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/DrawingAreaImpl.cpp46
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp10
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp99
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h44
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in8
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp (renamed from Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm)138
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h (renamed from Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h)35
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm109
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp69
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm12
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm165
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp37
16 files changed, 614 insertions, 187 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 0a18256..47acc7a 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -64,7 +64,8 @@ DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParamete
, m_isWaitingForDidUpdate(false)
, m_isPaintingSuspended(!parameters.isVisible)
, m_alwaysUseCompositing(false)
- , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
+ , m_lastDisplayTime(0)
+ , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::displayTimerFired)
, m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
{
if (webPage->corePage()->settings()->acceleratedDrawingEnabled())
@@ -89,6 +90,9 @@ void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect)
return;
}
+ if (m_webPage->mainFrameHasCustomRepresentation())
+ return;
+
m_dirtyRegion.unite(dirtyRect);
scheduleDisplay();
}
@@ -104,6 +108,9 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff
return;
}
+ if (m_webPage->mainFrameHasCustomRepresentation())
+ return;
+
if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) {
unsigned scrollArea = scrollRect.width() * scrollRect.height();
unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height();
@@ -197,7 +204,9 @@ void DrawingAreaImpl::layerHostDidFlushLayers()
if (!m_layerTreeHost)
return;
+#if USE(ACCELERATED_COMPOSITING)
m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(m_backingStoreStateID, m_layerTreeHost->layerTreeContext()));
+#endif
}
void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
@@ -291,11 +300,13 @@ void DrawingAreaImpl::sendDidUpdateBackingStoreState()
m_shouldSendDidUpdateBackingStoreState = false;
UpdateInfo updateInfo;
- LayerTreeContext layerTreeContext;
if (!m_isPaintingSuspended && !m_layerTreeHost)
display(updateInfo);
+#if USE(ACCELERATED_COMPOSITING)
+ LayerTreeContext layerTreeContext;
+
if (m_isPaintingSuspended || m_layerTreeHost) {
updateInfo.viewSize = m_webPage->size();
@@ -311,6 +322,7 @@ void DrawingAreaImpl::sendDidUpdateBackingStoreState()
}
m_webPage->send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
+#endif
}
void DrawingAreaImpl::didUpdate()
@@ -322,8 +334,8 @@ void DrawingAreaImpl::didUpdate()
m_isWaitingForDidUpdate = false;
- // Display if needed.
- display();
+ // Display if needed. We call displayTimerFired here since it will throttle updates to 60fps.
+ displayTimerFired();
}
void DrawingAreaImpl::suspendPainting()
@@ -391,9 +403,11 @@ void DrawingAreaImpl::exitAcceleratedCompositingMode()
else
display(updateInfo);
+#if USE(ACCELERATED_COMPOSITING)
// Send along a complete update of the page so we can paint the contents right after we exit the
// accelerated compositing mode, eliminiating flicker.
m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo));
+#endif
}
void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
@@ -421,6 +435,21 @@ void DrawingAreaImpl::scheduleDisplay()
m_displayTimer.startOneShot(0);
}
+void DrawingAreaImpl::displayTimerFired()
+{
+ static const double minimumFrameInterval = 1.0 / 60.0;
+
+ double timeSinceLastDisplay = currentTime() - m_lastDisplayTime;
+ double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;
+
+ if (timeUntilNextDisplay > 0) {
+ m_displayTimer.startOneShot(timeUntilNextDisplay);
+ return;
+ }
+
+ display();
+}
+
void DrawingAreaImpl::display()
{
ASSERT(!m_layerTreeHost);
@@ -479,8 +508,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
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())
+ if (m_webPage->mainFrameHasCustomRepresentation()) {
+ // ASSUMPTION: the custom representation will be painting the dirty region for us.
+ m_dirtyRegion = Region();
return;
+ }
m_webPage->layoutIfNeeded();
@@ -492,7 +524,7 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
IntRect bounds = m_dirtyRegion.bounds();
ASSERT(m_webPage->bounds().contains(bounds));
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size(), ShareableBitmap::SupportsAlpha);
if (!bitmap->createHandle(updateInfo.bitmapHandle))
return;
@@ -527,6 +559,8 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
// 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();
+
+ m_lastDisplayTime = currentTime();
}
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index 8d85200..9e93869 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -72,6 +72,7 @@ private:
void exitAcceleratedCompositingMode();
void scheduleDisplay();
+ void displayTimerFired();
void display();
void display(UpdateInfo&);
@@ -97,6 +98,8 @@ private:
bool m_isPaintingSuspended;
bool m_alwaysUseCompositing;
+ double m_lastDisplayTime;
+
RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 8e9dba7..3e7b268 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -153,6 +153,10 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
return false;
IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
+
+ // Selection rect can be empty for matches that are currently obscured from view.
+ if (selectionRect.isEmpty())
+ return false;
// We want the selection rect in window coordinates.
IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
@@ -161,7 +165,7 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
// Create a backing store and paint the find indicator text into it.
- RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size());
+ RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size(), ShareableBitmap::SupportsAlpha);
if (!findIndicatorTextBackingStore)
return false;
@@ -178,7 +182,7 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
selectedFrame->view()->paint(graphicsContext.get(), paintRect);
selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
- SharedMemory::Handle handle;
+ ShareableBitmap::Handle handle;
if (!findIndicatorTextBackingStore->createHandle(handle))
return false;
@@ -203,7 +207,7 @@ void FindController::hideFindIndicator()
if (!m_isShowingFindIndicator)
return;
- SharedMemory::Handle handle;
+ ShareableBitmap::Handle handle;
m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle, false));
m_isShowingFindIndicator = false;
}
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
index 1112d39..737e195 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
@@ -27,7 +27,7 @@
#include "LayerTreeHost.h"
#if PLATFORM(MAC)
-#include "LayerTreeHostMac.h"
+#include "LayerTreeHostCA.h"
#endif
#if !PLATFORM(MAC) && !PLATFORM(WIN)
@@ -41,7 +41,7 @@ namespace WebKit {
PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage)
{
#if PLATFORM(MAC)
- return LayerTreeHostMac::create(webPage);
+ return LayerTreeHostCA::create(webPage);
#endif
return 0;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index fa4dc2c..574634f 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -335,7 +335,11 @@ String WebFrame::url() const
if (!m_coreFrame)
return String();
- return m_coreFrame->document()->url().string();
+ DocumentLoader* documentLoader = m_coreFrame->loader()->documentLoader();
+ if (!documentLoader)
+ return String();
+
+ return documentLoader->url().string();
}
String WebFrame::innerText() const
@@ -611,7 +615,12 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
if (!loader)
return String();
-
+
+ // First, try the main resource.
+ if (loader->url() == url)
+ return loader->response().suggestedFilename();
+
+ // Next, try subresources.
RefPtr<ArchiveResource> resource = loader->subresource(url);
if (!resource)
return String();
@@ -627,7 +636,12 @@ String WebFrame::mimeTypeForResourceWithURL(const KURL& url) const
DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
if (!loader)
return String();
-
+
+ // First, try the main resource.
+ if (loader->url() == url)
+ return loader->response().mimeType();
+
+ // Next, try subresources.
RefPtr<ArchiveResource> resource = loader->subresource(url);
if (resource)
return resource->mimeType();
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index ff567bd..d5f3724 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -54,6 +54,7 @@
#include "WebEvent.h"
#include "WebEventConversion.h"
#include "WebFrame.h"
+#include "WebFullScreenManager.h"
#include "WebGeolocationClient.h"
#include "WebImage.h"
#include "WebInspector.h"
@@ -91,6 +92,7 @@
#include <WebCore/RenderView.h>
#include <WebCore/ReplaceSelectionCommand.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/SchemeRegistry.h>
#include <WebCore/SerializedScriptValue.h>
#include <WebCore/Settings.h>
#include <WebCore/SharedBuffer.h>
@@ -158,6 +160,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
, m_canRunModal(parameters.canRunModal)
, m_isRunningModal(false)
+ , m_userSpaceScaleFactor(parameters.userSpaceScaleFactor)
, m_cachedMainFrameIsPinnedToLeftSide(false)
, m_cachedMainFrameIsPinnedToRightSide(false)
{
@@ -352,6 +355,9 @@ void WebPage::close()
#if ENABLE(INSPECTOR)
m_inspector = 0;
#endif
+#if ENABLE(FULLSCREEN_API)
+ m_fullScreenManager = 0;
+#endif
if (m_activePopupMenu) {
m_activePopupMenu->disconnectFromPage();
@@ -424,7 +430,7 @@ void WebPage::loadAlternateHTMLString(const String& htmlString, const String& ba
{
RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar));
KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(), baseURLString);
- KURL unreachableURL = unreachableURLString.isEmpty() ? KURL() : KURL(KURL(), unreachableURLString) ;
+ KURL unreachableURL = unreachableURLString.isEmpty() ? KURL() : KURL(KURL(), unreachableURLString);
loadData(sharedBuffer, "text/html", "utf-16", baseURL, unreachableURL);
}
@@ -785,9 +791,9 @@ void WebPage::pageDidScroll()
}
#if ENABLE(TILED_BACKING_STORE)
-void WebPage::pageDidRequestScroll(const IntSize& delta)
+void WebPage::pageDidRequestScroll(const IntPoint& point)
{
- send(Messages::WebPageProxy::PageDidRequestScroll(delta));
+ send(Messages::WebPageProxy::PageDidRequestScroll(point));
}
#endif
@@ -1051,6 +1057,21 @@ void WebPage::touchEvent(const WebTouchEvent& touchEvent)
}
#endif
+void WebPage::scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
+{
+ page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity);
+}
+
+void WebPage::logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity)
+{
+ page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity);
+}
+
+void WebPage::scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity)
+{
+ scroll(m_page.get(), static_cast<ScrollDirection>(scrollDirection), static_cast<ScrollGranularity>(scrollGranularity));
+}
+
void WebPage::setActive(bool isActive)
{
m_page->focusController()->setActive(isActive);
@@ -1121,6 +1142,8 @@ void WebPage::viewWillEndLiveResize()
void WebPage::setFocused(bool isFocused)
{
+ if (!isFocused)
+ m_page->focusController()->focusedOrMainFrame()->selection()->clear();
m_page->focusController()->setFocused(isFocused);
}
@@ -1176,6 +1199,13 @@ void WebPage::setUserAgent(const String& userAgent)
{
m_userAgent = userAgent;
}
+
+IntRect WebPage::windowToScreen(const IntRect& rect)
+{
+ IntRect screenRect;
+ sendSync(Messages::WebPageProxy::WindowToScreen(rect), Messages::WebPageProxy::WindowToScreen::Reply(screenRect));
+ return screenRect;
+}
IntRect WebPage::windowResizerRect() const
{
@@ -1353,6 +1383,9 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey()));
settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey()));
settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey()));
+ settings->setWebSecurityEnabled(store.getBoolValueForKey(WebPreferencesKey::webSecurityEnabledKey()));
+ settings->setAllowUniversalAccessFromFileURLs(store.getBoolValueForKey(WebPreferencesKey::allowUniversalAccessFromFileURLsKey()));
+ settings->setAllowFileAccessFromFileURLs(store.getBoolValueForKey(WebPreferencesKey::allowFileAccessFromFileURLsKey()));
settings->setMinimumFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumFontSizeKey()));
settings->setMinimumLogicalFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey()));
@@ -1363,9 +1396,11 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
// Temporarily turn off accelerated compositing until we have a good solution for rendering it.
settings->setAcceleratedCompositingEnabled(false);
settings->setAcceleratedDrawingEnabled(false);
+ settings->setCanvasUsesAcceleratedDrawing(false);
#else
settings->setAcceleratedCompositingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedCompositingEnabledKey()));
settings->setAcceleratedDrawingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedDrawingEnabledKey()));
+ settings->setCanvasUsesAcceleratedDrawing(store.getBoolValueForKey(WebPreferencesKey::canvasUsesAcceleratedDrawingKey()));
#endif
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
@@ -1375,6 +1410,14 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
#endif
+#if ENABLE(FULLSCREEN_API)
+ settings->setFullScreenEnabled(store.getBoolValueForKey(WebPreferencesKey::fullScreenEnabledKey()));
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ settings->setLocalStorageDatabasePath(WebProcess::shared().localStorageDirectory());
+#endif
+
platformPreferencesDidChange(store);
}
@@ -1389,6 +1432,15 @@ WebInspector* WebPage::inspector()
}
#endif
+#if ENABLE(FULLSCREEN_API)
+WebFullScreenManager* WebPage::fullScreenManager()
+{
+ if (!m_fullScreenManager)
+ m_fullScreenManager = WebFullScreenManager::create(this);
+ return m_fullScreenManager.get();
+}
+#endif
+
#if !PLATFORM(MAC)
bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
{
@@ -1488,6 +1540,7 @@ void WebPage::dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint glob
IntPoint adjustedClientPosition(clientPosition.x() + m_page->dragController()->dragOffset().x(), clientPosition.y() + m_page->dragController()->dragOffset().y());
IntPoint adjustedGlobalPosition(globalPosition.x() + m_page->dragController()->dragOffset().x(), globalPosition.y() + m_page->dragController()->dragOffset().y());
+ platformDragEnded();
m_page->dragController()->dragEnded();
FrameView* view = m_page->mainFrame()->view();
if (!view)
@@ -1729,13 +1782,13 @@ void WebPage::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInSc
(*it)->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates);
}
+#endif
+
bool WebPage::windowIsFocused() const
{
return m_page->focusController()->isActive();
}
-
-#endif
-
+
void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
if (messageID.is<CoreIPC::MessageClassDrawingAreaLegacy>()) {
@@ -1760,6 +1813,13 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
}
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (messageID.is<CoreIPC::MessageClassWebFullScreenManager>()) {
+ fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
+
didReceiveWebPageMessage(connection, messageID, arguments);
}
@@ -1998,6 +2058,7 @@ void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint
if (coreFrame) {
ASSERT(coreFrame->document()->printing());
+#if PLATFORM(CG)
// FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
@@ -2013,6 +2074,7 @@ void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint
CGPDFContextEndPage(context.get());
CGPDFContextClose(context.get());
+#endif
}
send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
@@ -2028,6 +2090,7 @@ void WebPage::drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, u
if (coreFrame) {
ASSERT(coreFrame->document()->printing());
+#if PLATFORM(CG)
// FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data.
RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get()));
@@ -2048,6 +2111,7 @@ void WebPage::drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, u
CGPDFContextEndPage(context.get());
}
CGPDFContextClose(context.get());
+#endif
}
send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
@@ -2072,4 +2136,27 @@ void WebPage::setMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
m_page->setMemoryCacheClientCallsEnabled(memoryCacheMessagesEnabled);
}
+#if !PLATFORM(MAC)
+void WebPage::platformDragEnded()
+{
+}
+#endif
+
+bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
+{
+ if (SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument(request.url().protocol()))
+ return true;
+ return platformCanHandleRequest(request);
+}
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+void WebPage::handleCorrectionPanelResult(const String& result)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ if (!frame)
+ return;
+ frame->editor()->handleCorrectionPanelResult(result);
+}
+#endif
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index 8ce6405..8e4e71c 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/ScrollTypes.h>
#include <WebCore/WebCoreKeyboardUIMode.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
@@ -61,6 +62,8 @@
#include "DictionaryPopupInfo.h"
#include <wtf/RetainPtr.h>
OBJC_CLASS AccessibilityWebPageObject;
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSObject;
#endif
namespace CoreIPC {
@@ -77,6 +80,7 @@ namespace WebCore {
class Range;
class ResourceRequest;
class SharedBuffer;
+ class VisibleSelection;
}
namespace WebKit {
@@ -90,6 +94,7 @@ class WebContextMenu;
class WebContextMenuItemData;
class WebEvent;
class WebFrame;
+class WebFullScreenManager;
class WebImage;
class WebInspector;
class WebKeyboardEvent;
@@ -137,10 +142,16 @@ public:
void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
+ void scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
+
#if ENABLE(INSPECTOR)
WebInspector* inspector();
#endif
+#if ENABLE(FULLSCREEN_API)
+ WebFullScreenManager* fullScreenManager();
+#endif
+
// -- 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&);
@@ -229,15 +240,16 @@ public:
bool windowIsVisible() const { return m_windowIsVisible; }
const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
- bool windowIsFocused() const;
bool interceptEditingKeyboardEvent(WebCore::KeyboardEvent*, bool);
#elif PLATFORM(WIN)
HWND nativeWindow() const { return m_nativeWindow; }
#endif
+ bool windowIsFocused() const;
void installPageOverlay(PassRefPtr<PageOverlay>);
void uninstallPageOverlay(PageOverlay*);
bool hasPageOverlay() const { return m_pageOverlay; }
+ WebCore::IntRect windowToScreen(const WebCore::IntRect&);
PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
@@ -250,7 +262,7 @@ public:
void pageDidScroll();
#if ENABLE(TILED_BACKING_STORE)
- void pageDidRequestScroll(const WebCore::IntSize& delta);
+ void pageDidRequestScroll(const WebCore::IntPoint&);
void setActualVisibleContentRect(const WebCore::IntRect&);
bool resizesToContentsEnabled() const { return !m_resizesToContentsLayoutSize.isEmpty(); }
@@ -297,6 +309,7 @@ public:
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);
+ void readSelectionFromPasteboard(const WTF::String& pasteboardName, 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);
@@ -309,7 +322,7 @@ public:
void dummy(bool&);
#if PLATFORM(MAC)
- void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*);
+ void performDictionaryLookupForSelection(DictionaryPopupInfo::Type, WebCore::Frame*, const WebCore::VisibleSelection&);
bool isSpeaking();
void speak(const String&);
@@ -346,10 +359,20 @@ public:
void runModal();
+ float userSpaceScaleFactor() const { return m_userSpaceScaleFactor; }
+
void setMemoryCacheMessagesEnabled(bool);
void forceRepaintWithoutCallback();
+#if PLATFORM(MAC)
+ void setDragSource(NSObject *);
+#endif
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ void handleCorrectionPanelResult(const String&);
+#endif
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
@@ -398,6 +421,9 @@ private:
void touchEvent(const WebTouchEvent&);
#endif
+ static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
+ static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
+
uint64_t restoreSession(const SessionState&);
void restoreSessionAndNavigateToCurrentItem(const SessionState&, const SandboxExtension::Handle&);
@@ -429,6 +455,7 @@ private:
#if PLATFORM(MAC)
void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
+ void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
void setWindowIsVisible(bool windowIsVisible);
void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
@@ -473,6 +500,10 @@ private:
void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
#endif
+ void platformDragEnded();
+
+ static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
+
OwnPtr<WebCore::Page> m_page;
RefPtr<WebFrame> m_mainFrame;
RefPtr<InjectedBundleBackForwardList> m_backForwardList;
@@ -512,6 +543,8 @@ private:
HashSet<PluginView*> m_pluginViews;
RetainPtr<AccessibilityWebPageObject> m_mockAccessibilityElement;
+
+ RetainPtr<NSObject> m_dragSource;
#elif PLATFORM(WIN)
// Our view's window (in the UI process).
HWND m_nativeWindow;
@@ -539,6 +572,9 @@ private:
#if ENABLE(INSPECTOR)
RefPtr<WebInspector> m_inspector;
#endif
+#if ENABLE(FULLSCREEN_API)
+ RefPtr<WebFullScreenManager> m_fullScreenManager;
+#endif
RefPtr<WebPopupMenu> m_activePopupMenu;
RefPtr<WebContextMenu> m_contextMenu;
RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
@@ -554,6 +590,8 @@ private:
bool m_canRunModal;
bool m_isRunningModal;
+ float m_userSpaceScaleFactor;
+
bool m_cachedMainFrameIsPinnedToLeftSide;
bool m_cachedMainFrameIsPinnedToRightSide;
};
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 0c0eea5..69bd54d 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -42,6 +42,8 @@ messages -> WebPage {
TouchEvent(WebKit::WebTouchEvent event)
#endif
+ ScrollBy(uint32_t scrollDirection, uint32_t scrollGranularity)
+
GoBack(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
GoForward(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
GoToBackForwardItem(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
@@ -55,6 +57,7 @@ messages -> WebPage {
StopLoadingFrame(uint64_t frameID)
+ RestoreSession(WebKit::SessionState state)
RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
DidRemoveBackForwardItem(uint64_t backForwardItemID)
@@ -181,6 +184,7 @@ messages -> WebPage {
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)
+ ReadSelectionFromPasteboard(WTF::String pasteboardName) -> (bool result)
#endif
#if PLATFORM(WIN)
ConfirmComposition(WTF::String compositionString)
@@ -191,4 +195,8 @@ messages -> WebPage {
#if PLATFORM(QT)
FindZoomableAreaForPoint(WebCore::IntPoint point)
#endif
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ HandleCorrectionPanelResult(String result)
+#endif
}
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp
index 494f5e6..2460607 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp
@@ -23,39 +23,31 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "config.h"
-#import "LayerTreeHostMac.h"
-
-#import "DrawingAreaImpl.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
+#include "config.h"
+#include "LayerTreeHostCA.h"
+
+#include "DrawingAreaImpl.h"
+#include "WebPage.h"
+#include "WebProcess.h"
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/Page.h>
+#include <WebCore/Settings.h>
using namespace WebCore;
namespace WebKit {
-PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
+PassRefPtr<LayerTreeHostCA> LayerTreeHostCA::create(WebPage* webPage)
{
- return adoptRef(new LayerTreeHostMac(webPage));
+ return adoptRef(new LayerTreeHostCA(webPage));
}
-LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
+LayerTreeHostCA::LayerTreeHostCA(WebPage* webPage)
: LayerTreeHost(webPage)
, m_isValid(true)
, m_notifyAfterScheduledLayerFlush(false)
{
- mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
- m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
// Create a root layer.
m_rootLayer = GraphicsLayer::create(this);
@@ -65,8 +57,6 @@ LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
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");
@@ -79,53 +69,35 @@ LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
m_rootLayer->addChild(m_nonCompositedContentLayer.get());
- WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
-
if (m_webPage->hasPageOverlay())
createPageOverlayLayer();
- scheduleLayerFlush();
+ platformInitialize();
- m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+ scheduleLayerFlush();
}
-LayerTreeHostMac::~LayerTreeHostMac()
+LayerTreeHostCA::~LayerTreeHostCA()
{
ASSERT(!m_isValid);
+ ASSERT(!m_rootLayer);
+#if PLATFORM(MAC)
ASSERT(!m_flushPendingLayerChangesRunLoopObserver);
ASSERT(!m_remoteLayerClient);
- ASSERT(!m_rootLayer);
+#endif
}
-const LayerTreeContext& LayerTreeHostMac::layerTreeContext()
+const LayerTreeContext& LayerTreeHostCA::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::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
+void LayerTreeHostCA::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
{
m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
}
-void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+void LayerTreeHostCA::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
m_nonCompositedContentLayer->removeAllChildren();
@@ -134,22 +106,15 @@ void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
m_nonCompositedContentLayer->addChild(graphicsLayer);
}
-void LayerTreeHostMac::invalidate()
+void LayerTreeHostCA::invalidate()
{
ASSERT(m_isValid);
-
- if (m_flushPendingLayerChangesRunLoopObserver) {
- CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
- m_flushPendingLayerChangesRunLoopObserver = nullptr;
- }
-
- WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
- m_remoteLayerClient = nullptr;
+ platformInvalidate();
m_rootLayer = nullptr;
m_isValid = false;
}
-void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
+void LayerTreeHostCA::setNonCompositedContentsNeedDisplay(const IntRect& rect)
{
m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
if (m_pageOverlayLayer)
@@ -158,12 +123,12 @@ void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
scheduleLayerFlush();
}
-void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
+void LayerTreeHostCA::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
{
setNonCompositedContentsNeedDisplay(scrollRect);
}
-void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
+void LayerTreeHostCA::sizeDidChange(const IntSize& newSize)
{
m_rootLayer->setSize(newSize);
m_nonCompositedContentLayer->setSize(newSize);
@@ -174,47 +139,45 @@ void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
scheduleLayerFlush();
flushPendingLayerChanges();
- [CATransaction flush];
- [CATransaction synchronize];
+ platformSizeDidChange();
}
-void LayerTreeHostMac::forceRepaint()
+void LayerTreeHostCA::forceRepaint()
{
scheduleLayerFlush();
flushPendingLayerChanges();
- [CATransaction flush];
- [CATransaction synchronize];
+ platformForceRepaint();
}
-void LayerTreeHostMac::didInstallPageOverlay()
+void LayerTreeHostCA::didInstallPageOverlay()
{
createPageOverlayLayer();
scheduleLayerFlush();
}
-void LayerTreeHostMac::didUninstallPageOverlay()
+void LayerTreeHostCA::didUninstallPageOverlay()
{
destroyPageOverlayLayer();
scheduleLayerFlush();
}
-void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect)
+void LayerTreeHostCA::setPageOverlayNeedsDisplay(const IntRect& rect)
{
ASSERT(m_pageOverlayLayer);
m_pageOverlayLayer->setNeedsDisplayInRect(rect);
scheduleLayerFlush();
}
-void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+void LayerTreeHostCA::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
{
}
-void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*)
+void LayerTreeHostCA::notifySyncRequired(const WebCore::GraphicsLayer*)
{
}
-void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+void LayerTreeHostCA::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
{
if (graphicsLayer == m_nonCompositedContentLayer) {
m_webPage->drawRect(graphicsContext, clipRect);
@@ -227,25 +190,20 @@ void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, Graphic
}
}
-bool LayerTreeHostMac::showDebugBorders() const
+bool LayerTreeHostCA::showDebugBorders() const
{
return m_webPage->corePage()->settings()->showDebugBorders();
}
-bool LayerTreeHostMac::showRepaintCounter() const
+bool LayerTreeHostCA::showRepaintCounter() const
{
return m_webPage->corePage()->settings()->showRepaintCounter();
}
-void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
-{
- static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
-}
-
-void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
+void LayerTreeHostCA::performScheduledLayerFlush()
{
{
- RefPtr<LayerTreeHostMac> protect(this);
+ RefPtr<LayerTreeHostCA> protect(this);
m_webPage->layoutIfNeeded();
if (!m_isValid)
@@ -255,10 +213,12 @@ void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
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;
+ didPerformScheduledLayerFlush();
+}
+
+void LayerTreeHostCA::didPerformScheduledLayerFlush()
+{
+ platformDidPerformScheduledLayerFlush();
if (m_notifyAfterScheduledLayerFlush) {
// Let the drawing area know that we've done a flush of the layer changes.
@@ -267,7 +227,7 @@ void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
}
}
-bool LayerTreeHostMac::flushPendingLayerChanges()
+bool LayerTreeHostCA::flushPendingLayerChanges()
{
m_rootLayer->syncCompositingStateForThisLayerOnly();
m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
@@ -277,7 +237,7 @@ bool LayerTreeHostMac::flushPendingLayerChanges()
return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
}
-void LayerTreeHostMac::createPageOverlayLayer()
+void LayerTreeHostCA::createPageOverlayLayer()
{
ASSERT(!m_pageOverlayLayer);
@@ -292,7 +252,7 @@ void LayerTreeHostMac::createPageOverlayLayer()
m_rootLayer->addChild(m_pageOverlayLayer.get());
}
-void LayerTreeHostMac::destroyPageOverlayLayer()
+void LayerTreeHostCA::destroyPageOverlayLayer()
{
ASSERT(m_pageOverlayLayer);
m_pageOverlayLayer->removeFromParent();
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
index d05e43e..ba4e33a 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
+++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
@@ -23,26 +23,31 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LayerTreeHostMac_h
-#define LayerTreeHostMac_h
+#ifndef LayerTreeHostCA_h
+#define LayerTreeHostCA_h
#include "LayerTreeContext.h"
#include "LayerTreeHost.h"
#include <WebCore/GraphicsLayerClient.h>
#include <wtf/OwnPtr.h>
+
+#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
+#endif
+#if PLATFORM(MAC)
typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef;
+#endif
namespace WebKit {
-class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient {
+class LayerTreeHostCA : public LayerTreeHost, WebCore::GraphicsLayerClient {
public:
- static PassRefPtr<LayerTreeHostMac> create(WebPage*);
- ~LayerTreeHostMac();
+ static PassRefPtr<LayerTreeHostCA> create(WebPage*);
+ ~LayerTreeHostCA();
private:
- explicit LayerTreeHostMac(WebPage*);
+ explicit LayerTreeHostCA(WebPage*);
// LayerTreeHost.
virtual const LayerTreeContext& layerTreeContext();
@@ -67,13 +72,23 @@ private:
virtual bool showDebugBorders() const;
virtual bool showRepaintCounter() const;
- static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
- void flushPendingLayerChangesRunLoopObserverCallback();
+ void platformInitialize();
+ void platformInvalidate();
+ void platformSizeDidChange();
+ void platformForceRepaint();
+
+ void performScheduledLayerFlush();
+ void didPerformScheduledLayerFlush();
+ void platformDidPerformScheduledLayerFlush();
bool flushPendingLayerChanges();
void createPageOverlayLayer();
void destroyPageOverlayLayer();
+#if PLATFORM(MAC)
+ static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
+#endif
+
// The context for this layer tree.
LayerTreeContext m_layerTreeContext;
@@ -93,10 +108,12 @@ private:
// The page overlay layer. Will be null if there's no page overlay.
OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
+#if PLATFORM(MAC)
RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
+#endif
};
} // namespace WebKit
-#endif // LayerTreeHostMac_h
+#endif // LayerTreeHostCA_h
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
new file mode 100644
index 0000000..50776d7
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
@@ -0,0 +1,109 @@
+/*
+ * 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 "LayerTreeHostCA.h"
+
+#import "WebProcess.h"
+#import <QuartzCore/CATransaction.h>
+#import <WebCore/GraphicsLayer.h>
+#import <WebKitSystemInterface.h>
+
+@interface CATransaction (Details)
++ (void)synchronize;
+@end
+
+namespace WebKit {
+
+void LayerTreeHostCA::platformInitialize()
+{
+ mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
+ m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
+
+ [m_rootLayer->platformLayer() setGeometryFlipped:YES];
+
+ WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer());
+
+ m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+}
+
+void LayerTreeHostCA::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 LayerTreeHostCA::platformInvalidate()
+{
+ if (m_flushPendingLayerChangesRunLoopObserver) {
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = nullptr;
+ }
+
+ WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
+ m_remoteLayerClient = nullptr;
+}
+
+void LayerTreeHostCA::platformSizeDidChange()
+{
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
+void LayerTreeHostCA::platformForceRepaint()
+{
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
+void LayerTreeHostCA::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
+{
+ // This gets called outside of the normal event loop so wrap in an autorelease pool
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ static_cast<LayerTreeHostCA*>(context)->performScheduledLayerFlush();
+ [pool drain];
+}
+
+void LayerTreeHostCA::platformDidPerformScheduledLayerFlush()
+{
+ // We successfully flushed the pending layer changes, remove the run loop observer.
+ ASSERT(m_flushPendingLayerChangesRunLoopObserver);
+ CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+ m_flushPendingLayerChangesRunLoopObserver = 0;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp
new file mode 100644
index 0000000..81db03e
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "LayerTreeHostCA.h"
+
+#include <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+void LayerTreeHostCA::platformInitialize()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+void LayerTreeHostCA::scheduleLayerFlush()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+void LayerTreeHostCA::platformInvalidate()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+void LayerTreeHostCA::platformSizeDidChange()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+void LayerTreeHostCA::platformForceRepaint()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+void LayerTreeHostCA::platformDidPerformScheduledLayerFlush()
+{
+ // FIXME: <http://webkit.org/b/45567> Implement this!
+ notImplemented();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
index c88ab7e..1d036fa 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
@@ -175,10 +175,12 @@ using namespace WebKit;
point.y -= remotePosition.y;
point.x -= remotePosition.x;
- WebCore::FrameView* fv = m_page->mainFrame()->coreFrame()->view();
- if (fv) {
- point.y += fv->scrollPosition().y();
- point.x += fv->scrollPosition().x();
+ if (m_page && m_page->mainFrame() && m_page->mainFrame()->coreFrame()) {
+ WebCore::FrameView* fv = m_page->mainFrame()->coreFrame()->view();
+ if (fv) {
+ point.y += fv->scrollPosition().y();
+ point.x += fv->scrollPosition().x();
+ }
}
return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point];
@@ -186,7 +188,7 @@ using namespace WebKit;
- (id)accessibilityFocusedUIElement
{
- return NSAccessibilityUnignoredDescendant(self);
+ return [[self accessibilityRootObjectWrapper] accessibilityFocusedUIElement];
}
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index 4cae5aa..8d81889 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -1,5 +1,5 @@
/*
- * 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
@@ -46,6 +46,7 @@
#import <WebCore/ScrollView.h>
#import <WebCore/TextIterator.h>
#import <WebCore/WindowsKeyboardCodes.h>
+#import <WebCore/visible_units.h>
#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -76,8 +77,6 @@ void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
{
}
-// FIXME: need to add support for input methods
-
bool WebPage::interceptEditingKeyboardEvent(KeyboardEvent* evt, bool shouldSaveCommand)
{
Node* node = evt->target()->toNode();
@@ -164,12 +163,12 @@ void WebPage::getMarkedRange(uint64_t& location, uint64_t& length)
getLocationAndLengthFromRange(frame->editor()->compositionRange().get(), location, length);
}
-static PassRefPtr<Range> characterRangeAtPoint(Frame* frame, const IntPoint& point)
+
+static PassRefPtr<Range> characterRangeAtPositionForPoint(Frame* frame, const VisiblePosition& position, const IntPoint& point)
{
- VisiblePosition position = frame->visiblePositionForPoint(point);
if (position.isNull())
return 0;
-
+
VisiblePosition previous = position.previous();
if (previous.isNotNull()) {
RefPtr<Range> previousCharacterRange = makeRange(previous, position);
@@ -188,7 +187,12 @@ static PassRefPtr<Range> characterRangeAtPoint(Frame* frame, const IntPoint& poi
return 0;
}
-
+
+static PassRefPtr<Range> characterRangeAtPoint(Frame* frame, const IntPoint& point)
+{
+ return characterRangeAtPositionForPoint(frame, frame->visiblePositionForPoint(point), point);
+}
+
void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index)
{
index = NSNotFound;
@@ -242,6 +246,32 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web
resultRect = frame->view()->contentsToWindow(rect);
}
+static bool isPositionInRange(const VisiblePosition& position, Range* range)
+{
+ RefPtr<Range> positionRange = makeRange(position, position);
+
+ ExceptionCode ec = 0;
+ range->compareBoundaryPoints(Range::START_TO_START, positionRange.get(), ec);
+ if (ec)
+ return false;
+
+ if (!range->isPointInRange(positionRange->startContainer(), positionRange->startOffset(), ec))
+ return false;
+ if (ec)
+ return false;
+
+ return true;
+}
+
+static bool shouldUseSelection(const VisiblePosition& position, const VisibleSelection& selection)
+{
+ RefPtr<Range> selectedRange = selection.toNormalizedRange();
+ if (!selectedRange)
+ return false;
+
+ return isPositionInRange(position, selectedRange.get());
+}
+
void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
{
Frame* frame = m_page->mainFrame();
@@ -250,46 +280,78 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
// 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)
+ IntPoint translatedPoint = frame->view()->windowToContents(point);
+ VisiblePosition position = frame->visiblePositionForPoint(translatedPoint);
+
+ // Don't do anything if there is no character at the point.
+ if (!characterRangeAtPositionForPoint(frame, position, translatedPoint))
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;
- }
- }
+ VisibleSelection selection = m_page->focusController()->focusedOrMainFrame()->selection()->selection();
+ if (shouldUseSelection(position, selection)) {
+ performDictionaryLookupForSelection(DictionaryPopupInfo::HotKey, frame, selection);
+ return;
}
- if (!characterRange)
- return;
+ NSDictionary *options = nil;
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ // As context, we are going to use the surrounding paragraph of text.
+ VisiblePosition paragraphStart = startOfParagraph(position);
+ VisiblePosition paragraphEnd = endOfParagraph(position);
+
+ NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(paragraphStart, position).get()), 0);
- // Ensure we have whole words.
- VisibleSelection selection(characterRange.get());
- selection.expandUsingGranularity(WordGranularity);
+ RefPtr<Range> fullCharacterRange = makeRange(paragraphStart, paragraphEnd);
+ String fullPlainTextString = plainText(fullCharacterRange.get());
- RefPtr<Range> finalRange = selection.toNormalizedRange();
+ NSRange extractedRange = WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, &options);
+
+ RefPtr<Range> finalRange = TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length);
+ if (!finalRange)
+ return;
+#else
+ RefPtr<Range> finalRange = makeRange(startOfWord(position), endOfWord(position));
if (!finalRange)
return;
+#endif
+
+ performDictionaryLookupForRange(DictionaryPopupInfo::HotKey, frame, finalRange.get(), options);
+}
+
+void WebPage::performDictionaryLookupForSelection(DictionaryPopupInfo::Type type, Frame* frame, const VisibleSelection& selection)
+{
+ RefPtr<Range> selectedRange = selection.toNormalizedRange();
+ if (!selectedRange)
+ return;
- performDictionaryLookupForRange(DictionaryPopupInfo::HotKey, frame, finalRange.get());
+ NSDictionary *options = nil;
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ VisiblePosition selectionStart = selection.visibleStart();
+ VisiblePosition selectionEnd = selection.visibleEnd();
+
+ // As context, we are going to use the surrounding paragraphs of text.
+ VisiblePosition paragraphStart = startOfParagraph(selectionStart);
+ VisiblePosition paragraphEnd = endOfParagraph(selectionEnd);
+
+ int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
+ int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
+ NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
+
+ String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get());
+
+ // Since we already have the range we want, we just need to grab the returned options.
+ WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, &options);
+#endif
+
+ performDictionaryLookupForRange(type, frame, selectedRange.get(), options);
}
-void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Frame* frame, Range* range)
+void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Frame* frame, Range* range, NSDictionary *options)
{
String rangeText = range->text();
if (rangeText.stripWhiteSpace().isEmpty())
@@ -316,20 +378,11 @@ void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Fr
dictionaryPopupInfo.type = type;
dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y());
dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
+ dictionaryPopupInfo.options = (CFDictionaryRef)options;
send(Messages::WebPageProxy::DidPerformDictionaryLookup(rangeText, dictionaryPopupInfo));
}
-static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
-{
- page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity);
-}
-
-static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity)
-{
- page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity);
-}
-
bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent)
{
if (keyboardEvent.type() != WebEvent::KeyDown)
@@ -390,7 +443,7 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
if (keyboardEvent.metaKey())
m_page->goBack();
else {
- if (keyboardEvent.altKey() | keyboardEvent.controlKey())
+ if (keyboardEvent.altKey() || keyboardEvent.controlKey())
scroll(m_page.get(), ScrollLeft, ScrollByPage);
else
scroll(m_page.get(), ScrollLeft, ScrollByLine);
@@ -435,6 +488,13 @@ void WebPage::writeSelectionToPasteboard(const String& pasteboardName, const Vec
result = true;
}
+void WebPage::readSelectionFromPasteboard(const String& pasteboardName, bool& result)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ frame->editor()->readSelectionFromPasteboard(pasteboardName);
+ result = true;
+}
+
AccessibilityWebPageObject* WebPage::accessibilityRemoteObject()
{
return m_mockAccessibilityElement.get();
@@ -472,13 +532,26 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
return [[cachedResponse response] MIMEType];
}
-bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
+bool WebPage::platformCanHandleRequest(const WebCore::ResourceRequest& request)
{
if ([NSURLConnection canHandleRequest:request.nsURLRequest()])
- return YES;
+ return true;
// FIXME: Return true if this scheme is any one WebKit2 knows how to handle.
return request.url().protocolIs("applewebdata");
}
+void WebPage::setDragSource(NSObject *dragSource)
+{
+ m_dragSource = dragSource;
+}
+
+void WebPage::platformDragEnded()
+{
+ // The drag source we care about here is NSFilePromiseDragSource, which doesn't look at
+ // the arguments. It's OK to just pass arbitrary constant values, so we just pass all zeroes.
+ [m_dragSource.get() draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationNone];
+ m_dragSource = nullptr;
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
index cad0c04..de8385c 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
@@ -277,7 +277,7 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL&)
return String();
}
-bool WebPage::canHandleRequest(const WebCore::ResourceRequest&)
+bool WebPage::platformCanHandleRequest(const WebCore::ResourceRequest&)
{
// FIXME: Implement
return true;
diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
index 73ba2b2..41bb219 100644
--- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
@@ -192,16 +192,6 @@ const char* WebPage::interpretKeyEvent(const KeyboardEvent* evt)
return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
}
-static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
-{
- page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity);
-}
-
-static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity)
-{
- page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity);
-}
-
bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent)
{
if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown)
@@ -209,33 +199,53 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
switch (keyboardEvent.windowsVirtualKeyCode()) {
case VK_BACK:
+ if (keyboardEvent.isSystemKey())
+ return false;
if (keyboardEvent.shiftKey())
m_page->goForward();
else
m_page->goBack();
break;
case VK_LEFT:
- scroll(m_page.get(), ScrollLeft, ScrollByLine);
+ if (keyboardEvent.isSystemKey())
+ m_page->goBack();
+ else
+ scroll(m_page.get(), ScrollLeft, ScrollByLine);
break;
case VK_RIGHT:
- scroll(m_page.get(), ScrollRight, ScrollByLine);
+ if (keyboardEvent.isSystemKey())
+ m_page->goForward();
+ else
+ scroll(m_page.get(), ScrollRight, ScrollByLine);
break;
case VK_UP:
+ if (keyboardEvent.isSystemKey())
+ return false;
scroll(m_page.get(), ScrollUp, ScrollByLine);
break;
case VK_DOWN:
+ if (keyboardEvent.isSystemKey())
+ return false;
scroll(m_page.get(), ScrollDown, ScrollByLine);
break;
case VK_HOME:
+ if (keyboardEvent.isSystemKey())
+ return false;
logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByDocument);
break;
case VK_END:
+ if (keyboardEvent.isSystemKey())
+ return false;
logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByDocument);
break;
case VK_PRIOR:
+ if (keyboardEvent.isSystemKey())
+ return false;
logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage);
break;
case VK_NEXT:
+ if (keyboardEvent.isSystemKey())
+ return false;
logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage);
break;
default:
@@ -296,10 +306,9 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
#endif
}
-bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
+bool WebPage::platformCanHandleRequest(const WebCore::ResourceRequest& request)
{
#if USE(CFNETWORK)
- // FIXME: Are there other requests we need to be able to handle? WebKit1's WebView.cpp has a FIXME here as well.
return CFURLProtocolCanHandleRequest(request.cfURLRequest());
#else
return true;