diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 08:15:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-25 08:15:24 -0700 |
commit | fa91a01aee5d4a80ca6c80f722116b850f09996c (patch) | |
tree | f72740e60d3c3d4f0ab144e88c03d1f134944ce3 /Source/WebKit2 | |
parent | 96f37d6d1b390f6690858789706ee6ec25bc1677 (diff) | |
parent | feebf8e7a79ad68b04a1a948e2b8078d6e5f0048 (diff) | |
download | external_webkit-fa91a01aee5d4a80ca6c80f722116b850f09996c.zip external_webkit-fa91a01aee5d4a80ca6c80f722116b850f09996c.tar.gz external_webkit-fa91a01aee5d4a80ca6c80f722116b850f09996c.tar.bz2 |
Merge changes I78ff6a85,Ic85c6405,Ibf903baa,I3a0459db,I35140385,I54790419,I6bfe5d24,Ia9f39b83,I5bcecd5a,I1de96683,I543c6810,I8a5b0878,I0ae670bf,Ide4d58dc,I28ebaf3d,I499d6631,Ie5090e0d,I6d3e5f1f
* changes:
Merge WebKit at r78450: Update ThirdPartyProject.prop
Merge WebKit at r78450: Add new Font::canExpandAroundIdeographsInComplexText()
Merge WebKit at r78450: Add new ChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
Merge WebKit at r78450: FrameLoaderClient::didRunInsecureContent() signature changed
Merge WebKit at r78450: HTMLAreaElement::getRect() renamed
Merge WebKit at r78450: FrameLoader::url() removed
Merge WebKit at r78450: HTMLParserQuirks removed
Merge WebKit at r78450: TextRun::padding() renamed
Merge WebKit at r78450: Use new FontMetrics
Merge WebKit at r78450: GraphicsContext current path removed
Merge WebKit at r78450: TransformationMatrix multiply methods renamed and meaning changed
Merge WebKit at r78450: FontCustomPlatformData::fontPlatformData() signature changed
Merge WebKit at r78450: IntRect::bottom()/right() renamed
Merge WebKit at r78450: Fix remaining conflicts
Merge WebKit at r78450: Fix conflicts due to new ENABLE_WEB_ARCHIVE guard
Merge WebKit at r78450: Fix conflicts in media controls
Merge WebKit at r78450: Fix Makefiles
Merge WebKit at r78450: Initial merge by git.
Diffstat (limited to 'Source/WebKit2')
574 files changed, 15694 insertions, 2646 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index e83c4ed..9f916ac 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,5475 @@ +2011-02-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + Speculative fix for + + <rdar://problem/8995361> + CrashTracer: [USER] 47 crashes in WebProcess at com.apple.WebKit2: WebKit::WebPage::layoutIfNeeded + 4 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::~DrawingAreaImpl): + Invalidate the layer tree host. + +2011-02-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + The plug-in process heap should be executable by default + https://bugs.webkit.org/show_bug.cgi?id=54364 + <rdar://problem/8990563> + + * UIProcess/Launcher/ProcessLauncher.h: + Add executableHeap flag. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + Set the right posix_spawn flag if executableHeap is true. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::PluginProcessProxy): + Initialize executableHeap to true. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::connect): + Initialize executableHeap to false. + +2011-02-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Messages waited on are never dispatched + https://bugs.webkit.org/show_bug.cgi?id=54362 + <rdar://problem/8995051> + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::processIncomingMessage): + Get the argument encoder from the incoming message. + +2011-02-13 Jeremy Moskovich <jeremy@chromium.org> + + Reviewed by Adam Barth. + + Add a compile-time option to completely disable WebArchive support. + https://bugs.webkit.org/show_bug.cgi?id=52712 + + Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2011-02-13 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=54348 + Crash when printing a document with no pages + + * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawPagesToPDF): Don't fail on a fake + page that computePagesForPrinting() added to a pageless document. + +2011-02-13 Chris Fleizach <cfleizach@apple.com> + + Reviewed and landed by Sam Weinig. + + AX: Update WK2 usage of remote accessibility api + https://bugs.webkit.org/show_bug.cgi?id=54220 + + Rename some of the remote accessibility methods to be more accurate. + Make sure to unregister the AccessibilityWebPageObject on dealloc. + Send the window remote token along with the WKView remote token. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::accessibilityWebProcessTokenReceived): + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateRemoteAccessibilityRegistration:]): + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView viewDidMoveToWindow]): + (-[WKView _processDidCrash]): + (-[WKView _pageClosed]): + (-[WKView _setAccessibilityWebProcessToken:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::registerWebProcessAccessibilityToken): + (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: + (-[AccessibilityWebPageObject dealloc]): + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::platformInitialize): + (WebKit::WebPage::registerUIProcessAccessibilityTokens): + +2011-02-11 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=54335 + <rdar://problem/8895141> Make window.print() work with WebKit2 + + * Platform/CoreIPC/Connection.h: Corrected a typo in FIXME comment. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + (WebKit::ChunkedUpdateDrawingAreaProxy::sendSetSize): + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::sizeDidChange): + (WebKit::TiledDrawingAreaProxy::setPageIsVisible): + (WebKit::TiledDrawingAreaProxy::takeSnapshot): + (WebKit::TiledDrawingAreaProxy::removeTile): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::sizeDidChange): + (WebKit::LayerBackedDrawingAreaProxy::setPageIsVisible): + (WebKit::LayerBackedDrawingAreaProxy::update): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::postMessageToInjectedBundle): + Updated for send() -> deprecatedSend() rename. + + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Added a flag that's true while serving window.print(). + (WebKit::WebPageProxy::printFrame): Set and unset m_isPerformingDOMPrintOperation. + (WebKit::WebPageProxy::beginPrinting): Force message processing in web process when serving + window.print(). + (WebKit::WebPageProxy::endPrinting): Ditto. + (WebKit::WebPageProxy::computePagesForPrinting): Ditto. + (WebKit::WebPageProxy::drawRectToPDF): Ditto. + (WebKit::WebPageProxy::drawPagesToPDF): Ditto. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + (WebKit::WebProcessProxy::sendMessage): + (WebKit::WebProcessProxy::didFinishLaunching): + When waiting for a web process to launch, store message flags, too. This is not practically + important for DispatchMessageEvenWhenWaitingForSyncReply, but it's easier to store flags + than to remember about this pitfall. + + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): Added a flags argument, matching Connection::send(). + (WebKit::WebProcessProxy::deprecatedSend): Renamed one of send() overloads, because it was + conflicting with the other one after adding a flags argument. This matches a change previously + made to CoreIPC::Connection. + +2011-02-12 Chris Marrin <cmarrin@apple.com> + + Reviewed by Dan Bernstein. + + Crash in RenderLayerCompositor::updateCompositingLayers when loading some sites + https://bugs.webkit.org/show_bug.cgi?id=54345 + + Some sites flip between composited and non-comosited state while loading. When the timing is + right, when we flip out of compositing we will need to do a display while tossing all the + compositing layers. This causes us to reenter RenderLayerCompositor::computeCompositingRequirements() + while we are in the middle of tossing layers, which leads to a crash. + + The solution is to defer the logic of exiting compositing mode until the DrawingArea is finished + doing its display, using a timer. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::DrawingAreaImpl): + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingModeSoon): + * WebProcess/WebPage/DrawingAreaImpl.h: + +2011-02-12 Kevin Decker <kdecker@apple.com> + + Reviewed by Dan Bernstein. + + Follow up fix to: + https://bugs.webkit.org/show_bug.cgi?id=54341 - optionally scale snapshots in document view coordinates + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaledSnapshotInDocumentCoordinates): Fixed the order of the scale and translate. + +2011-02-12 Kevin Decker <kdecker@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=54341 - optionally scale snapshots in document view coordinates + <rdar://problem/8990069> + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCreateScaledSnapshotInDocumentCoordinates): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Added above new function. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaledSnapshotInDocumentCoordinates): Added. + (WebKit::WebPage::snapshotInDocumentCoordinates): Call scaledSnapshotInDocumentCoordinates with a scale of 1. + * WebProcess/WebPage/WebPage.h: Added scaledSnapshotInDocumentCoordinates(). + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + Can’t open local files on reload or navigation from the back/forward cache + https://bugs.webkit.org/show_bug.cgi?id=54332 + <rdar://problem/8903076> + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::isInspectorPage): + * UIProcess/WebInspectorProxy.h: + Check whether the given page is a web inspector page. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeSandboxExtensionHandle): + If this is a web inspector page, we don't want to make a sandbox extension. + + (WebKit::WebPageProxy::reattachToWebProcessWithItem): + (WebKit::WebPageProxy::goForward): + (WebKit::WebPageProxy::goBack): + (WebKit::WebPageProxy::goToBackForwardItem): + Pass a sandbox extension along when sending the message. + + * UIProcess/WebPageProxy.h: + Make initializeSandboxExtensionHandle a member function. + + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::restoreFromSessionStateData): + Pass a sandbox extension along. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::goForward): + (WebKit::WebPage::goBack): + (WebKit::WebPage::goToBackForwardItem): + Hand the sandbox extension to the sandbox extension tracker. + + (WebKit::WebPage::restoreSessionAndNavigateToCurrentItem): + Pass the sandbox extension to goToBackForwardItem. + + (WebKit::shouldReuseCommittedSandboxExtension): + New function that checks whether a committed sandbox extension should be re-used. We + do this for page reloads, as well as regular page navigations when both the committed + and provisional documents have file URLs. + + (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad): + Reuse the committed sandbox extension if necessary. + + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Fix Snow Leopard build. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::didFailToSendSyncMessage): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didFailToSendSyncMessage): + +2011-02-11 Yael Aharon <yael.aharon@nokia.com> + + Unreviewed Qt webkit2 build fix after r78392. + + * WebProcess/WebProcess.h: + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebProcess hung communicating with the plug-in process + https://bugs.webkit.org/show_bug.cgi?id=54328 + <rdar://problem/8854075> + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::createWebProcessConnection): + Add the DispatchMessageEvenWhenWaitingForSyncReply message send flag when sending the + PluginProcess::CreateWebProcessConnection message, since the plug-in process can be busy waiting + for a sync reply from the web process. + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Incoming synchronous messages should always be processed regardless of connection waiting for a reply + https://bugs.webkit.org/show_bug.cgi?id=54326 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::SyncMessageState::getOrCreate): + Assert that the map has a non-null SyncMessageState object. + + (CoreIPC::Connection::SyncMessageState::SyncMessageState): + Initialize m_waitForSyncReplyCount. + + (CoreIPC::Connection::SyncMessageState::beginWaitForSyncReply): + Increment m_waitForSyncReplyCount. + + (CoreIPC::Connection::SyncMessageState::endWaitForSyncReply): + Decrement m_waitForSyncReplyCount. If it's 0, enqueue any incoming sync messages. + + (CoreIPC::Connection::SyncMessageState::processIncomingMessage): + If this is a message that needs to be dispatched, add it to the queue and wake up the client run loop. + + (CoreIPC::Connection::SyncMessageState::dispatchMessages): + Go through the queue of incoming messages and dispatch them. + + (CoreIPC::Connection::sendSyncMessage): + call beginWaitForSyncReply/endWaitForSyncReply. + + (CoreIPC::Connection::waitForSyncReply): + Dispatch messages. + + (CoreIPC::Connection::processIncomingMessage): + Call SyncMessageState::processIncomingMessage. + + (CoreIPC::Connection::enqueueIncomingMessage): + Add helper function for enqueuing an incoming message. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::Message::destinationID): + +2011-02-11 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + WebKit2: Going to Ars Technica crashes WebProcess in WebCore::ResourceRequestBase::url() const + 9 + <rdar://problem/8978832> + + Speculative fix for crash accessing a bad ResourceRequest in policy + client code. Remove early returns from dispatchDecidePolicyForMIMEType + and dispatchDecidePolicyForNavigationAction that are not present in the WebKit1 + equivalent code. This should be safe, now that the IPC calls are synchronous. + + Also removes some invalid assertions in WebFrameProxy that were getting hit. It is okay + for the url to empty. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameProxy::didFailProvisionalLoad): + (WebKit::WebFrameProxy::didFailLoad): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + +2011-02-11 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler and Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=53593 + <rdar://problem/8948380> Crash beneath HistoryController::recursiveSetProvisionalItem in web + process (preceded by assertion failure) if UI process exits while + Messages::WebPage::RestoreSessionAndNavigateToCurrentItem is being handled + + Can't test exiting the UI process. + + * Platform/CoreIPC/Connection.cpp: (CoreIPC::Connection::sendSyncMessage): + * Platform/CoreIPC/Connection.h: (CoreIPC::Connection::Client::didFailToSendSyncMessage): + Notify connection client when the connection fails to send a sync message. + + * WebProcess/WebProcess.cpp: (WebKit::WebProcess::didFailToSendSyncMessage): + * WebProcess/WebProcess.h: + Quit the web process immediately if it tried to send a sync message to a dead UI process. + It never needs to continue and handle an unexpected null "reply". + + * PluginProcess/PluginProcess.cpp: (WebKit::PluginProcess::didFailToSendSyncMessage): + * PluginProcess/PluginProcess.h: + Ditto. There is no need for a plug-in to keep running even briefly if it couldn't get a + reply to a sync message. + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a way to send async messages that can't get out of order with sync ones + https://bugs.webkit.org/show_bug.cgi?id=54319 + <rdar://problem/8894844> + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + sendMessage now takes a messageSendFlags. Update the messageID if the + messageSendFlags contain DispatchMessageEvenWhenWaitingForSyncReply. + + (CoreIPC::Connection::waitForSyncReply): + Process asynchronous messages as well. + + (CoreIPC::Connection::processIncomingMessage): + Check if a message should be dispatched even when we're waiting for a + synchronous reply. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::send): + Send now takes a messageSendFlags parameter. + + * Platform/CoreIPC/MessageID.h: + (CoreIPC::MessageID::messageIDWithAddedFlags): + Return a new MessageID object with the given flags added. + + (CoreIPC::MessageID::shouldDispatchMessageWhenWaitingForSyncReply): + Add getter. + +2011-02-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Crash with dynamic popup menu use + <rdar://problem/8716952> + + Invalidate popup menus when forcing them closed, since they might still be + in their tracking loop. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showPopupMenu): + (WebKit::WebPageProxy::hidePopupMenu): + * UIProcess/WebPopupMenuProxy.h: + (WebKit::WebPopupMenuProxy::invalidate): + * UIProcess/mac/WebPopupMenuProxyMac.mm: + (WebKit::WebPopupMenuProxyMac::showPopupMenu): + * UIProcess/win/WebPopupMenuProxyWin.cpp: + (WebKit::WebPopupMenuProxyWin::showPopupMenu): + (WebKit::WebPopupMenuProxyWin::setFocusedIndex): + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Actually initialize m_syncMessageState. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::Connection): + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move the binary semaphore into SyncMessageState + https://bugs.webkit.org/show_bug.cgi?id=54311 + + With this change, all connections that belong to the same run loop will use same binary semaphore. + This is in preparation for making any connection be able to wakeup the client run loop. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::SyncMessageState::wakeUpClientRunLoop): + (CoreIPC::Connection::SyncMessageState::wait): + (CoreIPC::Connection::waitForSyncReply): + (CoreIPC::Connection::processIncomingMessage): + (CoreIPC::Connection::connectionDidClose): + * Platform/CoreIPC/Connection.h: + +2011-02-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a SyncMessageState class to CoreIPC::Connection + https://bugs.webkit.org/show_bug.cgi?id=54309 + + SyncMessageState objects are shared between all connections scheduled on + a given run loop. It will be used to keep track of state when waiting + for replies for a synchronous message. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::SyncMessageState::syncMessageStateMap): + (CoreIPC::Connection::SyncMessageState::syncMessageStateMapMutex): + Add a global RunLoop -> SyncMessageState map and a mutex for locking. + + (CoreIPC::Connection::SyncMessageState::getOrCreate): + Look in the map for an existing SyncMessageState object and create a new + one if none is found. + + (CoreIPC::Connection::SyncMessageState::SyncMessageState): + Initialize m_runLoop. + + (CoreIPC::Connection::SyncMessageState::~SyncMessageState): + Remove the object from the map. + +2011-02-11 Enrica Casucci <enrica@apple.com> + + Reviewed by Darin Adler. + + crashes in WebProcess at WebCore::Range::startPosition const + 16 + https://bugs.webkit.org/show_bug.cgi?id=54294 + <rdar://problem/8982710> + + I don't have a repro case for this bugs, but the side-by-side + comparison of the IME support implementation in WebKit and WebKi2 + shows a missing null check on a Range that could very well explain + this crash. + I tried running platform/mac/editing/input tests with a version of WebKit + without the null check and I can reproduce a crash with the same signature. + These tests are not yet enabled for WebKit2. + + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::firstRectForCharacterRange): + +2011-02-11 Jeff Miller <jeffm@apple.com> + + Reviewed by Steve Falkenburg. + + Eliminate /DELAYLOAD:msimg32.dll ignored warning when building WebKit project + https://bugs.webkit.org/show_bug.cgi?id=54296 + + * win/WebKit2Common.vsprops: Remove msimg32.dll from the list of DelayLoadDLLs. + +2011-02-11 Chandra Vallala <chandra.vallala@motorola.com> and Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Implement UpdateChunk, ChunkedUpdateDrawingArea/Proxy + classes for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=54080 + + * GNUmakefile.am: + * Shared/gtk/UpdateChunk.cpp: Added. + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::~UpdateChunk): + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + (WebKit::UpdateChunk::createImage): + * Shared/gtk/UpdateChunk.h: Added. + (WebKit::UpdateChunk::rect): + (WebKit::UpdateChunk::isEmpty): + (WebKit::UpdateChunk::size): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + Initialize the surface. + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.h: Added cairo variables. + * UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::page): + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + +2011-02-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Repro crash with Sony Google TV ad at Gizmodo + https://bugs.webkit.org/show_bug.cgi?id=54150 + <rdar://problem/8782346> + + Re-landing this fix, bug without the test case, since it causes hangs on the bots. + https://bugs.webkit.org/show_bug.cgi?id=54171 tracks adding back the test. + + Since PluginView::evaluate can cause the plug-in element to go away, we need to protect it. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::~PluginView): + Null out m_pluginElement here so we'll catch crashes earlier. + + (WebKit::PluginView::evaluate): + Add a plug-in protector. + +2011-02-10 Alice Liu <alice.liu@apple.com> + + Reviewed by Enrica Casucci and Adele Peterson. + + WebKit2 pages gobble up cmd-I as an editing command in some cases where it shouldn't + https://bugs.webkit.org/show_bug.cgi?id=54254 + + * UIProcess/API/mac/WKView.mm: + (-[WKView _handleStyleKeyEquivalent:]): + Return early if we're not in an editable region. + +2011-02-10 Andreas Kling <kling@webkit.org> + + Unreviewed Qt build fix. + + waitFor() -> deprecatedWaitFor() + + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::waitUntilUpdatesComplete): + +2011-02-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move code to dispatch an incoming message out into a new function + https://bugs.webkit.org/show_bug.cgi?id=54239 + + This also fixes a leak where we wouldn't free ArgumentDecoder objects + after a connection has been invalidated. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchMessage): + (CoreIPC::Connection::dispatchMessages): + * Platform/CoreIPC/Connection.h: + +2011-02-10 Anders Carlsson <andersca@apple.com> + + Try again to fix the Qt build. + + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::sizeDidChange): + (WebKit::TiledDrawingAreaProxy::setPageIsVisible): + (WebKit::TiledDrawingAreaProxy::takeSnapshot): + (WebKit::TiledDrawingAreaProxy::removeTile): + +2011-02-10 Anders Carlsson <andersca@apple.com> + + Attempt to fix the Qt build. + + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::sizeDidChange): + (WebKit::TiledDrawingAreaProxy::setPageIsVisible): + (WebKit::TiledDrawingAreaProxy::requestTileUpdate): + (WebKit::TiledDrawingAreaProxy::takeSnapshot): + (WebKit::TiledDrawingAreaProxy::removeTile): + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::display): + (WebKit::TiledDrawingArea::setSize): + (WebKit::TiledDrawingArea::updateTile): + (WebKit::TiledDrawingArea::tileUpdateTimerFired): + (WebKit::TiledDrawingArea::didReceiveMessage): + +2011-02-10 Adam Roben <aroben@apple.com> + + Handle a null FindIndicator correctly + + We are passed a null FindIndicator when the find indicator becomes hidden. + + Fixes <http://webkit.org/b/54213> <rdar://problem/8983261> REGRESSION (r78198): Crash in + FindIndicator::contentImage when scrolling page + + Reviewed by Steve Falkenburg. + + * Platform/win/SharedMemoryWin.cpp: + (WebKit::SharedMemory::Handle::isNull): Implemented. + (WebKit::SharedMemory::create): Bail out if the handle is null, just like Mac does. + Otherwise assert that ::MapViewOfFile succeeded. This doesn't fix the bug, but should help + catch other errors. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setFindIndicator): Null-check the FindIndicator before dereferencing it. + Also changed the function to store the FindIndicator in a RefPtr. + +2011-02-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add 'deprecated' to the deprecated CoreIPC functions + https://bugs.webkit.org/show_bug.cgi?id=54223 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::send): + (CoreIPC::Connection::deprecatedSendSync): + (CoreIPC::Connection::deprecatedSend): + (CoreIPC::Connection::deprecatedWaitFor): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::open): + * PluginProcess/PluginProcess.cpp: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::createWebProcessConnection): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::postSynchronousMessage): + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::setSize): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::setSize): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + +2011-02-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Window resizer does not have a border when there are scrollbars in WebKit2 windows + <rdar://problem/8488476> + https://bugs.webkit.org/show_bug.cgi?id=54222 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::didChangeScrollbarsForMainFrame): + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateGrowBoxForWindowFrameChange]): + (-[WKView _didChangeScrollbarsForMainFrame]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::didChangeScrollbarsForMainFrame): + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeScrollbarsForMainFrame): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::didChangeScrollbarsForMainFrame): + * UIProcess/win/WebView.h: + +2011-02-10 Ivan Krstić <ike@apple.com> + + Reviewed by Adam Roben. + + Rename remaining instances of _HOME sandbox parameter. + <rdar://problem/8983428> + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-10 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Anders Carlsson. + + AX: AX needs to stop using WebCoreViewFactory + https://bugs.webkit.org/show_bug.cgi?id=54153 + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-02-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Sandbox violations trying to read crypto preferences. + <rdar://problem/8981151> + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-10 Peter Varga <pvarga@webkit.org> + + Reviewed by Csaba Osztrogonác. + + Remove PCRE source from trunk + https://bugs.webkit.org/show_bug.cgi?id=54188 + + * WebKit2.pro: + +2011-02-09 Adam Roben <aroben@apple.com> + + Turn on the new drawing area on Windows + + Fixes <http://webkit.org/b/53805> <rdar://problem/8960666> WebKit2 on Windows should use + DrawingAreaProxyImpl + + Reviewed by Darin Adler. + + * UIProcess/win/WebView.cpp: + (WebKit::useNewDrawingArea): Return true! + +2011-02-09 Adam Roben <aroben@apple.com> + + Hook up WM_PRINT to the new drawing area + + Fixes <http://webkit.org/b/54145> <rdar://problem/8979559> WM_PRINT doesn't work with new + drawing area (assertion failure in DrawingAreaProxyImpl in Debug builds) + + Reviewed by Darin Adler. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::paint): Added. Code came from onPaintEvent. + + (WebKit::WebView::onPaintEvent): + (WebKit::WebView::onPrintClientEvent): + Changed to call paint. + + * UIProcess/win/WebView.h: Added paint. Also separated message handler functions into their + own paragraph. + +2011-02-09 Adam Roben <aroben@apple.com> + + Notice when the backing store goes away after DidSetSize + + Fixes <http://webkit.org/b/54142> <rdar://problem/8979365> Crash in + DrawingAreaProxyImpl::paint when WKView paints after being resized while hidden + + Reviewed by Darin Adler. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::paint): Null-check m_backingStore after waiting for + DidSetSize, as m_backingStore can go away when we receive that message. This is the bug fix. + Also moved the accelerated compositing check inside the block where we wait for DidSetSize. + If we didn't wait for DidSetSize, we already know that we're not in accelerated compositing + mode (and asserted so earlier in this function). + +2011-02-09 Adam Roben <aroben@apple.com> + + Decode a null SharedMemory::Handle correctly on Windows + + Fixes <http://webkit.org/b/54141> <rdar://problem/8979195> WKView draws at wrong size, + performs badly if is resized while hidden (assertion fails in + BackingStore::incorporateUpdate in Debug builds) + + Reviewed by Darin Adler. + + * Platform/win/SharedMemoryWin.cpp: + (WebKit::getDuplicatedHandle): Added. Code came from decode. The only changes were to + null-check sourceHandle (this is the bug fix) and to assert when ::DuplicateHandle fails + (which would have caught the bug earlier). + (WebKit::SharedMemory::Handle::decode): Changed to use getDuplicatedHandle. + +2011-02-09 Adam Roben <aroben@apple.com> + + Don't invalidate outside of the WebPage's bounds + + Fixes <http://webkit.org/b/54123> <rdar://problem/8978383> Assertion failure in + BackingStore::BackingStore if a new WebPage becomes active before receiving a size + + Reviewed by Darin Adler. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setNeedsDisplay): Intersect the dirty rect with our bounds before + doing anything else. + (WebKit::DrawingAreaImpl::display): Added an assertion to help catch the bad case a little + earlier. + +2011-02-10 Eric Seidel <eric@webkit.org> + + Unreviewed, rolling out r78157. + http://trac.webkit.org/changeset/78157 + https://bugs.webkit.org/show_bug.cgi?id=54150 + + Fails on a bunch of bots + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::~PluginView): + (WebKit::PluginView::evaluate): + +2011-02-09 Brian Weinstein <bweinstein@apple.com> + + Rubber-stamped by Sam Weinig. + + Fix a typo in WebSecurityOrigin::protocol. + + * Shared/WebSecurityOrigin.h: + (WebKit::WebSecurityOrigin::protocol): This should return the protocol, not the domain. + +2011-02-09 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + File uploads do not work within the sandbox + <rdar://problem/8950518> + https://bugs.webkit.org/show_bug.cgi?id=54154 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChooseFilesForOpenPanel): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::extendSandboxForFileFromOpenPanel): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2011-02-09 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=54148 + <rdar://problem/8973887> REGRESSION (WebKit2): Opening two print dialogs causes havoc + + * UIProcess/API/mac/WKPrintingView.h: Moved _isForcingPreviewUpdate into a static variable, + because dispatching a notification affects all WKPrintingViews at once. + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView _updatePreview]): Updated for new variable name. + (-[WKPrintingView knowsPageRange:]): Don't break if the method is called twice in a row + (we already had this logic when printing from separate thread, but not for preview). + (-[WKPrintingView drawRect:]): Changed all LOG messages to have view object address for + easier matching. + (-[WKPrintingView rectForPage:]): Ditto. + (-[WKPrintingView beginDocument]): Ditto. + (-[WKPrintingView endDocument]): Ditto. + +2011-02-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Repro crash with Sony Google TV ad at Gizmodo + https://bugs.webkit.org/show_bug.cgi?id=54150 + + Since PluginView::evaluate can cause the plug-in element to go away, we need to protect it. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::~PluginView): + Null out m_pluginElement here so we'll catch crashes earlier. + + (WebKit::PluginView::evaluate): + Add a plug-in protector. + +2011-02-09 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Google Maps says it has horizontal scrollbars when it doesn't + <rdar://problem/8978005> + + We were updating the main frame's scrollbar state for changes to + frames other than the main frame. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebKit::WebChromeClient::WebChromeClient): + Change to bail out early if we are not looking at the main frame. Also + fix some silly typos and rename the variables to be more specific. + +2011-02-09 Ivan Krstić <ike@apple.com> + + Reviewed by Sam Weinig. + + Allow read-only access to mouse preferences from sandboxed WebProcess. + <rdar://problem/8975279> + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-09 Steve Falkenburg <sfalken@apple.com> + + Build fix. + + * win/MainWin.cpp: + (wWinMain): + +2011-02-09 Amruth Raj <amruthraj@motorola.com> and Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + [GTK] Implement Module class for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=48510 + + * GNUmakefile.am: + * Platform/Module.h: Added GModule handle for GTK port. + * Platform/gtk/ModuleGtk.cpp: Initial code using GModule calls. + (WebKit::Module::load): + (WebKit::Module::unload): + (WebKit::Module::platformFunctionPointer): + +2011-02-09 Chandra Vallala <chandra.vallala@motorola.com> and Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Implement WKBaseGtk API for Webkit2 + https://bugs.webkit.org/show_bug.cgi?id=54081 + + * GNUmakefile.am: Added new files to compilation. + * Shared/API/c/WKBase.h: Included WKBaseGtk.h in this file. + * Shared/API/c/gtk: Added. + * Shared/API/c/gtk/WKBaseGtk.h: Added. Declaration of WKViewRef + for GTK port. + * UIProcess/API/C/WKAPICast.h: Included WKAPICastGtk.h in this + file. + * UIProcess/API/C/gtk: Added. + * UIProcess/API/C/gtk/WKAPICastGtk.h: Added. Type definition + template for WKViewRef to WebView and vice-versa. + * UIProcess/API/C/gtk/WKView.cpp: Added. Implementation of WKView + API interface. + (WKViewCreate): + (WKViewGetWindow): + (WKViewGetPage): + (WKURLCreateWithURL): + * UIProcess/API/C/gtk/WKView.h: Added. Declaration of WKView API + interface. + +2011-02-09 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Add WebGraphicsContext stub to the compilation + https://bugs.webkit.org/show_bug.cgi?id=54078 + + * GNUmakefile.am: + * Shared/API/c/gtk/WKGraphicsContextGtk.cpp: Added stub just for + compilation. + (WKGraphicsContextGetGtkContext): + * Shared/API/c/gtk/WKGraphicsContextGtk.h: Added stub just for + compilation. + * Shared/WebGraphicsContext.cpp: + (WebKit::WebGraphicsContext::WebGraphicsContext): + * Shared/WebGraphicsContext.h: + (WebKit::WebGraphicsContext::platformContext): + +2011-02-09 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Add geolocation support to the webkit2 compilation + https://bugs.webkit.org/show_bug.cgi?id=54077 + + Add Geolocation files to the GTK compilation. + + * GNUmakefile.am: + +2011-02-09 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt][WK2] Don't generate superfluous forwarding header for config.h. + + * Scripts/generate-forwarding-headers.pl: + +2011-02-09 Adam Roben <aroben@apple.com> + + Hide the ugly details of WebView::m_window initialization from WebPageProxy, and make it + less ugly + + WebView::WebView was initially creating a hidden window, then showing it. It would tell + WebPageProxy about the window while it was still hidden, and then have to inform + WebPageProxy that the window had become shown. This resulted in WebPageProxy sending + unnecessary messages to the web process, and confused code that assumed that the window + would be in the same state after WebView's constructor exited as it was when WebPageProxy + first found out about the window. + + We now don't hide the window when creating it, which simplifies the code, and only tell + WebPageProxy about the window after we're done modifying it, which fixes the bug. + + Fixes <http://webkit.org/b/53878> <rdar://problem/8977306> Assertion failure in + DrawingAreaImpl::resumePainting after window.open or when opening Web Inspector + + Reviewed by Anders Carlsson. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): Changed ::CreateWindowEx to ::CreateWindowExW, to match other + Win32 API calls in WebKit2. Pass WS_VISIBLE to ::CreateWindowExW rather than waiting until + later to show the window. Added an assertion that m_isVisible matches the window's visible + state. Don't even create our WebPageProxy, or tell it about our window, until we're done + initializing our window, so that it doesn't get informed about our window's internal state + changes that happen beneath ::CreateWindowExW. + (WebKit::WebView::onSizeEvent): Null-check m_page since we can receive this message beneath + ::CreateWindowExW. + (WebKit::WebView::onShowWindowEvent): Ditto. Replaced one FIXME with another. Always set + handled to false so that ::DefWindowProcW can do its thing. (MSDN says this is when it + actually shows/hides the window, though I couldn't find any consequences of not calling + ::DefWindowProcW here.) + +2011-02-09 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: follow up on InspectorAgent split - + removing unnecessary methods from InspectorController. + https://bugs.webkit.org/show_bug.cgi?id=54093 + + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::showConsole): + (WebKit::WebInspector::stopJavaScriptProfiling): + +2011-02-09 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Avoid WebProcessMain compilation, we are used a gtk specific main + https://bugs.webkit.org/show_bug.cgi?id=54015 + + Avoided the compilation of the general WebProcessMain, and added + soup initialization to WebProcessMainGtk.cpp. + + * GNUmakefile.am: + * WebProcess/gtk/WebProcessMainGtk.cpp: + (WebKit::WebProcessMainGtk): + +2011-02-08 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Incorrect assertion in WorkQueueGtk, we need to register + more than one handle + https://bugs.webkit.org/show_bug.cgi?id=54014 + + Fixed assertion condition we need to register more than one + handler for the same file descriptor. + + * Platform/gtk/WorkQueueGtk.cpp: + (WorkQueue::registerEventSourceHandler): + +2011-02-08 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + Fix typo in the include guards name in ChunkedUpdateDrawingAreaProxy.h + https://bugs.webkit.org/show_bug.cgi?id=54013 + + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + +2011-02-08 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Fix after r77874, m_isConnected is initialized before the + socket is opened + https://bugs.webkit.org/show_bug.cgi?id=54011 + + Fixed connection breakage after r77874, we have to wait until open + the socket to open the connection. + + * Platform/CoreIPC/gtk/ConnectionGtk.cpp: + (CoreIPC::Connection::platformInitialize): + (CoreIPC::Connection::open): + +2011-02-08 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [WK2] LayerTreeContext is used outside the ACCELERATED_COMPOSITING + guards but not defined in DrawingAreaProxy.h + https://bugs.webkit.org/show_bug.cgi?id=54009 + + Removed the guards in the forward declaration, this will fail if + the class is finally used in the function, but it works for the + moment. + + * UIProcess/DrawingAreaProxy.h: + +2011-02-08 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + WebKit2 GTK Fails to Build #include nested too deeply + https://bugs.webkit.org/show_bug.cgi?id=52219 + + * GNUmakefile.am: Removed the commands to create the directories + for the forwarding headers, the script already does it for us. + * config.h: Removed the config.h inclusion and added the + autotoolsconfig.h directly, also added a condition to share the + defines with QT. + +2011-02-08 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Mark Rowe. + + Crash when going back/forward when back/forward list is in a bad state. + https://bugs.webkit.org/show_bug.cgi?id=54059 + <rdar://problem/8975244> + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::goForward): Add a null check. + (WebKit::WebPageProxy::goBack): ditto + +2011-02-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Beth Dakin. + + Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyImpl::incorporateUpdate() + https://bugs.webkit.org/show_bug.cgi?id=54046 + <rdar://problem/8973960> + + DrawingAreaImpl::setRootCompositingLayer can be called with a new layer even when already + in accelerated compositing mode. Similarly, it can be called with a null layer even when not + in accelerated compositing mode. Make the drawing area and layer tree host handle both these cases. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + Only call enterAcceleratedCompositingMode if there is no layer tree host, otherwise + just call LayerTreeHost::setRootCompositingLayer. + + (WebKit::DrawingAreaImpl::setSize): + Add an assert. + + (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): + Assert that we don't have a layer tree host. + + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + Assert that we do have a layer tree host. + + (WebKit::DrawingAreaImpl::display): + If the call to display caused the page to enter accelerated compositing mode, we don't + want to send back an Update message. + + * WebProcess/WebPage/LayerTreeHost.cpp: + (WebKit::LayerTreeHost::create): + * WebProcess/WebPage/LayerTreeHost.h: + Create no longer takes a graphics layer. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::create): + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Create no longer takes a graphics layer. + + (WebKit::LayerTreeHostMac::setRootCompositingLayer): + Set the new root compositing layer. + +2011-02-08 Adam Roben <aroben@apple.com> + + Implement WorkQueue::scheduleWorkAfterDelay on Windows + + Each WorkQueue now owns its own timer queue. When scheduleWorkAfterDelay is called, we + create a timer-queue timer with the given delay. When the timer fires, we schedule the work + on the queue and clean up the timer. + + Fixes <http://webkit.org/b/54040> <rdar://problem/8974230> Web process sticks around forever + if it's hung when UI process goes away + + Reviewed by Anders Carlsson. + + * Platform/WorkQueue.h: Added timerCallback and m_timerQueue. + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::platformInitialize): Initialize m_timerQueue. + (WorkQueue::platformInvalidate): Clean up m_timerQueue. + (TimerContext::TimerContext): Added this helper object to hold the context needed by the + timer callback. + (WorkQueue::timerCallback): Added. Schedules the WorkItem on the WorkQueue and cleans up the + timer. + (WorkQueue::scheduleWorkAfterDelay): Create a timer-queue timer on our timer queue that will + fire after the given delay. Pass a new TimerContext object to the timer callback that + contains the information it needs. + +2011-02-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename PluginProcess::initializeConnection to PluginProcess::initialize + https://bugs.webkit.org/show_bug.cgi?id=54039 + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::initialize): + * PluginProcess/PluginProcess.h: + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + * WebProcess/WebProcess.h: + +2011-02-08 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8972913> and https://bugs.webkit.org/show_bug.cgi?id=54036 + didChangeBackForwardList should include some context about what changed + + Update the implementation of this API to include the new item (if any) and removed items (if any): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didChangeBackForwardList): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeBackForwardList): + * UIProcess/WebPageProxy.h: + + Have WebBackForwardList pass the new items and/or removed items when calling the notifier: + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::addItem): + (WebKit::WebBackForwardList::goToItem): + (WebKit::WebBackForwardList::clear): + +2011-02-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Sandbox violations visiting MobileMe. + <rdar://problem/8961330> + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename PluginProcess::initialize to PluginProcess::initializePluginProcess + https://bugs.webkit.org/show_bug.cgi?id=54037 + + Rename PluginProcess::initialize to PluginProcess::initializePluginProcess to better + match the WebProcess initialization code, in preparation of sharing more code. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::initializePluginProcess): + * PluginProcess/PluginProcess.h: + * PluginProcess/PluginProcess.messages.in: + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didFinishLaunching): + +2011-02-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WK2: Add ability to pass context to policy delegate methods + https://bugs.webkit.org/show_bug.cgi?id=54031 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + (CoreIPC::handleMessageVariadic): + * Scripts/webkit2/messages.py: + Add ability to pass variadic messages to sync messages. + + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + Add WKBundleNavigation type. + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + (WebKit::WebPageProxy::decidePolicyForMIMEType): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + (WebKit::WebPolicyClient::decidePolicyForMIMEType): + * UIProcess/WebPolicyClient.h: + Update policy client for new data. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp: Added. + (WKBundleNavigationActionGetTypeID): + (WKBundleNavigationActionGetNavigationType): + (WKBundleNavigationActionGetEventModifiers): + (WKBundleNavigationActionGetEventMouseButton): + (WKBundleNavigationActionCopyHitTestResult): + (WKBundleNavigationActionCopyFormElement): + * WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetPolicyClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp: Added. + (WebKit::mouseEventForNavigationAction): + (WebKit::mouseButtonForMouseEvent): + (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction): + (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction): + (WebKit::InjectedBundleNavigationAction::create): + (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction): + * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h: Added. + (WebKit::InjectedBundleNavigationAction::navigationType): + (WebKit::InjectedBundleNavigationAction::modifiers): + (WebKit::InjectedBundleNavigationAction::mouseButton): + (WebKit::InjectedBundleNavigationAction::hitTestResult): + (WebKit::InjectedBundleNavigationAction::formElement): + (WebKit::InjectedBundleNavigationAction::type): + * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp: Added. + (WebKit::InjectedBundlePagePolicyClient::decidePolicyForNavigationAction): + (WebKit::InjectedBundlePagePolicyClient::decidePolicyForNewWindowAction): + (WebKit::InjectedBundlePagePolicyClient::decidePolicyForMIMEType): + * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h: Added. + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createWindow): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundlePolicyClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundlePolicyClient): + Pipe the policy client through the bundle to allow setting user data. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2011-02-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Crash calling -setFrame:andScrollBy: in windowDidResize + https://bugs.webkit.org/show_bug.cgi?id=54030 + <rdar://problem/8969760> + + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::create): + Assert that size is not zero here; we never want to try to create shared memory with a zero size. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setSize): + Always invalidate the entire visible page when resizing. + +2011-02-08 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Remove orphan code from old parser + https://bugs.webkit.org/show_bug.cgi?id=53984 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp + * WebProcess/WebCoreSupport/WebChromeClient.h + +2011-02-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + UI process crashes if web process crashes while web inspector is focused + https://bugs.webkit.org/show_bug.cgi?id=53965 + <rdar://problem/8961633> + + Make sure to close the web inspector web page proxy before calling platformClose, since + platformClose can cause the web page proxy to try to send messages (such as SetActive) + to the web process while it's in a bad state. + + The original fix, http://trac.webkit.org/changeset/77866, put the call to m_page->close() in + WebInspectorProxy::didClose, which was wrong and lead to crashes. The right place to close the page + is in WebInspectorProxy::invalidate. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::invalidate): + +2011-02-08 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + ASSERTION FAILURE: ASSERT_NOT_REACHED() in Connection::writeEventHandler() after the Web + Process crashes. + https://bugs.webkit.org/show_bug.cgi?id=54005 + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::writeEventHandler): + Handle ERROR_BROKEN_PIPE by calling connectionDidClose() and returning early. + +2011-02-08 Adam Roben <aroben@apple.com> + + Handle WM_TIMER messages for stopped timers + + Whenever we stop a timer, we call ::KillTimer to cancel any future firings of the timer. But + ::KillTimer doesn't do anything about WM_TIMER messages that have already been posted to the + message queue. We need to handle those, too. + + Fixes <http://webkit.org/b/53999> Occasional assertion failures in + RunLoop::TimerBase::timerFired + + Reviewed by Darin Adler. + + * Platform/win/RunLoopWin.cpp: + (RunLoop::TimerBase::timerFired): Just bail if the timer has already been stopped. + +2011-02-08 Adam Roben <aroben@apple.com> + + Don't mark a Connection as connected until open() is called on Windows + + This matches Mac. Even though the Connection's pipe is connected before open() is called, + the Connection itself isn't really connected to the pipe until then, and we won't actually + read any data from before that point. + + Fixes <http://webkit.org/b/53998> <rdar://problem/8971207> REGRESSION (r77874): Assertion + failure on launch in Connection::setDidCloseOnConnectionWorkQueueCallback on Windows + + Reviewed by Darin Adler. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::platformInitialize): Moved code to set m_isConnected from here to + open. + (CoreIPC::Connection::platformInvalidate): Unset m_isConnected, to match Mac. (This isn't + part of the bug fix, but seemed worthwhile.) + (CoreIPC::Connection::open): Set m_isConnected now that we're going to listen on the pipe. + +2011-02-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r77866. + http://trac.webkit.org/changeset/77866 + https://bugs.webkit.org/show_bug.cgi?id=53981 + + caused all WebKit2 inspector tests to crash (Requested by + othermaciej on #webkit). + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::didClose): + +2011-02-07 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + Add resource load client for injected bundle and move willSendRequest there + https://bugs.webkit.org/show_bug.cgi?id=53972 + + * GNUmakefile.am: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetPageLoaderClient): + (WKBundlePageSetResourceLoadClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp: Added. + (WebKit::InjectedBundlePageResourceLoadClient::didInitiateLoadForResource): + (WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame): + (WebKit::InjectedBundlePageResourceLoadClient::didReceiveResponseForResource): + (WebKit::InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource): + (WebKit::InjectedBundlePageResourceLoadClient::didFinishLoadForResource): + (WebKit::InjectedBundlePageResourceLoadClient::didFailLoadForResource): + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h: Added. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest): + (WebKit::WebFrameLoaderClient::dispatchWillSendRequest): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoading): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleResourceLoadClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleResourceLoadClient): + * win/WebKit2.vcproj: + +2011-02-07 Mark Rowe <mrowe@apple.com> + + Fix the 32-bit build. + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Add some casts + to prevent warnings about mixing signed and unsigned comparisons. + +2011-02-07 Qi Zhang <qi.2.zhang@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl + https://bugs.webkit.org/show_bug.cgi?id=52974 + + Add ContextMenuItemTagCopyImageUrlToClipboard into standard action but Qt platform specific. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2011-02-07 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Fixing a build break on Mac caused by http://trac.webkit.org/changeset/77874 + + Removed unused static function. + + * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8969888> + The WebProcess should set LSFileQuarantineEnabled to true + + * WebProcess/Info.plist: + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Crash in web process after the connection had been closed + https://bugs.webkit.org/show_bug.cgi?id=51115 + <rdar://problem/8964255> + + Remove didCloseOnConnectionWorkQueue from Connection::Client and add + Connection::setDidCloseOnConnectionWorkQueueCallback which takes a static + function, eliminating the race condition in connectionDidClose where m_client could be + nulled out in the client thread right before we try to dereference it. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::Connection): + Initialize m_didCloseOnConnectionWorkQueueCallback. + + (CoreIPC::Connection::setDidCloseOnConnectionWorkQueueCallback): + Update m_didCloseOnConnectionWorkQueueCallback. + + (CoreIPC::Connection::connectionDidClose): + Call m_didCloseOnConnectionWorkQueueCallback. + + * Platform/WorkQueue.h: + Make WorkQueue noncopyable. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::initializeConnection): + Call setDidCloseOnConnectionWorkQueueCallback. + + * Shared/ChildProcess.cpp: + (WebKit::ChildProcess::didCloseOnConnectionWorkQueue): + * Shared/ChildProcess.h: + didCloseOnConnectionWorkQueue is now a static member function. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initialize): + Call setDidCloseOnConnectionWorkQueueCallback. + +2011-02-07 Enrica Casucci <enrica@apple.com> + + Reviewed Adam Roben and Darin Adler. + + WebKit2: drag and drop support on Windows. + https://bugs.webkit.org/show_bug.cgi?id=52775 + <rdar://problem/8514409> + + This patch contains the remaining work to support + a WebKit window as drag source on Windows. + I've added the code to generate the image for dragging a link as + well as the steps necessary to package the HBITMAP into a SharedMemory + object and send it over to the UI process where DoDragDrop is performed. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setDragImage): + (WebKit::WebPageProxy::startDragDrop): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebDragClient.cpp: + (WebKit::WebDragClient::startDrag): Made startDrag for + platforms other than Windows and Mac. + * WebProcess/WebCoreSupport/WebDragClient.h: + * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: + (WebKit::WebDragClient::startDrag): + * WebProcess/WebCoreSupport/win/WebDragClientWin.cpp: Added. + (WebKit::draggingSourceOperationMaskToDragCursors): + (WebKit::WebDragClient::startDrag): + * WebProcess/WebCoreSupport/win/WebDragSource.cpp: Added. + This object implements the IDropSource interface. + (WebDragSource::createInstance): + (WebDragSource::WebDragSource): + (WebDragSource::QueryInterface): + (WebDragSource::AddRef): + (WebDragSource::Release): + (WebDragSource::QueryContinueDrag): + (WebDragSource::GiveFeedback): + * WebProcess/WebCoreSupport/win/WebDragSource.h: Added. + * win/WebKit2.vcproj: + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + UI process crashes if web process crashes while web inspector is focused + https://bugs.webkit.org/show_bug.cgi?id=53965 + <rdar://problem/8961633> + + Make sure to close the web inspector web page proxy before calling platformClose, since + platformClose can cause the web page proxy to try to send messages (such as SetActive) + to the web process while it's in a bad state. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::didClose): + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Find bouncy is missing content on pages with framesets + https://bugs.webkit.org/show_bug.cgi?id=53958 + <rdar://problem/8904447> + + Fix paint rect computation; FrameView::paint expects the paint rect to be in the + parent widget's coordinate system. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindIndicator): + +2011-02-07 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/8960434> and https://bugs.webkit.org/show_bug.cgi?id=53957 + Crash after incorrectly restoring bogus session state. + + In some cases we're writing an invalid session state for a back/forward list where the current entry is 0 + but the number of entries is also 0. + In such cases the current entry should be "NoCurrentEntryIndex." + + When we later read this state in, we set ourselves up to crash later. + + Amusingly an ASSERT caught this, but we should've rejected it before the ASSERT fired. + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Fail the restore if the "current index past the end + of the list" case occurs, and speculatively bail out of the case where we have no current index but do have a list. + Also remove the unhelpful ASSERT. + +2011-02-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add bundle API to get the background color of a frame + <rdar://problem/8962670> + https://bugs.webkit.org/show_bug.cgi?id=53952 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetBodyBackgroundColor): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + Add API function. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::getDocumentBackgroundColor): + * WebProcess/WebPage/WebFrame.h: + Call down into the document to get either the body's, or if there is no body, + the root element's, background color. + +2011-02-07 Sam Weinig <sam@webkit.org> + + Fix typo. vectical -> vertical. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeScrollbarsForMainFrame): + +2011-02-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Inform the UIProcess when main frame scrollbars change + <rdar://problem/8967496> + https://bugs.webkit.org/show_bug.cgi?id=53941 + + * UIProcess/API/C/WKPage.cpp: + (WKPageHasHorizontalScrollbar): + (WKPageHasVerticalScrollbar): + * UIProcess/API/C/WKPage.h: + Add API to query whether the main frame has scrollbars. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::processDidCrash): + (WebKit::WebPageProxy::didChangeScrollbarsForMainFrame): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::hasHorizontalScrollbar): + (WebKit::WebPageProxy::hasVerticalScrollbar): + Store/update main frame scrollbar state. + + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebKit::WebChromeClient::WebChromeClient): + Post message when main frame scrollbar state changes. + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Some content is not covered by Find-on-page overlay + https://bugs.webkit.org/show_bug.cgi?id=53937 + <rdar://problem/8711353> + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::didInstallPageOverlay): + Call LayerTreeHost::didInstallPageOverlay. + + (WebKit::DrawingAreaImpl::didUninstallPageOverlay): + Call LayerTreeHost::didUninstallPageOverlay. + + (WebKit::DrawingAreaImpl::setPageOverlayNeedsDisplay): + Call LayerTreeHost::setPageOverlayNeedsDisplay. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::drawRect): + Remove a bogus assertion. + + * WebProcess/WebPage/LayerTreeHost.h: + Add new pure virtual member functions. + + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::setNeedsDisplay): + Call DrawingArea::setPageOverlayNeedsDisplay. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::installPageOverlay): + Make sure to call PageOverlay::setNeedsDisplay after the page overlay has been installed. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Create the page overlay layer if needed. + + (WebKit::LayerTreeHostMac::setNonCompositedContentsNeedDisplay): + Invalidate the page overlay layer as well. + + (WebKit::LayerTreeHostMac::sizeDidChange): + Resize the page overlay layer. + + (WebKit::LayerTreeHostMac::didInstallPageOverlay): + Create the page overlay layer. + + (WebKit::LayerTreeHostMac::didUninstallPageOverlay): + Destroy the page overlay layer. + + (WebKit::LayerTreeHostMac::setPageOverlayNeedsDisplay): + Call setNeedsDisplay on the page overlay layer. + + (WebKit::LayerTreeHostMac::paintContents): + Handle painting the page overlay layer. + + (WebKit::LayerTreeHostMac::flushPendingLayerChanges): + Flush the page overlay layer changes as well. + + (WebKit::LayerTreeHostMac::createPageOverlayLayer): + Create a layer and add it as a sublayer of the root layer. + + (WebKit::LayerTreeHostMac::destroyPageOverlayLayer): + Destroy the page overlay layer. + +2011-02-06 Adam Roben <aroben@apple.com> + + Make it possible to use DrawingAreaProxyImpl on Windows + + It can be optionally turned on by setting the WEBKIT2_USE_NEW_DRAWING_AREA environment + variable. Turning it on by default is covered by <http://webkit.org/b/53805>. + + Fixes <http://webkit.org/b/53879>. + + Reviewed by Anders Carlsson. + + * UIProcess/BackingStore.h: Add an m_bitmap member on Windows. + + * UIProcess/win/BackingStoreWin.cpp: + (WebKit::BitmapDC::operator HDC): + (WebKit::BitmapDC::BitmapDC): + (WebKit::BitmapDC::~BitmapDC): + Added this helper class, which uses RAII to select a bitmap into a new memory DC. + (WebKit::BackingStore::paint): Wrap our bitmap in a BitmapDC and use ::BitBlt to copy the + specified rect into the destination DC. + (WebKit::createBitmap): New helper function, just creates a DIB section with the specified + size. + (WebKit::BackingStore::incorporateUpdate): Ported from BackingStoreMac.mm. It seems like + this code could be shared at some point. + (WebKit::BackingStore::scroll): Wrap our bitmap in a BitmapDC and use ::ScrollDC to scroll + the specified rect. + + * UIProcess/win/WebView.cpp: + (WebKit::useNewDrawingArea): Added. Returns true if the WEBKIT2_USE_NEW_DRAWING_AREA + environment variable is set. + (WebKit::drawPageBackground): New helper function. Code came from onPaintEvent. + (WebKit::WebView::onPaintEvent): Ported from -[WKView drawRect:]. + (WebKit::WebView::createDrawingAreaProxy): Create a DrawingAreaProxyImpl if we're using the + new drawing area. + + (WebKit::WebView::enterAcceleratedCompositingMode): + (WebKit::WebView::exitAcceleratedCompositingMode): + (WebKit::WebView::pageDidEnterAcceleratedCompositing): + (WebKit::WebView::pageDidLeaveAcceleratedCompositing): + Added some assertions to make sure these are only called when expected. We don't expect + enter/exitAcceleratedCompositingMode to be called at all right now, because accelerated + compositing is turned off in WebKit2 on Windows. + + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): Ditto, and added a case for the + DrawingAreaInfo::Impl constant. + +2011-02-07 Adam Roben <aroben@apple.com> + + Start compiling DrawingArea[Proxy]Impl and dependencies on Windows + + Fixes <http://webkit.org/b/53875> WebKit2 on Windows should build DrawingArea[Proxy]Impl + + Reviewed by Sam Weinig and Darin Adler. + + * Platform/Region.cpp: + (WebKit::Region::Shape::shapeOperation): Initialize variable to avoid a bogus "potentially + uninitialized variable" warning. + + * UIProcess/BackingStore.cpp: Removed #error for non-Mac platforms. + + * UIProcess/BackingStore.h: Added a PlatformGraphicsContext typedef for Windows. + + * UIProcess/DrawingAreaProxy.h: + * UIProcess/DrawingAreaProxyImpl.cpp: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + Allow Windows to compile the new drawing area code. + + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): Allow creating a DrawingAreaImpl on Windows, too. + + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/DrawingAreaImpl.cpp: + * WebProcess/WebPage/LayerTreeHost.cpp: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): + Allow Windows to compile the new drawing area code. + + * Shared/win/LayerTreeContextWin.cpp: Added. + * UIProcess/win/BackingStoreWin.cpp: Added. + Stubbed out these files. + + * win/WebKit2.vcproj: Added new files. + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Rename some drawing area related member functions + https://bugs.webkit.org/show_bug.cgi?id=53935 + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::setPageOverlayNeedsDisplay): + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setNeedsDisplay): + (WebKit::DrawingAreaImpl::setPageOverlayNeedsDisplay): + * WebProcess/WebPage/DrawingAreaImpl.h: + * WebProcess/WebPage/LayerTreeHost.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::setNonCompositedContentsNeedDisplay): + (WebKit::LayerTreeHostMac::scrollNonCompositedContents): + +2011-02-07 Adam Roben <aroben@apple.com> + + Use the right calling convention when calling WebKitMain + + Fixes <http://webkit.org/b/53923> REGRESSION (r77678): Crash on quit in web process in + wWinMain + + Reviewed by Steve Falkenburg. + + * win/MainWin.cpp: + (wWinMain): Use __cdecl instead of WINAPI (__stdcall) when calling WebKitMain, since that is + how that function is declared. + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + The drawing area should be in charge of drawing the page overlay + https://bugs.webkit.org/show_bug.cgi?id=53927 + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::didInstallPageOverlay): + (WebKit::DrawingArea::didUninstallPageOverlay): + (WebKit::DrawingArea::setOverlayNeedsDisplay): + Add empty stubs. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::didInstallPageOverlay): + Add empty function. This will eventually ask the layer tree host to + create a GraphicsLayer for the page overlay. + + (WebKit::DrawingAreaImpl::didUninstallPageOverlay): + Tell the page that it needs to be repainted. + + (WebKit::DrawingAreaImpl::setOverlayNeedsDisplay): + Just call setNeedsDisplay for now. + + (WebKit::DrawingAreaImpl::display): + Paint the page overlay too. + + * WebProcess/WebPage/DrawingAreaImpl.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::drawRect): + Only call drawPageOverlay if we have an old drawing area. + + (WebKit::WebPage::drawPageOverlay): + Draw the page overlay. Code moved here from WebPage::drawRect. + + (WebKit::WebPage::installPageOverlay): + Call DrawingArea::installPageOverlay. + + (WebKit::WebPage::uninstallPageOverlay): + Call DrawingArea::uninstallPageOverlay. + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::hasPageOverlay): + Add getter. + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add WebPage::bounds and use it + https://bugs.webkit.org/show_bug.cgi?id=53926 + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::resumePainting): + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::resumePainting): + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::bounds): + +2011-02-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + Don't exclude overlay scrollers from the page overlay bounds + https://bugs.webkit.org/show_bug.cgi?id=53924 + + Don't subtract the scrollbars from the page overlay bounds if + overlay scrollers are enabled. + + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::bounds): + +2011-02-07 Adam Roben <aroben@apple.com> + + Windows build fix after r77794 + + * win/WebKit2.def: Export WebCore symbols used by WebKitTestRunner. + +2011-02-07 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Antti Koivisto. + + Add WKURLRequestCopyURL API (needed for tests and also generally useful) + https://bugs.webkit.org/show_bug.cgi?id=53909 + + * Shared/API/c/WKURLRequest.cpp: + (WKURLRequestCopyURL): + * Shared/API/c/WKURLRequest.h: + * Shared/WebURLRequest.h: + (WebKit::WebURLRequest::url): + +2011-02-06 Ryosuke Niwa <rniwa@webkit.org> + + Unreviewed; speculative Qt build fix. + + * WebKit2.pro: + +2011-02-06 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h + https://bugs.webkit.org/show_bug.cgi?id=52867 + + * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: + (WebKit::NetscapePluginModule::getPluginInfo): Calls adoptArrayPtr. + +2011-02-06 Benjamin Poulain <ikipou@gmail.com> + + Reviewed by Andreas Kling. + + [Qt] WebKit does not build on Mac with WebKit 2 + https://bugs.webkit.org/show_bug.cgi?id=53380 + + * Platform/CoreIPC/qt/ConnectionQt.cpp: Use fcntl() to set close on exec so + we do not rely on recent kernel. + (CoreIPC::Connection::readyReadHandler): + * Platform/qt/SharedMemoryQt.cpp: ditto + (WebKit::SharedMemory::create): + (WebKit::SharedMemory::createHandle): + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Guard prctl() since it is + a Linux specific function. + (WebKit::QtWebProcess::setupChildProcess): + * UIProcess/DrawingAreaProxy.h: Differentiate between building on Mac + and the Mac port. + * UIProcess/DrawingAreaProxyImpl.cpp: ditto + * UIProcess/WebPageProxy.cpp: ditto + (WebKit::WebPageProxy::didReceiveMessage): + * WebProcess/WebPage/DrawingArea.cpp: ditto + (WebKit::DrawingArea::create): + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/DrawingAreaImpl.cpp: ditto + * WebProcess/WebPage/WebPage.cpp: ditto + (WebKit::WebPage::didReceiveMessage): + +2011-02-05 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + REGRESSION: New drawing area is causing some WebProcess crashes in layout tests + https://bugs.webkit.org/show_bug.cgi?id=53865 + <rdar://problem/8963148> + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): Handle the case + where this is called repeatedly without exiting accelerated composting mode + first. + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Handle the case + of being called more than once. + +2011-02-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Need a way to resize and scroll the page at the same time + https://bugs.webkit.org/show_bug.cgi?id=53814 + <rdar://problem/8498008> + + Add -[WKView setFrame:andScrollBy:]. + + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView setFrame:andScrollBy:]): + Stash away the scroll offset and call setFrame:. + + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::]): + (-[WKView _setDrawingAreaSize:]): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::setViewportSize): + DrawingAreaProxy::setSize now takes a scroll offset. + + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::setSize): + This now takes a scroll offset and stores it in m_scrollOffset. + + * UIProcess/DrawingAreaProxy.h: + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::sendSetSize): + Send along the scroll offset and set it back to zero. + + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::didSetSize): + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::didSetSize): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onSizeEvent): + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + DrawingAreaProxy::setSize now takes a scroll offset. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::setSize): + Add a scrollOffset parameter. + + * WebProcess/WebPage/DrawingArea.messages.in: + Add a scroll offset parameter to the SetSize message. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setSize): + Call WebPage::scrollMainFrameIfNotAtMaxScrollPosition. + + * WebProcess/WebPage/DrawingAreaImpl.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scrollMainFrameIfNotAtMaxScrollPosition): + Compute a scroll offset and call setScrollPosition on the main frame view. + +2011-02-04 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKit2: Crash when InjectedBundlePageLoaderClient::willSendRequestForFrame returns a null WKURLRequestRef + https://bugs.webkit.org/show_bug.cgi?id=53829 + + Store the result of m_client.willSendRequestForFrame in a RefPtr, and null check it before + calling resourceRequest() on it. + + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::willSendRequestForFrame): + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/mac/WebProcessMac.mm: + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Mark Rowe. + + Link opened in background tab fails to paint when activated if it completes loading before tab is selected + https://bugs.webkit.org/show_bug.cgi?id=53827 + <rdar://problem/8962355> + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::resumePainting): + Invalidate the entire page. + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix <rdar://problem/8961227> WebKit2 does not work with symlinked home directories. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformSetCacheModel): + Don't adopt an autoreleased pointer, this would lead to a crash. + + (WebKit::appendSandboxParameterPath): + (WebKit::appendSandboxParameterConfPath): + (WebKit::initializeSandbox): + Clean up the sandbox parameter code and make sure that realpath is called for all parameters. + +2011-02-04 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Sandbox violations when visiting a site using HTTP authentication + <rdar://problem/8951079> + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-04 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=53823 + Print layout sometimes seen on screen + + <rdar://problem/8948742> REGRESSION (WebKit2) - When I print a page, I visually see it re-layout + <rdar://problem/8899389> REGRESSION(WebKit2): Wrong content can appear when print dialog is up + + * UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::setAutodisplay): Removed a + branch that didn't do anything useful. + + * UIProcess/API/mac/WKPrintingView.h: + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView _suspendAutodisplay]): + (-[WKPrintingView _delayedResumeAutodisplayTimerFired]): + (-[WKPrintingView _delayedResumeAutodisplay]): + (-[WKPrintingView knowsPageRange:]): + (-[WKPrintingView beginDocument]): + (-[WKPrintingView endDocument]): + When page setup changes, or when going from print preview to actual printing, AppKit calls + -endDocument just to begin it again. Delay resuming autodisplay until the next run loop + iteration. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::invalidateContentsAndWindow): + (WebKit::WebChromeClient::invalidateContentsForSlowScroll): + Tightened it up from other side - we should never send pixels to UI process while in + printing mode. This is not 100% reliable, because relayout doesn't happen immediately, + and we can still have print layout in screen mode - but it helps. + +2011-02-04 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Fix for <rdar://problem/8961580>. + Work around for <rdar://problem/8957845>. + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-04 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2 doesn't hide mouse pointer on keypress + https://bugs.webkit.org/show_bug.cgi?id=53821 + rdar://problem/8630895 + + * UIProcess/PageClient.h: Renamed didNotHandleKeyEvent to + doneWithKeyEvent and added a bool wasEventHandled argument. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveEvent): Changed code to call + doneWithKeyEvent and call even if event was handled. + + * UIProcess/API/mac/PageClientImpl.h: Updated for above change. + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::doneWithKeyEvent): Ditto. But also + call [NSCursor setHiddenUntilMouseMoves:YES] when a key down + event was handled. This matches what -[WebHTMLView keyDown:] does. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::doneWithKeyEvent): Ditto. + * UIProcess/API/qt/qwkpage_p.h: Ditto. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::doneWithKeyEvent): Ditto. + * UIProcess/win/WebView.h: Ditto. + +2011-02-04 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + WebKit2 clients fail to launch on Windows if client exe is in a different directory from WebKit + https://bugs.webkit.org/show_bug.cgi?id=53810 + <rdar://problem/8946085> + + If WebKit2WebProcess.exe is in a different directory from the client process, and that + client process uses CreateProcess to launch WebKit2WebProcess, the DLL search path may + end up excluding the directory containing WebKit. To address this, we use SetDllDirectory + to explicitly include the WebKit directory in the DLL search path. + + * win/MainWin.cpp: + (wWinMain): Use SetDllDirectory and LoadLibrary to load WebKit.dll from WebKit2WebProcess.exe + * win/WebKit2WebProcessCommon.vsprops: Don't link directly to WebKit. Link against shlwapi. + +2011-02-04 Adam Roben <aroben@apple.com> + + Allow passing a null filter callback to WKPageCopySessionState + + WebKit2 part of <http://webkit.org/b/53616> <rdar://problem/8949883>. + + Reviewed by Sam Weinig. + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Check if the filter is null + before calling it. + +2011-02-04 Brian Weinstein <bweinstein@apple.com> + + Reviewed by John Sullivan. + + WebKit2: DidInitiateLoadForResource needs to know if the resource is being loaded by a committed or provisional frame + https://bugs.webkit.org/show_bug.cgi?id=53794 + + When we navigate from one page to another, there can be multiple subresource requests between when + the new page has started its provisional load and when it has committed the load. + + There can be: + + - The main resource load of the provisional page + - Synchronous XHR from the unload event of the loaded page. + + WebKit clients need to be able to differentiate between these loads. + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didInitiateLoadForResource): Pass whether or not the page is provisionally loading + to the client. + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: Add a new parameter to DidInitiateLoadForResource. + * UIProcess/WebResourceLoadClient.cpp: + (WebKit::WebResourceLoadClient::didInitiateLoadForResource): a new parameter to didInitiateLoadForResource. + * UIProcess/WebResourceLoadClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest): Pass whether or not the page is currently + in a provisional load (checked by seeing if the DocumentLoader matches the FrameLoader's provisionalDocumentLoader) + to the UI Process. + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Mark Rowe. + + Mac WebKit2 should use the new drawing area + https://bugs.webkit.org/show_bug.cgi?id=53802 + <rdar://problem/7881419> + <rdar://problem/7881447> + <rdar://problem/8252632> + <rdar://problem/8479422> + <rdar://problem/8633813> + <rdar://problem/8734512> + <rdar://problem/8787660> + + * UIProcess/API/mac/WKView.mm: + (useNewDrawingArea): + Return true. Eventually this function should be removed, but let's keep it for now so + we can go back to the old drawing area if necessary. + +2011-02-04 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + WebKit2: Crash in WebPageProxy::setPendingAPIRequestURL after web process crashed + https://bugs.webkit.org/show_bug.cgi?id=53799 + <rdar://problem/8943956> + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::reload): + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + Fix a shared memory leak + https://bugs.webkit.org/show_bug.cgi?id=53800 + + Move the send right representing the shared memory. + + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::encode): + +2011-02-04 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/8636239> and https://bugs.webkit.org/show_bug.cgi?id=53785 + WebKit2: Pages with dynamically inserted iframes can add extraneous back/forward items. + + WebCore doesn't gracefully handle the case where the decidePolicyForNavigationAction callback + does not occur synchronously. Let's make it synchronous. + + Change WebPageProxy to handle this message reply synchronously: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::receivedPolicyDecision): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: Make the navigation policy action message be synchronous. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): Add a 6-argument varient + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Send the message synchronously. + +2011-02-04 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Correct prebuild build-stopping rule to allow project only rebuilds. + + * win/WebKit2WebProcessPreBuild.cmd: + +2011-02-04 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Assertion failure in WebInspectorProxy::platformClose closing main window when inspecting a popup + window, or when running regression tests. + https://bugs.webkit.org/show_bug.cgi?id=53798 + <rdar://problem/8814364> + + Only assert about the state of m_inspectorWindow and m_inspectorView if the inspector is visible. + Also, only call ::DestroyWindow if the HWND is non-null, just to be safe. + + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformClose): + +2011-02-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Go out of accelerated compositing mode when the drawing area is destroyed + https://bugs.webkit.org/show_bug.cgi?id=53788 + + This fixes a crash in the UI process if a web process crashes while in accelerated compositing mode. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::~DrawingAreaProxyImpl): + +2011-02-03 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: remove settings related methods from InspectorClient + https://bugs.webkit.org/show_bug.cgi?id=53686 + + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient): + +2011-02-03 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2: Need WebKit2 equivalent of WebResourceLoadDelegate::willSendRequest in the Bundle + https://bugs.webkit.org/show_bug.cgi?id=52897 + <rdar://problem/8898294> + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::willSendRequestForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSendRequest): + +2011-02-03 Ivan Krstić <ike@apple.com> + + Reviewed by Maciej Stachowiak. + + Make WebProcess pass explicit homedir parameter to the sandbox + <rdar://problem/8405760> + <https://webkit.org/b/53558> + + * WebProcess/com.apple.WebProcess.sb: + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + +2011-02-03 James Kozianski <koz@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add navigator.registerProtocolHandler behind a flag. + https://bugs.webkit.org/show_bug.cgi?id=52609 + + * Configurations/FeatureDefines.xcconfig: + +2011-02-03 Adam Langley <agl@chromium.org> + + Reviewed by Adam Barth. + + Plumb mixed script URL to FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=52384 + + Regressions covered by http/tests/security/mixedContent/* + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::didRunInsecureContent): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2011-02-03 Jon Honeycutt <jhoneycutt@apple.com> + + Download bundles should be moved to their final destination when they + finish. + + https://bugs.webkit.org/show_bug.cgi?id=53668 + + Reviewed by Adam Roben. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::Download): + Initialize m_allowOverwrite. + (WebKit::Download::retrieveDestinationWithSuggestedFilename): + Return the result of requesting the destination filename from the UI + process. + (WebKit::Download::decideDestinationWithSuggestedFilename): + Call retrieveDestinationWithSuggestedFilename(). + (WebKit::Download::didFinish): + Call platformDidFinish(). + + * WebProcess/Downloads/Download.h: + Declare retrieveDestinationWithSuggestedFilename() and + platformDidFinish(). Add a member variable to store whether the UI + process would like us to overwrite existing files. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::willResumeWithResponseCallback): + Remove some trailing whitespace. + + * WebProcess/Downloads/curl/DownloadCurl.cpp: + (WebKit::Download::platformDidFinish): + Stubbed. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::platformDidFinish): + Stubbed. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::platformDidFinish): + Stubbed. + + * WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp: + (WebKit::Download::didDecideDestination): + Store whether the UI process would like us to overwrite existing files. + (WebKit::Download::platformDidFinish): + Try to move the bundle to the final destination. If that fails, ask the + UI process for a new destination. If we receive one, try again to move + the bundle. Call didCreateDestination() to report the updated path of + file whether it's the bundle that we failed to move, or the new final + destination. + + This is similar to what is done by WebKit 1's CFNetwork port. + + * win/WebKit2.vcproj: + Add DownloadWin.cpp. + +2011-02-01 Jon Honeycutt <jhoneycutt@apple.com> + + Small clean-up in DownloadCFNet.cpp. + + Rubber-stamped by Mark Rowe. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::didDecideDestination): + Moved out of the section labeled "CFURLDownload callbacks" and up near + the other member functions. + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Paint non-composited contents in a layer + https://bugs.webkit.org/show_bug.cgi?id=53742 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setNeedsDisplay): + Call LayerTreeHost::setNonCompositedContentsNeedDisplayInRect. + + (WebKit::DrawingAreaImpl::scroll): + Call LayerTreeHost::scrollNonCompositedContents. + + (WebKit::DrawingAreaImpl::setSize): + Call LayerTreeHost::sizeDidChange. + + * WebProcess/WebPage/LayerTreeHost.h: + Add new pure virtual member functions. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Create the non-composited content layer. + + (WebKit::LayerTreeHostMac::setNonCompositedContentsNeedDisplayInRect): + Call setNeedsDisplay on the GraphicsLayer. + + (WebKit::LayerTreeHostMac::scrollNonCompositedContents): + Just call setNonCompositedContentsNeedDisplayInRect. + + (WebKit::LayerTreeHostMac::sizeDidChange): + Resize the layers and flush any changes. + + (WebKit::LayerTreeHostMac::paintContents): + Call WebPage::drawRect. + + (WebKit::LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback): + Lay out the web page. + + (WebKit::LayerTreeHostMac::flushPendingLayerChanges): + Call syncCompositingStateForThisLayerOnly on the non-composited content layer. + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + When in accelerated compositing mode, wait for DidSetSize messages + https://bugs.webkit.org/show_bug.cgi?id=53736 + + Normally we wait for DidSetSize messages from ::paint, but that's never called in + accelerated compositing mode so we just do it right after sending the SetSize message. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::paint): + Call waitForAndDispatchDidSetSize. + + (WebKit::DrawingAreaProxyImpl::sendSetSize): + Call waitForAndDispatchDidSetSize when in accelerated compositing mode. + + (WebKit::DrawingAreaProxyImpl::waitForAndDispatchDidSetSize): + New utility function which waits for and dispatches a DidSetSize message. + + * UIProcess/DrawingAreaProxyImpl.h: + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Pass along an UpdateInfo object to the ExitAcceleratedCompositingMode message + https://bugs.webkit.org/show_bug.cgi?id=53734 + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::exitAcceleratedCompositingMode): + Add an UpdateInfo parameter. + + * UIProcess/DrawingAreaProxy.messages.in: + Add an UpdateInfo parameter to the ExitAcceleratedCompositingMode message. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + Incorporate the passed in update. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + Create a new UpdateInfo object, paint into it and pass it along as a parameter + to the ExitAcceleratedCompositingMode message. + +2011-02-03 Beth Dakin <bdakin@apple.com> + + Reviewed by Sam Weinig. + + Fix for <rdar://problem/8944544> Ability to animate track + for WKPainter scrollers + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Change DidSetSize to take a LayerTreeContext parameter + https://bugs.webkit.org/show_bug.cgi?id=53724 + + Since SetSize can cause layout to happen, we need to pass along a layer tree context to + the DidSetSize message so the UI process can enter/exit accelerated compositing mode appropriately. + + * Shared/LayerTreeContext.h: + * Shared/mac/LayerTreeContextMac.mm: + Add equality operators to LayerTreeContext. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::didSetSize): + This now takes a LayerTreeContext parameter. + + * UIProcess/DrawingAreaProxy.messages.in: + Add LayerTreeContext parameter. + + * UIProcess/DrawingAreaProxyImpl.cpp: + Get rid of m_isInAcceleratedCompositingMode and use the current layer context instead. + + (WebKit::DrawingAreaProxyImpl::paint): + Bail if the call to DidSetSize ended up entering accelerated compositing mode. + + (WebKit::DrawingAreaProxyImpl::didSetSize): + If the new layer tree context is different, enter/exit accelerated compositing mode accordingly. + + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + Update the layer tree context. + + * UIProcess/DrawingAreaProxyImpl.h: + (WebKit::DrawingAreaProxyImpl::isInAcceleratedCompositingMode): + Add simple getter. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setSize): + Pass along the layer tree context. + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Get rid of LayerTreeContext::seed on Mac. + Add sequence checks to enterAcceleratedCompositingMode and exitAcceleratedCompositingMode and + have them call newly added overloads that don't have the checks. + + * Shared/LayerTreeContext.h: + * Shared/mac/LayerTreeContextMac.mm: + (WebKit::LayerTreeContext::LayerTreeContext): + (WebKit::LayerTreeContext::encode): + (WebKit::LayerTreeContext::decode): + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + * UIProcess/DrawingAreaProxyImpl.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Get rid of timestamps in UpdateInfo + https://bugs.webkit.org/show_bug.cgi?id=53713 + + Add a 64-bit sequence number to all DrawingAreaProxy messages, and use it to + check whether Update messages should be handled or not. + + * Shared/UpdateInfo.cpp: + (WebKit::UpdateInfo::encode): + (WebKit::UpdateInfo::decode): + * Shared/UpdateInfo.h: + (WebKit::UpdateInfo::UpdateInfo): + * UIProcess/BackingStore.cpp: + (WebKit::BackingStore::BackingStore): + (WebKit::BackingStore::incorporateUpdate): + * UIProcess/BackingStore.h: + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::update): + (WebKit::DrawingAreaProxy::didSetSize): + (WebKit::DrawingAreaProxy::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxy::exitAcceleratedCompositingMode): + * UIProcess/DrawingAreaProxy.messages.in: + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): + (WebKit::DrawingAreaProxyImpl::update): + (WebKit::DrawingAreaProxyImpl::didSetSize): + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + * UIProcess/DrawingAreaProxyImpl.h: + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::generateSequenceNumber): + (WebKit::DrawingAreaImpl::setSize): + (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + (WebKit::DrawingAreaImpl::display): + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Don't send enter/exit accelerated compositing mode messages when handling setSize + https://bugs.webkit.org/show_bug.cgi?id=53706 + + Don't send EnterAcceleratedCompositingMode/ExitAcceleratedCompositing mode when + the mode changes happen as a result of relayout in setSize, since an updated state + is going to be sent back in the DidSetSize message. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::didSetSize): + Add an assert. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::DrawingAreaImpl): + Initialize m_inSetSize. + + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + Factor out code into enterAcceleratedCompositingMode and exitAcceleratedCompositingMode. + + (WebKit::DrawingAreaImpl::setSize): + Set m_inSetSize to true while handling setSize. + + (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): + Take over the message sending responsibility from LayerTreeHostMac, and don't send messages + if we're currently handling a SetSize message. + + * WebProcess/WebPage/DrawingAreaImpl.h: + Add m_inSetSize. + + * WebProcess/WebPage/LayerTreeHost.h: + Add layerTreeHost getter. + + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Don't send EnterAcceleratedCompositingMode messages. + + (WebKit::LayerTreeHostMac::layerTreeContext): + Add getter for the current layer tree context. + + (WebKit::LayerTreeHostMac::invalidate): + Don't send ExitAcceleratedCompositingMode messages. + +2011-02-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make the layer tree host keep track of the layer tree context + https://bugs.webkit.org/show_bug.cgi?id=53698 + + Add a LayerTreeContext member variable to the LayerTreeHost object, + and also add a seed count to the LayerTreeContext so we can keep track of + how layer tree contexts relate to each other. + + * Shared/LayerTreeContext.h: + * Shared/mac/LayerTreeContextMac.mm: + (WebKit::LayerTreeContext::LayerTreeContext): + (WebKit::LayerTreeContext::makeWithSeed): + (WebKit::LayerTreeContext::encode): + (WebKit::LayerTreeContext::decode): + + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + Add the layer tree context as a member variable. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Initialize the layer tree context. + +2011-02-03 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + +2011-02-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add notification of the end of a rubber band. + <rdar://problem/8940648> + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::drawHeader): + (WebKit::WebPageProxy::drawFooter): + (WebKit::WebPageProxy::didCompleteRubberBandForMainFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::didCompleteRubberBandForMainFrame): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::didCompleteRubberBandForMainFrame): + * WebProcess/WebCoreSupport/WebChromeClient.h: + Pipe the notification up to the WKUIClient. + +2011-02-03 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r77449. + http://trac.webkit.org/changeset/77449 + https://bugs.webkit.org/show_bug.cgi?id=53663 + + causes many WebKit2 tests to crash (Requested by othermaciej + on #webkit). + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toCopiedAPI): + (WebKit::toURLRef): + (WebKit::toCopiedURLAPI): + * Shared/WebString.h: + (WebKit::WebString::isNull): + (WebKit::WebString::WebString): + +2011-02-02 Sam Weinig <sam@webkit.org> + + Fix license block issues pointed out by Daniel Bates. + + * Shared/API/c/WKGraphicsContext.cpp: + * Shared/API/c/WKGraphicsContext.h: + * Shared/API/c/cg/WKGraphicsContextCG.cpp: + * Shared/API/c/cg/WKGraphicsContextCG.h: + * Shared/WebGraphicsContext.cpp: + +2011-02-02 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add WKBundleFrameGetVisibleContentBoundsExcludingScrollbars API for WebKit2. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetContentBounds): + (WKBundleFrameGetVisibleContentBounds): + (WKBundleFrameGetVisibleContentBoundsExcludingScrollbars): + (WKBundleFrameGetScrollOffset): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::contentBounds): + (WebKit::WebFrame::visibleContentBounds): + (WebKit::WebFrame::visibleContentBoundsExcludingScrollbars): + (WebKit::WebFrame::scrollOffset): + * WebProcess/WebPage/WebFrame.h: + Move implementation of frame geometry to the implementation file + instead of keeping it in the API file. + +2011-02-02 Stephanie Lewis <slewis@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=53361 + <rdar://problem/8921729> REGRESSION: Membuster accumulates 1GB+ memory due to autorelease + pools not being drained. + Call into AppKit to add observers that push and pop autorelease pools on entry + and exit from the CFRunLoop. This will prevent memory from accumulating. + + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2011-02-02 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Make null WTF::String objects turn into 0 pointers for WKStringRef and WKURLRef. + rdar://problem/8948688 + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): Return 0 if the passed in string is 0. + (WebKit::toCopiedAPI): Ditto. + (WebKit::toURLRef): Ditto. Old code was trying to do this but was missing a return. + (WebKit::toCopiedURLAPI): Ditto. Old code was trying to do this but had incorrect + nll check. + + * Shared/WebString.h: Removed isNull function. It can never return true. + Removed constructor code that turns the null string into the empty string. + Instead assert that the passed in string is not null. + +2011-02-02 Mark Rowe <mrowe@apple.com> + + Reviewed by Beth Dakin. + + <rdar://problem/8928367> Crash when loading canvas pages inside HTMLCanvasElement::createImageBuffer(). + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Add some missing initializers. + +2011-02-02 Sam Weinig <sam@webkit.org> + + Reviewed by Beth Dakin. + + Add ChromeClient function to paint custom overhang areas. + https://bugs.webkit.org/show_bug.cgi?id=53639 + + * Shared/API/c/WKBase.h: + * Shared/API/c/WKGraphicsContext.cpp: Added. + (WKGraphicsContextGetTypeID): + * Shared/API/c/WKGraphicsContext.h: Added. + * Shared/API/c/WKSharedAPICast.h: + * Shared/API/c/cg/WKGraphicsContextCG.cpp: Added. + (WKGraphicsContextGetCGContext): + * Shared/API/c/cg/WKGraphicsContextCG.h: Added. + * Shared/APIObject.h: + * Shared/WebGraphicsContext.cpp: Added. + (WebKit::WebGraphicsContext::WebGraphicsContext): + * Shared/WebGraphicsContext.h: Added. + (WebKit::WebGraphicsContext::create): + (WebKit::WebGraphicsContext::platformContext): + (WebKit::WebGraphicsContext::type): + Add WebGraphicsContext API type. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::pageDidScroll): + (WebKit::InjectedBundlePageUIClient::shouldPaintCustomOverhangArea): + (WebKit::InjectedBundlePageUIClient::paintCustomOverhangArea): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::paintCustomOverhangArea): + * WebProcess/WebCoreSupport/WebChromeClient.h: + Pipe paintCustomOverhangArea to the InjectedBundlePageUIClient. + + * UIProcess/API/C/WebKit2.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2011-02-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Work towards making the layer tree host be in charge of all painting + https://bugs.webkit.org/show_bug.cgi?id=53636 + + Make sure that DrawingAreaImpl::display is never called when in accelerated compositing mode, + since the layer tree host is supposed to handle all drawing in that case. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::scroll): + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + (WebKit::DrawingAreaImpl::setSize): + (WebKit::DrawingAreaImpl::didUpdate): + +2011-02-02 Mark Rowe <mrowe@apple.com> + + Fix the 32-bit build. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::computeFakeWindowBoundsRect): + +2011-02-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make sure that we don't try to call display() when in accelerated compositing mode + https://bugs.webkit.org/show_bug.cgi?id=53629 + + When in accelerated compositing mode, the layer tree host should handle all painting, so make sure that display() is never called. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setNeedsDisplay): + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + (WebKit::DrawingAreaImpl::display): + +2011-02-02 Adam Roben <aroben@apple.com> + + Assert WebBackForwardList's current index is valid to help catch errors + + Hopefully this will help catch a crash I saw once but haven't yet been able to reproduce. + + Fixes <http://webkit.org/b/53622>. + + Reviewed by Brady Eidson. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::WebBackForwardList): + (WebKit::WebBackForwardList::addItem): + (WebKit::WebBackForwardList::goToItem): + (WebKit::WebBackForwardList::currentItem): + (WebKit::WebBackForwardList::backItem): + (WebKit::WebBackForwardList::forwardItem): + (WebKit::WebBackForwardList::itemAtIndex): + (WebKit::WebBackForwardList::backListCount): + (WebKit::WebBackForwardList::forwardListCount): + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::clear): + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): + Assert that m_current is valid. + + * UIProcess/WebBackForwardList.h: Moved the NoCurrentItemIndex to a static data member so + that it can be used from WebBackForwardListCF.cpp. + +2011-02-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + The drawing area proxy should keep track of the accelerated compositing state + https://bugs.webkit.org/show_bug.cgi?id=53624 + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): + Initialize m_isInAcceleratedCompositingMode to false. + + (WebKit::DrawingAreaProxyImpl::paint): + Don't try to paint if we're in accelerated compositing mode. + + (WebKit::DrawingAreaProxyImpl::didSetSize): + Bail if we're in accelerated compositing mode. + + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + Set m_isInAcceleratedCompositingMode to true, null out the backing store. + + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + Set m_isInAcceleratedCompositingMode back to false. + + (WebKit::DrawingAreaProxyImpl::incorporateUpdate): + Assert that we're not in accelerated compositing mode. + + * UIProcess/DrawingAreaProxyImpl.h: + +2011-02-02 Timothy Hatcher <timothy@apple.com> + + Give the Web Process access to the Safari RSS preferences. + + <rdar://problem/8916870> Sandbox violation related to RSS during initial + page load with WebKit2 (prevents RSS from working) + + Reviewed by Darin Adler. + + * WebProcess/com.apple.WebProcess.sb: + +2011-02-02 Steve Lacey <sjl@chromium.org> + + Reviewed by Eric Carlson. + + Implement basic media statistics on media elements. + https://bugs.webkit.org/show_bug.cgi?id=53322 + + * Configurations/FeatureDefines.xcconfig: + +2011-02-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=53561 + <rdar://problem/8900228> Stepping through print previews in WebKit2 mode steps in and out of + printing mode a lot + + Disable NSView autodisplay, so that -[WKView drawRect:] isn't called (other than when + resizing the window), so that we don't have to switch modes all the time. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setAutodisplay): + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setAutodisplay): + * UIProcess/WebPageProxy.h: + Pipe the call from WKPrintingView down to WKView. + + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView beginDocument]): Added. We don't want to autodisplay WKView while printing, + because layout is changed to print at the time, and drawing to screen requires relayout. + + (-[WKPrintingView endDocument]): When not printing, turn autodisplay back on. Also, call + -[super endDocument] for unknown but definitive good (oops!). + +2011-02-02 David Hyatt <hyatt@apple.com> + + Reviewed by Darin Adler. + + Conversion of right()/bottom() to maxX()/maxY() as part of the removal of those accessors. + + * UIProcess/win/WebPopupMenuProxyWin.cpp: + (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::prepareCandidateWindow): + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::platformGeometryDidChange): + +2011-02-01 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + Overflow in WebKit2 argument decoder buffer checking + https://bugs.webkit.org/show_bug.cgi?id=53536 + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::roundUpToAlignment): Tweak code a bit for clarity and to replace + C casts with C++ casts. + (CoreIPC::ArgumentDecoder::alignBufferPosition): Rearrange buffer calculation + so we don't do any math with the passed-in size, because that could overflow. + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughToContain): Ditto. + +2011-02-01 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed. + + Fix Qt build after r77339. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::enterAcceleratedCompositingMode): + (QWKPagePrivate::exitAcceleratedCompositingMode): + * UIProcess/API/qt/qwkpage_p.h: + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Attach the layer tree in the UI process + https://bugs.webkit.org/show_bug.cgi?id=53560 + + * UIProcess/API/mac/WKView.mm: + (-[WKView _enterAcceleratedCompositingMode:]): + Make a render layer and add it as a sublayer of our root layer. + + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + Make LayerTreeHostMac a GraphicsLayerClient. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + Create a root layer, add the layer subtree as a child of the root layer. + + (WebKit::LayerTreeHostMac::~LayerTreeHostMac): + Assert that m_rootLayer is null. + + (WebKit::LayerTreeHostMac::invalidate): + Null out m_rootLayer. + + (WebKit::LayerTreeHostMac::notifyAnimationStarted): + (WebKit::LayerTreeHostMac::notifySyncRequired): + (WebKit::LayerTreeHostMac::paintContents): + Add stubs. + + (WebKit::LayerTreeHostMac::showDebugBorders): + (WebKit::LayerTreeHostMac::showRepaintCounter): + Return the correct settings. + + (WebKit::LayerTreeHostMac::flushPendingLayerChanges): + Flush the root layer changes. + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::enterAcceleratedCompositingMode): + (WebKit::WebView::exitAcceleratedCompositingMode): + * UIProcess/win/WebView.h: + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add a layer backed NSView for accelerated content + https://bugs.webkit.org/show_bug.cgi?id=53555 + + Rename the current _layerHostingView to _oldLayerHostingView and + add a new _layerHostingView to be used with the new drawing area. + + * UIProcess/API/mac/WKView.mm: + (-[WKView hitTest:]): + (-[WKView _startAcceleratedCompositing:]): + (-[WKView _stopAcceleratedCompositing]): + (-[WKView _enterAcceleratedCompositingMode:]): + (-[WKView _exitAcceleratedCompositingMode]): + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Pass enter/exit accelerated compositing mode to the WKView + https://bugs.webkit.org/show_bug.cgi?id=53552 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::enterAcceleratedCompositingMode): + (WebKit::PageClientImpl::exitAcceleratedCompositingMode): + * UIProcess/API/mac/WKView.mm: + (-[WKView _enterAcceleratedCompositingMode:]): + (-[WKView _exitAcceleratedCompositingMode]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::enterAcceleratedCompositingMode): + (WebKit::WebPageProxy::exitAcceleratedCompositingMode): + * UIProcess/WebPageProxy.h: + +2011-02-01 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed Qt buildfix after r77286. + + https://bugs.webkit.org/show_bug.cgi?id=53520 + Remove the physical terminology from IntRect and FloatRect. + + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Send messages when entering/exiting accelerated compositing + https://bugs.webkit.org/show_bug.cgi?id=53534 + + * Shared/LayerTreeContext.h: Added. + * Shared/mac/LayerTreeContextMac.mm: Added. + Add new LayerTreeContext which holds all information needed to enter + accelerated compositing mode. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxy::exitAcceleratedCompositingMode): + Add empty stubs. + + * UIProcess/DrawingAreaProxy.messages.in: + Add new messgaes. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode): + (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): + * UIProcess/DrawingAreaProxyImpl.h: + Add empty stubs. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + (WebKit::LayerTreeHostMac::invalidate): + Send messages. + +2011-02-01 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein and Darin Adler. + + <rdar://problem/8830594> Printed page is sometimes shifted down, making footer invisible + + * UIProcess/API/mac/WKPrintingView.mm: (-[WKPrintingView locationOfPrintRect:]): Instead of + letting AppKit compute content position on page, make the view provide it. We can do this + because WK(Printing)Views are always printed on their own, not as part of other views. + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Make LayerTreeHost ref counted + https://bugs.webkit.org/show_bug.cgi?id=53530 + + LayerTreeHostMac will soon be able to trigger layout, which could cause + the page to leave accelerated compositing mode and free the LayerTreeHostMac object. + + Making LayerTreeHost ref counted will let LayerTreeHostMac protect itself while triggering layout. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + * WebProcess/WebPage/DrawingAreaImpl.h: + * WebProcess/WebPage/LayerTreeHost.cpp: + (WebKit::LayerTreeHost::create): + * WebProcess/WebPage/LayerTreeHost.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::create): + (WebKit::LayerTreeHostMac::LayerTreeHostMac): + (WebKit::LayerTreeHostMac::~LayerTreeHostMac): + (WebKit::LayerTreeHostMac::invalidate): + +2011-02-01 Sam Weinig <sam@webkit.org> + + Reviewed by Beth Dakin. + + Part 2 for <rdar://problem/8492788> + Adopt WKScrollbarPainterController + + Use header detection to define scrollbar painting controller #define. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-02-01 David Hyatt <hyatt@apple.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=53520 + + Remove the physical terminology from IntRect and FloatRect. + + Now that we have flipped RenderBlocks for vertical-rl and horizontal-bt writing modes, + we need to update our terminology to be more accurate. + + I'm borrowing a page from AppKit here (which also supports flipped NSViews) and + renaming right() and bottom() to maxX() and maxY(). These terms remain accurate + even for flipped rectangles. + + * Platform/Region.cpp: + (WebKit::Region::Shape::Shape): + * UIProcess/API/mac/WKPrintingView.mm: + (pageDidComputePageRects): + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::draw): + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::invalidate): + (WebKit::TiledDrawingAreaProxy::paint): + (WebKit::TiledDrawingAreaProxy::createTiles): + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::callSetWindow): + +2011-02-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move flushPendingLayerChanges to LayerTreeHostMac + https://bugs.webkit.org/show_bug.cgi?id=53525 + + In preparation for adding more Mac specific code to flushPendingLayerChanges. + + * WebProcess/WebPage/LayerTreeHost.cpp: + * WebProcess/WebPage/LayerTreeHost.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::flushPendingLayerChanges): + +2011-02-01 Beth Dakin <bdakin@apple.com> + + Reviewed by Sam Weinig. + + Fix for <rdar://problem/8492788> Adopt WKScrollbarPainterController + + Implement NSView's viewWillStartLiveResize and + viewDidEndLiveResize and propagate the messages down + to WebCore. + * UIProcess/API/mac/WKView.mm: + (-[WKView viewWillStartLiveResize]): + (-[WKView viewDidEndLiveResize]): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::viewWillStartLiveResize): + (WebKit::WebPageProxy::viewWillEndLiveResize): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::viewWillStartLiveResize): + (WebKit::WebPage::viewWillEndLiveResize): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + + A bunch of new WebKitSystemInterface functions. + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-02-01 Dave Hyatt <hyatt@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=46422, make printing and pagination work + with vertical text. + + Change printing functions to check writing-mode and properly swap width and height + as needed. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::computePagesForPrinting): + +2011-01-31 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Maciej Stachowiak. + + https://bugs.webkit.org/show_bug.cgi?id=53466 + Move WebKit2 to printing via API methods + + Also fixes <rdar://problem/8933724> REGRESSION: Wrong pages are printed when not printing from page 1 + + Also fixes horizontal tiling (no bug filed). + + The main idea here is that we don't force AppKit to use a different scaling factor when + a Web view can't be resized to exact page size, and scale when drawing instead. + + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView _firstPrintedPageNumber]): Factored out into a separate method. + (-[WKPrintingView _lastPrintedPageNumber]): Ditto. + (pageDidDrawToPDF): Avoid crashing if data is null. + (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): Use -_firstPrintedPageNumber + and -_lastPrintedPageNumber. + (pageDidComputePageRects): Set frame size to what it would have been for a normal NSView + that's been asked to resize. + (-[WKPrintingView _pageForRect:]): Check x(), because several pages can be at the same y() + when tiling horizontally. + (-[WKPrintingView _drawPDFDocument:page:atPoint:]): Point to draw at and frame size are + now using different units, translate as appropriate. + (-[WKPrintingView _drawPreview:]): Scale the rect to WebCore units. + (-[WKPrintingView drawRect:]): Correctly calculate page number when the first page to print + isn't page 1. + (-[WKPrintingView rectForPage:]): Scale the rect to AppKit units. + +2011-01-31 Darin Adler <darin@apple.com> + + Reviewed by Adele Peterson. + + WKView should support scrollPageDown:, scrollPageUp:, scrollToBeg and other similar selectors + https://bugs.webkit.org/show_bug.cgi?id=53460 + + * UIProcess/API/mac/WKView.mm: Added WEBCORE_COMMAND macro for lots of editor commands that + are implemented in WebCore so they will get forwarded. Many of these will probably work without + any further changes required. Added comments about the methods that we do not yet forward. + (createSelectorExceptionMap): Map scrollPageDown: to ScrollPageForward and + scrollPageUp: to ScrollPageBackward because we want the page up and page down + keys to follow the document logical order, not physical order. This is equivalent + to what we do in WebPage::performDefaultBehaviorForKeyEvent. + +2011-01-31 Jessie Berlin <jberlin@apple.com> + + Reviewed by Steve Falkenburg. + + WebKit2: the cookies used by the WebKit2 Web Process should not go in a top-level + directory. + https://bugs.webkit.org/show_bug.cgi?id=53278 + + Use the name WebKit2WebProcess since the default location for the cookies is determined + based on the process name (which is WebKit2WebProcess.exe on Windows). + + * win/WebKit2.make: + Copy the WebKit2WebProcess.resources directory into the AppleInternal bin. + + * win/WebKit2WebProcess.resources: Added. + * win/WebKit2WebProcess.resources/Info.plist: Added. + Copied from the WebKit version of Info.plist. + + * win/WebKit2WebProcessPostBuild.cmd: + Copy the WebKit2WebProcess.resources directory into the WebKitOutPutDir's bin. + +2011-01-31 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Make LayerTreeHost an abstract base class and make LayerTreeHostMac inherit from it + https://bugs.webkit.org/show_bug.cgi?id=53432 + + * WebKit2.xcodeproj/project.pbxproj: + Add LayerTreeHostMac.h. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + * WebProcess/WebPage/DrawingAreaImpl.h: + Make m_layerTreeHost an OwnPtr and initialize/destroy it appropriately. + + * WebProcess/WebPage/LayerTreeHost.cpp: + (WebKit::LayerTreeHost::create): + On Mac, create a LayerTreeHostMac instance. + + (WebKit::LayerTreeHost::~LayerTreeHost): + No need to call platformInvalidate anymore. + + * WebProcess/WebPage/LayerTreeHost.h: + * WebProcess/WebPage/mac/LayerTreeHostMac.h: Added. + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: + (WebKit::LayerTreeHostMac::~LayerTreeHostMac): + Invalidate the run loop observer here instead of in platformInvalidate. + + (WebKit::LayerTreeHostMac::scheduleLayerFlush): + (WebKit::LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback): + These are now members of LayerTreeHostMac. + +2011-01-30 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + [Take 2!] + Fixed crash on window close (maybe crash on launch?) due to missing frame null checks + https://bugs.webkit.org/show_bug.cgi?id=53408 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didNavigateWithNavigationData): + (WebKit::WebContext::didPerformClientRedirect): + (WebKit::WebContext::didPerformServerRedirect): + (WebKit::WebContext::didUpdateHistoryTitle): Use MESSAGE_CHECK because + we don't think we should be able to reach this state under normal conditions. + +2011-01-30 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Maciej Stachowiak. + + Fixed crash on window close (maybe crash on launch?) due to missing + frame null checks + https://bugs.webkit.org/show_bug.cgi?id=53408 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didNavigateWithNavigationData): + (WebKit::WebContext::didPerformClientRedirect): + (WebKit::WebContext::didPerformServerRedirect): + (WebKit::WebContext::didUpdateHistoryTitle): Check for NULL, since we're + calling a function that can return it. + +2011-01-30 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt][WK2]REGRESSION (r76991): Fix build errors + https://bugs.webkit.org/show_bug.cgi?id=53400 + + Revert the temporary build fix (http://trac.webkit.org/changeset/77088) + and remove WebKit2Prefix.h from the build. + * UIProcess/API/qt/qwkhistory.h: + * UIProcess/API/qt/qwkpage.h: + * WebKit2.pro: + +2011-01-30 Jeff Miller <jeffm@apple.com> + + Reviewed by Dan Bernstein. + + FindController::updateFindIndicator() crashes if selection isn't visible + https://bugs.webkit.org/show_bug.cgi?id=53399 + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindIndicator): Return false if ShareableBitmap::createShareable() returns null (typically because the selection rect is empty). + +2011-01-30 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed. + + [Qt][WK2] Buildfix. + + * UIProcess/API/qt/qwkhistory.h: + * UIProcess/API/qt/qwkpage.h: + +2011-01-29 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Geoffrey Garen. + + Add WKPageCopyPendingAPIRequestURL API + https://bugs.webkit.org/show_bug.cgi?id=53383 + + This API returns the last URL requested for load via API, if neither that load nor any + other load subsequently reaches the provisional state. + + This is useful to be able to track loads initiated via the API + + * UIProcess/API/C/WKPage.cpp: + (WKPageCopyPendingAPIRequestURL): Retrieve the pending URL. + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadURL): Set pending URL. + (WebKit::WebPageProxy::loadURLRequest): ditto + (WebKit::WebPageProxy::reload): ditto + (WebKit::WebPageProxy::goForward): ditto + (WebKit::WebPageProxy::goBack): ditto + (WebKit::WebPageProxy::estimatedProgress): Assume the initial + progress value when there is a pending URL. + (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Clear + pending URL; clients should look at the provisional URL now. + (WebKit::WebPageProxy::decidePolicyForNavigationAction): Clear + pending URL if it doesn't match the policy URL; this means we + were interrupted by another load. + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::pendingAPIRequestURL): Helper function. + (WebKit::WebPageProxy::clearPendingAPIRequestURL): ditto + (WebKit::WebPageProxy::setPendingAPIRequestURL): ditto + +2011-01-28 Jon Honeycutt <jhoneycutt@apple.com> + + Downloads in WK2 on Windows should write resume data to bundle + https://bugs.webkit.org/show_bug.cgi?id=53282 + <rdar://problem/8753077> + + Reviewed by Alice Liu. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::decideDestinationWithSuggestedFilename): + Call didDecideDestination(), now that the destination is decided. + + * WebProcess/Downloads/Download.h: + Declare didDecideDestination(). Added member variables to hold the + destination file path and the download bundle path. + (WebKit::Download::destination): + Return the path to the final destination for this download. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::start): + Remove the name of an unused param. + (WebKit::Download::startWithHandle): + Ditto. + (WebKit::Download::cancel): + Tell CFNetwork not to delete the file upon failure, and tell it to + cancel the download. Copy the resume data for the download, and append + it to the download bundle. Call didCancel() with an empty + DataReference, since we have written our own resume data. + (WebKit::decideDestinationWithSuggestedObjectNameCallback): + Remove some unused param names. Removed the call to + CFURLDownloadSetDestination() - this is now handled in + Download::didDecideDestination(). + (WebKit::didCreateDestinationCallback): + Report that the final destination was created, rather than the download + bundle, matching old WebKit. + (WebKit::Download::didDecideDestination): + Store the final destination and the download bundle paths, and call + CFURLDownloadSetDestination(), passing the path to the download bundle. + + * WebProcess/Downloads/curl/DownloadCurl.cpp: + (WebKit::Download::didDecideDestination): + Stubbed. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::didDecideDestination): + Stubbed - unneeded on the Mac. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::didDecideDestination): + Stubbed. + +2011-01-29 Jeff Miller <jeffm@apple.com> + + Reviewed by Anders Carlsson. + + Support find bouncy in WebKit2 on Windows + https://bugs.webkit.org/show_bug.cgi?id=53329 + <rdar://problem/8565843> + The Mac implements the find bouncy inside of WebKit in the UI process for WebKit2, but we need to do this inside Safari for WebKit2 on Windows. + Add infrastructure to call back into the app when the find indicator changes. + + * UIProcess/API/C/win/WKView.cpp: Cleanup some code style violations. + (WKViewSetFindIndicatorCallback): Added. + (WKViewGetFindIndicatorCallback): Added. + * UIProcess/API/C/win/WKView.h: Cleanup some code style violations. + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::create): + (WebKit::FindIndicator::FindIndicator): + (WebKit::FindIndicator::frameRect): + (WebKit::FindIndicator::draw): + Rename m_selectionRect to m_selectionRectInWindowCoordinates and m_textRects to m_textRectsInSelectionRectCoordinates (along with similarly named local variables) to be more explict about the coordinate system. + * UIProcess/FindIndicator.h: + (WebKit::FindIndicator::selectionRectInWindowCoordinates): Added. + (WebKit::FindIndicator::textRects): Rename m_textRects to m_textRectsInSelectionRectCoordinates. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setFindIndicator): Rename selectionRect to selectionRectInWindowCoordinates and textRects to textRectsInSelectionRectCoordinates to be more explict about the coordinate system. + * UIProcess/WebPageProxy.h: Ditto. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::setFindIndicator): Added. + (WebKit::WebView::setFindIndicatorCallback): Added. + (WebKit::WebView::getFindIndicatorCallback): Added. + * UIProcess/win/WebView.h: + +2011-01-28 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=53367 + <rdar://problem/8926460> Remove dysfunctional code from -[WKPrintingView _isPrintingPreview]. + + * UIProcess/API/mac/WKPrintingView.mm: (-[WKPrintingView _isPrintingPreview]): The common + branch works fine for now, no need to make platforms different. + +2011-01-28 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + WKPageGetEstimatedProgress returns wrong value after a mainframe provisional load has started + https://bugs.webkit.org/show_bug.cgi?id=53358 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didStartProgress): Start progress at the magic initial value, not 0. + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Yet another build fix (What was I thinking?) + + * WebProcess/Downloads/Download.h: + * WebProcess/Plugins/PluginProxy.h: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * Shared/PrintInfo.h: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Fix tyop. + + * Shared/mac/CoreAnimationRenderer.mm: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add CoreAnimationRenderer class + https://bugs.webkit.org/show_bug.cgi?id=53343 + + * Shared/mac/CoreAnimationRenderer.h: Added. + * Shared/mac/CoreAnimationRenderer.mm: Added. + + (WebKit::CoreAnimationRenderer::CoreAnimationRenderer): + Initialize the underlying CARenderer object and hook up a notification observer. + + (WebKit::CoreAnimationRenderer::~CoreAnimationRenderer): + Assert that the client is null. It has been set to null by the call to invalidate(). + + (WebKit::CoreAnimationRenderer::setBounds): + Update the bounds on the CARenderer and the root layer. + + (WebKit::CoreAnimationRenderer::render): + Ask the renderer to render and return the next frame time. + + (WebKit::CoreAnimationRenderer::invalidate): + Remove the change observer and reset the client. + + (WebKit::CoreAnimationRenderer::rendererDidChange): + Call the client member function. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an OBJC_CLASS macro for forward declaring an Objective-C class + https://bugs.webkit.org/show_bug.cgi?id=53337 + + * Shared/NativeWebKeyboardEvent.h: + * Shared/PrintInfo.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/WebInspectorProxy.h: + * UIProcess/mac/WebContextMenuProxyMac.h: + * UIProcess/mac/WebPopupMenuProxyMac.h: + * WebProcess/Downloads/Download.h: + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.h: + * config.h: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't put config.h in the message headers. + + * Scripts/webkit2/messages.py: + * Scripts/webkit2/messages_unittest.py: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Fix build. + + * Shared/mac/ShareableSurface.cpp: + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Try to unbreak the Windows build. + + * UIProcess/cf/WebPageProxyCF.cpp: + +2011-01-28 Brady Eidson <beidson@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=53330 + Need InjectedBundle API to get the response MIMEType for a URL + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyMIMETypeForResourceWithURL): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + + Get the MIMEType from the in-memory cache, or cachedResponseMIMETypeForURL() if not available: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::mimeTypeForResourceWithURL): + * WebProcess/WebPage/WebFrame.h: + + Get the MIMEType from the platform's disk cache if available: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::cachedResponseMIMETypeForURL): + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::cachedResponseMIMETypeForURL): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::cachedResponseMIMETypeForURL): + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Clean up the mess introduced when config.h was added to the project: + + - Remove the contents of WebKit2Prefix.h that is now in config.h, to avoid including everything + twice in each file, probably slowing down compile time. + + - Add config.h to all the files that were forgotten in order to keep the build from breaking. + + - Added trap to ensure that config.h is included at the top of every implementation file. If this + had been added it would have caught the previous issue. + +2011-01-28 Stephanie Lewis <slewis@apple.com> + + Reviewed by Geoff Garen. + + <rdar://problem/8857651> Implement unregisterWorld for WebKit2 + Rename unregisterWorld to clearWrappers. Clearing the wrappers reduces the + memory use of isolated worlds. + + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp: + (WKBundleScriptWorldClearWrappers): + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h: + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: + (WebKit::InjectedBundleScriptWorld::clearWrappers): + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h: + +2011-01-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + <select> can't display right-to-left (rtl) languages + https://bugs.webkit.org/show_bug.cgi?id=19785 + + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::WebPopupItem): Added initializers for m_textDirection and m_hasTextDirectionOverride. + (WebKit::WebPopupItem::encode): Encode the item's writing direction and direction override values. + (WebKit::WebPopupItem::decode): Decode the item's writing direction and direction override values. + * Shared/WebPopupItem.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showPopupMenu): Added a parameter for the menu's text direction. + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: Ditto. + * UIProcess/WebPopupMenuProxy.h: + * UIProcess/mac/WebPopupMenuProxyMac.h: + * UIProcess/mac/WebPopupMenuProxyMac.mm: + (WebKit::WebPopupMenuProxyMac::populate): Added a parameter for the menu's text direction. + Set items' text alignment to match the menu's writing direction. Set items' writing direction + and direction override according to their styles. + (WebKit::WebPopupMenuProxyMac::showPopupMenu): Set the pop-up's layout direction. + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural): Changed to return false. + (WebKit::WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added. + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::populateItems): Initialize items' writing direction and direction override + values. + (WebKit::WebPopupMenu::show): Pass the menu's writing direction. + +2011-01-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add ShareableSurface class + https://bugs.webkit.org/show_bug.cgi?id=53313 + + * Shared/mac/ShareableSurface.cpp: Added. + (WebKit::ShareableSurface::Handle::Handle): + Initialize the mach port. + + (WebKit::ShareableSurface::Handle::~Handle): + Deallocate our send right if needed. + + (WebKit::ShareableSurface::Handle::encode): + Encode the send right, and then null it out. + + (WebKit::ShareableSurface::Handle::decode): + Decode the send right. + + (WebKit::createIOSurface): + Create an IOSurface with the given size. + + (WebKit::ShareableSurface::create): + Create an IOSurface, either from a size or from a handle. + + (WebKit::ShareableSurface::~ShareableSurface): + Delete the texture and framebuffer. + + (WebKit::ShareableSurface::createHandle): + Create a mach port from the surface. + + (WebKit::ShareableSurface::attach): + Create an FBO if needed and bind it. + + (WebKit::ShareableSurface::detach): + Unbind the FBO. + + (WebKit::ShareableSurface::textureID): + Generate a new texture and bind it to the IOSurface. + + * Shared/mac/ShareableSurface.h: Added. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2011-01-27 Adam Roben <aroben@apple.com> + + Change BinarySemaphore to wrap an auto-reset Win32 event on Windows + + Fixes <http://webkit.org/b/53208> <rdar://problem/8922490>. + + Reviewed by Dave Hyatt. + + * Platform/CoreIPC/BinarySemaphore.cpp: Wrap this implementation in #if !PLATFORM(WIN). + + * Platform/CoreIPC/BinarySemaphore.h: Make the Windows implementation have a single HANDLE + member that holds the event. + + * Platform/CoreIPC/win/BinarySemaphoreWin.cpp: Copied from Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp. + (CoreIPC::BinarySemaphore::BinarySemaphore): Create our event. + (CoreIPC::BinarySemaphore::~BinarySemaphore): Destory our event. + (CoreIPC::BinarySemaphore::signal): Signal the event. + (CoreIPC::BinarySemaphore::wait): Convert the absolute time to a wait interval, then wait + for the event to be signaled or for the interval to elapse. + + * win/WebKit2.vcproj: Added BinarySemaphoreWin.cpp. Also let VS have its way with the file. + +2011-01-27 Chris Marrin <cmarrin@apple.com> + + Reviewed by Anders Carlsson. + + WebKit2: Page flashes just before accelerated compositing animation + https://bugs.webkit.org/show_bug.cgi?id=53274 + + When switching out of compositing mode, the new ChunkedUpdateDrawingAreaProxy + is getting created with the current page size. When the setSize() call is + subsequently made, the sizeDidChange() call is not made (which does the initial + render of the page) because the old size and new size are the same. The solution + is to skip the setting of the size in the ctor and let it go through a size + change sequence. + + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + +2011-01-28 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Fix dist compilation for the release + https://bugs.webkit.org/show_bug.cgi?id=53290 + + * GNUmakefile.am: Remove a file that is not in the repository + anymore. + + +2011-01-28 Andreas Kling <kling@webkit.org> + + Rubber-stamped by Simon Hausmann. + + [Qt][WK2] Combine QWKPage::engine{Connected,Disconnected} into one signal. + + Having two signals for this is redundant, combine them into + QWKPage::engineConnectionChanged(bool connected). + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::didRelaunchProcess): + (QWKPagePrivate::processDidCrash): + * UIProcess/API/qt/qwkpage.h: + +2011-01-27 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Maciej Stachowiak. + + Build fix for Mac Intel Debug after r76916 + https://bugs.webkit.org/show_bug.cgi?id=53284 + + Fix macro redefinition by guarding the redefined macros. + + * config.h: + +2011-01-27 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed build fix for Mac Intel Debug after r76916. + + Fix macro redefinition by guarding the redefined macros. + + Check if the macro is already defined before defininig it. + c++config.h has the same macros with the same values. + + * config.h: + +2011-01-27 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Adam Barth. + + Update the expected results for test-webkitpy after r76916. + + Include "config.h" in the expected results as well. + + * Scripts/webkit2/messages_unittest.py: + +2011-01-27 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed buildfix for SnowLeopard Intel Debug. + + Fix macro redefinition by not including config.h. + + Revert previous change in WebPageProxyCF.cpp. + + * UIProcess/cf/WebPageProxyCF.cpp: + +2011-01-27 Greg Coletta <greg.coletta@nokia.com> + + Reviewed by Laszlo Gombos. + + Get rid of prefix header dependency for WebKit2 build system. + https://bugs.webkit.org/show_bug.cgi?id=50174 + + Add config.h include explicitelly. + + * Platform/CoreIPC/ArgumentDecoder.cpp: + * Platform/CoreIPC/ArgumentEncoder.cpp: + * Platform/CoreIPC/Attachment.cpp: + * Platform/CoreIPC/BinarySemaphore.cpp: + * Platform/CoreIPC/Connection.cpp: + * Platform/CoreIPC/DataReference.cpp: + * Platform/CoreIPC/gtk/ConnectionGtk.cpp: + * Platform/CoreIPC/mac/ConnectionMac.cpp: + * Platform/CoreIPC/qt/ConnectionQt.cpp: + * Platform/CoreIPC/win/ConnectionWin.cpp: + * Platform/Logging.cpp: + * Platform/Module.cpp: + * Platform/Region.cpp: + * Platform/RunLoop.cpp: + * Platform/WorkQueue.cpp: + * Platform/cg/CGUtilities.cpp: + * Platform/gtk/RunLoopGtk.cpp: + * Platform/gtk/SharedMemoryGtk.cpp: + * Platform/gtk/WorkQueueGtk.cpp: + * Platform/mac/MachUtilities.cpp: + * Platform/mac/SharedMemoryMac.cpp: + * Platform/mac/WorkQueueMac.cpp: + * Platform/qt/MappedMemoryPool.cpp: + * Platform/qt/ModuleQt.cpp: + * Platform/qt/RunLoopQt.cpp: + * Platform/qt/WorkQueueQt.cpp: + * Platform/win/ModuleWin.cpp: + * Platform/win/RunLoopWin.cpp: + * Platform/win/SharedMemoryWin.cpp: + * Platform/win/WorkQueueWin.cpp: + * PluginProcess/PluginControllerProxy.cpp: + * PluginProcess/PluginProcess.cpp: + * PluginProcess/WebProcessConnection.cpp: + * Scripts/webkit2/messages.py: + * Shared/API/c/WKArray.cpp: + * Shared/API/c/WKCertificateInfo.cpp: + * Shared/API/c/WKContextMenuItem.cpp: + * Shared/API/c/WKData.cpp: + * Shared/API/c/WKDictionary.cpp: + * Shared/API/c/WKError.cpp: + * Shared/API/c/WKImage.cpp: + * Shared/API/c/WKMutableArray.cpp: + * Shared/API/c/WKMutableDictionary.cpp: + * Shared/API/c/WKNumber.cpp: + * Shared/API/c/WKSecurityOrigin.cpp: + * Shared/API/c/WKSerializedScriptValue.cpp: + * Shared/API/c/WKString.cpp: + * Shared/API/c/WKType.cpp: + * Shared/API/c/WKURL.cpp: + * Shared/API/c/WKURLRequest.cpp: + * Shared/API/c/WKURLResponse.cpp: + * Shared/API/c/WKUserContentURLPattern.cpp: + * Shared/API/c/cf/WKStringCF.cpp: + * Shared/API/c/cf/WKURLCF.cpp: + * Shared/API/c/cf/WKURLRequestCF.cpp: + * Shared/API/c/cf/WKURLResponseCF.cpp: + * Shared/API/c/cg/WKImageCG.cpp: + * Shared/API/c/win/WKCertificateInfoWin.cpp: + * Shared/ChildProcess.cpp: + * Shared/ImmutableArray.cpp: + * Shared/ImmutableDictionary.cpp: + * Shared/MutableArray.cpp: + * Shared/MutableDictionary.cpp: + * Shared/OriginAndDatabases.cpp: + * Shared/PlatformPopupMenuData.cpp: + * Shared/Plugins/NPIdentifierData.cpp: + * Shared/Plugins/NPObjectMessageReceiver.cpp: + * Shared/Plugins/NPObjectProxy.cpp: + * Shared/Plugins/NPRemoteObjectMap.cpp: + * Shared/Plugins/NPVariantData.cpp: + * Shared/Plugins/Netscape/NetscapePluginModule.cpp: + * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: + * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp: + * Shared/Plugins/PluginProcessCreationParameters.cpp: + * Shared/PrintInfo.cpp: + * Shared/SessionState.cpp: + * Shared/ShareableBitmap.cpp: + * Shared/UpdateInfo.cpp: + * Shared/VisitedLinkTable.cpp: + * Shared/WebBackForwardListItem.cpp: + * Shared/WebContextMenuItem.cpp: + * Shared/WebContextMenuItemData.cpp: + * Shared/WebError.cpp: + * Shared/WebEvent.cpp: + * Shared/WebEventConversion.cpp: + * Shared/WebGeolocationPosition.cpp: + * Shared/WebImage.cpp: + * Shared/WebKeyboardEvent.cpp: + * Shared/WebMemorySampler.cpp: + * Shared/WebMouseEvent.cpp: + * Shared/WebOpenPanelParameters.cpp: + * Shared/WebPageCreationParameters.cpp: + * Shared/WebPageGroupData.cpp: + * Shared/WebPlatformTouchPoint.cpp: + * Shared/WebPopupItem.cpp: + * Shared/WebPreferencesStore.cpp: + * Shared/WebProcessCreationParameters.cpp: + * Shared/WebTouchEvent.cpp: + * Shared/WebURLRequest.cpp: + * Shared/WebURLResponse.cpp: + * Shared/WebWheelEvent.cpp: + * Shared/cairo/ShareableBitmapCairo.cpp: + * Shared/cf/ArgumentCodersCF.cpp: + * Shared/cg/ShareableBitmapCG.cpp: + * Shared/gtk/ShareableBitmapGtk.cpp: + * Shared/gtk/WebCoreArgumentCodersGtk.cpp: + * Shared/mac/CommandLineMac.cpp: + * Shared/mac/UpdateChunk.cpp: + * Shared/qt/CleanupHandler.cpp: + * Shared/qt/NativeWebKeyboardEventQt.cpp: + * Shared/qt/ShareableBitmapQt.cpp: + * Shared/qt/UpdateChunk.cpp: + * Shared/qt/WebCoreArgumentCodersQt.cpp: + * Shared/qt/WebEventFactoryQt.cpp: + * Shared/qt/WebURLRequestQt.cpp: + * Shared/qt/WebURLResponseQt.cpp: + * Shared/win/CommandLineWin.cpp: + * Shared/win/NativeWebKeyboardEventWin.cpp: + * Shared/win/PlatformCertificateInfo.cpp: + * Shared/win/UpdateChunk.cpp: + * Shared/win/WebCoreArgumentCodersWin.cpp: + * Shared/win/WebEventFactory.cpp: + * Shared/win/WebURLRequestWin.cpp: + * Shared/win/WebURLResponseWin.cpp: + * UIProcess/API/C/WKAuthenticationChallenge.cpp: + * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: + * UIProcess/API/C/WKBackForwardList.cpp: + * UIProcess/API/C/WKBackForwardListItem.cpp: + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/WKCredential.cpp: + * UIProcess/API/C/WKDatabaseManager.cpp: + * UIProcess/API/C/WKDownload.cpp: + * UIProcess/API/C/WKFormSubmissionListener.cpp: + * UIProcess/API/C/WKFrame.cpp: + * UIProcess/API/C/WKFramePolicyListener.cpp: + * UIProcess/API/C/WKGeolocationManager.cpp: + * UIProcess/API/C/WKGeolocationPermissionRequest.cpp: + * UIProcess/API/C/WKGeolocationPosition.cpp: + * UIProcess/API/C/WKInspector.cpp: + * UIProcess/API/C/WKNavigationData.cpp: + * UIProcess/API/C/WKOpenPanelParameters.cpp: + * UIProcess/API/C/WKOpenPanelResultListener.cpp: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPageGroup.cpp: + * UIProcess/API/C/WKPreferences.cpp: + * UIProcess/API/C/WKProtectionSpace.cpp: + * UIProcess/API/C/win/WKContextWin.cpp: + * UIProcess/API/C/win/WKView.cpp: + * UIProcess/API/C/win/WKViewPrivate.cpp: + * UIProcess/API/cpp/qt/WKStringQt.cpp: + * UIProcess/API/cpp/qt/WKURLQt.cpp: + * UIProcess/API/qt/ClientImpl.cpp: + * UIProcess/API/qt/qgraphicswkview.cpp: + * UIProcess/API/qt/qwkcontext.cpp: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpreferences.cpp: + * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: + * UIProcess/Authentication/AuthenticationDecisionListener.cpp: + * UIProcess/Authentication/WebCredential.cpp: + * UIProcess/Authentication/WebProtectionSpace.cpp: + * UIProcess/BackingStore.cpp: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + * UIProcess/Downloads/DownloadProxy.cpp: + * UIProcess/DrawingAreaProxy.cpp: + * UIProcess/DrawingAreaProxyImpl.cpp: + * UIProcess/FindIndicator.cpp: + * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: + * UIProcess/GeolocationPermissionRequestProxy.cpp: + * UIProcess/Launcher/ProcessLauncher.cpp: + * UIProcess/Launcher/ThreadLauncher.cpp: + * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp: + * UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp: + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + * UIProcess/Launcher/qt/ThreadLauncherQt.cpp: + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + * UIProcess/Launcher/win/ThreadLauncherWin.cpp: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + * UIProcess/Plugins/PluginInfoStore.cpp: + * UIProcess/Plugins/PluginProcessManager.cpp: + * UIProcess/Plugins/PluginProcessProxy.cpp: + * UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp: + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + * UIProcess/ResponsivenessTimer.cpp: + * UIProcess/TiledDrawingAreaProxy.cpp: + * UIProcess/VisitedLinkProvider.cpp: + * UIProcess/WebBackForwardList.cpp: + * UIProcess/WebContext.cpp: + * UIProcess/WebContextInjectedBundleClient.cpp: + * UIProcess/WebContextMenuProxy.cpp: + * UIProcess/WebDatabaseManagerProxy.cpp: + * UIProcess/WebDatabaseManagerProxyClient.cpp: + * UIProcess/WebDownloadClient.cpp: + * UIProcess/WebEditCommandProxy.cpp: + * UIProcess/WebFindClient.cpp: + * UIProcess/WebFormClient.cpp: + * UIProcess/WebFormSubmissionListenerProxy.cpp: + * UIProcess/WebFrameListenerProxy.cpp: + * UIProcess/WebFramePolicyListenerProxy.cpp: + * UIProcess/WebFrameProxy.cpp: + * UIProcess/WebGeolocationManagerProxy.cpp: + * UIProcess/WebGeolocationProvider.cpp: + * UIProcess/WebHistoryClient.cpp: + * UIProcess/WebInspectorProxy.cpp: + * UIProcess/WebLoaderClient.cpp: + * UIProcess/WebNavigationData.cpp: + * UIProcess/WebOpenPanelResultListenerProxy.cpp: + * UIProcess/WebPageContextMenuClient.cpp: + * UIProcess/WebPageGroup.cpp: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPolicyClient.cpp: + * UIProcess/WebPreferences.cpp: + * UIProcess/WebProcessManager.cpp: + * UIProcess/WebProcessProxy.cpp: + * UIProcess/WebResourceLoadClient.cpp: + * UIProcess/WebUIClient.cpp: + * UIProcess/cf/WebBackForwardListCF.cpp: + * UIProcess/cf/WebPageProxyCF.cpp: + * UIProcess/cf/WebPreferencesCF.cpp: + * UIProcess/gtk/TextCheckerGtk.cpp: + * UIProcess/gtk/WebInspectorGtk.cpp: + * UIProcess/gtk/WebPageProxyGtk.cpp: + * UIProcess/gtk/WebPreferencesGtk.cpp: + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + * UIProcess/qt/TextCheckerQt.cpp: + * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: + * UIProcess/qt/TiledDrawingAreaTileQt.cpp: + * UIProcess/qt/WebContextMenuProxyQt.cpp: + * UIProcess/qt/WebContextQt.cpp: + * UIProcess/qt/WebInspectorProxyQt.cpp: + * UIProcess/qt/WebPageProxyQt.cpp: + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + * UIProcess/qt/WebPreferencesQt.cpp: + * UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp: + * UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp: + * UIProcess/win/TextCheckerWin.cpp: + * UIProcess/win/WebContextMenuProxyWin.cpp: + * UIProcess/win/WebContextWin.cpp: + * UIProcess/win/WebInspectorProxyWin.cpp: + * UIProcess/win/WebPageProxyWin.cpp: + * UIProcess/win/WebPopupMenuProxyWin.cpp: + * UIProcess/win/WebView.cpp: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Authentication/AuthenticationManager.cpp: + * WebProcess/Downloads/Download.cpp: + * WebProcess/Downloads/DownloadManager.cpp: + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + * WebProcess/Downloads/curl/DownloadCurl.cpp: + * WebProcess/Downloads/qt/DownloadQt.cpp: + * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: + * WebProcess/Geolocation/WebGeolocationManager.cpp: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + * WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp: + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: + * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp: + * WebProcess/InjectedBundle/InjectedBundleClient.cpp: + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: + * WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp: + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: + * WebProcess/Plugins/Netscape/JSNPMethod.cpp: + * WebProcess/Plugins/Netscape/JSNPObject.cpp: + * WebProcess/Plugins/Netscape/NPJSObject.cpp: + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + * WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + * WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp: + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + * WebProcess/Plugins/Plugin.cpp: + * WebProcess/Plugins/PluginProcessConnection.cpp: + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + * WebProcess/Plugins/PluginProxy.cpp: + * WebProcess/Plugins/PluginView.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: + * WebProcess/WebCoreSupport/WebDragClient.cpp: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: + * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp: + * WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp: + * WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp: + * WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp: + * WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp: + * WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp: + * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + * WebProcess/WebKitMain.cpp: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + * WebProcess/WebPage/DecoderAdapter.cpp: + * WebProcess/WebPage/DrawingArea.cpp: + * WebProcess/WebPage/DrawingAreaImpl.cpp: + * WebProcess/WebPage/EncoderAdapter.cpp: + * WebProcess/WebPage/FindController.cpp: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + * WebProcess/WebPage/PageOverlay.cpp: + * WebProcess/WebPage/TiledDrawingArea.cpp: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + * WebProcess/WebPage/WebContextMenu.cpp: + * WebProcess/WebPage/WebEditCommand.cpp: + * WebProcess/WebPage/WebFrame.cpp: + * WebProcess/WebPage/WebInspector.cpp: + * WebProcess/WebPage/WebOpenPanelResultListener.cpp: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPageGroupProxy.cpp: + * WebProcess/WebPage/gtk/WebInspectorGtk.cpp: + * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp: + * WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp: + * WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp: + * WebProcess/WebPage/qt/WebInspectorQt.cpp: + * WebProcess/WebPage/qt/WebPageQt.cpp: + * WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp: + * WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp: + * WebProcess/WebPage/win/WebInspectorWin.cpp: + * WebProcess/WebPage/win/WebPageWin.cpp: + * WebProcess/WebProcess.cpp: + * WebProcess/gtk/WebProcessGtk.cpp: + * WebProcess/gtk/WebProcessMainGtk.cpp: + * WebProcess/qt/WebProcessMainQt.cpp: + * WebProcess/qt/WebProcessQt.cpp: + * WebProcess/win/WebProcessMainWin.cpp: + * WebProcess/win/WebProcessWin.cpp: + * config.h: Copied from Source/WebKit2/WebKit2Prefix.h. + * win/WebKit2Common.vsprops: + +2011-01-27 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Darin Adler. + + execCommand("Paste") doesn't work in WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=52785 + + Thread through the new JavaScriptCanAccessClipboard setting. + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetJavaScriptCanAccessClipboard): + (WKPreferencesGetJavaScriptCanAccessClipboard): + * UIProcess/API/C/WKPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2011-01-27 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Use Document::url() instead of FrameLoader::url(). + https://bugs.webkit.org/show_bug.cgi?id=41165 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::url): + +2011-01-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Encode/Decode hasPreciseScrollingDeltas bit in WebWheelEvent + https://bugs.webkit.org/show_bug.cgi?id=53254 + + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::WebWheelEvent): + Initialize m_phase and m_hasPreciseScrollingDeltas. + + (WebKit::WebWheelEvent::encode): + (WebKit::WebWheelEvent::decode): + Add missing coding for m_hasPreciseScrollingDeltas. + +2011-01-26 Enrica Casucci <enrica@apple.com> + + Reviewed by Darin Adler and Adam Roben. + + WebKit2: add support for drag and drop on Windows + https://bugs.webkit.org/show_bug.cgi?id=52775 + <rdar://problem/8514409> + + On Windows the access to the content being dragged is + provided via the IDataObject interface that is made available + to the window that registers itself as drop target. + Since this interface cannot be accessed from the WebProcess, + in every call to one of the methods of the IDropTarget interface + we serialize the content of the drag clipboard and send it over to + the WebProcess. The implementation uses the same messages as the + Mac one, with slightly different parameters to pass the serialized + clipboard. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::performDragControllerAction): Added Windows + specific implementation. + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): Added dropTargetHelper object creation. + (WebKit::WebView::initialize): Added to register for drag/drop with out + refcount issues. + (WebKit::WebView::close): + (WebKit::WebView::windowReceivedMessage): + (WebKit::WebView::QueryInterface): + (WebKit::WebView::AddRef): + (WebKit::WebView::Release): + (WebKit::dragOperationToDragCursor): + (WebKit::WebView::keyStateToDragOperation): + (WebKit::WebView::DragEnter): + (WebKit::WebView::DragOver): + (WebKit::WebView::DragLeave): + (WebKit::WebView::Drop): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::performDragControllerAction): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2011-01-26 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=53197 + <rdar://problem/8895682> Make WebKit2 printing asynchronous + + <rdar://problem/8899988> REGRESSION(WebKit2): Attempting to print WHATWG HTML spec shows + 1-page blank preview + + <rdar://problem/8900078> WebKit2 printing has a separate message exchange per page when + printing instead of printing all at once + + * UIProcess/API/mac/WKPrintingView.h: Store a lot more cached information. + + * UIProcess/API/mac/WKPrintingView.mm: + (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): Use PrintOperation stored in + class. We generally want that now, because current operation will not be set up on other threads. + (-[WKPrintingView _isPrintingPreview]): Added. Preview is different, because it can draw + a placeholder - but actual printing need to wait until UI process has data. + (-[WKPrintingView _updatePreview]): Force AppKit to update print preview when we have real + data to replace placeholder with. + (-[WKPrintingView _hasPageRects]): Return if page rects have already been computed. + (-[WKPrintingView _expectedPreviewCallbackForRect:]): Find an existing request for this rect, + if any. + (pageDidDrawToPDF): Update preview - or if actually printing, release control to printing thread. + (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): Ask for a PDF document with + pages the user asked to print. + (pageDidComputePageRects): When web process returns page geometry data, we update preview to display + a page count (which indirectly triggers a request for a preview). When actually printing, + request a PDF right away, we'll need it later. + (-[WKPrintingView _askPageToComputePageRects]): Ask web process for page geometry. + (prepareDataForPrintingOnSecondaryThread): This function starts preparing all data necessary + for actual printing on main thread. + (-[WKPrintingView knowsPageRange:]): Changed to be async for preview, and to call main + thread for actual printing. + (-[WKPrintingView _pageForRect:]): Find page number for a given range, assuming that AppKit + always asks for full pages. + (-[WKPrintingView _drawPDFDocument:page:atPoint:]): A helper function to draw a PDF document. + (-[WKPrintingView _drawPreview:]): Draw the whole page for preview. + (-[WKPrintingView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + Draw the whole page for actual printing. + (-[WKPrintingView _drawPageBorderWithSizeOnMainThread:]): Call drawPageBorderWithSize: with + correct graphics context and print operation. + (-[WKPrintingView drawPageBorderWithSize:]): Delegate work to main thread when called from a + secondary one. + (-[WKPrintingView _provideTotalScaleFactorForPrintOperation:]): Added an assertion that + our stored NSPrintOperation isn't out of sync with reality. + (-[WKPrintingView rectForPage:]): Handle the case where we don't have the data yet, drawing + a placeholder. + (-[WKPrintingView endDocument]): When page setup changes, we must reset all state. + + * UIProcess/API/mac/WKView.mm: (-[WKView printOperationWithPrintInfo:forFrame:]): Tell + NSPrintingView which operation it's serving, so that it knows it even when current operation + isn't set. + + * UIProcess/GenericCallback.h: + (WebKit::ComputedPagesCallback::create): + (WebKit::ComputedPagesCallback::~ComputedPagesCallback): + (WebKit::ComputedPagesCallback::performCallbackWithReturnValue): + (WebKit::ComputedPagesCallback::invalidate): + (WebKit::ComputedPagesCallback::callbackID): + (WebKit::ComputedPagesCallback::generateCallbackID): + (WebKit::ComputedPagesCallback::ComputedPagesCallback): + Added ComputedPagesCallback, which returns a vector of IntRects and a double. Hopefully, + it will become a specialization of GenericCallback one day. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Added m_voidCallbacks - it looks like they were omitted + by accident. + (WebKit::WebPageProxy::computedPagesCallback): Added. + (WebKit::WebPageProxy::processDidCrash): Added m_computedPagesCallbacks. + (WebKit::WebPageProxy::computePagesForPrinting): Async now! + (WebKit::WebPageProxy::drawRectToPDF): Ditto. + (WebKit::WebPageProxy::drawPagesToPDF): Added. + * UIProcess/WebPageProxy.h: + + * UIProcess/WebPageProxy.messages.in: Added ComputedPagesCallback. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::beginPriting): Compute page rects right away - we'll need them in + drawPagesToPDF(), which doesn't have a PrintInfo. + (WebKit::WebPage::computePagesForPrinting): Send async response. + (WebKit::WebPage::drawRectToPDF): This function used to draw into original + location at frame coordinates, and now it draws at (0, 0). + (WebKit::WebPage::drawPagesToPDF): Added - make a multi-page PDF. + * WebProcess/WebPage/WebPage.h: + + * WebProcess/WebPage/WebPage.messages.in: Added DrawPagesToPDF. + +2011-01-27 Alejandro G. Castro <alex@igalia.com> + + Unreviewed GTK build fix after r76797. + + * Shared/WebPreferencesStore.h: Use Qt fonts preference for the moment. + +2011-01-27 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + Allow pop-up menus to contain multiple items that have the same title. + + * UIProcess/mac/WebPopupMenuProxyMac.mm: + (WebKit::WebPopupMenuProxyMac::populate): Set the item’s title after adding it rather than + when adding it, so that it will not replace any existing item with the same title. + +2011-01-27 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Add QWKPage APIs regarding engine process availability + https://bugs.webkit.org/show_bug.cgi?id=53237 + + QWKPage will now emit engineConnected() and engineDisconnected() + when the web process crashes and is relaunched respectively. + + Also added QWKPage::isConnectedToEngine() for convenience. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::didRelaunchProcess): + (QWKPagePrivate::processDidCrash): + (QWKPage::isConnectedToEngine): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + +2011-01-27 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Lots of layout test failures due to wrong font type + https://bugs.webkit.org/show_bug.cgi?id=53233 + + * Shared/WebPreferencesStore.h: + Specialize default font families for Qt. + +2011-01-26 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector + https://bugs.webkit.org/show_bug.cgi?id=42319 + + Add WKBundleInspector and APIs needed to implement WebKitTestRunner APIs. + + * GNUmakefile.am: + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp: Added. + (WKBundleInspectorGetTypeID): + (WKBundleInspectorShow): + (WKBundleInspectorClose): + (WKBundleInspectorEvaluateScriptForTest): + (WKBundleInspectorSetPageProfilingEnabled): + * WebProcess/InjectedBundle/API/c/WKBundleInspector.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetInspector): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::create): + (WebKit::WebInspector::evaluateScriptForTest): + * WebProcess/WebPage/WebInspector.h: + (WebKit::WebInspector::type): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::inspector): + * WebProcess/WebPage/WebPage.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2011-01-26 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork + <rdar://problem/8821760> + + Reviewed by Antti Koivisto. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Added initialization for + GetHTTPPipeliningPriority and SetHTTPPipeliningPriority. + +2011-01-26 Beth Dakin <bdakin@apple.com> + + Reviewed by Darin Adler. + + Fix for <rdar://problem/8895140> Adopt WKScrollbar metrics + when using WKScrollbars. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-01-26 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Add events to represent the start/end of a gesture scroll + https://bugs.webkit.org/show_bug.cgi?id=53215 + + * Scripts/webkit2/messages.py: + * Shared/WebEvent.h: + (WebKit::WebGestureEvent::WebGestureEvent): + (WebKit::WebGestureEvent::position): + (WebKit::WebGestureEvent::globalPosition): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent): + (WebKit::platform): + * Shared/WebEventConversion.h: + * Shared/WebGestureEvent.cpp: Added. + (WebKit::WebGestureEvent::WebGestureEvent): + (WebKit::WebGestureEvent::encode): + (WebKit::WebGestureEvent::decode): + (WebKit::WebGestureEvent::isGestureEventType): + * Shared/mac/WebEventFactory.h: + * Shared/mac/WebEventFactory.mm: + (WebKit::gestureEventTypeForEvent): + (WebKit::WebEventFactory::createWebGestureEvent): + * UIProcess/API/mac/WKView.mm: + (-[WKView shortCircuitedEndGestureWithEvent:]): + (-[WKView beginGestureWithEvent:]): + (-[WKView viewDidMoveToWindow]): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::handleGestureEvent): + (WebKit::WebPageProxy::didReceiveEvent): + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::handleGestureEvent): + (WebKit::WebPage::gestureEvent): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + Pipe gesture events down to WebCore. + +2011-01-26 Dan Bernstein <mitz@apple.com> + + Reviewed by Dave Hyatt. + + <rdar://problem/8446709> Allow inter-ideograph justification for CJK + https://bugs.webkit.org/show_bug.cgi?id=53184 + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): Added a TrailingExpansionBehavior parameter to the + RenderText constructor. + +2011-01-26 Jing Jin <jjin@apple.com> + + Reviewed by Darin Adler. + + Methods to temporarily disable size updates to the page drawing area in WKView. + https://bugs.webkit.org/show_bug.cgi?id=53206 + Part of <rdar://problem/8818585> + + * UIProcess/API/mac/WKView.h: Added _frameSizeUpdateDisabledCount. + * UIProcess/API/mac/WKView.mm: + (-[WKView setFrameSize:]): Only update page size if frame size updates are enabled. + (-[WKView _setDrawingAreaSize:]): Helper method to set the page's drawing area's size. + (-[WKView disableFrameSizeUpdates]): Increment _frameSizeUpdateDisabledCount + (-[WKView enableFrameSizeUpdates]): Decrement _frameSizeUpdateDisabledCount, and if the count is 0, meaning + that no one is disabling frame size updates anymore, update the drawing area's size to match the current frame. + (-[WKView frameSizeUpdatesDisabled]): Returns YES if at least one caller is disabling frame size updates. + * UIProcess/API/mac/WKViewInternal.h: Declared -disableFrameSizeUpdates, -enableFrameSizeUpdates, and -frameSizeUpdatesDisabled. + * UIProcess/API/mac/WKViewPrivate.h: Added. + * WebKit2.xcodeproj/project.pbxproj: Added WKViewPrivate.h + +2011-01-26 Jing Jin <jjin@apple.com> + + Rubber-stamped by Dan Bernstein. + + Several WKView Internal category methods are implemented in the main category. + https://bugs.webkit.org/show_bug.cgi?id=53195 + + * UIProcess/API/mac/WKView.mm: + (-[WKView _setEventBeingResent:]): Moved into implementation of WKView (Internal). + (-[WKView _interceptKeyEvent:]): Moved into implementation of WKView (Internal). + (-[WKView _getTextInputState:selectionEnd:underlines:WebCore::]): Moved into implementation of WKView (Internal). + (-[WKView _setAccessibilityChildToken:]): Moved into implementation of WKView (Internal). + +2011-01-26 Brian Weinstein <bweinstein@apple.com> + + Reviewed by John Sullivan. + + WebKit2: Need API to get the frame load state of a BundleFrame + https://bugs.webkit.org/show_bug.cgi?id=53193 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetFrameLoadState): Call through to the FrameLoader to get the frame load state. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + +2011-01-25 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Antti Koivisto. + + Crashes loading pages when cancelling subresource loads through WebKit + https://bugs.webkit.org/show_bug.cgi?id=53123 + <rdar://problem/8914361> + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): If our URL is null, return early instead of dispatching + a message. + +2011-01-25 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + WK2 leaks when a page is closed + https://bugs.webkit.org/show_bug.cgi?id=53100 + + Allow the WKView a chance to clean up on a page close. In this case, + cleaning up means removing the references the accessibility token has + to the window. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::pageClosed): + * UIProcess/API/mac/WKView.mm: + (-[WKView _setRemoteAccessibilityWindow:]): + (-[WKView _setAccessibilityChildToken:]): + (-[WKView _processDidCrash]): + (-[WKView _pageClosed]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::pageClosed): + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::pageClosed): + * UIProcess/win/WebView.h: + +2011-01-25 Chris Marrin <cmarrin@apple.com> + + Reviewed by Adam Roben. + + Expose WebGL flag set/get in WK2 + https://bugs.webkit.org/show_bug.cgi?id=53096 + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetWebGLEnabled): + (WKPreferencesGetWebGLEnabled): + * UIProcess/API/C/WKPreferencesPrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2011-01-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add and implement LayerTreeHost::scheduleLayerFlush + https://bugs.webkit.org/show_bug.cgi?id=53135 + + * WebKit2.xcodeproj/project.pbxproj: + Add LayerTreeHostMac.mm. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::scheduleCompositingLayerSync): + Call LayerTreeHost::scheduleLayerFlush. + + * WebProcess/WebPage/LayerTreeHost.cpp: + (WebKit::LayerTreeHost::~LayerTreeHost): + Call platformInvalidate(). + + (WebKit::LayerTreeHost::flushPendingLayerChanges): + Rename from syncCompositingLayers. + + * WebProcess/WebPage/mac/LayerTreeHostMac.mm: Added. + (WebKit::LayerTreeHost::scheduleLayerFlush): + Create a run loop observer if needed. This code is copied from LayerBackedDrawingAreaMac.mm + + (WebKit::LayerTreeHost::platformInvalidate): + Invalidate the run loop observer. + + (WebKit::LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback): + Call flushPendingChanges() and remove the run loop observer if it succeeded. + +2011-01-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Add LayerTreeHost class + https://bugs.webkit.org/show_bug.cgi?id=53132 + + * WebKit2.xcodeproj/project.pbxproj: + Add LayerTreeHost files. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::DrawingAreaImpl): + Initialize m_layerTreeHost. + + (WebKit::DrawingAreaImpl::setRootCompositingLayer): + Call the m_layerTreeHost. + + * WebProcess/WebPage/LayerTreeHost.cpp: Added. + (WebKit::LayerTreeHost::attachRootCompositingLayer): + (WebKit::LayerTreeHost::detachRootCompositingLayer): + Add stubbed out functions. + + (WebKit::LayerTreeHost::syncCompositingLayers): + Sync the compositing layers in the main frame. + + * WebProcess/WebPage/LayerTreeHost.h: Added. + +2011-01-25 Steve Falkenburg <sfalken@apple.com> + + Rubber-stamped by Adam Roben. + + Windows production build fix. + Use correct environment variable escaping + + * win/WebKit2.make: + * win/WebKit2Generated.make: + +2011-01-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't inform the UI process about compositing changes when using the new drawing area + https://bugs.webkit.org/show_bug.cgi?id=53120 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): + Return early if we're using the new drawing area. + + (WebKit::WebPage::exitAcceleratedCompositingMode): + Call setRootCompositingLayer(0) so the drawing area knows when we leave accelerated compositing. + +2011-01-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Pipe a timestamp down into the PlatformWheelEvent for the Mac. + https://bugs.webkit.org/show_bug.cgi?id=53111 + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): + Assign the timestamp. + +2011-01-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add hasPreciseScrollingDeltas bit to PlatformWheelEvent on the Mac. + https://bugs.webkit.org/show_bug.cgi?id=53107 + + * Shared/WebEvent.h: + (WebKit::WebWheelEvent::hasPreciseScrollingDeltas): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::WebWheelEvent): + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebWheelEvent): + +2011-01-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + need a way to request the host CALayer render server port + https://bugs.webkit.org/show_bug.cgi?id=53101 + <rdar://problem/8913620> + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::compositingRenderServerPort): + Get the render server port from the plug-in process. + + * PluginProcess/PluginControllerProxy.h: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Call NetscapePlugin::compositingRenderServerPort. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::compositingRenderServerPort): + Call PluginController::compositingRenderServerPort. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::compositingRenderServerPort): + Get the render server port from the web process. + + * WebProcess/Plugins/PluginView.h: + Add compositingRenderServerPort. + +2011-01-25 Maciej Stachowiak <mjs@apple.com> + + Rubber stamped by Dan Bernstein. + + Change some floating point constants from 1.0 to 1. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + +2011-01-25 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + Improve scale factor resetting + https://bugs.webkit.org/show_bug.cgi?id=53093 + + Two key changes: + - Don't set the scale factor to what it already is, as this causes an + uneeded force layout and scroll + - Don't ever set the scale factor based on a non-main frame committing + + This fixes two WebKit2 layout tests. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + +2011-01-24 Chris Marrin <cmarrin@apple.com> + + Reviewed by Eric Seidel. + + Change ENABLE_3D_CANVAS to ENABLE_WEBGL + https://bugs.webkit.org/show_bug.cgi?id=53041 + + * Configurations/FeatureDefines.xcconfig: + +2011-01-25 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Add QWKPage::processCrashed() signal + https://bugs.webkit.org/show_bug.cgi?id=53076 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::processDidCrash): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Reset the page scale factor on standard frame loads + https://bugs.webkit.org/show_bug.cgi?id=53058 + <rdar://problem/8908844> + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::scaleWebView): + Don't set m_viewScaleFactor here. It will be set in viewScaleFactorDidChange. + + (WebKit::WebPageProxy::viewScaleFactorDidChange): + Update m_viewScaleFactor. + + * UIProcess/WebPageProxy.h: + Add viewScaleFactorDidChange. + + * UIProcess/WebPageProxy.messages.in: + Add ViewScaleFactorDidChange message. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + Set the scale factor. + + (WebKit::WebFrameLoaderClient::restoreViewState): + Inform the UI process about the new view scale factor. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaleWebView): + Send a ViewScaleFactorDidChange message. + +2011-01-24 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + Use designated temp directory for the database for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=53052 + + Add the API necessary to support this. Database path is now + determined on the UI process side and passed to the Web process. + Reviewed by Anders Carlsson. + + * GNUmakefile.am: + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + * UIProcess/API/C/WKContext.cpp: + (WKContextSetDatabaseDirectory): + * UIProcess/API/C/WKContextPrivate.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::databaseDirectory): + * UIProcess/WebContext.h: + (WebKit::WebContext::setDatabaseDirectory): + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformDefaultDatabaseDirectory): + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::platformDefaultDatabaseDirectory): + * UIProcess/win/WebContextWin.cpp: + (WebKit::WebContext::platformDefaultDatabaseDirectory): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: + (WebKit::WebDatabaseManager::initialize): + (WebKit::WebDatabaseManager::WebDatabaseManager): + * WebProcess/WebCoreSupport/WebDatabaseManager.h: + * WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp: Removed. + * WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm: Removed. + * WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp: Removed. + * WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp: Removed. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/com.apple.WebProcess.sb: + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + * win/WebKit2.vcproj: + +2011-01-24 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * win/WebKit2.vcproj: Don't build the CG Utilities when building + without CG support. + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Don't use the timeout checker for non-user-interaction messages + https://bugs.webkit.org/show_bug.cgi?id=53046 + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::sendSetSize): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::sizeDidChange): + (WebKit::LayerBackedDrawingAreaProxy::didSetSize): + +2011-01-24 Adam Roben <aroben@apple.com> + + Windows Production build fix + + * win/WebKit2.make: Update for move of WebKit2 into Source. + +2011-01-24 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + WebKit2: LayoutTests: The UNIMPLEMENTED warnings in TextCheckerWin should be disabled + https://bugs.webkit.org/show_bug.cgi?id=53029 + + * UIProcess/win/TextCheckerWin.cpp: + Disable the warnings for this file. + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Wait for half a second if we're asked to paint when receiving a DidSetSize message + https://bugs.webkit.org/show_bug.cgi?id=53028 + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::paint): + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement forceRedisplay in the new drawing area + https://bugs.webkit.org/show_bug.cgi?id=53026 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::forceRepaint): + * WebProcess/WebPage/DrawingAreaImpl.h: + +2011-01-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fill unpainted rects with the background color. + https://bugs.webkit.org/show_bug.cgi?id=53025 + + * UIProcess/API/mac/WKView.mm: + (drawPageBackground): + Add new helper function. + + (-[WKView drawRect:]): + Iterate over the unpainted rects and fill them with the background color. + +2011-01-24 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + WebKit2 version of <rdar://problem/6097826> Mail's cursor does not become a resize cursor when moving mouse from scrolled email to the horizontal splitter + + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setCursor): If the current cursor comes from a cursor rect, do not override it. + +2011-01-24 Balazs Kelemen <kbalazs@webkit.org> + + Rubber-stamped by Csaba Osztrogonác. + + Typo fix. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncher::launchProcess): Move the bracket to the right place. + +2011-01-24 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove CleanupHandler by passing file descriptors. + + Deleting files in signal handler of UI process is not a good idea, + because the memory where filenames are stored might not be valid + after a crash. + + To avoid the need of using signal handlers for cleanup, + change following: + 1) Avoid passing filenames between processes, pass fds + 2) When mmap'ing files, delete them immediately after + opening and mmap'ing them. + 3) Pass sockets with fds during fork+exec instead of + passing them via the filesystem. + 4) Use mmap'ed files for implementation of SharedMemory. + QSharedMemory does not support cleanup correctly. + + Consquences: + - Move MappedMemory to SharedMemory, make UpdateChunk use this. + - Implement CoreIPC::Attachment using mmaped files. + - Send messages using datagram socket. This solution works + similiarly to Mach ports on Mac. + - Send big messages out-of-line and thus avoid increasing + the receive buffer. + - Remove MemoryMappedPool and rely on libc/kernel caching + of mmapped areas. + - Unmap memory areas after use. + - When UI process crashes, kill the web process using SIGKILL. + This is possible again because cleanup handler is not needed. + + [WK2][Qt] Multiple problems with MemoryMappedPool + https://bugs.webkit.org/show_bug.cgi?id=51984 + + * Platform/CoreIPC/Attachment.cpp: + (CoreIPC::Attachment::Attachment): + * Platform/CoreIPC/Attachment.h: + (CoreIPC::Attachment::size): + (CoreIPC::Attachment::releaseFileDescriptor): + (CoreIPC::Attachment::fileDescriptor): + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::MessageInfo::MessageInfo): + (CoreIPC::MessageInfo::setMessageBodyOOL): + (CoreIPC::MessageInfo::isMessageBodyOOL): + (CoreIPC::MessageInfo::bodySize): + (CoreIPC::MessageInfo::messageID): + (CoreIPC::MessageInfo::attachmentCount): + (CoreIPC::Connection::platformInitialize): + (CoreIPC::Connection::platformInvalidate): + (CoreIPC::SocketNotifierDisableGuard::SocketNotifierDisableGuard): + (CoreIPC::SocketNotifierDisableGuard::~SocketNotifierDisableGuard): + (CoreIPC::Connection::readyReadHandler): + (CoreIPC::Connection::open): + (CoreIPC::Connection::platformCanSendOutgoingMessages): + (CoreIPC::Connection::sendOutgoingMessage): + * Platform/SharedMemory.h: + * Platform/WorkQueue.h: + * Platform/qt/MappedMemoryPool.cpp: Removed. + * Platform/qt/MappedMemoryPool.h: Removed. + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::Handle::Handle): + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::isNull): + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + (WebKit::SharedMemory::Handle::releaseToAttachment): + (WebKit::SharedMemory::Handle::adoptFromAttachment): + (WebKit::SharedMemory::create): + (WebKit::accessModeMMap): + (WebKit::SharedMemory::~SharedMemory): + (WebKit::accessModeFile): + (WebKit::SharedMemory::createHandle): + * Platform/qt/WorkQueueQt.cpp: + (WorkQueue::registerSocketEventHandler): + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::~UpdateChunk): + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + (WebKit::UpdateChunk::createImage): + * Shared/qt/UpdateChunk.h: + * UIProcess/Launcher/ProcessLauncher.h: + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::QtWebProcess::QtWebProcess): + (WebKit::QtWebProcess::setupChildProcess): + (WebKit::ProcessLauncher::launchProcess): + (WebKit::ProcessLauncher::platformInvalidate): + * UIProcess/Launcher/qt/ThreadLauncherQt.cpp: + (WebKit::webThreadBody): + (WebKit::ThreadLauncher::createWebThread): + * WebKit2.pro: + * WebProcess/qt/WebProcessMainQt.cpp: + (WebKit::WebProcessMainQt): + +2011-01-24 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] Move project files into Source + https://bugs.webkit.org/show_bug.cgi?id=52891 + + * DerivedSources.pro: + * WebKit2.pro: + * WebProcess.pro: + +2011-01-23 Damian Kaleta <dkaleta@apple.com> + + Reviewed by Kevin Decker. + + <rdar://problem/8905171> + https://bugs.webkit.org/show_bug.cgi?id=52985 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::scaleWebView): Eliminated early return inside WebPageProxy::scaleWebView, making it + consistent with WebKit1. + +2011-01-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=52968 + Use a separate NSView for printing + + Also addresses <rdar://problem/8900148> Improper check for + -[NSGraphicsContext currentContextDrawingToScreen] + + * UIProcess/API/mac/WKPrintingView.h: Added. + * UIProcess/API/mac/WKPrintingView.mm: Added. + (-[WKPrintingView initWithFrameProxy:]): + (-[WKPrintingView isFlipped]): + (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): + (-[WKPrintingView knowsPageRange:]): + (-[WKPrintingView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + (-[WKPrintingView drawPageBorderWithSize:]): + (-[WKPrintingView _provideTotalScaleFactorForPrintOperation:]): + (-[WKPrintingView rectForPage:]): + * UIProcess/API/mac/WKView.mm: + (-[WKView drawRect:]): + (-[WKView canChangeFrameLayout:]): + (-[WKView printOperationWithPrintInfo:forFrame:]): + * WebKit2.xcodeproj/project.pbxproj: + Moved printing code to a separate view, simplifying as appropriate. The view is currently not + referenced by anything in WebKit2 directly, being owned by NSPrintOperation. + +2011-01-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Transparent windows with compositing WebKit2 content show garbage + https://bugs.webkit.org/show_bug.cgi?id=52966 + <rdar://problem/8765051> + + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + (WebKit::LayerBackedDrawingAreaProxy::paint): + If the WKView should draw transparent background, do so. + +2011-01-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an asynchronous WKPageForceRepaint + https://bugs.webkit.org/show_bug.cgi?id=52964 + <rdar://problem/8898527> + + * UIProcess/API/C/WKPage.cpp: + (WKPageForceRepaint): + Call WebPageProxy::forceRepaint. + + * UIProcess/API/C/WKPage.h: + Add WKPageForceRepaint. + + * UIProcess/GenericCallback.h: + Add a "generic" VoidCallback class. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::forceRepaint): + Insert the callback in the m_voidCallbacks map and send a forceRepaint message. + + (WebKit::WebPageProxy::voidCallback): + Call the right void callback. + + (WebKit::WebPageProxy::processDidCrash): + Invalidate m_voidCallbacks. + + * UIProcess/WebPageProxy.messages.in: + Add a VoidCallback message. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::forceRepaint): + Force a repaint. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + Add forceRepaint. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::forceRepaint): + Call forceRepaint on the drawing area. + + * WebProcess/WebPage/WebPage.messages.in: + Add a ForceRepaint message. + +2011-01-21 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Introduce FontMetrics abstraction + https://bugs.webkit.org/show_bug.cgi?id=51456 + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Use FontMetrics instead of Font to access the metrics. + (WebKit::WebPopupMenu::setUpPlatformData): + +2011-01-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=52950 + Leak in WebPage::drawRectToPDF + + * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawRectToPDF): Use RetainPtr here, too. + +2011-01-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=52951 + WebKit2 generates a bad PDF for cross process messaging + + * UIProcess/API/mac/WKView.mm: + (-[WKView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + Use a correct offset when flipping. + +2011-01-21 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=52943 + Objective-C files should use #import, not #include + + * UIProcess/API/C/WebKit2.h: This is an interesting one, because it's cross-platform, and + there is more than one WKView.h. + + * Platform/mac/ModuleMac.mm: + * Platform/mac/RunLoopMac.mm: + * PluginProcess/mac/PluginControllerProxyMac.mm: + * PluginProcess/mac/PluginProcessMac.mm: + * PluginProcess/mac/PluginProcessMainMac.mm: + * Shared/API/c/mac/WKCertificateInfoMac.mm: + * Shared/API/c/mac/WKURLRequestNS.mm: + * Shared/API/c/mac/WKURLResponseNS.mm: + * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: + * Shared/mac/PlatformCertificateInfo.mm: + * Shared/mac/SandboxExtensionMac.mm: + * Shared/mac/WebCoreArgumentCodersMac.mm: + * Shared/mac/WebMemorySampler.mac.mm: + * Shared/mac/WebURLRequestMac.mm: + * Shared/mac/WebURLResponseMac.mm: + * UIProcess/API/mac/FindIndicatorWindow.mm: + * UIProcess/API/mac/WKTextInputWindowController.mm: + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + * UIProcess/Launcher/mac/ThreadLauncherMac.mm: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: + * UIProcess/mac/BackingStoreMac.mm: + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + * UIProcess/mac/TextCheckerMac.mm: + * UIProcess/mac/WebContextMac.mm: + * UIProcess/mac/WebContextMenuProxyMac.mm: + * UIProcess/mac/WebPageProxyMac.mm: + * UIProcess/mac/WebPopupMenuProxyMac.mm: + * UIProcess/mac/WebPreferencesMac.mm: + * WebProcess/Downloads/mac/DownloadMac.mm: + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: + * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: + * WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: + * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm: + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + * WebProcess/WebPage/mac/WebPageMac.mm: + * WebProcess/mac/WebProcessMac.mm: + +2011-01-21 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Fix the WebKit2 build with clang. + + * Scripts/webkit2/messages.py: Add some more structs to the list. + * UIProcess/DrawingAreaProxy.h: Forward-declare UpdateInfo as a class. + * UIProcess/TextChecker.h: Forward-declare TextCheckerState as a struct. + * UIProcess/WebPageProxy.h: Forward-declare ContextMenuState as a struct. + * UIProcess/mac/TextCheckerMac.mm: Fix the type of the string constants so that they can be passed to + functions expecting NSString* without generating warnings. + * WebProcess/WebPage/DrawingArea.h: Forward-declare WebPageCreationParameters as a struct. + * WebProcess/WebPage/DrawingAreaImpl.h: Forward-declare UpdateInfo as a class. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getResourceDataFromFrame): Add parens around the assignment in the condition of + the if statement to suppress a warning. + 2011-01-21 Brian Weinstein <bweinstein@apple.com> Reviewed by Adam Roben. diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 46d5de4..3971037 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -38,10 +38,10 @@ ENABLE_ACCELERATED_2D_CANVAS_macosx = $(ENABLE_ACCELERATED_2D_CANVAS_macosx_$(TA ENABLE_ACCELERATED_2D_CANVAS_macosx_1060 = ; ENABLE_ACCELERATED_2D_CANVAS_macosx_1070 = ; -ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME)); -ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS; -ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS; +ENABLE_WEBGL = $(ENABLE_WEBGL_$(REAL_PLATFORM_NAME)); +ENABLE_WEBGL_macosx = $(ENABLE_WEBGL_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_WEBGL_macosx_1060 = ENABLE_WEBGL; +ENABLE_WEBGL_macosx_1070 = ENABLE_WEBGL; ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; @@ -91,6 +91,8 @@ ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; +ENABLE_REGISTER_PROTOCOL_HANDLER = ; + ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; @@ -106,6 +108,8 @@ ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; +ENABLE_MEDIA_STATISTICS = ; + ENABLE_WEB_AUDIO = ; ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); @@ -121,4 +125,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_WEBGL) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index d9d6bbc..527486d 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 16; +MINOR_VERSION = 20; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/DerivedSources.pro b/Source/WebKit2/DerivedSources.pro index 4164203..d7d4a7b 100644 --- a/Source/WebKit2/DerivedSources.pro +++ b/Source/WebKit2/DerivedSources.pro @@ -41,7 +41,7 @@ SBOX_CHECK = $$(_SBOX_DIR) PYTHON = python } -SRC_ROOT_DIR = $$replace(PWD, /Source/WebKit2, /) +SRC_ROOT_DIR = $$replace(PWD, /Source/WebKit2, "") defineTest(addExtraCompiler) { eval($${1}.CONFIG = target_predeps no_link) @@ -111,19 +111,19 @@ SCRIPTS = \ $$PWD/Scripts/webkit2/__init__.py \ $$PWD/Scripts/webkit2/messages.py -message_header_generator.commands = $${PYTHON} $${SRC_ROOT_DIR}Source/WebKit2/Scripts/generate-messages-header.py ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +message_header_generator.commands = $${PYTHON} $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-messages-header.py ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} message_header_generator.input = MESSAGE_RECEIVERS message_header_generator.depends = $$SCRIPTS message_header_generator.output_function = message_header_generator_output addExtraCompiler(message_header_generator) -message_receiver_generator.commands = $${PYTHON} $${SRC_ROOT_DIR}Source/WebKit2/Scripts/generate-message-receiver.py ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +message_receiver_generator.commands = $${PYTHON} $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-message-receiver.py ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} message_receiver_generator.input = MESSAGE_RECEIVERS message_receiver_generator.depends = $$SCRIPTS message_receiver_generator.output_function = message_receiver_generator_output addExtraCompiler(message_receiver_generator) -fwheader_generator.commands = perl $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/Source/WebKit2 ../../include qt +fwheader_generator.commands = perl $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/Source/WebKit2 ../include qt fwheader_generator.depends = $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl generated_files.depends += fwheader_generator QMAKE_EXTRA_TARGETS += fwheader_generator diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index be64c8e..7874c64 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -4,6 +4,8 @@ noinst_LTLIBRARIES += \ libWebKit2_ladir = $(prefix)/include/webkit2-@WEBKITGTK_API_VERSION@/WebKit2 libWebKit2_la_HEADERS = \ + $(WebKit2)/Shared/API/c/gtk/WKBaseGtk.h \ + $(WebKit2)/Shared/API/c/gtk/WKGraphicsContextGtk.h \ $(WebKit2)/Shared/API/c/WKArray.h \ $(WebKit2)/Shared/API/c/WKBase.h \ $(WebKit2)/Shared/API/c/WKCertificateInfo.h \ @@ -15,6 +17,7 @@ libWebKit2_la_HEADERS = \ $(WebKit2)/Shared/API/c/WKEvent.h \ $(WebKit2)/Shared/API/c/WKFindOptions.h \ $(WebKit2)/Shared/API/c/WKGeometry.h \ + $(WebKit2)/Shared/API/c/WKGraphicsContext.h \ $(WebKit2)/Shared/API/c/WKImage.h \ $(WebKit2)/Shared/API/c/WKMutableArray.h \ $(WebKit2)/Shared/API/c/WKMutableDictionary.h \ @@ -31,7 +34,8 @@ libWebKit2_la_HEADERS = \ $(WebKit2)/Shared/API/c/WKURLRequest.h \ $(WebKit2)/Shared/API/c/WKURLResponse.h \ $(WebKit2)/Shared/API/c/WKUserContentURLPattern.h \ - $(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h \ + $(WebKit2)/UIProcess/API/C/gtk/WKAPICastGtk.h \ + $(WebKit2)/UIProcess/API/C/gtk/WKView.h \ $(WebKit2)/UIProcess/API/C/WebKit2.h \ $(WebKit2)/UIProcess/API/C/WKAPICast.h \ $(WebKit2)/UIProcess/API/C/WKAuthenticationChallenge.h \ @@ -58,7 +62,8 @@ libWebKit2_la_HEADERS = \ $(WebKit2)/UIProcess/API/C/WKPreferences.h \ $(WebKit2)/UIProcess/API/C/WKPreferencesPrivate.h \ $(WebKit2)/UIProcess/API/C/WKProtectionSpace.h \ - $(WebKit2)/UIProcess/API/C/WKProtectionSpaceTypes.h + $(WebKit2)/UIProcess/API/C/WKProtectionSpaceTypes.h \ + $(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h nodist_libWebKit2_la_SOURCES = \ $(webkit2_built_sources) @@ -84,6 +89,7 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/Platform/CoreIPC/HandleMessage.h \ Source/WebKit2/Platform/CoreIPC/MessageID.h \ Source/WebKit2/Platform/CoreIPC/MessageSender.h \ + Source/WebKit2/Platform/gtk/ModuleGtk.cpp \ Source/WebKit2/Platform/gtk/RunLoopGtk.cpp \ Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp \ Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \ @@ -106,6 +112,9 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/PluginProcess/WebProcessConnection.cpp \ Source/WebKit2/PluginProcess/WebProcessConnection.h \ Source/WebKit2/Shared/APIClient.h \ + Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h \ + Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h \ + Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp \ Source/WebKit2/Shared/API/c/WKArray.cpp \ Source/WebKit2/Shared/API/c/WKArray.h \ Source/WebKit2/Shared/API/c/WKBase.h \ @@ -123,6 +132,8 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/Shared/API/c/WKEvent.h \ Source/WebKit2/Shared/API/c/WKFindOptions.h \ Source/WebKit2/Shared/API/c/WKGeometry.h \ + Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp \ + Source/WebKit2/Shared/API/c/WKGraphicsContext.h \ Source/WebKit2/Shared/API/c/WKImage.cpp \ Source/WebKit2/Shared/API/c/WKImage.h \ Source/WebKit2/Shared/API/c/WKMutableArray.cpp \ @@ -168,6 +179,8 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/Shared/FontSmoothingLevel.h \ Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp \ Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \ + Source/WebKit2/Shared/gtk/UpdateChunk.cpp \ + Source/WebKit2/Shared/gtk/UpdateChunk.h \ Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp \ Source/WebKit2/Shared/ImageOptions.h \ Source/WebKit2/Shared/ImmutableArray.cpp \ @@ -228,6 +241,10 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/Shared/WebEvent.cpp \ Source/WebKit2/Shared/WebEvent.h \ Source/WebKit2/Shared/WebFindOptions.h \ + Source/WebKit2/Shared/WebGeolocationPosition.cpp \ + Source/WebKit2/Shared/WebGeolocationPosition.h \ + Source/WebKit2/Shared/WebGraphicsContext.cpp \ + Source/WebKit2/Shared/WebGraphicsContext.h \ Source/WebKit2/Shared/WebImage.cpp \ Source/WebKit2/Shared/WebImage.h \ Source/WebKit2/Shared/WebKeyboardEvent.cpp \ @@ -258,7 +275,9 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/Shared/WebURLResponse.h \ Source/WebKit2/Shared/WebUserContentURLPattern.h \ Source/WebKit2/Shared/WebWheelEvent.cpp \ - Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \ + Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h \ + Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp \ + Source/WebKit2/UIProcess/API/C/gtk/WKView.h \ Source/WebKit2/UIProcess/API/C/WebKit2.h \ Source/WebKit2/UIProcess/API/C/WKAPICast.h \ Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp \ @@ -305,6 +324,7 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp \ Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h \ Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h \ + Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \ Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp \ Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h \ Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp \ @@ -322,6 +342,11 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/UIProcess/FindIndicator.cpp \ Source/WebKit2/UIProcess/FindIndicator.h \ Source/WebKit2/UIProcess/GenericCallback.h \ + Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp \ + Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h \ + Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp \ + Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h \ + Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp \ Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp \ Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp \ Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp \ @@ -380,6 +405,10 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h \ Source/WebKit2/UIProcess/WebFrameProxy.cpp \ Source/WebKit2/UIProcess/WebFrameProxy.h \ + Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp \ + Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h \ + Source/WebKit2/UIProcess/WebGeolocationProvider.cpp \ + Source/WebKit2/UIProcess/WebGeolocationProvider.h \ Source/WebKit2/UIProcess/WebHistoryClient.cpp \ Source/WebKit2/UIProcess/WebHistoryClient.h \ Source/WebKit2/UIProcess/WebInspectorProxy.cpp \ @@ -416,6 +445,10 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/Downloads/Download.h \ Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp \ Source/WebKit2/WebProcess/Downloads/DownloadManager.h \ + Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \ + Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h \ + Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp \ + Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h \ Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp \ Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp \ Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h \ @@ -432,6 +465,8 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ @@ -470,6 +505,8 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp \ @@ -504,7 +541,6 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/Plugins/PluginView.cpp \ Source/WebKit2/WebProcess/Plugins/PluginView.h \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp \ - Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h \ Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp \ @@ -520,6 +556,8 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h \ Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h \ Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h \ Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp \ @@ -530,7 +568,6 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h \ Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp \ Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h \ - Source/WebKit2/WebProcess/WebKitMain.cpp \ Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \ Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h \ Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp \ @@ -541,6 +578,7 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h \ Source/WebKit2/WebProcess/WebPage/FindController.cpp \ Source/WebKit2/WebProcess/WebPage/FindController.h \ + Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp \ Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp \ Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp \ Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h \ @@ -565,8 +603,7 @@ libWebKit2_la_SOURCES = \ Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h \ Source/WebKit2/WebProcess/WebPage/WebPage.h \ Source/WebKit2/WebProcess/WebProcess.cpp \ - Source/WebKit2/WebProcess/WebProcess.h \ - Source/WebKit2/WebProcess/WebProcessMain.h + Source/WebKit2/WebProcess/WebProcess.h libWebKit2_la_CPPFLAGS = \ -fno-strict-aliasing \ @@ -603,6 +640,7 @@ libWebKit2_la_CPPFLAGS = \ -I$(srcdir)/Source/WebKit2/WebProcess \ -I$(srcdir)/Source/WebKit2/WebProcess/Authentication \ -I$(srcdir)/Source/WebKit2/WebProcess/Downloads \ + -I$(srcdir)/Source/WebKit2/WebProcess/Geolocation \ -I$(srcdir)/Source/WebKit2/WebProcess/gtk \ -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle \ -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API \ @@ -755,6 +793,10 @@ webkit2_built_sources += \ DerivedSources/WebKit2/WebDatabaseManagerMessages.h \ DerivedSources/WebKit2/WebDatabaseManagerProxyMessageReceiver.cpp \ DerivedSources/WebKit2/WebDatabaseManagerProxyMessages.h \ + DerivedSources/WebKit2/WebGeolocationManagerMessageReceiver.cpp \ + DerivedSources/WebKit2/WebGeolocationManagerMessages.h \ + DerivedSources/WebKit2/WebGeolocationManagerProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/WebGeolocationManagerProxyMessages.h \ DerivedSources/WebKit2/WebInspectorMessageReceiver.cpp \ DerivedSources/WebKit2/WebInspectorMessages.h \ DerivedSources/WebKit2/WebInspectorProxyMessageReceiver.cpp \ @@ -776,9 +818,6 @@ BUILT_SOURCES += \ forwarding_headers := $(GENSOURCES_WEBKIT2)/include generate-webkit2-forwarding-headers: $(WebKit2)/Scripts/generate-forwarding-headers.pl $(libWebKit2_la_SOURCES) - $(AM_V_at)$(mkdir_p) $(forwarding_headers)/JavaScriptCore - $(AM_V_at)$(mkdir_p) $(forwarding_headers)/WebCore - $(AM_V_at)$(mkdir_p) $(forwarding_headers)/WebKit2 $(AM_V_GEN)$(PERL) $< $(WebKit2) $(forwarding_headers) gtk $(AM_V_GEN)$(PERL) $< $(WebKit2) $(forwarding_headers) soup @@ -787,9 +826,11 @@ vpath %.messages.in = \ $(WebKit2)/Shared/Plugins \ $(WebKit2)/UIProcess \ $(WebKit2)/UIProcess/Downloads \ + $(WebKit2)/UIProcess/Geolocation \ $(WebKit2)/UIProcess/Plugins \ $(WebKit2)/WebProcess \ $(WebKit2)/WebProcess/Authentication \ + $(WebKit2)/WebProcess/Geolocation \ $(WebKit2)/WebProcess/Plugins \ $(WebKit2)/WebProcess/WebCoreSupport \ $(WebKit2)/WebProcess/WebPage diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp index 336f72f..4664806 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp @@ -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 @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ArgumentDecoder.h" #include "DataReference.h" @@ -46,7 +47,13 @@ ArgumentDecoder::~ArgumentDecoder() { ASSERT(m_buffer); fastFree(m_buffer); +#if !PLATFORM(QT) // FIXME: We need to dispose of the mach ports in cases of failure. +#else + Deque<Attachment>::iterator end = m_attachments.end(); + for (Deque<Attachment>::iterator it = m_attachments.begin(); it != end; ++it) + it->dispose(); +#endif } void ArgumentDecoder::initialize(const uint8_t* buffer, size_t bufferSize) @@ -62,13 +69,15 @@ void ArgumentDecoder::initialize(const uint8_t* buffer, size_t bufferSize) static inline uint8_t* roundUpToAlignment(uint8_t* ptr, unsigned alignment) { - return (uint8_t*)(((uintptr_t)ptr + alignment - 1) & ~(uintptr_t)(alignment - 1)); + ASSERT(alignment); + uintptr_t alignmentMask = alignment - 1; + return reinterpret_cast<uint8_t*>((reinterpret_cast<uintptr_t>(ptr) + alignmentMask) & ~alignmentMask); } bool ArgumentDecoder::alignBufferPosition(unsigned alignment, size_t size) { uint8_t* buffer = roundUpToAlignment(m_bufferPos, alignment); - if (buffer + size > m_bufferEnd) { + if (static_cast<size_t>(m_bufferEnd - buffer) < size) { // We've walked off the end of this buffer. markInvalid(); return false; @@ -80,7 +89,7 @@ bool ArgumentDecoder::alignBufferPosition(unsigned alignment, size_t size) bool ArgumentDecoder::bufferIsLargeEnoughToContain(unsigned alignment, size_t size) const { - return roundUpToAlignment(m_bufferPos, alignment) + size <= m_bufferEnd; + return static_cast<size_t>(m_bufferEnd - roundUpToAlignment(m_bufferPos, alignment)) >= size; } bool ArgumentDecoder::decodeBytes(Vector<uint8_t>& buffer) diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp index 1340c0a..aa71b0f 100644 --- a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ArgumentEncoder.h" #include <algorithm> @@ -49,7 +50,12 @@ ArgumentEncoder::~ArgumentEncoder() { if (m_buffer) fastFree(m_buffer); +#if !PLATFORM(QT) // FIXME: We need to dispose of the attachments in cases of failure. +#else + for (int i = 0; i < m_attachments.size(); ++i) + m_attachments[i].dispose(); +#endif } static inline size_t roundUpToAlignment(size_t value, unsigned alignment) diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp index c8d35f4..646b64c 100644 --- a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Attachment.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.h b/Source/WebKit2/Platform/CoreIPC/Attachment.h index 55a09c9..c057714 100644 --- a/Source/WebKit2/Platform/CoreIPC/Attachment.h +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.h @@ -40,12 +40,16 @@ public: #if PLATFORM(MAC) MachPortType, MachOOLMemoryType +#elif PLATFORM(QT) + MappedMemory #endif }; #if PLATFORM(MAC) Attachment(mach_port_name_t port, mach_msg_type_name_t disposition); Attachment(void* address, mach_msg_size_t size, mach_msg_copy_options_t copyOptions, bool deallocate); +#elif PLATFORM(QT) + Attachment(int fileDescriptor, size_t); #endif Type type() const { return m_type; } @@ -62,6 +66,13 @@ public: mach_msg_size_t size() const { ASSERT(m_type == MachOOLMemoryType); return m_oolMemory.size; } mach_msg_copy_options_t copyOptions() const { ASSERT(m_type == MachOOLMemoryType); return m_oolMemory.copyOptions; } bool deallocate() const { ASSERT(m_type == MachOOLMemoryType); return m_oolMemory.deallocate; } +#elif PLATFORM(QT) + size_t size() const { return m_size; } + + int releaseFileDescriptor() { int temp = m_fileDescriptor; m_fileDescriptor = -1; return temp; } + int fileDescriptor() const { return m_fileDescriptor; } + + void dispose(); #endif void encode(ArgumentEncoder*) const; @@ -83,6 +94,9 @@ private: bool deallocate; } m_oolMemory; }; +#elif PLATFORM(QT) + int m_fileDescriptor; + size_t m_size; #endif }; diff --git a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp index c975dff..d4d9e7d 100644 --- a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp +++ b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp @@ -23,10 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "BinarySemaphore.h" namespace CoreIPC { +#if !PLATFORM(WIN) + BinarySemaphore::BinarySemaphore() : m_isSet(false) { @@ -60,5 +63,6 @@ bool BinarySemaphore::wait(double absoluteTime) return true; } +#endif // !PLATFORM(WIN) } // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h index 8113236..32b5b02 100644 --- a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h +++ b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h @@ -42,10 +42,14 @@ public: bool wait(double absoluteTime); private: +#if PLATFORM(WIN) + HANDLE m_event; +#else bool m_isSet; Mutex m_mutex; ThreadCondition m_condition; +#endif }; } // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index da92ce4..5cbd4bc 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -23,8 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Connection.h" +#include "BinarySemaphore.h" #include "CoreIPCMessageKinds.h" #include "RunLoop.h" #include "WorkItem.h" @@ -34,6 +36,156 @@ using namespace std; namespace CoreIPC { +class Connection::SyncMessageState : public RefCounted<Connection::SyncMessageState> { +public: + static PassRefPtr<SyncMessageState> getOrCreate(RunLoop*); + ~SyncMessageState(); + + void beginWaitForSyncReply(); + void endWaitForSyncReply(); + + void wakeUpClientRunLoop() + { + m_waitForSyncReplySemaphore.signal(); + } + + bool wait(double absoluteTime) + { + return m_waitForSyncReplySemaphore.wait(absoluteTime); + } + + // Returns true if this message will be handled on a client thread that is currently + // waiting for a reply to a synchronous message. + bool processIncomingMessage(Connection*, IncomingMessage&); + + void dispatchMessages(); + +private: + explicit SyncMessageState(RunLoop*); + + typedef HashMap<RunLoop*, SyncMessageState*> SyncMessageStateMap; + static SyncMessageStateMap& syncMessageStateMap() + { + DEFINE_STATIC_LOCAL(SyncMessageStateMap, syncMessageStateMap, ()); + return syncMessageStateMap; + } + + static Mutex& syncMessageStateMapMutex() + { + DEFINE_STATIC_LOCAL(Mutex, syncMessageStateMapMutex, ()); + return syncMessageStateMapMutex; + } + + RunLoop* m_runLoop; + BinarySemaphore m_waitForSyncReplySemaphore; + + // Protects m_waitForSyncReplyCount and m_messagesToDispatchWhileWaitingForSyncReply. + Mutex m_mutex; + + unsigned m_waitForSyncReplyCount; + + struct ConnectionAndIncomingMessage { + Connection* connection; + IncomingMessage incomingMessage; + }; + Vector<ConnectionAndIncomingMessage> m_messagesToDispatchWhileWaitingForSyncReply; +}; + +PassRefPtr<Connection::SyncMessageState> Connection::SyncMessageState::getOrCreate(RunLoop* runLoop) +{ + MutexLocker locker(syncMessageStateMapMutex()); + pair<SyncMessageStateMap::iterator, bool> result = syncMessageStateMap().add(runLoop, 0); + + if (!result.second) { + ASSERT(result.first->second); + return result.first->second; + } + + RefPtr<SyncMessageState> syncMessageState = adoptRef(new SyncMessageState(runLoop)); + result.first->second = syncMessageState.get(); + + return syncMessageState.release(); +} + +Connection::SyncMessageState::SyncMessageState(RunLoop* runLoop) + : m_runLoop(runLoop) + , m_waitForSyncReplyCount(0) +{ +} + +Connection::SyncMessageState::~SyncMessageState() +{ + MutexLocker locker(syncMessageStateMapMutex()); + + ASSERT(syncMessageStateMap().contains(m_runLoop)); + syncMessageStateMap().remove(m_runLoop); +} + +void Connection::SyncMessageState::beginWaitForSyncReply() +{ + ASSERT(RunLoop::current() == m_runLoop); + + MutexLocker locker(m_mutex); + m_waitForSyncReplyCount++; +} + +void Connection::SyncMessageState::endWaitForSyncReply() +{ + ASSERT(RunLoop::current() == m_runLoop); + + MutexLocker locker(m_mutex); + ASSERT(m_waitForSyncReplyCount); + --m_waitForSyncReplyCount; + + if (m_waitForSyncReplyCount) + return; + + // Dispatch any remaining incoming sync messages. + for (size_t i = 0; i < m_messagesToDispatchWhileWaitingForSyncReply.size(); ++i) { + ConnectionAndIncomingMessage& connectionAndIncomingMessage = m_messagesToDispatchWhileWaitingForSyncReply[i]; + connectionAndIncomingMessage.connection->enqueueIncomingMessage(connectionAndIncomingMessage.incomingMessage); + } + + m_messagesToDispatchWhileWaitingForSyncReply.clear(); +} + +bool Connection::SyncMessageState::processIncomingMessage(Connection* connection, IncomingMessage& incomingMessage) +{ + MessageID messageID = incomingMessage.messageID(); + if (!messageID.isSync() && !messageID.shouldDispatchMessageWhenWaitingForSyncReply()) + return false; + + MutexLocker locker(m_mutex); + if (!m_waitForSyncReplyCount) + return false; + + ConnectionAndIncomingMessage connectionAndIncomingMessage; + connectionAndIncomingMessage.connection = connection; + connectionAndIncomingMessage.incomingMessage = incomingMessage; + + m_messagesToDispatchWhileWaitingForSyncReply.append(connectionAndIncomingMessage); + wakeUpClientRunLoop(); + + return true; +} + +void Connection::SyncMessageState::dispatchMessages() +{ + ASSERT(m_runLoop == RunLoop::current()); + + Vector<ConnectionAndIncomingMessage> messagesToDispatchWhileWaitingForSyncReply; + + { + MutexLocker locker(m_mutex); + m_messagesToDispatchWhileWaitingForSyncReply.swap(messagesToDispatchWhileWaitingForSyncReply); + } + + for (size_t i = 0; i < messagesToDispatchWhileWaitingForSyncReply.size(); ++i) { + ConnectionAndIncomingMessage& connectionAndIncomingMessage = messagesToDispatchWhileWaitingForSyncReply[i]; + connectionAndIncomingMessage.connection->dispatchMessage(connectionAndIncomingMessage.incomingMessage); + } +} + PassRefPtr<Connection> Connection::createServerConnection(Identifier identifier, Client* client, RunLoop* clientRunLoop) { return adoptRef(new Connection(identifier, true, client, clientRunLoop)); @@ -48,11 +200,13 @@ Connection::Connection(Identifier identifier, bool isServer, Client* client, Run : m_client(client) , m_isServer(isServer) , m_syncRequestID(0) + , m_didCloseOnConnectionWorkQueueCallback(0) , m_isConnected(false) , m_connectionQueue("com.apple.CoreIPC.ReceiveQueue") , m_clientRunLoop(clientRunLoop) , m_inDispatchMessageCount(0) , m_didReceiveInvalidMessage(false) + , m_syncMessageState(SyncMessageState::getOrCreate(clientRunLoop)) , m_shouldWaitForSyncReplies(true) { ASSERT(m_client); @@ -67,6 +221,13 @@ Connection::~Connection() m_connectionQueue.invalidate(); } +void Connection::setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback) +{ + ASSERT(!m_isConnected); + + m_didCloseOnConnectionWorkQueueCallback = callback; +} + void Connection::invalidate() { if (!isValid()) { @@ -99,11 +260,14 @@ PassOwnPtr<ArgumentEncoder> Connection::createSyncMessageArgumentEncoder(uint64_ return argumentEncoder.release(); } -bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments, unsigned messageSendFlags) { if (!isValid()) return false; + if (messageSendFlags & DispatchMessageEvenWhenWaitingForSyncReply) + messageID = messageID.messageIDWithAddedFlags(MessageID::DispatchMessageWhenWaitingForSyncReply); + MutexLocker locker(m_outgoingMessagesLock); m_outgoingMessages.append(OutgoingMessage(messageID, arguments)); @@ -179,21 +343,27 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin // We only allow sending sync messages from the client run loop. ASSERT(RunLoop::current() == m_clientRunLoop); - if (!isValid()) + if (!isValid()) { + m_client->didFailToSendSyncMessage(this); return 0; + } // Push the pending sync reply information on our stack. { MutexLocker locker(m_syncReplyStateMutex); - if (!m_shouldWaitForSyncReplies) + if (!m_shouldWaitForSyncReplies) { + m_client->didFailToSendSyncMessage(this); return 0; + } m_pendingSyncReplies.append(PendingSyncReply(syncRequestID)); } // First send the message. sendMessage(messageID, encoder); - + + m_syncMessageState->beginWaitForSyncReply(); + // Then wait for a reply. Waiting for a reply could involve dispatching incoming sync messages, so // keep an extra reference to the connection here in case it's invalidated. RefPtr<Connection> protect(this); @@ -204,22 +374,13 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin MutexLocker locker(m_syncReplyStateMutex); ASSERT(m_pendingSyncReplies.last().syncRequestID == syncRequestID); m_pendingSyncReplies.removeLast(); - - if (m_pendingSyncReplies.isEmpty()) { - // This was the bottom-most sendSyncMessage call in the stack. If we have any pending incoming - // sync messages, they need to be dispatched. - if (!m_syncMessagesReceivedWhileWaitingForSyncReply.isEmpty()) { - // Add the messages. - MutexLocker locker(m_incomingMessagesLock); - m_incomingMessages.append(m_syncMessagesReceivedWhileWaitingForSyncReply); - m_syncMessagesReceivedWhileWaitingForSyncReply.clear(); - - // Schedule for the messages to be sent. - m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchMessages)); - } - } } - + + m_syncMessageState->endWaitForSyncReply(); + + if (!reply) + m_client->didFailToSendSyncMessage(this); + return reply.release(); } @@ -229,27 +390,12 @@ PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, bool timedOut = false; while (!timedOut) { + // First, check if we have any messages that we need to process. + m_syncMessageState->dispatchMessages(); + { MutexLocker locker(m_syncReplyStateMutex); - // First, check if we have any incoming sync messages that we need to process. - Vector<IncomingMessage> syncMessagesReceivedWhileWaitingForSyncReply; - m_syncMessagesReceivedWhileWaitingForSyncReply.swap(syncMessagesReceivedWhileWaitingForSyncReply); - - if (!syncMessagesReceivedWhileWaitingForSyncReply.isEmpty()) { - // Make sure to unlock the mutex here because we're calling out to client code which could in turn send - // another sync message and we don't want that to deadlock. - m_syncReplyStateMutex.unlock(); - - for (size_t i = 0; i < syncMessagesReceivedWhileWaitingForSyncReply.size(); ++i) { - IncomingMessage& message = syncMessagesReceivedWhileWaitingForSyncReply[i]; - OwnPtr<ArgumentDecoder> arguments = message.releaseArguments(); - - dispatchSyncMessage(message.messageID(), arguments.get()); - } - m_syncReplyStateMutex.lock(); - } - // Second, check if there is a sync reply at the top of the stack. ASSERT(!m_pendingSyncReplies.isEmpty()); @@ -262,7 +408,7 @@ PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, } // We didn't find a sync reply yet, keep waiting. - timedOut = !m_waitForSyncReplySemaphore.wait(absoluteTime); + timedOut = !m_syncMessageState->wait(absoluteTime); } // We timed out. @@ -281,42 +427,33 @@ void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<Argument pendingSyncReply.replyDecoder = arguments.leakPtr(); pendingSyncReply.didReceiveReply = true; - - m_waitForSyncReplySemaphore.signal(); + m_syncMessageState->wakeUpClientRunLoop(); return; } - // Check if this is a sync message. If it is, and we're waiting for a sync reply this message - // needs to be dispatched. If we don't we'll end up with a deadlock where both sync message senders are - // stuck waiting for a reply. - if (messageID.isSync()) { - MutexLocker locker(m_syncReplyStateMutex); - if (!m_pendingSyncReplies.isEmpty()) { - m_syncMessagesReceivedWhileWaitingForSyncReply.append(IncomingMessage(messageID, arguments)); + IncomingMessage incomingMessage(messageID, arguments); + + // Check if this is a sync message or if it's a message that should be dispatched even when waiting for + // a sync reply. If it is, and we're waiting for a sync reply this message needs to be dispatched. + // If we don't we'll end up with a deadlock where both sync message senders are stuck waiting for a reply. + if (m_syncMessageState->processIncomingMessage(this, incomingMessage)) + return; - // The message has been added, now wake up the client thread. - m_waitForSyncReplySemaphore.signal(); - return; - } - } - // Check if we're waiting for this message. { MutexLocker locker(m_waitForMessageMutex); - HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(std::make_pair(messageID.toInt(), arguments->destinationID())); + HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(std::make_pair(messageID.toInt(), incomingMessage.destinationID())); if (it != m_waitForMessageMap.end()) { - it->second = arguments.leakPtr(); + it->second = incomingMessage.releaseArguments().leakPtr(); + ASSERT(it->second); m_waitForMessageCondition.signal(); return; } } - MutexLocker locker(m_incomingMessagesLock); - m_incomingMessages.append(IncomingMessage(messageID, arguments)); - - m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchMessages)); + enqueueIncomingMessage(incomingMessage); } void Connection::connectionDidClose() @@ -331,10 +468,11 @@ void Connection::connectionDidClose() m_shouldWaitForSyncReplies = false; if (!m_pendingSyncReplies.isEmpty()) - m_waitForSyncReplySemaphore.signal(); + m_syncMessageState->wakeUpClientRunLoop(); } - m_client->didCloseOnConnectionWorkQueue(&m_connectionQueue, this); + if (m_didCloseOnConnectionWorkQueueCallback) + m_didCloseOnConnectionWorkQueueCallback(m_connectionQueue, this); m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchConnectionDidClose)); } @@ -412,42 +550,53 @@ void Connection::dispatchSyncMessage(MessageID messageID, ArgumentDecoder* argum sendSyncReply(replyEncoder); } -void Connection::dispatchMessages() +void Connection::enqueueIncomingMessage(IncomingMessage& incomingMessage) { - Vector<IncomingMessage> incomingMessages; - - { - MutexLocker locker(m_incomingMessagesLock); - m_incomingMessages.swap(incomingMessages); - } + MutexLocker locker(m_incomingMessagesLock); + m_incomingMessages.append(incomingMessage); - // Dispatch messages. - for (size_t i = 0; i < incomingMessages.size(); ++i) { - // If someone calls invalidate while we're invalidating messages, we should stop. - if (!m_client) - return; - - IncomingMessage& message = incomingMessages[i]; - OwnPtr<ArgumentDecoder> arguments = message.releaseArguments(); + m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchMessages)); +} + +void Connection::dispatchMessage(IncomingMessage& message) +{ + OwnPtr<ArgumentDecoder> arguments = message.releaseArguments(); + + // If there's no client, return. We do this after calling releaseArguments so that + // the ArgumentDecoder message will be freed. + if (!m_client) + return; - m_inDispatchMessageCount++; + m_inDispatchMessageCount++; - bool oldDidReceiveInvalidMessage = m_didReceiveInvalidMessage; - m_didReceiveInvalidMessage = false; + bool oldDidReceiveInvalidMessage = m_didReceiveInvalidMessage; + m_didReceiveInvalidMessage = false; - if (message.messageID().isSync()) - dispatchSyncMessage(message.messageID(), arguments.get()); - else - m_client->didReceiveMessage(this, message.messageID(), arguments.get()); + if (message.messageID().isSync()) + dispatchSyncMessage(message.messageID(), arguments.get()); + else + m_client->didReceiveMessage(this, message.messageID(), arguments.get()); - m_didReceiveInvalidMessage |= arguments->isInvalid(); - m_inDispatchMessageCount--; + m_didReceiveInvalidMessage |= arguments->isInvalid(); + m_inDispatchMessageCount--; - if (m_didReceiveInvalidMessage) - m_client->didReceiveInvalidMessage(this, message.messageID()); + if (m_didReceiveInvalidMessage && m_client) + m_client->didReceiveInvalidMessage(this, message.messageID()); + + m_didReceiveInvalidMessage = oldDidReceiveInvalidMessage; +} - m_didReceiveInvalidMessage = oldDidReceiveInvalidMessage; +void Connection::dispatchMessages() +{ + Vector<IncomingMessage> incomingMessages; + + { + MutexLocker locker(m_incomingMessagesLock); + m_incomingMessages.swap(incomingMessages); } + + for (size_t i = 0; i < incomingMessages.size(); ++i) + dispatchMessage(incomingMessages[i]); } } // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h index 1b009cf..eaa2ab9 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.h +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -31,7 +31,6 @@ #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "Arguments.h" -#include "BinarySemaphore.h" #include "MessageID.h" #include "WorkQueue.h" #include <wtf/HashMap.h> @@ -44,9 +43,8 @@ #elif PLATFORM(WIN) #include <string> #elif PLATFORM(QT) -#include <QString> -class QLocalServer; -class QLocalSocket; +class QSocketNotifier; +#include "PlatformProcessIdentifier.h" #endif class RunLoop; @@ -60,6 +58,12 @@ enum SyncReplyMode { ManualReply }; +enum MessageSendFlags { + // Whether this message should be dispatched when waiting for a sync reply. + // This is the default for synchronous messages. + DispatchMessageEvenWhenWaitingForSyncReply = 1 << 0, +}; + #define MESSAGE_CHECK_BASE(assertion, connection) do \ if (!(assertion)) { \ ASSERT(assertion); \ @@ -86,10 +90,7 @@ public: public: virtual void didClose(Connection*) = 0; virtual void didReceiveInvalidMessage(Connection*, MessageID) = 0; - - // Called on the connection work queue when the connection is closed, before - // didCall is called on the client thread. - virtual void didCloseOnConnectionWorkQueue(WorkQueue*, Connection*) { } + virtual void didFailToSendSyncMessage(Connection*) { } }; #if PLATFORM(MAC) @@ -98,7 +99,7 @@ public: typedef HANDLE Identifier; static bool createServerAndClientIdentifiers(Identifier& serverIdentifier, Identifier& clientIdentifier); #elif PLATFORM(QT) - typedef const QString Identifier; + typedef int Identifier; #elif PLATFORM(GTK) typedef int Identifier; #endif @@ -109,27 +110,37 @@ public: #if PLATFORM(MAC) void setShouldCloseConnectionOnMachExceptions(); +#elif PLATFORM(QT) + void setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier); #endif + // The set callback will be called on the connection work queue when the connection is closed, + // before didCall is called on the client thread. Must be called before the connection is opened. + // In the future we might want a more generic way to handle sync or async messages directly + // on the work queue, for example if we want to handle them on some other thread we could avoid + // handling the message on the client thread first. + typedef void (*DidCloseOnConnectionWorkQueueCallback)(WorkQueue&, Connection*); + void setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback); + bool open(); void invalidate(); void markCurrentlyDispatchedMessageAsInvalid(); static const unsigned long long NoTimeout = 10000000000ULL; - template<typename T> bool send(const T& message, uint64_t destinationID); + template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0); template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout); template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, double timeout); PassOwnPtr<ArgumentEncoder> createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID); - bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>); + bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>, unsigned messageSendFlags = 0); bool sendSyncReply(PassOwnPtr<ArgumentEncoder>); - // FIXME: These variants of senc, sendSync and waitFor are all deprecated. + // FIXME: These variants of send, sendSync and waitFor are all deprecated. // All clients should move to the overloads that take a message type. - template<typename E, typename T> bool send(E messageID, uint64_t destinationID, const T& arguments); - template<typename E, typename T, typename U> bool sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout); - template<typename E> PassOwnPtr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout); + template<typename E, typename T> bool deprecatedSend(E messageID, uint64_t destinationID, const T& arguments); + template<typename E, typename T, typename U> bool deprecatedSendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout = NoTimeout); + template<typename E> PassOwnPtr<ArgumentDecoder> deprecatedWaitFor(E messageID, uint64_t destinationID, double timeout); private: template<typename T> class Message { @@ -146,6 +157,8 @@ private: } MessageID messageID() const { return m_messageID; } + uint64_t destinationID() const { return m_arguments->destinationID(); } + T* arguments() const { return m_arguments; } PassOwnPtr<T> releaseArguments() @@ -184,15 +197,23 @@ private: bool sendOutgoingMessage(MessageID, PassOwnPtr<ArgumentEncoder>); void connectionDidClose(); + typedef Message<ArgumentDecoder> IncomingMessage; + // Called on the listener thread. void dispatchConnectionDidClose(); + void dispatchMessage(IncomingMessage&); void dispatchMessages(); void dispatchSyncMessage(MessageID, ArgumentDecoder*); - + + // Can be called on any thread. + void enqueueIncomingMessage(IncomingMessage&); + Client* m_client; bool m_isServer; uint64_t m_syncRequestID; + DidCloseOnConnectionWorkQueueCallback m_didCloseOnConnectionWorkQueueCallback; + bool m_isConnected; WorkQueue m_connectionQueue; RunLoop* m_clientRunLoop; @@ -201,8 +222,6 @@ private: bool m_didReceiveInvalidMessage; // Incoming messages. - typedef Message<ArgumentDecoder> IncomingMessage; - Mutex m_incomingMessagesLock; Vector<IncomingMessage> m_incomingMessages; @@ -249,12 +268,13 @@ private: } }; - BinarySemaphore m_waitForSyncReplySemaphore; + class SyncMessageState; + friend class SyncMessageState; + RefPtr<SyncMessageState> m_syncMessageState; Mutex m_syncReplyStateMutex; bool m_shouldWaitForSyncReplies; Vector<PendingSyncReply> m_pendingSyncReplies; - Vector<IncomingMessage> m_syncMessagesReceivedWhileWaitingForSyncReply; #if PLATFORM(MAC) // Called on the connection queue. @@ -285,8 +305,8 @@ private: Vector<uint8_t> m_readBuffer; size_t m_currentMessageSize; - QLocalSocket* m_socket; - QString m_serverName; + QSocketNotifier* m_socketNotifier; + int m_socketDescriptor; #elif PLATFORM(GTK) void readEventHandler(); void processCompletedMessage(); @@ -299,12 +319,12 @@ private: #endif }; -template<typename T> bool Connection::send(const T& message, uint64_t destinationID) +template<typename T> bool Connection::send(const T& message, uint64_t destinationID, unsigned messageSendFlags) { OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); argumentEncoder->encode(message); - return sendMessage(MessageID(T::messageID), argumentEncoder.release()); + return sendMessage(MessageID(T::messageID), argumentEncoder.release(), messageSendFlags); } template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout) @@ -338,7 +358,7 @@ template<typename T> bool Connection::waitForAndDispatchImmediately(uint64_t des // These three member functions are all deprecated. template<typename E, typename T, typename U> -inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) +inline bool Connection::deprecatedSendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) { uint64_t syncRequestID = 0; OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID); @@ -356,7 +376,7 @@ inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& a } template<typename E, typename T> -bool Connection::send(E messageID, uint64_t destinationID, const T& arguments) +bool Connection::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) { OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); argumentEncoder->encode(arguments); @@ -364,7 +384,7 @@ bool Connection::send(E messageID, uint64_t destinationID, const T& arguments) return sendMessage(MessageID(messageID), argumentEncoder.release()); } -template<typename E> inline PassOwnPtr<ArgumentDecoder> Connection::waitFor(E messageID, uint64_t destinationID, double timeout) +template<typename E> inline PassOwnPtr<ArgumentDecoder> Connection::deprecatedWaitFor(E messageID, uint64_t destinationID, double timeout) { return waitForMessage(MessageID(messageID), destinationID, timeout); } diff --git a/Source/WebKit2/Platform/CoreIPC/DataReference.cpp b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp index 308fd6e..f186a35 100644 --- a/Source/WebKit2/Platform/CoreIPC/DataReference.cpp +++ b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DataReference.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h index 534e825..abbe089 100644 --- a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h +++ b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h @@ -159,6 +159,11 @@ void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, Arguments2<R (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, replyArgs.argument1, replyArgs.argument2); } +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2> +void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2); +} template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3> void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) @@ -210,6 +215,25 @@ void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Argument (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, argumentDecoder); } +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7> +void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7, argumentDecoder); +} + +// Variadic dispatch functions with non-variadic reply arguments. + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2, typename R3> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, ArgumentDecoder* argumentDecoder, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, argumentDecoder, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2> +void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, ArgumentDecoder* argumentDecoder, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, argumentDecoder, replyArgs.argument1, replyArgs.argument2); +} // Main dispatch functions @@ -243,6 +267,19 @@ void handleMessageVariadic(ArgumentDecoder* argumentDecoder, C* object, MF funct callMemberFunction(arguments, argumentDecoder, object, function); } + +template<typename T, typename C, typename MF> +void handleMessageVariadic(ArgumentDecoder* argumentDecoder, ArgumentEncoder* replyEncoder, C* object, MF function) +{ + typename T::DecodeType::ValueType arguments; + if (!argumentDecoder->decode(arguments)) + return; + + typename T::Reply::ValueType replyArguments; + callMemberFunction(arguments, argumentDecoder, replyArguments, object, function); + replyEncoder->encode(replyArguments); +} + } // namespace CoreIPC #endif // HandleMessage_h diff --git a/Source/WebKit2/Platform/CoreIPC/MessageID.h b/Source/WebKit2/Platform/CoreIPC/MessageID.h index 724302c..bd8180a 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageID.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageID.h @@ -95,6 +95,7 @@ class MessageID { public: enum Flags { SyncMessage = 1 << 0, + DispatchMessageWhenWaitingForSyncReply = 1 << 1, }; MessageID() @@ -108,6 +109,14 @@ public: { } + MessageID messageIDWithAddedFlags(unsigned char flags) + { + MessageID messageID; + + messageID.m_messageID = stripMostSignificantBit(m_messageID | (flags << 24)); + return messageID; + } + template <typename EnumType> EnumType get() const { @@ -137,6 +146,7 @@ public: unsigned toInt() const { return m_messageID; } + bool shouldDispatchMessageWhenWaitingForSyncReply() const { return getFlags() & DispatchMessageWhenWaitingForSyncReply; } bool isSync() const { return getFlags() & SyncMessage; } private: diff --git a/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp index d561110..4b140ee 100644 --- a/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp +++ b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Connection.h" #include "ArgumentEncoder.h" @@ -98,7 +99,6 @@ void Connection::platformInitialize(Identifier identifier) m_pendingBytes = 0; m_readBuffer.resize(initialMessageBufferSize); m_socket = identifier; - m_isConnected = true; } void Connection::platformInvalidate() @@ -171,6 +171,8 @@ bool Connection::open() int flags = fcntl(m_socket, F_GETFL, 0); fcntl(m_socket, F_SETFL, flags | O_NONBLOCK); + m_isConnected = true; + // Register callbacks for connection termination and input data on the WorkQueue. m_connectionQueue.registerEventSourceHandler(m_socket, (G_IO_HUP | G_IO_ERR), WorkItem::create(this, &Connection::connectionDidClose)); m_connectionQueue.registerEventSourceHandler(m_socket, G_IO_IN, WorkItem::create(this, &Connection::readEventHandler)); diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp index 5e7bbbc..5c4b5d1 100644 --- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp +++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Connection.h" #include "CoreIPCMessageKinds.h" @@ -93,7 +94,7 @@ bool Connection::open() m_isConnected = true; // Send the initialize message, which contains a send right for the server to use. - send(CoreIPCMessage::InitializeConnection, 0, MachPort(m_receivePort, MACH_MSG_TYPE_MAKE_SEND)); + deprecatedSend(CoreIPCMessage::InitializeConnection, 0, MachPort(m_receivePort, MACH_MSG_TYPE_MAKE_SEND)); // Set the dead name handler for our send port. initializeDeadNameSource(); @@ -109,7 +110,7 @@ bool Connection::open() if (m_exceptionPort) { m_connectionQueue.registerMachPortEventHandler(m_exceptionPort, WorkQueue::MachPortDataAvailable, WorkItem::create(this, &Connection::exceptionSourceEventHandler)); - send(CoreIPCMessage::SetExceptionPort, 0, MachPort(m_exceptionPort, MACH_MSG_TYPE_MAKE_SEND)); + deprecatedSend(CoreIPCMessage::SetExceptionPort, 0, MachPort(m_exceptionPort, MACH_MSG_TYPE_MAKE_SEND)); } return true; diff --git a/Source/WebKit2/Platform/CoreIPC/qt/AttachmentQt.cpp b/Source/WebKit2/Platform/CoreIPC/qt/AttachmentQt.cpp new file mode 100644 index 0000000..4c0ebc0 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/qt/AttachmentQt.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "Attachment.h" + +#if PLATFORM(QT) +#include <unistd.h> +#include <errno.h> +#endif + + +namespace CoreIPC { + +Attachment::Attachment(int fileDescriptor, size_t size) + : m_type(MappedMemory) + , m_fileDescriptor(fileDescriptor) + , m_size(size) +{ + ASSERT(m_fileDescriptor); + ASSERT(m_size); +} + +void Attachment::dispose() +{ + if (m_fileDescriptor != -1) + while (close(m_fileDescriptor) == -1 && (errno == EINTR)) { } +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp b/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp index c0736b8..225d7dc 100644 --- a/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp +++ b/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp @@ -24,119 +24,346 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Connection.h" #include "ArgumentEncoder.h" #include "ProcessLauncher.h" #include "WorkItem.h" +#include "SharedMemory.h" +#include "WebProcessProxy.h" #include <QApplication> -#include <QLocalServer> -#include <QLocalSocket> +#include <QSocketNotifier> +#include <sys/socket.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <wtf/Assertions.h> using namespace std; namespace CoreIPC { -// This is what other ports use... static const size_t messageMaxSize = 4096; +static const size_t attachmentMaxAmount = 255; + +enum { + MessageBodyIsOOL = 1 << 31 +}; + +class MessageInfo { +public: + MessageInfo() { } + + MessageInfo(MessageID messageID, size_t bodySize, size_t initialAttachmentCount) + : m_messageID(messageID.toInt()) + , m_bodySize(bodySize) + , m_attachmentCount(initialAttachmentCount) + { + ASSERT(!(m_messageID & MessageBodyIsOOL)); + } + + void setMessageBodyOOL() + { + ASSERT(!isMessageBodyOOL()); + + m_messageID |= MessageBodyIsOOL; + m_attachmentCount++; + } + + bool isMessageBodyOOL() const { return m_messageID & MessageBodyIsOOL; } + + size_t bodySize() const { return m_bodySize; } + + MessageID messageID() const { return MessageID::fromInt(m_messageID & ~MessageBodyIsOOL); } + + size_t attachmentCount() const { return m_attachmentCount; } + +private: + uint32_t m_messageID; + size_t m_bodySize; + size_t m_attachmentCount; +}; void Connection::platformInitialize(Identifier identifier) { - m_serverName = identifier; - m_socket = 0; + m_socketDescriptor = identifier; + m_socketNotifier = 0; m_readBuffer.resize(messageMaxSize); m_currentMessageSize = 0; } void Connection::platformInvalidate() { - m_socket->disconnect(); - if (!m_isServer) - m_socket->deleteLater(); - m_socket = 0; + if (m_socketDescriptor != -1) + while (close(m_socketDescriptor) == -1 && errno == EINTR) { } + + if (!m_isConnected) + return; + + delete m_socketNotifier; + m_socketNotifier = 0; + m_socketDescriptor = -1; + m_isConnected = false; } +class SocketNotifierResourceGuard { +public: + SocketNotifierResourceGuard(QSocketNotifier* socketNotifier) + : m_socketNotifier(socketNotifier) + { + m_socketNotifier->setEnabled(false); + } + + ~SocketNotifierResourceGuard() + { + m_socketNotifier->setEnabled(true); + } + +private: + QSocketNotifier* const m_socketNotifier; +}; + +template<class T, class iterator> +class AttachmentResourceGuard { +public: + AttachmentResourceGuard(T& attachments) + : m_attachments(attachments) + { + } + ~AttachmentResourceGuard() + { + iterator end = m_attachments.end(); + for (iterator i = m_attachments.begin(); i != end; ++i) + i->dispose(); + } +private: + T& m_attachments; +}; + void Connection::readyReadHandler() { - while (m_socket->bytesAvailable()) { - if (!m_currentMessageSize) { - size_t numberOfBytesRead = m_socket->read(reinterpret_cast<char*>(m_readBuffer.data()), sizeof(size_t)); - ASSERT_UNUSED(numberOfBytesRead, numberOfBytesRead); - m_currentMessageSize = *reinterpret_cast<size_t*>(m_readBuffer.data()); - } + Deque<Attachment> attachments; + SocketNotifierResourceGuard socketNotifierEnabler(m_socketNotifier); + AttachmentResourceGuard<Deque<Attachment>, Deque<Attachment>::iterator> attachementDisposer(attachments); + + char attachmentDescriptorBuffer[CMSG_SPACE(sizeof(int) * (attachmentMaxAmount))]; + struct msghdr message; + memset(&message, 0, sizeof(message)); + + struct iovec iov[1]; + memset(&iov, 0, sizeof(iov)); - if (m_socket->bytesAvailable() < m_currentMessageSize) + message.msg_control = attachmentDescriptorBuffer; + message.msg_controllen = CMSG_SPACE(sizeof(int) * (attachmentMaxAmount)); + + iov[0].iov_base = m_readBuffer.data(); + iov[0].iov_len = m_readBuffer.size(); + + message.msg_iov = iov; + message.msg_iovlen = 1; + + + int messageLength = 0; + while ((messageLength = recvmsg(m_socketDescriptor, &message, 0)) == -1) { + if (errno != EINTR) return; + } + + struct cmsghdr* controlMessage = CMSG_FIRSTHDR(&message); + + MessageInfo messageInfo; + unsigned char* messageData = m_readBuffer.data(); + + memcpy(&messageInfo, messageData, sizeof(messageInfo)); + ASSERT(messageLength == sizeof(messageInfo) + messageInfo.attachmentCount() * sizeof(size_t) + (messageInfo.isMessageBodyOOL() ? 0 : messageInfo.bodySize())); + + messageData += sizeof(messageInfo); + + RefPtr<WebKit::SharedMemory> oolMessageBody; + + if (messageInfo.attachmentCount()) { + if (controlMessage && controlMessage->cmsg_level == SOL_SOCKET && controlMessage->cmsg_type == SCM_RIGHTS) { + size_t attachmentSizes[messageInfo.attachmentCount()]; + memcpy(attachmentSizes, messageData, sizeof(attachmentSizes)); + + messageData += sizeof(attachmentSizes); + + int fileDescriptors[messageInfo.attachmentCount()]; + memcpy(fileDescriptors, CMSG_DATA(controlMessage), sizeof(fileDescriptors)); + + int attachmentCount = messageInfo.attachmentCount(); - if (m_readBuffer.size() < m_currentMessageSize) - m_readBuffer.grow(m_currentMessageSize); + if (messageInfo.isMessageBodyOOL()) + attachmentCount--; - size_t numberOfBytesRead = m_socket->read(reinterpret_cast<char*>(m_readBuffer.data()), m_currentMessageSize); - ASSERT_UNUSED(numberOfBytesRead, numberOfBytesRead); + for (int i = 0; i < attachmentCount; ++i) { + while (fcntl(fileDescriptors[i], F_SETFL, FD_CLOEXEC) == -1) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + return; + } + } + } - // The messageID is encoded at the end of the buffer. - size_t realBufferSize = m_currentMessageSize - sizeof(uint32_t); - uint32_t messageID = *reinterpret_cast<uint32_t*>(m_readBuffer.data() + realBufferSize); + for (int i = 0; i < attachmentCount; ++i) + attachments.append(Attachment(fileDescriptors[i], attachmentSizes[i])); - processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize))); + if (messageInfo.isMessageBodyOOL()) { + ASSERT(messageInfo.bodySize()); - m_currentMessageSize = 0; + WebKit::SharedMemory::Handle handle; + handle.adoptFromAttachment(fileDescriptors[attachmentCount], attachmentSizes[attachmentCount]); + if (handle.isNull()) { + ASSERT_NOT_REACHED(); + return; + } + + oolMessageBody = WebKit::SharedMemory::create(handle, WebKit::SharedMemory::ReadOnly); + if (!oolMessageBody) { + ASSERT_NOT_REACHED(); + return; + } + } + + controlMessage = CMSG_NXTHDR(&message, controlMessage); + } else { + ASSERT_NOT_REACHED(); + return; + } } + + ASSERT(attachments.size() == messageInfo.isMessageBodyOOL() ? messageInfo.attachmentCount() - 1 : messageInfo.attachmentCount()); + + unsigned char* messageBody = messageData; + + if (messageInfo.isMessageBodyOOL()) + messageBody = reinterpret_cast<unsigned char*>(oolMessageBody->data()); + + ArgumentDecoder* argumentDecoder; + if (attachments.isEmpty()) + argumentDecoder = new ArgumentDecoder(messageBody, messageInfo.bodySize()); + else + argumentDecoder = new ArgumentDecoder(messageBody, messageInfo.bodySize(), attachments); + + processIncomingMessage(messageInfo.messageID(), adoptPtr(argumentDecoder)); + + ASSERT(!controlMessage); } bool Connection::open() { - ASSERT(!m_socket); - - if (m_isServer) { - m_socket = WebKit::ProcessLauncher::takePendingConnection(); - m_isConnected = m_socket; - if (m_isConnected) { - m_connectionQueue.moveSocketToWorkThread(m_socket); - m_connectionQueue.connectSignal(m_socket, SIGNAL(readyRead()), WorkItem::create(this, &Connection::readyReadHandler)); + ASSERT(!m_socketNotifier); + int flags = fcntl(m_socketDescriptor, F_GETFL, 0); + while (fcntl(m_socketDescriptor, F_SETFL, flags | O_NONBLOCK) == -1) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + return false; } - } else { - m_socket = new QLocalSocket(); - m_socket->connectToServer(m_serverName); - m_connectionQueue.moveSocketToWorkThread(m_socket); - m_connectionQueue.connectSignal(m_socket, SIGNAL(readyRead()), WorkItem::create(this, &Connection::readyReadHandler)); - m_connectionQueue.connectSignal(m_socket, SIGNAL(disconnected()), WorkItem::create(this, &Connection::connectionDidClose)); - m_isConnected = m_socket->waitForConnected(); } - return m_isConnected; + + m_isConnected = true; + m_socketNotifier = m_connectionQueue.registerSocketEventHandler(m_socketDescriptor, QSocketNotifier::Read, WorkItem::create(this, &Connection::readyReadHandler)); + + // Schedule a call to readyReadHandler. Data may have arrived before installation of the signal + // handler. + m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::readyReadHandler)); + + return true; } bool Connection::platformCanSendOutgoingMessages() const { - return m_socket; + return m_socketNotifier; } bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) { - ASSERT(m_socket); - - // We put the message ID last. - arguments->encodeUInt32(messageID.toInt()); + ASSERT(m_socketNotifier); + COMPILE_ASSERT(sizeof(MessageInfo) + attachmentMaxAmount * sizeof(size_t) <= messageMaxSize, AttachmentsFitToMessageInline); - size_t bufferSize = arguments->bufferSize(); + Vector<Attachment> attachments = arguments->releaseAttachments(); + AttachmentResourceGuard<Vector<Attachment>, Vector<Attachment>::iterator> attachementDisposer(attachments); - // Write message size first - // FIXME: Should just do a single write. - qint64 bytesWrittenForSize = m_socket->write(reinterpret_cast<char*>(&bufferSize), sizeof(bufferSize)); - if (bytesWrittenForSize != sizeof(bufferSize)) { - connectionDidClose(); + if (attachments.size() > (attachmentMaxAmount - 1)) { + ASSERT_NOT_REACHED(); return false; } - qint64 bytesWrittenForBuffer = m_socket->write(reinterpret_cast<char*>(arguments->buffer()), arguments->bufferSize()); - if (bytesWrittenForBuffer != arguments->bufferSize()) { - connectionDidClose(); - return false; + MessageInfo messageInfo(messageID, arguments->bufferSize(), attachments.size()); + size_t messageSizeWithBodyInline = sizeof(messageInfo) + (attachments.size() * sizeof(size_t)) + arguments->bufferSize(); + if (messageSizeWithBodyInline > messageMaxSize && arguments->bufferSize()) { + RefPtr<WebKit::SharedMemory> oolMessageBody = WebKit::SharedMemory::create(arguments->bufferSize()); + if (!oolMessageBody) + return false; + + WebKit::SharedMemory::Handle handle; + if (!oolMessageBody->createHandle(handle, WebKit::SharedMemory::ReadOnly)) + return false; + + messageInfo.setMessageBodyOOL(); + + memcpy(oolMessageBody->data(), arguments->buffer(), arguments->bufferSize()); + + attachments.append(handle.releaseToAttachment()); } - m_socket->flush(); + struct msghdr message; + memset(&message, 0, sizeof(message)); + + struct iovec iov[3]; + memset(&iov, 0, sizeof(iov)); + + message.msg_iov = iov; + int iovLength = 1; + + iov[0].iov_base = reinterpret_cast<void*>(&messageInfo); + iov[0].iov_len = sizeof(messageInfo); + + char attachmentFDBuffer[CMSG_SPACE(sizeof(int) * (attachments.size()))]; + size_t attachmentSizes[attachments.size()]; + + if (!attachments.isEmpty()) { + message.msg_control = attachmentFDBuffer; + message.msg_controllen = sizeof(attachmentFDBuffer); + + struct cmsghdr* cmsg = CMSG_FIRSTHDR(&message); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int) * attachments.size()); + + int* fdptr = reinterpret_cast<int*>(CMSG_DATA(cmsg)); + for (int i = 0; i < attachments.size(); ++i) { + attachmentSizes[i] = attachments[i].size(); + fdptr[i] = attachments[i].fileDescriptor(); + } + + message.msg_controllen = cmsg->cmsg_len; + iov[iovLength].iov_base = attachmentSizes; + iov[iovLength].iov_len = sizeof(attachmentSizes); + ++iovLength; + } + + if (!messageInfo.isMessageBodyOOL() && arguments->bufferSize()) { + iov[iovLength].iov_base = reinterpret_cast<void*>(arguments->buffer()); + iov[iovLength].iov_len = arguments->bufferSize(); + ++iovLength; + } + + message.msg_iovlen = iovLength; + + int bytesSent = 0; + while ((bytesSent = sendmsg(m_socketDescriptor, &message, 0)) == -1) { + if (errno != EINTR) + return false; + } return true; } +void Connection::setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier process) +{ + m_connectionQueue.scheduleWorkOnTermination(process, WorkItem::create(this, &Connection::connectionDidClose)); +} + } // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/win/BinarySemaphoreWin.cpp b/Source/WebKit2/Platform/CoreIPC/win/BinarySemaphoreWin.cpp new file mode 100644 index 0000000..9b26a9a --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/win/BinarySemaphoreWin.cpp @@ -0,0 +1,74 @@ +/* + * 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 "BinarySemaphore.h" + +namespace CoreIPC { + +BinarySemaphore::BinarySemaphore() + : m_event(::CreateEventW(0, FALSE, FALSE, 0)) +{ +} + +BinarySemaphore::~BinarySemaphore() +{ + ::CloseHandle(m_event); +} + +void BinarySemaphore::signal() +{ + ::SetEvent(m_event); +} + +bool BinarySemaphore::wait(double absoluteTime) +{ + DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime); + if (!interval) { + // Consider the wait to have timed out, even if the event has already been signaled, to + // match the WTF::ThreadCondition implementation. + return false; + } + + DWORD result = ::WaitForSingleObjectEx(m_event, interval, FALSE); + switch (result) { + case WAIT_OBJECT_0: + // The event was signaled. + return true; + + case WAIT_TIMEOUT: + // The wait timed out. + return false; + + case WAIT_FAILED: + ASSERT_WITH_MESSAGE(false, "::WaitForSingleObjectEx failed with error %lu", ::GetLastError()); + return false; + default: + ASSERT_WITH_MESSAGE(false, "::WaitForSingleObjectEx returned unexpected result %lu", result); + return false; + } +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp b/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp index 695da78..ab44658 100644 --- a/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp +++ b/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Connection.h" #include "ArgumentEncoder.h" @@ -88,9 +89,6 @@ void Connection::platformInitialize(Identifier identifier) m_writeState.hEvent = ::CreateEventW(0, FALSE, FALSE, 0); m_connectionPipe = identifier; - - // We connected the two ends of the pipe in createServerAndClientIdentifiers. - m_isConnected = true; } void Connection::platformInvalidate() @@ -98,6 +96,8 @@ void Connection::platformInvalidate() if (m_connectionPipe == INVALID_HANDLE_VALUE) return; + m_isConnected = false; + m_connectionQueue.unregisterAndCloseHandle(m_readState.hEvent); m_readState.hEvent = 0; @@ -242,6 +242,10 @@ void Connection::writeEventHandler() // FIXME: We should figure out why we're getting this error. return; } + if (error == ERROR_BROKEN_PIPE) { + connectionDidClose(); + return; + } ASSERT_NOT_REACHED(); } @@ -255,6 +259,9 @@ void Connection::writeEventHandler() bool Connection::open() { + // We connected the two ends of the pipe in createServerAndClientIdentifiers. + m_isConnected = true; + // Start listening for read and write state events. m_connectionQueue.registerHandle(m_readState.hEvent, WorkItem::create(this, &Connection::readEventHandler)); m_connectionQueue.registerHandle(m_writeState.hEvent, WorkItem::create(this, &Connection::writeEventHandler)); diff --git a/Source/WebKit2/Platform/Logging.cpp b/Source/WebKit2/Platform/Logging.cpp index ca312ef..184821c 100644 --- a/Source/WebKit2/Platform/Logging.cpp +++ b/Source/WebKit2/Platform/Logging.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Logging.h" #if !LOG_DISABLED diff --git a/Source/WebKit2/Platform/Module.cpp b/Source/WebKit2/Platform/Module.cpp index 7a2def5..33ffbe0 100644 --- a/Source/WebKit2/Platform/Module.cpp +++ b/Source/WebKit2/Platform/Module.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Module.h" namespace WebKit { diff --git a/Source/WebKit2/Platform/Module.h b/Source/WebKit2/Platform/Module.h index ec7523c..47899e9 100644 --- a/Source/WebKit2/Platform/Module.h +++ b/Source/WebKit2/Platform/Module.h @@ -37,6 +37,10 @@ #include <QLibrary> #endif +#if PLATFORM(GTK) +typedef struct _GModule GModule; +#endif + namespace WebKit { class Module { @@ -62,6 +66,8 @@ private: HMODULE m_module; #elif PLATFORM(QT) QLibrary m_lib; +#elif PLATFORM(GTK) + GModule* m_handle; #endif }; diff --git a/Source/WebKit2/Platform/Region.cpp b/Source/WebKit2/Platform/Region.cpp index a1cc24c..bd89065 100644 --- a/Source/WebKit2/Platform/Region.cpp +++ b/Source/WebKit2/Platform/Region.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Region.h" // A region class based on the paper "Scanline Coherent Shape Algebra" @@ -72,8 +73,8 @@ Region::Shape::Shape(const IntRect& rect) { appendSpan(rect.y()); appendSegment(rect.x()); - appendSegment(rect.right()); - appendSpan(rect.bottom()); + appendSegment(rect.maxX()); + appendSpan(rect.maxY()); } void Region::Shape::appendSpan(int y) @@ -254,7 +255,7 @@ Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& sh // Iterate over all spans. while (spans1 != spans1End && spans2 != spans2End) { - int y; + int y = 0; int test = spans1->y - spans2->y; if (test <= 0) { diff --git a/Source/WebKit2/Platform/RunLoop.cpp b/Source/WebKit2/Platform/RunLoop.cpp index 606aba1..ea81fc1 100644 --- a/Source/WebKit2/Platform/RunLoop.cpp +++ b/Source/WebKit2/Platform/RunLoop.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "RunLoop.h" #include "WorkItem.h" diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h index 9854132..fd1d60c 100644 --- a/Source/WebKit2/Platform/SharedMemory.h +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -31,10 +31,7 @@ #include <wtf/RefCounted.h> #if PLATFORM(QT) -#include <QtGlobal> -QT_BEGIN_NAMESPACE -class QSharedMemory; -QT_END_NAMESPACE +#include "Attachment.h" #include <wtf/text/WTFString.h> #endif @@ -63,6 +60,10 @@ public: void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, Handle&); +#if PLATFORM(QT) + CoreIPC::Attachment releaseToAttachment() const; + void adoptFromAttachment(int fileDescriptor, size_t); +#endif private: friend class SharedMemory; #if PLATFORM(MAC) @@ -70,7 +71,7 @@ public: #elif PLATFORM(WIN) mutable HANDLE m_handle; #elif PLATFORM(QT) - mutable String m_key; + mutable int m_fileDescriptor; #endif size_t m_size; }; @@ -97,7 +98,7 @@ private: #if PLATFORM(WIN) HANDLE m_handle; #elif PLATFORM(QT) - QSharedMemory* m_impl; + int m_fileDescriptor; #endif }; diff --git a/Source/WebKit2/Platform/WorkQueue.cpp b/Source/WebKit2/Platform/WorkQueue.cpp index de82c80..6bcdd22 100644 --- a/Source/WebKit2/Platform/WorkQueue.cpp +++ b/Source/WebKit2/Platform/WorkQueue.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WorkQueue.h" WorkQueue::WorkQueue(const char* name) diff --git a/Source/WebKit2/Platform/WorkQueue.h b/Source/WebKit2/Platform/WorkQueue.h index 78fa8b7..441d625 100644 --- a/Source/WebKit2/Platform/WorkQueue.h +++ b/Source/WebKit2/Platform/WorkQueue.h @@ -41,7 +41,8 @@ #include <wtf/Vector.h> #if PLATFORM(QT) -class QLocalSocket; +#include <QSocketNotifier> +#include "PlatformProcessIdentifier.h" class QObject; class QThread; #elif PLATFORM(GTK) @@ -50,6 +51,8 @@ typedef struct _GMainLoop GMainLoop; #endif class WorkQueue { + WTF_MAKE_NONCOPYABLE(WorkQueue); + public: explicit WorkQueue(const char* name); ~WorkQueue(); @@ -79,10 +82,8 @@ public: void registerHandle(HANDLE, PassOwnPtr<WorkItem>); void unregisterAndCloseHandle(HANDLE); #elif PLATFORM(QT) - void connectSignal(QObject*, const char* signal, PassOwnPtr<WorkItem>); - void disconnectSignal(QObject*, const char* signal); - - void moveSocketToWorkThread(QLocalSocket*); + QSocketNotifier* registerSocketEventHandler(int, QSocketNotifier::Type, PassOwnPtr<WorkItem>); + void scheduleWorkOnTermination(WebKit::PlatformProcessIdentifier, PassOwnPtr<WorkItem>); #elif PLATFORM(GTK) void registerEventSourceHandler(int, int, PassOwnPtr<WorkItem>); void unregisterEventSourceHandler(int); @@ -137,6 +138,7 @@ private: }; static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired); + static void CALLBACK timerCallback(void* context, BOOLEAN timerOrWaitFired); static DWORD WINAPI workThreadCallback(void* context); bool tryRegisterAsWorkThread(); @@ -153,6 +155,8 @@ private: Mutex m_handlesLock; HashMap<HANDLE, RefPtr<HandleWorkItem> > m_handles; + + HANDLE m_timerQueue; #elif PLATFORM(QT) class WorkItemQt; HashMap<QObject*, WorkItemQt*> m_signalListeners; diff --git a/Source/WebKit2/Platform/cg/CGUtilities.cpp b/Source/WebKit2/Platform/cg/CGUtilities.cpp index 1e5dd33..e57206d 100644 --- a/Source/WebKit2/Platform/cg/CGUtilities.cpp +++ b/Source/WebKit2/Platform/cg/CGUtilities.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CGUtilities.h" #include <wtf/RetainPtr.h> diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm b/Source/WebKit2/Platform/gtk/ModuleGtk.cpp index d4eb3ac..9b00d20 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm +++ b/Source/WebKit2/Platform/gtk/ModuleGtk.cpp @@ -1,5 +1,7 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,20 +25,30 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebDatabaseManager.h" +#include "config.h" +#include "Module.h" + +#include <gmodule.h> +#include <wtf/text/CString.h> namespace WebKit { -NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; +bool Module::load() +{ + m_handle = g_module_open(m_path.utf8().data(), G_MODULE_BIND_LAZY); + return !m_handle; +} -String WebDatabaseManager::databaseDirectory() const +void Module::unload() { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; - if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) - databasesDirectory = @"~/Library/WebKit/Databases"; + g_module_close(m_handle); +} - return [databasesDirectory stringByStandardizingPath]; +void* Module::platformFunctionPointer(const char* functionName) const +{ + gpointer symbol = 0; + g_module_symbol(m_handle, functionName, &symbol); + return symbol; } -} // namespace WebKit +} diff --git a/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp b/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp index 2c183fa..70b0552 100644 --- a/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp +++ b/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "RunLoop.h" #include "WKBase.h" diff --git a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp index 93fda95..3900e20 100644 --- a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp +++ b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SharedMemory.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp index 995b531..3d59c80 100644 --- a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp +++ b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WorkQueue.h" #include "NotImplemented.h" @@ -144,7 +145,6 @@ void WorkQueue::registerEventSourceHandler(int fileDescriptor, int condition, Pa // Set up the event sources under the mutex since this is shared across multiple threads. { MutexLocker locker(m_eventSourcesLock); - ASSERT(!m_eventSources.contains(fileDescriptor)); Vector<EventSource*> sources; EventSourceIterator it = m_eventSources.find(fileDescriptor); if (it != m_eventSources.end()) diff --git a/Source/WebKit2/Platform/mac/MachUtilities.cpp b/Source/WebKit2/Platform/mac/MachUtilities.cpp index edb17dc..a989dbf 100644 --- a/Source/WebKit2/Platform/mac/MachUtilities.cpp +++ b/Source/WebKit2/Platform/mac/MachUtilities.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "MachUtilities.h" #include <mach/task.h> diff --git a/Source/WebKit2/Platform/mac/ModuleMac.mm b/Source/WebKit2/Platform/mac/ModuleMac.mm index fa38745..078e7ee 100644 --- a/Source/WebKit2/Platform/mac/ModuleMac.mm +++ b/Source/WebKit2/Platform/mac/ModuleMac.mm @@ -23,7 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "Module.h" +#import "config.h" +#import "Module.h" namespace WebKit { diff --git a/Source/WebKit2/Platform/mac/RunLoopMac.mm b/Source/WebKit2/Platform/mac/RunLoopMac.mm index ca044f3..8258550 100644 --- a/Source/WebKit2/Platform/mac/RunLoopMac.mm +++ b/Source/WebKit2/Platform/mac/RunLoopMac.mm @@ -23,9 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "RunLoop.h" +#import "config.h" +#import "RunLoop.h" -#include "WorkItem.h" +#import "WorkItem.h" void RunLoop::performWork(void* context) { diff --git a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp index 07f942c..198ba69 100644 --- a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp +++ b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SharedMemory.h" #include "ArgumentDecoder.h" @@ -56,7 +57,7 @@ bool SharedMemory::Handle::isNull() const void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encodeUInt64(m_size); - encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_COPY_SEND)); + encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_MOVE_SEND)); m_port = MACH_PORT_NULL; } @@ -90,6 +91,8 @@ static inline mach_vm_address_t toVMAddress(void* pointer) PassRefPtr<SharedMemory> SharedMemory::create(size_t size) { + ASSERT(size); + mach_vm_address_t address; kern_return_t kr = mach_vm_allocate(mach_task_self(), &address, round_page(size), VM_FLAGS_ANYWHERE); if (kr != KERN_SUCCESS) diff --git a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp index 3651f8c..0303f7d 100644 --- a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp +++ b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WorkQueue.h" #include <mach/mach_port.h> diff --git a/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp b/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp deleted file mode 100644 index d36d82b..0000000 --- a/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2010 University of Szeged - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 "MappedMemoryPool.h" - -#include "CleanupHandler.h" -#include "StdLibExtras.h" -#include <QDir> -#include <QIODevice> -#include <QTemporaryFile> - -namespace WebKit { - -MappedMemoryPool* MappedMemoryPool::theInstance = 0; - -MappedMemoryPool* MappedMemoryPool::instance() -{ - if (!theInstance) { - theInstance = new MappedMemoryPool; - - // Do not leave mapping files on the disk. - CleanupHandler::instance()->markForCleanup(theInstance); - } - - return theInstance; -} - -MappedMemoryPool::~MappedMemoryPool() -{ - CleanupHandler::instance()->unmark(theInstance); - - for (unsigned n = 0; n < m_pool.size(); ++n) { - MappedMemory& current = m_pool.at(n); - if (!current.file) - continue; - current.file->remove(); - delete current.file; - } - m_pool.clear(); -} - -MappedMemory* MappedMemoryPool::mapMemory(size_t size) -{ - for (unsigned n = 0; n < m_pool.size(); ++n) { - MappedMemory& current = m_pool.at(n); - if (current.dataSize >= size && current.isFree()) { - current.markUsed(); - return ¤t; - } - } - - MappedMemory newMap; - newMap.dataSize = size; - newMap.file = new QTemporaryFile(QDir::tempPath() + "/WebKit2UpdateChunk"); - newMap.file->open(QIODevice::ReadWrite); - newMap.fileName = newMap.file->fileName(); - newMap.file->resize(newMap.mapSize()); - newMap.mappedBytes = newMap.file->map(0, newMap.mapSize()); - newMap.file->close(); - newMap.markUsed(); - m_pool.append(newMap); - return &m_pool.last(); -} - -MappedMemory* MappedMemoryPool::mapFile(QString fileName, size_t size) -{ - for (unsigned n = 0; n < m_pool.size(); ++n) { - MappedMemory& current = m_pool.at(n); - if (current.fileName == fileName) { - ASSERT(!current.isFree()); - return ¤t; - } - } - - MappedMemory newMap; - newMap.file = new QFile(fileName); - newMap.fileName = fileName; - newMap.dataSize = size; - ASSERT(newMap.file->exists()); - ASSERT(newMap.file->size() >= newMap.mapSize()); - newMap.file->open(QIODevice::ReadWrite); - newMap.mappedBytes = newMap.file->map(0, newMap.mapSize()); - ASSERT(newMap.mappedBytes); - ASSERT(!newMap.isFree()); - newMap.file->close(); - m_pool.append(newMap); - return &m_pool.last(); -} - -} // namespace WebKit diff --git a/Source/WebKit2/Platform/qt/MappedMemoryPool.h b/Source/WebKit2/Platform/qt/MappedMemoryPool.h deleted file mode 100644 index 8d6af8c..0000000 --- a/Source/WebKit2/Platform/qt/MappedMemoryPool.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2010 University of Szeged - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MappedMemoryPool_h -#define MappedMemoryPool_h - -#include <QFile> -#include <QObject> -#include <wtf/StdLibExtras.h> -#include <wtf/Vector.h> - -namespace WebKit { - -class MappedMemoryPool; - -struct MappedMemory { - - QString mappedFileName() const - { - ASSERT(file); - ASSERT(mappedBytes); - return fileName; - } - - void markFree() - { - ASSERT(mappedBytes); - dataPtr->isFree = true; - } - - uchar* data() const - { - ASSERT(mappedBytes); - return dataPtr->bytes; - } - -private: - friend class MappedMemoryPool; - - MappedMemory() - : file(0) - , mappedBytes(0) - , dataSize(0) - { - } - - void markUsed() { dataPtr->isFree = false; } - - size_t mapSize() const { return dataSize + sizeof(Data); } - bool isFree() const { return dataPtr->isFree; } - - struct Data { - uint32_t isFree; // keep bytes aligned - uchar bytes[]; - }; - - QFile* file; - QString fileName; - union { - uchar* mappedBytes; - Data* dataPtr; - }; - size_t dataSize; -}; - -class MappedMemoryPool : QObject { - Q_OBJECT -public: - static MappedMemoryPool* instance(); - - MappedMemory* mapMemory(size_t size); - MappedMemory* mapFile(QString fileName, size_t size); - -private: - MappedMemoryPool() { } - ~MappedMemoryPool(); - - static MappedMemoryPool* theInstance; - - Vector<MappedMemory> m_pool; -}; - -} // namespace WebKit - -#endif // MappedMemoryPool_h diff --git a/Source/WebKit2/Platform/qt/ModuleQt.cpp b/Source/WebKit2/Platform/qt/ModuleQt.cpp index 8a68cf4..de83691 100644 --- a/Source/WebKit2/Platform/qt/ModuleQt.cpp +++ b/Source/WebKit2/Platform/qt/ModuleQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Module.h" namespace WebKit { diff --git a/Source/WebKit2/Platform/qt/RunLoopQt.cpp b/Source/WebKit2/Platform/qt/RunLoopQt.cpp index d7d859d..b7aea2f 100644 --- a/Source/WebKit2/Platform/qt/RunLoopQt.cpp +++ b/Source/WebKit2/Platform/qt/RunLoopQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "RunLoop.h" #include "WorkItem.h" diff --git a/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp b/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp index f5fecfc..91af533 100644 --- a/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp +++ b/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp @@ -25,143 +25,193 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SharedMemory.h" #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" -#include "CleanupHandler.h" #include "WebCoreArgumentCoders.h" +#include <QDir> +#include <errno.h> +#include <fcntl.h> +#include <stdlib.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> -#include <QCoreApplication> -#include <QLatin1String> -#include <QSharedMemory> -#include <QString> -#include <QUuid> #include <wtf/Assertions.h> #include <wtf/CurrentTime.h> namespace WebKit { SharedMemory::Handle::Handle() - : m_key() + : m_fileDescriptor(-1) , m_size(0) { } SharedMemory::Handle::~Handle() { + if (!isNull()) + while (close(m_fileDescriptor) == -1 && errno == EINTR) { } } bool SharedMemory::Handle::isNull() const { - return m_key.isNull(); + return m_fileDescriptor == -1; } void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encodeUInt64(m_size); - encoder->encode(m_key); - m_key = String(); + ASSERT(!isNull()); + + encoder->encode(releaseToAttachment()); } bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) { ASSERT_ARG(handle, !handle.m_size); - ASSERT_ARG(handle, handle.m_key.isNull()); + ASSERT_ARG(handle, handle.isNull()); - uint64_t size; - if (!decoder->decodeUInt64(size)) + CoreIPC::Attachment attachment; + if (!decoder->decode(attachment)) return false; - String key; - if (!decoder->decode(key)) - return false; + handle.adoptFromAttachment(attachment.releaseFileDescriptor(), attachment.size()); + return true; +} - handle.m_size = size; - handle.m_key = key; +CoreIPC::Attachment SharedMemory::Handle::releaseToAttachment() const +{ + ASSERT(!isNull()); - return true; + int temp = m_fileDescriptor; + m_fileDescriptor = -1; + return CoreIPC::Attachment(temp, m_size); } -static QString createUniqueKey() +void SharedMemory::Handle::adoptFromAttachment(int fileDescriptor, size_t size) { - return QLatin1String("QWKSharedMemoryKey") + QUuid::createUuid().toString(); + ASSERT(!m_size); + ASSERT(isNull()); + + m_fileDescriptor = fileDescriptor; + m_size = size; } PassRefPtr<SharedMemory> SharedMemory::create(size_t size) { - RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); - QSharedMemory* impl = new QSharedMemory(createUniqueKey()); - bool created = impl->create(size); - ASSERT_UNUSED(created, created); + QString tempName = QDir::temp().filePath("qwkshm.XXXXXX"); + QByteArray tempNameCSTR = tempName.toLocal8Bit(); + char* tempNameC = tempNameCSTR.data(); + + int fileDescriptor; + while ((fileDescriptor = mkstemp(tempNameC)) == -1) { + if (errno != EINTR) + return 0; + } + while (fcntl(fileDescriptor, F_SETFD, FD_CLOEXEC) == -1) { + if (errno != EINTR) { + while (close(fileDescriptor) == -1 && errno == EINTR) { } + unlink(tempNameC); + return 0; + } + } - sharedMemory->m_impl = impl; - sharedMemory->m_size = size; - sharedMemory->m_data = impl->data(); + while (ftruncate(fileDescriptor, size) == -1) { + if (errno != EINTR) { + while (close(fileDescriptor) == -1 && errno == EINTR) { } + unlink(tempNameC); + return 0; + } + } - // Do not leave the shared memory segment behind. - CleanupHandler::instance()->markForCleanup(impl); + void* data = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileDescriptor, 0); + if (data == MAP_FAILED) { + while (close(fileDescriptor) == -1 && errno == EINTR) { } + unlink(tempNameC); + return 0; + } - return sharedMemory.release(); + unlink(tempNameC); + + RefPtr<SharedMemory> instance = adoptRef(new SharedMemory()); + instance->m_data = data; + instance->m_fileDescriptor = fileDescriptor; + instance->m_size = size; + return instance.release(); } -static inline QSharedMemory::AccessMode accessMode(SharedMemory::Protection protection) +static inline int accessModeMMap(SharedMemory::Protection protection) { switch (protection) { case SharedMemory::ReadOnly: - return QSharedMemory::ReadOnly; + return PROT_READ; case SharedMemory::ReadWrite: - return QSharedMemory::ReadWrite; + return PROT_READ | PROT_WRITE; } ASSERT_NOT_REACHED(); - return QSharedMemory::ReadWrite; + return PROT_READ | PROT_WRITE; } PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) { - if (handle.isNull()) - return 0; + ASSERT(!handle.isNull()); - QSharedMemory* impl = new QSharedMemory(QString(handle.m_key)); - bool attached = impl->attach(accessMode(protection)); - if (!attached) { - delete impl; + void* data = mmap(0, handle.m_size, accessModeMMap(protection), MAP_SHARED, handle.m_fileDescriptor, 0); + if (data == MAP_FAILED) return 0; - } - RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); - sharedMemory->m_impl = impl; - ASSERT(handle.m_size == impl->size()); - sharedMemory->m_size = handle.m_size; - sharedMemory->m_data = impl->data(); - - // Do not leave the shared memory segment behind. - CleanupHandler::instance()->markForCleanup(impl); - - return sharedMemory.release(); + RefPtr<SharedMemory> instance = adoptRef(new SharedMemory()); + instance->m_data = data; + instance->m_fileDescriptor = handle.m_fileDescriptor; + instance->m_size = handle.m_size; + handle.m_fileDescriptor = -1; + return instance; } SharedMemory::~SharedMemory() { - if (CleanupHandler::instance()->hasStartedDeleting()) - return; + munmap(m_data, m_size); + while (close(m_fileDescriptor) == -1 && errno == EINTR) { } +} + +static inline int accessModeFile(SharedMemory::Protection protection) +{ + switch (protection) { + case SharedMemory::ReadOnly: + return O_RDONLY; + case SharedMemory::ReadWrite: + return O_RDWR; + } - CleanupHandler::instance()->unmark(m_impl); - delete m_impl; + ASSERT_NOT_REACHED(); + return O_RDWR; } bool SharedMemory::createHandle(Handle& handle, Protection protection) { - ASSERT_ARG(handle, handle.m_key.isNull()); ASSERT_ARG(handle, !handle.m_size); + ASSERT_ARG(handle, handle.isNull()); + + int duplicatedHandle; + while ((duplicatedHandle = dup(m_fileDescriptor)) == -1) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + return false; + } + } - QString key = m_impl->key(); - if (key.isNull()) - return false; - handle.m_key = String(key); + while ((fcntl(duplicatedHandle, F_SETFD, FD_CLOEXEC | accessModeFile(protection)) == -1)) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + while (close(duplicatedHandle) == -1 && errno == EINTR) { } + return false; + } + } + handle.m_fileDescriptor = duplicatedHandle; handle.m_size = m_size; - return true; } diff --git a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp index 271984f..24af404 100644 --- a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp +++ b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp @@ -24,11 +24,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WorkQueue.h" #include <QLocalSocket> #include <QObject> #include <QThread> +#include <QProcess> #include <wtf/Threading.h> #include "NotImplemented.h" @@ -75,32 +77,17 @@ public: WorkItem* m_workItem; }; -void WorkQueue::connectSignal(QObject* o, const char* signal, PassOwnPtr<WorkItem> workItem) -{ - WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, o, signal, workItem.leakPtr()); - itemQt->moveToThread(m_workThread); - m_signalListeners.add(o, itemQt); -} - -void WorkQueue::disconnectSignal(QObject* o, const char* name) -{ - HashMap<QObject*, WorkItemQt*>::iterator it = m_signalListeners.find(o); - for (; it != m_signalListeners.end(); ++it) { - if (strcmp(it->second->m_signal, name)) - continue; - delete it->second; - m_signalListeners.remove(it); - return; - } -} - -void WorkQueue::moveSocketToWorkThread(QLocalSocket* socket) +QSocketNotifier* WorkQueue::registerSocketEventHandler(int socketDescriptor, QSocketNotifier::Type type, PassOwnPtr<WorkItem> workItem) { ASSERT(m_workThread); - ASSERT(socket); - socket->setParent(0); - socket->moveToThread(m_workThread); + QSocketNotifier* notifier = new QSocketNotifier(socketDescriptor, type, 0); + notifier->setEnabled(false); + notifier->moveToThread(m_workThread); + WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, notifier, SIGNAL(activated(int)), workItem.leakPtr()); + itemQt->moveToThread(m_workThread); + notifier->setEnabled(true); + return notifier; } void WorkQueue::platformInitialize(const char*) @@ -129,4 +116,10 @@ void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) notImplemented(); } +void WorkQueue::scheduleWorkOnTermination(WebKit::PlatformProcessIdentifier process, PassOwnPtr<WorkItem> workItem) +{ + WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, process, SIGNAL(finished(int, QProcess::ExitStatus)), workItem.leakPtr()); + itemQt->moveToThread(m_workThread); +} + #include "WorkQueueQt.moc" diff --git a/Source/WebKit2/Platform/win/ModuleWin.cpp b/Source/WebKit2/Platform/win/ModuleWin.cpp index 2c2250d..923fffd 100644 --- a/Source/WebKit2/Platform/win/ModuleWin.cpp +++ b/Source/WebKit2/Platform/win/ModuleWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Module.h" #include <shlwapi.h> diff --git a/Source/WebKit2/Platform/win/RunLoopWin.cpp b/Source/WebKit2/Platform/win/RunLoopWin.cpp index 4dfb4b5..7980e36 100644 --- a/Source/WebKit2/Platform/win/RunLoopWin.cpp +++ b/Source/WebKit2/Platform/win/RunLoopWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "RunLoop.h" #include "WorkItem.h" @@ -118,7 +119,11 @@ void RunLoop::wakeUp() void RunLoop::TimerBase::timerFired(RunLoop* runLoop, uint64_t ID) { TimerMap::iterator it = runLoop->m_activeTimers.find(ID); - ASSERT(it != runLoop->m_activeTimers.end()); + if (it == runLoop->m_activeTimers.end()) { + // The timer must have been stopped after the WM_TIMER message was posted to the message queue. + return; + } + TimerBase* timer = it->second; if (!timer->m_isRepeating) { diff --git a/Source/WebKit2/Platform/win/SharedMemoryWin.cpp b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp index 260783a..ef83de7 100644 --- a/Source/WebKit2/Platform/win/SharedMemoryWin.cpp +++ b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SharedMemory.h" #include "ArgumentDecoder.h" @@ -45,6 +46,11 @@ SharedMemory::Handle::~Handle() ::CloseHandle(m_handle); } +bool SharedMemory::Handle::isNull() const +{ + return !m_handle; +} + void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encodeUInt64(m_size); @@ -59,6 +65,25 @@ void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encodeUInt32(::GetCurrentProcessId()); } +static bool getDuplicatedHandle(HANDLE sourceHandle, DWORD sourcePID, HANDLE& duplicatedHandle) +{ + duplicatedHandle = 0; + if (!sourceHandle) + return true; + + HANDLE sourceProcess = ::OpenProcess(PROCESS_DUP_HANDLE, FALSE, sourcePID); + if (!sourceProcess) + return false; + + // Copy the handle into our process and close the handle that the sending process created for us. + BOOL success = ::DuplicateHandle(sourceProcess, sourceHandle, ::GetCurrentProcess(), &duplicatedHandle, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + ASSERT_WITH_MESSAGE(success, "::DuplicateHandle failed with error %lu", ::GetLastError()); + + ::CloseHandle(sourceProcess); + + return success; +} + bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) { ASSERT_ARG(handle, !handle.m_handle); @@ -76,17 +101,8 @@ bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& han if (!decoder->decodeUInt32(sourcePID)) return false; - HANDLE sourceProcess = ::OpenProcess(PROCESS_DUP_HANDLE, FALSE, sourcePID); - if (!sourceProcess) - return false; - - // Copy the handle into our process and close the handle that the sending process created for us. HANDLE duplicatedHandle; - BOOL success = ::DuplicateHandle(sourceProcess, reinterpret_cast<HANDLE>(sourceHandle), ::GetCurrentProcess(), &duplicatedHandle, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); - - ::CloseHandle(sourceProcess); - - if (!success) + if (!getDuplicatedHandle(reinterpret_cast<HANDLE>(sourceHandle), sourcePID, duplicatedHandle)) return false; handle.m_handle = duplicatedHandle; @@ -130,9 +146,13 @@ static DWORD accessRights(SharedMemory::Protection protection) PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) { + if (handle.isNull()) + return 0; + DWORD desiredAccess = accessRights(protection); void* baseAddress = ::MapViewOfFile(handle.m_handle, desiredAccess, 0, 0, handle.m_size); + ASSERT_WITH_MESSAGE(baseAddress, "::MapViewOfFile failed with error %lu", ::GetLastError()); if (!baseAddress) return 0; diff --git a/Source/WebKit2/Platform/win/WorkQueueWin.cpp b/Source/WebKit2/Platform/win/WorkQueueWin.cpp index f527432..f751b5d 100644 --- a/Source/WebKit2/Platform/win/WorkQueueWin.cpp +++ b/Source/WebKit2/Platform/win/WorkQueueWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WorkQueue.h" #include <wtf/Threading.h> @@ -164,6 +165,8 @@ void WorkQueue::performWorkOnRegisteredWorkThread() void WorkQueue::platformInitialize(const char* name) { m_isWorkThreadRegistered = 0; + m_timerQueue = ::CreateTimerQueue(); + ASSERT_WITH_MESSAGE(m_timerQueue, "::CreateTimerQueue failed with error %lu", ::GetLastError()); } bool WorkQueue::tryRegisterAsWorkThread() @@ -185,6 +188,10 @@ void WorkQueue::platformInvalidate() MutexLocker lock(m_handlesLock); ASSERT(m_handles.isEmpty()); #endif + + // FIXME: We need to ensure that any timer-queue timers that fire after this point don't try to + // access this WorkQueue <http://webkit.org/b/44690>. + ::DeleteTimerQueueEx(m_timerQueue, 0); } void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) @@ -203,9 +210,59 @@ void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) ::QueueUserWorkItem(workThreadCallback, this, WT_EXECUTEDEFAULT); } -void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) +struct TimerContext : public ThreadSafeShared<TimerContext> { + static PassRefPtr<TimerContext> create() { return adoptRef(new TimerContext); } + + WorkQueue* queue; + OwnPtr<WorkItem> item; + Mutex timerMutex; + HANDLE timer; + +private: + TimerContext() : queue(0), timer(0) { } +}; + +void WorkQueue::timerCallback(void* context, BOOLEAN timerOrWaitFired) +{ + ASSERT_ARG(context, context); + ASSERT_UNUSED(timerOrWaitFired, timerOrWaitFired); + + // Balanced by leakRef in scheduleWorkAfterDelay. + RefPtr<TimerContext> timerContext = adoptRef(static_cast<TimerContext*>(context)); + + timerContext->queue->scheduleWork(timerContext->item.release()); + + MutexLocker lock(timerContext->timerMutex); + ASSERT(timerContext->timer); + ASSERT(timerContext->queue->m_timerQueue); + if (!::DeleteTimerQueueTimer(timerContext->queue->m_timerQueue, timerContext->timer, 0)) + ASSERT_WITH_MESSAGE(false, "::DeleteTimerQueueTimer failed with error %lu", ::GetLastError()); +} + +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem> item, double delay) { - notImplemented(); + ASSERT(m_timerQueue); + + RefPtr<TimerContext> context = TimerContext::create(); + context->queue = this; + context->item = item; + + { + // The timer callback could fire before ::CreateTimerQueueTimer even returns, so we protect + // context->timer with a mutex to ensure the timer callback doesn't access it before the + // timer handle has been stored in it. + MutexLocker lock(context->timerMutex); + + // Since our timer callback is quick, we can execute in the timer thread itself and avoid + // an extra thread switch over to a worker thread. + if (!::CreateTimerQueueTimer(&context->timer, m_timerQueue, timerCallback, context.get(), delay * 1000, 0, WT_EXECUTEINTIMERTHREAD)) { + ASSERT_WITH_MESSAGE(false, "::CreateTimerQueueTimer failed with error %lu", ::GetLastError()); + return; + } + } + + // The timer callback will handle destroying context. + context.release().leakRef(); } void WorkQueue::unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem> item) diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp index 42e9e6d..3dc7e8e 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginControllerProxy.h" +#if ENABLE(PLUGIN_PROCESS) + #include "DataReference.h" #include "NPObjectProxy.h" #include "NPRemoteObjectMap.h" @@ -249,6 +250,11 @@ void PluginControllerProxy::setComplexTextInputEnabled(bool complexTextInputEnab m_connection->connection()->send(Messages::PluginProxy::SetComplexTextInputEnabled(complexTextInputEnabled), m_pluginInstanceID); } +mach_port_t PluginControllerProxy::compositingRenderServerPort() +{ + return PluginProcess::shared().compositingRenderServerPort(); +} + String PluginControllerProxy::proxiesForURL(const String& urlString) { String proxyString; diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h index 339c151..c39542a 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.h +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h @@ -90,6 +90,7 @@ private: #if PLATFORM(MAC) virtual void setComplexTextInputEnabled(bool); + virtual mach_port_t compositingRenderServerPort(); #endif virtual String proxiesForURL(const String&); diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp index 6124f9a..58eedba 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.cpp +++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcess.h" +#if ENABLE(PLUGIN_PROCESS) + #include "MachPort.h" #include "NetscapePluginModule.h" #include "PluginProcessProxyMessages.h" @@ -55,11 +56,12 @@ PluginProcess::~PluginProcess() { } -void PluginProcess::initializeConnection(CoreIPC::Connection::Identifier serverIdentifier) +void PluginProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, RunLoop* runLoop) { ASSERT(!m_connection); - m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, RunLoop::main()); + m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop); + m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue); m_connection->open(); } @@ -109,7 +111,14 @@ void PluginProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::Mess { } -void PluginProcess::initialize(const PluginProcessCreationParameters& parameters) +NO_RETURN void PluginProcess::didFailToSendSyncMessage(CoreIPC::Connection*) +{ + // We were making a synchronous call to a web process that doesn't exist any more. + // Callers are unlikely to be prepared for an error like this, so it's best to exit immediately. + exit(0); +} + +void PluginProcess::initializePluginProcess(const PluginProcessCreationParameters& parameters) { ASSERT(!m_pluginModule); diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h index 6c221e7..89d4bcd 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.h +++ b/Source/WebKit2/PluginProcess/PluginProcess.h @@ -44,7 +44,7 @@ class PluginProcess : ChildProcess { public: static PluginProcess& shared(); - void initializeConnection(CoreIPC::Connection::Identifier); + void initialize(CoreIPC::Connection::Identifier, RunLoop*); void removeWebProcessConnection(WebProcessConnection* webProcessConnection); NetscapePluginModule* netscapePluginModule(); @@ -65,10 +65,11 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); virtual void didClose(CoreIPC::Connection*); virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + virtual void didFailToSendSyncMessage(CoreIPC::Connection*); // Message handlers. void didReceivePluginProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); - void initialize(const PluginProcessCreationParameters&); + void initializePluginProcess(const PluginProcessCreationParameters&); void createWebProcessConnection(); void shutdownTimerFired(); diff --git a/Source/WebKit2/PluginProcess/PluginProcess.messages.in b/Source/WebKit2/PluginProcess/PluginProcess.messages.in index e9b0fd3..3d45e0e 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.messages.in +++ b/Source/WebKit2/PluginProcess/PluginProcess.messages.in @@ -23,8 +23,8 @@ #if ENABLE(PLUGIN_PROCESS) messages -> PluginProcess { - # Initializes the plug-in. - Initialize(WebKit::PluginProcessCreationParameters processCreationParameters) + # Initializes the plug-in process. + InitializePluginProcess(WebKit::PluginProcessCreationParameters processCreationParameters) # Creates a web process connection. When the connection has been created, # The plug-in process sends back a DidCreateWebProcessConnection message with diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp index ae5d7ca..b58f4d0 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "WebProcessConnection.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPRemoteObjectMap.h" #include "PluginControllerProxy.h" #include "PluginProcess.h" diff --git a/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm b/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm index 40d4f6d..610ca32 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) +#import "config.h" +#import "PluginControllerProxy.h" -#include "PluginControllerProxy.h" +#if ENABLE(PLUGIN_PROCESS) -#include <QuartzCore/QuartzCore.h> -#include "PluginProcess.h" -#include "WebKitSystemInterface.h" +#import <QuartzCore/QuartzCore.h> +#import "PluginProcess.h" +#import "WebKitSystemInterface.h" using namespace WebCore; diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index 3919c8b..5a54719 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -23,18 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" +#import "PluginProcess.h" + #if ENABLE(PLUGIN_PROCESS) // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized #define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str] - -#include "PluginProcess.h" -#include "NetscapePlugin.h" -#include "PluginProcessShim.h" -#include "PluginProcessCreationParameters.h" -#include <WebKitSystemInterface.h> -#include <dlfcn.h> +#import "NetscapePlugin.h" +#import "PluginProcessShim.h" +#import "PluginProcessCreationParameters.h" +#import <WebKitSystemInterface.h> +#import <dlfcn.h> namespace WebKit { diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm index 36cc2a1..d39353a 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm @@ -23,18 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) +#import "config.h" +#import "PluginProcessMain.h" -#include "PluginProcessMain.h" +#if ENABLE(PLUGIN_PROCESS) -#include "CommandLine.h" -#include "PluginProcess.h" -#include "RunLoop.h" -#include <runtime/InitializeThreading.h> -#include <servers/bootstrap.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> -#include <WebKitSystemInterface.h> +#import "CommandLine.h" +#import "PluginProcess.h" +#import "RunLoop.h" +#import <runtime/InitializeThreading.h> +#import <servers/bootstrap.h> +#import <wtf/text/CString.h> +#import <wtf/text/WTFString.h> +#import <WebKitSystemInterface.h> // FIXME: We should be doing this another way. extern "C" kern_return_t bootstrap_look_up2(mach_port_t, const name_t, mach_port_t*, pid_t, uint64_t); @@ -84,7 +85,7 @@ int PluginProcessMain(const CommandLine& commandLine) PluginProcess::shared().initializeShim(); // Initialize the plug-in process connection. - PluginProcess::shared().initializeConnection(serverPort); + PluginProcess::shared().initialize(serverPort, RunLoop::main()); [NSApplication sharedApplication]; diff --git a/Source/WebKit2/Scripts/generate-forwarding-headers.pl b/Source/WebKit2/Scripts/generate-forwarding-headers.pl index 6e2b2c2..738d413 100755 --- a/Source/WebKit2/Scripts/generate-forwarding-headers.pl +++ b/Source/WebKit2/Scripts/generate-forwarding-headers.pl @@ -78,7 +78,7 @@ sub collectFameworkHeaderPaths { my $file = $_; if ($filePath =~ '\.h$' && $filePath !~ "ForwardingHeaders" && grep{$file eq $_} keys %neededHeaders) { my $headerPath = substr($filePath, length(File::Spec->catfile($srcRoot, $framework)) + 1 ); - push(@frameworkHeaders, $headerPath) unless (grep($headerPath =~ "$_/", @skippedPrefixes)); + push(@frameworkHeaders, $headerPath) unless (grep($headerPath =~ "$_/", @skippedPrefixes) || $headerPath =~ "config.h"); } } diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index 8fc0eaa..800dc39 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -48,6 +48,7 @@ _license_header = """/* * 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. */ + """ class MessageReceiver(object): @@ -255,9 +256,13 @@ def struct_or_class(namespace, type): 'WebCore::PrintInfo', 'WebCore::ViewportArguments', 'WebCore::WindowFeatures', + 'WebKit::ContextMenuState', 'WebKit::DrawingAreaInfo', 'WebKit::PlatformPopupMenuData', 'WebKit::PluginProcessCreationParameters', + 'WebKit::PrintInfo', + 'WebKit::SelectionState', + 'WebKit::TextCheckerState', 'WebKit::WebNavigationDataStore', 'WebKit::WebOpenPanelParameters::Data', 'WebKit::WebPageCreationParameters', @@ -318,7 +323,6 @@ def generate_messages_header(file): result = [] result.append(_license_header) - result.append('\n') result.append('#ifndef %s\n' % header_guard) result.append('#define %s\n\n' % header_guard) @@ -371,9 +375,13 @@ def async_case_statement(receiver, message): def sync_case_statement(receiver, message): + dispatch_function = 'handleMessage' + if message.is_variadic: + dispatch_function += 'Variadic' + result = [] result.append(' case Messages::%s::%s:\n' % (receiver.name, message.id())) - result.append(' CoreIPC::handleMessage<Messages::%s::%s>(arguments, reply, this, &%s);\n' % (receiver.name, message.name, handler_function(receiver, message))) + result.append(' CoreIPC::%s<Messages::%s::%s>(arguments, reply, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message))) # FIXME: Handle delayed replies result.append(' return CoreIPC::AutomaticReply;\n') return surround_in_condition(''.join(result), message.condition) @@ -417,6 +425,7 @@ def headers_for_type(type): 'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>', 'WebCore::PluginInfo': '<WebCore/PluginData.h>', 'WebCore::TextCheckingResult': '<WebCore/EditorClient.h>', + 'WebKit::WebGestureEvent': '"WebEvent.h"', 'WebKit::WebKeyboardEvent': '"WebEvent.h"', 'WebKit::WebMouseEvent': '"WebEvent.h"', 'WebKit::WebTouchEvent': '"WebEvent.h"', @@ -468,6 +477,7 @@ def generate_message_handler(file): result = [] result.append(_license_header) + result.append('#include "config.h"\n') result.append('\n') if receiver.condition: diff --git a/Source/WebKit2/Scripts/webkit2/messages_unittest.py b/Source/WebKit2/Scripts/webkit2/messages_unittest.py index 25123c0..8ed8cee 100644 --- a/Source/WebKit2/Scripts/webkit2/messages_unittest.py +++ b/Source/WebKit2/Scripts/webkit2/messages_unittest.py @@ -47,6 +47,8 @@ _messages_file_contents = """# Copyright (C) 2010 Apple Inc. All rights reserved # 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" + #if ENABLE(WEBKIT2) messages -> WebPage { @@ -478,6 +480,8 @@ _expected_receiver_implementation = """/* * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" + #if ENABLE(WEBKIT2) #include "WebPage.h" diff --git a/Source/WebKit2/Shared/API/c/WKArray.cpp b/Source/WebKit2/Shared/API/c/WKArray.cpp index 9e20b7e..3cc98b8 100644 --- a/Source/WebKit2/Shared/API/c/WKArray.cpp +++ b/Source/WebKit2/Shared/API/c/WKArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKArray.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index f906f9f..1db647a 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 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 @@ -32,6 +33,10 @@ #include <WebKit2/WKBaseWin.h> #endif +#if defined(BUILDING_GTK__) +#include <WebKit2/WKBaseGtk.h> +#endif + /* WebKit2 shared types */ typedef uint32_t WKTypeID; @@ -49,6 +54,7 @@ typedef const struct OpaqueWKContextMenuItem* WKContextMenuItemRef; typedef const struct OpaqueWKData* WKDataRef; typedef const struct OpaqueWKDouble* WKDoubleRef; typedef const struct OpaqueWKError* WKErrorRef; +typedef const struct OpaqueWKGraphicsContext* WKGraphicsContextRef; typedef const struct OpaqueWKImage* WKImageRef; typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef; typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef; @@ -92,6 +98,8 @@ typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListI typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef; typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef; typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef; +typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef; +typedef const struct OpaqueWKBundleNavigationAction* WKBundleNavigationActionRef; typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef; typedef const struct OpaqueWKBundlePage* WKBundlePageRef; typedef const struct OpaqueWKBundlePageGroup* WKBundlePageGroupRef; @@ -99,8 +107,6 @@ typedef const struct OpaqueWKBundlePageOverlay* WKBundlePageOverlayRef; typedef const struct OpaqueWKBundleRangeHandle* WKBundleRangeHandleRef; typedef const struct OpaqueWKBundleScriptWorld* WKBundleScriptWorldRef; -/* These rules should stay the same as in JavaScriptCore/API/JSBase.h */ - #undef WK_EXPORT #if defined(WK_NO_EXPORT) #define WK_EXPORT diff --git a/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp index c5a3ad9..45ec627 100644 --- a/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp +++ b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKCertificateInfo.h" #include "WebCertificateInfo.h" diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp index a4eaa53..c04aab1 100644 --- a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKContextMenuItem.h" #include "MutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKData.cpp b/Source/WebKit2/Shared/API/c/WKData.cpp index aefe795..b8253aa 100644 --- a/Source/WebKit2/Shared/API/c/WKData.cpp +++ b/Source/WebKit2/Shared/API/c/WKData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKData.h" #include "WebData.h" diff --git a/Source/WebKit2/Shared/API/c/WKDictionary.cpp b/Source/WebKit2/Shared/API/c/WKDictionary.cpp index 6b336bf..dc423de 100644 --- a/Source/WebKit2/Shared/API/c/WKDictionary.cpp +++ b/Source/WebKit2/Shared/API/c/WKDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKDictionary.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKError.cpp b/Source/WebKit2/Shared/API/c/WKError.cpp index 395cf3a..148bd62 100644 --- a/Source/WebKit2/Shared/API/c/WKError.cpp +++ b/Source/WebKit2/Shared/API/c/WKError.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKError.h" #include "WebError.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp b/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp index 11f929c..5d80dfa 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp +++ b/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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 @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebDatabaseManager.h" +#include "config.h" +#include "WKGraphicsContext.h" -namespace WebKit { +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" -String WebDatabaseManager::databaseDirectory() const +using namespace WebKit; + +WKTypeID WKGraphicsContextGetTypeID() { - // FIXME: Implement. - return ""; + return toAPI(WebGraphicsContext::APIType); } - -} // namespace WebKit diff --git a/Source/WebKit2/Shared/API/c/WKGraphicsContext.h b/Source/WebKit2/Shared/API/c/WKGraphicsContext.h new file mode 100644 index 0000000..c9d0a52 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKGraphicsContext.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContext_h +#define WKGraphicsContext_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGraphicsContextGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContext_h */ diff --git a/Source/WebKit2/Shared/API/c/WKImage.cpp b/Source/WebKit2/Shared/API/c/WKImage.cpp index 0bf21df..23278b3 100644 --- a/Source/WebKit2/Shared/API/c/WKImage.cpp +++ b/Source/WebKit2/Shared/API/c/WKImage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKImage.h" #include "WKSharedAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKMutableArray.cpp b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp index 56bd72f..1ae65c1 100644 --- a/Source/WebKit2/Shared/API/c/WKMutableArray.cpp +++ b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKMutableArray.h" #include "MutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp index df9f5a7..0d96ca1 100644 --- a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp +++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKMutableDictionary.h" #include "MutableDictionary.h" diff --git a/Source/WebKit2/Shared/API/c/WKNumber.cpp b/Source/WebKit2/Shared/API/c/WKNumber.cpp index 4a413e1..f2cf0f8 100644 --- a/Source/WebKit2/Shared/API/c/WKNumber.cpp +++ b/Source/WebKit2/Shared/API/c/WKNumber.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKNumber.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp index 761cbf8..ef51335 100644 --- a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp +++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKSecurityOrigin.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp index 4c642f0..f45c388 100644 --- a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp +++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKSerializedScriptValue.h" #include "WKSerializedScriptValuePrivate.h" diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index 6dc80e8..ac3b420 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -41,6 +41,8 @@ #include "WebNumber.h" #include "WebString.h" #include "WebURL.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" #include <WebCore/ContextMenuItem.h> #include <WebCore/FloatRect.h> #include <WebCore/FrameLoaderTypes.h> @@ -56,6 +58,7 @@ class MutableDictionary; class WebCertificateInfo; class WebContextMenuItem; class WebData; +class WebGraphicsContext; class WebImage; class WebSecurityOrigin; class WebSerializedScriptValue; @@ -78,6 +81,7 @@ WK_ADD_API_MAPPING(WKDataRef, WebData) WK_ADD_API_MAPPING(WKDictionaryRef, ImmutableDictionary) WK_ADD_API_MAPPING(WKDoubleRef, WebDouble) WK_ADD_API_MAPPING(WKErrorRef, WebError) +WK_ADD_API_MAPPING(WKGraphicsContextRef, WebGraphicsContext) WK_ADD_API_MAPPING(WKImageRef, WebImage) WK_ADD_API_MAPPING(WKMutableArrayRef, MutableArray) WK_ADD_API_MAPPING(WKMutableDictionaryRef, MutableDictionary) @@ -172,6 +176,16 @@ inline ProxyingRefPtr<WebError> toAPI(const WebCore::ResourceError& error) return ProxyingRefPtr<WebError>(WebError::create(error)); } +inline ProxyingRefPtr<WebURLRequest> toAPI(const WebCore::ResourceRequest& request) +{ + return ProxyingRefPtr<WebURLRequest>(WebURLRequest::create(request)); +} + +inline ProxyingRefPtr<WebURLResponse> toAPI(const WebCore::ResourceResponse& response) +{ + return ProxyingRefPtr<WebURLResponse>(WebURLResponse::create(response)); +} + /* Geometry conversions */ inline WebCore::FloatRect toFloatRect(const WKRect& wkRect) diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp index 14f40fa..72841a4 100644 --- a/Source/WebKit2/Shared/API/c/WKString.cpp +++ b/Source/WebKit2/Shared/API/c/WKString.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKString.h" #include "WKStringPrivate.h" diff --git a/Source/WebKit2/Shared/API/c/WKType.cpp b/Source/WebKit2/Shared/API/c/WKType.cpp index a499737..f0e4ea8 100644 --- a/Source/WebKit2/Shared/API/c/WKType.cpp +++ b/Source/WebKit2/Shared/API/c/WKType.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKType.h" #include "APIObject.h" diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp index 0060b34..6b7e567 100644 --- a/Source/WebKit2/Shared/API/c/WKURL.cpp +++ b/Source/WebKit2/Shared/API/c/WKURL.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURL.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp index 6ea66ec..433db05 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLRequest.h" #include "WKAPICast.h" @@ -41,3 +42,8 @@ WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef url) { return toAPI(WebURLRequest::create(KURL(KURL(), toImpl(url)->string())).leakRef()); } + +WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef) +{ + return toCopiedURLAPI(toImpl(requestRef)->url()); +} diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.h b/Source/WebKit2/Shared/API/c/WKURLRequest.h index d78968d..7d146f2 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.h +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.h @@ -36,6 +36,8 @@ WK_EXPORT WKTypeID WKURLRequestGetTypeID(); WK_EXPORT WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef); +WK_EXPORT WKURLRef WKURLRequestCopyURL(WKURLRequestRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp index 12537bd..7d8d68b 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLResponse.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp index 3eb24c4..f09610f 100644 --- a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp +++ b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKUserContentURLPattern.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp index b89110e..9a49e5a 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKStringCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp index a4627ce..e1d4ee7 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp index 98c801a..7422fd2 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLRequestCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp index 36d3f00..42473c8 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLResponseCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp new file mode 100644 index 0000000..aa7a77e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp @@ -0,0 +1,38 @@ +/* + * 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 "WKGraphicsContextCG.h" + +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" + +using namespace WebKit; + +CGContextRef WKGraphicsContextGetCGContext(WKGraphicsContextRef graphicsContextRef) +{ + return toImpl(graphicsContextRef)->platformContext(); +} diff --git a/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h new file mode 100644 index 0000000..06e9df0 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContextCG_h +#define WKGraphicsContextCG_h + +#include <CoreGraphics/CGContext.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT CGContextRef WKGraphicsContextGetCGContext(WKGraphicsContextRef graphicsContext); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContextCG_h */ diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp index 34a8bf1..61b5f17 100644 --- a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp +++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKImageCG.h" #include "ShareableBitmap.h" diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h index b6d15fd..8f34ed3 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp +++ b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h @@ -1,5 +1,7 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,17 +25,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebDatabaseManager.h" +#ifndef WKBaseGtk_h +#define WKBaseGtk_h -#include <WebCore/FileSystem.h> +#ifndef WKBase_h +#error "Please #include \"WKBase.h\" instead of this file directly." +#endif -using namespace WebCore; +typedef const struct OpaqueWKView* WKViewRef; -namespace WebKit { - -String WebDatabaseManager::databaseDirectory() const -{ - return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases"); -} - -} // namespace WebKit +#endif /* WKBaseGtk_h */ diff --git a/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp new file mode 100644 index 0000000..69695f1 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Igalia SL 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 "WKGraphicsContextGtk.h" + +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" + +using namespace WebKit; + +cairo_t* WKGraphicsContextGetGtkContext(WKGraphicsContextRef graphicsContextRef) +{ + return toImpl(graphicsContextRef)->platformContext(); +} diff --git a/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h new file mode 100644 index 0000000..25fcfc4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Igalia SL All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContextGtk_h +#define WKGraphicsContextGtk_h + +#include <WebKit2/WKBase.h> + +#include <cairo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT cairo_t* WKGraphicsContextGetGtkContext(WKGraphicsContextRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContextGtk_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm index 2ffc1f5..a2f348d 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKCertificateInfoMac.h" +#import "config.h" +#import "WKCertificateInfoMac.h" -#include "WKAPICast.h" -#include "WebCertificateInfo.h" +#import "WKAPICast.h" +#import "WebCertificateInfo.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm index 7cc69fa..081bbd7 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKURLRequestNS.h" +#import "config.h" +#import "WKURLRequestNS.h" -#include "WKAPICast.h" -#include "WebURLRequest.h" +#import "WKAPICast.h" +#import "WebURLRequest.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm index 79b874d..f19883e 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKURLResponseNS.h" +#import "config.h" +#import "WKURLResponseNS.h" -#include "WKAPICast.h" -#include "WebURLResponse.h" +#import "WKAPICast.h" +#import "WebURLResponse.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp index f4c7bb2..ada20ef 100644 --- a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp +++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKCertificateInfoWin.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h index 70ed0ba..10149b0 100644 --- a/Source/WebKit2/Shared/APIObject.h +++ b/Source/WebKit2/Shared/APIObject.h @@ -44,6 +44,7 @@ public: TypeData, TypeDictionary, TypeError, + TypeGraphicsContext, TypeImage, TypeProtectionSpace, TypeSecurityOrigin, @@ -85,6 +86,8 @@ public: TypeBundleBackForwardListItem, TypeBundleFrame, TypeBundleHitTestResult, + TypeBundleInspector, + TypeBundleNavigationAction, TypeBundleNodeHandle, TypeBundlePage, TypeBundlePageGroup, diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp index 06217fd..d45f4f2 100644 --- a/Source/WebKit2/Shared/ChildProcess.cpp +++ b/Source/WebKit2/Shared/ChildProcess.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChildProcess.h" #if !OS(WINDOWS) @@ -47,13 +48,13 @@ NO_RETURN static void watchdogCallback() _exit(EXIT_FAILURE); } -void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue* workQueue, CoreIPC::Connection*) +void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue& workQueue, CoreIPC::Connection*) { // If the connection has been closed and we haven't responded in the main thread for 10 seconds // the process will exit forcibly. static const double watchdogDelay = 10.0; - workQueue->scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay); + workQueue.scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h index 8c5e8e3..7286d52 100644 --- a/Source/WebKit2/Shared/ChildProcess.h +++ b/Source/WebKit2/Shared/ChildProcess.h @@ -36,8 +36,7 @@ protected: ChildProcess(); ~ChildProcess(); -private: - void didCloseOnConnectionWorkQueue(WorkQueue*, CoreIPC::Connection*); + static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*); }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/ImmutableArray.cpp b/Source/WebKit2/Shared/ImmutableArray.cpp index 2be62fd..67b2a34 100644 --- a/Source/WebKit2/Shared/ImmutableArray.cpp +++ b/Source/WebKit2/Shared/ImmutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ImmutableArray.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/ImmutableDictionary.cpp b/Source/WebKit2/Shared/ImmutableDictionary.cpp index 488da2d..1af988e 100644 --- a/Source/WebKit2/Shared/ImmutableDictionary.cpp +++ b/Source/WebKit2/Shared/ImmutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ImmutableDictionary.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h new file mode 100644 index 0000000..e2938aa --- /dev/null +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayerTreeContext_h +#define LayerTreeContext_h + +#if USE(ACCELERATED_COMPOSITING) + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class LayerTreeContext { +public: + LayerTreeContext(); + ~LayerTreeContext(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&); + + bool isEmpty() const; + +#if PLATFORM(MAC) + uint32_t contextID; +#endif +}; + +bool operator==(const LayerTreeContext&, const LayerTreeContext&); + +inline bool operator!=(const LayerTreeContext& a, const LayerTreeContext& b) +{ + return !(a == b); +} + +}; + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // LayerTreeContext_h diff --git a/Source/WebKit2/Shared/MutableArray.cpp b/Source/WebKit2/Shared/MutableArray.cpp index 00f718e..0f3138f 100644 --- a/Source/WebKit2/Shared/MutableArray.cpp +++ b/Source/WebKit2/Shared/MutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "MutableArray.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/MutableDictionary.cpp b/Source/WebKit2/Shared/MutableDictionary.cpp index c151dd6..222caf3 100644 --- a/Source/WebKit2/Shared/MutableDictionary.cpp +++ b/Source/WebKit2/Shared/MutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "MutableDictionary.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h index 9c4e480..cdf1aef 100644 --- a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h +++ b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h @@ -30,11 +30,7 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSView; -#else -class NSView; -#endif +OBJC_CLASS NSView; #elif PLATFORM(QT) #include <QKeyEvent> #endif diff --git a/Source/WebKit2/Shared/OriginAndDatabases.cpp b/Source/WebKit2/Shared/OriginAndDatabases.cpp index 4db7bf0..7286e5e 100644 --- a/Source/WebKit2/Shared/OriginAndDatabases.cpp +++ b/Source/WebKit2/Shared/OriginAndDatabases.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "OriginAndDatabases.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp index 6d90ce5..51e0e6c 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PlatformPopupMenuData.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp index 51dd6be..eeb8914 100644 --- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPIdentifierData.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp index 013d849..2fd7244 100644 --- a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp +++ b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPObjectMessageReceiver.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPIdentifierData.h" #include "NPRemoteObjectMap.h" #include "NPRuntimeUtilities.h" diff --git a/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp index e7fc47f..04a6e7d 100644 --- a/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp +++ b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPObjectProxy.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentCoders.h" #include "Connection.h" #include "NPIdentifierData.h" diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp index 5fea618..bcf2a7c 100644 --- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPRemoteObjectMap.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPObjectMessageReceiver.h" #include "NPObjectProxy.h" #include "NPRuntimeUtilities.h" diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp index b100589..5e4392b 100644 --- a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPVariantData.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp index fec00b3..a1f0833 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include "Module.h" diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm index 6ecacf0..544def3 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "NetscapePluginModule.h" +#import "config.h" +#import "NetscapePluginModule.h" -#include <WebCore/WebCoreNSStringExtras.h> -#include <wtf/HashSet.h> +#import <WebCore/WebCoreNSStringExtras.h> +#import <wtf/HashSet.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp index f969ba4..d6287e3 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include <WebCore/FileSystem.h> @@ -59,7 +60,7 @@ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoSto if (!versionInfoSize) return false; - OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]); + OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]); if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get())) return false; diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp index a02cdad..a651d3b 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include "PluginDatabase.h" diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index c95a825..06014a9 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessCreationParameters.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentCoders.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp index 2a9c5e0..23d3ef9 100644 --- a/Source/WebKit2/Shared/PrintInfo.cpp +++ b/Source/WebKit2/Shared/PrintInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PrintInfo.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/PrintInfo.h b/Source/WebKit2/Shared/PrintInfo.h index d6ccd4a..502be93 100644 --- a/Source/WebKit2/Shared/PrintInfo.h +++ b/Source/WebKit2/Shared/PrintInfo.h @@ -28,9 +28,10 @@ #include <wtf/Platform.h> -#ifdef __OBJC__ -@class NSPrintInfo; +#if PLATFORM(MAC) +OBJC_CLASS NSPrintInfo; #else +// FIXME: This should use the windows equivalent. class NSPrintInfo; #endif diff --git a/Source/WebKit2/Shared/SessionState.cpp b/Source/WebKit2/Shared/SessionState.cpp index 109805f..b25289a 100644 --- a/Source/WebKit2/Shared/SessionState.cpp +++ b/Source/WebKit2/Shared/SessionState.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SessionState.h" namespace CoreIPC { diff --git a/Source/WebKit2/Shared/ShareableBitmap.cpp b/Source/WebKit2/Shared/ShareableBitmap.cpp index 90fa0d8..e89cdb7 100644 --- a/Source/WebKit2/Shared/ShareableBitmap.cpp +++ b/Source/WebKit2/Shared/ShareableBitmap.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "SharedMemory.h" diff --git a/Source/WebKit2/Shared/UpdateInfo.cpp b/Source/WebKit2/Shared/UpdateInfo.cpp index 182f75b..4afd693 100644 --- a/Source/WebKit2/Shared/UpdateInfo.cpp +++ b/Source/WebKit2/Shared/UpdateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateInfo.h" #include "WebCoreArgumentCoders.h" @@ -31,7 +32,6 @@ namespace WebKit { void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(timestamp); encoder->encode(viewSize); encoder->encode(scrollRect); encoder->encode(scrollOffset); @@ -42,8 +42,6 @@ void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result) { - if (!decoder->decode(result.timestamp)) - return false; if (!decoder->decode(result.viewSize)) return false; if (!decoder->decode(result.scrollRect)) diff --git a/Source/WebKit2/Shared/UpdateInfo.h b/Source/WebKit2/Shared/UpdateInfo.h index 2ceb164..7b5454e 100644 --- a/Source/WebKit2/Shared/UpdateInfo.h +++ b/Source/WebKit2/Shared/UpdateInfo.h @@ -41,14 +41,11 @@ class UpdateInfo { WTF_MAKE_NONCOPYABLE(UpdateInfo); public: - UpdateInfo() : timestamp(0) { } + UpdateInfo() { } void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, UpdateInfo&); - // The timestamp of this update. - double timestamp; - // The size of the web view. WebCore::IntSize viewSize; diff --git a/Source/WebKit2/Shared/VisitedLinkTable.cpp b/Source/WebKit2/Shared/VisitedLinkTable.cpp index 746ec3e..09b7cc8 100644 --- a/Source/WebKit2/Shared/VisitedLinkTable.cpp +++ b/Source/WebKit2/Shared/VisitedLinkTable.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "VisitedLinkTable.h" #include "SharedMemory.h" diff --git a/Source/WebKit2/Shared/WebBackForwardListItem.cpp b/Source/WebKit2/Shared/WebBackForwardListItem.cpp index 07061e9..5f3ef94 100644 --- a/Source/WebKit2/Shared/WebBackForwardListItem.cpp +++ b/Source/WebKit2/Shared/WebBackForwardListItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebBackForwardListItem.h" #include "DataReference.h" diff --git a/Source/WebKit2/Shared/WebContextMenuItem.cpp b/Source/WebKit2/Shared/WebContextMenuItem.cpp index 55fa70a..a3322bb 100644 --- a/Source/WebKit2/Shared/WebContextMenuItem.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuItem.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp index aec8fa0..e872047 100644 --- a/Source/WebKit2/Shared/WebContextMenuItemData.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuItemData.h" #include "APIObject.h" diff --git a/Source/WebKit2/Shared/WebError.cpp b/Source/WebKit2/Shared/WebError.cpp index a401d71..88204dd 100644 --- a/Source/WebKit2/Shared/WebError.cpp +++ b/Source/WebKit2/Shared/WebError.cpp @@ -23,7 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - +#include "config.h" #include "WebError.h" #include <wtf/text/WTFString.h> diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp index 429622c..f6738fa 100644 --- a/Source/WebKit2/Shared/WebEvent.cpp +++ b/Source/WebKit2/Shared/WebEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h index f048d6e..361aa46 100644 --- a/Source/WebKit2/Shared/WebEvent.h +++ b/Source/WebKit2/Shared/WebEvent.h @@ -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 @@ -55,13 +55,20 @@ public: KeyDown, KeyUp, RawKeyDown, - Char + Char, + +#if ENABLE(GESTURE_EVENTS) + // WebGestureEvent + GestureScrollBegin, + GestureScrollEnd, +#endif + #if ENABLE(TOUCH_EVENTS) - , + // WebTouchEvent TouchStart, TouchMove, TouchEnd, - TouchCancel + TouchCancel, #endif }; @@ -166,7 +173,7 @@ public: WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, double timestamp); #if PLATFORM(MAC) - WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, Modifiers, double timestamp); + WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, bool hasPreciseScrollingDeltas, Modifiers, double timestamp); #endif const WebCore::IntPoint position() const { return m_position; } @@ -176,6 +183,7 @@ public: Granularity granularity() const { return static_cast<Granularity>(m_granularity); } #if PLATFORM(MAC) Phase phase() const { return static_cast<Phase>(m_phase); } + bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; } #endif void encode(CoreIPC::ArgumentEncoder*) const; @@ -191,6 +199,7 @@ private: uint32_t m_granularity; // Granularity #if PLATFORM(MAC) uint32_t m_phase; // Phase + bool m_hasPreciseScrollingDeltas; #endif }; @@ -228,8 +237,30 @@ private: bool m_isSystemKey; }; -#if ENABLE(TOUCH_EVENTS) +#if ENABLE(GESTURE_EVENTS) +// FIXME: Move this class to its own header file. +class WebGestureEvent : public WebEvent { +public: + WebGestureEvent() { } + WebGestureEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, Modifiers, double timestamp); + + const WebCore::IntPoint position() const { return m_position; } + const WebCore::IntPoint globalPosition() const { return m_globalPosition; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebGestureEvent&); + +private: + static bool isGestureEventType(Type); + + WebCore::IntPoint m_position; + WebCore::IntPoint m_globalPosition; +}; +#endif // ENABLE(GESTURE_EVENTS) + + +#if ENABLE(TOUCH_EVENTS) // FIXME: Move this class to its own header file. // FIXME: Having "Platform" in the name makes it sound like this event is platform-specific or low- // level in some way. That doesn't seem to be the case. diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp index 14c51b7..62147d0 100644 --- a/Source/WebKit2/Shared/WebEventConversion.cpp +++ b/Source/WebKit2/Shared/WebEventConversion.cpp @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventConversion.h" #include "WebEvent.h" -#include <WebCore/IntPoint.h> namespace WebKit { @@ -112,6 +112,8 @@ public: m_metaKey = webEvent.metaKey(); #if PLATFORM(MAC) m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase()); + m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas(); + m_timestamp = webEvent.timestamp(); #endif } }; @@ -166,6 +168,34 @@ WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent& webEvent) return WebKit2PlatformKeyboardEvent(webEvent); } +#if ENABLE(GESTURE_EVENTS) +class WebKit2PlatformGestureEvent : public WebCore::PlatformGestureEvent { +public: + WebKit2PlatformGestureEvent(const WebGestureEvent& webEvent) + { + switch (webEvent.type()) { + case WebEvent::GestureScrollBegin: + m_type = PlatformGestureEvent::ScrollBeginType; + break; + case WebEvent::GestureScrollEnd: + m_type = PlatformGestureEvent::ScrollEndType; + break; + default: + ASSERT_NOT_REACHED(); + } + + m_position = webEvent.position(); + m_globalPosition = webEvent.globalPosition(); + m_timestamp = webEvent.timestamp(); + } +}; + +WebCore::PlatformGestureEvent platform(const WebGestureEvent& webEvent) +{ + return WebKit2PlatformGestureEvent(webEvent); +} +#endif + #if ENABLE(TOUCH_EVENTS) class WebKit2PlatformTouchPoint : public WebCore::PlatformTouchPoint { public: diff --git a/Source/WebKit2/Shared/WebEventConversion.h b/Source/WebKit2/Shared/WebEventConversion.h index 8fa0813..1fe87bc 100644 --- a/Source/WebKit2/Shared/WebEventConversion.h +++ b/Source/WebKit2/Shared/WebEventConversion.h @@ -29,6 +29,11 @@ #include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/PlatformMouseEvent.h> #include <WebCore/PlatformWheelEvent.h> + +#if ENABLE(GESTURE_EVENTS) +#include <WebCore/PlatformGestureEvent.h> +#endif + #if ENABLE(TOUCH_EVENTS) #include <WebCore/PlatformTouchEvent.h> #include <WebCore/PlatformTouchPoint.h> @@ -39,17 +44,29 @@ namespace WebKit { class WebMouseEvent; class WebWheelEvent; class WebKeyboardEvent; + +#if ENABLE(GESTURE_EVENTS) +class WebGestureEvent; +#endif + #if ENABLE(TOUCH_EVENTS) class WebTouchEvent; class WebTouchPoint; #endif + WebCore::PlatformMouseEvent platform(const WebMouseEvent&); WebCore::PlatformWheelEvent platform(const WebWheelEvent&); WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent&); + +#if ENABLE(GESTURE_EVENTS) +WebCore::PlatformGestureEvent platform(const WebGestureEvent&); +#endif + #if ENABLE(TOUCH_EVENTS) WebCore::PlatformTouchEvent platform(const WebTouchEvent&); WebCore::PlatformTouchPoint platform(const WebTouchPoint&); #endif + } // namespace WebKit #endif // WebEventConversion_h diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp index 9cda350..01fdfb8 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.cpp +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationPosition.h" #include "ArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebGestureEvent.cpp b/Source/WebKit2/Shared/WebGestureEvent.cpp new file mode 100644 index 0000000..bbf8f83 --- /dev/null +++ b/Source/WebKit2/Shared/WebGestureEvent.cpp @@ -0,0 +1,72 @@ +/* + * 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 "WebEvent.h" + +#if ENABLE(GESTURE_EVENTS) + +#include "Arguments.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +WebGestureEvent::WebGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) +{ + ASSERT(isGestureEventType(type)); +} + +void WebGestureEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + + encoder->encode(m_position); + encoder->encode(m_globalPosition); +} + +bool WebGestureEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebGestureEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + if (!decoder->decode(t.m_position)) + return false; + if (!decoder->decode(t.m_globalPosition)) + return false; + return true; +} + +bool WebGestureEvent::isGestureEventType(Type type) +{ + return type == GestureScrollBegin || type == GestureScrollEnd; +} + +} // namespace WebKit + +#endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit2/Shared/WebGraphicsContext.cpp b/Source/WebKit2/Shared/WebGraphicsContext.cpp new file mode 100644 index 0000000..3d319e4 --- /dev/null +++ b/Source/WebKit2/Shared/WebGraphicsContext.cpp @@ -0,0 +1,42 @@ +/* + * 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 "WebGraphicsContext.h" + +using namespace WebCore; + +namespace WebKit { + +WebGraphicsContext::WebGraphicsContext(GraphicsContext* graphicsContext) +#if PLATFORM(CG) + : m_platformContext(graphicsContext->platformContext()) +#elif PLATFORM(GTK) + : m_platformContext(graphicsContext->platformContext()) +#endif +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebGraphicsContext.h b/Source/WebKit2/Shared/WebGraphicsContext.h new file mode 100644 index 0000000..ddb2e34 --- /dev/null +++ b/Source/WebKit2/Shared/WebGraphicsContext.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGraphicsContext_h +#define WebGraphicsContext_h + +#include "APIObject.h" +#include <WebCore/GraphicsContext.h> +#include <wtf/PassRefPtr.h> + +#if PLATFORM(CG) +#include <wtf/RetainPtr.h> +#elif PLATFORM(GTK) +#include "RefPtrCairo.h" +#endif + +namespace WebKit { + +class WebGraphicsContext : public APIObject { +public: + static const Type APIType = TypeGraphicsContext; + + static PassRefPtr<WebGraphicsContext> create(WebCore::GraphicsContext* graphicsContext) + { + return adoptRef(new WebGraphicsContext(graphicsContext)); + } + +#if PLATFORM(CG) + CGContextRef platformContext() { return m_platformContext.get(); } +#elif PLATFORM(GTK) + cairo_t* platformContext() { return m_platformContext.get(); } +#endif + + +private: + explicit WebGraphicsContext(WebCore::GraphicsContext*); + + virtual Type type() const { return APIType; } + +#if PLATFORM(CG) + RetainPtr<CGContextRef> m_platformContext; +#elif PLATFORM(GTK) + RefPtr<cairo_t> m_platformContext; +#endif +}; + +} // namespace WebKit + +#endif // WebGraphicsContext_h diff --git a/Source/WebKit2/Shared/WebImage.cpp b/Source/WebKit2/Shared/WebImage.cpp index 1426690..e245268 100644 --- a/Source/WebKit2/Shared/WebImage.cpp +++ b/Source/WebKit2/Shared/WebImage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebImage.h" #include "ShareableBitmap.h" diff --git a/Source/WebKit2/Shared/WebKeyboardEvent.cpp b/Source/WebKit2/Shared/WebKeyboardEvent.cpp index 08aaab8..7e65ef1 100644 --- a/Source/WebKit2/Shared/WebKeyboardEvent.cpp +++ b/Source/WebKit2/Shared/WebKeyboardEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebMemorySampler.cpp b/Source/WebKit2/Shared/WebMemorySampler.cpp index 7b5c487..82b2be9 100644 --- a/Source/WebKit2/Shared/WebMemorySampler.cpp +++ b/Source/WebKit2/Shared/WebMemorySampler.cpp @@ -23,10 +23,11 @@ * */ -#if ENABLE(MEMORY_SAMPLER) - +#include "config.h" #include "WebMemorySampler.h" +#if ENABLE(MEMORY_SAMPLER) + #include <wtf/text/CString.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp index fe30290..16e5057 100644 --- a/Source/WebKit2/Shared/WebMouseEvent.cpp +++ b/Source/WebKit2/Shared/WebMouseEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "Arguments.h" diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp index 821477b..13b3d0b 100644 --- a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebOpenPanelParameters.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp index 5ab1212..45fa5a4 100644 --- a/Source/WebKit2/Shared/WebPageCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageCreationParameters.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp index f01f4a6..e8df62f 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.cpp +++ b/Source/WebKit2/Shared/WebPageGroupData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageGroupData.h" #include "ArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp index 3954368..e23830f 100644 --- a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TOUCH_EVENTS) - +#include "config.h" #include "WebEvent.h" +#if ENABLE(TOUCH_EVENTS) + #include "Arguments.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index 3a5f178..a9ac032 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -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 @@ -23,29 +23,39 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" + #include "WebPopupItem.h" #include "ArgumentCoders.h" #include "Arguments.h" +using namespace WebCore; + namespace WebKit { WebPopupItem::WebPopupItem() : m_type(Item) + , m_textDirection(LTR) + , m_hasTextDirectionOverride(false) , m_isEnabled(true) { } WebPopupItem::WebPopupItem(Type type) : m_type(type) + , m_textDirection(LTR) + , m_hasTextDirectionOverride(false) , m_isEnabled(true) , m_isLabel(false) { } -WebPopupItem::WebPopupItem(Type type, const String& text, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) +WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) : m_type(type) , m_text(text) + , m_textDirection(textDirection) + , m_hasTextDirectionOverride(hasTextDirectionOverride) , m_toolTip(toolTip) , m_accessibilityText(accessibilityText) , m_isEnabled(isEnabled) @@ -55,21 +65,23 @@ WebPopupItem::WebPopupItem(Type type, const String& text, const String& toolTip, void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); + encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, static_cast<uint64_t>(m_textDirection), m_hasTextDirectionOverride, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) { uint32_t type; String text; + uint64_t textDirection; + bool hasTextDirectionOverride; String toolTip; String accessibilityText; bool isEnabled; bool isLabel; - if (!decoder->decode(CoreIPC::Out(type, text, toolTip, accessibilityText, isEnabled, isLabel))) + if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel))) return false; - item = WebPopupItem(static_cast<Type>(type), text, toolTip, accessibilityText, isEnabled, isLabel); + item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel); return true; } diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h index c6874f8..85495a3 100644 --- a/Source/WebKit2/Shared/WebPopupItem.h +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -26,6 +26,7 @@ #ifndef WebPopupItem_h #define WebPopupItem_h +#include <WebCore/TextDirection.h> #include <wtf/text/WTFString.h> namespace CoreIPC { @@ -43,13 +44,15 @@ struct WebPopupItem { WebPopupItem(); WebPopupItem(Type); - WebPopupItem(Type, const String& text, const String& toolTip, const String& accessibilityText, bool isEnabled, bool m_isLabel); + WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool m_isLabel); void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&); Type m_type; String m_text; + WebCore::TextDirection m_textDirection; + bool m_hasTextDirectionOverride; String m_toolTip; String m_accessibilityText; bool m_isEnabled; diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp index 82b422b..c215782 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.cpp +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferencesStore.h" #include "FontSmoothingLevel.h" diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index e8cf244..c9624df 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -55,6 +55,7 @@ namespace WebKit { macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \ macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \ macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \ + macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \ macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \ macro(TabsToLinks, tabsToLinks, Bool, bool, false) \ macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \ @@ -64,6 +65,7 @@ namespace WebKit { macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \ macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \ macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \ + macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \ macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \ \ @@ -91,7 +93,7 @@ namespace WebKit { macro(SerifFontFamily, serifFontFamily, String, String, "Times New Roman") \ \ -#else +#elif PLATFORM(MAC) #define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ macro(StandardFontFamily, standardFontFamily, String, String, "Times") \ @@ -102,6 +104,17 @@ namespace WebKit { macro(SerifFontFamily, serifFontFamily, String, String, "Times") \ \ +#elif PLATFORM(QT) || PLATFORM(GTK) + +#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ + macro(StandardFontFamily, standardFontFamily, String, String, "Times") \ + macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \ + macro(FantasyFontFamily, fantasyFontFamily, String, String, "Impact") \ + macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \ + macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \ + macro(SerifFontFamily, serifFontFamily, String, String, "Times") \ + \ + #endif #define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \ diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp index 77e3a82..89b1009 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessCreationParameters.h" #include "ArgumentCoders.h" @@ -46,6 +47,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con encoder->encode(injectedBundlePath); encoder->encode(injectedBundlePathExtensionHandle); encoder->encode(applicationCacheDirectory); + encoder->encode(databaseDirectory); encoder->encode(urlSchemesRegistererdAsEmptyDocument); encoder->encode(urlSchemesRegisteredAsSecure); encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden); @@ -76,6 +78,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.applicationCacheDirectory)) return false; + if (!decoder->decode(parameters.databaseDirectory)) + return false; if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument)) return false; if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure)) diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h index 50d8a90..b157c94 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.h +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -53,6 +53,7 @@ struct WebProcessCreationParameters { SandboxExtension::Handle injectedBundlePathExtensionHandle; String applicationCacheDirectory; + String databaseDirectory; Vector<String> urlSchemesRegistererdAsEmptyDocument; Vector<String> urlSchemesRegisteredAsSecure; Vector<String> urlSchemesForWhichDomainRelaxationIsForbidden; diff --git a/Source/WebKit2/Shared/WebSecurityOrigin.h b/Source/WebKit2/Shared/WebSecurityOrigin.h index be684ab..347f83e 100644 --- a/Source/WebKit2/Shared/WebSecurityOrigin.h +++ b/Source/WebKit2/Shared/WebSecurityOrigin.h @@ -52,7 +52,7 @@ public: return adoptRef(new WebSecurityOrigin(securityOrigin.release())); } - const String protocol() const { return m_securityOrigin->domain(); } + const String protocol() const { return m_securityOrigin->protocol(); } const String host() const { return m_securityOrigin->host(); } unsigned short port() const { return m_securityOrigin->port(); } diff --git a/Source/WebKit2/Shared/WebTouchEvent.cpp b/Source/WebKit2/Shared/WebTouchEvent.cpp index f42f48c..2ffca38 100644 --- a/Source/WebKit2/Shared/WebTouchEvent.cpp +++ b/Source/WebKit2/Shared/WebTouchEvent.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TOUCH_EVENTS) - +#include "config.h" #include "WebEvent.h" +#if ENABLE(TOUCH_EVENTS) + #include "ArgumentCoders.h" #include "Arguments.h" diff --git a/Source/WebKit2/Shared/WebURLRequest.cpp b/Source/WebKit2/Shared/WebURLRequest.cpp index 1e255c2..586bbb4 100644 --- a/Source/WebKit2/Shared/WebURLRequest.cpp +++ b/Source/WebKit2/Shared/WebURLRequest.cpp @@ -7,6 +7,7 @@ * */ +#include "config.h" #include "WebURLRequest.h" using namespace WebCore; diff --git a/Source/WebKit2/Shared/WebURLRequest.h b/Source/WebKit2/Shared/WebURLRequest.h index 6cb5ba8..ab167b8 100644 --- a/Source/WebKit2/Shared/WebURLRequest.h +++ b/Source/WebKit2/Shared/WebURLRequest.h @@ -59,6 +59,8 @@ public: PlatformRequest platformRequest() const; const WebCore::ResourceRequest& resourceRequest() const { return m_request; } + const String& url() const { return m_request.url(); } + private: explicit WebURLRequest(const WebCore::ResourceRequest&); explicit WebURLRequest(PlatformRequest); diff --git a/Source/WebKit2/Shared/WebURLResponse.cpp b/Source/WebKit2/Shared/WebURLResponse.cpp index 8f8ec14..223b55b 100644 --- a/Source/WebKit2/Shared/WebURLResponse.cpp +++ b/Source/WebKit2/Shared/WebURLResponse.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/WebWheelEvent.cpp b/Source/WebKit2/Shared/WebWheelEvent.cpp index 570b8e0..26f2337 100644 --- a/Source/WebKit2/Shared/WebWheelEvent.cpp +++ b/Source/WebKit2/Shared/WebWheelEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "Arguments.h" @@ -39,12 +40,16 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint , m_delta(delta) , m_wheelTicks(wheelTicks) , m_granularity(granularity) +#if PLATFORM(MAC) + , m_phase(PhaseNone) + , m_hasPreciseScrollingDeltas(false) +#endif { ASSERT(isWheelEventType(type)); } #if PLATFORM(MAC) -WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, Modifiers modifiers, double timestamp) +WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp) : WebEvent(type, modifiers, timestamp) , m_position(position) , m_globalPosition(globalPosition) @@ -52,6 +57,7 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint , m_wheelTicks(wheelTicks) , m_granularity(granularity) , m_phase(phase) + , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas) { ASSERT(isWheelEventType(type)); } @@ -68,6 +74,7 @@ void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(m_granularity); #if PLATFORM(MAC) encoder->encode(m_phase); + encoder->encode(m_hasPreciseScrollingDeltas); #endif } @@ -88,6 +95,8 @@ bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t) #if PLATFORM(MAC) if (!decoder->decode(t.m_phase)) return false; + if (!decoder->decode(t.m_hasPreciseScrollingDeltas)) + return false; #endif return true; } diff --git a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp index f5dbbc4..555eab5 100644 --- a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp +++ b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp index 4edf46f..936b6b3 100644 --- a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ArgumentCodersCF.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp index 08c5dc3..e9ca723 100644 --- a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp +++ b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include <WebCore/GraphicsContext.h> diff --git a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp index b84f05c..50c7b57 100644 --- a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp +++ b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/gtk/UpdateChunk.cpp b/Source/WebKit2/Shared/gtk/UpdateChunk.cpp new file mode 100644 index 0000000..fb3573c --- /dev/null +++ b/Source/WebKit2/Shared/gtk/UpdateChunk.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "UpdateChunk.h" + +#include "WebCoreArgumentCoders.h" +#include <gdk/gdkx.h> + +using namespace WebCore; + +static cairo_format_t imageFormat = CAIRO_FORMAT_ARGB32; + +namespace WebKit { + +UpdateChunk::UpdateChunk() + : m_sharedMemory(0) +{ +} + +UpdateChunk::UpdateChunk(const IntRect& rect) + : m_rect(rect) + , m_sharedMemory(SharedMemory::create(size())) +{ +} + +UpdateChunk::~UpdateChunk() +{ +} + +size_t UpdateChunk::size() const +{ + return cairo_format_stride_for_width(imageFormat, m_rect.width()) * m_rect.height(); +} + +void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_rect); + if (!m_sharedMemory) { + encoder->encode(false); + return; + } + + SharedMemory::Handle handle; + if (m_sharedMemory->createHandle(handle, SharedMemory::ReadOnly)) { + encoder->encode(true); + encoder->encode(handle); + } else + encoder->encode(false); + + m_sharedMemory = 0; +} + +bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) +{ + ASSERT_ARG(chunk, chunk.isEmpty()); + + IntRect rect; + if (!decoder->decode(rect)) + return false; + + chunk.m_rect = rect; + + bool hasSharedMemory; + if (!decoder->decode(hasSharedMemory)) + return false; + + if (!hasSharedMemory) { + chunk.m_sharedMemory = 0; + return true; + } + + SharedMemory::Handle handle; + if (!decoder->decode(handle)) + return false; + + chunk.m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); + return true; +} + +cairo_surface_t* UpdateChunk::createImage() const +{ + ASSERT(m_sharedMemory); + if (!m_sharedMemory) + return 0; + + int stride = cairo_format_stride_for_width(imageFormat, m_rect.width()); + return cairo_image_surface_create_for_data(static_cast<unsigned char*>(m_sharedMemory->data()), + imageFormat, m_rect.width(), m_rect.height(), stride); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/gtk/UpdateChunk.h b/Source/WebKit2/Shared/gtk/UpdateChunk.h new file mode 100644 index 0000000..6242add --- /dev/null +++ b/Source/WebKit2/Shared/gtk/UpdateChunk.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UpdateChunk_h +#define UpdateChunk_h + +#include "IntRect.h" +#include "SharedMemory.h" + +#include <cairo.h> + +namespace CoreIPC { +class ArgumentEncoder; +class ArgumentDecoder; +} + +namespace WebKit { + +class UpdateChunk { +public: + UpdateChunk(); + UpdateChunk(const WebCore::IntRect&); + ~UpdateChunk(); + + const WebCore::IntRect& rect() const { return m_rect; } + bool isEmpty() { return m_rect.isEmpty(); } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&); + + cairo_surface_t* createImage() const; + +private: + size_t size() const; + int m_stride; + WebCore::IntRect m_rect; + mutable RefPtr<SharedMemory> m_sharedMemory; +}; + +} // namespace WebKit + + +#endif // UpdateChunk_h diff --git a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp index 95d6286..515966c 100644 --- a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp +++ b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/mac/CommandLineMac.cpp b/Source/WebKit2/Shared/mac/CommandLineMac.cpp index 185aaea..d48a401 100644 --- a/Source/WebKit2/Shared/mac/CommandLineMac.cpp +++ b/Source/WebKit2/Shared/mac/CommandLineMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CommandLine.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h new file mode 100644 index 0000000..482f579 --- /dev/null +++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CoreAnimationRenderer_h +#define CoreAnimationRenderer_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +OBJC_CLASS CALayer; +OBJC_CLASS CARenderer; + +typedef struct _CGLContextObject* CGLContextObj; + +namespace WebKit { + +class CoreAnimationRenderer : public RefCounted<CoreAnimationRenderer> { +public: + class Client { + public: + virtual ~Client() { } + virtual void rendererDidChange(CoreAnimationRenderer*) = 0; + }; + + static PassRefPtr<CoreAnimationRenderer> create(Client*, CGLContextObj, CALayer *); + ~CoreAnimationRenderer(); + + void invalidate(); + + void setBounds(CGRect); + void render(CFTimeInterval frameTime, CVTimeStamp*, CFTimeInterval& nextFrameTime); + +private: + CoreAnimationRenderer(Client*, CGLContextObj, CALayer *); + + static void rendererDidChange(void*); + void rendererDidChange(); + + Client* m_client; + CGLContextObj m_cglContext; + RetainPtr<CARenderer> m_renderer; +}; + +} // namespace WebKit + +#endif // CoreAnimationRenderer_h diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm new file mode 100644 index 0000000..97276f6 --- /dev/null +++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm @@ -0,0 +1,100 @@ +/* + * 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 "CoreAnimationRenderer.h" + +#import <WebKitSystemInterface.h> +#import <QuartzCore/QuartzCore.h> +#import <OpenGL/CGLMacro.h> + +// The CGLMacro.h header adds an implicit CGLContextObj parameter to all OpenGL calls, +// which is good because it allows us to make OpenGL calls without saving and restoring the +// current context. The context argument is named "cgl_ctx" by default, so we use the macro +// below to declare this variable. +#define DECLARE_GL_CONTEXT_VARIABLE(name) \ + CGLContextObj cgl_ctx = (name) + +namespace WebKit { + +PassRefPtr<CoreAnimationRenderer> CoreAnimationRenderer::create(Client* client, CGLContextObj cglContextObj, CALayer *layer) +{ + return adoptRef(new CoreAnimationRenderer(client, cglContextObj, layer)); +} + +CoreAnimationRenderer::CoreAnimationRenderer(Client* client, CGLContextObj cglContextObj, CALayer *layer) + : m_client(client) + , m_cglContext(cglContextObj) + , m_renderer([CARenderer rendererWithCGLContext:m_cglContext options:nil]) +{ + [m_renderer.get() setLayer:layer]; + + WKCARendererAddChangeNotificationObserver(m_renderer.get(), rendererDidChange, this); +} + +CoreAnimationRenderer::~CoreAnimationRenderer() +{ + ASSERT(!m_client); +} + +void CoreAnimationRenderer::setBounds(CGRect bounds) +{ + [m_renderer.get() setBounds:bounds]; + + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [[m_renderer.get() layer] setFrame:bounds]; + [CATransaction commit]; +} + +void CoreAnimationRenderer::render(CFTimeInterval frameTime, CVTimeStamp* timeStamp, CFTimeInterval& nextFrameTime) +{ + [m_renderer.get() beginFrameAtTime:frameTime timeStamp:timeStamp]; + [m_renderer.get() render]; + nextFrameTime = [m_renderer.get() nextFrameTime]; + [m_renderer.get() endFrame]; +} + +void CoreAnimationRenderer::invalidate() +{ + ASSERT(m_client); + + WKCARendererRemoveChangeNotificationObserver(m_renderer.get(), rendererDidChange, this); + m_client = 0; +} + +void CoreAnimationRenderer::rendererDidChange(void* context) +{ + static_cast<CoreAnimationRenderer*>(context)->rendererDidChange(); +} + +void CoreAnimationRenderer::rendererDidChange() +{ + ASSERT(m_client); + + m_client->rendererDidChange(this); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm new file mode 100644 index 0000000..e4ad1ce --- /dev/null +++ b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm @@ -0,0 +1,66 @@ +/* + * 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 "LayerTreeContext.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" + +namespace WebKit { + +LayerTreeContext::LayerTreeContext() + : contextID(0) +{ +} + +LayerTreeContext::~LayerTreeContext() +{ +} + +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(contextID); +} + +bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& result) +{ + if (!decoder->decode(result.contextID)) + return false; + + return true; +} + +bool LayerTreeContext::isEmpty() const +{ + return !contextID; +} + +bool operator==(const LayerTreeContext& a, const LayerTreeContext& b) +{ + return a.contextID == b.contextID; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm index d69082d..c9f2a0a 100644 --- a/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm +++ b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "NativeWebKeyboardEvent.h" #import "WebEventFactory.h" diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.mm b/Source/WebKit2/Shared/mac/PasteboardTypes.mm index 380e24c..0d48464 100644 --- a/Source/WebKit2/Shared/mac/PasteboardTypes.mm +++ b/Source/WebKit2/Shared/mac/PasteboardTypes.mm @@ -23,7 +23,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "PasteboardTypes.h" + #import <wtf/RetainPtr.h> namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm index 0f3fee7..0c0b737 100644 --- a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "PlatformCertificateInfo.h" +#import "config.h" +#import "PlatformCertificateInfo.h" -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include <WebKitSystemInterface.h> -#include <Security/Security.h> +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" +#import <WebKitSystemInterface.h> +#import <Security/Security.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/mac/PrintInfoMac.mm b/Source/WebKit2/Shared/mac/PrintInfoMac.mm index 78cf9df..bb7792c 100644 --- a/Source/WebKit2/Shared/mac/PrintInfoMac.mm +++ b/Source/WebKit2/Shared/mac/PrintInfoMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "PrintInfo.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm index 68b5849..54cf5d3 100644 --- a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm +++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm @@ -23,16 +23,17 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(WEB_PROCESS_SANDBOX) +#import "config.h" +#import "SandboxExtension.h" -#include "SandboxExtension.h" +#if ENABLE(WEB_PROCESS_SANDBOX) -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include "DataReference.h" -#include "WebKitSystemInterface.h" -#include <WebCore/FileSystem.h> -#include <wtf/text/CString.h> +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" +#import "DataReference.h" +#import "WebKitSystemInterface.h" +#import <WebCore/FileSystem.h> +#import <wtf/text/CString.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/mac/ShareableSurface.cpp b/Source/WebKit2/Shared/mac/ShareableSurface.cpp new file mode 100644 index 0000000..4c15f5e --- /dev/null +++ b/Source/WebKit2/Shared/mac/ShareableSurface.cpp @@ -0,0 +1,215 @@ +/* + * 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 "ShareableSurface.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "MachPort.h" +#include <IOSurface/IOSurface.h> +#include <OpenGL/CGLIOSurface.h> +#include <OpenGL/CGLMacro.h> +#include <OpenGL/OpenGL.h> +#include <mach/mach_port.h> + +// The CGLMacro.h header adds an implicit CGLContextObj parameter to all OpenGL calls, +// which is good because it allows us to make OpenGL calls without saving and restoring the +// current context. The context argument is named "cgl_ctx" by default, so we the macro +// below to declare this variable. +#define DECLARE_GL_CONTEXT_VARIABLE(name) \ + CGLContextObj cgl_ctx = (name) + +// It expects a context named " +using namespace WebCore; + +namespace WebKit { + +ShareableSurface::Handle::Handle() + : m_port(MACH_PORT_NULL) +{ +} + +ShareableSurface::Handle::~Handle() +{ + if (m_port != MACH_PORT_NULL) + mach_port_deallocate(mach_task_self(), m_port); +} + +void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_MOVE_SEND)); + m_port = MACH_PORT_NULL; +} + +bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port == MACH_PORT_NULL); + + CoreIPC::MachPort machPort; + if (!decoder->decode(machPort)) + return false; + + handle.m_port = machPort.port(); + return false; +} + +static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size) +{ + int width = size.width(); + int height = size.height(); + + unsigned bytesPerElement = 4; + unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement); + if (!bytesPerRow) + return 0; + + unsigned long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow); + if (!allocSize) + return 0; + + unsigned pixelFormat = 'BGRA'; + + static const size_t numKeys = 6; + const void *keys[numKeys]; + const void *values[numKeys]; + keys[0] = kIOSurfaceWidth; + values[0] = CFNumberCreate(0, kCFNumberIntType, &width); + keys[1] = kIOSurfaceHeight; + values[1] = CFNumberCreate(0, kCFNumberIntType, &height); + keys[2] = kIOSurfacePixelFormat; + values[2] = CFNumberCreate(0, kCFNumberIntType, &pixelFormat); + keys[3] = kIOSurfaceBytesPerElement; + values[3] = CFNumberCreate(0, kCFNumberIntType, &bytesPerElement); + keys[4] = kIOSurfaceBytesPerRow; + values[4] = CFNumberCreate(0, kCFNumberLongType, &bytesPerRow); + keys[5] = kIOSurfaceAllocSize; + values[5] = CFNumberCreate(0, kCFNumberLongType, &allocSize); + + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, CFDictionaryCreate(0, keys, values, numKeys, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + for (unsigned i = 0; i < numKeys; i++) + CFRelease(values[i]); + + return RetainPtr<IOSurfaceRef>(AdoptCF, IOSurfaceCreate(dictionary.get())); +} + +PassRefPtr<ShareableSurface> ShareableSurface::create(CGLContextObj cglContextObj, const IntSize& size) +{ + RetainPtr<IOSurfaceRef> ioSurface = createIOSurface(size); + if (!ioSurface) + return 0; + + return adoptRef(new ShareableSurface(cglContextObj, size, ioSurface.get())); +} + +PassRefPtr<ShareableSurface> ShareableSurface::create(CGLContextObj cglContextObj, const Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port != MACH_PORT_NULL); + + RetainPtr<IOSurfaceRef> ioSurface(AdoptCF, IOSurfaceLookupFromMachPort(handle.m_port)); + if (!ioSurface) + return 0; + + IntSize size = IntSize(IOSurfaceGetWidth(ioSurface.get()), IOSurfaceGetHeight(ioSurface.get())); + + return adoptRef(new ShareableSurface(cglContextObj, size, ioSurface.get())); +} + +ShareableSurface::ShareableSurface(CGLContextObj cglContextObj, const IntSize& size, IOSurfaceRef ioSurface) + : m_cglContextObj(CGLRetainContext(cglContextObj)) + , m_size(size) + , m_textureID(0) + , m_frameBufferObjectID(0) + , m_ioSurface(ioSurface) +{ +} + +ShareableSurface::~ShareableSurface() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + if (m_textureID) + glDeleteTextures(1, &m_textureID); + + if (m_frameBufferObjectID) + glDeleteFramebuffersEXT(1, &m_frameBufferObjectID); + + CGLReleaseContext(m_cglContextObj); +} + +bool ShareableSurface::createHandle(Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port == MACH_PORT_NULL); + + mach_port_t port = IOSurfaceCreateMachPort(m_ioSurface.get()); + if (port == MACH_PORT_NULL) + return false; + + handle.m_port = port; + return true; +} + +void ShareableSurface::attach() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + if (!m_frameBufferObjectID) { + // Generate a frame buffer object. + glGenFramebuffersEXT(1, &m_frameBufferObjectID); + + // Associate it with the texture. + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBufferObjectID); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, textureID(), 0); + } else + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBufferObjectID); +} + +void ShareableSurface::detach() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +} + +unsigned ShareableSurface::textureID() +{ + if (m_textureID) + return m_textureID; + + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + // Generate a texture. + glGenTextures(1, &m_textureID); + + // Associate it with our IOSurface. + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, m_textureID); + CGLTexImageIOSurface2D(cgl_ctx, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA8, m_size.width(), m_size.height(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, m_ioSurface.get(), 0); + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 0); + + return m_textureID; +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Shared/mac/ShareableSurface.h b/Source/WebKit2/Shared/mac/ShareableSurface.h new file mode 100644 index 0000000..dda1364 --- /dev/null +++ b/Source/WebKit2/Shared/mac/ShareableSurface.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ShareableSurface_h +#define ShareableSurface_h + +#include <WebCore/IntSize.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +typedef struct _CGLContextObject* CGLContextObj; +typedef struct __IOSurface* IOSurfaceRef; + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class ShareableSurface : public RefCounted<ShareableSurface> { +public: + class Handle { + WTF_MAKE_NONCOPYABLE(Handle); + + public: + Handle(); + ~Handle(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Handle&); + + private: + friend class ShareableSurface; + + mutable mach_port_t m_port; + }; + + // Create a shareable surface with the given size. Returns 0 on failure. + static PassRefPtr<ShareableSurface> create(CGLContextObj, const WebCore::IntSize&); + + // Create a shareable surface from a handle. Returns 0 on failure. + static PassRefPtr<ShareableSurface> create(CGLContextObj, const Handle&); + + ~ShareableSurface(); + + bool createHandle(Handle&); + + unsigned textureID(); + + void attach(); + void detach(); + +private: + ShareableSurface(CGLContextObj, const WebCore::IntSize&, IOSurfaceRef); + + // The OpenGL context. + CGLContextObj m_cglContextObj; + + // The size of the surface. + WebCore::IntSize m_size; + + // The ID of the texture. + unsigned m_textureID; + + // The frame buffer object ID of the texture; used when the surface is used as a render destination. + unsigned m_frameBufferObjectID; + + RetainPtr<IOSurfaceRef> m_ioSurface; +}; + +} // namespace WebKit + +#endif // ShareableSurface_h diff --git a/Source/WebKit2/Shared/mac/UpdateChunk.cpp b/Source/WebKit2/Shared/mac/UpdateChunk.cpp index a9376db..76206fb 100644 --- a/Source/WebKit2/Shared/mac/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/mac/UpdateChunk.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm index 8ffba8a..63dd20d 100644 --- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm +++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebCoreArgumentCoders.h" +#import "config.h" +#import "WebCoreArgumentCoders.h" -#include "ArgumentCodersCF.h" -#include "WebKitSystemInterface.h" +#import "ArgumentCodersCF.h" +#import "WebKitSystemInterface.h" namespace CoreIPC { diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.h b/Source/WebKit2/Shared/mac/WebEventFactory.h index 7bc8d97..73fbed0 100644 --- a/Source/WebKit2/Shared/mac/WebEventFactory.h +++ b/Source/WebKit2/Shared/mac/WebEventFactory.h @@ -38,6 +38,10 @@ public: static WebMouseEvent createWebMouseEvent(NSEvent *event, NSView *windowView); static WebWheelEvent createWebWheelEvent(NSEvent *event, NSView *windowView); static WebKeyboardEvent createWebKeyboardEvent(NSEvent *event, NSView *windowView); + +#if ENABLE(GESTURE_EVENTS) + static WebGestureEvent createWebGestureEvent(NSEvent *event, NSView *windowView); +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm index 46ff906..e31c62e 100644 --- a/Source/WebKit2/Shared/mac/WebEventFactory.mm +++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebEventFactory.h" #import "WebKitSystemInterface.h" @@ -188,7 +189,22 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event) return WebWheelEvent::PhaseNone; #endif } - + +#if ENABLE(GESTURE_EVENTS) +static WebEvent::Type gestureEventTypeForEvent(NSEvent *event) +{ + switch ([event type]) { + case NSEventTypeBeginGesture: + return WebEvent::GestureScrollBegin; + case NSEventTypeEndGesture: + return WebEvent::GestureScrollEnd; + default: + ASSERT_NOT_REACHED(); + return WebEvent::GestureScrollEnd; + } +} +#endif + static inline String textFromEvent(NSEvent* event) { if ([event type] == NSFlagsChanged) @@ -1020,10 +1036,11 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windo } WebWheelEvent::Phase phase = phaseForEvent(event); + bool hasPreciseScrollingDeltas = continuous; WebEvent::Modifiers modifiers = modifiersForEvent(event); double timestamp = [event timestamp]; - return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, modifiers, timestamp); + return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, hasPreciseScrollingDeltas, modifiers, timestamp); } WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *) @@ -1044,4 +1061,17 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp); } +#if ENABLE(GESTURE_EVENTS) +WebGestureEvent WebEventFactory::createWebGestureEvent(NSEvent *event, NSView *windowView) +{ + WebEvent::Type type = gestureEventTypeForEvent(event); + NSPoint position = pointForEvent(event, windowView); + NSPoint globalPosition = globalPointForEvent(event); + WebEvent::Modifiers modifiers = modifiersForEvent(event); + double timestamp = [event timestamp]; + + return WebGestureEvent(type, IntPoint(position), IntPoint(globalPosition), modifiers, timestamp); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm index 5be52d4..ed12cc4 100644 --- a/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm +++ b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm @@ -23,18 +23,19 @@ * */ -#if ENABLE(MEMORY_SAMPLER) +#import "config.h" +#import "WebMemorySampler.h" -#include "WebMemorySampler.h" +#if ENABLE(MEMORY_SAMPLER) -#include <JavaScriptCore/MemoryStatistics.h> -#include <mach/mach.h> -#include <mach/task.h> -#include <mach/mach_types.h> -#include <malloc/malloc.h> -#include <runtime/JSLock.h> -#include <WebCore/JSDOMWindow.h> -#include <wtf/CurrentTime.h> +#import <JavaScriptCore/MemoryStatistics.h> +#import <mach/mach.h> +#import <mach/task.h> +#import <mach/mach_types.h> +#import <malloc/malloc.h> +#import <runtime/JSLock.h> +#import <WebCore/JSDOMWindow.h> +#import <wtf/CurrentTime.h> using namespace WebCore; using namespace JSC; @@ -115,9 +116,8 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const totalBytesCommitted += fastMallocBytesCommitted; JSLock lock(SilenceAssertionsOnly); - MarkedSpace::Statistics heapMemoryStats = heapStatistics(JSDOMWindow::commonJSGlobalData()); - size_t jscHeapBytesInUse = heapMemoryStats.size - heapMemoryStats.free; - size_t jscHeapBytesCommitted = heapMemoryStats.size; + size_t jscHeapBytesInUse = JSDOMWindow::commonJSGlobalData()->heap.size(); + size_t jscHeapBytesCommitted = JSDOMWindow::commonJSGlobalData()->heap.capacity(); totalBytesInUse += jscHeapBytesInUse; totalBytesCommitted += jscHeapBytesCommitted; diff --git a/Source/WebKit2/Shared/mac/WebURLRequestMac.mm b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm index a7196f7..4eda378 100644 --- a/Source/WebKit2/Shared/mac/WebURLRequestMac.mm +++ b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm @@ -23,7 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebURLRequest.h" +#import "config.h" +#import "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/WebURLResponseMac.mm b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm index ff5b6e6..6f44afc 100644 --- a/Source/WebKit2/Shared/mac/WebURLResponseMac.mm +++ b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm @@ -23,7 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebURLResponse.h" +#import "config.h" +#import "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.cpp b/Source/WebKit2/Shared/qt/CleanupHandler.cpp index 74c1d4c..1ec44d4 100644 --- a/Source/WebKit2/Shared/qt/CleanupHandler.cpp +++ b/Source/WebKit2/Shared/qt/CleanupHandler.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CleanupHandler.h" #include "MappedMemoryPool.h" diff --git a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp index d0d247c..9a2d666 100644 --- a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NativeWebKeyboardEvent.h" #include "WebEventFactoryQt.h" diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp index 184b0f8..36c45a2 100644 --- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include <QImage> diff --git a/Source/WebKit2/Shared/qt/UpdateChunk.cpp b/Source/WebKit2/Shared/qt/UpdateChunk.cpp index 4d8e62d..772d499 100644 --- a/Source/WebKit2/Shared/qt/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/qt/UpdateChunk.cpp @@ -25,11 +25,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" -#include "MappedMemoryPool.h" #include "WebCoreArgumentCoders.h" #include <QIODevice> #include <QImage> @@ -43,28 +43,35 @@ using namespace std; namespace WebKit { UpdateChunk::UpdateChunk() - : m_mappedMemory(0) { } UpdateChunk::UpdateChunk(const IntRect& rect) : m_rect(rect) - , m_mappedMemory(MappedMemoryPool::instance()->mapMemory(size())) + , m_sharedMemory(SharedMemory::create(size())) { } UpdateChunk::~UpdateChunk() { - if (m_mappedMemory) - m_mappedMemory->markFree(); } void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encode(m_rect); - encoder->encode(String(m_mappedMemory->mappedFileName())); + if (!m_sharedMemory) { + encoder->encode(false); + return; + } + + SharedMemory::Handle handle; + if (m_sharedMemory->createHandle(handle, SharedMemory::ReadOnly)) { + encoder->encode(true); + encoder->encode(handle); + } else + encoder->encode(false); - m_mappedMemory = 0; + m_sharedMemory = 0; } bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) @@ -74,16 +81,23 @@ bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) IntRect rect; if (!decoder->decode(rect)) return false; + chunk.m_rect = rect; - if (chunk.isEmpty()) - return true; // Successfully decoded empty chunk. + bool hasSharedMemory; + if (!decoder->decode(hasSharedMemory)) + return false; - String fileName; - if (!decoder->decode(fileName)) + if (!hasSharedMemory) { + chunk.m_sharedMemory = 0; + return true; + } + + SharedMemory::Handle handle; + if (!decoder->decode(handle)) return false; - chunk.m_mappedMemory = MappedMemoryPool::instance()->mapFile(fileName, chunk.size()); + chunk.m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); return true; } @@ -101,7 +115,10 @@ size_t UpdateChunk::size() const QImage UpdateChunk::createImage() const { - ASSERT(m_mappedMemory); + ASSERT(m_sharedMemory); + if (!m_sharedMemory) + return QImage(); + QImage::Format format; int bpp; if (QPixmap::defaultDepth() == 16) { @@ -112,7 +129,7 @@ QImage UpdateChunk::createImage() const bpp = 4; } - return QImage(m_mappedMemory->data(), m_rect.width(), m_rect.height(), (m_rect.width() * bpp + 3) & ~0x3, format); + return QImage(reinterpret_cast<unsigned char*>(m_sharedMemory->data()), m_rect.width(), m_rect.height(), (m_rect.width() * bpp + 3) & ~0x3, format); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/UpdateChunk.h b/Source/WebKit2/Shared/qt/UpdateChunk.h index f506ba7..664056a 100644 --- a/Source/WebKit2/Shared/qt/UpdateChunk.h +++ b/Source/WebKit2/Shared/qt/UpdateChunk.h @@ -29,6 +29,7 @@ #include <QImage> #include <WebCore/IntRect.h> +#include "SharedMemory.h" namespace CoreIPC { class ArgumentEncoder; @@ -37,8 +38,6 @@ class ArgumentDecoder; namespace WebKit { -class MappedMemory; - class UpdateChunk { public: UpdateChunk(); @@ -58,7 +57,7 @@ private: WebCore::IntRect m_rect; - mutable MappedMemory* m_mappedMemory; + mutable RefPtr<SharedMemory> m_sharedMemory; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp index 80ab3f9..44cdbea 100644 --- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp index 39a6455..8edc03c 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventFactoryQt.h" #include <qgraphicssceneevent.h> #include <QApplication> diff --git a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp index 834353a..717a4cc 100644 --- a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp +++ b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp index abc0c29..35625e3 100644 --- a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp +++ b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/CommandLineWin.cpp b/Source/WebKit2/Shared/win/CommandLineWin.cpp index 7d6c9e3..2e2798f 100644 --- a/Source/WebKit2/Shared/win/CommandLineWin.cpp +++ b/Source/WebKit2/Shared/win/CommandLineWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CommandLine.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp new file mode 100644 index 0000000..f1bf1b4 --- /dev/null +++ b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp @@ -0,0 +1,66 @@ +/* + * 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 "LayerTreeContext.h" + +#include "NotImplemented.h" + +namespace WebKit { + +LayerTreeContext::LayerTreeContext() +{ + notImplemented(); +} + +LayerTreeContext::~LayerTreeContext() +{ + notImplemented(); +} + +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder*) const +{ + notImplemented(); +} + +bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&) +{ + notImplemented(); + return true; +} + +bool LayerTreeContext::isEmpty() const +{ + notImplemented(); + return true; +} + +bool operator==(const LayerTreeContext&, const LayerTreeContext&) +{ + notImplemented(); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp index d947b87..37aaf5d 100644 --- a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp +++ b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NativeWebKeyboardEvent.h" #include "WebEventFactory.h" diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp index b88a7ef..ade2291 100644 --- a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PlatformCertificateInfo.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/win/UpdateChunk.cpp b/Source/WebKit2/Shared/win/UpdateChunk.cpp index 2aabead..236e279 100644 --- a/Source/WebKit2/Shared/win/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/win/UpdateChunk.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp index 95d7de2..684378a 100644 --- a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp +++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #if USE(CFNETWORK) diff --git a/Source/WebKit2/Shared/win/WebEventFactory.cpp b/Source/WebKit2/Shared/win/WebEventFactory.cpp index a4081fc..44a67fc 100644 --- a/Source/WebKit2/Shared/win/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/win/WebEventFactory.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventFactory.h" #include <windowsx.h> diff --git a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp index e64d451..4bbc10c 100644 --- a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp +++ b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp index 3b3f24c..e41c0f3 100644 --- a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp +++ b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index 15cb7ee..5ce3b1f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -1,5 +1,6 @@ /* * 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 @@ -230,4 +231,7 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis #include "WKAPICastWin.h" #endif +#if defined(BUILDING_GTK__) +#include "WKAPICastGtk.h" +#endif #endif // WKAPICast_h diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp index 0997577..5319c2a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKAuthenticationChallenge.h" #include "AuthenticationChallengeProxy.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp index 959f5c2..bcb175d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKAuthenticationDecisionListener.h" #include "AuthenticationDecisionListener.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp index c2343ca..d7af883 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBackForwardList.h" #include "WebBackForwardList.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp index 2165737..5f6a222 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBackForwardListItem.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index c207225..82bd13d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKContext.h" #include "WKContextPrivate.h" @@ -176,3 +177,8 @@ void WKContextStopMemorySampler(WKContextRef contextRef) { toImpl(contextRef)->stopMemorySampler(); } + +void WKContextSetDatabaseDirectory(WKContextRef contextRef, WKStringRef databaseDirectory) +{ + toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index 8bcb1b6..bcd24a5 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -54,6 +54,10 @@ WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKString WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); +// FIXME: This function is only effective if called before the Web process is launched. But +// we should really change this setting to be on WebPreferences and changeable at runtime. +WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp index 25e1185..997fd7a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKCredential.h" #include "WebCredential.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp index 226ef8c..c29d63c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKDatabaseManager.h" #include "WebDatabaseManagerProxy.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp index 8960e2a..45dea68 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKDownload.h" #include "DownloadProxy.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp index ae98831..842c534 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKFormSubmissionListener.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp index cce572a..af4006e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKFrame.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp index d44d0d3..3bb6730 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKFramePolicyListener.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp index ed399ad..3b75855 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKGeolocationManager.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp index ca52798..cd1757c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKGeolocationPermissionRequest.h" #include "GeolocationPermissionRequestProxy.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp index 7977369..5ce85c1 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKGeolocationPosition.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp index 7a87265..325db5a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKInspector.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp index 90eb142..fd0ddab 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKNavigationData.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp index 3cf89cf..8b78d6d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKOpenPanelParameters.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp index 5b143f2..8c79318 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKOpenPanelResultListener.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 82daa4b..1d5763f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKPage.h" #include "WKPagePrivate.h" @@ -290,6 +291,16 @@ WKSize WKPageFixedLayoutSize(WKPageRef pageRef) return toAPI(toImpl(pageRef)->fixedLayoutSize()); } +bool WKPageHasHorizontalScrollbar(WKPageRef pageRef) +{ + return toImpl(pageRef)->hasHorizontalScrollbar(); +} + +bool WKPageHasVerticalScrollbar(WKPageRef pageRef) +{ + return toImpl(pageRef)->hasVerticalScrollbar(); +} + void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) { toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount); @@ -429,3 +440,15 @@ void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose); } #endif + +void WKPageForceRepaint(WKPageRef pageRef, void* context, WKPageForceRepaintFunction callback) +{ + toImpl(pageRef)->forceRepaint(VoidCallback::create(context, callback)); +} + +WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef pageRef) +{ + if (toImpl(pageRef)->pendingAPIRequestURL().isNull()) + return 0; + return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index e4bf162..e6ebc5c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -60,6 +60,7 @@ typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo); typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); +typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo); struct WKPageLoaderClient { int version; @@ -91,14 +92,14 @@ struct WKPageLoaderClient { WKPageCallback processDidBecomeResponsive; WKPageCallback processDidCrash; - WKPageCallback didChangeBackForwardList; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; }; typedef struct WKPageLoaderClient WKPageLoaderClient; // Policy Client. -typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); -typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); -typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); struct WKPagePolicyClient { int version; @@ -120,7 +121,7 @@ struct WKPageFormClient { typedef struct WKPageFormClient WKPageFormClient; // Resource Load Client. -typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, const void* clientInfo); +typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, bool pageIsProvisionallyLoading, const void* clientInfo); typedef void (*WKPageDidSendRequestForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo); typedef void (*WKPageDidReceiveResponseForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLResponseRef response, const void* clientInfo); typedef void (*WKPageDidReceiveContentLengthForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo); @@ -167,6 +168,7 @@ typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, co typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); +typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page, WKSize initialOverhang, const void* clientInfo); struct WKPageUIClient { int version; @@ -203,6 +205,7 @@ struct WKPageUIClient { WKPageDrawFooterCallback drawFooter; WKPagePrintFrameCallback printFrame; WKPageCallback runModal; + WKPageDidCompleteRubberBandForMainFrameCallback didCompleteRubberBandForMainFrame; }; typedef struct WKPageUIClient WKPageUIClient; @@ -305,8 +308,11 @@ WK_EXPORT double WKPageGetScaleFactor(WKPageRef page); WK_EXPORT void WKPageSetUseFixedLayout(WKPageRef page, bool fixed); WK_EXPORT void WKPageSetFixedLayoutSize(WKPageRef page, WKSize size); -WK_EXPORT bool WKPageUseFixedLayout(WKPageRef pageRef); -WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef pageRef); +WK_EXPORT bool WKPageUseFixedLayout(WKPageRef page); +WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page); + +WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page); +WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page); WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); WK_EXPORT void WKPageHideFindUI(WKPageRef page); @@ -341,6 +347,11 @@ typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef); WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block); #endif +typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*); +WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function); + +WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp index 6c10014..8a4d86a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKPageGroup.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 379859c..97e9403 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKPreferences.h" #include "WKPreferencesPrivate.h" @@ -330,6 +331,16 @@ bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferen return toImpl(preferencesRef)->compositingRepaintCountersVisible(); } +void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setWebGLEnabled(flag); +} + +bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->webGLEnabled(); +} + void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag) { toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag); @@ -449,3 +460,13 @@ bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferencesRef) { return toImpl(preferencesRef)->domPasteAllowed(); } + +void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setJavaScriptCanAccessClipboard(enabled); +} + +bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptCanAccessClipboard(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index 8116575..5c6c478 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -146,6 +146,10 @@ WK_EXPORT bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef prefe WK_EXPORT void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferences, bool shouldPrintBackgrounds); WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferences); +// Defaults to false. +WK_EXPORT void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index 7408c8e..ff9beec 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -60,6 +60,10 @@ WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRe WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef); // Defaults to false. +WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef); + +// Defaults to false. WK_EXPORT void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef); diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp index c72ee98..7e764b9 100644 --- a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKProtectionSpace.h" #include "WebProtectionSpace.h" diff --git a/Source/WebKit2/UIProcess/API/C/WebKit2.h b/Source/WebKit2/UIProcess/API/C/WebKit2.h index 02a339f..47d7c7b 100644 --- a/Source/WebKit2/UIProcess/API/C/WebKit2.h +++ b/Source/WebKit2/UIProcess/API/C/WebKit2.h @@ -42,6 +42,7 @@ #include <WebKit2/WKGeolocationManager.h> #include <WebKit2/WKGeolocationPermissionRequest.h> #include <WebKit2/WKGeolocationPosition.h> +#include <WebKit2/WKGraphicsContext.h> #include <WebKit2/WKMutableArray.h> #include <WebKit2/WKMutableDictionary.h> #include <WebKit2/WKNavigationData.h> @@ -56,7 +57,9 @@ #include <WebKit2/WKURLRequest.h> #include <WebKit2/WKURLResponse.h> -#if !(defined(__APPLE__) && __APPLE__) || (defined(__OBJC__) && __OBJC__) +#if defined(__OBJC__) && __OBJC__ +#import <WebKit2/WKView.h> +#elif !(defined(__APPLE__) && __APPLE__) #include <WebKit2/WKView.h> #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h index b3c1289..79c1133 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h @@ -24,16 +24,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebDatabaseManager.h" +#ifndef WKAPICastGtk_h +#define WKAPICastGtk_h -#include "NotImplemented.h" +#ifndef WKAPICast_h +#error "Please #include \"WKAPICast.h\" instead of this file directly." +#endif namespace WebKit { -String WebDatabaseManager::databaseDirectory() const -{ - notImplemented(); - return String(); +class WebView; + +WK_ADD_API_MAPPING(WKViewRef, WebView) + } -} // namespace WebKit +#endif // WKAPICastGtk_h diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp new file mode 100644 index 0000000..aa88151 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKView.h" + +#include "WKAPICast.h" +#include "WebView.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/StringImpl.h> + +using namespace WebKit; +using namespace WebCore; + +WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef) +{ + RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef)); + return toAPI(view.release().leakRef()); +} + +GtkWidget* WKViewGetWindow(WKViewRef viewRef) +{ + return toImpl(viewRef)->window(); +} + +WKPageRef WKViewGetPage(WKViewRef viewRef) +{ + return toAPI(toImpl(viewRef)->page()); +} + +WKURLRef WKURLCreateWithURL(const char* url) +{ + return toCopiedURLAPI(StringImpl::create(url).leakRef()); +} diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h new file mode 100644 index 0000000..5415fd3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKView_h +#define WKView_h + +#include <WebKit2/WKBase.h> +#include <gtk/gtk.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef context, WKPageGroupRef pageGroup); + +WK_EXPORT GtkWidget* WKViewGetWindow(WKViewRef view); + +WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); + +WK_EXPORT WKURLRef WKURLCreateWithURL(const char*); +#ifdef __cplusplus +} +#endif + +#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp index 9906c81..110951f 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKContext.h" #include "WKContextPrivateWin.h" diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp index 612661e..62603fe 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKView.h" #include "WKAPICast.h" @@ -70,3 +71,13 @@ void WKViewSetInitialFocus(WKViewRef viewRef, bool forward) { toImpl(viewRef)->setInitialFocus(forward); } + +void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context) +{ + toImpl(viewRef)->setFindIndicatorCallback(callback, context); +} + +WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context) +{ + return toImpl(viewRef)->getFindIndicatorCallback(context); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h index f4226cd..213897e 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -46,6 +46,10 @@ WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view); WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow); WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward); +typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*); +WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context); +WK_EXPORT WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef view, void** context); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp index 00c3595..7b3cf6e 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp +++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKViewPrivate.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp index 0f2c946..f2f1883 100644 --- a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp @@ -18,6 +18,7 @@ * */ +#include "config.h" #include "WKStringQt.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp index 74eca86..f9111f7 100644 --- a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp @@ -18,6 +18,7 @@ * */ +#include "config.h" #include "WKURLQt.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm index 5b93a9e..e622c9d 100644 --- a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm +++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "FindIndicatorWindow.h" +#import "config.h" +#import "FindIndicatorWindow.h" -#include "FindIndicator.h" -#include <WebCore/GraphicsContext.h> +#import "FindIndicator.h" +#import <WebCore/GraphicsContext.h> static const double bounceAnimationDuration = 0.12; static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2; diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm index a92c2d4..6ab425d 100644 --- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm +++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "PDFViewController.h" #import "DataReference.h" diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h index 625b8f6..b557c1a 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h @@ -60,6 +60,7 @@ private: virtual bool isViewInWindow(); virtual void processDidCrash(); + virtual void pageClosed(); virtual void didRelaunchProcess(); virtual void takeFocus(bool direction); virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip); @@ -75,23 +76,29 @@ private: virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); - virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&); + virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled); virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut); + virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); + virtual void exitAcceleratedCompositingMode(); + #if USE(ACCELERATED_COMPOSITING) virtual void pageDidEnterAcceleratedCompositing(); virtual void pageDidLeaveAcceleratedCompositing(); #endif - virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&); + virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&); virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled); + virtual void setAutodisplay(bool); virtual CGContextRef containingWindowGraphicsContext(); + virtual void didChangeScrollbarsForMainFrame() const; + virtual void didCommitLoadForMainFrame(bool useCustomRepresentation); virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index 60be5bc..fd70a67 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -23,11 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#import "NativeWebKeyboardEvent.h" +#import "config.h" #import "PageClientImpl.h" #import "DataReference.h" #import "FindIndicator.h" +#import "NativeWebKeyboardEvent.h" #import "WKAPICast.h" #import "WKStringCF.h" #import "WKViewInternal.h" @@ -43,6 +44,10 @@ #import <wtf/text/CString.h> #import <wtf/text/WTFString.h> +@interface NSApplication (WebNSApplicationDetails) +- (NSCursor *)_cursorRectCursor; +@end + using namespace WebCore; @interface WebEditCommandObjC : NSObject @@ -177,6 +182,11 @@ void PageClientImpl::processDidCrash() { [m_wkView _processDidCrash]; } + +void PageClientImpl::pageClosed() +{ + [m_wkView _pageClosed]; +} void PageClientImpl::didRelaunchProcess() { @@ -195,7 +205,8 @@ void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newT void PageClientImpl::setCursor(const WebCore::Cursor& cursor) { - [m_wkView _setCursor:cursor.platformCursor()]; + if (![NSApp _cursorRectCursor]) + [m_wkView _setCursor:cursor.platformCursor()]; } void PageClientImpl::setViewportArguments(const WebCore::ViewportArguments&) @@ -297,10 +308,14 @@ FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect) return [m_wkView _convertToUserSpace:rect]; } -void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event) +void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled) { NSEvent* nativeEvent = event.nativeEvent(); - if ([nativeEvent type] == NSKeyDown) { + if ([nativeEvent type] != NSKeyDown) + return; + if (wasEventHandled) + [NSCursor setHiddenUntilMouseMoves:YES]; + else { [m_wkView _setEventBeingResent:nativeEvent]; [[NSApplication sharedApplication] sendEvent:nativeEvent]; } @@ -321,13 +336,23 @@ void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, b [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut]; } -void PageClientImpl::accessibilityChildTokenReceived(const CoreIPC::DataReference& data) +void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataReference& data) { NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; - [m_wkView _setAccessibilityChildToken:remoteToken]; + [m_wkView _setAccessibilityWebProcessToken:remoteToken]; } #if USE(ACCELERATED_COMPOSITING) +void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) +{ + [m_wkView _enterAcceleratedCompositingMode:layerTreeContext]; +} + +void PageClientImpl::exitAcceleratedCompositingMode() +{ + [m_wkView _exitAcceleratedCompositingMode]; +} + void PageClientImpl::pageDidEnterAcceleratedCompositing() { [m_wkView _pageDidEnterAcceleratedCompositing]; @@ -344,11 +369,24 @@ void PageClientImpl::setComplexTextInputEnabled(uint64_t pluginComplexTextInputI [m_wkView _setComplexTextInputEnabled:complexTextInputEnabled pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; } +void PageClientImpl::setAutodisplay(bool newState) +{ + if (!newState && [[m_wkView window] isAutodisplay]) + [m_wkView displayIfNeeded]; + + [[m_wkView window] setAutodisplay:newState]; +} + CGContextRef PageClientImpl::containingWindowGraphicsContext() { return static_cast<CGContextRef>([[[m_wkView window] graphicsContext] graphicsPort]); } +void PageClientImpl::didChangeScrollbarsForMainFrame() const +{ + [m_wkView _didChangeScrollbarsForMainFrame]; +} + void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation) { [m_wkView _setPageHasCustomRepresentation:useCustomRepresentation]; diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h new file mode 100644 index 0000000..3f7a692 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.h @@ -0,0 +1,61 @@ +/* + * 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 <WebCore/IntRectHash.h> +#import <wtf/RetainPtr.h> + +@class WKPrintingViewData; + +namespace WebKit { + class WebFrameProxy; +} + +@interface WKPrintingView : NSView { +@public + NSPrintOperation *_printOperation; // WKPrintingView is owned by the operation. + + RefPtr<WebKit::WebFrameProxy> _webFrame; + Vector<WebCore::IntRect> _printingPageRects; + double _totalScaleFactorForPrinting; + HashMap<WebCore::IntRect, Vector<uint8_t> > _pagePreviews; + + Vector<uint8_t> _printedPagesData; + RetainPtr<CGPDFDocumentRef> _printedPagesPDFDocument; + + uint64_t _expectedComputedPagesCallback; + HashMap<uint64_t, WebCore::IntRect> _expectedPreviewCallbacks; + uint64_t _latestExpectedPreviewCallback; + uint64_t _expectedPrintCallback; + + BOOL _isPrintingFromSecondaryThread; + Mutex _printingCallbackMutex; + ThreadCondition _printingCallbackCondition; + + NSTimer *_autodisplayResumeTimer; +} + +- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame; + +@end diff --git a/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm new file mode 100644 index 0000000..28ba153 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm @@ -0,0 +1,585 @@ +/* + * 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 "WKPrintingView.h" + +#import "Logging.h" +#import "PrintInfo.h" +#import "WebData.h" +#import "WebPageProxy.h" + +using namespace WebKit; +using namespace WebCore; + +NSString * const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin"; +NSString * const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin"; + +NSString * const NSPrintInfoDidChangeNotification = @"NSPrintInfoDidChange"; + +static BOOL isForcingPreviewUpdate; + +@implementation WKPrintingView + +- (id)initWithFrameProxy:(WebFrameProxy*)frame +{ + self = [super init]; // No frame rect to pass to NSView. + if (!self) + return nil; + + _webFrame = frame; + + return self; +} + +- (BOOL)isFlipped +{ + return YES; +} + +- (void)_suspendAutodisplay +{ + // A drawRect: call on WKView causes a switch to screen mode, which is slow due to relayout, and we want to avoid that. + // Disabling autodisplay will prevent random updates from causing this, but resizing the window will still work. + if (_autodisplayResumeTimer) { + [_autodisplayResumeTimer invalidate]; + _autodisplayResumeTimer = nil; + } else + _webFrame->page()->setAutodisplay(false); +} + +- (void)_delayedResumeAutodisplayTimerFired +{ + ASSERT(isMainThread()); + + _autodisplayResumeTimer = nil; + _webFrame->page()->setAutodisplay(true); +} + +- (void)_delayedResumeAutodisplay +{ + // AppKit calls endDocument/beginDocument when print option change. We don't want to switch between print and screen mode just for that, + // and enabling autodisplay may result in switching into screen mode. So, autodisplay is only resumed on next run loop iteration. + if (!_autodisplayResumeTimer) { + _autodisplayResumeTimer = [NSTimer timerWithTimeInterval:0 target:self selector:@selector(_delayedResumeAutodisplayTimerFired) userInfo:nil repeats:NO]; + // The timer must be scheduled on main thread, because printing thread may finish before it fires. + [[NSRunLoop mainRunLoop] addTimer:_autodisplayResumeTimer forMode:NSDefaultRunLoopMode]; + } +} + +- (void)_adjustPrintingMarginsForHeaderAndFooter +{ + NSPrintInfo *info = [_printOperation printInfo]; + NSMutableDictionary *infoDictionary = [info dictionary]; + + // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the + // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087), + // we stash away the unmodified top and bottom margins the first time this method is called, and we read from + // those stashed-away values on subsequent calls. + double originalTopMargin; + double originalBottomMargin; + NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey]; + if (!originalTopMarginNumber) { + ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]); + originalTopMargin = [info topMargin]; + originalBottomMargin = [info bottomMargin]; + [infoDictionary setObject:[NSNumber numberWithDouble:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey]; + [infoDictionary setObject:[NSNumber numberWithDouble:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey]; + } else { + ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]); + ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]); + originalTopMargin = [originalTopMarginNumber doubleValue]; + originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] doubleValue]; + } + + CGFloat scale = [info scalingFactor]; + [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(_webFrame.get()) * scale]; + [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(_webFrame.get()) * scale]; +} + +- (BOOL)_isPrintingPreview +{ + // <rdar://problem/8901041> Please add an API returning whether the current print operation is for preview. + // Assuming that if NSPrintOperation is allowed to spawn a thread for printing, it will. Print preview doesn't spawn a thread. + return !_isPrintingFromSecondaryThread; +} + +- (void)_updatePreview +{ + // <rdar://problem/8900923> Please add an API to force print preview update. + ASSERT(!isForcingPreviewUpdate); + isForcingPreviewUpdate = YES; + [[NSNotificationCenter defaultCenter] postNotificationName:NSPrintInfoDidChangeNotification object:nil]; + isForcingPreviewUpdate = NO; +} + +- (BOOL)_hasPageRects +{ + // WebCore always prints at least one page. + return !_printingPageRects.isEmpty(); +} + +- (NSUInteger)_firstPrintedPageNumber +{ + // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion. + return [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue]; +} + +- (NSUInteger)_lastPrintedPageNumber +{ + ASSERT([self _hasPageRects]); + + // Need to directly access the dictionary because -[NSPrintOperation pageRange] verifies pagination, potentially causing recursion. + NSUInteger firstPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintFirstPage] unsignedIntegerValue]; + NSUInteger lastPage = [[[[_printOperation printInfo] dictionary] objectForKey:NSPrintLastPage] unsignedIntegerValue]; + if (lastPage - firstPage >= _printingPageRects.size()) + return _printingPageRects.size(); + return lastPage; +} + +- (uint64_t)_expectedPreviewCallbackForRect:(const IntRect&)rect +{ + for (HashMap<uint64_t, WebCore::IntRect>::iterator iter = _expectedPreviewCallbacks.begin(); iter != _expectedPreviewCallbacks.end(); ++iter) { + if (iter->second == rect) + return iter->first; + } + return 0; +} + +struct IPCCallbackContext { + RetainPtr<WKPrintingView> view; + uint64_t callbackID; +}; + +static void pageDidDrawToPDF(WKDataRef dataRef, WKErrorRef, void* untypedContext) +{ + ASSERT(isMainThread()); + + OwnPtr<IPCCallbackContext> context = adoptPtr(static_cast<IPCCallbackContext*>(untypedContext)); + WKPrintingView *view = context->view.get(); + WebData* data = toImpl(dataRef); + + if (context->callbackID == view->_expectedPrintCallback) { + ASSERT(![view _isPrintingPreview]); + ASSERT(view->_printedPagesData.isEmpty()); + ASSERT(!view->_printedPagesPDFDocument); + if (data) + view->_printedPagesData.append(data->bytes(), data->size()); + view->_expectedPrintCallback = 0; + view->_printingCallbackCondition.signal(); + } else { + // If the user has already changed print setup, then this response is obsolete. And this callback is not in response to the latest request, + // then the user has already moved to another page - we'll cache the response, but won't draw it. + HashMap<uint64_t, WebCore::IntRect>::iterator iter = view->_expectedPreviewCallbacks.find(context->callbackID); + if (iter != view->_expectedPreviewCallbacks.end()) { + ASSERT([view _isPrintingPreview]); + + if (data) { + pair<HashMap<WebCore::IntRect, Vector<uint8_t> >::iterator, bool> entry = view->_pagePreviews.add(iter->second, Vector<uint8_t>()); + entry.first->second.append(data->bytes(), data->size()); + } + bool receivedResponseToLatestRequest = view->_latestExpectedPreviewCallback == context->callbackID; + view->_latestExpectedPreviewCallback = 0; + view->_expectedPreviewCallbacks.remove(context->callbackID); + if (receivedResponseToLatestRequest) + [view _updatePreview]; + } + } +} + +- (void)_preparePDFDataForPrintingOnSecondaryThread +{ + ASSERT(isMainThread()); + + if (!_webFrame->page()) { + _printingCallbackCondition.signal(); + return; + } + + MutexLocker lock(_printingCallbackMutex); + + ASSERT([self _hasPageRects]); + ASSERT(_printedPagesData.isEmpty()); + ASSERT(!_printedPagesPDFDocument); + ASSERT(!_expectedPrintCallback); + + NSUInteger firstPage = [self _firstPrintedPageNumber]; + NSUInteger lastPage = [self _lastPrintedPageNumber]; + + ASSERT(firstPage > 0); + ASSERT(firstPage <= lastPage); + LOG(View, "WKPrintingView requesting PDF data for pages %u...%u", firstPage, lastPage); + + // Return to printing mode if we're already back to screen (e.g. due to window resizing). + _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo])); + + IPCCallbackContext* context = new IPCCallbackContext; + RefPtr<DataCallback> callback = DataCallback::create(context, pageDidDrawToPDF); + _expectedPrintCallback = callback->callbackID(); + + context->view = self; + context->callbackID = callback->callbackID(); + + _webFrame->page()->drawPagesToPDF(_webFrame.get(), firstPage - 1, lastPage - firstPage + 1, callback.get()); +} + +static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, WKErrorRef, void* untypedContext) +{ + ASSERT(isMainThread()); + + OwnPtr<IPCCallbackContext> context = adoptPtr(static_cast<IPCCallbackContext*>(untypedContext)); + WKPrintingView *view = context->view.get(); + + // If the user has already changed print setup, then this response is obsolete. + if (context->callbackID == view->_expectedComputedPagesCallback) { + ASSERT(isMainThread()); + ASSERT(view->_expectedPreviewCallbacks.isEmpty()); + ASSERT(!view->_latestExpectedPreviewCallback); + ASSERT(!view->_expectedPrintCallback); + ASSERT(view->_pagePreviews.isEmpty()); + view->_expectedComputedPagesCallback = 0; + + view->_printingPageRects = pageRects; + view->_totalScaleFactorForPrinting = totalScaleFactorForPrinting; + + const IntRect& lastPrintingPageRect = view->_printingPageRects[view->_printingPageRects.size() - 1]; + NSRect newFrameSize = NSMakeRect(0, 0, + ceil(lastPrintingPageRect.maxX() * view->_totalScaleFactorForPrinting), + ceil(lastPrintingPageRect.maxY() * view->_totalScaleFactorForPrinting)); + LOG(View, "WKPrintingView setting frame size to x:%g y:%g width:%g height:%g", newFrameSize.origin.x, newFrameSize.origin.y, newFrameSize.size.width, newFrameSize.size.height); + [view setFrame:newFrameSize]; + + if ([view _isPrintingPreview]) { + // Show page count, and ask for an actual image to replace placeholder. + [view _updatePreview]; + } else { + // When printing, request everything we'll need beforehand. + [view _preparePDFDataForPrintingOnSecondaryThread]; + } + } +} + +- (BOOL)_askPageToComputePageRects +{ + ASSERT(isMainThread()); + + if (!_webFrame->page()) + return NO; + + ASSERT(!_expectedComputedPagesCallback); + + IPCCallbackContext* context = new IPCCallbackContext; + RefPtr<ComputedPagesCallback> callback = ComputedPagesCallback::create(context, pageDidComputePageRects); + _expectedComputedPagesCallback = callback->callbackID(); + context->view = self; + context->callbackID = _expectedComputedPagesCallback; + + _webFrame->page()->computePagesForPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo]), callback.release()); + return YES; +} + +static void prepareDataForPrintingOnSecondaryThread(void* untypedContext) +{ + ASSERT(isMainThread()); + + WKPrintingView *view = static_cast<WKPrintingView *>(untypedContext); + MutexLocker lock(view->_printingCallbackMutex); + + // We may have received page rects while a message to call this function traveled from secondary thread to main one. + if ([view _hasPageRects]) { + [view _preparePDFDataForPrintingOnSecondaryThread]; + return; + } + + // A request for pages has already been made, just wait for it to finish. + if (view->_expectedComputedPagesCallback) + return; + + [view _askPageToComputePageRects]; +} + +- (BOOL)knowsPageRange:(NSRangePointer)range +{ + LOG(View, "-[WKPrintingView %p knowsPageRange:], %s, %s", self, [self _hasPageRects] ? "print data is available" : "print data is not available yet", isMainThread() ? "on main thread" : "on secondary thread"); + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + + // Assuming that once we switch to printing from a secondary thread, we don't go back. + ASSERT(!_isPrintingFromSecondaryThread || !isMainThread()); + if (!isMainThread()) + _isPrintingFromSecondaryThread = YES; + + [self _suspendAutodisplay]; + + [self _adjustPrintingMarginsForHeaderAndFooter]; + + if ([self _hasPageRects]) + *range = NSMakeRange(1, _printingPageRects.size()); + else if (!isMainThread()) { + ASSERT(![self _isPrintingPreview]); + MutexLocker lock(_printingCallbackMutex); + callOnMainThread(prepareDataForPrintingOnSecondaryThread, self); + _printingCallbackCondition.wait(_printingCallbackMutex); + *range = NSMakeRange(1, _printingPageRects.size()); + } else { + ASSERT([self _isPrintingPreview]); + + // If a request for pages hasn't already been made, make it now. + if (!_expectedComputedPagesCallback) + [self _askPageToComputePageRects]; + + *range = NSMakeRange(1, NSIntegerMax); + } + return YES; +} + +- (unsigned)_pageForRect:(NSRect)rect +{ + // Assuming that rect exactly matches one of the pages. + for (size_t i = 0; i < _printingPageRects.size(); ++i) { + IntRect currentRect(_printingPageRects[i]); + currentRect.scale(_totalScaleFactorForPrinting); + if (rect.origin.y == currentRect.y() && rect.origin.x == currentRect.x()) + return i + 1; + } + ASSERT_NOT_REACHED(); + return 0; // Invalid page number. +} + +- (void)_drawPDFDocument:(CGPDFDocumentRef)pdfDocument page:(unsigned)page atPoint:(NSPoint)point +{ + if (!pdfDocument) { + LOG_ERROR("Couldn't create a PDF document with data passed for preview"); + return; + } + + CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument, page); + if (!pdfPage) { + LOG_ERROR("Preview data doesn't have page %d", page); + return; + } + + NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext]; + CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]); + + CGContextSaveGState(context); + CGContextTranslateCTM(context, point.x, point.y); + CGContextScaleCTM(context, _totalScaleFactorForPrinting, -_totalScaleFactorForPrinting); + CGContextTranslateCTM(context, 0, -CGPDFPageGetBoxRect(pdfPage, kCGPDFMediaBox).size.height); + CGContextDrawPDFPage(context, pdfPage); + CGContextRestoreGState(context); +} + +- (void)_drawPreview:(NSRect)nsRect +{ + ASSERT(isMainThread()); + + IntRect rect(nsRect); + rect.scale(1 / _totalScaleFactorForPrinting); + HashMap<WebCore::IntRect, Vector<uint8_t> >::iterator pagePreviewIterator = _pagePreviews.find(rect); + if (pagePreviewIterator == _pagePreviews.end()) { + // It's too early to ask for page preview if we don't even know page size and scale. + if ([self _hasPageRects]) { + if (uint64_t existingCallback = [self _expectedPreviewCallbackForRect:rect]) { + // We've already asked for a preview of this page, and are waiting for response. + // There is no need to ask again. + _latestExpectedPreviewCallback = existingCallback; + } else { + // Preview isn't available yet, request it asynchronously. + if (!_webFrame->page()) + return; + + // Return to printing mode if we're already back to screen (e.g. due to window resizing). + _webFrame->page()->beginPrinting(_webFrame.get(), PrintInfo([_printOperation printInfo])); + + IPCCallbackContext* context = new IPCCallbackContext; + RefPtr<DataCallback> callback = DataCallback::create(context, pageDidDrawToPDF); + _latestExpectedPreviewCallback = callback->callbackID(); + _expectedPreviewCallbacks.add(_latestExpectedPreviewCallback, rect); + + context->view = self; + context->callbackID = callback->callbackID(); + + _webFrame->page()->drawRectToPDF(_webFrame.get(), rect, callback.get()); + return; + } + } + + // FIXME: Draw a placeholder + return; + } + + const Vector<uint8_t>& pdfData = pagePreviewIterator->second; + RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, pdfData.data(), pdfData.size(), 0)); + RetainPtr<CGPDFDocumentRef> pdfDocument(AdoptCF, CGPDFDocumentCreateWithProvider(pdfDataProvider.get())); + + [self _drawPDFDocument:pdfDocument.get() page:1 atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)]; +} + +- (void)drawRect:(NSRect)nsRect +{ + LOG(View, "WKPrintingView %p printing rect x:%g, y:%g, width:%g, height:%g%s", self, nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height, [self _isPrintingPreview] ? " for preview" : ""); + + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + + if (!_webFrame->page()) + return; + + if ([self _isPrintingPreview]) { + [self _drawPreview:nsRect]; + return; + } + + ASSERT(!isMainThread()); + ASSERT(!_printedPagesData.isEmpty()); // Prepared by knowsPageRange: + + if (!_printedPagesPDFDocument) { + RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, _printedPagesData.data(), _printedPagesData.size(), 0)); + _printedPagesPDFDocument.adoptCF(CGPDFDocumentCreateWithProvider(pdfDataProvider.get())); + } + + unsigned printedPageNumber = [self _pageForRect:nsRect] - [self _firstPrintedPageNumber] + 1; + [self _drawPDFDocument:_printedPagesPDFDocument.get() page:printedPageNumber atPoint:NSMakePoint(nsRect.origin.x, nsRect.origin.y)]; +} + +- (void)_drawPageBorderWithSizeOnMainThread:(NSSize)borderSize +{ + ASSERT(isMainThread()); + + // When printing from a secondary thread, the main thread doesn't have graphics context and printing operation set up. + NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; + [NSGraphicsContext setCurrentContext:[_printOperation context]]; + + ASSERT(![NSPrintOperation currentOperation]); + [NSPrintOperation setCurrentOperation:_printOperation]; + + [self drawPageBorderWithSize:borderSize]; + + [NSPrintOperation setCurrentOperation:nil]; + [NSGraphicsContext setCurrentContext:currentContext]; +} + +- (void)drawPageBorderWithSize:(NSSize)borderSize +{ + ASSERT(NSEqualSizes(borderSize, [[_printOperation printInfo] paperSize])); + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + + if (!isMainThread()) { + // Don't call the client from a secondary thread. + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[WKPrintingView instanceMethodSignatureForSelector:@selector(_drawPageBorderWithSizeOnMainThread:)]]; + [invocation setSelector:@selector(_drawPageBorderWithSizeOnMainThread:)]; + [invocation setArgument:&borderSize atIndex:2]; + [invocation performSelectorOnMainThread:@selector(invokeWithTarget:) withObject:self waitUntilDone:YES]; + return; + } + + if (!_webFrame->page()) + return; + + // The header and footer rect height scales with the page, but the width is always + // all the way across the printed page (inset by printing margins). + NSPrintInfo *printInfo = [_printOperation printInfo]; + CGFloat scale = [printInfo scalingFactor]; + NSSize paperSize = [printInfo paperSize]; + CGFloat headerFooterLeft = [printInfo leftMargin] / scale; + CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale; + NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(_webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get())); + NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(_webFrame.get())); + + NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; + [currentContext saveGraphicsState]; + NSRectClip(headerRect); + _webFrame->page()->drawHeader(_webFrame.get(), headerRect); + [currentContext restoreGraphicsState]; + + [currentContext saveGraphicsState]; + NSRectClip(footerRect); + _webFrame->page()->drawFooter(_webFrame.get(), footerRect); + [currentContext restoreGraphicsState]; +} + +- (NSRect)rectForPage:(NSInteger)page +{ + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + if (![self _hasPageRects]) { + LOG(View, "-[WKPrintingView %p rectForPage:%d] - data is not yet available", self, (int)page); + // We must be still calculating the page range. + ASSERT(_expectedComputedPagesCallback); + return NSMakeRect(0, 0, 1, 1); + } + + IntRect rect = _printingPageRects[page - 1]; + rect.scale(_totalScaleFactorForPrinting); + LOG(View, "-[WKPrintingView %p rectForPage:%d] -> x %d, y %d, width %d, height %d", self, (int)page, rect.x(), rect.y(), rect.width(), rect.height()); + return rect; +} + +// Temporary workaround for <rdar://problem/8944535>. Force correct printout positioning. +- (NSPoint)locationOfPrintRect:(NSRect)aRect +{ + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + return NSMakePoint([[_printOperation printInfo] leftMargin], [[_printOperation printInfo] bottomMargin]); +} + +- (void)beginDocument +{ + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + + // Forcing preview update gets us here, but page setup hasn't actually changed. + if (isForcingPreviewUpdate) + return; + + LOG(View, "-[WKPrintingView %p beginDocument]", self); + + [super beginDocument]; + + [self _suspendAutodisplay]; +} + +- (void)endDocument +{ + ASSERT(_printOperation == [NSPrintOperation currentOperation]); + + // Forcing preview update gets us here, but page setup hasn't actually changed. + if (isForcingPreviewUpdate) + return; + + LOG(View, "-[WKPrintingView %p endDocument] - clearing cached data", self); + + // Both existing data and pending responses are now obsolete. + _printingPageRects.clear(); + _totalScaleFactorForPrinting = 1; + _pagePreviews.clear(); + _printedPagesData.clear(); + _printedPagesPDFDocument = nullptr; + _expectedComputedPagesCallback = 0; + _expectedPreviewCallbacks.clear(); + _latestExpectedPreviewCallback = 0; + _expectedPrintCallback = 0; + + [self _delayedResumeAutodisplay]; + + [super endDocument]; +} +@end diff --git a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm index b7dae31..3b69a1d 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm @@ -23,9 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKTextInputWindowController.h" +#import "config.h" +#import "WKTextInputWindowController.h" -#include <WebKitSystemInterface.h> +#import <WebKitSystemInterface.h> @interface WKTextInputPanel : NSPanel { NSTextView *_inputTextView; diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.h b/Source/WebKit2/UIProcess/API/mac/WKView.h index 618bbc4..8c1826c 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.h +++ b/Source/WebKit2/UIProcess/API/mac/WKView.h @@ -31,6 +31,7 @@ WK_EXPORT @interface WKView : NSView <NSTextInput> { WKViewData *_data; + unsigned _frameSizeUpdatesDisabledCount; } - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef; @@ -39,6 +40,8 @@ WK_EXPORT - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef; - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef; +- (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset; + @property(readonly) WKPageRef pageRef; @property BOOL drawsBackground; diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 400239d..da29e04 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WKView.h" #import "ChunkedUpdateDrawingAreaProxy.h" @@ -31,19 +32,22 @@ #import "FindIndicator.h" #import "FindIndicatorWindow.h" #import "LayerBackedDrawingAreaProxy.h" +#import "LayerTreeContext.h" #import "Logging.h" #import "NativeWebKeyboardEvent.h" #import "PDFViewController.h" #import "PageClientImpl.h" #import "PasteboardTypes.h" -#import "PrintInfo.h" #import "Region.h" #import "RunLoop.h" #import "TextChecker.h" #import "TextCheckerState.h" #import "WKAPICast.h" +#import "WKPrintingView.h" #import "WKStringCF.h" #import "WKTextInputWindowController.h" +#import "WKViewInternal.h" +#import "WKViewPrivate.h" #import "WebContext.h" #import "WebEventFactory.h" #import "WebPage.h" @@ -71,12 +75,9 @@ - (void)speakString:(NSString *)string; @end -@interface NSView (Details) -- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView; -@end - @interface NSWindow (Details) - (NSRect)_growBoxRect; +- (void)_setShowOpaqueGrowBoxForOwner:(id)owner; - (BOOL)_updateGrowBoxForWindowFrameChange; @end @@ -97,9 +98,6 @@ typedef HashMap<String, ValidationVector> ValidationMap; } -NSString* const WebKitOriginalTopPrintingMarginKey = @"WebKitOriginalTopMargin"; -NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMargin"; - @interface WKViewData : NSObject { @public OwnPtr<PageClientImpl> _pageClient; @@ -110,8 +108,11 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa id _trackingRectOwner; void* _trackingRectUserData; + RetainPtr<NSView> _layerHostingView; + + // FIXME: Remove _oldLayerHostingView. #if USE(ACCELERATED_COMPOSITING) - NSView *_layerHostingView; + NSView *_oldLayerHostingView; #endif RetainPtr<id> _remoteAccessibilityChild; @@ -128,6 +129,8 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa NSEvent *_keyDownEventBeingResent; Vector<KeypressCommand> _commandsList; + NSSize _resizeScrollOffset; + // The identifier of the plug-in we want to send complex text input to, or 0 if there is none. uint64_t _pluginComplexTextInputIdentifier; @@ -135,50 +138,21 @@ NSString* const WebKitOriginalBottomPrintingMarginKey = @"WebKitOriginalBottomMa unsigned _selectionStart; unsigned _selectionEnd; - Vector<IntRect> _printingPageRects; - double _totalScaleFactorForPrinting; - bool _inBecomeFirstResponder; bool _inResignFirstResponder; NSEvent *_mouseDownEvent; BOOL _ignoringMouseDraggedEvents; BOOL _dragHasStarted; -} -@end -@implementation WKViewData -@end - -@interface WebFrameWrapper : NSObject { -@public - RefPtr<WebFrameProxy> _frame; +#if ENABLE(GESTURE_EVENTS) + id _endGestureMonitor; +#endif } - -- (id)initWithFrameProxy:(WebFrameProxy*)frame; -- (WebFrameProxy*)webFrame; @end -@implementation WebFrameWrapper - -- (id)initWithFrameProxy:(WebFrameProxy*)frame -{ - self = [super init]; - if (!self) - return nil; - - _frame = frame; - return self; -} - -- (WebFrameProxy*)webFrame -{ - return _frame.get(); -} - +@implementation WKViewData @end -NSString * const PrintedFrameKey = @"WebKitPrintedFrameKey"; - @interface NSObject (NSTextInputContextDetails) - (BOOL)wantsToHandleMouseEvents; - (BOOL)handleMouseEvent:(NSEvent *)event; @@ -186,11 +160,10 @@ NSString * const PrintedFrameKey = @"WebKitPrintedFrameKey"; @implementation WKView +// FIXME: Remove this once we no longer want to be able to go back to the old drawing area. static bool useNewDrawingArea() { - static bool useNewDrawingArea = getenv("USE_NEW_DRAWING_AREA"); - - return useNewDrawingArea; + return true; } - (id)initWithFrame:(NSRect)frame @@ -211,6 +184,24 @@ static bool useNewDrawingArea() [types release]; } +- (void)_updateRemoteAccessibilityRegistration:(BOOL)registerProcess +{ +#if !defined(BUILDING_ON_SNOW_LEOPARD) + // When the tree is connected/disconnected, the remote accessibility registration + // needs to be updated with the pid of the remote process. If the process is going + // away, that information is not present in WebProcess + pid_t pid = 0; + if (registerProcess && _data->_page->process()) + pid = _data->_page->process()->processIdentifier(); + else if (!registerProcess) { + pid = WKAXRemoteProcessIdentifier(_data->_remoteAccessibilityChild.get()); + _data->_remoteAccessibilityChild = nil; + } + if (pid) + WKAXRegisterRemoteProcess(registerProcess, pid); +#endif +} + - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef { self = [super initWithFrame:frame]; @@ -239,12 +230,6 @@ static bool useNewDrawingArea() WebContext::statistics().wkViewCount++; -#if !defined(BUILDING_ON_SNOW_LEOPARD) - NSData *remoteToken = (NSData *)WKAXRemoteTokenForElement(self); - CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]); - _data->_page->sendAccessibilityPresenterToken(dataToken); -#endif - return self; } @@ -312,19 +297,35 @@ static bool useNewDrawingArea() return YES; } +- (void)viewWillStartLiveResize +{ + _data->_page->viewWillStartLiveResize(); +} + +- (void)viewDidEndLiveResize +{ + _data->_page->viewWillEndLiveResize(); +} + - (BOOL)isFlipped { return YES; } +- (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset +{ + ASSERT(NSEqualSizes(_data->_resizeScrollOffset, NSZeroSize)); + + _data->_resizeScrollOffset = offset; + [self setFrame:rect]; +} + - (void)setFrameSize:(NSSize)size { [super setFrameSize:size]; - - if (!_data->_page->drawingArea()) - return; - _data->_page->drawingArea()->setSize(IntSize(size)); + if (![self frameSizeUpdatesDisabled]) + [self _setDrawingAreaSize:size]; } - (void)_updateWindowAndViewFrames @@ -366,6 +367,8 @@ static const SelectorNameMap* createSelectorExceptionMap() map->add(@selector(pageDownAndModifySelection:), "MovePageDownAndModifySelection"); map->add(@selector(pageUp:), "MovePageUp"); map->add(@selector(pageUpAndModifySelection:), "MovePageUpAndModifySelection"); + map->add(@selector(scrollPageDown:), "ScrollPageForward"); + map->add(@selector(scrollPageUp:), "ScrollPageBackward"); return map; } @@ -392,16 +395,143 @@ static String commandNameForSelector(SEL selector) #define WEBCORE_COMMAND(command) - (void)command:(id)sender { _data->_page->executeEditCommand(commandNameForSelector(_cmd)); } +WEBCORE_COMMAND(alignCenter) +WEBCORE_COMMAND(alignJustified) +WEBCORE_COMMAND(alignLeft) +WEBCORE_COMMAND(alignRight) WEBCORE_COMMAND(copy) WEBCORE_COMMAND(cut) -WEBCORE_COMMAND(paste) WEBCORE_COMMAND(delete) +WEBCORE_COMMAND(deleteBackward) +WEBCORE_COMMAND(deleteBackwardByDecomposingPreviousCharacter) +WEBCORE_COMMAND(deleteForward) +WEBCORE_COMMAND(deleteToBeginningOfLine) +WEBCORE_COMMAND(deleteToBeginningOfParagraph) +WEBCORE_COMMAND(deleteToEndOfLine) +WEBCORE_COMMAND(deleteToEndOfParagraph) +WEBCORE_COMMAND(deleteToMark) +WEBCORE_COMMAND(deleteWordBackward) +WEBCORE_COMMAND(deleteWordForward) +WEBCORE_COMMAND(ignoreSpelling) +WEBCORE_COMMAND(indent) +WEBCORE_COMMAND(insertBacktab) +WEBCORE_COMMAND(insertLineBreak) +WEBCORE_COMMAND(insertNewline) +WEBCORE_COMMAND(insertNewlineIgnoringFieldEditor) +WEBCORE_COMMAND(insertParagraphSeparator) +WEBCORE_COMMAND(insertTab) +WEBCORE_COMMAND(insertTabIgnoringFieldEditor) +WEBCORE_COMMAND(makeTextWritingDirectionLeftToRight) +WEBCORE_COMMAND(makeTextWritingDirectionNatural) +WEBCORE_COMMAND(makeTextWritingDirectionRightToLeft) +WEBCORE_COMMAND(moveBackward) +WEBCORE_COMMAND(moveBackwardAndModifySelection) +WEBCORE_COMMAND(moveDown) +WEBCORE_COMMAND(moveDownAndModifySelection) +WEBCORE_COMMAND(moveForward) +WEBCORE_COMMAND(moveForwardAndModifySelection) +WEBCORE_COMMAND(moveLeft) +WEBCORE_COMMAND(moveLeftAndModifySelection) +WEBCORE_COMMAND(moveParagraphBackwardAndModifySelection) +WEBCORE_COMMAND(moveParagraphForwardAndModifySelection) +WEBCORE_COMMAND(moveRight) +WEBCORE_COMMAND(moveRightAndModifySelection) +WEBCORE_COMMAND(moveToBeginningOfDocument) +WEBCORE_COMMAND(moveToBeginningOfDocumentAndModifySelection) +WEBCORE_COMMAND(moveToBeginningOfLine) +WEBCORE_COMMAND(moveToBeginningOfLineAndModifySelection) +WEBCORE_COMMAND(moveToBeginningOfParagraph) +WEBCORE_COMMAND(moveToBeginningOfParagraphAndModifySelection) +WEBCORE_COMMAND(moveToBeginningOfSentence) +WEBCORE_COMMAND(moveToBeginningOfSentenceAndModifySelection) +WEBCORE_COMMAND(moveToEndOfDocument) +WEBCORE_COMMAND(moveToEndOfDocumentAndModifySelection) +WEBCORE_COMMAND(moveToEndOfLine) +WEBCORE_COMMAND(moveToEndOfLineAndModifySelection) +WEBCORE_COMMAND(moveToEndOfParagraph) +WEBCORE_COMMAND(moveToEndOfParagraphAndModifySelection) +WEBCORE_COMMAND(moveToEndOfSentence) +WEBCORE_COMMAND(moveToEndOfSentenceAndModifySelection) +WEBCORE_COMMAND(moveToLeftEndOfLine) +WEBCORE_COMMAND(moveToLeftEndOfLineAndModifySelection) +WEBCORE_COMMAND(moveToRightEndOfLine) +WEBCORE_COMMAND(moveToRightEndOfLineAndModifySelection) +WEBCORE_COMMAND(moveUp) +WEBCORE_COMMAND(moveUpAndModifySelection) +WEBCORE_COMMAND(moveWordBackward) +WEBCORE_COMMAND(moveWordBackwardAndModifySelection) +WEBCORE_COMMAND(moveWordForward) +WEBCORE_COMMAND(moveWordForwardAndModifySelection) +WEBCORE_COMMAND(moveWordLeft) +WEBCORE_COMMAND(moveWordLeftAndModifySelection) +WEBCORE_COMMAND(moveWordRight) +WEBCORE_COMMAND(moveWordRightAndModifySelection) +WEBCORE_COMMAND(outdent) +WEBCORE_COMMAND(pageDown) +WEBCORE_COMMAND(pageDownAndModifySelection) +WEBCORE_COMMAND(pageUp) +WEBCORE_COMMAND(pageUpAndModifySelection) +WEBCORE_COMMAND(paste) WEBCORE_COMMAND(pasteAsPlainText) +WEBCORE_COMMAND(scrollPageDown) +WEBCORE_COMMAND(scrollPageUp) +WEBCORE_COMMAND(scrollToBeginningOfDocument) +WEBCORE_COMMAND(scrollToEndOfDocument) WEBCORE_COMMAND(selectAll) +WEBCORE_COMMAND(selectLine) +WEBCORE_COMMAND(selectParagraph) +WEBCORE_COMMAND(selectSentence) +WEBCORE_COMMAND(selectToMark) +WEBCORE_COMMAND(selectWord) +WEBCORE_COMMAND(setMark) +WEBCORE_COMMAND(subscript) +WEBCORE_COMMAND(superscript) +WEBCORE_COMMAND(swapWithMark) WEBCORE_COMMAND(takeFindStringFromSelection) +WEBCORE_COMMAND(transpose) +WEBCORE_COMMAND(underline) +WEBCORE_COMMAND(unscript) +WEBCORE_COMMAND(yank) +WEBCORE_COMMAND(yankAndSelect) #undef WEBCORE_COMMAND +/* + +When possible, editing-related methods should be implemented in WebCore with the +EditorCommand mechanism and invoked via WEBCORE_COMMAND, rather than implementing +individual methods here with Mac-specific code. + +Editing-related methods still unimplemented that are implemented in WebKit1: + +- (void)capitalizeWord:(id)sender; +- (void)centerSelectionInVisibleArea:(id)sender; +- (void)changeFont:(id)sender; +- (void)complete:(id)sender; +- (void)copyFont:(id)sender; +- (void)lowercaseWord:(id)sender; +- (void)makeBaseWritingDirectionLeftToRight:(id)sender; +- (void)makeBaseWritingDirectionNatural:(id)sender; +- (void)makeBaseWritingDirectionRightToLeft:(id)sender; +- (void)pasteFont:(id)sender; +- (void)scrollLineDown:(id)sender; +- (void)scrollLineUp:(id)sender; +- (void)showGuessPanel:(id)sender; +- (void)uppercaseWord:(id)sender; + +Some other editing-related methods still unimplemented: + +- (void)changeCaseOfLetter:(id)sender; +- (void)copyRuler:(id)sender; +- (void)insertContainerBreak:(id)sender; +- (void)insertDoubleQuoteIgnoringSubstitution:(id)sender; +- (void)insertSingleQuoteIgnoringSubstitution:(id)sender; +- (void)pasteRuler:(id)sender; +- (void)toggleRuler:(id)sender; +- (void)transposeWords:(id)sender; + +*/ + // Menu items validation static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item) @@ -791,6 +921,41 @@ EVENT_HANDLER(scrollWheel, Wheel) [self _mouseHandler:event]; } +#if ENABLE(GESTURE_EVENTS) + +static const short kIOHIDEventTypeScroll = 6; + +- (void)shortCircuitedEndGestureWithEvent:(NSEvent *)event +{ + if ([event subtype] != kIOHIDEventTypeScroll) + return; + + WebGestureEvent webEvent = WebEventFactory::createWebGestureEvent(event, self); + _data->_page->handleGestureEvent(webEvent); + + if (_data->_endGestureMonitor) { + [NSEvent removeMonitor:_data->_endGestureMonitor]; + _data->_endGestureMonitor = nil; + } +} + +- (void)beginGestureWithEvent:(NSEvent *)event +{ + if ([event subtype] != kIOHIDEventTypeScroll) + return; + + WebGestureEvent webEvent = WebEventFactory::createWebGestureEvent(event, self); + _data->_page->handleGestureEvent(webEvent); + + if (!_data->_endGestureMonitor) { + _data->_endGestureMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskEndGesture handler:^(NSEvent *blockEvent) { + [self shortCircuitedEndGestureWithEvent:blockEvent]; + return blockEvent; + }]; + } +} +#endif + - (void)doCommandBySelector:(SEL)selector { if (selector != @selector(noop:)) @@ -830,6 +995,9 @@ EVENT_HANDLER(scrollWheel, Wheel) - (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event { + if (!_data->_page->selectionState().isContentEditable) + return NO; + if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) != NSCommandKeyMask) return NO; @@ -875,27 +1043,6 @@ EVENT_HANDLER(scrollWheel, Wheel) return [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; } -- (void)_setEventBeingResent:(NSEvent *)event -{ - _data->_keyDownEventBeingResent = [event retain]; -} - -- (Vector<KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent -{ - _data->_commandsList.clear(); - // interpretKeyEvents will trigger one or more calls to doCommandBySelector or setText - // that will populate the commandsList vector. - [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; - return _data->_commandsList; -} - -- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines -{ - start = _data->_selectionStart; - end = _data->_selectionEnd; - lines = _data->_underlines; -} - - (void)keyUp:(NSEvent *)theEvent { _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); @@ -1165,15 +1312,22 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde { // Temporarily enable the resize indicator to make a the _ownsWindowGrowBox calculation work. BOOL wasShowingIndicator = [[self window] showsResizeIndicator]; - [[self window] setShowsResizeIndicator:YES]; + if (!wasShowingIndicator) + [[self window] setShowsResizeIndicator:YES]; BOOL ownsGrowBox = [self _ownsWindowGrowBox]; _data->_page->setWindowResizerSize(ownsGrowBox ? enclosingIntRect([[self window] _growBoxRect]).size() : IntSize()); - + + if (ownsGrowBox) + [[self window] _setShowOpaqueGrowBoxForOwner:(_data->_page->hasHorizontalScrollbar() || _data->_page->hasVerticalScrollbar() ? self : nil)]; + else + [[self window] _setShowOpaqueGrowBoxForOwner:nil]; + // Once WebCore can draw the window resizer, this should read: // if (wasShowingIndicator) // [[self window] setShowsResizeIndicator:!ownsGrowBox]; - [[self window] setShowsResizeIndicator:wasShowingIndicator]; + if (!wasShowingIndicator) + [[self window] setShowsResizeIndicator:NO]; return ownsGrowBox; } @@ -1228,11 +1382,27 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow); [self _updateWindowVisibility]; [self _updateWindowAndViewFrames]; + + // Initialize remote accessibility when the window connection has been established. +#if !defined(BUILDING_ON_SNOW_LEOPARD) + NSData *remoteElementToken = WKAXRemoteTokenForElement(self); + NSData *remoteWindowToken = WKAXRemoteTokenForElement([self window]); + CoreIPC::DataReference elementToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteElementToken bytes]), [remoteElementToken length]); + CoreIPC::DataReference windowToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteWindowToken bytes]), [remoteWindowToken length]); + _data->_page->registerUIProcessAccessibilityTokens(elementToken, windowToken); +#endif + } else { _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow); - } +#if ENABLE(GESTURE_EVENTS) + if (_data->_endGestureMonitor) { + [NSEvent removeMonitor:_data->_endGestureMonitor]; + _data->_endGestureMonitor = nil; + } +#endif + } } - (void)_windowDidBecomeKey:(NSNotification *)notification @@ -1264,13 +1434,34 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde [self _updateWindowAndViewFrames]; } +static void drawPageBackground(CGContextRef context, WebPageProxy* page, const IntRect& rect) +{ + if (!page->drawsBackground()) + return; + + CGContextSaveGState(context); + CGContextSetBlendMode(context, kCGBlendModeCopy); + + CGColorRef backgroundColor; + if (page->drawsTransparentBackground()) + backgroundColor = CGColorGetConstantColor(kCGColorClear); + else + backgroundColor = CGColorGetConstantColor(kCGColorWhite); + + CGContextSetFillColorWithColor(context, backgroundColor); + CGContextFillRect(context, rect); + + CGContextRestoreGState(context); +} + - (void)drawRect:(NSRect)rect { LOG(View, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + _data->_page->endPrinting(); if (useNewDrawingArea()) { - if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) { - CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) { const NSRect *rectsBeingDrawn; NSInteger numRectsBeingDrawn; [self getRectsBeingDrawn:&rectsBeingDrawn count:&numRectsBeingDrawn]; @@ -1278,11 +1469,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Region unpaintedRegion; IntRect rect = enclosingIntRect(rectsBeingDrawn[i]); drawingArea->paint(context, rect, unpaintedRegion); + + Vector<IntRect> unpaintedRects = unpaintedRegion.rects(); + for (size_t i = 0; i < unpaintedRects.size(); ++i) + drawPageBackground(context, _data->_page.get(), unpaintedRects[i]); } - } else if (_data->_page->drawsBackground()) { - [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set]; - NSRectFill(rect); - } + } else + drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect)); _data->_page->didDraw(); return; @@ -1313,14 +1506,6 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); } -- (void)_setAccessibilityChildToken:(NSData *)data -{ -#if !defined(BUILDING_ON_SNOW_LEOPARD) - _data->_remoteAccessibilityChild = WKAXRemoteElementForToken((CFDataRef)data); - WKAXInitializeRemoteElementWithWindow(_data->_remoteAccessibilityChild.get(), [self window]); -#endif -} - - (BOOL)accessibilityIsIgnored { return NO; @@ -1353,9 +1538,12 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSView *)hitTest:(NSPoint)point { NSView *hitView = [super hitTest:point]; -#if USE(ACCELERATED_COMPOSITING) if (hitView && _data && hitView == _data->_layerHostingView) hitView = self; + +#if USE(ACCELERATED_COMPOSITING) + if (hitView && _data && hitView == _data->_oldLayerHostingView) + hitView = self; #endif return hitView; } @@ -1365,190 +1553,30 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde return (NSInteger)self; } -static void setFrameBeingPrinted(NSPrintOperation *printOperation, WebFrameProxy* frame) -{ - RetainPtr<WebFrameWrapper> frameWrapper(AdoptNS, [[WebFrameWrapper alloc] initWithFrameProxy:frame]); - [[[printOperation printInfo] dictionary] setObject:frameWrapper.get() forKey:PrintedFrameKey]; -} - -static WebFrameProxy* frameBeingPrinted() -{ - return [[[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:PrintedFrameKey] webFrame]; -} -static float currentPrintOperationScale() -{ - ASSERT([NSPrintOperation currentOperation]); - ASSERT([[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:NSPrintScalingFactor]); - return [[[[[NSPrintOperation currentOperation] printInfo] dictionary] objectForKey:NSPrintScalingFactor] floatValue]; -} - -- (void)_adjustPrintingMarginsForHeaderAndFooter +- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef { - NSPrintOperation *printOperation = [NSPrintOperation currentOperation]; - NSPrintInfo *info = [printOperation printInfo]; - NSMutableDictionary *infoDictionary = [info dictionary]; - - // We need to modify the top and bottom margins in the NSPrintInfo to account for the space needed by the - // header and footer. Because this method can be called more than once on the same NSPrintInfo (see 5038087), - // we stash away the unmodified top and bottom margins the first time this method is called, and we read from - // those stashed-away values on subsequent calls. - float originalTopMargin; - float originalBottomMargin; - NSNumber *originalTopMarginNumber = [infoDictionary objectForKey:WebKitOriginalTopPrintingMarginKey]; - if (!originalTopMarginNumber) { - ASSERT(![infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey]); - originalTopMargin = [info topMargin]; - originalBottomMargin = [info bottomMargin]; - [infoDictionary setObject:[NSNumber numberWithFloat:originalTopMargin] forKey:WebKitOriginalTopPrintingMarginKey]; - [infoDictionary setObject:[NSNumber numberWithFloat:originalBottomMargin] forKey:WebKitOriginalBottomPrintingMarginKey]; - } else { - ASSERT([originalTopMarginNumber isKindOfClass:[NSNumber class]]); - ASSERT([[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] isKindOfClass:[NSNumber class]]); - originalTopMargin = [originalTopMarginNumber floatValue]; - originalBottomMargin = [[infoDictionary objectForKey:WebKitOriginalBottomPrintingMarginKey] floatValue]; - } - - float scale = currentPrintOperationScale(); - [info setTopMargin:originalTopMargin + _data->_page->headerHeight(frameBeingPrinted()) * scale]; - [info setBottomMargin:originalBottomMargin + _data->_page->footerHeight(frameBeingPrinted()) * scale]; + // PDF documents are already paginated, so we can't change them to add headers and footers. + return !toImpl(frameRef)->isMainFrame() || !_data->_pdfViewController; } - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef { LOG(View, "Creating an NSPrintOperation for frame '%s'", toImpl(frameRef)->url().utf8().data()); - NSPrintOperation *printOperation; // Only the top frame can currently contain a PDF view. if (_data->_pdfViewController) { - ASSERT(toImpl(frameRef)->isMainFrame()); - printOperation = _data->_pdfViewController->makePrintOperation(printInfo); - } else - printOperation = [NSPrintOperation printOperationWithView:self printInfo:printInfo]; - - setFrameBeingPrinted(printOperation, toImpl(frameRef)); - return printOperation; -} - -- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef -{ - // PDF documents are already paginated, so we can't change them to add headers and footers. - return !toImpl(frameRef)->isMainFrame() || !_data->_pdfViewController; -} - -// Return the number of pages available for printing -- (BOOL)knowsPageRange:(NSRangePointer)range -{ - LOG(View, "knowsPageRange:"); - WebFrameProxy* frame = frameBeingPrinted(); - ASSERT(frame); - - if (frame->isMainFrame() && _data->_pdfViewController) - return [super knowsPageRange:range]; - - [self _adjustPrintingMarginsForHeaderAndFooter]; - - _data->_page->computePagesForPrinting(frame, PrintInfo([[NSPrintOperation currentOperation] printInfo]), _data->_printingPageRects, _data->_totalScaleFactorForPrinting); - - *range = NSMakeRange(1, _data->_printingPageRects.size()); - return YES; -} - -// Take over printing. AppKit applies incorrect clipping, and doesn't print pages beyond the first one. -- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView -{ - // FIXME: This check isn't right for some non-printing cases, such as capturing into a buffer using cacheDisplayInRect:toBitmapImageRep:. - if ([NSGraphicsContext currentContextDrawingToScreen]) { - _data->_page->endPrinting(); - [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView topView:topView]; - return; - } - - LOG(View, "Printing rect x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); - - ASSERT(self == visibleView); - ASSERT(frameBeingPrinted()); - - WebFrameProxy* frame = frameBeingPrinted(); - ASSERT(frame); - - _data->_page->beginPrinting(frame, PrintInfo([[NSPrintOperation currentOperation] printInfo])); - - // FIXME: This is optimized for print preview. Get the whole document at once when actually printing. - Vector<uint8_t> pdfData; - _data->_page->drawRectToPDF(frame, IntRect(rect), pdfData); - - RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithData(0, pdfData.data(), pdfData.size(), 0)); - RetainPtr<CGPDFDocumentRef> pdfDocument(AdoptCF, CGPDFDocumentCreateWithProvider(pdfDataProvider.get())); - if (!pdfDocument) { - LOG_ERROR("Couldn't create a PDF document with data passed for printing"); - return; - } - - CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument.get(), 1); - if (!pdfPage) { - LOG_ERROR("Printing data doesn't have page 1"); - return; + if (!toImpl(frameRef)->isMainFrame()) + return 0; + return _data->_pdfViewController->makePrintOperation(printInfo); + } else { + RetainPtr<WKPrintingView> printingView(AdoptNS, [[WKPrintingView alloc] initWithFrameProxy:toImpl(frameRef)]); + // NSPrintOperation takes ownership of the view. + NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:printingView.get()]; + [printOperation setCanSpawnSeparateThread:YES]; + printingView->_printOperation = printOperation; + return printOperation; } - - NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext]; - CGContextRef context = static_cast<CGContextRef>([nsGraphicsContext graphicsPort]); - - CGContextSaveGState(context); - // Flip the destination. - CGContextScaleCTM(context, 1, -1); - CGContextTranslateCTM(context, 0, -rect.size.height); - CGContextDrawPDFPage(context, pdfPage); - CGContextRestoreGState(context); -} - -- (void)drawPageBorderWithSize:(NSSize)borderSize -{ - ASSERT(NSEqualSizes(borderSize, [[[NSPrintOperation currentOperation] printInfo] paperSize])); - - // The header and footer rect height scales with the page, but the width is always - // all the way across the printed page (inset by printing margins). - NSPrintOperation *printOperation = [NSPrintOperation currentOperation]; - NSPrintInfo *printInfo = [printOperation printInfo]; - float scale = currentPrintOperationScale(); - NSSize paperSize = [printInfo paperSize]; - float headerFooterLeft = [printInfo leftMargin] / scale; - float headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale; - WebFrameProxy* frame = frameBeingPrinted(); - NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _data->_page->footerHeight(frame), headerFooterWidth, _data->_page->footerHeight(frame)); - NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _data->_page->headerHeight(frame)); - - NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; - [currentContext saveGraphicsState]; - NSRectClip(headerRect); - _data->_page->drawHeader(frame, headerRect); - [currentContext restoreGraphicsState]; - - [currentContext saveGraphicsState]; - NSRectClip(footerRect); - _data->_page->drawFooter(frame, footerRect); - [currentContext restoreGraphicsState]; -} - -// FIXME 3491344: This is an AppKit-internal method that we need to override in order -// to get our shrink-to-fit to work with a custom pagination scheme. We can do this better -// if AppKit makes it SPI/API. -- (CGFloat)_provideTotalScaleFactorForPrintOperation:(NSPrintOperation *)printOperation -{ - return _data->_totalScaleFactorForPrinting; -} - -// Return the drawing rectangle for a particular page number -- (NSRect)rectForPage:(NSInteger)page -{ - WebFrameProxy* frame = frameBeingPrinted(); - ASSERT(frame); - - if (frame->isMainFrame() && _data->_pdfViewController) - return [super rectForPage:page]; - - LOG(View, "rectForPage:%d -> x %d, y %d, width %d, height %d\n", (int)page, _data->_printingPageRects[page - 1].x(), _data->_printingPageRects[page - 1].y(), _data->_printingPageRects[page - 1].width(), _data->_printingPageRects[page - 1].height()); - return _data->_printingPageRects[page - 1]; } @end @@ -1575,6 +1603,12 @@ static float currentPrintOperationScale() - (void)_processDidCrash { [self setNeedsDisplay:YES]; + [self _updateRemoteAccessibilityRegistration:NO]; +} + +- (void)_pageClosed +{ + [self _updateRemoteAccessibilityRegistration:NO]; } - (void)_didRelaunchProcess @@ -1610,6 +1644,27 @@ static float currentPrintOperationScale() } } +- (void)_setEventBeingResent:(NSEvent *)event +{ + _data->_keyDownEventBeingResent = [event retain]; +} + +- (Vector<KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent +{ + _data->_commandsList.clear(); + // interpretKeyEvents will trigger one or more calls to doCommandBySelector or setText + // that will populate the commandsList vector. + [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; + return _data->_commandsList; +} + +- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines +{ + start = _data->_selectionStart; + end = _data->_selectionEnd; + lines = _data->_underlines; +} + - (NSRect)_convertToDeviceSpace:(NSRect)rect { return toDeviceSpace(rect, [self window]); @@ -1750,7 +1805,7 @@ static float currentPrintOperationScale() #if USE(ACCELERATED_COMPOSITING) - (void)_startAcceleratedCompositing:(CALayer *)rootLayer { - if (!_data->_layerHostingView) { + if (!_data->_oldLayerHostingView) { NSView *hostingView = [[NSView alloc] initWithFrame:[self bounds]]; #if !defined(BUILDING_ON_LEOPARD) [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; @@ -1758,7 +1813,7 @@ static float currentPrintOperationScale() [self addSubview:hostingView]; [hostingView release]; - _data->_layerHostingView = hostingView; + _data->_oldLayerHostingView = hostingView; } // Make a container layer, which will get sized/positioned by AppKit and CA. @@ -1792,8 +1847,8 @@ static float currentPrintOperationScale() [viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; #endif - [_data->_layerHostingView setLayer:viewLayer]; - [_data->_layerHostingView setWantsLayer:YES]; + [_data->_oldLayerHostingView setLayer:viewLayer]; + [_data->_oldLayerHostingView setWantsLayer:YES]; // Parent our root layer in the container layer [viewLayer addSublayer:rootLayer]; @@ -1801,11 +1856,11 @@ static float currentPrintOperationScale() - (void)_stopAcceleratedCompositing { - if (_data->_layerHostingView) { - [_data->_layerHostingView setLayer:nil]; - [_data->_layerHostingView setWantsLayer:NO]; - [_data->_layerHostingView removeFromSuperview]; - _data->_layerHostingView = nil; + if (_data->_oldLayerHostingView) { + [_data->_oldLayerHostingView setLayer:nil]; + [_data->_oldLayerHostingView setWantsLayer:NO]; + [_data->_oldLayerHostingView removeFromSuperview]; + _data->_oldLayerHostingView = nil; } } @@ -1830,12 +1885,46 @@ static float currentPrintOperationScale() } } - newDrawingArea->setSize(IntSize([self frame].size)); + newDrawingArea->setSize(IntSize([self frame].size), IntSize()); _data->_page->drawingArea()->detachCompositingContext(); _data->_page->setDrawingArea(newDrawingArea.release()); } +- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext +{ + ASSERT(!_data->_layerHostingView); + ASSERT(!layerTreeContext.isEmpty()); + + // Create an NSView that will host our layer tree. + _data->_layerHostingView.adoptNS([[NSView alloc] initWithFrame:[self bounds]]); + [_data->_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + [self addSubview:_data->_layerHostingView.get()]; + + // Create a root layer that will back the NSView. + RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]); +#ifndef NDEBUG + [rootLayer.get() setName:@"Hosting root layer"]; +#endif + + CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID); + [rootLayer.get() addSublayer:renderLayer]; + + [_data->_layerHostingView.get() setLayer:rootLayer.get()]; + [_data->_layerHostingView.get() setWantsLayer:YES]; +} + +- (void)_exitAcceleratedCompositingMode +{ + ASSERT(_data->_layerHostingView); + + [_data->_layerHostingView.get() setLayer:nil]; + [_data->_layerHostingView.get() setWantsLayer:NO]; + [_data->_layerHostingView.get() removeFromSuperview]; + + _data->_layerHostingView = nullptr; +} + - (void)_pageDidEnterAcceleratedCompositing { [self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::LayerBacked]; @@ -1848,6 +1937,14 @@ static float currentPrintOperationScale() } #endif // USE(ACCELERATED_COMPOSITING) +- (void)_setAccessibilityWebProcessToken:(NSData *)data +{ +#if !defined(BUILDING_ON_SNOW_LEOPARD) + _data->_remoteAccessibilityChild = WKAXRemoteElementForToken(data); + [self _updateRemoteAccessibilityRegistration:YES]; +#endif +} + - (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier { BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier; @@ -1922,4 +2019,42 @@ static float currentPrintOperationScale() _data->_dragHasStarted = NO; } +- (void)_setDrawingAreaSize:(NSSize)size +{ + if (!_data->_page->drawingArea()) + return; + + _data->_page->drawingArea()->setSize(IntSize(size), IntSize(_data->_resizeScrollOffset)); + _data->_resizeScrollOffset = NSZeroSize; +} + +- (void)_didChangeScrollbarsForMainFrame +{ + [self _updateGrowBoxForWindowFrameChange]; +} + +@end + +@implementation WKView (Private) + +- (void)disableFrameSizeUpdates +{ + _frameSizeUpdatesDisabledCount++; +} + +- (void)enableFrameSizeUpdates +{ + if (!_frameSizeUpdatesDisabledCount) + return; + + if (!(--_frameSizeUpdatesDisabledCount)) + [self _setDrawingAreaSize:[self frame].size]; +} + +- (BOOL)frameSizeUpdatesDisabled +{ + return _frameSizeUpdatesDisabledCount > 0; +} + @end + diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index cba241d..9e77e30 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -36,6 +36,7 @@ namespace WebKit { - (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; - (BOOL)_isFocused; - (void)_processDidCrash; +- (void)_pageClosed; - (void)_didRelaunchProcess; - (void)_takeFocus:(BOOL)direction; - (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; @@ -48,6 +49,9 @@ namespace WebKit { - (NSRect)_convertToUserSpace:(NSRect)rect; - (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut; +- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; +- (void)_exitAcceleratedCompositingMode; + #if USE(ACCELERATED_COMPOSITING) - (void)_startAcceleratedCompositing:(CALayer *)rootLayer; - (void)_stopAcceleratedCompositing; @@ -55,7 +59,7 @@ namespace WebKit { - (void)_pageDidLeaveAcceleratedCompositing; #endif -- (void)_setAccessibilityChildToken:(NSData *)data; +- (void)_setAccessibilityWebProcessToken:(NSData *)data; - (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; - (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; @@ -64,4 +68,7 @@ namespace WebKit { - (void)_setCustomRepresentationZoomFactor:(double)zoomFactor; - (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag; +- (void)_setDrawingAreaSize:(NSSize)size; + +- (void)_didChangeScrollbarsForMainFrame; @end diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h new file mode 100644 index 0000000..5d6125e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +@interface WKView (Private) + +// Stops updating the size of the page as the WKView frame size updates. +// This should always be followed by enableFrameSizeUpdates. Calls can be nested. +- (void)disableFrameSizeUpdates; +// Immediately updates the size of the page to match WKView's frame size +// and allows subsequent updates as the frame size is set. Calls can be nested. +- (void)enableFrameSizeUpdates; +- (BOOL)frameSizeUpdatesDisabled; + +@end diff --git a/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp index 642e529..8197236 100644 --- a/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp @@ -17,6 +17,7 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" #include "ClientImpl.h" #include "WebFrameProxy.h" diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp index ec23760..748b1bd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp @@ -18,6 +18,7 @@ * */ +#include "config.h" #include "qgraphicswkview.h" #include "ChunkedUpdateDrawingAreaProxy.h" diff --git a/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp index b17c100..5f05f93 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp @@ -18,6 +18,7 @@ * */ +#include "config.h" #include "qwkcontext.h" #include "qwkcontext_p.h" diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp index 72c1322..16e1cdd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp @@ -18,6 +18,7 @@ * */ +#include "config.h" #include "qwkpage.h" #include "qwkpage_p.h" @@ -89,6 +90,7 @@ QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c) , preferences(0) , createNewPageFn(0) , backingStoreType(QGraphicsWKView::Simple) + , isConnectedToEngine(true) { memset(actions, 0, sizeof(actions)); page = context->d->context->createWebPage(this, 0); @@ -183,6 +185,16 @@ bool QWKPagePrivate::isViewInWindow() return true; } +void QWKPagePrivate::enterAcceleratedCompositingMode(const LayerTreeContext&) +{ + // FIXME: Implement. +} + +void QWKPagePrivate::exitAcceleratedCompositingMode() +{ + // FIXME: Implement. +} + void QWKPagePrivate::pageDidRequestScroll(const IntSize& delta) { emit q->scrollRequested(delta.width(), delta.height()); @@ -220,7 +232,7 @@ void QWKPagePrivate::selectionChanged(bool, bool, bool, bool) { } -void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&) +void QWKPagePrivate::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) { } @@ -391,6 +403,15 @@ void QWKPagePrivate::didRelaunchProcess() QGraphicsWKView* wkView = static_cast<QGraphicsWKView*>(view); if (wkView) q->setViewportSize(wkView->size().toSize()); + + isConnectedToEngine = true; + emit q->engineConnectionChanged(true); +} + +void QWKPagePrivate::processDidCrash() +{ + isConnectedToEngine = false; + emit q->engineConnectionChanged(false); } QWKPage::QWKPage(QWKContext* context) @@ -459,7 +480,8 @@ QWKPage::QWKPage(QWKContext* context) 0, /* drawHeader */ 0, /* drawFooter */ 0, /* printFrame */ - 0 /* runModal */ + 0, /* runModal */ + 0 /* didCompleteRubberBandForMainFrame */ }; WKPageSetPageUIClient(pageRef(), &uiClient); } @@ -622,7 +644,7 @@ QString QWKPage::title() const void QWKPage::setViewportSize(const QSize& size) { if (d->page->drawingArea()) - d->page->drawingArea()->setSize(IntSize(size)); + d->page->drawingArea()->setSize(IntSize(size), IntSize()); } qreal QWKPage::textZoomFactor() const @@ -775,4 +797,9 @@ void QWKPagePrivate::didFindZoomableArea(const IntRect& area) emit q->zoomableAreaFound(QRect(area)); } +bool QWKPage::isConnectedToEngine() const +{ + return d->isConnectedToEngine; +} + #include "moc_qwkpage.cpp" diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.h b/Source/WebKit2/UIProcess/API/qt/qwkpage.h index e0bb4c3..cb7933a 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwkpage.h +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.h @@ -117,6 +117,8 @@ public: void findZoomableAreaForPoint(const QPoint&); + bool isConnectedToEngine() const; + public: Q_SIGNAL void statusBarMessage(const QString&); Q_SIGNAL void titleChanged(const QString&); @@ -133,6 +135,7 @@ public: Q_SIGNAL void zoomableAreaFound(const QRect&); Q_SIGNAL void focusNextPrevChild(bool); Q_SIGNAL void showContextMenu(QMenu*); + Q_SIGNAL void engineConnectionChanged(bool connected); protected: void timerEvent(QTimerEvent*); diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h index 420ff62..65f64ff 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h @@ -22,6 +22,7 @@ #define qwkpage_p_h #include "DrawingAreaProxy.h" +#include "LayerTreeContext.h" #include "PageClient.h" #include "qwkpage.h" #include "qgraphicswkview.h" @@ -35,6 +36,8 @@ class QGraphicsWKView; class QWKPreferences; +using namespace WebKit; + class QWKPagePrivate : WebKit::PageClient { public: QWKPagePrivate(QWKPage*, QWKContext*); @@ -57,11 +60,14 @@ public: virtual bool isViewInWindow(); #if USE(ACCELERATED_COMPOSITING) + virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); + virtual void exitAcceleratedCompositingMode(); void pageDidEnterAcceleratedCompositing() { } void pageDidLeaveAcceleratedCompositing() { } #endif // USE(ACCELERATED_COMPOSITING) virtual void pageDidRequestScroll(const WebCore::IntSize&); - virtual void processDidCrash() { } + virtual void processDidCrash(); + virtual void pageClosed() { } virtual void didRelaunchProcess(); virtual void didChangeContentsSize(const WebCore::IntSize&); virtual void didFindZoomableArea(const WebCore::IntRect&); @@ -73,7 +79,7 @@ public: virtual void clearAllEditCommands(); virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); - virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&); + virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled); virtual void selectionChanged(bool, bool, bool, bool); virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*); virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*); @@ -84,6 +90,7 @@ public: virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); virtual double customRepresentationZoomFactor() { return 1; } virtual void setCustomRepresentationZoomFactor(double) { } + virtual void didChangeScrollbarsForMainFrame() const { } void paint(QPainter* painter, QRect); @@ -122,6 +129,8 @@ public: QPoint tripleClick; QBasicTimer tripleClickTimer; QGraphicsWKView::BackingStoreType backingStoreType; + + bool isConnectedToEngine; }; class QtViewportAttributesPrivate : public QSharedData { diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp index dea18aa..4ba18a3 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp @@ -17,6 +17,7 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" #include "qwkpreferences.h" #include "WKPageGroup.h" diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp index 07b39b2..ffe8bac 100644 --- a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "AuthenticationChallengeProxy.h" #include "AuthenticationDecisionListener.h" diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp index ddcc6c6..a3987cd 100644 --- a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "AuthenticationDecisionListener.h" #include "AuthenticationChallengeProxy.h" diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp index b9a346e..0b429a7 100644 --- a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCredential.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp index 1671371..3d38e22 100644 --- a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProtectionSpace.h" #include <WebCore/SharedBuffer.h> diff --git a/Source/WebKit2/UIProcess/BackingStore.cpp b/Source/WebKit2/UIProcess/BackingStore.cpp index b468b6b..f9a2672 100644 --- a/Source/WebKit2/UIProcess/BackingStore.cpp +++ b/Source/WebKit2/UIProcess/BackingStore.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "BackingStore.h" #include "ShareableBitmap.h" @@ -30,7 +31,7 @@ using namespace WebCore; -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) && !PLATFORM(WIN) #error "This class is not ready for use by other ports yet." #endif @@ -44,7 +45,6 @@ PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size, WebPageProxy* BackingStore::BackingStore(const IntSize& size, WebPageProxy* webPageProxy) : m_size(size) , m_webPageProxy(webPageProxy) - , m_latestUpdateTimestamp(0) { ASSERT(!m_size.isEmpty()); } @@ -55,20 +55,13 @@ BackingStore::~BackingStore() void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo) { - if (updateInfo.timestamp < m_latestUpdateTimestamp) { - // The update is too old, discard it. - return; - } - - ASSERT(m_size == updateInfo.viewSize); +// ASSERT(m_size == updateInfo.viewSize); RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle); if (!bitmap) return; incorporateUpdate(bitmap.get(), updateInfo); - - m_latestUpdateTimestamp = updateInfo.timestamp; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/BackingStore.h b/Source/WebKit2/UIProcess/BackingStore.h index a3ea065..eacd99e 100644 --- a/Source/WebKit2/UIProcess/BackingStore.h +++ b/Source/WebKit2/UIProcess/BackingStore.h @@ -32,6 +32,8 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> +#elif PLATFORM(WIN) +#include <wtf/OwnPtr.h> #endif namespace WebCore { @@ -55,6 +57,8 @@ public: #if PLATFORM(MAC) typedef CGContextRef PlatformGraphicsContext; +#elif PLATFORM(WIN) + typedef HDC PlatformGraphicsContext; #endif void paint(PlatformGraphicsContext, const WebCore::IntRect&); @@ -68,13 +72,14 @@ private: WebCore::IntSize m_size; WebPageProxy* m_webPageProxy; - double m_latestUpdateTimestamp; #if PLATFORM(MAC) CGContextRef backingStoreContext(); RetainPtr<CGLayerRef> m_cgLayer; RetainPtr<CGContextRef> m_bitmapContext; +#elif PLATFORM(WIN) + OwnPtr<HBITMAP> m_bitmap; #endif }; diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp index 22e9c84..58cac4f 100644 --- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp @@ -1,5 +1,6 @@ /* * 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 @@ -23,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingAreaProxy.h" #include "DrawingAreaMessageKinds.h" @@ -47,6 +49,9 @@ ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy(PlatformWebView* we , m_isWaitingForDidSetFrameNotification(false) , m_isVisible(true) , m_forceRepaintWhenResumingPainting(false) +#if PLATFORM(GTK) + , m_backingStoreImage(0) +#endif , m_webView(webView) { } @@ -65,7 +70,7 @@ bool ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingCo if (page->process()->isLaunching()) return false; - OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04); + OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->deprecatedWaitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04); if (arguments) didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyLegacyMessage::DidSetSize), arguments.get()); } @@ -91,12 +96,12 @@ void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible) if (!m_isVisible) { // Tell the web process that it doesn't need to paint anything for now. - page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier)); return; } // The page is now visible, resume painting. - page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting)); m_forceRepaintWhenResumingPainting = false; } @@ -113,9 +118,6 @@ void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk) invalidateBackingStore(); if (!updateChunk->isEmpty()) drawUpdateChunkIntoBackingStore(updateChunk); - - WebPageProxy* page = this->page(); - page->process()->responsivenessTimer()->stop(); } void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk) @@ -131,7 +133,7 @@ void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk) } WebPageProxy* page = this->page(); - page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); } void ChunkedUpdateDrawingAreaProxy::sendSetSize() @@ -143,8 +145,7 @@ void ChunkedUpdateDrawingAreaProxy::sendSetSize() return; m_isWaitingForDidSetFrameNotification = true; - m_webPageProxy->process()->responsivenessTimer()->start(); - m_webPageProxy->process()->send(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size)); + m_webPageProxy->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size)); } void ChunkedUpdateDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h index 348d04f..7d7a5f4 100644 --- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h @@ -1,5 +1,7 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,22 +25,20 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DrawingAreaProxyUpdateChunk_h -#define DrawingAreaProxyUpdateChunk_h +#ifndef ChunkedUpdateDrawingAreaProxy_h +#define ChunkedUpdateDrawingAreaProxy_h #include "DrawingAreaProxy.h" #include <WebCore/IntSize.h> #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class WKView; -#else -class WKView; -#endif +OBJC_CLASS WKView; #elif PLATFORM(QT) #include <QImage> class QGraphicsWKView; +#elif PLATFORM(GTK) +typedef struct _cairo_surface cairo_surface_t; #endif namespace WebKit { @@ -53,6 +53,9 @@ class WebView; typedef WebView PlatformWebView; #elif PLATFORM(QT) typedef QGraphicsWKView PlatformWebView; +#elif PLATFORM(GTK) +class WebView; +typedef WebView PlatformWebView; #endif class ChunkedUpdateDrawingAreaProxy : public DrawingAreaProxy { @@ -99,6 +102,8 @@ private: OwnPtr<HBITMAP> m_backingStoreBitmap; #elif PLATFORM(QT) QImage m_backingStoreImage; +#elif PLATFORM(GTK) + cairo_surface_t* m_backingStoreImage; #endif PlatformWebView* m_webView; @@ -106,4 +111,4 @@ private: } // namespace WebKit -#endif // DrawingAreaProxyUpdateChunk_h +#endif // ChunkedUpdateDrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp index fcc4a75..55168bc 100644 --- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp +++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DownloadProxy.h" #include "DataReference.h" diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp index fa16641..3d1f1aa 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DrawingAreaProxy.h" #include "WebPageProxy.h" @@ -34,7 +35,6 @@ namespace WebKit { DrawingAreaProxy::DrawingAreaProxy(DrawingAreaInfo::Type type, WebPageProxy* webPageProxy) : m_info(type, nextIdentifier()) , m_webPageProxy(webPageProxy) - , m_size(webPageProxy->viewSize()) { } @@ -48,12 +48,13 @@ DrawingAreaInfo::Identifier DrawingAreaProxy::nextIdentifier() return ++nextID; } -void DrawingAreaProxy::setSize(const IntSize& size) +void DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollOffset) { - if (m_size == size) + if (m_size == size && scrollOffset.isZero()) return; m_size = size; + m_scrollOffset += scrollOffset; sizeDidChange(); } diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 3eb24da..f802241 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -1,5 +1,6 @@ /* * 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 @@ -31,19 +32,24 @@ #if PLATFORM(QT) class QPainter; +#elif PLATFORM(GTK) +typedef struct _cairo cairo_t; #endif namespace WebKit { +class LayerTreeContext; +class UpdateInfo; class WebPageProxy; -struct UpdateInfo; - + #if PLATFORM(MAC) typedef CGContextRef PlatformDrawingContext; #elif PLATFORM(WIN) typedef HDC PlatformDrawingContext; #elif PLATFORM(QT) typedef QPainter* PlatformDrawingContext; +#elif PLATFORM(GTK) +typedef cairo_t* PlatformDrawingContext; #endif class DrawingAreaProxy { @@ -54,7 +60,7 @@ public: virtual ~DrawingAreaProxy(); -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); #endif @@ -79,7 +85,7 @@ public: const DrawingAreaInfo& info() const { return m_info; } const WebCore::IntSize& size() const { return m_size; } - void setSize(const WebCore::IntSize&); + void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset); protected: explicit DrawingAreaProxy(DrawingAreaInfo::Type, WebPageProxy*); @@ -88,12 +94,17 @@ protected: WebPageProxy* m_webPageProxy; WebCore::IntSize m_size; + WebCore::IntSize m_scrollOffset; private: // CoreIPC message handlers. // FIXME: These should be pure virtual. - virtual void update(const UpdateInfo&) { } - virtual void didSetSize(const UpdateInfo&) { } + virtual void update(uint64_t sequenceNumber, const UpdateInfo&) { } + virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&) { } +#if USE(ACCELERATED_COMPOSITING) + virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&) { } + virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&) { } +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in index ec065c7..a2b5e26 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -21,6 +21,11 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. messages -> DrawingAreaProxy { - Update(WebKit::UpdateInfo updateInfo) - DidSetSize(WebKit::UpdateInfo updateInfo) + Update(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo) + DidSetSize(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context) + +#if USE(ACCELERATED_COMPOSITING) + EnterAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::LayerTreeContext context) + ExitAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo) +#endif } diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp index 3207094..6a65841 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp @@ -23,15 +23,18 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DrawingAreaProxyImpl.h" #include "DrawingAreaMessages.h" +#include "DrawingAreaProxyMessages.h" +#include "LayerTreeContext.h" #include "Region.h" #include "UpdateInfo.h" #include "WebPageProxy.h" #include "WebProcessProxy.h" -#ifndef __APPLE__ +#if !PLATFORM(MAC) && !PLATFORM(WIN) #error "This drawing area is not ready for use by other ports yet." #endif @@ -47,11 +50,15 @@ PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webP DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy) : DrawingAreaProxy(DrawingAreaInfo::Impl, webPageProxy) , m_isWaitingForDidSetSize(false) + , m_lastDidSetSizeSequenceNumber(0) { } DrawingAreaProxyImpl::~DrawingAreaProxyImpl() { + // Make sure to exit accelerated compositing mode. + if (isInAcceleratedCompositingMode()) + exitAcceleratedCompositingMode(); } void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion) @@ -61,6 +68,18 @@ void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, if (!m_backingStore) return; + ASSERT(!isInAcceleratedCompositingMode()); + + if (m_isWaitingForDidSetSize) { + // Wait for a DidSetSize message that contains the new bits before we paint + // what's currently in the backing store. + waitForAndDispatchDidSetSize(); + + // Dispatching DidSetSize could destroy our backing store or change the compositing mode. + if (!m_backingStore || isInAcceleratedCompositingMode()) + return; + } + m_backingStore->paint(context, rect); unpaintedRegion.subtract(IntRect(IntPoint(), m_backingStore->size())); } @@ -112,29 +131,71 @@ void DrawingAreaProxyImpl::detachCompositingContext() ASSERT_NOT_REACHED(); } -void DrawingAreaProxyImpl::update(const UpdateInfo& updateInfo) +void DrawingAreaProxyImpl::update(uint64_t sequenceNumber, const UpdateInfo& updateInfo) { + if (sequenceNumber < m_lastDidSetSizeSequenceNumber) + return; + // FIXME: Handle the case where the view is hidden. incorporateUpdate(updateInfo); m_webPageProxy->process()->send(Messages::DrawingArea::DidUpdate(), m_webPageProxy->pageID()); } -void DrawingAreaProxyImpl::didSetSize(const UpdateInfo& updateInfo) +void DrawingAreaProxyImpl::didSetSize(uint64_t sequenceNumber, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext) { + ASSERT(sequenceNumber > m_lastDidSetSizeSequenceNumber); + m_lastDidSetSizeSequenceNumber = sequenceNumber; + ASSERT(m_isWaitingForDidSetSize); m_isWaitingForDidSetSize = false; if (m_size != updateInfo.viewSize) sendSetSize(); + if (layerTreeContext != m_layerTreeContext) { + if (!m_layerTreeContext.isEmpty()) { + exitAcceleratedCompositingMode(); + ASSERT(m_layerTreeContext.isEmpty()); + } + + if (!layerTreeContext.isEmpty()) { + enterAcceleratedCompositingMode(layerTreeContext); + ASSERT(layerTreeContext == m_layerTreeContext); + } + } + + if (isInAcceleratedCompositingMode()) { + ASSERT(!m_backingStore); + return; + } + m_backingStore = nullptr; + incorporateUpdate(updateInfo); +} + +void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext& layerTreeContext) +{ + if (sequenceNumber < m_lastDidSetSizeSequenceNumber) + return; + + enterAcceleratedCompositingMode(layerTreeContext); +} + +void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo& updateInfo) +{ + if (sequenceNumber < m_lastDidSetSizeSequenceNumber) + return; + + exitAcceleratedCompositingMode(); incorporateUpdate(updateInfo); } void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo) { + ASSERT(!isInAcceleratedCompositingMode()); + if (updateInfo.updateRectBounds.isEmpty()) return; @@ -164,7 +225,45 @@ void DrawingAreaProxyImpl::sendSetSize() return; m_isWaitingForDidSetSize = true; - m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size), m_webPageProxy->pageID()); + m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size, m_scrollOffset), m_webPageProxy->pageID()); + m_scrollOffset = IntSize(); + + if (!m_layerTreeContext.isEmpty()) { + // Wait for the DidSetSize message. Normally we don this in DrawingAreaProxyImpl::paint, but that + // function is never called when in accelerated compositing mode. + waitForAndDispatchDidSetSize(); + } +} + +void DrawingAreaProxyImpl::waitForAndDispatchDidSetSize() +{ + ASSERT(m_isWaitingForDidSetSize); + + if (!m_webPageProxy->isValid()) + return; + if (m_webPageProxy->process()->isLaunching()) + return; + + // The timeout, in seconds, we use when waiting for a DidSetSize message when we're asked to paint. + static const double didSetSizeTimeout = 0.5; + m_webPageProxy->process()->connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidSetSize>(m_webPageProxy->pageID(), didSetSizeTimeout); +} + +void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) +{ + ASSERT(!isInAcceleratedCompositingMode()); + + m_backingStore = nullptr; + m_layerTreeContext = layerTreeContext; + m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); +} + +void DrawingAreaProxyImpl::exitAcceleratedCompositingMode() +{ + ASSERT(isInAcceleratedCompositingMode()); + + m_layerTreeContext = LayerTreeContext(); + m_webPageProxy->exitAcceleratedCompositingMode(); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h index bf7b878..f776b09 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h @@ -28,6 +28,7 @@ #include "BackingStore.h" #include "DrawingAreaProxy.h" +#include "LayerTreeContext.h" namespace WebKit { @@ -54,16 +55,30 @@ private: virtual void detachCompositingContext(); // CoreIPC message handlers - virtual void update(const UpdateInfo&); - virtual void didSetSize(const UpdateInfo&); - + virtual void update(uint64_t sequenceNumber, const UpdateInfo&); + virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&); + virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&); + virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&); + void incorporateUpdate(const UpdateInfo&); void sendSetSize(); + void waitForAndDispatchDidSetSize(); + + void enterAcceleratedCompositingMode(const LayerTreeContext&); + void exitAcceleratedCompositingMode(); + bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); } + + // The current layer tree context. + LayerTreeContext m_layerTreeContext; + // Whether we've sent a SetSize message and are now waiting for a DidSetSize message. // Used to throttle SetSize messages so we don't send them faster than the Web process can handle. bool m_isWaitingForDidSetSize; + // The sequence number of the last DidSetSize message + uint64_t m_lastDidSetSizeSequenceNumber; + OwnPtr<BackingStore> m_backingStore; }; diff --git a/Source/WebKit2/UIProcess/FindIndicator.cpp b/Source/WebKit2/UIProcess/FindIndicator.cpp index f1357e7..d6ac461 100644 --- a/Source/WebKit2/UIProcess/FindIndicator.cpp +++ b/Source/WebKit2/UIProcess/FindIndicator.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "FindIndicator.h" #include "ShareableBitmap.h" @@ -76,18 +77,18 @@ static const int gradientLightAlpha = 255; namespace WebKit { -PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle) +PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle) { - RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRect).size(), contentImageHandle); + RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRectInWindowCoordinates).size(), contentImageHandle); if (!contentImage) return 0; - return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release())); + return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release())); } -FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage) - : m_selectionRect(selectionRect) - , m_textRects(textRects) +FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, PassRefPtr<ShareableBitmap> contentImage) + : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates) + , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates) , m_contentImage(contentImage) { } @@ -107,9 +108,9 @@ static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflat FloatRect FindIndicator::frameRect() const { - return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness, - m_selectionRect.width() + rightBorderThickness + leftBorderThickness, - m_selectionRect.height() + topBorderThickness + bottomBorderThickness); + return FloatRect(m_selectionRectInWindowCoordinates.x() - leftBorderThickness, m_selectionRectInWindowCoordinates.y() - topBorderThickness, + m_selectionRectInWindowCoordinates.width() + rightBorderThickness + leftBorderThickness, + m_selectionRectInWindowCoordinates.height() + topBorderThickness + bottomBorderThickness); } static Color lightBorderColor() @@ -142,8 +143,8 @@ static Path pathWithRoundedRect(const FloatRect& pathRect, float radius) void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect) { - for (size_t i = 0; i < m_textRects.size(); ++i) { - FloatRect textRect = m_textRects[i]; + for (size_t i = 0; i < m_textRectsInSelectionRectCoordinates.size(); ++i) { + FloatRect textRect = m_textRectsInSelectionRectCoordinates[i]; textRect.move(leftBorderThickness, topBorderThickness); graphicsContext.save(); @@ -156,7 +157,7 @@ void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyR graphicsContext.save(); FloatRect innerPathRect = inflateRect(textRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder); graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius)); - RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.bottom())); + RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.maxY())); gradient->addColorStop(0, gradientLightColor()); gradient->addColorStop(1, gradientDarkColor()); graphicsContext.setFillGradient(gradient); diff --git a/Source/WebKit2/UIProcess/FindIndicator.h b/Source/WebKit2/UIProcess/FindIndicator.h index 997d537..69088ce 100644 --- a/Source/WebKit2/UIProcess/FindIndicator.h +++ b/Source/WebKit2/UIProcess/FindIndicator.h @@ -42,12 +42,13 @@ class ShareableBitmap; class FindIndicator : public RefCounted<FindIndicator> { public: - static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle); + static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle); ~FindIndicator(); + WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; } WebCore::FloatRect frameRect() const; - const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; } + const Vector<WebCore::FloatRect>& textRects() const { return m_textRectsInSelectionRectCoordinates; } ShareableBitmap* contentImage() const { return m_contentImage.get(); } @@ -56,8 +57,8 @@ public: private: FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage); - WebCore::FloatRect m_selectionRect; - Vector<WebCore::FloatRect> m_textRects; + WebCore::FloatRect m_selectionRectInWindowCoordinates; + Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates; RefPtr<ShareableBitmap> m_contentImage; }; diff --git a/Source/WebKit2/UIProcess/GenericCallback.h b/Source/WebKit2/UIProcess/GenericCallback.h index b72314a..c34414a 100644 --- a/Source/WebKit2/UIProcess/GenericCallback.h +++ b/Source/WebKit2/UIProcess/GenericCallback.h @@ -35,6 +35,115 @@ namespace WebKit { +class VoidCallback : public RefCounted<VoidCallback> { +public: + typedef void (*CallbackFunction)(WKErrorRef, void*); + + static PassRefPtr<VoidCallback> create(void* context, CallbackFunction callback) + { + return adoptRef(new VoidCallback(context, callback)); + } + + VoidCallback() + { + ASSERT(!m_callback); + } + + void performCallback() + { + ASSERT(m_callback); + + m_callback(0, m_context); + + m_callback = 0; + } + + void invalidate() + { + ASSERT(m_callback); + + RefPtr<WebError> error = WebError::create(); + m_callback(toAPI(error.get()), m_context); + + m_callback = 0; + } + + uint64_t callbackID() const { return m_callbackID; } + +private: + static uint64_t generateCallbackID() + { + static uint64_t uniqueCallbackID = 1; + return uniqueCallbackID++; + } + + VoidCallback(void* context, CallbackFunction callback) + : m_context(context) + , m_callback(callback) + , m_callbackID(generateCallbackID()) + { + } + + void* m_context; + CallbackFunction m_callback; + uint64_t m_callbackID; +}; + +// FIXME: Make a version of GenericCallback with two arguments, and define ComputedPagesCallback as a specialization. +class ComputedPagesCallback : public RefCounted<ComputedPagesCallback> { +public: + typedef void (*CallbackFunction)(const Vector<WebCore::IntRect>&, double, WKErrorRef, void*); + + static PassRefPtr<ComputedPagesCallback> create(void* context, CallbackFunction callback) + { + return adoptRef(new ComputedPagesCallback(context, callback)); + } + + ~ComputedPagesCallback() + { + ASSERT(!m_callback); + } + + void performCallbackWithReturnValue(const Vector<WebCore::IntRect>& returnValue1, double returnValue2) + { + ASSERT(m_callback); + + m_callback(returnValue1, returnValue2, 0, m_context); + + m_callback = 0; + } + + void invalidate() + { + ASSERT(m_callback); + + RefPtr<WebError> error = WebError::create(); + m_callback(Vector<WebCore::IntRect>(), 0, toAPI(error.get()), m_context); + + m_callback = 0; + } + + uint64_t callbackID() const { return m_callbackID; } + +private: + static uint64_t generateCallbackID() + { + static uint64_t uniqueCallbackID = 1; + return uniqueCallbackID++; + } + + ComputedPagesCallback(void* context, CallbackFunction callback) + : m_context(context) + , m_callback(callback) + , m_callbackID(generateCallbackID()) + { + } + + void* m_context; + CallbackFunction m_callback; + uint64_t m_callbackID; +}; + template<typename APIReturnValueType, typename InternalReturnValueType = typename APITypeInfo<APIReturnValueType>::ImplType> class GenericCallback : public RefCounted<GenericCallback<APIReturnValueType, InternalReturnValueType> > { public: diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp index 285e329..38bbd6a 100644 --- a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "GeolocationPermissionRequestManagerProxy.h" #include "WebPageMessages.h" diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp index 9766ad2..4cd1736 100644 --- a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "GeolocationPermissionRequestProxy.h" #include "GeolocationPermissionRequestManagerProxy.h" diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp index 507edfa..15a7450 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ProcessLauncher.h" #include "WorkQueue.h" diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h index 31efd4d..8a1cd01 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h @@ -56,6 +56,7 @@ public: #if PLATFORM(MAC) static const cpu_type_t MatchCurrentArchitecture = 0; cpu_type_t architecture; + bool executableHeap; #endif }; @@ -72,11 +73,6 @@ public: static bool getProcessTypeFromString(const char*, ProcessType&); -#if PLATFORM(QT) - friend class ProcessLauncherHelper; - static QLocalSocket* takePendingConnection(); -#endif - private: ProcessLauncher(Client*, const LaunchOptions& launchOptions); diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp index 69e4893..d331749 100644 --- a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp +++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ThreadLauncher.h" #include "RunLoop.h" diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp index 2565a48..04d8a03 100644 --- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ProcessLauncher.h" #include "Connection.h" diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp index 2841e0a..b5fda40 100644 --- a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ThreadLauncher.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm index a725d6b..92f5ad3 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm @@ -23,24 +23,25 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ProcessLauncher.h" - -#include "RunLoop.h" -#include "WebProcess.h" -#include "WebKitSystemInterface.h" -#include <crt_externs.h> -#include <mach-o/dyld.h> -#include <mach/machine.h> -#include <runtime/InitializeThreading.h> -#include <servers/bootstrap.h> -#include <spawn.h> -#include <sys/param.h> -#include <sys/stat.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RetainPtr.h> -#include <wtf/Threading.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> +#import "config.h" +#import "ProcessLauncher.h" + +#import "RunLoop.h" +#import "WebProcess.h" +#import "WebKitSystemInterface.h" +#import <crt_externs.h> +#import <mach-o/dyld.h> +#import <mach/machine.h> +#import <runtime/InitializeThreading.h> +#import <servers/bootstrap.h> +#import <spawn.h> +#import <sys/param.h> +#import <sys/stat.h> +#import <wtf/PassRefPtr.h> +#import <wtf/RetainPtr.h> +#import <wtf/Threading.h> +#import <wtf/text/CString.h> +#import <wtf/text/WTFString.h> using namespace WebCore; @@ -230,6 +231,12 @@ void ProcessLauncher::launchProcess() // Start suspended so we can set up the termination notification handler. flags |= POSIX_SPAWN_START_SUSPENDED; +#ifndef BUILDING_ON_SNOW_LEOPARD + static const int allowExecutableHeapFlag = 0x2000; + if (m_launchOptions.executableHeap) + flags |= allowExecutableHeapFlag; +#endif + posix_spawnattr_setflags(&attr, flags); pid_t processIdentifier; diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm index 8aac275..c15073b 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ThreadLauncher.h" +#import "config.h" +#import "ThreadLauncher.h" -#include "RunLoop.h" -#include "WebProcess.h" -#include "WebSystemInterface.h" -#include <runtime/InitializeThreading.h> -#include <wtf/Threading.h> +#import "RunLoop.h" +#import "WebProcess.h" +#import "WebSystemInterface.h" +#import <runtime/InitializeThreading.h> +#import <wtf/Threading.h> namespace WebKit { diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp index 7dff894..85c3651 100644 --- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp +++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp @@ -24,20 +24,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ProcessLauncher.h" #include "Connection.h" -#include "CleanupHandler.h" #include "NotImplemented.h" #include "RunLoop.h" #include "WebProcess.h" -#include <runtime/InitializeThreading.h> -#include <string> -#include <wtf/HashSet.h> -#include <wtf/PassRefPtr.h> -#include <wtf/Threading.h> -#include <wtf/text/WTFString.h> - #include <QApplication> #include <QDebug> #include <QFile> @@ -45,52 +38,27 @@ #include <QMetaType> #include <QProcess> #include <QString> - #include <QtCore/qglobal.h> - +#include <errno.h> +#include <fcntl.h> +#include <runtime/InitializeThreading.h> +#include <string> #include <sys/resource.h> +#include <sys/socket.h> #include <unistd.h> +#include <wtf/HashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Threading.h> +#include <wtf/text/WTFString.h> +#if defined Q_OS_LINUX +#include <sys/prctl.h> +#include <signal.h> +#endif using namespace WebCore; namespace WebKit { -class ProcessLauncherHelper : public QObject { - Q_OBJECT -public: - ~ProcessLauncherHelper(); - void launch(WebKit::ProcessLauncher*); - QLocalSocket* takePendingConnection(); - static ProcessLauncherHelper* instance(); - - const QString serverName() const { return m_server.serverName(); } - -private: - ProcessLauncherHelper(); - QLocalServer m_server; - QList<WorkItem*> m_items; - - Q_SLOT void newConnection(); -}; - -Q_GLOBAL_STATIC(WTF::HashSet<QProcess*>, processes); - -static void cleanupAtExit() -{ - // Terminate our web process(es). - WTF::HashSet<QProcess*>::const_iterator end = processes()->end(); - for (WTF::HashSet<QProcess*>::const_iterator it = processes()->begin(); it != end; ++it) { - QProcess* process = *it; - process->disconnect(process); - process->terminate(); - if (!process->waitForFinished(200)) - process->kill(); - } - - // Do not leave the socket file behind. - QLocalServer::removeServer(ProcessLauncherHelper::instance()->serverName()); -} - class QtWebProcess : public QProcess { Q_OBJECT @@ -98,32 +66,20 @@ public: QtWebProcess(QObject* parent = 0) : QProcess(parent) { - static bool isRegistered = false; - if (!isRegistered) { - qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState"); - isRegistered = true; - } - - connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); } -private slots: - void processStateChanged(QProcess::ProcessState state); +protected: + virtual void setupChildProcess(); }; -void QtWebProcess::processStateChanged(QProcess::ProcessState state) +void QtWebProcess::setupChildProcess() { - QProcess* process = qobject_cast<QProcess*>(sender()); - if (!process) - return; - - if (state == QProcess::Running) - processes()->add(process); - else if (state == QProcess::NotRunning) - processes()->remove(process); +#if defined Q_OS_LINUX + prctl(PR_SET_PDEATHSIG, SIGKILL); +#endif } -void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher) +void ProcessLauncher::launchProcess() { QString applicationPath = "%1 %2"; @@ -133,12 +89,38 @@ void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher) applicationPath = applicationPath.arg("QtWebProcess"); } - QString program(applicationPath.arg(m_server.serverName())); + int sockets[2]; + if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) == -1) { + qDebug() << "Creation of socket failed with errno:" << errno; + ASSERT_NOT_REACHED(); + return; + } + + // Don't expose the ui socket to the web process + while (fcntl(sockets[1], F_SETFD, FD_CLOEXEC) == -1) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + while (close(sockets[0]) == -1 && errno == EINTR) { } + while (close(sockets[1]) == -1 && errno == EINTR) { } + return; + } + } + + QString program(applicationPath.arg(sockets[0])); QProcess* webProcess = new QtWebProcess(); webProcess->setProcessChannelMode(QProcess::ForwardedChannels); webProcess->start(program); + // Don't expose the web socket to possible future web processes + while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) { + if (errno != EINTR) { + ASSERT_NOT_REACHED(); + delete webProcess; + return; + } + } + if (!webProcess->waitForStarted()) { qDebug() << "Failed to start" << program; ASSERT_NOT_REACHED(); @@ -148,55 +130,7 @@ void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher) setpriority(PRIO_PROCESS, webProcess->pid(), 10); - m_items.append(WorkItem::create(launcher, &WebKit::ProcessLauncher::didFinishLaunchingProcess, webProcess, m_server.serverName()).leakPtr()); -} - -QLocalSocket* ProcessLauncherHelper::takePendingConnection() -{ - return m_server.nextPendingConnection(); -} - -ProcessLauncherHelper::~ProcessLauncherHelper() -{ - m_server.close(); -} - -ProcessLauncherHelper::ProcessLauncherHelper() -{ - srandom(time(0)); - if (!m_server.listen("QtWebKit" + QString::number(random()))) { - qDebug() << "Failed to create server socket."; - ASSERT_NOT_REACHED(); - } - connect(&m_server, SIGNAL(newConnection()), this, SLOT(newConnection())); -} - -ProcessLauncherHelper* ProcessLauncherHelper::instance() -{ - static ProcessLauncherHelper* result = 0; - if (!result) { - result = new ProcessLauncherHelper(); - - // The purpose of the following line is to ensure that our static is initialized before the exit handler is installed. - processes()->clear(); - - atexit(cleanupAtExit); - } - return result; -} - -void ProcessLauncherHelper::newConnection() -{ - ASSERT(!m_items.isEmpty()); - - m_items[0]->execute(); - delete m_items[0]; - m_items.pop_front(); -} - -void ProcessLauncher::launchProcess() -{ - ProcessLauncherHelper::instance()->launch(this); + RunLoop::main()->scheduleWork(WorkItem::create(this, &WebKit::ProcessLauncher::didFinishLaunchingProcess, webProcess, sockets[1])); } void ProcessLauncher::terminateProcess() @@ -208,14 +142,9 @@ void ProcessLauncher::terminateProcess() m_processIdentifier->terminate(); } -QLocalSocket* ProcessLauncher::takePendingConnection() -{ - return ProcessLauncherHelper::instance()->takePendingConnection(); -} - void ProcessLauncher::platformInvalidate() { - notImplemented(); + } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp index 471a424..313091e 100644 --- a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp +++ b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ThreadLauncher.h" #include "RunLoop.h" @@ -54,7 +55,7 @@ static void* webThreadBody(void* /* context */) // FIXME: We do not support threaded mode for now. - WebProcess::shared().initialize("foo", RunLoop::current()); + WebProcess::shared().initialize(-1, RunLoop::current()); RunLoop::run(); return 0; @@ -70,8 +71,7 @@ CoreIPC::Connection::Identifier ThreadLauncher::createWebThread() return 0; } - QString serverIdentifier = QString::number(connectionIdentifier); - return serverIdentifier; + return connectionIdentifier; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp index 7165a18..8981e80 100644 --- a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp +++ b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ProcessLauncher.h" #include "Connection.h" diff --git a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp index b8b2f64..2094fc6 100644 --- a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp +++ b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ThreadLauncher.h" #include "RunLoop.h" diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp index ffa91de..fbbff43 100644 --- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if USE(ACCELERATED_COMPOSITING) - +#include "config.h" #include "LayerBackedDrawingAreaProxy.h" +#if USE(ACCELERATED_COMPOSITING) + #include "DrawingAreaMessageKinds.h" #include "DrawingAreaProxyMessageKinds.h" #include "MessageID.h" @@ -55,7 +56,7 @@ LayerBackedDrawingAreaProxy::~LayerBackedDrawingAreaProxy() { } -#if !PLATFORM(WIN) +#if !PLATFORM(WIN) && !PLATFORM(MAC) bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) { return true; @@ -80,8 +81,7 @@ void LayerBackedDrawingAreaProxy::sizeDidChange() m_isWaitingForDidSetFrameNotification = true; - page->process()->responsivenessTimer()->start(); - page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size)); } #if !PLATFORM(MAC) && !PLATFORM(WIN) @@ -103,12 +103,12 @@ void LayerBackedDrawingAreaProxy::setPageIsVisible(bool isVisible) if (!m_isVisible) { // Tell the web process that it doesn't need to paint anything for now. - page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier)); return; } // The page is now visible. - page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier)); // FIXME: We should request a full repaint here if needed. } @@ -118,16 +118,13 @@ void LayerBackedDrawingAreaProxy::didSetSize(const IntSize& size) m_isWaitingForDidSetFrameNotification = false; if (size != m_lastSetViewSize) - setSize(m_lastSetViewSize); - - WebPageProxy* page = this->page(); - page->process()->responsivenessTimer()->stop(); + setSize(m_lastSetViewSize, IntSize()); } void LayerBackedDrawingAreaProxy::update() { WebPageProxy* page = this->page(); - page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); } void LayerBackedDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h index bbaa643..31aca5c 100644 --- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h @@ -33,13 +33,9 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class CALayer; -@class WKView; -#else -class CALayer; -class WKView; -#endif + +OBJC_CLASS CALayer; +OBJC_CLASS WKView; #endif namespace WebKit { diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index e483aef..4eb1860 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -79,6 +79,7 @@ public: virtual void processDidCrash() = 0; virtual void didRelaunchProcess() = 0; + virtual void pageClosed() = 0; virtual void takeFocus(bool direction) = 0; virtual void toolTipChanged(const String&, const String&) = 0; @@ -98,7 +99,7 @@ public: virtual void clearAllEditCommands() = 0; virtual void setEditCommandState(const String& commandName, bool isEnabled, int state) = 0; #if PLATFORM(MAC) - virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&) = 0; + virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0; virtual void interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines) = 0; virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0; #endif @@ -108,7 +109,7 @@ public: virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0; virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0; - virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0; + virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0; virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0; virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0; @@ -116,6 +117,9 @@ public: virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0; #if USE(ACCELERATED_COMPOSITING) + virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0; + virtual void exitAcceleratedCompositingMode() = 0; + virtual void pageDidEnterAcceleratedCompositing() = 0; virtual void pageDidLeaveAcceleratedCompositing() = 0; #endif @@ -126,10 +130,13 @@ public: #if PLATFORM(MAC) virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0; + virtual void setAutodisplay(bool) = 0; virtual CGContextRef containingWindowGraphicsContext() = 0; #endif + virtual void didChangeScrollbarsForMainFrame() const = 0; + // Custom representations. virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0; virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp index f4fb5ad..b3d9183 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PluginInfoStore.h" #include <WebCore/KURL.h> diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp index ff44e25..bca9689 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessManager.h" +#if ENABLE(PLUGIN_PROCESS) + #include "PluginInfoStore.h" #include "PluginProcessProxy.h" #include "WebContext.h" diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index 093a31f..4b3b3c0 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessProxy.h" +#if ENABLE(PLUGIN_PROCESS) + #include "MachPort.h" #include "PluginProcessCreationParameters.h" #include "PluginProcessManager.h" @@ -51,6 +52,9 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage launchOptions.processType = ProcessLauncher::PluginProcess; #if PLATFORM(MAC) launchOptions.architecture = pluginInfo.pluginArchitecture; + + // FIXME: This shouldn't be true for all plug-ins. + launchOptions.executableHeap = true; #endif m_processLauncher = ProcessLauncher::create(this, launchOptions); @@ -71,8 +75,9 @@ void PluginProcessProxy::createWebProcessConnection(WebProcessProxy* webProcessP return; } - // Ask the plug-in process to create a connection. - m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0); + // Ask the plug-in process to create a connection. Since the plug-in can be waiting for a synchronous reply + // we need to make sure that this message is always processed, even when the plug-in is waiting for a synchronus reply. + m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply); } void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch() @@ -126,7 +131,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio platformInitializePluginProcess(parameters); // Initialize the plug-in host process. - m_connection->send(Messages::PluginProcess::Initialize(parameters), 0); + m_connection->send(Messages::PluginProcess::InitializePluginProcess(parameters), 0); // Send all our pending requests. for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i) diff --git a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp index 8a6e86c..f06f0e5 100644 --- a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp +++ b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp @@ -24,7 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - +#include "config.h" #include "PluginInfoStore.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm index b787101..fb4329e 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "PluginInfoStore.h" - -#include "NetscapePluginModule.h" -#include "WebKitSystemInterface.h" -#include <WebCore/WebCoreNSStringExtras.h> -#include <wtf/HashSet.h> -#include <wtf/RetainPtr.h> +#import "config.h" +#import "PluginInfoStore.h" + +#import "NetscapePluginModule.h" +#import "WebKitSystemInterface.h" +#import <WebCore/WebCoreNSStringExtras.h> +#import <wtf/HashSet.h> +#import <wtf/RetainPtr.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm index eaf8aef..2adc473 100644 --- a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) +#import "config.h" +#import "PluginProcessProxy.h" -#include "PluginProcessProxy.h" +#if ENABLE(PLUGIN_PROCESS) -#include "PluginProcessCreationParameters.h" -#include "WebKitSystemInterface.h" +#import "PluginProcessCreationParameters.h" +#import "WebKitSystemInterface.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp index fc77663..4d76467 100644 --- a/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp +++ b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp @@ -25,6 +25,7 @@ // Note: this file is only for UNIX. On other platforms we can reuse the native implementation. +#include "config.h" #include "PluginInfoStore.h" #include "NetscapePluginModule.h" diff --git a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp index 1e0c251..2138131 100644 --- a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp +++ b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PluginInfoStore.h" #include "NetscapePluginModule.h" diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp index da54a7e..903c17a 100644 --- a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp +++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ResponsivenessTimer.h" #include "WorkItem.h" diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h index 7415da3..fc347fe 100644 --- a/Source/WebKit2/UIProcess/TextChecker.h +++ b/Source/WebKit2/UIProcess/TextChecker.h @@ -30,7 +30,7 @@ namespace WebKit { -class TextCheckerState; +struct TextCheckerState; class TextChecker { public: diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp index b687192..3b3334f 100644 --- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TiledDrawingAreaProxy.h" #if ENABLE(TILED_BACKING_STORE) @@ -82,7 +83,7 @@ void TiledDrawingAreaProxy::sizeDidChange() m_isWaitingForDidSetFrameNotification = true; page->process()->responsivenessTimer()->start(); - page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size)); } void TiledDrawingAreaProxy::setPageIsVisible(bool isVisible) @@ -98,12 +99,12 @@ void TiledDrawingAreaProxy::setPageIsVisible(bool isVisible) if (!m_isVisible) { // Tell the web process that it doesn't need to paint anything for now. - page->process()->send(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In()); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In()); return; } // The page is now visible. - page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In()); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In()); // FIXME: We should request a full repaint here if needed. } @@ -114,7 +115,7 @@ void TiledDrawingAreaProxy::didSetSize(const IntSize& viewSize) m_isWaitingForDidSetFrameNotification = false; if (viewSize != m_lastSetViewSize) - setSize(m_lastSetViewSize); + setSize(m_lastSetViewSize, IntSize()); WebPageProxy* page = this->page(); page->process()->responsivenessTimer()->stop(); @@ -177,7 +178,7 @@ void TiledDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC: void TiledDrawingAreaProxy::requestTileUpdate(int tileID, const IntRect& dirtyRect) { - page()->process()->connection()->send(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale())); + page()->process()->connection()->deprecatedSend(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale())); } void TiledDrawingAreaProxy::waitUntilUpdatesComplete() @@ -188,7 +189,7 @@ void TiledDrawingAreaProxy::waitUntilUpdatesComplete() float scale; unsigned pendingUpdateCount; static const double tileUpdateTimeout = 10.0; - OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout); + OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->deprecatedWaitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout); if (!arguments) break; if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount))) @@ -232,22 +233,22 @@ void TiledDrawingAreaProxy::setKeepAndCoverAreaMultipliers(const FloatSize& keep void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect) { WebPageProxy* page = this->page(); - page->process()->send(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect)); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect)); } void TiledDrawingAreaProxy::invalidate(const IntRect& contentsDirtyRect) { IntRect dirtyRect(mapFromContents(contentsDirtyRect)); - TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft()); - TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight()); + TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location()); + TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY())); IntRect coverRect = calculateCoverRect(m_previousVisibleRect); Vector<TiledDrawingAreaTile::Coordinate> tilesToRemove; - for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) { - for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) { + for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) { + for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) { RefPtr<TiledDrawingAreaTile> currentTile = tileAt(TiledDrawingAreaTile::Coordinate(xCoordinate, yCoordinate)); if (!currentTile) continue; @@ -337,11 +338,11 @@ bool TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext co IntRect dirtyRect = mapFromContents(rect); - TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft()); - TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight()); + TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location()); + TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY())); - for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) { - for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) { + for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) { + for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) { TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate); RefPtr<TiledDrawingAreaTile> currentTile = tileAt(currentCoordinate); if (currentTile && currentTile->isReadyToPaint()) @@ -435,10 +436,10 @@ void TiledDrawingAreaProxy::createTiles() Vector<TiledDrawingAreaTile::Coordinate> tilesToCreate; unsigned requiredTileCount = 0; bool hasVisibleCheckers = false; - TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(coverRect.topLeft()); - TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(coverRect.bottomRight()); - for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) { - for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) { + TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(visibleRect.location()); + TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(visibleRect.maxX(), visibleRect.maxY())); + for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) { + for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) { TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate); // Distance is 0 for all currently visible tiles. double distance = tileDistance(visibleRect, currentCoordinate); @@ -541,7 +542,7 @@ void TiledDrawingAreaProxy::removeTile(const TiledDrawingAreaTile::Coordinate& c if (!tile->hasBackBufferUpdatePending()) return; WebPageProxy* page = this->page(); - page->process()->send(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID())); + page->process()->deprecatedSend(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID())); } IntRect TiledDrawingAreaProxy::mapToContents(const IntRect& rect) const diff --git a/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp index 6beafff..94b595a 100644 --- a/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp +++ b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "VisitedLinkProvider.h" #include "SharedMemory.h" diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.cpp b/Source/WebKit2/UIProcess/WebBackForwardList.cpp index b351418..5c567b5 100644 --- a/Source/WebKit2/UIProcess/WebBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/WebBackForwardList.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebBackForwardList.h" #include "WebPageProxy.h" @@ -30,7 +31,6 @@ namespace WebKit { static const unsigned DefaultCapacity = 100; -static const unsigned NoCurrentItemIndex = UINT_MAX; WebBackForwardList::WebBackForwardList(WebPageProxy* page) : m_page(page) @@ -39,6 +39,7 @@ WebBackForwardList::WebBackForwardList(WebPageProxy* page) , m_closed(true) , m_enabled(true) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); } WebBackForwardList::~WebBackForwardList() @@ -58,15 +59,21 @@ void WebBackForwardList::pageClosed() void WebBackForwardList::addItem(WebBackForwardListItem* newItem) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + if (m_capacity == 0 || !m_enabled) return; + Vector<RefPtr<APIObject> > removedItems; + // Toss anything in the forward list if (m_current != NoCurrentItemIndex) { unsigned targetSize = m_current + 1; + removedItems.reserveCapacity(m_entries.size() - targetSize); while (m_entries.size() > targetSize) { if (m_page) m_page->backForwardRemovedItem(m_entries.last()->itemID()); + removedItems.append(m_entries.last().release()); m_entries.removeLast(); } } @@ -76,6 +83,7 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem) if (m_entries.size() == m_capacity && (m_current != 0 || m_capacity == 1)) { if (m_page) m_page->backForwardRemovedItem(m_entries[0]->itemID()); + removedItems.append(m_entries[0].release()); m_entries.remove(0); m_current--; } @@ -84,11 +92,15 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem) m_current++; if (m_page) - m_page->didChangeBackForwardList(); + m_page->didChangeBackForwardList(newItem, &removedItems); + + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); } void WebBackForwardList::goToItem(WebBackForwardListItem* item) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + if (!m_entries.size() || !item) return; @@ -100,12 +112,14 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item) if (index < m_entries.size()) { m_current = index; if (m_page) - m_page->didChangeBackForwardList(); + m_page->didChangeBackForwardList(0, 0); } } WebBackForwardListItem* WebBackForwardList::currentItem() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + if (m_current != NoCurrentItemIndex) return m_entries[m_current].get(); return 0; @@ -113,6 +127,8 @@ WebBackForwardListItem* WebBackForwardList::currentItem() WebBackForwardListItem* WebBackForwardList::backItem() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + if (m_current && m_current != NoCurrentItemIndex) return m_entries[m_current - 1].get(); return 0; @@ -120,6 +136,8 @@ WebBackForwardListItem* WebBackForwardList::backItem() WebBackForwardListItem* WebBackForwardList::forwardItem() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + if (m_entries.size() && m_current < m_entries.size() - 1) return m_entries[m_current + 1].get(); return 0; @@ -127,6 +145,8 @@ WebBackForwardListItem* WebBackForwardList::forwardItem() WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + // Do range checks without doing math on index to avoid overflow. if (index < -static_cast<int>(m_current)) return 0; @@ -139,16 +159,22 @@ WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index) int WebBackForwardList::backListCount() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + return m_current == NoCurrentItemIndex ? 0 : m_current; } int WebBackForwardList::forwardListCount() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + return m_current == NoCurrentItemIndex ? 0 : static_cast<int>(m_entries.size()) - (m_current + 1); } PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned limit) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + unsigned backListSize = static_cast<unsigned>(backListCount()); unsigned size = std::min(backListSize, limit); if (!size) @@ -166,6 +192,8 @@ PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLimit(unsigned limit) { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + unsigned size = std::min(static_cast<unsigned>(forwardListCount()), limit); if (!size) return ImmutableArray::create(); @@ -183,6 +211,8 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi void WebBackForwardList::clear() { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + size_t size = m_entries.size(); if (size <= 1) return; @@ -196,13 +226,20 @@ void WebBackForwardList::clear() } } + Vector<RefPtr<APIObject> > removedItems; + removedItems.reserveCapacity(m_entries.size() - 1); + for (size_t i = 0; i < m_entries.size(); ++i) { + if (i != m_current) + removedItems.append(m_entries[i].release()); + } + m_entries.shrink(1); m_entries[0] = currentItem.release(); m_current = 0; if (m_page) - m_page->didChangeBackForwardList(); + m_page->didChangeBackForwardList(0, &removedItems); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h index f51ab26..3376771 100644 --- a/Source/WebKit2/UIProcess/WebBackForwardList.h +++ b/Source/WebKit2/UIProcess/WebBackForwardList.h @@ -83,6 +83,8 @@ public: #endif private: + static const unsigned NoCurrentItemIndex = UINT_MAX; + WebBackForwardList(WebPageProxy*); virtual Type type() const { return APIType; } diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index 1bb6bc4..5411a36 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContext.h" #include "DownloadProxy.h" @@ -51,6 +52,8 @@ #include <wtf/RefCountedLeakCounter.h> #endif +#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process()->connection()) + using namespace WebCore; namespace WebKit { @@ -176,6 +179,7 @@ void WebContext::ensureWebProcess() parameters.cacheModel = m_cacheModel; parameters.languageCode = defaultLanguage(); parameters.applicationCacheDirectory = applicationCacheDirectory(); + parameters.databaseDirectory = databaseDirectory(); parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess; parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess; #if PLATFORM(MAC) @@ -200,7 +204,7 @@ void WebContext::ensureWebProcess() for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) { pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i]; - m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get()))); + m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get()))); } m_pendingMessagesToPostToInjectedBundle.clear(); } @@ -277,7 +281,7 @@ void WebContext::postMessageToInjectedBundle(const String& messageName, APIObjec // FIXME: We should consider returning false from this function if the messageBody cannot // be encoded. - m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); + m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); } // InjectedBundle client @@ -297,6 +301,7 @@ void WebContext::didReceiveSynchronousMessageFromInjectedBundle(const String& me void WebContext::didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore& store, uint64_t frameID) { WebFrameProxy* frame = m_process->webFrame(frameID); + MESSAGE_CHECK(frame); if (!frame->page()) return; @@ -306,6 +311,7 @@ void WebContext::didNavigateWithNavigationData(uint64_t pageID, const WebNavigat void WebContext::didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID) { WebFrameProxy* frame = m_process->webFrame(frameID); + MESSAGE_CHECK(frame); if (!frame->page()) return; @@ -315,6 +321,7 @@ void WebContext::didPerformClientRedirect(uint64_t pageID, const String& sourceU void WebContext::didPerformServerRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID) { WebFrameProxy* frame = m_process->webFrame(frameID); + MESSAGE_CHECK(frame); if (!frame->page()) return; @@ -324,6 +331,7 @@ void WebContext::didPerformServerRedirect(uint64_t pageID, const String& sourceU void WebContext::didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID) { WebFrameProxy* frame = m_process->webFrame(frameID); + MESSAGE_CHECK(frame); if (!frame->page()) return; @@ -602,4 +610,12 @@ void WebContext::stopMemorySampler() m_process->send(Messages::WebProcess::StopMemorySampler(), 0); } +String WebContext::databaseDirectory() const +{ + if (!m_overrideDatabaseDirectory.isEmpty()) + return m_overrideDatabaseDirectory; + + return platformDefaultDatabaseDirectory(); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index e973160..ebf1914 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -137,6 +137,8 @@ public: }; static Statistics& statistics(); + void setDatabaseDirectory(const String& dir) { m_overrideDatabaseDirectory = dir; } + private: WebContext(ProcessModel, const String& injectedBundlePath); @@ -162,6 +164,9 @@ private: static void languageChanged(void* context); void languageChanged(); + String databaseDirectory() const; + String platformDefaultDatabaseDirectory() const; + ProcessModel m_processModel; // FIXME: In the future, this should be one or more WebProcessProxies. @@ -203,6 +208,8 @@ private: #if PLATFORM(WIN) bool m_shouldPaintNativeControls; #endif + + String m_overrideDatabaseDirectory; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp index 97613f8..24e6271 100644 --- a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp +++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextInjectedBundleClient.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp index 887a260..4c4cb26 100644 --- a/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp +++ b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp @@ -22,6 +22,8 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "config.h" #include "WebContextMenuProxy.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp index 1bc0303..96488fb 100644 --- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebDatabaseManagerProxy.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp index 8ba3a0e..2f3c767 100644 --- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebDatabaseManagerProxyClient.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.cpp b/Source/WebKit2/UIProcess/WebDownloadClient.cpp index d6a7bcb..4b1b756 100644 --- a/Source/WebKit2/UIProcess/WebDownloadClient.cpp +++ b/Source/WebKit2/UIProcess/WebDownloadClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebDownloadClient.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp index 9a816e3..568faa1 100644 --- a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp +++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEditCommandProxy.h" #include "WebPageMessages.h" diff --git a/Source/WebKit2/UIProcess/WebFindClient.cpp b/Source/WebKit2/UIProcess/WebFindClient.cpp index e2e8de5..c8df91d 100644 --- a/Source/WebKit2/UIProcess/WebFindClient.cpp +++ b/Source/WebKit2/UIProcess/WebFindClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFindClient.h" #include "WKAPICast.h" #include <wtf/text/WTFString.h> diff --git a/Source/WebKit2/UIProcess/WebFormClient.cpp b/Source/WebKit2/UIProcess/WebFormClient.cpp index 159a34c..ecddbcc 100644 --- a/Source/WebKit2/UIProcess/WebFormClient.cpp +++ b/Source/WebKit2/UIProcess/WebFormClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFormClient.h" #include "ImmutableDictionary.h" diff --git a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp index 10564a4..dcc864a 100644 --- a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFormSubmissionListenerProxy.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp index c4e38ee..b998f58 100644 --- a/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFrameListenerProxy.h" #include "WebFrameProxy.h" diff --git a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp index 865d352..5764533 100644 --- a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFramePolicyListenerProxy.h" #include "WebFrameProxy.h" diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.cpp b/Source/WebKit2/UIProcess/WebFrameProxy.cpp index 779cf61..2df22c6 100644 --- a/Source/WebKit2/UIProcess/WebFrameProxy.cpp +++ b/Source/WebKit2/UIProcess/WebFrameProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFrameProxy.h" #include "WebCertificateInfo.h" @@ -137,16 +138,13 @@ void WebFrameProxy::didStartProvisionalLoad(const String& url) void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const String& url) { - ASSERT(!url.isEmpty()); ASSERT(m_loadState == LoadStateProvisional); - ASSERT(!m_provisionalURL.isEmpty()); m_provisionalURL = url; } void WebFrameProxy::didFailProvisionalLoad() { ASSERT(m_loadState == LoadStateProvisional); - ASSERT(!m_provisionalURL.isEmpty()); m_loadState = LoadStateFinished; m_provisionalURL = String(); } @@ -174,7 +172,6 @@ void WebFrameProxy::didFailLoad() { ASSERT(m_loadState == LoadStateCommitted); ASSERT(m_provisionalURL.isEmpty()); - ASSERT(!m_url.isEmpty()); m_loadState = LoadStateFinished; m_title = String(); } diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index 0842ca6..eae4935 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationManagerProxy.h" #include "WebContext.h" diff --git a/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp index c48ee89..c382235 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationProvider.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/WebHistoryClient.cpp b/Source/WebKit2/UIProcess/WebHistoryClient.cpp index d0ca71b..ca6cf94 100644 --- a/Source/WebKit2/UIProcess/WebHistoryClient.cpp +++ b/Source/WebKit2/UIProcess/WebHistoryClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebHistoryClient.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp index dfeff6a..2b282a1 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorProxy.h" #if ENABLE(INSPECTOR) @@ -69,6 +70,7 @@ WebInspectorProxy::~WebInspectorProxy() void WebInspectorProxy::invalidate() { + m_page->close(); platformClose(); m_page = 0; @@ -156,6 +158,11 @@ void WebInspectorProxy::togglePageProfiling() m_isProfilingPage = !m_isProfilingPage; } +bool WebInspectorProxy::isInspectorPage(WebPageProxy* page) +{ + return page->pageGroup() == inspectorPageGroup(); +} + // Called by WebInspectorProxy messages void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters) { diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index cc0725a..ac618c6 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -36,15 +36,10 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSWindow; -@class WKView; -@class WebInspectorProxyObjCAdapter; -#else -class NSWindow; -class WKView; -class WebInspectorProxyObjCAdapter; -#endif + +OBJC_CLASS NSWindow; +OBJC_CLASS WKView; +OBJC_CLASS WebInspectorProxyObjCAdapter; #endif namespace WebKit { @@ -98,6 +93,8 @@ public: CoreIPC::SyncReplyMode didReceiveSyncWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); #endif + static bool isInspectorPage(WebPageProxy*); + private: WebInspectorProxy(WebPageProxy* page); diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp index 0b14a17..96adb85 100644 --- a/Source/WebKit2/UIProcess/WebLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp @@ -23,8 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebLoaderClient.h" +#include "ImmutableArray.h" +#include "WebBackForwardListItem.h" #include "WKAPICast.h" #include <string.h> @@ -208,12 +211,16 @@ void WebLoaderClient::processDidCrash(WebPageProxy* page) m_client.processDidCrash(toAPI(page), m_client.clientInfo); } -void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page) +void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems) { if (!m_client.didChangeBackForwardList) return; - m_client.didChangeBackForwardList(toAPI(page), m_client.clientInfo); + RefPtr<ImmutableArray> removedItemsArray; + if (removedItems && !removedItems->isEmpty()) + removedItemsArray = ImmutableArray::adopt(*removedItems); + + m_client.didChangeBackForwardList(toAPI(page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.clientInfo); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.h b/Source/WebKit2/UIProcess/WebLoaderClient.h index 0c250fe..6600876 100644 --- a/Source/WebKit2/UIProcess/WebLoaderClient.h +++ b/Source/WebKit2/UIProcess/WebLoaderClient.h @@ -30,6 +30,8 @@ #include "SameDocumentNavigationType.h" #include "WKPage.h" #include <wtf/Forward.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> namespace WebCore { class ResourceError; @@ -40,6 +42,7 @@ namespace WebKit { class APIObject; class AuthenticationChallengeProxy; class AuthenticationDecisionListener; +class WebBackForwardListItem; class WebFrameProxy; class WebPageProxy; class WebProtectionSpace; @@ -73,7 +76,7 @@ public: void processDidBecomeResponsive(WebPageProxy*); void processDidCrash(WebPageProxy*); - void didChangeBackForwardList(WebPageProxy*); + void didChangeBackForwardList(WebPageProxy*, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems); }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebNavigationData.cpp b/Source/WebKit2/UIProcess/WebNavigationData.cpp index c4f17f3..eefc7d0 100644 --- a/Source/WebKit2/UIProcess/WebNavigationData.cpp +++ b/Source/WebKit2/UIProcess/WebNavigationData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebNavigationData.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp index de2d174..288a736 100644 --- a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebOpenPanelResultListenerProxy.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp index 73220b2..480a56e 100644 --- a/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp +++ b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageContextMenuClient.h" #include "Logging.h" diff --git a/Source/WebKit2/UIProcess/WebPageGroup.cpp b/Source/WebKit2/UIProcess/WebPageGroup.cpp index 901b393..aa4cfb7 100644 --- a/Source/WebKit2/UIProcess/WebPageGroup.cpp +++ b/Source/WebKit2/UIProcess/WebPageGroup.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageGroup.h" #include "WebPageProxy.h" diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 0be2f11..2582547 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageProxy.h" #include "AuthenticationChallengeProxy.h" @@ -65,6 +66,13 @@ #include "WebProtectionSpace.h" #include "WebSecurityOrigin.h" #include "WebURLRequest.h" +#if PLATFORM(WIN) +#include "WebDragSource.h" +#include <WebCore/BitmapInfo.h> +#include <WebCore/COMPtr.h> +#include <WebCore/WCDataObject.h> +#include <shlobj.h> +#endif #include <WebCore/DragData.h> #include <WebCore/FloatRect.h> #include <WebCore/MIMETypeRegistry.h> @@ -113,10 +121,14 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG , m_isValid(true) , m_isClosed(false) , m_isInPrintingMode(false) + , m_isPerformingDOMPrintOperation(false) , m_inDecidePolicyForMIMEType(false) , m_syncMimeTypePolicyActionIsValid(false) , m_syncMimeTypePolicyAction(PolicyUse) , m_syncMimeTypePolicyDownloadID(0) + , m_inDecidePolicyForNavigationAction(false) + , m_syncNavigationActionPolicyActionIsValid(false) + , m_syncNavigationActionPolicyAction(PolicyUse) , m_processingWheelEvent(false) , m_processingMouseMoveEvent(false) , m_pageID(pageID) @@ -128,6 +140,8 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG , m_pendingLearnOrIgnoreWordMessageCount(0) , m_mainFrameHasCustomRepresentation(false) , m_currentDragOperation(DragOperationNone) + , m_mainFrameHasHorizontalScrollbar(false) + , m_mainFrameHasVerticalScrollbar(false) { #ifndef NDEBUG webPageProxyCounter.increment(); @@ -227,9 +241,13 @@ void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item) m_backForwardList->goToItem(item); reattachToWebProcess(); - - if (item) - process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); + + if (!item) + return; + + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle); + process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID); } void WebPageProxy::initializeWebPage() @@ -254,6 +272,7 @@ void WebPageProxy::close() m_isClosed = true; m_backForwardList->pageClosed(); + m_pageClient->pageClosed(); process()->disconnectFramesFromPage(this); m_mainFrame = 0; @@ -274,8 +293,13 @@ void WebPageProxy::close() m_toolTip = String(); + m_mainFrameHasHorizontalScrollbar = false; + m_mainFrameHasVerticalScrollbar = false; + + invalidateCallbackMap(m_voidCallbacks); invalidateCallbackMap(m_dataCallbacks); invalidateCallbackMap(m_stringCallbacks); + invalidateCallbackMap(m_computedPagesCallbacks); Vector<WebEditCommandProxy*> editCommandVector; copyToVector(m_editCommandSet, editCommandVector); @@ -306,16 +330,22 @@ bool WebPageProxy::tryClose() return false; } -static void initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle) +void WebPageProxy::initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle) { if (!url.isLocalFile()) return; + // Don't give the inspector full access to the file system. + if (WebInspectorProxy::isInspectorPage(this)) + return; + SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle); } void WebPageProxy::loadURL(const String& url) { + setPendingAPIRequestURL(url); + if (!isValid()) reattachToWebProcess(); @@ -326,6 +356,8 @@ void WebPageProxy::loadURL(const String& url) void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest) { + setPendingAPIRequestURL(urlRequest->resourceRequest().url()); + if (!isValid()) reattachToWebProcess(); @@ -369,6 +401,9 @@ void WebPageProxy::stopLoading() void WebPageProxy::reload(bool reloadFromOrigin) { + if (m_backForwardList->currentItem()) + setPendingAPIRequestURL(m_backForwardList->currentItem()->url()); + if (!isValid()) { reattachToWebProcessWithItem(m_backForwardList->currentItem()); return; @@ -379,15 +414,21 @@ void WebPageProxy::reload(bool reloadFromOrigin) void WebPageProxy::goForward() { - if (!isValid()) { - reattachToWebProcessWithItem(m_backForwardList->forwardItem()); + if (isValid() && !canGoForward()) return; - } - if (!canGoForward()) + WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem(); + if (forwardItem) + setPendingAPIRequestURL(forwardItem->url()); + + if (!isValid()) { + reattachToWebProcessWithItem(forwardItem); return; + } - process()->send(Messages::WebPage::GoForward(m_backForwardList->forwardItem()->itemID()), m_pageID); + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(KURL(KURL(), forwardItem->url()), sandboxExtensionHandle); + process()->send(Messages::WebPage::GoForward(forwardItem->itemID(), sandboxExtensionHandle), m_pageID); } bool WebPageProxy::canGoForward() const @@ -397,15 +438,21 @@ bool WebPageProxy::canGoForward() const void WebPageProxy::goBack() { - if (!isValid()) { - reattachToWebProcessWithItem(m_backForwardList->backItem()); + if (isValid() && !canGoBack()) return; - } - if (!canGoBack()) + WebBackForwardListItem* backItem = m_backForwardList->backItem(); + if (backItem) + setPendingAPIRequestURL(backItem->url()); + + if (!isValid()) { + reattachToWebProcessWithItem(backItem); return; + } - process()->send(Messages::WebPage::GoBack(m_backForwardList->backItem()->itemID()), m_pageID); + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(KURL(KURL(), backItem->url()), sandboxExtensionHandle); + process()->send(Messages::WebPage::GoBack(backItem->itemID(), sandboxExtensionHandle), m_pageID); } bool WebPageProxy::canGoBack() const @@ -420,12 +467,14 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item) return; } - process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle); + process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID); } -void WebPageProxy::didChangeBackForwardList() +void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed) { - m_loaderClient.didChangeBackForwardList(this); + m_loaderClient.didChangeBackForwardList(this, added, removed); } @@ -467,6 +516,16 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID); } +void WebPageProxy::viewWillStartLiveResize() +{ + process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID); +} + +void WebPageProxy::viewWillEndLiveResize() +{ + process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID); +} + void WebPageProxy::setViewNeedsDisplay(const IntRect& rect) { m_pageClient->setViewNeedsDisplay(rect); @@ -609,7 +668,13 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, WebC { if (!isValid()) return; +#if PLATFORM(WIN) + // FIXME: We should pass the drag data map only on DragEnter. + process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), + dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID); +#else process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags()), m_pageID); +#endif } void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation) @@ -628,6 +693,63 @@ void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const I } #endif +#if PLATFORM(WIN) + +void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect, + const HashMap<UINT, Vector<String> >& dataMap, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag) +{ + COMPtr<WCDataObject> dataObject; + WCDataObject::createInstance(&dataObject, dataMap); + + RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly); + if (!memoryBuffer) + return; + + RefPtr<WebDragSource> source = WebDragSource::createInstance(); + if (!source) + return; + + COMPtr<IDragSourceHelper> helper; + if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper)))) + return; + + BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize); + void* bits; + OwnPtr<HBITMAP> hbmp(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0)); + memcpy(bits, memoryBuffer->data(), memoryBuffer->size()); + + SHDRAGIMAGE sdi; + sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth; + sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight; + sdi.crColorKey = 0xffffffff; + sdi.hbmpDragImage = hbmp.leakPtr(); + sdi.ptOffset.x = dragPoint.x() - imageOrigin.x(); + sdi.ptOffset.y = dragPoint.y() - imageOrigin.y(); + if (isLinkDrag) + sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y; + + helper->InitializeFromBitmap(&sdi, dataObject.get()); + + DWORD effect = DROPEFFECT_NONE; + + DragOperation operation = DragOperationNone; + if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) { + if (effect & DROPEFFECT_COPY) + operation = DragOperationCopy; + else if (effect & DROPEFFECT_LINK) + operation = DragOperationLink; + else if (effect & DROPEFFECT_MOVE) + operation = DragOperationMove; + } + POINT globalPoint; + ::GetCursorPos(&globalPoint); + POINT localPoint = globalPoint; + ::ScreenToClient(m_pageClient->nativeWindow(), &localPoint); + + dragEnded(localPoint, globalPoint, operation); +} +#endif + void WebPageProxy::dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation) { if (!isValid()) @@ -701,6 +823,17 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) process()->send(Messages::WebPage::KeyEvent(event), m_pageID); } +#if ENABLE(GESTURE_EVENTS) +void WebPageProxy::handleGestureEvent(const WebGestureEvent& event) +{ + if (!isValid()) + return; + + process()->responsivenessTimer()->start(); + process()->send(Messages::WebPage::GestureEvent(event), m_pageID); +} +#endif + #if ENABLE(TOUCH_EVENTS) void WebPageProxy::handleTouchEvent(const WebTouchEvent& event) { @@ -730,6 +863,14 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr return; } + // If we received a policy decision while in decidePolicyForNavigationAction the decision will + // be sent back to the web process by decidePolicyForNavigationAction. + if (m_inDecidePolicyForNavigationAction) { + m_syncNavigationActionPolicyActionIsValid = true; + m_syncNavigationActionPolicyAction = action; + return; + } + process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID); } @@ -890,10 +1031,6 @@ void WebPageProxy::scaleWebView(double scale, const IntPoint& origin) if (!isValid()) return; - if (m_viewScaleFactor == scale) - return; - - m_viewScaleFactor = scale; process()->send(Messages::WebPage::ScaleWebView(scale, origin), m_pageID); } @@ -923,6 +1060,11 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size) process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); } +void WebPageProxy::viewScaleFactorDidChange(double scaleFactor) +{ + m_viewScaleFactor = scaleFactor; +} + void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount) { process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID); @@ -1002,6 +1144,20 @@ void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCal process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID); } +void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback) +{ + RefPtr<VoidCallback> callback = prpCallback; + + if (!isValid()) { + callback->invalidate(); + return; + } + + uint64_t callbackID = callback->callbackID(); + m_voidCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID); +} + void WebPageProxy::preferencesDidChange() { if (!isValid()) @@ -1022,7 +1178,7 @@ void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& t void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) { m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments); return; @@ -1138,17 +1294,30 @@ void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t paren parentFrame->appendChild(subframe); } + +// Always start progress at initialProgressValue. This helps provide feedback as +// soon as a load starts. + +static const double initialProgressValue = 0.1; + +double WebPageProxy::estimatedProgress() const +{ + if (!pendingAPIRequestURL().isNull()) + return initialProgressValue; + return m_estimatedProgress; +} + void WebPageProxy::didStartProgress() { - m_estimatedProgress = 0.0; - + m_estimatedProgress = initialProgressValue; + m_loaderClient.didStartProgress(this); } void WebPageProxy::didChangeProgress(double value) { m_estimatedProgress = value; - + m_loaderClient.didChangeProgress(this); } @@ -1161,6 +1330,8 @@ void WebPageProxy::didFinishProgress() void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments) { + clearPendingAPIRequestURL(); + RefPtr<APIObject> userData; WebContextUserMessageDecoder messageDecoder(userData, context()); if (!arguments->decode(messageDecoder)) @@ -1366,13 +1537,6 @@ void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::Argu m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get()); } -void WebPageProxy::didReceiveAccessibilityPageToken(const CoreIPC::DataReference& data) -{ -#if PLATFORM(MAC) - m_pageClient->accessibilityChildTokenReceived(data); -#endif -} - void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value) { WebFrameProxy* frame = process()->webFrame(frameID); @@ -1384,9 +1548,16 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value) } // PolicyClient - -void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID) +void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction) { + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + if (request.url() != pendingAPIRequestURL()) + clearPendingAPIRequestURL(); + WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); @@ -1395,12 +1566,31 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton); RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID); - if (!m_policyClient.decidePolicyForNavigationAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get())) + + ASSERT(!m_inDecidePolicyForNavigationAction); + + m_inDecidePolicyForNavigationAction = true; + m_syncNavigationActionPolicyActionIsValid = false; + + if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get())) listener->use(); + + m_inDecidePolicyForNavigationAction = false; + + // Check if we received a policy decision already. If we did, we can just pass it back. + if (m_syncNavigationActionPolicyActionIsValid) { + receivedPolicyAction = true; + policyAction = m_syncNavigationActionPolicyAction; + } } -void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID) +void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments) { + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); @@ -1409,12 +1599,17 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton); RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID); - if (!m_policyClient.decidePolicyForNewWindowAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get())) + if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get())) listener->use(); } -void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID) +void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID) { + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); @@ -1425,7 +1620,7 @@ void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMET m_inDecidePolicyForMIMEType = true; m_syncMimeTypePolicyActionIsValid = false; - if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get())) + if (!m_policyClient.decidePolicyForMIMEType(this, frame, MIMEType, request, listener.get(), 0 /*userData*/)) listener->use(); m_inDecidePolicyForMIMEType = false; @@ -1460,12 +1655,12 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons // ResourceLoad Client -void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request) +void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading) { WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); - m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request); + m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading); } void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse) @@ -1674,10 +1869,15 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters:: void WebPageProxy::printFrame(uint64_t frameID) { + ASSERT(!m_isPerformingDOMPrintOperation); + m_isPerformingDOMPrintOperation = true; + WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); m_uiClient.printFrame(this, frame); + + m_isPerformingDOMPrintOperation = false; } #if PLATFORM(QT) @@ -1798,9 +1998,9 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCou m_findClient.didCountStringMatches(this, string, matchCount); } -void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut) +void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut) { - RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle); + RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle); m_pageClient->setFindIndicator(findIndicator.release(), fadeOut); } @@ -1824,20 +2024,26 @@ void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID); } -void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data) +void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data) { - if (m_activePopupMenu) + if (m_activePopupMenu) { m_activePopupMenu->hidePopupMenu(); - else - m_activePopupMenu = m_pageClient->createPopupMenuProxy(this); + m_activePopupMenu->invalidate(); + m_activePopupMenu = 0; + } + + m_activePopupMenu = m_pageClient->createPopupMenuProxy(this); #if PLATFORM(WIN) // On Windows, we're about to run our own message pump in showPopupMenu(), so turn off the responsiveness timer. process()->responsivenessTimer()->stop(); #endif - m_activePopupMenu->showPopupMenu(rect, items, data, selectedIndex); - m_activePopupMenu = 0; + RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu; + + protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), items, data, selectedIndex); + protectedActivePopupMenu->invalidate(); + protectedActivePopupMenu = 0; } void WebPageProxy::hidePopupMenu() @@ -1846,6 +2052,7 @@ void WebPageProxy::hidePopupMenu() return; m_activePopupMenu->hidePopupMenu(); + m_activePopupMenu->invalidate(); m_activePopupMenu = 0; } @@ -1929,7 +2136,16 @@ void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) if (!isValid()) return; - // FIXME: This also needs to send a sandbox extension for these paths. +#if ENABLE(WEB_PROCESS_SANDBOX) + // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This + // is gated on a way of passing SandboxExtension::Handles in a Vector. + for (size_t i = 0; i < fileURLs.size(); ++i) { + SandboxExtension::Handle sandboxExtensionHandle; + SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle); + process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID); + } +#endif + process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); m_openPanelResultListener->invalidate(); @@ -2096,6 +2312,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) case WebEvent::KeyUp: case WebEvent::RawKeyDown: case WebEvent::Char: +#if ENABLE(GESTURE_EVENTS) + case WebEvent::GestureScrollBegin: + case WebEvent::GestureScrollEnd: +#endif process()->responsivenessTimer()->stop(); break; } @@ -2110,6 +2330,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) break; case WebEvent::MouseDown: case WebEvent::MouseUp: +#if ENABLE(GESTURE_EVENTS) + case WebEvent::GestureScrollBegin: + case WebEvent::GestureScrollEnd: +#endif break; case WebEvent::Wheel: { @@ -2130,16 +2354,28 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) m_keyEventQueue.removeFirst(); + m_pageClient->doneWithKeyEvent(event, handled); + if (handled) break; - m_pageClient->didNotHandleKeyEvent(event); m_uiClient.didNotHandleKeyEvent(this, event); break; } } } +void WebPageProxy::voidCallback(uint64_t callbackID) +{ + RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + callback->performCallback(); +} + void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID) { RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID); @@ -2162,13 +2398,30 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI callback->performCallbackWithReturnValue(resultString.impl()); } +void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID) +{ + RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting); +} + #if PLATFORM(MAC) -void WebPageProxy::sendAccessibilityPresenterToken(const CoreIPC::DataReference& token) + +void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data) +{ + m_pageClient->accessibilityWebProcessTokenReceived(data); +} + +void WebPageProxy::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken) { if (!isValid()) return; - process()->send(Messages::WebPage::SendAccessibilityPresenterToken(token), m_pageID); + process()->send(Messages::WebPage::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID); } #endif @@ -2249,8 +2502,13 @@ void WebPageProxy::processDidCrash() m_toolTip = String(); + m_mainFrameHasHorizontalScrollbar = false; + m_mainFrameHasVerticalScrollbar = false; + + invalidateCallbackMap(m_voidCallbacks); invalidateCallbackMap(m_dataCallbacks); invalidateCallbackMap(m_stringCallbacks); + invalidateCallbackMap(m_computedPagesCallbacks); Vector<WebEditCommandProxy*> editCommandVector; copyToVector(m_editCommandSet, editCommandVector); @@ -2302,6 +2560,15 @@ WebPageCreationParameters WebPageProxy::creationParameters() const } #if USE(ACCELERATED_COMPOSITING) +void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) +{ + m_pageClient->enterAcceleratedCompositingMode(layerTreeContext); +} + +void WebPageProxy::exitAcceleratedCompositingMode() +{ + m_pageClient->exitAcceleratedCompositingMode(); +} void WebPageProxy::didEnterAcceleratedCompositing() { @@ -2372,16 +2639,29 @@ float WebPageProxy::footerHeight(WebFrameProxy* frame) return m_uiClient.footerHeight(this, frame); } -void WebPageProxy::drawHeader(WebFrameProxy* frame, const WebCore::FloatRect& rect) +void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect) { m_uiClient.drawHeader(this, frame, rect); } -void WebPageProxy::drawFooter(WebFrameProxy* frame, const WebCore::FloatRect& rect) +void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect) { m_uiClient.drawFooter(this, frame, rect); } +void WebPageProxy::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) +{ + m_uiClient.didCompleteRubberBandForMainFrame(this, initialOverhang); +} + +void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar) +{ + m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar; + m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar; + + m_pageClient->didChangeScrollbarsForMainFrame(); +} + void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference) { m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference); @@ -2392,6 +2672,11 @@ void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIde { m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled); } + +void WebPageProxy::setAutodisplay(bool newState) +{ + m_pageClient->setAutodisplay(newState); +} #endif void WebPageProxy::backForwardRemovedItem(uint64_t itemID) @@ -2405,7 +2690,7 @@ void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInf return; m_isInPrintingMode = true; - process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID); + process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } void WebPageProxy::endPrinting() @@ -2414,20 +2699,30 @@ void WebPageProxy::endPrinting() return; m_isInPrintingMode = false; - process()->send(Messages::WebPage::EndPrinting(), m_pageID); + process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } -void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting) +void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> callback) { - // Layout for printing can take a long time, but we need to have the answer. - process()->sendSync(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo), Messages::WebPage::ComputePagesForPrinting::Reply(resultPageRects, resultTotalScaleFactorForPrinting), m_pageID); + uint64_t callbackID = callback->callbackID(); + m_computedPagesCallbacks.set(callbackID, callback.get()); + m_isInPrintingMode = true; + process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } #if PLATFORM(MAC) -void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, Vector<uint8_t>& pdfData) +void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, PassRefPtr<DataCallback> callback) { - // Printing can take a long time, but we need to have the answer. - process()->sendSync(Messages::WebPage::DrawRectToPDF(frame->frameID(), rect), Messages::WebPage::DrawRectToPDF::Reply(pdfData), m_pageID); + uint64_t callbackID = callback->callbackID(); + m_dataCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); +} + +void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, uint32_t first, uint32_t count, PassRefPtr<DataCallback> callback) +{ + uint64_t callbackID = callback->callbackID(); + m_dataCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } #endif diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index dc43e19..46aa240 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -31,6 +31,7 @@ #include "DragControllerAction.h" #include "DrawingAreaProxy.h" #include "GeolocationPermissionRequestManagerProxy.h" +#include "SandboxExtension.h" #include "SelectionState.h" #include "SharedMemory.h" #include "WKBase.h" @@ -81,13 +82,11 @@ namespace WebCore { namespace WebKit { -class ContextMenuState; class DrawingAreaProxy; class NativeWebKeyboardEvent; class PageClient; class PlatformCertificateInfo; class StringPairVector; -class WebOpenPanelResultListenerProxy; class WebBackForwardList; class WebBackForwardListItem; class WebContextMenuProxy; @@ -95,16 +94,22 @@ class WebData; class WebEditCommandProxy; class WebKeyboardEvent; class WebMouseEvent; +class WebOpenPanelResultListenerProxy; class WebPageGroup; class WebPopupMenuProxy; class WebProcessProxy; class WebURLRequest; class WebWheelEvent; +struct ContextMenuState; struct PlatformPopupMenuData; struct PrintInfo; struct WebPageCreationParameters; struct WebPopupItem; +#if ENABLE(GESTURE_EVENTS) +class WebGestureEvent; +#endif + typedef GenericCallback<WKStringRef, StringImpl*> StringCallback; class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client { @@ -158,7 +163,7 @@ public: bool canGoBack() const; void goToBackForwardItem(WebBackForwardListItem*); - void didChangeBackForwardList(); + void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems); bool canShowMIMEType(const String& mimeType) const; @@ -168,6 +173,9 @@ public: bool drawsTransparentBackground() const { return m_drawsTransparentBackground; } void setDrawsTransparentBackground(bool); + void viewWillStartLiveResize(); + void viewWillEndLiveResize(); + void setInitialFocus(bool); void setWindowResizerSize(const WebCore::IntSize&); @@ -215,6 +223,9 @@ public: void handleMouseEvent(const WebMouseEvent&); void handleWheelEvent(const WebWheelEvent&); void handleKeyboardEvent(const NativeWebKeyboardEvent&); +#if ENABLE(GESTURE_EVENTS) + void handleGestureEvent(const WebGestureEvent&); +#endif #if ENABLE(TOUCH_EVENTS) void handleTouchEvent(const WebTouchEvent&); #endif @@ -233,7 +244,7 @@ public: void setCustomTextEncodingName(const String&); String customTextEncodingName() const { return m_customTextEncodingName; } - double estimatedProgress() const { return m_estimatedProgress; } + double estimatedProgress() const; void terminateProcess(); @@ -256,10 +267,18 @@ public: bool useFixedLayout() const { return m_useFixedLayout; }; const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; }; + bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; } + bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; } + #if PLATFORM(MAC) - void sendAccessibilityPresenterToken(const CoreIPC::DataReference&); + // Called by the web process through a message. + void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&); + // Called by the UI process when it is ready to send its tokens to the web process. + void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken); #endif + void viewScaleFactorDidChange(double); + // Find. void findString(const String&, FindOptions, unsigned maxMatchCount); void hideFindUI(); @@ -273,23 +292,31 @@ public: void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>); void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>); void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>); - + void forceRepaint(PassRefPtr<VoidCallback>); + float headerHeight(WebFrameProxy*); float footerHeight(WebFrameProxy*); void drawHeader(WebFrameProxy*, const WebCore::FloatRect&); void drawFooter(WebFrameProxy*, const WebCore::FloatRect&); +#if PLATFORM(MAC) + void setAutodisplay(bool); +#endif + void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID); void backForwardRemovedItem(uint64_t itemID); // Drag and drop support. - void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String&); + void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& = String()); void didPerformDragControllerAction(uint64_t resultOperation); void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation); #if PLATFORM(MAC) void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag); #endif +#if PLATFORM(WIN) + void startDragDrop(const WebCore::IntPoint& imagePoint, const WebCore::IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, const WebCore::IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag); +#endif void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); @@ -298,6 +325,11 @@ public: void processDidCrash(); #if USE(ACCELERATED_COMPOSITING) + virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); + virtual void exitAcceleratedCompositingMode(); +#endif + +#if USE(ACCELERATED_COMPOSITING) void didEnterAcceleratedCompositing(); void didLeaveAcceleratedCompositing(); #endif @@ -356,11 +388,14 @@ public: void beginPrinting(WebFrameProxy*, const PrintInfo&); void endPrinting(); - void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting); + void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>); #if PLATFORM(MAC) - void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, Vector<uint8_t>& pdfData); + void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>); + void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>); #endif + const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; } + private: WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID); @@ -397,16 +432,15 @@ private: void didStartProgress(); void didChangeProgress(double); void didFinishProgress(); - void didReceiveAccessibilityPageToken(const CoreIPC::DataReference&); - void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID); - void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID); - void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID); + void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction); + void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*); + void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID); void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*); // Resource load client - void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&); + void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading); void didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); void didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceResponse&); void didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength); @@ -442,6 +476,8 @@ private: void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota); void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier); void runModal() { m_uiClient.runModal(this); } + void didCompleteRubberBandForMainFrame(const WebCore::IntSize&); + void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar); void reattachToWebProcess(); void reattachToWebProcessWithItem(WebBackForwardListItem*); @@ -477,12 +513,12 @@ private: // Find. void didCountStringMatches(const String&, uint32_t matchCount); - void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut); + void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut); void didFindString(const String&, uint32_t matchCount); void didFailToFindString(const String&); // Popup Menu. - void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&); + void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&); void hidePopupMenu(); // Context Menu. @@ -510,8 +546,10 @@ private: void didReceiveEvent(uint32_t opaqueType, bool handled); + void voidCallback(uint64_t); void dataCallback(const CoreIPC::DataReference&, uint64_t); void stringCallback(const String&, uint64_t); + void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t); void focusedFrameChanged(uint64_t frameID); void frameSetLargestFrameChanged(uint64_t frameID); @@ -531,6 +569,11 @@ private: static String standardUserAgent(const String& applicationName = String()); + void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); } + void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; } + + void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&); + PageClient* m_pageClient; WebLoaderClient m_loaderClient; WebPolicyClient m_policyClient; @@ -556,8 +599,10 @@ private: RefPtr<WebInspectorProxy> m_inspector; #endif + HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks; HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks; HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks; + HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks; HashSet<WebEditCommandProxy*> m_editCommandSet; @@ -603,12 +648,17 @@ private: bool m_isClosed; bool m_isInPrintingMode; + bool m_isPerformingDOMPrintOperation; bool m_inDecidePolicyForMIMEType; bool m_syncMimeTypePolicyActionIsValid; WebCore::PolicyAction m_syncMimeTypePolicyAction; uint64_t m_syncMimeTypePolicyDownloadID; + bool m_inDecidePolicyForNavigationAction; + bool m_syncNavigationActionPolicyActionIsValid; + WebCore::PolicyAction m_syncNavigationActionPolicyAction; + Deque<NativeWebKeyboardEvent> m_keyEventQueue; bool m_processingWheelEvent; OwnPtr<WebWheelEvent> m_nextWheelEvent; @@ -628,6 +678,11 @@ private: bool m_mainFrameHasCustomRepresentation; WebCore::DragOperation m_currentDragOperation; + + String m_pendingAPIRequestURL; + + bool m_mainFrameHasHorizontalScrollbar; + bool m_mainFrameHasVerticalScrollbar; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 6456851..e566d02 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -55,6 +55,8 @@ messages -> WebPageProxy { RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters) PrintFrame(uint64_t frameID) -> () RunModal() + DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang) + DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar) #if ENABLE(TILED_BACKING_STORE) PageDidRequestScroll(WebCore::IntSize delta) @@ -65,9 +67,9 @@ messages -> WebPageProxy { #endif # Policy messages - DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WTF::String url, uint64_t listenerID) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) - DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID) - DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WTF::String url, uint64_t listenerID) + DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID) + DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction) + DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) # Progress messages DidChangeProgress(double value) @@ -99,7 +101,7 @@ messages -> WebPageProxy { FrameDidBecomeFrameSet(uint64_t frameID, bool value) # Resource load messages - DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request) + DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request, bool pageIsProvisionallyLoading) DidSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse) DidReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceResponse response) DidReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength) @@ -113,14 +115,20 @@ messages -> WebPageProxy { WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) # Callback messages + VoidCallback(uint64_t callbackID) DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID) StringCallback(WTF::String resultString, uint64_t callbackID) + ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, uint64_t callbackID) - DidReceiveAccessibilityPageToken(CoreIPC::DataReference data) + + ViewScaleFactorDidChange(double scaleFactor) #if PLATFORM(MAC) # Keyboard support messages InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines) + + # Remote accessibility messages + RegisterWebProcessAccessibilityToken(CoreIPC::DataReference data) #endif # BackForward messages @@ -149,7 +157,7 @@ messages -> WebPageProxy { DidFailToFindString(WTF::String string) # PopupMenu messages - ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data) + ShowPopupMenu(WebCore::IntRect rect, uint64_t textDirection, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data) HidePopupMenu() # ContextMenu messages @@ -188,10 +196,13 @@ messages -> WebPageProxy { GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses) LearnWord(WTF::String word); IgnoreWord(WTF::String word); - + # Drag and drop messages DidPerformDragControllerAction(uint64_t resultOperation) #if PLATFORM(MAC) SetDragImage(WebCore::IntPoint clientPosition, WebCore::IntSize imageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag) #endif +#if PLATFORM(WIN) + StartDragDrop(WebCore::IntPoint imagePoint, WebCore::IntPoint dragPoint, uint64_t okEffect, HashMap<UINT,Vector<String> > dataMap, WebCore::IntSize dragImageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag) +#endif } diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.cpp b/Source/WebKit2/UIProcess/WebPolicyClient.cpp index e7a8239..6296664 100644 --- a/Source/WebKit2/UIProcess/WebPolicyClient.cpp +++ b/Source/WebKit2/UIProcess/WebPolicyClient.cpp @@ -23,39 +23,46 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPolicyClient.h" #include "WKAPICast.h" -#include <wtf/text/WTFString.h> +#include "WebURLRequest.h" using namespace WebCore; namespace WebKit { -bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener) +bool WebPolicyClient::decidePolicyForNavigationAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData) { if (!m_client.decidePolicyForNavigationAction) return false; - m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo); + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo); return true; } -bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener) +bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFrameProxy* frame, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const ResourceRequest& resourceRequest, const String& frameName, WebFramePolicyListenerProxy* listener, APIObject* userData) { if (!m_client.decidePolicyForNewWindowAction) return false; - m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo); + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(type), toAPI(modifiers), toAPI(mouseButton), toAPI(request.get()), toAPI(frameName.impl()), toAPI(listener), toAPI(userData), m_client.clientInfo); return true; } -bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, const String& MIMEType, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener) +bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, WebFrameProxy* frame, const String& MIMEType, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData) { if (!m_client.decidePolicyForMIMEType) return false; - m_client.decidePolicyForMIMEType(toAPI(page), toAPI(MIMEType.impl()), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo); + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + m_client.decidePolicyForMIMEType(toAPI(page), toAPI(frame), toAPI(MIMEType.impl()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo); return true; } diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.h b/Source/WebKit2/UIProcess/WebPolicyClient.h index 797bc37..c624c58 100644 --- a/Source/WebKit2/UIProcess/WebPolicyClient.h +++ b/Source/WebKit2/UIProcess/WebPolicyClient.h @@ -27,11 +27,16 @@ #define WebPolicyClient_h #include "APIClient.h" +#include "APIObject.h" #include "WKPage.h" #include "WebEvent.h" #include <WebCore/FrameLoaderTypes.h> #include <wtf/Forward.h> +namespace WebCore { + class ResourceRequest; +} + namespace WebKit { class WebPageProxy; @@ -40,9 +45,9 @@ class WebFramePolicyListenerProxy; class WebPolicyClient : public APIClient<WKPagePolicyClient> { public: - bool decidePolicyForNavigationAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*); - bool decidePolicyForNewWindowAction(WebPageProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*); - bool decidePolicyForMIMEType(WebPageProxy*, const String&, const String& url, WebFrameProxy*, WebFramePolicyListenerProxy*); + bool decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData); + bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, const String& frameName, WebFramePolicyListenerProxy*, APIObject* userData); + bool decidePolicyForMIMEType(WebPageProxy*, WebFrameProxy*, const String& MIMEType, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData); }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h index fd84928..78dad64 100644 --- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h +++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h @@ -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 @@ -26,6 +26,7 @@ #ifndef WebPopupMenuProxy_h #define WebPopupMenuProxy_h +#include <WebCore/TextDirection.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -56,9 +57,11 @@ public: { } - virtual void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0; + virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0; virtual void hidePopupMenu() = 0; + void invalidate() { m_client = 0; } + protected: WebPopupMenuProxy(Client* client) : m_client(client) diff --git a/Source/WebKit2/UIProcess/WebPreferences.cpp b/Source/WebKit2/UIProcess/WebPreferences.cpp index e33ebb2..efda4cd 100644 --- a/Source/WebKit2/UIProcess/WebPreferences.cpp +++ b/Source/WebKit2/UIProcess/WebPreferences.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferences.h" #include "WebPageGroup.h" diff --git a/Source/WebKit2/UIProcess/WebProcessManager.cpp b/Source/WebKit2/UIProcess/WebProcessManager.cpp index 94556f8..80e3c2d 100644 --- a/Source/WebKit2/UIProcess/WebProcessManager.cpp +++ b/Source/WebKit2/UIProcess/WebProcessManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessManager.h" #include "WebContext.h" diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index c7e9382..67dc46b 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessProxy.h" #include "DataReference.h" @@ -43,6 +44,7 @@ #include <wtf/text/WTFString.h> using namespace WebCore; +using namespace std; namespace WebKit { @@ -76,7 +78,7 @@ WebProcessProxy::~WebProcessProxy() m_connection->invalidate(); for (size_t i = 0; i < m_pendingMessages.size(); ++i) - m_pendingMessages[i].releaseArguments(); + m_pendingMessages[i].first.releaseArguments(); if (m_processLauncher) { m_processLauncher->invalidate(); @@ -99,20 +101,22 @@ void WebProcessProxy::connect() ProcessLauncher::LaunchOptions launchOptions; launchOptions.processType = ProcessLauncher::WebProcess; + #if PLATFORM(MAC) // We want the web process to match the architecture of the UI process. launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture; + launchOptions.executableHeap = false; #endif m_processLauncher = ProcessLauncher::create(this, launchOptions); } } -bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments) +bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments, unsigned messageSendFlags) { // If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have // a CoreIPC connection. if (isLaunching()) { - m_pendingMessages.append(CoreIPC::Connection::OutgoingMessage(messageID, arguments)); + m_pendingMessages.append(make_pair(CoreIPC::Connection::OutgoingMessage(messageID, arguments), messageSendFlags)); return true; } @@ -120,7 +124,7 @@ bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreI if (!m_connection) return false; - return m_connection->sendMessage(messageID, arguments); + return m_connection->sendMessage(messageID, arguments, messageSendFlags); } bool WebProcessProxy::isLaunching() const @@ -344,13 +348,16 @@ void WebProcessProxy::didFinishLaunching(CoreIPC::Connection::Identifier connect m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); #if PLATFORM(MAC) m_connection->setShouldCloseConnectionOnMachExceptions(); +#elif PLATFORM(QT) + m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier()); #endif - + m_connection->open(); for (size_t i = 0; i < m_pendingMessages.size(); ++i) { - CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i]; - m_connection->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments())); + CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i].first; + unsigned messageSendFlags = m_pendingMessages[i].second; + m_connection->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments()), messageSendFlags); } m_pendingMessages.clear(); diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 531d7fe..e4221fe 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -63,8 +63,7 @@ public: void terminate(); - template<typename E, typename T> bool send(E messageID, uint64_t destinationID, const T& arguments); - template<typename T> bool send(const T& message, uint64_t destinationID); + template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0); template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = 1); CoreIPC::Connection* connection() const @@ -105,13 +104,16 @@ public: void updateTextCheckerState(); void registerNewWebBackForwardListItem(WebBackForwardListItem*); - + + // FIXME: This variant of send is deprecated. All clients should move to an overload that take a message type. + template<typename E, typename T> bool deprecatedSend(E messageID, uint64_t destinationID, const T& arguments); + private: explicit WebProcessProxy(WebContext*); void connect(); - bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>); + bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>, unsigned messageSendFlags); void addBackForwardItem(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title, const CoreIPC::DataReference& backForwardData); @@ -143,7 +145,7 @@ private: ResponsivenessTimer m_responsivenessTimer; RefPtr<CoreIPC::Connection> m_connection; - Vector<CoreIPC::Connection::OutgoingMessage> m_pendingMessages; + Vector<std::pair<CoreIPC::Connection::OutgoingMessage, unsigned> > m_pendingMessages; RefPtr<ProcessLauncher> m_processLauncher; RefPtr<ThreadLauncher> m_threadLauncher; @@ -155,21 +157,21 @@ private: }; template<typename E, typename T> -bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& arguments) +bool WebProcessProxy::deprecatedSend(E messageID, uint64_t destinationID, const T& arguments) { OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID); argumentEncoder->encode(arguments); - return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release()); + return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release(), 0); } template<typename T> -bool WebProcessProxy::send(const T& message, uint64_t destinationID) +bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned messageSendFlags) { OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID); argumentEncoder->encode(message); - return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release()); + return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release(), messageSendFlags); } template<typename U> diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp index 675890f..f6dbe59 100644 --- a/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp +++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebResourceLoadClient.h" #include "WKAPICast.h" @@ -33,13 +34,13 @@ using namespace WebCore; namespace WebKit { -void WebResourceLoadClient::didInitiateLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest) +void WebResourceLoadClient::didInitiateLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest, bool pageIsProvisionallyLoading) { if (!m_client.didInitiateLoadForResource) return; RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); - return m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(request.get()), m_client.clientInfo); + return m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(request.get()), pageIsProvisionallyLoading, m_client.clientInfo); } void WebResourceLoadClient::didSendRequestForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest, const ResourceResponse& redirectResourceResponse) diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.h b/Source/WebKit2/UIProcess/WebResourceLoadClient.h index e2e322f..9648379 100644 --- a/Source/WebKit2/UIProcess/WebResourceLoadClient.h +++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.h @@ -43,7 +43,7 @@ class WebPageProxy; class WebResourceLoadClient : public APIClient<WKPageResourceLoadClient> { public: - void didInitiateLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&); + void didInitiateLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading); void didSendRequestForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); void didReceiveResponseForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceResponse&); void didReceiveContentLengthForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, uint64_t contentLength); diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp index 9f2c7ab..076b331 100644 --- a/Source/WebKit2/UIProcess/WebUIClient.cpp +++ b/Source/WebKit2/UIProcess/WebUIClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebUIClient.h" #include "ImmutableDictionary.h" @@ -326,4 +327,12 @@ void WebUIClient::runModal(WebPageProxy* page) m_client.runModal(toAPI(page), m_client.clientInfo); } +void WebUIClient::didCompleteRubberBandForMainFrame(WebPageProxy* page, const IntSize& initialOverhang) +{ + if (!m_client.runModal) + return; + + m_client.didCompleteRubberBandForMainFrame(toAPI(page), toAPI(initialOverhang), m_client.clientInfo); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h index b873a8d..d8e0bff 100644 --- a/Source/WebKit2/UIProcess/WebUIClient.h +++ b/Source/WebKit2/UIProcess/WebUIClient.h @@ -96,6 +96,8 @@ public: bool canRunModal() const; void runModal(WebPageProxy*); + + void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&); }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp index 3f03980..718e3b8 100644 --- a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebBackForwardList.h" #include "Logging.h" #include <wtf/RetainPtr.h> @@ -51,6 +52,8 @@ DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHis CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const { + ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + RetainPtr<CFNumberRef> currentIndex(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &m_current)); RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks)); @@ -61,7 +64,7 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx for (size_t i = 0; i < m_entries.size(); ++i) { RefPtr<WebURL> webURL = WebURL::create(m_entries[i]->url()); - if (!filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) + if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) continue; RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString()); @@ -100,6 +103,16 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d } CFIndex size = CFArrayGetCount(cfEntries); + if (currentIndex != static_cast<CFIndex>(NoCurrentItemIndex) && currentIndex >= size) { + LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentIndex, size); + return false; + } + + if (currentIndex == static_cast<CFIndex>(NoCurrentItemIndex) && size) { + LOG(SessionState, "WebBackForwardList dictionary representation says there is no current item index, but there is a list of %ld entries - this is bogus", size); + return false; + } + BackForwardListItemVector newEntries; newEntries.reserveCapacity(size); for (CFIndex i = 0; i < size; ++i) { @@ -138,6 +151,7 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d m_current = currentIndex; m_entries = newEntries; + return true; } diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp index c1b7971..2065799 100644 --- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageProxy.h" #include "DataReference.h" @@ -132,7 +133,11 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData) for (size_t i = 0; i < size; ++i) process()->registerNewWebBackForwardListItem(entries[i].get()); - process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex())), m_pageID); + SandboxExtension::Handle sandboxExtensionHandle; + if (WebBackForwardListItem* item = m_backForwardList->currentItem()) + initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle); + + process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex()), sandboxExtensionHandle), m_pageID); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp index 7b89d04..1b7c2dc 100644 --- a/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferences.h" #if !PLATFORM(MAC) diff --git a/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp new file mode 100644 index 0000000..a5c708f --- /dev/null +++ b/Source/WebKit2/UIProcess/gtk/ChunkedUpdateDrawingAreaProxyGtk.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ChunkedUpdateDrawingAreaProxy.h" + +#include "RefPtrCairo.h" +#include "UpdateChunk.h" +#include "WebProcessProxy.h" +#include "WebView.h" + +#include <gdk/gdk.h> + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* ChunkedUpdateDrawingAreaProxy::page() +{ + return m_webView->page(); +} + +void ChunkedUpdateDrawingAreaProxy::ensureBackingStore() +{ + if (m_backingStoreImage) + return; + + m_backingStoreImage = gdk_window_create_similar_surface(gtk_widget_get_window(m_webView->window()), + CAIRO_CONTENT_COLOR_ALPHA, size().width(), size().height()); +} + +void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore() +{ + if (m_backingStoreImage) { + cairo_surface_destroy(m_backingStoreImage); + m_backingStoreImage = 0; + } +} + +bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, cairo_t* cr) +{ + if (!m_backingStoreImage) + return false; + + cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); + cairo_set_source_surface(cr, m_backingStoreImage, 0, 0); + cairo_fill(cr); + + return true; +} + +void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) +{ + ensureBackingStore(); + + RefPtr<cairo_surface_t> pixmap(updateChunk->createImage()); + if (cairo_surface_status(pixmap.get()) != CAIRO_STATUS_SUCCESS) + return; + + const IntRect& updateChunkRect = updateChunk->rect(); + + RefPtr<cairo_t> cr = cairo_create(m_backingStoreImage); + cairo_set_source_surface(cr.get(), pixmap.get(), updateChunkRect.x(), updateChunkRect.y()); + cairo_paint(cr.get()); + + gtk_widget_queue_draw_area(m_webView->window(), updateChunkRect.x(), updateChunkRect.y(), + updateChunkRect.width(), updateChunkRect.height()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp index 3d7ba2d..711783a 100644 --- a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TextChecker.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp index 86ae636..8d6b515 100644 --- a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorProxy.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp index 71befa4..a36bd0c 100644 --- a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageProxy.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp index 3da7323..f7caee8 100644 --- a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferences.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm index eacfefa..0a04eed 100644 --- a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm +++ b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "BackingStore.h" - -#include "CGUtilities.h" -#include "ShareableBitmap.h" -#include "UpdateInfo.h" -#include "WebPageProxy.h" -#include <WebCore/GraphicsContext.h> +#import "config.h" +#import "BackingStore.h" + +#import "CGUtilities.h" +#import "ShareableBitmap.h" +#import "UpdateInfo.h" +#import "WebPageProxy.h" +#import <WebCore/GraphicsContext.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm index 909745b..a580a57 100644 --- a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ChunkedUpdateDrawingAreaProxy.h" +#import "config.h" +#import "ChunkedUpdateDrawingAreaProxy.h" -#include "DrawingAreaMessageKinds.h" -#include "DrawingAreaProxyMessageKinds.h" -#include "UpdateChunk.h" -#include "WKAPICast.h" -#include "WKView.h" -#include "WebPageProxy.h" +#import "DrawingAreaMessageKinds.h" +#import "DrawingAreaProxyMessageKinds.h" +#import "UpdateChunk.h" +#import "WKAPICast.h" +#import "WKView.h" +#import "WebPageProxy.h" using namespace WebCore; @@ -96,7 +97,7 @@ void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* // Flip the destination. CGContextScaleCTM(m_bitmapContext.get(), 1, -1); - CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.bottom())); + CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.maxY())); CGContextDrawImage(m_bitmapContext.get(), updateChunkRect, image.get()); diff --git a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm index 846eb25..1c3aee3 100644 --- a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm @@ -23,16 +23,17 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "LayerBackedDrawingAreaProxy.h" +#import "config.h" +#import "LayerBackedDrawingAreaProxy.h" -#include "DrawingAreaMessageKinds.h" -#include "DrawingAreaProxyMessageKinds.h" -#include <QuartzCore/QuartzCore.h> -#include "WKAPICast.h" -#include "WKView.h" -#include "WKViewInternal.h" -#include "WebKitSystemInterface.h" -#include "WebPageProxy.h" +#import "DrawingAreaMessageKinds.h" +#import "DrawingAreaProxyMessageKinds.h" +#import <QuartzCore/QuartzCore.h> +#import "WKAPICast.h" +#import "WKView.h" +#import "WKViewInternal.h" +#import "WebKitSystemInterface.h" +#import "WebPageProxy.h" using namespace WebCore; @@ -89,4 +90,19 @@ void LayerBackedDrawingAreaProxy::detachCompositingContext() m_compositingRootLayer = 0; } +bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) +{ + WebPageProxy* webPageProxy = page(); + if (webPageProxy->drawsBackground() && webPageProxy->drawsTransparentBackground()) { + CGContextSaveGState(context); + CGContextSetBlendMode(context, kCGBlendModeCopy); + CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear)); + CGContextFillRect(context, rect); + + CGContextRestoreGState(context); + } + + return true; +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm index c89011e..ceb140a 100644 --- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm +++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm @@ -23,23 +23,24 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "TextChecker.h" +#import "config.h" +#import "TextChecker.h" -#include "TextCheckerState.h" -#include <wtf/RetainPtr.h> +#import "TextCheckerState.h" +#import <wtf/RetainPtr.h> #ifndef BUILDING_ON_SNOW_LEOPARD #import <AppKit/NSTextChecker.h> #endif -static const NSString * const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled"; -static const NSString * const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled"; -static const NSString * const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled"; -static const NSString * const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled"; -static const NSString * const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled"; -static const NSString * const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled"; -static const NSString * const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled"; -static const NSString * const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled"; +static NSString* const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled"; +static NSString* const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled"; +static NSString* const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled"; +static NSString* const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled"; +static NSString* const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled"; +static NSString* const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled"; +static NSString* const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled"; +static NSString* const WebAutomaticTextReplacementEnabled = @"WebAutomaticTextReplacementEnabled"; using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index 4d1679f..9f635c1 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebContext.h" +#import "config.h" +#import "WebContext.h" -#include "WebKitSystemInterface.h" -#include "WebProcessCreationParameters.h" -#include <WebCore/FileSystem.h> -#include <sys/param.h> +#import "WebKitSystemInterface.h" +#import "WebProcessCreationParameters.h" +#import <WebCore/FileSystem.h> +#import <sys/param.h> using namespace WebCore; @@ -90,5 +91,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]); } +String WebContext::platformDefaultDatabaseDirectory() const +{ + return [@"~/Library/WebKit/Databases" stringByStandardizingPath]; +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h index ee4fa3d..20ffd0b 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h @@ -29,13 +29,8 @@ #include "WebContextMenuProxy.h" #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -@class WKView; -#else -class NSPopUpButtonCell; -class WKView; -#endif +OBJC_CLASS NSPopUpButtonCell; +OBJC_CLASS WKView; namespace WebKit { diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm index d76b997..67139b3 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm @@ -23,14 +23,15 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebContextMenuProxyMac.h" +#import "config.h" +#import "WebContextMenuProxyMac.h" -#include "PageClientImpl.h" -#include "WebContextMenuItemData.h" -#include "WKView.h" +#import "PageClientImpl.h" +#import "WebContextMenuItemData.h" +#import "WKView.h" -#include <WebCore/IntRect.h> -#include <WebKitSystemInterface.h> +#import <WebCore/IntRect.h> +#import <WebKitSystemInterface.h> using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index e129094..37a6f97 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebInspectorProxy.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index cd3e6f1..e641fe0 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -23,11 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPageProxy.h" +#import "config.h" +#import "WebPageProxy.h" -#include "PageClient.h" -#include <WebCore/Language.h> -#include <wtf/text/StringConcatenate.h> +#import "PageClient.h" +#import <WebCore/Language.h> +#import <wtf/text/StringConcatenate.h> @interface NSApplication (Details) - (void)speakString:(NSString *)string; diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h index 85339d6..788fd20 100644 --- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h @@ -29,13 +29,8 @@ #include "WebPopupMenuProxy.h" #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -@class WKView; -#else -class NSPopUpButtonCell; -class WKView; -#endif +OBJC_CLASS NSPopUpButtonCell; +OBJC_CLASS WKView; namespace WebKit { @@ -49,13 +44,13 @@ public: } ~WebPopupMenuProxyMac(); - virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); virtual void hidePopupMenu(); private: WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client); - void populate(const Vector<WebPopupItem>&); + void populate(const Vector<WebPopupItem>&, WebCore::TextDirection); RetainPtr<NSPopUpButtonCell> m_popup; WKView* m_webView; diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm index 481e8c5..61713fc 100644 --- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.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 @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPopupMenuProxyMac.h" +#import "config.h" +#import "WebPopupMenuProxyMac.h" -#include "PageClientImpl.h" -#include "PlatformPopupMenuData.h" -#include "WKView.h" -#include "WebPopupItem.h" -#include <WebKitSystemInterface.h> +#import "PageClientImpl.h" +#import "PlatformPopupMenuData.h" +#import "WKView.h" +#import "WebPopupItem.h" +#import <WebKitSystemInterface.h> using namespace WebCore; @@ -47,7 +48,7 @@ WebPopupMenuProxyMac::~WebPopupMenuProxyMac() [m_popup.get() setControlView:nil]; } -void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items) +void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirection menuTextDirection) { if (m_popup) [m_popup.get() removeAllItems]; @@ -63,20 +64,38 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items) if (items[i].m_type == WebPopupItem::Seperator) [[m_popup.get() menu] addItem:[NSMenuItem separatorItem]]; else { - [m_popup.get() addItemWithTitle:nsStringFromWebCoreString(items[i].m_text)]; - NSMenuItem* menuItem = [m_popup.get() lastItem]; + [m_popup.get() addItemWithTitle:@""]; + NSMenuItem *menuItem = [m_popup.get() lastItem]; + + RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); + NSWritingDirection writingDirection = items[i].m_textDirection == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; + [paragraphStyle.get() setBaseWritingDirection:writingDirection]; + [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment]; + RetainPtr<NSMutableDictionary> attributes(AdoptNS, [[NSMutableDictionary alloc] initWithObjectsAndKeys: + paragraphStyle.get(), NSParagraphStyleAttributeName, + [m_popup.get() font], NSFontAttributeName, + nil]); + if (items[i].m_hasTextDirectionOverride) { + RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]); + RetainPtr<NSArray> writingDirectionArray(AdoptNS, [[NSArray alloc] initWithObjects:writingDirectionValue.get(), nil]); + [attributes.get() setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName]; + } + RetainPtr<NSAttributedString> string(AdoptNS, [[NSAttributedString alloc] initWithString:nsStringFromWebCoreString(items[i].m_text) attributes:attributes.get()]); + + [menuItem setAttributedTitle:string.get()]; [menuItem setEnabled:items[i].m_isEnabled]; [menuItem setToolTip:nsStringFromWebCoreString(items[i].m_toolTip)]; } } } -void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) { - populate(items); + populate(items, textDirection); [m_popup.get() attachPopUpWithFrame:rect inView:m_webView]; [m_popup.get() selectItemAtIndex:selectedIndex]; + [m_popup.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; NSMenu* menu = [m_popup.get() menu]; @@ -97,7 +116,8 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPo [m_popup.get() dismissPopUp]; [dummyView.get() removeFromSuperview]; - m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]); + if (m_client) + m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]); } void WebPopupMenuProxyMac::hidePopupMenu() @@ -105,5 +125,4 @@ void WebPopupMenuProxyMac::hidePopupMenu() [m_popup.get() dismissPopUp]; } - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm index b954bd2..f2f41d3 100644 --- a/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPreferences.h" +#import "config.h" +#import "WebPreferences.h" -#include "PageClientImpl.h" -#include <wtf/text/StringConcatenate.h> +#import "PageClientImpl.h" +#import <wtf/text/StringConcatenate.h> namespace WebKit { diff --git a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp index 06ce7c6..c323fef 100644 --- a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingAreaProxy.h" #include "DrawingAreaMessageKinds.h" @@ -73,7 +74,7 @@ void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* const IntRect& updateChunkRect = updateChunk->rect(); QPainter painter(&m_backingStoreImage); - painter.drawImage(updateChunkRect.topLeft(), image); + painter.drawImage(updateChunkRect.location(), image); m_webView->update(QRect(updateChunkRect)); } diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp index 9ab6297..2e124d5 100644 --- a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp +++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TextChecker.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp index 59faa1e..5dda454 100644 --- a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TiledDrawingAreaProxy.h" #if ENABLE(TILED_BACKING_STORE) diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp index 2b631ca..11e325f 100644 --- a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TiledDrawingAreaTile.h" #if ENABLE(TILED_BACKING_STORE) @@ -88,11 +89,11 @@ void TiledDrawingAreaTile::invalidate(const IntRect& dirtyRect) void TiledDrawingAreaTile::resize(const IntSize& newSize) { IntRect oldRect = m_rect; - m_rect = IntRect(m_rect.topLeft(), newSize); - if (m_rect.right() > oldRect.right()) - invalidate(IntRect(oldRect.right(), oldRect.y(), m_rect.right() - oldRect.right(), m_rect.height())); - if (m_rect.bottom() > oldRect.bottom()) - invalidate(IntRect(oldRect.x(), oldRect.bottom(), m_rect.width(), m_rect.bottom() - oldRect.bottom())); + m_rect = IntRect(m_rect.location(), newSize); + if (m_rect.maxX() > oldRect.maxX()) + invalidate(IntRect(oldRect.maxX(), oldRect.y(), m_rect.maxX() - oldRect.maxX(), m_rect.height())); + if (m_rect.maxY() > oldRect.maxY()) + invalidate(IntRect(oldRect.x(), oldRect.maxY(), m_rect.width(), m_rect.maxY() - oldRect.maxY())); } void TiledDrawingAreaTile::swapBackBufferToFront() @@ -131,7 +132,7 @@ void TiledDrawingAreaTile::updateFromChunk(UpdateChunk* updateChunk, float) if (m_backBuffer.isNull()) m_backBuffer = m_buffer.isNull() ? QPixmap(m_proxy->tileSize()) : m_buffer; QPainter painter(&m_backBuffer); - IntSize drawPoint = updateChunkRect.topLeft() - m_rect.topLeft(); + IntSize drawPoint = updateChunkRect.location() - m_rect.location(); painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image); } m_hasUpdatePending = false; diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp index 566a22e..09638b6 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuProxyQt.h" #include <IntPoint.h> diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp index 5b2cd88..c1301d5 100644 --- a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp @@ -24,10 +24,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContext.h" #include "ApplicationCacheStorage.h" #include "WebProcessCreationParameters.h" +#include <QProcess> namespace WebKit { @@ -42,6 +44,13 @@ String WebContext::applicationCacheDirectory() void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&) { + qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); +} + +String WebContext::platformDefaultDatabaseDirectory() const +{ + // FIXME: Implement. + return ""; } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp index c04bd99..fe0dac5 100644 --- a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorProxy.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index baf765a..1fa90bb 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageProxy.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index 5e13499..a79cc3c 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPopupMenuProxyQt.h" #include "PlatformPopupMenuData.h" @@ -41,7 +42,7 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt() { } -void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) { } diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h index e6c7a1e..f41432c 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -38,7 +38,7 @@ public: } ~WebPopupMenuProxyQt(); - virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); virtual void hidePopupMenu(); private: diff --git a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp index 173cfd5..fae4a2d 100644 --- a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferences.h" namespace WebKit { diff --git a/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp b/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp new file mode 100644 index 0000000..801376f --- /dev/null +++ b/Source/WebKit2/UIProcess/win/BackingStoreWin.cpp @@ -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. + */ + +#include "config.h" +#include "BackingStore.h" + +#include "ShareableBitmap.h" +#include "UpdateInfo.h" +#include <WebCore/BitmapInfo.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/IntRect.h> + +using namespace WebCore; + +namespace WebKit { + +class BitmapDC { + WTF_MAKE_NONCOPYABLE(BitmapDC); + +public: + BitmapDC(HBITMAP, HDC destinationDC); + ~BitmapDC(); + + operator HDC() const { return m_dc.get(); } + +private: + OwnPtr<HDC> m_dc; + HBITMAP m_originalBitmap; +}; + +BitmapDC::BitmapDC(HBITMAP bitmap, HDC destinationDC) + : m_dc(adoptPtr(::CreateCompatibleDC(destinationDC))) + , m_originalBitmap(static_cast<HBITMAP>(::SelectObject(m_dc.get(), bitmap))) +{ +} + +BitmapDC::~BitmapDC() +{ + ::SelectObject(m_dc.get(), m_originalBitmap); +} + +void BackingStore::paint(HDC dc, const IntRect& rect) +{ + ASSERT(m_bitmap); + ::BitBlt(dc, rect.x(), rect.y(), rect.width(), rect.height(), BitmapDC(m_bitmap.get(), dc), rect.x(), rect.y(), SRCCOPY); +} + +static PassOwnPtr<HBITMAP> createBitmap(const IntSize& size) +{ + // FIXME: Maybe it would be better for performance to create a device-dependent bitmap here? + BitmapInfo info = BitmapInfo::createBottomUp(size); + void* bits; + return adoptPtr(::CreateDIBSection(0, &info, DIB_RGB_COLORS, &bits, 0, 0)); +} + +void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo) +{ + if (!m_bitmap) + m_bitmap = createBitmap(m_size); + + scroll(updateInfo.scrollRect, updateInfo.scrollOffset); + + IntPoint updateRectLocation = updateInfo.updateRectBounds.location(); + + BitmapDC dc(m_bitmap.get(), 0); + GraphicsContext graphicsContext(dc); + + // Paint all update rects. + for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) { + IntRect updateRect = updateInfo.updateRects[i]; + IntRect srcRect = updateRect; + srcRect.move(-updateRectLocation.x(), -updateRectLocation.y()); + + bitmap->paint(graphicsContext, updateRect.location(), srcRect); + } +} + +void BackingStore::scroll(const IntRect& scrollRect, const IntSize& scrollOffset) +{ + if (scrollOffset.isZero()) + return; + + RECT winScrollRect = scrollRect; + ::ScrollDC(BitmapDC(m_bitmap.get(), 0), scrollOffset.width(), scrollOffset.height(), &winScrollRect, &winScrollRect, 0, 0); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp index 6a1ee36..e7ce37a 100644 --- a/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingAreaProxy.h" #include "UpdateChunk.h" diff --git a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp index 8259272..58dc3b0 100644 --- a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if USE(ACCELERATED_COMPOSITING) - +#include "config.h" #include "LayerBackedDrawingAreaProxy.h" +#if USE(ACCELERATED_COMPOSITING) + #include "DrawingAreaMessageKinds.h" #include "DrawingAreaProxyMessageKinds.h" #include "WebView.h" diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp index 3c4b1eb..a16f169 100644 --- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp +++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp @@ -23,8 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "TextChecker.h" +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 #include "NotImplemented.h" #include "TextCheckerState.h" diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp index 090598f..f8f3a24 100644 --- a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuProxyWin.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp index 83b586d..210d6cc 100644 --- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContext.h" #include "WebProcessCreationParameters.h" @@ -52,5 +53,10 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para parameters.shouldPaintNativeControls = m_shouldPaintNativeControls; } +String WebContext::platformDefaultDatabaseDirectory() const +{ + return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases"); +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp index 7637429..35d73ac 100644 --- a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspectorProxy.h" #if ENABLE(INSPECTOR) @@ -171,10 +172,13 @@ void WebInspectorProxy::platformOpen() void WebInspectorProxy::platformClose() { - ASSERT(m_inspectorWindow); - ASSERT(m_inspectorView); + ASSERT(!m_isVisible || m_inspectorWindow); + ASSERT(!m_isVisible || m_inspectorView); - ::DestroyWindow(m_inspectorWindow); + if (m_inspectorWindow) { + ASSERT(::IsWindow(m_inspectorWindow)); + ::DestroyWindow(m_inspectorWindow); + } m_inspectorWindow = 0; m_inspectorView = 0; diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp index 6b0efd1..f70363c 100644 --- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageProxy.h" #include <tchar.h> diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp index 40e3556..4039c49 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp @@ -26,6 +26,7 @@ // NOTE: This implementation is very similar to the implementation of popups in WebCore::PopupMenuWin. // We should try and factor out the common bits and share them. +#include "config.h" #include "WebPopupMenuProxyWin.h" #include "WebView.h" @@ -187,7 +188,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin() m_scrollbar->setParent(0); } -void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex) +void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex) { m_items = items; m_data = data; @@ -323,7 +324,8 @@ void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPo m_showPopup = false; ::ShowWindow(m_popup, SW_HIDE); - m_client->valueChangedForPopupMenu(this, m_newSelectedIndex); + if (m_client) + m_client->valueChangedForPopupMenu(this, m_newSelectedIndex); } void WebPopupMenuProxyWin::hidePopupMenu() @@ -372,7 +374,7 @@ void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect) // Always left-align items in the popup. This matches popup menus on the mac. int popupX = rectInScreenCoords.x() + m_data.m_clientInsetLeft; - IntRect popupRect(popupX, rectInScreenCoords.bottom(), popupWidth, popupHeight); + IntRect popupRect(popupX, rectInScreenCoords.maxY(), popupWidth, popupHeight); // The popup needs to stay within the bounds of the screen and not overlap any toolbars HMONITOR monitor = ::MonitorFromWindow(m_webView->window(), MONITOR_DEFAULTTOPRIMARY); @@ -382,7 +384,7 @@ void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect) FloatRect screen = monitorInfo.rcWork; // Check that we don't go off the screen vertically - if (popupRect.bottom() > screen.height()) { + if (popupRect.maxY() > screen.height()) { // The popup will go off the screen, so try placing it above the client if (rectInScreenCoords.y() - popupRect.height() < 0) { // The popup won't fit above, either, so place it whereever's bigger and resize it to fit @@ -848,8 +850,10 @@ bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking) m_focusedIndex = i; - if (!hotTracking) - m_client->setTextFromItemForPopupMenu(this, i); + if (!hotTracking) { + if (m_client) + m_client->setTextFromItemForPopupMenu(this, i); + } if (!scrollToRevealSelection()) ::UpdateWindow(m_popup); diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h index d1dc466..2d09bb9 100644 --- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h @@ -48,7 +48,7 @@ public: } ~WebPopupMenuProxyWin(); - virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); virtual void hidePopupMenu(); void hide() { hidePopupMenu(); } diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp index 4516f54..eea43c5 100644 --- a/Source/WebKit2/UIProcess/win/WebView.cpp +++ b/Source/WebKit2/UIProcess/win/WebView.cpp @@ -23,14 +23,18 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebView.h" #include "ChunkedUpdateDrawingAreaProxy.h" +#include "DrawingAreaProxyImpl.h" #include "FindIndicator.h" #include "LayerBackedDrawingAreaProxy.h" #include "Logging.h" -#include "RunLoop.h" #include "NativeWebKeyboardEvent.h" +#include "Region.h" +#include "RunLoop.h" +#include "WKAPICast.h" #include "WebContext.h" #include "WebContextMenuProxyWin.h" #include "WebEditCommandProxy.h" @@ -38,8 +42,10 @@ #include "WebPageProxy.h" #include "WebPopupMenuProxyWin.h" #include <Commctrl.h> +#include <WebCore/BitmapInfo.h> #include <WebCore/Cursor.h> #include <WebCore/FloatRect.h> +#include <WebCore/GraphicsContextCG.h> #include <WebCore/IntRect.h> #include <WebCore/SoftLinking.h> #include <WebCore/WebCoreInstanceHandle.h> @@ -47,17 +53,17 @@ #include <wtf/text/WTFString.h> namespace Ime { - // We need these functions in a separate namespace, because in the global namespace they conflict - // with the definitions in imm.h only by the type modifier (the macro defines them as static) and - // imm.h is included by windows.h - SOFT_LINK_LIBRARY(IMM32) - SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd)) - SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC)) - SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen)) - SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate)) - SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen)) - SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue)) - SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags)) +// We need these functions in a separate namespace, because in the global namespace they conflict +// with the definitions in imm.h only by the type modifier (the macro defines them as static) and +// imm.h is included by windows.h +SOFT_LINK_LIBRARY(IMM32) +SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd)) +SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC)) +SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen)) +SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate)) +SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen)) +SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue)) +SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags)) }; using namespace WebCore; @@ -76,6 +82,13 @@ enum { UpdateActiveStateTimer = 1, }; +static bool useNewDrawingArea() +{ + // FIXME: Remove this function and the old drawing area code once we aren't interested in + // testing the old drawing area anymore. + return true; +} + LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); @@ -100,93 +113,93 @@ LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) bool handled = true; switch (message) { - case WM_CLOSE: - m_page->tryClose(); - break; - case WM_DESTROY: - m_isBeingDestroyed = true; - close(); - break; - case WM_ERASEBKGND: - lResult = 1; - break; - case WM_PAINT: - lResult = onPaintEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_PRINTCLIENT: - lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_MOUSEACTIVATE: - setWasActivatedByMouseEvent(true); - handled = false; - break; - case WM_MOUSEMOVE: - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_RBUTTONUP: - case WM_MOUSELEAVE: - lResult = onMouseEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_MOUSEWHEEL: - case WM_VISTA_MOUSEHWHEEL: - lResult = onWheelEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_SYSKEYDOWN: - case WM_KEYDOWN: - case WM_SYSCHAR: - case WM_CHAR: - case WM_SYSKEYUP: - case WM_KEYUP: - lResult = onKeyEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_SIZE: - lResult = onSizeEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_WINDOWPOSCHANGED: - lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_SETFOCUS: - lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_KILLFOCUS: - lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_TIMER: - lResult = onTimerEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_SHOWWINDOW: - lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled); - break; - case WM_SETCURSOR: - lResult = onSetCursor(hWnd, message, wParam, lParam, handled); - break; - case WM_IME_STARTCOMPOSITION: - handled = onIMEStartComposition(); - break; - case WM_IME_REQUEST: - lResult = onIMERequest(wParam, lParam); - break; - case WM_IME_COMPOSITION: - handled = onIMEComposition(lParam); - break; - case WM_IME_ENDCOMPOSITION: - handled = onIMEEndComposition(); - break; - case WM_IME_SELECT: - handled = onIMESelect(wParam, lParam); - break; - case WM_IME_SETCONTEXT: - handled = onIMESetContext(wParam, lParam); - break; - default: - handled = false; - break; + case WM_CLOSE: + m_page->tryClose(); + break; + case WM_DESTROY: + m_isBeingDestroyed = true; + close(); + break; + case WM_ERASEBKGND: + lResult = 1; + break; + case WM_PAINT: + lResult = onPaintEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_PRINTCLIENT: + lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_MOUSEACTIVATE: + setWasActivatedByMouseEvent(true); + handled = false; + break; + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + case WM_LBUTTONUP: + case WM_MBUTTONUP: + case WM_RBUTTONUP: + case WM_MOUSELEAVE: + lResult = onMouseEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_MOUSEWHEEL: + case WM_VISTA_MOUSEHWHEEL: + lResult = onWheelEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + case WM_SYSCHAR: + case WM_CHAR: + case WM_SYSKEYUP: + case WM_KEYUP: + lResult = onKeyEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SIZE: + lResult = onSizeEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_WINDOWPOSCHANGED: + lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SETFOCUS: + lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_KILLFOCUS: + lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_TIMER: + lResult = onTimerEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SHOWWINDOW: + lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SETCURSOR: + lResult = onSetCursor(hWnd, message, wParam, lParam, handled); + break; + case WM_IME_STARTCOMPOSITION: + handled = onIMEStartComposition(); + break; + case WM_IME_REQUEST: + lResult = onIMERequest(wParam, lParam); + break; + case WM_IME_COMPOSITION: + handled = onIMEComposition(lParam); + break; + case WM_IME_ENDCOMPOSITION: + handled = onIMEEndComposition(); + break; + case WM_IME_SELECT: + handled = onIMESelect(wParam, lParam); + break; + case WM_IME_SETCONTEXT: + handled = onIMESetContext(wParam, lParam); + break; + default: + handled = false; + break; } if (!handled) @@ -232,18 +245,23 @@ WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND p , m_wasActivatedByMouseEvent(false) , m_isBeingDestroyed(false) , m_inIMEComposition(0) + , m_findIndicatorCallback(0) + , m_findIndicatorCallbackContext(0) { registerWebViewWindowClass(); - m_page = context->createWebPage(this, pageGroup); - - m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + m_window = ::CreateWindowExW(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE, rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this); ASSERT(::IsWindow(m_window)); + // We only check our window style, and not ::IsWindowVisible, because m_isVisible only tracks + // this window's visibility status, while ::IsWindowVisible takes our ancestors' visibility + // status into account. <http://webkit.org/b/54104> + ASSERT(m_isVisible == static_cast<bool>(::GetWindowLong(m_window, GWL_STYLE) & WS_VISIBLE)); + m_page = context->createWebPage(this, pageGroup); m_page->initializeWebPage(); - ::ShowWindow(m_window, SW_SHOW); + CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (void**)&m_dropTargetHelper); // FIXME: Initializing the tooltip window here matches WebKit win, but seems like something // we could do on demand to save resources. @@ -260,6 +278,11 @@ WebView::~WebView() ::DestroyWindow(m_toolTipWindow); } +void WebView::initialize() +{ + ::RegisterDragDrop(m_window, this); +} + void WebView::setParentWindow(HWND parentWindow) { if (m_window) { @@ -325,29 +348,29 @@ LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa setWasActivatedByMouseEvent(false); switch (message) { - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: - ::SetFocus(m_window); - ::SetCapture(m_window); - break; - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_RBUTTONUP: - ::ReleaseCapture(); - break; - case WM_MOUSEMOVE: - startTrackingMouseLeave(); - break; - case WM_MOUSELEAVE: - stopTrackingMouseLeave(); - break; - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - break; - default: - ASSERT_NOT_REACHED(); + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: + ::SetFocus(m_window); + ::SetCapture(m_window); + break; + case WM_LBUTTONUP: + case WM_MBUTTONUP: + case WM_RBUTTONUP: + ::ReleaseCapture(); + break; + case WM_MOUSEMOVE: + startTrackingMouseLeave(); + break; + case WM_MOUSELEAVE: + stopTrackingMouseLeave(); + break; + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + break; + default: + ASSERT_NOT_REACHED(); } m_page->handleMouseEvent(mouseEvent); @@ -382,19 +405,45 @@ LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara return 0; } +static void drawPageBackground(HDC dc, const RECT& rect) +{ + // Mac checks WebPageProxy::drawsBackground and + // WebPageProxy::drawsTransparentBackground here, but those are always false on + // Windows currently (see <http://webkit.org/b/52009>). + ::FillRect(dc, &rect, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1)); +} + +void WebView::paint(HDC hdc, const IntRect& dirtyRect) +{ + if (useNewDrawingArea()) { + if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(m_page->drawingArea())) { + // FIXME: We should port WebKit1's rect coalescing logic here. + Region unpaintedRegion; + drawingArea->paint(hdc, dirtyRect, unpaintedRegion); + + Vector<IntRect> unpaintedRects = unpaintedRegion.rects(); + for (size_t i = 0; i < unpaintedRects.size(); ++i) { + RECT winRect = unpaintedRects[i]; + drawPageBackground(hdc, unpaintedRects[i]); + } + } else + drawPageBackground(hdc, dirtyRect); + + m_page->didDraw(); + } else { + if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(dirtyRect, hdc)) + m_page->didDraw(); + else + drawPageBackground(hdc, dirtyRect); + } +} + LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) { PAINTSTRUCT paintStruct; HDC hdc = ::BeginPaint(m_window, &paintStruct); - if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc)) - m_page->didDraw(); - else { - // Mac checks WebPageProxy::drawsBackground and - // WebPageProxy::drawsTransparentBackground here, but those are always false on Windows - // currently (see <http://webkit.org/b/52009>). - ::FillRect(hdc, &paintStruct.rcPaint, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1)); - } + paint(hdc, paintStruct.rcPaint); ::EndPaint(m_window, &paintStruct); @@ -407,9 +456,8 @@ LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool HDC hdc = reinterpret_cast<HDC>(wParam); RECT winRect; ::GetClientRect(hWnd, &winRect); - IntRect rect = winRect; - m_page->drawingArea()->paint(rect, hdc); + paint(hdc, winRect); handled = true; return 0; @@ -420,8 +468,8 @@ LRESULT WebView::onSizeEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) int width = LOWORD(lParam); int height = HIWORD(lParam); - if (m_page->drawingArea()) - m_page->drawingArea()->setSize(IntSize(width, height)); + if (m_page && m_page->drawingArea()) + m_page->drawingArea()->setSize(IntSize(width, height), IntSize()); handled = true; return 0; @@ -453,10 +501,10 @@ LRESULT WebView::onKillFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handl LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled) { switch (wParam) { - case UpdateActiveStateTimer: - ::KillTimer(hWnd, UpdateActiveStateTimer); - updateActiveState(); - break; + case UpdateActiveStateTimer: + ::KillTimer(hWnd, UpdateActiveStateTimer); + updateActiveState(); + break; } handled = true; @@ -466,14 +514,15 @@ LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& hand LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) { // lParam is 0 when the message is sent because of a ShowWindow call. - // FIXME: Is WM_SHOWWINDOW sent when ShowWindow is called on an ancestor of our window? + // FIXME: Since we don't get notified when an ancestor window is hidden or shown, we will keep + // painting even when we have a hidden ancestor. <http://webkit.org/b/54104> if (!lParam) { m_isVisible = wParam; - m_page->viewStateDidChange(WebPageProxy::ViewIsVisible); - - handled = true; + if (m_page) + m_page->viewStateDidChange(WebPageProxy::ViewIsVisible); } + handled = false; return 0; } @@ -569,6 +618,7 @@ void WebView::stopTrackingMouseLeave() void WebView::close() { + ::RevokeDragDrop(m_window); setParentWindow(0); m_page->close(); } @@ -577,6 +627,9 @@ void WebView::close() PassOwnPtr<DrawingAreaProxy> WebView::createDrawingAreaProxy() { + if (useNewDrawingArea()) + return DrawingAreaProxyImpl::create(m_page.get()); + return ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); } @@ -626,6 +679,10 @@ bool WebView::isViewInWindow() return m_isInWindow; } +void WebView::pageClosed() +{ +} + void WebView::processDidCrash() { updateNativeCursor(); @@ -740,11 +797,11 @@ void WebView::prepareCandidateWindow(HIMC hInputContext) form.dwIndex = 0; form.dwStyle = CFS_EXCLUDE; form.ptCurrentPos.x = caret.x(); - form.ptCurrentPos.y = caret.bottom(); + form.ptCurrentPos.y = caret.maxY(); form.rcArea.top = caret.y(); - form.rcArea.bottom = caret.bottom(); + form.rcArea.bottom = caret.maxY(); form.rcArea.left = caret.x(); - form.rcArea.right = caret.right(); + form.rcArea.right = caret.maxX(); Ime::ImmSetCandidateWindow(hInputContext, &form); } @@ -962,11 +1019,11 @@ LRESULT WebView::onIMERequest(WPARAM request, LPARAM data) return 0; switch (request) { - case IMR_RECONVERTSTRING: - return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data)); + case IMR_RECONVERTSTRING: + return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data)); - case IMR_QUERYCHARPOSITION: - return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data)); + case IMR_QUERYCHARPOSITION: + return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data)); } return 0; } @@ -985,11 +1042,12 @@ bool WebView::onIMESetContext(WPARAM wparam, LPARAM) return false; } -void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event) +void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled) { // Calling ::DefWindowProcW will ensure that pressing the Alt key will generate a WM_SYSCOMMAND // event, e.g. See <http://webkit.org/b/47671>. - ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam); + if (!wasEventHandled) + ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam); } PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy* page) @@ -1002,9 +1060,54 @@ PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy* pa return WebContextMenuProxyWin::create(m_window, page); } -void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) +void WebView::setFindIndicator(PassRefPtr<FindIndicator> prpFindIndicator, bool fadeOut) { - // FIXME: Implement. + if (!m_findIndicatorCallback) + return; + + HBITMAP hbmp = 0; + IntRect selectionRect; + + if (RefPtr<FindIndicator> findIndicator = prpFindIndicator) { + if (ShareableBitmap* contentImage = findIndicator->contentImage()) { + // Render the contentImage to an HBITMAP. + void* bits; + HDC hdc = ::CreateCompatibleDC(0); + int width = contentImage->bounds().width(); + int height = contentImage->bounds().height(); + BitmapInfo bitmapInfo = BitmapInfo::create(contentImage->size()); + + hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0); + HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp)); + RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(bits, width, height, + 8, width * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst)); + + GraphicsContext graphicsContext(context.get()); + contentImage->paint(graphicsContext, IntPoint(), contentImage->bounds()); + + ::SelectObject(hdc, hbmpOld); + ::DeleteDC(hdc); + } + + selectionRect = IntRect(findIndicator->selectionRectInWindowCoordinates()); + } + + // The callback is responsible for calling ::DeleteObject(hbmp). + (*m_findIndicatorCallback)(toAPI(this), hbmp, selectionRect, fadeOut, m_findIndicatorCallbackContext); +} + +void WebView::setFindIndicatorCallback(WKViewFindIndicatorCallback callback, void* context) +{ + m_findIndicatorCallback = callback; + m_findIndicatorCallbackContext = context; +} + +WKViewFindIndicatorCallback WebView::getFindIndicatorCallback(void** context) +{ + if (context) + *context = m_findIndicatorCallbackContext; + + return m_findIndicatorCallback; } void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation) @@ -1024,6 +1127,10 @@ void WebView::setCustomRepresentationZoomFactor(double) { } +void WebView::didChangeScrollbarsForMainFrame() const +{ +} + void WebView::setIsInWindow(bool isInWindow) { m_isInWindow = isInWindow; @@ -1032,36 +1139,55 @@ void WebView::setIsInWindow(bool isInWindow) #if USE(ACCELERATED_COMPOSITING) +void WebView::enterAcceleratedCompositingMode(const LayerTreeContext&) +{ + ASSERT(useNewDrawingArea()); + // FIXME: Implement. + ASSERT_NOT_REACHED(); +} + +void WebView::exitAcceleratedCompositingMode() +{ + ASSERT(useNewDrawingArea()); + // FIXME: Implement. + ASSERT_NOT_REACHED(); +} + void WebView::pageDidEnterAcceleratedCompositing() { + ASSERT(!useNewDrawingArea()); switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::LayerBacked); } void WebView::pageDidLeaveAcceleratedCompositing() { + ASSERT(!useNewDrawingArea()); switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::ChunkedUpdate); } void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type) { + ASSERT(!useNewDrawingArea()); + DrawingAreaInfo::Type existingDrawingAreaType = m_page->drawingArea() ? m_page->drawingArea()->info().type : DrawingAreaInfo::None; if (existingDrawingAreaType == type) return; OwnPtr<DrawingAreaProxy> newDrawingArea; switch (type) { - case DrawingAreaInfo::None: - break; - case DrawingAreaInfo::ChunkedUpdate: - newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); - break; - case DrawingAreaInfo::LayerBacked: - newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get()); - break; + case DrawingAreaInfo::Impl: + case DrawingAreaInfo::None: + break; + case DrawingAreaInfo::ChunkedUpdate: + newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); + break; + case DrawingAreaInfo::LayerBacked: + newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get()); + break; } if (m_page->drawingArea()) - newDrawingArea->setSize(m_page->drawingArea()->size()); + newDrawingArea->setSize(m_page->drawingArea()->size(), IntSize()); m_page->drawingArea()->detachCompositingContext(); m_page->setDrawingArea(newDrawingArea.release()); @@ -1079,13 +1205,140 @@ HWND WebView::nativeWindow() void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM) { switch (message) { - case WM_NCACTIVATE: - updateActiveStateSoon(); - break; - case WM_SETTINGCHANGE: - // systemParameterChanged(wParam); - break; + case WM_NCACTIVATE: + updateActiveStateSoon(); + break; + case WM_SETTINGCHANGE: + // systemParameterChanged(wParam); + break; } } +HRESULT STDMETHODCALLTYPE WebView::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = static_cast<IUnknown*>(this); + else if (IsEqualGUID(riid, IID_IDropTarget)) + *ppvObject = static_cast<IDropTarget*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE WebView::AddRef(void) +{ + ref(); + return refCount(); +} + +ULONG STDMETHODCALLTYPE WebView::Release(void) +{ + deref(); + return refCount(); +} + +static DWORD dragOperationToDragCursor(DragOperation op) +{ + DWORD res = DROPEFFECT_NONE; + if (op & DragOperationCopy) + res = DROPEFFECT_COPY; + else if (op & DragOperationLink) + res = DROPEFFECT_LINK; + else if (op & DragOperationMove) + res = DROPEFFECT_MOVE; + else if (op & DragOperationGeneric) + res = DROPEFFECT_MOVE; // This appears to be the Firefox behaviour + return res; +} + +WebCore::DragOperation WebView::keyStateToDragOperation(DWORD grfKeyState) const +{ + if (!m_page) + return DragOperationNone; + + // Conforms to Microsoft's key combinations as documented for + // IDropTarget::DragOver. Note, grfKeyState is the current + // state of the keyboard modifier keys on the keyboard. See: + // <http://msdn.microsoft.com/en-us/library/ms680129(VS.85).aspx>. + DragOperation operation = m_page->dragOperation(); + + if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == (MK_CONTROL | MK_SHIFT)) + operation = DragOperationLink; + else if ((grfKeyState & MK_CONTROL) == MK_CONTROL) + operation = DragOperationCopy; + else if ((grfKeyState & MK_SHIFT) == MK_SHIFT) + operation = DragOperationGeneric; + + return operation; +} + +HRESULT STDMETHODCALLTYPE WebView::DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) +{ + m_dragData = 0; + m_page->resetDragOperation(); + + if (m_dropTargetHelper) + m_dropTargetHelper->DragEnter(m_window, pDataObject, (POINT*)&pt, *pdwEffect); + + POINTL localpt = pt; + ::ScreenToClient(m_window, (LPPOINT)&localpt); + DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState)); + m_page->performDragControllerAction(DragControllerActionEntered, &data); + *pdwEffect = dragOperationToDragCursor(m_page->dragOperation()); + + m_lastDropEffect = *pdwEffect; + m_dragData = pDataObject; + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) +{ + if (m_dropTargetHelper) + m_dropTargetHelper->DragOver((POINT*)&pt, *pdwEffect); + + if (m_dragData) { + POINTL localpt = pt; + ::ScreenToClient(m_window, (LPPOINT)&localpt); + DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState)); + m_page->performDragControllerAction(DragControllerActionUpdated, &data); + *pdwEffect = dragOperationToDragCursor(m_page->dragOperation()); + } else + *pdwEffect = DROPEFFECT_NONE; + + m_lastDropEffect = *pdwEffect; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::DragLeave() +{ + if (m_dropTargetHelper) + m_dropTargetHelper->DragLeave(); + + if (m_dragData) { + DragData data(m_dragData.get(), IntPoint(), IntPoint(), DragOperationNone); + m_page->performDragControllerAction(DragControllerActionExited, &data); + m_dragData = 0; + m_page->resetDragOperation(); + } + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) +{ + if (m_dropTargetHelper) + m_dropTargetHelper->Drop(pDataObject, (POINT*)&pt, *pdwEffect); + + m_dragData = 0; + *pdwEffect = m_lastDropEffect; + POINTL localpt = pt; + ::ScreenToClient(m_window, (LPPOINT)&localpt); + DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState)); + m_page->performDragControllerAction(DragControllerActionPerformDrag, &data); + return S_OK; +} + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h index dfb5ed1..297b6ad 100644 --- a/Source/WebKit2/UIProcess/win/WebView.h +++ b/Source/WebKit2/UIProcess/win/WebView.h @@ -28,21 +28,30 @@ #include "APIObject.h" #include "PageClient.h" +#include "WKView.h" #include "WebPageProxy.h" +#include <ShlObj.h> +#include <WebCore/COMPtr.h> +#include <WebCore/DragActions.h> +#include <WebCore/DragData.h> #include <WebCore/WindowMessageListener.h> #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +interface IDropTargetHelper; + namespace WebKit { class DrawingAreaProxy; -class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener { +class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener, public IDropTarget { public: static PassRefPtr<WebView> create(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow) { - return adoptRef(new WebView(rect, context, pageGroup, parentWindow)); + RefPtr<WebView> webView = adoptRef(new WebView(rect, context, pageGroup, parentWindow)); + webView->initialize(); + return webView; } ~WebView(); @@ -50,8 +59,22 @@ public: void setParentWindow(HWND); void windowAncestryDidChange(); void setIsInWindow(bool); - void setOverrideCursor(HCURSOR overrideCursor); + void setOverrideCursor(HCURSOR); void setInitialFocus(bool forward); + void setFindIndicatorCallback(WKViewFindIndicatorCallback, void*); + WKViewFindIndicatorCallback getFindIndicatorCallback(void**); + void initialize(); + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + // IDropTarget + virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); + virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); + virtual HRESULT STDMETHODCALLTYPE DragLeave(); + virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); WebPageProxy* page() const { return m_page.get(); } @@ -64,7 +87,6 @@ private: static LRESULT CALLBACK WebViewWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - void setWasActivatedByMouseEvent(bool flag) { m_wasActivatedByMouseEvent = flag; } LRESULT onMouseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); LRESULT onWheelEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); LRESULT onKeyEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); @@ -77,6 +99,9 @@ private: LRESULT onTimerEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); LRESULT onShowWindowEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); LRESULT onSetCursor(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + + void paint(HDC, const WebCore::IntRect& dirtyRect); + void setWasActivatedByMouseEvent(bool flag) { m_wasActivatedByMouseEvent = flag; } bool onIMEStartComposition(); bool onIMEComposition(LPARAM); bool onIMEEndComposition(); @@ -116,6 +141,7 @@ private: virtual bool isViewInWindow(); virtual void processDidCrash(); virtual void didRelaunchProcess(); + virtual void pageClosed(); virtual void takeFocus(bool direction); virtual void toolTipChanged(const WTF::String&, const WTF::String&); virtual void setCursor(const WebCore::Cursor&); @@ -125,13 +151,16 @@ private: virtual void setEditCommandState(const WTF::String&, bool, int); virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); - virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&); + virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled); virtual void compositionSelectionChanged(bool); virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut); #if USE(ACCELERATED_COMPOSITING) + virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); + virtual void exitAcceleratedCompositingMode(); + virtual void pageDidEnterAcceleratedCompositing(); virtual void pageDidLeaveAcceleratedCompositing(); void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type); @@ -141,6 +170,8 @@ private: void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); virtual double customRepresentationZoomFactor(); virtual void setCustomRepresentationZoomFactor(double); + WebCore::DragOperation keyStateToDragOperation(DWORD grfKeyState) const; + virtual void didChangeScrollbarsForMainFrame() const; virtual HWND nativeWindow(); @@ -164,6 +195,17 @@ private: RefPtr<WebPageProxy> m_page; unsigned m_inIMEComposition; + + WKViewFindIndicatorCallback m_findIndicatorCallback; + void* m_findIndicatorCallbackContext; + + COMPtr<IDataObject> m_dragData; + COMPtr<IDropTargetHelper> m_dropTargetHelper; + // FIXME: This variable is part of a workaround. The drop effect (pdwEffect) passed to Drop is incorrect. + // We set this variable in DragEnter and DragOver so that it can be used in Drop to set the correct drop effect. + // Thus, on return from DoDragDrop we have the correct pdwEffect for the drag-and-drop operation. + // (see https://bugs.webkit.org/show_bug.cgi?id=29264) + DWORD m_lastDropEffect; }; } // namespace WebKit diff --git a/Source/WebKit2/WebKit2.pro b/Source/WebKit2/WebKit2.pro index c478636..98f4d25 100644 --- a/Source/WebKit2/WebKit2.pro +++ b/Source/WebKit2/WebKit2.pro @@ -13,8 +13,8 @@ CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = ../WebCore/generated } -include($$PWD/../../WebKit.pri) -include($$PWD/../../common.pri) +include($$PWD/../WebKit.pri) +include($$PWD/../common.pri) include($$PWD/../WebCore/features.pri) include(WebKit2.pri) @@ -45,7 +45,6 @@ WEBKIT2_INCLUDEPATH = \ $$PWD/../JavaScriptCore/interpreter \ $$PWD/../JavaScriptCore/jit \ $$PWD/../JavaScriptCore/parser \ - $$PWD/../JavaScriptCore/pcre \ $$PWD/../JavaScriptCore/profiler \ $$PWD/../JavaScriptCore/runtime \ $$PWD/../JavaScriptCore/wtf \ @@ -170,9 +169,6 @@ symbian { INCLUDEPATH = $$WEBKIT2_INCLUDEPATH $$INCLUDEPATH } -PREFIX_HEADER = $$PWD/../WebKit2/WebKit2Prefix.h -*-g++*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" - WEBKIT2_GENERATED_HEADERS = \ $$WEBKIT2_GENERATED_SOURCES_DIR/AuthenticationManagerMessages.h \ $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessages.h \ @@ -232,12 +228,12 @@ HEADERS += \ Platform/SharedMemory.h \ Platform/WorkItem.h \ Platform/WorkQueue.h \ - Platform/qt/MappedMemoryPool.h \ Shared/API/c/WKBase.h \ Shared/API/c/WKCertificateInfo.h \ Shared/API/c/WKContextMenuItem.h \ Shared/API/c/WKContextMenuItemTypes.h \ Shared/API/c/WKGeometry.h \ + Shared/API/c/WKGraphicsContext.h \ Shared/API/c/WKImage.h \ Shared/API/c/WKNumber.h \ Shared/API/c/WKPageLoadTypes.h \ @@ -280,6 +276,7 @@ HEADERS += \ Shared/WebEventConversion.h \ Shared/WebFindOptions.h \ Shared/WebGeolocationPosition.h \ + Shared/WebGraphicsContext.h \ Shared/WebImage.h \ Shared/WebNavigationDataStore.h \ Shared/WebNumber.h \ @@ -293,7 +290,6 @@ HEADERS += \ Shared/WebURLResponse.h \ Shared/WebUserContentURLPattern.h \ Shared/Plugins/Netscape/NetscapePluginModule.h \ - Shared/qt/CleanupHandler.h \ Shared/qt/PlatformCertificateInfo.h \ Shared/qt/UpdateChunk.h \ Shared/qt/WebEventFactoryQt.h \ @@ -398,6 +394,7 @@ HEADERS += \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \ + WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ WebProcess/InjectedBundle/API/c/WKBundlePage.h \ @@ -408,8 +405,10 @@ HEADERS += \ WebProcess/InjectedBundle/InjectedBundle.h \ WebProcess/InjectedBundle/InjectedBundleClient.h \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + WebProcess/InjectedBundle/InjectedBundleNavigationAction.h \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \ + WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h \ WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \ WebProcess/InjectedBundle/InjectedBundleScriptWorld.h \ WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h \ @@ -459,12 +458,12 @@ SOURCES += \ Platform/CoreIPC/BinarySemaphore.cpp \ Platform/CoreIPC/Connection.cpp \ Platform/CoreIPC/DataReference.cpp \ + Platform/CoreIPC/qt/AttachmentQt.cpp \ Platform/CoreIPC/qt/ConnectionQt.cpp \ Platform/Logging.cpp \ Platform/Module.cpp \ Platform/RunLoop.cpp \ Platform/WorkQueue.cpp \ - Platform/qt/MappedMemoryPool.cpp \ Platform/qt/ModuleQt.cpp \ Platform/qt/RunLoopQt.cpp \ Platform/qt/SharedMemoryQt.cpp \ @@ -472,6 +471,7 @@ SOURCES += \ Shared/API/c/WKArray.cpp \ Shared/API/c/WKCertificateInfo.cpp \ Shared/API/c/WKContextMenuItem.cpp \ + Shared/API/c/WKGraphicsContext.cpp \ Shared/API/c/WKImage.cpp \ Shared/API/c/WKNumber.cpp \ Shared/API/c/WKSecurityOrigin.cpp \ @@ -502,6 +502,7 @@ SOURCES += \ Shared/WebEvent.cpp \ Shared/WebEventConversion.cpp \ Shared/WebGeolocationPosition.cpp \ + Shared/WebGraphicsContext.cpp \ Shared/WebKeyboardEvent.cpp \ Shared/WebImage.cpp \ Shared/WebMouseEvent.cpp \ @@ -517,7 +518,6 @@ SOURCES += \ Shared/WebURLResponse.cpp \ Shared/WebWheelEvent.cpp \ Shared/qt/ShareableBitmapQt.cpp \ - Shared/qt/CleanupHandler.cpp \ Shared/qt/NativeWebKeyboardEventQt.cpp \ Shared/qt/UpdateChunk.cpp \ Shared/qt/WebCoreArgumentCodersQt.cpp \ @@ -623,6 +623,8 @@ SOURCES += \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp \ WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \ + WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ + WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ WebProcess/InjectedBundle/API/c/WKBundlePage.cpp \ WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp \ @@ -631,14 +633,17 @@ SOURCES += \ WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp \ WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp \ WebProcess/InjectedBundle/InjectedBundle.cpp \ - WebProcess/InjectedBundle/InjectedBundleClient.cpp \ WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp \ WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp \ + WebProcess/InjectedBundle/InjectedBundleClient.cpp \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ + WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp \ + WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp \ + WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp \ WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp \ WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp \ WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp \ @@ -666,7 +671,6 @@ SOURCES += \ WebProcess/WebCoreSupport/WebPopupMenu.cpp \ WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp \ WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp \ - WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp \ WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp \ WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp \ WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp \ @@ -693,3 +697,4 @@ SOURCES += \ WebProcess/qt/WebProcessMainQt.cpp \ WebProcess/qt/WebProcessQt.cpp \ $$WEBKIT2_GENERATED_SOURCES + diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index b83c16c..303ca6c 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -67,6 +67,9 @@ 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */; }; 1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */; }; 1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; }; + 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; }; + 1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */; }; + 1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */; }; 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; }; 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; }; 1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; }; @@ -140,6 +143,7 @@ 1A64256812DE42EC00CAAE2C /* BackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64256612DE42EC00CAAE2C /* BackingStore.h */; }; 1A64256912DE42EC00CAAE2C /* BackingStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64256712DE42EC00CAAE2C /* BackingStore.cpp */; }; 1A64292D12DE5F9800CAAE2C /* BackingStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */; }; + 1A690D1712F39E3300ECD289 /* LayerTreeHostMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */; }; 1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; }; 1A6F9FB711E1408500DB1371 /* CommandLineMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */; }; 1A6FA01E11E1526300DB1371 /* WebProcessMainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FA01D11E1526300DB1371 /* WebProcessMainMac.mm */; }; @@ -171,6 +175,12 @@ 1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A910070126675C4001842F5 /* FindIndicator.cpp */; }; 1A91010A1268C8CA001842F5 /* FindIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */; }; 1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */; }; + 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */; }; + 1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */; }; + 1A9636BC12F348490078A062 /* ShareableSurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9636BA12F348490078A062 /* ShareableSurface.cpp */; }; + 1A9636BD12F348490078A062 /* ShareableSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9636BB12F348490078A062 /* ShareableSurface.h */; }; + 1A9639F712F38ECD0078A062 /* CoreAnimationRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */; }; + 1A9639F812F38ECD0078A062 /* CoreAnimationRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */; }; 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; }; @@ -283,6 +293,10 @@ 51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; }; 51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; }; 51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; }; + 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; }; + 6546A82C13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6546A82A13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h */; }; + 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; }; + 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Public, ); }; }; 6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; }; 762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; @@ -304,6 +318,7 @@ 93FC67BE12D3CCF200A60610 /* DecoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */; }; 93FC67BF12D3CCF200A60610 /* EncoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */; }; 93FC67C012D3CCF200A60610 /* EncoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */; }; + B396EA5612E0ED2D00F4FEB7 /* config.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B396EA5512E0ED2D00F4FEB7 /* config.h */; }; BC0092F7115837A300E0AE2A /* RunLoopMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F5115837A300E0AE2A /* RunLoopMac.mm */; }; BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */; }; BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6010F4378D0058C15A /* WebChromeClient.h */; }; @@ -488,6 +503,8 @@ BC646C1C11DD399F006455B0 /* WKBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC646C1811DD399F006455B0 /* WKBackForwardListItem.cpp */; }; BC646C1D11DD399F006455B0 /* WKBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = BC646C1911DD399F006455B0 /* WKBackForwardListItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC6EDAA6111271C600E7678B /* PageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6EDAA5111271C600E7678B /* PageClient.h */; }; + BC7043CC12F75EE0006472B9 /* WKBundleNavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7043CA12F75EE0006472B9 /* WKBundleNavigationAction.h */; }; + BC7043CD12F75EE0006472B9 /* WKBundleNavigationAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7043CB12F75EE0006472B9 /* WKBundleNavigationAction.cpp */; }; BC72B9FA11E6476B001EB4EA /* WebBackForwardListProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */; }; BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */; }; BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */; }; @@ -502,6 +519,10 @@ BC7B633812A45ABA00D174A4 /* WKPageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */; }; BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC7B633E12A45D1200D174A4 /* WKBundlePageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */; }; + BC8147A912F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8147A712F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h */; }; + BC8147AA12F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8147A812F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp */; }; + BC8147D512F66D31007B2C32 /* InjectedBundleNavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8147D312F66D31007B2C32 /* InjectedBundleNavigationAction.h */; }; + BC8147D612F66D31007B2C32 /* InjectedBundleNavigationAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8147D412F66D31007B2C32 /* InjectedBundleNavigationAction.cpp */; }; BC8452A71162C80900CAB9B5 /* DrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8452A51162C80900CAB9B5 /* DrawingArea.cpp */; }; BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8452A61162C80900CAB9B5 /* DrawingArea.h */; }; BC84EB1812A7100C0083F2DA /* WebPreferencesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC84EB1712A7100C0083F2DA /* WebPreferencesMac.mm */; }; @@ -526,6 +547,7 @@ BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */; }; BC90A1D3122DD55E00CC8C50 /* WebURLResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90A1D1122DD55E00CC8C50 /* WebURLResponse.cpp */; }; BC90A1D7122DD66A00CC8C50 /* WebURLResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */; }; + BC9585C812F095B800755821 /* WebGestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9585C712F095B800755821 /* WebGestureEvent.cpp */; }; BC963D6B113DD19200574BE2 /* WebPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC963D6A113DD19200574BE2 /* WebPage.cpp */; }; BC963D6E113DD1A500574BE2 /* WebPageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC963D6D113DD1A500574BE2 /* WebPageMac.mm */; }; BC9B38A110F538BE00443A15 /* WebFrameProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B389F10F538BE00443A15 /* WebFrameProxy.h */; }; @@ -537,6 +559,12 @@ BCA0EF8012331E78007D3CFB /* WebEditCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA0EF7E12331E78007D3CFB /* WebEditCommand.cpp */; }; BCA0EF9F12332642007D3CFB /* WebEditCommandProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */; }; BCA0EFA012332642007D3CFB /* WebEditCommandProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */; }; + BCA56A1C12F9028E00C566C7 /* WebGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA56A1A12F9028E00C566C7 /* WebGraphicsContext.h */; }; + BCA56A1D12F9028E00C566C7 /* WebGraphicsContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA56A1B12F9028E00C566C7 /* WebGraphicsContext.cpp */; }; + BCA56A6512F9C8F900C566C7 /* WKGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA56A6312F9C8F900C566C7 /* WKGraphicsContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCA56A6612F9C8F900C566C7 /* WKGraphicsContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA56A6412F9C8F900C566C7 /* WKGraphicsContext.cpp */; }; + BCA56A6912F9C9AD00C566C7 /* WKGraphicsContextCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA56A6712F9C9AD00C566C7 /* WKGraphicsContextCG.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCA56A6A12F9C9AD00C566C7 /* WKGraphicsContextCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA56A6812F9C9AD00C566C7 /* WKGraphicsContextCG.cpp */; }; BCA8C6A811E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */; }; BCA8C6A911E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */; }; BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */; }; @@ -643,6 +671,7 @@ BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; }; BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; }; + BFA6179F12F0B99D0033E0CA /* WKViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BFA6179E12F0B99D0033E0CA /* WKViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; C01A260112662F2100C9ED55 /* ShareableBitmapCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C01A260012662F2100C9ED55 /* ShareableBitmapCG.cpp */; }; C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */; }; C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */; }; @@ -668,6 +697,8 @@ D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; }; D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */; }; D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; }; + E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */ = {isa = PBXBuildFile; fileRef = E134F01512EA5D11004EC58D /* WKPrintingView.h */; }; + E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E134F01912EA5D99004EC58D /* WKPrintingView.mm */; }; E18C92F412DB9E7100CF2AEB /* PrintInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */; }; E18C92F512DB9E7A00CF2AEB /* PrintInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */; }; E18C92F612DB9E9400CF2AEB /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; }; @@ -692,7 +723,6 @@ F634445C12A885E9000612D8 /* WKSecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */; }; F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445B12A885E9000612D8 /* WKSecurityOrigin.h */; settings = {ATTRIBUTES = (Public, ); }; }; F67DD7BA125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; - F6A25FD912ADC6BD00DC40CC /* WebDatabaseManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6A25FD812ADC6BD00DC40CC /* WebDatabaseManagerMac.mm */; }; F6A25FDC12ADC6CC00DC40CC /* WebDatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6A25FDA12ADC6CC00DC40CC /* WebDatabaseManager.cpp */; }; F6A25FDD12ADC6CC00DC40CC /* WebDatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = F6A25FDB12ADC6CC00DC40CC /* WebDatabaseManager.h */; }; /* End PBXBuildFile section */ @@ -737,6 +767,8 @@ files = ( 1A50DB66110A3D57000D3FE5 /* WebProcess.app in CopyFiles */, 1A64228B12DD024700CAAE2C /* DrawingArea.messages.in in CopyFiles */, + B396EA5612E0ED2D00F4FEB7 /* config.h in CopyFiles */, + 6546A82C13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -794,6 +826,9 @@ 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; }; 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkProvider.h; sourceTree = "<group>"; }; 1A119A94127B796200A9ECB1 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageSender.h; sourceTree = "<group>"; }; + 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHost.h; sourceTree = "<group>"; }; + 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerTreeHost.cpp; sourceTree = "<group>"; }; + 1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerTreeHostMac.mm; sourceTree = "<group>"; }; 1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; }; 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRemoteObjectMap.h; sourceTree = "<group>"; }; 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRemoteObjectMap.cpp; sourceTree = "<group>"; }; @@ -872,6 +907,7 @@ 1A64256612DE42EC00CAAE2C /* BackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackingStore.h; sourceTree = "<group>"; }; 1A64256712DE42EC00CAAE2C /* BackingStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackingStore.cpp; sourceTree = "<group>"; }; 1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackingStoreMac.mm; sourceTree = "<group>"; }; + 1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHostMac.h; sourceTree = "<group>"; }; 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandLine.h; sourceTree = "<group>"; }; 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandLineMac.cpp; sourceTree = "<group>"; }; 1A6FA01D11E1526300DB1371 /* WebProcessMainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessMainMac.mm; sourceTree = "<group>"; }; @@ -905,6 +941,12 @@ 1A910070126675C4001842F5 /* FindIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindIndicator.cpp; sourceTree = "<group>"; }; 1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicatorWindow.h; sourceTree = "<group>"; }; 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindIndicatorWindow.mm; sourceTree = "<group>"; }; + 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeContext.h; sourceTree = "<group>"; }; + 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerTreeContextMac.mm; sourceTree = "<group>"; }; + 1A9636BA12F348490078A062 /* ShareableSurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableSurface.cpp; sourceTree = "<group>"; }; + 1A9636BB12F348490078A062 /* ShareableSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareableSurface.h; sourceTree = "<group>"; }; + 1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAnimationRenderer.h; sourceTree = "<group>"; }; + 1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreAnimationRenderer.mm; sourceTree = "<group>"; }; 1AA1C79A100E7FC50078DEBC /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; @@ -1026,6 +1068,10 @@ 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; }; 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; }; 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; }; + 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageResourceLoadClient.cpp; sourceTree = "<group>"; }; + 6546A82A13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageResourceLoadClient.h; sourceTree = "<group>"; }; + 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; }; + 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; }; 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; }; 762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; }; 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; }; @@ -1049,6 +1095,7 @@ 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoderAdapter.cpp; sourceTree = "<group>"; }; 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderAdapter.h; sourceTree = "<group>"; }; A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedScriptValue.h; sourceTree = "<group>"; }; + B396EA5512E0ED2D00F4FEB7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; BC0092F5115837A300E0AE2A /* RunLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RunLoopMac.mm; sourceTree = "<group>"; }; BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueMac.cpp; sourceTree = "<group>"; }; BC032D6010F4378D0058C15A /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; }; @@ -1098,7 +1145,7 @@ BC111A54112F4FBB00337BAB /* WebContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuClient.cpp; sourceTree = "<group>"; }; BC111A56112F4FBB00337BAB /* WebDragClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDragClient.cpp; sourceTree = "<group>"; }; BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEditorClient.cpp; sourceTree = "<group>"; }; - BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameLoaderClient.cpp; sourceTree = "<group>"; }; + BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameLoaderClient.cpp; sourceTree = "<group>"; wrapsLines = 0; }; BC111A59112F4FBB00337BAB /* WebInspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorClient.cpp; sourceTree = "<group>"; }; BC111ADC112F5B9300337BAB /* WebFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrame.cpp; sourceTree = "<group>"; }; BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebErrorsMac.mm; sourceTree = "<group>"; }; @@ -1140,7 +1187,7 @@ BC204EEA11C83EC8008F3375 /* WKBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundle.h; sourceTree = "<group>"; }; BC204EEB11C83EC8008F3375 /* WKBundleAPICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleAPICast.h; sourceTree = "<group>"; }; BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInitialize.h; sourceTree = "<group>"; }; - BC20527F11C94284008F3375 /* WKBundlePage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePage.h; sourceTree = "<group>"; }; + BC20527F11C94284008F3375 /* WKBundlePage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePage.h; sourceTree = "<group>"; wrapsLines = 0; }; BC20528011C94284008F3375 /* WKBundlePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePage.cpp; sourceTree = "<group>"; }; BC2651F511825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChunkedUpdateDrawingAreaProxyMac.mm; sourceTree = "<group>"; }; BC2652121182608100243E12 /* DrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxy.cpp; sourceTree = "<group>"; }; @@ -1237,6 +1284,8 @@ BC646C1811DD399F006455B0 /* WKBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBackForwardListItem.cpp; sourceTree = "<group>"; }; BC646C1911DD399F006455B0 /* WKBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItem.h; sourceTree = "<group>"; }; BC6EDAA5111271C600E7678B /* PageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClient.h; sourceTree = "<group>"; }; + BC7043CA12F75EE0006472B9 /* WKBundleNavigationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNavigationAction.h; sourceTree = "<group>"; }; + BC7043CB12F75EE0006472B9 /* WKBundleNavigationAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleNavigationAction.cpp; sourceTree = "<group>"; }; BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebBackForwardListProxy.cpp; sourceTree = "<group>"; }; BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListProxy.h; sourceTree = "<group>"; }; BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebBackForwardList.cpp; sourceTree = "<group>"; }; @@ -1251,6 +1300,10 @@ BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageGroup.cpp; sourceTree = "<group>"; }; BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageGroup.h; sourceTree = "<group>"; }; BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageGroup.cpp; sourceTree = "<group>"; }; + BC8147A712F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePagePolicyClient.h; sourceTree = "<group>"; wrapsLines = 0; }; + BC8147A812F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePagePolicyClient.cpp; sourceTree = "<group>"; wrapsLines = 0; }; + BC8147D312F66D31007B2C32 /* InjectedBundleNavigationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleNavigationAction.h; sourceTree = "<group>"; }; + BC8147D412F66D31007B2C32 /* InjectedBundleNavigationAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleNavigationAction.cpp; sourceTree = "<group>"; }; BC8452A51162C80900CAB9B5 /* DrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingArea.cpp; sourceTree = "<group>"; }; BC8452A61162C80900CAB9B5 /* DrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingArea.h; sourceTree = "<group>"; }; BC84EB1712A7100C0083F2DA /* WebPreferencesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPreferencesMac.mm; sourceTree = "<group>"; }; @@ -1274,6 +1327,7 @@ BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURLResponse.h; sourceTree = "<group>"; }; BC90A1D1122DD55E00CC8C50 /* WebURLResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLResponse.cpp; sourceTree = "<group>"; }; BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebURLResponseMac.mm; sourceTree = "<group>"; }; + BC9585C712F095B800755821 /* WebGestureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGestureEvent.cpp; sourceTree = "<group>"; }; BC963D6A113DD19200574BE2 /* WebPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPage.cpp; sourceTree = "<group>"; }; BC963D6D113DD1A500574BE2 /* WebPageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageMac.mm; sourceTree = "<group>"; }; BC9B389F10F538BE00443A15 /* WebFrameProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameProxy.h; sourceTree = "<group>"; }; @@ -1285,6 +1339,12 @@ BCA0EF7E12331E78007D3CFB /* WebEditCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEditCommand.cpp; sourceTree = "<group>"; }; BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEditCommandProxy.h; sourceTree = "<group>"; }; BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEditCommandProxy.cpp; sourceTree = "<group>"; }; + BCA56A1A12F9028E00C566C7 /* WebGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGraphicsContext.h; sourceTree = "<group>"; }; + BCA56A1B12F9028E00C566C7 /* WebGraphicsContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGraphicsContext.cpp; sourceTree = "<group>"; }; + BCA56A6312F9C8F900C566C7 /* WKGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGraphicsContext.h; sourceTree = "<group>"; }; + BCA56A6412F9C8F900C566C7 /* WKGraphicsContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGraphicsContext.cpp; sourceTree = "<group>"; }; + BCA56A6712F9C9AD00C566C7 /* WKGraphicsContextCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGraphicsContextCG.h; sourceTree = "<group>"; }; + BCA56A6812F9C9AD00C566C7 /* WKGraphicsContextCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGraphicsContextCG.cpp; sourceTree = "<group>"; }; BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageLoaderClient.cpp; sourceTree = "<group>"; }; BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageLoaderClient.h; sourceTree = "<group>"; }; BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageUIClient.cpp; sourceTree = "<group>"; }; @@ -1397,6 +1457,7 @@ BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; }; BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; }; BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; }; + BFA6179E12F0B99D0033E0CA /* WKViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKViewPrivate.h; sourceTree = "<group>"; }; C01A260012662F2100C9ED55 /* ShareableBitmapCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableBitmapCG.cpp; sourceTree = "<group>"; }; C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebKeyboardEvent.h; sourceTree = "<group>"; }; C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebKeyboardEventMac.mm; sourceTree = "<group>"; }; @@ -1431,6 +1492,8 @@ D3B9484311FF4B6500032B39 /* WebPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenu.h; sourceTree = "<group>"; }; D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSearchPopupMenu.cpp; sourceTree = "<group>"; }; D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSearchPopupMenu.h; sourceTree = "<group>"; }; + E134F01512EA5D11004EC58D /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; }; + E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; }; E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintInfo.cpp; sourceTree = "<group>"; }; E1CC1B8E12D7EADF00625838 /* PrintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintInfo.h; sourceTree = "<group>"; }; E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrintInfoMac.mm; sourceTree = "<group>"; }; @@ -1453,7 +1516,6 @@ F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKSecurityOrigin.cpp; sourceTree = "<group>"; }; F634445B12A885E9000612D8 /* WKSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSecurityOrigin.h; sourceTree = "<group>"; }; F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSerializedScriptValuePrivate.h; sourceTree = "<group>"; }; - F6A25FD812ADC6BD00DC40CC /* WebDatabaseManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManagerMac.mm; sourceTree = "<group>"; }; F6A25FDA12ADC6CC00DC40CC /* WebDatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManager.cpp; sourceTree = "<group>"; }; F6A25FDB12ADC6CC00DC40CC /* WebDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManager.h; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -1501,6 +1563,7 @@ 0867D691FE84028FC02AAC07 /* WebKit2 */ = { isa = PBXGroup; children = ( + B396EA5512E0ED2D00F4FEB7 /* config.h */, C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */, BC2E6E74114196F000A63B1E /* Platform */, 1A0EC6B0124BBD36007EF4A5 /* PluginProcess */, @@ -1761,6 +1824,7 @@ BC64696E11DBE603006455B0 /* ImmutableArray.h */, BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */, BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */, + 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */, BCC8049D122F0D6B00103529 /* MutableArray.cpp */, BCC8049E122F0D6B00103529 /* MutableArray.h */, BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */, @@ -1804,6 +1868,8 @@ 1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */, BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */, BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */, + BCA56A1B12F9028E00C566C7 /* WebGraphicsContext.cpp */, + BCA56A1A12F9028E00C566C7 /* WebGraphicsContext.h */, BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */, BCCF6ABB12C91EF9008F9C35 /* WebImage.h */, C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */, @@ -1836,6 +1902,7 @@ BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */, F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */, C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */, + BC9585C712F095B800755821 /* WebGestureEvent.cpp */, 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */, ); path = Shared; @@ -2056,6 +2123,8 @@ 1A90C1F21264FD71003E44D4 /* FindController.h */, 0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */, 0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */, + 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */, + 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */, 1A90C23612650717003E44D4 /* PageOverlay.cpp */, 1A90C23512650717003E44D4 /* PageOverlay.h */, BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */, @@ -2275,7 +2344,6 @@ children = ( C554FFA212E4E8EA002F22C0 /* WebDragClientMac.mm */, 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */, - F6A25FD812ADC6BD00DC40CC /* WebDatabaseManagerMac.mm */, C5237F5F12441CA300780472 /* WebEditorClientMac.mm */, BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */, 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */, @@ -2317,11 +2385,14 @@ 1AAF061312B01131008E49E2 /* PDFViewController.mm */, BC111B4B112F619200337BAB /* PageClientImpl.h */, BC111B4C112F619200337BAB /* PageClientImpl.mm */, + E134F01512EA5D11004EC58D /* WKPrintingView.h */, + E134F01912EA5D99004EC58D /* WKPrintingView.mm */, 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */, 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */, BC8699B2116AADAA002A925B /* WKView.h */, BC8699B3116AADAA002A925B /* WKView.mm */, BC8699B4116AADAA002A925B /* WKViewInternal.h */, + BFA6179E12F0B99D0033E0CA /* WKViewPrivate.h */, ); path = mac; sourceTree = "<group>"; @@ -2329,13 +2400,19 @@ BC111B5A112F628200337BAB /* mac */ = { isa = PBXGroup; children = ( - C574A57F12E66681002DFE98 /* PasteboardTypes.h */, - C574A58012E66681002DFE98 /* PasteboardTypes.mm */, 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */, + 1A9639F512F38ECD0078A062 /* CoreAnimationRenderer.h */, + 1A9639F612F38ECD0078A062 /* CoreAnimationRenderer.mm */, + 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */, C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */, - BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */, + C574A57F12E66681002DFE98 /* PasteboardTypes.h */, + C574A58012E66681002DFE98 /* PasteboardTypes.mm */, BCF505E51243047B005955AE /* PlatformCertificateInfo.h */, + BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */, E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */, + 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */, + 1A9636BA12F348490078A062 /* ShareableSurface.cpp */, + 1A9636BB12F348490078A062 /* ShareableSurface.h */, BC9E95D211449B0300870E71 /* UpdateChunk.cpp */, BC9E95D111449B0300870E71 /* UpdateChunk.h */, BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */, @@ -2344,7 +2421,6 @@ 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */, BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */, BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */, - 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */, ); path = mac; sourceTree = "<group>"; @@ -2365,18 +2441,20 @@ isa = PBXGroup; children = ( BC204EE711C83EAD008F3375 /* API */, - BC204EE411C83E9C008F3375 /* mac */, BC4BEE96120A091700FBA0C7 /* DOM */, + BC204EE411C83E9C008F3375 /* mac */, BC204EE011C83E98008F3375 /* InjectedBundle.cpp */, BC204EE111C83E98008F3375 /* InjectedBundle.h */, - BCEE7DC4128B645D009827DA /* InjectedBundleClient.cpp */, - BCEE7DC3128B645D009827DA /* InjectedBundleClient.h */, 935EEB8F1277615D003322B8 /* InjectedBundleBackForwardList.cpp */, 935EEB901277615D003322B8 /* InjectedBundleBackForwardList.h */, 935EEB911277615D003322B8 /* InjectedBundleBackForwardListItem.cpp */, 935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */, + BCEE7DC4128B645D009827DA /* InjectedBundleClient.cpp */, + BCEE7DC3128B645D009827DA /* InjectedBundleClient.h */, BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */, BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */, + BC8147D412F66D31007B2C32 /* InjectedBundleNavigationAction.cpp */, + BC8147D312F66D31007B2C32 /* InjectedBundleNavigationAction.h */, 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */, 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */, E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */, @@ -2385,6 +2463,10 @@ BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */, BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */, BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */, + BC8147A812F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp */, + BC8147A712F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h */, + 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */, + 6546A82A13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h */, BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */, BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */, BC14DF76120B5B7900826C0C /* InjectedBundleScriptWorld.cpp */, @@ -2426,6 +2508,10 @@ BC49862E124D18C100D834E1 /* WKBundleHitTestResult.cpp */, BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */, BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */, + 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */, + 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */, + BC7043CB12F75EE0006472B9 /* WKBundleNavigationAction.cpp */, + BC7043CA12F75EE0006472B9 /* WKBundleNavigationAction.h */, BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */, BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */, BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */, @@ -2532,10 +2618,12 @@ BC963D6C113DD19500574BE2 /* mac */ = { isa = PBXGroup; children = ( - 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */, 29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */, + 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */, BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */, 0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */, + 1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */, + 1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */, 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */, BC963D6D113DD1A500574BE2 /* WebPageMac.mm */, ); @@ -2573,6 +2661,8 @@ BCCF6AC412C91F3B008F9C35 /* cg */ = { isa = PBXGroup; children = ( + BCA56A6812F9C9AD00C566C7 /* WKGraphicsContextCG.cpp */, + BCA56A6712F9C9AD00C566C7 /* WKGraphicsContextCG.h */, BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */, BCCF6AC812C91F59008F9C35 /* WKImageCG.h */, ); @@ -2610,6 +2700,8 @@ BC40783C1250FADD0068F20A /* WKEvent.h */, 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */, BCC8B373125FB69000DE46A4 /* WKGeometry.h */, + BCA56A6412F9C8F900C566C7 /* WKGraphicsContext.cpp */, + BCA56A6312F9C8F900C566C7 /* WKGraphicsContext.h */, BCCF6AC012C91F34008F9C35 /* WKImage.cpp */, BCCF6AC112C91F34008F9C35 /* WKImage.h */, BC4075E1124FF0270068F20A /* WKMutableArray.cpp */, @@ -2821,6 +2913,7 @@ BC204EF011C83EC8008F3375 /* WKBundleAPICast.h in Headers */, BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */, BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */, + 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */, BC20528111C94284008F3375 /* WKBundlePage.h in Headers */, BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */, BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */, @@ -3069,6 +3162,19 @@ C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */, 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */, C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */, + E134F01712EA5D33004EC58D /* WKPrintingView.h in Headers */, + 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */, + BFA6179F12F0B99D0033E0CA /* WKViewPrivate.h in Headers */, + 1A9636BD12F348490078A062 /* ShareableSurface.h in Headers */, + 1A9639F712F38ECD0078A062 /* CoreAnimationRenderer.h in Headers */, + 1A690D1712F39E3300ECD289 /* LayerTreeHostMac.h in Headers */, + BC8147A912F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h in Headers */, + BC8147D512F66D31007B2C32 /* InjectedBundleNavigationAction.h in Headers */, + BC7043CC12F75EE0006472B9 /* WKBundleNavigationAction.h in Headers */, + 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */, + BCA56A1C12F9028E00C566C7 /* WebGraphicsContext.h in Headers */, + BCA56A6512F9C8F900C566C7 /* WKGraphicsContext.h in Headers */, + BCA56A6912F9C9AD00C566C7 /* WKGraphicsContextCG.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3474,7 +3580,6 @@ 512F58F912A88A5400629530 /* WKCredential.cpp in Sources */, 512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */, F634445C12A885E9000612D8 /* WKSecurityOrigin.cpp in Sources */, - F6A25FD912ADC6BD00DC40CC /* WebDatabaseManagerMac.mm in Sources */, F6A25FDC12ADC6CC00DC40CC /* WebDatabaseManager.cpp in Sources */, 51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */, 1AAF061512B01131008E49E2 /* PDFViewController.mm in Sources */, @@ -3532,6 +3637,21 @@ 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */, C574A37712E6099D002DFE98 /* WebDragClientMac.mm in Sources */, C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */, + E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */, + BC9585C812F095B800755821 /* WebGestureEvent.cpp in Sources */, + 1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */, + 1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */, + 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */, + 1A9636BC12F348490078A062 /* ShareableSurface.cpp in Sources */, + 1A9639F812F38ECD0078A062 /* CoreAnimationRenderer.mm in Sources */, + BC8147AA12F64CDA007B2C32 /* InjectedBundlePagePolicyClient.cpp in Sources */, + BC8147D612F66D31007B2C32 /* InjectedBundleNavigationAction.cpp in Sources */, + BC7043CD12F75EE0006472B9 /* WKBundleNavigationAction.cpp in Sources */, + 1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */, + BCA56A1D12F9028E00C566C7 /* WebGraphicsContext.cpp in Sources */, + BCA56A6612F9C8F900C566C7 /* WKGraphicsContext.cpp in Sources */, + BCA56A6A12F9C9AD00C566C7 /* WKGraphicsContextCG.cpp in Sources */, + 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebKit2Prefix.h b/Source/WebKit2/WebKit2Prefix.h index 7ed70cb..a96014f 100644 --- a/Source/WebKit2/WebKit2Prefix.h +++ b/Source/WebKit2/WebKit2Prefix.h @@ -24,102 +24,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined (BUILDING_GTK__) -#include <WebCore/config.h> -#endif /* defined (BUILDING_GTK__) */ - -#include <wtf/Platform.h> -#include <wtf/DisallowCType.h> -#ifdef __cplusplus -#include <wtf/FastMalloc.h> -#endif - -#ifdef __cplusplus -#define EXTERN_C_BEGIN extern "C" { -#define EXTERN_C_END } -#else -#define EXTERN_C_BEGIN -#define EXTERN_C_END -#endif - -// For defining getters to a static value, where the getters have internal linkage -#define DEFINE_STATIC_GETTER(type, name, arguments) \ -static const type& name() \ -{ \ - DEFINE_STATIC_LOCAL(type, name##Value, arguments); \ - return name##Value; \ -} - -#if defined(BUILDING_QT__) - -#define WTF_USE_JSC 1 -#define WTF_USE_V8 0 - -#define JS_EXPORTDATA -#define JS_EXPORTCLASS - -// Disable notImplemented() warnings not to break layout tests. -// FIXME: WebKit2 logging system should behave identical to WebKit1. -#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 - -#elif defined(__APPLE__) - -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -#define ENABLE_WEB_PROCESS_SANDBOX 1 -#endif - -#define ENABLE_PLUGIN_PROCESS 1 - -#if PLATFORM(MAC) -#define ENABLE_MEMORY_SAMPLER 1 -#endif - -#import <CoreGraphics/CoreGraphics.h> - #ifdef __OBJC__ #import <Cocoa/Cocoa.h> #endif -/* WebKit has no way to pull settings from WebCore/config.h for now */ -/* so we assume WebKit is always being compiled on top of JavaScriptCore */ -#define WTF_USE_JSC 1 -#define WTF_USE_V8 0 - -#define JS_EXPORTDATA -#define JS_EXPORTCLASS -#define WEBKIT_EXPORTDATA - -#include <WebCore/EmptyProtocolDefinitions.h> - -#elif defined(WIN32) || defined(_WIN32) - -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#endif - -#ifndef WINVER -#define WINVER 0x0500 -#endif - -/* If we don't define these, they get defined in windef.h. */ -/* We want to use std::min and std::max. */ -#ifndef max -#define max max -#endif -#ifndef min -#define min min -#endif - -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ -#endif - -#include <WebCore/config.h> -#include <windows.h> - -#if PLATFORM(CG) -#include <CoreGraphics/CoreGraphics.h> +#ifdef __cplusplus +#define new ("if you use new/delete make sure to include config.h at the top of the file"()) +#define delete ("if you use new/delete make sure to include config.h at the top of the file"()) #endif - -#endif /* defined(WIN32) || defined(_WIN32) */ - diff --git a/Source/WebKit2/WebProcess.pro b/Source/WebKit2/WebProcess.pro index 94f49cd..bc0b878 100644 --- a/Source/WebKit2/WebProcess.pro +++ b/Source/WebKit2/WebProcess.pro @@ -5,7 +5,7 @@ SOURCES += \ qt/MainQt.cpp isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. -include(../../WebKit.pri) +include($$PWD/../WebKit.pri) DESTDIR = $$OUTPUT_DIR/bin !CONFIG(standalone_package): CONFIG -= app_bundle diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp index 36757d6..af35f75 100644 --- a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "AuthenticationManager.h" #include "MessageID.h" diff --git a/Source/WebKit2/WebProcess/Downloads/Download.cpp b/Source/WebKit2/WebProcess/Downloads/Download.cpp index 3cb5588..1c36df2 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.cpp +++ b/Source/WebKit2/WebProcess/Downloads/Download.cpp @@ -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 @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Download.h" #include "Connection.h" @@ -45,6 +46,9 @@ PassOwnPtr<Download> Download::create(uint64_t downloadID, const ResourceRequest Download::Download(uint64_t downloadID, const ResourceRequest& request) : m_downloadID(downloadID) , m_request(request) +#if USE(CFNETWORK) + , m_allowOverwrite(false) +#endif { ASSERT(m_downloadID); } @@ -83,7 +87,7 @@ bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType) return result; } -String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite) +String Download::retrieveDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite) { String destination; SandboxExtension::Handle sandboxExtensionHandle; @@ -97,6 +101,15 @@ String Download::decideDestinationWithSuggestedFilename(const String& filename, return destination; } +String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite) +{ + String destination = retrieveDestinationWithSuggestedFilename(filename, allowOverwrite); + + didDecideDestination(destination, allowOverwrite); + + return destination; +} + void Download::didCreateDestination(const String& path) { send(Messages::DownloadProxy::DidCreateDestination(path)); @@ -104,6 +117,8 @@ void Download::didCreateDestination(const String& path) void Download::didFinish() { + platformDidFinish(); + send(Messages::DownloadProxy::DidFinish()); if (m_sandboxExtension) diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h index bacdd01..26d8f3d 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.h +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -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 @@ -33,13 +33,9 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSURLDownload; -@class WKDownloadAsDelegate; -#else -class NSURLDownload; -class WKDownloadAsDelegate; -#endif + +OBJC_CLASS NSURLDownload; +OBJC_CLASS WKDownloadAsDelegate; #endif #if USE(CFNETWORK) @@ -84,14 +80,22 @@ public: String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite); void didCreateDestination(const String& path); void didFinish(); + void platformDidFinish(); void didFail(const WebCore::ResourceError&, const CoreIPC::DataReference& resumeData); void didCancel(const CoreIPC::DataReference& resumeData); + void didDecideDestination(const String&, bool allowOverwrite); + +#if USE(CFNETWORK) + const String& destination() const { return m_destination; } +#endif private: Download(uint64_t downloadID, const WebCore::ResourceRequest&); void platformInvalidate(); + String retrieveDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite); + uint64_t m_downloadID; WebCore::ResourceRequest m_request; @@ -102,6 +106,9 @@ private: RetainPtr<WKDownloadAsDelegate> m_delegate; #endif #if USE(CFNETWORK) + bool m_allowOverwrite; + String m_destination; + String m_bundlePath; RetainPtr<CFURLDownloadRef> m_download; #endif }; diff --git a/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp index e65883a..1cb288e 100644 --- a/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp +++ b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DownloadManager.h" #include "Download.h" diff --git a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp index 08c381f..c8a065e 100644 --- a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp +++ b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp @@ -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 @@ -23,12 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Download.h" #include "DataReference.h" #include "NotImplemented.h" #pragma warning(push, 0) +#include <WebCore/DownloadBundle.h> #include <WebCore/LoaderRunLoopCF.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceHandle.h> @@ -52,7 +54,7 @@ static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef pat static void didFinishCallback(CFURLDownloadRef download, const void* clientInfo); static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void* clientInfo); -void Download::start(WebPage* initiatingWebPage) +void Download::start(WebPage*) { ASSERT(!m_download); @@ -70,7 +72,7 @@ void Download::start(WebPage* initiatingWebPage) CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode); } -void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response) +void Download::startWithHandle(WebPage*, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response) { ASSERT(!m_download); @@ -98,7 +100,18 @@ void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, void Download::cancel() { - notImplemented(); + ASSERT(m_download); + if (!m_download) + return; + + CFURLDownloadSetDeletesUponFailure(m_download.get(), false); + CFURLDownloadCancel(m_download.get()); + + RetainPtr<CFDataRef> resumeData(AdoptCF, CFURLDownloadCopyResumeData(m_download.get())); + if (resumeData) + DownloadBundle::appendResumeData(resumeData.get(), m_bundlePath); + + didCancel(CoreIPC::DataReference()); } void Download::platformInvalidate() @@ -106,6 +119,21 @@ void Download::platformInvalidate() m_download = nullptr; } +void Download::didDecideDestination(const String& destination, bool allowOverwrite) +{ + ASSERT(!destination.isEmpty()); + if (destination.isEmpty()) + return; + + m_allowOverwrite = allowOverwrite; + m_destination = destination; + m_bundlePath = destination + DownloadBundle::fileExtension(); + + RetainPtr<CFStringRef> bundlePath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(m_bundlePath.characters()), m_bundlePath.length(), kCFAllocatorNull)); + RetainPtr<CFURLRef> bundlePathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLWindowsPathStyle, false)); + CFURLDownloadSetDestination(m_download.get(), bundlePathURL.get(), allowOverwrite); +} + // CFURLDownload Callbacks ---------------------------------------------------------------- static Download* downloadFromClientInfo(const void* clientInfo) { @@ -136,7 +164,7 @@ void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, con } void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void* clientInfo) -{ +{ // FIXME: implement. notImplemented(); } @@ -151,24 +179,20 @@ Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodin return downloadFromClientInfo(clientInfo)->shouldDecodeSourceDataOfMIMEType(encodingType); } -void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef cfURLDownloadRef, CFStringRef objectName, const void* clientInfo) +void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void* clientInfo) { Download* download = downloadFromClientInfo(clientInfo); bool allowOverwrite; - String destination = download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite); - if (destination.isNull()) - return; - - RetainPtr<CFStringRef> cfPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(destination.characters()), destination.length(), kCFAllocatorNull)); - RetainPtr<CFURLRef> pathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, cfPath.get(), kCFURLWindowsPathStyle, false)); - CFURLDownloadSetDestination(cfURLDownloadRef, pathURL.get(), allowOverwrite); + download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite); } -void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef url, const void* clientInfo) -{ - RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyFileSystemPath(url, kCFURLWindowsPathStyle)); - String result(path.get()); - downloadFromClientInfo(clientInfo)->didCreateDestination(result); +void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef, const void* clientInfo) +{ + // The concept of the ".download bundle" is internal to the Download, so we try to hide its + // existence by reporting the final destination was created, when in reality the bundle was created. + + Download* download = downloadFromClientInfo(clientInfo); + download->didCreateDestination(download->destination()); } void didFinishCallback(CFURLDownloadRef, const void* clientInfo) diff --git a/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp new file mode 100644 index 0000000..0dd6508 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp @@ -0,0 +1,56 @@ +/* + * 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 "Download.h" + +using namespace WebCore; + +namespace WebKit { + +void Download::platformDidFinish() +{ + ASSERT(!m_bundlePath.isEmpty()); + ASSERT(!m_destination.isEmpty()); + + // Try to move the bundle to the final filename. + DWORD flags = MOVEFILE_COPY_ALLOWED | (m_allowOverwrite ? MOVEFILE_REPLACE_EXISTING : 0); + if (::MoveFileExW(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), flags)) + return; + + // The move failed. Give the client one more chance to choose the final filename. + m_destination = retrieveDestinationWithSuggestedFilename(m_destination, m_allowOverwrite); + if (m_destination.isEmpty()) + return; + + // We either need to report our final filename as the bundle filename or the updated destination filename. + flags = MOVEFILE_COPY_ALLOWED | (m_allowOverwrite ? MOVEFILE_REPLACE_EXISTING : 0); + if (::MoveFileExW(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), flags)) + didCreateDestination(m_destination); + else + didCreateDestination(m_bundlePath); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp index 25ed351..eb0a1cd 100644 --- a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp +++ b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org> * * Redistribution and use in source and binary forms, with or without @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Download.h" #include "NotImplemented.h" @@ -52,4 +53,14 @@ void Download::platformInvalidate() notImplemented(); } +void Download::didDecideDestination(const String& destination, bool allowOverwrite) +{ + notImplemented(); +} + +void Download::platformDidFinish() +{ + notImplemented(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm index 6839020..0abd744 100644 --- a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm +++ b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.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 @@ -23,16 +23,17 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "Download.h" +#import "config.h" +#import "Download.h" -#include <WebCore/BackForwardController.h> -#include <WebCore/HistoryItem.h> -#include <WebCore/Page.h> -#include <WebCore/ResourceHandle.h> -#include <WebCore/ResourceResponse.h> -#include "DataReference.h" -#include "NotImplemented.h" -#include "WebPage.h" +#import <WebCore/BackForwardController.h> +#import <WebCore/HistoryItem.h> +#import <WebCore/Page.h> +#import <WebCore/ResourceHandle.h> +#import <WebCore/ResourceResponse.h> +#import "DataReference.h" +#import "NotImplemented.h" +#import "WebPage.h" @interface NSURLDownload (WebNSURLDownloadDetails) +(id)_downloadWithLoadingConnection:(NSURLConnection *)connection @@ -168,6 +169,14 @@ void Download::platformInvalidate() m_nsURLDownload = nullptr; } +void Download::didDecideDestination(const String& destination, bool allowOverwrite) +{ +} + +void Download::platformDidFinish() +{ +} + } // namespace WebKit @implementation WKDownloadAsDelegate diff --git a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp index 34fd60e..131f53a 100644 --- a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp +++ b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp @@ -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 @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Download.h" #include "NotImplemented.h" @@ -51,4 +52,14 @@ void Download::platformInvalidate() notImplemented(); } +void Download::didDecideDestination(const String& destination, bool allowOverwrite) +{ + notImplemented(); +} + +void Download::platformDidFinish() +{ + notImplemented(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp index 3068d5e..ba2aad0 100644 --- a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "GeolocationPermissionRequestManager.h" #include "WebFrame.h" diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp index 713ba71..cee8e0b 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationManager.h" #include "WebGeolocationManagerProxyMessages.h" diff --git a/Source/WebKit2/WebProcess/Info.plist b/Source/WebKit2/WebProcess/Info.plist index 1564066..1fa2672 100644 --- a/Source/WebKit2/WebProcess/Info.plist +++ b/Source/WebKit2/WebProcess/Info.plist @@ -2,6 +2,8 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>LSFileQuarantineEnabled</key> + <true/> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 5c4b6e9..a58dbda 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundle.h" #include "WKBundlePrivate.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index 47ac2d6..db32716 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -45,11 +45,13 @@ class InjectedBundle; class InjectedBundleBackForwardList; class InjectedBundleBackForwardListItem; class InjectedBundleHitTestResult; +class InjectedBundleNavigationAction; class InjectedBundleNodeHandle; class InjectedBundleRangeHandle; class InjectedBundleScriptWorld; class PageOverlay; class WebFrame; +class WebInspector; class WebPage; class WebPageGroupProxy; @@ -58,6 +60,8 @@ WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList) WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration) WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame) WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult) +WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector) +WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction) WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle) WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy) WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp index 288c676..7ffa3ce 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleBackForwardList.h" #include "InjectedBundleBackForwardList.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp index cde15c4..e9845e3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleBackForwardListItem.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index f02044c..82f616a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleFrame.h" #include "WKBundleFramePrivate.h" @@ -55,6 +56,29 @@ WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frameRef) return toCopiedURLAPI(toImpl(frameRef)->provisionalURL()); } +WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frameRef) +{ + Frame* coreFrame = toImpl(frameRef)->coreFrame(); + if (!coreFrame) + return kWKFrameLoadStateFinished; + + FrameLoader* loader = coreFrame->loader(); + if (!loader) + return kWKFrameLoadStateFinished; + + switch (loader->state()) { + case FrameStateProvisional: + return kWKFrameLoadStateProvisional; + case FrameStateCommittedPage: + return kWKFrameLoadStateCommitted; + case FrameStateComplete: + return kWKFrameLoadStateFinished; + } + + ASSERT_NOT_REACHED(); + return kWKFrameLoadStateFinished; +} + WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef) { return toAPI(toImpl(frameRef)->childFrames().releaseRef()); @@ -152,58 +176,35 @@ bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frameRef) { - WKRect contentBounds = { { 0, 0 }, { 0, 0 } }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return contentBounds; - - FrameView* view = coreFrame->view(); - if (!view) - return contentBounds; - - contentBounds.size.width = view->contentsWidth(); - contentBounds.size.height = view->contentsHeight(); - - return contentBounds; + return toAPI(toImpl(frameRef)->contentBounds()); } WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frameRef) { - WKRect visibleContentBounds = { { 0, 0 }, { 0, 0 } }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return visibleContentBounds; - - FrameView* view = coreFrame->view(); - if (!view) - return visibleContentBounds; - - FloatRect bounds = view->visibleContentRect(true); + return toAPI(toImpl(frameRef)->visibleContentBounds()); +} - visibleContentBounds.size.width = bounds.width(); - visibleContentBounds.size.height = bounds.height(); - - return visibleContentBounds; +WKRect WKBundleFrameGetVisibleContentBoundsExcludingScrollbars(WKBundleFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->visibleContentBoundsExcludingScrollbars()); } -WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef) +WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef) { - WKSize scrollOffset = { 0, 0 }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return scrollOffset; - - FrameView* view = coreFrame->view(); - if (!view) - return scrollOffset; - - return toAPI(view->scrollOffset()); + return toAPI(toImpl(frameRef)->scrollOffset()); +} + +bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frameRef, double* red, double* green, double* blue, double* alpha) +{ + return toImpl(frameRef)->getDocumentBackgroundColor(red, green, blue, alpha); } WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) { return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); } + +WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) +{ + return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h index 59c2d75..3c7c52d 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h @@ -28,6 +28,7 @@ #include <JavaScriptCore/JavaScript.h> #include <WebKit2/WKBase.h> +#include <WebKit2/WKFrame.h> #include <WebKit2/WKGeometry.h> #ifdef __cplusplus @@ -43,6 +44,8 @@ WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame); WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame); WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame); +WK_EXPORT WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frame); + WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame); WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world); @@ -57,9 +60,13 @@ WK_EXPORT bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frame, WKURLRef WK_EXPORT WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frame); WK_EXPORT WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frame); +WK_EXPORT WKRect WKBundleFrameGetVisibleContentBoundsExcludingScrollbars(WKBundleFrameRef frame); WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frame); +WK_EXPORT bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frame, double* red, double* green, double* blue, double* alpha); + WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); +WK_EXPORT WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp index 7e74262..b764ee9 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleHitTestResult.h" #include "InjectedBundleHitTestResult.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp new file mode 100644 index 0000000..ae69a53 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp @@ -0,0 +1,66 @@ +/* + * 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 "WKBundleInspector.h" + +#if ENABLE(INSPECTOR) + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebInspector.h" + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKBundleInspectorGetTypeID() +{ + return toAPI(WebInspector::APIType); +} + +void WKBundleInspectorShow(WKBundleInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->show(); +} + +void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->close(); +} + +void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script) +{ + return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string()); +} + +void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) +{ + if (enabled) + toImpl(inspectorRef)->startPageProfiling(); + else + toImpl(inspectorRef)->stopPageProfiling(); +} + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h new file mode 100644 index 0000000..e32fdf2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBundleInspector_h +#define WKBundleInspector_h + +#include <WebKit2/WKBase.h> + +#if ENABLE(INSPECTOR) + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleInspectorGetTypeID(); + +WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector); +WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector); + +WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script); +WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); + +#ifdef __cplusplus +} +#endif + +#endif // ENABLE(INSPECTOR) + +#endif // WKBundleInspector_h + diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp new file mode 100644 index 0000000..c26ec3e --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp @@ -0,0 +1,67 @@ +/* + * 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 "WKBundleNavigationAction.h" + +#include "InjectedBundleHitTestResult.h" +#include "InjectedBundleNavigationAction.h" +#include "InjectedBundleNodeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleNavigationActionGetTypeID() +{ + return toAPI(InjectedBundleNavigationAction::APIType); +} + +WKFrameNavigationType WKBundleNavigationActionGetNavigationType(WKBundleNavigationActionRef navigationActionRef) +{ + return toAPI(toImpl(navigationActionRef)->navigationType()); +} + +WKEventModifiers WKBundleNavigationActionGetEventModifiers(WKBundleNavigationActionRef navigationActionRef) +{ + return toAPI(toImpl(navigationActionRef)->modifiers()); +} + +WKEventMouseButton WKBundleNavigationActionGetEventMouseButton(WKBundleNavigationActionRef navigationActionRef) +{ + return toAPI(toImpl(navigationActionRef)->mouseButton()); +} + +WKBundleHitTestResultRef WKBundleNavigationActionCopyHitTestResult(WKBundleNavigationActionRef navigationActionRef) +{ + RefPtr<InjectedBundleHitTestResult> hitTestResult = toImpl(navigationActionRef)->hitTestResult(); + return toAPI(hitTestResult.release().leakRef()); +} + +WKBundleNodeHandleRef WKBundleNavigationActionCopyFormElement(WKBundleNavigationActionRef navigationActionRef) +{ + RefPtr<InjectedBundleNodeHandle> formElement = toImpl(navigationActionRef)->formElement(); + return toAPI(formElement.release().leakRef()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h new file mode 100644 index 0000000..03f083a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBundleNavigationAction_h +#define WKBundleNavigationAction_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKEvent.h> +#include <WebKit2/WKPageLoadTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleNavigationActionGetTypeID(); + +WK_EXPORT WKFrameNavigationType WKBundleNavigationActionGetNavigationType(WKBundleNavigationActionRef navigationAction); +WK_EXPORT WKEventModifiers WKBundleNavigationActionGetEventModifiers(WKBundleNavigationActionRef navigationAction); +WK_EXPORT WKEventMouseButton WKBundleNavigationActionGetEventMouseButton(WKBundleNavigationActionRef navigationAction); +WK_EXPORT WKBundleHitTestResultRef WKBundleNavigationActionCopyHitTestResult(WKBundleNavigationActionRef navigationAction); +WK_EXPORT WKBundleNodeHandleRef WKBundleNavigationActionCopyFormElement(WKBundleNavigationActionRef navigationAction); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleNavigationAction_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp index bf853d1..9b0eaf1 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleNodeHandle.h" #include "WKBundleNodeHandlePrivate.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 9693b6a..a1a4da3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundlePage.h" #include "WKBundlePagePrivate.h" @@ -64,13 +65,27 @@ void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient* toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient); } -void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient) +void WKBundlePageSetPageLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient) { if (wkClient && wkClient->version) return; toImpl(pageRef)->initializeInjectedBundleLoaderClient(wkClient); } +void WKBundlePageSetResourceLoadClient(WKBundlePageRef pageRef, WKBundlePageResourceLoadClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleResourceLoadClient(wkClient); +} + +void WKBundlePageSetPolicyClient(WKBundlePageRef pageRef, WKBundlePagePolicyClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundlePolicyClient(wkClient); +} + void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkClient) { if (wkClient && wkClient->version) @@ -184,3 +199,16 @@ WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageR RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInDocumentCoordinates(toIntRect(rect), toImageOptions(options)); return toAPI(webImage.release().leakRef()); } + +WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, double scaleFactor, WKImageOptions options) +{ + RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotInDocumentCoordinates(toIntRect(rect), scaleFactor, toImageOptions(options)); + return toAPI(webImage.release().leakRef()); +} + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef) +{ + return toAPI(toImpl(pageRef)->inspector()); +} +#endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 00db56f..944a5b6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -87,8 +87,6 @@ typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo); typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); -typedef bool (*WKBundlePageShouldLoadResourceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef url, const void *clientInfo); - struct WKBundlePageLoaderClient { int version; @@ -113,10 +111,43 @@ struct WKBundlePageLoaderClient { WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame; WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame; WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame; - WKBundlePageShouldLoadResourceForFrameCallback shouldLoadResourceForFrame; }; typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient; +// Policy Client +typedef void (*WKBundlePageDecidePolicyForNavigationActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePageDecidePolicyForNewWindowActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKStringRef frameName, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePageDecidePolicyForMIMETypeCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo); + +struct WKBundlePagePolicyClient { + int version; + const void * clientInfo; + WKBundlePageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; + WKBundlePageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKBundlePageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType; +}; +typedef struct WKBundlePagePolicyClient WKBundlePagePolicyClient; + +// Resource Load Client +typedef void (*WKBundlePageDidInitiateLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo); +typedef WKURLRequestRef (*WKBundlePageWillSendRequestForFrameCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef redirectResponse, const void *clientInfo); +typedef void (*WKBundlePageDidReceiveResponseForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLResponseRef, const void* clientInfo); +typedef void (*WKBundlePageDidReceiveContentLengthForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo); +typedef void (*WKBundlePageDidFinishLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo); +typedef void (*WKBundlePageDidFailLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKErrorRef, const void* clientInfo); + +struct WKBundlePageResourceLoadClient { + int version; + const void * clientInfo; + WKBundlePageDidInitiateLoadForResourceCallback didInitiateLoadForResource; + WKBundlePageWillSendRequestForFrameCallback willSendRequestForFrame; + WKBundlePageDidReceiveResponseForResourceCallback didReceiveResponseForResource; + WKBundlePageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource; + WKBundlePageDidFinishLoadForResourceCallback didFinishLoadForResource; + WKBundlePageDidFailLoadForResourceCallback didFailLoadForResource; +}; +typedef struct WKBundlePageResourceLoadClient WKBundlePageResourceLoadClient; + // UI Client typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo); typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo); @@ -125,6 +156,7 @@ typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef pag typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo); typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo); typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo); +typedef void (*WKBundlePagePaintCustomOverhangAreaCallback)(WKBundlePageRef page, WKGraphicsContextRef graphicsContext, WKRect horizontalOverhang, WKRect verticalOverhang, WKRect dirtyRect, const void* clientInfo); struct WKBundlePageUIClient { int version; @@ -136,6 +168,7 @@ struct WKBundlePageUIClient { WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt; WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement; WKBundlePageDidScrollCallback pageDidScroll; + WKBundlePagePaintCustomOverhangAreaCallback paintCustomOverhangArea; }; typedef struct WKBundlePageUIClient WKBundlePageUIClient; @@ -201,7 +234,9 @@ WK_EXPORT WKTypeID WKBundlePageGetTypeID(); WK_EXPORT void WKBundlePageSetContextMenuClient(WKBundlePageRef page, WKBundlePageContextMenuClient* client); WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClient* client); WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClient* client); -WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client); +WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client); +WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClient* client); +WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClient* client); WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client); WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); @@ -219,6 +254,11 @@ WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); +WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, double scaleFactor, WKImageOptions options); + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); +#endif #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp index 47d4cf1..e076cb9 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundlePageGroup.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp index 48fcab4..d86c2e0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundlePageOverlay.h" #include "PageOverlay.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp index 78047af..c868fab 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleRangeHandle.h" #include "InjectedBundleRangeHandle.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp index a7a4a8d..1133e3e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleScriptWorld.h" #include "InjectedBundleScriptWorld.h" @@ -46,3 +47,8 @@ WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld() { return toAPI(InjectedBundleScriptWorld::normalWorld()); } + +void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorldRef) +{ + toImpl(scriptWorldRef)->clearWrappers(); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h index 0763efa..013cdc9 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h @@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKBundleScriptWorldGetTypeID(); WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld(); WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld(); +WK_EXPORT void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorld); #ifdef __cplusplus } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp index 6ee3b31..43cf1ef 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleNodeHandle.h" #include "WebFrame.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp index 9186637..e94edfd 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleRangeHandle.h" #include <WebCore/Range.h> diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index c9f1a6d..b887374 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundle.h" #include "Arguments.h" @@ -70,7 +71,7 @@ void InjectedBundle::initializeClient(WKBundleClient* client) void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody) { - WebProcess::shared().connection()->send(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody))); + WebProcess::shared().connection()->deprecatedSend(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody))); } void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData) @@ -78,7 +79,7 @@ void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject RefPtr<APIObject> returnDataTmp; InjectedBundleUserMessageDecoder messageDecoder(returnDataTmp); - bool succeeded = WebProcess::shared().connection()->sendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder)); + bool succeeded = WebProcess::shared().connection()->deprecatedSendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder)); if (!succeeded) return; diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp index 9f50942..d7fb9ec 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleBackForwardList.h" #include "InjectedBundleBackForwardListItem.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp index 222dfa3..92a7e69 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleBackForwardListItem.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp index de572d0..f2e4f2b 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleClient.h" #include "WKBundleAPICast.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp index ab59226..c359b42 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleHitTestResult.h" #include "InjectedBundleNodeHandle.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp new file mode 100644 index 0000000..7a40ee6 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp @@ -0,0 +1,105 @@ +/* + * 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 "InjectedBundleNavigationAction.h" + +#include "WebFrame.h" +#include <WebCore/Frame.h> +#include <WebCore/HTMLFormElement.h> +#include <WebCore/MouseEvent.h> +#include <WebCore/NavigationAction.h> +#include <WebCore/UIEventWithKeyState.h> + +using namespace WebCore; + +namespace WebKit { + +static const MouseEvent* mouseEventForNavigationAction(const NavigationAction& navigationAction) +{ + for (const Event* e = navigationAction.event(); e; e = e->underlyingEvent()) { + if (e->isMouseEvent()) + return static_cast<const MouseEvent*>(e); + } + return 0; +} + +static WebMouseEvent::Button mouseButtonForMouseEvent(const MouseEvent* mouseEvent) +{ + if (!mouseEvent) + return WebMouseEvent::NoButton; + + if (!mouseEvent->buttonDown()) + return WebMouseEvent::NoButton; + + return static_cast<WebMouseEvent::Button>(mouseEvent->button()); +} + +WebEvent::Modifiers InjectedBundleNavigationAction::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 static_cast<WebEvent::Modifiers>(modifiers); +} + +WebMouseEvent::Button InjectedBundleNavigationAction::mouseButtonForNavigationAction(const NavigationAction& navigationAction) +{ + return mouseButtonForMouseEvent(mouseEventForNavigationAction(navigationAction)); +} + + +PassRefPtr<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, PassRefPtr<FormState> formState) +{ + return adoptRef(new InjectedBundleNavigationAction(frame, action, formState)); +} + +InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, const NavigationAction& navigationAction, PassRefPtr<FormState> prpFormState) +{ + m_navigationType = navigationAction.type(); + m_modifiers = modifiersForNavigationAction(navigationAction); + + if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) { + m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false)); + m_mouseButton = mouseButtonForMouseEvent(mouseEvent); + } + + RefPtr<FormState> formState = prpFormState; + if (formState) { + ASSERT(formState->form()); + m_formElement = InjectedBundleNodeHandle::getOrCreate(formState->form()); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h new file mode 100644 index 0000000..128c9fb --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundleNavigationAction_h +#define InjectedBundleNavigationAction_h + +#include "APIObject.h" +#include "InjectedBundleHitTestResult.h" +#include "InjectedBundleNodeHandle.h" +#include "WebEvent.h" +#include <WebCore/FrameLoaderTypes.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class FormState; + class NavigationAction; +} + +namespace WebKit { + +class WebFrame; + +class InjectedBundleNavigationAction : public APIObject { +public: + static const Type APIType = TypeBundleNavigationAction; + + static PassRefPtr<InjectedBundleNavigationAction> create(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>); + + static WebEvent::Modifiers modifiersForNavigationAction(const WebCore::NavigationAction&); + static WebMouseEvent::Button mouseButtonForNavigationAction(const WebCore::NavigationAction&); + + WebCore::NavigationType navigationType() const { return m_navigationType; } + WebEvent::Modifiers modifiers() const { return m_modifiers; } + WebMouseEvent::Button mouseButton() const { return m_mouseButton; } + InjectedBundleHitTestResult* hitTestResult() const { return m_hitTestResult.get(); } + InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); } + +private: + InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>); + + virtual Type type() const { return APIType; } + + WebCore::NavigationType m_navigationType; + WebEvent::Modifiers m_modifiers; + WebMouseEvent::Button m_mouseButton; + RefPtr<InjectedBundleHitTestResult> m_hitTestResult; + RefPtr<InjectedBundleNodeHandle> m_formElement; +}; + +} // namespace WebKit + +#endif // InjectedBundleNavigationAction_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp index a2d16cb..9df0081 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePageContextMenuClient.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp index 40996c2..633936b 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePageEditorClient.h" #include "InjectedBundleNodeHandle.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp index 4d210f2..39924ec 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePageFormClient.h" #include "ImmutableDictionary.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp index 23341c5..58a20cf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePageLoaderClient.h" #include "InjectedBundleScriptWorld.h" @@ -175,14 +176,6 @@ void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page userData = adoptRef(toImpl(userDataToPass)); } -bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& resourceURL) -{ - if (!m_client.shouldLoadResourceForFrame) - return true; - - return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toAPI(resourceURL.impl()), m_client.clientInfo); -} - void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world) { if (!m_client.didClearWindowObjectForFrame) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h index e983b48..88cb824 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h @@ -35,6 +35,8 @@ namespace WebCore { class DOMWrapperWorld; class ResourceError; +class ResourceRequest; +class ResourceResponse; } namespace WebKit { @@ -60,8 +62,6 @@ public: void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); - bool shouldLoadResourceForFrame(WebPage*, WebFrame*, const String&); - void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*); void didCancelClientRedirectForFrame(WebPage*, WebFrame*); void willPerformClientRedirectForFrame(WebPage*, WebFrame*, const String& url, double delay, double date); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp new file mode 100644 index 0000000..c55e729 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp @@ -0,0 +1,72 @@ +/* + * 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 "InjectedBundlePagePolicyClient.h" + +#include "WKBundleAPICast.h" +#include "WebURLRequest.h" + +using namespace WebCore; + +namespace WebKit { + +void InjectedBundlePagePolicyClient::decidePolicyForNavigationAction(WebPage* page, WebFrame* frame, InjectedBundleNavigationAction* action, const ResourceRequest& resourceRequest, RefPtr<APIObject>& userData) +{ + if (!m_client.decidePolicyForNavigationAction) + return; + + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + WKTypeRef userDataToPass = 0; + m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePagePolicyClient::decidePolicyForNewWindowAction(WebPage* page, WebFrame* frame, InjectedBundleNavigationAction* action, const ResourceRequest& resourceRequest, const String& frameName, RefPtr<APIObject>& userData) +{ + if (!m_client.decidePolicyForNewWindowAction) + return; + + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + WKTypeRef userDataToPass = 0; + m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), toAPI(frameName.impl()), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePagePolicyClient::decidePolicyForMIMEType(WebPage* page, WebFrame* frame, const String& MIMEType, const ResourceRequest& resourceRequest, RefPtr<APIObject>& userData) +{ + if (!m_client.decidePolicyForMIMEType) + return; + + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + + WKTypeRef userDataToPass = 0; + m_client.decidePolicyForMIMEType(toAPI(page), toAPI(frame), toAPI(MIMEType.impl()), toAPI(request.get()), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h new file mode 100644 index 0000000..2145ac4 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundlePagePolicyClient_h +#define InjectedBundlePagePolicyClient_h + +#include "APIClient.h" +#include "APIObject.h" +#include "WKBundlePage.h" +#include <wtf/Forward.h> + +namespace WebCore { + class ResourceRequest; +} + +namespace WebKit { + +class InjectedBundleNavigationAction; +class WebFrame; +class WebPage; + +class InjectedBundlePagePolicyClient : public APIClient<WKBundlePagePolicyClient> { +public: + void decidePolicyForNavigationAction(WebPage*, WebFrame*, InjectedBundleNavigationAction*, const WebCore::ResourceRequest&, RefPtr<APIObject>& userData); + void decidePolicyForNewWindowAction(WebPage*, WebFrame*, InjectedBundleNavigationAction*, const WebCore::ResourceRequest&, const String& frameName, RefPtr<APIObject>& userData); + void decidePolicyForMIMEType(WebPage*, WebFrame*, const String& MIMEType, const WebCore::ResourceRequest&, RefPtr<APIObject>& userData); +}; + +} // namespace WebKit + +#endif // InjectedBundlePagePolicyClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp new file mode 100644 index 0000000..c2866a8 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp @@ -0,0 +1,88 @@ +/* + * 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 "InjectedBundlePageResourceLoadClient.h" + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebCore; + +namespace WebKit { + +void InjectedBundlePageResourceLoadClient::didInitiateLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceRequest& request, bool pageIsProvisionallyLoading) +{ + if (!m_client.didInitiateLoadForResource) + return; + + m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(request), pageIsProvisionallyLoading, m_client.clientInfo); +} + +void InjectedBundlePageResourceLoadClient::willSendRequestForFrame(WebPage* page, WebFrame* frame, uint64_t identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) +{ + if (!m_client.willSendRequestForFrame) + return; + + RefPtr<WebURLRequest> returnedRequest = toImpl(m_client.willSendRequestForFrame(toAPI(page), toAPI(frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.clientInfo)); + if (returnedRequest) + request = returnedRequest->resourceRequest(); + else + request = ResourceRequest(); +} + +void InjectedBundlePageResourceLoadClient::didReceiveResponseForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceResponse& response) +{ + if (!m_client.didReceiveResponseForResource) + return; + + m_client.didReceiveResponseForResource(toAPI(page), toAPI(frame), identifier, toAPI(response), m_client.clientInfo); +} + +void InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource(WebPage* page, WebFrame* frame, uint64_t identifier, uint64_t contentLength) +{ + if (!m_client.didReceiveContentLengthForResource) + return; + + m_client.didReceiveContentLengthForResource(toAPI(page), toAPI(frame), identifier, contentLength, m_client.clientInfo); +} + +void InjectedBundlePageResourceLoadClient::didFinishLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier) +{ + if (!m_client.didFinishLoadForResource) + return; + + m_client.didFinishLoadForResource(toAPI(page), toAPI(frame), identifier, m_client.clientInfo); +} + +void InjectedBundlePageResourceLoadClient::didFailLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceError& error) +{ + if (!m_client.didFailLoadForResource) + return; + + m_client.didFailLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(error), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h new file mode 100644 index 0000000..c2b654f --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundlePageResourceLoadClient_h +#define InjectedBundlePageResourceLoadClient_h + +#include "APIClient.h" +#include "SameDocumentNavigationType.h" +#include "WKBundlePage.h" +#include <JavaScriptCore/JSBase.h> +#include <wtf/Forward.h> + +namespace WebCore { +class ResourceError; +class ResourceRequest; +class ResourceResponse; +} + +namespace WebKit { + +class APIObject; +class WebPage; +class WebFrame; + +class InjectedBundlePageResourceLoadClient : public APIClient<WKBundlePageResourceLoadClient> { +public: + void didInitiateLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading); + void willSendRequestForFrame(WebPage*, WebFrame*, uint64_t identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + void didReceiveResponseForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceResponse&); + void didReceiveContentLengthForResource(WebPage*, WebFrame*, uint64_t identifier, uint64_t contentLength); + void didFinishLoadForResource(WebPage*, WebFrame*, uint64_t identifier); + void didFailLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceError&); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageResourceLoadClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp index 56e4434..7bb4f89 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp @@ -23,10 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePageUIClient.h" #include "InjectedBundleHitTestResult.h" #include "WKAPICast.h" +#include "WebGraphicsContext.h" #include "WKBundleAPICast.h" #include <wtf/text/WTFString.h> @@ -78,8 +80,23 @@ void InjectedBundlePageUIClient::mouseDidMoveOverElement(WebPage* page, const Hi void InjectedBundlePageUIClient::pageDidScroll(WebPage* page) { - if (m_client.pageDidScroll) - m_client.pageDidScroll(toAPI(page), m_client.clientInfo); + if (!m_client.pageDidScroll) + return; + + m_client.pageDidScroll(toAPI(page), m_client.clientInfo); +} + +bool InjectedBundlePageUIClient::shouldPaintCustomOverhangArea() +{ + return m_client.paintCustomOverhangArea; +} + +void InjectedBundlePageUIClient::paintCustomOverhangArea(WebPage* page, GraphicsContext* graphicsContext, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) +{ + ASSERT(shouldPaintCustomOverhangArea()); + + RefPtr<WebGraphicsContext> context = WebGraphicsContext::create(graphicsContext); + m_client.paintCustomOverhangArea(toAPI(page), toAPI(context.get()), toAPI(horizontalOverhangArea), toAPI(verticalOverhangArea), toAPI(dirtyRect), m_client.clientInfo); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h index 93c19e9..94925b7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h @@ -32,7 +32,9 @@ #include <wtf/Forward.h> namespace WebCore { + class GraphicsContext; class HitTestResult; + class IntRect; } namespace WebKit { @@ -50,6 +52,9 @@ public: void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*); void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<APIObject>& userData); void pageDidScroll(WebPage*); + + bool shouldPaintCustomOverhangArea(); + void paintCustomOverhangArea(WebPage*, WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&); }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp index d764cf2..2f40fd3 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundleScriptWorld.h" #include <WebCore/DOMWrapperWorld.h> @@ -80,5 +81,10 @@ DOMWrapperWorld* InjectedBundleScriptWorld::coreWorld() const { return m_world.get(); } + +void InjectedBundleScriptWorld::clearWrappers() +{ + m_world->clearWrappers(); +} } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h index 00dd14a..7562a6f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h @@ -47,6 +47,8 @@ public: virtual ~InjectedBundleScriptWorld(); WebCore::DOMWrapperWorld* coreWorld() const; + + void clearWrappers(); private: InjectedBundleScriptWorld(PassRefPtr<WebCore::DOMWrapperWorld>); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp index f992af2..c75e433 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundle.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp index f278ea9..00e4dff 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundle.h" #include "WKBundleAPICast.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp index 9d397e8..a5183b1 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundle.h" #include "WKBundleAPICast.h" diff --git a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp index 3fd3333..1e593fc 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundle.h" #include "WKBundleAPICast.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp index c094505..edd2b44 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "JSNPMethod.h" #include "JSNPObject.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp index d7d626f..f6939cb 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "JSNPObject.h" #include "JSNPMethod.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp index 45c1e6e..345bd54 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NPJSObject.h" #include "JSNPObject.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp index 4fa37c1..0a96ad7 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NPRuntimeObjectMap.h" #include "JSNPObject.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp index 20ff478..e92f026 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NPRuntimeUtilities.h" #include <wtf/text/CString.h> diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp index ba21db1..5f8ee5c 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapeBrowserFuncs.h" #include "NPRuntimeUtilities.h" @@ -387,8 +388,12 @@ static NPError NPN_PostURLNotify(NPP npp, const char* url, const char* target, u } #if PLATFORM(MAC) -/* TRUE if the browser supports hardware compositing of Core Animation plug-ins */ +// true if the browser supports hardware compositing of Core Animation plug-ins. static const unsigned WKNVSupportsCompositingCoreAnimationPluginsBool = 74656; + +// The Core Animation render server port. +static const unsigned WKNVCALayerRenderServerPort = 71879; + #endif static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) @@ -432,6 +437,13 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) *(NPBool*)value = true; break; + case WKNVCALayerRenderServerPort: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + *(mach_port_t*)value = plugin->compositingRenderServerPort(); + break; + } + #ifndef NP_NO_QUICKDRAW case NPNVsupportsQuickDrawBool: // We don't support the QuickDraw drawing model. diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index 5674ba5..e746d5a 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePlugin.h" #include "NPRuntimeObjectMap.h" @@ -351,8 +352,8 @@ void NetscapePlugin::callSetWindow() m_npWindow.height = m_frameRect.height(); m_npWindow.clipRect.top = m_clipRect.y(); m_npWindow.clipRect.left = m_clipRect.x(); - m_npWindow.clipRect.bottom = m_clipRect.bottom(); - m_npWindow.clipRect.right = m_clipRect.right(); + m_npWindow.clipRect.bottom = m_clipRect.maxY(); + m_npWindow.clipRect.right = m_clipRect.maxX(); NPP_SetWindow(&m_npWindow); } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h index 95ff714..e807beb 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -56,6 +56,8 @@ public: NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace); NPError popUpContextMenu(NPMenu*); + mach_port_t compositingRenderServerPort(); + #ifndef NP_NO_CARBON WindowRef windowRef() const; bool isWindowActive() const { return m_windowHasFocus; } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp index be60795..9450317 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginStream.h" #include "NetscapePlugin.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp index 64239f3..2b734fd 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePlugin.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm index d57e8d1..46671b8 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm @@ -23,13 +23,14 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "NetscapePlugin.h" +#import "config.h" +#import "NetscapePlugin.h" -#include "PluginController.h" -#include "WebEvent.h" -#include <WebCore/GraphicsContext.h> -#include <Carbon/Carbon.h> -#include <WebKitSystemInterface.h> +#import "PluginController.h" +#import "WebEvent.h" +#import <WebCore/GraphicsContext.h> +#import <Carbon/Carbon.h> +#import <WebKitSystemInterface.h> using namespace WebCore; @@ -171,6 +172,11 @@ NPError NetscapePlugin::popUpContextMenu(NPMenu* npMenu) return NPERR_NO_ERROR; } +mach_port_t NetscapePlugin::compositingRenderServerPort() +{ + return m_pluginController->compositingRenderServerPort(); +} + #ifndef NP_NO_CARBON typedef HashMap<WindowRef, NetscapePlugin*> WindowMap; @@ -779,8 +785,8 @@ static Rect computeFakeWindowBoundsRect(const WebCore::IntRect& windowFrameInScr // Carbon global coordinates has the origin set at the top left corner of the main viewing screen, so we want to flip the y coordinate. CGFloat maxY = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]); - int flippedWindowFrameYCoordinate = maxY - windowFrameInScreenCoordinates.bottom(); - int flippedViewFrameYCoordinate = windowFrameInScreenCoordinates.height() - viewFrameInWindowCoordinates.bottom(); + int flippedWindowFrameYCoordinate = maxY - windowFrameInScreenCoordinates.maxY(); + int flippedViewFrameYCoordinate = windowFrameInScreenCoordinates.height() - viewFrameInWindowCoordinates.maxY(); Rect bounds; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm index 6ecf7b9..d331506 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm @@ -23,11 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) +#import "config.h" +#import "PluginProxy.h" -#include "PluginProxy.h" +#if ENABLE(PLUGIN_PROCESS) -#include <WebKitSystemInterface.h> +#import <WebKitSystemInterface.h> namespace WebKit { diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp index 77efc01..1ede2c3 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePlugin.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp index 930f87b..e713f83 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePlugin.h" #include "NotImplemented.h" @@ -126,7 +127,7 @@ void NetscapePlugin::platformGeometryDidChange() IntRect clipRectInPluginWindowCoordinates = m_clipRect; clipRectInPluginWindowCoordinates.move(-m_frameRect.x(), -m_frameRect.y()); - OwnPtr<HRGN> clipRegion = adoptPtr(::CreateRectRgn(clipRectInPluginWindowCoordinates.x(), clipRectInPluginWindowCoordinates.y(), clipRectInPluginWindowCoordinates.right(), clipRectInPluginWindowCoordinates.bottom())); + OwnPtr<HRGN> clipRegion = adoptPtr(::CreateRectRgn(clipRectInPluginWindowCoordinates.x(), clipRectInPluginWindowCoordinates.y(), clipRectInPluginWindowCoordinates.maxX(), clipRectInPluginWindowCoordinates.maxY())); setWindowRegion(m_window, clipRegion.release(), Redraw); // FIXME: We should only update the size here and let the UI process update our position so diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp index 32ad92d..98e1128 100644 --- a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "Plugin.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/WebProcess/Plugins/PluginController.h b/Source/WebKit2/WebProcess/Plugins/PluginController.h index 06cf2d7..9dc8ec3 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginController.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginController.h @@ -91,6 +91,9 @@ public: #if PLATFORM(MAC) // Tells the controller that complex text input be enabled or disabled for the plug-in. virtual void setComplexTextInputEnabled(bool) = 0; + + // Returns the mach port of the compositing render server. + virtual mach_port_t compositingRenderServerPort() = 0; #endif // Returns the proxies for the given URL or null on failure. diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp index 7c09e56..ef931c8 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessConnection.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPRemoteObjectMap.h" #include "PluginProcessConnectionManager.h" #include "PluginProxy.h" diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp index 99848ef..1290391 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessConnectionManager.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "MachPort.h" @@ -61,7 +62,7 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect CoreIPC::Connection::Identifier connectionIdentifier; CoreIPC::MachPort connectionMachPort; - if (!WebProcess::shared().connection()->sendSync(WebProcessProxyLegacyMessage::GetPluginProcessConnection, 0, CoreIPC::In(pluginPath), CoreIPC::Out(connectionMachPort))) + if (!WebProcess::shared().connection()->deprecatedSendSync(WebProcessProxyLegacyMessage::GetPluginProcessConnection, 0, CoreIPC::In(pluginPath), CoreIPC::Out(connectionMachPort))) return 0; connectionIdentifier = connectionMachPort.port(); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index f029cbf..551e458 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProxy.h" +#if ENABLE(PLUGIN_PROCESS) + #include "DataReference.h" #include "NPRemoteObjectMap.h" #include "NPRuntimeUtilities.h" diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h index 2c3b052..9be7bd1 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -33,11 +33,7 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class CALayer; -#else -class CALayer; -#endif +OBJC_CLASS CALayer; #endif namespace WebCore { diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 00271c1..8ac7d3a 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PluginView.h" #include "NPRuntimeUtilities.h" @@ -30,6 +31,7 @@ #include "WebEvent.h" #include "WebPage.h" #include "WebPageProxyMessages.h" +#include "WebProcess.h" #include <WebCore/Chrome.h> #include <WebCore/CookieJar.h> #include <WebCore/DocumentLoader.h> @@ -282,8 +284,11 @@ PluginView::~PluginView() // Invalidate the object map. m_npRuntimeObjectMap.invalidate(); - // Cancel all streams. cancelAllStreams(); + + // Null out the plug-in element explicitly so we'll crash earlier if we try to use + // the plug-in view after it's been destroyed. + m_pluginElement = nullptr; } Frame* PluginView::frame() @@ -901,6 +906,10 @@ bool PluginView::evaluate(NPObject* npObject, const String& scriptString, NPVari bool oldAllowPopups = frame()->script()->allowPopupsFromPlugin(); frame()->script()->setAllowPopupsFromPlugin(allowPopups); + // Calling evaluate will run JavaScript that can potentially remove the plug-in element, so we need to + // protect the plug-in view from destruction. + NPRuntimeObjectMap::PluginProtector pluginProtector(&m_npRuntimeObjectMap); + bool returnValue = m_npRuntimeObjectMap.evaluate(npObject, scriptString, result); frame()->script()->setAllowPopupsFromPlugin(oldAllowPopups); @@ -959,6 +968,12 @@ void PluginView::setComplexTextInputEnabled(bool complexTextInputEnabled) { m_webPage->send(Messages::WebPageProxy::SetComplexTextInputEnabled(m_plugin->pluginComplexTextInputIdentifier(), complexTextInputEnabled)); } + +mach_port_t PluginView::compositingRenderServerPort() +{ + return WebProcess::shared().compositingRenderServerPort(); +} + #endif String PluginView::proxiesForURL(const String& urlString) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h index 07511d7..dca3a62 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h @@ -132,6 +132,7 @@ private: #endif #if PLATFORM(MAC) virtual void setComplexTextInputEnabled(bool); + virtual mach_port_t compositingRenderServerPort(); #endif virtual String proxiesForURL(const String&); virtual String cookiesForURL(const String&); 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/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/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/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/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)); diff --git a/Source/WebKit2/WebProcess/WebKitMain.cpp b/Source/WebKit2/WebProcess/WebKitMain.cpp index 53084a6..d8bebb0 100644 --- a/Source/WebKit2/WebProcess/WebKitMain.cpp +++ b/Source/WebKit2/WebProcess/WebKitMain.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CommandLine.h" #include "PluginProcessMain.h" diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp index d629ced..f5100aa 100644 --- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingArea.h" #include "DrawingAreaMessageKinds.h" @@ -89,12 +90,18 @@ void ChunkedUpdateDrawingArea::display() UpdateChunk updateChunk(dirtyRect); paintIntoUpdateChunk(&updateChunk); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk)); m_isWaitingForUpdate = true; m_displayTimer.stop(); } +void ChunkedUpdateDrawingArea::forceRepaint() +{ + m_isWaitingForUpdate = false; + display(); +} + void ChunkedUpdateDrawingArea::scheduleDisplay() { if (m_paintingIsSuspended) @@ -132,7 +139,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize) ASSERT(!m_displayTimer.isActive()); // Painting is suspended, just send back an empty update chunk. - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk())); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk())); return; } @@ -142,7 +149,7 @@ void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize) m_displayTimer.stop(); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk)); } void ChunkedUpdateDrawingArea::suspendPainting() @@ -161,7 +168,7 @@ void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint) if (forceRepaint) { // Just set the dirty rect to the entire page size. - m_dirtyRect = IntRect(IntPoint(0, 0), m_webPage->size()); + m_dirtyRect = m_webPage->bounds(); } // Schedule a display. diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h index 08aa3e7..d32ed4c 100644 --- a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h @@ -42,6 +42,7 @@ public: virtual void setNeedsDisplay(const WebCore::IntRect&); virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); virtual void display(); + virtual void forceRepaint(); #if USE(ACCELERATED_COMPOSITING) virtual void attachCompositingContext() { } diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp index e5de52f..1649fb1 100644 --- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DecoderAdapter.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp index ea5b443..10a8dbf 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DrawingArea.h" // Subclasses #include "ChunkedUpdateDrawingArea.h" -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) #include "DrawingAreaImpl.h" #endif @@ -52,7 +53,7 @@ PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat break; case DrawingAreaInfo::Impl: -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) return DrawingAreaImpl::create(webPage, parameters); #else return 0; diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h index 713994d..de256b6 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -40,7 +40,7 @@ namespace WebCore { namespace WebKit { class WebPage; -class WebPageCreationParameters; +struct WebPageCreationParameters; class DrawingArea : public RefCounted<DrawingArea> { public: @@ -48,17 +48,22 @@ public: static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&); virtual ~DrawingArea(); -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) void didReceiveDrawingAreaMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); #endif virtual void setNeedsDisplay(const WebCore::IntRect&) = 0; virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0; + // FIXME: These should be pure virtual. virtual void pageBackgroundTransparencyChanged() { } - virtual void onPageClose() { } - + virtual void forceRepaint() { } + + virtual void didInstallPageOverlay() { } + virtual void didUninstallPageOverlay() { } + virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) { } + #if USE(ACCELERATED_COMPOSITING) virtual void attachCompositingContext() = 0; virtual void detachCompositingContext() = 0; @@ -80,7 +85,7 @@ protected: private: // CoreIPC message handlers. // FIXME: These should be pure virtual. - virtual void setSize(const WebCore::IntSize&) { } + virtual void setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { } virtual void didUpdate() { } virtual void suspendPainting() { } virtual void resumePainting() { } diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in index 682ef5a..ec09e18 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in @@ -21,7 +21,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. messages -> DrawingArea { - SetSize(WebCore::IntSize size) + SetSize(WebCore::IntSize size, WebCore::IntSize scrollOffset) DidUpdate() SuspendPainting() ResumePainting() diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp index 2063bd6..6d65fae 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp @@ -23,9 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "DrawingAreaImpl.h" #include "DrawingAreaProxyMessages.h" +#include "LayerTreeContext.h" #include "ShareableBitmap.h" #include "UpdateInfo.h" #include "WebPage.h" @@ -33,7 +35,7 @@ #include "WebProcess.h" #include <WebCore/GraphicsContext.h> -#ifndef __APPLE__ +#if !PLATFORM(MAC) && !PLATFORM(WIN) #error "This drawing area is not ready for use by other ports yet." #endif @@ -41,6 +43,12 @@ using namespace WebCore; namespace WebKit { +static uint64_t generateSequenceNumber() +{ + static uint64_t sequenceNumber; + return ++sequenceNumber; +} + PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebPageCreationParameters& parameters) { return adoptRef(new DrawingAreaImpl(webPage, parameters)); @@ -48,27 +56,50 @@ PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(WebPage* webPage, const WebP DrawingAreaImpl::~DrawingAreaImpl() { + if (m_layerTreeHost) + m_layerTreeHost->invalidate(); } DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters) : DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage) + , m_inSetSize(false) , m_isWaitingForDidUpdate(false) , m_isPaintingSuspended(!parameters.isVisible) , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display) + , m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode) { } void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect) { - if (rect.isEmpty()) + IntRect dirtyRect = rect; + dirtyRect.intersect(m_webPage->bounds()); + + if (dirtyRect.isEmpty()) return; - m_dirtyRegion.unite(rect); + if (m_layerTreeHost) { + ASSERT(m_dirtyRegion.isEmpty()); + + m_layerTreeHost->setNonCompositedContentsNeedDisplay(dirtyRect); + return; + } + + m_dirtyRegion.unite(dirtyRect); scheduleDisplay(); } void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOffset) { + if (m_layerTreeHost) { + ASSERT(m_scrollRect.isEmpty()); + ASSERT(m_scrollOffset.isEmpty()); + ASSERT(m_dirtyRegion.isEmpty()); + + m_layerTreeHost->scrollNonCompositedContents(scrollRect, scrollOffset); + return; + } + if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) { unsigned scrollArea = scrollRect.width() * scrollRect.height(); unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height(); @@ -109,6 +140,36 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollOff m_scrollOffset += scrollOffset; } +void DrawingAreaImpl::forceRepaint() +{ + m_isWaitingForDidUpdate = false; + display(); +} + +void DrawingAreaImpl::didInstallPageOverlay() +{ + if (m_layerTreeHost) + m_layerTreeHost->didInstallPageOverlay(); +} + +void DrawingAreaImpl::didUninstallPageOverlay() +{ + if (m_layerTreeHost) + m_layerTreeHost->didUninstallPageOverlay(); + + setNeedsDisplay(m_webPage->bounds()); +} + +void DrawingAreaImpl::setPageOverlayNeedsDisplay(const IntRect& rect) +{ + if (m_layerTreeHost) { + m_layerTreeHost->setPageOverlayNeedsDisplay(rect); + return; + } + + setNeedsDisplay(rect); +} + void DrawingAreaImpl::attachCompositingContext() { } @@ -117,12 +178,31 @@ void DrawingAreaImpl::detachCompositingContext() { } -void DrawingAreaImpl::setRootCompositingLayer(WebCore::GraphicsLayer*) +void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer) { + if (graphicsLayer) { + if (!m_layerTreeHost) { + // We're actually entering accelerated compositing mode. + enterAcceleratedCompositingMode(graphicsLayer); + } else { + m_exitCompositingTimer.stop(); + // We're already in accelerated compositing mode, but the root compositing layer changed. + m_layerTreeHost->setRootCompositingLayer(graphicsLayer); + } + } else { + if (m_layerTreeHost) { + // We'll exit accelerated compositing mode on a timer, to avoid re-entering + // compositing code via display() and layout. + exitAcceleratedCompositingModeSoon(); + } + } } void DrawingAreaImpl::scheduleCompositingLayerSync() { + if (!m_layerTreeHost) + return; + m_layerTreeHost->scheduleLayerFlush(); } void DrawingAreaImpl::syncCompositingLayers() @@ -133,27 +213,48 @@ void DrawingAreaImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID { } -void DrawingAreaImpl::setSize(const IntSize& size) +void DrawingAreaImpl::setSize(const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { + ASSERT(!m_inSetSize); + m_inSetSize = true; + // Set this to false since we're about to call display(). m_isWaitingForDidUpdate = false; m_webPage->setSize(size); m_webPage->layoutIfNeeded(); + m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset); UpdateInfo updateInfo; + LayerTreeContext layerTreeContext; - if (m_isPaintingSuspended) { - updateInfo.timestamp = currentTime(); + if (m_layerTreeHost) { + m_layerTreeHost->sizeDidChange(size); + layerTreeContext = m_layerTreeHost->layerTreeContext(); + } + + if (m_isPaintingSuspended || m_layerTreeHost) updateInfo.viewSize = m_webPage->size(); - } else + else { + m_dirtyRegion.unite(m_webPage->bounds()); + + // The display here should not cause layout to happen, so we can't enter accelerated compositing mode here. display(updateInfo); + ASSERT(!m_layerTreeHost); + } - m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(updateInfo)); + m_webPage->send(Messages::DrawingAreaProxy::DidSetSize(generateSequenceNumber(), updateInfo, layerTreeContext)); + + m_inSetSize = false; } void DrawingAreaImpl::didUpdate() { + // We might get didUpdate messages from the UI process even after we've + // entered accelerated compositing mode. Ignore them. + if (m_layerTreeHost) + return; + m_isWaitingForDidUpdate = false; // Display if needed. @@ -174,7 +275,62 @@ void DrawingAreaImpl::resumePainting() m_isPaintingSuspended = false; - // FIXME: Repaint if needed. + // FIXME: We shouldn't always repaint everything here. + setNeedsDisplay(m_webPage->bounds()); +} + +void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer) +{ + m_exitCompositingTimer.stop(); + + ASSERT(!m_layerTreeHost); + + m_layerTreeHost = LayerTreeHost::create(m_webPage); + m_layerTreeHost->setRootCompositingLayer(graphicsLayer); + + // Non-composited content will now be handled exclusively by the layer tree host. + m_dirtyRegion = Region(); + m_scrollRect = IntRect(); + m_scrollOffset = IntSize(); + m_displayTimer.stop(); + m_isWaitingForDidUpdate = false; + + if (!m_inSetSize) + m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(generateSequenceNumber(), m_layerTreeHost->layerTreeContext())); +} + +void DrawingAreaImpl::exitAcceleratedCompositingMode() +{ + m_exitCompositingTimer.stop(); + + ASSERT(m_layerTreeHost); + + m_layerTreeHost->invalidate(); + m_layerTreeHost = nullptr; + + if (m_inSetSize) + return; + + UpdateInfo updateInfo; + if (m_isPaintingSuspended) + updateInfo.viewSize = m_webPage->size(); + else { + m_dirtyRegion = m_webPage->bounds(); + display(updateInfo); + } + + // Send along a complete update of the page so we can paint the contents right after we exit the + // accelerated compositing mode, eliminiating flicker. + if (!m_inSetSize) + m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(generateSequenceNumber(), updateInfo)); +} + +void DrawingAreaImpl::exitAcceleratedCompositingModeSoon() +{ + if (m_exitCompositingTimer.isActive()) + return; + + m_exitCompositingTimer.startOneShot(0); } void DrawingAreaImpl::scheduleDisplay() @@ -196,6 +352,7 @@ void DrawingAreaImpl::scheduleDisplay() void DrawingAreaImpl::display() { + ASSERT(!m_layerTreeHost); ASSERT(!m_isWaitingForDidUpdate); if (m_isPaintingSuspended) @@ -207,7 +364,13 @@ void DrawingAreaImpl::display() UpdateInfo updateInfo; display(updateInfo); - m_webPage->send(Messages::DrawingAreaProxy::Update(updateInfo)); + if (m_layerTreeHost) { + // The call to update caused layout which turned on accelerated compositing. + // Don't send an Update message in this case. + return; + } + + m_webPage->send(Messages::DrawingAreaProxy::Update(generateSequenceNumber(), updateInfo)); m_isWaitingForDidUpdate = true; } @@ -235,6 +398,8 @@ static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>& void DrawingAreaImpl::display(UpdateInfo& updateInfo) { ASSERT(!m_isPaintingSuspended); + ASSERT(!m_layerTreeHost); + ASSERT(!m_webPage->size().isEmpty()); // FIXME: It would be better if we could avoid painting altogether when there is a custom representation. if (m_webPage->mainFrameHasCustomRepresentation()) @@ -263,7 +428,6 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo) m_webPage->layoutIfNeeded(); - updateInfo.timestamp = currentTime(); updateInfo.viewSize = m_webPage->size(); updateInfo.updateRectBounds = bounds; @@ -271,9 +435,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo) for (size_t i = 0; i < rects.size(); ++i) { m_webPage->drawRect(*graphicsContext, rects[i]); + if (m_webPage->hasPageOverlay()) + m_webPage->drawPageOverlay(*graphicsContext, rects[i]); updateInfo.updateRects.append(rects[i]); } - + // Layout can trigger more calls to setNeedsDisplay and we don't want to process them // until the UI process has painted the update, so we stop the timer here. m_displayTimer.stop(); diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h index e008adc..cbb94c2 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h @@ -27,12 +27,13 @@ #define DrawingAreaImpl_h #include "DrawingArea.h" +#include "LayerTreeHost.h" #include "Region.h" #include "RunLoop.h" namespace WebKit { -struct UpdateInfo; +class UpdateInfo; class DrawingAreaImpl : public DrawingArea { public: @@ -45,6 +46,12 @@ private: // DrawingArea virtual void setNeedsDisplay(const WebCore::IntRect&); virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); + virtual void forceRepaint(); + + virtual void didInstallPageOverlay(); + virtual void didUninstallPageOverlay(); + virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&); + virtual void attachCompositingContext(); virtual void detachCompositingContext(); virtual void setRootCompositingLayer(WebCore::GraphicsLayer*); @@ -53,11 +60,15 @@ private: virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); // CoreIPC message handlers. - virtual void setSize(const WebCore::IntSize&); + virtual void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset); virtual void didUpdate(); virtual void suspendPainting(); virtual void resumePainting(); + void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*); + void exitAcceleratedCompositingModeSoon(); + void exitAcceleratedCompositingMode(); + void scheduleDisplay(); void display(); void display(UpdateInfo&); @@ -65,7 +76,10 @@ private: Region m_dirtyRegion; WebCore::IntRect m_scrollRect; WebCore::IntSize m_scrollOffset; - + + // Whether we're currently processing a setSize message. + bool m_inSetSize; + // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the // web process won't paint more frequent than the UI process can handle. bool m_isWaitingForDidUpdate; @@ -75,6 +89,10 @@ private: bool m_isPaintingSuspended; RunLoop::Timer<DrawingAreaImpl> m_displayTimer; + RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer; + + // The layer tree host that handles accelerated compositing. + RefPtr<LayerTreeHost> m_layerTreeHost; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp index 00edcce..590010b 100644 --- a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp +++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "EncoderAdapter.h" #include "DataReference.h" diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp index 9b8669d..8e9dba7 100644 --- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp +++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "FindController.h" #include "ShareableBitmap.h" @@ -151,22 +152,30 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve if (!selectedFrame) return false; + IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds()); + // We want the selection rect in window coordinates. - IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds())); + IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect); Vector<FloatRect> textRects; selectedFrame->selection()->getClippedVisibleTextRectangles(textRects); // Create a backing store and paint the find indicator text into it. - RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRectInWindowCoordinates.size()); + RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size()); + if (!findIndicatorTextBackingStore) + return false; + OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext(); - graphicsContext->translate(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y()); + IntRect paintRect = selectionRect; + paintRect.move(selectedFrame->view()->frameRect().x(), selectedFrame->view()->frameRect().y()); + paintRect.move(-selectedFrame->view()->scrollOffset()); + + graphicsContext->translate(-paintRect.x(), -paintRect.y()); selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers); selectedFrame->document()->updateLayout(); - graphicsContext->clip(selectionRectInWindowCoordinates); - selectedFrame->view()->paint(graphicsContext.get(), selectionRectInWindowCoordinates); + selectedFrame->view()->paint(graphicsContext.get(), paintRect); selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal); SharedMemory::Handle handle; @@ -259,7 +268,6 @@ static Color overlayBackgroundColor() void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect) { Vector<IntRect> rects = rectsForTextMatches(); - ASSERT(!rects.isEmpty()); // Draw the background. graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB); diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp index b104b29..44b3bd6 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if USE(ACCELERATED_COMPOSITING) - +#include "config.h" #include "LayerBackedDrawingArea.h" +#if USE(ACCELERATED_COMPOSITING) + #include "DrawingAreaMessageKinds.h" #include "DrawingAreaProxyMessageKinds.h" #include "MessageID.h" @@ -121,7 +122,7 @@ void LayerBackedDrawingArea::setSize(const IntSize& viewSize) if (m_webPage->drawingArea() != this) return; - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); } void LayerBackedDrawingArea::suspendPainting() diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h index ed05cc7..400c8c5 100644 --- a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h @@ -35,11 +35,8 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class CALayer; -#else -class CALayer; -#endif +OBJC_CLASS NSPopUpButtonCell; +OBJC_CLASS WKView; typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef; #endif diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp new file mode 100644 index 0000000..1112d39 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LayerTreeHost.h" + +#if PLATFORM(MAC) +#include "LayerTreeHostMac.h" +#endif + +#if !PLATFORM(MAC) && !PLATFORM(WIN) +#error "This class is not ready for use by other ports yet." +#endif + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage) +{ +#if PLATFORM(MAC) + return LayerTreeHostMac::create(webPage); +#endif + + return 0; +} + +LayerTreeHost::LayerTreeHost(WebPage* webPage) + : m_webPage(webPage) +{ +} + +LayerTreeHost::~LayerTreeHost() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h new file mode 100644 index 0000000..4ca1137 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayerTreeHost_h +#define LayerTreeHost_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + class IntRect; + class IntSize; + class GraphicsLayer; +} + +namespace WebKit { + +class LayerTreeContext; +class WebPage; + +class LayerTreeHost : public RefCounted<LayerTreeHost> { +public: + static PassRefPtr<LayerTreeHost> create(WebPage*); + virtual ~LayerTreeHost(); + + virtual const LayerTreeContext& layerTreeContext() = 0; + virtual void scheduleLayerFlush() = 0; + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0; + virtual void invalidate() = 0; + + virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&) = 0; + virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0; + virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0; + + virtual void didInstallPageOverlay() = 0; + virtual void didUninstallPageOverlay() = 0; + virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) = 0; + +protected: + explicit LayerTreeHost(WebPage*); + + WebPage* m_webPage; +}; + +} // namespace WebKit + +#endif // LayerTreeHost_h diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp index 091f460..67c1165 100644 --- a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp +++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PageOverlay.h" #include "WebPage.h" @@ -30,6 +31,7 @@ #include <WebCore/FrameView.h> #include <WebCore/GraphicsContext.h> #include <WebCore/Page.h> +#include <WebCore/ScrollbarTheme.h> using namespace WebCore; @@ -55,12 +57,14 @@ IntRect PageOverlay::bounds() const FrameView* frameView = webPage()->corePage()->mainFrame()->view(); int width = frameView->width(); - if (frameView->verticalScrollbar()) - width -= frameView->verticalScrollbar()->width(); int height = frameView->height(); - if (frameView->horizontalScrollbar()) - height -= frameView->horizontalScrollbar()->height(); - + + if (!ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) { + if (frameView->verticalScrollbar()) + width -= frameView->verticalScrollbar()->width(); + if (frameView->horizontalScrollbar()) + height -= frameView->horizontalScrollbar()->height(); + } return IntRect(0, 0, width, height); } @@ -71,10 +75,10 @@ void PageOverlay::setPage(WebPage* webPage) m_client->didMoveToWebPage(this, webPage); } -void PageOverlay::setNeedsDisplay(const WebCore::IntRect& dirtyRect) +void PageOverlay::setNeedsDisplay(const IntRect& dirtyRect) { if (m_webPage) - m_webPage->drawingArea()->setNeedsDisplay(dirtyRect); + m_webPage->drawingArea()->setPageOverlayNeedsDisplay(dirtyRect); } void PageOverlay::setNeedsDisplay() diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp index 74aa4b2..f27f14f 100644 --- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TILED_BACKING_STORE) - +#include "config.h" #include "TiledDrawingArea.h" +#if ENABLE(TILED_BACKING_STORE) + #include "DrawingAreaMessageKinds.h" #include "DrawingAreaProxyMessageKinds.h" #include "MessageID.h" @@ -81,7 +82,7 @@ void TiledDrawingArea::display() IntRect dirtyRect = m_dirtyRect; m_dirtyRect = IntRect(); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect)); m_displayTimer.stop(); } @@ -106,7 +107,7 @@ void TiledDrawingArea::setSize(const IntSize& viewSize) scheduleDisplay(); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); } void TiledDrawingArea::suspendPainting() @@ -141,7 +142,7 @@ void TiledDrawingArea::updateTile(int tileID, const IntRect& dirtyRect, float sc paintIntoUpdateChunk(&updateChunk, scale); unsigned pendingUpdateCount = m_pendingUpdates.size(); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount)); } void TiledDrawingArea::tileUpdateTimerFired() @@ -155,7 +156,7 @@ void TiledDrawingArea::tileUpdateTimerFired() updateTile(update.tileID, update.dirtyRect, update.scale); if (m_pendingUpdates.isEmpty()) - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); else m_tileUpdateTimer.startOneShot(0.001); } @@ -185,7 +186,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI if (it != m_pendingUpdates.end()) { m_pendingUpdates.remove(it); if (m_pendingUpdates.isEmpty()) { - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); m_tileUpdateTimer.stop(); } } @@ -221,7 +222,7 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize)); paintIntoUpdateChunk(&updateChunk, targetScale); - WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk)); + WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk)); break; } default: diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp index 21f4fba..7b958bf 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebBackForwardListProxy.h" #include "DataReference.h" diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp index b496128..35058de 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp @@ -19,6 +19,7 @@ * */ +#include "config.h" #include "WebContextMenu.h" #include "ContextMenuState.h" diff --git a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp index 198cb6d..dce1a68 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEditCommand.h" namespace WebKit { diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp index 42eacc1..fa4dc2c 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebFrame.h" #include "DownloadManager.h" @@ -334,7 +335,7 @@ String WebFrame::url() const if (!m_coreFrame) return String(); - return m_coreFrame->loader()->url().string(); + return m_coreFrame->document()->url().string(); } String WebFrame::innerText() const @@ -457,6 +458,81 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world) return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec()); } +IntRect WebFrame::contentBounds() const +{ + if (!m_coreFrame) + return IntRect(); + + FrameView* view = m_coreFrame->view(); + if (!view) + return IntRect(); + + return IntRect(0, 0, view->contentsWidth(), view->contentsHeight()); +} + +IntRect WebFrame::visibleContentBounds() const +{ + if (!m_coreFrame) + return IntRect(); + + FrameView* view = m_coreFrame->view(); + if (!view) + return IntRect(); + + IntRect contentRect = view->visibleContentRect(true); + return IntRect(0, 0, contentRect.width(), contentRect.height()); +} + +IntRect WebFrame::visibleContentBoundsExcludingScrollbars() const +{ + if (!m_coreFrame) + return IntRect(); + + FrameView* view = m_coreFrame->view(); + if (!view) + return IntRect(); + + IntRect contentRect = view->visibleContentRect(false); + return IntRect(0, 0, contentRect.width(), contentRect.height()); +} + +IntSize WebFrame::scrollOffset() const +{ + if (!m_coreFrame) + return IntSize(); + + FrameView* view = m_coreFrame->view(); + if (!view) + return IntSize(); + + return view->scrollOffset(); +} + +bool WebFrame::getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha) +{ + if (!m_coreFrame) + return false; + Document* document = m_coreFrame->document(); + if (!document) + return false; + + Element* rootElementToUse = document->body(); + if (!rootElementToUse) + rootElementToUse = document->documentElement(); + if (!rootElementToUse) + return false; + + RenderObject* renderer = rootElementToUse->renderer(); + if (!renderer) + return false; + Color color = renderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); + if (!color.isValid()) + return false; + + color.getRGBA(*red, *green, *blue, *alpha); + return true; +} + WebFrame* WebFrame::frameForContext(JSContextRef context) { JSObjectRef globalObjectRef = JSContextGetGlobalObject(context); @@ -543,4 +619,20 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const return resource->response().suggestedFilename(); } +String WebFrame::mimeTypeForResourceWithURL(const KURL& url) const +{ + if (!m_coreFrame) + return String(); + + DocumentLoader* loader = m_coreFrame->loader()->documentLoader(); + if (!loader) + return String(); + + RefPtr<ArchiveResource> resource = loader->subresource(url); + if (resource) + return resource->mimeType(); + + return page()->cachedResponseMIMETypeForURL(url); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h index f254e7a..3c63cf3 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h @@ -89,6 +89,11 @@ public: JSValueRef computedStyleIncludingVisitedInfo(JSObjectRef element); JSGlobalContextRef jsContext(); JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*); + WebCore::IntRect contentBounds() const; + WebCore::IntRect visibleContentBounds() const; + WebCore::IntRect visibleContentBoundsExcludingScrollbars() const; + WebCore::IntSize scrollOffset() const; + bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha); static WebFrame* frameForContext(JSContextRef); @@ -110,6 +115,7 @@ public: String provisionalURL() const; String suggestedFilenameForResourceWithURL(const WebCore::KURL&) const; + String mimeTypeForResourceWithURL(const WebCore::KURL&) const; // Simple listener class used by plug-ins to know when frames finish or fail loading. class LoadListener { diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp index 559b8b6..4b3fdaf 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspector.h" #if ENABLE(INSPECTOR) @@ -38,6 +39,11 @@ using namespace WebCore; namespace WebKit { +PassRefPtr<WebInspector> WebInspector::create(WebPage* page) +{ + return adoptRef(new WebInspector(page)); +} + WebInspector::WebInspector(WebPage* page) : m_page(page) , m_inspectorPage(0) @@ -91,9 +97,14 @@ void WebInspector::close() m_page->corePage()->inspectorController()->close(); } +void WebInspector::evaluateScriptForTest(long callID, const String& script) +{ + m_page->corePage()->inspectorController()->evaluateForTestInFrontend(callID, script); +} + void WebInspector::showConsole() { - m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel); + m_page->corePage()->inspectorController()->showConsole(); } void WebInspector::startJavaScriptDebugging() @@ -121,7 +132,6 @@ void WebInspector::stopJavaScriptProfiling() { #if ENABLE(JAVASCRIPT_DEBUGGER) m_page->corePage()->inspectorController()->stopUserInitiatedProfiling(); - m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel); #endif } diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h index 21a7529..517ae8e 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebInspector.h +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h @@ -28,6 +28,7 @@ #if ENABLE(INSPECTOR) +#include "APIObject.h" #include "Connection.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -37,11 +38,11 @@ namespace WebKit { class WebPage; struct WebPageCreationParameters; -class WebInspector { - WTF_MAKE_NONCOPYABLE(WebInspector); - +class WebInspector : public APIObject { public: - explicit WebInspector(WebPage*); + static const Type APIType = TypeBundleInspector; + + static PassRefPtr<WebInspector> create(WebPage*); WebPage* page() const { return m_page; } WebPage* inspectorPage() const { return m_inspectorPage; } @@ -49,10 +50,23 @@ public: // Implemented in generated WebInspectorMessageReceiver.cpp void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + // Called by WebInspector messages + void show(); + void close(); + + void evaluateScriptForTest(long callID, const String& script); + + void startPageProfiling(); + void stopPageProfiling(); + private: friend class WebInspectorClient; friend class WebInspectorFrontendClient; + explicit WebInspector(WebPage*); + + virtual Type type() const { return APIType; } + // Called from WebInspectorClient WebPage* createInspectorPage(); @@ -63,10 +77,6 @@ private: // Implemented in platform WebInspector file String localizedStringsURL() const; - // Called by WebInspector messages - void show(); - void close(); - void showConsole(); void startJavaScriptDebugging(); @@ -75,9 +85,6 @@ private: void startJavaScriptProfiling(); void stopJavaScriptProfiling(); - void startPageProfiling(); - void stopPageProfiling(); - WebPage* m_page; WebPage* m_inspectorPage; }; diff --git a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp index d42e313..bcf3e80 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebOpenPanelResultListener.h" namespace WebKit { diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index af236e9..462d352 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPage.h" #include "Arguments.h" @@ -254,6 +255,16 @@ void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* cli m_loaderClient.initialize(client); } +void WebPage::initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient* client) +{ + m_policyClient.initialize(client); +} + +void WebPage::initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient* client) +{ + m_resourceLoadClient.initialize(client); +} + void WebPage::initializeInjectedBundleUIClient(WKBundlePageUIClient* client) { m_uiClient.initialize(client); @@ -313,6 +324,11 @@ void WebPage::changeAcceleratedCompositingMode(WebCore::GraphicsLayer* layer) if (m_isClosed) return; + // With the new drawing area we don't need to inform the UI process when the accelerated + // compositing mode changes. + if (m_drawingArea->info().type == DrawingAreaInfo::Impl) + return; + bool compositing = layer; // Tell the UI process that accelerated compositing changed. It may respond by changing @@ -342,6 +358,7 @@ void WebPage::enterAcceleratedCompositingMode(GraphicsLayer* layer) void WebPage::exitAcceleratedCompositingMode() { changeAcceleratedCompositingMode(0); + m_drawingArea->setRootCompositingLayer(0); } #endif @@ -463,20 +480,26 @@ void WebPage::reload(bool reloadFromOrigin) m_mainFrame->coreFrame()->loader()->reload(reloadFromOrigin); } -void WebPage::goForward(uint64_t backForwardItemID) +void WebPage::goForward(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle) { + m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle); + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); m_page->goToItem(item, FrameLoadTypeForward); } -void WebPage::goBack(uint64_t backForwardItemID) +void WebPage::goBack(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle) { + m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle); + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); m_page->goToItem(item, FrameLoadTypeBack); } -void WebPage::goToBackForwardItem(uint64_t backForwardItemID) +void WebPage::goToBackForwardItem(uint64_t backForwardItemID, const SandboxExtension::Handle& sandboxExtensionHandle) { + m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle); + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); m_page->goToItem(item, FrameLoadTypeIndexedBackForward); } @@ -553,6 +576,27 @@ void WebPage::resizeToContentsIfNeeded() } #endif +void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset) +{ + Frame* frame = m_page->mainFrame(); + + IntPoint scrollPosition = frame->view()->scrollPosition(); + IntPoint maximumScrollPosition = frame->view()->maximumScrollPosition(); + + // If the current scroll position in a direction is the max scroll position + // we don't want to scroll at all. + IntSize newScrollOffset; + if (scrollPosition.x() < maximumScrollPosition.x()) + newScrollOffset.setWidth(scrollOffset.width()); + if (scrollPosition.y() < maximumScrollPosition.y()) + newScrollOffset.setHeight(scrollOffset.height()); + + if (newScrollOffset.isZero()) + return; + + frame->view()->setScrollPosition(frame->view()->scrollPosition() + newScrollOffset); +} + void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect) { graphicsContext.save(); @@ -560,12 +604,19 @@ void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect) m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect); graphicsContext.restore(); - if (m_pageOverlay) { - graphicsContext.save(); - graphicsContext.clip(rect); - m_pageOverlay->drawRect(graphicsContext, rect); - graphicsContext.restore(); - } + // FIXME: Remove this code once we're using the new drawing area on mac and windows. + if (m_pageOverlay && m_drawingArea->info().type != DrawingAreaInfo::Impl) + drawPageOverlay(graphicsContext, rect); +} + +void WebPage::drawPageOverlay(GraphicsContext& graphicsContext, const IntRect& rect) +{ + ASSERT(m_pageOverlay); + + graphicsContext.save(); + graphicsContext.clip(rect); + m_pageOverlay->drawRect(graphicsContext, rect); + graphicsContext.restore(); } double WebPage::textZoomFactor() const @@ -614,6 +665,8 @@ void WebPage::scaleWebView(double scale, const IntPoint& origin) if (!frame) return; frame->scalePage(scale, origin); + + send(Messages::WebPageProxy::ViewScaleFactorDidChange(scale)); } double WebPage::viewScaleFactor() const @@ -660,6 +713,9 @@ void WebPage::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay) m_pageOverlay = pageOverlay; m_pageOverlay->setPage(this); + + m_drawingArea->didInstallPageOverlay(); + m_pageOverlay->setNeedsDisplay(); } @@ -670,7 +726,8 @@ void WebPage::uninstallPageOverlay(PageOverlay* pageOverlay) m_pageOverlay->setPage(0); m_pageOverlay = nullptr; - m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); + + m_drawingArea->didUninstallPageOverlay(); } PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, ImageOptions options) @@ -697,7 +754,7 @@ PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, Ima return snapshot.release(); } -PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options) +PassRefPtr<WebImage> WebPage::scaledSnapshotInDocumentCoordinates(const IntRect& rect, double scaleFactor, ImageOptions options) { FrameView* frameView = m_mainFrame->coreFrame()->view(); if (!frameView) @@ -708,10 +765,18 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, PaintBehavior oldBehavior = frameView->paintBehavior(); frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers); - RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options); - OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); + bool scale = scaleFactor != 1; + IntSize size = rect.size(); + if (scale) + size = IntSize(ceil(rect.width() * scaleFactor), ceil(rect.height() * scaleFactor)); + RefPtr<WebImage> snapshot = WebImage::create(size, options); + OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); graphicsContext->save(); + + if (scale) + graphicsContext->scale(FloatSize(scaleFactor, scaleFactor)); + graphicsContext->translate(-rect.x(), -rect.y()); frameView->paintContents(graphicsContext.get(), rect); graphicsContext->restore(); @@ -721,6 +786,11 @@ PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, return snapshot.release(); } +PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options) +{ + return scaledSnapshotInDocumentCoordinates(rect, 1, options); +} + void WebPage::pageDidScroll() { // Hide the find indicator. @@ -909,6 +979,26 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled)); } +#if ENABLE(GESTURE_EVENTS) +static bool handleGestureEvent(const WebGestureEvent& gestureEvent, Page* page) +{ + Frame* frame = page->mainFrame(); + if (!frame->view()) + return false; + + PlatformGestureEvent platformGestureEvent = platform(gestureEvent); + return frame->eventHandler()->handleGestureEvent(platformGestureEvent); +} + +void WebPage::gestureEvent(const WebGestureEvent& gestureEvent) +{ + CurrentEvent currentEvent(gestureEvent); + + bool handled = handleGestureEvent(gestureEvent, m_page.get()); + send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled)); +} +#endif + void WebPage::validateMenuItem(const String& commandName) { bool isEnabled = false; @@ -952,10 +1042,10 @@ uint64_t WebPage::restoreSession(const SessionState& sessionState) return currentItemID; } -void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState) +void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState, const SandboxExtension::Handle& sandboxExtensionHandle) { if (uint64_t currentItemID = restoreSession(sessionState)) - goToBackForwardItem(currentItemID); + goToBackForwardItem(currentItemID, sandboxExtensionHandle); } #if ENABLE(TOUCH_EVENTS) @@ -1022,6 +1112,30 @@ void WebPage::setDrawsTransparentBackground(bool drawsTransparentBackground) m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); } +void WebPage::viewWillStartLiveResize() +{ + if (!m_page) + return; + + // FIXME: This should propagate to all ScrollableAreas. + if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) { + if (FrameView* view = frame->view()) + view->willStartLiveResize(); + } +} + +void WebPage::viewWillEndLiveResize() +{ + if (!m_page) + return; + + // FIXME: This should propagate to all ScrollableAreas. + if (Frame* frame = m_page->focusController()->focusedOrMainFrame()) { + if (FrameView* view = frame->view()) + view->willEndLiveResize(); + } +} + void WebPage::setFocused(bool isFocused) { m_page->focusController()->setFocused(isFocused); @@ -1161,7 +1275,7 @@ void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceU if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) { if (DocumentLoader* loader = frame->coreFrame()->loader()->documentLoader()) { if (RefPtr<ArchiveResource> subresource = loader->subresource(KURL(KURL(), resourceURL))) { - if (buffer = subresource->data()) + if ((buffer = subresource->data())) dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size()); } } @@ -1187,6 +1301,12 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID) send(Messages::WebPageProxy::DataCallback(dataReference, callbackID)); } +void WebPage::forceRepaint(uint64_t callbackID) +{ + m_drawingArea->forceRepaint(); + send(Messages::WebPageProxy::VoidCallback(callbackID)); +} + void WebPage::preferencesDidChange(const WebPreferencesStore& store) { WebPreferencesStore::removeTestRunnerOverrides(); @@ -1224,12 +1344,15 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey())); settings->setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey())); settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey())); +#if ENABLE(WEB_ARCHIVE) settings->setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey())); +#endif settings->setLocalFileContentSniffingEnabled(store.getBoolValueForKey(WebPreferencesKey::localFileContentSniffingEnabledKey())); settings->setUsesPageCache(store.getBoolValueForKey(WebPreferencesKey::usesPageCacheKey())); settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey())); settings->setPaginateDuringLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::paginateDuringLayoutEnabledKey())); settings->setDOMPasteAllowed(store.getBoolValueForKey(WebPreferencesKey::domPasteAllowedKey())); + settings->setJavaScriptCanAccessClipboard(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanAccessClipboardKey())); settings->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey())); settings->setMinimumFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumFontSizeKey())); @@ -1245,6 +1368,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) #endif settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey())); settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey())); + settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey())); #if ENABLE(DATABASE) AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey())); @@ -1259,7 +1383,7 @@ WebInspector* WebPage::inspector() if (m_isClosed) return 0; if (!m_inspector) - m_inspector = adoptPtr(new WebInspector(this)); + m_inspector = WebInspector::create(this); return m_inspector.get(); } #endif @@ -1296,6 +1420,37 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt) } #endif +#if PLATFORM(WIN) +void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap& dataMap, uint32_t flags) +{ + if (!m_page) { + send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone)); + return; + } + + DragData dragData(dataMap, clientPosition, globalPosition, static_cast<DragOperation>(draggingSourceOperationMask), static_cast<DragApplicationFlags>(flags)); + switch (action) { + case DragControllerActionEntered: + send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragEntered(&dragData))); + break; + + case DragControllerActionUpdated: + send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController()->dragUpdated(&dragData))); + break; + + case DragControllerActionExited: + m_page->dragController()->dragExited(&dragData); + break; + + case DragControllerActionPerformDrag: + m_page->dragController()->performDrag(&dragData); + break; + + default: + ASSERT_NOT_REACHED(); + } +} +#else void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags) { if (!m_page) { @@ -1325,6 +1480,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli ASSERT_NOT_REACHED(); } } +#endif void WebPage::dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation) { @@ -1433,6 +1589,13 @@ void WebPage::didCancelForOpenPanel() m_activeOpenPanelResultListener = 0; } +#if ENABLE(WEB_PROCESS_SANDBOX) +void WebPage::extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle& handle) +{ + SandboxExtension::create(handle)->consumePermanently(); +} +#endif + void WebPage::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) { m_geolocationPermissionRequestManager.didReceiveGeolocationPermissionDecision(geolocationID, allowed); @@ -1563,7 +1726,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag return; } -#ifdef __APPLE__ +#if PLATFORM(MAC) || PLATFORM(WIN) if (messageID.is<CoreIPC::MessageClassDrawingArea>()) { if (m_drawingArea) m_drawingArea->didReceiveDrawingAreaMessage(connection, messageID, arguments); @@ -1650,11 +1813,39 @@ void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxE m_pendingProvisionalSandboxExtension = SandboxExtension::create(handle); } +static bool shouldReuseCommittedSandboxExtension(WebFrame* frame) +{ + ASSERT(frame->isMainFrame()); + + FrameLoader* frameLoader = frame->coreFrame()->loader(); + FrameLoadType frameLoadType = frameLoader->loadType(); + + // If the page is being reloaded, it should reuse whatever extension is committed. + if (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin) + return true; + + DocumentLoader* documentLoader = frameLoader->documentLoader(); + DocumentLoader* provisionalDocumentLoader = frameLoader->provisionalDocumentLoader(); + if (!documentLoader || !provisionalDocumentLoader) + return false; + + if (documentLoader->url().isLocalFile() && provisionalDocumentLoader->url().isLocalFile() + && provisionalDocumentLoader->triggeringAction().type() == NavigationTypeLinkClicked) + return true; + + return false; +} + void WebPage::SandboxExtensionTracker::didStartProvisionalLoad(WebFrame* frame) { if (!frame->isMainFrame()) return; + if (shouldReuseCommittedSandboxExtension(frame)) { + m_pendingProvisionalSandboxExtension = m_committedSandboxExtension.release(); + ASSERT(!m_committedSandboxExtension); + } + ASSERT(!m_provisionalSandboxExtension); m_provisionalSandboxExtension = m_pendingProvisionalSandboxExtension.release(); @@ -1749,6 +1940,9 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo) m_printContext = adoptPtr(new PrintContext(coreFrame)); m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight); + + float fullPageHeight; + m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true); } void WebPage::endPrinting() @@ -1756,57 +1950,90 @@ void WebPage::endPrinting() m_printContext = nullptr; } -void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, Vector<IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting) +void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID) { - beginPrinting(frameID, printInfo); + Vector<IntRect> resultPageRects; + double resultTotalScaleFactorForPrinting = 1; - WebFrame* frame = WebProcess::shared().webFrame(frameID); - if (!frame) - return; - - float fullPageHeight; - m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true); + beginPrinting(frameID, printInfo); - resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(printInfo.availablePaperWidth) * printInfo.pageSetupScaleFactor; - resultPageRects = m_printContext->pageRects(); + if (m_printContext) { + resultPageRects = m_printContext->pageRects(); + resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(FloatSize(printInfo.availablePaperWidth, printInfo.availablePaperHeight)) * printInfo.pageSetupScaleFactor; + } // If we're asked to print, we should actually print at least a blank page. if (resultPageRects.isEmpty()) resultPageRects.append(IntRect(0, 0, 1, 1)); + + send(Messages::WebPageProxy::ComputedPagesCallback(resultPageRects, resultTotalScaleFactorForPrinting, callbackID)); } #if PLATFORM(MAC) // FIXME: Find a better place for Mac specific code. -void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, Vector<uint8_t>& pdfData) +void WebPage::drawRectToPDF(uint64_t frameID, const WebCore::IntRect& rect, uint64_t callbackID) { WebFrame* frame = WebProcess::shared().webFrame(frameID); - if (!frame) - return; + Frame* coreFrame = frame ? frame->coreFrame() : 0; - Frame* coreFrame = frame->coreFrame(); - if (!coreFrame) - return; + RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0)); - ASSERT(coreFrame->document()->printing()); + if (coreFrame) { + ASSERT(coreFrame->document()->printing()); + + // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data. + RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get())); + + CGRect mediaBox = CGRectMake(0, 0, rect.width(), rect.height()); + RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0)); + RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + CGPDFContextBeginPage(context.get(), pageInfo.get()); + + GraphicsContext ctx(context.get()); + ctx.scale(FloatSize(1, -1)); + ctx.translate(0, -rect.height()); + m_printContext->spoolRect(ctx, rect); + + CGPDFContextEndPage(context.get()); + CGPDFContextClose(context.get()); + } + + send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID)); +} + +void WebPage::drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID) +{ + WebFrame* frame = WebProcess::shared().webFrame(frameID); + Frame* coreFrame = frame ? frame->coreFrame() : 0; RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0)); - // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data. - RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get())); + if (coreFrame) { + ASSERT(coreFrame->document()->printing()); - CGRect mediaBox = CGRectMake(0, 0, frame->size().width(), frame->size().height()); - RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0)); - CFDictionaryRef pageInfo = CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CGPDFContextBeginPage(context.get(), pageInfo); + // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data. + RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get())); - GraphicsContext ctx(context.get()); - m_printContext->spoolRect(ctx, rect); + CGRect mediaBox = m_printContext->pageCount() ? m_printContext->pageRect(0) : CGRectMake(0, 0, 1, 1); + RetainPtr<CGContextRef> context(AdoptCF, CGPDFContextCreate(pdfDataConsumer.get(), &mediaBox, 0)); + for (uint32_t page = first; page < first + count; ++page) { + if (page >= m_printContext->pageCount()) + break; - CGPDFContextEndPage(context.get()); - CGPDFContextClose(context.get()); + RetainPtr<CFDictionaryRef> pageInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + CGPDFContextBeginPage(context.get(), pageInfo.get()); + + GraphicsContext ctx(context.get()); + ctx.scale(FloatSize(1, -1)); + ctx.translate(0, -m_printContext->pageRect(page).height()); + m_printContext->spoolPage(ctx, page, m_printContext->pageRect(page).width()); + + CGPDFContextEndPage(context.get()); + } + CGPDFContextClose(context.get()); + } - pdfData.resize(CFDataGetLength(pdfPageData.get())); - CFDataGetBytes(pdfPageData.get(), CFRangeMake(0, pdfData.size()), pdfData.data()); + send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID)); } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index d29400f..89087b0 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -35,11 +35,14 @@ #include "InjectedBundlePageEditorClient.h" #include "InjectedBundlePageFormClient.h" #include "InjectedBundlePageLoaderClient.h" +#include "InjectedBundlePagePolicyClient.h" +#include "InjectedBundlePageResourceLoadClient.h" #include "InjectedBundlePageUIClient.h" #include "MessageSender.h" #include "Plugin.h" #include "SandboxExtension.h" #include "WebEditCommand.h" +#include <WebCore/DragData.h> #include <WebCore/Editor.h> #include <WebCore/FrameLoaderTypes.h> #include <WebCore/IntRect.h> @@ -55,11 +58,7 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class AccessibilityWebPageObject; -#else -class AccessibilityWebPageObject; -#endif +OBJC_CLASS AccessibilityWebPageObject; #endif namespace CoreIPC { @@ -100,6 +99,10 @@ struct PrintInfo; struct WebPageCreationParameters; struct WebPreferencesStore; +#if ENABLE(GESTURE_EVENTS) +class WebGestureEvent; +#endif + #if ENABLE(TOUCH_EVENTS) class WebTouchEvent; #endif @@ -122,12 +125,15 @@ public: void setSize(const WebCore::IntSize&); const WebCore::IntSize& size() const { return m_viewSize; } - + WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); } + InjectedBundleBackForwardList* backForwardList(); DrawingArea* drawingArea() const { return m_drawingArea.get(); } WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); } + void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset); + #if ENABLE(INSPECTOR) WebInspector* inspector(); #endif @@ -135,6 +141,7 @@ public: // -- Called by the DrawingArea. // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial? void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&); + void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&); void layoutIfNeeded(); // -- Called from WebCore clients. @@ -165,12 +172,16 @@ public: void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*); void initializeInjectedBundleFormClient(WKBundlePageFormClient*); void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*); + void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*); + void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*); void initializeInjectedBundleUIClient(WKBundlePageUIClient*); InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; } InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; } InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; } InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; } + InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; } + InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; } InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; } bool findStringFromInjectedBundle(const String&, FindOptions); @@ -224,9 +235,11 @@ public: void installPageOverlay(PassRefPtr<PageOverlay>); void uninstallPageOverlay(PageOverlay*); + bool hasPageOverlay() const { return m_pageOverlay; } PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions); PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions); + PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions); static const WebEvent* currentEvent(); @@ -247,6 +260,7 @@ public: WebContextMenu* contextMenu(); bool hasLocalDataForURL(const WebCore::KURL&); + String cachedResponseMIMETypeForURL(const WebCore::KURL&); static bool canHandleRequest(const WebCore::ResourceRequest&); @@ -271,7 +285,7 @@ public: static void getLocationAndLengthFromRange(WebCore::Range*, uint64_t& location, uint64_t& length); #if PLATFORM(MAC) - void sendAccessibilityPresenterToken(const CoreIPC::DataReference&); + void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken); AccessibilityWebPageObject* accessibilityRemoteObject(); WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; } @@ -300,14 +314,19 @@ public: #endif void replaceSelectionWithText(WebCore::Frame*, const String&); +#if PLATFORM(WIN) + void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags); +#else void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags); +#endif void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation); void beginPrinting(uint64_t frameID, const PrintInfo&); void endPrinting(); - void computePagesForPrinting(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting); + void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID); #if PLATFORM(MAC) - void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, Vector<uint8_t>& pdfData); + void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, uint64_t callbackID); + void drawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID); #endif bool mainFrameHasCustomRepresentation() const; @@ -336,37 +355,44 @@ private: // Actions void tryClose(); - void loadURL(const String&, const SandboxExtension::Handle& sandboxExtensionHandle); - void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle& sandboxExtensionHandle); + void loadURL(const String&, const SandboxExtension::Handle&); + void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&); void loadHTMLString(const String& htmlString, const String& baseURL); void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL); void loadPlainTextString(const String&); void reload(bool reloadFromOrigin); - void goForward(uint64_t); - void goBack(uint64_t); - void goToBackForwardItem(uint64_t); + void goForward(uint64_t, const SandboxExtension::Handle&); + void goBack(uint64_t, const SandboxExtension::Handle&); + void goToBackForwardItem(uint64_t, const SandboxExtension::Handle&); void setActive(bool); void setFocused(bool); void setInitialFocus(bool); void setWindowResizerSize(const WebCore::IntSize&); void setIsInWindow(bool); + void validateMenuItem(const String&); + void executeEditCommand(const String&); + void mouseEvent(const WebMouseEvent&); void wheelEvent(const WebWheelEvent&); void keyEvent(const WebKeyboardEvent&); - void validateMenuItem(const String&); - void executeEditCommand(const String&); +#if ENABLE(GESTURE_EVENTS) + void gestureEvent(const WebGestureEvent&); +#endif #if ENABLE(TOUCH_EVENTS) void touchEvent(const WebTouchEvent&); #endif uint64_t restoreSession(const SessionState&); - void restoreSessionAndNavigateToCurrentItem(const SessionState&); + void restoreSessionAndNavigateToCurrentItem(const SessionState&, const SandboxExtension::Handle&); void didRemoveBackForwardItem(uint64_t); void setDrawsBackground(bool); void setDrawsTransparentBackground(bool); + void viewWillStartLiveResize(); + void viewWillEndLiveResize(); + void getContentsAsString(uint64_t callbackID); void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID); void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID); @@ -375,6 +401,7 @@ private: void getSourceForFrame(uint64_t frameID, uint64_t callbackID); void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID); void runJavaScriptInMainFrame(const String&, uint64_t callbackID); + void forceRepaint(uint64_t callbackID); void preferencesDidChange(const WebPreferencesStore&); void platformPreferencesDidChange(const WebPreferencesStore&); @@ -406,6 +433,9 @@ private: void didChooseFilesForOpenPanel(const Vector<String>&); void didCancelForOpenPanel(); +#if ENABLE(WEB_PROCESS_SANDBOX) + void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&); +#endif void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed); @@ -477,6 +507,8 @@ private: InjectedBundlePageEditorClient m_editorClient; InjectedBundlePageFormClient m_formClient; InjectedBundlePageLoaderClient m_loaderClient; + InjectedBundlePagePolicyClient m_policyClient; + InjectedBundlePageResourceLoadClient m_resourceLoadClient; InjectedBundlePageUIClient m_uiClient; #if ENABLE(TILED_BACKING_STORE) @@ -487,7 +519,7 @@ private: RefPtr<PageOverlay> m_pageOverlay; #if ENABLE(INSPECTOR) - OwnPtr<WebInspector> m_inspector; + RefPtr<WebInspector> m_inspector; #endif RefPtr<WebPopupMenu> m_activePopupMenu; RefPtr<WebContextMenu> m_contextMenu; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index e001864..e47a013 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Apple Inc. All rights reserved. +# Copyright (C) 2010, 2011 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,16 +29,22 @@ messages -> WebPage { SetDrawsBackground(bool drawsBackground) SetDrawsTransparentBackground(bool drawsTransparentBackground) + ViewWillStartLiveResize() + ViewWillEndLiveResize() + KeyEvent(WebKit::WebKeyboardEvent event) MouseEvent(WebKit::WebMouseEvent event) WheelEvent(WebKit::WebWheelEvent event) +#if ENABLE(GESTURE_EVENTS) + GestureEvent(WebKit::WebGestureEvent event) +#endif #if ENABLE(TOUCH_EVENTS) TouchEvent(WebKit::WebTouchEvent event) #endif - GoBack(uint64_t backForwardItemID) - GoForward(uint64_t backForwardItemID) - GoToBackForwardItem(uint64_t backForwardItemID) + GoBack(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle) + GoForward(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle) + GoToBackForwardItem(uint64_t backForwardItemID, WebKit::SandboxExtension::Handle sandboxExtensionHandle) LoadHTMLString(WTF::String htmlString, WTF::String baseURL) LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL); LoadPlainTextString(WTF::String string) @@ -49,7 +55,7 @@ messages -> WebPage { StopLoadingFrame(uint64_t frameID) - RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state) + RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state, WebKit::SandboxExtension::Handle sandboxExtensionHandle) DidRemoveBackForwardItem(uint64_t backForwardItemID) @@ -65,6 +71,9 @@ messages -> WebPage { GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID) RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID) + # FIXME: This should be a drawing area message. + ForceRepaint(uint64_t callbackID) + PreferencesDidChange(WebKit::WebPreferencesStore store) SetUserAgent(WTF::String userAgent) @@ -100,7 +109,12 @@ messages -> WebPage { CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount) # Drag and drop. +#if PLATFORM(WIN) + PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags) +#endif +#if !PLATFORM(WIN) PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags) +#endif DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation) # Popup menu. @@ -113,6 +127,9 @@ messages -> WebPage { # Open panel. DidChooseFilesForOpenPanel(Vector<WTF::String> fileURLs) DidCancelForOpenPanel() +#if ENABLE(WEB_PROCESS_SANDBOX) + ExtendSandboxForFileFromOpenPanel(WebKit::SandboxExtension::Handle sandboxExtensionHandle) +#endif # Spelling and grammar. AdvanceToNextMisspelling(bool startBeforeSelection) @@ -133,11 +150,12 @@ messages -> WebPage { SetWindowResizerSize(WebCore::IntSize intersectsView) # Printing. - BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo); + BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo) EndPrinting(); - ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo) -> (Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting) + ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID) #if PLATFORM(MAC) - DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect) -> (Vector<uint8_t> pdfData) + DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect, uint64_t callbackID) + DrawPagesToPDF(uint64_t frameID, uint32_t first, uint32_t count, uint64_t callbackID) #endif // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require @@ -153,7 +171,7 @@ messages -> WebPage { GetMarkedRange() -> (uint64_t location, uint64_t length) CharacterIndexForPoint(WebCore::IntPoint point) -> (uint64_t result) FirstRectForCharacterRange(uint64_t location, uint64_t length) -> (WebCore::IntRect resultRect) - SendAccessibilityPresenterToken(CoreIPC::DataReference token) + RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken) #endif #if PLATFORM(WIN) ConfirmComposition(WTF::String compositionString) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp index 67109ec..3bd20c8 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageGroupProxy.h" #include "WebProcess.h" diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp new file mode 100644 index 0000000..313ad3f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/gtk/ChunkedUpdateDrawingAreaGtk.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ChunkedUpdateDrawingArea.h" + +#include "RefPtrCairo.h" +#include "UpdateChunk.h" +#include "WebPage.h" + +#include <WebCore/GraphicsContext.h> +#include <WebCore/IntRect.h> + +using namespace WebCore; + +namespace WebKit { + +void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk) +{ + ASSERT(!updateChunk->isEmpty()); + + RefPtr<cairo_surface_t> image = updateChunk->createImage(); + RefPtr<cairo_t> cr = cairo_create(image.get()); + GraphicsContext gc(cr.get()); + gc.save(); + IntRect rect = updateChunk->rect(); + gc.translate(-rect.x(), -rect.y()); + m_webPage->drawRect(gc, updateChunk->rect()); + gc.restore(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp index 4697f62..36bde01 100644 --- a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp +++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspector.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm index fa4aa1a..c88ab7e 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "AccessibilityWebPageObject.h" #import "WebFrame.h" @@ -32,6 +33,7 @@ #import <WebCore/FrameView.h> #import <WebCore/ScrollView.h> #import <WebCore/Scrollbar.h> +#import <WebKitSystemInterface.h> using namespace WebCore; using namespace WebKit; @@ -70,6 +72,7 @@ using namespace WebKit; - (void)dealloc { + WKUnregisterUniqueIdForElement(self); [m_accessibilityChildren release]; [m_attributeNames release]; [m_parent release]; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp index 6bcecfd..b39598f 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp +++ b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingArea.h" #include "UpdateChunk.h" diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm index 24fa124..25a1dfd 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm @@ -23,18 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if USE(ACCELERATED_COMPOSITING) +#import "config.h" +#import "LayerBackedDrawingArea.h" -#include "LayerBackedDrawingArea.h" +#if USE(ACCELERATED_COMPOSITING) -#include "DrawingAreaProxyMessageKinds.h" -#include "WebKitSystemInterface.h" -#include "WebPage.h" -#include "WebProcess.h" -#include <WebCore/Frame.h> -#include <WebCore/FrameView.h> -#include <WebCore/GraphicsLayer.h> -#include <WebCore/Page.h> +#import "DrawingAreaProxyMessageKinds.h" +#import "WebKitSystemInterface.h" +#import "WebPage.h" +#import "WebProcess.h" +#import <WebCore/Frame.h> +#import <WebCore/FrameView.h> +#import <WebCore/GraphicsLayer.h> +#import <WebCore/Page.h> using namespace WebCore; @@ -83,7 +84,7 @@ void LayerBackedDrawingArea::attachCompositingContext() WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_hostingLayer->platformLayer()); uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get()); - WebProcess::shared().connection()->sendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out()); + WebProcess::shared().connection()->deprecatedSendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out()); #endif } diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h new file mode 100644 index 0000000..016f0d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayerTreeHostMac_h +#define LayerTreeHostMac_h + +#include "LayerTreeContext.h" +#include "LayerTreeHost.h" +#include <WebCore/GraphicsLayerClient.h> +#include <wtf/OwnPtr.h> +#include <wtf/RetainPtr.h> + +typedef struct __WKCARemoteLayerClientRef* WKCARemoteLayerClientRef; + +namespace WebKit { + +class LayerTreeHostMac : public LayerTreeHost, WebCore::GraphicsLayerClient { +public: + static PassRefPtr<LayerTreeHostMac> create(WebPage*); + ~LayerTreeHostMac(); + +private: + explicit LayerTreeHostMac(WebPage*); + + // LayerTreeHost. + virtual const LayerTreeContext& layerTreeContext(); + virtual void scheduleLayerFlush(); + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*); + virtual void invalidate(); + + virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&); + virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); + virtual void sizeDidChange(const WebCore::IntSize& newSize); + + virtual void didInstallPageOverlay(); + virtual void didUninstallPageOverlay(); + virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&); + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); + virtual bool showDebugBorders() const; + virtual bool showRepaintCounter() const; + + static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*); + void flushPendingLayerChangesRunLoopObserverCallback(); + bool flushPendingLayerChanges(); + + void createPageOverlayLayer(); + void destroyPageOverlayLayer(); + + // The context for this layer tree. + LayerTreeContext m_layerTreeContext; + + // Whether the layer tree host is valid or not. + bool m_isValid; + + // The root layer. + OwnPtr<WebCore::GraphicsLayer> m_rootLayer; + + // The layer which contains all non-composited content. + OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer; + + // The page overlay layer. Will be null if there's no page overlay. + OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; + + RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient; + RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver; +}; + +} // namespace WebKit + +#endif // LayerTreeHostMac_h diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm new file mode 100644 index 0000000..9734aec --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "LayerTreeHostMac.h" + +#import "WebPage.h" +#import "WebProcess.h" +#import <QuartzCore/CATransaction.h> +#import <WebCore/Frame.h> +#import <WebCore/FrameView.h> +#import <WebCore/Page.h> +#import <WebCore/Settings.h> +#import <WebKitSystemInterface.h> + +@interface CATransaction (Details) ++ (void)synchronize; +@end + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage) +{ + return adoptRef(new LayerTreeHostMac(webPage)); +} + +LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage) + : LayerTreeHost(webPage) + , m_isValid(true) +{ + mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort(); + m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort); + + // Create a root layer. + m_rootLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_rootLayer->setName("LayerTreeHost root layer"); +#endif + m_rootLayer->setDrawsContent(false); + m_rootLayer->setSize(webPage->size()); + + [m_rootLayer->platformLayer() setGeometryFlipped:YES]; + + m_nonCompositedContentLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content"); +#endif + m_nonCompositedContentLayer->setDrawsContent(true); + m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground()); + m_nonCompositedContentLayer->setSize(webPage->size()); + + m_rootLayer->addChild(m_nonCompositedContentLayer.get()); + + WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), m_rootLayer->platformLayer()); + + if (m_webPage->hasPageOverlay()) + createPageOverlayLayer(); + + scheduleLayerFlush(); + + m_layerTreeContext.contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get()); +} + +LayerTreeHostMac::~LayerTreeHostMac() +{ + ASSERT(!m_isValid); + ASSERT(!m_flushPendingLayerChangesRunLoopObserver); + ASSERT(!m_remoteLayerClient); + ASSERT(!m_rootLayer); +} + +const LayerTreeContext& LayerTreeHostMac::layerTreeContext() +{ + return m_layerTreeContext; +} + +void LayerTreeHostMac::scheduleLayerFlush() +{ + CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent(); + + // Make sure we wake up the loop or the observer could be delayed until some other source fires. + CFRunLoopWakeUp(currentRunLoop); + + if (m_flushPendingLayerChangesRunLoopObserver) + return; + + // Run before the Core Animation commit observer, which has order 2000000. + const CFIndex runLoopOrder = 2000000 - 1; + CFRunLoopObserverContext context = { 0, this, 0, 0, 0 }; + m_flushPendingLayerChangesRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, runLoopOrder, flushPendingLayerChangesRunLoopObserverCallback, &context)); + + CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes); +} + +void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer) +{ + ASSERT(graphicsLayer); + + m_nonCompositedContentLayer->removeAllChildren(); + + // Add the accelerated layer tree hierarchy. + m_nonCompositedContentLayer->addChild(graphicsLayer); +} + +void LayerTreeHostMac::invalidate() +{ + ASSERT(m_isValid); + + if (m_flushPendingLayerChangesRunLoopObserver) { + CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get()); + m_flushPendingLayerChangesRunLoopObserver = nullptr; + } + + WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get()); + m_remoteLayerClient = nullptr; + m_rootLayer = nullptr; + m_isValid = false; +} + +void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect) +{ + m_nonCompositedContentLayer->setNeedsDisplayInRect(rect); + if (m_pageOverlayLayer) + m_pageOverlayLayer->setNeedsDisplayInRect(rect); + + scheduleLayerFlush(); +} + +void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset) +{ + setNonCompositedContentsNeedDisplay(scrollRect); +} + +void LayerTreeHostMac::sizeDidChange(const IntSize& newSize) +{ + m_rootLayer->setSize(newSize); + m_nonCompositedContentLayer->setSize(newSize); + + if (m_pageOverlayLayer) + m_pageOverlayLayer->setSize(newSize); + + scheduleLayerFlush(); + flushPendingLayerChanges(); + + [CATransaction flush]; + [CATransaction synchronize]; +} + +void LayerTreeHostMac::didInstallPageOverlay() +{ + createPageOverlayLayer(); + scheduleLayerFlush(); +} + +void LayerTreeHostMac::didUninstallPageOverlay() +{ + destroyPageOverlayLayer(); + scheduleLayerFlush(); +} + +void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect) +{ + ASSERT(m_pageOverlayLayer); + m_pageOverlayLayer->setNeedsDisplayInRect(rect); + scheduleLayerFlush(); +} + +void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) +{ +} + +void LayerTreeHostMac::notifySyncRequired(const WebCore::GraphicsLayer*) +{ +} + +void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect) +{ + if (graphicsLayer == m_nonCompositedContentLayer) { + m_webPage->drawRect(graphicsContext, clipRect); + return; + } + + if (graphicsLayer == m_pageOverlayLayer) { + m_webPage->drawPageOverlay(graphicsContext, clipRect); + return; + } +} + +bool LayerTreeHostMac::showDebugBorders() const +{ + return m_webPage->corePage()->settings()->showDebugBorders(); +} + +bool LayerTreeHostMac::showRepaintCounter() const +{ + return m_webPage->corePage()->settings()->showRepaintCounter(); +} + +void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context) +{ + static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback(); +} + +void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback() +{ + { + RefPtr<LayerTreeHostMac> protect(this); + m_webPage->layoutIfNeeded(); + + if (!m_isValid) + return; + } + + if (!flushPendingLayerChanges()) + return; + + // We successfully flushed the pending layer changes, remove the run loop observer. + ASSERT(m_flushPendingLayerChangesRunLoopObserver); + CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get()); + m_flushPendingLayerChangesRunLoopObserver = 0; +} + +bool LayerTreeHostMac::flushPendingLayerChanges() +{ + m_rootLayer->syncCompositingStateForThisLayerOnly(); + m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly(); + if (m_pageOverlayLayer) + m_pageOverlayLayer->syncCompositingStateForThisLayerOnly(); + + return m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes(); +} + +void LayerTreeHostMac::createPageOverlayLayer() +{ + ASSERT(!m_pageOverlayLayer); + + m_pageOverlayLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_pageOverlayLayer->setName("LayerTreeHost page overlay content"); +#endif + + m_pageOverlayLayer->setDrawsContent(true); + m_pageOverlayLayer->setSize(m_webPage->size()); + + m_rootLayer->addChild(m_pageOverlayLayer.get()); +} + +void LayerTreeHostMac::destroyPageOverlayLayer() +{ + ASSERT(m_pageOverlayLayer); + m_pageOverlayLayer->removeFromParent(); + m_pageOverlayLayer = nullptr; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm index 83909be..f053cab 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebInspector.h" #import <wtf/text/WTFString.h> diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm index f3211f2..71bbf78 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm @@ -23,28 +23,29 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebPage.h" +#import "config.h" +#import "WebPage.h" -#include "AccessibilityWebPageObject.h" -#include "DataReference.h" -#include "PluginView.h" -#include "WebCoreArgumentCoders.h" -#include "WebEvent.h" -#include "WebFrame.h" -#include "WebPageProxyMessages.h" -#include "WebProcess.h" -#include <WebCore/AXObjectCache.h> -#include <WebCore/FocusController.h> -#include <WebCore/Frame.h> -#include <WebCore/FrameView.h> -#include <WebCore/HitTestResult.h> -#include <WebCore/KeyboardEvent.h> -#include <WebCore/Page.h> -#include <WebCore/PlatformKeyboardEvent.h> -#include <WebCore/ScrollView.h> -#include <WebCore/TextIterator.h> -#include <WebCore/WindowsKeyboardCodes.h> -#include <WebKitSystemInterface.h> +#import "AccessibilityWebPageObject.h" +#import "DataReference.h" +#import "PluginView.h" +#import "WebCoreArgumentCoders.h" +#import "WebEvent.h" +#import "WebFrame.h" +#import "WebPageProxyMessages.h" +#import "WebProcess.h" +#import <WebCore/AXObjectCache.h> +#import <WebCore/FocusController.h> +#import <WebCore/Frame.h> +#import <WebCore/FrameView.h> +#import <WebCore/HitTestResult.h> +#import <WebCore/KeyboardEvent.h> +#import <WebCore/Page.h> +#import <WebCore/PlatformKeyboardEvent.h> +#import <WebCore/ScrollView.h> +#import <WebCore/TextIterator.h> +#import <WebCore/WindowsKeyboardCodes.h> +#import <WebKitSystemInterface.h> using namespace WebCore; @@ -65,7 +66,7 @@ void WebPage::platformInitialize() // send data back over NSData* remoteToken = (NSData *)WKAXRemoteTokenForElement(mockAccessibilityElement); CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]); - send(Messages::WebPageProxy::DidReceiveAccessibilityPageToken(dataToken)); + send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken)); m_mockAccessibilityElement = mockAccessibilityElement; #endif } @@ -230,10 +231,11 @@ void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, Web resultRect.setSize(IntSize(0, 0)); RefPtr<Range> range = convertToRange(frame, NSMakeRange(location, length)); - if (range) { - ASSERT(range->startContainer()); - ASSERT(range->endContainer()); - } + if (!range) + return; + + ASSERT(range->startContainer()); + ASSERT(range->endContainer()); IntRect rect = frame->editor()->firstRectForRange(range.get()); resultRect = frame->view()->contentsToWindow(rect); @@ -334,11 +336,16 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard return true; } -void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data) +void WebPage::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken) { #if !defined(BUILDING_ON_SNOW_LEOPARD) - NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()]; - [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)]; + NSData* elementTokenData = [NSData dataWithBytes:elementToken.data() length:elementToken.size()]; + NSData* windowTokenData = [NSData dataWithBytes:windowToken.data() length:windowToken.size()]; + id remoteElement = WKAXRemoteElementForToken(elementTokenData); + id remoteWindow = WKAXRemoteElementForToken(windowTokenData); + WKAXSetWindowForRemoteElement(remoteWindow, remoteElement); + + [accessibilityRemoteObject() setRemoteParent:remoteElement]; #endif } @@ -357,6 +364,16 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url) return cachedResponse; } +String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url) +{ + NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url]; + [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"]; + NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request]; + [request release]; + + return [[cachedResponse response] MIMEType]; +} + bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) { if ([NSURLConnection canHandleRequest:request.nsURLRequest()]) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp index 25ed3e7..ec65b4e 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingArea.h" #include "UpdateChunk.h" diff --git a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp index b7ad782..c9ae03d 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TILED_BACKING_STORE) - +#include "config.h" #include "TiledDrawingArea.h" +#if ENABLE(TILED_BACKING_STORE) + #include "UpdateChunk.h" #include "WebPage.h" #include <WebCore/GraphicsContext.h> diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp index 99aa1eb..1675d77 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspector.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index fe1a89c..cad0c04 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPage.h" #include "WebEvent.h" @@ -270,6 +271,12 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL&) return false; } +String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL&) +{ + // FIXME: Implement + return String(); +} + bool WebPage::canHandleRequest(const WebCore::ResourceRequest&) { // FIXME: Implement diff --git a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp index aa1f975..13f1e3f 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChunkedUpdateDrawingArea.h" #include "UpdateChunk.h" diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp index cae79c2..3c2f3c9 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if USE(ACCELERATED_COMPOSITING) - +#include "config.h" #include "LayerBackedDrawingArea.h" +#if USE(ACCELERATED_COMPOSITING) + using namespace WebCore; namespace WebKit { diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp index 4c30b8b..3ae0dae 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebInspector.h" #if ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp index d41972c..e20af3a 100644 --- a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp +++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPage.h" #include "FontSmoothingLevel.h" @@ -261,6 +262,27 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url) #endif } +String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url) +{ +#if USE(CFNETWORK) + RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL()); + RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0)); + + RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString()); + CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get()); + + RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache()); + + RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get())); + + CFURLResponseRef response = CFCachedURLResponseGetWrappedResponse(cachedResponse.get()); + + return response ? CFURLResponseGetMIMEType(response) : String(); +#else + return String(); +#endif +} + bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) { #if USE(CFNETWORK) diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 47f4125..97faec4 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcess.h" #include "AuthenticationManager.h" @@ -119,11 +120,6 @@ WebProcess::WebProcess() // Initialize our platform strategies. WebPlatformStrategies::initialize(); #endif // USE(PLATFORM_STRATEGIES) - -#if ENABLE(DATABASE) - // Make sure the WebDatabaseManager is initialized so that the Database directory is set. - WebDatabaseManager::shared(); -#endif } void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, RunLoop* runLoop) @@ -131,6 +127,8 @@ void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, Ru ASSERT(!m_connection); m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop); + m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue); + m_connection->open(); m_runLoop = runLoop; @@ -159,6 +157,11 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame } } +#if ENABLE(DATABASE) + // Make sure the WebDatabaseManager is initialized so that the Database directory is set. + WebDatabaseManager::initialize(parameters.databaseDirectory); +#endif + #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (!parameters.applicationCacheDirectory.isEmpty()) cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); @@ -564,6 +567,13 @@ void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::Message // we'll let it slide. } +NO_RETURN void WebProcess::didFailToSendSyncMessage(CoreIPC::Connection*) +{ + // We were making a synchronous call to a UI process that doesn't exist any more. + // Callers are unlikely to be prepared for an error like this, so it's best to exit immediately. + exit(0); +} + WebFrame* WebProcess::webFrame(uint64_t frameID) const { return m_frameMap.get(frameID); diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index e82cf15..993cf38 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -68,7 +68,7 @@ class WebProcess : ChildProcess { public: static WebProcess& shared(); - void initialize(CoreIPC::Connection::Identifier, RunLoop* runLoop); + void initialize(CoreIPC::Connection::Identifier, RunLoop*); CoreIPC::Connection* connection() const { return m_connection.get(); } RunLoop* runLoop() const { return m_runLoop; } @@ -156,6 +156,7 @@ private: CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); void didClose(CoreIPC::Connection*); void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + NO_RETURN void didFailToSendSyncMessage(CoreIPC::Connection*); // Implemented in generated WebProcessMessageReceiver.cpp void didReceiveWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb index df57bde..5d81971 100644 --- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb +++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb @@ -6,48 +6,57 @@ ;; Read-only preferences and data (allow file-read* - ;; Basic system paths - (subpath "/Library/Fonts") - (subpath "/Library/Frameworks") - (subpath "/Library/Keychains") - (subpath "/private/var/db/mds") - (regex #"^/private/etc/(hosts|group|passwd)$") - - ;; Plugins - (subpath "/Library/Internet Plug-Ins") - (subpath (string-append (param "_HOME") "/Library/Internet Plug-Ins")) - - ;; System and user preferences - (literal "/Library/Preferences/.GlobalPreferences.plist") - (literal "/Library/Preferences/com.apple.security.plist") - (literal (string-append (param "_HOME") "/Library/Preferences/.GlobalPreferences.plist")) - (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/\.GlobalPreferences\.")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.ATS.plist")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.HIToolbox.plist")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.LaunchServices.plist")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.WebFoundation.plist")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.security.plist")) - (literal (string-append (param "_HOME") "/Library/Preferences/com.apple.security.revocation.plist")) - (subpath (string-append (param "_HOME") "/Library/Keychains")) - - ;; On-disk WebKit2 framework location, to account for debug installations - ;; outside of /System/Library/Frameworks - (subpath (param "WEBKIT2_FRAMEWORK_DIR")) - - ;; Extensions from UIProcess - (extension) + ;; Basic system paths + (subpath "/Library/Fonts") + (subpath "/Library/Frameworks") + (subpath "/Library/Keychains") + (subpath "/private/var/db/mds") + (subpath "/private/var/db/DetachedSignatures") + (regex #"^/private/etc/(hosts|group|passwd)$") + + ;; Plugins + (subpath "/Library/Internet Plug-Ins") + (subpath (string-append (param "HOME_DIR") "/Library/Internet Plug-Ins")) + + ;; System and user preferences + (literal "/Library/Preferences/.GlobalPreferences.plist") + (literal "/Library/Preferences/com.apple.crypto.plist") + (literal "/Library/Preferences/com.apple.security.plist") + (literal "/Library/Preferences/com.apple.security.common.plist") + (literal "/Library/Preferences/com.apple.security.revocation.plist") + (literal (string-append (param "HOME_DIR") "/Library/Preferences/.GlobalPreferences.plist")) + (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/\.GlobalPreferences\.")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.ATS.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.HIToolbox.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.LaunchServices.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.WebFoundation.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.security.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.security.revocation.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain")) + (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$")) + + ;; On-disk WebKit2 framework location, to account for debug installations + ;; outside of /System/Library/Frameworks + (subpath (param "WEBKIT2_FRAMEWORK_DIR")) + + ;; FIXME: This should be removed when <rdar://problem/8957845> is fixed. + (subpath (string-append (param "HOME_DIR") "/Library/Fonts")) + + ;; Extensions from UIProcess + (extension) ) (allow file-write* - ;; Extensions from UIProcess - (extension) + ;; Extensions from UIProcess + (extension) ) ;; Writable preferences and temporary files (allow file* - (subpath (string-append (param "_HOME") "/Library/Caches/com.apple.WebProcess")) - (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/com\.apple\.HIToolbox\.")) - (regex (string-append "^" (param "_HOME") "/Library/Preferences/com\.apple\.WebProcess\.")) + (subpath (string-append (param "HOME_DIR") "/Library/Caches/com.apple.WebProcess")) + (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/com\.apple\.HIToolbox\.")) + (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/com\.apple\.WebProcess\.")) + (subpath (string-append (param "HOME_DIR") "/Library/Keychains")) ) ;; Darwin temporary files and caches, if present @@ -56,6 +65,10 @@ (if (positive? (string-length (param "DARWIN_USER_TEMP_DIR"))) (allow file* (subpath (param "DARWIN_USER_TEMP_DIR")))) +;; Database dir +(if (positive? (string-length (param "WEBKIT_DATABASE_DIR"))) + (allow file* (subpath (param "WEBKIT_DATABASE_DIR")))) + ;; The NSURLCache directory. (if (positive? (string-length (param "NSURL_CACHE_DIR"))) (allow file* (subpath (param "NSURL_CACHE_DIR")))) @@ -89,6 +102,7 @@ (global-name "com.apple.dock.server") (global-name "com.apple.ocspd") (global-name "com.apple.pasteboard.1") + (global-name "com.apple.system.opendirectoryd.api") (global-name "com.apple.window_proxies") (global-name "com.apple.windowserver.active") (global-name-regex #"^com\.apple\.WebKit\.WebProcess-") @@ -107,8 +121,8 @@ ;; FIXME: These rules are required until plug-ins are moved out of the web process. (allow file-read* - (regex (string-append "^" (param "_HOME") "/Library/Preferences/ByHost/com\.apple\.ist\.")) - (literal (string-append (param "_HOME") "/Library/Preferences/edu.mit.Kerberos")) + (regex (string-append "^" (param "HOME_DIR") "/Library/Preferences/ByHost/com\.apple\.ist\.")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/edu.mit.Kerberos")) (literal "/Library/Preferences/edu.mit.Kerberos") ) @@ -127,6 +141,10 @@ ;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed. (allow mach-lookup (global-name "com.apple.pubsub.ipc")) (allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render")) +(allow file-read* + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.Safari.RSS.plist")) + (literal (string-append (param "HOME_DIR") "/Library/Preferences/com.apple.Syndication.plist")) +) ;; FIXME: Investigate these. (allow appleevent-send (appleevent-destination "com.apple.WebProcess")) diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp index 4c26c08..43e9776 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcess.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp index dcac73f..60e537f 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessMainGtk.h" #include "WKBase.h" @@ -51,10 +52,16 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]) JSC::initializeThreading(); WTF::initializeMainThread(); - + RunLoop::initializeMainRunLoop(); - WebCore::ResourceHandle::defaultSession(); - + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + + SoupSessionFeature* sniffer = static_cast<SoupSessionFeature*>(g_object_new(SOUP_TYPE_CONTENT_SNIFFER, NULL)); + soup_session_add_feature(session, sniffer); + g_object_unref(sniffer); + + soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_DECODER); + int socket = atoi(argv[1]); WebProcess::shared().initialize(socket, RunLoop::main()); RunLoop::run(); diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index d394c98..fc06d2c 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -23,23 +23,24 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebProcess.h" - -#include "SandboxExtension.h" -#include "WebProcessCreationParameters.h" -#include <WebCore/MemoryCache.h> -#include <WebCore/PageCache.h> -#include <WebKitSystemInterface.h> -#include <algorithm> -#include <dispatch/dispatch.h> -#include <mach/host_info.h> -#include <mach/mach.h> -#include <mach/mach_error.h> +#import "config.h" +#import "WebProcess.h" + +#import "SandboxExtension.h" +#import "WebProcessCreationParameters.h" +#import <WebCore/MemoryCache.h> +#import <WebCore/PageCache.h> +#import <WebKitSystemInterface.h> +#import <algorithm> +#import <dispatch/dispatch.h> +#import <mach/host_info.h> +#import <mach/mach.h> +#import <mach/mach_error.h> #if ENABLE(WEB_PROCESS_SANDBOX) -#include <sandbox.h> -#include <stdlib.h> -#include <sysexits.h> +#import <sandbox.h> +#import <stdlib.h> +#import <sysexits.h> #endif using namespace WebCore; @@ -75,7 +76,7 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel) { RetainPtr<NSString> nsurlCacheDirectory(AdoptNS, (NSString *)WKCopyFoundationCacheDirectory()); if (!nsurlCacheDirectory) - nsurlCacheDirectory.adoptNS(NSHomeDirectory()); + nsurlCacheDirectory = NSHomeDirectory(); // As a fudge factor, use 1000 instead of 1024, in case the reported byte // count doesn't align exactly to a megabyte boundary. @@ -109,6 +110,27 @@ void WebProcess::platformClearResourceCaches() [[NSURLCache sharedURLCache] removeAllCachedResponses]; } +#if ENABLE(WEB_PROCESS_SANDBOX) +static void appendSandboxParameterPath(Vector<const char*>& vector, const char* name, const char* path) +{ + char normalizedPath[PATH_MAX]; + if (!realpath(path, normalizedPath)) + normalizedPath[0] = '\0'; + + vector.append(name); + vector.append(fastStrDup(normalizedPath)); +} + +static void appendSandboxParameterConfPath(Vector<const char*>& vector, const char* name, int confID) +{ + char path[PATH_MAX]; + if (confstr(confID, path, PATH_MAX) <= 0) + path[0] = '\0'; + + appendSandboxParameterPath(vector, name, path); +} +#endif + static void initializeSandbox(const WebProcessCreationParameters& parameters) { #if ENABLE(WEB_PROCESS_SANDBOX) @@ -117,33 +139,29 @@ static void initializeSandbox(const WebProcessCreationParameters& parameters) return; } + Vector<const char*> sandboxParameters; + + appendSandboxParameterPath(sandboxParameters, "HOME_DIR", [NSHomeDirectory() fileSystemRepresentation]); + appendSandboxParameterPath(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation]); + appendSandboxParameterConfPath(sandboxParameters, "DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR); + appendSandboxParameterConfPath(sandboxParameters, "DARWIN_USER_CACHE_DIR", _CS_DARWIN_USER_CACHE_DIR); + appendSandboxParameterPath(sandboxParameters, "WEBKIT_DATABASE_DIR", [(NSString *)parameters.databaseDirectory fileSystemRepresentation]); + appendSandboxParameterPath(sandboxParameters, "NSURL_CACHE_DIR", parameters.nsURLCachePath.data()); + appendSandboxParameterPath(sandboxParameters, "UI_PROCESS_BUNDLE_RESOURCE_DIR", parameters.uiProcessBundleResourcePath.data()); + sandboxParameters.append(static_cast<const char*>(0)); + + const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] fileSystemRepresentation]; + char* errorBuf; - char tmpPath[PATH_MAX]; - char tmpRealPath[PATH_MAX]; - char cachePath[PATH_MAX]; - char cacheRealPath[PATH_MAX]; - const char* frameworkPath = [[[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent] UTF8String]; - const char* profilePath = [[[NSBundle mainBundle] pathForResource:@"com.apple.WebProcess" ofType:@"sb"] UTF8String]; - - if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmpPath, PATH_MAX) <= 0 || !realpath(tmpPath, tmpRealPath)) - tmpRealPath[0] = '\0'; - - if (confstr(_CS_DARWIN_USER_CACHE_DIR, cachePath, PATH_MAX) <= 0 || !realpath(cachePath, cacheRealPath)) - cacheRealPath[0] = '\0'; - - const char* const sandboxParam[] = { - "WEBKIT2_FRAMEWORK_DIR", frameworkPath, - "DARWIN_USER_TEMP_DIR", (const char*)tmpRealPath, - "DARWIN_USER_CACHE_DIR", (const char*)cacheRealPath, - "NSURL_CACHE_DIR", (const char*)parameters.nsURLCachePath.data(), - "UI_PROCESS_BUNDLE_RESOURCE_DIR", (const char*)parameters.uiProcessBundleResourcePath.data(), - NULL - }; - - if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParam, &errorBuf)) { - fprintf(stderr, "WebProcess: couldn't initialize sandbox profile [%s] with framework path [%s], tmp path [%s], cache path [%s]: %s\n", profilePath, frameworkPath, tmpRealPath, cacheRealPath, errorBuf); + if (sandbox_init_with_parameters(profilePath, SANDBOX_NAMED_EXTERNAL, sandboxParameters.data(), &errorBuf)) { + fprintf(stderr, "WebProcess: couldn't initialize sandbox profile [%s]\n", profilePath); + for (size_t i = 0; sandboxParameters[i]; i += 2) + fprintf(stderr, "%s=%s\n", sandboxParameters[i], sandboxParameters[i + 1]); exit(EX_NOPERM); } + + for (size_t i = 0; sandboxParameters[i]; i += 2) + fastFree(const_cast<char*>(sandboxParameters[i + 1])); #endif } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm index a44dc23..846d7a1 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebProcessMain.h" #import "CommandLine.h" @@ -45,6 +46,10 @@ // FIXME: We should be doing this another way. extern "C" kern_return_t bootstrap_look_up2(mach_port_t, const name_t, mach_port_t*, pid_t, uint64_t); +@interface NSApplication (WebNSApplicationDetails) +-(void)_installAutoreleasePoolsOnCurrentThreadIfNecessary; +@end + #define SHOW_CRASH_REPORTER 1 using namespace WebCore; @@ -88,6 +93,10 @@ int WebProcessMain(const CommandLine& commandLine) // Initialize AppKit. [NSApplication sharedApplication]; + // Installs autorelease pools on the current CFRunLoop which prevents memory from accumulating between user events. + // FIXME: Remove when <rdar://problem/8929426> is fixed. + [[NSApplication sharedApplication] _installAutoreleasePoolsOnCurrentThreadIfNecessary]; + #if !defined(BUILDING_ON_SNOW_LEOPARD) WKAXRegisterRemoteApp(); #endif diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp index bd4e370..291c3e7 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "RunLoop.h" #include <runtime/InitializeThreading.h> #include "WebProcess.h" @@ -160,7 +161,18 @@ QWEBKIT_EXPORT int WebProcessMainQt(int argc, char** argv) RunLoop::initializeMainRunLoop(); // Create the connection. - QString identifier(app->arguments().size() > 1 ? app->arguments().at(1) : ""); + if (app->arguments().size() <= 1) { + qDebug() << "Error: wrong number of arguments."; + return 1; + } + + bool wasNumber = false; + int identifier = app->arguments().at(1).toInt(&wasNumber, 10); + if (!wasNumber) { + qDebug() << "Error: connection identifier wrong."; + return 1; + } + WebKit::WebProcess::shared().initialize(identifier, RunLoop::main()); RunLoop::run(); diff --git a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp index 53a51d3..c45ea32 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcess.h" #include "WebProcessCreationParameters.h" diff --git a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp index 944d8ff..2533c00 100644 --- a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp +++ b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessMain.h" #include "CommandLine.h" diff --git a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp index 7f53cd3..97e2385 100644 --- a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp +++ b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcess.h" #include "WebProcessCreationParameters.h" diff --git a/Source/WebKit2/config.h b/Source/WebKit2/config.h new file mode 100644 index 0000000..4f8d923 --- /dev/null +++ b/Source/WebKit2/config.h @@ -0,0 +1,142 @@ +/* + * 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. + */ + +#if defined (BUILDING_GTK__) +#include "autotoolsconfig.h" +#endif /* defined (BUILDING_GTK__) */ + +#ifdef __cplusplus + +// These undefs match up with defines in WebKit2Prefix.h for Mac OS X. +// Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h". +#undef new +#undef delete +#include <wtf/FastMalloc.h> + +#endif + +#include <wtf/DisallowCType.h> +#include <wtf/Platform.h> + +#ifdef __cplusplus +#ifndef EXTERN_C_BEGIN +#define EXTERN_C_BEGIN extern "C" { +#endif +#ifndef EXTERN_C_END +#define EXTERN_C_END } +#endif +#else +#define EXTERN_C_BEGIN +#define EXTERN_C_END +#endif + +// For defining getters to a static value, where the getters have internal linkage +#define DEFINE_STATIC_GETTER(type, name, arguments) \ +static const type& name() \ +{ \ + DEFINE_STATIC_LOCAL(type, name##Value, arguments); \ + return name##Value; \ +} + +#if defined(BUILDING_QT__) || defined(BUILDING_GTK__) + +#define WTF_USE_JSC 1 +#define WTF_USE_V8 0 + +#define JS_EXPORTDATA +#define JS_EXPORTCLASS + +// Disable notImplemented() warnings not to break layout tests. +// FIXME: WebKit2 logging system should behave identical to WebKit1. +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 + +#elif defined(__APPLE__) + +#ifdef __OBJC__ +#define OBJC_CLASS @class +#else +#define OBJC_CLASS class +#endif + +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#define ENABLE_WEB_PROCESS_SANDBOX 1 +#endif + +#define ENABLE_PLUGIN_PROCESS 1 + +#if PLATFORM(MAC) +#define ENABLE_MEMORY_SAMPLER 1 +#endif + +#import <CoreGraphics/CoreGraphics.h> + +#ifdef __OBJC__ +#import <Cocoa/Cocoa.h> +#endif + +/* WebKit has no way to pull settings from WebCore/config.h for now */ +/* so we assume WebKit is always being compiled on top of JavaScriptCore */ +#define WTF_USE_JSC 1 +#define WTF_USE_V8 0 + +#define JS_EXPORTDATA +#define JS_EXPORTCLASS +#define WEBKIT_EXPORTDATA + +#include <WebCore/EmptyProtocolDefinitions.h> + +#elif defined(WIN32) || defined(_WIN32) + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#endif + +#ifndef WINVER +#define WINVER 0x0500 +#endif + +/* If we don't define these, they get defined in windef.h. */ +/* We want to use std::min and std::max. */ +#ifndef max +#define max max +#endif +#ifndef min +#define min min +#endif + +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ +#endif + +#include <WebCore/config.h> +#include <windows.h> + +#if PLATFORM(CG) +#include <CoreGraphics/CoreGraphics.h> +#endif + +#endif /* defined(WIN32) || defined(_WIN32) */ + diff --git a/Source/WebKit2/mac/MainMac.cpp b/Source/WebKit2/mac/MainMac.cpp index 0bba8af..5e6e6a2 100644 --- a/Source/WebKit2/mac/MainMac.cpp +++ b/Source/WebKit2/mac/MainMac.cpp @@ -24,6 +24,9 @@ */ #include <dlfcn.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> static void closeUnusedFileDescriptors() { diff --git a/Source/WebKit2/win/MainWin.cpp b/Source/WebKit2/win/MainWin.cpp index 7aea3f2..c12d048 100644 --- a/Source/WebKit2/win/MainWin.cpp +++ b/Source/WebKit2/win/MainWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include <shlwapi.h> #include <windows.h> #if defined _M_IX86 @@ -37,9 +38,30 @@ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='6595b64144ccf1df' language='*'\"") -extern "C" __declspec(dllimport) int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow); - int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow) { - return WebKitMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow); +#ifndef DEBUG_ALL + LPCWSTR webKitDLLName = L"WebKit.dll"; +#else + LPCTSTR webKitDLLName = L"WebKit_debug.dll"; +#endif + + WCHAR webKitPath[MAX_PATH]; + ::GetModuleFileNameW(0, webKitPath, ARRAYSIZE(webKitPath)); + ::PathRemoveFileSpecW(webKitPath); + + // Look for DLLs in the same directory as WebKit2WebProcess.exe. This is not in the search + // path already, since we launch WebKit2WebProcess.exe via CreateProcess with lpCurrentDirectory + // set to 0. We want both the WebKit client app DLL path and the WebKit directory DLL path in + // the DLL search order, and we want the current directory set to the WebKit client app path. + ::SetDllDirectoryW(webKitPath); + + ::PathAppendW(webKitPath, webKitDLLName); + HMODULE module = ::LoadLibraryW(webKitPath); + typedef int (__cdecl* WebKitMainProcPtr)(HINSTANCE, HINSTANCE, LPTSTR, int); + WebKitMainProcPtr mainProc = reinterpret_cast<WebKitMainProcPtr>(GetProcAddress(module, "WebKitMain")); + if (!mainProc) + return 0; + + return mainProc(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow); } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 37c5dfc..799fea9 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -19,6 +19,14 @@ EXPORTS WebKitShouldUseFontSmoothing WebKitCreateInstance + ; Exported for WebKitTestRunner's use only + ??0KURL@WebCore@@QAE@W4ParsedURLStringTag@1@PBD@Z + ??1StringImpl@WTF@@QAE@XZ + ?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z + ?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBD@Z + ?host@KURL@WebCore@@QBE?AVString@WTF@@XZ + ?protocol@KURL@WebCore@@QBE?AVString@WTF@@XZ + ; These functions are deprecated WebLocalizedString WebLocalizedLPCTSTR diff --git a/Source/WebKit2/win/WebKit2.make b/Source/WebKit2/win/WebKit2.make index 7d1ea35..111d113 100755 --- a/Source/WebKit2/win/WebKit2.make +++ b/Source/WebKit2/win/WebKit2.make @@ -8,14 +8,15 @@ install: set WebKitLibrariesDir=$(SRCROOT)\AppleInternal set WebKitOutputDir=$(OBJROOT) set ConfigurationBuildDir=$(OBJROOT)\$(BUILDSTYLE) - set WebKitVSPropsRedirectionDir=$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\ + set WebKitVSPropsRedirectionDir=$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\ set PRODUCTION=1 devenv "WebKit2.submit.sln" /rebuild $(BUILDSTYLE) - -xcopy "$(ConfigurationBuildDir)\bin\*.exe" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y - xcopy "$(ConfigurationBuildDir)\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y - xcopy "$(ConfigurationBuildDir)\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y - xcopy "$(ConfigurationBuildDir)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y - xcopy "$(ConfigurationBuildDir)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y - -xcopy "$(ConfigurationBuildDir)\bin\WebKit2.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit2.resources" /e/v/i/h/y + -xcopy "%ConfigurationBuildDir%\bin\*.exe" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y + xcopy "%ConfigurationBuildDir%\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y + xcopy "%ConfigurationBuildDir%\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y + xcopy "%ConfigurationBuildDir%\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y + xcopy "%ConfigurationBuildDir%\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y + -xcopy "%ConfigurationBuildDir%\bin\WebKit2.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit2.resources" /e/v/i/h/y + -xcopy "%ConfigurationBuildDir%\bin\WebKit2WebProcess.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit2WebProcess.resources" /e/v/i/h/y -mkdir "$(DSTROOT)\AppleInternal\Sources\WebKit2" - xcopy "$(ConfigurationBuildDir)\obj\WebKit\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\WebKit2" /e/v/i/h/y + xcopy "%ConfigurationBuildDir%\obj\WebKit\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\WebKit2" /e/v/i/h/y diff --git a/Source/WebKit2/win/WebKit2.vcproj b/Source/WebKit2/win/WebKit2.vcproj index 0742c6e..6d6ab21 100755 --- a/Source/WebKit2/win/WebKit2.vcproj +++ b/Source/WebKit2/win/WebKit2.vcproj @@ -399,14 +399,6 @@ > </File> <File - RelativePath="..\Shared\ShareableBitmap.cpp" - > - </File> - <File - RelativePath="..\Shared\ShareableBitmap.h" - > - </File> - <File RelativePath="..\Shared\CacheModel.h" > </File> @@ -451,6 +443,10 @@ > </File> <File + RelativePath="..\Shared\LayerTreeContext.h" + > + </File> + <File RelativePath="..\Shared\MutableArray.cpp" > </File> @@ -515,6 +511,14 @@ > </File> <File + RelativePath="..\Shared\ShareableBitmap.cpp" + > + </File> + <File + RelativePath="..\Shared\ShareableBitmap.h" + > + </File> + <File RelativePath="..\Shared\StringPairVector.h" > </File> @@ -523,6 +527,14 @@ > </File> <File + RelativePath="..\Shared\UpdateInfo.cpp" + > + </File> + <File + RelativePath="..\Shared\UpdateInfo.h" + > + </File> + <File RelativePath="..\Shared\UserMessageCoders.h" > </File> @@ -607,6 +619,14 @@ > </File> <File + RelativePath="..\Shared\WebGraphicsContext.cpp" + > + </File> + <File + RelativePath="..\Shared\WebGraphicsContext.h" + > + </File> + <File RelativePath="..\Shared\WebImage.cpp" > </File> @@ -806,6 +826,14 @@ > </File> <File + RelativePath="..\Shared\API\c\WKGraphicsContext.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKGraphicsContext.h" + > + </File> + <File RelativePath="..\Shared\API\c\WKImage.cpp" > </File> @@ -989,6 +1017,30 @@ Name="cg" > <File + RelativePath="..\Shared\API\c\cg\WKGraphicsContextCG.cpp" + > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\Shared\API\c\cg\WKGraphicsContextCG.h" + > + </File> + <File RelativePath="..\Shared\API\c\cg\WKImageCG.cpp" > <FileConfiguration @@ -1062,6 +1114,10 @@ > </File> <File + RelativePath="..\Shared\win\LayerTreeContextWin.cpp" + > + </File> + <File RelativePath="..\Shared\win\NativeWebKeyboardEventWin.cpp" > </File> @@ -1397,11 +1453,19 @@ Name="win" > <File - RelativePath="..\WebProcess\WebCoreSupport\win\WebContextMenuClientWin.cpp" + RelativePath="..\WebProcess\WebCoreSupport\win\WebDragClientWin.cpp" > </File> <File - RelativePath="..\WebProcess\WebCoreSupport\win\WebDatabaseManagerWin.cpp" + RelativePath="..\WebProcess\WebCoreSupport\win\WebDragSource.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebDragSource.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebContextMenuClientWin.cpp" > </File> <File @@ -1450,6 +1514,14 @@ > </File> <File + RelativePath="..\WebProcess\WebPage\DrawingAreaImpl.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\DrawingAreaImpl.h" + > + </File> + <File RelativePath="..\WebProcess\WebPage\EncoderAdapter.cpp" > </File> @@ -1474,6 +1546,14 @@ > </File> <File + RelativePath="..\WebProcess\WebPage\LayerTreeHost.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\LayerTreeHost.h" + > + </File> + <File RelativePath="..\WebProcess\WebPage\PageOverlay.cpp" > </File> @@ -1628,6 +1708,14 @@ /> </FileConfiguration> </File> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\Downloads\cf\win\DownloadCFNetWin.cpp" + > + </File> + </Filter> </Filter> <Filter Name="curl" @@ -1714,6 +1802,14 @@ > </File> <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleNavigationAction.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleNavigationAction.h" + > + </File> + <File RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageContextMenuClient.cpp" > </File> @@ -1746,6 +1842,22 @@ > </File> <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePagePolicyClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePagePolicyClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageResourceLoadClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageResourceLoadClient.h" + > + </File> + <File RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageUIClient.cpp" > </File> @@ -1824,6 +1936,22 @@ > </File> <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleInspector.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleInspector.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNavigationAction.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNavigationAction.h" + > + </File> + <File RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.cpp" > </File> @@ -2019,6 +2147,14 @@ Name="UIProcess" > <File + RelativePath="..\UIProcess\BackingStore.cpp" + > + </File> + <File + RelativePath="..\UIProcess\BackingStore.h" + > + </File> + <File RelativePath="..\UIProcess\ChunkedUpdateDrawingAreaProxy.cpp" > </File> @@ -2035,6 +2171,14 @@ > </File> <File + RelativePath="..\UIProcess\DrawingAreaProxyImpl.cpp" + > + </File> + <File + RelativePath="..\UIProcess\DrawingAreaProxyImpl.h" + > + </File> + <File RelativePath="..\UIProcess\FindIndicator.cpp" > </File> @@ -2726,6 +2870,10 @@ Name="win" > <File + RelativePath="..\UIProcess\win\BackingStoreWin.cpp" + > + </File> + <File RelativePath="..\UIProcess\win\ChunkedUpdateDrawingAreaProxyWin.cpp" > </File> @@ -2819,6 +2967,14 @@ > </File> <File + RelativePath="..\Platform\Region.cpp" + > + </File> + <File + RelativePath="..\Platform\Region.h" + > + </File> + <File RelativePath="..\Platform\RunLoop.cpp" > </File> @@ -2848,6 +3004,22 @@ <File RelativePath="..\Platform\cg\CGUtilities.cpp" > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\Platform\cg\CGUtilities.h" @@ -2957,6 +3129,10 @@ Name="win" > <File + RelativePath="..\Platform\CoreIPC\win\BinarySemaphoreWin.cpp" + > + </File> + <File RelativePath="..\Platform\CoreIPC\win\ConnectionWin.cpp" > </File> @@ -3095,6 +3271,22 @@ > </File> <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DrawingAreaMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DrawingAreaMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DrawingAreaProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DrawingAreaProxyMessages.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebContextMessageReceiver.cpp" > </File> diff --git a/Source/WebKit2/win/WebKit2Common.vsprops b/Source/WebKit2/win/WebKit2Common.vsprops index ab53421..b29aa75 100755 --- a/Source/WebKit2/win/WebKit2Common.vsprops +++ b/Source/WebKit2/win/WebKit2Common.vsprops @@ -6,7 +6,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)\..\Platform";"$(ProjectDir)\..\Platform\cg";"$(ProjectDir)\..\Platform\CoreIPC";"$(ProjectDir)\..\PluginProcess";"$(ProjectDir)\..\Shared";"$(ProjectDir)\..\Shared\win";"$(ProjectDir)\..\Shared\cf";"$(ProjectDir)\..\Shared\API\c";"$(ProjectDir)\..\Shared\API\c\cf";"$(ProjectDir)\..\Shared\API\c\win";"$(ProjectDir)\..\Shared\CoreIPCSupport";"$(ProjectDir)\..\Shared\Plugins";"$(ProjectDir)\..\Shared\Plugins\Netscape";"$(ProjectDir)\..\UIProcess";"$(ProjectDir)\..\UIProcess\API\C";"$(ProjectDir)\..\UIProcess\API\C\win";"$(ProjectDir)\..\UIProcess\API\cpp";"$(ProjectDir)\..\UIProcess\API\win";"$(ProjectDir)\..\UIProcess\Authentication";"$(ProjectDir)\..\UIProcess\Downloads";"$(ProjectDir)\..\UIProcess\Launcher";"$(ProjectDir)\..\UIProcess\Plugins";"$(ProjectDir)\..\UIProcess\win";"$(ProjectDir)\..\WebProcess";"$(ProjectDir)\..\WebProcess\WebCoreSupport";"$(ProjectDir)\..\WebProcess\WebCoreSupport\win";"$(ProjectDir)\..\WebProcess\WebPage";"$(ProjectDir)\..\WebProcess\WebPage\win";"$(ProjectDir)\..\WebProcess\InjectedBundle";"$(ProjectDir)\..\WebProcess\InjectedBundle\API\c";"$(ProjectDir)\..\WebProcess\InjectedBundle\DOM";"$(ProjectDir)\..\WebProcess\InjectedBundle\win";"$(ProjectDir)\..\WebProcess\Plugins";"$(ProjectDir)\..\WebProcess\Plugins\Netscape";"$(ProjectDir)\..\WebProcess\win";"$(ProjectDir)\..\WebProcess\Authentication";"$(ProjectDir)\..\WebProcess\Downloads";"$(ProjectDir)\..\WebProcess\Downloads\cf";"$(ProjectDir)\..\WebProcess\Geolocation";"$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources";"$(ConfigurationBuildDir)\Include";"$(ConfigurationBuildDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\Include\pthreads";"$(ConfigurationBuildDir)\Include\JavaScriptCore";"$(ConfigurationBuildDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(ConfigurationBuildDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders"" + AdditionalIncludeDirectories=""$(ProjectDir)\..";"$(ProjectDir)\..\Platform";"$(ProjectDir)\..\Platform\cg";"$(ProjectDir)\..\Platform\CoreIPC";"$(ProjectDir)\..\PluginProcess";"$(ProjectDir)\..\Shared";"$(ProjectDir)\..\Shared\win";"$(ProjectDir)\..\Shared\cf";"$(ProjectDir)\..\Shared\API\c";"$(ProjectDir)\..\Shared\API\c\cf";"$(ProjectDir)\..\Shared\API\c\win";"$(ProjectDir)\..\Shared\CoreIPCSupport";"$(ProjectDir)\..\Shared\Plugins";"$(ProjectDir)\..\Shared\Plugins\Netscape";"$(ProjectDir)\..\UIProcess";"$(ProjectDir)\..\UIProcess\API\C";"$(ProjectDir)\..\UIProcess\API\C\win";"$(ProjectDir)\..\UIProcess\API\cpp";"$(ProjectDir)\..\UIProcess\API\win";"$(ProjectDir)\..\UIProcess\Authentication";"$(ProjectDir)\..\UIProcess\Downloads";"$(ProjectDir)\..\UIProcess\Launcher";"$(ProjectDir)\..\UIProcess\Plugins";"$(ProjectDir)\..\UIProcess\win";"$(ProjectDir)\..\WebProcess";"$(ProjectDir)\..\WebProcess\WebCoreSupport";"$(ProjectDir)\..\WebProcess\WebCoreSupport\win";"$(ProjectDir)\..\WebProcess\WebPage";"$(ProjectDir)\..\WebProcess\WebPage\win";"$(ProjectDir)\..\WebProcess\InjectedBundle";"$(ProjectDir)\..\WebProcess\InjectedBundle\API\c";"$(ProjectDir)\..\WebProcess\InjectedBundle\DOM";"$(ProjectDir)\..\WebProcess\InjectedBundle\win";"$(ProjectDir)\..\WebProcess\Plugins";"$(ProjectDir)\..\WebProcess\Plugins\Netscape";"$(ProjectDir)\..\WebProcess\win";"$(ProjectDir)\..\WebProcess\Authentication";"$(ProjectDir)\..\WebProcess\Downloads";"$(ProjectDir)\..\WebProcess\Downloads\cf";"$(ProjectDir)\..\WebProcess\Geolocation";"$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources";"$(ConfigurationBuildDir)\Include";"$(ConfigurationBuildDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\Include\pthreads";"$(ConfigurationBuildDir)\Include\JavaScriptCore";"$(ConfigurationBuildDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(ConfigurationBuildDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders"" PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;BUILDING_WEBKIT" UsePrecompiledHeader="2" PrecompiledHeaderThrough="WebKit2Prefix.h" @@ -18,7 +18,7 @@ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib libicuin$(LibraryConfigSuffix).lib libicuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitLib$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib comsuppw.lib rpcrt4.lib zdll$(LibraryConfigSuffix).lib" OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll" AdditionalLibraryDirectories=""$(IntDir)\lib"" - DelayLoadDLLs="usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;iphlpapi.dll" + DelayLoadDLLs="usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;iphlpapi.dll" /> <Tool Name="VCResourceCompilerTool" diff --git a/Source/WebKit2/win/WebKit2Generated.make b/Source/WebKit2/win/WebKit2Generated.make index 9460ab5..506e1ed 100644 --- a/Source/WebKit2/win/WebKit2Generated.make +++ b/Source/WebKit2/win/WebKit2Generated.make @@ -1,90 +1,94 @@ all: - touch "$(CONFIGURATIONBUILDDIR)\buildfailed" - -mkdir 2>NUL "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\cf\WKStringCF.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\cf\WKURLCF.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\cf\WKURLRequestCF.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\cf\WKURLResponseCF.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\cg\WKImageCG.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\win\WKBaseWin.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\win\WKCertificateInfoWin.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKArray.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKBase.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKCertificateInfo.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\C\WKContextMenuItem.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\C\WKContextMenuItemTypes.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKData.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKDictionary.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKError.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKEvent.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKFindOptions.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKGeometry.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKImage.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKMutableArray.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKMutableDictionary.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKNumber.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKPageLoadTypes.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\C\WKSecurityOrigin.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKSerializedScriptValue.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKSerializedScriptValuePrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKString.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKStringPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKType.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKURL.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKURLRequest.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKURLResponse.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\Shared\API\c\WKUserContentURLPattern.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WebKit2.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKAuthenticationChallenge.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKAuthenticationDecisionListener.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKBackForwardList.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKBackForwardListItem.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKContext.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKContextPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKCredential.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKCredentialTypes.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKDatabaseManager.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKDownload.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKFramePolicyListener.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKGeolocationManager.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKGeolocationPermissionRequest.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKGeolocationPosition.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\c\WKInspector.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKNativeEvent.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKNavigationData.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKOpenPanelParameters.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKOpenPanelResultListener.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKPage.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKPageGroup.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKPreferences.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKProtectionSpace.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\WKProtectionSpaceTypes.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\win\WKContextPrivateWin.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\win\WKView.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\C\win\WKViewPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\UIProcess\API\cpp\WKRetainPtr.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundle.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardList.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardListItem.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFrame.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInitialize.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandlePrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.h" "$(CONFIGURATIONBUILDDIR)\include\WebKit2" - bash build-generated-files.sh "$(CONFIGURATIONBUILDDIR)" - -del "$(CONFIGURATIONBUILDDIR)\buildfailed" + touch "%ConfigurationBuildDir%\buildfailed" + -mkdir 2>NUL "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cf\WKStringCF.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cf\WKURLCF.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cf\WKURLRequestCF.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cf\WKURLResponseCF.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cg\WKImageCG.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\cg\WKGraphicsContextCG.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\win\WKBaseWin.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\win\WKCertificateInfoWin.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKArray.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKBase.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKCertificateInfo.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\C\WKContextMenuItem.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\C\WKContextMenuItemTypes.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKData.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKDictionary.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKError.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKEvent.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKFindOptions.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKGeometry.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKGraphicsContext.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKImage.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKMutableArray.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKMutableDictionary.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKNumber.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKPageLoadTypes.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\C\WKSecurityOrigin.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKSerializedScriptValue.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKSerializedScriptValuePrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKString.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKStringPrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKType.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKURL.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKURLRequest.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKURLResponse.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\Shared\API\c\WKUserContentURLPattern.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WebKit2.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKAuthenticationChallenge.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKAuthenticationDecisionListener.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKBackForwardList.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKBackForwardListItem.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKContext.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKContextPrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKCredential.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKCredentialTypes.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKDatabaseManager.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKDownload.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKFramePolicyListener.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKGeolocationManager.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKGeolocationPermissionRequest.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKGeolocationPosition.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\c\WKInspector.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKNativeEvent.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKNavigationData.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKOpenPanelParameters.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKOpenPanelResultListener.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKPage.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKPageGroup.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKPreferences.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKProtectionSpace.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\WKProtectionSpaceTypes.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\win\WKContextPrivateWin.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\win\WKView.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\C\win\WKViewPrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\UIProcess\API\cpp\WKRetainPtr.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundle.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardList.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardListItem.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFrame.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInitialize.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInspector.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNavigationAction.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandlePrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h" "%ConfigurationBuildDir%\include\WebKit2" + xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.h" "%ConfigurationBuildDir%\include\WebKit2" + bash build-generated-files.sh "%ConfigurationBuildDir%" + -del "%ConfigurationBuildDir%\buildfailed" clean: - -del "$(CONFIGURATIONBUILDDIR)\buildfailed" - -del /s /q "$(CONFIGURATIONBUILDDIR)\include\WebKit2" + -del "%ConfigurationBuildDir%\buildfailed" + -del /s /q "%ConfigurationBuildDir%\include\WebKit2" diff --git a/Source/WebKit2/win/WebKit2WebProcess.resources/Info.plist b/Source/WebKit2/win/WebKit2WebProcess.resources/Info.plist new file mode 100644 index 0000000..2b8f801 --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcess.resources/Info.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>WebKit2WebProcess</string> + <key>CFBundleGetInfoString</key> + <string>Copyright 2011 Apple Inc.</string> + <key>CFBundleIdentifier</key> + <string>com.apple.WebKit2WebProcess</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>WebKit2WebProcess</string> + <key>CFBundlePackageType</key> + <string>APPL</string> +</dict> +</plist> diff --git a/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops b/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops index 4a79706..6e3681e 100644 --- a/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops +++ b/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops @@ -10,6 +10,6 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="WebKit$(WebKitDLLConfigSuffix).lib" + AdditionalDependencies="Shlwapi.lib" /> </VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd b/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd index 26707ca..609f325 100644 --- a/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd +++ b/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd @@ -1 +1,4 @@ +mkdir 2>NUL "%OUTDIR%\..\bin\WebKit2WebProcess.resources" +xcopy /y /d "%PROJECTDIR%\WebKit2WebProcess.resources\*" "%OUTDIR%\..\bin\WebKit2WebProcess.resources" + if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd b/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd index 21af383..42fbb71 100644 --- a/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd +++ b/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd @@ -3,6 +3,6 @@ if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% cmd /c if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed" if errorlevel 1 exit 1 -echo XX$%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed" +echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed" bash "%WEBKITLIBRARIESDIR%\tools\scripts\auto-version.sh" "%INTDIR%" |