diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 13:36:51 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-24 15:38:28 +0100 |
commit | 2fc2651226baac27029e38c9d6ef883fa32084db (patch) | |
tree | e396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebKit2/WebProcess/WebCoreSupport | |
parent | b3725cedeb43722b3b175aaeff70552e562d2c94 (diff) | |
download | external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2 |
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport')
40 files changed, 479 insertions, 425 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 6da6c6e..2394141 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -24,12 +24,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebChromeClient.h" #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 #include "NotImplemented.h" #include "DrawingArea.h" +#include "InjectedBundleNavigationAction.h" #include "InjectedBundleUserMessageCoders.h" #include "WebContextMenu.h" #include "WebCoreArgumentCoders.h" @@ -49,6 +51,7 @@ #include <WebCore/FileChooser.h> #include <WebCore/Frame.h> #include <WebCore/FrameLoader.h> +#include <WebCore/FrameView.h> #include <WebCore/HTMLNames.h> #include <WebCore/HTMLPlugInImageElement.h> #include <WebCore/Page.h> @@ -151,8 +154,8 @@ void WebChromeClient::focusedFrameChanged(Frame* frame) Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction) { - uint32_t modifiers = modifiersForNavigationAction(navigationAction); - int32_t mouseButton = mouseButtonForNavigationAction(navigationAction); + uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction)); + int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction)); uint64_t newPageID = 0; WebPageCreationParameters parameters; @@ -354,11 +357,15 @@ void WebChromeClient::invalidateWindow(const IntRect&, bool) void WebChromeClient::invalidateContentsAndWindow(const IntRect& rect, bool) { + if (m_page->corePage()->mainFrame()->document()->printing()) + return; m_page->drawingArea()->setNeedsDisplay(rect); } void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool) { + if (m_page->corePage()->mainFrame()->document()->printing()) + return; m_page->pageDidScroll(); m_page->drawingArea()->setNeedsDisplay(rect); } @@ -413,7 +420,23 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con WebFrame* largestFrame = findLargestFrameInFrameSet(m_page); if (largestFrame != m_cachedFrameSetLargestFrame.get()) { m_cachedFrameSetLargestFrame = largestFrame; - WebProcess::shared().connection()->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0), m_page->pageID()); + m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0)); + } + + if (frame->page()->mainFrame() != frame) + return; + FrameView* frameView = frame->view(); + if (!frameView) + return; + + bool hasHorizontalScrollbar = frameView->horizontalScrollbar(); + bool hasVerticalScrollbar = frameView->verticalScrollbar(); + + if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) { + m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar)); + + m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar; + m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar; } } @@ -550,6 +573,15 @@ bool WebChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect& return false; } +bool WebChromeClient::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) +{ + if (!m_page->injectedBundleUIClient().shouldPaintCustomOverhangArea()) + return false; + + m_page->injectedBundleUIClient().paintCustomOverhangArea(m_page, context, horizontalOverhangArea, verticalOverhangArea, dirtyRect); + return true; +} + void WebChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*) { notImplemented(); @@ -611,6 +643,11 @@ void WebChromeClient::formDidBlur(const Node*) bool WebChromeClient::selectItemWritingDirectionIsNatural() { + return false; +} + +bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection() +{ return true; } @@ -631,12 +668,6 @@ void WebChromeClient::showContextMenu() } #endif -PassOwnPtr<HTMLParserQuirks> WebChromeClient::createHTMLParserQuirks() -{ - notImplemented(); - return 0; -} - #if USE(ACCELERATED_COMPOSITING) void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer) { @@ -683,4 +714,9 @@ void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& arg m_page->send(Messages::WebPageProxy::DidChangeViewportData(args)); } +void WebChromeClient::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) const +{ + m_page->send(Messages::WebPageProxy::DidCompleteRubberBandForMainFrame(initialOverhang)); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index d749833..82ba36e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -39,11 +39,14 @@ class WebPage; class WebChromeClient : public WebCore::ChromeClient { public: WebChromeClient(WebPage* page) - : m_page(page) + : m_cachedMainFrameHasHorizontalScrollbar(false) + , m_cachedMainFrameHasVerticalScrollbar(false) + , m_page(page) { } WebPage* page() const { return m_page; } + private: virtual void chromeDestroyed(); @@ -154,27 +157,28 @@ private: WebCore::ScrollbarControlState, WebCore::ScrollbarPart pressedPart, bool vertical, float value, float proportion, WebCore::ScrollbarControlPartMask); virtual bool paintCustomScrollCorner(WebCore::GraphicsContext*, const WebCore::FloatRect&); - + + virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&); + // This is an asynchronous call. The ChromeClient can display UI asking the user for permission // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately. virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); - + virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void chooseIconForFiles(const Vector<String>&, WebCore::FileChooser*); virtual void setCursor(const WebCore::Cursor&); - + // Notification that the given form element has changed. This function // will be called frequently, so handling should be very fast. virtual void formStateDidChange(const WebCore::Node*); - + virtual void formDidFocus(const WebCore::Node*); virtual void formDidBlur(const WebCore::Node*); - - virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks(); virtual bool selectItemWritingDirectionIsNatural(); + virtual bool selectItemAlignmentFollowsMenuWritingDirection(); virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; @@ -202,8 +206,13 @@ private: virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const; + virtual void didCompleteRubberBandForMainFrame(const WebCore::IntSize&) const; + String m_cachedToolTip; mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; + mutable bool m_cachedMainFrameHasHorizontalScrollbar; + mutable bool m_cachedMainFrameHasVerticalScrollbar; + WebPage* m_page; }; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp index 42b60a5..0c83cda 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuClient.h" #include "WebContextMenuItemData.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp index cc61b04..caa6eda 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebDatabaseManager.h" #include "Connection.h" @@ -45,9 +46,13 @@ WebDatabaseManager& WebDatabaseManager::shared() return shared; } +void WebDatabaseManager::initialize(const String& databaseDirectory) +{ + DatabaseTracker::initializeTracker(databaseDirectory); +} + WebDatabaseManager::WebDatabaseManager() { - DatabaseTracker::initializeTracker(databaseDirectory()); DatabaseTracker::tracker().setClient(this); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h index 4701645..96ed83e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h @@ -43,6 +43,7 @@ class WebDatabaseManager : public WebCore::DatabaseTrackerClient { WTF_MAKE_NONCOPYABLE(WebDatabaseManager); public: static WebDatabaseManager& shared(); + static void initialize(const String& databaseDirectory); void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); @@ -63,8 +64,6 @@ private: // WebCore::DatabaseTrackerClient virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier); - - String databaseDirectory() const; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp index e3d401d..9e348cd 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebDragClient.h" #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 @@ -50,16 +51,10 @@ DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& win return DragSourceActionAny; } -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) && !PLATFORM(WIN) void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) { } - -DragImageRef WebDragClient::createDragImageForLink(KURL&, const String&, Frame*) -{ - notImplemented(); - return 0; -} #endif void WebDragClient::dragControllerDestroyed() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h index 6f7cf85..389680a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h @@ -46,7 +46,6 @@ private: virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint); virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false); - virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const String& label, WebCore::Frame*); #if PLATFORM(MAC) virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index e3db967..5ed1c60 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEditorClient.h" #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 49ce240..4be913f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFrameLoaderClient.h" #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 @@ -30,6 +31,7 @@ #include "AuthenticationManager.h" #include "DataReference.h" +#include "InjectedBundleNavigationAction.h" #include "InjectedBundleUserMessageCoders.h" #include "PlatformCertificateInfo.h" #include "PluginView.h" @@ -57,6 +59,7 @@ #include <WebCore/FrameView.h> #include <WebCore/HTMLAppletElement.h> #include <WebCore/HTMLFormElement.h> +#include <WebCore/HistoryItem.h> #include <WebCore/MIMETypeRegistry.h> #include <WebCore/MouseEvent.h> #include <WebCore/Page.h> @@ -141,13 +144,18 @@ void WebFrameLoaderClient::detachedFromParent3() notImplemented(); } -void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest& request) +void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request) { WebPage* webPage = m_frame->page(); if (!webPage) return; - webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request)); + bool pageIsProvisionallyLoading = false; + if (FrameLoader* frameLoader = loader->frameLoader()) + pageIsProvisionallyLoading = frameLoader->provisionalDocumentLoader() == loader; + + webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(webPage, m_frame, identifier, request, pageIsProvisionallyLoading); + webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request, pageIsProvisionallyLoading)); } void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) @@ -156,8 +164,9 @@ void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned lon if (!webPage) return; - if (!webPage->injectedBundleLoaderClient().shouldLoadResourceForFrame(webPage, m_frame, request.url().string())) { - request = ResourceRequest(); + webPage->injectedBundleResourceLoadClient().willSendRequestForFrame(webPage, m_frame, identifier, request, redirectResponse); + + if (request.isNull()) { // FIXME: We should probably send a message saying we cancelled the request for the resource. return; } @@ -211,6 +220,7 @@ void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned if (!webPage) return; + webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(webPage, m_frame, identifier, response); webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(m_frame->frameID(), identifier, response)); } @@ -220,6 +230,7 @@ void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsi if (!webPage) return; + webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, lengthReceived); webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, lengthReceived)); } @@ -229,6 +240,7 @@ void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned lo if (!webPage) return; + webPage->injectedBundleResourceLoadClient().didFinishLoadForResource(webPage, m_frame, identifier); webPage->send(Messages::WebPageProxy::DidFinishLoadForResource(m_frame->frameID(), identifier)); } @@ -238,6 +250,7 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long if (!webPage) return; + webPage->injectedBundleResourceLoadClient().didFailLoadForResource(webPage, m_frame, identifier, error); webPage->send(Messages::WebPageProxy::DidFailLoadForResource(m_frame->frameID(), identifier, error)); } @@ -311,7 +324,7 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationAnchorNavigation, userData); // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); + webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchDidPushStateWithinPage() @@ -326,7 +339,7 @@ void WebFrameLoaderClient::dispatchDidPushStateWithinPage() webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePush, userData); // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); + webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage() @@ -341,7 +354,7 @@ void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage() webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStateReplace, userData); // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); + webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchDidPopStateWithinPage() @@ -356,7 +369,7 @@ void WebFrameLoaderClient::dispatchDidPopStateWithinPage() webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePop, userData); // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); + webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get()))); } void WebFrameLoaderClient::dispatchWillClose() @@ -426,7 +439,14 @@ void WebFrameLoaderClient::dispatchDidCommitLoad() webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame); // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frameHasCustomRepresentation, PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get()))); + + // Only restore the scale factor for standard frame loads (of the main frame). + if (m_frame->isMainFrame() && m_frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) { + if (m_frame->coreFrame()->pageScaleFactor() != 1) + webPage->scaleWebView(1, IntPoint()); + } } void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error) @@ -556,64 +576,27 @@ void WebFrameLoaderClient::dispatchShow() webPage->show(); } -uint32_t modifiersForNavigationAction(const NavigationAction& navigationAction) -{ - uint32_t modifiers = 0; - if (const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(navigationAction.event()))) { - if (keyStateEvent->shiftKey()) - modifiers |= WebEvent::ShiftKey; - if (keyStateEvent->ctrlKey()) - modifiers |= WebEvent::ControlKey; - if (keyStateEvent->altKey()) - modifiers |= WebEvent::AltKey; - if (keyStateEvent->metaKey()) - modifiers |= WebEvent::MetaKey; - } - - return modifiers; -} - -static const MouseEvent* findMouseEvent(const Event* event) -{ - for (const Event* e = event; e; e = e->underlyingEvent()) { - if (e->isMouseEvent()) - return static_cast<const MouseEvent*>(e); - } - return 0; -} - -int32_t mouseButtonForNavigationAction(const NavigationAction& navigationAction) -{ - const MouseEvent* mouseEvent = findMouseEvent(navigationAction.event()); - if (!mouseEvent) - return -1; - - if (!mouseEvent->buttonDown()) - return -1; - - return mouseEvent->button(); -} - void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& MIMEType, const ResourceRequest& request) { - if (m_frame->coreFrame()->loader()->documentLoader()->url().isEmpty() && request.url() == blankURL()) { - // WebKit2 loads initial about:blank documents synchronously, without consulting the policy delegate - ASSERT(m_frame->coreFrame()->loader()->stateMachine()->committingFirstRealLoad()); - (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); - return; - } - WebPage* webPage = m_frame->page(); if (!webPage) return; - uint64_t listenerID = m_frame->setUpPolicyListener(function); - const String& url = request.url().string(); // FIXME: Pass entire request. + if (!request.url().string()) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundlePolicyClient().decidePolicyForMIMEType(webPage, m_frame, MIMEType, request, userData); + uint64_t listenerID = m_frame->setUpPolicyListener(function); bool receivedPolicyAction; uint64_t policyAction; uint64_t downloadID; - if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, url, listenerID), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID))) + + // Notify the UIProcess. + if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForMIMEType(m_frame->frameID(), MIMEType, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForMIMEType::Reply(receivedPolicyAction, policyAction, downloadID))) return; // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback. @@ -621,54 +604,50 @@ void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction f m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID); } -void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName) +void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName) { WebPage* webPage = m_frame->page(); if (!webPage) return; - uint64_t listenerID = m_frame->setUpPolicyListener(function); + RefPtr<APIObject> userData; + + RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); + + // Notify the bundle client. + webPage->injectedBundlePolicyClient().decidePolicyForNewWindowAction(webPage, m_frame, action.get(), request, frameName, userData); - // FIXME: Pass more than just the navigation action type. - // FIXME: Pass the frame name. - const String& url = request.url().string(); // FIXME: Pass entire request. - uint32_t navigationType = static_cast<uint32_t>(navigationAction.type()); - uint32_t modifiers = modifiersForNavigationAction(navigationAction); - int32_t mouseButton = mouseButtonForNavigationAction(navigationAction); + uint64_t listenerID = m_frame->setUpPolicyListener(function); - webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID)); + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, frameName, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); } -void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>) +void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState) { - if (m_frame->coreFrame()->loader()->documentLoader()->url().isEmpty() && request.url() == blankURL()) { - // WebKit2 loads initial about:blank documents synchronously, without consulting the policy delegate - ASSERT(m_frame->coreFrame()->loader()->stateMachine()->committingFirstRealLoad()); - (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse); - return; - } - - // Always ignore requests with empty URLs. - if (request.isEmpty()) { - (m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyIgnore); - return; - } - WebPage* webPage = m_frame->page(); if (!webPage) return; - uint64_t listenerID = m_frame->setUpPolicyListener(function); + RefPtr<APIObject> userData; + + RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState); + + // Notify the bundle client. + webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.get(), request, userData); - // FIXME: Pass more than just the navigation action type. - const String& url = request.url().string(); // FIXME: Pass entire request. + uint64_t listenerID = m_frame->setUpPolicyListener(function); + bool receivedPolicyAction; + uint64_t policyAction; - uint32_t navigationType = static_cast<uint32_t>(navigationAction.type()); - uint32_t modifiers = modifiersForNavigationAction(navigationAction); - int32_t mouseButton = mouseButtonForNavigationAction(navigationAction); + // Notify the UIProcess. + if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction))) + return; - webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID)); + // We call this synchronously because WebCore cannot gracefully handle a frame load without a synchronous navigation policy reply. + if (receivedPolicyAction) + m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), 0); } void WebFrameLoaderClient::cancelPolicyCheck() @@ -900,7 +879,7 @@ void WebFrameLoaderClient::didDisplayInsecureContent() webPage->send(Messages::WebPageProxy::DidDisplayInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); } -void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*) +void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const KURL&) { WebPage* webPage = m_frame->page(); if (!webPage) @@ -1003,7 +982,9 @@ void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*) void WebFrameLoaderClient::restoreViewState() { - notImplemented(); + // Inform the UI process of the scale factor. + double scaleFactor = m_frame->coreFrame()->loader()->history()->currentItem()->pageScaleFactor(); + m_frame->page()->send(Messages::WebPageProxy::ViewScaleFactorDidChange(scaleFactor)); } void WebFrameLoaderClient::provisionalLoadStarted() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index 29c8bdd..9070b3a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -137,7 +137,7 @@ private: virtual void dispatchDidChangeBackForwardIndex() const; virtual void didDisplayInsecureContent(); - virtual void didRunInsecureContent(WebCore::SecurityOrigin*); + virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&); virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); @@ -222,9 +222,6 @@ private: bool m_frameHasCustomRepresentation; }; -uint32_t modifiersForNavigationAction(const WebCore::NavigationAction&); -int32_t mouseButtonForNavigationAction(const WebCore::NavigationAction&); - } // namespace WebKit #endif // WebFrameLoaderClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp index 8701022..1f920a1 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationClient.h" #if ENABLE(CLIENT_BASED_GEOLOCATION) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp index ddd1fa8..80552f0 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorClient.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp index 28d3b3d..6298293 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorFrontendClient.h" #if ENABLE(INSPECTOR) @@ -40,7 +41,7 @@ using namespace WebCore; namespace WebKit { WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage) - : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage()) + : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage(), new Settings()) , m_page(page) { } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index 49b31ef..479252a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPlatformStrategies.h" #if USE(PLATFORM_STRATEGIES) @@ -213,6 +214,13 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() return UI_STRING("Copy Image", "Copy Image context menu item"); } +#if PLATFORM(QT) +String WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard() +{ + return UI_STRING("Copy Image Address", "Copy Image Address menu item"); +} +#endif + String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow() { return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item"); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h index b584f8d..a763475 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -68,6 +68,9 @@ private: virtual String contextMenuItemTagOpenImageInNewWindow(); virtual String contextMenuItemTagDownloadImageToDisk(); virtual String contextMenuItemTagCopyImageToClipboard(); +#if PLATFORM(QT) + virtual String contextMenuItemTagCopyImageUrlToClipboard(); +#endif virtual String contextMenuItemTagOpenFrameInNewWindow(); virtual String contextMenuItemTagCopy(); virtual String contextMenuItemTagGoBack(); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp index ea0ad2d..7242d4f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp @@ -19,6 +19,7 @@ * */ +#include "config.h" #include "WebPopupMenu.h" #include "PlatformPopupMenuData.h" @@ -85,7 +86,8 @@ Vector<WebPopupItem> WebPopupMenu::populateItems() // FIXME: Add support for styling the font. // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. - items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i))); + PopupMenuStyle itemStyle = m_popupClient->itemStyle(i); + items.append(WebPopupItem(WebPopupItem::Item, m_popupClient->itemText(i), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride(), m_popupClient->itemToolTip(i), m_popupClient->itemAccessibilityText(i), m_popupClient->itemIsEnabled(i), m_popupClient->itemIsLabel(i))); } } @@ -110,7 +112,7 @@ void WebPopupMenu::show(const IntRect& rect, FrameView* view, int index) PlatformPopupMenuData platformData; setUpPlatformData(pageCoordinates, platformData); - WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, items, index, platformData), m_page->pageID()); + WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, m_popupClient->menuStyle().textDirection(), items, index, platformData), m_page->pageID()); } void WebPopupMenu::hide() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp index acec5f2..b875f32 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp @@ -20,6 +20,7 @@ */ +#include "config.h" #include "WebSearchPopupMenu.h" using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp index db9500a..b21be47 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuClient.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp deleted file mode 100644 index b3c1289..0000000 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Portions Copyright (c) 2010 Motorola Mobility, 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 "WebDatabaseManager.h" - -#include "NotImplemented.h" - -namespace WebKit { - -String WebDatabaseManager::databaseDirectory() const -{ - notImplemented(); - return String(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp index 6cda476..b6d71bb 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPopupMenu.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm index 32d08b2..750a397 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebContextMenuClient.h" +#import "config.h" +#import "WebContextMenuClient.h" -#include "NotImplemented.h" -#include "WebPage.h" -#include <WebCore/Frame.h> -#include <WebCore/Page.h> -#include <wtf/text/WTFString.h> +#import "NotImplemented.h" +#import "WebPage.h" +#import <WebCore/Frame.h> +#import <WebCore/Page.h> +#import <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm deleted file mode 100644 index d4eb3ac..0000000 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm +++ /dev/null @@ -1,42 +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 "WebDatabaseManager.h" - -namespace WebKit { - -NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; - -String WebDatabaseManager::databaseDirectory() const -{ - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; - if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) - databasesDirectory = @"~/Library/WebKit/Databases"; - - return [databasesDirectory stringByStandardizingPath]; -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm index 9952e3f..5169b23 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm @@ -23,10 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" +#import "WebDragClient.h" + #import "PasteboardTypes.h" #import "ShareableBitmap.h" #import "WebCoreArgumentCoders.h" -#import "WebDragClient.h" #import "WebPage.h" #import "WebPageProxyMessages.h" #import <WebCore/CachedImage.h> @@ -45,35 +47,8 @@ using namespace WebCore; namespace WebKit { -const float DragLabelBorderX = 4; -//Keep border_y in synch with DragController::LinkDragBorderInset -const float DragLabelBorderY = 2; -const float DragLabelRadius = 5; -const float LabelBorderYOffset = 2; - -const float MinDragLabelWidthBeforeClip = 120; -const float MaxDragLabelWidth = 320; - -const float DragLinkLabelFontsize = 11; -const float DragLinkUrlFontSize = 10; - using namespace WebCore; - -static Font& fontFromNSFont(NSFont *font) -{ - static NSFont *currentFont; - DEFINE_STATIC_LOCAL(Font, currentRenderer, ()); - - if ([font isEqual:currentFont]) - return currentRenderer; - if (currentFont) - CFRelease(currentFont); - currentFont = font; - CFRetain(currentFont); - currentRenderer = Font(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]); - return currentRenderer; -} - + void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag) { if (!frame) @@ -98,88 +73,6 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const m_page->send(Messages::WebPageProxy::SetDragImage(clientPoint, IntSize([dragNSImage size]), handle, linkDrag)); } -DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& title, Frame* frame) -{ - if (!frame) - return nil; - NSString *label = 0; - if (!title.isEmpty()) - label = title; - NSURL *cocoaURL = url; - NSString *urlString = [cocoaURL _web_userVisibleString]; - - BOOL drawURLString = YES; - BOOL clipURLString = NO; - BOOL clipLabelString = NO; - - if (!label) { - drawURLString = NO; - label = urlString; - } - - NSFont *labelFont = [[NSFontManager sharedFontManager] convertFont:[NSFont systemFontOfSize:DragLinkLabelFontsize] - toHaveTrait:NSBoldFontMask]; - NSFont *urlFont = [NSFont systemFontOfSize:DragLinkUrlFontSize]; - NSSize labelSize; - labelSize.width = [label _web_widthWithFont: labelFont]; - labelSize.height = [labelFont ascender] - [labelFont descender]; - if (labelSize.width > MaxDragLabelWidth){ - labelSize.width = MaxDragLabelWidth; - clipLabelString = YES; - } - - NSSize imageSize; - imageSize.width = labelSize.width + DragLabelBorderX * 2; - imageSize.height = labelSize.height + DragLabelBorderY * 2; - if (drawURLString) { - NSSize urlStringSize; - urlStringSize.width = [urlString _web_widthWithFont: urlFont]; - urlStringSize.height = [urlFont ascender] - [urlFont descender]; - imageSize.height += urlStringSize.height; - if (urlStringSize.width > MaxDragLabelWidth) { - imageSize.width = max(MaxDragLabelWidth + DragLabelBorderY * 2, MinDragLabelWidthBeforeClip); - clipURLString = YES; - } else - imageSize.width = max(labelSize.width + DragLabelBorderX * 2, urlStringSize.width + DragLabelBorderX * 2); - } - NSImage *dragImage = [[[NSImage alloc] initWithSize: imageSize] autorelease]; - [dragImage lockFocus]; - - [[NSColor colorWithDeviceRed: 0.7f green: 0.7f blue: 0.7f alpha: 0.8f] set]; - - // Drag a rectangle with rounded corners - NSBezierPath *path = [NSBezierPath bezierPath]; - [path appendBezierPathWithOvalInRect: NSMakeRect(0, 0, DragLabelRadius * 2, DragLabelRadius * 2)]; - [path appendBezierPathWithOvalInRect: NSMakeRect(0, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)]; - [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, imageSize.height - DragLabelRadius * 2, DragLabelRadius * 2, DragLabelRadius * 2)]; - [path appendBezierPathWithOvalInRect: NSMakeRect(imageSize.width - DragLabelRadius * 2, 0, DragLabelRadius * 2, DragLabelRadius * 2)]; - - [path appendBezierPathWithRect: NSMakeRect(DragLabelRadius, 0, imageSize.width - DragLabelRadius * 2, imageSize.height)]; - [path appendBezierPathWithRect: NSMakeRect(0, DragLabelRadius, DragLabelRadius + 10, imageSize.height - 2 * DragLabelRadius)]; - [path appendBezierPathWithRect: NSMakeRect(imageSize.width - DragLabelRadius - 20, DragLabelRadius, DragLabelRadius + 20, imageSize.height - 2 * DragLabelRadius)]; - [path fill]; - - NSColor *topColor = [NSColor colorWithDeviceWhite:0.0f alpha:0.75f]; - NSColor *bottomColor = [NSColor colorWithDeviceWhite:1.0f alpha:0.5f]; - if (drawURLString) { - if (clipURLString) - //urlString = [WebStringTruncator centerTruncateString: urlString toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:urlFont]; - urlString = StringTruncator::centerTruncate(urlString, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(urlFont)); - [urlString _web_drawDoubledAtPoint:NSMakePoint(DragLabelBorderX, DragLabelBorderY - [urlFont descender]) - withTopColor:topColor bottomColor:bottomColor font:urlFont]; - } - - if (clipLabelString) - //label = [WebStringTruncator rightTruncateString: label toWidth:imageSize.width - (DragLabelBorderX * 2) withFont:labelFont]; - label = StringTruncator::rightTruncate(label, imageSize.width - (DragLabelBorderX * 2), fontFromNSFont(labelFont)); - [label _web_drawDoubledAtPoint:NSMakePoint (DragLabelBorderX, imageSize.height - LabelBorderYOffset - [labelFont pointSize]) - withTopColor:topColor bottomColor:bottomColor font:labelFont]; - - [dragImage unlockFocus]; - - return dragImage; -} - static void writeURL(NSPasteboard* pasteboard, NSURL* URL, NSString* title, NSArray* types) { ASSERT(URL); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm index ce33890..ee87ea2 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -27,26 +27,27 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebEditorClient.h" #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 -#include "NotImplemented.h" - -#include "WebCoreArgumentCoders.h" -#include "WebPage.h" -#include "WebFrame.h" -#include "WebPageProxyMessages.h" -#include "WebProcess.h" -#include <WebCore/ArchiveResource.h> -#include <WebCore/DocumentFragment.h> -#include <WebCore/DOMDocumentFragmentInternal.h> -#include <WebCore/DOMDocumentInternal.h> -#include <WebCore/FocusController.h> -#include <WebCore/Frame.h> -#include <WebCore/KeyboardEvent.h> -#include <WebCore/Page.h> -#include <WebKit/WebResource.h> -#include <WebKit/WebNSURLExtras.h> +#import "NotImplemented.h" + +#import "WebCoreArgumentCoders.h" +#import "WebPage.h" +#import "WebFrame.h" +#import "WebPageProxyMessages.h" +#import "WebProcess.h" +#import <WebCore/ArchiveResource.h> +#import <WebCore/DocumentFragment.h> +#import <WebCore/DOMDocumentFragmentInternal.h> +#import <WebCore/DOMDocumentInternal.h> +#import <WebCore/FocusController.h> +#import <WebCore/Frame.h> +#import <WebCore/KeyboardEvent.h> +#import <WebCore/Page.h> +#import <WebKit/WebResource.h> +#import <WebKit/WebNSURLExtras.h> #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) #import <AppKit/NSTextChecker.h> #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm index 549d7ee..677c537 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebErrors.h" - -#include "WKError.h" -#include "WebError.h" -#include <WebCore/ResourceRequest.h> -#include <WebCore/ResourceResponse.h> -#include <pthread.h> +#import "config.h" +#import "WebErrors.h" + +#import "WKError.h" +#import "WebError.h" +#import <WebCore/ResourceRequest.h> +#import <WebCore/ResourceResponse.h> +#import <pthread.h> using namespace WebCore; using namespace WebKit; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm index 570d351..d91e8e8 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm @@ -17,6 +17,7 @@ Boston, MA 02110-1301, USA. */ +#import "config.h" #import "WebFrameNetworkingContext.h" #import <WebCore/Page.h> diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm index 4d3d167..7e446b7 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm @@ -23,9 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPopupMenu.h" +#import "config.h" +#import "WebPopupMenu.h" -#include "PlatformPopupMenuData.h" +#import "PlatformPopupMenuData.h" using namespace WebCore; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index f81b627..2d74bbc 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebSystemInterface.h" #import <WebCore/WebCoreSystemInterface.h> @@ -55,6 +56,7 @@ void InitWebCoreSystemInterface(void) INIT(GetFontInLanguageForRange); INIT(GetGlyphTransformedAdvances); INIT(GetGlyphsForCharacters); + INIT(GetHTTPPipeliningPriority); INIT(GetMIMETypeForExtension); INIT(GetNSURLResponseLastModifiedDate); INIT(GetPreferredExtensionForMIMEType); @@ -82,6 +84,7 @@ void InitWebCoreSystemInterface(void) INIT(SetCONNECTProxyForStream); INIT(SetCookieStoragePrivateBrowsingEnabled); INIT(SetDragImage); + INIT(SetHTTPPipeliningPriority); INIT(SetNSURLConnectionDefersCallbacks); INIT(SetNSURLRequestShouldContentSniff); INIT(SetPatternBaseCTM); @@ -92,11 +95,51 @@ void InitWebCoreSystemInterface(void) INIT(SignalCFReadStreamHasBytes); #if !defined(BUILDING_ON_SNOW_LEOPARD) + INIT(IOSurfaceContextCreate); + INIT(IOSurfaceContextCreateImage); INIT(CreateCTTypesetterWithUniCharProviderAndOptions); INIT(MakeScrollbarPainter); + INIT(ScrollbarPainterSetDelegate); INIT(ScrollbarPainterPaint); + INIT(ScrollbarThickness); + INIT(ScrollbarMinimumThumbLength); + INIT(ScrollbarMinimumTotalLengthNeededForThumb); + INIT(ScrollbarPainterKnobAlpha); + INIT(SetScrollbarPainterKnobAlpha); + INIT(ScrollbarPainterTrackAlpha); + INIT(SetScrollbarPainterTrackAlpha); + INIT(ScrollbarPainterIsHorizontal); + INIT(ScrollbarPainterSetOverlayState); + INIT(MakeScrollbarPainterController); + INIT(MakeScrollbarReplacementPainter); + INIT(SetPainterForPainterController); + INIT(VerticalScrollbarPainterForController); + INIT(HorizontalScrollbarPainterForController); + INIT(SetScrollbarPainterControllerStyle); + INIT(ContentAreaScrolled); + INIT(ContentAreaWillPaint); + INIT(MouseEnteredContentArea); + INIT(MouseExitedContentArea); + INIT(MouseMovedInContentArea); + INIT(WillStartLiveResize); + INIT(ContentAreaResized); + INIT(WillEndLiveResize); + INIT(ContentAreaDidShow); + INIT(ContentAreaDidHide); + INIT(ScrollbarPainterUsesOverlayScrollers); #else INIT(GetHyphenationLocationBeforeIndex); #endif + + INIT(GetAXTextMarkerTypeID); + INIT(GetAXTextMarkerRangeTypeID); + INIT(CreateAXTextMarker); + INIT(GetBytesFromAXTextMarker); + INIT(CreateAXTextMarkerRange); + INIT(CopyAXTextMarkerRangeStart); + INIT(CopyAXTextMarkerRangeEnd); + INIT(AccessibilityHandleFocusChanged); + INIT(CreateAXUIElementRef); + INIT(UnregisterUniqueIdForElement); }); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp index abfb70a..f6c45b0 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuClient.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp deleted file mode 100644 index 11f929c..0000000 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp +++ /dev/null @@ -1,36 +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 "WebDatabaseManager.h" - -namespace WebKit { - -String WebDatabaseManager::databaseDirectory() const -{ - // FIXME: Implement. - return ""; -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp index cee6842..61c2a3a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebErrors.h" #include <WebCore/ResourceRequest.h> diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp index 55552e1..5fcaa84 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp @@ -18,7 +18,6 @@ */ #include "config.h" - #include "WebFrameNetworkingContext.h" #include "WebProcess.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp index 4d3d167..b21f06c 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPopupMenu.h" #include "PlatformPopupMenuData.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp index c16a4d6..c866c1d 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuClient.h" #include <WebCore/NotImplemented.h> diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp deleted file mode 100644 index b6d15fd..0000000 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp +++ /dev/null @@ -1,39 +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 "WebDatabaseManager.h" - -#include <WebCore/FileSystem.h> - -using namespace WebCore; - -namespace WebKit { - -String WebDatabaseManager::databaseDirectory() const -{ - return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases"); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp new file mode 100644 index 0000000..7381096 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragClientWin.cpp @@ -0,0 +1,89 @@ +/* + * 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 "WebDragClient.h" + +#include "ShareableBitmap.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include <WebCore/BitmapInfo.h> +#include <WebCore/COMPtr.h> +#include <WebCore/ClipboardWin.h> +#include <WebCore/DragController.h> +#include <WebCore/Frame.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/Page.h> +#include <shlobj.h> + +using namespace WebCore; + +namespace WebKit { + +static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op) +{ + DWORD result = DROPEFFECT_NONE; + if (op == DragOperationEvery) + return DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE; + if (op & DragOperationCopy) + result |= DROPEFFECT_COPY; + if (op & DragOperationLink) + result |= DROPEFFECT_LINK; + if (op & DragOperationMove) + result |= DROPEFFECT_MOVE; + if (op & DragOperationGeneric) + result |= DROPEFFECT_MOVE; + return result; +} + +void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, Clipboard* clipboard, Frame* frame, bool isLink) +{ + COMPtr<IDataObject> dataObject = static_cast<ClipboardWin*>(clipboard)->dataObject(); + + if (!dataObject) + return; + + OwnPtr<HDC> bitmapDC(CreateCompatibleDC(0)); + BITMAPINFO bitmapInfo = {0}; + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + GetDIBits(bitmapDC.get(), image, 0, 0, 0, &bitmapInfo, DIB_RGB_COLORS); + if (bitmapInfo.bmiHeader.biSizeImage <= 0) + bitmapInfo.bmiHeader.biSizeImage = bitmapInfo.bmiHeader.biWidth * abs(bitmapInfo.bmiHeader.biHeight) * (bitmapInfo.bmiHeader.biBitCount + 7) / 8; + + RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(bitmapInfo.bmiHeader.biSizeImage); + + bitmapInfo.bmiHeader.biCompression = BI_RGB; + GetDIBits(bitmapDC.get(), image, 0, bitmapInfo.bmiHeader.biHeight, memoryBuffer->data(), &bitmapInfo, DIB_RGB_COLORS); + + SharedMemory::Handle handle; + if (!memoryBuffer->createHandle(handle, SharedMemory::ReadOnly)) + return; + DWORD okEffect = draggingSourceOperationMaskToDragCursors(m_page->corePage()->dragController()->sourceDragOperation()); + DragData dragData(dataObject.get(), IntPoint(), IntPoint(), DragOperationNone); + m_page->send(Messages::WebPageProxy::StartDragDrop(imageOrigin, dragPoint, okEffect, dragData.dragDataMap(), IntSize(bitmapInfo.bmiHeader.biWidth, bitmapInfo.bmiHeader.biHeight), handle, isLink), m_page->pageID()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp new file mode 100644 index 0000000..b4f1414 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.cpp @@ -0,0 +1,87 @@ +/* + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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 "WebDragSource.h" + +#include <WebCore/Cursor.h> +#include <WebCore/DragActions.h> +#include <WebCore/EventHandler.h> +#include <WebCore/Frame.h> +#include <WebCore/Page.h> +#include <WebCore/PlatformMouseEvent.h> +#include <wtf/CurrentTime.h> + +using namespace WebCore; + +PassRefPtr<WebDragSource> WebDragSource::createInstance() +{ + return adoptRef(new WebDragSource); +} + +WebDragSource::WebDragSource() +{ +} + +HRESULT WebDragSource::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDropSource)) { + *ppvObject = this; + AddRef(); + + return S_OK; + } + + return E_NOINTERFACE; +} + +ULONG WebDragSource::AddRef(void) +{ + ref(); + return refCount(); +} + +ULONG WebDragSource::Release(void) +{ + deref(); + return refCount(); +} + +HRESULT WebDragSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfState) +{ + if (fEscapePressed) + return DRAGDROP_S_CANCEL; + + if (grfState & (MK_LBUTTON | MK_RBUTTON)) + return S_OK; + + return DRAGDROP_S_DROP; +} + +HRESULT WebDragSource::GiveFeedback(DWORD dwEffect) +{ + return DRAGDROP_S_USEDEFAULTCURSORS; +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h new file mode 100644 index 0000000..c2c5f3f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDragSource.h @@ -0,0 +1,46 @@ +/* + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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 WebDragSource_h +#define WebDragSource_h + +#include <WTF/RefCounted.h> +#include <WebCore/COMPtr.h> +#include <objidl.h> + +class WebDragSource : public IDropSource, public RefCounted<WebDragSource> { +public: + static PassRefPtr<WebDragSource> createInstance(); + +private: + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfState); + virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect); + WebDragSource(); +}; + +#endif // !WebDragSource_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp index b29b461..b31920c 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebErrors.h" #include "WKError.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp index 9c23133..b80dccd 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPopupMenu.h" #include "PlatformPopupMenuData.h" @@ -49,7 +50,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl data.m_clientPaddingRight = m_popupClient->clientPaddingRight(); data.m_clientInsetLeft = m_popupClient->clientInsetLeft(); data.m_clientInsetRight = m_popupClient->clientInsetRight(); - data.m_itemHeight = m_popupClient->menuStyle().font().height() + 1; + data.m_itemHeight = m_popupClient->menuStyle().font().fontMetrics().height() + 1; int popupWidth = 0; for (size_t i = 0; i < itemCount; ++i) { @@ -115,7 +116,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl unsigned length = itemText.length(); const UChar* string = itemText.characters(); - TextRun textRun(string, length, false, 0, 0, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft); + TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft); notSelectedBackingStoreContext->setFillColor(optionTextColor, ColorSpaceDeviceRGB); selectedBackingStoreContext->setFillColor(activeOptionTextColor, ColorSpaceDeviceRGB); @@ -133,7 +134,7 @@ void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, Pl int textX = std::max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft); if (RenderTheme::defaultTheme()->popupOptionSupportsTextIndent() && itemStyle.textDirection() == LTR) textX += itemStyle.textIndent().calcMinValue(itemRect.width()); - int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2; + int textY = itemRect.y() + itemFont.fontMetrics().ascent() + (itemRect.height() - itemFont.fontMetrics().height()) / 2; notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); selectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); |