summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit2/WebProcess/WebPage
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp28
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp34
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.h30
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp190
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h21
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp239
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h123
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp10
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebInspector.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp144
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h33
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in17
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm187
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm29
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm128
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp65
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp17
28 files changed, 493 insertions, 843 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
index f5100aa..ed40063 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp
@@ -38,8 +38,8 @@ using namespace WebCore;
namespace WebKit {
-ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage)
- : DrawingArea(DrawingAreaInfo::ChunkedUpdate, identifier, webPage)
+ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea(WebPage* webPage)
+ : DrawingArea(DrawingAreaTypeChunkedUpdate, webPage)
, m_isWaitingForUpdate(false)
, m_paintingIsSuspended(false)
, m_displayTimer(WebProcess::shared().runLoop(), this, &ChunkedUpdateDrawingArea::display)
@@ -74,15 +74,9 @@ void ChunkedUpdateDrawingArea::display()
if (m_dirtyRect.isEmpty())
return;
- // Laying out the page can cause the drawing area to change so we keep an extra reference.
- RefPtr<ChunkedUpdateDrawingArea> protect(this);
-
// Layout if necessary.
m_webPage->layoutIfNeeded();
- if (m_webPage->drawingArea() != this)
- return;
-
IntRect dirtyRect = m_dirtyRect;
m_dirtyRect = IntRect();
@@ -126,15 +120,9 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize)
// We don't want to wait for an update until we display.
m_isWaitingForUpdate = false;
- // Laying out the page can cause the drawing area to change so we keep an extra reference.
- RefPtr<ChunkedUpdateDrawingArea> protect(this);
-
m_webPage->setSize(viewSize);
m_webPage->layoutIfNeeded();
- if (m_webPage->drawingArea() != this)
- return;
-
if (m_paintingIsSuspended) {
ASSERT(!m_displayTimer.isActive());
@@ -160,7 +148,7 @@ void ChunkedUpdateDrawingArea::suspendPainting()
m_displayTimer.stop();
}
-void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint)
+void ChunkedUpdateDrawingArea::deprecatedResumePainting(bool forceRepaint)
{
ASSERT(m_paintingIsSuspended);
@@ -185,14 +173,6 @@ void ChunkedUpdateDrawingArea::didUpdate()
void ChunkedUpdateDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
- DrawingAreaInfo::Identifier targetIdentifier;
- if (!arguments->decode(CoreIPC::Out(targetIdentifier)))
- return;
-
- // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it.
- if (targetIdentifier != info().identifier)
- return;
-
switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) {
case DrawingAreaLegacyMessage::SetSize: {
IntSize size;
@@ -212,7 +192,7 @@ void ChunkedUpdateDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::
if (!arguments->decode(CoreIPC::Out(forceRepaint)))
return;
- resumePainting(forceRepaint);
+ deprecatedResumePainting(forceRepaint);
break;
}
case DrawingAreaLegacyMessage::DidUpdate:
diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
index d32ed4c..5798ef6 100644
--- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h
@@ -36,7 +36,7 @@ class UpdateChunk;
class ChunkedUpdateDrawingArea : public DrawingArea {
public:
- ChunkedUpdateDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage*);
+ explicit ChunkedUpdateDrawingArea(WebPage*);
virtual ~ChunkedUpdateDrawingArea();
virtual void setNeedsDisplay(const WebCore::IntRect&);
@@ -45,8 +45,6 @@ public:
virtual void forceRepaint();
#if USE(ACCELERATED_COMPOSITING)
- virtual void attachCompositingContext() { }
- virtual void detachCompositingContext() { }
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) { }
virtual void scheduleCompositingLayerSync() { }
virtual void syncCompositingLayers() { }
@@ -60,7 +58,7 @@ private:
// CoreIPC message handlers.
void setSize(const WebCore::IntSize& viewSize);
void suspendPainting();
- void resumePainting(bool forceRepaint);
+ void deprecatedResumePainting(bool forceRepaint);
void didUpdate();
// Platform overrides
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
index 10a8dbf..c808b19 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
@@ -33,10 +33,6 @@
#include "DrawingAreaImpl.h"
#endif
-#if USE(ACCELERATED_COMPOSITING)
-#include "LayerBackedDrawingArea.h"
-#endif
-
#if ENABLE(TILED_BACKING_STORE)
#include "TiledDrawingArea.h"
#endif
@@ -45,37 +41,29 @@
namespace WebKit {
-PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreationParameters& parameters)
+PassOwnPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
- switch (parameters.drawingAreaInfo.type) {
- case DrawingAreaInfo::None:
- ASSERT_NOT_REACHED();
- break;
-
- case DrawingAreaInfo::Impl:
+ switch (parameters.drawingAreaType) {
+ case DrawingAreaTypeImpl:
#if PLATFORM(MAC) || PLATFORM(WIN)
- return DrawingAreaImpl::create(webPage, parameters);
+ return DrawingAreaImpl::create(webPage, parameters);
#else
- return 0;
+ return 0;
#endif
- case DrawingAreaInfo::ChunkedUpdate:
- return adoptRef(new ChunkedUpdateDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
+ case DrawingAreaTypeChunkedUpdate:
+ return adoptPtr(new ChunkedUpdateDrawingArea(webPage));
-#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
- case DrawingAreaInfo::LayerBacked:
- return adoptRef(new LayerBackedDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
-#endif
#if ENABLE(TILED_BACKING_STORE)
- case DrawingAreaInfo::Tiled:
- return adoptRef(new TiledDrawingArea(parameters.drawingAreaInfo.identifier, webPage));
+ case DrawingAreaTypeTiled:
+ return adoptPtr(new TiledDrawingArea(webPage));
#endif
}
return 0;
}
-DrawingArea::DrawingArea(DrawingAreaInfo::Type type, DrawingAreaInfo::Identifier identifier, WebPage* webPage)
- : m_info(type, identifier)
+DrawingArea::DrawingArea(DrawingAreaType type, WebPage* webPage)
+ : m_type(type)
, m_webPage(webPage)
{
}
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
index de256b6..940e40e 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
@@ -28,13 +28,17 @@
#include "DrawingAreaInfo.h"
#include <WebCore/IntRect.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
namespace WebCore {
-#if USE(ACCELERATED_COMPOSITING)
class GraphicsLayer;
-#endif
}
namespace WebKit {
@@ -42,10 +46,11 @@ namespace WebKit {
class WebPage;
struct WebPageCreationParameters;
-class DrawingArea : public RefCounted<DrawingArea> {
+class DrawingArea {
+ WTF_MAKE_NONCOPYABLE(DrawingArea);
+
public:
- // FIXME: It might make sense to move this create function into a factory style class.
- static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
+ static PassOwnPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingArea();
#if PLATFORM(MAC) || PLATFORM(WIN)
@@ -57,7 +62,6 @@ public:
// FIXME: These should be pure virtual.
virtual void pageBackgroundTransparencyChanged() { }
- virtual void onPageClose() { }
virtual void forceRepaint() { }
virtual void didInstallPageOverlay() { }
@@ -65,8 +69,6 @@ public:
virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { }
#if USE(ACCELERATED_COMPOSITING)
- virtual void attachCompositingContext() = 0;
- virtual void detachCompositingContext() = 0;
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
virtual void scheduleCompositingLayerSync() = 0;
virtual void syncCompositingLayers() = 0;
@@ -74,18 +76,16 @@ public:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
- const DrawingAreaInfo& info() const { return m_info; }
-
protected:
- DrawingArea(DrawingAreaInfo::Type, DrawingAreaInfo::Identifier, WebPage*);
+ DrawingArea(DrawingAreaType, WebPage*);
- DrawingAreaInfo m_info;
+ DrawingAreaType m_type;
WebPage* m_webPage;
private:
// CoreIPC message handlers.
// FIXME: These should be pure virtual.
- virtual void setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
+ virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, 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 ec09e18..30186f2 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, WebCore::IntSize scrollOffset)
+ UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, 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 6d65fae..0a18256 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -34,6 +34,8 @@
#include "WebPageCreationParameters.h"
#include "WebProcess.h"
#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+#include <WebCore/Settings.h>
#if !PLATFORM(MAC) && !PLATFORM(WIN)
#error "This drawing area is not ready for use by other ports yet."
@@ -43,15 +45,9 @@ using namespace WebCore;
namespace WebKit {
-static uint64_t generateSequenceNumber()
+PassOwnPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters)
{
- static uint64_t sequenceNumber;
- return ++sequenceNumber;
-}
-
-PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters)
-{
- return adoptRef(new DrawingAreaImpl(webPage, parameters));
+ return adoptPtr(new DrawingAreaImpl(webPage, parameters));
}
DrawingAreaImpl::~DrawingAreaImpl()
@@ -61,13 +57,21 @@ DrawingAreaImpl::~DrawingAreaImpl()
}
DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)
- : DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage)
- , m_inSetSize(false)
+ : DrawingArea(DrawingAreaTypeImpl, webPage)
+ , m_backingStoreStateID(0)
+ , m_inUpdateBackingStoreState(false)
+ , m_shouldSendDidUpdateBackingStoreState(false)
, m_isWaitingForDidUpdate(false)
, m_isPaintingSuspended(!parameters.isVisible)
+ , m_alwaysUseCompositing(false)
, m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
, m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
{
+ if (webPage->corePage()->settings()->acceleratedDrawingEnabled())
+ m_alwaysUseCompositing = true;
+
+ if (m_alwaysUseCompositing)
+ enterAcceleratedCompositingMode(0);
}
void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
@@ -142,6 +146,15 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff
void DrawingAreaImpl::forceRepaint()
{
+ setNeedsDisplay(m_webPage->bounds());
+
+ m_webPage->layoutIfNeeded();
+
+ if (m_layerTreeHost) {
+ m_layerTreeHost->forceRepaint();
+ return;
+ }
+
m_isWaitingForDidUpdate = false;
display();
}
@@ -170,12 +183,21 @@ void DrawingAreaImpl::setPageOverlayNeedsDisplay(const IntRect& rect)
setNeedsDisplay(rect);
}
-void DrawingAreaImpl::attachCompositingContext()
+void DrawingAreaImpl::layerHostDidFlushLayers()
{
-}
+ ASSERT(m_layerTreeHost);
-void DrawingAreaImpl::detachCompositingContext()
-{
+ m_layerTreeHost->forceRepaint();
+
+ if (m_shouldSendDidUpdateBackingStoreState) {
+ sendDidUpdateBackingStoreState();
+ return;
+ }
+
+ if (!m_layerTreeHost)
+ return;
+
+ m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(m_backingStoreStateID, m_layerTreeHost->layerTreeContext()));
}
void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
@@ -191,9 +213,17 @@ void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* 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();
+ m_layerTreeHost->setRootCompositingLayer(0);
+ if (!m_alwaysUseCompositing) {
+ // We'll exit accelerated compositing mode on a timer, to avoid re-entering
+ // compositing code via display() and layout.
+ // If we're leaving compositing mode because of a setSize, it is safe to
+ // exit accelerated compositing mode right away.
+ if (m_inUpdateBackingStoreState)
+ exitAcceleratedCompositingMode();
+ else
+ exitAcceleratedCompositingModeSoon();
+ }
}
}
}
@@ -213,39 +243,74 @@ void DrawingAreaImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID
{
}
-void DrawingAreaImpl::setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
+void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
{
- ASSERT(!m_inSetSize);
- m_inSetSize = true;
+ ASSERT(!m_inUpdateBackingStoreState);
+ m_inUpdateBackingStoreState = true;
+
+ ASSERT_ARG(stateID, stateID >= m_backingStoreStateID);
+ if (stateID != m_backingStoreStateID) {
+ m_backingStoreStateID = stateID;
+ m_shouldSendDidUpdateBackingStoreState = true;
+
+ m_webPage->setSize(size);
+ m_webPage->layoutIfNeeded();
+ m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
+
+ if (m_layerTreeHost)
+ m_layerTreeHost->sizeDidChange(size);
+ else
+ m_dirtyRegion = m_webPage->bounds();
+ } else {
+ ASSERT(size == m_webPage->size());
+ if (!m_shouldSendDidUpdateBackingStoreState) {
+ // We've already sent a DidUpdateBackingStoreState message for this state. We have nothing more to do.
+ m_inUpdateBackingStoreState = false;
+ return;
+ }
+ }
- // Set this to false since we're about to call display().
+ // The UI process has updated to a new backing store state. Any Update messages we sent before
+ // this point will be ignored. We wait to set this to false until after updating the page's
+ // size so that any displays triggered by the relayout will be ignored. If we're supposed to
+ // respond to the UpdateBackingStoreState message immediately, we'll do a display anyway in
+ // sendDidUpdateBackingStoreState; otherwise we shouldn't do one right now.
m_isWaitingForDidUpdate = false;
- m_webPage->setSize(size);
- m_webPage->layoutIfNeeded();
- m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
+ if (respondImmediately)
+ sendDidUpdateBackingStoreState();
+
+ m_inUpdateBackingStoreState = false;
+}
+
+void DrawingAreaImpl::sendDidUpdateBackingStoreState()
+{
+ ASSERT(!m_isWaitingForDidUpdate);
+ ASSERT(m_shouldSendDidUpdateBackingStoreState);
+
+ m_shouldSendDidUpdateBackingStoreState = false;
UpdateInfo updateInfo;
LayerTreeContext layerTreeContext;
- if (m_layerTreeHost) {
- m_layerTreeHost->sizeDidChange(size);
- layerTreeContext = m_layerTreeHost->layerTreeContext();
- }
+ if (!m_isPaintingSuspended && !m_layerTreeHost)
+ display(updateInfo);
- if (m_isPaintingSuspended || m_layerTreeHost)
+ if (m_isPaintingSuspended || m_layerTreeHost) {
updateInfo.viewSize = m_webPage->size();
- 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);
- }
+ if (m_layerTreeHost) {
+ layerTreeContext = m_layerTreeHost->layerTreeContext();
- m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(generateSequenceNumber(), updateInfo, layerTreeContext));
+ // We don't want the layer tree host to notify after the next scheduled
+ // layer flush because that might end up sending an EnterAcceleratedCompositingMode
+ // message back to the UI process, but the updated layer tree context
+ // will be sent back in the DidUpdateBackingStoreState message.
+ m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(false);
+ }
+ }
- m_inSetSize = false;
+ m_webPage->send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
}
void DrawingAreaImpl::didUpdate()
@@ -286,6 +351,9 @@ void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLay
ASSERT(!m_layerTreeHost);
m_layerTreeHost = LayerTreeHost::create(m_webPage);
+ if (!m_inUpdateBackingStoreState)
+ m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(true);
+
m_layerTreeHost->setRootCompositingLayer(graphicsLayer);
// Non-composited content will now be handled exclusively by the layer tree host.
@@ -294,35 +362,38 @@ void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLay
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()
{
+ if (m_alwaysUseCompositing)
+ return;
+
m_exitCompositingTimer.stop();
ASSERT(m_layerTreeHost);
m_layerTreeHost->invalidate();
m_layerTreeHost = nullptr;
+ m_dirtyRegion = m_webPage->bounds();
+
+ if (m_inUpdateBackingStoreState)
+ return;
- if (m_inSetSize)
+ if (m_shouldSendDidUpdateBackingStoreState) {
+ sendDidUpdateBackingStoreState();
return;
+ }
UpdateInfo updateInfo;
if (m_isPaintingSuspended)
updateInfo.viewSize = m_webPage->size();
- else {
- m_dirtyRegion = m_webPage->bounds();
+ else
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));
+ m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo));
}
void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
@@ -354,6 +425,7 @@ void DrawingAreaImpl::display()
{
ASSERT(!m_layerTreeHost);
ASSERT(!m_isWaitingForDidUpdate);
+ ASSERT(!m_inUpdateBackingStoreState);
if (m_isPaintingSuspended)
return;
@@ -361,6 +433,11 @@ void DrawingAreaImpl::display()
if (m_dirtyRegion.isEmpty())
return;
+ if (m_shouldSendDidUpdateBackingStoreState) {
+ sendDidUpdateBackingStoreState();
+ return;
+ }
+
UpdateInfo updateInfo;
display(updateInfo);
@@ -370,7 +447,7 @@ void DrawingAreaImpl::display()
return;
}
- m_webPage->send(Messages::DrawingAreaProxy::Update(generateSequenceNumber(), updateInfo));
+ m_webPage->send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo));
m_isWaitingForDidUpdate = true;
}
@@ -405,7 +482,20 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
if (m_webPage->mainFrameHasCustomRepresentation())
return;
+ m_webPage->layoutIfNeeded();
+
+ // The layout may have put the page into accelerated compositing mode, in which case the
+ // LayerTreeHost is now in charge of displaying.
+ if (m_layerTreeHost)
+ return;
+
IntRect bounds = m_dirtyRegion.bounds();
+ ASSERT(m_webPage->bounds().contains(bounds));
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
+ if (!bitmap->createHandle(updateInfo.bitmapHandle))
+ return;
+
Vector<IntRect> rects = m_dirtyRegion.rects();
if (shouldPaintBoundsRect(bounds, rects)) {
@@ -419,14 +509,8 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
m_dirtyRegion = Region();
m_scrollRect = IntRect();
m_scrollOffset = IntSize();
-
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
- if (!bitmap->createHandle(updateInfo.bitmapHandle))
- return;
OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
-
- m_webPage->layoutIfNeeded();
updateInfo.viewSize = m_webPage->size();
updateInfo.updateRectBounds = bounds;
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index cbb94c2..8d85200 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -37,9 +37,11 @@ class UpdateInfo;
class DrawingAreaImpl : public DrawingArea {
public:
- static PassRefPtr<DrawingAreaImpl> create(WebPage*, const WebPageCreationParameters&);
+ static PassOwnPtr<DrawingAreaImpl> create(WebPage*, const WebPageCreationParameters&);
virtual ~DrawingAreaImpl();
+ void layerHostDidFlushLayers();
+
private:
DrawingAreaImpl(WebPage*, const WebPageCreationParameters&);
@@ -52,19 +54,19 @@ private:
virtual void didUninstallPageOverlay();
virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
- virtual void attachCompositingContext();
- virtual void detachCompositingContext();
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
virtual void scheduleCompositingLayerSync();
virtual void syncCompositingLayers();
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
// CoreIPC message handlers.
- virtual void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
+ virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
virtual void didUpdate();
virtual void suspendPainting();
virtual void resumePainting();
+ void sendDidUpdateBackingStoreState();
+
void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
void exitAcceleratedCompositingModeSoon();
void exitAcceleratedCompositingMode();
@@ -73,12 +75,18 @@ private:
void display();
void display(UpdateInfo&);
+ uint64_t m_backingStoreStateID;
+
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 currently processing an UpdateBackingStoreState message.
+ bool m_inUpdateBackingStoreState;
+
+ // When true, we should send an UpdateBackingStoreState message instead of any other messages
+ // we normally send to the UI process.
+ bool m_shouldSendDidUpdateBackingStoreState;
// 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.
@@ -87,6 +95,7 @@ private:
// Whether painting is suspended. We'll still keep track of the dirty region but we
// won't paint until painting has resumed again.
bool m_isPaintingSuspended;
+ bool m_alwaysUseCompositing;
RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
deleted file mode 100644
index 44b3bd6..0000000
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2010 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 "LayerBackedDrawingArea.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "DrawingAreaMessageKinds.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include "MessageID.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
-#include <WebCore/Settings.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-LayerBackedDrawingArea::LayerBackedDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage)
- : DrawingArea(DrawingAreaInfo::LayerBacked, identifier, webPage)
- , m_syncTimer(WebProcess::shared().runLoop(), this, &LayerBackedDrawingArea::syncCompositingLayers)
- , m_attached(false)
- , m_shouldPaint(true)
-{
- m_hostingLayer = GraphicsLayer::create(this);
- m_hostingLayer->setDrawsContent(false);
-#ifndef NDEBUG
- m_hostingLayer->setName("DrawingArea hosting layer");
-#endif
- m_hostingLayer->setSize(webPage->size());
- m_backingLayer = GraphicsLayer::create(this);
- m_backingLayer->setDrawsContent(true);
- m_backingLayer->setContentsOpaque(webPage->drawsBackground() && !webPage->drawsTransparentBackground());
-
-#ifndef NDEBUG
- m_backingLayer->setName("DrawingArea backing layer");
-#endif
- m_backingLayer->setSize(webPage->size());
- m_hostingLayer->addChild(m_backingLayer.get());
- platformInit();
-}
-
-LayerBackedDrawingArea::~LayerBackedDrawingArea()
-{
- platformClear();
-}
-
-void LayerBackedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
-{
- // FIXME: Do something much smarter.
- setNeedsDisplay(scrollRect);
-}
-
-void LayerBackedDrawingArea::setNeedsDisplay(const IntRect& rect)
-{
- m_backingLayer->setNeedsDisplayInRect(rect);
- scheduleCompositingLayerSync();
-}
-
-void LayerBackedDrawingArea::display()
-{
- // Laying out the page can cause the drawing area to change so we keep an extra reference.
- RefPtr<LayerBackedDrawingArea> protect(this);
-
- // Layout if necessary.
- m_webPage->layoutIfNeeded();
-
- if (m_webPage->drawingArea() != this)
- return;
-}
-
-void LayerBackedDrawingArea::pageBackgroundTransparencyChanged()
-{
- m_backingLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
-}
-
-void LayerBackedDrawingArea::scheduleDisplay()
-{
-}
-
-void LayerBackedDrawingArea::setSize(const IntSize& viewSize)
-{
- ASSERT(m_shouldPaint);
- ASSERT_ARG(viewSize, !viewSize.isEmpty());
-
- m_hostingLayer->setSize(viewSize);
- m_backingLayer->setSize(viewSize);
- scheduleCompositingLayerSync();
-
- // Laying out the page can cause the drawing area to change so we keep an extra reference.
- RefPtr<LayerBackedDrawingArea> protect(this);
-
- m_webPage->setSize(viewSize);
- m_webPage->layoutIfNeeded();
-
- if (m_webPage->drawingArea() != this)
- return;
-
- WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize));
-}
-
-void LayerBackedDrawingArea::suspendPainting()
-{
- ASSERT(m_shouldPaint);
-
- m_shouldPaint = false;
-}
-
-void LayerBackedDrawingArea::resumePainting()
-{
- ASSERT(!m_shouldPaint);
-
- m_shouldPaint = true;
-
- // Display if needed.
- display();
-}
-
-void LayerBackedDrawingArea::didUpdate()
-{
- // Display if needed.
- display();
-}
-
-void LayerBackedDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
-{
- DrawingAreaInfo::Identifier targetIdentifier;
- if (!arguments->decode(CoreIPC::Out(targetIdentifier)))
- return;
-
- // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it.
- if (targetIdentifier != info().identifier)
- return;
-
- switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) {
- case DrawingAreaLegacyMessage::SetSize: {
- IntSize size;
- if (!arguments->decode(CoreIPC::Out(size)))
- return;
-
- setSize(size);
- break;
- }
-
- case DrawingAreaLegacyMessage::SuspendPainting:
- suspendPainting();
- break;
-
- case DrawingAreaLegacyMessage::ResumePainting:
- resumePainting();
- break;
-
- case DrawingAreaLegacyMessage::DidUpdate:
- didUpdate();
- break;
-
- default:
- ASSERT_NOT_REACHED();
- break;
- }
-}
-
-// GraphicsLayerClient methods
-void LayerBackedDrawingArea::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& inClip)
-{
- m_webPage->drawRect(graphicsContext, inClip);
-}
-
-bool LayerBackedDrawingArea::showDebugBorders() const
-{
- return m_webPage->corePage()->settings()->showDebugBorders();
-}
-
-bool LayerBackedDrawingArea::showRepaintCounter() const
-{
- return m_webPage->corePage()->settings()->showRepaintCounter();
-}
-
-#if !PLATFORM(MAC) && !PLATFORM(WIN)
-void LayerBackedDrawingArea::attachCompositingContext(GraphicsLayer*)
-{
-}
-
-void LayerBackedDrawingArea::detachCompositingContext()
-{
-}
-
-#if !PLATFORM(MAC)
-void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer*)
-{
-}
-#endif
-
-void LayerBackedDrawingArea::scheduleCompositingLayerSync()
-{
-}
-
-void LayerBackedDrawingArea::syncCompositingLayers()
-{
-}
-
-void LayerBackedDrawingArea::platformInit()
-{
-}
-
-void LayerBackedDrawingArea::platformClear()
-{
-}
-#endif
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
deleted file mode 100644
index 400c8c5..0000000
--- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2010 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 LayerBackedDrawingArea_h
-#define LayerBackedDrawingArea_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "DrawingArea.h"
-#include "RunLoop.h"
-#include <WebCore/IntPoint.h>
-#include <WebCore/GraphicsLayerClient.h>
-
-#if PLATFORM(MAC)
-#include <wtf/RetainPtr.h>
-OBJC_CLASS NSPopUpButtonCell;
-OBJC_CLASS WKView;
-typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
-#endif
-
-namespace WebCore {
- class GraphicsContext;
- class GraphicsLayer;
-}
-
-namespace WebKit {
-
-class LayerBackedDrawingArea : public DrawingArea, private WebCore::GraphicsLayerClient {
-public:
- LayerBackedDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage*);
- virtual ~LayerBackedDrawingArea();
-
- virtual void setNeedsDisplay(const WebCore::IntRect&);
- virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
- virtual void display();
-
- virtual void pageBackgroundTransparencyChanged();
-
- virtual void attachCompositingContext();
- virtual void detachCompositingContext();
- virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
- virtual void scheduleCompositingLayerSync();
- virtual void syncCompositingLayers();
-
- virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
-private:
-
- // GraphicsLayerClient
- virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double /*time*/) { }
- virtual void notifySyncRequired(const WebCore::GraphicsLayer*) { }
-public:
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip);
-private:
- virtual bool showDebugBorders() const;
- virtual bool showRepaintCounter() const;
-
-#if PLATFORM(MAC)
- virtual void onPageClose();
-#endif
-
- void scheduleDisplay();
-
- // CoreIPC message handlers.
- void setSize(const WebCore::IntSize& viewSize);
- void suspendPainting();
- void resumePainting();
- void didUpdate();
-
- void platformInit();
- void platformClear();
-
-#if PLATFORM(MAC)
- void setUpUpdateLayoutRunLoopObserver();
- void scheduleUpdateLayoutRunLoopObserver();
- void removeUpdateLayoutRunLoopObserver();
-
- static void updateLayoutRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
- void updateLayoutRunLoopObserverFired();
-#endif
-
- RunLoop::Timer<LayerBackedDrawingArea> m_syncTimer;
-
- OwnPtr<WebCore::GraphicsLayer> m_hostingLayer;
- OwnPtr<WebCore::GraphicsLayer> m_backingLayer;
-#if PLATFORM(MAC)
-#if HAVE(HOSTED_CORE_ANIMATION)
- RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerRef;
-#endif
- RetainPtr<CFRunLoopObserverRef> m_updateLayoutRunLoopObserver;
-#endif
-
- bool m_attached;
- bool m_shouldPaint;
-};
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // LayerBackedDrawingArea_h
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
index 4ca1137..bbb94e8 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
@@ -47,11 +47,13 @@ public:
virtual const LayerTreeContext& layerTreeContext() = 0;
virtual void scheduleLayerFlush() = 0;
+ virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) = 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 forceRepaint() = 0;
virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
virtual void didInstallPageOverlay() = 0;
diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
index f27f14f..5997564 100644
--- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
@@ -43,8 +43,8 @@ using namespace WebCore;
namespace WebKit {
-TiledDrawingArea::TiledDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage)
- : DrawingArea(DrawingAreaInfo::Tiled, identifier, webPage)
+TiledDrawingArea::TiledDrawingArea(WebPage* webPage)
+ : DrawingArea(DrawingAreaTypeTiled, webPage)
, m_isWaitingForUpdate(false)
, m_shouldPaint(true)
, m_displayTimer(WebProcess::shared().runLoop(), this, &TiledDrawingArea::display)
diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h
index 7b682ca..3572c9f 100644
--- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h
@@ -30,7 +30,6 @@
#include "DrawingArea.h"
#include "RunLoop.h"
-#include <WebCore/IntPoint.h>
#include <WebCore/IntRect.h>
#include <wtf/Vector.h>
@@ -40,7 +39,7 @@ class UpdateChunk;
class TiledDrawingArea : public DrawingArea {
public:
- TiledDrawingArea(DrawingAreaInfo::Identifier, WebPage*);
+ explicit TiledDrawingArea(WebPage*);
virtual ~TiledDrawingArea();
virtual void setNeedsDisplay(const WebCore::IntRect&);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
index 7b958bf..02688c5 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
@@ -51,13 +51,13 @@ typedef HashMap<RefPtr<HistoryItem>, uint64_t> HistoryItemToIDMap;
static IDToHistoryItemMap& idToHistoryItemMap()
{
- static IDToHistoryItemMap map;
+ DEFINE_STATIC_LOCAL(IDToHistoryItemMap, map, ());
return map;
}
static HistoryItemToIDMap& historyItemToIDMap()
{
- static HistoryItemToIDMap map;
+ DEFINE_STATIC_LOCAL(HistoryItemToIDMap, map, ());
return map;
}
@@ -118,6 +118,12 @@ HistoryItem* WebBackForwardListProxy::itemForID(uint64_t itemID)
return idToHistoryItemMap().get(itemID).get();
}
+uint64_t WebBackForwardListProxy::idForItem(HistoryItem* item)
+{
+ ASSERT(item);
+ return historyItemToIDMap().get(item);
+}
+
void WebBackForwardListProxy::removeItem(uint64_t itemID)
{
IDToHistoryItemMap::iterator it = idToHistoryItemMap().find(itemID);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
index be28739..00ef8f6 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
@@ -38,6 +38,7 @@ public:
static PassRefPtr<WebBackForwardListProxy> create(WebPage* page) { return adoptRef(new WebBackForwardListProxy(page)); }
static WebCore::HistoryItem* itemForID(uint64_t);
+ static uint64_t idForItem(WebCore::HistoryItem*);
static void removeItem(uint64_t itemID);
static void addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem>);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
index 4b3fdaf..58ae5ea 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
@@ -86,6 +86,11 @@ void WebInspector::didClose()
WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID());
}
+void WebInspector::inspectedURLChanged(const String& urlString)
+{
+ WebProcess::shared().connection()->send(Messages::WebInspectorProxy::InspectedURLChanged(urlString), m_page->pageID());
+}
+
// Called by WebInspector messages
void WebInspector::show()
{
diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
index 517ae8e..6b1c77a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h
@@ -73,6 +73,7 @@ private:
// Called from WebInspectorFrontendClient
void didLoadInspectorPage();
void didClose();
+ void inspectedURLChanged(const String&);
// Implemented in platform WebInspector file
String localizedStringsURL() const;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 462d352..ff567bd 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -91,6 +91,7 @@
#include <WebCore/RenderView.h>
#include <WebCore/ReplaceSelectionCommand.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/SerializedScriptValue.h>
#include <WebCore/Settings.h>
#include <WebCore/SharedBuffer.h>
#include <WebCore/SubstituteData.h>
@@ -99,6 +100,9 @@
#include <runtime/JSLock.h>
#include <runtime/JSValue.h>
+#include <WebCore/Range.h>
+#include <WebCore/VisiblePosition.h>
+
#if PLATFORM(MAC) || PLATFORM(WIN)
#include <WebCore/LegacyWebArchive.h>
#endif
@@ -151,8 +155,11 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_findController(this)
, m_geolocationPermissionRequestManager(this)
, m_pageID(pageID)
+ , m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
, m_canRunModal(parameters.canRunModal)
, m_isRunningModal(false)
+ , m_cachedMainFrameIsPinnedToLeftSide(false)
+ , m_cachedMainFrameIsPinnedToRightSide(false)
{
ASSERT(m_pageID);
@@ -184,7 +191,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
m_page->setGroupName(m_pageGroup->identifier());
platformInitialize();
- Settings::setMinDOMTimerInterval(0.004);
+ Settings::setDefaultMinDOMTimerInterval(0.004);
m_drawingArea = DrawingArea::create(this, parameters);
m_mainFrame = WebFrame::createMainFrame(this);
@@ -192,6 +199,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
setDrawsBackground(parameters.drawsBackground);
setDrawsTransparentBackground(parameters.drawsTransparentBackground);
+ setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
+
setActive(parameters.isActive);
setFocused(parameters.isFocused);
setIsInWindow(parameters.isInWindow);
@@ -319,45 +328,13 @@ void WebPage::clearMainFrameName()
}
#if USE(ACCELERATED_COMPOSITING)
-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
- // drawing area types.
- DrawingAreaInfo newDrawingAreaInfo;
-
- if (!sendSync(Messages::WebPageProxy::DidChangeAcceleratedCompositing(compositing), Messages::WebPageProxy::DidChangeAcceleratedCompositing::Reply(newDrawingAreaInfo)))
- return;
-
- if (newDrawingAreaInfo.type != drawingArea()->info().type) {
- m_drawingArea = 0;
- if (newDrawingAreaInfo.type != DrawingAreaInfo::None) {
- WebPageCreationParameters parameters;
- parameters.drawingAreaInfo = newDrawingAreaInfo;
- m_drawingArea = DrawingArea::create(this, parameters);
- m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
- }
- }
-}
-
void WebPage::enterAcceleratedCompositingMode(GraphicsLayer* layer)
{
- changeAcceleratedCompositingMode(layer);
m_drawingArea->setRootCompositingLayer(layer);
}
void WebPage::exitAcceleratedCompositingMode()
{
- changeAcceleratedCompositingMode(0);
m_drawingArea->setRootCompositingLayer(0);
}
#endif
@@ -393,15 +370,16 @@ void WebPage::close()
m_mainFrame->coreFrame()->loader()->detachFromParent();
m_page.clear();
- m_drawingArea->onPageClose();
m_drawingArea.clear();
+ bool isRunningModal = m_isRunningModal;
+ m_isRunningModal = false;
+
+ // The WebPage can be destroyed by this call.
WebProcess::shared().removeWebPage(m_pageID);
- if (m_isRunningModal) {
- m_isRunningModal = false;
+ if (isRunningModal)
WebProcess::shared().runLoop()->stop();
- }
}
void WebPage::tryClose()
@@ -482,25 +460,34 @@ void WebPage::reload(bool reloadFromOrigin)
void WebPage::goForward(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
- m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
-
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
+ ASSERT(item);
+ if (!item)
+ return;
+
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
m_page->goToItem(item, FrameLoadTypeForward);
}
void WebPage::goBack(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
- m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
-
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
+ ASSERT(item);
+ if (!item)
+ return;
+
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
m_page->goToItem(item, FrameLoadTypeBack);
}
void WebPage::goToBackForwardItem(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle)
{
- m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
-
HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID);
+ ASSERT(item);
+ if (!item)
+ return;
+
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
m_page->goToItem(item, FrameLoadTypeIndexedBackForward);
}
@@ -603,10 +590,6 @@ void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
graphicsContext.clip(rect);
m_mainFrame->coreFrame()->view()->paint(&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)
@@ -999,7 +982,7 @@ void WebPage::gestureEvent(const WebGestureEvent& gestureEvent)
}
#endif
-void WebPage::validateMenuItem(const String& commandName)
+void WebPage::validateCommand(const String& commandName, uint64_t callbackID)
{
bool isEnabled = false;
int32_t state = 0;
@@ -1010,7 +993,7 @@ void WebPage::validateMenuItem(const String& commandName)
isEnabled = command.isSupported() && command.isEnabled();
}
- send(Messages::WebPageProxy::DidValidateMenuItem(commandName, isEnabled, state));
+ send(Messages::WebPageProxy::ValidateCommandCallback(commandName, isEnabled, state, callbackID));
}
void WebPage::executeEditCommand(const String& commandName)
@@ -1209,18 +1192,29 @@ IntRect WebPage::windowResizerRect() const
m_windowResizerSize.width(), m_windowResizerSize.height());
}
+KeyboardUIMode WebPage::keyboardUIMode()
+{
+ bool fullKeyboardAccessEnabled = WebProcess::shared().fullKeyboardAccessEnabled();
+ return static_cast<KeyboardUIMode>((fullKeyboardAccessEnabled ? KeyboardAccessFull : KeyboardAccessDefault) | (m_tabToLinks ? KeyboardAccessTabsToLinks : 0));
+}
+
void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID)
{
// NOTE: We need to be careful when running scripts that the objects we depend on don't
// disappear during script execution.
+ // Retain the SerializedScriptValue at this level so it (and the internal data) lives
+ // long enough for the DataReference to be encoded by the sent message.
+ RefPtr<SerializedScriptValue> serializedResultValue;
+ CoreIPC::DataReference dataReference;
+
JSLock lock(SilenceAssertionsOnly);
- JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue();
- String resultString;
- if (resultValue)
- resultString = ustringToString(resultValue.toString(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec()));
+ if (JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue()) {
+ if ((serializedResultValue = SerializedScriptValue::create(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec(), resultValue)))
+ dataReference = CoreIPC::DataReference(serializedResultValue->data().data(), serializedResultValue->data().size());
+ }
- send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
+ send(Messages::WebPageProxy::ScriptValueCallback(dataReference, callbackID));
}
void WebPage::getContentsAsString(uint64_t callbackID)
@@ -1291,7 +1285,7 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
#if PLATFORM(MAC) || PLATFORM(WIN)
RetainPtr<CFDataRef> data;
if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
- if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(frame->coreFrame())) {
+ if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(frame->coreFrame()->document())) {
if ((data = archive->rawDataRepresentation()))
dataReference = CoreIPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
}
@@ -1301,12 +1295,17 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
-void WebPage::forceRepaint(uint64_t callbackID)
+void WebPage::forceRepaintWithoutCallback()
{
m_drawingArea->forceRepaint();
+}
+
+void WebPage::forceRepaint(uint64_t callbackID)
+{
+ forceRepaintWithoutCallback();
send(Messages::WebPageProxy::VoidCallback(callbackID));
}
-
+
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
{
WebPreferencesStore::removeTestRunnerOverrides();
@@ -1363,8 +1362,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
#if PLATFORM(WIN)
// Temporarily turn off accelerated compositing until we have a good solution for rendering it.
settings->setAcceleratedCompositingEnabled(false);
+ settings->setAcceleratedDrawingEnabled(false);
#else
settings->setAcceleratedCompositingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedCompositingEnabledKey()));
+ settings->setAcceleratedDrawingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedDrawingEnabledKey()));
#endif
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
@@ -1664,9 +1665,9 @@ void WebPage::replaceSelectionWithText(Frame* frame, const String& text)
{
if (frame->selection()->isNone())
return;
-
+
RefPtr<DocumentFragment> textFragment = createFragmentFromText(frame->selection()->toNormalizedRange().get(), text);
- applyCommand(ReplaceSelectionCommand::create(frame->document(), textFragment.release(), true, false, true));
+ applyCommand(ReplaceSelectionCommand::create(frame->document(), textFragment.release(), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting));
frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
}
@@ -1675,6 +1676,23 @@ bool WebPage::mainFrameHasCustomRepresentation() const
return static_cast<WebFrameLoaderClient*>(mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation();
}
+void WebPage::didChangeScrollOffsetForMainFrame()
+{
+ Frame* frame = m_page->mainFrame();
+ IntPoint scrollPosition = frame->view()->scrollPosition();
+ IntPoint maximumScrollPosition = frame->view()->maximumScrollPosition();
+
+ bool isPinnedToLeftSide = (scrollPosition.x() <= 0);
+ bool isPinnedToRightSide = (scrollPosition.x() >= maximumScrollPosition.x());
+
+ if (isPinnedToLeftSide != m_cachedMainFrameIsPinnedToLeftSide || isPinnedToRightSide != m_cachedMainFrameIsPinnedToRightSide) {
+ send(Messages::WebPageProxy::DidChangeScrollOffsetPinningForMainFrame(isPinnedToLeftSide, isPinnedToRightSide));
+
+ m_cachedMainFrameIsPinnedToLeftSide = isPinnedToLeftSide;
+ m_cachedMainFrameIsPinnedToRightSide = isPinnedToRightSide;
+ }
+}
+
#if PLATFORM(MAC)
void WebPage::addPluginView(PluginView* pluginView)
@@ -1969,8 +1987,7 @@ void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printIn
send(Messages::WebPageProxy::ComputedPagesCallback(resultPageRects, resultTotalScaleFactorForPrinting, callbackID));
}
-#if PLATFORM(MAC)
-// FIXME: Find a better place for Mac specific code.
+#if PLATFORM(MAC) || PLATFORM(WIN)
void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint64_t callbackID)
{
WebFrame* frame = WebProcess::shared().webFrame(frameID);
@@ -2050,4 +2067,9 @@ void WebPage::runModal()
ASSERT(!m_isRunningModal);
}
+void WebPage::setMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
+{
+ m_page->setMemoryCacheClientCallsEnabled(memoryCacheMessagesEnabled);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index 89087b0..8ce6405 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -46,6 +46,7 @@
#include <WebCore/Editor.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/IntRect.h>
+#include <WebCore/WebCoreKeyboardUIMode.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
@@ -57,6 +58,7 @@
#endif
#if PLATFORM(MAC)
+#include "DictionaryPopupInfo.h"
#include <wtf/RetainPtr.h>
OBJC_CLASS AccessibilityWebPageObject;
#endif
@@ -72,6 +74,7 @@ namespace WebCore {
class KeyboardEvent;
class Page;
class PrintContext;
+ class Range;
class ResourceRequest;
class SharedBuffer;
}
@@ -151,7 +154,7 @@ public:
void show();
String userAgent() const { return m_userAgent; }
WebCore::IntRect windowResizerRect() const;
- bool tabsToLinks() const { return m_tabToLinks; }
+ WebCore::KeyboardUIMode keyboardUIMode();
WebEditCommand* webEditCommand(uint64_t);
void addWebEditCommand(uint64_t, WebEditCommand*);
@@ -215,7 +218,6 @@ public:
void setDefersLoading(bool deferLoading);
#if USE(ACCELERATED_COMPOSITING)
- void changeAcceleratedCompositingMode(WebCore::GraphicsLayer*);
void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
void exitAcceleratedCompositingMode();
#endif
@@ -294,6 +296,7 @@ public:
void getMarkedRange(uint64_t& location, uint64_t& length);
void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect);
+ void writeSelectionToPasteboard(const WTF::String& pasteboardName, const WTF::Vector<WTF::String>& pasteboardTypes, bool& result);
#elif PLATFORM(WIN)
void confirmComposition(const String& compositionString);
void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
@@ -306,6 +309,8 @@ public:
void dummy(bool&);
#if PLATFORM(MAC)
+ void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*);
+
bool isSpeaking();
void speak(const String&);
void stopSpeaking();
@@ -324,16 +329,27 @@ public:
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(WIN)
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;
+ void didChangeScrollOffsetForMainFrame();
+
+ bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
+ void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
+
bool canRunModal() const { return m_canRunModal; }
+ void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
+
void runModal();
+ void setMemoryCacheMessagesEnabled(bool);
+
+ void forceRepaintWithoutCallback();
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
@@ -369,7 +385,7 @@ private:
void setInitialFocus(bool);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
- void validateMenuItem(const String&);
+ void validateCommand(const String&, uint64_t);
void executeEditCommand(const String&);
void mouseEvent(const WebMouseEvent&);
@@ -412,6 +428,8 @@ private:
void setCustomTextEncodingName(const String&);
#if PLATFORM(MAC)
+ void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
+
void setWindowIsVisible(bool windowIsVisible);
void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
#endif
@@ -464,7 +482,7 @@ private:
String m_userAgent;
WebCore::IntSize m_viewSize;
- RefPtr<DrawingArea> m_drawingArea;
+ OwnPtr<DrawingArea> m_drawingArea;
bool m_drawsBackground;
bool m_drawsTransparentBackground;
@@ -531,8 +549,13 @@ private:
SandboxExtensionTracker m_sandboxExtensionTracker;
uint64_t m_pageID;
+ bool m_canRunBeforeUnloadConfirmPanel;
+
bool m_canRunModal;
bool m_isRunningModal;
+
+ bool m_cachedMainFrameIsPinnedToLeftSide;
+ bool m_cachedMainFrameIsPinnedToRightSide;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index e47a013..0c0eea5 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -70,10 +70,13 @@ messages -> WebPage {
GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
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)
+#if PLATFORM(MAC)
+ # Dictionary support.
+ PerformDictionaryLookupAtLocation(WebCore::FloatPoint point)
+#endif
+
PreferencesDidChange(WebKit::WebPreferencesStore store)
SetUserAgent(WTF::String userAgent)
@@ -87,7 +90,7 @@ messages -> WebPage {
Close()
TryClose()
- ValidateMenuItem(WTF::String name)
+ ValidateCommand(WTF::String name, uint64_t callbackID)
ExecuteEditCommand(WTF::String name)
DidRemoveEditCommand(uint64_t commandID)
@@ -153,15 +156,20 @@ messages -> WebPage {
BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo)
EndPrinting();
ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID)
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(WIN)
DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect, uint64_t callbackID)
DrawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID)
#endif
+ SetMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
+
// FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
// any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
Dummy() -> (bool dummyReturn)
+ SetCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel)
+ SetCanRunModal(bool canRunModal)
+
#if PLATFORM(MAC)
# Complex text input support for plug-ins.
SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput)
@@ -172,6 +180,7 @@ messages -> WebPage {
CharacterIndexForPoint(WebCore::IntPoint point) -> (uint64_t result)
FirstRectForCharacterRange(uint64_t location, uint64_t length) -> (WebCore::IntRect resultRect)
RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken)
+ WriteSelectionToPasteboard(WTF::String pasteboardName, WTF::Vector<WTF::String> pasteboardTypes) -> (bool result)
#endif
#if PLATFORM(WIN)
ConfirmComposition(WTF::String compositionString)
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
index 36bde01..e00e437 100644
--- a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
@@ -29,11 +29,9 @@
#if ENABLE(INSPECTOR)
+#include <WebCore/NotImplemented.h>
#include <wtf/text/WTFString.h>
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
-
namespace WebKit {
String WebInspector::localizedStringsURL() const
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
deleted file mode 100644
index 25a1dfd..0000000
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2010 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 "LayerBackedDrawingArea.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#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;
-
-namespace WebKit {
-
-void LayerBackedDrawingArea::platformInit()
-{
- setUpUpdateLayoutRunLoopObserver();
-
- [m_hostingLayer->platformLayer() setGeometryFlipped:YES];
-#if HAVE(HOSTED_CORE_ANIMATION)
- attachCompositingContext();
-#endif
-
- scheduleCompositingLayerSync();
-}
-
-void LayerBackedDrawingArea::platformClear()
-{
- if (!m_attached)
- return;
-
- if (m_updateLayoutRunLoopObserver) {
- CFRunLoopObserverInvalidate(m_updateLayoutRunLoopObserver.get());
- m_updateLayoutRunLoopObserver = 0;
- }
-
-#if HAVE(HOSTED_CORE_ANIMATION)
- WKCARemoteLayerClientInvalidate(m_remoteLayerRef.get());
- m_remoteLayerRef = nullptr;
-#endif
-
- m_attached = false;
-}
-
-void LayerBackedDrawingArea::attachCompositingContext()
-{
- if (m_attached)
- return;
-
- m_attached = true;
-
-#if HAVE(HOSTED_CORE_ANIMATION)
- mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
- m_remoteLayerRef = WKCARemoteLayerClientMakeWithServerPort(serverPort);
- WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_hostingLayer->platformLayer());
-
- uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get());
- WebProcess::shared().connection()->deprecatedSendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out());
-#endif
-}
-
-void LayerBackedDrawingArea::detachCompositingContext()
-{
- m_backingLayer->removeAllChildren();
-
- scheduleCompositingLayerSync();
-}
-
-void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer* layer)
-{
- m_backingLayer->removeAllChildren();
- if (layer)
- m_backingLayer->addChild(layer);
-
- scheduleCompositingLayerSync();
-}
-
-void LayerBackedDrawingArea::scheduleCompositingLayerSync()
-{
-// if (m_syncTimer.isActive())
-// return;
-//
-// m_syncTimer.startOneShot(0);
-
- scheduleUpdateLayoutRunLoopObserver();
-}
-
-void LayerBackedDrawingArea::syncCompositingLayers()
-{
- m_hostingLayer->syncCompositingStateForThisLayerOnly();
- m_backingLayer->syncCompositingStateForThisLayerOnly();
-
- bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
- if (!didSync) {
-
- }
-}
-
-void LayerBackedDrawingArea::setUpUpdateLayoutRunLoopObserver()
-{
- if (m_updateLayoutRunLoopObserver)
- return;
-
- // Run before Core Animations commit observer, which has order 2000000.
- const CFIndex runLoopOrder = 2000000 - 1;
- CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
- m_updateLayoutRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0,
- kCFRunLoopBeforeWaiting | kCFRunLoopExit, true /* repeats */,
- runLoopOrder, updateLayoutRunLoopObserverCallback, &context));
-}
-
-void LayerBackedDrawingArea::scheduleUpdateLayoutRunLoopObserver()
-{
- CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
- CFRunLoopWakeUp(currentRunLoop);
-
- if (CFRunLoopContainsObserver(currentRunLoop, m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes))
- return;
-
- CFRunLoopAddObserver(currentRunLoop, m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes);
-}
-
-void LayerBackedDrawingArea::removeUpdateLayoutRunLoopObserver()
-{
- // FIXME: cache the run loop ref?
- CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes);
-}
-
-void LayerBackedDrawingArea::updateLayoutRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* info)
-{
- // Keep the drawing area alive while running the callback, since that does layout,
- // which might replace this drawing area with one of another type.
- RefPtr<LayerBackedDrawingArea> drawingArea = reinterpret_cast<LayerBackedDrawingArea*>(info);
- drawingArea->updateLayoutRunLoopObserverFired();
-}
-
-void LayerBackedDrawingArea::updateLayoutRunLoopObserverFired()
-{
- // Laying out the page can cause the drawing area to change so we keep an extra reference.
- RefPtr<LayerBackedDrawingArea> protect(this);
-
- m_webPage->layoutIfNeeded();
-
- if (m_webPage->drawingArea() != this)
- return;
-
- if (m_attached)
- syncCompositingLayers();
-}
-
-void LayerBackedDrawingArea::onPageClose()
-{
- platformClear();
-}
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
index 016f0d6..d05e43e 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
@@ -47,12 +47,14 @@ private:
// LayerTreeHost.
virtual const LayerTreeContext& layerTreeContext();
virtual void scheduleLayerFlush();
+ virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool);
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 forceRepaint();
virtual void didInstallPageOverlay();
virtual void didUninstallPageOverlay();
@@ -78,6 +80,10 @@ private:
// Whether the layer tree host is valid or not.
bool m_isValid;
+ // Whether we should let the drawing area know the next time we've flushed
+ // layer tree changes.
+ bool m_notifyAfterScheduledLayerFlush;
+
// The root layer.
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
index 9734aec..494f5e6 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -26,6 +26,7 @@
#import "config.h"
#import "LayerTreeHostMac.h"
+#import "DrawingAreaImpl.h"
#import "WebPage.h"
#import "WebProcess.h"
#import <QuartzCore/CATransaction.h>
@@ -51,6 +52,7 @@ PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
: LayerTreeHost(webPage)
, m_isValid(true)
+ , m_notifyAfterScheduledLayerFlush(false)
{
mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
@@ -72,6 +74,8 @@ LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
m_nonCompositedContentLayer->setDrawsContent(true);
m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
m_nonCompositedContentLayer->setSize(webPage->size());
+ if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled())
+ m_nonCompositedContentLayer->setAcceleratesDrawing(true);
m_rootLayer->addChild(m_nonCompositedContentLayer.get());
@@ -116,14 +120,18 @@ void LayerTreeHostMac::scheduleLayerFlush()
CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
}
-void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+void LayerTreeHostMac::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
{
- ASSERT(graphicsLayer);
+ m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
+}
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
m_nonCompositedContentLayer->removeAllChildren();
// Add the accelerated layer tree hierarchy.
- m_nonCompositedContentLayer->addChild(graphicsLayer);
+ if (graphicsLayer)
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
}
void LayerTreeHostMac::invalidate()
@@ -170,6 +178,15 @@ void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
[CATransaction synchronize];
}
+void LayerTreeHostMac::forceRepaint()
+{
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
void LayerTreeHostMac::didInstallPageOverlay()
{
createPageOverlayLayer();
@@ -242,6 +259,12 @@ void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
ASSERT(m_flushPendingLayerChangesRunLoopObserver);
CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
m_flushPendingLayerChangesRunLoopObserver = 0;
+
+ if (m_notifyAfterScheduledLayerFlush) {
+ // Let the drawing area know that we've done a flush of the layer changes.
+ static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();
+ m_notifyAfterScheduledLayerFlush = false;
+ }
}
bool LayerTreeHostMac::flushPendingLayerChanges()
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index 71bbf78..4cae5aa 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -42,6 +42,7 @@
#import <WebCore/KeyboardEvent.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ResourceHandle.h>
#import <WebCore/ScrollView.h>
#import <WebCore/TextIterator.h>
#import <WebCore/WindowsKeyboardCodes.h>
@@ -163,29 +164,29 @@ void WebPage::getMarkedRange(uint64_t& location, uint64_t& length)
getLocationAndLengthFromRange(frame->editor()->compositionRange().get(), location, length);
}
-static Range *characterRangeAtPoint(Frame* frame, const IntPoint point)
+static PassRefPtr<Range> characterRangeAtPoint(Frame* frame, const IntPoint& point)
{
VisiblePosition position = frame->visiblePositionForPoint(point);
if (position.isNull())
- return NULL;
+ return 0;
VisiblePosition previous = position.previous();
if (previous.isNotNull()) {
- Range *previousCharacterRange = makeRange(previous, position).get();
- NSRect rect = frame->editor()->firstRectForRange(previousCharacterRange);
- if (NSPointInRect(point, rect))
- return previousCharacterRange;
+ RefPtr<Range> previousCharacterRange = makeRange(previous, position);
+ IntRect rect = frame->editor()->firstRectForRange(previousCharacterRange.get());
+ if (rect.contains(point))
+ return previousCharacterRange.release();
}
VisiblePosition next = position.next();
if (next.isNotNull()) {
- Range *nextCharacterRange = makeRange(position, next).get();
- NSRect rect = frame->editor()->firstRectForRange(nextCharacterRange);
- if (NSPointInRect(point, rect))
- return nextCharacterRange;
+ RefPtr<Range> nextCharacterRange = makeRange(position, next);
+ IntRect rect = frame->editor()->firstRectForRange(nextCharacterRange.get());
+ if (rect.contains(point))
+ return nextCharacterRange.release();
}
- return NULL;
+ return 0;
}
void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index)
@@ -198,12 +199,12 @@ void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index)
HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
- Range *range = characterRangeAtPoint(frame, result.point());
+ RefPtr<Range> range = characterRangeAtPoint(frame, result.point());
if (!range)
return;
uint64_t length;
- getLocationAndLengthFromRange(range, index, length);
+ getLocationAndLengthFromRange(range.get(), index, length);
}
static PassRefPtr<Range> convertToRange(Frame* frame, NSRange nsrange)
@@ -241,6 +242,84 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web
resultRect = frame->view()->contentsToWindow(rect);
}
+void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
+{
+ Frame* frame = m_page->mainFrame();
+ if (!frame)
+ return;
+
+ // Find the frame the point is over.
+ IntPoint point = roundedIntPoint(floatPoint);
+
+ HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
+ frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
+
+ // Figure out if there are any characters under the point.
+ RefPtr<Range> characterRange = characterRangeAtPoint(frame, frame->view()->windowToContents(point));
+ if (!characterRange)
+ return;
+
+ // Grab the currently selected text.
+ RefPtr<Range> selectedRange = m_page->focusController()->focusedOrMainFrame()->selection()->selection().toNormalizedRange();
+
+ // Use the selected text if the point was anywhere in it. Assertain this by seeing if either character range
+ // the mouse is over is contained by the selection range.
+ if (characterRange && selectedRange) {
+ ExceptionCode ec = 0;
+ selectedRange->compareBoundaryPoints(Range::START_TO_START, characterRange.get(), ec);
+ if (!ec) {
+ if (selectedRange->isPointInRange(characterRange->startContainer(), characterRange->startOffset(), ec)) {
+ if (!ec)
+ characterRange = selectedRange;
+ }
+ }
+ }
+
+ if (!characterRange)
+ return;
+
+ // Ensure we have whole words.
+ VisibleSelection selection(characterRange.get());
+ selection.expandUsingGranularity(WordGranularity);
+
+ RefPtr<Range> finalRange = selection.toNormalizedRange();
+ if (!finalRange)
+ return;
+
+ performDictionaryLookupForRange(DictionaryPopupInfo::HotKey, frame, finalRange.get());
+}
+
+void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Frame* frame, Range* range)
+{
+ String rangeText = range->text();
+ if (rangeText.stripWhiteSpace().isEmpty())
+ return;
+
+ RenderObject* renderer = range->startContainer()->renderer();
+ RenderStyle* style = renderer->style();
+ NSFont *font = style->font().primaryFont()->getNSFont();
+ if (!font)
+ return;
+
+ CFDictionaryRef fontDescriptorAttributes = (CFDictionaryRef)[[font fontDescriptor] fontAttributes];
+ if (!fontDescriptorAttributes)
+ return;
+
+ Vector<FloatQuad> quads;
+ range->textQuads(quads);
+ if (quads.isEmpty())
+ return;
+
+ IntRect rangeRect = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
+
+ DictionaryPopupInfo dictionaryPopupInfo;
+ dictionaryPopupInfo.type = type;
+ dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y());
+ dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
+
+ send(Messages::WebPageProxy::DidPerformDictionaryLookup(rangeText, dictionaryPopupInfo));
+}
+
static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
{
page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity);
@@ -349,6 +428,13 @@ void WebPage::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference&
#endif
}
+void WebPage::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes, bool& result)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ frame->editor()->writeSelectionToPasteboard(pasteboardName, pasteboardTypes);
+ result = true;
+}
+
AccessibilityWebPageObject* WebPage::accessibilityRemoteObject()
{
return m_mockAccessibilityElement.get();
@@ -358,7 +444,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
{
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
- NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+ NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+ if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+ cachedResponse = WKCachedResponseForRequest(storageSession, request);
+ else
+#endif
+ cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
[request release];
return cachedResponse;
@@ -368,7 +460,13 @@ 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];
+ NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+ if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+ cachedResponse = WKCachedResponseForRequest(storageSession, request);
+ else
+#endif
+ cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
[request release];
return [[cachedResponse response] MIMEType];
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
index 1675d77..1a3b598 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp
@@ -28,11 +28,9 @@
#if ENABLE(INSPECTOR)
+#include <WebCore/NotImplemented.h>
#include <wtf/text/WTFString.h>
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
-
namespace WebKit {
String WebInspector::localizedStringsURL() const
diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
deleted file mode 100644
index 3c2f3c9..0000000
--- a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 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 "LayerBackedDrawingArea.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void LayerBackedDrawingArea::platformInit()
-{
-}
-
-void LayerBackedDrawingArea::platformClear()
-{
-}
-
-void LayerBackedDrawingArea::attachCompositingContext()
-{
-}
-
-void LayerBackedDrawingArea::detachCompositingContext()
-{
-}
-
-void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer* layer)
-{
-}
-
-void LayerBackedDrawingArea::scheduleCompositingLayerSync()
-{
-}
-
-void LayerBackedDrawingArea::syncCompositingLayers()
-{
-}
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
index 3ae0dae..5ada45d 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp
@@ -28,6 +28,7 @@
#if ENABLE(INSPECTOR)
+#include "WebKitBundle.h"
#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
@@ -35,7 +36,7 @@ namespace WebKit {
String WebInspector::localizedStringsURL() const
{
- RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("localizedStrings"), CFSTR("js"), 0));
+ RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), 0));
if (!localizedStringsURLRef)
return String();
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
index e20af3a..73ba2b2 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
@@ -36,6 +36,7 @@
#include <WebCore/KeyboardEvent.h>
#include <WebCore/Page.h>
#include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/ResourceHandle.h>
#include <WebCore/Settings.h>
#if PLATFORM(CG)
#include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -253,7 +254,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
- RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+ RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+ if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+ cache.adoptCF(wkCopyURLCache(storageSession));
+ else
+#endif
+ cache.adoptCF(CFURLCacheCopySharedURLCache());
RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));
return response;
@@ -271,7 +278,13 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
- RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+ RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+ if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+ cache.adoptCF(wkCopyURLCache(storageSession));
+ else
+#endif
+ cache.adoptCF(CFURLCacheCopySharedURLCache());
RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));