diff options
author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit2 | |
parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit2')
874 files changed, 146465 insertions, 0 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog new file mode 100644 index 0000000..f382e2e --- /dev/null +++ b/Source/WebKit2/ChangeLog @@ -0,0 +1,38187 @@ +2011-01-17 Jon Honeycutt <jhoneycutt@apple.com> + + Windows build fix. Unreviewed. + + * Shared/PrintInfo.cpp: + Use #include, not #import. + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Actually wrote a FIXME promised for a review comment. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson and Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=52595 + Make basic printing work in WebKit2 + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetShouldPrintBackgrounds): + (WKPreferencesGetShouldPrintBackgrounds): + * UIProcess/API/C/WKPreferences.h: + Implement a preference for printing backgrounds. + + * Shared/PrintInfo.cpp: Added. + (WebKit::PrintInfo::encode): + (WebKit::PrintInfo::decode): + * Shared/PrintInfo.h: Added. + * Shared/mac/PrintInfoMac.mm: Added. + (WebKit::PrintInfo::PrintInfo): + A new class for passing page setup information down to the web process. + + * WebKit2.xcodeproj/project.pbxproj: + * GNUmakefile.am: + * WebKit2.pro: + * win/WebKit2.vcproj: + Added PrintInfo. + + * Scripts/webkit2/messages.py: Added PrintInfo.h to a list of structs. + + * UIProcess/API/mac/WKView.mm: + (WKViewData): Cache page count and geometry. + (WebFrameWrapper): Added a wrapper class for adding a WebFrameProxy to an NSDictionary. + (-[WKView drawRect:]): Added logging. + (setFrameBeingPrinted): Store a frame into NSPrintOperation's NSPrintInfo, so that all + methods invoked for this operation would know what's being printed. + (frameBeingPrinted): Retrieve this data. + (-[WKView printOperationWithPrintInfo:forFrame:]): Create a print operation that's appropriate + for the frame. + (-[WKView knowsPageRange:]): Ask the web process. + (-[WKView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + Take over printing, because I couldn't make drawRect: work correctly with WebKit custom fit + to page implementation. + (-[WKView _provideTotalScaleFactorForPrintOperation:]): Help AppKit clip correctly. + (-[WKView rectForPage:]): Return a pre-calculated rect. + + * UIProcess/WebPageProxy.h: Added m_isInPrintingMode to track whether the web page is in + printing mode. The UI process controls that. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Initialize m_isInPrintingMode. + (WebKit::WebPageProxy::beginPrinting): Change printing mode in web process if the value changes. + (WebKit::WebPageProxy::endPrinting): Ditto. + (WebKit::WebPageProxy::computePagesForPrinting): Ask the web process about output page geometry. + (WebKit::WebPageProxy::drawRectToPDF): Ask the web process about printed page data. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): Delete m_printContext while there is still a Frame pointer. + (WebKit::WebPage::updatePreferences): Pass through ShouldPrintBackgrounds. + (WebKit::WebPage::beginPrinting): Switch into printing mode (or update parameters if we're + already in printing mode). + (WebKit::WebPage::endPrinting): Delete m_printContext, implicitly calling end(). + (WebKit::WebPage::computePagesForPrinting): Make sure that we're in printing mode, and + copmute page rects. + (WebKit::WebPage::drawRectToPDF): Added a CG specific function to create a PDF document out + of a page rect. It should really work for onscreen content, but we only need it for printing. + + * WebProcess/WebPage/WebPage.h: + + * WebProcess/WebPage/WebPage.messages.in: Added BeginPrinting, EndPrinting, + ComputePagesForPrinting and DrawRectToPDF. + +2011-01-17 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Fix some headers with missing or misspelled #ifndef guards + https://bugs.webkit.org/show_bug.cgi?id=52545 + + * Shared/UserMessageCoders.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + * WebProcess/WebProcessMain.h: + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Build fix. + + * Platform/Logging.cpp: + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=52592 + Add a logging channel for WKView + + * Platform/Logging.cpp: + * Platform/Logging.h: + +2011-01-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Factor bitmap context drawing code out into a shared function + https://bugs.webkit.org/show_bug.cgi?id=52589 + + * Platform/cg/CGUtilities.h: Added. + * Platform/cg/CGUtilities.cpp: Added. + (WebKit::paintBitmapContext): + New function that will paint a bitmap context into a CGContext. + + * Shared/cg/ShareableBitmapCG.cpp: + (WebKit::ShareableBitmap::paint): + Use paintBitmapContext. + + * UIProcess/mac/BackingStoreMac.mm: + (WebKit::BackingStore::paint): + (WebKit::BackingStore::scroll): + Use paintBitmapContext. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + Add CGUtilities.{cpp|h}. + +2011-01-17 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Mark Rowe. + + Update xcodeproj svn:ignore to include xcuserdata. + + * WebKit2.xcodeproj: Modified property svn:ignore. + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Fixing a typo from a bad merge. + + * UIProcess/API/mac/WKView.mm: (-[WKView canChangeFrameLayout:]): + +2011-01-17 Alexey Proskuryakov <ap@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=52590 + Should pass a frame into -[WKView canPrintHeadersAndFooters] + + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: (-[WKView canChangeFrameLayout:]): Also, renamed the method + to canChangeFrameLayout. + +2011-01-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement scrolling support + https://bugs.webkit.org/show_bug.cgi?id=52502 + + * Shared/UpdateInfo.cpp: + (WebKit::UpdateInfo::encode): + (WebKit::UpdateInfo::decode): + * Shared/UpdateInfo.h: + Add scrollRect and scrollDelta member variables. + + * UIProcess/BackingStore.h: + Add scroll member function. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::incorporateUpdate): + Repaint the scroll rect. Force a display of the view when the update info contains a scroll rect. + + * UIProcess/mac/BackingStoreMac.mm: + (WebKit::BackingStore::incorporateUpdate): + Call scroll. + + (WebKit::BackingStore::scroll): + Paint the backing store into itself. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::display): + Pass the scroll information in the update info. + +2011-01-17 Andrey Kosyakov <caseq@chromium.org> + + Unreviewed. Fixed malformed reference to WebKitVSPropsRedirectionDir that broke win build. + + * win/WebKit2.vcproj: + * win/WebKit2GeneratedCommon.vsprops: + * win/WebKit2WebProcess.vcproj: + +2011-01-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: simplify debugger enabling routine. + https://bugs.webkit.org/show_bug.cgi?id=52472 + + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::startJavaScriptDebugging): + +2011-01-17 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Crash due to double destruction of QSharedMemory + https://bugs.webkit.org/show_bug.cgi?id=52569 + + Avoid deleting the QSharedMemory twice. + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::~SharedMemory): + * Shared/qt/CleanupHandler.cpp: + Renamed m_inDeleteObjects to m_hasStartedDeleting and + added a getter for it. + (WebKit::CleanupHandler::CleanupHandler): + (WebKit::CleanupHandler::deleteObjects): + * Shared/qt/CleanupHandler.h: + (WebKit::CleanupHandler::unmark): + (WebKit::CleanupHandler::hasStartedDeleting): + +2011-01-15 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Move WebKit2 into Source + https://bugs.webkit.org/show_bug.cgi?id=52438 + + * DerivedSources.pro: + * GNUmakefile.am: + * WebKit2.pro: + * WebProcess.pro: + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + +2011-01-14 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Antti Koivisto. + + Rename cache() to memoryCache() + https://bugs.webkit.org/show_bug.cgi?id=52433 + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::shutdownIfPossible): + (WebKit::WebProcess::didClose): + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformSetCacheModel): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformSetCacheModel): + +2011-01-13 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Oliver Hunt. + + Split out a MarkedSpace strategy object from Heap. + https://bugs.webkit.org/show_bug.cgi?id=52421 + + * Shared/mac/WebMemorySampler.mac.mm: + (WebKit::WebMemorySampler::sampleWebKit): Updated for class move. + +2011-01-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add a new PageClient::displayView function and expose it on WebPageProxy + https://bugs.webkit.org/show_bug.cgi?id=52500 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::displayView): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::displayView): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::displayView): + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::displayView): + * UIProcess/win/WebView.h: + +2011-01-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement the "should paint bounds instead of indiviual rects" algorithm from WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=52499 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::shouldPaintBoundsRect): + Port code from -[WebView _mustDrawUnionedRect:singleRects:count:]. + + (WebKit::DrawingAreaImpl::display): + If shouldPaintBoundsRect returns true, clear the rects vector and append the bounds rect. + +2011-01-14 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Geoff Garen. + + ShouldLoadResourceForFrame should use strings, not URLs. + https://bugs.webkit.org/show_bug.cgi?id=52476 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::shouldLoadResourceForFrame): Pass resourceURL as a string instead of + a URL, and rename from subresourceURL to resourceURL. + +2011-01-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix for <rdar://problem/8711576> The web process should be able to read resources from the UI process. + + Based on a patch by Ivan Krstić. This also makes the NSURLCache path a sandbox parameter. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + Encode and decode the uiProcessBundleResourcePath member variable. + + * Shared/WebProcessCreationParameters.h: + Add uiProcessBundleResourcePath member variable. + + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): + Set the uiProcessBundleResourcePath member variable. + + * WebProcess/com.apple.WebProcess.sb: + Allow read-only access to UI_PROCESS_BUNDLE_RESOURCE_DIR and all subdirectories. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + When initializing the sandbox, pass UI_PROCESS_BUNDLE_RESOURCE_DIR. + + (WebKit::WebProcess::platformInitializeWebProcess): + Remove the code that would consume a sandbox extension for the url cache path. + +2011-01-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Delay initializing the sandbox until we get the InitializeWebProcess message. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::initializeSandbox): + (WebKit::WebProcess::platformInitializeWebProcess): + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2011-01-14 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Align import/export directives + https://bugs.webkit.org/show_bug.cgi?id=52208 + + * Shared/API/c/WKBase.h: Align import/export directives with + JavaScriptCore/API/JSBase.h. + +2011-01-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: extract InspectorSettings from InspectorState, + simplify it. + https://bugs.webkit.org/show_bug.cgi?id=52429 + + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + +2011-01-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Add support for drag and drop + https://bugs.webkit.org/show_bug.cgi?id=52343 + <rdar://problem/7660558> + + This patch contains the changes required to support dropping content + in WebKit on the Mac. The DragData class has been extended to provide + additional context from the application (keyboard state, modal windows, etc.) + as well as information of the drag pasteboard being used. + The support for WebKit as drag source will be added with a separate patch. + + * Shared/DragControllerAction.h: Added. + * UIProcess/API/mac/WKView.mm: + Added implemention of the methods required to add suport for a drop target. + To maintain asynchronous communication with the WebProcess, we always return + the previous calculated value for the drag operation. + (-[WKView _registerDraggedTypes]): + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView applicationFlags:]): + (-[WKView draggingEntered:]): + (-[WKView draggingUpdated:]): + (-[WKView draggingExited:]): + (-[WKView prepareForDragOperation:]): + (-[WKView performDragOperation:]): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::performDragControllerAction): + (WebKit::WebPageProxy::didPerformDragControllerAction): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::dragOperation): + (WebKit::WebPageProxy::resetDragOperation): + * UIProcess/WebPageProxy.messages.in: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebDragClient.cpp: + (WebKit::WebDragClient::willPerformDragDestinationAction): + (WebKit::WebDragClient::willPerformDragSourceAction): + (WebKit::WebDragClient::actionMaskForDrag): + (WebKit::WebDragClient::dragSourceActionMaskForPoint): + (WebKit::WebDragClient::startDrag): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::performDragControllerAction): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2011-01-13 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + Incorrect assertion in DrawingAreaImpl::scroll() + https://bugs.webkit.org/show_bug.cgi?id=52376 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::scroll): Changed to take the fast path if the rects have the same area. + This made the assertion valid, but I removed it anyway. + +2011-01-12 Balazs Kelemen <kbalazs@webkit.org> + + Unreviewed. + + Getting rid of the unused 'viewportSize' argument in QWKPagePrivate:init. + The argument is unused since http://trac.webkit.org/changeset/75468. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::init): + * UIProcess/API/qt/qwkpage_p.h: + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement DrawingAreaImpl::scroll + https://bugs.webkit.org/show_bug.cgi?id=52346 + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::scroll): + If there is already an active scroll, compute the area of both scroll rects and + invalidate the smallest one. Compute a new dirty region if necessary and also + add the scroll repaint region to the dirty region. + + (WebKit::DrawingAreaImpl::display): + Reset the scroll area and scroll delta. + + * WebProcess/WebPage/DrawingAreaImpl.h: + Add scroll area and scroll delta member variables. + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Region improvements + https://bugs.webkit.org/show_bug.cgi?id=52344 + + * Platform/Region.cpp: + (WebKit::Region::Shape::move): + (WebKit::Region::move): + Change Region::move to take an IntSize. + + * Platform/Region.h: + (WebKit::intersect): + (WebKit::subtract): + (WebKit::move): + Add convenience functions. + +2011-01-12 Ryosuke Niwa <rniwa@webkit.org> + + Unreviewed Qt build fix for r75661 + + * Shared/WebEvent.h: Don't declare phase() on non-Mac platforms. + +2011-01-12 Beth Dakin <bdakin@apple.com> + + Reviewed by Anders Carlsson. + + Add-on for https://bugs.webkit.org/show_bug.cgi?id=52309 + Expose fixed layout through WebKit SPI + -and corresponding- + <rdar://problem/8844464> + + And now with getters! + * UIProcess/API/C/WKPage.cpp: + (WKPageUseFixedLayout): + (WKPageFixedLayoutSize): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::useFixedLayout): + (WebKit::WebPageProxy::fixedLayoutSize): + +2011-01-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=52337 + PlatformWheelEvent should know about the scroll phase on the Mac + + Add a phase parameter on Mac WebWheelEvent and pipe it down to PlatformWheelEvent. + + * Shared/WebEvent.h: + (WebKit::WebWheelEvent::phase): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::WebWheelEvent): + (WebKit::WebWheelEvent::encode): + (WebKit::WebWheelEvent::decode): + * Shared/mac/WebEventFactory.mm: + (WebKit::phaseForEvent): + (WebKit::WebEventFactory::createWebWheelEvent): + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get rid of an unneeded parameter from DrawingArea::scroll + https://bugs.webkit.org/show_bug.cgi?id=52336 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::scroll): + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::scroll): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::scroll): + * WebProcess/WebPage/DrawingAreaImpl.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::scroll): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::scroll): + * WebProcess/WebPage/TiledDrawingArea.h: + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get the new drawing area painting to the screen + https://bugs.webkit.org/show_bug.cgi?id=52331 + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::incorporateUpdate): + Call setViewNeedsDisplay on all the update rects. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setViewNeedsDisplay): + Call through to the page client. + + (WebKit::WebPageProxy::processDidCrash): + Null out the drawing area proxy. + + * UIProcess/mac/BackingStoreMac.mm: + (WebKit::BackingStore::paint): + Paint. + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on getting the drawing area proxy to paint + https://bugs.webkit.org/show_bug.cgi?id=52328 + + * UIProcess/API/mac/WKView.mm: + (-[WKView drawRect:]): + Handle the new drawing area. + + * UIProcess/BackingStore.cpp: + (WebKit::BackingStore::BackingStore): + Assert that the size isn't empty. + + * UIProcess/BackingStore.h: + * UIProcess/mac/BackingStoreMac.mm: + (WebKit::BackingStore::incorporateUpdate): + Paint all update rects into the bitmap context. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::display): + Create a handle so the shareable bitmap will actually be transferred over. + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::incorporateUpdate): + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Begin stubbing out some more BackingStore member functions + https://bugs.webkit.org/show_bug.cgi?id=52323 + + * UIProcess/BackingStore.cpp: + (WebKit::BackingStore::~BackingStore): + This was accidentally made into a constructor; it should be a destructor. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::paint): + Call the backing store. + + (WebKit::DrawingAreaProxyImpl::update): + Incorporate the update. + + (WebKit::DrawingAreaProxyImpl::incorporateUpdate): + Create the backing store if needed and incorporate the update. + + * UIProcess/mac/BackingStoreMac.mm: Added. + (WebKit::BackingStore::platformInitialize): + Create a bitmap context. + + (WebKit::BackingStore::paint): + (WebKit::BackingStore::incorporateUpdate): + Add stubs. + + * WebKit2.xcodeproj/project.pbxproj: + Add BackingStoreMac.mm + +2011-01-12 Beth Dakin <bdakin@apple.com> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=52309 Expose + fixed layout through WebKit SPI + -and corresponding- + <rdar://problem/8844464> + + Store useFixedLayout and fixedLayoutSize in the + WebPageCreationParameters and the WebPageProxy. + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + * Shared/WebPageCreationParameters.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageSetUseFixedLayout): + (WKPageSetFixedLayoutSize): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::setUseFixedLayout): + (WebKit::WebPageProxy::setFixedLayoutSize): + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setUseFixedLayout): + (WebKit::WebPage::setFixedLayoutSize): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Beth Dakin. + + Add BackingStore class + https://bugs.webkit.org/show_bug.cgi?id=52318 + + * UIProcess/BackingStore.cpp: Added. + (WebKit::BackingStore::create): + (WebKit::BackingStore::BackingStore): + * UIProcess/BackingStore.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2011-01-12 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8837307>, <rdar://problem/8637038>, and https://bugs.webkit.org/show_bug.cgi?id=52248 + Back/forward list recovery after a WebProcess crash is crashy itself. + + Add an isEmpty() accessor so the WebProcess knows if it is actually restoring a session: + * Shared/SessionState.cpp: + (WebKit::SessionState::isEmpty): + * Shared/SessionState.h: + + Keep track of the highest used itemID so a relaunched WebProcess can later be informed: + * Shared/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::WebBackForwardListItem): + (WebKit::WebBackForwardListItem::highedUsedItemID): + * Shared/WebBackForwardListItem.h: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::generateHistoryItemID): + (WebKit::WebBackForwardListProxy::setHighestItemIDFromUIProcess): + (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Remove a now-invalid ASSERT, as the UIProcess + now tells the WebProcess that a previous WebProcess created. + * WebProcess/WebPage/WebBackForwardListProxy.h: + + Encode/decode data relevant to restoring a session on WebPage creation: + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + * Shared/WebPageCreationParameters.h: + + If the WebProcess has crashed since the last load, change reload and the various back/forward APIs to + update the current back/forward item (if necessary) then relaunch the process: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::reattachToWebProcessWithItem): + (WebKit::WebPageProxy::reattachToWebProcess): Renamed from "relaunch()" and made private. + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::loadURLRequest): + (WebKit::WebPageProxy::reload): + (WebKit::WebPageProxy::goForward): + (WebKit::WebPageProxy::goBack): + (WebKit::WebPageProxy::goToBackForwardItem): + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + + Rename "RestoreSession" to "RestoreSessionAndNavigateToCurrentItem" + * WebProcess/WebPage/WebPage.messages.in: + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::restoreFromSessionStateData): + + Restore a session on page creation if the parameters include it: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Call restoreSession if session state exists. + (WebKit::WebPage::restoreSessionAndNavigateToCurrentItem): + (WebKit::WebPage::restoreSession): + * WebProcess/WebPage/WebPage.h: + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send Update and DidUpdate messages + https://bugs.webkit.org/show_bug.cgi?id=52316 + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::update): + Add empty stub. + + * UIProcess/DrawingAreaProxy.messages.in: + Add Update message. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::update): + Just send back a DidUpdate message. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::didUpdate): + Add empty stub. + + * WebProcess/WebPage/DrawingArea.messages.in: + Add DidUpdate message. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::didUpdate): + Call display(). + + (WebKit::DrawingAreaImpl::display): + Send an Update message. + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make the new drawing area actually draw something + https://bugs.webkit.org/show_bug.cgi?id=52314 + + * Shared/UpdateInfo.cpp: + (WebKit::UpdateInfo::encode): + (WebKit::UpdateInfo::decode): + Encode and decode newly added fields. + + * Shared/UpdateInfo.h: + Add a vector of update rects and a handle for the sharable bitmap. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::display): + Get the individual rects from the region and paint them into the shareable bitmap. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::mainFrameHasCustomRepresentation): + * WebProcess/WebPage/WebPage.h: + Add helper function. + + * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp: + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + Use helper function. + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add UpdateInfo class + https://bugs.webkit.org/show_bug.cgi?id=52306 + + * Shared/UpdateInfo.cpp: Added. + (WebKit::UpdateInfo::encode): + (WebKit::UpdateInfo::decode): + * Shared/UpdateInfo.h: Added. + (WebKit::UpdateInfo::UpdateInfo): + * WebKit2.xcodeproj/project.pbxproj: + +2011-01-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on the new drawing area implementation + https://bugs.webkit.org/show_bug.cgi?id=52302 + + * Platform/Region.cpp: + (WebKit::Region::Shape::segments_end): + segments_end could end up returning an iterator that is one element past the Vector data, so + we can't use operator[] since that will assert. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::DrawingAreaImpl): + Initialize the timer. + + (WebKit::DrawingAreaImpl::setNeedsDisplay): + Unite the rect with the dirty region and schedule a display. + + (WebKit::DrawingAreaImpl::setSize): + Tell the web page to resize. + + (WebKit::DrawingAreaImpl::scheduleDisplay): + Start a display timer if needed. + + (WebKit::DrawingAreaImpl::display): + Add a stub. + +2011-01-12 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix after r75527. Rename 'BackingStoreCairo.cpp' + to 'ShareableBitmapCairo.cpp' to match VS project changes. + + * Shared/cairo/BackingStoreCairo.cpp: Removed. + * Shared/cairo/ShareableBitmapCairo.cpp: Copied from Shared/cairo/BackingStoreCairo.cpp. + +2011-01-11 Jeff Miller <jeffm@apple.com> + + Reviewed by John Sullivan. + + WebKit2: "Webpages not responding" dialog appears when <select> popup menu is showing + https://bugs.webkit.org/show_bug.cgi?id=52242 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showPopupMenu): + On Windows, stop the responsiveness timer before calling showPopupMenu(). + +2011-01-11 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + UIProcess kills the WebProcess sometimes when detached frames exist + https://bugs.webkit.org/show_bug.cgi?id=52227 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didSaveFrameToPageCache): Don't consider the message invalid + if it came in for a detached frame. + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Build fix. + + * WebKit2.xcodeproj/project.pbxproj: + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a Region class which represents a graphical region + https://bugs.webkit.org/show_bug.cgi?id=52255 + + * Platform/Region.cpp: Added. + (WebKit::Region::Region): + (WebKit::Region::rects): + (WebKit::Region::Shape::Shape): + (WebKit::Region::Shape::appendSpan): + (WebKit::Region::Shape::canCoalesce): + (WebKit::Region::Shape::appendSpans): + (WebKit::Region::Shape::appendSegment): + (WebKit::Region::Shape::spans_begin): + (WebKit::Region::Shape::spans_end): + (WebKit::Region::Shape::segments_begin): + (WebKit::Region::Shape::segments_end): + (WebKit::Region::Shape::dump): + (WebKit::Region::Shape::bounds): + (WebKit::Region::Shape::move): + (WebKit::Region::Shape::swap): + (WebKit::Region::Shape::shapeOperation): + (WebKit::Region::Shape::UnionOperation::trySimpleOperation): + (WebKit::Region::Shape::unionShapes): + (WebKit::Region::Shape::IntersectOperation::trySimpleOperation): + (WebKit::Region::Shape::intersectShapes): + (WebKit::Region::Shape::SubtractOperation::trySimpleOperation): + (WebKit::Region::Shape::subtractShapes): + (WebKit::Region::dump): + (WebKit::Region::intersect): + (WebKit::Region::unite): + (WebKit::Region::subtract): + (WebKit::Region::move): + * Platform/Region.h: Added. + (WebKit::Region::bounds): + (WebKit::Region::isEmpty): + (WebKit::Region::Span::Span): + (WebKit::Region::Shape::isEmpty): + * WebKit2.xcodeproj/project.pbxproj: + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add DidSetSize message + https://bugs.webkit.org/show_bug.cgi?id=52254 + + * DerivedSources.make: + Add DrawingAReaProxy.messages.in. + + * Platform/CoreIPC/MessageID.h: + Add DrawingAreaProxy message class. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::didSetSize): + Add CoreIPC message handler function. + + * UIProcess/DrawingAreaProxy.messages.in: Added. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::didSetSize): + Add stub. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + Handle DrawingAreaProxy messages. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit::DrawingAreaImpl::setSize): + Send a DidSetSize message for now. + +2011-01-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix spelling mistake. Sharable -> Shareable. + + * Shared/API/c/WKImage.h: + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toImageOptions): + * Shared/ImageOptions.h: + * Shared/WebImage.cpp: + (WebKit::WebImage::create): + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add SetSize message + https://bugs.webkit.org/show_bug.cgi?id=52247 + + * DerivedSources.make: + Add DrawingArea.messages.in + + * Platform/CoreIPC/MessageID.h: + Add DrawingArea message class. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::sizeDidChange): + Call sendSetSize. + + (WebKit::DrawingAreaProxyImpl::sendSetSize): + Send a SetSize message. + + * UIProcess/DrawingAreaProxyImpl.h: + Add setSize override. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::setSize): + Add setSize member function. + + * WebProcess/WebPage/DrawingArea.messages.in: Added. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: + * WebProcess/WebPage/DrawingAreaImpl.h: + Add setSize. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): + Handle drawing area messages. + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Replace ASSERTs with FIXMEs. + + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::sizeDidChange): + (WebKit::DrawingAreaProxyImpl::setPageIsVisible): + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add DrawingAreaImpl skeleton class + https://bugs.webkit.org/show_bug.cgi?id=52246 + + * UIProcess/API/mac/WKView.mm: + (useNewDrawingArea): + New function which controls which drawing area to use, through an environment variable. + + (-[WKView drawRect:]): + Bail if we're using the new drawing area (for now). + + (-[WKView WebKit::]): + Create a DrawingAreaProxyImpl when asked to. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + Create a DrawingAreaImpl when asked to. + + * WebProcess/WebPage/DrawingAreaImpl.cpp: Added. + * WebProcess/WebPage/DrawingAreaImpl.h: Added. + Add DrawingAreaImpl class. + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add Mac-only DrawingAreaProxyImpl class skeleton + https://bugs.webkit.org/show_bug.cgi?id=52243 + + This is the proxy side of a new drawing area implementation. This is Mac only for now + while the design is being fleshed out. + + * Shared/DrawingAreaInfo.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::]): + * UIProcess/DrawingAreaProxyImpl.cpp: Added. + (WebKit::DrawingAreaProxyImpl::create): + (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): + (WebKit::DrawingAreaProxyImpl::~DrawingAreaProxyImpl): + (WebKit::DrawingAreaProxyImpl::didReceiveMessage): + (WebKit::DrawingAreaProxyImpl::didReceiveSyncMessage): + (WebKit::DrawingAreaProxyImpl::paint): + (WebKit::DrawingAreaProxyImpl::sizeDidChange): + (WebKit::DrawingAreaProxyImpl::setPageIsVisible): + (WebKit::DrawingAreaProxyImpl::attachCompositingContext): + (WebKit::DrawingAreaProxyImpl::detachCompositingContext): + * UIProcess/DrawingAreaProxyImpl.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename ShareableBitmap::createSharable to createShareable + https://bugs.webkit.org/show_bug.cgi?id=52234 + + * Shared/ShareableBitmap.cpp: + (WebKit::ShareableBitmap::createShareable): + * Shared/ShareableBitmap.h: + * Shared/WebImage.cpp: + (WebKit::WebImage::create): + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::geometryDidChange): + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindIndicator): + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename BackingStore to ShareableBitmap + https://bugs.webkit.org/show_bug.cgi?id=52228 + + * GNUmakefile.am: + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::geometryDidChange): + * PluginProcess/PluginControllerProxy.h: + * Shared/API/c/cg/WKImageCG.cpp: + (WKImageCreateCGImage): + * Shared/BackingStore.cpp: Removed. + * Shared/BackingStore.h: Removed. + * Shared/PlatformPopupMenuData.cpp: + (WebKit::PlatformPopupMenuData::decode): + * Shared/PlatformPopupMenuData.h: + * Shared/ShareableBitmap.cpp: Copied from WebKit2/Shared/BackingStore.cpp. + (WebKit::ShareableBitmap::create): + (WebKit::ShareableBitmap::createSharable): + (WebKit::ShareableBitmap::createHandle): + (WebKit::ShareableBitmap::ShareableBitmap): + (WebKit::ShareableBitmap::~ShareableBitmap): + (WebKit::ShareableBitmap::resize): + (WebKit::ShareableBitmap::data): + * Shared/ShareableBitmap.h: Copied from WebKit2/Shared/BackingStore.h. + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + * Shared/WebImage.cpp: + (WebKit::WebImage::create): + (WebKit::WebImage::WebImage): + (WebKit::WebImage::~WebImage): + (WebKit::WebImage::size): + * Shared/WebImage.h: + (WebKit::WebImage::bitmap): + * Shared/cairo/BackingStoreCairo.cpp: + (WebKit::ShareableBitmap::createGraphicsContext): + (WebKit::ShareableBitmap::paint): + * Shared/cg/BackingStoreCG.cpp: Removed. + * Shared/cg/ShareableBitmapCG.cpp: Copied from WebKit2/Shared/cg/BackingStoreCG.cpp. + (WebKit::ShareableBitmap::createGraphicsContext): + (WebKit::ShareableBitmap::paint): + * Shared/gtk/BackingStoreGtk.cpp: Removed. + * Shared/gtk/ShareableBitmapGtk.cpp: Copied from WebKit2/Shared/gtk/BackingStoreGtk.cpp. + (WebKit::ShareableBitmap::createGraphicsContext): + (WebKit::ShareableBitmap::paint): + * Shared/qt/BackingStoreQt.cpp: Removed. + * Shared/qt/ShareableBitmapQt.cpp: Copied from WebKit2/Shared/qt/BackingStoreQt.cpp. + (WebKit::ShareableBitmap::createGraphicsContext): + (WebKit::ShareableBitmap::paint): + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::create): + (WebKit::FindIndicator::FindIndicator): + * UIProcess/FindIndicator.h: + (WebKit::FindIndicator::contentImage): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::geometryDidChange): + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindIndicator): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::snapshotInViewCoordinates): + (WebKit::WebPage::snapshotInDocumentCoordinates): + * win/WebKit2.vcproj: + +2011-01-11 John Sullivan <sullivan@apple.com> + + Reviewed by Anders Carlsson. + + [WKView setFrameSize:] derefs _page->drawingArea() without null check + <https://bugs.webkit.org/show_bug.cgi?id=52231> + + * UIProcess/API/mac/WKView.mm: + (-[WKView setFrameSize:]): + Null check drawingArea(). This is OK because if it doesn't exist then it will be + created later with the correct initial size. + +2011-01-07 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Paste and drag and drop use different code paths to interact with the pasteboard. + https://bugs.webkit.org/show_bug.cgi?id=52093 + The change consists in a refactoring of the code to have only one class that + deals with the pasteboard on Mac. + + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Added two methods to provide to WebCore functionality + exposed by NSURLExtras. + (WebKit::WebEditorClient::canonicalizeURL): + (WebKit::WebEditorClient::canonicalizeURLString): + +2011-01-11 Jessie Berlin <jberlin@apple.com> + + Reviewed by Anders Carlsson and Sam Weinig. + + Fix crash on launch on Windows. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onSizeEvent): + The drawing area is no longer initialized before the WebView is created and the first + onSize is receieved. + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Automatically reinitialize the web page on relaunch + https://bugs.webkit.org/show_bug.cgi?id=52224 + <rdar://problem/8765695> + + * UIProcess/API/mac/WKView.mm: + (-[WKView _didRelaunchProcess]): + Remove call to reinitializeWebPage. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::relaunch): + Call initializeWebPage(). + + (WebKit::WebPageProxy::initializeWebPage): + Assert that the web page is valid here. + + * UIProcess/WebPageProxy.h: + Remove reinitializeWebPage. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::didRelaunchProcess): + Remove call to reinitializeWebPage. + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass the view size to the DrawingAreaProxy constructor + https://bugs.webkit.org/show_bug.cgi?id=52189 + + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::viewSize): + * UIProcess/WebPageProxy.h: + +2011-01-11 Sam Weinig <sam@webkit.org> + + Roll r75460 back in with build fix. + +2011-01-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Andreas Kling. + + Work towards having the WebPageProxy decide when to create the DrawingAreaProxy + https://bugs.webkit.org/show_bug.cgi?id=52184 + + Qt part made my Balazs Kelemen. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::createDrawingAreaProxy): + Call -[WKView _createDrawingAreaProxy]. + + (WebKit::PageClientImpl::setViewNeedsDisplay): + Call setNeedsDisplayInRect on the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + No need to set the drawing area proxy anymore. + + (-[WKView _createDrawingAreaProxy]): + Create a chunked update drawing area proxy for now. + + * UIProcess/API/qt/qgraphicswkview.cpp: + Added a QGraphicsItem* member that is initialized in init to the accociated view. + Implement the new functions. This is a temporary solution, in the long term the view + and the page should be decoupled. + (QGraphicsWKView::QGraphicsWKView): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::init): + (QWKPagePrivate::createDrawingAreaProxy): + (QWKPagePrivate::setViewNeedsDisplay): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + + * UIProcess/PageClient.h: + Add new pure virtual member functions. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + Set the new drawing area proxy. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + No need to set the drawing area proxy anymore. + + (WebKit::WebView::createDrawingAreaProxy): + Create a chunked update drawing area proxy for now. + + (WebKit::WebView::setViewNeedsDisplay): + Invalidate the window. + +2011-01-11 Adam Roben <aroben@apple.com> + + Fix a typo in a comment + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + +2011-01-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r75460. + http://trac.webkit.org/changeset/75460 + https://bugs.webkit.org/show_bug.cgi?id=52191 + + It broke Qt-WK2 build (Requested by Ossy on #webkit). + + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKGeolocationPermissionRequest.cpp: Removed. + * UIProcess/API/C/WKGeolocationPermissionRequest.h: Removed. + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WebKit2.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: Removed. + * UIProcess/GeolocationPermissionRequestManagerProxy.h: Removed. + * UIProcess/GeolocationPermissionRequestProxy.cpp: Removed. + * UIProcess/GeolocationPermissionRequestProxy.h: Removed. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + * UIProcess/WebUIClient.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: Removed. + * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: Removed. + * WebProcess/Geolocation/WebGeolocationManager.cpp: + * WebProcess/Geolocation/WebGeolocationManager.h: + * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: + (WebKit::WebGeolocationClient::requestPermission): + (WebKit::WebGeolocationClient::cancelPermissionRequest): + * WebProcess/WebCoreSupport/WebGeolocationClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2011-01-10 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed, rolling out r75459 + http://trac.webkit.org/changeset/75459 + + Work towards having the WebPageProxy decide when to create the DrawingAreaProxy + https://bugs.webkit.org/show_bug.cgi?id=52184 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/mac/WKView.mm: + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * UIProcess/win/WebView.h: + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove size parameter to WebPageProxy::initializeWebPage + https://bugs.webkit.org/show_bug.cgi?id=52188 + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::init): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Didn't mean to land this. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + * UIProcess/WebPageProxy.h: + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebPageProxy::creationParameters no longer needs to take a size + https://bugs.webkit.org/show_bug.cgi?id=52187 + + WebPageProxy::creationParameters can just ask the page client for the view size now. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::createInspectorPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + (WebKit::WebPageProxy::createNewPage): + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass information about the view in the WebPageCreationParameters + https://bugs.webkit.org/show_bug.cgi?id=52186 + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + Encode and decode the state flags. + + * Shared/WebPageCreationParameters.h: + Add new state flags. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::creationParameters): + Initialize the state flags. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + Update the page state from the state flags. + +2011-01-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make Geolocation features work in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=52078 + + Step 2 - Add support for requesting and granting permission for geolocation. + + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * UIProcess/API/C/WebKit2.h: + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKGeolocationPermissionRequest.cpp: Added. + * UIProcess/API/C/WKGeolocationPermissionRequest.h: Added. + Add new API type, WKGeolocationPermissionRequestRef. + + * UIProcess/API/C/WKPage.h: + Add new UIClient function for requesting permission. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + Stub out the UIClient. + + * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: Added. + * UIProcess/GeolocationPermissionRequestManagerProxy.h: Added. + * UIProcess/GeolocationPermissionRequestProxy.cpp: Added. + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + * UIProcess/WebUIClient.h: + * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: Added. + * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: Added. + * WebProcess/Geolocation/WebGeolocationManager.cpp: + * WebProcess/Geolocation/WebGeolocationManager.h: + * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: + * WebProcess/WebCoreSupport/WebGeolocationClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::didReceiveGeolocationPermissionDecision): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::geolocationPermissionRequestManager): + * WebProcess/WebPage/WebPage.messages.in: + Track the permission request through both sides of the process divide. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Work towards having the WebPageProxy decide when to create the DrawingAreaProxy + https://bugs.webkit.org/show_bug.cgi?id=52184 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::createDrawingAreaProxy): + Call -[WKView _createDrawingAreaProxy]. + + (WebKit::PageClientImpl::setViewNeedsDisplay): + Call setNeedsDisplayInRect on the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + No need to set the drawing area proxy anymore. + + (-[WKView _createDrawingAreaProxy]): + Create a chunked update drawing area proxy for now. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createDrawingAreaProxy): + (QWKPagePrivate::setViewNeedsDisplay): + Add stubs. + + * UIProcess/PageClient.h: + Add new pure virtual member functions. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + Set the new drawing area proxy. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + No need to set the drawing area proxy anymore. + + (WebKit::WebView::createDrawingAreaProxy): + Create a chunked update drawing area proxy for now. + + (WebKit::WebView::setViewNeedsDisplay): + Invalidate the window. + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Fix Windows build again. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::isViewWindowActive): + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onShowWindowEvent): + +2011-01-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Use a pull model for view state changes + https://bugs.webkit.org/show_bug.cgi?id=52175 + + Instead of having the WKView call setFocused, setActive etc on the WebPageProxy, the + WKView now simply informs the WebPageProxy what has changed, using the WebPageProxy::viewStateDidChange + function. The WebPageProxy can then fetch the relevant information using newly added PageClient functions. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::viewSize): + (WebKit::PageClientImpl::isViewWindowActive): + (WebKit::PageClientImpl::isViewFocused): + (WebKit::PageClientImpl::isViewVisible): + (WebKit::PageClientImpl::isViewInWindow): + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView becomeFirstResponder]): + (-[WKView resignFirstResponder]): + (-[WKView viewDidMoveToWindow]): + (-[WKView _windowDidBecomeKey:]): + (-[WKView _windowDidResignKey:]): + (-[WKView viewDidHide]): + (-[WKView viewDidUnhide]): + (-[WKView _isFocused]): + (-[WKView _didRelaunchProcess]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::focusInEvent): + (QGraphicsWKView::focusOutEvent): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::viewSize): + (QWKPagePrivate::isViewWindowActive): + (QWKPagePrivate::isViewFocused): + (QWKPagePrivate::isViewVisible): + (QWKPagePrivate::isViewInWindow): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::createWebPage): + * UIProcess/WebContext.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::create): + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::viewStateDidChange): + * UIProcess/WebPageProxy.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::createWebPage): + * UIProcess/WebProcessProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::onSetFocusEvent): + (WebKit::WebView::onKillFocusEvent): + (WebKit::WebView::onShowWindowEvent): + (WebKit::WebView::updateActiveState): + (WebKit::WebView::viewSize): + (WebKit::WebView::isViewWindowActive): + (WebKit::WebView::isViewFocused): + (WebKit::WebView::isViewVisible): + (WebKit::WebView::isViewInWindow): + (WebKit::WebView::didRelaunchProcess): + (WebKit::WebView::setIsInWindow): + * UIProcess/win/WebView.h: + +2011-01-10 Adam Roben <aroben@apple.com> + + Don't pass a reference type to va_start + + C++ says this results in undefined behavior: + + The restrictions that ISO C places on the second parameter to the + va_start() macro in header <stdarg.h> are different in this + International Standard. The parameter parmN is the identifier of + the rightmost parameter in the variable parameter list of the + function definition (the one just before the ...).221) If the + parameter parmN is declared with a function, array, or reference + type, or with a type that is not compatible with the type that + results when passing an argument for which there is no parameter, + the behavior is undefined. + + Fixes <http://webkit.org/b/52168> Title of standalone image document + includes bogus image dimensions + + Rubber-stamped by Eric Seidel. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::formatLocalizedString): Don't use a reference type for + |format|. + +2011-01-10 Siddharth Mathur <siddharth.mathur@nokia.com> + + Reviewed by Eric Seidel. + + Support for ARM's RVCT(ARMCC) compiler in import/export directives + https://bugs.webkit.org/show_bug.cgi?id=52146 + + * Shared/API/c/WKBase.h: + +2011-01-10 Sam Weinig <sam@webkit.org> + + Fix the build. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2011-01-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make Geolocation features work in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=52078 + + Step 1 - Add enough support to get position data from a provider. + This does not include permission support. + + * Platform/CoreIPC/HandleMessage.h: + Add #include of Arguments.h for CoreIPC::In and Out definitions. + + * Platform/CoreIPC/MessageID.h: + Add new message types. + + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + Add new API types. + + * Shared/WebGeolocationPosition.cpp: Added. + * Shared/WebGeolocationPosition.h: Added. + Internal position representation. + + * UIProcess/API/C/WKAPICast.h: + Add casts for new API types. + + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKGeolocationManager.cpp: Added. + * UIProcess/API/C/WKGeolocationManager.h: Added. + * UIProcess/API/C/WKGeolocationPosition.cpp: Added. + * UIProcess/API/C/WKGeolocationPosition.h: Added. + * UIProcess/API/C/WebKit2.h: + Add API to provide and control geolocation data. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + (WebKit::WebContext::processDidClose): + (WebKit::WebContext::didReceiveMessage): + * UIProcess/WebContext.h: + (WebKit::WebContext::geolocationManagerProxy): + * UIProcess/WebGeolocationManagerProxy.cpp: Added. + (WebKit::WebGeolocationManagerProxy::create): + (WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy): + (WebKit::WebGeolocationManagerProxy::~WebGeolocationManagerProxy): + (WebKit::WebGeolocationManagerProxy::invalidate): + (WebKit::WebGeolocationManagerProxy::initializeProvider): + (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): + (WebKit::WebGeolocationManagerProxy::providerDidFailToDeterminePosition): + (WebKit::WebGeolocationManagerProxy::didReceiveMessage): + (WebKit::WebGeolocationManagerProxy::startUpdating): + (WebKit::WebGeolocationManagerProxy::stopUpdating): + * UIProcess/WebGeolocationManagerProxy.h: Added. + (WebKit::WebGeolocationManagerProxy::clearContext): + (WebKit::WebGeolocationManagerProxy::type): + * UIProcess/WebGeolocationManagerProxy.messages.in: Added. + * UIProcess/WebGeolocationProvider.cpp: Added. + (WebKit::WebGeolocationProvider::startUpdating): + (WebKit::WebGeolocationProvider::stopUpdating): + * UIProcess/WebGeolocationProvider.h: Added. + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + * WebProcess/Geolocation: Added. + * WebProcess/Geolocation/WebGeolocationManager.cpp: Added. + (WebKit::WebGeolocationManager::WebGeolocationManager): + (WebKit::WebGeolocationManager::~WebGeolocationManager): + (WebKit::WebGeolocationManager::didReceiveMessage): + (WebKit::WebGeolocationManager::registerWebPage): + (WebKit::WebGeolocationManager::unregisterWebPage): + (WebKit::WebGeolocationManager::didChangePosition): + (WebKit::WebGeolocationManager::didFailToDeterminePosition): + * WebProcess/Geolocation/WebGeolocationManager.h: Added. + * WebProcess/Geolocation/WebGeolocationManager.messages.in: Added. + * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: Added. + (WebKit::WebGeolocationClient::geolocationDestroyed): + (WebKit::WebGeolocationClient::startUpdating): + (WebKit::WebGeolocationClient::stopUpdating): + (WebKit::WebGeolocationClient::setEnableHighAccuracy): + (WebKit::WebGeolocationClient::lastPosition): + (WebKit::WebGeolocationClient::requestPermission): + (WebKit::WebGeolocationClient::cancelPermissionRequest): + * WebProcess/WebCoreSupport/WebGeolocationClient.h: Added. + (WebKit::WebGeolocationClient::WebGeolocationClient): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::geolocationManager): + Pipe geolocation positions/errors from the UIProcess to the WebProcess. + + * DerivedSources.make: + * DerivedSources.pro: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + * win/WebKit2Generated.make: + Add new files. + +2011-01-10 Martin Robinson <mrobinson@igalia.com> + + GTK+ build fix. Continue to fix 'make dist.' + + * GNUmakefile.am: Remove more non-existent files from the WebKit2 build. + +2011-01-10 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Remove webkit2 files that are still not added to the + repository from the makefile + https://bugs.webkit.org/show_bug.cgi?id=52145 + + This change is required for the release, we can add the lines + again to the makefiles with the patches adding the files. + + * GNUmakefile.am: + +2011-01-10 Andreas Kling <kling@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] [WK2] MiniBrowser does not load pages opened in new windows + https://bugs.webkit.org/show_bug.cgi?id=52111 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::context): Implement this method. + +2011-01-09 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/8839498> Assertion failure in KURL::KURL when calling WKURLRequestCreateWithWKURL with a non-parsed URL + https://bugs.webkit.org/show_bug.cgi?id=52132 + + * Shared/API/c/WKURLRequest.cpp: + (WKURLRequestCreateWithWKURL): Parse the URL. + * Shared/WebString.h: Fixed a comment. + * Shared/WebURL.h: Ditto. + +2011-01-09 Amruth Raj <amruthraj@motorola.com> and Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + Changes to add Process Launcher and Thread Launcher implementation to the WebKit2 GTK port. + The main() implementation for WebKitWebProcess binary to launch Web process from UI process. + https://bugs.webkit.org/show_bug.cgi?id=48511 + + * UIProcess/Launcher/gtk: Added. + * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp: Added. GTK (UNIX_X11 specific) implementation + (WebKit::ProcessLauncher::launchProcess): + (WebKit::ProcessLauncher::terminateProcess): + (WebKit::ProcessLauncher::platformInvalidate): + * UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::ThreadLauncher::createWebThread): + * WebProcess/gtk: Added. + * WebProcess/gtk/WebProcessGtk.cpp: Added. The stubbed implementations of virtual functions of WebProcess.h for GTK port. + (WebKit::WebProcess::platformSetCacheModel): + (WebKit::WebProcess::platformClearResourceCaches): + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::platformShutdown): + * WebProcess/gtk/WebProcessMainGtk.cpp: Added. The WebProcessMain call which initiates the Web Process for GTK port. + (WebKit::WebProcessMainGtk): + * WebProcess/gtk/WebProcessMainGtk.h: Added. The WebProcessMain declaration for Web Process for GTK port. + * gtk/MainGtk.cpp: Added. The main function implementation for binary WebKitWebProcess. + (main): + +2011-01-07 Amruth Raj <amruthraj@motorola.com> and Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + [GTK] WebKit2 GNUmakefile is out of date from trunk + https://bugs.webkit.org/show_bug.cgi?id=51883 + + * GNUmakefile.am: Updated sources list as per latest revision + * Platform/gtk/RunLoopGtk.cpp: + (RunLoop::TimerBase::start): + * Platform/gtk/WorkQueueGtk.cpp: + (WorkQueue::scheduleWorkAfterDelay): + * Shared/gtk/BackingStoreGtk.cpp: + (WebKit::BackingStore::paint): + * WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp: + (WebKit::InjectedBundle::load): + * WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp: + (WebKit::NetscapePlugin::platformInvalidate): + +2011-01-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8812759> In WebKit2, PDF view settings (mode and scale) do not stick + https://bugs.webkit.org/show_bug.cgi?id=52118 + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::encode): Encode the double values map. + (WebKit::WebPreferencesStore::decode): Decode the double values map. + (WebKit::defaultValueForKey): Added double instance. + (WebKit::WebPreferencesStore::setDoubleValueForKey): Added. + (WebKit::WebPreferencesStore::getDoubleValueForKey): Added. + * Shared/WebPreferencesStore.h: Added PDFScaleFactor and PDFDisplayMode preferences. + * UIProcess/API/mac/PDFViewController.mm: + (-[WKPDFView initWithFrame:PDFViewController:WebKit::]): Initialize the _pdfViewController ivar. + (-[WKPDFView invalidate]): Changed 'nil' to '0' in assignment to a non-Objective-C pointer. + (-[WKPDFView setDocument:]): Added. + (-[WKPDFView _applyPDFPreferences]): Added. + (-[WKPDFView _updatePreferences:]): Added. + (-[WKPDFView _updatePreferencesSoon]): Added. + (-[WKPDFView _scaleOrDisplayModeOrPageChanged:]): Added. + (-[WKPDFView viewDidMoveToWindow]): Added. Starts observing the PDF view for changes to scale + and display mode. + (-[WKPDFView viewWillMoveToWindow:]): Added. Stops observing for changes. + (WebKit::PDFViewController::setPDFDocumentData): Changed to call throguh -[WKPDFView setDocument:]. + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::updateDoubleValueForKey): Added. + * UIProcess/WebPreferences.h: + * UIProcess/cf/WebPreferencesCF.cpp: + (WebKit::WebPreferences::platformUpdateDoubleValueForKey): Added empty implementation. + * UIProcess/gtk/WebPreferencesGtk.cpp: + (WebKit::WebPreferences::platformUpdateDoubleValueForKey): Added stub. + * UIProcess/mac/WebPreferencesMac.mm: + (WebKit::setDoubleValueIfInUserDefaults): Added. + (WebKit::WebPreferences::platformUpdateDoubleValueForKey): Added. + * UIProcess/qt/WebPreferencesQt.cpp: + (WebKit::WebPreferences::platformUpdateDoubleValueForKey): Added. + +2011-01-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Maciej Stachowiak. + + In WebKit2, page zooming does not work with PDF + https://bugs.webkit.org/show_bug.cgi?id=52113 + + * UIProcess/API/C/WKPage.cpp: + (WKPageSupportsTextZoom): Added. Returns whether the page currently supports text-only zoom. + * UIProcess/API/C/WKPage.h: + * UIProcess/API/mac/PDFViewController.h: Made pdfDocumentClass() private and declared new + member functions. + * UIProcess/API/mac/PDFViewController.mm: + (WebKit::PDFViewController::zoomFactor): Added. + (WebKit::PDFViewController::setZoomFactor): Added. + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::customRepresentationZoomFactor): Added. Calls through to the WKView. + (WebKit::PageClientImpl::setCustomRepresentationZoomFactor): Ditto. + * UIProcess/API/mac/WKView.mm: + (-[WKView _customRepresentationZoomFactor]): Added. Calls through to the PDFViewController. + (-[WKView _setCustomRepresentationZoomFactor:]): Ditto. + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::customRepresentationZoomFactor): Added. + (QWKPagePrivate::setCustomRepresentationZoomFactor): Added. + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Coding style fix. + (WebKit::WebPageProxy::supportsTextZoom): Added. Returns false if the main frame has a custom + representation or is a standalone image, true otherwise. + (WebKit::WebPageProxy::setTextZoomFactor): Bail out if the main frame has a custom representation. + (WebKit::WebPageProxy::pageZoomFactor): If the main frame has a custom representation, get the + zoom factor from the page client. + (WebKit::WebPageProxy::setPageZoomFactor): If the main frame has a custom representation, have + the client set the zoom factor. + (WebKit::WebPageProxy::setPageAndTextZoomFactors): Ditto. + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::textZoomFactor): Changed to return 1 if the main frame has a custom + representation. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::customRepresentationZoomFactor): Added. + (WebKit::WebView::setCustomRepresentationZoomFactor): Added. + * UIProcess/win/WebView.h: + +2011-01-08 Jeff Miller <jeffm@apple.com> + + Reviewed by Jon Honeycutt. + + Add WKBundleFrameGetVisibleContentBounds(). + https://bugs.webkit.org/show_bug.cgi?id=52089 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetVisibleContentBounds): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + Added WKBundleFrameGetVisibleContentBounds(). + +2011-01-08 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] QWKView does not propagate show and hide events to the drawing area + https://bugs.webkit.org/show_bug.cgi?id=52108 + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::event): Call setPageIsVisible on the drawing area + if the event is Show or Hide. + +2011-01-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][Symbian] Make sure WebKit headers are included before platform headers on Symbian + https://bugs.webkit.org/show_bug.cgi?id=31273 + + On Symbian PREPEND_INCLUDEPATH is the best way to make sure that WebKit headers + are included before platform headers. On all other platforms continue to use + INCLUDEPATH (as before). + + * WebKit2.pro: + +2011-01-08 Csaba Osztrogonác <ossy@webkit.org> + + [Qt][WK2] Unreviewed buildfix after r75313. + + * Scripts/generate-forwarding-headers.pl: + +2011-01-08 Adam Barth <abarth@webkit.org> + + Moving WebCore changes the layout of the Qt build directory as well, + which means we need to change where we look for these generated files. + + * DerivedSources.pro: + +2011-01-07 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Move WebCore to Source + https://bugs.webkit.org/show_bug.cgi?id=52050 + + * WebKit2.pro: + +2011-01-07 Stephanie Lewis <slewis@apple.com> + + Reviewed by Geoff Garen. + + <rdar://problem/8649617> Migrate memory tracking from Safari to WebKit + https://bugs.webkit.org/show_bug.cgi?id=50799 Add Memory Sampler to WebKit + + Add a sampler for printing off process memory statistics. + This tool can track: + + WebCore + - FastMalloc allocations bytes (in use or committed) + JavaScriptCore + - Garbage collector heap bytes (in use or committed) + - Stack bytes (committed only!) + - JIT Code bytes (committed only!) + Malloc zones + - In use bytes for the following zones: + * Default zone (in use or committed) + * DispCon zone (in use or committed) + * Purgable zone (in use or committed) + Task Info + - Resident size memory (RSIZE) + + Data collected is dumped to a temporary file. + + Create a sandbox for a temporary file. + * Shared/SandboxExtension.h: + (WebKit::SandboxExtension::createHandleForTemporaryFile): + * Shared/mac/SandboxExtensionMac.mm: + (WebKit::SandboxExtension::createHandleForTemporaryFile): + + Memory Sampler files + + * Shared/WebMemorySampler.cpp: Added. + (WebKit::WebMemorySampler::shared): + (WebKit::WebMemorySampler::WebMemorySampler): + (WebKit::WebMemorySampler::start): + (WebKit::WebMemorySampler::initializeTimers): + (WebKit::WebMemorySampler::stop): + (WebKit::WebMemorySampler::isRunning): + (WebKit::WebMemorySampler::initializeTempLogFile): + (WebKit::WebMemorySampler::initializeSandboxedLogFile): + (WebKit::WebMemorySampler::writeHeaders): + (WebKit::WebMemorySampler::sampleTimerFired): + (WebKit::WebMemorySampler::stopTimerFired): + (WebKit::WebMemorySampler::appendCurrentMemoryUsageToFile): + * Shared/WebMemorySampler.h: Added. + * Shared/mac/WebMemorySampler.mac.mm: Added. + (WebKit::WebMemorySampler::sampleSystemMalloc): + (WebKit::WebMemorySampler::sampleProcessCommittedBytes): + (WebKit::WebMemorySampler::processName): + (WebKit::WebMemorySampler::sampleWebKit): + + API to start and stop UIProcess and WebProcess sampling. + + * UIProcess/API/C/WKContext.cpp: + (WKContextStartMemorySampler): + (WKContextStopMemorySampler): + * UIProcess/API/C/WKContext.h: + + Send messages to WebProcess to start and stop memory sampling. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::processDidFinishLaunching): + (WebKit::WebContext::startMemorySampler): + (WebKit::WebContext::stopMemorySampler): + * UIProcess/WebContext.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::startMemorySampler): + (WebKit::WebProcess::stopMemorySampler): + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: + +2011-01-07 Jessie Berlin <jberlin@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2: Need WKBundleFrameCopyProvisionalURL + https://bugs.webkit.org/show_bug.cgi?id=52083 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyProvisionalURL): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::provisionalURL): + Grab the URL from the provisional document loader. + * WebProcess/WebPage/WebFrame.h: + +2011-01-07 James Robinson <jamesr@chromium.org> + + Revert "Implement mozilla's animationTime property" + https://bugs.webkit.org/show_bug.cgi?id=51952 + + This approach isn't quite right. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::setSize): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::drawRect): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::syncCompositingLayers): + +2011-01-07 Amruth Raj <amruthraj@motorola.com> and Ravi Phaneendra Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + [GTK] WebKit2 GNUmakefile is out of date from trunk + Adding new stub files for compiling on latest revision + https://bugs.webkit.org/show_bug.cgi?id=51883 + + * UIProcess/gtk: Added. + * UIProcess/gtk/TextCheckerGtk.cpp: Added. + (WebKit::TextChecker::state): + (WebKit::TextChecker::isContinuousSpellCheckingAllowed): + (WebKit::TextChecker::setContinuousSpellCheckingEnabled): + (WebKit::TextChecker::setGrammarCheckingEnabled): + (WebKit::TextChecker::uniqueSpellDocumentTag): + (WebKit::TextChecker::closeSpellDocumentWithTag): + (WebKit::TextChecker::checkTextOfParagraph): + (WebKit::TextChecker::updateSpellingUIWithMisspelledWord): + (WebKit::TextChecker::getGuessesForWord): + (WebKit::TextChecker::learnWord): + (WebKit::TextChecker::ignoreWord): + * UIProcess/gtk/WebInspectorGtk.cpp: Added. + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + (WebKit::WebInspectorProxy::platformOpen): + (WebKit::WebInspectorProxy::platformClose): + (WebKit::WebInspectorProxy::inspectorPageURL): + * UIProcess/gtk/WebPageProxyGtk.cpp: Added. + (WebKit::WebPageProxy::standardUserAgent): + * UIProcess/gtk/WebPreferencesGtk.cpp: Added. + (WebKit::WebPreferences::platformInitializeStore): + (WebKit::WebPreferences::platformUpdateStringValueForKey): + (WebKit::WebPreferences::platformUpdateBoolValueForKey): + (WebKit::WebPreferences::platformUpdateUInt32ValueForKey): + * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp: Added. + (WebKit::WebContextMenuClient::lookUpInDictionary): + (WebKit::WebContextMenuClient::isSpeaking): + (WebKit::WebContextMenuClient::speak): + (WebKit::WebContextMenuClient::stopSpeaking): + * WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp: Added. + (WebKit::WebDatabaseManager::databaseDirectory): + * WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp: Added. + (WebKit::WebPopupMenu::setUpPlatformData): + * WebProcess/WebPage/gtk: Added. + * WebProcess/WebPage/gtk/WebInspectorGtk.cpp: Added. + (WebKit::WebInspector::localizedStringsURL): + +2011-01-06 Adam Roben <aroben@apple.com> + + Don't ever call ::SetCursor(0) + + Doing so makes the cursor disappear from the screen. + + Fixes <http://webkit.org/b/52024> Mouse cursor flashes when moving it + around a WKView before the web process has finished launching + + Reviewed by Jon Honeycutt. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onSetCursor): If we don't have a cursor to set, just + let Windows do its default thing (which is to set the cursor to the + window class's cursor, which in our case is the arrow cursor). + (WebKit::WebView::cursorToShow): Just return 0 when the page has + crashed so that we'll show the default cursor (which is the arrow + cursor). This change has no visible effect, but seems slightly better + conceptually. + (WebKit::WebView::updateNativeCursor): Don't do anything if we don't + have a cursor to set. + +2011-01-06 Adam Roben <aroben@apple.com> + + Fill the WKView with white when the web process hasn't drawn anything + yet + + Fixes <http://webkit.org/b/52023> WKView accumulates pixel garbage + before web process has had a chance to draw anything (if Aero is + disabled) + + Reviewed by Jon Honeycutt. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::paint): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::paint): + * UIProcess/TiledDrawingAreaProxy.h: + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + * UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + * UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp: + (WebKit::LayerBackedDrawingAreaProxy::paint): + Changed these functions to return a boolean indicating whether we + actually painted anything. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onPaintEvent): Fill with white (and don't call + didDraw) when the DrawingAreaProxy isn't able to paint. + +2011-01-06 Jessie Berlin <jberlin@apple.com> + + Reviewed by Jon Honeycutt. + + WebKit2: Need WKBundlePagePrivate equivalent of WebKit1's WebViewPrivate's setDefersCallbacks + https://bugs.webkit.org/show_bug.cgi?id=52038 + + The implementation of WebKit1's WebViewPrivate's setDefersCallbacks on both Windows and Mac + calls WebCore::Page::setDefersLoading. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetDefersLoading): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setDefersLoading): + * WebProcess/WebPage/WebPage.h: + +2011-01-06 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 + Change WebKit2 session restoring to restore the full back/forward list. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Let the UIProcess register its own + WebBackForwardListItems in its ID map upon creation. + * UIProcess/WebProcessProxy.h: + + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::restoreFromSessionStateData): Register each new list entry in the + UIProcess ID map. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Add this method to register UIProcess + created items without doing any of the other work normally associated with adding a new back/forward item + (such as notifying the UIProcess). + * WebProcess/WebPage/WebBackForwardListProxy.h: + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::restoreSession): Map all of the back/forward list entries from the UIProcess then + cause a load of the current entry. + +2011-01-06 Adam Roben <aroben@apple.com> + + Always show the arrow cursor when the web process has crashed + + Fixes <http://webkit.org/b/52006> WKView shows a stale cursor when the + web process crashes + + Reviewed by Ada Chan. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::processDidCrash): + (WebKit::WebView::didRelaunchProcess): + Update the cursor to reflect the new state. + + (WebKit::WebView::cursorToShow): Always show the arrow cursor when the + web process has crashed. + +2011-01-06 Adam Roben <aroben@apple.com> + + Reduce code duplication in WebView::updateNativeCursor + + Fixes <http://webkit.org/b/52005> It's not easy to add new behavior to + WebView::updateNativeCursor + + Reviewed by Ada Chan. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::cursorToShow): Moved code to choose a cursor here... + (WebKit::WebView::updateNativeCursor): ...from here. + + * UIProcess/win/WebView.h: Added cursorToShow. + +2011-01-06 Adam Roben <aroben@apple.com> + + Make WKView fill with white when the web process has crashed + + Previously we would just draw whatever we had last drawn into the + WKView (i.e., a stale picture of the web page), which was confusing + (because the web page would mysteriously not respond to input) and ugly + (because it wouldn't behave properly if the window was resized). + + Fixes <http://webkit.org/b/52004> WKView keeps painting a stale + picture of the web page when the web process crashes + + Reviewed by Ada Chan. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onPaintEvent): Ported code from -[WKView drawRect:] + to fill with white if the page is invalid or has no DrawingArea. As a + bonus, also ported the call to WebPageProxy::didDraw from that method. + + (WebKit::WebView::processDidCrash): + (WebKit::WebView::didRelaunchProcess): + Invalidate our window so that we'll redraw with white or the new page. + +2011-01-06 Adam Roben <aroben@apple.com> + + Make WKViews work on Windows after a crashed web process gets relaunched + + Fixes <http://webkit.org/b/52001> Relaunching the web process fails to + revivify WKViews on Windows + + Reviewed by Ada Chan. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::didRelaunchProcess): Implemented by porting code from + -[WKView _didRelaunchProcess]. + +2011-01-06 Adam Roben <aroben@apple.com> + + Remove WebView::m_rect + + It was only used in the constructor, and wasn't even kept up-to-date as + the WebView's size changed. + + Fixes <http://webkit.org/b/52000> WebView::m_rect is unnecessary + + Reviewed by Ada Chan. + + * UIProcess/win/WebView.cpp: + * UIProcess/win/WebView.h: + +2011-01-05 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Ada Chan. + + WebKit2: Should be able to call into injected bundle to ask if we should allow resource loads + https://bugs.webkit.org/show_bug.cgi?id=51969 + + Add the ability to call into the injected bundle to ask if we should allow resource loads. + If the injected bundle says we should cancel, we clear out the ResourceRequest that was + passed into willSendRequest, which cancels the resource load. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add the new callback for allowing/cancelling + resource loads. + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::shouldLoadResourceForFrame): Calls through to the client. + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSendRequest): Ask the InjectedBundlePageLoaderClient if we + should load the resource or not. + +2011-01-06 Jeff Miller <jeffm@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Add APIs to WKBundleFrame to get content bounds and scroll offset + https://bugs.webkit.org/show_bug.cgi?id=51968 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetContentBounds): + (WKBundleFrameGetScrollOffset): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + Add WKBundleFrameGetContentBounds() and WKBundleFrameGetScrollOffset(). + +2011-01-06 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Implement mozilla's animationTime property + https://bugs.webkit.org/show_bug.cgi?id=51952 + + Tells the page to clear the current animation time after producing a frame. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::drawRect): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::setSize): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::syncCompositingLayers): + +2011-01-06 Darin Adler <darin@apple.com> + + Redo the half-done rename from the last check-in. + Sorry for the broken build last night. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::removeItem): Renamed. + * WebProcess/WebPage/WebBackForwardListProxy.h: Updated + for new name. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didRemoveBackForwardItem): Updated to + use the new name. + +2011-01-06 Maciej Stachowiak <mjs@apple.com> + + Rubber stamped by Dan Bernstein. + + Fix build for Darin's previous change w/ the obvious renaming. + + * WebProcess/WebPage/WebBackForwardListProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didRemoveBackForwardItem): + +2011-01-05 Darin Adler <darin@apple.com> + + Reviewed by Geoff Garen. + + Back/Forward entries in WebKit2 leak + https://bugs.webkit.org/show_bug.cgi?id=51983 + + Besides fixing the leak, this also fixes a problem where + all history items were sent over to the UI process, but + we wanted to send only back/forward items. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::pageClosed): Added. + Tells the web process about all the back/forward + items being removed. + (WebKit::WebBackForwardList::addItem): Ditto. + Also removed a redundant call to didChangeBackForwardList. + (WebKit::WebBackForwardList::clear): Ditto. + + * UIProcess/WebBackForwardList.h: Added pageClosed. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Added a call to pageClosed. + (WebKit::WebPageProxy::backForwardRemovedItem): Added. + Sends a message to the web page in the web process. + + * UIProcess/WebPageProxy.h: Added backForwardRemovedItem. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::updateBackForwardItem): Added an itemID argument, + since callers will now be getting it and we don't want to + get it twice. Removed the code to generate an ID. Also + removed some local variables to make the code a little + tighter and clearer. + (WebKit::WK2NotifyHistoryItemChanged): Only call + updateBackForwardItem for items that already have IDs. + We don't want to send cross-process messages for every + history item; just the ones that are top level back/forward + items. + (WebKit::WebBackForwardListProxy::removeItem): + Added. For use when the UI process tells us to remove it. + (WebKit::WebBackForwardListProxy::addItem): Added code to + assign an ID and put this item into the maps. This is called + exactly once on each back/forward item. + + * WebProcess/WebPage/WebBackForwardListProxy.h: Added + removeItem. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didRemoveBackForwardItem): Added. + + * WebProcess/WebPage/WebPage.h: Added didRemoveBackForwardItem. + + * WebProcess/WebPage/WebPage.messages.in: Added + DidRemoveBackForwardItem message. + +2011-01-05 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Darin Adler. + + Debug and Release builds on Windows clobber each other + https://bugs.webkit.org/show_bug.cgi?id=49185 + + Changes the structure of WebKitBuild build products directory so we + completely separate each build configuration into independent directories. + + Although we previously had per-configuration directories for obj, this change adds + per-configuration directories for bin, lib, obj, and include. Each configuration's + build products are stored within a directory inside of WebKitBuild. + + Most use of $(WebKitOutputDir) in the build files has been replaced by $(ConfigurationBuildDir), + defined in common.vsprops to be $(WebKitOutputDir)\$(ConfigurationName). + + * win/WebKit2.make: + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + * win/WebKit2Generated.make: + * win/WebKit2GeneratedCommon.vsprops: + * win/WebKit2WebProcessPostBuild.cmd: + * win/WebKit2WebProcessPreBuild.cmd: + * win/WebKitPostBuild.cmd: + * win/WebKitPreBuild.cmd: + +2011-01-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=51973 + Make main frame PDF printing work + + * UIProcess/API/mac/PDFViewController.h: + * UIProcess/API/mac/PDFViewController.mm: (WebKit::PDFViewController::makePrintOperation): + Ask PDFDocument to create an NSPrintOperation. + + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView printOperationWithPrintInfo:forFrame:]): Create a new NSPrintOperation, either + from scratch or from a PDF view. + (-[WKView canPrintHeadersAndFooters]): Report if the view can be re-paginated to add headers + and footers. + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8750248> + Need a way to create a new DownloadProxy from an arbitrary resource request + + <rdar://problem/8750465> + Need a way to start a download in WKDownload + + <rdar://problem/8752204> + WK2 Context Menus - "Save linked file" support + + * Shared/ContextMenuState.h: Added. + Add a ContextMenuState struct which contains state for context menus. + + * UIProcess/API/C/WKContext.cpp: + (WKContextDownloadURLRequest): + Call WebContext::download. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::download): + Send a DownloadRequest message to the web process. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showContextMenu): + Set the active context menu state. + + (WebKit::WebPageProxy::contextMenuItemSelected): + Handle ContextMenuItemTagDownloadImageToDisk and ContextMenuItemTagDownloadLinkToDisk by calling + WebContext::Download, passing the respective URLs. + + * UIProcess/WebPageProxy.messages.in: + ShowContextMenu now takes state as well. + + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::downloadURL): + Assert that this is never reached; downloads are handled in the UI process. + + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): + Pass the context menu state along when sending the ShowContextMenu message. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::downloadRequest): + Call the shared DownloadManager. + + * WebProcess/WebProcess.messages.in: + Add DownloadRequest message. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add ContextMenuState.h. + +2011-01-05 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed build fix. + + [Qt] [Symbian] Fix building NPAPI support + + NPEvent is mapped to QAction on Symbian. QAction has no + default constructor, so toNP() fails to build. Add a case for + Symbian behind the OS(SYMBIAN) guard. + + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + (WebKit::toNP): + +2011-01-05 Jeff Miller <jeffm@apple.com> + + Reviewed by Dan Bernstein. + + Copy WKImageCG.h to include\WebKit2 in build output + https://bugs.webkit.org/show_bug.cgi?id=51944 + + * win/WebKit2Generated.make: + Add xcopy command to copy WKImageCG.h. + +2011-01-05 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Part of <rdar://problem/8261624> and https://bugs.webkit.org/show_bug.cgi?id=47355 + Change WebKit2 session restoring to restore the full back/forward list + + Add a new message to tell the WebProcess to restore a session state: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::restoreSession): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: Add the new message, AND fix the intentional misspellings. + + Also, Sam sucks. + + Change WebProcess back/forward list item ids to be odd (UIProcess's will be even): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::generateHistoryItemID): + + Provide accessors to the entries in the list to pass to the WebProcess: + * UIProcess/WebBackForwardList.h: + (WebKit::WebBackForwardList::entries): + (WebKit::WebBackForwardList::currentIndex): + + Add decoding of the saved back/forward list itmes (we already encode them): + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::generateWebBackForwardItemID): + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): + + Instead of loading the current URL, pass the entire last back to the WebProcess: + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::restoreFromSessionStateData): + +2011-01-05 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=51953 + Add a "SessionState" object for IPC messaging. + + This object includes all data necessary to restore a session state; + For now, this is just the back/forward list to restore. + + * Shared/SessionState.cpp: Added. + (WebKit::SessionState::SessionState): + (WebKit::SessionState::encode): + (WebKit::SessionState::decode): + * Shared/SessionState.h: Added. + (WebKit::SessionState::list): + (WebKit::SessionState::currentIndex): + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2011-01-05 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed build fix. + + Include unistd.h for _exit() for non-Windows builds. + + Build break noticed on QtWebkit Symbian builds. + + * Shared/ChildProcess.cpp: + +2011-01-05 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=51949 + Make WebBackForwardListItem shared, and add encoders and decoders + + * Shared/WebBackForwardListItem.cpp: Copied from UIProcess/WebBackForwardListItem.cpp. + (WebKit::WebBackForwardListItem::encode): + (WebKit::WebBackForwardListItem::decode): + * Shared/WebBackForwardListItem.h: Copied from UIProcess/WebBackForwardListItem.h. + * UIProcess/WebBackForwardListItem.cpp: Removed. + * UIProcess/WebBackForwardListItem.h: Removed. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle smart insert/delete + https://bugs.webkit.org/show_bug.cgi?id=51946 + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + * Shared/WebPageCreationParameters.h: + Add isSmartInsertDelete enabled. + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + Handle toggleSmartInsertDelete:. + + (-[WKView toggleSmartInsertDelete:]): + Toggle the smart insert/delete state. + + * UIProcess/TextChecker.h: + Add isSmartInsertDeleteEnabled and setSmartInsertDeleteEnabled. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize m_isSmartInsertDeleteEnabled. + + (WebKit::WebPageProxy::contextMenuItemSelected): + Handle ContextMenuItemTagSmartCopyPaste. + + (WebKit::WebPageProxy::setSmartInsertDeleteEnabled): + Update the state and send a SetSmartInsertDeleteEnabled message. + + (WebKit::WebPageProxy::creationParameters): + Initialize isSmartInsertDeleteEnabled. + + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::isSmartInsertDeleteEnabled): + Return m_isSmartInsertDeleteEnabled. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::TextChecker::isSmartInsertDeleteEnabled): + (WebKit::TextChecker::setSmartInsertDeleteEnabled): + Store and fetch the smart insert delete state. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::smartInsertDeleteEnabled): + Call WebPage::isSmartInsertDeleteEnabled. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::toggleSmartInsertDelete): + Assert that this is never called. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + Initialize m_isSmartInsertDeleteEnabled + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::isSmartInsertDeleteEnabled): + (WebKit::WebPage::setSmartInsertDeleteEnabled): + Add getter and setter. + + * WebProcess/WebPage/WebPage.messages.in: + Add SetSmartInsertDeleteEnabled message. + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * WebProcess/WebPage/WebPage.cpp: + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Adele Peterson. + + Implement word transformation + https://bugs.webkit.org/show_bug.cgi?id=51943 + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + Handle the word transformation selectors. + + (-[WKView uppercaseWord:]): + (-[WKView lowercaseWord:]): + (-[WKView capitalizeWord:]): + Call down to the WebPageProxy. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::uppercaseWord): + (WebKit::WebPageProxy::lowercaseWord): + (WebKit::WebPageProxy::capitalizeWord): + Send messages to the WebPage. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::changeWordCase): + Add helper function. + + (WebKit::WebEditorClient::uppercaseWord): + (WebKit::WebEditorClient::lowercaseWord): + (WebKit::WebEditorClient::capitalizeWord): + Call helper function. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeSpellingToWord): + Call replaceSelectionWithText. + + (WebKit::WebPage::uppercaseWord): + (WebKit::WebPage::lowercaseWord): + (WebKit::WebPage::capitalizeWord): + Call the editor functions. + + (WebKit::WebPage::replaceSelectionWithText): + New helper function that replaces the selected string with another string. + + * WebProcess/WebPage/WebPage.messages.in: + Add new messages. + +2011-01-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=51935 + Add WebKit2 API for largest frame + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetFrameSetLargestFrame): + * UIProcess/API/C/WKPage.h: + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on spelling + https://bugs.webkit.org/show_bug.cgi?id=51939 + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + Handle changeSpelling: as well. + + (-[WKView showGuessPanel:]): + Show or hide the guess panel. + + (-[WKView checkSpelling:]): + Pass false to advanceToNextMisspelling. + + (-[WKView changeSpelling:]): + Call changeSpellingToWord. + + * UIProcess/TextChecker.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize m_pendingLearnOrIgnoreWordMessageCount. + + (WebKit::WebPageProxy::contextMenuItemSelected): + Handle smart toggles directly in the UI process, keep track of whether + we're asked to learn or ignore a word. + + (WebKit::WebPageProxy::advanceToNextMisspelling): + Pass the boolean through. + + (WebKit::WebPageProxy::changeSpellingToWord): + Send a ChangeSpellingToWord message. + + (WebKit::WebPageProxy::learnWord): + (WebKit::WebPageProxy::ignoreWord): + Check that we do have a pending learn or ignore word message. Call through to + the text checker. + + (WebKit::WebPageProxy::processDidCrash): + Reset the m_pendingLearnOrIgnoreWordMessageCount variable. + + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + Add new messages. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::TextChecker::learnWord): + (WebKit::TextChecker::ignoreWord): + Implement in terms of NSSpellChecker. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::ignoreWordInSpellDocument): + (WebKit::WebEditorClient::learnWord): + Send IgnoreWord and LearnWord messages. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): + (WebKit::WebEditorClient::toggleAutomaticLinkDetection): + (WebKit::WebEditorClient::toggleAutomaticDashSubstitution): + (WebKit::WebEditorClient::toggleAutomaticTextReplacement): + Add assertions. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::advanceToNextMisspelling): + Pass the bool along to the Editor. + + (WebKit::WebPage::changeSpellingToWord): + Replace the selected text. + + * WebProcess/WebPage/WebPage.messages.in: + Add new ChangeSpellingToWord message and add a boolean to AdvanceToNextMisspelling. + +2011-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Keep track of active text substitution preferences + https://bugs.webkit.org/show_bug.cgi?id=51931 + + * Shared/TextCheckerState.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + Handle new selectors, mostly copied from WebKit1 code. + + (-[WKView orderFrontSubstitutionsPanel:]): + Open the substitution panel. + + (-[WKView isAutomaticQuoteSubstitutionEnabled]): + (-[WKView setAutomaticQuoteSubstitutionEnabled:]): + (-[WKView toggleAutomaticQuoteSubstitution:]): + (-[WKView isAutomaticDashSubstitutionEnabled]): + (-[WKView setAutomaticDashSubstitutionEnabled:]): + (-[WKView toggleAutomaticDashSubstitution:]): + (-[WKView isAutomaticLinkDetectionEnabled]): + (-[WKView setAutomaticLinkDetectionEnabled:]): + (-[WKView toggleAutomaticLinkDetection:]): + (-[WKView isAutomaticTextReplacementEnabled]): + (-[WKView setAutomaticTextReplacementEnabled:]): + (-[WKView toggleAutomaticTextReplacement:]): + Call the text checker, and update the state in the web process if needed. + + * UIProcess/TextChecker.h: + Add new flags. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::initializeState): + Initialize flags from user defaults. + + (WebKit::TextChecker::setAutomaticQuoteSubstitutionEnabled): + (WebKit::TextChecker::setAutomaticDashSubstitutionEnabled): + (WebKit::TextChecker::setAutomaticLinkDetectionEnabled): + (WebKit::TextChecker::setAutomaticTextReplacementEnabled): + Update and save the flags. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::isAutomaticQuoteSubstitutionEnabled): + (WebKit::WebEditorClient::isAutomaticLinkDetectionEnabled): + (WebKit::WebEditorClient::isAutomaticDashSubstitutionEnabled): + (WebKit::WebEditorClient::isAutomaticTextReplacementEnabled): + Get the text checker state. + +2011-01-05 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Darin Adler. + + Cleaned up com.apple.WebProcess.sb + + * WebProcess/com.apple.WebProcess.sb: Moved the closing parentheses of multi-line blocks to + their own lines. Changed to use WebKit-standard 4-space indentation. + +2011-01-05 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=51903 + Tell UI process which subframe is largest + + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::frameSetLargestFrame): + Remember largest frame in frameset pages. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::frameDidBecomeFrameSet): Reset stored largest frame if main frame + changes to a frameset or back. + (WebKit::WebPageProxy::frameSetLargestFrameChanged): Store a new largest frame when notified + of a change. + + * UIProcess/WebPageProxy.messages.in: Added FrameSetLargestFrameChanged. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::area): Calculate area of a frame. + (WebKit::findLargestFrameInFrameSet): Find largest first-level subframe in a frameset page. + (WebKit::WebChromeClient::contentsSizeChanged): Recalculate largest frame, and notify UI + process if it changed. + + * WebProcess/WebCoreSupport/WebChromeClient.h: Store the latest largest frame. + + * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::size): + * WebProcess/WebPage/WebFrame.h: + Expose frame size. + +2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] Add support for non-trivial context menu action + https://bugs.webkit.org/show_bug.cgi?id=51902 + + Implement a call back from the QAction triggered in the UIProcess to the + action in WebProcess. + + A few basic actions have been implemented based on this feature. + + * UIProcess/API/qt/qwkpage.cpp: + (contextMenuActionForWebAction): + (QWKPage::triggerAction): + (QWKPage::action): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/qt/WebContextMenuProxyQt.cpp: + (WebKit::webActionForContextMenuAction): + +2011-01-04 Siddharth Mathur <siddharth.mathur@nokia.com> + + Reviewed by Laszlo Gombos. + + Include unistd.h for sleep() for non-Windows builds. + + * WebProcess/WebProcess.cpp: + * WebProcess/qt/WebProcessMainQt.cpp: + +2011-01-04 Brian Weinstein <bweinstein@apple.com> + + Windows build fix. Change the inline type of consumePermanently. + + * Shared/SandboxExtension.h: + (WebKit::SandboxExtension::consumePermanently): + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/8821203> Sandbox violations trying to access the Safari cache + + * Shared/SandboxExtension.h: + (WebKit::SandboxExtension::consumePermanently): + New function which consumes a sandbox extension and destroys it, making it impossible + to later revoke it. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + Encode and decode the path extension handle. + + * Shared/mac/SandboxExtensionMac.mm: + (WebKit::SandboxExtension::createHandle): + Standardize the path before creating the handle. + + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): + Create a sandbox extension for the cache path. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformInitializeWebProcess): + Consume the sandbox extension. + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::TextChecker::getGuessesForWord): + +2011-01-04 Jeff Miller <jeffm@apple.com> + + Reviewed by Darin Adler. + + Mouse events in WebKit2 on Windows need to know whether the click activated the WebView to match WebKit1 behavior. + https://bugs.webkit.org/show_bug.cgi?id=51228 + + * Shared/WebEvent.h: + (WebKit::WebMouseEvent::didActivateWebView): + Add m_didActivateWebView to WebMouseEvent on Windows. + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): + Propagate whether the click activated the WebView when converting to a PlatformMouseEvent. + + * Shared/WebMouseEvent.cpp: + (WebKit::WebMouseEvent::WebMouseEvent): + Add m_didActivateWebView to WebMouseEvent on Windows. + + (WebKit::WebMouseEvent::encode): + (WebKit::WebMouseEvent::decode): + Encode and decode new m_didActivateWebView member variable. + + * Shared/win/WebEventFactory.cpp: + (WebKit::WebEventFactory::createWebMouseEvent): + * Shared/win/WebEventFactory.h: + Add didActivateWebView parameter to createWebMouseEvent(). + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): + (WebKit::WebView::WebView): + (WebKit::WebView::onMouseEvent): + * UIProcess/win/WebView.h: + (WebKit::WebView::setWasActivatedByMouseEvent): + Keep track of whether the click activated the WebView. + +2011-01-04 Ivan Krstić <ike@apple.com> + + Reviewed and landed by Anders Carlsson. + + <rdar://problem/8602585> + <rdar://problem/8711641> + + * WebProcess/com.apple.WebProcess.sb: + Fix a misplaced right parenthesis and add a new system path regex. + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on spelling and grammar + https://bugs.webkit.org/show_bug.cgi?id=51910 + + * Scripts/webkit2/messages.py: + Add special case for WebCore::TextCheckingResult. + + * Shared/NotImplemented.h: + Fix macro so that defining DISABLE_NOT_IMPLEMENTED_WARNINGS to 0 will enable the warnings. + + * Shared/WebCoreArgumentCoders.h: + Add argument coders for WebCore::GrammarDetail and WebCore::TextCheckingResult. + + * UIProcess/API/mac/WKView.mm: + (-[WKView checkSpelling:]): + Call advanceToNextMisspelling. + + * UIProcess/TextChecker.h: + Add new NSSpellChecker wrappers. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize the new member variables. + + (WebKit::WebPageProxy::~WebPageProxy): + Call TextChecker::closeSpellDocumentWithTag. + + (WebKit::WebPageProxy::advanceToNextMisspelling): + Send the AdvanceToNextMisspelling message. + + (WebKit::WebPageProxy::spellDocumentTag): + Create a spell document tag if necessary. + + (WebKit::WebPageProxy::checkTextOfParagraph): + (WebKit::WebPageProxy::updateSpellingUIWithMisspelledWord): + (WebKit::WebPageProxy::getGuessesForWord): + Call the TextChecker. + + * UIProcess/WebPageProxy.messages.in: + Add new messages. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::TextChecker::uniqueSpellDocumentTag): + (WebKit::TextChecker::closeSpellDocumentWithTag): + (WebKit::TextChecker::checkTextOfParagraph): + (WebKit::TextChecker::updateSpellingUIWithMisspelledWord): + (WebKit::TextChecker::getGuessesForWord): + Add NSSpellChecker wrappers. + + * UIProcess/qt/TextCheckerQt.cpp: + * UIProcess/win/TextCheckerWin.cpp: + Add stubs. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::isContinuousSpellCheckingEnabled): + (WebKit::WebEditorClient::isGrammarCheckingEnabled): + Get the text checking state from the web process. + + (WebKit::WebEditorClient::updateSpellingUIWithMisspelledWord): + (WebKit::WebEditorClient::getGuessesForWord): + Proxy calls to the UI process. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::isAutomaticSpellingCorrectionEnabled): + + (WebKit::WebEditorClient::checkTextOfParagraph): + Proxy calls to the UI process. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::advanceToNextMisspelling): + Call the frame. + + * WebProcess/WebPage/WebPage.messages.in: + Add AdvanceToNextMisspelling message. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + Set the text checker state. + +2011-01-04 Chris Fleizach <cfleizach@apple.com> + + Unreviewed. Build fix. + + WK2: Support Accessibility + https://bugs.webkit.org/show_bug.cgi?id=51859 + + * WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: + +2011-01-04 Chris Fleizach <cfleizach@apple.com> + + Unreviewed. Build fix. + + WK2: Support Accessibility + https://bugs.webkit.org/show_bug.cgi?id=51859 + + * WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: + (-[AccessibilityWebPageObject accessibilityAttributeValue:]): + +2011-01-04 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Sam Weinig. + + WK2: Support Accessibility + https://bugs.webkit.org/show_bug.cgi?id=51859 + + Implement remote accessibility API to support cross process accessibility + on the Mac platform. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::accessibilityChildTokenReceived): + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView _updateWindowAndViewFrames]): + (-[WKView _setAccessibilityChildToken:]): + (-[WKView accessibilityIsIgnored]): + (-[WKView accessibilityHitTest:]): + (-[WKView accessibilityAttributeValue:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::windowAndViewFramesChanged): + (WebKit::WebPageProxy::didReceiveAccessibilityPageToken): + (WebKit::WebPageProxy::sendAccessibilityPresenterToken): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::accessibilityRemoteObject): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::windowAndViewFramesChanged): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::accessibilityPosition): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/mac/AccessibilityWebPageObject.h: Added. + * WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: Added. + (-[AccessibilityWebPageObject setWebPage:]): + (-[AccessibilityWebPageObject setRemoteParent:]): + (-[AccessibilityWebPageObject dealloc]): + (-[AccessibilityWebPageObject accessibilityIsIgnored]): + (-[AccessibilityWebPageObject accessibilityAttributeNames]): + (-[AccessibilityWebPageObject accessibilityIsAttributeSettable:]): + (-[AccessibilityWebPageObject accessibilitySetValue:forAttribute:]): + (-[AccessibilityWebPageObject accessibilityActionNames]): + (-[AccessibilityWebPageObject accessibilityChildren]): + (-[AccessibilityWebPageObject accessibilityAttributeValue:]): + (-[AccessibilityWebPageObject accessibilityShouldUseUniqueId]): + (-[AccessibilityWebPageObject accessibilityHitTest:]): + (-[AccessibilityWebPageObject accessibilityFocusedUIElement]): + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::platformInitialize): + (WebKit::WebPage::sendAccessibilityPresenterToken): + (WebKit::WebPage::accessibilityRemoteObject): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::presenterApplicationPid): + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2011-01-04 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + Get rid of an extra copy in the back/forward item IPC message by using a DataReference. + + * UIProcess/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::WebBackForwardListItem): + (WebKit::WebBackForwardListItem::setBackForwardData): + * UIProcess/WebBackForwardListItem.h: + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::dataCallback): Get rid of no-longer-needed check for size 0. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::addBackForwardItem): + * UIProcess/WebProcessProxy.h: + + * UIProcess/WebProcessProxy.messages.in: + + * WebProcess/WebPage/EncoderAdapter.cpp: + (WebKit::EncoderAdapter::data): + * WebProcess/WebPage/EncoderAdapter.h: + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + +2011-01-04 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + Store more data per history entry in the session state blob. + + * UIProcess/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::WebBackForwardListItem): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::create): + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::addBackForwardItem): + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): + + * UIProcess/cf/WebPageProxyCF.cpp: + +2011-01-04 Darin Adler <darin@apple.com> + + Reviewed by Brady Eidson. + + Add back/forward encoding and decoding to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51901 + + * GNUmakefile.am: Added new source files. + * WebKit2.pro: Ditto. + * WebKit2.xcodeproj/project.pbxproj: Ditto. + * win/WebKit2.vcproj: Ditto. + + * WebProcess/WebPage/DecoderAdapter.cpp: Added. + * WebProcess/WebPage/DecoderAdapter.h: Added. + * WebProcess/WebPage/EncoderAdapter.cpp: Added. + * WebProcess/WebPage/EncoderAdapter.h: Added. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::updateBackForwardItem): Added code to encode the back/forward + tree and send it along. The code to decode needs to wait on Brady's + current project. + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8766999> WebKit2: Sandboxing causes certificate error on access to any HTTPS URL + + Allow read access to /Library/Preferences/com.apple.security.plist. + + * WebProcess/com.apple.WebProcess.sb: + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Build fixes. + + * UIProcess/qt/TextCheckerQt.cpp: + * UIProcess/win/TextCheckerWin.cpp: + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Don't use macros for the key names. + + * UIProcess/mac/TextCheckerMac.mm: + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send over text checker state to the web process + https://bugs.webkit.org/show_bug.cgi?id=51896 + + * Platform/CoreIPC/Arguments.h: + Remove 'const' from the argument, this matches all the other Arguments classes. + + * Shared/TextCheckerState.h: Added. + New class with text checker state. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + Add textCheckerState. + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + (-[WKView toggleContinuousSpellChecking:]): + (-[WKView toggleGrammarChecking:]): + (-[WKView toggleAutomaticSpellingCorrection:]): + Get the needed flags from the text checker state. + + * UIProcess/TextChecker.h: + Add state() function, remove getters. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Initialize the text checker state. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::updateTextCheckerState): + Send the SetTextCheckerState message to the web process. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::initializeState): + Initialize the state from the user defaults. + + (WebKit::TextChecker::state): + Return the state. + + (WebKit::TextChecker::setContinuousSpellCheckingEnabled): + (WebKit::TextChecker::setGrammarCheckingEnabled): + (WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled): + Make sure to write the new state. + + * UIProcess/qt/TextCheckerQt.cpp: + (WebKit::TextChecker::state): + * UIProcess/win/TextCheckerWin.cpp: + (WebKit::TextChecker::state): + Add stubs. + + * WebKit2.xcodeproj/project.pbxproj: + Add TextCheckerState.h. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + Initialize m_textCheckerState. + + (WebKit::WebProcess::setTextCheckerState): + Update. + + * WebProcess/WebProcess.messages.in: + Add SetTextCheckerState message. + + * win/WebKit2.vcproj: + Add TextCheckerState.h. + +2011-01-04 Brady Eidson <beidson@apple.com> + + Rubberstamped by Anders Carlsson. + + Attach a radar # to this FIXME: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + +2011-01-04 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Add more spelling/grammar related methods + https://bugs.webkit.org/show_bug.cgi?id=51886 + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + Handle more selectors. + + (-[WKView showGuessPanel:]): + Add stub. + + (-[WKView checkSpelling:]): + Ditto. + + (-[WKView toggleAutomaticSpellingCorrection:]): + Toggle automatic spelling correction. + + * UIProcess/TextChecker.h: + Add setAutomaticSpellingCorrectionEnabled and isAutomaticSpellingCorrectionEnabled. + + * UIProcess/mac/TextCheckerMac.mm: + (WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled): + (WebKit::TextChecker::isAutomaticSpellingCorrectionEnabled): + Update the toggle. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: + Add a Radar URL for the localization FIXMEs. + +2011-01-04 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * win/WebKit2.vcproj: Correct the missing $(WebKitVSPropsRedirectionDir) + variables that Visual Studio helpfully removes when making changes. + +2011-01-04 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * win/WebKit2.vcproj: Disable CG-specific WKImageCG.cpp from + Debug_Cairo_CFLite/Release_Cario_CFLite builds. + +2011-01-04 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=51856 + Pass encoded back/forward tree data from the WebProcess to the UIProcess + + Remove the WKBackForwardListItemCopyOriginalURL API as it's not needed: + * UIProcess/API/C/WKBackForwardListItem.cpp: + * UIProcess/API/C/WKBackForwardListItem.h: + * UIProcess/API/qt/qwkhistory.cpp: + * UIProcess/API/qt/qwkhistory.h: + + * UIProcess/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::WebBackForwardListItem): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::create): + (WebKit::WebBackForwardListItem::setBackForwardData): + (WebKit::WebBackForwardListItem::backForwardData): + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::addBackForwardItem): + * UIProcess/WebProcessProxy.h: + + * UIProcess/WebProcessProxy.messages.in: + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::updateBackForwardItem): + +2011-01-04 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Incomplete clean up on termination + https://bugs.webkit.org/show_bug.cgi?id=51474 + + Do not kill the web process to force it's termination. + Fix object destruction and cleanup logic and make the cleanup more reliable. + Do not try to cleanup on crash because it is not reliable. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::platformInvalidate): Do not delete the socket if we + do not own it. This is the case with a server connection. + * Platform/qt/MappedMemoryPool.cpp: + Turn MappedMemoryPool into a QObject so the CleanupHandler can destruct it + in the same way as the other objects. + (WebKit::MappedMemoryPool::instance): + (WebKit::MappedMemoryPool::~MappedMemoryPool): + * Platform/qt/MappedMemoryPool.h: + (WebKit::MappedMemoryPool::MappedMemoryPool): + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::create): No need to care about QCoreApplication::aboutToQuit. + It is handled by the CleanupHandler. + (WebKit::SharedMemory::~SharedMemory): Ditto. + * Shared/qt/CleanupHandler.cpp: Renamed from WebKit2/Shared/qt/CrashHandler.cpp. + No longer try to handle crash but just normal termination. + (WebKit::CleanupHandler::CleanupHandler): Connect deleteObjects with QCoreApplication::aboutToQuit. + Ensure appropriate thread affinity. + (WebKit::CleanupHandler::sigTermHandler): Stop the main event loop. + (WebKit::CleanupHandler::deleteObjects): Use deleteLater instead of delete since it is more reliable. + * Shared/qt/CleanupHandler.h: Renamed from WebKit2/Shared/qt/CrashHandler.h. + (WebKit::CleanupHandler::instance): + (WebKit::CleanupHandler::markForCleanup): + (WebKit::CleanupHandler::unmark): + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + Do not kill the web process immidiately but give it a chance to cleanup. + Use QLocalServer::removeServer for assuring that the socket file will be removed. + (WebKit::ProcessLauncherHelper::serverName): + (WebKit::cleanupAtExit): Renamed from cleanupProcesses. Only kill the web process when it times + out terminating. Fixed the bug of changing the list while iterating it over by disconnecting + from the processStateChanged slot. + (WebKit::QtWebProcess::QtWebProcess): Added missing meta type registration of QProcess::ProcessState. + (WebKit::ProcessLauncherHelper::~ProcessLauncherHelper): + (WebKit::ProcessLauncherHelper::ProcessLauncherHelper): No need to add the the instance to the + CleanupHandler because we will remove the socket file in cleanupAtExit. + (WebKit::ProcessLauncherHelper::instance): + (WebKit::ProcessLauncher::terminateProcess): + * WebKit2.pro: + +2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] create an initial implementation of the context menu handling for WebKit 2 + https://bugs.webkit.org/show_bug.cgi?id=51825 + + Implement the necessary methods to get a basic context menu working for Qt. + + Only 4 basic WebAction have been added on the UIProcess side: back, forward, stop and reload. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + (QGraphicsWKView::showContextMenu): + (QGraphicsWKViewPrivate::QGraphicsWKViewPrivate): + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createContextMenuProxy): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/qt/WebContextMenuProxyQt.cpp: + (WebKit::webActionForContextMenuAction): + (WebKit::WebContextMenuProxyQt::WebContextMenuProxyQt): + (WebKit::WebContextMenuProxyQt::create): + (WebKit::WebContextMenuProxyQt::showContextMenu): + (WebKit::WebContextMenuProxyQt::hideContextMenu): + (WebKit::WebContextMenuProxyQt::createContextMenu): + * UIProcess/qt/WebContextMenuProxyQt.h: + +2011-01-03 Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Adam Barth. + + [Qt] Add SelectAll option to the context menu for the editor + https://bugs.webkit.org/show_bug.cgi?id=50049 + + Add WebPlatformStrategies::contextMenuItemTagSelectAll for Qt. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::contextMenuItemTagSelectAll): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2011-01-03 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Ensure that the correct initial focusable area is focused when tabbing + and shift-tabbing into the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView becomeFirstResponder]): Use the keyViewSelectionDirection to set + the initial focus. + +2011-01-02 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Simon Fraser. + + <rdar://problem/8812159> Update copyright strings + + * Info.plist: + * WebProcess/Info.plist: + +2011-01-02 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Csaba Osztrogonác. + + WebKit 2 does not build on 64bits with a recent GCC + https://bugs.webkit.org/show_bug.cgi?id=51754 + + Change the argument coding for DatabaseDetails to use explicitly the 64 bits type. + + * Shared/OriginAndDatabases.h: + * Shared/WebCoreArgumentCoders.h: + +2011-01-02 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Adam Barth. + + Move JavaScriptCore to Source + https://bugs.webkit.org/show_bug.cgi?id=51604 + + Workaround until moving all sources to Source directory is finished. + + * Scripts/generate-forwarding-headers.pl: Add Sources to searching path for JavaScriptCore. + +2011-01-01 Adam Barth <abarth@webkit.org> + + Speculative build fix for Qt. Add some more include paths. + + * WebKit2.pro: + +2011-01-01 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move JavaScriptCore to Source + https://bugs.webkit.org/show_bug.cgi?id=51604 + + * WebKit2.pro: + - Point to JavaScriptCore in its new location. + +2010-12-15 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + [GTK] Enable building whatever already exists of WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=37369 + + * GNUmakefile.am: Added. + * WebKit2Prefix.h: Included WebCore/config.h for GTK port as the first header + file for WebKit2 sources files. + * gtk: Added. + * gtk/webkit2.pc.in: Added. + +2010-12-29 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] Added more webattributes to the qwkpreferences + https://bugs.webkit.org/show_bug.cgi?id=51697 + + Added PrivateBrowsingEnabled, DeveloperExtrasEnabled, DnsPrefetchEnabled attributes + + * UIProcess/API/qt/qwkpreferences.cpp: + (QWKPreferences::testAttribute): + (QWKPreferences::setAttribute): + * UIProcess/API/qt/qwkpreferences.h: + +2010-12-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 snapshots should contain accelerated content + <rdar://problem/8807393> + https://bugs.webkit.org/show_bug.cgi?id=51660 + + When creating a snapshot, flatten the layer tree for painting so that + accelerated content is included in the snapshot. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::snapshotInViewCoordinates): + (WebKit::WebPage::snapshotInDocumentCoordinates): + +2010-12-27 Daniel Bates <dbates@rim.com> + + Attempt to fix the WebKit2 Windows build after changeset 74698 + <http://trac.webkit.org/changeset/74698> (bug #51656). + + Add "..\Shared\API\c\WKImage.h" to WebKit2Generated.make. + + * win/WebKit2Generated.make: + +2010-12-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Add API for getting snapshots + https://bugs.webkit.org/show_bug.cgi?id=51656 + + * Shared/API/c/WKBase.h: + * Shared/API/c/WKImage.cpp: Added. + (WKImageGetTypeID): + (WKImageCreate): + (WKImageGetSize): + * Shared/API/c/WKImage.h: Added. + * Shared/WebImage.cpp: Added. + (WebKit::WebImage::create): + (WebKit::WebImage::size): + * Shared/WebImage.h: Added. + (WebKit::WebImage::backingStore): + (WebKit::WebImage::WebImage): + (WebKit::WebImage::type): + Add a general purpose API image class. + + * Shared/API/c/cg: Added. + * Shared/API/c/cg/WKImageCG.cpp: Added. + (WKImageCreateCGImage): + * Shared/API/c/cg/WKImageCG.h: Added. + Add function to convert a WKImageRef to a CGImageRef for platforms that use CG. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toFloatRect): + (WebKit::toIntSize): + (WebKit::toIntPoint): + (WebKit::toIntRect): + (WebKit::toImageOptions): + Make conversion functions that are ambiguous more explicit. + + * Shared/APIObject.h: + * Shared/BackingStore.h: + (WebKit::BackingStore::isBackedBySharedMemory): + * Shared/ImageOptions.h: Added. + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + Allow a WKImageRef to be passed in user messages. Right now, it only + works if the image is sharable. + + * UIProcess/API/C/WKPage.cpp: + (WKPageScaleWebView): + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::windowFrame): + Use the more explicit conversion function name. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCreateSnapshotInViewCoordinates): + (WKBundlePageCreateSnapshotInDocumentCoordinates): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: + (WKBundlePageOverlaySetNeedsDisplay): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::snapshotInViewCoordinates): + (WebKit::WebPage::snapshotInDocumentCoordinates): + Add function to take the snapshot. + + * WebProcess/WebPage/WebPage.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-12-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Add additional API for managing databases + https://bugs.webkit.org/show_bug.cgi?id=51629 + + - Adds client for the database manager to get notifications + of changes to databases. + + * UIProcess/API/C/WKDatabaseManager.cpp: + (WKDatabaseManagerSetClient): + * UIProcess/API/C/WKDatabaseManager.h: + * UIProcess/WebDatabaseManagerProxy.cpp: + (WebKit::WebDatabaseManagerProxy::initializeClient): + (WebKit::WebDatabaseManagerProxy::didModifyOrigin): + (WebKit::WebDatabaseManagerProxy::didModifyDatabase): + * UIProcess/WebDatabaseManagerProxy.h: + * UIProcess/WebDatabaseManagerProxy.messages.in: + * UIProcess/WebDatabaseManagerProxyClient.cpp: Added. + (WebKit::WebDatabaseManagerProxyClient::didModifyOrigin): + (WebKit::WebDatabaseManagerProxyClient::didModifyDatabase): + * UIProcess/WebDatabaseManagerProxyClient.h: Added. + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: + (WebKit::WebDatabaseManager::WebDatabaseManager): + (WebKit::WebDatabaseManager::~WebDatabaseManager): + (WebKit::WebDatabaseManager::dispatchDidModifyOrigin): + (WebKit::WebDatabaseManager::dispatchDidModifyDatabase): + * WebProcess/WebCoreSupport/WebDatabaseManager.h: + * win/WebKit2.vcproj: + +2010-12-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Add additional API for managing databases + https://bugs.webkit.org/show_bug.cgi?id=51629 + + - Adds WKDatabaseManagerGetDatabasesByOrigin, which asynchronously returns + an array of dictionaries containing details about each origin using + databases and details about each database. Keys were added for accessing + the data in the dictionaries. + - Adds WKDatabaseManagerDeleteDatabasesWithNameForOrigin to delete a database + with a specific identifier. + - Adds WKDatabaseManagerSetQuotaForOrigin to set the quota for an origin. + + * Shared/OriginAndDatabases.cpp: Added. + (WebKit::OriginAndDatabases::encode): + (WebKit::OriginAndDatabases::decode): + * Shared/OriginAndDatabases.h: Added. + * Shared/WebCoreArgumentCoders.h: + * UIProcess/API/C/WKDatabaseManager.cpp: + (WKDatabaseManagerGetOriginKey): + (WKDatabaseManagerGetOriginQuotaKey): + (WKDatabaseManagerGetOriginUsageKey): + (WKDatabaseManagerGetDatabaseDetailsKey): + (WKDatabaseManagerGetDatabaseDetailsNameKey): + (WKDatabaseManagerGetDatabaseDetailsDisplayNameKey): + (WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey): + (WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey): + (WKDatabaseManagerGetDatabasesByOrigin): + (callGetDatabasesByOriginBlockAndDispose): + (WKDatabaseManagerGetDatabasesByOrigin_b): + (WKDatabaseManagerGetDatabaseOrigins): + (callGetDatabaseOriginsBlockBlockAndDispose): + (WKDatabaseManagerGetDatabaseOrigins_b): + (WKDatabaseManagerDeleteDatabasesWithNameForOrigin): + (WKDatabaseManagerDeleteDatabasesForOrigin): + (WKDatabaseManagerDeleteAllDatabases): + (WKDatabaseManagerSetQuotaForOrigin): + * UIProcess/API/C/WKDatabaseManager.h: + * UIProcess/WebDatabaseManagerProxy.cpp: + (WebKit::WebDatabaseManagerProxy::originKey): + (WebKit::WebDatabaseManagerProxy::originQuotaKey): + (WebKit::WebDatabaseManagerProxy::originUsageKey): + (WebKit::WebDatabaseManagerProxy::databaseDetailsKey): + (WebKit::WebDatabaseManagerProxy::databaseDetailsNameKey): + (WebKit::WebDatabaseManagerProxy::databaseDetailsDisplayNameKey): + (WebKit::WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey): + (WebKit::WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey): + (WebKit::WebDatabaseManagerProxy::invalidate): + (WebKit::WebDatabaseManagerProxy::getDatabasesByOrigin): + (WebKit::WebDatabaseManagerProxy::didGetDatabasesByOrigin): + (WebKit::WebDatabaseManagerProxy::getDatabaseOrigins): + (WebKit::WebDatabaseManagerProxy::didGetDatabaseOrigins): + (WebKit::WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin): + (WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin): + (WebKit::WebDatabaseManagerProxy::setQuotaForOrigin): + * UIProcess/WebDatabaseManagerProxy.h: + * UIProcess/WebDatabaseManagerProxy.messages.in: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: + (WebKit::WebDatabaseManager::getDatabasesByOrigin): + (WebKit::WebDatabaseManager::deleteDatabaseWithNameForOrigin): + (WebKit::WebDatabaseManager::setQuotaForOrigin): + * WebProcess/WebCoreSupport/WebDatabaseManager.h: + * WebProcess/WebCoreSupport/WebDatabaseManager.messages.in: + * win/WebKit2.vcproj: + +2010-12-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Rename DrawingAreaMessage and DrawingAreaLegacyMessage and + DrawingAreaProxyMessage to DrawingAreaProxyLegacyMessage. + + * Platform/CoreIPC/MessageID.h: + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + (WebKit::ChunkedUpdateDrawingAreaProxy::sendSetSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::didReceiveMessage): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::sizeDidChange): + (WebKit::LayerBackedDrawingAreaProxy::setPageIsVisible): + (WebKit::LayerBackedDrawingAreaProxy::update): + (WebKit::LayerBackedDrawingAreaProxy::didReceiveMessage): + (WebKit::LayerBackedDrawingAreaProxy::didReceiveSyncMessage): + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::sizeDidChange): + (WebKit::TiledDrawingAreaProxy::setPageIsVisible): + (WebKit::TiledDrawingAreaProxy::didReceiveMessage): + (WebKit::TiledDrawingAreaProxy::requestTileUpdate): + (WebKit::TiledDrawingAreaProxy::waitUntilUpdatesComplete): + (WebKit::TiledDrawingAreaProxy::takeSnapshot): + (WebKit::TiledDrawingAreaProxy::removeTile): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::setSize): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::setSize): + (WebKit::LayerBackedDrawingArea::didReceiveMessage): + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::display): + (WebKit::TiledDrawingArea::setSize): + (WebKit::TiledDrawingArea::updateTile): + (WebKit::TiledDrawingArea::tileUpdateTimerFired): + (WebKit::TiledDrawingArea::didReceiveMessage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + +2010-12-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Drawing area cleanup. Remove a bunch of redundant functions that just ended + up calling setNeedsDisplay. + + * UIProcess/DrawingAreaProxy.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::invalidateWindow): + (WebKit::WebChromeClient::invalidateContentsAndWindow): + (WebKit::WebChromeClient::invalidateContentsForSlowScroll): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/TiledDrawingArea.cpp: + * WebProcess/WebPage/TiledDrawingArea.h: + +2010-12-25 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fill in some more preferences for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51610 + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetAuthorAndUserStylesEnabled): + (WKPreferencesGetAuthorAndUserStylesEnabled): + (WKPreferencesSetWebArchiveDebugModeEnabled): + (WKPreferencesGetWebArchiveDebugModeEnabled): + (WKPreferencesSetLocalFileContentSniffingEnabled): + (WKPreferencesGetLocalFileContentSniffingEnabled): + (WKPreferencesSetPageCacheEnabled): + (WKPreferencesGetPageCacheEnabled): + (WKPreferencesSetPaginateDuringLayoutEnabled): + (WKPreferencesGetPaginateDuringLayoutEnabled): + (WKPreferencesSetDOMPasteAllowedEnabled): + (WKPreferencesGetDOMPasteAllowedEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/C/WKPreferencesPrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Pipe through some more preferences. + +2010-12-24 Dan Bernstein <mitz@apple.com> + + Reviewed by Alexey Proskuryakov. + + REGRESSION (r74648): XHR layout test failures + https://bugs.webkit.org/show_bug.cgi?id=51603 + + Reverted r74648. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage): + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2010-12-24 Simon Fraser <simon.fraser@apple.com> + + Fix the Qt build after r74650. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + +2010-12-24 Benjamin Poulain <ikipou@gmail.com> + + Reviewed by Darin Adler. + + [Qt] [WK2] WebKit 2 does not build on mac, missing reference to RetainPtr + https://bugs.webkit.org/show_bug.cgi?id=51598 + + Fix the build, add the missing header. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + +2010-12-24 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/8758386> The web process uses its own credential storage + https://bugs.webkit.org/show_bug.cgi?id=51599 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): Try to answer the challenge using + the UI process’s credential storage first. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage): Prevent the web process from using + its own credential storage. + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): Ditto. + +2010-12-23 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Make dragging work again after r74591. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveEvent): Fixed a typo. + +2010-12-23 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Need WebKit2 API to create a SecurityOrigin from protocol, host, and port + https://bugs.webkit.org/show_bug.cgi?id=51563 + + Add WKSecurityOriginCreate(WKStringRef protocol, WKStringRef host, int port). + + * Shared/API/c/WKSecurityOrigin.cpp: + (WKSecurityOriginCreateFromIdentifier): + Renamed so as not to clash with the new WKSecurityOriginCreate. + (WKSecurityOriginCreate): + * Shared/API/c/WKSecurityOrigin.h: + * Shared/WebSecurityOrigin.h: + (WebKit::WebSecurityOrigin::create): + +2010-12-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Ensure that we are not getting too many mouse move events + https://bugs.webkit.org/show_bug.cgi?id=51568 + <rdar://problem/7881470> + <rdar://problem/8735512> + + Implement throttling of mouse move events. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize m_processingMouseMoveEvent to false. + + (WebKit::WebPageProxy::handleMouseEvent): + If we're already processing a mouse move events, just update + m_nextMouseMoveEvent and return. + + (WebKit::WebPageProxy::didReceiveEvent): + If we received a mouse move event, send the next mouse move event if there is one. + +2010-12-23 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Anders Carlsson. + + Assertion when loading www.yahoo.com in WebKit2 under decodeResourceRequest + https://bugs.webkit.org/show_bug.cgi?id=51562 + + Don't assert that our data reference isn't empty when we try to get the data from it. + If it is empty, just return 0. + + All callers are safe with this function returning 0. + + * Platform/CoreIPC/DataReference.h: + (CoreIPC::DataReference::data): Change the assert to an early return. + * Shared/cf/ArgumentCodersCF.cpp: + (CoreIPC::decode): Add an assert, and remove a ternarny operator because the function now does + this for us (if the data is empty, return 0). + +2010-12-23 Sam Weinig <sam@webkit.org> + + Fix incorrect assertion causing all pages with subframes to crash. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::appendChild): + +2010-12-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Clean up the selection handling code + https://bugs.webkit.org/show_bug.cgi?id=51550 + + * Shared/SelectionState.h: Added. + Add SelectionState class which hold information about the current selection. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + Remove selectionChanged function. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + Remove all the selection related state; it lives in the WebPageProxy object now. + + (-[WKView insertText:]): + (-[WKView selectedRange]): + (-[WKView hasMarkedText]): + Get the selection information from the WebPageProxy. + + * UIProcess/API/mac/WKViewInternal.h: + Remove _selectionChanged declaration. + + * UIProcess/PageClient.h: + Remove selectionChanged functions. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::selectionStateChanged): + Update the selection state. + + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::selectionState): + Return the selection state. + + * UIProcess/WebPageProxy.messages.in: + Add SelectionStateChanged message. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + Remove all the selection related state; it lives in the WebPageProxy object now. + + (WebKit::WebView::compositionSelectionChanged): + (WebKit::WebView::onIMEComposition): + (WebKit::WebView::onIMEEndComposition): + (WebKit::WebView::onIMERequestCharPosition): + (WebKit::WebView::onIMERequest): + Get the selection information from the WebPageProxy. + + * WebKit2.xcodeproj/project.pbxproj: + Add SelectionState.h + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::respondToChangedSelection): + Send a SelectionStateChanged message with the updated state. + + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + Remove mac specific code. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getLocationAndLengthFromRange): + Rename this function from convertRangeToPlatformRange and move it out of WebPageMac.mm + + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::getMarkedRange): + (WebKit::WebPage::characterIndexForPoint): + Call getLocationAndLengthFromRange. + + * win/WebKit2.vcproj: + Add SelectionState.h + +2010-12-23 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WKView should not try to do asynchronous validation for selectors that are not editor commands + https://bugs.webkit.org/show_bug.cgi?id=51555 + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): Removed the special case for startSpeaking. + Added call to commandIsSupportedFromMenuOrKeyBinding so we only try to do validation + for commands that are supported. Tweaked comments and added some bug numbers. + (-[WKView _setUserInterfaceItemState:enabled:state:]): Tweaked comment and added + bug number. + +2010-12-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + <rdar://problem/8799032> + REGRESSION(r74436) Crash opening many pages with WebKit2 + + * Shared/cf/ArgumentCodersCF.cpp: + (CoreIPC::decode): + Fix paste-o. Decode into a CFDataRef not a CFDictionaryRef + when decoding CFDataRefs. + +2010-12-22 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + WebKit2 needs to mirror the frame tree in the UIProcess + https://bugs.webkit.org/show_bug.cgi?id=51546 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCopyChildFrames): + * UIProcess/API/C/WKFrame.h: + Add API to get the child frames of a frame. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::WebFrameProxy): + (WebKit::WebFrameProxy::disconnect): + (WebKit::WebFrameProxy::appendChild): + (WebKit::WebFrameProxy::removeChild): + (WebKit::WebFrameProxy::isDescendantOf): + (WebKit::WebFrameProxy::dumpFrameTree): + (WebKit::WebFrameProxy::didRemoveFromHierarchy): + (WebKit::WebFrameProxy::childFrames): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::parentFrame): Add getter. + (WebKit::WebFrameProxy::nextSibling): Add getter. + (WebKit::WebFrameProxy::previousSibling): Add getter. + (WebKit::WebFrameProxy::firstChild): Add getter. + (WebKit::WebFrameProxy::lastChild): Add getter. + Make frames keep track of their subframes. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didCreateSubframe): + Use the now passed parentID to insert the frame into the hierarchy + + (WebKit::WebPageProxy::didSaveFrameToPageCache): + When a frame is added to the page cache, remove it from the hierarchy. + + (WebKit::WebPageProxy::didRestoreFrameFromPageCache): + When a frame is restored from the page cache, add it back to the hierarchy. + + (WebKit::WebPageProxy::didRemoveFrameFromHierarchy): + Detached frames should also be removed from the hierarchy. + + * UIProcess/WebPageProxy.h: + Add new declarations for didSaveFrameToPageCache and didRestoreFrameFromPageCache. + + * UIProcess/WebPageProxy.messages.in: + Add messages for DidSaveFrameToPageCache and DidRestoreFrameFromPageCache. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): + (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame): + Remove notImplemented, there is no work we need to do here. + + (WebKit::WebFrameLoaderClient::didSaveToPageCache): + (WebKit::WebFrameLoaderClient::didRestoreFromPageCache): + Send message to UIProcess to indicate this happened. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::createSubframe): + Send parent frameID in addition to our own in the message to UIProcess. + +2010-12-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + New popup windows open disproportionately big + https://bugs.webkit.org/show_bug.cgi?id=51547 + <rdar://problem/8637029> + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::createNewPage): + Pass the correct size back to the UI process. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::pageRect): + Implement this and return the size of the page. + +2010-12-23 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Nothing happens clicking "launch live player" on live.cnn.com + https://bugs.webkit.org/show_bug.cgi?id=51540 + <rdar://problem/8791086> + + Implement NPN_PushPopupsEnabledState/NPN_PopPopupsEnabledState. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_PushPopupsEnabledState): + Call NetscapePlugin::pushPopupsEnabledState. + + (WebKit::NPN_PopPopupsEnabledState): + Call NetscapePlugin::popPopupsEnabledState. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::pushPopupsEnabledState): + Append the boolean to the vector. + + (WebKit::NetscapePlugin::popPopupsEnabledState): + Remove the last boolean from the vector. + + (WebKit::NetscapePlugin::allowPopups): + Return the last boolean from the vector. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performJavaScriptURLRequest): + Update the "allowPopupsFromPlugin" state. + +2010-12-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Webkit2: WebProcess crashes when Private browsing is turned on on yahoo.com + https://bugs.webkit.org/show_bug.cgi?id=51516 + <rdar://problem/8766995> + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_SetValue): + Add a null check for NPP_SetValue. + +2010-12-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (WK2): Plugins swallow CMD-W, CMD-Q, and probably other shortcuts + https://bugs.webkit.org/show_bug.cgi?id=51515 + <rdar://problem/8740926> + + Always return false for keyboard events where the command key is down. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + +2010-12-22 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + WebProcess should be terminated if invalid frameIDs are + passed to the UIProcess. + https://bugs.webkit.org/show_bug.cgi?id=51508 + + - Introduce a mechanism to mark a messages as invalid due to + reasons other than in ability to decode the message, eg. an + invalid frameID is passed in a message. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::Connection): + (CoreIPC::Connection::markCurrentlyDispatchedMessageAsInvalid): Sets + the m_didReceiveInvalidMessage bit so that it can be picked up in + (CoreIPC::Connection::dispatchMessages): Check for m_didReceiveInvalidMessage in + addition to tainted arguments. + * Platform/CoreIPC/Connection.h: + Add base macro for others to extend, that calls markCurrentlyDispatchedMessageAsInvalid() + ASSERTs, and returns. + + * UIProcess/WebPageProxy.cpp: + Add Message checks for all WebFrameProxy's gotten from frameIDs passed + over the wire. + * UIProcess/WebProcessProxy.cpp: + (WebKit::isGoodMapKey): + Checks that the key can be inserted safely into a map (eg. not the empty or deleted value). + + (WebKit::WebProcessProxy::webFrame): + Return null for bad keys (eg. 0 or -1). + + (WebKit::WebProcessProxy::canCreateFrame): + Added. Checks that the ID is good and not in the map yet. Used + as a consistency check before creating frames. + + (WebKit::WebProcessProxy::frameCreated): + ASSERT that the key is good, in addition to not in the map yet. + + (WebKit::WebProcessProxy::didDestroyFrame): + ASSERT that the key is good. + + * UIProcess/WebProcessProxy.h: + Move WebFrameProxy HashMap type into a typedef. + +2010-12-22 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + WebKit2 needs a way to return the main resource data + https://bugs.webkit.org/show_bug.cgi?id=51510 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetMainResourceData): Added. + (callGetMainResourceDataBlockAndDispose): Added. + (WKFrameGetMainResourceData_b): Added. + * UIProcess/API/C/WKFrame.h: Added WKFrameGetMainResourceData. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::getMainResourceData): Added. + * UIProcess/WebFrameProxy.h: Ditto. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::getMainResourceDataOfFrame): Added. + (WebKit::WebPageProxy::dataCallback): Replaced the individual callbacks + with just these two. + (WebKit::WebPageProxy::stringCallback): Ditto. + * UIProcess/WebPageProxy.h: Ditto. + * UIProcess/WebPageProxy.messages.in: Ditto. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::runJavaScriptInMainFrame): Send the string callback + message instead of a specific one. + (WebKit::WebPage::getContentsAsString): Ditto. + (WebKit::WebPage::getRenderTreeExternalRepresentation): Ditto. + (WebKit::WebPage::getSelectionOrContentsAsString): Ditto. + (WebKit::WebPage::getSourceForFrame): Ditto. + (WebKit::WebPage::getMainResourceDataOfFrame): Added. + (WebKit::WebPage::getWebArchiveOfFrame): Send the data callback message + instead of a specific one. + * WebProcess/WebPage/WebPage.h: Added getMainResourceDataOfFrame. + * WebProcess/WebPage/WebPage.messages.in: Ditto. + +2010-12-22 Darin Adler <darin@apple.com> + + * WebProcess/WebPage/WebPage.cpp: Add #if to try to fix non-Mac builds. + +2010-12-22 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + Make Speech menu items work in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51504 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetWebArchive): Updated to use new-named typedef. + * UIProcess/API/C/WKPage.cpp: + (WKPageRunJavaScriptInMainFrame): Ditto. + (WKPageRenderTreeExternalRepresentation): Ditto. + (WKPageGetSourceForFrame): Ditto. + (WKPageGetContentsAsString): Ditto. + + * UIProcess/API/mac/WKView.mm: + (menuItem): Added. Helper function to make it easy to call menu item + functions on arbitrary user interface items. + (toolbarItem): Ditto. + (-[WKView validateUserInterfaceItem:]): Added validation for startSpeaking + and stopSpeaking commands. Reworked the code to fix a bug where + toggleContinuousSpellChecking would always be enabled even when it should + be disabled. Reworked the asynchronous validation code so it works for + items other than menu items and can also handle more than one item for the + same command. Added some comments. + (speakString): Added. Helper function to be used as a callback when we + get the selection or contents to speak. + (-[WKView startSpeaking:]): Added. Uses getSelectionOrContentsAsString. + (-[WKView stopSpeaking:]): Added. + (-[WKView _setUserInterfaceItemState:enabled:state:]): Reworked to work + with the changes to validateUserInterfaceItem above. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::isDisplayingMarkupDocument): Added a FIXME about + a problem I noticed. + (WebKit::WebFrameProxy::didCommitLoad): Tweaked argument name. + (WebKit::WebFrameProxy::getWebArchive): Changed to use new-named typedef. + * UIProcess/WebFrameProxy.h: Changed WebArchiveCallback to DataCallaback. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Invalidate the two callback maps since + we only have two now. + (WebKit::WebPageProxy::runJavaScriptInMainFrame): Changed to use merged + maps and typedefs so we don't need a separate callback map for each function. + (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): Ditto. + (WebKit::WebPageProxy::getSourceForFrame): Ditto. + (WebKit::WebPageProxy::getContentsAsString): Ditto. + (WebKit::WebPageProxy::getSelectionOrContentsAsString): Added. + (WebKit::WebPageProxy::getWebArchiveOfFrame): Ditto. + (WebKit::WebPageProxy::didGetContentsAsString): Ditto. + (WebKit::WebPageProxy::didGetSelectionOrContentsAsString): Ditto. + (WebKit::WebPageProxy::didRunJavaScriptInMainFrame): Ditto. + (WebKit::WebPageProxy::didGetRenderTreeExternalRepresentation): Ditto. + (WebKit::WebPageProxy::didGetSourceForFrame): Ditto. + (WebKit::WebPageProxy::didGetWebArchiveOfFrame): Ditto. + (WebKit::WebPageProxy::processDidCrash): Ditto. + + * UIProcess/WebPageProxy.h: Updated for changes above. + + * UIProcess/WebPageProxy.messages.in: Added DidGetSelectionOrContentsAsString, + GetIsSpeaking, Speak, and StopSpeaking. + + * UIProcess/mac/WebPageProxyMac.mm: + (WebKit::WebPageProxy::getIsSpeaking): Added. + (WebKit::WebPageProxy::speak): Added. + (WebKit::WebPageProxy::stopSpeaking): Added. + + * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: + (WebKit::WebContextMenuClient::isSpeaking): Call WebPage instead of doing + the work directly, so it can run in the UI process. + (WebKit::WebContextMenuClient::speak): Ditto. + (WebKit::WebContextMenuClient::stopSpeaking): Ditto. + (WebKit::WebContextMenuClient::searchWithSpotlight): Added FIXME comment and + changed code to avoid a C-style cast. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::selectionAsString): Added. + * WebProcess/WebPage/WebFrame.h: Ditto. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): Use sendSync in the + modern way instead of explicitly calling WebProcess. + (WebKit::WebPage::getSelectionOrContentsAsString): Added. + (WebKit::WebPage::isSpeaking): Added. + (WebKit::WebPage::speak): Added. + (WebKit::WebPage::stopSpeaking): Added. + * WebProcess/WebPage/WebPage.h: Added functions. + + * WebProcess/WebPage/WebPage.messages.in: Added GetSelectionOrContentsAsString. + +2010-12-22 Anders Carlsson <andersca@apple.com> + + Fix build. + + * Platform/mac/MachUtilities.cpp: + +2010-12-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Detect WebProcess crashes sooner, without waiting for ReportCrash to finish + https://bugs.webkit.org/show_bug.cgi?id=51505 + + * Platform/CoreIPC/CoreIPCMessageKinds.h: + Add SetExceptionPort. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformInvalidate): + If we have an exception port, unregister it. + + (CoreIPC::Connection::platformInitialize): + Set m_exceptionPort to null. + + (CoreIPC::Connection::open): + If we have an exception port, register an event handler for it and send it over + to the other side. + + (CoreIPC::Connection::receiveSourceEventHandler): + Handle the SetExceptionPort message. + + (CoreIPC::Connection::exceptionSourceEventHandler): + Receive the message, forward it to the real exception handler and call connectionDidClose. + + (CoreIPC::Connection::setShouldCloseConnectionOnMachExceptions): + Create an exception port. + + * Platform/mac/MachUtilities.cpp: + (machExceptionPort): + (setMachExceptionPort): + * Platform/mac/MachUtilities.h: + Add helper functions for getting and setting the mach exception port. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didFinishLaunching): + Call setShouldCloseConnectionOnMachExceptions on Mac. + +2010-12-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Move Mach message receiving code out into a new function + https://bugs.webkit.org/show_bug.cgi?id=51502 + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::readFromMachPort): + (CoreIPC::Connection::receiveSourceEventHandler): + +2010-12-22 Jeff Miller <jeffm@apple.com> + + Reviewed by Sam Weinig. + + InjectedBundle methods should use the relative URL constructor for KURL instead of the ParsedURLStringTag version + https://bugs.webkit.org/show_bug.cgi?id=51491 + + The url passed to various InjectedBundle methods is not from KURL::string(), i.e. it has not already been parsed by KURL, + so we have to use the relative URL constructor for KURL instead of the ParsedURLStringTag version. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::addUserScript): + (WebKit::InjectedBundle::addUserStyleSheet): + (WebKit::InjectedBundle::removeUserScript): + (WebKit::InjectedBundle::removeUserStyleSheet): + +2010-12-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Move more of WebPageProxy::didCommitLoadForFrame into WebFrameProxy::didCommitLoad. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didCommitLoad): Added type and certificate info arguments, + and set m_MIMEType, m_isFrameSet, and m_certificateInfo. + * UIProcess/WebFrameProxy.h: Removed setMIMEType and setCertificateInfo and added + arguments to didCommitLoad. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didCommitLoadForFrame): Removed code that is now inside the + WebFrameProxy::didCommitLoad function. + +2010-12-21 Darin Adler <darin@apple.com> + + Reviewed by Brady Eidson and Sam Weinig. + + Add a way to get a web archive in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51437 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetWebArchive): Added. + (callGetWebArchiveBlockAndDispose): Added. + (WKFrameGetWebArchive_b): Added. + * UIProcess/API/C/WKFrame.h: Added functions above. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Clear out m_webArchiveCallbacks. + (WebKit::WebPageProxy::getWebArchiveOfFrame): Added. + (WebKit::WebPageProxy::didGetWebArchiveOfFrame): Added. + (WebKit::WebPageProxy::processDidCrash): Clear out m_webArchiveCallbacks. + * UIProcess/WebPageProxy.h: Added functions above. + * UIProcess/WebPageProxy.messages.in: Added DidGetWebArchiveOfFrame. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getWebArchiveOfFrame): Added. + * WebProcess/WebPage/WebPage.h: Added function above. + * WebProcess/WebPage/WebPage.messages.in: Added GetWebArchiveOfFrame. + +2010-12-21 Siddharth Mathur <siddharth.mathur@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] [WK2] Guard gcc-specific syntax + + * WebKit2.pro: Non-gcc based compliers choke on the "-include" + syntax for preinclude, make sure it has guard around it. + +2010-12-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Can't stop QT music on santastreefarm.com + https://bugs.webkit.org/show_bug.cgi?id=51438 + <rdar://problem/8741152> + + Implement NPN_ConvertPoint. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_ConvertPoint): + Call NetscapePlugin::convertPoint. + + (WebKit::initializeBrowserFuncs): + Only initialize NPN_ConvertPoint and NPN_PopUpContextMenu on Mac. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::convertPoint): + Implement conversion routines. + + (WebKit::NetscapePlugin::windowAndViewFramesChanged): + Keep track of the window and view frames, they are needed to do coordinate conversion. + +2010-12-21 Sam Weinig <weinig@apple.com> + + Reviewed by Anders Carlsson. + + Implement encoding/decoding of ResourceRequest and + ResourceResponse for Windows/CFNetwork. + + * Shared/win/WebCoreArgumentCodersWin.cpp: + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + +2010-12-21 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Mac WebKit delivers an extra didCommit when loading web archives + https://bugs.webkit.org/show_bug.cgi?id=51419 + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didStartProvisionalLoad): Added assertions so we catch + inconsistencies here instead of at the application level. Later, we will have + to decide what to do in cases these assertions fail. The right policy is probably + to consider it a web process failure and do whatever we do for those. + (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad): Ditto. + (WebKit::WebFrameProxy::didFailProvisionalLoad): Ditto. + (WebKit::WebFrameProxy::didCommitLoad): Ditto. + (WebKit::WebFrameProxy::didFinishLoad): Ditto. + (WebKit::WebFrameProxy::didFailLoad): Ditto. + +2010-12-21 Anders Carlsson <andersca@apple.com> + + Fix Snow Leopard build. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + +2010-12-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Fix crash when a Carbon plug-in fails to initialize correctly + https://bugs.webkit.org/show_bug.cgi?id=51415 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Don't claim to support the QuickDraw event model. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformDestroy): + Only try to remove the window from the map if it's not null. + +2010-12-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add ArgumentCoder support for CFDataRef + https://bugs.webkit.org/show_bug.cgi?id=51412 + + * Shared/cf/ArgumentCodersCF.cpp: + (CoreIPC::typeFromCFTypeRef): + (CoreIPC::encode): + (CoreIPC::decode): + * Shared/cf/ArgumentCodersCF.h: + +2010-12-21 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Clicking missing plug-in text does not show a sheet + https://bugs.webkit.org/show_bug.cgi?id=51403 + + * UIProcess/API/C/WKPage.h: + Add missingPluginButtonClicked to WKPageUIClient. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::missingPluginButtonClicked): + Call the WebUIClient member function. + + * UIProcess/WebPageProxy.messages.in: + Add MissingPluginButtonClicked message. + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::missingPluginButtonClicked): + Call the WKPageUIClient callback. + + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::shouldMissingPluginMessageBeButton): + Always return true for now. + + (WebKit::WebChromeClient::missingPluginButtonClicked): + Send a MissingPluginButtonClicked message. + +2010-12-21 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Set BUILDING_QT__ consistently + https://bugs.webkit.org/show_bug.cgi?id=51341 + + * WebKit2.pro: Remove the definition of BUILDING_QT__ as it + is already defined in WebKit.pri. + +2010-12-20 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Add resource load client API + https://bugs.webkit.org/show_bug.cgi?id=51370 + + This just pipes through the basic resource load client data. + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageResourceLoadClient): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeResourceLoadClient): + (WebKit::WebPageProxy::didInitiateLoadForResource): + (WebKit::WebPageProxy::didSendRequestForResource): + (WebKit::WebPageProxy::didReceiveResponseForResource): + (WebKit::WebPageProxy::didReceiveContentLengthForResource): + (WebKit::WebPageProxy::didFinishLoadForResource): + (WebKit::WebPageProxy::didFailLoadForResource): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebResourceLoadClient.cpp: Added. + (WebKit::WebResourceLoadClient::didInitiateLoadForResource): + (WebKit::WebResourceLoadClient::didSendRequestForResource): + (WebKit::WebResourceLoadClient::didReceiveResponseForResource): + (WebKit::WebResourceLoadClient::didReceiveContentLengthForResource): + (WebKit::WebResourceLoadClient::didFinishLoadForResource): + (WebKit::WebResourceLoadClient::didFailLoadForResource): + * UIProcess/WebResourceLoadClient.h: Added. + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest): + (WebKit::WebFrameLoaderClient::dispatchWillSendRequest): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoading): + * win/WebKit2.vcproj: + +2010-12-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a TextChecker class, hook up spelling and grammar toggling + https://bugs.webkit.org/show_bug.cgi?id=51363 + + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): + (-[WKView toggleContinuousSpellChecking:]): + (-[WKView toggleGrammarChecking:]): + * UIProcess/TextChecker.h: Added. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::unmarkAllMisspellings): + (WebKit::WebPageProxy::unmarkAllBadGrammar): + * UIProcess/WebPageProxy.h: + * UIProcess/mac/TextCheckerMac.mm: Added. + (WebKit::TextChecker::isContinuousSpellCheckingAllowed): + (WebKit::TextChecker::isContinuousSpellCheckingEnabled): + (WebKit::TextChecker::setContinuousSpellCheckingEnabled): + (WebKit::TextChecker::isGrammarCheckingEnabled): + (WebKit::TextChecker::setGrammarCheckingEnabled): + * UIProcess/qt/TextCheckerQt.cpp: Added. + (WebKit::TextChecker::isContinuousSpellCheckingAllowed): + (WebKit::TextChecker::isContinuousSpellCheckingEnabled): + (WebKit::TextChecker::setContinuousSpellCheckingEnabled): + (WebKit::TextChecker::isGrammarCheckingEnabled): + (WebKit::TextChecker::setGrammarCheckingEnabled): + * UIProcess/win/TextCheckerWin.cpp: Added. + (WebKit::TextChecker::isContinuousSpellCheckingAllowed): + (WebKit::TextChecker::isContinuousSpellCheckingEnabled): + (WebKit::TextChecker::setContinuousSpellCheckingEnabled): + (WebKit::TextChecker::isGrammarCheckingEnabled): + (WebKit::TextChecker::setGrammarCheckingEnabled): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::unmarkAllMisspellings): + (WebKit::WebPage::unmarkAllBadGrammar): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + * win/WebKit2.vcproj: + +2010-12-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Flash plug-in does not work on YouTube video page when accelerated compositing is disabled + https://bugs.webkit.org/show_bug.cgi?id=51348 + <rdar://problem/8787667> + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::create): + (WebKit::PluginControllerProxy::PluginControllerProxy): + These now take an additional isAcceleratedCompositingEnabled parameter. + + (WebKit::PluginControllerProxy::isAcceleratedCompositingEnabled): + Return m_isAcceleratedCompositingEnabled. + + * PluginProcess/PluginControllerProxy.h: + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): + This now takes an additional isAcceleratedCompositingEnabled parameter. + + * PluginProcess/WebProcessConnection.messages.in: + Add isAcceleratedCompositingEnabled parameter to the CreatePlugin message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::initialize): + Pass isAcceleratedCompositingEnabled when sending the CreatePlugin message. + +2010-12-20 Anders Carlsson <andersca@apple.com> + + Unreviewed, rolling out r74345. + http://trac.webkit.org/changeset/74345 + https://bugs.webkit.org/show_bug.cgi?id=51115 + + Not the correct fix. + + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::open): + +2010-12-20 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Crash in web process after the connection had been closed + https://bugs.webkit.org/show_bug.cgi?id=51115 + + Do not call connectionDidClose with a connection that has been explicitly + invalidated on the listener thread. + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::disconnectHandler): Added. + (CoreIPC::Connection::open): + +2010-12-19 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Improve the fix for <rdar://problem/8769525>. + + * UIProcess/API/mac/WKView.mm: + (-[WKView performKeyEquivalent:]): Do not retain the view. Doing so is necessary in + -[WebHTMLView performKeyEquivalent:], which this method was based upon, but not here, because + there is no way for the web process to cause the WKView to be released while it is handling + the event. + +2010-12-19 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8769525> WKView leak when performing key equivalents + https://bugs.webkit.org/show_bug.cgi?id=51315 + + * UIProcess/API/mac/WKView.mm: + (-[WKView performKeyEquivalent:]): Use a RetainPtr to ensure that the view is released in the + early return code path. + +2010-12-19 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] QWKPagePrivate::paint() does not need to save the graphics context + https://bugs.webkit.org/show_bug.cgi?id=51300 + + Remove the unnecessary save() and restore() on the QPainter. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::paint): + +2010-12-19 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] [WK2] Client are expected to render their own background for WebPages + https://bugs.webkit.org/show_bug.cgi?id=51296 + + Remove the rendering of the checkerboard from the tiled DrawingAreaProxy + + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::paint): + * UIProcess/TiledDrawingAreaTile.h: + * UIProcess/qt/TiledDrawingAreaTileQt.cpp: + +2010-12-19 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] Client are expected to render their own background for WebPages + https://bugs.webkit.org/show_bug.cgi?id=51296 + + Do not render a white background before rendering the page with DrawingAreaProxy. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::paint): + +2010-12-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Window title for image documents shows corrupted characters instead of multiplication sign when using WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=43505 + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Changed UI_STRING macros to return + WebCore::String objects instead of C strings. + (WebKit::formatLocalizedString): Added. Uses the Core Foundation string formatting function for + reasons explained in the comment. + (WebKit::WebPlatformStrategies::multipleFileUploadText): Use formatLocalizedString instead of + String::format. + (WebKit::WebPlatformStrategies::imageTitle): Ditto. + (WebKit::WebPlatformStrategies::localizedMediaTimeDescription): Ditto. + +2010-12-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Resizing a WKView while loading a page can leave the page at a size that doesn't match the window + https://bugs.webkit.org/show_bug.cgi?id=51282 + <rdar://problem/8133142> + + Fix a race condition in waitForMessage. If we time out on the wait condition, we would keep the + m_waitForMessageMutex mutex unlocked for a brief period of time before taking the lock again and + then removing the messageID/destinationID pair from the hash map. Under some circumstances, the + connection queue would update the hash map right before we removed it, leading to a lost message. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::waitForMessage): + +2010-12-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Clean up ChunkedUpdateDrawingAreaProxy + https://bugs.webkit.org/show_bug.cgi?id=51277 + + Get rid of m_lastSetViewSize since it was always equal to m_size. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::sizeDidChange): + Call sendSetSize(). + + (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize): + Call sendSetSize if the size differs. + + (WebKit::ChunkedUpdateDrawingAreaProxy::sendSetSize): + Move code from sizeDidChange over here. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::setSize): + Add back the early return if the sizes are equal. + +2010-12-17 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::canHandleRequest): Provide alternative for + non-CFNetwork implementation. + +2010-12-17 Ada Chan <adachan@apple.com> + + Reviewed by Anders Carlsson. + + Implement WKView::setInitialFocus(). + https://bugs.webkit.org/show_bug.cgi?id=51274 + + * UIProcess/API/C/win/WKView.cpp: + (WKViewSetInitialFocus): + * UIProcess/API/C/win/WKView.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setInitialFocus): Send message to the Web Process to set + initial focus. + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setInitialFocus): + * UIProcess/win/WebView.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setInitialFocus): Set the focused node to null initially. Then + ask FocusController to set the initial focus based on the focus direction. + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: Add a new message for SetInitialFocus. + +2010-12-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove a check that probably uncovered a resizing bug. + + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::setSize): + +2010-12-17 Brian Weinstein <bweinstein@apple.com> + + Qt build fix. + + * UIProcess/qt/WebPopupMenuProxyQt.h: + +2010-12-17 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Anders Carlsson. + + Text area does not update when you arrow through a <select> in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51269 + <rdar://problem/8612853> + + Patch by Sam Weinig. + + Insteaed of keeping track of the selected index of a <select> just in the UI process, we + need to pass this information along to the web process so that the web process can draw + the correct text in the text field at the top of the select, when the selection changes (via + the arrows or other typing while the select is opened). + + When the selected item in a popup changes, the UI process sends a message to the web process, telling + it about the new selected index. The web process gets this message, and then sets the text that + is visible in the select element. + + * UIProcess/API/mac/PageClientImpl.h: CreatePopupMenuProxy now takes a WebPageProxy. + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::createPopupMenuProxy): Pass the WebPageProxy to create. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createPopupMenuProxy): + * UIProcess/API/qt/qwkpage_p.h: CreatePopupMenuProxy now takes a WebPageProxy. + * UIProcess/PageClient.h: CreatePopupMenuProxy now takes a WebPageProxy. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::valueChangedForPopupMenu): Send that the selected index changed to the + web process.selected + (WebKit::WebPageProxy::setTextFromItemForPopupMenu): Send that we should update the text for the + active popup menu (with the index of the item to show). + (WebKit::WebPageProxy::showPopupMenu): Pass the WebPageProxy to createPopupMenuProxy. + * UIProcess/WebPageProxy.h: + * UIProcess/WebPopupMenuProxy.h: Add a client who has virtual functions for the state changing of the + popup menu. ShowPopupMenu doesn't take a new selected index anymore, that is handled by the client, + and calling down to the web process. + (WebKit::WebPopupMenuProxy::Client::~Client): + (WebKit::WebPopupMenuProxy::WebPopupMenuProxy): Initialize the client. + * UIProcess/mac/WebPopupMenuProxyMac.h: + (WebKit::WebPopupMenuProxyMac::create): Takes a WebPopupMenuProxy::Client, and passes it to the constructor. + * UIProcess/mac/WebPopupMenuProxyMac.mm: + (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac): Update what's initialized by the constructor. + (WebKit::WebPopupMenuProxyMac::showPopupMenu): Call through to the web process that the value changed. + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (WebKit::WebPopupMenuProxyQt::WebPopupMenuProxyQt): Update what's initialized by the constructor. + * UIProcess/win/WebPopupMenuProxyWin.cpp: + (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin): Ditto. + (WebKit::WebPopupMenuProxyWin::showPopupMenu): Call through to the web process that the value changed. + (WebKit::WebPopupMenuProxyWin::setFocusedIndex): Resolve a FIXME to set the text of the popup menu. + * UIProcess/win/WebPopupMenuProxyWin.h: + (WebKit::WebPopupMenuProxyWin::create): Take in a WebPopupMenuProxy::client, and pass it to the constructor. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createPopupMenuProxy): Pass the WebPageProxy to create. + * UIProcess/win/WebView.h: + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::setTextForIndex): Call through to setTextFromItem to set the select text. + * WebProcess/WebCoreSupport/WebPopupMenu.h: + * WebProcess/WebPage/WebPage.cpp: Call through to setTextForIndex on the active popup menu. + (WebKit::WebPage::setTextForActivePopupMenu): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: Add a new message. + +2010-12-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + DrawingAreaProxy::setSize shouldn't be a virtual member function + https://bugs.webkit.org/show_bug.cgi?id=51275 + + Add a pure virtual sizeDidChange member function to DrawingAreaProxy, and only + call it if the size changes. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::sizeDidChange): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::setSize): + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::size): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::sizeDidChange): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::sizeDidChange): + * UIProcess/TiledDrawingAreaProxy.h: + +2010-12-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a WebPageProxy parameter to the DrawingAreaProxy constructor + https://bugs.webkit.org/show_bug.cgi?id=51271 + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::]): + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::create): + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + * UIProcess/DrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::create): + (WebKit::LayerBackedDrawingAreaProxy::LayerBackedDrawingAreaProxy): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::create): + (WebKit::TiledDrawingAreaProxy::TiledDrawingAreaProxy): + * UIProcess/TiledDrawingAreaProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + +2010-12-17 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + Add API for "Always Use the Complex Text Code Path" + https://bugs.webkit.org/show_bug.cgi?id=51265 + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Initialize shouldAlwaysUseComplexTextCodePath. + (WebKit::WebProcessCreationParameters::encode): Encode shouldAlwaysUseComplexTextCodePath. + (WebKit::WebProcessCreationParameters::decode): Decode shouldAlwaysUseComplexTextCodePath. + * Shared/WebProcessCreationParameters.h: + * UIProcess/API/C/WKContext.cpp: + (_WKContextSetAlwaysUsesComplexTextCodePath): Added. + * UIProcess/API/C/WKContextPrivate.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): Initialize m_alwaysUsesComplexTextCodePath. + (WebKit::WebContext::ensureWebProcess): Set shouldAlwaysUseComplexTextCodePath in the creation parameters. + (WebKit::WebContext::setAlwaysUsesComplexTextCodePath): Added. Sets m_alwaysUsesComplexTextCodePath and + sends a message to the WebProcess. + * UIProcess/WebContext.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): Call setAlwaysUsesComplexTextCodePath() based on the creation + parameters. + (WebKit::WebProcess::setAlwaysUsesComplexTextCodePath): Added. + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: Added SetAlwaysUsesComplexTextCodePath. + +2010-12-17 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + WebKit2: Implement a title attribute per frame + https://bugs.webkit.org/show_bug.cgi?id=51266 + + Cache the title of each frame on the WebFrameProxy. Removes + the WebPageProxy's cache of the main frame title to just + access the main frame. + + We clear the cached title on new committed loads and on failures + to load. + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCopyTitle): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didCommitLoad): + (WebKit::WebFrameProxy::didFailLoad): + (WebKit::WebFrameProxy::didChangeTitle): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::title): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::pageTitle): + (WebKit::WebPageProxy::didReceiveTitleForFrame): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + +2010-12-16 Darin Adler <darin@apple.com> + + Reviewed by Maciej Stachowiak. + + Add text encoding menu API for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=51226 + + * UIProcess/API/C/WKPage.cpp: + (WKPageSupportsTextEncoding): Added. + (WKPageCopyCustomTextEncodingName): Added. + (WKPageSetCustomTextEncodingName): Added. + * UIProcess/API/C/WKPage.h: Added the functions above. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Initialize + m_mainFrameHasCustomRepresentation to false. + (WebKit::WebPageProxy::supportsTextEncoding): Added. + (WebKit::WebPageProxy::setCustomTextEncodingName): Added. + (WebKit::WebPageProxy::didCommitLoadForFrame): Set + m_mainFrameHasCustomRepresentation. + + * UIProcess/WebPageProxy.h: Added supportsTextEncoding, + setCustomTextEncodingName, customTextEncodingName, and + m_mainFrameHasCustomRepresentation. + + * UIProcess/WebPageProxy.messages.in: Tweaked formatting + (added a blank line). + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setCustomTextEncodingName): Added. + * WebProcess/WebPage/WebPage.h: Added setCustomTextEncodingName. + + * WebProcess/WebPage/WebPage.messages.in: Added the + SetCustomTextEncodingName message. Tweaked formatting of the + dummy message. + +2010-12-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r74201. + http://trac.webkit.org/changeset/74201 + https://bugs.webkit.org/show_bug.cgi?id=51248 + + It broke ~6000 layout tests (Requested by Ossy_ on #webkit). + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::setGeometry): + (QGraphicsWKView::itemChange): + +2010-12-16 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Add svn:eol-style native to the message.in files as a favor to Darin Adler. + + * PluginProcess/PluginControllerProxy.messages.in: Added property svn:eol-style. + * PluginProcess/PluginProcess.messages.in: Added property svn:eol-style. + * PluginProcess/WebProcessConnection.messages.in: Added property svn:eol-style. + * Shared/Plugins/NPObjectMessageReceiver.messages.in: Added property svn:eol-style. + * UIProcess/Downloads/DownloadProxy.messages.in: Added property svn:eol-style. + * UIProcess/Plugins/PluginProcessProxy.messages.in: Added property svn:eol-style. + * UIProcess/WebContext.messages.in: Added property svn:eol-style. + * UIProcess/WebDatabaseManagerProxy.messages.in: Added property svn:eol-style. + * UIProcess/WebInspectorProxy.messages.in: Added property svn:eol-style. + * UIProcess/WebPageProxy.messages.in: Added property svn:eol-style. + * UIProcess/WebProcessProxy.messages.in: Added property svn:eol-style. + * WebProcess/Authentication/AuthenticationManager.messages.in: Added property svn:eol-style. + * WebProcess/Plugins/PluginProxy.messages.in: Added property svn:eol-style. + * WebProcess/WebCoreSupport/WebDatabaseManager.messages.in: Added property svn:eol-style. + * WebProcess/WebPage/WebInspector.messages.in: Added property svn:eol-style. + * WebProcess/WebPage/WebPage.messages.in: Added property svn:eol-style. + * WebProcess/WebProcess.messages.in: Added property svn:eol-style. + +2010-12-16 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move NSURLCache initialization from the ProcessLauncherMac to the centralized + WebContext initialize WebProcess mechanism. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformInitializeWebProcess): + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::setShouldPaintNativeControls): + +2010-12-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Defer getting a PluginProcessConnection object until the plug-in is initialized + https://bugs.webkit.org/show_bug.cgi?id=51207 + <rdar://problem/8731306> + + Before this change, we would pass the PluginProcessConnection to the PluginProxy constructor, but not + call PluginProcessConnection::addPluginProxy (which associates the plug-in proxy with the connection) + until the plug-in is initialized. + + This could lead to a PluginProxy holding a reference to a PluginProcessConnection when the PluginProxyConnection + itself did not know anything about the PluginProxy. This would happen when a page with plug-ins is opened in a background + tab, with the plug-ins not yet initialized. + + Because of this, we could end up in a weird state, where the PluginProcessConnection would think that there are no + more plug-ins alive, and invalidate (and null out) the underlying CoreIPC connection, which would lead to crashes + when trying to send messages to the connection during later initialization. + + The fix is to pass the plug-in path to the PluginProxy constructor, and get the connection from PluginProxy::initialize. + + PluginProcessConnection object + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::create): + (WebKit::PluginProxy::PluginProxy): + (WebKit::PluginProxy::initialize): + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + +2010-12-16 Enrica Casucci <enrica@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKit2: Cannot copy two successive selections using cmd-c + <rdar://problem/8680309> + https://bugs.webkit.org/show_bug.cgi?id=51203 + + The previous implementation assumed a call sequence from AppKit that + was not always happening. + When the user clicks on the pulldown menu, AppKit sends validateUserInterfaceItem + calls for each element that needs validation and we used to count the number of + validation requests being sent to the web process. + All these calls are made before we have the chance to get one reply from the WebProcess. + We also delayed the menu update until we had received all the replies to the validation requests. + At that point we called update on the menu to trigger the validation one more time with + the data retrived from the WebProcess. + When the user simply presses cmd-c, only one call to vaidateUserInterfaceItem is made + and the menu update triggered the validation of all the menu entries causing the internal + state to be out of sync. + The new implementation is very simple: for each validation request from AppKit we send + a request to the WebProcess and we cache a reference to the menu item being validated. + When the WebProcess replies, we retrieve the menu item from our cache and update its state. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): Removed initialization of deleted memebers. + (-[WKView validateUserInterfaceItem:]): Request validation to the WebProcess and return YES to + allow AppKit to do the keyBinding processing. + (-[WKView _setUserInterfaceItemState:enabled:state:]): Called when the WebProcess replies to the + validation request to check/uncheck and enable/disable the menu item. + +2010-12-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Don't try to call plug-in member functions if the plug-in hasn't been initialized + https://bugs.webkit.org/show_bug.cgi?id=51205 + <rdar://problem/8730204> + + Make sure that all PluginView functions that can be called while a plug-in has not been + initialized (if the plug-in page is in a background tab for example) have an additional + check for m_isInitialized. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::setWindowIsFocused): + (WebKit::PluginView::windowAndViewFramesChanged): + (WebKit::PluginView::platformLayer): + (WebKit::PluginView::scriptObject): + (WebKit::PluginView::privateBrowsingStateChanged): + (WebKit::PluginView::handleEvent): + (WebKit::PluginView::viewGeometryDidChange): + (WebKit::PluginView::setFocus): + +2010-12-16 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Add a bunch of m_isStarted assertions to plug-in code. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::frameDidFinishLoading): + (WebKit::NetscapePlugin::frameDidFail): + (WebKit::NetscapePlugin::didEvaluateJavaScript): + (WebKit::NetscapePlugin::streamDidReceiveResponse): + (WebKit::NetscapePlugin::streamDidReceiveData): + (WebKit::NetscapePlugin::streamDidFinishLoading): + (WebKit::NetscapePlugin::streamDidFail): + (WebKit::NetscapePlugin::manualStreamDidReceiveResponse): + (WebKit::NetscapePlugin::manualStreamDidReceiveData): + (WebKit::NetscapePlugin::manualStreamDidFinishLoading): + (WebKit::NetscapePlugin::manualStreamDidFail): + (WebKit::NetscapePlugin::handleMouseEvent): + (WebKit::NetscapePlugin::handleWheelEvent): + (WebKit::NetscapePlugin::handleMouseEnterEvent): + (WebKit::NetscapePlugin::handleMouseLeaveEvent): + (WebKit::NetscapePlugin::handleKeyboardEvent): + (WebKit::NetscapePlugin::setFocus): + (WebKit::NetscapePlugin::pluginScriptableNPObject): + (WebKit::NetscapePlugin::privateBrowsingStateChanged): + +2010-12-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Save the manual plug-in stream data and redeliver it when the plug-in is initialized + https://bugs.webkit.org/show_bug.cgi?id=51201 + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Initialize m_manualStreamState. + + (WebKit::PluginView::manualLoadDidReceiveResponse): + If the plug-in hasn't been initialized, store the response. + + (WebKit::PluginView::manualLoadDidReceiveData): + If the plug-in hasn't been initialized, store the data. + + (WebKit::PluginView::manualLoadDidFinishLoading): + If the plug-in hasn't been initialized, update the state. + + (WebKit::PluginView::manualLoadDidFail): + If the plug-in hasn't been initialized, store the error and update the state. + + (WebKit::PluginView::initializePlugin): + Call redeliverManualStream. + + (WebKit::PluginView::redeliverManualStream): + Redeliver the manual stream to the plug-in. + + * WebProcess/Plugins/PluginView.h: + +2010-12-16 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Turn off drawing area updates if the item is not visible + + The updates are controlled by the QGraphicsItem::visible property. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKViewPrivate::updateViewportSize): + (QGraphicsWKView::setGeometry): + (QGraphicsWKView::itemChange): + +2010-12-15 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8731320> WebProcess’s CFNetwork cache is in ~/Library/Caches/com.apple.WebProcess + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): Get the location, disk capacity and memory capacity + of the UI process’s NSURLCache and pass them to the WebProcess. + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): If an NSURLCache location was passed on the command line, set the + shared NSURLCache to that path and use the specified capacities as initial values. + +2010-12-15 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam “I blame andersca” Weinig. + + Allow responses to be cached by the NSURLCache. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::willCacheResponse): Changed to return the response instead of 0. + +2010-12-14 Enrica Casucci <enrica@apple.com> + + Reviewed by Adam Roben. + + Add IME support to WebKit2 on Windows + https://bugs.webkit.org/show_bug.cgi?id=51049 + The implementation is very close to the one in WebKit. + The main change is the addition of handlers for WM_IME_STARTCOMPOSITION, + WM_IME_REQUEST, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION, + WM_IME_SELECT, WM_IME_SETCONTEXT and a number of new messages + between the UI process and the WebProcess to send/retrieve + the data being handled by the messages listed above. + + * UIProcess/PageClient.h: Added compositionSelectionChanged for Windows platform. + * UIProcess/WebPageProxy.cpp: + The following methods send synchronous messages to the WebProcess. + (WebKit::WebPageProxy::firstRectForCharacterInSelectedRange): Retrieves the rectangle to position + the cnadidates window. + (WebKit::WebPageProxy::getSelectedText): Retrieves the currently selected text. + The following methods send asynchronous messages to the WebProcess. + (WebKit::WebPageProxy::confirmComposition): + (WebKit::WebPageProxy::setComposition): + (WebKit::WebPageProxy::didChangeSelection): Name changed. + (WebKit::WebPageProxy::didChangeCompositionSelection): Called when there is a change + in the composition selection. + * UIProcess/WebPageProxy.messages.in: Added messages corresponding to the methods above. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): Added handling of messages for IME. + The following are the handlers for the window message being sent during composition. + (WebKit::WebView::onIMEComposition): + (WebKit::WebView::onIMEEndComposition): + (WebKit::WebView::onIMERequestCharPosition): + (WebKit::WebView::onIMERequestReconvertString): + (WebKit::WebView::onIMERequest): + (WebKit::WebView::onIMESelect): + (WebKit::WebView::onIMESetContext): + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::respondToChangedSelection): Added notification + of composition selection changed for Windows. + * WebProcess/WebPage/win/WebPageWin.cpp: + The following are the WebProcess counterparts of the new messages. + (WebKit::WebPage::confirmComposition): + (WebKit::WebPage::setComposition): + (WebKit::WebPage::firstRectForCharacterInSelectedRange): + (WebKit::WebPage::getSelectedText): + +2010-12-15 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Loading webkit.org over and over is slower in WebKit2 than WebKit1, looks like page is not cached + <rdar://problem/8774683> + https://bugs.webkit.org/show_bug.cgi?id=51143 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::canCachePage): Return true as long as we + are not a custom representation (eg. a PDF). + (WebKit::WebFrameLoaderClient::shouldCacheResponse): Always return true. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): Enable the page cache. + +2010-12-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adele Peterson. + + WebKit2 in compositing mode no longer has font smoothing + https://bugs.webkit.org/show_bug.cgi?id=50733 + + Tell the root GraphicsLayer that its contents are opaque + if the WebPage draws its background, and that background + is not transparent. + + The GraphicsLayer then uses the 'contentsOpaque' setting to + determine whether to use font smoothing. + + Add pageBackgroundTransparencyChanged() to DrawingArea + so that the WebPage can inform the DrawingArea when the + background transparency changes. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::pageBackgroundTransparencyChanged): + (WebKit::DrawingArea::onPageClose): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::pageBackgroundTransparencyChanged): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setDrawsBackground): + (WebKit::WebPage::setDrawsTransparentBackground): + +2010-12-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix assertion in plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html test + https://bugs.webkit.org/show_bug.cgi?id=51136 + + Ensure that a plug-in that has explicitly cancelled the manual stream won't get any more callbacks. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::PluginControllerProxy): + (WebKit::PluginControllerProxy::cancelManualStreamLoad): + (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse): + (WebKit::PluginControllerProxy::manualStreamDidReceiveData): + (WebKit::PluginControllerProxy::manualStreamDidFinishLoading): + (WebKit::PluginControllerProxy::manualStreamDidFail): + * PluginProcess/PluginControllerProxy.h: + +2010-12-15 Brian Weinstein <bweinstein@apple.com> + + Windows Build Fix. A .h file was added to the vcproj twice, but not its corresponding cpp file. + + * win/WebKit2.vcproj: + +2010-12-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Can't add files to an <input type=file> + https://bugs.webkit.org/show_bug.cgi?id=51087 + + * Scripts/webkit2/messages.py: + Adds new types. + + * Shared/API/c/WKBase.h: + Adds WKOpenPanelParametersRef and WKOpenPanelResultListenerRef. + + * Shared/APIObject.h: + Adds TypeOpenPanelParameters and TypeOpenPanelResultListener. + + * Shared/WebOpenPanelParameters.cpp: Added. + (WebKit::WebOpenPanelParameters::create): + (WebKit::WebOpenPanelParameters::WebOpenPanelParameters): + (WebKit::WebOpenPanelParameters::~WebOpenPanelParameters): + (WebKit::WebOpenPanelParameters::Data::encode): + (WebKit::WebOpenPanelParameters::Data::decode): + * Shared/WebOpenPanelParameters.h: Added. + (WebKit::WebOpenPanelParameters::allowMultipleFiles): + (WebKit::WebOpenPanelParameters::type): + Class representing options one can pass to open panel. + + * UIProcess/API/C/WKAPICast.h: + Add casts for WebOpenPanelParameters and WebOpenPanelResultListenerProxy. + + * UIProcess/API/C/WKOpenPanelParameters.cpp: Added. + (WKOpenPanelParametersGetTypeID): + (WKOpenPanelParametersGetAllowsMultipleFiles): + * UIProcess/API/C/WKOpenPanelParameters.h: Added. + * UIProcess/API/C/WKOpenPanelResultListener.cpp: Added. + (WKOpenPanelResultListenerGetTypeID): + (WKOpenPanelResultListenerChooseFiles): + (WKOpenPanelResultListenerCancel): + * UIProcess/API/C/WKOpenPanelResultListener.h: Added. + Add API wrappers. + + * UIProcess/API/C/WKPage.h: + Add new UI callback, WKPageRunOpenPanelCallback. + + * UIProcess/API/C/WebKit2.h: + Add includes for new API headers. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + Stub out the runOpenPanel callback. + + * UIProcess/WebOpenPanelResultListenerProxy.cpp: Added. + (WebKit::WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy): + (WebKit::WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy): + (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): + (WebKit::WebOpenPanelResultListenerProxy::cancel): + (WebKit::WebOpenPanelResultListenerProxy::invalidate): + * UIProcess/WebOpenPanelResultListenerProxy.h: Added. + (WebKit::WebOpenPanelResultListenerProxy::create): + (WebKit::WebOpenPanelResultListenerProxy::type): + Adds the listener used to choose files for <input type=file> + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::runOpenPanel): + (WebKit::WebPageProxy::didChooseFilesForOpenPanel): + (WebKit::WebPageProxy::didCancelForOpenPanel): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::runOpenPanel): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::runOpenPanel): + * WebProcess/WebPage/WebOpenPanelResultListener.cpp: Added. + (WebKit::WebOpenPanelResultListener::create): + (WebKit::WebOpenPanelResultListener::WebOpenPanelResultListener): + (WebKit::WebOpenPanelResultListener::~WebOpenPanelResultListener): + (WebKit::WebOpenPanelResultListener::didChooseFiles): + * WebProcess/WebPage/WebOpenPanelResultListener.h: Added. + (WebKit::WebOpenPanelResultListener::disconnectFromPage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): + (WebKit::WebPage::setActiveOpenPanelResultListener): + (WebKit::WebPage::didChooseFilesForOpenPanel): + (WebKit::WebPage::didCancelForOpenPanel): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::activeOpenPanelResultListener): + * WebProcess/WebPage/WebPage.messages.in: + Pipe through file choosing. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2010-12-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + Semi-reproducible crash in ChunkedUpdateDrawingArea::paintIntoUpdateChunk closing a particular yahoo page + https://bugs.webkit.org/show_bug.cgi?id=51126 + <rdar://problem/8771219> + + Laying out the web page can cause the drawing area to change so we need to protect against this. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::display): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::display): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::updateLayoutRunLoopObserverFired): + +2010-12-15 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + WebKit2: WebPageWin needs implementations of hasLocalDataForURL and canHandleRequest + https://bugs.webkit.org/show_bug.cgi?id=51090 + + Implement these functions for WebKit2 on Windows. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::hasLocalDataForURL): Does the cross-platform part of the check for having local + data (file URL or subresource), then calls platformHasLocalDataForURL to let the platform do + their specific checks. + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::platformHasLocalDataForURL): Moved the cross-platform code from here to WebPage::hasLocalDataForURL. + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL. + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL and implemented with CFNetwork calls. This is the + CFNetwork equivalent of the code in WebPageMac::platformHasLocalDataForURL. + (WebKit::WebPage::canHandleRequest): Copied the line of code from WebView::canHandleRequest in WebKit1, with a FIXME saying + this might not be enough (although it was in WebKit1 on Windows). + +2010-12-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r74117. + http://trac.webkit.org/changeset/74117 + https://bugs.webkit.org/show_bug.cgi?id=51113 + + This broke the GTK1 build. (Requested by mrobinson on + #webkit). + + * GNUmakefile.am: Removed. + * Scripts/generate-forwarding-headers.pl: + * WebKit2Prefix.h: + * gtk/webkit2.pc.in: Removed. + +2010-12-15 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + Changes to enable building WebKit2 for Gtk port. + (https://bugs.webkit.org/show_bug.cgi?id=37369) + + * GNUmakefile.am: Added. + * Scripts/generate-forwarding-headers.pl: For GTK port, taking 1 extra argument for copying network headers. + * WebKit2Prefix.h: Included WebCore/config.h for GTK port as the first header file for WebKit2 sources files. + * gtk: Added. + * gtk/webkit2.pc.in: Added. + +2010-12-15 Jan Erik Hanssen <jhanssen@sencha.com> + + Reviewed by Andreas Kling. + + [Qt][WK2] webkit2 does not compile on OS X + https://bugs.webkit.org/show_bug.cgi?id=50128 + + prctl(2) is only available on Linux, so use an atexit handler for killing + all the child processes when the process is exiting. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::cleanupProcesses): + (WebKit::QtWebProcess::QtWebProcess): + (WebKit::QtWebProcess::processStateChanged): + (WebKit::ProcessLauncherHelper::instance): + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * win/WebKit2Common.vsprops: + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Fix Qt build. + + * WebKit2.pro: + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by TYPO FIX. + + Fix a typo. + + * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: + (WebKit::NetscapePluginModule::determineQuirks): + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cannot type into plugin edit field + https://bugs.webkit.org/show_bug.cgi?id=51074 + <rdar://problem/8483741> + + Add a PrognameShouldBeWebKitPluginHost quirk, since it turns out Flash Player calls getprogname() and checks + if the return value is "WebKitPluginHost" in order to determine when to handle NPCocoaEventKeyDown events. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::netscapePluginModule): + If the plug-in module has the PrognameShouldBeWebKitPluginHost quirk, call setprogname("WebKitPluginHost"). + + * Shared/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::load): + Call determineQuirks() + + * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: + (WebKit::NetscapePluginModule::determineQuirks): + Add the PrognameShouldBeWebKitPluginHost quirk for Flash. + + * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: + (WebKit::NetscapePluginModule::determineQuirks): + * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp: + (WebKit::NetscapePluginModule::determineQuirks): + Add stubs. + + * Shared/Plugins/PluginQuirks.h: + Add new PluginQuirks file. + + * WebKit2.xcodeproj/project.pbxproj: + Add PluginQuirks.h + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a NetscapePluginModuleX11 and move the Qt implementation of PluginInfoStore::getPluginInfo there + https://bugs.webkit.org/show_bug.cgi?id=51066 + + * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp: Copied from WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp. + (WebKit::NetscapePluginModule::getPluginInfo): + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::getPluginInfo): + * WebKit2.pro: + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Move Windows version of getPluginInfo to NetscapePluginModule + https://bugs.webkit.org/show_bug.cgi?id=51073 + + * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: Added. + (WebKit::getVersionInfo): + (WebKit::fileVersion): + (WebKit::NetscapePluginModule::getPluginInfo): + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::PluginInfoStore::getPluginInfo): + * win/WebKit2.vcproj: + +2010-12-14 Alice Liu <alice.liu@apple.com> + + Fix clang++ build. + + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::sendSync): + Move the default argument to the declaration. + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move PluginInfoStore::getPluginInfo to NetscapePluginModule + https://bugs.webkit.org/show_bug.cgi?id=51058 + + * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: + Move implementation of PluginInfoStore::getPluginInfo and related + helper functions here. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::getPluginInfo): + Just call NetscapePluginModule::getPluginInfo here for now. + + * WebKit2.xcodeproj/project.pbxproj: + Add NetscapePluginModuleMac.mm. + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Switch name and description order when fetching Carbon plug-in info + https://bugs.webkit.org/show_bug.cgi?id=46211 + + The plug-in description comes before the name in the Carbon string list resource. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::getPluginInfoFromCarbonResources): + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move NetscapePluginModule.{cpp|h} to Shared/Plugins/Netscape + https://bugs.webkit.org/show_bug.cgi?id=51052 + + * Shared/Plugins/Netscape/NetscapePluginModule.cpp: Renamed from WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp. + * Shared/Plugins/Netscape/NetscapePluginModule.h: Renamed from WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.h. + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + +2010-12-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle complex text input for plug-ins + https://bugs.webkit.org/show_bug.cgi?id=51047 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::sendComplexTextInput): + Pass along the text input to the plug-in. + + * PluginProcess/PluginControllerProxy.messages.in: + Add SendComplexTextInput message. + + * UIProcess/API/mac/WKTextInputWindowController.h: Added. + * UIProcess/API/mac/WKTextInputWindowController.mm: Added. + Add text input window controller, mostly copied from WebKit1. + + * UIProcess/API/mac/WKView.mm: + (-[WKView keyDown:]): + If needed, pass along the event to the text input window controller. + + (-[WKView inputContext]): + Return the input context of the text input window controller. + + (-[WKView _setComplexTextInputEnabled:pluginComplexTextInputIdentifier:]): + Notify the input window controller that the input source changed. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::sendComplexTextInputToPlugin): + Send the complex text input to the web process. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::convertStringToKeyCodes): + Convert a string to a vector of key codes in the current encoding. + + (WebKit::NetscapePlugin::sendComplexTextInput): + In the Cocoa event model, create and dispatch an NPCocoaEventTextInput event. + In the Carbon event model, convert the string to individual key codes and send them + as key down events. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::sendComplexTextInput): + Send the text to the plug-in controller proxy. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::sendComplexTextInput): + If the plug-in has a matching text input identifier, call Plugin::sendComplexTextInput. + + * WebProcess/WebPage/WebPage.messages.in: + Add SendComplexTextInputToPlugin message. + + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::sendComplexTextInputToPlugin): + Iterate over all known plug-in views and try to find one to send the text input to. + +2010-12-13 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=50953 + DNS Prefetch should be an opt-in feature + + Pass the preference through WebKit2. + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetDNSPrefetchingEnabled): + (WKPreferencesGetDNSPrefetchingEnabled): + * UIProcess/API/C/WKPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2010-12-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Kevin Decker. + + Pass the complex text input status to the WKView + https://bugs.webkit.org/show_bug.cgi?id=50993 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setComplexTextInputEnabled): + * UIProcess/API/mac/WKView.mm: + (-[WKView _setComplexTextInputEnabled:pluginComplexTextInputIdentifier:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setComplexTextInputEnabled): + +2010-12-14 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + WebKit 2 does not send touch cancel events correctly between processes + https://bugs.webkit.org/show_bug.cgi?id=50235 + + The classes WebKit2PlatformTouchPoint and WebKit2PlatformTouchEvent + misses the conversion of TouchCancel events and points. + + This patch add the missing enums when converting from a WebTouchEvent + to a PlatformTouchEvent. + + Testing is already covered by fast/events/touch/send-oncancel-event.html + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint): + (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent): + +2010-12-14 Zalan Bujtas <zbujtas@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + Add loadFinished() for provisional load error + This fixes the hanging UI state, when provisional load error occurs due to + the async nature of policy check. + + https://bugs.webkit.org/show_bug.cgi?id=48724 + + * UIProcess/API/qt/ClientImpl.cpp: + (loadFinished): + (qt_wk_didFailProvisionalLoadWithErrorForFrame): + (qt_wk_didFinishLoadForFrame): + (qt_wk_didFailLoadWithErrorForFrame): + +2010-12-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2: Need to be able to set the application name for the user agent for a WKPage + https://bugs.webkit.org/show_bug.cgi?id=51011 + + Fixes: + WebKit2: Need to be able to set the application name for the user agent for a WKPage + <rdar://problem/8564532> + WebKit2: Need to be able to get the computed user agent for a WKPage + <rdar://problem/8637285> + + Moves user agent computation to the UIProcess and just passes it to the WebProcess + when it has changed. + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + * Shared/WebPageCreationParameters.h: + Add a user agent to the creation parameters. + + * UIProcess/API/C/WKPage.cpp: + (WKPageCopyUserAgent): + (WKPageCopyApplicationNameForUserAgent): + (WKPageSetApplicationNameForUserAgent): + (WKPageSetCustomUserAgent): + * UIProcess/API/C/WKPage.h: + Add new API to set the application name and access the computed user agent. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::setUserAgent): + (WebKit::WebPageProxy::setApplicationNameForUserAgent): + (WebKit::WebPageProxy::setCustomUserAgent): + (WebKit::WebPageProxy::processDidCrash): + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::userAgent): + (WebKit::WebPageProxy::applicationNameForUserAgent): + * UIProcess/mac/WebPageProxyMac.mm: Added. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::setUserAgent): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::userAgent): + * WebProcess/WebPage/WebPage.messages.in: + Pipe through user agent. + + (WebKit::callGestalt): + (WebKit::macOSXVersionString): + (WebKit::userVisibleWebKitVersionString): + (WebKit::WebPageProxy::standardUserAgent): + * UIProcess/win/WebPageProxyWin.cpp: Added. + (WebKit::windowsVersion): + (WebKit::userVisibleWebKitVersionString): + (WebKit::WebPageProxy::standardUserAgent): + Port standardUserAgent computation from WebKit1. + + * UIProcess/qt/WebPageProxyQt.cpp: Added. + (WebKit::WebPageProxy::standardUserAgent): + Stub out the user agent so there is no change in behavior. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new file. + +2010-12-13 Brady Eidson <beidson@apple.com> + + Reviewed by Jon Honeycutt (and Brian Weinstein in heart). + + <rdar://problem/8752202> and https://bugs.webkit.org/show_bug.cgi?id=50997 + Expose "link title" and "link label" to InjectedBundleHitTestResult API + + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: + (WKBundleHitTestResultCopyLinkLabel): + (WKBundleHitTestResultCopyLinkTitle): + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: + + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: + (WebKit::InjectedBundleHitTestResult::linkLabel): + (WebKit::InjectedBundleHitTestResult::linkTitle): + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: + +2010-12-13 Brian Weinstein <bweinstein@apple.com> + + Windows Build Fix. Add a needed include. + + * UIProcess/win/WebView.cpp: + +2010-12-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Remove associated page concept from WKView constructor + https://bugs.webkit.org/show_bug.cgi?id=50983 + + Step 2: Remove WebPageNamespace. It no longer does anything. + + * Shared/APIObject.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + * UIProcess/API/qt/qgraphicswkview.cpp: + * UIProcess/API/qt/qwkcontext.cpp: + (QWKContext::QWKContext): + * UIProcess/API/qt/qwkcontext_p.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + (WebKit::WebContext::createWebPage): + * UIProcess/WebContext.h: + * UIProcess/WebPageNamespace.cpp: Removed. + * UIProcess/WebPageNamespace.h: Removed. + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::context): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::createWebPage): + * UIProcess/WebProcessProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * UIProcess/win/WebView.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-12-13 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * UIProcess/win/WebView.h: + +2010-12-13 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + +2010-12-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Remove associated page concept from WKView constructor + https://bugs.webkit.org/show_bug.cgi?id=50983 + + Step 1: Remove associate page constructors from WKView and make + all views use the shared namespace for the context. + + * UIProcess/API/C/win/WKView.cpp: + * UIProcess/API/C/win/WKView.h: + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + * UIProcess/API/qt/qwkcontext.cpp: + * UIProcess/API/qt/qwkcontext.h: + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + +2010-12-13 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/WebPageProxy.h: + +2010-12-13 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + WebKit2: Leaks a WebView when opening/closing Web Inspector on Windows + https://bugs.webkit.org/show_bug.cgi?id=50975 + <rdar://problem/8763501> + + Make m_inspectorView be a RefPtr<WebView>, instead of a WebView*. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::WebInspectorProxy): If we are on Windows, include WebView.h. + * UIProcess/WebInspectorProxy.h: Change the type of m_inspectorView to a RefPtr<WebView>. + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Remove the call to leakRef when creating the WebView. + +2010-12-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Pass the complex text input state all the way to the UI process + https://bugs.webkit.org/show_bug.cgi?id=50980 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::setComplexTextInputEnabled): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setComplexTextInputEnabled): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::pluginComplexTextInputIdentifier): + * WebProcess/Plugins/Plugin.h: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::pluginComplexTextInputIdentifier): + (WebKit::PluginProxy::setComplexTextInputEnabled): + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/Plugins/PluginProxy.messages.in: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::setComplexTextInputEnabled): + +2010-12-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Change the WebKit2 public API so there is no explicit WKPageNamespace object + https://bugs.webkit.org/show_bug.cgi?id=50898 + + * Shared/API/c/WKBase.h: Remove definition of WKPageNamespaceRef. + * UIProcess/API/C/WKAPICast.h: Remove toAPI/toImpl for WKPageNamespaceRef. + + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + Replace WKPageGetPageNamespace with WKPageGetContext. + + * UIProcess/API/C/WKPageNamespace.cpp: Removed. + * UIProcess/API/C/WKPageNamespace.h: Removed. + + * UIProcess/API/C/WebKit2.h: Remove #include of WKPageNamespace.h. + + * UIProcess/API/C/win/WKView.cpp: + (WKViewCreate): Changed to take a WKContextRef instead of a WKPageNamespaceRef. + (WKViewCreateUsingSharedProcess): Added. Similar to WKViewCreate except that + all callers of it will have their views end up in the same shared process, whereas + with WKViewCreate, a new internal page namespace will be created and could place + the view's WebPage into a new process. + (WKViewCreateForAssociatedPage): Added. Creates a view that is forced to use the + same process as the passed in page. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::initialize): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + (WebKit::WebView::createUsingSharedProcess): + (WebKit::WebView::createForAssociatedPage): + Implementation of the WKView create functions. + + * UIProcess/API/C/win/WKView.h: + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:]): + (-[WKView initWithFrame:contextRef:]): + (-[WKView initWithFrame:contextRef:pageGroupRef:]): + (-[WKView initWithFrame:contextRef:usingSharedProcess:]): + (-[WKView initWithFrame:contextRef:pageGroupRef:usingSharedProcess:]): + (-[WKView initWithFrame:forAssociatedPageRef:]): + (-[WKView initWithFrame:forAssociatedPageRef:pageGroupRef:]): + (-[WKView initWithFrame:pageNamespace:pageGroup:]): + Add new initializers for the objective-c WKView. It follows the same + pattern as WKViewRef. + + * UIProcess/API/qt/qwkcontext.cpp: + (QWKContext::QWKContext): + * UIProcess/API/qt/qwkcontext.h: + Remove uses of WKPageNamespaceRef. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::sharedPageNamespace): Returns a shared + page namespace used by the view's createUsingSharedProcess constructions. + (WebKit::WebContext::createPageNamespace): Change to return + a PassRefPtr to make things clearer. + (WebKit::WebContext::pageNamespaceWasDestroyed): Clear the shared + namespace if it is cleared. + * UIProcess/WebContext.h: + + * UIProcess/WebPageNamespace.h: Remove unused "struct WKContextStatistics". + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::context): + * UIProcess/WebPageProxy.h: + Add context getter. + + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + Use forAssociatedPageRef constructor for the WebInspector view. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Remove WKPageNamespace.h/cpp. + +2010-12-13 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * UIProcess/win/WebInspectorProxyWin.cpp: Non-Apple builds + need to include <wtf/RetainPtr.h>. + +2010-12-13 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix after r73807. + + Added stub implementation of Download object. + + * WebProcess/Downloads/curl: Added. + * WebProcess/Downloads/curl/DownloadCurl.cpp: Added. + (WebKit::Download::start): + (WebKit::Download::startWithHandle): + (WebKit::Download::cancel): + (WebKit::Download::platformInvalidate): + * win/WebKit2.vcproj: Exclude DownloadCFNet for Cairo builds, + added DownloadCurl (excluded for regular Apple builds.) + +2010-12-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add the ability for plug-ins to toggle complex text input + https://bugs.webkit.org/show_bug.cgi?id=50966 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::PluginControllerProxy): + Initialize m_isComplexTextInputEnabled. + + (WebKit::PluginControllerProxy::setComplexTextInputEnabled): + Update m_isComplexTextInputEnabled. + + * PluginProcess/PluginControllerProxy.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_pluginHasFocus and m_windowHasFocus. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + (WebKit::NetscapePlugin::isWindowActive): + Return m_windowHasFocus. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformSetFocus): + Update m_pluginHasFocus and call setComplexTextInputEnabled. + + (WebKit::NetscapePlugin::windowFocusChanged): + Update m_windowHasFocus and call setComplexTextInputEnabled. + + * WebProcess/Plugins/PluginController.h: + Add setComplexTextInputEnabled. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::setComplexTextInputEnabled): + * WebProcess/Plugins/PluginView.h: + Add setComplexTextInputEnabled + +2010-12-13 David Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + Remove the space behavior that I added. It's covered in EventHandler in WebCore + already for Windows. + + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + +2010-12-13 David Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=48545, Home/End, PageUp/PageDwn should respect writing-mode. Use + logical scrolling instead of physical scrolling for those keys in WebKit2. + + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::logicalScroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::logicalScroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::logicalScroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + +2010-12-13 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Focusing Web Inspector window doesn't focus contents on Windows + https://bugs.webkit.org/show_bug.cgi?id=50947 + <rdar://problem/8762468> + + When we get the notification that the inspector window has focused, focus the inner inspector view. + + * UIProcess/WebInspectorProxy.h: + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::onSetFocusEvent): Set the focus of the inspector view, because that is what + needs to be focused in the inspector window. + +2010-12-13 Dan Bernstein <mitz@apple.com> + + Coding style fix. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::originatingURLFromBackForwardList): + +2010-12-13 Balazs Kelemen <kbalazs@webkit.org> + + Unreviewed trivial build fix (linux, 64 bit, gcc-4.5.1) + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::exceededDatabaseQuota): + Don't use unsigned long long as alias for uint64_t. + +2010-12-13 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Crash when clicking a download link that targets a new tab + https://bugs.webkit.org/show_bug.cgi?id=50935 + <rdar://problem/8760572> + + Check for a null history item. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::originatingURLFromBackForwardList): + +2010-12-13 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt][WK2] Fix build if WebKitTools are not available + https://bugs.webkit.org/show_bug.cgi?id=50242 + + * DerivedSources.pro: Remove dependency to WebKitTools. + * Scripts/generate-forwarding-headers.pl: Moved from WebKitTools/Scripts/generate-forwarding-headers.pl. + +2010-12-13 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed. + + * WebKit2.pro: Remove non-existant Shared/DrawingAreaBase.h from build system. + +2010-10-28 MORITA Hajime <morrita@google.com> + + Reviewed by Ojan Vafai. + + spellcheck does not check pasted text + https://bugs.webkit.org/show_bug.cgi?id=40092 + + Added a stub implememntation. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::requestCheckingOfString): + * WebProcess/WebCoreSupport/WebEditorClient.h: + +2010-12-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Tim Hatcher. + + WebKit2: Implement WebInspector::localizedStringsURL on Windows + https://bugs.webkit.org/show_bug.cgi?id=50896 + + Find the localized strings file using CFBundleCopyResourceURL. + + * WebProcess/WebPage/win/WebInspectorWin.cpp: + (WebKit::WebInspector::localizedStringsURL): + +2010-12-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Give LogTextInput a sensible flag value. + + * Platform/Logging.cpp: + +2010-12-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Remove incorrect assertion that has been firing in the API tester. + + * UIProcess/WebDatabaseManagerProxy.cpp: + (WebKit::WebDatabaseManagerProxy::~WebDatabaseManagerProxy): + +2010-12-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Disable WebKit2 logging by default. + https://bugs.webkit.org/show_bug.cgi?id=50878 + + * Platform/Logging.cpp: + (initializeLogChannelsIfNecessary): + +2010-12-11 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Sam Weinig. + + Web Inspector: Make inspector on Windows show and be usable in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=50877 + + Hook up the unimplemented methods in WebInspectorProxyWin to get the web inspector + showing and usable in WebKit2 on Windows. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize Windows-specific variables to 0. + * UIProcess/WebInspectorProxy.h: + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::registerInspectorViewWindowClass): Sets up the inspector view class. + (WebKit::WebInspectorProxy::InspectorViewWndProc): Calls through to the WebInspectorProxy's non-static + WndProc. + (WebKit::WebInspectorProxy::wndProc): Handles WM_SIZE, WM_CLOSE, and WM_GETMINMAXINFO, the rest go to + ::DefWindowProc. + (WebKit::WebInspectorProxy::onSizeEvent): Resize the WKView that has the inspector page to match the + outer window that was just resized. + (WebKit::WebInspectorProxy::onMinMaxInfoEvent): Set the minimum size the window can be resized to. + (WebKit::WebInspectorProxy::onCloseEvent): Hide the window, and call WebInspectorProxy::close. + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create a WKView and return its page. + (WebKit::WebInspectorProxy::platformOpen): Create an HWND for the inspector, put the inspector's WKView + inside of it, and show the window. + (WebKit::WebInspectorProxy::platformClose): Destroy the inspector's window (which destroys the child WKView), + and 0 out instance variables. + (WebKit::WebInspectorProxy::inspectorPageURL): Finds inspector/inspector.html in the WebKit bundle. + +2010-12-12 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Crash in WebPage constructor. + https://bugs.webkit.org/show_bug.cgi?id=50892 + + * WebProcess/qt/WebProcessQt.cpp: + (WebKit::WebProcess::platformInitializeWebProcess): + Disable runtime enabled features that have no WebKit2 implementation yet. + +2010-12-10 Jon Honeycutt <jhoneycutt@apple.com> + + Select menus with short option titles do not paint properly + https://bugs.webkit.org/show_bug.cgi?id=50860 + <rdar://problem/8660807> + + The backing stores used for painting the popup menu items were only as + wide as the widest option title, but the popup window that we create is + at least as wide as the <select> element. This adjusts the backing + stores to be at least as wide as the <select>, as well. + + Reviewed by Sam Weinig. + + * UIProcess/win/WebPopupMenuProxyWin.cpp: + (WebKit::WebPopupMenuProxyWin::paint): + Paint using the width of the backing store. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::show): + Pass the page coordinates of the <select> element to + setUpPlatformData(). + + * WebProcess/WebCoreSupport/WebPopupMenu.h: + Added new parameter to setUpPlatformData(). + + * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm: + (WebKit::WebPopupMenu::setUpPlatformData): + Ditto. + + * WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + Ditto. + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + Fixed a typo in a comment. Adjust the backing store size to be at least + as wide as the <select> element, and use that width when painting the + items to the backing store. + +2010-12-11 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed Qt buildfix after r73808. + + WebKit2: Need a WebKit2 equivalent of the WebKit1 WebDatabaseManager + https://bugs.webkit.org/show_bug.cgi?id=50606 + + * DerivedSources.pro: + +2010-12-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r73834. + http://trac.webkit.org/changeset/73834 + https://bugs.webkit.org/show_bug.cgi?id=50866 + + It broke Qt-WebKit2 build, because of missing WK2_DIR variable + (Requested by Ossy on #webkit). + + * WebKit2.pro: + +2010-12-10 Siddharth Mathur <siddharth.mathur@nokia.com> + + Reviewed by Eric Seidel. + + [Qt][WK2] Make WebKit2 static library compile on Symbian + https://bugs.webkit.org/show_bug.cgi?id=50861 + + * WebKit2.pro: + +2010-12-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Ensure that we are not getting too many wheel events + <rdar://problem/7881465> + + Add simple coalescing of wheel events being sent to the WebProcess. This + adds two models, one which drops interim events and one which merges events + together. For now, we are using the simpler dropping model. + + * Shared/WebEvent.h: + (WebKit::WebEvent::modifiers): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::coalesceWheelEvents): + (WebKit::WebPageProxy::handleWheelEvent): + (WebKit::WebPageProxy::didReceiveEvent): + * UIProcess/WebPageProxy.h: + +2010-12-10 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Make WKContextGetStatistics gather global statistics + https://bugs.webkit.org/show_bug.cgi?id=50850 + + Change WKContextGetStatistics to work on all objects in the process, and + make it more robust by incrementing/decrementing the counts in the constructor + and destructor respectively. + + Also, rename WKContextGetStatistics to WKContextGetGlobalStatistics to better match + what it's actually doing. + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetStatistics): + * UIProcess/API/C/WKContextPrivate.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:pageGroupRef:]): + (-[WKView dealloc]): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::statistics): + * UIProcess/WebContext.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::WebFrameProxy): + (WebKit::WebFrameProxy::~WebFrameProxy): + * UIProcess/WebPageNamespace.cpp: + * UIProcess/WebPageNamespace.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::~WebPageProxy): + * UIProcess/WebPageProxy.h: + +2010-12-10 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Context menu support on Windows + <https://bugs.webkit.org/show_bug.cgi?id=50514> + + Implment showing of the context menu on Windows for WebKit2, and calling through to + WebPageProxy::contextMenuItemSelected. + + * UIProcess/win/WebContextMenuProxyWin.cpp: + (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin): Initialize the member variables. + (WebKit::WebContextMenuProxyWin::populateMenu): Iterate over the vector of WebContextMenuItemData + that was passed in, adding the menu items and recursively calling back into this function to populate + any submenus that are needed. This function also sets up the map from action identifierss to WebContextMenuItemData, + to use to find the WebContextMenuItemData from a selected menu item. + (WebKit::WebContextMenuProxyWin::showContextMenu): Destroy any menu we have already created, populate the menu + to show, and show the context menu. Once TrackPopupMenuEx returns, it returns identifier of the selected menu item. + Look up that identifier in the map we created, and tell the WebPageProxy that a context menu item was selected. + (WebKit::WebContextMenuProxyWin::hideContextMenu): Destroy the HMENU if it is non-null, and clear the identifier map. + * UIProcess/win/WebContextMenuProxyWin.h: + (WebKit::WebContextMenuProxyWin::create): Call through to the constructor, and change the arguments that it takes. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createContextMenuProxy): Call with the correct arguments. + +2010-12-10 Jessie Berlin <jberlin@apple.com> + + Qt Build Fix. Unreviewed. + + * WebKit2.pro: + Add the Messages.h and MessageReceivers.h. + +2010-12-10 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben and Sam Weinig. + + WebKit2: Need a WebKit2 equivalent of the WebKit1 WebDatabaseManager + https://bugs.webkit.org/show_bug.cgi?id=50606 + + Add a WebDatabaseManagerProxy owned by the WebContext. + + Expose API (similar to the WebKit1 API) to get a list of origins for which there are + Databases, delete all the databases for a given origin, and delete all the databases. + + Add WebDatabaseManager and WebDatabaseManagerProxy as messages receivers. + * DerivedSources.make: + * Platform/CoreIPC/MessageID.h: + + Add the WebDatabaseManagerProxy as a UIProcess type (DatabaseManager). + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * UIProcess/API/C/WKAPICast.h: + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetDatabaseManager): + Expose API to get the DatabaseManager. + * UIProcess/API/C/WKContext.h: + + * UIProcess/API/C/WKDatabaseManager.cpp: Added. + (WKDatabaseManagerGetTypeID): + (WKDatabaseManagerGetDatabaseOrigins): + (callGetDatabaseOriginsBlockBlockAndDispose): + (WKDatabaseManagerGetDatabaseOrigins_b): + (WKDatabaseManagerDeleteDatabasesForOrigin): + (WKDatabaseManagerDeleteAllDatabases): + * UIProcess/API/C/WKDatabaseManager.h: Added. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + Create the WebDatabaseManagerProxy. + (WebKit::WebContext::processDidClose): + Invalidate the WebDatabaseManagerProxy. + (WebKit::WebContext::didReceiveMessage): + Forward messages to the WebDatabaseManagerProxy. + * UIProcess/WebContext.h: + (WebKit::WebContext::databaseManagerProxy): + + * UIProcess/WebDatabaseManagerProxy.cpp: Added. + (WebKit::WebDatabaseManagerProxy::create): + (WebKit::WebDatabaseManagerProxy::WebDatabaseManagerProxy): + (WebKit::WebDatabaseManagerProxy::~WebDatabaseManagerProxy): + (WebKit::WebDatabaseManagerProxy::invalidate): + Invalidate the map of callbacks for getDatabaseOrigins. + (WebKit::WebDatabaseManagerProxy::getDatabaseOrigins): + Store the callback and send the request for the origins which have databases to the + WebProcess. + (WebKit::WebDatabaseManagerProxy::didGetDatabaseOrigins): + Call the callback function with the SecurityOrigins created from the identifiers received. + (WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin): + If the origin exists, send the message on to the WebProcess to delete the databases + associated with that origin. + (WebKit::WebDatabaseManagerProxy::deleteAllDatabases): + Send the message to the WebProcess to delete all the databases. + * UIProcess/WebDatabaseManagerProxy.h: Added. + (WebKit::WebDatabaseManagerProxy::type): + * UIProcess/WebDatabaseManagerProxy.messages.in: Added. + + * UIProcess/WebPageProxy.cpp: + Move invalidateCallbackMap from here ... + * UIProcess/GenericCallback.h: + (WebKit::invalidateCallbackMap): + .. to here so that it can be used elsewhere (e.g. by WebDatabaseManagerProxy). + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + Forward on all messages destined for the WebDatabaseManagerProxy to the WebContext. + + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: + (WebKit::WebDatabaseManager::didReceiveMessage): + (WebKit::WebDatabaseManager::getDatabaseOrigins): + Send an array of the identifiers for the SecurityOrigins for which there are databases to + the UIProcess. + (WebKit::WebDatabaseManager::deleteDatabasesForOrigin): + If the SecurityOrigin with that identifier exists, tell the DatabaseTracker to delete the + databases for that origin. + (WebKit::WebDatabaseManager::deleteAllDatabases): + Tell the DatabaseTracker to delete the databases for that origin. + * WebProcess/WebCoreSupport/WebDatabaseManager.h: + * WebProcess/WebCoreSupport/WebDatabaseManager.messages.in: Added. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + + * WebKit2.pro: + Add WKDatabaseManager.cpp/.h and WebDatabaseManagerProxy.cpp/.h + * WebKit2.xcodeproj/project.pbxproj: + Ditto, also add WebDatabaseManagerProxy.messages.in and WebDatabaseManager.messages.in. + * win/WebKit2.vcproj: + Ditto. + * win/WebKit2Generated.make: + Make sure WKDatabaseManager.h is copied into WebKitBuild on Windows. + +2010-12-10 Ada Chan <adachan@apple.com> + + Reviewed by Anders Carlsson. + + Implement Download::start() and Download::startWithHandle() on Windows. + https://bugs.webkit.org/show_bug.cgi?id=50844 + + * WebProcess/Downloads/Download.h: + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::start): Create a CFURLDownloadRef and schedule it. + (WebKit::Download::startWithHandle): Create a CFURLDownloadRef with the loading connection + retrieved from the ResourceHandle. + (WebKit::Download::platformInvalidate): + (WebKit::downloadFromClientInfo): + (WebKit::didStartCallback): + (WebKit::willSendRequestCallback): + (WebKit::didReceiveAuthenticationChallengeCallback): + (WebKit::didReceiveResponseCallback): + (WebKit::willResumeWithResponseCallback): + (WebKit::didReceiveDataCallback): + (WebKit::shouldDecodeDataOfMIMETypeCallback): + (WebKit::decideDestinationWithSuggestedObjectNameCallback): + (WebKit::didCreateDestinationCallback): + (WebKit::didFinishCallback): + (WebKit::didFailCallback): + +2010-12-10 Enrica Casucci <enrica@apple.com> + + Windows build fix. Unreviewed. + + Adding a dummy synchronous message for platforms + that don't have any. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::dummy): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-12-09 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Prep for WebKit2: Context menu support on Windows + https://bugs.webkit.org/show_bug.cgi?id=50514 + + Update WebKit2 to call the correct code when CROSS_PLATFORM_CONTEXT_MENUS is set. + + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::WebContextMenuItemData): Add a branch based on whether or not + CROSS_PLATFORM_CONTEXT_MENUS is set. + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::customizeMenu): Define different functions based on + whether or not CROSS_PLATFORM_CONTEXT_MENUS. Both of these are stubs, so functionality + doesn't need to be shared. + * WebProcess/WebCoreSupport/WebContextMenuClient.h: Define different functions based on + whether or not CROSS_PLATFORM_CONTEXT_MENUS. + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): Add a branch based on whether or not + CROSS_PLATFORM_CONTEXT_MENUS is set. + +2010-12-09 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Implement IME support for Mac. + <rdar://problem/7660589> WebKit2: Implement IME support for Mac. + https://bugs.webkit.org/show_bug.cgi?id=50788 + + This patch addes support for input methods in WebKit2. + In order to support IME, it was necessary to add synchronous calls from the UIProcess + to the WebProcess. These calls all have a timeout of 1 second. + The current implementation still uses the NSTextInput protocol, but the plan is to move + to the NSTextInputClient protocol. This has not been done yet for ease of comparison with + WebKit. attributedSubstringFromRange is the only method that has not been implemented, because + I have not yet decided what is the best way to send an NSAttributedString across the process + boundary. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): Added template for member function. + with four reply arguments. + * Scripts/webkit2/messages.py: Added CompositionUnderline and relevant header. + * Shared/WebCoreArgumentCoders.h: + (CoreIPC::): Added encoder/decoder for CompositionUnderline. + * UIProcess/API/mac/PageClientImpl.h: Added parameters to interceptKeyEvent and selectionChanged. + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::selectionChanged): Added parameters. + (WebKit::PageClientImpl::interceptKeyEvent): Added parameters. + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:pageGroupRef:]): Added initialization of new private members. + (-[WKView insertText:]): + (-[WKView _selectionChanged:isEditable:isPassword:hasMarkedText:range:]): Added parameters. + (-[WKView _interceptKeyEvent:hasComposition:start:end:lines:WebCore::]): Added parameters. + (-[WKView keyDown:]): Modified to reset state on each keyDown. + (-[WKView selectedRange]): Added. + (-[WKView hasMarkedText]): Added. + (-[WKView unmarkText]): Added. + (-[WKView validAttributesForMarkedText]): Added. + (extractUnderlines): Added. + (-[WKView setMarkedText:selectedRange:]): Added. + (-[WKView markedRange]): Added. + (-[WKView attributedSubstringFromRange:]): Added. + (-[WKView characterIndexForPoint:]): Added. + (-[WKView firstRectForCharacterRange:]): Added. + (-[WKView conversationIdentifier]): Added. + * UIProcess/API/mac/WKViewInternal.h: Added parameters to _interceptKeyEvent and _selectionChanged. + * UIProcess/PageClient.h: Added parameters to interpretKeyEvent and selectionChanged. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::getMarkedRange): Added. + (WebKit::WebPageProxy::characterIndexForPoint): Added. + (WebKit::WebPageProxy::firstRectForCharacterRange): Added. + (WebKit::WebPageProxy::interpretKeyEvent): Additional parameters. + (WebKit::WebPageProxy::didSelectionChange): Additional parameters for Mac platform. + * UIProcess/WebPageProxy.h: Added new methods and parameters to didSelectionChange + and interpretKeyEvent. + * UIProcess/WebPageProxy.messages.in: Added parameters to interpretKeyEvent and selectionChanged messages. + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::sendSync): Added support for synchronous messages. + The default timeout is 1 second. + * WebProcess/WebCoreSupport/WebEditorClient.cpp: respondToChangedSelection is now + only for non Mac platform. + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::respondToChangedSelection): Added implementation for Mac platform. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveSyncMessage): Added. + * WebProcess/WebPage/WebPage.h: Added new methods and support for synchronous messages. + * WebProcess/WebPage/WebPage.messages.in: Added new messages. + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::interceptEditingKeyboardEvent): Added parameters. + (WebKit::WebPage::convertRangeToPlatformRange): Added. + (WebKit::WebPage::getMarkedRange): Added. + (WebKit::characterRangeAtPoint): Added. + (WebKit::WebPage::characterIndexForPoint): Added. + (WebKit::convertToRange): Added. + (WebKit::WebPage::firstRectForCharacterRange): Added. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveSyncMessage): Added. + * WebProcess/WebProcess.h: Added didReceiveSyncMessage. + +2010-12-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Add the QWKContext API class to wrap the WebContext. + https://bugs.webkit.org/show_bug.cgi?id=50750 + + * UIProcess/API/qt/WKView.h: + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + Change the WKPageNamespaceRef argument to QWKContext* + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qwkcontext.cpp: Added. + * UIProcess/API/qt/qwkcontext.h: Added. + * UIProcess/API/qt/qwkcontext_p.h: Added. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPage::QWKPage): + Change the WKPageNamespaceRef argument to QWKContext* + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + * WebKit2.pro: + +2010-12-10 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Flush IPC connection send buffer after each message. + + [Qt] [WK2] IPC messages are not sent until send buffer fills up + https://bugs.webkit.org/show_bug.cgi?id=50667 + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + +2010-12-09 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Use a single QNetworkAccessManager per web process. + https://bugs.webkit.org/show_bug.cgi?id=50757 + + This allows a better management of network resources and the use + of global cookie jar and disk cache across all frames. + + * WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp: + (WebCore::WebFrameNetworkingContext::WebFrameNetworkingContext): + (WebCore::WebFrameNetworkingContext::networkAccessManager): + * WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::initializeWebProcess): + (WebKit::WebProcess::shutdownIfPossible): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::networkAccessManager): + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::platformShutdown): + * WebProcess/qt/WebProcessQt.cpp: + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::platformShutdown): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::platformShutdown): + +2010-12-09 Mark Rowe <mrowe@apple.com> + + Fix the 32-bit build. + + * Shared/cf/ArgumentCodersCF.cpp: + (CoreIPC::sizeForNumberType): + +2010-12-09 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Brady Eidson. + + WebKit2: Control-click doesn't invoke context menu + https://bugs.webkit.org/show_bug.cgi?id=50793 + <rdar://problem/8664800> + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::isContextClick): New helper function - on Mac, not only right clicks + but also control-left-clicks are context clicks. + (WebKit::handleMouseEvent): Use above. + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Fix clang++ build. + + * Scripts/webkit2/messages.py: + DrawingAreaInfo is a struct. + + * Shared/WebPreferencesStore.cpp: + (WebKit::valueForKey): + Move valueForKey above code that uses it. + + * UIProcess/mac/WebInspectorProxyMac.mm: + (-[WebInspectorProxyObjCAdapter windowWillClose:]): + Remove trailing semicolon. + +2010-12-09 Timothy Hatcher <timothy@apple.com> + + Add support for transparent WebKit2 WKViews. + + https://webkit.org/b/50785 + + Reviewed by Anders Carlsson. + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): Encode drawsBackground and drawsTransparentBackground. + (WebKit::WebPageCreationParameters::decode): Decode drawsBackground and drawsTransparentBackground. + * Shared/WebPageCreationParameters.h: + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView setDrawsBackground:]): Added. + (-[WKView drawsBackground]): Added. + (-[WKView setDrawsTransparentBackground:]): Added. + (-[WKView drawsTransparentBackground]): Added. + (-[WKView drawRect:]): Only fill the background if the WebProcess isn't valid and drawsBackground. + Use white or clear based on setDrawsTransparentBackground. + (-[WKView isOpaque]): Return drawsBackground. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Initialize m_drawsBackground and m_drawsTransparentBackground. + (WebKit::WebPageProxy::setDrawsBackground): Added. Send a SetDrawsBackground message. + (WebKit::WebPageProxy::setDrawsTransparentBackground): Added. Send a SetDrawsTransparentBackground message. + (WebKit::WebPageProxy::creationParameters): Set drawsBackground and drawsTransparentBackground. + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::drawsBackground): Added. Return m_drawsBackground. + (WebKit::WebPageProxy::drawsTransparentBackground): Added. Return m_drawsTransparentBackground. + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): Use the copy blend mode when drawing a background. + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): Use the copy blend mode to replace existing content. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Setup the new view's background color and transparent flag. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Initialize m_drawsBackground and m_drawsTransparentBackground. + (WebKit::WebPage::setDrawsBackground): Added. Propagate the flag to the FrameViews. + (WebKit::WebPage::setDrawsTransparentBackground): Added. Propagate the background color to the FrameViews. + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::drawsBackground): Added. Return m_drawsBackground. + (WebKit::WebPage::drawsTransparentBackground): Added. Return m_drawsTransparentBackground. + * WebProcess/WebPage/WebPage.messages.in: Added SetDrawsBackground and SetDrawsTransparentBackground. + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cannot use NSKeyedArchiver in WK2 for ResourceResponses + https://bugs.webkit.org/show_bug.cgi?id=50792 + <rdar://problem/8741799> + + When encoding, first convert the requests and responses to the serializable dictionary representation + and use the newly added CF CoreIPC encoders. When decoding, do the opposite. + + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add CoreIPC coders for CF types + https://bugs.webkit.org/show_bug.cgi?id=50791 + + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::decodeEnum): + * Platform/CoreIPC/ArgumentEncoder.h: + (CoreIPC::ArgumentEncoder::encodeEnum): + * Shared/cf/ArgumentCodersCF.cpp: Added. + (CoreIPC::tokenNullTypeRef): + (CoreIPC::typeFromCFTypeRef): + (CoreIPC::encode): + (CoreIPC::decode): + (CoreIPC::sizeForNumberType): + * Shared/cf/ArgumentCodersCF.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-12-09 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8749750> and https://bugs.webkit.org/show_bug.cgi?id=50786 + WK2 authentication never consults WebCore session credential storage. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage): Since we don't need to expose this as + API at this time, always return true. + +2010-12-09 Sam Weinig <weinig@apple.com> + + Reviewed by Alexey Proskuryakov. + + WebKit2: Add support for access keys + https://bugs.webkit.org/show_bug.cgi?id=49832 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::handleKeyEvent): Match windows WebKit and call + the event handler's for handleAccessKey function for + system keys. This will never be hit on the Mac. + +2010-12-09 Darin Adler <darin@apple.com> + + Qt build fix. + + * WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp: Include "NotImplemented.h". + +2010-12-09 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: + +2010-12-09 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/8613779> and https://bugs.webkit.org/show_bug.cgi?id=50777 + WebKit2 ContextMenuClient support + + Implement google search in a cross platform manner, and add a FIXME for download support: + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::downloadURL): + (WebKit::WebContextMenuClient::searchWithGoogle): + + Mac implementations for speaking and searching: + * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm: Added. + (WebKit::WebContextMenuClient::lookUpInDictionary): Add a FIXME for now. + (WebKit::WebContextMenuClient::isSpeaking): + (WebKit::WebContextMenuClient::speak): + (WebKit::WebContextMenuClient::stopSpeaking): + (WebKit::WebContextMenuClient::searchWithSpotlight): + + Stubs for Win and Qt: + * WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp: Added. + (WebKit::WebContextMenuClient::lookUpInDictionary): + (WebKit::WebContextMenuClient::isSpeaking): + (WebKit::WebContextMenuClient::speak): + (WebKit::WebContextMenuClient::stopSpeaking): + * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: Added. + (WebKit::WebContextMenuClient::lookUpInDictionary): + (WebKit::WebContextMenuClient::isSpeaking): + (WebKit::WebContextMenuClient::speak): + (WebKit::WebContextMenuClient::stopSpeaking): + + Project file stuffs: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't leak the PDFDocument + https://bugs.webkit.org/show_bug.cgi?id=50771 + + * UIProcess/API/mac/PDFViewController.mm: + (WebKit::PDFViewController::setPDFDocumentData): + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a basic implementation of PDF support on Mac + https://bugs.webkit.org/show_bug.cgi?id=50768 + + * UIProcess/API/mac/PDFViewController.h: + * UIProcess/API/mac/PDFViewController.mm: Added. + (-[WKPDFView initWithFrame:PDFViewController:WebKit::]): + Setup the view hierarchy. + + (-[WKPDFView invalidate]): + Set the controller to null. + + (-[WKPDFView pdfView]): + Return the PDF view. + + (WebKit::PDFViewController::create): + (WebKit::PDFViewController::PDFViewController): + Create a WKPDFView and insert it as a subview of the WKView. + + (WebKit::PDFViewController::~PDFViewController): + Remove the WKPDFView from the view hierarchy and invalidate it. + + (WebKit::convertPostScriptDataSourceToPDF): + Convert the data in the data reference to PDF and return it as a CFDataRef. + + (WebKit::PDFViewController::setPDFDocumentData): + Create a PDFDocument and set it on the PDF view. + + (WebKit::PDFViewController::pdfDocumentClass): + (WebKit::PDFViewController::pdfPreviewViewClass): + (WebKit::PDFViewController::pdfKitBundle): + Add soft-linking helper functions. + + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::didCommitLoadForMainFrame): + (WebKit::PageClientImpl::didFinishLoadingDataForCustomRepresentation): + Call the WKView methods. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _setPageHasCustomRepresentation:]): + Create a PDF view controller if necessary. + + (-[WKView _didFinishLoadingDataForCustomRepresentation:CoreIPC::]): + Pass the data along to the PDF view controller. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-12-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add support for custom representation + https://bugs.webkit.org/show_bug.cgi?id=50767 + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + Add mimeTypesWithCustomRepresentation and encode and decode accordingly. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::didCommitLoadForMainFrame): + (WebKit::PageClientImpl::didFinishLoadingDataForCustomRepresentation): + Add empty stubs for now. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::didCommitLoadForMainFrame): + (QWKPagePrivate::didFinishLoadingDataForCustomRepresentation): + * UIProcess/API/qt/qwkpage_p.h: + Add empty stubs. + + * UIProcess/PageClient.h: + Add new functions for custom representations. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canShowMIMEType): + Check that the mime type is not null. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didCommitLoadForFrame): + This now takes an additional frameHasCustomRepresentation parameter. + Call the page client function. + + (WebKit::WebPageProxy::didFinishLoadingDataForCustomRepresentation): + Call the page client function. + + * UIProcess/WebPageProxy.messages.in: + Change DidCommitLoadForFrame message, add DidFinishLoadingDataForCustomRepresentation message. + + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): + We want to use custom representations for PDF and PostScript MIME types. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::didCommitLoadForMainFrame): + (WebKit::WebView::didFinishLoadingDataForCustomRepresentation): + * UIProcess/win/WebView.h: + Add stubs. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::WebFrameLoaderClient): + Initialize m_frameHasCustomRepresentation. + + (WebKit::WebFrameLoaderClient::hasHTMLView): + The frame has a HTML view unless it has a custom representation. + + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + Pass along whether the frame has a custom representation. + + (WebKit::WebFrameLoaderClient::committedLoad): + Don't send data back to WebCore if the frame has a custom representation. + + (WebKit::WebFrameLoaderClient::finishedLoading): + Send all the data to the UI process. + + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + Update the m_frameHasCustomRepresentation state based on the MIME type. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + (WebKit::WebFrameLoaderClient::frameHasCustomRepresentation): + Add getter. + + * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp: + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + Don't do any painting if the main frame has a custom representation. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + Add all the MIME types with custom representations. + + * WebProcess/WebProcess.h: + (WebKit::WebProcess::shouldUseCustomRepresentationForMIMEType): + Add getter. + +2010-12-09 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + Implement "Use Selection for Find" in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=50737 + <rdar://problem/8564881> + + * UIProcess/API/mac/WKView.mm: Add support for the takeFindStringFromSelection: + selector as a command. + +2010-12-09 Brady Eidson <beidson@apple.com> + + Reviewed by Maciej Stachowiak. + + <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191 + WebKit2 Authentication Support + + Implement authentication-related coders: + * Shared/WebCoreArgumentCoders.h: + + Allow the ResourceResponse coders to handle null responses: + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + + Add new API and Impl casts for ProtectionSpace and Credential enums: + * UIProcess/API/C/WKAPICast.h: + (WebKit::toAPI): + (WebKit::toCredentialPersistence): + + Move the DecisionListener to be accessed off the challenge itself, and fill in other + necessary API: + * UIProcess/API/C/WKAuthenticationChallenge.cpp: + (WKAuthenticationChallengeGetDecisionListener): + (WKAuthenticationChallengeGetProtectionSpace): + (WKAuthenticationChallengeGetProposedCredential): + (WKAuthenticationChallengeGetPreviousFailureCount): + * UIProcess/API/C/WKAuthenticationChallenge.h: + * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: + (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): + (WebKit::AuthenticationChallengeProxy::proposedCredential): + (WebKit::AuthenticationChallengeProxy::protectionSpace): + * UIProcess/Authentication/AuthenticationChallengeProxy.h: + (WebKit::AuthenticationChallengeProxy::previousFailureCount): + + Fill in some credential API: + * UIProcess/API/C/WKCredential.cpp: + (WKCredentialCreate): + (WKCredentialCopyUser): + * UIProcess/API/C/WKCredential.h: + * UIProcess/API/C/WKCredentialTypes.h: Added. + * UIProcess/Authentication/WebCredential.cpp: + (WebKit::WebCredential::WebCredential): + (WebKit::WebCredential::user): + * UIProcess/Authentication/WebCredential.h: + (WebKit::WebCredential::create): + + Fill in some protection space API: + * UIProcess/API/C/WKProtectionSpace.cpp: + (WKProtectionSpaceCopyHost): + (WKProtectionSpaceGetPort): + (WKProtectionSpaceCopyRealm): + (WKProtectionSpaceGetIsProxy): + (WKProtectionSpaceGetServerType): + (WKProtectionSpaceGetReceivesCredentialSecurely): + (WKProtectionSpaceGetAuthenticationScheme): + * UIProcess/API/C/WKProtectionSpace.h: + * UIProcess/API/C/WKProtectionSpaceTypes.h: Added. + * UIProcess/Authentication/WebProtectionSpace.cpp: + (WebKit::WebProtectionSpace::WebProtectionSpace): + (WebKit::WebProtectionSpace::host): + (WebKit::WebProtectionSpace::port): + (WebKit::WebProtectionSpace::realm): + (WebKit::WebProtectionSpace::isProxy): + (WebKit::WebProtectionSpace::serverType): + (WebKit::WebProtectionSpace::receivesCredentialSecurely): + (WebKit::WebProtectionSpace::authenticationScheme): + * UIProcess/Authentication/WebProtectionSpace.h: + + Change the authentication challenge callback to reflect the new ownership of + the DecisionListener: + * UIProcess/API/C/WKPage.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey "Error" Garen. + + Fix typo: Diplaying -> Displaying + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameIsDisplayingStandaloneImageDocument): + (WKFrameIsDisplayingMarkupDocument): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canProvideSource): + (WebKit::WebFrameProxy::isDisplayingStandaloneImageDocument): + (WebKit::WebFrameProxy::isDisplayingMarkupDocument): + * UIProcess/WebFrameProxy.h: + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Add WebKit2 Preference for TabsToLinks behavior. + <rdar://problem/8664263> + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetTabsToLinks): + (WKPreferencesGetTabsToLinks): + * UIProcess/API/C/WKPreferences.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::tabsToLinks): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::updatePreferences): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::tabsToLinks): + +2010-12-08 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + WebTouchEvent::isTouchEventType() does not take into account the type TouchCancel + https://bugs.webkit.org/show_bug.cgi?id=50680 + + Add the missing type check to WebTouchEvent::isTouchEventType(). + + * Shared/WebTouchEvent.cpp: + (WebKit::WebTouchEvent::isTouchEventType): + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Need a way to get a WKBundleFrameRef from JS HTMLIFrameElement + https://bugs.webkit.org/show_bug.cgi?id=50726 + + Adds WKBundleNodeHandleCopyDocumentFrame, WKBundleNodeHandleCopyHTMLFrameElementContentFrame + and WKBundleNodeHandleCopyHTMLIFrameElementContentFrame, to handle the document, <frame> + and <iframe> cases. + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleCopyDocumentFrame): + (WKBundleNodeHandleCopyHTMLFrameElementContentFrame): + (WKBundleNodeHandleCopyHTMLIFrameElementContentFrame): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::copyDocumentFrame): + (WebKit::InjectedBundleNodeHandle::copyHTMLFrameElementContentFrame): + (WebKit::InjectedBundleNodeHandle::copyHTMLIFrameElementContentFrame): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Need a WebKit2 way to test whether a frame is displaying a standalone image + <rdar://problem/8443059> + WebKit2: Need a way to test whether a page or frame is showing HTML content + <rdar://problem/8642563> + + Add WKFrameIsDiplayingStandaloneImageDocument and WKFrameIsDiplayingMarkupDocument. + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameIsDiplayingStandaloneImageDocument): + (WKFrameIsDiplayingMarkupDocument): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canProvideSource): This now just calls isDiplayingMarkupDocument. + (WebKit::WebFrameProxy::isDiplayingStandaloneImageDocument): + (WebKit::WebFrameProxy::isDiplayingMarkupDocument): + * UIProcess/WebFrameProxy.h: + +2010-12-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + WebFrameProxy::canShowMIMEType should return true for PDF MIME types in the main frame + https://bugs.webkit.org/show_bug.cgi?id=50724 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::pdfAndPostScriptMIMETypes): + * UIProcess/WebContext.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canShowMIMEType): + +2010-12-08 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Brady Eidson. + + WebMenuTarget implemented in both WebKit and WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=50665 + <rdar://problem/8742640> + + Rename WebMenuTarget to WKMenuTarget to prevent this warning and stay consistent with + other WebKit2 namings. + + * UIProcess/mac/WebContextMenuProxyMac.mm: + (+[WKMenuTarget sharedMenuTarget]): + (WebKit::nsMenuItemVector): + (WebKit::WebContextMenuProxyMac::showContextMenu): + +2010-12-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Move canShowMIMEType to Frame + https://bugs.webkit.org/show_bug.cgi?id=50723 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCanShowMIMEType): + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canShowMIMEType): + * UIProcess/WebFrameProxy.h: + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Oliver Hunt. + + Rename WKPreferencesGetFTPDirectoryTemplatePath to WKPreferencesCopyFTPDirectoryTemplatePath + since it copies the value. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesCopyFTPDirectoryTemplatePath): + * UIProcess/API/C/WKPreferencesPrivate.h: + +2010-12-08 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + WebKit2: Can't open ftp directory + <rdar://problem/8489321> + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetForceFTPDirectoryListings): + (WKPreferencesGetForceFTPDirectoryListings): + (WKPreferencesSetFTPDirectoryTemplatePath): + (WKPreferencesGetFTPDirectoryTemplatePath): + * UIProcess/API/C/WKPreferencesPrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Pipe through the FTP directory listing preferences. + +2010-12-08 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations + https://bugs.webkit.org/show_bug.cgi?id=49388 + + Fixes a build failure because WebChromeClient.cpp uses WebCore::Cursor. + This patch adds an include of QuartzCore/CATransform3D, which includes + a file that has a 'Cursor' object defined. So I had to qualify the + use of Cursor in WebChromeClient.cpp. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setCursor): + +2010-12-07 Brian Weinstein <bweinstein@apple.com> + + Reviewed by John Sullivan. + + Layering Violation in ContextMenu - member variable of type HitTestResult + https://bugs.webkit.org/show_bug.cgi?id=50586 + + Update users of ContextMenu and ContextMenuController to match where the new functions + are located. + + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::WebContextMenuItemData): Remove the call to checkOrEnableItem, that call will be made when + the ContextMenuItem is added to the ContextMenu through the ContextMenuController. + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): + +2010-12-08 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + WebKit2: Implement WebChromeClient::exceededDatabaseQuota + https://bugs.webkit.org/show_bug.cgi?id=50656 + + The exceededDatabaseQuota call from the WebProcess to the UIProcess needs to be synchronous + because the new quota is checked directly after exceededDatabaseQuota returns in order to + determine if the new Database can be created. + + Pass all of the details from the WebProcess to the UIProcess in order to inform the + decision in the UIProcess about the new quota. In WebKit1, these details were + fetched through an additional call to the API detailsForDatabase (which is infeasible in + WebKit2 since exceededDatabaseQuota is a synchronous call). + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add a version that takes 7 parameters. + + * UIProcess/API/C/WKPage.h: + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + Indicate that exceededDatabaseQuota is not implemented. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::exceededDatabaseQuota): + Call the UIClient's exceededDatabaseQuota + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::exceededDatabaseQuota): + If the client does not implement exceededDatabaseQuota, return a the current quota. + * UIProcess/WebUIClient.h: + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::exceededDatabaseQuota): + Send a synchronous message to the UIProcess to ask for the new quota for the origin for the + given frame. + +2010-12-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + fast/loader/empty-embed-src-attribute.html asserts in debug builds + https://bugs.webkit.org/show_bug.cgi?id=50643 + + Just always ignore attempts to load requests with empty URLs. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + +2010-12-07 Jessie Berlin <jberlin@apple.com> + + Build fix. Unreviewed. + + * WebKit2.pro: + Added WebDatabaseManagerQt.cpp. + * WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp: Added. + (WebKit::WebDatabaseManager::databaseDirectory): + Added a FIXME to implement and return an empty string. + +2010-12-07 Darin Adler <darin@apple.com> + + Get a bit closer to making Qt WebKit2 compile again. + + * WebKit2.pro: Add the WebDatabaseManager source files. + Still missing: The Qt version of the databaseDirectory function. + +2010-12-07 Jessie Berlin <jberlin@apple.com> + + Reviewed by Darin Adler. + + WebKit2: Need to set the location of the Databases directory when the WebProcess is initialized + https://bugs.webkit.org/show_bug.cgi?id=50604 + + * WebProcess/WebCoreSupport/WebDatabaseManager.cpp: Added. + (WebKit::WebDatabaseManager::shared): + (WebKit::WebDatabaseManager::WebDatabaseManager): + Initialize the DatabaseTracker with the Database directory. + * WebProcess/WebCoreSupport/WebDatabaseManager.h: Added. + * WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm: Added. + (WebKit::WebDatabaseManager::databaseDirectory): + Copied from WebKitInitializeDatabasesIfNecessary in WebKit/mac/Storage/WebDatabaseManager.mm. + * WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp: Added. + (WebKit::WebDatabaseManager::databaseDirectory): + Copied from WebKitInitializeWebDatabasesIfNecessary in WebKit/win/WebDatabaseManager.cpp. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + Make sure that the Databases directory has been set by calling WebDatabaseManager::shared(). + + * WebKit2.xcodeproj/project.pbxproj: + Add WebDatabaseManager.cpp/.h/Mac.cpp + * win/WebKit2.vcproj: + Add WebDatabaseManager.cpp/.h/Win.cpp + +2010-12-06 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Pass security origin to make local file decision correctly + https://bugs.webkit.org/show_bug.cgi?id=48603 + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::loadURL): Pass security origin. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchCreatePage): Ditto. + +2010-12-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Fix two WebKit2 prefs issues. + + * Shared/WebPreferencesStore.h: Include font-family preferences + in the FOR_EACH_WEBKIT_STRING_PREFERENCE macro, actually propagating + font family prefs to WebCore settings. + + * UIProcess/WebPageGroup.cpp: + (WebKit::WebPageGroup::WebPageGroup): + (WebKit::WebPageGroup::~WebPageGroup): Add and remove the WebPageGroup + from the preference object it creates. This allows preference changes + to actually be propagated to the web process. + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + The plug-in process crashes if it can't load the plug-in module + https://bugs.webkit.org/show_bug.cgi?id=50601 + <rdar://problem/8692654> + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::initialize): + Handle m_plugin being 0. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::netscapePluginModule): + Create the plug-in module if it doesn't exist. + + (WebKit::PluginProcess::initialize): + Store the plug-in path. + + * PluginProcess/PluginProcess.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::create): + Return null if the plug-in module doesn't exist. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Simplify code. + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebProcess crash in NPRemoteObjectMap::invalidate when closing tab + https://bugs.webkit.org/show_bug.cgi?id=50597 + <rdar://problem/8655584> + + When invalidating the NPRemoteObjectMap, we don't want NPObjectMessageReceiver to + release all objects NPObjects blindly because NPJSObjects have already been deallocated by the plug-in view. + + This is not an ideal solution; an ideal solution would involve NPJSObjects notifying any NPObjectMessageReceiver objects + that the NPJSObject is being destroyed. The NPObjectMessageReceiver could then simply null out the NPObject pointer. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver): + (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): + * Shared/Plugins/NPObjectMessageReceiver.h: + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::NPRemoteObjectMap): + (WebKit::NPRemoteObjectMap::invalidate): + * Shared/Plugins/NPRemoteObjectMap.h: + (WebKit::NPRemoteObjectMap::isInvalidating): + +2010-12-06 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Generalize didChangeLocationWithinPageForFrame for all same document navigations + https://bugs.webkit.org/show_bug.cgi?id=50584 + + - Rename didChangeLocationWithinPageForFrame callbacks to didSameDocumentNavigationForFrame + - Add WKSameDocumentNavigationType to didChangeLocationWithinPageForFrame. + - Call didSameDocumentNavigationForFrame for HTML session state changes. + + * Shared/API/c/WKPageLoadTypes.h: Added. + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + Moved WKFrameNavigationType here from WKPage.h and add WKSameDocumentNavigationType. + + * Shared/SameDocumentNavigationType.h: Added. + * UIProcess/API/C/WKAPICast.h: + Moved WKFrameNavigationType conversion from here. + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + Update comment. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didSameDocumentNavigation): + * UIProcess/WebFrameProxy.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didSameDocumentNavigationForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + Pipe new name through. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage): + Call didChangeLocationWithinPageForFrame for session state changes. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2010-12-06 Jessie Berlin <jberlin@apple.com> + + Reviewed by Dan Bernstein. + + WebKit2: Expose the preference to enable or disable HTML5 Databases. + https://bugs.webkit.org/show_bug.cgi?id=50411 + + * Shared/WebPreferencesStore.h: + Make the preference to enable HTML5 Databases default ot true. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetDatabasesEnabled): + (WKPreferencesGetDatabasesEnabled): + * UIProcess/API/C/WKPreferences.h: + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Set AbstractDatabase::isAvailable (mimicking how the preference is set in WebKit1). + +2010-12-06 Mark Rowe <mrowe@apple.com> + + Build fix. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): Wrap Carbon-specific code in #ifndef NP_NO_CARBON. + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a shim for GetCurrentEventButtonState + https://bugs.webkit.org/show_bug.cgi?id=50583 + + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::getCurrentEventButtonState): + Get the event button state from the plug-in. + + (WebKit::PluginProcess::initializeShim): + Add new shim callback. + + * PluginProcess/mac/PluginProcessShim.cpp: + (WebKit::shimGetCurrentEventButtonState): + Add shim. + + * PluginProcess/mac/PluginProcessShim.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::buttonState): + Return the button state. + + (WebKit::NetscapePlugin::platformHandleMouseEvent): + Update the button state. Also, make sure to actually pass the modifiers to NPP_HandleEvent. + + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a shim for IsWindowActive + https://bugs.webkit.org/show_bug.cgi?id=50582 + + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::isWindowActive): + Get the NetscapePlugin from the WindowRef and check if the plug-in's window is active. + + (WebKit::PluginProcess::initializeShim): + * PluginProcess/mac/PluginProcessShim.cpp + (WebKit::shimIsWindowActive): + Call isWindowActive. If it returns true, return the result value. Otherwise, call the real + IsWindowActive function. + + * PluginProcess/mac/PluginProcessShim.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_isWindowactive. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + (WebKit::NetscapePlugin::isWindowActive): + Return whether the window is active. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::windowMap): + (WebKit::NetscapePlugin::platformPostInitialize): + (WebKit::NetscapePlugin::platformDestroy): + (WebKit::NetscapePlugin::netscapePluginFromWindow): + Add a mapping between windows and the corresponding NetscapePlugin objects. + + (WebKit::NetscapePlugin::windowFocusChanged): + Update the window focus member variable. + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + REGERSSION (r73310?): Contents of <select> popup menus are upside-down on Windows + https://bugs.webkit.org/show_bug.cgi?id=50544 + <rdar://problem/8732336> + + * Shared/BackingStore.cpp: + * Shared/BackingStore.h: + * Shared/cairo/BackingStoreCairo.cpp: + Remove BackingStore::createFlippedGraphicsContext. + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: + (WebKit::WebPopupMenu::setUpPlatformData): + Don't create a flipped graphics context. + +2010-12-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + REGRESSION: Text in Find indicator is vertically flipped + https://bugs.webkit.org/show_bug.cgi?id=50524 + <rdar://problem/8732978> + + Don't flip the graphics context. + + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::draw): + +2010-12-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Dispatch keyboard events in the Carbon event model + https://bugs.webkit.org/show_bug.cgi?id=50503 + + * Shared/WebEvent.h: + (WebKit::WebKeyboardEvent::macCharCode): + * Shared/WebKeyboardEvent.cpp: + (WebKit::WebKeyboardEvent::WebKeyboardEvent): + (WebKit::WebKeyboardEvent::encode): + (WebKit::WebKeyboardEvent::decode): + Add macCharCode field. + + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebKeyboardEvent): + * Shared/qt/WebEventFactoryQt.cpp: + (WebKit::WebEventFactory::createWebKeyboardEvent): + * Shared/win/WebEventFactory.cpp: + (WebKit::WebEventFactory::createWebKeyboardEvent): + Pass along the Mac char code. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + Convert the event to a Carobn event. + +2010-12-03 John Sullivan <sullivan@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=50504 + Expose some more WebCore settings in WebKit2 preferences + + * Shared/WebPreferencesStore.h: + Changed name of existing FOR_EACH_WEBKIT_STRING_PREFERENCE macro to + FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE since it was all about platform-specific + font families, and I'm now introducing a non-platform-spacific string, and + I didn't want to put the new preference in two platform-specific lists. Then + added a new FOR_EACH_WEBKIT_STRING_PREFERENCE to hold the new preference. Note + that the other preferences exposed in this patch were already declared here. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetDefaultFontSize): + New wrapper. + (WKPreferencesGetDefaultFontSize): + Ditto. + (WKPreferencesSetDefaultFixedFontSize): + Ditto. + (WKPreferencesGetDefaultFixedFontSize): + Ditto. + (WKPreferencesSetDefaultTextEncodingName): + Ditto. + (WKPreferencesCopyDefaultTextEncodingName): + Ditto. + + * UIProcess/API/C/WKPreferences.h: + Declare new wrappers. + +2010-12-05 Adam Roben <aroben@apple.com> + + Windows production build fix + + Put spaces after trailing backslashes when setting + %WebKitVSPropsRedirectionDir%. According to MSDN + <http://msdn.microsoft.com/en-us/library/2kzfk8c7(v=VS.80).aspx>: + + A backslash ( \ ) followed by a newline character is interpreted as + a space in the command; use a backslash at the end of a line to + continue a command onto the next line. NMAKE interprets the + backslash literally if any other character, including a space or + tab, follows the backslash. + + * win/WebKit2.make: + +2010-12-04 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + WebKit2: Need client functions to notify app when the url changes due to a fragment navigation + https://bugs.webkit.org/show_bug.cgi?id=50511 + + Pipe didChangeLocationWithinPageForFrame up through the UIProcess to the WKPageLoadClient, + updating the WebFrameProxy's URL on the way. + + Test: PageLoadDidChangeLocationWithinPageForFrame + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didChangeURLWithoutNavigation): + * UIProcess/WebFrameProxy.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didChangeLocationWithinPageForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeLocationWithinPageForFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didChangeLocationWithinPageForFrame): + (WebKit::InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame): + (WebKit::InjectedBundlePageLoaderClient::didRunInsecureContentForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect): Fix typo. + (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): + +2010-12-03 Timothy Hatcher <timothy@apple.com> + + Make the Web Inspector window show and be usable on Mac. + + https://webkit.org/b/50490 + + Reviewed by Sam Weinig. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::invalidate): Call platformClose. + (WebKit::WebInspectorProxy::didLoadInspectorPage): Call platformOpen. + (WebKit::WebInspectorProxy::didClose): Call platformClose. + * UIProcess/WebInspectorProxy.h: + * UIProcess/WebInspectorProxy.messages.in: Added DidClose. + * UIProcess/mac/WebInspectorProxyMac.mm: + (-[WebInspectorProxyObjCAdapter initWithWebInspectorProxy:]): Added. + (-[WebInspectorProxyObjCAdapter windowWillClose:]): Added. Call WebInspectorProxy::close. + (WebKit::WebInspectorProxy::platformOpen): Added. + (WebKit::WebInspectorProxy::platformClose): Added. + * UIProcess/qt/WebInspectorProxyQt.cpp: + (WebKit::WebInspectorProxy::platformOpen): Added stub. + (WebKit::WebInspectorProxy::platformClose): Added stub. + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformOpen): Added stub. + (WebKit::WebInspectorProxy::platformClose): Added stub. + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + (WebKit::WebInspectorClient::sendMessageToFrontend): Added more null checks to avoid a crash. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + (WebKit::WebInspectorFrontendClient::closeWindow): Call WebInspector::didClose. + (WebKit::WebInspectorFrontendClient::disconnectFromBackend): Ditto. + (WebKit::WebInspectorFrontendClient::sendMessageToBackend): Removed. This does not need to be + implemented by our subclass since we are in a single process. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: Removed sendMessageToBackend. + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::didClose): Added. Send a DidClose message to the UI process. + * WebProcess/WebPage/WebInspector.h: + +2010-12-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig and Dan Bernstein. + + Clean up the BackingStore implementation + https://bugs.webkit.org/show_bug.cgi?id=50498 + + * Shared/BackingStore.cpp: + (WebKit::BackingStore::create): + (WebKit::BackingStore::createSharable): + (WebKit::BackingStore::resize): + Use new numBytesForSize helper function. + + (WebKit::BackingStore::createFlippedGraphicsContext): + Make this function platform independent. + + * Shared/BackingStore.h: + (WebKit::BackingStore::numBytesForSize): + Given a size, return the number of bytes needed for it. + + (WebKit::BackingStore::sizeInBytes): + Implement. + + * Shared/cg/BackingStoreCG.cpp: + (WebKit::BackingStore::paint): + Don't use CGBitmapContextCreateImage; it creates an extra copy of the image data. + + * Shared/qt/BackingStoreQt.cpp: + Remove createFlippedGraphicsContext. + +2010-12-03 Siddharth Mathur <siddharth.mathur@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] [WK2] Build system improvements for non-Unix targets + https://bugs.webkit.org/show_bug.cgi?id=50257 + + * DerivedSources.pro: + Fix dir seperator errors on Windows build host. Thanks to Laszlo Gombos. + +2010-12-03 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Enable <a ping> for Mac/Windows/WebKit2 builds + <rdar://problem/8504473> + https://bugs.webkit.org/show_bug.cgi?id=50488 + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetHyperlinkAuditingEnabled): + (WKPreferencesGetHyperlinkAuditingEnabled): + * UIProcess/API/C/WKPreferences.h: + Add "HyperlinkAuditing" preference and enabled it by default. + +2010-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by good sense in fixing builds. + + Export the 4 new API headers I added today. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8725679> and https://bugs.webkit.org/show_bug.cgi?id=50482 + Crash trying to empty caches with no WebProcess. + + * Shared/WebProcessCreationParameters.h: Add the "clear this cache" flags. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::ensureWebProcess): If either of the clear cache flags are set when a new WebProcess is + created, include those flags in the parameters. + (WebKit::WebContext::clearResourceCaches): If the current process isn't valid, flag this action to be done later. + (WebKit::WebContext::clearApplicationCache): Ditto. + * UIProcess/WebContext.h: + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): Clear the caches if told to. + +2010-12-03 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Fix failing API test. The default san serif font on the mac + should be Helvetica, not Courier. + + * Shared/WebPreferencesStore.h: + +2010-12-03 Jia Pu <jpu@apple.com> + + Reviewed by Darin Adler. + + Need to move all code that applies correction into correction panel callback. + https://bugs.webkit.org/show_bug.cgi?id=50426 + <rdar://problem/8720832> + + Adopted new signature of dismissCorrectionPanel. + + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::dismissCorrectionPanel): + +2010-12-03 Jessie Berlin <jberlin@apple.com> + + Windows build fix. Unreviewed. + + * win/WebKit2Generated.make: + Add the new API files from http://trac.webkit.org/changeset/73281. + +2010-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Groundwork for <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191 + WebKit2 Authentication Support + + With this patch in place, authentication challenges are sent up from WebCore and shipped over the IPC layer. + Client apps can implement the related client methods to attempt to continue without credentials or cancel a + challenge. + + There's not yet API to inspect a challenge or create a credential to use in reply - that will come later. + + Build-system changes: + * DerivedSources.make: + * DerivedSources.pro: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + + Messages and casts for IPC and APIs: + * Platform/CoreIPC/MessageID.h: + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * Shared/WebCoreArgumentCoders.h: + * UIProcess/API/C/WKAPICast.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + + Stub out the AuthenticationChallenge class family: + * UIProcess/API/C/WKAuthenticationChallenge.cpp: Added. + (WKAuthenticationChallengeGetTypeID): + * UIProcess/API/C/WKAuthenticationChallenge.h: Added. + * UIProcess/API/C/WKCredential.cpp: Added. + (WKCredentialGetTypeID): + * UIProcess/API/C/WKCredential.h: Added. + * UIProcess/API/C/WKProtectionSpace.cpp: Added. + (WKProtectionSpaceGetTypeID): + * UIProcess/API/C/WKProtectionSpace.h: Added. + + Add an Authentication listener for the client app to respond to: + * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: Added. + (WKAuthenticationDecisionListenerGetTypeID): + (WKAuthenticationDecisionListenerUseCredential): + (WKAuthenticationDecisionListenerCancel): + * UIProcess/API/C/WKAuthenticationDecisionListener.h: Added. + + Add Authentication related methods to the page loader client: + * UIProcess/API/C/WKPage.h: + + Add empty implementations of the new API objects: + * UIProcess/Authentication: Added. + * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Added. + (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): + (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): + (WebKit::AuthenticationChallengeProxy::useCredential): + (WebKit::AuthenticationChallengeProxy::cancel): + * UIProcess/Authentication/AuthenticationChallengeProxy.h: Added. + (WebKit::AuthenticationChallengeProxy::create): + (WebKit::AuthenticationChallengeProxy::listener): + (WebKit::AuthenticationChallengeProxy::type): + + * UIProcess/Authentication/WebCredential.cpp: Added. + (WebKit::WebCredential::core): + * UIProcess/Authentication/WebCredential.h: Added. + (WebKit::WebCredential::create): + (WebKit::WebCredential::type): + * UIProcess/Authentication/WebProtectionSpace.cpp: Added. + (WebKit::WebProtectionSpace::WebProtectionSpace): + * UIProcess/Authentication/WebProtectionSpace.h: Added. + (WebKit::WebProtectionSpace::create): + (WebKit::WebProtectionSpace::type): + + Add implementation of the Authentication decision listener: + * UIProcess/Authentication/AuthenticationDecisionListener.cpp: Added. + (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): + (WebKit::AuthenticationDecisionListener::useCredential): + (WebKit::AuthenticationDecisionListener::cancel): + (WebKit::AuthenticationDecisionListener::detachChallenge): + * UIProcess/Authentication/AuthenticationDecisionListener.h: Added. + (WebKit::AuthenticationDecisionListener::create): + (WebKit::AuthenticationDecisionListener::type): + + WebPage and PageLoaderClient glue: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): + (WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame): + (WebKit::WebPageProxy::didReceiveAuthenticationChallenge): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + + Add a manager to map the actual platform authentication challenges to a challenge ID, + as at least some platforms require the object identity to persist: + * WebProcess/Authentication: Added. + * WebProcess/Authentication/AuthenticationManager.cpp: Added. + (WebKit::generateAuthenticationChallengeID): + (WebKit::AuthenticationManager::shared): + (WebKit::AuthenticationManager::AuthenticationManager): + (WebKit::AuthenticationManager::didReceiveMessage): + (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): + (WebKit::AuthenticationManager::useCredentialForChallenge): + (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): + (WebKit::AuthenticationManager::cancelChallenge): + * WebProcess/Authentication/AuthenticationManager.h: Added. + * WebProcess/Authentication/AuthenticationManager.messages.in: Added. + + Hand off Authentication challenges to the manager to be sent over IPC: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): + (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace): + + * UIProcess/API/qt/qwkpage.cpp: + +2010-12-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Flip the destination context when painting a backing store into the destination + https://bugs.webkit.org/show_bug.cgi?id=50491 + + * Shared/cg/BackingStoreCG.cpp: + (WebKit::BackingStore::paint): + +2010-12-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + The chunked update drawing area is flipped twice when drawing + https://bugs.webkit.org/show_bug.cgi?id=50465 + <rdar://problem/8726836> + + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + Flip the destination contexts, thus unflipping them. (Turns out two wrongs make a right here). + +2010-12-03 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Need a WebKit2 Equivalent of WebSecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=50170 + + * Shared/API/c/WKBase.h: + Add the WKSecurityOriginRef typedef. + + * Shared/APIObject.h: + Add the SecurityOrigin type as a Shared type. + + * Shared/API/c/WKSharedAPICast.h:: + Add the mapping between WKSecurityOriginRef and WebSecurityOrigin. + + * UIProcess/API/C/WKSecurityOrigin.cpp: Added. + (WKSecurityOriginGetTypeID): + (WKSecurityOriginCreate): + (WKSecurityOriginGetProtocol): + (WKSecurityOriginGetHost): + (WKSecurityOriginGetPort): + * UIProcess/API/C/WKSecurityOrigin.h: Added. + + * UIProcess/WebSecurityOrigin.h: Added. + (WebKit::WebSecurityOrigin::create): + Create based on the database identifier, which contains the protocol, host and port. + (WebKit::WebSecurityOrigin::protocol): + (WebKit::WebSecurityOrigin::host): + (WebKit::WebSecurityOrigin::port): + (WebKit::WebSecurityOrigin::databaseIdentifier): + (WebKit::WebSecurityOrigin::WebSecurityOrigin): + (WebKit::WebSecurityOrigin::type): + + * WebKit2.pro: + Add WKSecurityOrigin.cpp/.h. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add the WebSecurityOrigin.h and WKSecurityOrigin.cpp/.h. + + * win/WebKit2Generated.make: + Make sure WKSecurityOrigin.h file gets copied over to the WebKitBuild directory on Windows. + +2010-12-02 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Csaba Osztrogonác. + + [Qt] Fix compilation with !ENABLE(OFFLINE_WEB_APPLICATIONS) and + !ENABLE(TILED_BACKING_STORE) for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=50071 + + Add appropriate guards. No functional change if guards are set. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::setActualVisibleContentsRect): + * UIProcess/TiledDrawingAreaProxy.cpp: + * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: + * UIProcess/qt/TiledDrawingAreaTileQt.cpp: + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::applicationCacheDirectory): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + +2010-12-02 Sam Weinig <sam@webkit.org> + + Fix Qt. + + * UIProcess/API/qt/qwkpreferences.cpp: + (QWKPreferencesPrivate::createPreferences): + +2010-12-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 Preferences should be held off the PageGroup, not the Context + https://bugs.webkit.org/show_bug.cgi?id=50414 + + - In addition, this now makes the preference held off the PageGroup have + the identifier of the PageGroup and autosave to disk (only on the mac + for now). + - Adds ability to create an arbitrary preference that can be autosaved + via a new WKPreferencesCreateWithIdentifier function. + + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/WKContext.h: + Remove preference related code. + + * UIProcess/API/C/WKPageGroup.cpp: + (WKPageGroupSetPreferences): + (WKPageGroupGetPreferences): + * UIProcess/API/C/WKPageGroup.h: + Add getter/setter for preferences. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesCreateWithIdentifier): + * UIProcess/API/C/WKPreferences.h: + Add WKPreferencesCreateWithIdentifier and remove WKPreferencesCreateCopy which is + unused. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::~WebContext): + * UIProcess/WebContext.h: + Remove preference related code. + + * UIProcess/WebPageGroup.cpp: + (WebKit::WebPageGroup::WebPageGroup): + (WebKit::WebPageGroup::addPage): + (WebKit::WebPageGroup::removePage): + (WebKit::WebPageGroup::setPreferences): + (WebKit::WebPageGroup::preferences): + (WebKit::WebPageGroup::preferencesDidChange): + * UIProcess/WebPageGroup.h: + Add preference and page tracking. + + * UIProcess/WebPageNamespace.cpp: + * UIProcess/WebPageNamespace.h: + Remove preference change notification code. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::~WebPageProxy): + Add/remove self from page group set. + + (WebKit::WebPageProxy::preferencesDidChange): + (WebKit::WebPageProxy::creationParameters): + Get preferences from the pageGroup. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::WebPreferences): + (WebKit::WebPreferences::addPageGroup): + (WebKit::WebPreferences::removePageGroup): + (WebKit::WebPreferences::update): + * UIProcess/WebPreferences.h: + (WebKit::WebPreferences::create): + Change to track page groups instead of contexts. + + * UIProcess/mac/WebPreferencesMac.mm: + (WebKit::makeKey): Add ".WebKit2" prefix for keys. + +2010-12-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Flash videos on YouTube flicker + https://bugs.webkit.org/show_bug.cgi?id=50409 + <rdar://problem/8668757> + + When painting from a backing store, we need to add the source location + to the destination point. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::paint): + (WebKit::PluginProxy::update): + +2010-12-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 needs API to turn on popup blocking + https://bugs.webkit.org/show_bug.cgi?id=50407 + + Pipe-through a preference for javascript being able to open + windows without user gesture. + + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetJavaScriptCanOpenWindowsAutomatically): + (WKPreferencesGetJavaScriptCanOpenWindowsAutomatically): + * UIProcess/API/C/WKPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2010-12-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Plug-ins should be able to update the mouse cursor + https://bugs.webkit.org/show_bug.cgi?id=50399 + + Call WKEnableSettingCursorWhenInBackground. + + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + +2010-12-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=50368 + Overhaul WebKit2 preferences code + + - Reduces the number of places you have to touch to add a new preference + (From 9 down to 4, but with a bit of elbow grease, we should get that + down to 2 or 3). + - Add hooks so that platforms can initialize the preferences based on an + identifier. This is currently only used on the Mac to initialize a + preference store from NSUserDefaults and autosave the changes to disk. + It is not yet enabled due to no way to set the identifier from client + code. + + * Shared/WebPageCreationParameters.cpp: + Add necessary #include of WebCoreArgumentCoders.h which is now needed + due to cleanup in WebPreferencesStore.h. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + (WebKit::defaultValueForKey): + (WebKit::setValueForKey): + (WebKit::valueForKey): + (WebKit::WebPreferencesStore::setStringValueForKey): + (WebKit::WebPreferencesStore::getStringValueForKey): + (WebKit::WebPreferencesStore::setBoolValueForKey): + (WebKit::WebPreferencesStore::getBoolValueForKey): + (WebKit::WebPreferencesStore::setUInt32ValueForKey): + (WebKit::WebPreferencesStore::getUInt32ValueForKey): + * Shared/WebPreferencesStore.h: + Complete overhaul of this class to store the preferences as + a set of HashMaps and use macros to define the keys and default + values. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesGetFontSmoothingLevel): + Add cast to keep conversion function working. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::WebPreferences): Add identifier constructor. + (WebKit::WebPreferences::updateStringValueForKey): + (WebKit::WebPreferences::updateBoolValueForKey): + (WebKit::WebPreferences::updateUInt32ValueForKey): + Add type based updaters. These currently give hooks to the platform and + call the generic update, but in the future, we can use this to optimize + updating preferences to not send the entire store for each change. + + * UIProcess/WebPreferences.h: + Generate the getters and setters via macro instantiation. + + * UIProcess/cf/WebPreferencesCF.cpp: Added. + (WebKit::WebPreferences::platformInitializeStore): + (WebKit::WebPreferences::platformUpdateStringValueForKey): + (WebKit::WebPreferences::platformUpdateBoolValueForKey): + (WebKit::WebPreferences::platformUpdateUInt32ValueForKey): + Stubbed out. + + * UIProcess/mac/WebPreferencesMac.mm: Added. + (WebKit::makeKey): + (WebKit::setStringValueIfInUserDefaults): + (WebKit::setBoolValueIfInUserDefaults): + (WebKit::setUInt32ValueIfInUserDefaults): + (WebKit::WebPreferences::platformInitializeStore): + (WebKit::WebPreferences::platformUpdateStringValueForKey): + (WebKit::WebPreferences::platformUpdateBoolValueForKey): + (WebKit::WebPreferences::platformUpdateUInt32ValueForKey): + Use the platform hooks to initialize and update the store from + NSUserDefaults. + + * UIProcess/qt/WebPreferencesQt.cpp: Added. + (WebKit::WebPreferences::platformInitializeStore): + (WebKit::WebPreferences::platformUpdateStringValueForKey): + (WebKit::WebPreferences::platformUpdateBoolValueForKey): + (WebKit::WebPreferences::platformUpdateUInt32ValueForKey): + Stubbed out. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::platformPreferencesDidChange): + Update to pull the value using the new type based getters. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-12-02 Steve Falkenburg <sfalken@apple.com> + + Mac build fix. + + * WebProcess/WebKitMain.cpp: + (enableDataExecutionPrevention): + +2010-11-30 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + [GTK] Implement RunLoop, WorkQueue, Connection classes for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=48507 + + * Platform/CoreIPC/Connection.h: UNIX_X11 specific changes for GTK port. + (CoreIPC::Connection::messageProcessingCompleted): + * Platform/CoreIPC/gtk: Added. + * Platform/CoreIPC/gtk/ConnectionGtk.cpp: Added. Connection class implementation for GTK port (UNIX_X11 specific). + (CoreIPC::readBytesFromSocket): + (CoreIPC::writeBytesToSocket): + (CoreIPC::Connection::platformInitialize): + (CoreIPC::Connection::platformInvalidate): + (CoreIPC::Connection::processCompletedMessage): + (CoreIPC::Connection::readEventHandler): + (CoreIPC::Connection::open): + (CoreIPC::Connection::platformCanSendOutgoingMessages): + (CoreIPC::Connection::sendOutgoingMessage): + * Platform/PlatformProcessIdentifier.h: UNIX_X11 specific changes for GTK port. + * Platform/RunLoop.h: GTK port specific changes. + * Platform/WorkQueue.h: GTK port specific changes. + * Platform/gtk/RunLoopGtk.cpp: Added. Runs an event loop using GMainLoop and handles the incoming messages. + (RunLoop::RunLoop): + (RunLoop::~RunLoop): + (RunLoop::run): + (RunLoop::mainLoop): + (RunLoop::stop): + (RunLoop::queueWork): + (RunLoop::wakeUp): + (RunLoop::TimerBase::TimerBase): + (RunLoop::TimerBase::~TimerBase): + (RunLoop::TimerBase::resetTimerSource): + (RunLoop::TimerBase::oneShotTimerFired): + (RunLoop::TimerBase::repeatingTimerFired): + (RunLoop::TimerBase::start): + (RunLoop::TimerBase::stop): + (RunLoop::TimerBase::isActive): + * Platform/gtk/WorkQueueGtk.cpp: Added. Creates a thread and polls on a given fd using GIOChannel. + Dispatches the obtained messages to RunLoop's GMainLoop. + (WorkQueue::EventSource::EventSource): + (WorkQueue::EventSource::dispatchSource): + (WorkQueue::EventSource::performWorkOnce): + (WorkQueue::EventSource::performWork): + (WorkQueue::EventSource::deleteEventSource): + (WorkQueue::platformInitialize): + (WorkQueue::platformInvalidate): + (WorkQueue::startWorkQueueThread): + (WorkQueue::workQueueThreadBody): + (WorkQueue::registerEventSourceHandler): + (WorkQueue::unregisterEventSourceHandler): + (WorkQueue::scheduleWork): + +2010-12-02 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Move enableExecutionPrevention to WebKitMain + https://bugs.webkit.org/show_bug.cgi?id=50392 + + * WebProcess/WebKitMain.cpp: + (enableDataExecutionPrevention): + (WebKitMain): + * WebProcess/win/WebProcessMainWin.cpp: + (WebKit::WebProcessMain): + +2010-12-02 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Enable DEP at runtime to allow for compatibility with older versions of ATL + https://bugs.webkit.org/show_bug.cgi?id=50378 + + * WebProcess/win/WebProcessMainWin.cpp: + (WebKit::enableDataExecutionPrevention): + (WebKit::WebProcessMain): + * win/WebKit2WebProcessCommon.vsprops: + +2010-12-01 Sam Weinig <sam@webkit.org> + + Fix 64-bit build. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::windowAndViewFramesChanged): + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Give the fake Carbon window the right bounds + https://bugs.webkit.org/show_bug.cgi?id=50361 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::windowAndViewFramesChanged): + * PluginProcess/PluginControllerProxy.h: + * PluginProcess/PluginControllerProxy.messages.in: + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateWindowAndViewFrames]): + Pass both the window frame and view frame along. + + (-[WKView renewGState]): + Call _updateWindowAndViewFrames. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::windowAndViewFramesChanged): + Pass both the window frame and view frame along. + + * UIProcess/WebPageProxy.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + We don't want a title bar in our fake window. + + (WebKit::computeFakeWindowBoundsRect): + Compute the fake window bounds. + + (WebKit::NetscapePlugin::windowAndViewFramesChanged): + Update the fake window bounds. + + * WebProcess/Plugins/Plugin.h: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::windowAndViewFramesChanged): + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::windowAndViewFramesChanged): + (WebKit::PluginView::initializePlugin): + * WebProcess/Plugins/PluginView.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::windowAndViewFramesChanged): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::windowFrameInScreenCoordinates): + (WebKit::WebPage::viewFrameInWindowCoordinates): + * WebProcess/WebPage/WebPage.messages.in: + Pass both the window frame and view frame along. + +2010-12-01 Jia Pu <jpu@apple.com> + + Reviewed by Darin Adler. + + Support multiple correction candidates panel for misspelled word on Mac OS X. + https://bugs.webkit.org/show_bug.cgi?id=50137 + <rdar://problem/8568059> + + Adopted new function signatures defined in base class. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::getGuessesForWord): + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::showCorrectionPanel): + +2010-12-01 Simon Fraser <simon.fraser@apple.com> + + Reviewed by John Sullivan. + + Hit testing broken on sibling views of the WKView + <rdar://problem/8718397> + + Make sure that hitView is not null when comparing with the + _layerHostingView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView hitTest:]): + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement the remaining PluginController/Plugin member functions + https://bugs.webkit.org/show_bug.cgi?id=50356 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::cancelStreamLoad): + (WebKit::PluginControllerProxy::cancelManualStreamLoad): + (WebKit::PluginControllerProxy::setStatusbarText): + (WebKit::PluginControllerProxy::pluginProcessCrashed): + (WebKit::PluginControllerProxy::frameDidFinishLoading): + (WebKit::PluginControllerProxy::frameDidFail): + (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse): + (WebKit::PluginControllerProxy::manualStreamDidReceiveData): + (WebKit::PluginControllerProxy::manualStreamDidFinishLoading): + (WebKit::PluginControllerProxy::manualStreamDidFail): + * PluginProcess/PluginControllerProxy.h: + * PluginProcess/PluginControllerProxy.messages.in: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::frameDidFinishLoading): + (WebKit::PluginProxy::frameDidFail): + (WebKit::PluginProxy::manualStreamDidReceiveResponse): + (WebKit::PluginProxy::manualStreamDidReceiveData): + (WebKit::PluginProxy::manualStreamDidFinishLoading): + (WebKit::PluginProxy::manualStreamDidFail): + (WebKit::PluginProxy::windowFrameChanged): + (WebKit::PluginProxy::cancelStreamLoad): + (WebKit::PluginProxy::cancelManualStreamLoad): + (WebKit::PluginProxy::setStatusbarText): + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/Plugins/PluginProxy.messages.in: + +2010-12-01 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + WinCairo build should not use link-time code generation (LTCG) + https://bugs.webkit.org/show_bug.cgi?id=50353 + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig.. + + Fix <rdar://problem/8717674>. + + * WebProcess/com.apple.WebProcess.sb: + Allow the UI process to issue file-write extensions. + +2010-12-01 Sam Weinig <sam@webkit.org> + + Another windows build fix. + + * UIProcess/API/C/win/WKView.cpp: + (WKViewCreate): + +2010-12-01 Sam Weinig <sam@webkit.org> + + Attempt to fix Windows build. + + * UIProcess/API/C/win/WKViewPrivate.cpp: + * UIProcess/API/C/win/WKViewPrivate.h: + +2010-12-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add PageGrouping to WebKit2 API + https://bugs.webkit.org/show_bug.cgi?id=50332 + + - Adds WKPageGroupRef and WKBundlePageGroupRef API objects + (backed by WebPageGroup and WebPageGroupProxy respectively). + - Moves visibleToInjectedBundle from page to PageGroup. + - Make userScript/userStyleSheet functions take a page group parameter. + + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + * Shared/WebPageCreationParameters.h: + * Shared/WebPageGroupData.cpp: Added. + (WebKit::WebPageGroupData::encode): + (WebKit::WebPageGroupData::decode): + * Shared/WebPageGroupData.h: Added. + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageGetPageGroup): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPageGroup.cpp: Added. + (WKPageGroupGetTypeID): + (WKPageGroupCreateWithIdentifier): + (WKPageGroupCopyIdentifier): + * UIProcess/API/C/WKPageGroup.h: Added. + * UIProcess/API/C/WebKit2.h: + * UIProcess/API/C/win/WKView.cpp: + (WKViewCreate): + * UIProcess/API/C/win/WKView.h: + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:pageGroupRef:]): + (-[WKView initWithFrame:pageNamespaceRef:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::createWebPage): + * UIProcess/WebContext.h: + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::encode): + (WebKit::WebContextUserMessageDecoder::decode): + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::inspectorPageGroup): + * UIProcess/WebInspectorProxy.h: + * UIProcess/WebPageGroup.cpp: Added. + (WebKit::generatePageGroupID): + (WebKit::webPageGroupMap): + (WebKit::WebPageGroup::create): + (WebKit::WebPageGroup::get): + (WebKit::WebPageGroup::WebPageGroup): + (WebKit::WebPageGroup::~WebPageGroup): + * UIProcess/WebPageGroup.h: Added. + (WebKit::WebPageGroup::identifier): + (WebKit::WebPageGroup::pageGroupID): + (WebKit::WebPageGroup::data): + (WebKit::WebPageGroup::type): + * UIProcess/WebPageNamespace.cpp: + (WebKit::WebPageNamespace::createWebPage): + * UIProcess/WebPageNamespace.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::create): + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::pageGroup): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::createWebPage): + * UIProcess/WebProcessProxy.h: + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleAddUserScript): + (WKBundleAddUserStyleSheet): + (WKBundleRemoveUserScript): + (WKBundleRemoveUserStyleSheet): + (WKBundleRemoveUserScripts): + (WKBundleRemoveUserStyleSheets): + (WKBundleRemoveAllUserContent): + (WKBundleOverrideXSSAuditorEnabledForTestRunner): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetPageGroup): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp: Added. + (WKBundlePageGroupGetTypeID): + (WKBundlePageGroupCopyIdentifier): + * WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): + (WebKit::InjectedBundle::addUserScript): + (WebKit::InjectedBundle::addUserStyleSheet): + (WebKit::InjectedBundle::removeUserScript): + (WebKit::InjectedBundle::removeUserStyleSheet): + (WebKit::InjectedBundle::removeUserScripts): + (WebKit::InjectedBundle::removeUserStyleSheets): + (WebKit::InjectedBundle::removeAllUserContent): + (WebKit::InjectedBundle::didInitializePageGroup): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/InjectedBundleClient.cpp: + (WebKit::InjectedBundleClient::didInitializePageGroup): + * WebProcess/InjectedBundle/InjectedBundleClient.h: + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + (WebKit::InjectedBundleUserMessageEncoder::encode): + (WebKit::InjectedBundleUserMessageDecoder::decode): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::create): + (WebKit::WebPage::WebPage): + (WebKit::WebPage::close): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::pageGroup): + * WebProcess/WebPage/WebPageGroupProxy.cpp: Added. + (WebKit::WebPageGroupProxy::create): + (WebKit::WebPageGroupProxy::~WebPageGroupProxy): + * WebProcess/WebPage/WebPageGroupProxy.h: Added. + (WebKit::WebPageGroupProxy::identifier): + (WebKit::WebPageGroupProxy::pageGroupID): + (WebKit::WebPageGroupProxy::isVisibleToInjectedBundle): + (WebKit::WebPageGroupProxy::WebPageGroupProxy): + (WebKit::WebPageGroupProxy::type): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::webPageGroup): + * WebProcess/WebProcess.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-12-01 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + vcproj changes can't be applied cleanly by the Windows EWS bot + https://bugs.webkit.org/show_bug.cgi?id=50328 + + * win/WebKit2.submit.sln: Added property svn:eol-style. + * win/WebKit2.vcproj: Added property svn:eol-style. + * win/WebKit2Apple.vsprops: Added property svn:eol-style. + * win/WebKit2CFLite.vsprops: Added property svn:eol-style. + * win/WebKit2Common.vsprops: Added property svn:eol-style. + * win/WebKit2DirectX.vsprops: Added property svn:eol-style. + * win/WebKit2Generated.vcproj: Added property svn:eol-style. + * win/WebKit2GeneratedCommon.vsprops: Added property svn:eol-style. + * win/WebKit2WebProcess.vcproj: Added property svn:eol-style. + * win/WebKit2WebProcessCommon.vsprops: Added property svn:eol-style. + +2010-12-01 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Size changes on layer-backed drawing areas don't always end up with the correct value + https://bugs.webkit.org/show_bug.cgi?id=50351 + <rdar://problem/8692966> + + When the UI process does not receive didSetSize messages promptly, + LayerBackedDrawingAreaProxy::setSize() bails early based on the + m_isWaitingForDidSetFrameNotification flag. + + In this situation, the final size may be incorrect. didSetSize() + needs to compare the size that the web process has to the expected size, + and send a final setSize if they differ. + + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::didSetSize): + (WebKit::LayerBackedDrawingAreaProxy::didReceiveMessage): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::setSize): + +2010-12-01 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Crash when closing WebKit2 window with accelerated composting content + https://bugs.webkit.org/show_bug.cgi?id=50307 + <rdar://problem/8640126> + + When the web page is closing, notify the drawing area, so that + the layer-backed drawing area can kill the runloop obsever, + then clear it. Clearing it is not sufficient, since the drawing + area is ref-counted. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::onPageClose): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformClear): + (WebKit::LayerBackedDrawingArea::onPageClose): + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Return a correct user agent if NPN_UserAgent is called with a null NPP from NPP_New. + https://bugs.webkit.org/show_bug.cgi?id=50336 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_UserAgent): + Call the static NetscapePlugin::userAgent function instead. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::userAgent): + If the passed in NPP is null, get the NetscapePlugin currently executing NPP_New. + + (WebKit::NetscapePlugin::initialize): + Keep track of the plug-in currently executing NPP_New. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + +2010-12-01 Brian Weinstein <bweinstein@apple.com> + + One last Windows build fix. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::pageDidEnterAcceleratedCompositing): + (WebKit::WebView::pageDidLeaveAcceleratedCompositing): + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/win/WebView.h: + +2010-12-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Andreas Kling. + + Get rid of DrawingAreaBase + https://bugs.webkit.org/show_bug.cgi?id=50329 + + * Scripts/webkit2/messages.py: + * Shared/DrawingAreaInfo.h: + (WebKit::DrawingAreaInfo::DrawingAreaInfo): + * Shared/WebPageCreationParameters.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::]): + (-[WKView _pageDidEnterAcceleratedCompositing]): + (-[WKView _pageDidLeaveAcceleratedCompositing]): + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::takeSnapshot): + (QGraphicsWKViewPrivate::commitScale): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + (WebKit::ChunkedUpdateDrawingAreaProxy::setSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + (WebKit::DrawingAreaProxy::nextIdentifier): + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::info): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::LayerBackedDrawingAreaProxy): + (WebKit::LayerBackedDrawingAreaProxy::setSize): + (WebKit::LayerBackedDrawingAreaProxy::setPageIsVisible): + (WebKit::LayerBackedDrawingAreaProxy::update): + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::TiledDrawingAreaProxy): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeAcceleratedCompositing): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + (WebKit::DrawingArea::DrawingArea): + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::info): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::didReceiveMessage): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::TiledDrawingArea): + * WebProcess/WebPage/TiledDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::changeAcceleratedCompositingMode): + +2010-11-30 Ryosuke Niwa <rniwa@webkit.org> + + Unreviewed speculative build fix for Windows. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::pageDidEnterAcceleratedCompositing): + (WebKit::WebView::pageDidLeaveAcceleratedCompositing): + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + * UIProcess/win/WebView.h: + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Fix Qt build. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::takeSnapshot): + (QGraphicsWKViewPrivate::commitScale): + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Change DrawingArea and DrawingAreaProxy to not inherit from DrawingAreaBase + https://bugs.webkit.org/show_bug.cgi?id=50300 + + * UIProcess/API/mac/WKView.mm: + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaBase::]): + (-[WKView _pageDidEnterAcceleratedCompositing]): + (-[WKView _pageDidLeaveAcceleratedCompositing]): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + (WebKit::DrawingAreaProxy::nextDrawingAreaID): + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::info): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::LayerBackedDrawingAreaProxy): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + (WebKit::DrawingArea::DrawingArea): + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::info): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::didReceiveMessage): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::TiledDrawingArea): + * WebProcess/WebPage/TiledDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): + +2010-11-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Context menus broken after WebKit2 goes into accelerated composting mode. + https://bugs.webkit.org/show_bug.cgi?id=50296 + + Override hitTest: on the WKView to exclude the child layer-backed view from + hit testing, so that context menus work. + + * UIProcess/API/mac/WKView.mm: + (-[WKView hitTest:]): + +2010-11-30 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Build fix. + + * Configurations/BaseTarget.xcconfig: Don't run Copy Files and Run Script build phases + during installhdrs. It's not necessary, and it results in Xcode attempting to copy the + plug-in shim dylib when it has not yet been built. + * WebKit2.xcodeproj/project.pbxproj: Stop copying the .xcconfig file in to the application + wrapper. + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Fix build. + + * Scripts/webkit2/messages.py: + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename DrawingAreaBase.h to DrawingAreaInfo.h. + + * Shared/DrawingAreaInfo.h: Renamed from WebKit2/Shared/DrawingAreaBase.h. + (WebKit::DrawingAreaBase::DrawingAreaInfo::DrawingAreaInfo): + (WebKit::DrawingAreaBase::~DrawingAreaBase): + (WebKit::DrawingAreaBase::info): + (WebKit::DrawingAreaBase::DrawingAreaBase): + * Shared/WebPageCreationParameters.h: + * UIProcess/DrawingAreaProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/DrawingArea.h: + * win/WebKit2.vcproj: + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Fix build. + + * PluginProcess/mac/PluginProcessShim.cpp: + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add a simple shim function for Debugger(). + https://bugs.webkit.org/show_bug.cgi?id=50268 + + * PluginProcess/PluginProcess.h: + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::initShouldCallRealDebugger): + We only want to call the real Debugger() function when USERBREAK is set. + + (WebKit::shouldCallRealDebugger): + Return whether USERBREAK is set. + + (WebKit::PluginProcess::initializeShim): + Initialize the shim. + + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + Call PluginProcess::initializeShim. + + * PluginProcess/mac/PluginProcessShim.cpp: + (WebKit::WebKitPluginProcessShimInitialize): + This now takes a struct of callbacks. + + (WebKit::shimDebugger): + Call the shouldCallDebugger function. If it returns true, the real Debugger() function should be called. + + * PluginProcess/mac/PluginProcessShim.h: + * WebKit2.xcodeproj/project.pbxproj: + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass the plug-in process shim in DYLD_INSERT_LIBRARIES when launching the plug-in process + https://bugs.webkit.org/show_bug.cgi?id=50262 + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + Add an EnvironmentVariables class that allows for easy modification of the environment variables + passed to posix_spawn. + + (WebKit::ProcessLauncher::launchProcess): + When spawning the plug-in process, insert the plug-in process shim. + +2010-11-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add plug-in process shim + https://bugs.webkit.org/show_bug.cgi?id=50261 + + * Configurations/PluginProcessShim.xcconfig: Added. + * PluginProcess/mac/PluginProcessShim.cpp: Added. + (PluginProcessShimInitialize): + * PluginProcess/mac/PluginProcessShim.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-11-30 Brian Weinstein <bweinstein@apple.com> + + Fix the Windows build by copying WKFindOptions.h into WebKitOutputDir with the other headers. + + * win/WebKit2Generated.make: + +2010-11-30 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build. + + * win/WebKit2.vcproj: + +2010-11-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + Injected bundle support for <rdar://problem/8710645> WebKitTestRunner needs layoutTestController.findString + https://bugs.webkit.org/show_bug.cgi?id=50238 + + * Shared/API/c/WKFindOptions.h: Added. Moved the definition of WKFindOptions here from WKPage.h. + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toFindOptions): Moved from WKAPICast.h. + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKPage.h: + * WebKit2.xcodeproj/project.pbxproj: Added WKFindOptions.h. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageFindString): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::findStringFromInjectedBundle): Added. + * WebProcess/WebPage/WebPage.h: + +2010-11-30 Andreas Kling <kling@webkit.org> + + Reviewed by Dirk Schulze. + + GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument + https://bugs.webkit.org/show_bug.cgi?id=48516 + + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::draw): + +2010-11-30 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + All projects on Windows should use cmd files for build events + https://bugs.webkit.org/show_bug.cgi?id=50213 + + * win/WebKit2Common.vsprops: + * win/WebKit2WebProcessCommon.vsprops: + * win/WebKit2WebProcessPostBuild.cmd: Added. + * win/WebKit2WebProcessPreBuild.cmd: Added. + * win/WebKitPostBuild.cmd: Added. + * win/WebKitPreBuild.cmd: Added. + * win/WebKitPreLink.cmd: Added. + +2010-11-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] Early return if setResizesToContentsUsingLayoutSize() is called with already-set size + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setResizesToContentsUsingLayoutSize): + +2010-11-29 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + WebKit2 part of <rdar://problem/8650085> adding word-prefix search options to the text search API. + https://bugs.webkit.org/show_bug.cgi?id=50038 + Based on a patch from Darin Adler. + + * Shared/WebFindOptions.h: Renamed FindOptions.h to this to account for WebCore’s new private + FindOptions.h. Added and reordered FindOptions and rolled FindDirection into FindOptions. + * UIProcess/API/C/WKAPICast.h: Removed toFindDirection(). + (WebKit::toFindOptions): Updated for new values. + * UIProcess/API/C/WKPage.cpp: + (WKPageFindString): Removed separate WKFindDirection. + (WKPageCountStringMatches): Replaces caseInsensitive boolean with WKFindOptions. + * UIProcess/API/C/WKPage.h: Removed WKFindDirection and updated WKFindOptions. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::findString): Removed separate FindDirection. + (WebKit::WebPageProxy::countStringMatches): Replaced caseInsensitive boolean with FindOptions. + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: Updated for the header rename. + * WebProcess/WebPage/FindController.cpp: + (WebKit::core): Added. Converts WebKit2 FindOptions to WebCore FindOptions. + (WebKit::FindController::countStringMatches): Changed to use FindOptions. + (WebKit::FindController::findString): Ditto. + * WebProcess/WebPage/FindController.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::findString): Ditto. + (WebKit::WebPage::countStringMatches): Ditto. + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: Ditto. + +2010-11-29 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * win/WebKit2.vcproj: Add missing vsprops association for + Debug_Cairo_CFLite target. + +2010-11-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cursor does not always change back to arrow when exiting image document + https://bugs.webkit.org/show_bug.cgi?id=50190 + <rdar://problem/8665265> + + * Shared/mac/WebEventFactory.mm: + (WebKit::mouseEventTypeForEvent): + (WebKit::globalPointForEvent): + (WebKit::pointForEvent): + Handle the NSMouseEntered and NSMouseExited events. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:]): + We want entered and exited events for this tracking area. + Add mouseEntered and mouseExited handlers. + +2010-11-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Should be able to pause and resume downloads + https://bugs.webkit.org/show_bug.cgi?id=50185 + <rdar://problem/8691135> + + * UIProcess/API/C/WKContext.h: + Add didCancel callback. + + * UIProcess/API/C/WKDownload.cpp: + (WKDownloadGetResumeData): + (WKDownloadCancel): + Call the respective DownloadProxy member functions. + + * UIProcess/API/C/WKDownload.h: + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::cancel): + Send Cancel to the WebProcess. + + (WebKit::DownloadProxy::didFail): + This now takes a resumeData reference. + + (WebKit::DownloadProxy::didCancel): + Set the resume data and call didCancel. + + * UIProcess/Downloads/DownloadProxy.h: + (WebKit::DownloadProxy::resumeData): + Return the resume data. + + * UIProcess/Downloads/DownloadProxy.messages.in: + Add DidCancel message, Add resume data to DidFail. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::didCancel): + Call the didCancel context client function. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didFail): + This now takes a resume data argument as well. + + (WebKit::Download::didCancel): + Send DidCancel. + + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::cancelDownload): + Look up the download and cancel it. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::cancel): + Add stub. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::cancel): + Cancel the download. + + (-[WKDownloadAsDelegate download:didFailWithError:]): + Pass the resume data along. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::cancel): + Add stub. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::cancelDownload): + Ask the download manager to cancel the download. + + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: + Add CancelDownload message. + +2010-11-29 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Adam Roben. + + [WK2] Support repeating timers + https://bugs.webkit.org/show_bug.cgi?id=50024 + + Added boolean member for TimerBase on PLATFORM(WIN) + and PLATFORM(QT) to be able to differentiate between + repeating and one shot operating mode. Change the confusing + signature of TimerBase::start: use a bool for selecting + operating mode. + * Platform/RunLoop.h: + (RunLoop::TimerBase::startRepeating): + (RunLoop::TimerBase::startOneShot): + * Platform/mac/RunLoopMac.mm: + (RunLoop::TimerBase::start): + * Platform/qt/RunLoopQt.cpp: + (RunLoop::TimerBase::timerFired): Only stop the timer if it + is not in repeating mode. + (RunLoop::TimerBase::TimerBase): + (RunLoop::TimerBase::start): + * Platform/win/RunLoopWin.cpp: + (RunLoop::TimerBase::timerFired): Only stop the timer if it + is not in repeating mode. + (RunLoop::TimerBase::TimerBase): + (RunLoop::TimerBase::start): + +2010-11-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Downloads: When the web process crashes, call error callbacks for pending downloads + https://bugs.webkit.org/show_bug.cgi?id=50164 + <rdar://problem/8691170> + + * UIProcess/API/C/WKContext.h: + Add processDidCrash callback. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::~DownloadProxy): + Assert that the web context is null. + + (WebKit::DownloadProxy::processDidClose): + Call the processDidCrash callback. + + (WebKit::DownloadProxy::didFinish): + (WebKit::DownloadProxy::didFail): + Call downloadFinished. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::processDidClose): + Call processDidClose on all pending downloads. + + (WebKit::WebContext::downloadFinished): + Remove the download proxy from the map. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::processDidCrash): + Call the processDidCrash callback function. + +2010-11-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Allow pre-generation for package builds for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=50139 + + Use a build variable for the generated directory path and set the + value based on CONFIG just like for WebKit1. + + For non-package builds use a relative base path for the + genrated directory just like for WebKit1. + + * DerivedSources.pro: + * WebKit2.pro: + +2010-11-28 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Move some build logic from Qt to platform independent code + https://bugs.webkit.org/show_bug.cgi?id=50134 + + Remove the creation of the directories under $$OUTPUT_DIR/include + as these will be handled by the fwheader_generator target. + + Remove the explicit generation of $$OUTPUT_DIR/WebKit2/generated as + this is not required. + + * DerivedSources.pro: + +2010-11-24 Brady Eidson <beidson@apple.com> + + Reviewed implicitly by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=50042 + + * UIProcess/mac/WebContextMenuProxyMac.mm: + (-[WebUserDataWrapper initWithUserData:WebKit::]): Do the proper self = [super init] dance here. + +2010-11-24 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein. + + More of <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=50042 + WK2 Context Menu Items need a user data object and a client callback for selection. + + * Shared/API/c/WKContextMenuItem.cpp: + (WKContextMenuItemGetUserData): + (WKContextMenuItemSetUserData): + * Shared/API/c/WKContextMenuItem.h: + + * Shared/WebContextMenuItem.cpp: + (WebKit::WebContextMenuItem::userData): + (WebKit::WebContextMenuItem::setUserData): + * Shared/WebContextMenuItem.h: + + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::userData): + (WebKit::WebContextMenuItemData::setUserData): + * Shared/WebContextMenuItemData.h: + + * UIProcess/API/C/WKPage.h: + + * UIProcess/WebPageContextMenuClient.cpp: + (WebKit::WebPageContextMenuClient::customContextMenuItemSelected): Added for WK2 apps to get a callback. + * UIProcess/WebPageContextMenuClient.h: + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::contextMenuItemSelected): + * UIProcess/mac/WebContextMenuProxyMac.mm: + (-[WebUserDataWrapper initWithUserData:WebKit::]): Add an "APIObject" user data wrapper class to associate with the NSMenuItem. + (-[WebUserDataWrapper WebKit::]): + (-[WebMenuTarget forwardContextMenuAction:]): Include the user data object in the created ContextMenuItemData. + (WebKit::nsMenuItemVector): + +2010-11-24 Andras Becsi <abecsi@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + Make WebKit2 compile with !ENABLE(INSPECTOR). + https://bugs.webkit.org/show_bug.cgi?id=49973 + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toImpl): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKInspector.cpp: + * UIProcess/API/C/WKInspector.h: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/WebInspectorProxy.cpp: + * UIProcess/WebInspectorProxy.h: + * UIProcess/WebInspectorProxy.messages.in: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + * UIProcess/mac/WebInspectorProxyMac.mm: + * UIProcess/qt/WebInspectorProxyQt.cpp: + * UIProcess/win/WebInspectorProxyWin.cpp: + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorClient.h: + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: + * WebProcess/WebPage/WebInspector.cpp: + * WebProcess/WebPage/WebInspector.h: + * WebProcess/WebPage/WebInspector.messages.in: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::close): + (WebKit::WebPage::windowIsFocused): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/qt/WebInspectorQt.cpp: + * WebProcess/WebPage/win/WebInspectorWin.cpp: + +2010-11-24 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Make deep copies of tile images + + We need the tile images we get from UpdateChunk::createImage() to persist, + so we should take a copy() of them. + + * UIProcess/qt/TiledDrawingAreaTileQt.cpp: + (WebKit::TiledDrawingAreaTile::updateFromChunk): + +2010-11-24 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix uninitialized variable in QGraphicsWKViewPrivate + + Always initialize QGWKVP::m_isChangingScale in the constructor. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKViewPrivate::QGraphicsWKViewPrivate): + +2010-11-23 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Adapt to setShouldDelegateScrolling not being a real setting anymore. + We now similarily to setUseFixedLayout and setPaintEntireContents + set it on the FrameView wen transitioning to a new page, etc. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setResizesToContentsUsingLayoutSize): + +2010-11-22 Adam Roben <aroben@apple.com> + + Use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops files + + Apple's Windows build allows placing header files and import libraries for WebKit's + dependencies (CoreGraphics, CFNetwork, SQLite, etc.) outside the source tree via the + $WebKitLibrariesDir environment variable. This is both required for production builds and + convenient for Apple-internal developer builds. Apple's production builds also require that + WebKit's shared .vsprops files be accessed relative to $WebKitLibrariesDir. In production + builds, the files are copied into that directory tree by the + WebKitLibraries/win/tools/WinTools.make file. In Apple-internal developer builds, the + copying is done by + JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make. + + This .vsprops copying is problematic in one very important case: when a developer updates + their source tree and then tries to build. Visual Studio only reads .vsprops files when a + project is first loaded. So, when Visual Studio is first opened after the .vsprops files are + updated, it reads in the old files that were already residing in $WebKitLibrariesDir. When a + build is started, JavaScriptCoreGenerated.make copies the new .vsprops files into + $WebKitLibrariesDir, but Visual Studio will not pick up the changes. The rest of the build + will proceed with out-of-date .vsprops files, which will likely result in a build failure. + + To fix this, we now use normal relative paths to access the .vsprops files in the source + tree rather than in $WebKitLibrariesDir, but prefix those paths with a new environment + variable, $WebKitVSPropsRedirectionDir. In developer builds, this environment variable is + unset, so the normal relative paths are used to read the .vsprops files out of the source + tree directly. In production builds, this environment variable is set to a fake directory + that will cause the .vsprops files in $WebKitLibrariesDir to be found when the relative path + is resolved. + + For example, JavaScriptCore.vcproj uses this path for FeatureDefines.vsprops: + + $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops + + In developer builds, where $WebKitVSPropsRedirectionDir is unset, this will point to the + files in WebKitLibraries\win\tools\vsprops in the source tree. In production builds, + JavaScriptCore.make sets $WebKitVSPropsRedirectionDir to + "$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\", so the full path for + FeatureDefines.vsprops becomes: + + $(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops + + which resolves to: + + $(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops + + (We rely on the fact that Windows doesn't care whether the directories "1", "2", and "3" + actually exist since they are matched by an equal number of ".." path components.) + + Note that Visual Studio still won't pick up changes made to .vsprops files while Visual + Studio is open, but that problem hasn't seemed to cause developers many headaches so far. + + Fixes <http://webkit.org/b/49181> Windows build fails mysteriously when .vsprops files are + updated + + Reviewed by Dave Hyatt. + + * win/WebKit2.make: Set $WebKitVSPropsRedirectionDir so that production builds can + find the .vsprops files. + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + Changed to use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops + files. + +2010-11-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Make WebKit2 compile with ENABLE_JAVASCRIPT_DEBUGGER=0 + + * WebProcess/WebPage/WebInspector.cpp: Add missing ENABLE(JAVASCRIPT_DEBUGGER) guards. + (WebKit::WebInspector::startJavaScriptDebugging): + (WebKit::WebInspector::stopJavaScriptDebugging): + (WebKit::WebInspector::startJavaScriptProfiling): + (WebKit::WebInspector::stopJavaScriptProfiling): + +2010-11-21 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Textareas should be resizable by default + https://bugs.webkit.org/show_bug.cgi?id=49892 + + Test: WebKit2/WKPreferences + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + Add textAreasAreResizable bit. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetJavaEnabled): + (WKPreferencesGetJavaEnabled): + Fix typo, WKPRe... -> WKPre... + + (WKPreferencesSetMinimumFontSize): + (WKPreferencesGetMinimumFontSize): + Fix comment to correctly reflect that the default minimumFontSize is 0, not 1. + + (WKPreferencesSetTextAreasAreResizable): + (WKPreferencesGetTextAreasAreResizable): + * UIProcess/API/C/WKPreferences.h: + Add API. + + * UIProcess/API/C/WKPreferencesPrivate.h: + Don't use PLATFORM in API headers. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setTextAreasAreResizable): + (WebKit::WebPreferences::textAreasAreResizable): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Pipe bit through to the WebProcess and onto WebCore::Settings. + +2010-11-19 Zalan Bujtas <zbujtas@gmail.com> + + Reviewed by Andreas Kling. + + WebUIClient::createNewPage() expects a retained WKPageRef. + https://bugs.webkit.org/show_bug.cgi?id=48549 + + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_createNewPage): + +2010-11-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a didFail WKContextDownloadClient callback + https://bugs.webkit.org/show_bug.cgi?id=49847 + + * UIProcess/API/C/WKContext.h: + Add didFail callback. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didFail): + Call WebDownloadClient::didFail. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::didFail): + Call the didFail client function. + + +2010-11-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Extend sandbox when downloading files + https://bugs.webkit.org/show_bug.cgi?id=49844 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new overload. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): + Create a sandbox extension handle if necessary. + + * UIProcess/Downloads/DownloadProxy.messages.in: + Add a sandbox extension handle out parameter to the DecideDestinationWithSuggestedFilename message. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::decideDestinationWithSuggestedFilename): + Create and consume the returned sandbox extension handle. + + (WebKit::Download::didFinish): + (WebKit::Download::didFail): + Invalidate the sandbox extension handles. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]): + Whoops, fix inverted logic. + +2010-11-19 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Add Debug_Cairo_CFLite and Release_Cairo_CFLite configurations for all vcproj files + https://bugs.webkit.org/show_bug.cgi?id=49819 + + * win/WebKit2.vcproj: + * win/WebKit2Generated.vcproj: + * win/WebKit2WebProcess.vcproj: + * win/WebKit2WebProcessCommon.vsprops: + +2010-11-19 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + More of <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=49836 + Add WebKit2 API relevant to customization of context menus + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameAllowsFollowingLink): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::allowsFollowingLink): + * WebProcess/WebPage/WebFrame.h: + +2010-11-19 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=49836 + Add WebKit2 API relevant to customization of context menus + + Most of this is just exposing already-existing concepts in API. + + * Shared/API/c/WKURLRequest.cpp: + (WKURLRequestCreateWithWKURL): + * Shared/API/c/WKURLRequest.h: + + * Shared/WebURLRequest.cpp: + (WebKit::WebURLRequest::create): + * Shared/WebURLRequest.h: + + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: + (WKBundleHitTestResultCopyAbsoluteImageURL): + (WKBundleHitTestResultCopyAbsoluteMediaURL): + (WKBundleHitTestResultGetImageRect): + (WKBundleHitTestResultGetIsSelected): + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageHasLocalDataForURL): + (WKBundlePageCanHandleRequest): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: + (WebKit::InjectedBundleHitTestResult::absoluteImageURL): + (WebKit::InjectedBundleHitTestResult::absoluteMediaURL): + (WebKit::InjectedBundleHitTestResult::imageRect): + (WebKit::InjectedBundleHitTestResult::isSelected): + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: + + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): + + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::hasLocalDataForURL): + (WebKit::WebPage::canHandleRequest): + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::hasLocalDataForURL): Stubbed for now. + (WebKit::WebPage::canHandleRequest): Ditto. + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::hasLocalDataForURL): Ditto. + (WebKit::WebPage::canHandleRequest): Ditto. + +2010-11-19 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Need a way to clear disk cache from WebContext + https://bugs.webkit.org/show_bug.cgi?id=49820 + + * UIProcess/API/C/WKContext.cpp: + (WKContextClearResourceCaches): Added. + (WKContextClearApplicationCache): Added. + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::clearResourceCaches): Added. + (WebKit::WebContext::clearApplicationCache): Added. + * UIProcess/WebContext.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::clearResourceCaches): Added. + (WebKit::WebProcess::clearApplicationCache): Added. + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: Added messages. + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformClearResourceCaches): Added. + * WebProcess/qt/WebProcessQt.cpp: + (WebKit::WebProcess::platformClearResourceCaches): Added. + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformClearResourceCaches): Added. + +2010-11-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement support for loading local files + https://bugs.webkit.org/show_bug.cgi?id=49828 + <rdar://problem/8447121> + + * UIProcess/WebPageProxy.cpp: + (WebKit::initializeSandboxExtensionHandle): + Given an URL, create a sandbox extension if it's a local file URL. + + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::loadURLRequest): + Pass along sandbox extension handles to the LoadURL and LoadURLRequest messages. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + Call SandboxExtensionTracker::didStartProvisionalLoad. + + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + Call SandboxExtensionTracker::didCommitProvisionalLoad. + + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + Call SandboxExtensionTracker::didFailProvisionalLoad. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::~WebPage): + Invalidate the sandbox extension tracker. + + (WebKit::WebPage::close): + Invalidate the sandbox extension tracker. + + (WebKit::WebPage::loadURL): + (WebKit::WebPage::loadURLRequest): + Pass the sandbox extension handle to the sandbox extension tracker. + + (WebKit::WebPage::SandboxExtensionTracker::~SandboxExtensionTracker): + Invalidate the sandbox extension tracker. + + (WebKit::WebPage::SandboxExtensionTracker::invalidate): + invalidate ell the sandbox extensions. + + (WebKit::WebPage::SandboxExtensionTracker::beginLoad): + Create a sandbox extension and store it as the "pending provisional extension". + + (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad): + Consume the pending provisional extension and make it the provisional extension. + + (WebKit::WebPage::SandboxExtensionTracker::didCommitProvisionalLoad): + Invalidate the committed extension and make the provisional extension the committed extension. + + (WebKit::WebPage::SandboxExtensionTracker::didFailProvisionalLoad): + Invalidate the provisional extension. + + * WebProcess/WebPage/WebPage.messages.in: + Add SandboxExtension::Handle parameters to LoadURL and LoadURLRequest. + +2010-11-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Make it possible to encode null SandboxExtension handles + https://bugs.webkit.org/show_bug.cgi?id=49825 + + * Shared/mac/SandboxExtensionMac.mm: + (WebKit::SandboxExtension::Handle::encode): + If there's no underlying sandbox extension, just encode an empty byte array. + + (WebKit::SandboxExtension::Handle::decode): + If the decoded byte array is empty, don't try to create a sandbox extension. + + (WebKit::SandboxExtension::create): + If the handle is null, return null. + + (WebKit::SandboxExtension::consume): + Consuming shuld not null out the underlying sandbox extension object. + +2010-11-19 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Darin Adler. + + Normalize Cairo/CFLite project/solution configuration names + https://bugs.webkit.org/show_bug.cgi?id=49818 + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + +2010-11-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add SandboxExtension abstraction and use it for the injected bundle extension + https://bugs.webkit.org/show_bug.cgi?id=49817 + + * Shared/SandboxExtension.h: + Add SandboxExtension abstraction. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + Instead of encoding/decoding a token, encode/decode the sandbox extension handle. + + * Shared/mac/SandboxExtensionMac.mm: Added. + Add Mac implementation of SandboxExtension. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Create a SandboxExtension::Handle object. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/InjectedBundle/InjectedBundle.h: + (WebKit::InjectedBundle::setSandboxExtension): + Set the sandbox extension. + + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + (WebKit::InjectedBundle::load): + Consume the sandbox extension. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + Create a sandbox extension and set it on the injected bundle. + +2010-11-18 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Windows vcproj configuration names should be normalized across projects + https://bugs.webkit.org/show_bug.cgi?id=49776 + + * win/WebKit2.submit.sln: + * win/WebKit2Generated.vcproj: + * win/WebKit2GeneratedCommon.vsprops: Added. + +2010-11-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Crash in WebKit::PluginView::manualLoadDidReceiveResponse when navigating to a .wav file in WebKit2 on Mac + https://bugs.webkit.org/show_bug.cgi?id=48559 + <rdar://problem/8606622> + + Add null checks for m_plugin. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::manualLoadDidReceiveResponse): + (WebKit::PluginView::manualLoadDidReceiveData): + (WebKit::PluginView::manualLoadDidFinishLoading): + (WebKit::PluginView::manualLoadDidFail): + +2010-11-18 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Adam Roben. + + <rdar://problem/8602509&8602717&8602724> Enable compaction support. + + * Configurations/WebKit2.xcconfig: + +2010-11-18 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + WebKit2: Safari shouldn't auto-activate plug-ins in background tabs. + https://bugs.webkit.org/show_bug.cgi?id=49770 + <rdar://problem/8482424> + + Add an API on Windows to call setIsInWindow, which calls through to WebPage::setIsInWindow. + Remove the !PLATFORM(WIN) check in WebPage, so we don't automatically start plugins that are + loaded in background tabs. + + * UIProcess/API/C/win/WKView.cpp: + (WKViewSetIsInWindow): Call through to WebView::setIsInWindow. + * UIProcess/API/C/win/WKView.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setIsInWindow): Call through to WebPage::setIsInWindow. + * UIProcess/win/WebView.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Remove the !PLATFORM(WIN) check and update the comment. + +2010-11-18 Darin Adler <darin@apple.com> + + * WebProcess/WebPage/WebPage.cpp: Fix build by rolling out a change. + +2010-11-18 Darin Adler <darin@apple.com> + + Reviewed by Kevin Decker. + + REGRESSION (WebKit2): Plug-ins and <video> start playing immediately in background tabs + https://bugs.webkit.org/show_bug.cgi?id=49766 + + Test: manual-tests/resources/video-tab.html + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Call setCanStartMedia(false) since the rest of the code + starts out treating the page as "not in a window". + +2010-11-18 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Remove leftover Windows Debug_Internal configurations + https://bugs.webkit.org/show_bug.cgi?id=49758 + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + +2010-11-18 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Page overlays should be able to handle mouse events + https://bugs.webkit.org/show_bug.cgi?id=49756 + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + Add API cast function for converting an IntPoint to a WKPoint. + + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: + (PageOverlayClientImpl::mouseEvent): + Call the appropriate callbacks. + + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: + Add new callbacks. + +2010-11-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Keep the web process alive if there are active downloads + https://bugs.webkit.org/show_bug.cgi?id=49755 + + Make sure that Download objects are destroyed when the download finishes or fails. + Don't close the web process if there are live Download objects. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didFail): + Add stub. + + * UIProcess/Downloads/DownloadProxy.h: + * UIProcess/Downloads/DownloadProxy.messages.in: + Add DidFail message. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didFinish): + Call DownloadManager::downloadFinished. + + (WebKit::Download::didFail): + Send DidFail message and call DownloadManager::downloadFinished. + + * WebProcess/Downloads/Download.h: + (WebKit::Download::destinationID): + Call downloadID(). + + (WebKit::Download::downloadID): + Return the download ID. + + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::downloadFinished): + Delete the Download object and call WebProcess::shutdownIfPossible. + + * WebProcess/Downloads/DownloadManager.h: + (WebKit::DownloadManager::isDownloading): + Return whether the download manager has any active downloads. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:didFailWithError:]): + Call Download::didFail. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::removeWebPage): + Call shutdownIfPossible. + + (WebKit::WebProcess::shutdownIfPossible): + New function. Don't shutdown if there are live pages or active downloads. + + * WebProcess/WebProcess.h: + +2010-11-18 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Debug_Internal Windows configuration is unnecessary, should be removed + https://bugs.webkit.org/show_bug.cgi?id=49753 + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + * WebKit2Prefix.h: + +2010-11-18 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Clean up vcproj errors + https://bugs.webkit.org/show_bug.cgi?id=49741 + + * win/WebKit2WebProcess.vcproj: + +2010-11-18 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] [WK2] WebKit 2 would not compile for Qt without ENABLE_TOUCH_EVENT + https://bugs.webkit.org/show_bug.cgi?id=49664 + + Move the ENABLE(TOUCH_EVENTS) to the code where internal WebKit touch + types are used. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::touchEvent): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::touchEvent): + +2010-11-17 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Reuse the size of the actualVisibleContentRect when loading a new page + or navigating session history. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + +2010-11-17 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Converge means of querying a parent node into one way, which is Node::parentNode. + https://bugs.webkit.org/show_bug.cgi?id=49686 + + * WebProcess/WebPage/WebPage.cpp: Changed to use parentNode. + (WebKit::WebPage::findZoomableAreaForPoint): Ditto. + +2010-11-17 Timothy Hatcher <timothy@apple.com> + + Remove duplicate Web Inspector message handeling in WebPage::didReceiveMessage. + + https://webkit.org/b/49689 + + Reviewed by Andreas Kling. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): Remove duplicate code. + +2010-11-17 Timothy Hatcher <timothy@apple.com> + + Fix a crash when closing the inspected page when the Web Inspector + page was never created. + + https://bugs.webkit.org/show_bug.cgi?id=49687 + + Reviewed by John Sullivan. + + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + (WebKit::WebInspectorClient::sendMessageToFrontend): Null check the Inspector WebPage. + +2010-11-17 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Don't crash when invalidating a page overlay that hasn't been installed yet + https://bugs.webkit.org/show_bug.cgi?id=49685 + + Null check the web page. + + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::setNeedsDisplay): + +2010-11-17 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=49682 - Expose "removeItemAtIndex" in WKMutableArray + + * Shared/API/c/WKMutableArray.cpp: + (WKArrayRemoveItemAtIndex): + * Shared/API/c/WKMutableArray.h: + + * Shared/MutableArray.cpp: + (WebKit::MutableArray::removeItemAtIndex): + * Shared/MutableArray.h: + +2010-11-17 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=49683 - Export WKContextMenuItem and WKContextMenuItemTypes as public headers + + * WebKit2.xcodeproj/project.pbxproj: + +2010-11-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Need way to invalidate part of a WKOverlayRef so it will be redrawn + https://bugs.webkit.org/show_bug.cgi?id=49679 + <rdar://problem/8679152> + + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: + (WKBundlePageOverlaySetNeedsDisplay): + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::setNeedsDisplay): + * WebProcess/WebPage/PageOverlay.h: + +2010-11-17 Timothy Hatcher <timothy@apple.com> + + Provide a way to create a WKView (WebPage) that is hidden from + the InjectedBundle. This is needed for the Web Inspector. + + https://webkit.org/b/49670 + + Reviewed by Sam Weinig. + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): Added visibleToInjectedBundle. + (WebKit::WebPageCreationParameters::decode): Ditto. + * Shared/WebPageCreationParameters.h: Ditto. + * UIProcess/API/C/win/WKView.cpp: + (WKViewCreate): Pass VisibleToInjectedBundle to the WebView create function. + * UIProcess/API/C/win/WKViewPrivate.cpp: + (WKViewCreateForWebInspector): Added. Not used yet. Passes HiddenFromInjectedBundle + to the WebView create function. + * UIProcess/API/C/win/WKViewPrivate.h: Added WKViewCreateForWebInspector. + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:]): Added hiddenFromInjectedBundle + parameter and calls WebPageProxy::setVisibleToInjectedBundle. + (-[WKView initWithFrame:pageNamespaceRef:]): Calls initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle: + and passes NO for hiddenFromInjectedBundle. + (-[WKView initWithFrame:]): Cleaned up by removing the local assignment to self and just returns the result. + * UIProcess/API/mac/WKViewInternal.h: Added initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): Initialize m_visibleToInjectedBundle from the creation parameters. + (WebKit::WebPageProxy::creationParameters): Set visibleToInjectedBundle using m_visibleToInjectedBundle. + * UIProcess/WebPageProxy.h: Added m_visibleToInjectedBundle. + (WebKit::WebPageProxy::visibleToInjectedBundle): Added. Return m_visibleToInjectedBundle. + (WebKit::WebPageProxy::setVisibleToInjectedBundle): Added. Set m_visibleToInjectedBundle. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): Added InjectedBundleVisibility parameter and calls + WebPageProxy::setVisibleToInjectedBundle. + * UIProcess/win/WebView.h: Added InjectedBundleVisibility enum. + (WebKit::WebView::create): Added InjectedBundleVisibility parameter. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::create): Checks visibleToInjectedBundle before talking to the injected bundle. + (WebKit::WebPage::WebPage): Initialize m_isVisibleToInjectedBundle from the creation parameters. + (WebKit::WebPage::close): Checks m_isVisibleToInjectedBundle before talking to the injected bundle. + * WebProcess/WebPage/WebPage.h: Added m_isVisibleToInjectedBundle. + +2010-11-17 Andras Becsi <abecsi@webkit.org> + + Unreviewed buildfix. + + [Qt] D'oh! I screwed up the dependencies. + + * DerivedSources.pro: + +2010-11-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + [WK2] Set paintsEntireContents for "resizes to contents" mode + + Only relevant for the tiled backing store. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setResizesToContentsUsingLayoutSize): + +2010-11-17 Andras Becsi <abecsi@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Make it possible to set custom user agent strings in MiniBrowser + https://bugs.webkit.org/show_bug.cgi?id=49627 + + Copy the MiniBrowser.qrc and QtTestBrowser's useragentlist.txt file + to the build directory of MiniBrowser because it has to be in a + subdirectory of the resource file. + Add a method to QWKPage to retrieve the custom user agent string. + + * DerivedSources.pro: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::customUserAgent): + * UIProcess/API/qt/qwkpage.h: + +2010-11-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=45567 + Add stubbed-out layer-backed drawing area for Windows. + + Add implementations of LayerBackedDrawingArea and + LayerBackedDrawingAreaProxy for Windows, and add them + to the vcproj. + + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + * UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp: Added. + (WebKit::LayerBackedDrawingAreaProxy::page): + (WebKit::LayerBackedDrawingAreaProxy::platformSetSize): + (WebKit::LayerBackedDrawingAreaProxy::attachCompositingContext): + (WebKit::LayerBackedDrawingAreaProxy::detachCompositingContext): + (WebKit::LayerBackedDrawingAreaProxy::paint): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::pageDidEnterAcceleratedCompositing): + (WebKit::WebView::pageDidLeaveAcceleratedCompositing): + (WebKit::WebView::switchToDrawingAreaTypeIfNecessary): + * UIProcess/win/WebView.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + * WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp: Added. + (WebKit::LayerBackedDrawingArea::platformInit): + (WebKit::LayerBackedDrawingArea::platformClear): + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + (WebKit::LayerBackedDrawingArea::detachCompositingContext): + (WebKit::LayerBackedDrawingArea::setRootCompositingLayer): + (WebKit::LayerBackedDrawingArea::scheduleCompositingLayerSync): + (WebKit::LayerBackedDrawingArea::syncCompositingLayers): + * win/WebKit2.vcproj: + +2010-11-17 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WK2] The focus switching does not seems to work with QGraphicsWKView + https://bugs.webkit.org/show_bug.cgi?id=49545 + + Implement focus switching with Tab. This is now done asynchronously, + waiting for webkit to call takeFocus() and switching the widget. + + Since the focus can change between the Tab press and the callback, + QGraphicsWKView::focusNextPrevChildCallback() make sure the view still has + focus before passing it to the next widget. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + (QGraphicsWKView::focusNextPrevChildCallback): + (QGraphicsWKView::focusNextPrevChild): + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::takeFocus): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + +2010-11-17 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Don't prohibit scrolling in tiled backing store mode. + + We delegate scrolling instead. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + +2010-11-17 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Christiansen. + + [Qt] Improve painting performance on 16-bit displays + + When the default pixmap depth is 16-bit, then use RGB16 instead of + RGB32 for the chunks, to avoid unnecessary conversions and reduce + chunk size. The conversions happen as images as QPixmaps have 16-bit + depth and the tiles on the ui process are also backed by QPixmaps. + + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::size): + (WebKit::UpdateChunk::createImage): + * Shared/qt/UpdateChunk.h: + +2010-11-16 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + WebKit2: Support enabling site-specific quirks + <rdar://problem/8451371> + https://bugs.webkit.org/show_bug.cgi?id=46076 + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + Add needsSiteSpecificQuirks; + + * UIProcess/API/C/WKAPICast.h: + (WebKit::toFontSmoothingLevel): + (WebKit::toAPI): + Move FontSmoothing conversion functions here. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetFontSmoothingLevel): + (WKPreferencesGetFontSmoothingLevel): + (WKPreferencesSetAcceleratedCompositingEnabled): + (WKPreferencesGetAcceleratedCompositingEnabled): + (WKPreferencesSetCompositingBordersVisible): + (WKPreferencesGetCompositingBordersVisible): + (WKPreferencesSetCompositingRepaintCountersVisible): + (WKPreferencesGetCompositingRepaintCountersVisible): + (WKPreferencesSetNeedsSiteSpecificQuirks): + (WKPreferencesGetNeedsSiteSpecificQuirks): + Add WKPreferencesSetNeedsSiteSpecificQuirks/WKPreferencesGetNeedsSiteSpecificQuirks + and move implementations from WKPreferencesPrivate.cpp here. + + * UIProcess/API/C/WKPreferencesPrivate.cpp: Removed. + + * UIProcess/API/C/WKPreferencesPrivate.h: + Add Add WKPreferencesSetNeedsSiteSpecificQuirks/WKPreferencesGetNeedsSiteSpecificQuirks. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setNeedsSiteSpecificQuirks): + (WebKit::WebPreferences::needsSiteSpecificQuirks): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Pipe through needsSiteSpecificQuirks. + + * WebKit2.xcodeproj/project.pbxproj: + * WebKit2.pro: + * win/WebKit2.vcproj: + Update for removed files. + +2010-11-16 Adam Roben <aroben@apple.com> + + Fix horizontal scrolling via the mousewheel/trackpad on Windows + + Reviewed by Mark Rowe. + + * Shared/win/WebEventFactory.cpp: Fixed typo in the + WM_VISTA_MOUSEHWHEEL constant. + +2010-11-16 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + Disable LTCG for Windows Release builds. Add new Release_LTCG configuration. + https://bugs.webkit.org/show_bug.cgi?id=49632 + + * win/WebKit2.make: + * win/WebKit2.submit.sln: + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + +2010-11-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle converting a ResourceHandle to a download + https://bugs.webkit.org/show_bug.cgi?id=49631 + + * WebProcess/Downloads/Download.h: + Add startWithHandle. + + * WebProcess/Downloads/DownloadManager.h: + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::convertHandleToDownload): + Create a new Download object and call startWithHandle on it. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::startWithHandle): + Add stub. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::startWithHandle): + Create an NSURLDownload object from passed in ResourceHandle. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::startWithHandle): + Add stub. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::download): + Call WebFrame::convertHandleToDownload. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::convertHandleToDownload): + Call DownloadManager::convertHandleToDownload. + +2010-11-16 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Set the original URL for downloads + https://bugs.webkit.org/show_bug.cgi?id=49628 + + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::startDownload): + * WebProcess/Downloads/DownloadManager.h: + startDownload now takes the originating web page. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::start): + start now takes the originating web page. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::originatingURL): + (WebKit::setOriginalURLForDownload): + Port code over from WebKit1 that sets the download URL. + + (WebKit::Download::start): + Call setOriginalURLForDownload. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::start): + start now takes the originating web page. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::startDownload): + Pass the web page to DownloadManager::startDownload. + +2010-11-16 Dave Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=11004 + + font-size:0 is ignored. Remove the minimum font size of 1 in CSSStyleSelector. + Change the pref value for minimum font size from 1 to 0. Make sure to never use the NSFont's size, + since it doesn't honor a size of 0. Instead pass the size in to the FontPlatformData(NSFont*) version + of the constructor rather than using [NSFont pointSize]. + + https://bugs.webkit.org/show_bug.cgi?id=49582 + + Negative leading is not handled correctly. There are two bugs here. The first is that + maxAscent and maxDescent can be negative, so we need a notion of whether or not we have + set them before so that we can allow them to be < 0. + + The second issue is that we should understand where fonts will end up relative to + our baseline (excluding line height), and only allow those boxes to impact ascent and + descent if the actual font box (without factoring in line height) is above or below the + root line box baseline. + + Added fast/css/negative-leading.html + + These two bug fixes have to land together to keep the Acid 3 test rendering correctly. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + +2010-11-16 Anders Carlsson <andersca@apple.com> + + Fix clang++ build. + + * Scripts/webkit2/messages.py: + * WebProcess/WebPage/WebInspector.h: + +2010-11-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add WKPageCanShowMIMEType + https://bugs.webkit.org/show_bug.cgi?id=49612 + + * UIProcess/API/C/WKPage.cpp: + (WKPageCanShowMIMEType): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::canShowMIMEType): + * UIProcess/WebPageProxy.h: + +2010-11-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make WebPageProxy::decidePolicyForMIMEType a tad synchronous + https://bugs.webkit.org/show_bug.cgi?id=49605 + + Change the DecidePolicyForMIMEType message to be synchronous, and if the policy listener is + invoked from within the decidePolicyForMIMEType callback return the policy information as out + parameters. This is needed in order to convert a loading connection to a download. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::receivedPolicyDecision): + (WebKit::WebPageProxy::decidePolicyForMIMEType): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + +2010-11-16 Kenneth Rohde Christiansen <kenneth@webkit.org>, Zalan Bujtas <zbujtas@gmail.com> + + Reviewed by Andreas Kling. + + [WK2][Qt] Add API for finding a zoomable area for a given point + + This is useful for implementing e.g "double tap zoom" + + Only enabled for Qt. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::findZoomableAreaForPoint): + (QWKPagePrivate::didFindZoomableArea): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didFindZoomableArea): + (WebKit::WebPageProxy::findZoomableAreaForPoint): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::findZoomableAreaForPoint): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-16 Andreas Kling <kling@webkit.org> + + Rubber-stamped by Simon Hausmann. + + Revert !ENABLE(INSPECTOR) fix- we don't need it right now, + and it was less maintainable than I had though. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toImpl): + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + * WebProcess/WebPage/WebInspector.cpp: + +2010-11-16 Andreas Kling <kling@webkit.org> + + Reviewed by Simon Hausmann. + + Fix compilation with !ENABLE(INSPECTOR) + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toImpl): + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + * WebProcess/WebPage/WebInspector.cpp: + +2010-11-16 Andras Becsi <abecsi@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] Use SIGINT instead of SIGKILL to let the web process clean up after itself. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::QtWebProcess::setupChildProcess): + +2010-11-16 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + [WK2][Qt] Expose resizes-to-contents mode in WebKit2 + + Only available with ENABLE(TILED_BACKING_STORE) + + Based on a patch by Antti Koivisto. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::setResizesToContentsUsingLayoutSize): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setResizesToContentsUsingLayoutSize): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setSize): + (WebKit::WebPage::setResizesToContentsUsingLayoutSize): + (WebKit::WebPage::resizeToContentsIfNeeded): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::resizesToContentsEnabled): + (WebKit::WebPage::resizesToContentsLayoutSize): + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-16 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Get proxy settings from environment (http[s]_proxy) + + If http_proxy and/or https_proxy are set in the environment, + pass those in to QNetworkAccessManager. + + * WebProcess/qt/WebProcessMainQt.cpp: + (WebKit::EnvHttpProxyFactory::EnvHttpProxyFactory): + (WebKit::EnvHttpProxyFactory::initializeFromEnvironment): + (WebKit::EnvHttpProxyFactory::queryProxy): + (WebKit::initializeProxy): + (WebKit::WebProcessMainQt): + +2010-11-16 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Emit windowCloseRequested signal on window.close() + + Original patch by Zalan Bujtas. + + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_close): + * UIProcess/API/qt/qwkpage.h: + +2010-11-15 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Kill the web process if the UI process dies + + Connect UI (parent) process death signal to SIGKILL of the web + process (child). This ensures that there's no stale web processes + after the UI process has crashed. + + Original patch by Kimmo Kinnunen. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::QtWebProcess::QtWebProcess): + (WebKit::QtWebProcess::setupChildProcess): + (WebKit::ProcessLauncherHelper::launch): + +2010-11-16 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Andreas Kling. + + [Qt] Trivial build fix for building WebKit2 inside Qt Creator + + Similar to WebCore.pro, define a fallback for OUTPUT_DIR. + + * WebKit2.pro: + +2010-11-15 Andreas Kling <kling@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] Make sure qwkpage.h and qwkpreferences.h are copied into includes/WebKit2 + + * UIProcess/API/qt/WKView.h: + +2010-11-15 Andreas Kling <kling@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] Use $${PYTHON} rather than "python" to execute Python scripts + + Fixes building with the old Python that currently ships with Scratchbox. + + * DerivedSources.pro: + +2010-11-15 Brady Eidson <beidson@apple.com> + + Reviewed by a better attempt at a Windows build fix. + + * win/WebKit2Generated.make: + +2010-11-15 Brady Eidson <beidson@apple.com> + + Reviewed by my attempt to fix the Windows build + + * win/WebKit2Generated.make: Add new API headers here. + +2010-11-15 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Finish off <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720 + Customizable context menu support in WebKit2. + + - Adds an API-level WKContextMenuItem. + - Round trips through both the InjectedBundle client and the new PageContextMenuClient before + actually displaying the menu. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * Shared/API/c/WKBase.h: + * Shared/API/c/WKContextMenuItem.cpp: Added. + (WKContextMenuItemGetTypeID): + (WKContextMenuItemCreateAsAction): + (WKContextMenuItemCreateAsCheckableAction): + (WKContextMenuItemCreateAsSubmenu): + (WKContextMenuItemSeparatorItem): + (WKContextMenuItemGetTag): + (WKContextMenuItemGetType): + (WKContextMenuItemCopyTitle): + (WKContextMenuItemGetEnabled): + (WKContextMenuItemGetChecked): + (WKContextMenuCopySubmenuItems): + * Shared/API/c/WKContextMenuItem.h: Added. + * Shared/API/c/WKContextMenuItemTypes.h: Added. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toImpl): + + * Shared/WebContextMenuItem.cpp: + (WebKit::WebContextMenuItem::create): + (WebKit::WebContextMenuItem::separatorItem): + (WebKit::WebContextMenuItem::submenuItemsAsImmutableArray): + * Shared/WebContextMenuItem.h: + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageContextMenuClient): + (WKPageSetPageFindClient): + (WKPageSetPageLoaderClient): + (WKPageSetPagePolicyClient): + (WKPageSetPageUIClient): + * UIProcess/API/C/WKPage.h: + + * UIProcess/WebPageContextMenuClient.cpp: Added. + (WebKit::WebPageContextMenuClient::getContextMenuFromProposedMenu): + * UIProcess/WebPageContextMenuClient.h: Added. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeContextMenuClient): + (WebKit::WebPageProxy::showContextMenu): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: + (WebKit::InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems): + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: + + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): + +2010-11-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add shouldDecodeSourceDataOfMIMEType WKContextDownloadClient callback + https://bugs.webkit.org/show_bug.cgi?id=49558 + + * UIProcess/API/C/WKContext.h: + Add shouldDecodeSourceDataOfMIMEType callback. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType): + Call WebDownloadClient::shouldDecodeSourceDataOfMIMEType. + + (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): + Add allowOverwrite out parameter. + + * UIProcess/Downloads/DownloadProxy.h: + * UIProcess/Downloads/DownloadProxy.messages.in: + Add ShouldDecodeSourceDataOfMIMEType message. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::shouldDecodeSourceDataOfMIMEType): + Call the WKContextDownloadClient. + + (WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename): + Add allowOverwrite out parameter. + + * UIProcess/WebDownloadClient.h: + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::shouldDecodeSourceDataOfMIMEType): + Send the ShouldDecodeSourceDataOfMIMEType message. + + (WebKit::Download::decideDestinationWithSuggestedFilename): + Add allowOverwrite reply parameter. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]): + Call Download::shouldDecodeSourceDataOfMIMEType. + + (-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]): + Add allowOverwrite parameter. + +2010-11-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add decideDestinationWithSuggestedFilename WKContextDownloadClient callback + https://bugs.webkit.org/show_bug.cgi?id=49554 + + * Platform/CoreIPC/MessageSender.h: + (CoreIPC::MessageSender::sendSync): + Add sendSync capabilities to Messagesender. + + * UIProcess/API/C/WKContext.h: + Add decideDestinationWithSuggestedFilename callback. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): + Call WebDownloadClient::decideDestinationWithSuggestedFilename. + + * UIProcess/Downloads/DownloadProxy.messages.in: + Add DecideDestinationWithSuggestedFilename. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveSyncMessage): + Process MessageClassDownloadProxy messages. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::decideDestinationWithSuggestedFilename): + Ask the WKContextDownloadClient for the destination. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveSyncMessage): + MessageClassDownloadProxy messages should go to the WebContext. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::decideDestinationWithSuggestedFilename): + Send the DecideDestinationWithSuggestedFilename message. + + * WebProcess/Downloads/Download.h: + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:decideDestinationWithSuggestedFilename:]): + call Download::decideDestinationWithSuggestedFilename and set the destination. + +2010-11-15 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [WK2][Qt] Add "page snapshot" functionality to tiled backing store + + Original patch by Antti Koivisto. + + Add a way to take a snapshot of a specific part of the page, at a specific scale. + Only implemented for the tiled drawing area. + + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + New message: TakeSnapshot. + + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: + New message: SnapshotTaken. + + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::takeSnapshot): + Expose the snapshot functionality. + + * UIProcess/TiledDrawingAreaProxy.cpp: + (WebKit::TiledDrawingAreaProxy::didReceiveMessage): + (WebKit::TiledDrawingAreaProxy::takeSnapshot): + * UIProcess/TiledDrawingAreaProxy.h: + * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: + (WebKit::TiledDrawingAreaProxy::snapshotTaken): + * WebProcess/WebPage/TiledDrawingArea.cpp: + (WebKit::TiledDrawingArea::didReceiveMessage): + +2010-11-15 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [WK2][Qt] WebKit2 implementation of tiled backing store + https://bugs.webkit.org/show_bug.cgi?id=49526 + + Basic opt-in tiling implementation for WebKit2/Qt. + + Original patch by Antti Koivisto. + + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + New messages: RequestTileUpdate and CancelTileUpdate. + + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: + New messages: Invalidate, TileUpdated, AllTileUpdatesProcessed. + + * Shared/DrawingAreaBase.h: + New area type: TiledDrawingAreaType. + + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + (QGraphicsWKView::setGeometry): + (QGraphicsWKViewPrivate::QGraphicsWKViewPrivate): + (QGraphicsWKView::prepareScaleChange): + (QGraphicsWKView::commitScaleChange): + (QGraphicsWKViewPrivate::onScaleChanged): + (QGraphicsWKViewPrivate::commitScale): + Support for tiled backing store. + + * UIProcess/TiledDrawingAreaProxy.cpp: Added. + (WebKit::TiledDrawingAreaProxy::create): + (WebKit::TiledDrawingAreaProxy::TiledDrawingAreaProxy): + (WebKit::TiledDrawingAreaProxy::~TiledDrawingAreaProxy): + (WebKit::TiledDrawingAreaProxy::setSize): + (WebKit::TiledDrawingAreaProxy::setPageIsVisible): + (WebKit::TiledDrawingAreaProxy::didSetSize): + (WebKit::TiledDrawingAreaProxy::didReceiveMessage): + (WebKit::TiledDrawingAreaProxy::didReceiveSyncMessage): + (WebKit::TiledDrawingAreaProxy::requestTileUpdate): + (WebKit::TiledDrawingAreaProxy::waitUntilUpdatesComplete): + (WebKit::TiledDrawingAreaProxy::createTile): + (WebKit::TiledDrawingAreaProxy::setTileSize): + (WebKit::TiledDrawingAreaProxy::setTileCreationDelay): + (WebKit::TiledDrawingAreaProxy::setKeepAndCoverAreaMultipliers): + (WebKit::TiledDrawingAreaProxy::invalidate): + (WebKit::TiledDrawingAreaProxy::updateTileBuffers): + (WebKit::TiledDrawingAreaProxy::tileBufferUpdateComplete): + (WebKit::TiledDrawingAreaProxy::paint): + (WebKit::TiledDrawingAreaProxy::adjustVisibleRect): + (WebKit::TiledDrawingAreaProxy::setContentsScale): + (WebKit::TiledDrawingAreaProxy::removeAllTiles): + (WebKit::TiledDrawingAreaProxy::tileDistance): + (WebKit::TiledDrawingAreaProxy::calculateKeepRect): + (WebKit::TiledDrawingAreaProxy::calculateCoverRect): + (WebKit::TiledDrawingAreaProxy::createTiles): + (WebKit::TiledDrawingAreaProxy::resizeEdgeTiles): + (WebKit::TiledDrawingAreaProxy::dropTilesOutsideRect): + (WebKit::TiledDrawingAreaProxy::tileAt): + (WebKit::TiledDrawingAreaProxy::setTile): + (WebKit::TiledDrawingAreaProxy::removeTile): + (WebKit::TiledDrawingAreaProxy::mapToContents): + (WebKit::TiledDrawingAreaProxy::mapFromContents): + (WebKit::TiledDrawingAreaProxy::contentsRect): + (WebKit::TiledDrawingAreaProxy::tileRectForCoordinate): + (WebKit::TiledDrawingAreaProxy::tileCoordinateForPoint): + (WebKit::TiledDrawingAreaProxy::startTileBufferUpdateTimer): + (WebKit::TiledDrawingAreaProxy::tileBufferUpdateTimerFired): + (WebKit::TiledDrawingAreaProxy::startTileCreationTimer): + (WebKit::TiledDrawingAreaProxy::tileCreationTimerFired): + (WebKit::TiledDrawingAreaProxy::hasPendingUpdates): + * UIProcess/TiledDrawingAreaProxy.h: Added. + (WebKit::TiledDrawingAreaProxy::contentsScale): + (WebKit::TiledDrawingAreaProxy::attachCompositingContext): + (WebKit::TiledDrawingAreaProxy::detachCompositingContext): + (WebKit::TiledDrawingAreaProxy::tileSize): + (WebKit::TiledDrawingAreaProxy::tileCreationDelay): + (WebKit::TiledDrawingAreaProxy::getKeepAndCoverAreaMultipliers): + * UIProcess/TiledDrawingAreaTile.h: Added. + (WebKit::TiledDrawingAreaTile::create): + (WebKit::TiledDrawingAreaTile::hasBackBufferUpdatePending): + (WebKit::TiledDrawingAreaTile::coordinate): + (WebKit::TiledDrawingAreaTile::rect): + (WebKit::TiledDrawingAreaTile::ID): + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + * WebProcess/WebPage/TiledDrawingArea.cpp: Added. + (WebKit::TiledDrawingArea::TiledDrawingArea): + (WebKit::TiledDrawingArea::~TiledDrawingArea): + (WebKit::TiledDrawingArea::invalidateWindow): + (WebKit::TiledDrawingArea::invalidateContentsAndWindow): + (WebKit::TiledDrawingArea::invalidateContentsForSlowScroll): + (WebKit::TiledDrawingArea::scroll): + (WebKit::TiledDrawingArea::setNeedsDisplay): + (WebKit::TiledDrawingArea::display): + (WebKit::TiledDrawingArea::scheduleDisplay): + (WebKit::TiledDrawingArea::setSize): + (WebKit::TiledDrawingArea::suspendPainting): + (WebKit::TiledDrawingArea::resumePainting): + (WebKit::TiledDrawingArea::didUpdate): + (WebKit::TiledDrawingArea::updateTile): + (WebKit::TiledDrawingArea::tileUpdateTimerFired): + (WebKit::TiledDrawingArea::didReceiveMessage): + * WebProcess/WebPage/TiledDrawingArea.h: Added. + (WebKit::TiledDrawingArea::attachCompositingContext): + (WebKit::TiledDrawingArea::detachCompositingContext): + (WebKit::TiledDrawingArea::setRootCompositingLayer): + (WebKit::TiledDrawingArea::scheduleCompositingLayerSync): + (WebKit::TiledDrawingArea::syncCompositingLayers): + * WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp: Added. + (WebKit::TiledDrawingArea::paintIntoUpdateChunk): + * WebKit2.pro: + * UIProcess/qt/TiledDrawingAreaTileQt.cpp: Added. + (WebKit::checkeredPixmap): + (WebKit::TiledDrawingAreaTile::TiledDrawingAreaTile): + (WebKit::TiledDrawingAreaTile::~TiledDrawingAreaTile): + (WebKit::TiledDrawingAreaTile::isDirty): + (WebKit::TiledDrawingAreaTile::isReadyToPaint): + (WebKit::TiledDrawingAreaTile::hasReadyBackBuffer): + (WebKit::TiledDrawingAreaTile::invalidate): + (WebKit::TiledDrawingAreaTile::resize): + (WebKit::TiledDrawingAreaTile::swapBackBufferToFront): + (WebKit::TiledDrawingAreaTile::paint): + (WebKit::TiledDrawingAreaTile::paintCheckerPattern): + (WebKit::TiledDrawingAreaTile::updateFromChunk): + (WebKit::TiledDrawingAreaTile::updateBackBuffer): + * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: Added. + (WebKit::TiledDrawingAreaProxy::updateWebView): + (WebKit::TiledDrawingAreaProxy::webViewVisibleRect): + (WebKit::TiledDrawingAreaProxy::page): + +2010-11-12 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Need to implement WebKit::pluginWillHandleLoadError for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=48764 + + Add the missing error to Qt support. + + * WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp: + (WebKit::pluginWillHandleLoadError): + +2010-11-12 John Sullivan <sullivan@apple.com> + + Reviewed by Anders Carlsson. + + Fixed Target for WKBundlePageOverlay.cpp. + + * WebKit2.xcodeproj/project.pbxproj: + Changed Target for WKBundlePageOverlay.cpp from WebProcess to WebKit2. + +2010-11-12 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Need a way that WKBundlePageOverlayRef clients can make sure they only uninstall the overlay they installed + https://bugs.webkit.org/show_bug.cgi?id=49461 + <rdar://problem/8662760> + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageUninstallPageOverlay): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + (WebKit::FindController::hideFindUI): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::uninstallPageOverlay): + * WebProcess/WebPage/WebPage.h: + +2010-11-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Allow MessageSender to override sendMessage + https://bugs.webkit.org/show_bug.cgi?id=49457 + + Change MessageSender::send to encode the message and then call sendMessage. + This allows for clients to override sendMessage, something which WebProcessProxy + will be able to take advantage of. + + * Platform/CoreIPC/MessageSender.h: + (CoreIPC::MessageSender::send): + (CoreIPC::MessageSender::sendMessage): + +2010-11-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + CoreIPC cleanup + https://bugs.webkit.org/show_bug.cgi?id=49455 + + Add a static create function to ArgumentEncoder. + Factor sync message argument encoder creation out into a new function, + createSyncMessageArgumentEncoder. + + * Platform/CoreIPC/ArgumentEncoder.cpp: + (CoreIPC::ArgumentEncoder::create): + * Platform/CoreIPC/ArgumentEncoder.h: + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::createSyncMessageArgumentEncoder): + (CoreIPC::Connection::dispatchSyncMessage): + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::send): + (CoreIPC::Connection::sendSync): + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): + +2010-11-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + ASSERTION when converting some WKStringRefs returned from willSubmitForm to CFStringRef + <rdar://problem/8662180> + https://bugs.webkit.org/show_bug.cgi?id=49454 + + Enforce the invariant that a WebString never contains a null WTF::String at a + lower level, in the WebString constructor, instead of relying on the callers of + WebString::create to do it. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + (WebKit::toCopiedAPI): Remove null string check... + + * Shared/WebString.h: + (WebKit::WebString::WebString): ... and move it to the constructor. + + * Shared/API/c/WKURL.cpp: + (WKURLCopyString): Use toCopiedAPI() instead of calling WebString directly + to match other similar uses. + +2010-11-12 Andreas Kling <kling@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt][WK2] Fix leaking of mapped files + + MappedMemory::fileName was never set on the receiving side, which led + the MappedMemoryPool to call QFile::map() again when reusing an existing file. + + * Platform/qt/MappedMemoryPool.cpp: + (WebKit::MappedMemoryPool::mapFile): + +2010-11-12 Adam Roben <aroben@apple.com> + + Windows build fix + + * win/WebKit2Generated.make: Copy WKBundlePageOverlay.h. + +2010-11-12 Benjamin Poulain <benjamin.poulain@nokia.com> + + Unreviewed fix after r71857. + + * UIProcess/qt/WebInspectorProxyQt.cpp: + * WebProcess/WebPage/qt/WebInspectorQt.cpp: + +2010-11-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add didReceiveResponse and didReceiveData to the download client + https://bugs.webkit.org/show_bug.cgi?id=49418 + + * UIProcess/API/C/WKContext.h: + Add didReceiveResponse and didReceiveData to WKContextDownloadClient. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didReceiveResponse): + (WebKit::DownloadProxy::didReceiveData): + Call WebDownloadClient member functions. + + * UIProcess/Downloads/DownloadProxy.messages.in: + Add DidReceiveResponse and DidReceiveData messages. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::didReceiveResponse): + (WebKit::WebDownloadClient::didReceiveData): + Call client functions. + + * WebKit2.xcodeproj/project.pbxproj: + Let Xcode update the file. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didReceiveResponse): + (WebKit::Download::didReceiveData): + Send messages. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::start): + Set deletesFileUponFailure to NO. + + (-[WKDownloadAsDelegate download:didReceiveResponse:]): + Call didReceiveResponse. + +2010-11-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an argument coder for ResourceResponse. + https://bugs.webkit.org/show_bug.cgi?id=49415 + + * Shared/WebCoreArgumentCoders.h: + * Shared/gtk/WebCoreArgumentCodersGtk.cpp: + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + * Shared/qt/WebCoreArgumentCodersQt.cpp: + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + * Shared/win/WebCoreArgumentCodersWin.cpp: + (CoreIPC::encodeResourceResponse): + (CoreIPC::decodeResourceResponse): + +2010-11-11 Ryosuke Niwa <rniwa@webkit.org> + + Unreviewed build fix for r71587. + + * WebKit2.xcodeproj/project.pbxproj: No longer uses absolute path. + +2010-11-11 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Unreviewed WebKit2 buildfix after r71587. + + * UIProcess/qt/WebInspectorProxyQt.cpp: + * WebKit2.pro: + +2010-11-11 Brian Weinstein <bweinstein@apple.com> + + More Windows build fixing. Change another #import to a #include, and remove an unneeded + namespace. + + * UIProcess/win/WebInspectorProxyWin.cpp: + * WebProcess/WebPage/win/WebInspectorWin.cpp: + +2010-11-11 Brent Fulgham <bfulgham@webkit.org> + + Windows [Cairo] build fix. Unreviewed. + + Provide stubs for two BackingStore methods. + + * Shared/cairo/BackingStoreCairo.cpp: + (WebKit::BackingStore::createFlippedGraphicsContext): + (WebKit::BackingStore::paint): + +2010-11-11 Brian Weinstein <bweinstein@apple.com> + + Windows Build Fix. Change #imports to #includes. + + * UIProcess/win/WebInspectorProxyWin.cpp: + +2010-11-08 Timothy Hatcher <timothy@apple.com> + + Create and load the Web Inspector page. + + https://webkit.org/b/49207 + + Reviewed by Anders Carlsson. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::createInspectorPage): Added. Call platformCreateInspectorPage and then + call WebPageProxy::loadURL with inspectorPageURL. + (WebKit::WebInspectorProxy::didLoadInspectorPage): Added stub. + * UIProcess/WebInspectorProxy.h: + * UIProcess/WebInspectorProxy.messages.in: Added. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Call WebInspectorProxy::didReceiveWebInspectorProxyMessage. + (WebKit::WebPageProxy::didReceiveSyncMessage): Call WebInspectorProxy::didReceiveSyncWebInspectorProxyMessage. + * UIProcess/WebPageProxy.h: Made creationParameters public so WebInspectorProxy can use it. + + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Make a WkView and return the WebPageProxy. + (WebKit::WebInspectorProxy::inspectorPageURL): Return the file URL for the inspector.html file. + * UIProcess/qt/WebInspectorProxyQt.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Added stub. + (WebKit::WebInspectorProxy::inspectorPageURL): Ditto. + * UIProcess/win/WebInspectorProxyWin.cpp: + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Added stub. + (WebKit::WebInspectorProxy::inspectorPageURL): Ditto. + + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + (WebKit::WebInspectorClient::openInspectorFrontend): Call WebInspector::createInspectorPage and set up the WebInspectorFrontendClient. + (WebKit::WebInspectorClient::sendMessageToFrontend): Call doDispatchMessageOnFrontendPage in the base class. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + (WebKit::WebInspectorFrontendClient::frontendLoaded): Call WebInspector::didLoadInspectorPage. + (WebKit::WebInspectorFrontendClient::localizedStringsURL): Call WebInspector::localizedStringsURL. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: + + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::WebInspector): + (WebKit::WebInspector::createInspectorPage): Send a sync WebInspectorProxy::CreateInspectorPage message and set up + the WebPage using the result page ID. + (WebKit::WebInspector::didLoadInspectorPage): Send a WebInspectorProxy::DidLoadInspectorPage message. + * WebProcess/WebPage/WebInspector.h: + (WebKit::WebInspector::inspectorPage): Added. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): Call WebInspector::didReceiveWebInspectorMessage. + + * WebProcess/WebPage/mac/WebInspectorMac.mm: + (WebKit::WebInspector::localizedStringsURL): Return the file URL for the localizedStrings.js file. + * WebProcess/WebPage/qt/WebInspectorQt.cpp: + (WebKit::WebInspector::localizedStringsURL): Added stub. + * WebProcess/WebPage/win/WebInspectorWin.cpp: + (WebKit::WebInspector::localizedStringsURL): Added stub. + + * DerivedSources.make: Added WebInspectorProxy.messages.in. + * DerivedSources.pro: Ditto. + + * WebKit2.pro: Added new files. + * WebKit2.xcodeproj/project.pbxproj: Ditto. + * win/WebKit2.vcproj: Ditto. + +2010-11-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move the remaining API client classes to use the APIClient base class. + https://bugs.webkit.org/show_bug.cgi?id=49404 + + Also moves InjectedBundleClient into its own class to match other API clients. + + * UIProcess/WebContextInjectedBundleClient.cpp: + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebHistoryClient.cpp: + (WebKit::WebHistoryClient::didNavigateWithNavigationData): + (WebKit::WebHistoryClient::didPerformClientRedirect): + (WebKit::WebHistoryClient::didPerformServerRedirect): + (WebKit::WebHistoryClient::didUpdateHistoryTitle): + (WebKit::WebHistoryClient::populateVisitedLinks): + * UIProcess/WebHistoryClient.h: + (WebKit::WebHistoryClient::shouldTrackVisitedLinks): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::initializeClient): + (WebKit::InjectedBundle::reportException): + (WebKit::InjectedBundle::didCreatePage): + (WebKit::InjectedBundle::willDestroyPage): + (WebKit::InjectedBundle::didReceiveMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/InjectedBundleClient.cpp: Added. + (WebKit::InjectedBundleClient::didCreatePage): + (WebKit::InjectedBundleClient::willDestroyPage): + (WebKit::InjectedBundleClient::didReceiveMessage): + * WebProcess/InjectedBundle/InjectedBundleClient.h: Added. + * win/WebKit2.vcproj: + +2010-11-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Remove an unneeded CFAllocatorRef parameter. + + * Shared/API/c/mac/WKURLResponseNS.h: + * Shared/API/c/mac/WKURLResponseNS.mm: + (WKURLResponseCopyNSURLResponse): + +2010-11-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add and implement WKDownloadCopyRequest + https://bugs.webkit.org/show_bug.cgi?id=49393 + + * Shared/API/c/mac/WKURLRequestNS.h: + * Shared/API/c/mac/WKURLRequestNS.mm: + (WKURLRequestCopyNSURLRequest): + Remove unneeded CFAllocator parameter. + + * Shared/WebURLRequest.cpp: + (WebKit::WebURLRequest::WebURLRequest): + * Shared/WebURLRequest.h: + (WebKit::WebURLRequest::create): + Change create to take a ResourceRequest instead. + + * UIProcess/API/C/WKDownload.cpp: + (WKDownloadCopyRequest): + Return a copied WKURLRequest. + + * UIProcess/API/C/WKDownload.h: + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didStart): + Set the request. + + * UIProcess/Downloads/DownloadProxy.h: + (WebKit::DownloadProxy::request): + Return the request. + + * UIProcess/Downloads/DownloadProxy.messages.in: + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didStart): + Pass the request along when sending the DidStart message. + +2010-11-11 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * WebKit2.xcodeproj/project.pbxproj: + Added WKBundlePageOverlay.h to the WebKit2 Target and made it public. + +2010-11-11 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Move GraphicsContext setup code to PageOverlay::drawRect + https://bugs.webkit.org/show_bug.cgi?id=49389 + + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h: + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::drawRect): + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::drawRect): + +2010-11-11 Adam Roben <aroben@apple.com> + + Build fix after r71816 + + * WebProcess/WebPage/WebPage.messages.in: Compile out + SetActualVisibleContentRect when ENABLE(TILED_BACKING_STORE) is + turned off. + +2010-11-11 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Implement BackingStore + https://bugs.webkit.org/show_bug.cgi?id=49377 + + * Shared/qt/BackingStoreQt.cpp: + (WebKit::createQImage): Added static helper. Creates a QImage + from the shared memory buffer. + (WebKit::BackingStore::createGraphicsContext): + (WebKit::BackingStore::createFlippedGraphicsContext): Leave + unimplemented with an ASSERT_NOT_REACHED since this is only + needed for the CoreGraphics backend. + (WebKit::BackingStore::paint): + +2010-11-11 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] Add a Qt WebKit2 API for overriding the actual visible content rect + https://bugs.webkit.org/show_bug.cgi?id=49381 + + Add an Qt WebKit2 API for overriding the actual visible content rect in + WebCore. This is supposed to be used in combination with tiling. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::setActualVisibleContentsRect): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setActualVisibleContentRect): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setActualVisibleContentRect): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-10 Beth Dakin <bdakin@apple.com> + + Reviewed by Simon Fraser. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=49356 + -[WebView _scaleWebView:] should take and origin and scroll the + document + -and corresponding- + <rdar://problem/8643921> + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toImpl): + * UIProcess/API/C/WKPage.cpp: + (WKPageScaleWebView): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::scaleWebView): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaleWebView): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-10 Ada Chan <adachan@apple.com> + + Fix Windows build. + + * win/WebKit2Generated.make: + +2010-11-10 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Misc drawing area cleanup + https://bugs.webkit.org/show_bug.cgi?id=49349 + + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::setSize): + (WebKit::LayerBackedDrawingAreaProxy::setPageIsVisible): + (WebKit::LayerBackedDrawingAreaProxy::update): + Call process()->send() instead of process()->connection()->send() in case + the web process has not been launched yet. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Delay creation of the drawing area + until after other WebPage state has been initialized, in case + the DrawingArea creation needs to call back to the WebPage. + +2010-11-10 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + Push m_viewSize down to DrawingAreaProxy base class + https://bugs.webkit.org/show_bug.cgi?id=49347 + + Some refactoring so that the various drawing area classes + can share m_size. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::setSize): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::setSize): + (WebKit::DrawingAreaProxy::size): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::setSize): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + (WebKit::LayerBackedDrawingAreaProxy::platformSetSize): + (WebKit::LayerBackedDrawingAreaProxy::attachCompositingContext): + * UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + +2010-11-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Closing tabs sometimes crashes the WebProcess in invalidateContentsAndWindow + https://bugs.webkit.org/show_bug.cgi?id=49335 + <rdar://problem/8646621> + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): + If we fail to send the DidChangeAcceleratedCompositing message, don't null out the + drawing area. This will happen during page teardown. + +2010-11-10 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by David Hyatt. + + HTML5 Ruby support should be mandatory feature + https://bugs.webkit.org/show_bug.cgi?id=49272 + + Remove Ruby as optional feature. + + * Configurations/FeatureDefines.xcconfig: + * WebKit2Prefix.h: Touch it to avoid incremental build failure on Windows. + +2010-11-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add license to DerivedSources.make. + + * DerivedSources.make: + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Convert client classes to use APIClient base class. + https://bugs.webkit.org/show_bug.cgi?id=49322 + + * UIProcess/WebFormClient.cpp: + (WebKit::WebFormClient::willSubmitForm): + * UIProcess/WebFormClient.h: + * UIProcess/WebLoaderClient.cpp: + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPolicyClient.cpp: + * UIProcess/WebPolicyClient.h: + * UIProcess/WebUIClient.cpp: + * UIProcess/WebUIClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + +2010-11-10 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Fix re-use of memory-mapped files + https://bugs.webkit.org/show_bug.cgi?id=49310 + + QTemporaryFile::fileName() returns an empty string after close() + so we have to keep separate track of the filename. + + Also, we can't reopen the file if it's been QFile::remove()d, + so we defer unlinking until the MappedMemoryPool is destroyed or + the CrashHandler kicks in. + + This makes re-use of memory-mapped files work (after we kill an + assertion that the file size == the new mmap size - it's fine if + the file is larger, too.) + + * Platform/qt/MappedMemoryPool.cpp: + (WebKit::MappedMemoryPool::~MappedMemoryPool): + (WebKit::MappedMemoryPool::clear): + (WebKit::MappedMemoryPool::mapMemory): + (WebKit::MappedMemoryPool::mapFile): + * Platform/qt/MappedMemoryPool.h: + (WebKit::MappedMemory::mappedFileName): + * Shared/qt/CrashHandler.cpp: + (WebKit::CrashHandler::deleteObjects): + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::encode): + +2010-11-09 Brady Eidson <beidson@apple.com> + + Reviewed by the ever-picky Windows build-bot. + + Windows build bot was complaining about this. + + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::core): + +2010-11-09 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + WKDownload.h should be a public header. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-11-09 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + Part of <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720 + Customizable context menu support in WebKit2. + + This adds a BundlePageContextMenu client and lets WebKit2 consult it with the proposed + list of WebContextMenuItems. + There is no realistic API for the embedding app to actually inspect or create new + WebContextMenuItems (will be "WKContextMenuItem") and that ability will come later. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * Platform/Logging.cpp: + (initializeLogChannelsIfNecessary): + * Platform/Logging.h: + + * Shared/APIObject.h: + + * Shared/MutableArray.cpp: + (WebKit::MutableArray::reserveCapacity): + * Shared/MutableArray.h: + + * Shared/WebContextMenuItem.cpp: Added. + (WebKit::WebContextMenuItem::WebContextMenuItem): + (WebKit::WebContextMenuItem::data): + * Shared/WebContextMenuItem.h: Added. + (WebKit::WebContextMenuItem::create): + (WebKit::WebContextMenuItem::type): + + * Shared/WebContextMenuItemData.cpp: + (WebKit::WebContextMenuItemData::core): + (WebKit::kitItems): + (WebKit::coreItems): + * Shared/WebContextMenuItemData.h: + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetContextMenuClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: Added. + (WebKit::InjectedBundlePageContextMenuClient::InjectedBundlePageContextMenuClient): + (WebKit::InjectedBundlePageContextMenuClient::initialize): + (WebKit::InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems): + * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: Added. + + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Call through to the injected bundle client + with the default items and convert the returned items back for WebCore to use. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleContextMenuClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleContextMenuClient): + +2010-11-09 Sam Weinig <sam@webkit.org> + + Add some stylistic flourish to the last patch as suggested by Lord Darin Adler. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetSourceForFrame): + (WKPageGetContentsAsString): + * UIProcess/WebPageProxy.cpp: + (WebKit::invalidateCallbackMap): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::contentsAsString): + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Need WebKit2 mechanism for getting the visible page text + <rdar://problem/8646928> + https://bugs.webkit.org/show_bug.cgi?id=49275 + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetContentsAsString): + (callContentsAsStringBlockBlockAndDispose): + (WKPageGetContentsAsString_b): + * UIProcess/API/C/WKPage.h: + Add GetContentsAsString callback function declaration and forwarding. + + * UIProcess/WebPageProxy.cpp: + (WebKit::invalidateCallbackMap): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::getContentsAsString): + (WebKit::WebPageProxy::didGetContentsAsString): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + Add GetContentsAsString callback and generalize invalidating the callback + maps into a standalone function. + + * UIProcess/WebPageProxy.messages.in: + Add DidGetContentsAsString return message. + + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::contentsAsString): + Gets the string content of all the subframes. + + (WebKit::WebFrame::isFrameSet): + Call through to the document. + + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getContentsAsString): + Forward to the the main frames contentsAsString function. + + * WebProcess/WebPage/WebPage.messages.in: + Add GetContentsAsString and collect all callback messages together. + +2010-11-09 Sam Weinig <sam@webkit.org> + + Fix mac build. + + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformSetCacheModel): + +2010-11-09 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler, Dan Bernstein. + + <rdar://problem/8360145> Pages using accelerated compositing missing content on Windows + + Disable accelerated compositing on Windows until we have cross-process + rendering implemented. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2010-11-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add injected bundle API for creating page overlays + https://bugs.webkit.org/show_bug.cgi?id=49282 + + * Shared/API/c/WKBase.h: + Add WKBundlePageOverlayRef. + + * Shared/APIObject.h: + Add TypeBundlePageOverlay. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + Add WKBundlePageOverlayRef mapping. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageInstallPageOverlay): + Install the passed in page overlay. + + (WKBundlePageUninstallPageOverlay): + Uninstall the passed in page overlay. + + * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: Added. + (PageOverlayClientImpl::create): + (PageOverlayClientImpl::PageOverlayClientImpl): + (PageOverlayClientImpl::pageOverlayDestroyed): + (PageOverlayClientImpl::willMoveToWebPage): + (PageOverlayClientImpl::didMoveToWebPage): + (PageOverlayClientImpl::drawRect): + (PageOverlayClientImpl::mouseEvent): + Add a PageOverlay::Client subclass that forwards everything to its client. + + (WKBundlePageOverlayGetTypeID): + (WKBundlePageOverlayCreate): + Create a page overlay. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::pageOverlayDestroyed): + * WebProcess/WebPage/FindController.h: + Add stub. + + * WebProcess/WebPage/PageOverlay.h: + Inherit from APIObject. + + (WebKit::PageOverlay::type): + return TypeBundlePageOverlay. + + * win/WebKit2.vcproj: + Add new files. + +2010-11-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Get rid of FindPageOverlay + https://bugs.webkit.org/show_bug.cgi?id=49268 + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Remove files. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + Create a PageOverlay with the FindController as its client. + + (WebKit::FindController::willMoveToWebPage): + Null out the find page overlay if the web page is null. + + (WebKit::FindController::didMoveToWebPage): + Add stub. + + * WebProcess/WebPage/FindController.h: + FindController is now a PageOverlay::Client. + + * WebProcess/WebPage/FindPageOverlay.cpp: Removed. + * WebProcess/WebPage/FindPageOverlay.h: Removed. + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::setPage): + Call the willMoveToWebPage and didMoveToWebPage client functions. + + (WebKit::PageOverlay::setNeedsDisplay): + Pass the page overlay bounds instead of the web page size. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::installPageOverlay): + Clear the page of the previous page overlay. + + (WebKit::WebPage::uninstallPageOverlay): + Clear the page of the previous page overlay. + + * WebProcess/WebPage/WebPage.h: + The page overlay is now refcounted. + + * win/WebKit2.vcproj: + Remove files. + +2010-11-09 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * WebProcess/win/WebProcessWin.cpp: + (WebKit::WebProcess::platformSetCacheModel): + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Factor calculation of cache sizes based on cache model into shared function + https://bugs.webkit.org/show_bug.cgi?id=48706 + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::calculateCacheSizes): + * WebProcess/WebProcess.h: + * WebProcess/mac/WebProcessMac.mm: + (WebKit::volumeFreeSize): + (WebKit::WebProcess::platformSetCacheModel): + * WebProcess/win/WebProcessWin.cpp: + (WebKit::memorySize): + (WebKit::volumeFreeSize): + (WebKit::WebProcess::platformSetCacheModel): + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Context menus show up in the wrong place when the page is scrolled + https://bugs.webkit.org/show_bug.cgi?id=49264 + + Convert the hitTestResult point into 'window' coordinates before sending over + to the UIProcess to show the menu. + + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::show): + Convert to use message sender interface. + + (WebKit::WebContextMenu::itemSelected): + Remove unnecessary WebCore::'s. + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Send messages directly to the WebContext + https://bugs.webkit.org/show_bug.cgi?id=49262 + + * Platform/CoreIPC/MessageID.h: + Temporarily add MessageClassWebContextLegacy. + + * Shared/CoreIPCSupport/WebContextMessageKinds.h: + Rename adding Legacy prefix. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didNavigateWithNavigationData): + (WebKit::WebContext::didPerformClientRedirect): + (WebKit::WebContext::didPerformServerRedirect): + (WebKit::WebContext::didUpdateHistoryTitle): + (WebKit::WebContext::setCacheModel): + (WebKit::WebContext::addVisitedLink): + (WebKit::WebContext::addVisitedLinkHash): + (WebKit::WebContext::getPlugins): + (WebKit::WebContext::getPluginPath): + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * UIProcess/WebContext.h: + * UIProcess/WebContext.messages.in: Added. + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginProcessConnection): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + * UIProcess/WebProcessProxy.messages.in: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::postSynchronousMessage): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::updateGlobalHistory): + (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): + (WebKit::WebFrameLoaderClient::setTitle): + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::populatePluginCache): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::addVisitedLink): + Move context related messages to be sent directly to the context. + + * DerivedSources.make: + * DerivedSources.pro: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-11-09 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Move the find page overlay code to FindController + https://bugs.webkit.org/show_bug.cgi?id=49266 + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::~FindController): + (WebKit::FindController::rectsForTextMatches): + (WebKit::overlayBackgroundColor): + (WebKit::FindController::drawRect): + (WebKit::FindController::mouseEvent): + * WebProcess/WebPage/FindController.h: + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::drawRect): + (WebKit::FindPageOverlay::mouseEvent): + * WebProcess/WebPage/FindPageOverlay.h: + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::bounds): + (WebKit::PageOverlay::drawRect): + (WebKit::PageOverlay::mouseEvent): + * WebProcess/WebPage/PageOverlay.h: + +2010-11-09 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Add a PageOverlay::Client object in preparation of not allowing subclassing of PageOverlay + https://bugs.webkit.org/show_bug.cgi?id=49263 + + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::FindPageOverlay): + Call the PageOverlay constructor. + + (WebKit::FindPageOverlay::drawRect): + (WebKit::FindPageOverlay::mouseEvent): + These now take a PageOverlay callback. + + * WebProcess/WebPage/FindPageOverlay.h: + FindPageOverlay now inherits from PageOverlay::Client. + + * WebProcess/WebPage/PageOverlay.cpp: + (WebKit::PageOverlay::create): + Add create function. + + (WebKit::PageOverlay::PageOverlay): + The constructor now takes a client. + + (WebKit::PageOverlay::drawRect): + (WebKit::PageOverlay::mouseEvent): + Call the client methods. + + * WebProcess/WebPage/PageOverlay.h: + Add Client class. + +2010-11-09 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Darin Adler. + + <rdar://problem/8646456> WebProcess crashes reproducibly on complex text + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Initialize wkCreateCTTypesetterWithUniCharProviderAndOptions + and wkCreateCTLineWithUniCharProvider. + +2010-11-09 Sam Weinig <sam@webkit.org> + + Fix Windows build. + + * win/WebKit2.vcproj: + +2010-11-09 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * WebKit2.pro: + +2010-11-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Windows Popup widget support (<select>) + <rdar://problem/8559439> + https://bugs.webkit.org/show_bug.cgi?id=48701 + + Port WebCore's PopupMenuWin's implementation to work within the confines of WebKit2. + Since we currently can't draw text using WebCore in the UIProcess, this approach uses + the WebProcess to create two bitmaps representing the full popup menu (both unselected and + selected) and sends them to the UIProcess to be drawn in an HWND. + + * Shared/BackingStore.h: + * Shared/cg/BackingStoreCG.cpp: + * Shared/qt/BackingStoreQt.cpp: + + Add new function to create a flipped graphics context from the backing store, + and add additional parameters to paint, to allow more control of how the backing + store is painted into the destination context. + + * Shared/PlatformPopupMenuData.cpp: Added. + (WebKit::PlatformPopupMenuData::PlatformPopupMenuData): + (WebKit::PlatformPopupMenuData::encode): + (WebKit::PlatformPopupMenuData::decode): + * Shared/PlatformPopupMenuData.h: Added. + Add struct so platforms can send platform specific data to their popup menu implementations. + + * Shared/WebPopupItem.cpp: + (WebKit::WebPopupItem::WebPopupItem): + (WebKit::WebPopupItem::encode): + (WebKit::WebPopupItem::decode): + * Shared/WebPopupItem.h: + Add isLabel for each menu item. + + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::draw): + Update for new BackingStore::paint signature. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showPopupMenu): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebPopupMenuProxy.h: + * UIProcess/mac/WebPopupMenuProxyMac.h: + * UIProcess/mac/WebPopupMenuProxyMac.mm: + (WebKit::WebPopupMenuProxyMac::showPopupMenu): + * UIProcess/qt/WebPopupMenuProxyQt.cpp: + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + * UIProcess/qt/WebPopupMenuProxyQt.h: + Pass through the new PlatformPopupMenuData. + + * UIProcess/win/WebPopupMenuProxyWin.cpp: + * UIProcess/win/WebPopupMenuProxyWin.h: + Port implementation from WebCore. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createPopupMenuProxy): + Pass the WebView to the WebPopupMenuProxyWin. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::paint): + (WebKit::PluginProxy::update): + Update for new BackingStore::paint signature. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::populateItems): Add isLabel for each item. + (WebKit::WebPopupMenu::show): Give each platform a chance to add platform specific data. + * WebProcess/WebCoreSupport/WebPopupMenu.h: + + * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm: Added. + (WebKit::WebPopupMenu::setUpPlatformData): + * WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp: Added. + (WebKit::WebPopupMenu::setUpPlatformData): + Add stubbed out setUpPlatformData. + + * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Added. + (WebKit::WebPopupMenu::setUpPlatformData): + Compute data needed in the UIProcess including generating the bitmaps. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-11-09 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt][WK2] ASSERT fail in fast/frames/lots-of-objects.html + https://bugs.webkit.org/show_bug.cgi?id=49253 + + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::create): Do not assert + when the attach was unsuccessful but return with 0. + +2010-11-09 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] WebKitTestRunner is dead + https://bugs.webkit.org/show_bug.cgi?id=49129 + + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::~SharedMemory): + Follow up fix: do not access the QSharedMemory object + in an assert if it has been deleted. + +2010-11-08 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Send page scroll requests to the PageClient when scroll delegation is turned on + https://bugs.webkit.org/show_bug.cgi?id=49171 + + Implement the IPC and API required for making scroll delegation work + with WebKit2. This is only used when you have tiling enabled. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::pageDidRequestScroll): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::pageDidRequestScroll): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::delegatedScrollRequested): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::pageDidRequestScroll): + * WebProcess/WebPage/WebPage.h: + +2010-11-08 Ivan Krstić <ike@apple.com> + + Reviewed by Mark Rowe. + + <rdar://problem/8531943> Enable partial symbolication for sandbox violations in WebProcess. + + * WebProcess/com.apple.WebProcess.sb: + +2010-11-08 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Andreas Kling. + + [Qt] Added new methods to QWKHistory and made QWKHistoryItemPrivate to shared object. + https://bugs.webkit.org/show_bug.cgi?id=49063 + + Added more functionality to the QWKHistory and changed QWKHistoryItemPrivate to shared object. + This is needed because we cannot delete the QWKHistoryItemPrivate pointer in destructor of QWKHistoryItem, + there may have other history instances which share same private implementation. + + * UIProcess/API/qt/qwkhistory.cpp: + (QWKHistoryItemPrivate::~QWKHistoryItemPrivate): + (QWKHistoryItem::QWKHistoryItem): + (QWKHistoryItem::QWKHistoryItem::operator=): + (QWKHistory::currentItem): Added + (QWKHistory::backItem): Added + (QWKHistory::forwardItem): Added + (QWKHistory::itemAt): Added + (QWKHistory::backItems): Added + (QWKHistory::forwardItems): Added + * UIProcess/API/qt/qwkhistory.h: + * UIProcess/API/qt/qwkhistory_p.h: + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add WKDownloadClient API + https://bugs.webkit.org/show_bug.cgi?id=49227 + + * Shared/API/c/WKBase.h: + Add WKDownloadRef. + + * UIProcess/API/C/WKAPICast.h: + Add WKDownloadRef <-> DownloadProxy mapping. + + * UIProcess/API/C/WKContext.cpp: + (WKContextSetDownloadClient): + Initialize the download client. + + * UIProcess/API/C/WKContext.h: + Add new WKContextDownloadClient API. + + * UIProcess/API/C/WKDownload.cpp: Added. + * UIProcess/API/C/WKDownload.h: + Add WKDownload files. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didStart): + (WebKit::DownloadProxy::didCreateDestination): + (WebKit::DownloadProxy::didFinish): + Call down to the the WebDownloadClient. + + * UIProcess/Downloads/DownloadProxy.messages.in: + Rename DidBegin to DidStart. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::initializeDownloadClient): + Initialize the download client. + + * UIProcess/WebContext.h: + (WebKit::WebContext::downloadClient): + Add getter. + + * UIProcess/WebDownloadClient.cpp: + (WebKit::WebDownloadClient::didStart): + (WebKit::WebDownloadClient::didCreateDestination): + (WebKit::WebDownloadClient::didFinish): + Call the relevant WKContextDownloadClient functions. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didStart): + * WebProcess/Downloads/Download.h: + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate downloadDidBegin:]): + Rename Download::didBegin to Download::didStart. + + * win/WebKit2.vcproj: + Add new files. + +2010-11-08 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Part of https://bugs.webkit.org/show_bug.cgi?id=49222 + Rename "WebContextMenuItem" to "WebContextMenuItemData" + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * Shared/WebContextMenuItem.cpp: Removed. + * Shared/WebContextMenuItem.h: Removed. + * Shared/WebContextMenuItemData.cpp: Copied from Shared/WebContextMenuItem.cpp. + (WebKit::WebContextMenuItemData::WebContextMenuItemData): + (WebKit::WebContextMenuItemData::encode): + (WebKit::WebContextMenuItemData::decode): + (WebKit::kitItems): + * Shared/WebContextMenuItemData.h: Copied from Shared/WebContextMenuItem.h. + (WebKit::WebContextMenuItemData::submenu): + + * UIProcess/WebContextMenuProxy.h: + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showContextMenu): + (WebKit::WebPageProxy::contextMenuItemSelected): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + + * UIProcess/mac/WebContextMenuProxyMac.h: + * UIProcess/mac/WebContextMenuProxyMac.mm: + (-[WebMenuTarget forwardContextMenuAction:]): + (WebKit::WebContextMenuProxyMac::contextMenuItemSelected): + (WebKit::nsMenuItemVector): + (WebKit::WebContextMenuProxyMac::populate): + (WebKit::WebContextMenuProxyMac::showContextMenu): + + * UIProcess/qt/WebContextMenuProxyQt.cpp: + (WebKit::WebContextMenuProxyQt::showContextMenu): + * UIProcess/qt/WebContextMenuProxyQt.h: + + * UIProcess/win/WebContextMenuProxyWin.cpp: + (WebKit::WebContextMenuProxyWin::showContextMenu): + * UIProcess/win/WebContextMenuProxyWin.h: + + * WebProcess/WebPage/WebContextMenu.cpp: + (WebKit::WebContextMenu::itemSelected): + * WebProcess/WebPage/WebContextMenu.h: + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didSelectItemFromActiveContextMenu): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan and Dan Bernstein. + + Find in Page: scrolling the page with the scrollbar while overlay is up dismisses the overlay + https://bugs.webkit.org/show_bug.cgi?id=49219 + <rdar://problem/8569550> + + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::bounds): + Return the bounds of the find page overlay, excluding any scrollbars. + + (WebKit::FindPageOverlay::drawRect): + Call bounds. + + (WebKit::FindPageOverlay::mouseEvent): + Only dismiss the find UI if the mouse down event happens inside the overlay bounds. + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add the ability to send messages to DownloadProxy objects + https://bugs.webkit.org/show_bug.cgi?id=49213 + + * DerivedSources.make: + * DerivedSources.pro: + Add Download.messages.in. + + * Platform/CoreIPC/MessageID.h: + Add MessageClassDownloadProxy message class. + + * Platform/CoreIPC/MessageSender.h: + Include Connection.h directly since it's required. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didBegin): + (WebKit::DownloadProxy::didCreateDestination): + (WebKit::DownloadProxy::didFinish): + Add stubs. + + * UIProcess/Downloads/DownloadProxy.messages.in: Added. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveMessage): + Handle DownloadProxy messages. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + Hand DownloadProxy messages off to the context. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::didBegin): + (WebKit::Download::didReceiveData): + (WebKit::Download::didCreateDestination): + (WebKit::Download::didFinish): + Send messages. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:didCreateDestination:]): + Call Download::didCreateDestination. + + * win/WebKit2.vcproj: + Add new files. + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add DownloadProxy object + https://bugs.webkit.org/show_bug.cgi?id=49211 + + DownloadProxy will be the implementation of the forthcoming WKDownloadRef object. + + * Shared/APIObject.h: + Add TypeDownload. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::generateDownloadID): + Generate a unique download ID. + + (WebKit::DownloadProxy::invalidate): + Null out the web context. + + * UIProcess/Downloads/DownloadProxy.h: + (WebKit::WebContext::processDidClose): + Invalidate all downloads. + + (WebKit::WebContext::createDownloadProxy): + Create a WebDownload object. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::receivedPolicyDecision): + Call createDownloadProxy instead. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + + * win/WebKit2Common.vsprops: + Add new include path. + +2010-11-08 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=49201 + Crash when closing a page + + Handle null frame by passing a 0 frame id (normal ones start from 1). + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::focusedFrameChanged): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::focusedFrameChanged): + +2010-11-08 Nate Chapin <japhet@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Function call update for + https://bugs.webkit.org/show_bug.cgi?id=27165. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::start): + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=49198 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::invokeDefault): + Call NPClass::invokeDefault. + + (WebKit::NPObjectMessageReceiver::construct): + Call NPClass::construct + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add InvokeDefault and Construct messages. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::invokeDefault): + Send the InvokeDefault message. + + (WebKit::NPObjectProxy::construct): + Send the Construct message. + + (WebKit::NPObjectProxy::NP_InvokeDefault): + Call NPObjectProxy::invokeDefault. + + (WebKit::NPObjectProxy::NP_Construct): + Call NPObjectProxy::construct. + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Plug-in views should not assume that plugins are RenderEmbeddedObjects + https://bugs.webkit.org/show_bug.cgi?id=49196 + <rdar://problem/8638467> + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::pluginProcessCrashed): + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + NPN_Evaluate doesn't work with out-of-process plugins in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=49193 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::evaluate): + Send an Evaluate message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::evaluate): + Call Evaluate on the plug-in proxy. + + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/Plugins/PluginProxy.messages.in: + Add Evaluate message. + +2010-11-08 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Correctly convert NPObjectProxy to NPVariantData + https://bugs.webkit.org/show_bug.cgi?id=49190 + + * Shared/Plugins/NPObjectMessageReceiver.h: + (WebKit::NPObjectMessageReceiver::npObject): + Add NPObject getter. + + * Shared/Plugins/NPObjectProxy.h: + (WebKit::NPObjectProxy::npObjectID): + Add NPObjectID getter. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + Handle the case where the NPObject is an NPObjectProxy. + + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + Handle NPVariantData::LocalNPObjectID. + + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::makeRemoteNPObjectID): + * Shared/Plugins/NPVariantData.h: + New function for creating an NPVariantData that contains a remote NPObject ID. + +2010-11-08 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48685 + Notify UI process about focused frame + + Handle notifications, store the current one in WebPageProxy in UI process. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetFocusedFrame): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::focusedFrameChanged): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::focusedFrame): + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::focusedFrameChanged): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-11-07 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename Cache to MemoryCache + https://bugs.webkit.org/show_bug.cgi?id=49159 + + * WebProcess/WebProcess.cpp: + * WebProcess/mac/WebProcessMac.mm: + * WebProcess/win/WebProcessWin.cpp: + +2010-11-06 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] WebKitTestRunner is dead + https://bugs.webkit.org/show_bug.cgi?id=49129 + + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::~SharedMemory): + Avoid double deletion when deleteLater has + already been called. + +2010-11-05 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + suspendAnimations/resumeAnimations not present in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=49109 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameSuspendAnimations): + (WKBundleFrameResumeAnimations): + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::suspendAnimations): + (WebKit::WebFrame::resumeAnimations): + * WebProcess/WebPage/WebFrame.h: + +2010-11-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + WebProcess won't kill itself if UIProcess goes away while WebProcess is spinning + https://bugs.webkit.org/show_bug.cgi?id=49090 + <rdar://problem/7834575> + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::connectionDidClose): + Call Client::didCloseOnConnectionWorkQueue. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::Client::didCloseOnConnectionWorkQueue): + Add new client function. Will be called on the connection work queue when the connection is closed. + + * Platform/WorkItem.h: + (FunctionWorkItem0::FunctionWorkItem0): + (FunctionWorkItem0::execute): + (WorkItem::create): + Add a new WorkItem subclass that will invoke a C function. + + * Platform/WorkQueue.h: + * Platform/mac/WorkQueueMac.cpp: + (WorkQueue::scheduleWorkAfterDelay): + New function which will schedule the given work item to be executed in at least 'delay' seconds. + + * Platform/qt/WorkQueueQt.cpp: + (WorkQueue::scheduleWorkAfterDelay): + Add empty stub. + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::scheduleWorkAfterDelay): + Ditto. + + * PluginProcess/PluginProcess.h: + Derive from ChildProcess. + + * Shared/ChildProcess.cpp: Added. + (WebKit::ChildProcess::ChildProcess): + (WebKit::ChildProcess::~ChildProcess): + (WebKit::watchdogCallback): + Call _exit. + + (WebKit::ChildProcess::didCloseOnConnectionWorkQueue): + When the connection is closed, schedule a work item to be run in 10 seconds. If the process hasn't + exited normally by then, we'll exit. + + * Shared/ChildProcess.h: + Add new ChildProcess class which is a common base class of WebProcess and PluginProcess and which contains + the watchdog timer logic. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebProcess.h: + Derive from ChildProcess. + + * win/WebKit2.vcproj: + Add new files. + +2010-11-05 Adam Roben <aroben@apple.com> + + Implement PluginInfoStore::shouldUsePlugin on Windows + + Fixes <http://webkit.org/b/43509> <rdar://problem/8273822> WebKit2 + should refuse to load the same plugins that old-WebKit refuses to load + + Reviewed by Anders Carlsson. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::fileVersion): Helper function to construct a 64-bit file + version from two 32-bit numbers. + (WebKit::PluginInfoStore::getPluginInfo): Ported code from + WebCore::PluginPackage::fetchInfo to get the plugin's version. We now + store it in Plugin::fileVersion. + + (WebKit::isOldWindowsMediaPlayerPlugin): + (WebKit::isNewWindowsMediaPlayerPlugin): + Added these helpers. The code came from + WebCore::PluginDatabase::getPluginPathsInDirectories. + + (WebKit::PluginInfoStore::shouldUsePlugin): Implemented. The code was + ported from WebCore::PluginDatabase::getPluginPathsInDirectories and + WebCore::PluginPackage::isPluginBlacklisted. + +2010-11-05 Adam Roben <aroben@apple.com> + + Operate on m_plugins directly in PluginInfoStore::shouldUsePlugin + + We'll need to operate on m_plugins if we ever want to unload an + already-loaded plugin before loading the new one. + + Fixes <http://webkit.org/b/49076> loadedPlugins parameter to + PluginInfoStore::shouldUsePlugin is redundant + + Reviewed by Anders Carlsson. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::loadPlugin): + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp: + (WebKit::PluginInfoStore::shouldUsePlugin): + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::shouldUsePlugin): + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::shouldUsePlugin): + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::PluginInfoStore::shouldUsePlugin): + Removed the loadedPlugins parameter from shouldUsePlugin. The single + implementation (Mac) now uses m_plugins directly. + +2010-11-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Implement pluginElementNPObject + https://bugs.webkit.org/show_bug.cgi?id=49077 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::pluginElementNPObject): + Send the GetPluginElementNPObject message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::getPluginElementNPObject): + Get the plug-in element NPObject and expose it to the other side of the connection. + + * WebProcess/Plugins/PluginProxy.messages.in: + Add GetPluginElementNPObject. + +2010-11-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Implement NP_RemoveProperty and NP_Enumerate + https://bugs.webkit.org/show_bug.cgi?id=49046 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::removeProperty): + Call the removeProperty NPClass function. + + (WebKit::NPObjectMessageReceiver::enumerate): + Call the enumerate NPClass function. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add RemoveProperty and Enumerate messages. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::removeProperty): + Send the RemoveProperty message. + + (WebKit::NPObjectProxy::enumerate): + Send the Enumerate message. + + (WebKit::NPObjectProxy::NP_RemoveProperty): + Call removeProperty. + + (WebKit::NPObjectProxy::NP_Enumerate): + Call enumerate. + +2010-11-05 Sam Weinig <sam@webkit.org> + + Fix failing python tests. + + * Scripts/webkit2/messages.py: + * Scripts/webkit2/messages_unittest.py: + +2010-11-05 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben.. + + Generate the messages sent to the WebProcessProxy + https://bugs.webkit.org/show_bug.cgi?id=49062 + + * Platform/CoreIPC/MessageID.h: + Temporarily add MessageClassWebProcessProxyLegacy while we still can't + support GetPluginProcessConnection (and deferred sync replies) in the + general mechanism. + + * Scripts/webkit2/messages.py: + Add support for WebCore::PluginData and WebKit::WebNavigationDataStore. + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + Remove now unused kinds. Rename to MessageClassWebProcessProxyLegacy. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginPath): + (WebKit::WebProcessProxy::addBackForwardItem): + (WebKit::WebProcessProxy::didNavigateWithNavigationData): + (WebKit::WebProcessProxy::didPerformClientRedirect): + (WebKit::WebProcessProxy::didPerformServerRedirect): + (WebKit::WebProcessProxy::didUpdateHistoryTitle): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + (WebKit::WebProcessProxy::didDestroyFrame): + * UIProcess/WebProcessProxy.h: + * UIProcess/WebProcessProxy.messages.in: Added. + Move implementations to their own functions. + + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): + Change to use WebProcessProxyLegacyMessage. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::updateGlobalHistory): + (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): + (WebKit::WebFrameLoaderClient::setTitle): + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::populatePluginCache): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::updateBackForwardItem): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::addVisitedLink): + (WebKit::WebProcess::removeWebFrame): + Use generated messages. + + * DerivedSources.make: + * DerivedSources.pro: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-11-04 Adam Roben <aroben@apple.com> + + Use a window region to clip windowed plugins + + Fixes <http://webkit.org/b/49024> <rdar://problem/8487847> Windowed + plugins aren't clipped in WebKit2 on Windows + + Reviewed by Jon Honeycutt. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::registerPluginView): Removed the CS_PARENTDC style. This style + makes Windows ignore the window region and always clip to the parent + window. Also pass WebKit.dll's HINSTANCE as part of the WNDCLASSW + struct so that the window class will be specific to WebKit.dll rather + than to WebKit2WebProcess.exe. This is useful for testing, but also + more pedantically correct. + (WebKit::setWindowRegion): Helper function to set a window region and + deal with ownership of the HRGN correctly. + (WebKit::NetscapePlugin::platformGeometryDidChange): Make an HRGN that + corresponds to m_clipRect and set it on the plugin's window. + +2010-11-05 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Left over files and shared memory segments + https://bugs.webkit.org/show_bug.cgi?id=48985 + + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::create): Force deletion of the QSharedMemory + object on terminate by connecting QCoreApplication::aboutToQuit with + deleteLater. Add the object to the CrashHandler as well to release the + shared memory segment even on crash. + (WebKit::SharedMemory::~SharedMemory): + * Shared/qt/CrashHandler.cpp: Added. + CrashHandler has a container for QObjects that we want to + destroy on crash. When we got a signal that we interpret as + a crash then it destroys those objects. + (WebKit::CrashHandler::CrashHandler): + (WebKit::CrashHandler::signalHandler): + (WebKit::CrashHandler::deleteObjects): + * Shared/qt/CrashHandler.h: Added. + (WebKit::CrashHandler::instance): + (WebKit::CrashHandler::didDelete): + (WebKit::CrashHandler::markForDeletionOnCrash): + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::ProcessLauncherHelper): + Add the object itself to the CrashHandler to close the QLocalServer + even on crash. Without that the QLocalServer leaves over socket files on the disk. + (WebKit::ProcessLauncherHelper::~ProcessLauncherHelper): + * WebKit2.pro: + +2010-11-04 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + reversion bubble in WebViews + https://bugs.webkit.org/show_bug.cgi?id=47630 + <rdar://problem/8530960> + + This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. + + * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto. + (WebKit::WebEditorClient::showCorrectionPanel): + (WebKit::WebEditorClient::dismissCorrectionPanel): + +2010-11-04 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by David Hyatt. + + Delegate scrolling via a separate method + https://bugs.webkit.org/show_bug.cgi?id=48988 + + Add delegatedScrollRequested method to WebChromeClient, + which is only used in conjunging with tiling, and thus ifdef'ed. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::delegatedScrollRequested): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-11-03 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Need a way to test in WebKit2 whether a form field contains marked text + <rdar://problem/8555293> + https://bugs.webkit.org/show_bug.cgi?id=48969 + + Added a selection changed notification from the Web process to the UI process. + The message being sent contains information about the current selection. + Event though for this specific bug the only information required is the marked text, + I've added other selection information that will be needed to support IME. + All the stubbed methods are required methods by the NSTextInput protocol. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::selectionChanged): Added. + * UIProcess/API/mac/WKView.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): Added initialization of new members. + (-[WKView _selectionChanged:isEditable:isPassword:hasMarkedText:]): Stores the values from + the selection changed message. + (-[WKView selectedRange]): Added stub. + (-[WKView hasMarkedText]): Implemented. + (-[WKView unmarkText]): Added stub. + (-[WKView validAttributesForMarkedText]): Added stub. + (-[WKView setMarkedText:selectedRange:]): Added stub. + (-[WKView markedRange]): Added stub. + (-[WKView attributedSubstringFromRange:]): Added stub. + (-[WKView conversationIdentifier]): Added stub. + (-[WKView characterIndexForPoint:]): Added stub. + (-[WKView firstRectForCharacterRange:]): Added stub. + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::selectionChanged): Added. + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didSelectionChange): New message handler. + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::selectionChanged): Added. + * UIProcess/win/WebView.h: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::respondToChangedSelection): Added implementation. + +2010-11-04 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] Cleanup UpdateChunk and MappedMemoryPool + https://bugs.webkit.org/show_bug.cgi?id=48994 + + * Platform/qt/MappedMemoryPool.cpp: + (WebKit::MappedMemoryPool::mapMemory): + Removed argument with default value that was always + used with the default value. + (WebKit::MappedMemoryPool::mapFile): Ditto and + add some asserts. + * Platform/qt/MappedMemoryPool.h: + Encapsulating MappedMemory and remove the unused + MappedMemoryPool::searchForMappedMemory method. + (WebKit::MappedMemory::mappedFile): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::data): + (WebKit::MappedMemory::MappedMemory): + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::mapSize): + (WebKit::MappedMemory::isFree): + (WebKit::MappedMemoryPool::instance): + * Shared/qt/UpdateChunk.cpp: + Removed the unused data method besides other cleanups. + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + (WebKit::UpdateChunk::createImage): + * Shared/qt/UpdateChunk.h: + +2010-11-04 Andreas Kling <kling@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] Add a stub WebContextMenuProxy + + This is the Qt equivalent of r71333. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createContextMenuProxy): + * UIProcess/qt/WebContextMenuProxyQt.cpp: Added. + (WebKit::WebContextMenuProxyQt::WebContextMenuProxyQt): + (WebKit::WebContextMenuProxyQt::create): + (WebKit::WebContextMenuProxyQt::showContextMenu): + (WebKit::WebContextMenuProxyQt::hideContextMenu): + * UIProcess/qt/WebContextMenuProxyQt.h: Added. + * WebKit2.pro: + +2010-11-04 Adam Roben <aroben@apple.com> + + Add a do-nothing WebContextMenuProxy implementation on Windows + + Fixes <http://webkit.org/b/48992> REGRESSION (r71041): Crash in + WebPageProxy::showContextMenu when right-clicking in WebKit2 on + Windows + + Reviewed by Dan Bernstein. + + * UIProcess/win/WebContextMenuProxyWin.cpp: Added. + (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin): + (WebKit::WebContextMenuProxyWin::create): + (WebKit::WebContextMenuProxyWin::showContextMenu): + (WebKit::WebContextMenuProxyWin::hideContextMenu): + * UIProcess/win/WebContextMenuProxyWin.h: Added. + Just stubbed-out this class. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createContextMenuProxy): Create a new + WebContextMenuProxyWin and return it. Returning 0 results in a crash. + + * win/WebKit2.vcproj: Added WebContextMenuProxyWin. + +2010-11-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Andreas Kling.. + + [Qt] Build Webkit2 both in debug and release on Mac + + On Mac OS X we build QtWebKit in both debug and release, so + we need to also build the webkit2 library in both configs. + + * WebKit2.pro: + +2010-11-04 Adam Roben <aroben@apple.com> + + Remove lame puts()s from WebPageProxy + + Rubber-stamped by Anders Carlsson. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::loadURLRequest): + +2010-11-03 Alice Liu <alice.liu@apple.com> + + Fix clang++ build + + * PluginProcess/PluginProcess.h: + * UIProcess/Plugins/PluginProcessProxy.h: + * UIProcess/WebContextMenuProxy.h: + Change class to struct and vise versa where needed. + +2010-11-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Implement NP_SetProperty + https://bugs.webkit.org/show_bug.cgi?id=48956 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::setProperty): + Call the NPClass setProperty function. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add SetProperty message. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::setProperty): + Send a SetProperty message. + + (WebKit::NPObjectProxy::NP_SetProperty): + Call NPObjectProxy::setProperty. + +2010-11-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Out of process plug-ins don't support the CA drawing model + https://bugs.webkit.org/show_bug.cgi?id=48950 + <rdar://problem/8626019> + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::initialize): + Call platformInitialize(). + + (WebKit::PluginControllerProxy::destroy): + Call platformDestroy(). + + (WebKit::PluginControllerProxy::isAcceleratedCompositingEnabled): + Assume that accelerated compositing is available if we have a render server port. + + (WebKit::PluginControllerProxy::geometryDidChange): + Call platformGeometryDidChange(). + + * PluginProcess/PluginProcess.h: + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): + Pass back the remote layer client ID. + + * PluginProcess/WebProcessConnection.messages.in: + Add a remoteLayerClientID out parameter to CreatePlugin. + + * PluginProcess/mac/PluginControllerProxyMac.mm: Added. + (WebKit::PluginControllerProxy::platformInitialize): + If the plug-in has a layer, create a remote layer client and associate it with the layer. + + (WebKit::PluginControllerProxy::platformDestroy): + Invalidate the remote layer client. + + (WebKit::PluginControllerProxy::remoteLayerClientID): + Return the remote layer client ID if one exists. + + (WebKit::PluginControllerProxy::platformGeometryDidChange): + Update the layer bounds. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: Added. + (WebKit::PluginProxy::pluginLayer): + Create a render layer if needed. + + (WebKit::PluginProxy::needsBackingStore): + Return whether the plug-in needs a backing store. (It doesn't need a backing store if it's a CA plug-in). + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::PluginProxy): + Initialize m_remoteLayerClientID. + + (WebKit::PluginProxy::initialize): + Set m_remoteLayerClientID. + + (WebKit::PluginProxy::paint): + Bail if the plug-in doesn't need a backing store. + + (WebKit::PluginProxy::geometryDidChange): + Don't create a backing store if the plug-in doesn't need one. + + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + Remove RetainPtr initialization. + + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformClear): + Use nullptr instead of 0. + +2010-11-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Crash when layout in response to setSize changes the drawing area + https://bugs.webkit.org/show_bug.cgi?id=48947 + + This is tested by compositing/plugins/small-to-large-composited-plugin.html. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::setSize): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::setSize): + +2010-11-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Pass the accelerated compositing render server port to the plug-in process at startup + https://bugs.webkit.org/show_bug.cgi?id=48925 + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::PluginProcess): + Initialize m_compositingRenderServerPort to MACH_PORT_NULL. + + (WebKit::PluginProcess::initialize): + Get the plug-in path and render server port from the creation parameters. + + * PluginProcess/PluginProcess.messages.in: + Change the Initialize message to take a PluginProcessCreationParameters struct. + + * Shared/Plugins/PluginProcessCreationParameters.cpp: Added. + * Shared/Plugins/PluginProcessCreationParameters.h: Added. + Add new PluginProcessCreationParameters struct. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didFinishLaunching): + Initialize now takes a PluginProcessCreationParameters struct. + + * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: Added. + (WebKit::PluginProcessProxy::platformInitializePluginProcess): + Initialize the render server port. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-11-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add the webkit2 library to LIBS instead of QMAKE_LFLAGS + + Otherwise the library order will get messed up and cause + missing symbols on Mac OS X. + + * WebKit2.pri: + * WebKit2.pro: + +2010-11-02 Daniel Bates <dbates@rim.com> + + Reviewed by Adam Barth. + + For unnamed frames, window.name returns a generated name + https://bugs.webkit.org/show_bug.cgi?id=6751 + + Part 1 of 2. + + Substitute FrameTree::uniqueName() for FrameTree::name() in WebKit2. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::name): + +2010-11-02 Amruth Raj <amruthraj@motorola.com> and Ravi Kasibhatla <ravi.kasibhatla@motorola.com> + + Reviewed by Martin Robinson. + + Changes to enable building WebKit2 for Gtk port. + (https://bugs.webkit.org/show_bug.cgi?id=37369) + + * Platform/gtk: Added. + * Platform/gtk/SharedMemoryGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::SharedMemory::Handle::Handle): + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + (WebKit::SharedMemory::create): + (WebKit::SharedMemory::~SharedMemory): + (WebKit::SharedMemory::createHandle): + (WebKit::SharedMemory::systemPageSize): + * Shared/gtk: Added. + * Shared/gtk/BackingStoreGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::BackingStore::createGraphicsContext): + (WebKit::BackingStore::paint): + * Shared/gtk/PlatformCertificateInfo.h: Added. Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + * Shared/gtk/WebCoreArgumentCodersGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + * UIProcess/Plugins/gtk: Added. + * UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::PluginInfoStore::pluginsDirectories): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::PluginInfoStore::individualPluginPaths): + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/gtk: Added. + * WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::InjectedBundle::load): + (WebKit::InjectedBundle::activateMacFontAscentHack): + * WebProcess/Plugins/Netscape/gtk: Added. + * WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement. + (WebKit::NetscapePlugin::platformPostInitialize): + (WebKit::NetscapePlugin::platformDestroy): + (WebKit::NetscapePlugin::platformGeometryDidChange): + (WebKit::NetscapePlugin::platformPaint): + (WebKit::toNP): + (WebKit::NetscapePlugin::platformHandleMouseEvent): + (WebKit::NetscapePlugin::platformHandleWheelEvent): + (WebKit::NetscapePlugin::platformSetFocus): + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + * WebProcess/WebCoreSupport/gtk: Added. + * WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h: Added. Added. Stubbed implementation for GTK port. Yet to implement. + (WebFrameNetworkingContext::create): + (WebFrameNetworkingContext::WebFrameNetworkingContext): + +2010-11-02 Jing Jin <jjin@apple.com> + + Reviewed by Alexey Proskuryakov. + + Key down calls are not being sent to the application. + https://bugs.webkit.org/show_bug.cgi?id=48867 + + * UIProcess/API/mac/WKView.mm: + (-[WKView keyDown:]): Call super when ignoring a key down. + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Add Null and Int32 to NPVariantData + https://bugs.webkit.org/show_bug.cgi?id=48887 + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::NPVariantData): + (WebKit::NPVariantData::makeNull): + (WebKit::NPVariantData::makeInt32): + (WebKit::NPVariantData::encode): + (WebKit::NPVariantData::decode): + * Shared/Plugins/NPVariantData.h: + (WebKit::NPVariantData::int32Value): + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add support for NP_HasMethod and NP_Invoke + https://bugs.webkit.org/show_bug.cgi?id=48882 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new overload. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::hasMethod): + Call hasMethod and return the result. + + (WebKit::NPObjectMessageReceiver::invoke): + Convert the arguments, call invoke and return the result. + + (WebKit::NPObjectMessageReceiver::getProperty): + Release the converted variant. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add HasMethod and Invoke messages. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::hasMethod): + Send the HasMethod message. + + (WebKit::NPObjectProxy::invoke): + Send the Invoke message. + + (WebKit::NPObjectProxy::NP_HasMethod): + Call hasMethod. + + (WebKit::NPObjectProxy::NP_Invoke): + Call invoke. + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NP_HasProperty for NPObjectProxy + https://bugs.webkit.org/show_bug.cgi?id=48876 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::hasProperty): + Call The hasProperty callback function. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add HasProperty message. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::hasProperty): + Send the HasProperty message. + + (WebKit::NPObjectProxy::NP_HasProperty): + Call hasProperty. + + +2010-11-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add a way to send startup messages on the context which can be posted when a process launches + <rdar://problem/8617928> + https://bugs.webkit.org/show_bug.cgi?id=48838 + + Adds WKContextSetInitializationUserDataForInjectedBundle which sets an + APIObject on WebContext to be sent to the InjectedBundle's WKBundleInitialize + function each time a process starts up. This can help in cases where + the WebProcess dies, and will be helpful in the world where there are + multiple WebProcess's per context. + + * Scripts/webkit2/messages.py: + * UIProcess/API/C/WKContext.cpp: + (WKContextSetInitializationUserDataForInjectedBundle): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + * UIProcess/WebContext.h: + (WebKit::WebContext::setInjectedBundleInitializationUserData): + (WebKit::WebContext::injectedBundleInitializationUserData): + * WebProcess/InjectedBundle/API/c/WKBundleInitialize.h: + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + (WebKit::InjectedBundle::load): + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + (WebKit::InjectedBundle::load): + * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: + (WebKit::InjectedBundle::load): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement PluginProxy::pluginScriptableNPObject + https://bugs.webkit.org/show_bug.cgi?id=48874 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::getPluginScriptableNPObject): + Ask the plug-in for its scriptable NPObject, register it with the map and return its object ID. + + * PluginProcess/PluginControllerProxy.messages.in: + Add GetPluginScriptableNPObject message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::pluginScriptableNPObject): + Send the GetPluginScriptableNPObject message. + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add strings to NPVariantData + https://bugs.webkit.org/show_bug.cgi?id=48871 + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::makeString): + (WebKit::NPVariantData::encode): + (WebKit::NPVariantData::decode): + * Shared/Plugins/NPVariantData.h: + (WebKit::NPVariantData::stringValue): + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add convenience functions for allocating NPAPI memory + https://bugs.webkit.org/show_bug.cgi?id=48870 + + Add npnMemAlloc, npnMemFree and createNPString functions and + npnMemNew, npnMemNewArray function templates. + + * WebProcess/Plugins/Netscape/JSNPObject.cpp: + (WebKit::JSNPObject::getOwnPropertyNames): + Use npnMemFree. + + * WebProcess/Plugins/Netscape/NPJSObject.cpp: + (WebKit::NPJSObject::enumerate): + Use npnMemNewArray. + + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + Use createNPString. + + * WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp: + (WebKit::npnMemAlloc): + Call malloc. + + (WebKit::npnMemFree): + Call free. + + (WebKit::createNPString): + Allocate the characters for a new NPString. + + (WebKit::createNPObject): + Call npnMemNew. + + (WebKit::deallocateNPObject): + Call npnMemFree. + + (WebKit::releaseNPVariantValue): + Call npnMemFree. + + * WebProcess/Plugins/Netscape/NPRuntimeUtilities.h: + (WebKit::npnMemNew): + (WebKit::npnMemNewArray): + Add new functions. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_MemAlloc): + Call npnMemAlloc. + + (WebKit::NPN_MemFree): + Call npnMemFree. + + (WebKit::NPN_UTF8FromIdentifier): + Call npnMemNewArray. + + (WebKit::copyCString): + Call npnMemNewArray. Correctly initialize the "len" out parameter. + +2010-11-02 Jessie Berlin <jberlin@apple.com> + + Windows build fix. Unreviewed. + + * win/WebKit2Generated.make: + Add WKInspector.h so that it is copied over to the WebKitBuild directory. + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add some support for remote and local NPObjects to NPRemoteObjectMap + https://bugs.webkit.org/show_bug.cgi?id=48864 + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + If the NPVariant contains an NPObject that isn't an NPObjectProxy, register it + and return its ID. + + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + If the NPVariantData contains a remote object, create an NPObjectProxy and return it. + + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::NPVariantData): + Initialize m_localNPObjectIDValue and m_remoteNPObjectIDValue. + + (WebKit::NPVariantData::makeLocalNPObjectID): + Create an NPVariantData that contains a local NPObject ID. + + (WebKit::NPVariantData::encode): + Handle local and remote NPObject IDs. + + (WebKit::NPVariantData::decode): + Decode local and remote NPObject IDs and "swap them" so an encoded remote NPObject ID is + decoded as a local NPObjectID (and vice versa). + + * Shared/Plugins/NPVariantData.h: + (WebKit::NPVariantData::localNPObjectIDValue): + (WebKit::NPVariantData::remoteNPObjectIDValue): + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Attempt to fix a GCC release only warning. + + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::NPVariantData): + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Invalidate the NPRemoteObjectMap + https://bugs.webkit.org/show_bug.cgi?id=48856 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): + Remove FIXME. The NPRemoteObjectMap always outlives the NPObjectMessageReceiver. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::~NPObjectProxy): + Call npObjectProxyDestroyed here. + + (WebKit::NPObjectProxy::invalidate): + Null out m_npRemoteObjectMap. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::~NPRemoteObjectMap): + Add assertions. + + (WebKit::NPRemoteObjectMap::createNPObjectProxy): + Keep track of the NPObjectProxy by adding it to the m_npObjectProxies set. + + (WebKit::NPRemoteObjectMap::npObjectProxyDestroyed): + Remove the NPObjectProxy from the m_npObjectProxies set. + + (WebKit::NPRemoteObjectMap::invalidate): + Delete all NPObjectMessageReceivers. Iterate over all NPObjectProxy objects and invalidate them. + +2010-11-02 Mike Thole <mthole@apple.com> + + Reviewed by Anders Carlsson. + + WebProcessManager informed about crashes too late (pages may have already tried to load a new URL) + https://bugs.webkit.org/show_bug.cgi?id=48853 + + This also fixes: <rdar://problem/8610451> Webkit2: Crash in WebKit!WebKit::WebProcessProxy::sendMessage opening google.com page + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + Removed invalid assertion that is hit when the WebProcess dies unexpectedly. + (WebKit::WebProcessProxy::didClose): + Reordered so that the individual pages are informed that the processDidCrash() after the shared + WebProcessManager has been. This allows the pages to properly trigger a new process to be launched. + +2010-11-02 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + WebKit2: Repeated cmd-key presses lead to unusable UI state + https://bugs.webkit.org/show_bug.cgi?id=48811 + <rdar://problem/8611924> + + Given the asynchronous nature of every interaction with the WebProcess, + we could re-send a keyDown event to AppKit that maps to an + action that is currently disabled and therefore will not trigger an action + but a call to the keyDown method of the NSView. We need to detect this + situation to avoid an infinite loop. + + * UIProcess/API/mac/WKView.mm: + (-[WKView performKeyEquivalent:]): Delay the release of the last processed event + to the moment we receive another event. + (-[WKView keyDown:]): Added early return in case the event is one we have re-sent. + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Handle boolean values in NPVariant and NPVariantData + https://bugs.webkit.org/show_bug.cgi?id=48852 + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::makeBool): + (WebKit::NPVariantData::encode): + (WebKit::NPVariantData::decode): + * Shared/Plugins/NPVariantData.h: + (WebKit::NPVariantData::boolValue): + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Assertion hit in WebProcessProxy::~WebProcessProxy() + https://bugs.webkit.org/show_bug.cgi?id=48849 + <rdar://problem/8617676> + + It is perfectly valid for the page map to contain pages if the web process proxy + goes away, this can happen if the process crashes for example. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + Remove the assertion. + +2010-11-02 Christian Sejersen <christian.webkit@gmail.com> + + Reviewed by Andreas Kling. + + The previous patch only took into account arm targets. This one + now checks whether the build is done inside Scratchbox. + https://bugs.webkit.org/show_bug.cgi?id=47895 + + * DerivedSources.pro: + +2010-11-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + More NPRuntime work + https://bugs.webkit.org/show_bug.cgi?id=48847 + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::~WebProcessConnection): + Add assertions. + + (WebKit::WebProcessConnection::removePluginControllerProxy): + If we have no more plug-in controller proxies, invalidate the remote object map. + + * Shared/Plugins/NPIdentifierData.cpp: + (WebKit::NPIdentifierData::createNPIdentifier): + Create an NPIdentifier from the given NPIdentifierData. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::create): + (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver): + This now takes the NPRemoteObjectMap as well as the npObjectID of the object. + + (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): + Unregister the object. + + (WebKit::NPObjectMessageReceiver::deallocate): + Delete the object. + + (WebKit::NPObjectMessageReceiver::getProperty): + Ask the NPObject for the property and convert it back to an NPVariantData. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::~NPObjectProxy): + Send a Deallocate message to the corresponding message receiver on the other side. + + (WebKit::NPObjectProxy::getProperty): + Convert the NPVariantData back to an NPVariant and return it. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::registerNPObject): + Pass the NPRemoteObjectMap and the npObjectID to NPObjectMessageReceiver::create. + + (WebKit::NPRemoteObjectMap::unregisterNPObject): + Remove the given object from the map of registered objects. + + (WebKit::NPRemoteObjectMap::npVariantToNPVariantData): + Given an NPVariant, create an NPVariantData. Only supports void and double types right now. + + (WebKit::NPRemoteObjectMap::npVariantDataToNPVariant): + Given an NPVariantData, create an NPVariant. Only supports void and double types right now. + + (WebKit::NPRemoteObjectMap::invalidate): + Add stub. + + * Shared/Plugins/NPVariantData.cpp: + (WebKit::NPVariantData::NPVariantData): + Set the type to void by default. + + (WebKit::NPVariantData::makeVoid): + Return a void NPVariantData. + + (WebKit::NPVariantData::makeDouble): + Return an NPVariantData that contains a double value. + + (WebKit::NPVariantData::encode): + Encode the NPVariantData. + + (WebKit::NPVariantData::decode): + Decode the NPVariantData. + + * Shared/Plugins/NPVariantData.h: + (WebKit::NPVariantData::type): + Return the type of the NPVariantData. + + (WebKit::NPVariantData::doubleValue): + Return the double value of the NPVariantData. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didClose): + Use nullptr instead of 0. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::~PluginProcessConnection): + Assert that the connection and the remote object map are both null. + + (WebKit::PluginProcessConnection::removePluginProxy): + If this was the last plug-in proxy, invalidate the remote object map. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::shutdown): + Use nullptr instead of 0. + +2010-11-02 Balazs Kelemen <kbalazs@webkit.org> + + Unreviewed Qt buildfix. + + * DerivedSources.pro: Add WebInspector to the list of + message recievers. + +2010-11-02 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] SharedMemory is broken + https://bugs.webkit.org/show_bug.cgi?id=48520 + + Implement SharedMemory with QSharedMemory to correctly handle + ownership and to avoid extra allocation for page size requests. + * Platform/SharedMemory.h: + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::Handle::Handle): + (WebKit::SharedMemory::Handle::isNull): + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + (WebKit::createUniqueKey): + (WebKit::SharedMemory::create): + (WebKit::accessMode): + (WebKit::SharedMemory::~SharedMemory): + (WebKit::SharedMemory::createHandle): + +2010-11-02 Timothy Hatcher <timothy@apple.com> + + Add WKInspector public APIs. + + https://webkit.org/b/48718 + + Reviewed by Pavel Feldman. + + * DerivedSources.make: Added WebInspector to MESSAGE_RECEIVERS section. + * UIProcess/API/C/WKInspector.cpp: + (WKInspectorIsVisible): Added. + (WKInspectorShow): Added. + (WKInspectorClose): Added. + (WKInspectorShowConsole): Added. + (WKInspectorIsAttached): Added. + (WKInspectorAttach): Added. + (WKInspectorDetach): Added. + (WKInspectorIsDebuggingJavaScript): Added. + (WKInspectorToggleJavaScriptDebugging): Added. + (WKInspectorIsProfilingJavaScript): Added. + (WKInspectorToggleJavaScriptProfiling): Added. + (WKInspectorIsProfilingPage): Added. + (WKInspectorTogglePageProfiling): Added. + * UIProcess/API/C/WKInspector.h: Added new functions. + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize new booleans. + (WebKit::WebInspectorProxy::invalidate): Reset new booleans. + (WebKit::WebInspectorProxy::show): Added. + (WebKit::WebInspectorProxy::close): Added. + (WebKit::WebInspectorProxy::showConsole): Added. + (WebKit::WebInspectorProxy::attach): Added. + (WebKit::WebInspectorProxy::detach): Added. + (WebKit::WebInspectorProxy::toggleJavaScriptDebugging): Added. + (WebKit::WebInspectorProxy::toggleJavaScriptProfiling): Added. + (WebKit::WebInspectorProxy::togglePageProfiling): Added. + * UIProcess/WebInspectorProxy.h: + (WebKit::WebInspectorProxy::isVisible): Added. + (WebKit::WebInspectorProxy::isAttached): Added. + (WebKit::WebInspectorProxy::isDebuggingJavaScript): Added. + (WebKit::WebInspectorProxy::isProfilingJavaScript): Added. + (WebKit::WebInspectorProxy::isProfilingPage): Added. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Invalidate the WebInspectorProxy. + (WebKit::WebPageProxy::inspector): Return 0 if closed or invalid. + * WebKit2.pro: Added new files. + * WebKit2.xcodeproj/project.pbxproj: Added new Files. + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::show): Added. + (WebKit::WebInspector::close): Added. + (WebKit::WebInspector::showConsole): Added. + (WebKit::WebInspector::startJavaScriptDebugging): Added. + (WebKit::WebInspector::stopJavaScriptDebugging): Added. + (WebKit::WebInspector::startJavaScriptProfiling): Added. + (WebKit::WebInspector::stopJavaScriptProfiling): Added. + (WebKit::WebInspector::startPageProfiling): Added. + (WebKit::WebInspector::stopPageProfiling): Added. + * WebProcess/WebPage/WebInspector.h: + (WebKit::WebInspector::page): Added. + * WebProcess/WebPage/WebInspector.messages.in: Added. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): Destroy the WebInspector. + (WebKit::WebPage::inspector): Return 0 if closed. + (WebKit::WebPage::didReceiveMessage): Send the message to the WebInspector + if the message class is MessageClassWebInspector. + * win/WebKit2.vcproj: Added new files. + +2010-11-02 Timothy Hatcher <timothy@apple.com> + + Make WebInspectorFrontendClient inherit from InspectorFrontendClientLocal. + + We can do this since the Web Inspector WebPage will share the same process + with the inspected WebPage. + + https://webkit.org/b/48652 + + Reviewed by Pavel Feldman. + + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: + (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient): + Call the InspectorFrontendClientLocal constructor. + (WebKit::WebInspectorFrontendClient::attachWindow): Added. + (WebKit::WebInspectorFrontendClient::detachWindow): Added. + (WebKit::WebInspectorFrontendClient::setAttachedWindowHeight): Added. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: + +2010-11-01 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Kenneth Rohde Christiansen. + + Initial implementation of QWKHistoryItem. + https://bugs.webkit.org/show_bug.cgi?id=48620 + + The QWkHistoryItem represents one item in the history of QWKPage. + + * UIProcess/API/qt/qwkhistory.cpp: + (QWKHistoryItemPrivate::QWKHistoryItemPrivate): + (QWKHistoryItem::QWKHistoryItem): + (QWKHistoryItem::~QWKHistoryItem): + (QWKHistoryItem::title): The page title + (QWKHistoryItem::url): The URL of the page. + (QWKHistoryItem::originalUrl): The URL used to access the page. + * UIProcess/API/qt/qwkhistory.h: + * UIProcess/API/qt/qwkhistory_p.h: + * WebKit2.pro: Added WKBackForwardListItem.h and WKBackForwardListItem.cpp + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Make NPRemoteObjectMap a ref counted object + https://bugs.webkit.org/show_bug.cgi?id=48808 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::windowScriptNPObject): + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::WebProcessConnection): + (WebKit::WebProcessConnection::didReceiveSyncMessage): + * PluginProcess/WebProcessConnection.h: + (WebKit::WebProcessConnection::npRemoteObjectMap): + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::create): + (WebKit::NPRemoteObjectMap::~NPRemoteObjectMap): + (WebKit::NPRemoteObjectMap::createNPObjectProxy): + * Shared/Plugins/NPRemoteObjectMap.h: + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::PluginProcessConnection): + (WebKit::PluginProcessConnection::didReceiveSyncMessage): + * WebProcess/Plugins/PluginProcessConnection.h: + (WebKit::PluginProcessConnection::npRemoteObjectMap): + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::getWindowScriptNPObject): + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Respond to NP_GetProperty by sending a GetProperty message + https://bugs.webkit.org/show_bug.cgi?id=48797 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new sync message overload. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveSyncMessage): + If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap. + + * Shared/Plugins/NPIdentifierData.cpp: + * Shared/Plugins/NPIdentifierData.h: + Add NPIdentifierData, a CoreIPC representation of an NPIdentifier. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::getProperty): + Add stub. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: + Add GetProperty. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::create): + (WebKit::NPObjectProxy::NPObjectProxy): + (WebKit::NPObjectProxy::initialize): + NPObjectProxy now takes an NPRemoteObjectMap in its create function. + + (WebKit::NPObjectProxy::getProperty): + Send a GetProperty message. + + (WebKit::NPObjectProxy::NP_GetProperty): + Call getProperty. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::createNPObjectProxy): + Pass the NPRemoteObjectMap. + + (WebKit::NPRemoteObjectMap::didReceiveSyncMessage): + Find the right message receiver and dispatch the message to it. + + * Shared/Plugins/NPVariantData.cpp: + * Shared/Plugins/NPVariantData.h: + Add NPVariantData, which will be a CoreIPC representation of an NPVariant. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didReceiveSyncMessage): + If the message class is MessageClassNPObjectMessageReceiver, pass it to the NPRemoteObjectMap. + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add ArgumentCoder specialization for WTF::CString + https://bugs.webkit.org/show_bug.cgi?id=48796 + + * Platform/CoreIPC/ArgumentCoders.h: + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add NPObjectMessageReceiver.messages.in + https://bugs.webkit.org/show_bug.cgi?id=48782 + + * DerivedSources.make: + Add NPObjectMessageReceiver. + + * Platform/CoreIPC/MessageID.h: + Add MessageClassNPObjectMessageReceiver message class. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::deallocate): + Add stubbed out deallocate member function. + + * Shared/Plugins/NPObjectMessageReceiver.messages.in: Added. + + * WebKit2.xcodeproj/project.pbxproj: + Add NPObjectMessageReceiver.messages.in. + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Start stubbing out NPClass functions in NPObjectProxy + https://bugs.webkit.org/show_bug.cgi?id=48778 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::windowScriptNPObject): + getOrCreateNPObjectProxy is now createNPObjectProxy. + + * Shared/Plugins/NPObjectProxy.cpp: + (WebKit::NPObjectProxy::create): + Allocate and initialize an NPObjectProxy object. + + (WebKit::NPObjectProxy::NPObjectProxy): + Initialize m_npObjectID to 0. + + (WebKit::NPObjectProxy::isNPObjectProxy): + Check the class. + + (WebKit::NPObjectProxy::initialize): + Set m_npObjectID. + + (WebKit::NPObjectProxy::npClass): + Return the NPClass with all functions filled in. + + (WebKit::NPObjectProxy::NP_Allocate): + Create a new NPObjectProxy object. + + (WebKit::NPObjectProxy::NP_Deallocate): + Deallocate the NPObjectProxy object. + + (WebKit::NPObjectProxy::NP_HasMethod): + (WebKit::NPObjectProxy::NP_Invoke): + (WebKit::NPObjectProxy::NP_InvokeDefault): + (WebKit::NPObjectProxy::NP_HasProperty): + (WebKit::NPObjectProxy::NP_GetProperty): + (WebKit::NPObjectProxy::NP_SetProperty): + (WebKit::NPObjectProxy::NP_RemoveProperty): + (WebKit::NPObjectProxy::NP_Enumerate): + (WebKit::NPObjectProxy::NP_Construct): + Add stubs. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::NPRemoteObjectMap::createNPObjectProxy): + * Shared/Plugins/NPRemoteObjectMap.h: + Rename getOrCreateNPObjectProxy to createNPObjectProxy. + + * WebProcess/Plugins/Netscape/NPJSObject.cpp: + (WebKit::NPJSObject::NP_Allocate): + Remove unused parameter. + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Both the WebProcessConnection and PluginProcessConnection should have NPRemoteObjectMaps + https://bugs.webkit.org/show_bug.cgi?id=48775 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::windowScriptNPObject): + Ask for an NPObjectProxy for the window script NPObject. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::WebProcessConnection): + Initialize m_npRemoteObjectMap. + + * Shared/Plugins/NPObjectMessageReceiver.cpp: + (WebKit::NPObjectMessageReceiver::create): + Add a create member function that takes an NPObject. + + (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver): + Retain the NPObject. + + (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): + Release the NPObject. + + * Shared/Plugins/NPRemoteObjectMap.cpp: + (WebKit::generateNPObjectID): + Generate a unique 64-bit NPObject ID. + + (WebKit::NPRemoteObjectMap::getOrCreateNPObjectProxy): + Add stub. + + (WebKit::NPRemoteObjectMap::registerNPObject): + Create a NPObjectMessageReceiver and add it to the map. + + * WebKit2.xcodeproj/project.pbxproj: + Set the correct target for NPRuntime related files. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::PluginProcessConnection): + Initialize m_npRemoteObjectMap + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::getWindowScriptNPObject): + Ask the real plug-in controller for the window script NPObject and register it. + +2010-11-01 John Sullivan <sullivan@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=48774 + minimFontSize preference needs to be exposed in WebKit2 + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setMinimumFontSize): + New function, parallel to existing functions for other preferences. + (WebKit::WebPreferences::minimumFontSize): + Ditto. + + * UIProcess/WebPreferences.h: + Declared new function. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetMinimumFontSize): + New UI process wrapper for new function. + (WKPreferencesGetMinimumFontSize): + Ditto. + + * UIProcess/API/C/WKPreferences.h: + Declared new functions. + +2010-11-01 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Tear down the related WebProcessProxy when a WebContext is deallocated + https://bugs.webkit.org/show_bug.cgi?id=48769 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::~WebContext): + Call WebProcessManager::contextWasDestroyed. + + (WebKit::WebContext::didNavigateWithNavigationData): + (WebKit::WebContext::didPerformClientRedirect): + (WebKit::WebContext::didPerformServerRedirect): + (WebKit::WebContext::didUpdateHistoryTitle): + It is valid for a frame to have a null page here, if the frame has outlived + its page. + + * UIProcess/WebProcessManager.cpp: + (WebKit::WebProcessManager::contextWasDestroyed): + Remove the context from the map. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + It's OK for the connection to be non-null here if the process goes away because + the context has been deallocated. + +2010-11-01 Brady Eidson <beidson@apple.com> + + Windows build fix. + + * UIProcess/win/WebView.cpp: + +2010-11-01 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699 + Context menu support for WebKit 2. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * Shared/WebContextMenuItem.cpp: Added. + (WebKit::WebContextMenuItem::WebContextMenuItem): + (WebKit::WebContextMenuItem::encode): + (WebKit::WebContextMenuItem::decode): + (WebKit::kitItems): + * Shared/WebContextMenuItem.h: Added. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::createContextMenuProxy): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createContextMenuProxy): Stub to keep the build working. + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + + * UIProcess/WebContextMenuProxy.cpp: Added. + (WebKit::WebContextMenuProxy::~WebContextMenuProxy): + (WebKit::WebContextMenuProxy::WebContextMenuProxy): + * UIProcess/WebContextMenuProxy.h: Added. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showContextMenu): Shows the menu after receiving the message from the WebProcess. + (WebKit::WebPageProxy::contextMenuItemSelected): Sends info about the selected menu item to the WebProcess + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + + * UIProcess/mac/WebContextMenuProxyMac.h: Added. + (WebKit::WebContextMenuProxyMac::create): + * UIProcess/mac/WebContextMenuProxyMac.mm: Added. + (+[WebMenuTarget sharedMenuTarget]): + (-[WebMenuTarget WebKit::]): + (-[WebMenuTarget setMenuProxy:WebKit::]): + (-[WebMenuTarget forwardContextMenuAction:]): + (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac): + (WebKit::WebContextMenuProxyMac::~WebContextMenuProxyMac): + (WebKit::WebContextMenuProxyMac::contextMenuItemSelected): + (WebKit::populateNSMenu): + (WebKit::nsMenuItemVector): + (WebKit::WebContextMenuProxyMac::populate): + (WebKit::WebContextMenuProxyMac::showContextMenu): + (WebKit::WebContextMenuProxyMac::hideContextMenu): + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createContextMenuProxy): Stub for now. + * UIProcess/win/WebView.h: + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::showContextMenu): + * WebProcess/WebCoreSupport/WebChromeClient.h: + + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + (WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Return the WebCore-provided default + menu for now. Embedding app customization will come later (see bug 48720) + + * WebProcess/WebPage/WebContextMenu.cpp: Added. + (WebKit::WebContextMenu::WebContextMenu): + (WebKit::WebContextMenu::~WebContextMenu): + (WebKit::WebContextMenu::show): + (WebKit::WebContextMenu::itemSelected): + * WebProcess/WebPage/WebContextMenu.h: Added. + (WebKit::WebContextMenu::create): + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::contextMenu): + (WebKit::handleMouseEvent): Pass right mouse presses along to WebCore as both a mouse event and context menu event, + the same way WebKit1 does. + (WebKit::WebPage::didSelectItemFromActiveContextMenu): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-11-01 Adam Roben <aroben@apple.com> + + Cancel main resource loads after we hand them off to the media engine + + This is the WebKit2 equivalent of r51104. Clearly this code should be + moved to a cross-platform location someday. + + Fixes <http://webkit.org/b/48561> <rdar://problem/8606679> Assertion + failure in DocumentLoader::commitData when loading a media document in + WebKit2 + + Reviewed by Eric Carlson. + + * WebProcess/WebCoreSupport/WebErrors.h: Added pluginWillHandleLoadError. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::committedLoad): Cancel the main resource load + after handing off the load to the media engine. This code originally + came from -[WebHTMLRepresentation receivedData:withDataSource:]. + (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError): Call through to WebErrors. + (WebKit::WebFrameLoaderClient::shouldFallBack): Implemented. We fall + back for all errors except when the load was cancelled or we handed it + off to the media engine or a plugin. + + * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: + (WebKit::pluginWillHandleLoadError): Implemented. + + * WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp: + (WebKit::pluginWillHandleLoadError): Stubbed out. + + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + (WebKit::pluginWillHandleLoadError): Implemented. + +2010-11-01 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Cleanup viewportAttributesForSize API + + Change QSize argument to a const QSize&. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::viewportAttributesForSize): + * UIProcess/API/qt/qwkpage.h: + +2010-10-31 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Visited links not populated correctly in new web processes after the first + https://bugs.webkit.org/show_bug.cgi?id=48735 + rdar://problem/8442177 + + * UIProcess/VisitedLinkProvider.cpp: + (WebKit::VisitedLinkProvider::VisitedLinkProvider): Initialize + m_webProcessHasVisitedLinkState. + (WebKit::VisitedLinkProvider::processDidFinishLaunching): Renamed + from populateVisitedLinksIfNeeded. Set m_webProcessHasVisitedLinkState + to false, since this is a new process, and also start the timer + so the visited links messages will be sent. + (WebKit::VisitedLinkProvider::processDidClose): Renamed from + stopVisitedLinksTimer. + (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired): + Added logic so we send SetVisitedLinkTable and + AllVisitedLinkStateChanged once to each new process and to set + m_webProcessHasVisitedLinkState to true once that is done. + + * UIProcess/VisitedLinkProvider.h: Updated for above changes. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::processDidFinishLaunching): Called + VisitedLinkProvider function under its new name. Also used + ASSERT_UNUSED rather than ASSERT since the argument is used + only for the assertion. + (WebKit::WebContext::processDidClose): Ditto. + +2010-10-30 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt][WK2] Crash in drawUpdateChunkIntoBackingStore + https://bugs.webkit.org/show_bug.cgi?id=48707 + + UpdateChunk images have to be created using the QImage constructor + that takes a bytesPerLine (stride) value, or the data length won't + match UpdateChunk::size(). + + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::createImage): + +2010-10-29 Daniel Bates <dbates@rim.com> + + No review, rolling out 70971. + http://trac.webkit.org/changeset/70971 + https://bugs.webkit.org/show_bug.cgi?id=6751 + + Rolling out changeset 70971 <http://trac.webkit.org/changeset/70971> since + it caused layout test failures on all bots. In particular, the + child count in a generated frame name differs after this patch. We need + to look into this further. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::name): + +2010-10-29 Daniel Bates <dbates@rim.com> + + Reviewed by Adam Barth. + + For unnamed frames, window.name returns a generated name + https://bugs.webkit.org/show_bug.cgi?id=6751 + + Modified WebKit2 to use FrameTree::uniqueName(). + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::name): + +2010-10-29 Sam Weinig <weinig@apple.com> + + Reviewed by Simon Fraser. + + Implement WebProcess::platformSetCacheModel for windows + <rdar://problem/8605796> + https://bugs.webkit.org/show_bug.cgi?id=48703 + + * WebProcess/win/WebProcessWin.cpp: + (WebKit::memorySize): + (WebKit::volumeFreeSize): + (WebKit::WebProcess::platformSetCacheModel): + Add implemenation based on the version in WebKit/win/WebView.cpp. + +2010-10-29 Andreas Kling <kling@webkit.org> + + Reviewed by Anders Carlsson. + + WK2: Unbreak compilation of WebPlatformTouchPoint::decode() + + * Shared/WebPlatformTouchPoint.cpp: + (WebKit::WebPlatformTouchPoint::decode): + +2010-10-29 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + More back/forward refactoring + + * WebKit2.pro: Removed WebBackForwardControllerClient.cpp and .h. + * WebKit2.xcodeproj/project.pbxproj: Ditto. + + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: Removed. + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.h: Removed. + + * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: + (WebKit::InjectedBundleBackForwardList::itemAtIndex): Use backForward. + (WebKit::InjectedBundleBackForwardList::backListCount): Ditto. + (WebKit::InjectedBundleBackForwardList::forwardListCount): Ditto. + (WebKit::InjectedBundleBackForwardList::clear): Ditto. + + * WebProcess/WebPage/WebBackForwardListProxy.h: Added newly-needed include. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Set up backForwardClient. + +2010-10-29 Adam Roben <aroben@apple.com> + + Stop using encode/decodeBytes for WebEvent subclasses + + The use of encode/decodeBytes was making these classes sensitive to + differences in padding on different architectures (e.g., 32-bit vs. + 64-bit). By encoding each data member explicitly we remove this + sensitivity, allowing these classes to be passed between processes + with different padding. + + Fixes <http://webkit.org/b/48552> <rdar://problem/8606571> Mouse + events never reach Flash in WebKit2 on Mac (asserts in Debug builds) + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/Arguments.h: + (CoreIPC::Arguments8::Arguments8): + (CoreIPC::Arguments8::encode): + (CoreIPC::Arguments8::decode): + (CoreIPC::In): + (CoreIPC::Out): + Added Arguments8, the biggest Arguments yet. + + * Shared/WebEvent.cpp: + (WebKit::WebEvent::encode): + (WebKit::WebEvent::decode): + * Shared/WebKeyboardEvent.cpp: + (WebKit::WebKeyboardEvent::encode): + (WebKit::WebKeyboardEvent::decode): + * Shared/WebMouseEvent.cpp: + (WebKit::WebMouseEvent::encode): + (WebKit::WebMouseEvent::decode): + * Shared/WebPlatformTouchPoint.cpp: + (WebKit::WebPlatformTouchPoint::encode): + (WebKit::WebPlatformTouchPoint::decode): + * Shared/WebTouchEvent.cpp: + (WebKit::WebTouchEvent::encode): + (WebKit::WebTouchEvent::decode): + * Shared/WebWheelEvent.cpp: + (WebKit::WebWheelEvent::encode): + (WebKit::WebWheelEvent::decode): + Changed all encode/decode function to use CoreIPC::In/Out to + encode/decode data members individually. + +2010-10-29 Adam Roben <aroben@apple.com> + + Use only CoreIPC-sanctioned types in WebEvent subclasses + + Fixes <http://webkit.org//48694> WebEvent subclasses should not use + architecture-dependent types + + Reviewed by Anders Carlsson. + + * Shared/WebEvent.h: + (WebKit::WebEvent::type): + (WebKit::WebMouseEvent::button): + (WebKit::WebMouseEvent::clickCount): + (WebKit::WebWheelEvent::granularity): + (WebKit::WebPlatformTouchPoint::id): + (WebKit::WebPlatformTouchPoint::state): + Replaced enums, ints, and unsigneds with uint32_ts, int32_ts, and + uint32_ts, respectively. + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Generate a DelayedReply struct for sync messages marked delayed + https://bugs.webkit.org/show_bug.cgi?id=48696 + + * Scripts/webkit2/messages.py: + If we encounter a sync message marked delayed, generate a DelayedReply struct with a send member funciton + that can be used for sending the reply. + + * Scripts/webkit2/messages_unittest.py: + Update expected results. + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Use WebPage::send in a couple of more places. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setWindowRect): + (WebKit::WebChromeClient::takeFocus): + (WebKit::WebChromeClient::setToolbarsVisible): + (WebKit::WebChromeClient::setStatusbarVisible): + (WebKit::WebChromeClient::setMenubarVisible): + (WebKit::WebChromeClient::setResizable): + (WebKit::WebChromeClient::setStatusbarText): + (WebKit::WebChromeClient::contentsSizeChanged): + (WebKit::WebChromeClient::mouseDidMoveOverElement): + (WebKit::WebChromeClient::setToolTip): + (WebKit::WebChromeClient::setCursor): + (WebKit::WebChromeClient::dispatchViewportDataDidChange): + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::registerCommandForUndo): + (WebKit::WebEditorClient::clearUndoRedoOperations): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::detachedFromParent2): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFirstLayout): + (WebKit::WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + (WebKit::WebFrameLoaderClient::postProgressStartedNotification): + (WebKit::WebFrameLoaderClient::postProgressEstimateChangedNotification): + (WebKit::WebFrameLoaderClient::postProgressFinishedNotification): + (WebKit::WebFrameLoaderClient::didDisplayInsecureContent): + (WebKit::WebFrameLoaderClient::didRunInsecureContent): + (WebKit::WebFrameLoaderClient::dispatchDidBecomeFrameset): + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + (WebKit::FindController::hideFindIndicator): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::addItem): + (WebKit::WebBackForwardListProxy::goToItem): + (WebKit::WebBackForwardListProxy::clear): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::createMainFrame): + (WebKit::WebFrame::createSubframe): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::sendClose): + (WebKit::WebPage::pageDidScroll): + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + (WebKit::WebPage::validateMenuItem): + (WebKit::WebPage::touchEvent): + (WebKit::WebPage::show): + (WebKit::WebPage::runJavaScriptInMainFrame): + (WebKit::WebPage::getRenderTreeExternalRepresentation): + (WebKit::WebPage::getSourceForFrame): + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a MessageSender class template + https://bugs.webkit.org/show_bug.cgi?id=48683 + + * Platform/CoreIPC/MessageSender.h: Added. + (CoreIPC::MessageSender::send): + Add send overloads for simple message sending. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add MessageSender.h + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::countStringMatches): + (WebKit::FindController::findString): + (WebKit::FindController::updateFindIndicator): + Call send on the web page. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::connection): + Add connection(), used by the MessageSender. + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::destinationID): + Add destinationID(), used by the MessageSender. + + * win/WebKit2.vcproj: + Add MessageSender.h + +2010-10-29 Adam Roben <aroben@apple.com> + + Remove redundant data members from WebTouchEvent + + WebEvent already stores the Type and timestamp. + + Fixes <http://webkit.org/b/48671> WebTouchEvent duplicates data from + WebEvent + + Reviewed by Anders Carlsson. + + * Shared/WebEvent.h: + * Shared/WebTouchEvent.cpp: + (WebKit::WebTouchEvent::WebTouchEvent): + Removed m_type and m_timestamp (which was never even getting + initialized!). + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add the plug-in proxy to the map before sending the CreatePlugin message + https://bugs.webkit.org/show_bug.cgi?id=48678 + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::initialize): + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add GetWindowScriptNPObject message + https://bugs.webkit.org/show_bug.cgi?id=48670 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::windowScriptNPObject): + Send the GetWindowScriptNPObject message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::getWindowScriptNPObject): + Add stub. + + * WebProcess/Plugins/PluginProxy.messages.in: + Add GetWindowScriptNPObject message. + +2010-10-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Change the Connection::sendSync timeout parameter to have the NoTimeout argument as a default + argument and update all the call sites. + + * Platform/CoreIPC/Connection.h: + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::proxiesForURL): + (WebKit::PluginControllerProxy::cookiesForURL): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postSynchronousMessage): + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::initialize): + (WebKit::PluginProxy::destroy): + (WebKit::PluginProxy::paint): + (WebKit::PluginProxy::handleMouseEvent): + (WebKit::PluginProxy::handleWheelEvent): + (WebKit::PluginProxy::handleMouseEnterEvent): + (WebKit::PluginProxy::handleMouseLeaveEvent): + (WebKit::PluginProxy::handleKeyboardEvent): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::windowRect): + (WebKit::WebChromeClient::createWindow): + (WebKit::WebChromeClient::toolbarsVisible): + (WebKit::WebChromeClient::statusbarVisible): + (WebKit::WebChromeClient::menubarVisible): + (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel): + (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): + (WebKit::WebChromeClient::runJavaScriptAlert): + (WebKit::WebChromeClient::runJavaScriptConfirm): + (WebKit::WebChromeClient::runJavaScriptPrompt): + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::populatePluginCache): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::itemAtIndex): + (WebKit::WebBackForwardListProxy::backListCount): + (WebKit::WebBackForwardListProxy::forwardListCount): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + (WebKit::WebPage::changeAcceleratedCompositingMode): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::interceptEditingKeyboardEvent): + +2010-10-29 John Sullivan <sullivan@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=48666 + WebKit2 should provide counterpart getter to WKBundleNodeHandleSetHTMLInputElementAutofilled + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleGetHTMLInputElementAutofilled): + New function, calls through to InjectedBundleNodeHandle. + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: + Declared new function. + + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled): + New function, calls through to HTMLInputElement. + + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + Declared new function. + +2010-10-29 Jessie Berlin <jberlin@apple.com> + + Reviewed by Anders Carlsson. + + ASSERTION FAILURE in WebProcessProxy::frameDestroyed when a Page is closed before it can send + the DidCreateMainFrame messsage to the UIProcess. + https://bugs.webkit.org/show_bug.cgi?id=48654 + + WebProcessProxy::frameDestroyed was asserting that the frameID it was called with was + registered in WebProcessProxy::frameCreated (which is called when the WebPageProxy is + created). However, in the case where we close the page before it's had the chance to send + the DidCreateMainFrame message back to the UI process, the UI Process will get the + DidDestroyFrame message because it's sent directly to the WebProcessProxy and doesn't go + through WebPageProxy. + + Remove the assert because it is invalid in this case. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::frameDestroyed): + +2010-10-29 Adam Roben <aroben@apple.com> + + Build fix when Carbon plugins are disabled + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformHandleMouseEvent): + +2010-10-29 Adam Roben <aroben@apple.com> + + Move NPRuntime-related files into WebProcess/Plugins/Netscape + + Fixes <http://webkit.org/b/48645>. + + Reviewed by Anders Carlsson. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Updated the files' paths. + + * WebProcess/Plugins/Netscape/JSNPMethod.cpp: Renamed from WebKit2/WebProcess/Plugins/JSNPMethod.cpp. + * WebProcess/Plugins/Netscape/JSNPMethod.h: Renamed from WebKit2/WebProcess/Plugins/JSNPMethod.h. + * WebProcess/Plugins/Netscape/JSNPObject.cpp: Renamed from WebKit2/WebProcess/Plugins/JSNPObject.cpp. + * WebProcess/Plugins/Netscape/JSNPObject.h: Renamed from WebKit2/WebProcess/Plugins/JSNPObject.h. + * WebProcess/Plugins/Netscape/NPJSObject.cpp: Renamed from WebKit2/WebProcess/Plugins/NPJSObject.cpp. + * WebProcess/Plugins/Netscape/NPJSObject.h: Renamed from WebKit2/WebProcess/Plugins/NPJSObject.h. + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: Renamed from WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp. + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: Renamed from WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h. + * WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp: Renamed from WebKit2/WebProcess/Plugins/NPRuntimeUtilities.cpp. + * WebProcess/Plugins/Netscape/NPRuntimeUtilities.h: Renamed from WebKit2/WebProcess/Plugins/NPRuntimeUtilities.h. + +2010-10-29 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48576 + Let WebKit2 client know when a frame is a frameset + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::WebFrameProxy): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::setIsFrameSet): + (WebKit::WebFrameProxy::isFrameSet): + Remember whether the frame is currently a frameset. + + * UIProcess/API/C/WKFrame.cpp: (WKFrameIsFrameSet): + * UIProcess/API/C/WKFrame.h: + Added client API. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didCommitLoadForFrame): + (WebKit::WebPageProxy::frameDidBecomeFrameSet): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidBecomeFrameset): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + Pass notification from web process to UI process. + +2010-10-28 Adam Roben <aroben@apple.com> + + Use IntPoint/FloatSize in WebEvent subclasses + + This is nicer than passing around pairs of ints/floats. + + Fixes <http://webkit.org/b/48611>. + + Reviewed by Anders Carlsson. + + * Shared/WebEvent.h: + * Shared/WebMouseEvent.cpp: + * Shared/WebPlatformTouchPoint.cpp: + * Shared/WebWheelEvent.cpp: + Changed all x/y pairs to either use IntPoint or FloatSize, as + appropriate. + + * Shared/WebEventConversion.cpp: + * Shared/mac/WebEventFactory.mm: + * Shared/qt/WebEventFactoryQt.cpp: + * Shared/win/WebEventFactory.cpp: + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + Updated for WebEvent changes. + +2010-10-29 Adam Roben <aroben@apple.com> + + Touch WebKit2Prefix.h to fix incremental builds on Windows + + * WebKit2Prefix.h: + +2010-10-28 Adam Roben <aroben@apple.com> + + Remove unnecessary #includes from WebEvent.h + + Fixes <http://webkit.org/b/48609> WebEvent.h #includes things it + doesn't need + + Reviewed by Sam Weinig. + + * Scripts/webkit2/messages.py: + (MessageReceiver.iterparameters): Merged iterreplyparameters into this + function. All callers to iterparameters are really interested in the + reply parameters, too. This will cause us to, e.g., add + forward-declarations for types used in sync replies. + (headers_for_type): Added a special case for WebCore::KeypressCommand. + + * Scripts/webkit2/messages_unittest.py: Added a test to cover the + failing case that inspired the above changes. + + * Shared/WebEvent.h: Replaced #includes with forward-declarations. + + * Shared/API/c/WKSharedAPICast.h: + * Shared/NativeWebKeyboardEvent.h: + * Shared/WebEvent.cpp: + * Shared/WebKeyboardEvent.cpp: + * Shared/WebMouseEvent.cpp: + * Shared/WebPlatformTouchPoint.cpp: + * Shared/WebTouchEvent.cpp: + * Shared/WebWheelEvent.cpp: + * Shared/qt/WebEventFactoryQt.cpp: + * Shared/win/WebEventFactory.cpp: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + * UIProcess/WebUIClient.cpp: + * UIProcess/WebUIClient.h: + * UIProcess/win/WebView.cpp: + * WebProcess/WebPage/FindController.cpp: + * WebProcess/WebPage/mac/WebPageMac.mm: + Added now-needed #includes and declarations. + +2010-10-29 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Adam Roben and David Kilzer. + + Fix and cleanup of build systems + https://bugs.webkit.org/show_bug.cgi?id=48342 + + * Configurations/FeatureDefines.xcconfig: Remove unnecessary ENABLE_SANDBOX and add missing features. + +2010-10-28 Dan Bernstein <mitz@apple.com> + + LLVM compiler build fix + + * WebProcess/Downloads/mac/DownloadMac.mm: + (-[WKDownloadAsDelegate download:didReceiveResponse:]): Removed a stray semicolon. + +2010-10-28 Adam Roben <aroben@apple.com> + + Move some function definitions from WebEvent.h into new .cpp files + + Someday maybe we'll split the classes into their own header files, + too. + + Fixes <http://webkit.org/b/48604>. + + Reviewed by Anders Carlsson. + + * Shared/WebEvent.h: Moved code from here... + + * Shared/WebEvent.cpp: Added. + * Shared/WebKeyboardEvent.cpp: Added. + * Shared/WebMouseEvent.cpp: Added. + * Shared/WebPlatformTouchPoint.cpp: Added. + * Shared/WebTouchEvent.cpp: Added. + * Shared/WebWheelEvent.cpp: Added. + ...to here. Also changed WebTouchEvent::touchPoints not to copy the + Vector. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Added the new files. + +2010-10-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Connection::sendSyncMessage needs to dispatch incoming sync messages + https://bugs.webkit.org/show_bug.cgi?id=48606 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendSyncMessage): + Protect the connection when waiting for a reply. Schedule for any remaining incoming sync messages + to be sent once the bottom-most waitForSyncReply calls returns. + + (CoreIPC::Connection::waitForSyncReply): + Make sure to dispatch any incoming sync messages. + + (CoreIPC::Connection::processIncomingMessage): + If the incoming message is a sync message and we're waiting for a sync reply, add the message to the + queue of "sync messages received while waiting for sync reply" and wake up the client thread. + + * Platform/CoreIPC/Connection.h: + +2010-10-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move code to dispatch a sync message out into a separate function + https://bugs.webkit.org/show_bug.cgi?id=48605 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchSyncMessage): + Factor code out from dispatchMessage. Handle receiving a message with an invalid reply ID. + + (CoreIPC::Connection::dispatchMessages): + Call dispatchSyncMessage. + + * Platform/CoreIPC/Connection.h: + +2010-10-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add NPObjectMessageReceiver class. + https://bugs.webkit.org/show_bug.cgi?id=48599 + + * Shared/Plugins/NPObjectMessageReceiver.cpp: Added. + (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver): + (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): + * Shared/Plugins/NPObjectMessageReceiver.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-10-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add NPObjectProxy class + https://bugs.webkit.org/show_bug.cgi?id=48558 + + * Shared/Plugins/NPObjectProxy.cpp: Added. + (WebKit::NPObjectProxy::NPObjectProxy): + (WebKit::NPObjectProxy::~NPObjectProxy): + * Shared/Plugins/NPObjectProxy.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-10-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add NPRemoteObjectMap class + https://bugs.webkit.org/show_bug.cgi?id=48553 + + * Shared/Plugins/NPRemoteObjectMap.cpp: Added. + (WebKit::NPRemoteObjectMap::NPRemoteObjectMap): + * Shared/Plugins/NPRemoteObjectMap.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-10-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WKURLRefs should be allowed to be null + <rdar://problem/8575621> + https://bugs.webkit.org/show_bug.cgi?id=48535 + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toURLRef): + (WebKit::toCopiedURLAPI): + Turn a null WTF::String into a null WKURLRef. + +2010-10-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WebKit2 API for window feature getter/setters + <rdar://problem/8590373> + https://bugs.webkit.org/show_bug.cgi?id=48496 + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setToolbarsAreVisible): + (WebKit::WebPageProxy::getToolbarsAreVisible): + (WebKit::WebPageProxy::setMenuBarIsVisible): + (WebKit::WebPageProxy::getMenuBarIsVisible): + (WebKit::WebPageProxy::setStatusBarIsVisible): + (WebKit::WebPageProxy::getStatusBarIsVisible): + (WebKit::WebPageProxy::setIsResizable): + (WebKit::WebPageProxy::getIsResizable): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::toolbarsAreVisible): + (WebKit::WebUIClient::setToolbarsAreVisible): + (WebKit::WebUIClient::menuBarIsVisible): + (WebKit::WebUIClient::setMenuBarIsVisible): + (WebKit::WebUIClient::statusBarIsVisible): + (WebKit::WebUIClient::setStatusBarIsVisible): + (WebKit::WebUIClient::isResizable): + (WebKit::WebUIClient::setIsResizable): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setToolbarsVisible): + (WebKit::WebChromeClient::toolbarsVisible): + (WebKit::WebChromeClient::setStatusbarVisible): + (WebKit::WebChromeClient::statusbarVisible): + (WebKit::WebChromeClient::setMenubarVisible): + (WebKit::WebChromeClient::menubarVisible): + (WebKit::WebChromeClient::setResizable): + Plumb through the calls. + +2010-10-28 Dan Bernstein <mitz@apple.com> + + Build fix. + + * win/WebKit2Common.vsprops: + +2010-10-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Adam Roben. + + No longer soft-link zlib + https://bugs.webkit.org/show_bug.cgi?id=48004 + + * win/WebKit2Common.vsprops: Added zlib.lib to AdditionalDependencies. + +2010-10-28 Adam Roben <aroben@apple.com> + + Make PluginView retain its HTMLPlugInElement + + This matches WebKit/mac's WebBaseNetscapePluginView. WebCore didn't do + this, but had a very different mechanism for implementing NPRuntime + that didn't require it. + + Fixes <http://webkit.org/b/46672> <rdar://problem/8484208> Crash + (preceded by assertion) in Node::document when running + plugins/document-open.html in WebKit2 on Windows + + Reviewed by Anders Carlsson. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::create): Moved here from the header file so that + clients of the header file won't have to pull in HTMLPlugInElement.h. + Changed to take a PassRefPtr<HTMLPlugInElement>. + (WebKit::PluginView::PluginView): Changed to take a + PassRefPtr<HTMLPlugInElement> and to use m_pluginElement later (because + the parameter to the function will be nulled-out after assigning into + m_pluginElement). + (WebKit::PluginView::pluginElementNPObject): Updated for change to m_pluginElement. + + * WebProcess/Plugins/PluginView.h: Made m_pluginElement a RefPtr. + +2010-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Make Qt viewportAttributesForSize not assert on (0, 0) size + https://bugs.webkit.org/show_bug.cgi?id=48524 + + We now return an invalid (isValid() == false) ViewportAttributes + instance when the supplied size is (0, 0). + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::viewportAttributesForSize): + +2010-10-28 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt][WK2] SharedMemory should be released by the receiving process + https://bugs.webkit.org/show_bug.cgi?id=48520 + + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::~SharedMemory): + (WebKit::SharedMemory::createHandle): + +2010-10-28 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Web process cannot be debugged if it crashes in initialization + https://bugs.webkit.org/show_bug.cgi?id=47399 + + Wait 3 seconds for the debugger on debug mode if + WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH environment variable is set. + + The debugging can be initiated for example in following way: + export WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH=1 + ./MiniBrowser & while [ -z `pidof QtWebProcess` ]; do sleep 1; done; \ + gdb --pid=`pidof QtWebProcess` + + * WebProcess/qt/WebProcessMainQt.cpp: + (WebKit::WebProcessMainQt): + +2010-10-28 Mark Rowe <mrowe@apple.com> + + 32-bit build fix. + + Qualify references to Rect to avoid ambiguity between WebCore::Rect and Carbon's Rect. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + (WebKit::NetscapePlugin::windowFrameChanged): + +2010-10-28 Ivan Krstić <ike@apple.com> + + Reviewed by Mark Rowe. + + Remove unused experimental proxied panel interface. + <rdar://problem/7237059> + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2010-10-27 Mark Rowe <mrowe@apple.com> + + Build fix. + + * UIProcess/API/mac/PageClientImpl.mm: Reference the file using the correct case. + +2010-10-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Find indicators do not bounce + https://bugs.webkit.org/show_bug.cgi?id=48490 + <rdar://problem/8564276> + + * UIProcess/API/mac/FindIndicatorWindow.h: + * UIProcess/API/mac/FindIndicatorWindow.mm: + (-[WebFindIndicatorWindowAnimation _initWithFindIndicatorWindow:WebKit::animationDuration:animationProgressCallback:WebKit::FindIndicatorWindow::animationDidEndCallback:WebKit::FindIndicatorWindow::]): + Add an animationDuration parameter. + + (WebKit::FindIndicatorWindow::FindIndicatorWindow): + Initialize m_bounceAnimationContext. + + (WebKit::FindIndicatorWindow::setFindIndicator): + Create a bounce animation and start it. + + (WebKit::FindIndicatorWindow::closeWindow): + Stop the bounce animation and destroy the bounce animation context. + + (WebKit::FindIndicatorWindow::startFadeOutTimerFired): + pass the fade out duration. + + (WebKit::FindIndicatorWindow::bounceAnimationCallback): + Set the bounce animation progress. + + (WebKit::FindIndicatorWindow::bounceAnimationDidEnd): + Destroy the bounce animation context. + +2010-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Remove the reference to the pageNamespace in the QWKPagePrivate. + Access it through the WebPageProxy instead which holds a strong + ref to it. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPage::preferences): + * UIProcess/API/qt/qwkpage_p.h: + +2010-10-27 Enrica Casucci <enrica@apple.com> + + Reviewed by Alexey Proskuryakov. + + Support Appkit key bindings and custom key bindings in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=48271 + <rdar://problem/7660723> + + We need to support AppKit key bindings and custom key bindings in WebKit2. + Every keyboard event is first sent to the WebProcess and we inform AppKit that + we don't need further processing. When the event is processed by the WebProcess and no handler consumes it, + we send a synchronous message back to the UI process to let AppKit perform the key bindings. + This operation can result in one or more editing commands to execute or a noop. + The WebProcess then replies back to the UI process to inform whether further processing is required, in + which case the event is sent back to the application to be mapped. + There is a potential for a race condition: in case the WebProcess is very slow to process the key events, the UI + process could be in a completely different state when the event is being resent (for example it might not have the + keyboard focus anymore) and the command could be lost. We should look out for user experience impact. + + * Scripts/webkit2/messages.py: Added header file in the generated file. + * Shared/WebCoreArgumentCoders.h: Added encoder/decoder for KeypressCommand. + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::interceptKeyEvent): Pass-through call to WKView. + (WebKit::PageClientImpl::didNotHandleKeyEvent): Added logic to resend the event to the application. + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): Changed the default return value to YES, otherwise no menu shortcut is performed. + (-[WKView doCommandBySelector:]): Added. + (-[WKView insertText:]): Added. + (-[WKView _handleStyleKeyEquivalent:]): Added to handle command-B and command-I. + (-[WKView performKeyEquivalent:]): Added to intercept key binding sequences. + (-[WKView _setEventBeingResent:]): + (-[WKView _interceptKeyEvent:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::interpretKeyEvent): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + (WebKit::WebEditorClient::handleKeyboardEvent): + (WebKit::WebEditorClient::handleInputMethodKeydown): + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: Moved handleKeyboardEvent and handleInputMethodKeydown + to the Mac specific implementation. + (WebKit::WebPage::interceptEditingKeyboardEvent): Added. + +2010-10-27 Brian Weinstein <bweinstein@apple.com> + + More Windows build fixage. Copy another new header into WebKitOutputDir. + + * win/WebKit2Generated.make: + +2010-10-27 Brian Weinstein <bweinstein@apple.com> + + Windows build fix. Copy a new header into WebKitOutputDir. + + * win/WebKit2Generated.make: + +2010-10-26 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.dumpBackForwardList + https://bugs.webkit.org/show_bug.cgi?id=42322 + rdar://problem/8193631 + + WebKitTestRunner needs to support layoutTestController.clearBackForwardList + https://bugs.webkit.org/show_bug.cgi?id=42333 + rdar://problem/8193643 + + * Shared/API/c/WKBase.h: Added WKBundleBackForwardListRef and + WKBundleBackForwardListItemRef. + + * Shared/API/c/WKURL.cpp: + (WKURLCopyString): Added. + * Shared/API/c/WKURL.h: Added WKURLCopyString. + + * Shared/API/c/cf/WKURLCF.h: Fixed incorrect argument name. + + * Shared/APIObject.h: Added TypeBundleBackForwardList and + TypeBundleBackForwardListItem. + + * Shared/ImmutableArray.h: Marked destructor virtual explicitly. + * Shared/ImmutableDictionary.h: Ditto. + * UIProcess/WebBackForwardListItem.h: Ditto. + * UIProcess/WebContext.h: Ditto. + * UIProcess/WebFrameProxy.h: Ditto. + * UIProcess/WebNavigationData.h: Ditto. + * UIProcess/WebPageNamespace.h: Ditto. + * UIProcess/WebPreferences.h: Ditto. + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h: Ditto. + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: Ditto. + * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: Ditto. + + * UIProcess/WebBackForwardList.cpp: Removed unneeded backListWithLimit + and forwardListWithLimit functions. + (WebKit::WebBackForwardList::clear): Added. + * UIProcess/WebBackForwardList.h: Marked destructor virtual explicitly. + Added clear, removed backListWithLimit and forwardListWithLimit functions. + + * UIProcess/WebPageProxy.cpp: Removed unneeded backForwardBackItem, + backForwardCurrentItem, and backForwardForwardItem functions. + (WebKit::WebPageProxy::backForwardClear): Added. + * UIProcess/WebPageProxy.h: Ditto. + * UIProcess/WebPageProxy.messages.in: Ditto. + + * WebKit2.pro: Added new files. + * WebKit2.xcodeproj/project.pbxproj: Ditto. + * win/WebKit2.vcproj: Ditto. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Added + WKBundleBackForwardListRef and WKBundleBackForwardListItemRef. + + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp: + Started with a copy of from WebKit2/UIProcess/API/C/WKBackForwardList.cpp. + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h: + Started with a copy of WebKit2/UIProcess/API/C/WKBackForwardList.h. + + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp: + Started with a copy of WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp. + * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h: + Started with a copy of WebKit2/UIProcess/API/C/WKBackForwardListItem.h. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetBackForwardList): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Ditto. + + + * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: + Started with a copy of WebKit2/UIProcess/WebBackForwardList.cpp. + * WebProcess/InjectedBundle/InjectedBundleBackForwardList.h: + Started with a copy of WebKit2/UIProcess/WebBackForwardList.h. + + * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp: + Started with a copy of WebKit2/UIProcess/WebBackForwardListItem.cpp. + * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h: + Started with a copy of WebKit2/UIProcess/WebBackForwardListItem.h. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: Removed + many unneeded functions. + (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): + Removed unneeded initialization of m_closed. + (WebKit::WebBackForwardListProxy::addItem): Added a check for + the case of a capacity of 0. + (WebKit::WebBackForwardListProxy::goToItem): Added a check for + when the proxy outlives its page. + (WebKit::WebBackForwardListProxy::itemAtIndex): Ditto. + (WebKit::WebBackForwardListProxy::backListCount): Ditto. + (WebKit::WebBackForwardListProxy::forwardListCount): Ditto. + (WebKit::WebBackForwardListProxy::close): Removed unneeded code + setting m_closed. + (WebKit::WebBackForwardListProxy::isActive): Added. + (WebKit::WebBackForwardListProxy::clear): Added. + + * WebProcess/WebPage/WebBackForwardListProxy.h: Added clear, + isActive, and detach functions. Removed many other unneeded + function and data members. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::~WebPage): Added call to detach on the + back/forward list. + (WebKit::WebPage::backForwardList): Added. + * WebProcess/WebPage/WebPage.h: Added backForwardList function + and m_backForwardList data member. + +2010-10-27 Beth Dakin <bdakin@apple.com> + + Reviewed by Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=48385 Add WebKit + SPI to scale a WebView + -and corresponding- + <rdar://problem/8107667> + + This patch adds SPI to Mac WebKit that scales the page by the given + scale factor. + + Implement scaleWebView(), which tells WebCore::Frame to scale, and + viewScaleFactor() which returns the current scale factor. + * Shared/API/c/WKSharedAPICast.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageScaleWebView): + (WKPageGetViewScaleFactor): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::scaleWebView): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::viewScaleFactor): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaleWebView): + (WebKit::WebPage::viewScaleFactor): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-10-27 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Fix the WebKit2 API tests. + https://bugs.webkit.org/show_bug.cgi?id=48461 + + The API tests were failing because the tests expect to be able to send messages before the + WebProcess finishes launching. + + Instead of dispatching the pending messages in processDidFinishLaunching, dispatch them in + ensureWebProcess but do not make messages pending if the process is launching. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::processDidFinishLaunching): + Move dispatching the pending messages back from here ... + (WebKit::WebContext::ensureWebProcess): + ... to here. + (WebKit::WebContext::postMessageToInjectedBundle): + Check whether the process can send messages in order to determine if a message needs to be + sent later. + + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::canSendMessage): + The WebProcessProxy can send a message if it is valid or if it is launching. + +2010-10-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on downloads + https://bugs.webkit.org/show_bug.cgi?id=48480 + + * WebProcess/Downloads/Download.cpp: + (WebKit::Download::~Download): + Call platformInvalidate(). + + (WebKit::Download::didBegin): + (WebKit::Download::didReceiveData): + (WebKit::Download::didFinish): + Add empty stubs. + + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::startDownload): + Create a Download object and insert it into the m_downloads map. + + * WebProcess/Downloads/cf/DownloadCFNet.cpp: + (WebKit::Download::platformInvalidate): + Add empty stub. + + * WebProcess/Downloads/mac/DownloadMac.mm: + (WebKit::Download::platformInvalidate): + Tell the WKDownloadAsDelegate object that we're being invalidated. + + (-[WKDownloadAsDelegate downloadDidBegin:]): + Call Download::didBegin. + + (-[WKDownloadAsDelegate download:didReceiveDataOfLength:]): + Call Download::didReceiveData. + + (-[WKDownloadAsDelegate downloadDidFinish:]): + Call Download::didFinish. + + * WebProcess/Downloads/qt/DownloadQt.cpp: + (WebKit::Download::platformInvalidate): + Add empty stub. + +2010-10-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebPageProxy::isValid should return false if the page has been explicitly closed + https://bugs.webkit.org/show_bug.cgi?id=48458 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::isValid): + (WebKit::WebPageProxy::relaunch): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::isClosed): + +2010-10-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Begin stubbing out the Download class + https://bugs.webkit.org/show_bug.cgi?id=48447 + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebKit2Prefix.h: + Include WebCore/EmptyProtocolDefinitions.h + + * WebProcess/Downloads/Download.cpp: Added. + * WebProcess/Downloads/Download.h: Added. + + * WebProcess/Downloads/DownloadManager.cpp: + (WebKit::DownloadManager::startDownload): + Create a Download object and start it. + + * WebProcess/Downloads/mac/DownloadMac.mm: Added. + (WebKit::Download::start): + Create an NSURLDownload. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::startDownload): + Ask the download manager to start downloading. + + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + Add new files. + +2010-10-27 Adam Roben <aroben@apple.com> + + Don't allow setting NetscapePlugin::m_isWindowed after NPP_New has + completed + + In Firefox, Chrome, and WebKit1 trying to set this value after NPP_New + does not actually affect whether the plugin is windowed. + + Fixes <http://webkit.org/b/46673> <rdar://problem/8484211> Assertion + failure in NetscapePlugin::platformDestroy when running + plugins/mouse-events.html in WebKit2 on Windows + + Reviewed by Anders Carlsson. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::setIsWindowed): Moved here from the header. + Bail out if m_isStarted is true, indicating that NPP_New has already + finished. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Removed the + implementation of setIsWindowed. + +2010-10-27 Timothy Hatcher <timothy@apple.com> + + Add API for enabling the developer extras (Web Inspector). + + http://webkit.org/b/48439 + + Reviewed by John Sullivan. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetDeveloperExtrasEnabled): + (WKPreferencesGetDeveloperExtrasEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setDeveloperExtrasEnabled): + (WebKit::WebPreferences::developerExtrasEnabled): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2010-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Anders Carlsson. + + Move contentsSizeChange from the UIClient into the PageClient and + and make it a private Qt-only API in the process. + + Make WKPageContentsSizeChangedCallback be a private API + https://bugs.webkit.org/show_bug.cgi?id=48409 + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::didChangeContentsSize): + (QWKPage::QWKPage): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeContentsSize): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + +2010-10-26 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + WebKit2 shouldn't try to send an empty user agent + https://bugs.webkit.org/show_bug.cgi?id=48397 + + Change the check of the custom user agent to an empty check instead of a null check. When the client application + sets a custom user agent and then resets it, the custom user agent is set to an empty string. If all we do + is check for a null string, then we will think we have a custom user agent (which is empty) and send an empty + user agent. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::userAgent): + +2010-10-27 Adam Roben <aroben@apple.com> + + Don't call NPP_GetValue if the plugin didn't provide an implementation + + Fixes <http://webkit.org/b/48433> Crash in + NetscapePlugin::shouldLoadSrcURL when using Shockwave Director 10.3 in + WebKit2 on Windows + + Reviewed by Eric Carlson. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_GetValue): Null-check the getvalue pointer + before using it to call NPP_GetValue. + +2010-10-27 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] Assert due to multiple initialization of WebPlatformStrategies + https://bugs.webkit.org/show_bug.cgi?id=48327 + + We are using the LocalizationStrategy in the UI process + so the previous attempt to fix this (http://trac.webkit.org/changeset/70620) + was wrong. + * UIProcess/API/qt/qwkpage.cpp: + (initializePlatformStrategiesIfNeeded): + Call WebPlatformStrategies::initialize exactly once. + (QWKPagePrivate::QWKPagePrivate): + +2010-10-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] WebKit2 UI process crashes if web process crashes + https://bugs.webkit.org/show_bug.cgi?id=48400 + + Check the success of socket write operations. + Avoids crashing the UI process if web process has crashed. + Qt socket code segfaults when write is called for a socket + that has had an error. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::platformInvalidate): + Reset m_socket after deletion. + + (CoreIPC::Connection::sendOutgoingMessage): + Check error status of write operations and + invalidate socket if writes fail. + +2010-10-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Type mismatch while serializing/deserializing message id size + https://bugs.webkit.org/show_bug.cgi?id=48401 + + Use correct types when reading data from connection buffer. + + The message id is written as uint32_t, thus the buffer size should be + calculated based on sizeof(uint32_t) and not sizeof(MessageID). + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::readyReadHandler): + +2010-10-27 Zalan Bujtas <zbujtas@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + Multiple WebPlatformStrategy initialization triggers assert in WebCore/PlatformStrategies. + Remove the code for now, as it is not used at all. + https://bugs.webkit.org/show_bug.cgi?id=48327 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + +2010-10-26 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fix. + + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + (WebKit::cancelledError): Conditionalize use of CFNetwork calls + and includes. + +2010-10-26 Alexey Proskuryakov <ap@apple.com> + + Build fix. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Modified original file, not its framework + copy this time. + +2010-10-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add DownloadManager class + https://bugs.webkit.org/show_bug.cgi?id=48388 + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Downloads/DownloadManager.cpp: Added. + (WebKit::DownloadManager::shared): + (WebKit::DownloadManager::DownloadManager): + * WebProcess/Downloads/DownloadManager.h: Added. + + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + Add new files. + +2010-10-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass a downloadID to the web process whenever a download is requested + https://bugs.webkit.org/show_bug.cgi?id=48380 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::generateDownloadID): + Generate a unique download ID. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::receivedPolicyDecision): + Pass along a download ID if needed. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::startDownload): + Call the web frame member function. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::WebFrame): + Initialize m_policyDownloadID. + + (WebKit::WebFrame::invalidatePolicyListener): + Reset m_policyDownloadID. + + (WebKit::WebFrame::didReceivePolicyDecision): + Set m_policyDownloadID. + + (WebKit::WebFrame::startDownload): + Assert that m_policyDownloadID is not zero. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceivePolicyDecision): + Pass along the download ID. + + * WebProcess/WebPage/WebPage.messages.in: + Add the download ID. + +2010-10-26 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=48375 + <rdar://problem/8392724> Need delegate calls in PageLoaderClient to indicate if we have + loaded insecure content + + Added the delegate. Just like the bundle version, it misses WebOrigin parameter that Mac + delegate call used to have. It doesn't seem necessary for clients. + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didDisplayInsecureContentForFrame): + (WebKit::WebLoaderClient::didRunInsecureContentForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): + (WebKit::WebPageProxy::didRunInsecureContentForFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame): + (WebKit::InjectedBundlePageLoaderClient::didRunInsecureContentForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::didDisplayInsecureContent): + (WebKit::WebFrameLoaderClient::didRunInsecureContent): + +2010-10-26 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Resource tracking failure when trying to move a frame between documents + https://bugs.webkit.org/show_bug.cgi?id=44713 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::transferLoadingResourceFromPage): + Empty method. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-10-26 Jessie Berlin <jberlin@apple.com> + + Reviewed by Darin Adler. + + Post any pending messages to the Injected Bundle in WebContext::processDidFinishLaunching + instead of in WebContext::ensureWebProcess. + https://bugs.webkit.org/show_bug.cgi?id=48367 + + Send pending injected bundle messages after the process finished launching instead of of + directly after creating it. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Move the logic to dispatch pending injected bundle messages from here ... + (WebKit::WebContext::processDidFinishLaunching): + ... to here. + Also use a reference instead of a pointer when sending the pending messages. + +2010-10-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + pageDidScroll callback should be on the UI process client rather than (or in addition to) the web process client + https://bugs.webkit.org/show_bug.cgi?id=48366 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + Add zero initializer. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::pageDidScroll): + Call the pageDidScroll client function. + + * UIProcess/WebPageProxy.messages.in: + Add PageDidScroll message. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::pageDidScroll): + Send the PageDidScroll message. + +2010-10-26 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Darin Adler. + + Need a way to retrieve custom user agent from a WKPage + https://bugs.webkit.org/show_bug.cgi?id=48360 + <rdar://problem/8466537> + + Add an exported function on WKPage to get the page's custom user agent. + + * UIProcess/API/C/WKPage.cpp: + (WKPageCopyCustomUserAgent): Exported function that returns the custom user + agent. + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): Clear the custom user agent string. + (WebKit::WebPageProxy::processDidCrash): Ditto. + (WebKit::WebPageProxy::setCustomUserAgent): Add a new early return if we're setting + the custom user agent to what it was before, and set the custom user agent member + variable. + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::customUserAgent): Returns the custom user agent. + +2010-10-26 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Support layoutTestController.layerTreeAsText in WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=42145 + + Expose layerTreeAsText() as private API so that + WebKitTestRunner can use it. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyLayerTreeAsText): + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::numberOfActiveAnimations): + (WebKit::WebFrame::layerTreeAsText): + (WebKit::WebFrame::pendingUnloadCount): + * WebProcess/WebPage/WebFrame.h: + +2010-10-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Enable the plug-in process on Mac + https://bugs.webkit.org/show_bug.cgi?id=48350 + + * WebKit2Prefix.h: + Flip the switch and enable the plug-in process on Mac. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformDestroy): + Fix a bogus assert. + +2010-10-26 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement SharedMemory for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=47345 + + Implement unimplemented functions in SharedMemoryQt.cpp. + Rename MappedMemory.h to MappedMemoryPool.h, move MappedMemoryPool.{h|cpp} from + Shared/qt to Platform/qt. Modify affected lines of WebKit2.pro. + Move MappedMemory implementation into MappedMemoryPool. Remove unnecessary + methods of MappedMemoryPool. + + * Platform/SharedMemory.h: Add a handle member for Qt. + * Platform/qt/MappedMemoryPool.cpp: Copied from WebKit2/Shared/qt/MappedMemoryPool.cpp. + (WebKit::MappedMemoryPool::searchForMappedMemory): + (WebKit::MappedMemoryPool::mapMemory): + (WebKit::MappedMemoryPool::mapFile): + * Platform/qt/MappedMemoryPool.h: Copied from WebKit2/Shared/qt/MappedMemory.h. + (WebKit::MappedMemoryPool::MappedMemory::mapSize): + (WebKit::MappedMemoryPool::MappedMemory::markUsed): + (WebKit::MappedMemoryPool::MappedMemory::markFree): + (WebKit::MappedMemoryPool::MappedMemory::isFree): + (WebKit::MappedMemoryPool::MappedMemory::data): + (WebKit::MappedMemoryPool::MappedMemoryPool): + Move MappedMemory implementation into MappedMemoryPool. + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::Handle::Handle): Implement. + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::isNull): Implement. + (WebKit::SharedMemory::Handle::encode): Implement. + (WebKit::SharedMemory::Handle::decode): Implement. + (WebKit::SharedMemory::create): Implement. + (WebKit::mapProtection): Added. + (WebKit::SharedMemory::~SharedMemory): Implement. + (WebKit::SharedMemory::createHandle): Implement. + (WebKit::SharedMemory::systemPageSize): Implement. + * Shared/qt/MappedMemory.h: Removed. + * Shared/qt/MappedMemoryPool.cpp: Removed. + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::decode): + Modify to use MappedMemoryPool. + * Shared/qt/UpdateChunk.h: + * WebKit2.pro: + Modify affected lines. + +2010-10-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebKit2 callbacks for findString() and countMatchesForString() should report whether the match count was exceeded + https://bugs.webkit.org/show_bug.cgi?id=48285 + <rdar://problem/8576318> + + * UIProcess/API/C/WKPage.h: + Add a kWKMoreThanMaximumMatchCount constant. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + If we get back more matches than allowed, send kWKMoreThanMaximumMatchCount as the match constant. + +2010-10-25 Dan Bernstein <mitz@apple.com> + + Non-Carbon build fix. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::windowFrameChanged): + +2010-10-25 Timothy Hatcher <timothy@apple.com> + + Stub out WebInspector objects and WKInspectorRef API. + + https://webkit.org/b/48265 + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/MessageID.h: Added MessageClassWebInspector and MessageClassWebInspectorProxy. + * Shared/API/c/WKBase.h: Added WKInspectorRef. + * Shared/APIObject.h: Added TypeInspector. + * UIProcess/API/C/WKAPICast.h: Added WKInspectorRef to WebInspectorProxy mapping. + * UIProcess/API/C/WKInspector.cpp: Added. + (WKInspectorGetTypeID): + (WKInspectorGetPage): + * UIProcess/API/C/WKInspector.h: Added. + * UIProcess/API/C/WKPage.cpp: + (WKPageGetInspector): Added. + * UIProcess/API/C/WKPage.h: + * UIProcess/WebInspectorProxy.cpp: Added. + (WebKit::WebInspectorProxy::WebInspectorProxy): + (WebKit::WebInspectorProxy::~WebInspectorProxy): + (WebKit::WebInspectorProxy::invalidate): + * UIProcess/WebInspectorProxy.h: + (WebKit::WebInspectorProxy::create): + (WebKit::WebInspectorProxy::page): + (WebKit::WebInspectorProxy::type): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::inspector): Lazily create the WebInspectorProxy. + * UIProcess/WebPageProxy.h: + * WebKit2.pro: Added new files. + * WebKit2.xcodeproj/project.pbxproj: Added new files. + * WebProcess/WebPage/WebInspector.cpp: Added. + (WebKit::WebInspector::WebInspector): + * WebProcess/WebPage/WebInspector.h: Added. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::inspector): Lazily create the WebInspector. + * WebProcess/WebPage/WebPage.h: + * win/WebKit2.vcproj: Added new files. + +2010-10-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Update the fake Carbon window when the window frame changes + https://bugs.webkit.org/show_bug.cgi?id=48273 + + * UIProcess/API/mac/WKView.mm: + (screenForWindow): + (-[WKView _updateWindowFrame]): + Pass the window frame in Carbon coordinates. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::windowFrameChanged): + Update the window bounds. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::setWindowFrame): + Call the plug-in. + + (WebKit::PluginView::platformLayer): + Fix a crash when WebCore asked for the layer before it was initialized. + +2010-10-25 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Remove exec and globalData arguments from jsNumber + https://bugs.webkit.org/show_bug.cgi?id=48270 + + Mechanical removal of exec parameter to jsNumber + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue): + +2010-10-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Replace matchCountDidChange with didFindString/didFailToFindString + https://bugs.webkit.org/show_bug.cgi?id=48262 + <rdar://problem/8568928> + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebFindClient.cpp: + (WebKit::WebFindClient::didFindString): + (WebKit::WebFindClient::didFailToFindString): + * UIProcess/WebFindClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didFindString): + (WebKit::WebPageProxy::didFailToFindString): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + +2010-10-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a pageDidScroll BundleUIClient callback + https://bugs.webkit.org/show_bug.cgi?id=48260 + <rdar://problem/8531159> + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::pageDidScroll): + Call the pageDidScroll callback. + + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::invalidateContentsForSlowScroll): + (WebKit::WebChromeClient::scroll): + Call pageDidScroll. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::pageDidScroll): + Hide the find banner UI and call the BundleUIClient pageDidScroll callback. + +2010-10-25 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Control + Mousewheel shouldn't be handled in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=48253 + + Don't handle a wheel event if Control is pressed, pass the message back to DefWindowProc. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onWheelEvent): + +2010-10-25 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + cancelledError for WebKit2 on windows should use kCFErrorDomainCFNetwork instead of webKitErrorDomain + https://bugs.webkit.org/show_bug.cgi?id=48254 + + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + (WebKit::cancelledError): Use kCFErrorDomainCFNetwork instead of webKitErrorDomain and switch over + to using kCFURLErrorCancelled instead of a hard coded constant. + +2010-10-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Need WebKit2 API to figure out if a frame can provide source + <rdar://problem/8424632> + https://bugs.webkit.org/show_bug.cgi?id=48252 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCanProvideSource): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::canProvideSource): + * UIProcess/WebFrameProxy.h: + Add API to figure out if a frame can provide source based on its + MIME type. + +2010-10-25 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Java applets don't display on the page + https://bugs.webkit.org/show_bug.cgi?id=48251 + <rdar://problem/8483759> + + Add WKPreferencesSetJavaEnabled and initialize it to true by default, matching old WebKit. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + Initialize javaEnabled. + + (WebKit::WebPreferencesStore::encode): + Encode javaEnabled. + + (WebKit::WebPreferencesStore::decode): + Decode javaEnabled. + + * Shared/WebPreferencesStore.h: + Add javaEnabled. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPReferencesSetJavaEnabled): + (WKPReferencesGetJavaEnabled): + Call the WebPreferences functions. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createJavaAppletWidget): + Just call createPlugin. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Call Settings::setJavaEnabled. + +2010-10-25 Patrick Gansterer <paroga@webkit.org> + + Reviewed by David Kilzer. + + Replace _countof with WTF_ARRAY_LENGTH + https://bugs.webkit.org/show_bug.cgi?id=48229 + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::launchProcess): + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::safariPluginsDirectory): + (WebKit::addMozillaPluginDirectories): + (WebKit::addWindowsMediaPlayerPluginDirectory): + (WebKit::addAdobeAcrobatPluginDirectory): + (WebKit::addMacromediaPluginDirectories): + (WebKit::addPluginPathsFromRegistry): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::interpretKeyEvent): + +2010-10-25 Adam Roben <aroben@apple.com> + + Stop copying .messages.in files into WebKit2's framework bundle + + Fixes <http://webkit.org/b/48232> Several .messages.in files end up in + WebKit2's framework bundle + + Reviewed by Dan Bernstein. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-10-25 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] Fix the WebKit2 build after sheriffbot messed up the rollout patch. + https://bugs.webkit.org/show_bug.cgi?id=48238 + + * Shared/qt/MappedMemory.h: Renamed from WebKit2/Platform/qt/MappedMemoryPool.h. + (WebKit::MappedMemory::mapSize): + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::isFree): + (WebKit::MappedMemory::data): + +2010-10-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r70450. + http://trac.webkit.org/changeset/70450 + https://bugs.webkit.org/show_bug.cgi?id=48238 + + Causes WTR to crash on tests which use SharedMemory. + (Requested by bbandix on #webkit). + + * Platform/SharedMemory.h: + * Platform/qt/MappedMemoryPool.cpp: Removed. + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::Handle::Handle): + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + (WebKit::SharedMemory::create): + (WebKit::SharedMemory::~SharedMemory): + (WebKit::SharedMemory::createHandle): + (WebKit::SharedMemory::systemPageSize): + * Shared/qt/MappedMemory.h: Renamed from WebKit2/Platform/qt/MappedMemoryPool.h. + (WebKit::MappedMemory::mapSize): + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::isFree): + (WebKit::MappedMemory::data): + * Shared/qt/MappedMemoryPool.cpp: Added. + (WebKit::MappedMemoryPool::MappedMemoryPool): + (WebKit::MappedMemoryPool::instance): + (WebKit::MappedMemoryPool::size): + (WebKit::MappedMemoryPool::at): + (WebKit::MappedMemoryPool::append): + (WebKit::MappedMemoryPool::cleanUp): + * Shared/qt/UpdateChunk.cpp: + (WebKit::mapMemory): + (WebKit::mapFile): + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::decode): + * Shared/qt/UpdateChunk.h: + * WebKit2.pro: + +2010-10-25 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement SharedMemory for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=47345 + + Implement unimplemented functions in SharedMemoryQt.cpp. + Rename MappedMemory.h to MappedMemoryPool.h, move MappedMemoryPool.{h|cpp} from + Shared/qt to Platform/qt. Modify affected lines of WebKit2.pro. + Move MappedMemory implementation into MappedMemoryPool. Remove unnecessary + methods of MappedMemoryPool. + + * Platform/SharedMemory.h: Add a handle member for Qt. + * Platform/qt/MappedMemoryPool.cpp: Copied from WebKit2/Shared/qt/MappedMemoryPool.cpp. + (WebKit::MappedMemoryPool::searchForMappedMemory): + (WebKit::MappedMemoryPool::mapMemory): + (WebKit::MappedMemoryPool::mapFile): + * Platform/qt/MappedMemoryPool.h: Copied from WebKit2/Shared/qt/MappedMemory.h. + (WebKit::MappedMemoryPool::MappedMemory::mapSize): + (WebKit::MappedMemoryPool::MappedMemory::markUsed): + (WebKit::MappedMemoryPool::MappedMemory::markFree): + (WebKit::MappedMemoryPool::MappedMemory::isFree): + (WebKit::MappedMemoryPool::MappedMemory::data): + (WebKit::MappedMemoryPool::MappedMemoryPool): + Move MappedMemory implementation into MappedMemoryPool. + * Platform/qt/SharedMemoryQt.cpp: + (WebKit::SharedMemory::Handle::Handle): Implement. + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::isNull): Implement. + (WebKit::SharedMemory::Handle::encode): Implement. + (WebKit::SharedMemory::Handle::decode): Implement. + (WebKit::SharedMemory::create): Implement. + (WebKit::mapProtection): Added. + (WebKit::SharedMemory::~SharedMemory): Implement. + (WebKit::SharedMemory::createHandle): Implement. + (WebKit::SharedMemory::systemPageSize): Implement. + * Shared/qt/MappedMemory.h: Removed. + * Shared/qt/MappedMemoryPool.cpp: Removed. + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::decode): + Modify to use MappedMemoryPool. + * Shared/qt/UpdateChunk.h: + * WebKit2.pro: + Modify affected lines. + +2010-10-24 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Need a way to determine the screen rect for a form control in WebKit2 + <rdar://problem/8530670> + https://bugs.webkit.org/show_bug.cgi?id=48216 + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + Add conversion from IntRect to WKRect. + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleGetElementBounds): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::elementBounds): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + Add SPI to get the rect in window space. The client can then convert this to screen + space if they wish to. + +2010-10-23 Xan Lopez <xlopez@igalia.com> + + Reviewed by Sam Weinig. + + Unify globalData APIs + https://bugs.webkit.org/show_bug.cgi?id=47969 + + Adapt code to JSGlobalObject::globalData returning a reference + instead of a pointer. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::getOrCreateJSObject): + (WebKit::NPRuntimeObjectMap::evaluate): + +2010-10-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=48083 + <rdar://problem/8489082> Need WebKit2 API for private browsing (48083) + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): + Initialize the new method. + +2010-10-21 Timothy Hatcher <timothy@apple.com> + + Stub out WebInspectorFrontendClient. + + https://bugs.webkit.org/show_bug.cgi?id=48091 + + Reviewed by Adam Roben. + + * WebKit2.pro: Added WebInspectorFrontendClient.{cpp,h}. + * WebKit2.xcodeproj/project.pbxproj: Added WebInspectorFrontendClient.{cpp,h}. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: Added. + (WebKit::WebInspectorFrontendClient::windowObjectCleared): Added. + (WebKit::WebInspectorFrontendClient::frontendLoaded): Added. + (WebKit::WebInspectorFrontendClient::moveWindowBy): Added. + (WebKit::WebInspectorFrontendClient::localizedStringsURL): Added. + (WebKit::WebInspectorFrontendClient::hiddenPanels): Added. + (WebKit::WebInspectorFrontendClient::bringToFront): Added. + (WebKit::WebInspectorFrontendClient::closeWindow): Added. + (WebKit::WebInspectorFrontendClient::disconnectFromBackend): Added. + (WebKit::WebInspectorFrontendClient::requestAttachWindow): Added. + (WebKit::WebInspectorFrontendClient::requestDetachWindow): Added. + (WebKit::WebInspectorFrontendClient::changeAttachedWindowHeight): Added. + (WebKit::WebInspectorFrontendClient::inspectedURLChanged): Added. + (WebKit::WebInspectorFrontendClient::sendMessageToBackend): Added. + * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: Added. + (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient): Added. + * win/WebKit2.vcproj: Added WebInspectorFrontendClient.{cpp,h}. + +2010-10-21 Timothy Hatcher <timothy@apple.com> + + Remove stale stubs that are not longer part of InspectorClient. + + https://bugs.webkit.org/show_bug.cgi?id=48090 + + Reviewed by Adam Roben. + + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorClient.h: + +2010-10-22 Andy Estes <aestes@apple.com> + + Reviewed by Adam Roben and Sam Weinig. + + WebKit shouldn't load a plug-in based on file extension if a MIME type + is specified. + https://bugs.webkit.org/show_bug.cgi?id=48046 + + The fix landed in r70332 only covered the Mac port. Implement this fix + for WebKit2 as well. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::findPlugin): + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Fix clang++ build. + + * Scripts/webkit2/messages.py: + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::didRelaunchProcess): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::didRelaunchProcess): + * UIProcess/win/WebView.h: + * WebKit2.xcodeproj/project.pbxproj: + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebContext::ensureWebProcess shouldn't send multiple InitializeWebProcess messages. + https://bugs.webkit.org/show_bug.cgi?id=48158 + <rdar://problem/8512572> + + If the web process was launching when another call to ensureWebProcess is sent, we + would end up sending another InitializeWebProcess message to it which would result + in assertions firing. Fix this by only checking for m_process, and not requiring a process + to be valid (which it won't be until it's finished launching). + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename revive to relaunch everywhere. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::didRelaunchProcess): + * UIProcess/API/mac/WKView.mm: + (-[WKView _didRelaunchProcess]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::relaunchProcessIfNecessary): + * UIProcess/WebContext.h: + * UIProcess/WebPageNamespace.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::relaunch): + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::loadURLRequest): + * UIProcess/WebPageProxy.h: + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Fix assert when a NetscapePluginModule loses its last NetscapePlugin. + https://bugs.webkit.org/show_bug.cgi?id=48155 + + (The assert in question is ASSERT(pluginModuleIndex != notFound) in + NetscapePluginModule::shutdown()). + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::pluginCreated): + If we didn't have any live plug-ins, load the plug-in module. + + (WebKit::NetscapePluginModule::pluginDestroyed): + If this was the last plug-in, unload the plug-in module. + + (WebKit::NetscapePluginModule::shutdown): + Set m_isInitialized to false. + + (WebKit::NetscapePluginModule::load): + Don't do anything if the plug-in module has already been initialized. + + (WebKit::NetscapePluginModule::unload): + Assert that we're not initialized. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + Assert that we successfully created the window. + +2010-10-22 Jessie Berlin <jberlin@apple.com> + + Reviewed by Anders Carlsson. + + Crash in Connection::isValid when called in response to + VisitedLinksProvider::pendingVisitedLinksTimerFired after WebProcessProxy::didClose was + already called. + https://bugs.webkit.org/show_bug.cgi?id=48153 + + * UIProcess/VisitedLinkProvider.cpp: + (WebKit::VisitedLinkProvider::stopVisitedLinksTimer): + * UIProcess/VisitedLinkProvider.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::processDidClose): + Stop the pendingVisitedLinksTimer and null out the process. + * UIProcess/WebContext.h: + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didClose): + Tell the WebContext that the WebProcess did close. + +2010-10-22 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * UIProcess/API/qt/ClientImpl.h: + +2010-10-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 needs to pass the current event modifier flags when requesting a new window + https://bugs.webkit.org/show_bug.cgi?id=48140 + + In addition to passing modifier flags from the now passed NavigationAction, also pass + the WindowFeatures to the UIProcess. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebEvent.h: + (WebKit::WebEvent::modifiers): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::createNewPage): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::createNewPage): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createWindow): + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchCreatePage): + (WebKit::modifiersForNavigationAction): + (WebKit::mouseButtonForNavigationAction): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-10-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename processDidExit to processDidCrash + https://bugs.webkit.org/show_bug.cgi?id=48146 + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::processDidCrash): + * UIProcess/API/mac/WKView.mm: + (-[WKView _processDidCrash]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::processDidCrash): + * UIProcess/PageClient.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::processDidBecomeUnresponsive): + (WebKit::WebLoaderClient::processDidBecomeResponsive): + (WebKit::WebLoaderClient::processDidCrash): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::processDidBecomeUnresponsive): + (WebKit::WebPageProxy::processDidBecomeResponsive): + (WebKit::WebPageProxy::processDidCrash): + * UIProcess/WebPageProxy.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didClose): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::processDidCrash): + * UIProcess/win/WebView.h: + +2010-10-22 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Corrected target dependencies. + + * WebKit2.xcodeproj/project.pbxproj: Made WebKit2 depend on DerivedSources and removed + the explicit dependency of All on DerivedSources and WebKit2, since WebProcess depends on + them. + +2010-10-20 Jon Honeycutt <jhoneycutt@apple.com> + + <rdar://problem/8423766> Cursor does not become "busy" when a page is + loading with WebKit2 + + Reviewed by Sam Weinig. + + * UIProcess/API/C/win/WKViewPrivate.cpp: Added. + (WKViewSetOverrideCursor): + Call the WebView's setOverrideCursor(). + + * UIProcess/API/C/win/WKViewPrivate.h: Added. + Declare WKViewSetOVerrideCursor(). + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + Initialize new member vars to 0. + (WebKit::WebView::updateNativeCursor): + If there is an override cursor, and the last cursor set from the web + process was the arrow cursor, use the override cursor. Otherwise, use + the cursor from the web process. + (WebKit::WebView::setCursor): + Record the web process's cursor, and call updateNativeCursor(). + (WebKit::WebView::setOverrideCursor): + Record the override cursor, and call updateNativeCursor(). + + * UIProcess/win/WebView.h: + Declare setOverrideCursor() and updateNativeCursor(). Add members to + hold the last cursor set from the web process and the override cursor. + + * win/WebKit2.vcproj: + Add new files to project. + + * win/WebKit2Generated.make: + Copy WKViewPrivate.h with other headers. + +2010-10-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Crash evaluating JavaScript string that throws an exception + https://bugs.webkit.org/show_bug.cgi?id=48092 + <rdar://problem/8487657> + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::sendMessage): + m_connection can be null here; just return false if that is the case. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::runJavaScriptInMainFrame): + If the JSValue returned is null we just send along a null string. + +2010-10-21 Adam Roben <aroben@apple.com> + + Invalidate the plugin's HWND when NPN_InvalidateRect is called + + Fixes <http://webkit.org/b/48086> <rdar://problem/8482944> Silverlight + doesn't repaint in WebKit2 + + Reviewed by Anders Carlsson. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::invalidate): Call platformInvalidate before + invalidating via the PluginController. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added platformInvalidate. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformInvalidate): + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + (WebKit::NetscapePlugin::platformInvalidate): + Stubbed out. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::platformInvalidate): If the plugin is + windowed, invalidate its HWND via ::InvalidateRect. + +2010-10-21 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Find indicator does not draw found text in WebKit2 when page is not scrolled to top + <rdar://problem/8562647> + https://bugs.webkit.org/show_bug.cgi?id=48089 + + We always want the selection rectangle in "WebCore window coordinates" which is the same + as WKView coordinates in WebKit2. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::updateFindIndicator): + +2010-10-21 Anders Carlsson <andersca@apple.com> + + Reviewed by David Hyatt. + + Always clear the selection when the find string isn't found + https://bugs.webkit.org/show_bug.cgi?id=48087 + <rdar://problem/8564640> + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + +2010-10-21 Alexey Proskuryakov <ap@apple.com> + + Reviewed by John Sullivan. + + https://bugs.webkit.org/show_bug.cgi?id=48083 + <rdar://problem/8489082> Need WebKit2 API for private browsing + + This just adds glue code for passing the preference from embedder to WebCore. The aspects of + private browsing that WebCore is responsible for do work, but cookies are not handled yet. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetPrivateBrowsingEnabled): + (WKPreferencesGetPrivateBrowsingEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setPrivateBrowsingEnabled): + (WebKit::WebPreferences::privateBrowsingEnabled): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + Do what it takes to pass a single boolean from WebKit2 to WebCore. And we aren't even syncing + the preference to user defaults yet. + +2010-10-20 Adam Roben <aroben@apple.com> + + Ask the UI client to close the page when the WKView receives a WM_CLOSE + message + + Fixes <http://webkit.org/b/48044> <rdar://problem/8488446> Pressing + Ctrl+W when viewing a full-page PDF destroys the WKView but doesn't + close its parent window + + Reviewed by Jon Honeycutt. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): Call through to WebPageProxy::tryClose when + we receive a WM_CLOSE message, rather than passing the message along to + ::DefWindowProcW. tryClose will end up asking the UI client to close + the page, while ::DefWindowProcW would destroy us synchronously without + notifying the UI client at all. One case where we'll get sent a + WM_CLOSE message is when the user presses Ctrl+W when using the Adobe + Reader plugin to view a PDF. + +2010-10-20 Adam Roben <aroben@apple.com> + + Remove confusing and redundant "host window" terminology from WKView on + Windows + + WKView's "host window" is really just its HWND's parent window. The + terminology has been updated to reflect this. The unnecessary + WKViewGetHostWindow function has been removed, as it was a synonym for + ::GetParent(WKViewGetWindow(view)). + + Fixes <http://webkit.org/b/48039> WKView's "host window" API is + confusing + + Reviewed by Sam Weinig. + + * UIProcess/API/C/win/WKView.cpp: + (WKViewCreate): + (WKViewSetParentWindow): + * UIProcess/API/C/win/WKView.h: + Replaced "host window" with "parent window". Removed + WKViewGetHostWindow. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::setParentWindow): + (WebKit::WebView::windowAncestryDidChange): + (WebKit::WebView::close): + * UIProcess/win/WebView.h: + (WebKit::WebView::create): + Replaced "host window" with "parent window". Removed m_hostWindow and + hostWindow(). + +2010-10-21 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Null frame passed when running alert from UserScript run at document start + <rdar://problem/8573809> + https://bugs.webkit.org/show_bug.cgi?id=48036 + + Don't initialize a Frame until after we have notified the UIProcess of its creation. + This is necessary since arbitrary actions can happen during the call to Frame::init() + such as the running of UserScripts. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createFrame): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::createMainFrame): + (WebKit::WebFrame::createSubframe): + (WebKit::WebFrame::create): + (WebKit::WebFrame::WebFrame): + (WebKit::WebFrame::init): + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2010-10-21 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] PluginInfoStore does not set up mime types for plugins + https://bugs.webkit.org/show_bug.cgi?id=48063 + + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::getPluginInfo): Store the mime types + that are supported by the plugin into the plugin argument. + +2010-10-21 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Kenneth Rohde Christiansen. + + This is initial implementation of QWKHistory. The QWKHistory class represents the history of a QWKPage. + https://bugs.webkit.org/show_bug.cgi?id=47716 + + Each QWKPage instance contains a history of a visited pages that can be accessed by QWKHistory::history(). + The QWKPagePrivate class creates QWKHistory in constructor. + + * UIProcess/API/qt/qwkhistory.cpp: Added. + (QWKHistoryPrivate::QWKHistoryPrivate): + (QWKHistoryPrivate::createHistory): Creates history object. + (QWKHistoryPrivate::~QWKHistoryPrivate): + (QWKHistory::QWKHistory): + (QWKHistory::~QWKHistory): + (QWKHistory::backListCount): Gets items count in back. + (QWKHistory::forwardListCount): Gets items count in forward. + (QWKHistory::count): Gets items count. + * UIProcess/API/qt/qwkhistory.h: Added. + * UIProcess/API/qt/qwkhistory_p.h: Added. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::~QWKPagePrivate): + (QWKPage::history): Returns history object. + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: Added history member variable. + * WebKit2.pro: Added WKBackForwardList.h, WKBackForwardList.cpp and new files. + +2010-10-14 Adam Roben <aroben@apple.com> + + Don't require the plugin to always use the same NPP struct we gave it + in NPP_New + + Neither WebCore, nor WebKit/mac, nor Firefox requires this, and + Shockwave (at least) seems to use a different NPP struct that contains + the same ndata member. So we shouldn't enforce it, either. + + Fixes <http://webkit.org/b/47690> <rdar://problem/8553020> Assertion + failure in NetscapePlugin::fromNPP when using Shockwave in WebKit2 + + Reviewed by John Sullivan. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::fromNPP): Removed the bogus assertion. + +2010-10-20 Anders Carlsson <andersca@apple.com> + + Fix clang++ build. + + * UIProcess/API/C/WKNativeEvent.h: + +2010-10-20 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Simon Fraser. + + Crash closing page with <video> element + https://bugs.webkit.org/show_bug.cgi?id=47960 + <rdar://problem/8573297> + + I couldn't think of a good way to make a layout test for this because the + crash isn't triggered by closing an iframe. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::scheduleCompositingLayerSync): NULL check drawingArea(). + +2010-10-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Out of process plug-ins are never asked to initially paint + https://bugs.webkit.org/show_bug.cgi?id=47993 + <rdar://problem/8570342> + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + Add new callMemberFunction overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::paintEntirePlugin): + Set the dirty rect to be the entire plug-in rect and then paint the plug-in. + + * PluginProcess/PluginControllerProxy.messages.in: + Add PaintEntirePlugin message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::PluginProxy): + Initialize m_pluginBackingStoreContainsValidData to false. + + (WebKit::PluginProxy::paint): + If m_pluginBackingStoreContainsValidData is false, synchronously ask the plug-in to paint, + then blit the plug-in backing store into our own backing store. + + (WebKit::PluginProxy::geometryDidChange): + Set m_pluginBackingStoreContainsValidData to false. + + (WebKit::PluginProxy::update): + Set m_pluginBackingStoreContainsValidData to true if the plug-in has painted its entire area. + +2010-10-19 Jessie Berlin <jberlin@apple.com> + + Reviewed by Geoffrey Garen. + + ASSERTION FAILURE: !m_adoptionIsRequired for the WebFrame under the + InjectedBundlePageLoaderClient::didClearWindowObjectForFrame callback. + https://bugs.webkit.org/show_bug.cgi?id=47960 + + Do not try to initialize the coreFrame (which results in the + InjectedBundlePageLoaderClient::didClearWindowObjectForFrame being called) until after the + WebFrame constructor has returned and the WebFrame has been adopted. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::create): + Moved the call to init the coreFrame here ... + (WebKit::WebFrame::WebFrame): + ... from here. + +2010-10-20 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + Merge ColorSpace and ImageColorSpace enums + https://bugs.webkit.org/show_bug.cgi?id=47922 + + Renamed ColorSpace enum entries DeviceColorSpace and sRGBColorSpace to ColorSpaceDeviceRGB and ColorSpaceSRGB + to follow webkit style rules. + + * UIProcess/FindIndicator.cpp: + (WebKit::FindIndicator::draw): + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::drawRect): + +2010-10-20 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. + + Fix Qt/WebKit2 build, also needs a svg/properties include. + + * WebKit2.pro: + +2010-10-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix MiniBrowser crashes during startup and shutdown + https://bugs.webkit.org/show_bug.cgi?id=47954 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::sharedProcessContext): + Initialize the main thread. + + (WebKit::WebContext::create): + Ditto. + + (WebKit::WebContext::WebContext): + Add the language observer here so we know that it will always be set up. + + (WebKit::WebContext::ensureWebProcess): + Remove code. + + * UIProcess/WebContext.h: + +2010-10-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Coalesce plug-in drawing + https://bugs.webkit.org/show_bug.cgi?id=47939 + + Coalesce plug-in drawing in the same manner as we do it in the chunked update drawing area. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::PluginControllerProxy): + Initialize m_waitingForDidUpdate to false. + + (WebKit::PluginControllerProxy::startPaintTimer): + Move code from invalidate out to here. Don't start the paint timer if m_waitingForDidUpdate is true. + + (WebKit::PluginControllerProxy::invalidate): + Call startPaintTimer. + + (WebKit::PluginControllerProxy::didUpdate): + Set m_waitingForDidUpdate to false and start the paint timer. + + * PluginProcess/PluginControllerProxy.messages.in: + Add DidUpdate message. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::PluginProxy): + Initialize m_waitingForPaintInResponseToUpdate to false. + + (WebKit::PluginProxy::paint): + If m_waitingForPaintInResponseToUpdate is true, send a DidUpdate message. + + (WebKit::PluginProxy::update): + Set m_waitingForPaintInResponseToUpdate to true. + +2010-10-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add alternateHTMLString and unreachableURL API to WebKit2 + <rdar://problem/8557864> + https://bugs.webkit.org/show_bug.cgi?id=47938 + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCopyUnreachableURL): + * UIProcess/API/C/WKFrame.h: + Add accessor for the unreachableURL if one is set. It will only be + set during a loadAlternateHTMLString and will be unset on the next normal + didStartProvisionalLoadForFrame call. + + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadHTMLString): Remove whitespace. + (WKPageLoadAlternateHTMLString): + * UIProcess/API/C/WKPage.h: + Add function to load a string as "alternate", meant for use as error pages. + + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::setUnreachableURL): + (WebKit::WebFrameProxy::unreachableURL): + Add setter/getter for the unreachableURL. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadAlternateHTMLString): + Plumb through the call to loadAlternateHTMLString to the WebProcess + and set the main frame's unreachableURL. This does nothing if no pages + have ever been loaded in this page. + + (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): + If this is not a provisional load of substitute data for an unreachableURL + (e.g. someone who called WKPageLoadAlternateHTMLString), reset the + frame's unreachableURL. + + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + Update function signatures. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + Pass whether or not this is a load of SubstituteData for an unreachableURL + to the UIProcess. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadData): + (WebKit::WebPage::loadAlternateHTMLString): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + Plumb through the loading of the alternate HTML string. + +2010-10-19 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=47933 + <rdar://problem/8494337> navigator.language doesn't work in WebKit2 + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + Pass language code when creating a web process. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::~WebContext): Don't send language change notifications to the destroyed + process. + (WebKit::languageChanged): Make web process know about the change. + (WebKit::WebContext::ensureWebProcess): Fill WebProcessCreationParameters, and register for + change notifications. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface): + Initialize wkCopyCFLocalizationPreferredName. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): Use passed in language as an override. Web process + doesn't know about per-application settings, so it depends on UI process for those. + (WebKit::WebProcess::languageChanged): Update the language override when messaged. + + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: + Added LanguageChanged message. + +2010-10-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Stop waiting for sync replies if the connection is closed + https://bugs.webkit.org/show_bug.cgi?id=47930 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::Connection): + Initialize m_shouldWaitForSyncReplies to true. + + (CoreIPC::Connection::sendSyncMessage): + Don't attempt to send a message if m_shouldWaitForSyncReplies is false. + + (CoreIPC::Connection::waitForSyncReply): + Return if m_shouldWaitForSyncReplies was set to false. + + (CoreIPC::Connection::connectionDidClose): + Set m_shouldWaitForSyncReplies to true and signal the semaphore. + + * Platform/CoreIPC/Connection.h: + +2010-10-19 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + (WebKit::interruptForPolicyChangeError): Add a missing comma. + +2010-10-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Part 2 of: + Need to include WKErrorRef in the WKPageDidFail... functions + <rdar://problem/8564110> + https://bugs.webkit.org/show_bug.cgi?id=47871 + + * Shared/API/c/WKError.cpp: + (WKErrorCopyWKErrorDomain): + * Shared/API/c/WKError.h: + * Shared/WebError.cpp: Added. + (WebKit::WebError::webKitErrorDomain): + * Shared/WebError.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: + (+[NSError _webKitErrorWithCode:failingURL:]): + (registerErrors): + (WebKit::blockedError): + (WebKit::cannotShowURLError): + (WebKit::interruptForPolicyChangeError): + (WebKit::cannotShowMIMETypeError): + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + (WebKit::cancelledError): + (WebKit::blockedError): + (WebKit::cannotShowURLError): + (WebKit::interruptForPolicyChangeError): + * win/WebKit2.vcproj: + +2010-10-19 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Need to include WKErrorRef in the WKPageDidFail... functions + <rdar://problem/8564110> + https://bugs.webkit.org/show_bug.cgi?id=47871 + + Give WebError a WebCore::ResourceError backing and start passing it over the wire + for failure cases. Also, fill out the WKError API to include domain, errorCode, + failingURL and localizedDescription. + + * Shared/API/c/WKError.cpp: + (WKErrorCopyDomain): + (WKErrorGetErrorCode): + (WKErrorCopyFailingURL): + (WKErrorCopyLocalizedDescription): + * Shared/API/c/WKError.h: + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toAPI): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebError.h: + (WebKit::WebError::create): + (WebKit::WebError::domain): + (WebKit::WebError::errorCode): + (WebKit::WebError::failingURL): + (WebKit::WebError::localizedDescription): + (WebKit::WebError::platformError): + (WebKit::WebError::WebError): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_didFailProvisionalLoadWithErrorForFrame): + (qt_wk_didFailLoadWithErrorForFrame): + * UIProcess/API/qt/ClientImpl.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::WebLoaderClient::didFailLoadWithErrorForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): + (WebKit::WebPageProxy::didFailLoadForFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFailLoadWithErrorForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + +2010-10-19 Christian Sejersen <christian.webkit@gmail.com> + + Reviewed by Kenneth Rohde Christiansen. + + Scratchbox has an old version of python as the default one, so + force it to use version 2.6. + https://bugs.webkit.org/show_bug.cgi?id=47895 + + * DerivedSources.pro: + +2010-10-19 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] WebKit2 MacOS build fix + https://bugs.webkit.org/show_bug.cgi?id=47897 + + Qt WebKit2 MacOS build fix. + + * UIProcess/WebPageProxy.cpp: + * WebKit2.pri: + * WebKit2.pro: + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Initialize the API client. + + * Shared/APIClient.h: + (WebKit::APIClient::APIClient): + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + WebKit2 should handle dismissing the Find overlay on mouse-down + https://bugs.webkit.org/show_bug.cgi?id=47854 + + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::mouseEvent): + Dismiss the find UI on MouseDown. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::mouseEvent): + If there's a page overlay, let it have a go at the event. + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Fix clang build. + + * UIProcess/API/mac/FindIndicatorWindow.mm: + (-[WebFindIndicatorWindowAnimation _initWithFindIndicatorWindow:WebKit::animationProgressCallback:WebKit::FindIndicatorWindow::animationDidEndCallback:WebKit::FindIndicatorWindow::]): + (WebKit::FindIndicatorWindow::setFindIndicator): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPopupMenuProxy.h: + * WebProcess/WebCoreSupport/WebPopupMenu.h: + +2010-10-18 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * WebKit2.pro: + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Don't try to change accelerated compositing mode if the web page is closed + https://bugs.webkit.org/show_bug.cgi?id=47852 + + changeAcceleratedCompositingMode ends up sending a sync message to the UI process which is unnecessary if + the UI process is being torn down. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::changeAcceleratedCompositingMode): + (WebKit::WebPage::close): + * WebProcess/WebPage/WebPage.h: + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8036034> + WebKit2's WebProcess dies immediately on Mac due to DYLD_FRAMEWORK_PATH problem + + Pass the path to the WebKit2 framework along to the web process and don't rely on DYLD_FRAMEWORK_PATH being set. + + * Shared/mac/CommandLineMac.cpp: + (WebKit::CommandLine::parse): + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + * mac/MainMac.cpp: + (main): + +2010-10-18 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Need a WebKit2 equivalent of the WebKit1 WebUserContentURLPattern. + https://bugs.webkit.org/show_bug.cgi?id=47783 + + * Shared/API/c/WKBase.h: + + * Shared/API/c/WKSharedAPICast.h: + + * Shared/API/c/WKUserContentURLPattern.cpp: Added. + (WKUserContentURLPatternGetTypeID): + (WKUserContentURLPatternCreate): + (WKUserContentURLPatternMatchesURL): + * Shared/API/c/WKUserContentURLPattern.h: Added. + + * Shared/APIObject.h: + + * Shared/UserMessageCoders.h: + Use the original pattern string to encode and decode a UserContentURLPattern. + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + + * Shared/WebUserContentURLPattern.h: Added. + (WebKit::WebUserContentURLPattern::create): + (WebKit::WebUserContentURLPattern::matchesURL): + Use WebCore::UserContentURLPattern::matches. + (WebKit::WebUserContentURLPattern::patternString): + Expose the pattern string used to create the UserContentURLPattern for the purpose of + encoding and decoding. + (WebKit::WebUserContentURLPattern::WebUserContentURLPattern): + (WebKit::WebUserContentURLPattern::type): + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add WKUserContentURLPattern.h/.cpp and WebUserContentURLPattern.h + + * win/WebKit2Generated.make: + Copy over WKUsercontentURLPattern into the output directory. + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + (WebKit::NetscapePlugin::platformSetFocus): + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add matchCountDidChange callback + https://bugs.webkit.org/show_bug.cgi?id=47840 + + * UIProcess/API/C/WKPage.h: + Add matchCountDidChange WKPageFindClient callback. + + * UIProcess/WebFindClient.cpp: + (WebKit::WebFindClient::matchCountDidChange): + Call the WKPageFindClient callback. + + * UIProcess/WebPageProxy.messages.in: + Add MatchCountDidChange message. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::countStringMatches): + Move code here from WebPage. + + (WebKit::FindController::findString): + Send the MatchCountDidChange message. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::countStringMatches): + Move this code over to FindController. + +2010-10-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Use nullptr instead of 0. + + * UIProcess/API/mac/FindIndicatorWindow.mm: + (WebKit::FindIndicatorWindow::closeWindow): + * UIProcess/API/mac/WKView.mm: + (-[WKView renewGState]): + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::removePluginProxy): + +2010-10-15 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::createPopupMenuProxy): + +2010-10-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Popup widget support (<select>) + <rdar://problem/8147746> + https://bugs.webkit.org/show_bug.cgi?id=47740 + + Add initial support for popup menus. Only works on the mac at this time. + + * Shared/WebPopupItem.cpp: Added. + (WebKit::WebPopupItem::WebPopupItem): + (WebKit::WebPopupItem::encode): + (WebKit::WebPopupItem::decode): + * Shared/WebPopupItem.h: Added. + Serializable representation of a menu item. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::createPopupMenuProxy): + Create a WebPopupMenuProxyMac. + + * UIProcess/API/qt/qwkpage.cpp: + (WebView::createPopupMenuProxy): + * UIProcess/API/qt/qwkpage_p.h: + Create a WebPopupMenuProxyQt (which is just a stub right now). + + (WebKit::WebPopupMenuProxyWin::create): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::createPopupMenuProxy): + * UIProcess/win/WebView.h: + Create a WebPopupMenuProxyWin (which is just a stub right now). + + * UIProcess/PageClient.h: + Add new client function to get a platform specific WebPopupMenuProxy. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::showPopupMenu): + (WebKit::WebPageProxy::hidePopupMenu): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + Pipe through calls to set up the menu. + + * UIProcess/mac/WebPopupMenuProxyMac.h: Added. + (WebKit::WebPopupMenuProxyMac::create): + * UIProcess/mac/WebPopupMenuProxyMac.mm: Added. + (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac): + (WebKit::WebPopupMenuProxyMac::~WebPopupMenuProxyMac): + (WebKit::WebPopupMenuProxyMac::populate): + (WebKit::WebPopupMenuProxyMac::showPopupMenu): + (WebKit::WebPopupMenuProxyMac::hidePopupMenu): + Add UI process side implementation. Currently this does not support + custom fonts as the old implementation did. + + * UIProcess/qt/WebPopupMenuProxyQt.cpp: Added. + (WebKit::WebPopupMenuProxyQt::WebPopupMenuProxyQt): + (WebKit::WebPopupMenuProxyQt::~WebPopupMenuProxyQt): + (WebKit::WebPopupMenuProxyQt::showPopupMenu): + (WebKit::WebPopupMenuProxyQt::hidePopupMenu): + * UIProcess/qt/WebPopupMenuProxyQt.h: Added. + (WebKit::WebPopupMenuProxyQt::create): + * UIProcess/win/WebPopupMenuProxyWin.cpp: Added. + (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin): + (WebKit::WebPopupMenuProxyWin::~WebPopupMenuProxyWin): + (WebKit::WebPopupMenuProxyWin::showPopupMenu): + (WebKit::WebPopupMenuProxyWin::hidePopupMenu): + * UIProcess/win/WebPopupMenuProxyWin.h: Added. + Add stubbed out implementations for Qt and windows. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createPopupMenu): + (WebKit::WebChromeClient::createSearchPopupMenu): + Pass the page in the create function. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::create): + (WebKit::WebPopupMenu::WebPopupMenu): + (WebKit::WebPopupMenu::didChangeSelectedIndex): + (WebKit::WebPopupMenu::populateItems): + (WebKit::WebPopupMenu::show): + (WebKit::WebPopupMenu::hide): + * WebProcess/WebCoreSupport/WebPopupMenu.h: + (WebKit::WebPopupMenu::disconnectFromPage): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: + (WebKit::WebSearchPopupMenu::create): + (WebKit::WebSearchPopupMenu::WebSearchPopupMenu): + (WebKit::WebSearchPopupMenu::popupMenu): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): + (WebKit::WebPage::setActivePopupMenu): + (WebKit::WebPage::didChangeSelectedIndexForActivePopupMenu): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + Pipe through calls to set up the menu. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/API/mac/FindIndicatorWindow.mm: + (-[WebFindIndicatorWindowAnimation setCurrentProgress:]): + +2010-10-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Add 'didDraw' callback for framerate tracking + https://bugs.webkit.org/show_bug.cgi?id=47478 + + Hook up the 'didDraw' callback for WebKit2 on Mac. + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView drawRect:]): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didDraw): + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::didDraw): + * UIProcess/WebUIClient.h: + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make the find indicator window fade out when requested + https://bugs.webkit.org/show_bug.cgi?id=47747 + + * UIProcess/API/mac/FindIndicatorWindow.h: + * UIProcess/API/mac/FindIndicatorWindow.mm: + Add WebFindIndicatorWindowAnimation - an NSAnimation subclass that takes two + C++ member function pointers and invokes them the animation progress changes and + when the animation stops. + + (-[WebFindIndicatorWindowAnimation setCurrentProgress:]): + Call the _animationProgressCallback. + + (-[WebFindIndicatorWindowAnimation animationDidEnd:]): + Call the _animationDidEndCallback. + + (WebKit::FindIndicatorWindow::FindIndicatorWindow): + Initialize the fade out start timer. + + (WebKit::FindIndicatorWindow::setFindIndicator): + When asked to fade out, we start the fade out timer. + + (WebKit::FindIndicatorWindow::closeWindow): + Stop the fade out timer and the fade out animation. + + (WebKit::FindIndicatorWindow::startFadeOutTimerFired): + Create a fade out animation. + + (WebKit::FindIndicatorWindow::fadeOutAnimationCallback): + Update the window alpha. + + (WebKit::FindIndicatorWindow::fadeOutAnimationDidEnd): + Close the window. + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Move find indicator window logic to WKView + https://bugs.webkit.org/show_bug.cgi?id=47739 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setFindIndicator): + Call -[WKView _setFindIndicator:fadeOut:]. + + * UIProcess/API/mac/WKView.mm: + (-[WKView renewGState]): + Hide the find indicator. + + (-[WKView _setFindIndicator:fadeOut:]): + Move the find indicator logic here. + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Hide the find indicator/overlay when necessary + https://bugs.webkit.org/show_bug.cgi?id=47737 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::invalidateContentsForSlowScroll): + Hide the find indicator. + + (WebKit::WebChromeClient::scroll): + Ditto. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + Hide the find indicator and the find overlay. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + Always hide all previous find matches. Only clear the selection if the string + not found wasn't empty. + + (WebKit::FindController::hideFindUI): + Uninstall the page overlay and hide the find indicator. + + (WebKit::FindController::hideFindIndicator): + Rename resetFindIndicator to hideFindIndicator. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::uninstallPageOverlay): + Invalidate the entire page. + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add FindIndicatorWindow class + https://bugs.webkit.org/show_bug.cgi?id=47731 + + * UIProcess/API/mac/FindIndicatorWindow.h: Added. + * UIProcess/API/mac/FindIndicatorWindow.mm: Added. + (-[WebFindIndicatorView _initWithFindIndicator:WebKit::]): + Initialize the find indicator view. + + (-[WebFindIndicatorView drawRect:]): + Ask the find indicator to draw. + + (-[WebFindIndicatorView isFlipped]): + Return YES. + + (WebKit::FindIndicatorWindow::~FindIndicatorWindow): + Make sure to close the window. + + (WebKit::FindIndicatorWindow::setFindIndicator): + Update the find indicator window. + + (WebKit::FindIndicatorWindow::closeWindow): + Close and release the window. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setFindIndicator): + Create a find indicator window. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/win/WebView.cpp: + +2010-10-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a FindIndicator class + https://bugs.webkit.org/show_bug.cgi?id=47635 + + * Shared/BackingStore.h: + (WebKit::BackingStore::bounds): + New function that returns the bounds of the backing store. + + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setFindIndicator): + Add stub. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::setFindIndicator): + Add stub. + + * UIProcess/FindIndicator.cpp: Added. + * UIProcess/FindIndicator.h: + + * UIProcess/PageClient.h: + Add setFindIndicator client member function. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setFindIndicator): + Call PageClient::setFindIndicator. + + * UIProcess/WebPageProxy.messages.in: + Add a fadeOut boolean to the message. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setFindIndicator): + Add stub. + + * UIProcess/win/WebView.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + (WebKit::FindController::updateFindIndicator): + (WebKit::FindController::resetFindIndicator): + * WebProcess/WebPage/FindController.h: + * win/WebKit2.vcproj: + +2010-10-14 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Plumb accelerated compositing prefs through WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=46860 + <rdar://problem/8495312> + + Wire up the prefs to enable accelerated compositing, and + show debug borders and repaint counters. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferencesPrivate.cpp: + (WKPreferencesSetAcceleratedCompositingEnabled): + (WKPreferencesGetAcceleratedCompositingEnabled): + (WKPreferencesSetCompositingBordersVisible): + (WKPreferencesGetCompositingBordersVisible): + (WKPreferencesSetCompositingRepaintCountersVisible): + (WKPreferencesGetCompositingRepaintCountersVisible): + * UIProcess/API/C/WKPreferencesPrivate.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setAcceleratedCompositingEnabled): + (WebKit::WebPreferences::acceleratedCompositingEnabled): + (WebKit::WebPreferences::setCompositingBordersVisible): + (WebKit::WebPreferences::compositingBordersVisible): + (WebKit::WebPreferences::setCompositingRepaintCountersVisible): + (WebKit::WebPreferences::compositingRepaintCountersVisible): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::preferencesDidChange): + (WebKit::WebPage::updatePreferences): + * WebProcess/WebPage/WebPage.h: + +2010-10-14 Ada Chan <adachan@apple.com> + + Reviewed by Sam Weinig. + + WebKit2: Store the certificate chain in PlatformCertificateInfo. + https://bugs.webkit.org/show_bug.cgi?id=47603 + + * Shared/API/c/win/WKCertificateInfoWin.cpp: + (WKCertificateInfoGetCertificateChainLength): + (WKCertificateInfoGetCertificateContextAtIndex): + * Shared/API/c/win/WKCertificateInfoWin.h: + * Shared/win/PlatformCertificateInfo.cpp: + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): Get the chain context from the response and duplicate the certificate contexts + in the chain to store in m_certificateChain. + (WebKit::PlatformCertificateInfo::~PlatformCertificateInfo): Free all the certificate contexts in the chain. + (WebKit::PlatformCertificateInfo::operator=): Duplicate the certificate contexts from the other PlatformCertificateInfo's certificate chain + to store in m_certificateChain. + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + (WebKit::PlatformCertificateInfo::clearCertificateChain): Free all the certificate contexts in the chain and clear the vector. + * Shared/win/PlatformCertificateInfo.h: + (WebKit::PlatformCertificateInfo::certificateChain): + +2010-10-14 Adam Roben <aroben@apple.com> + + Make sure WebKit2 only loads each plugin once + + Fixes <http://webkit.org/b/47677> <rdar://problem/8552178> WebKit2 can + load the same plugin multiple times + + Reviewed by Sam Weinig. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::addFromVector): Helper function that adds all the elements + from a Vector to a HashSet. + (WebKit::PluginInfoStore::loadPluginsIfNecessary): Put all the plugin + paths into a HashSet, then load the plugins specified in the HashSet. + On Windows, the HashSet is case-insensitive, just like the file + system. + + * UIProcess/Plugins/PluginInfoStore.h: Removed loadPluginsInDirectory, + which is no longer used. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::addPluginPathsFromRegistry): + (WebKit::PluginInfoStore::individualPluginPaths): + Changed to store the paths in a Vector instead of a HashSet now that + loadPluginsIfNecessary will handle duplicates for us. + +2010-10-14 Adam Roben <aroben@apple.com> + + Load plugins that are specified in the MozillaPlugins registry key + + Fixes <http://webkit.org/b/44271> <rdar://problem/8329750> WebKit2 + should load plugins specified in the MozillaPlugins registry key (like + old WebKit does) + + I couldn't think of a good way to test this. + + Reviewed by Steve Falkenburg. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::loadPluginsIfNecessary): Also load plugins + specified by individualPluginPaths. + + * UIProcess/Plugins/PluginInfoStore.h: Added individualPluginPaths and + some comments. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::individualPluginPaths): + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::individualPluginPaths): + Stubbed out. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::addPluginPathsFromRegistry): + (WebKit::PluginInfoStore::individualPluginPaths): + Ported this code from WebCore's PluginDatabaseWin.cpp. I slightly + cleaned it up and changed it to use a case-insensitive hash, since + paths on Windows are case-insensitive. + +2010-10-14 Adam Roben <aroben@apple.com> + + Call ::DefWindowProcW for unhandled key events + + ::DefWindowProcW does important things for at least some key events + (e.g., it generates a WM_SYSCOMMAND message when the Alt key is + released), so we need to make sure to call it when we don't handle key + events. + + Fixes <http://webkit.org/b/47671> <rdar://problem/8435594> Pressing + the Alt key when MiniBrowser's WKView is focused doesn't send focus to + the menu bar + + Reviewed by Steve Falkenburg. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::didNotHandleKeyEvent): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::didNotHandleKeyEvent): + * UIProcess/API/qt/qwkpage_p.h: + Stubbed out didNotHandleKeyEvent. + + * UIProcess/PageClient.h: Added didNotHandleKeyEvent. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveEvent): Tell the PageClient about the + unhandled event. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onKeyEvent): Added a comment. + (WebKit::WebView::didNotHandleKeyEvent): Pass the event to + ::DefWindowProcW. + + * UIProcess/win/WebView.h: Added didNotHandleKeyEvent. + +2010-10-13 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Memory smasher in WebKit2 InjectedBundleHitTestResult::absoluteLinkURL + https://bugs.webkit.org/show_bug.cgi?id=47648 + + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: + (WebKit::InjectedBundleHitTestResult::absoluteLinkURL): + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: Return a String instead of + a const String&. + +2010-10-13 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + PlatformMouseEvents need to contain modifier flags + https://bugs.webkit.org/show_bug.cgi?id=47651 + + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): + Fill in m_modifierFlags. + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Draw the find overlay holes + https://bugs.webkit.org/show_bug.cgi?id=47631 + + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::drawRect): + Draw the white frames and the holes. + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Use WKSI to get wheel event deltas + https://bugs.webkit.org/show_bug.cgi?id=47617 + + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebWheelEvent): + Call WKGetWheelEventDeltas. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + Call InitWebCoreSystemInterface. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + Use dispatch_once. + +2010-10-13 Adam Roben <aroben@apple.com> + + Fix the Cairo build + + * Shared/cairo/BackingStoreCairo.cpp: Added. + (WebKit::BackingStore::createGraphicsContext): + (WebKit::BackingStore::paint): + Stubbed out. + + * win/WebKit2.vcproj: Build BackingStoreCG.cpp in CG builds and + BackingStoreCairo.cpp in Cairo builds. + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Build fix. + + * Shared/cg/BackingStoreCG.cpp: + +2010-10-13 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=43987 + Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder + to construct their internal result string. Remove ScriptString (this is now + redundant). + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send over find indicator information to the UI process + https://bugs.webkit.org/show_bug.cgi?id=47612 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setFindIndicator): + Add stub. + + * UIProcess/WebPageProxy.messages.in: + Add SetFindIndicator. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::FindController): + Initialize m_isShowingFindIndicator. + + (WebKit::FindController::findString): + Update the find indicator if needed. + + (WebKit::FindController::updateFindIndicator): + Compute find indicator information, paint the find indicator text into a + backing store and send it over. + + (WebKit::FindController::resetFindIndicator): + Send a SetFindIndicator message with a null backing store. + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add BackingStoreQt.cpp file with stubbed out BackingStore member functions + https://bugs.webkit.org/show_bug.cgi?id=47614 + + * Shared/BackingStore.h: + Remove unused include. + + * Shared/qt/BackingStoreQt.cpp: Added. + (WebKit::BackingStore::createGraphicsContext): + (WebKit::BackingStore::paint): + + * WebKit2.pro: + Add BackingStore.cpp, BackingStore.h and BackingStoreQt.cpp + +2010-10-13 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fixes after r69538. + + * UIProcess/WebBackForwardList.h: Add missing include directive + for CoreFoundation. + * UIProcess/cf/WebBackForwardListCF.cpp: Add missing include + directives for RetainPtr.h and CoreFoundation. + * UIProcess/cf/WebPageProxyCF.cpp: Add missing include directive + for RetainPtr.h. + +2010-10-13 Adam Roben <aroben@apple.com> + + Start compiling BackingStore on Windows + + Rubber-stamped by Anders Carlsson. + + * win/WebKit2.vcproj: Added BackingStore. + +2010-10-13 Adam Roben <aroben@apple.com> + + Rename BackingStoreMac.mm to BackingStoreCG.cpp + + There's nothing Mac-specific about this file. + + Rubber-stamped by Anders Carlsson. + + * Shared/cg/BackingStoreCG.cpp: Renamed from WebKit2/Shared/mac/BackingStoreMac.mm. + + * WebKit2.xcodeproj/project.pbxproj: Updated for rename. + +2010-10-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Allow all signals to be delivered to the web process + https://bugs.webkit.org/show_bug.cgi?id=47602 + <rdar://problem/8546399> + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + +2010-10-12 Adam Roben <aroben@apple.com> + + Let WebCore handle scrolling when the spacebar is pressed on Windows + + WebCore already has code to do this, and WebKit2 was doing it on + keydown instead of keypress, which caused problems with text fields. + + WebCore's spacebar-handling code is currently compiled out on Mac and + Qt, so we continue to handle spacebar in WebKit2 on those platforms. + + Fixes <http://webkit.org/b/47544> <rdar://problem/8540645> REGRESSION: + Pressing spacebar in a text field in WebKit2 does not insert a space, + scrolls the page instead + + Test: WebKit2/SpacebarScrolling + + Reviewed by Sam Weinig. + + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + Removed handling for spacebar presses. WebCore already does this for + us, and does it better. + +2010-10-12 Jessie Berlin <jberlin@apple.com> + + Reviewed by Jon Honeycutt. + + Add ability for WK2 to set domain relaxation forbidden for a URL scheme. + https://bugs.webkit.org/show_bug.cgi?id=47562 + + Add the schemes for which domain relaxation is forbidden to the + WebProcessCreationParameters. + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + + * UIProcess/API/C/WKContext.cpp: + (WKContextSetDomainRelaxationForbiddenForURLScheme): + * UIProcess/API/C/WKContextPrivate.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Copy over the schemes for which domain relaxation is forbidden to + WebProcessCreationParameters. + (WebKit::WebContext::setDomainRelaxationForbiddenForURLScheme): + Only send a message to the WebProcess if it is valid. + * UIProcess/WebContext.h: + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + Set domain relaxation forbidden for the schemes in + WebProcesCreationParameters.urlSchemesForWhichDomainRelaxationIsForbidden. + (WebKit::WebProcess::setDomainRelaxationForbiddenForURLScheme): + * WebProcess/WebProcess.h: + + * WebProcess/WebProcess.messages.in: + Add the SetDomainRelaxationFobiddenForURLScheme message. + +2010-10-13 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Simplify code generation in WebKit2/DerivedSources.pro + https://bugs.webkit.org/show_bug.cgi?id=47543 + + * DerivedSources.pro: General generator rules added instead of copy/paste code to converge Makefile.DerivedSources. + * WebKit2.pro: PluginProcess' headers and sources added. + +2010-10-13 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use flag instead of magic word to mark memory map free/used + + Original patch by Antti Koivisto. + + * Shared/qt/MappedMemory.h: + (WebKit::MappedMemory::mapSize): + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::isFree): + (WebKit::MappedMemory::data): + * Shared/qt/MappedMemoryPool.cpp: + (WebKit::MappedMemoryPool::cleanUp): + * Shared/qt/UpdateChunk.cpp: + (WebKit::mapMemory): + (WebKit::mapFile): + (WebKit::UpdateChunk::data): + (WebKit::UpdateChunk::decode): + +2010-10-12 Jon Honeycutt <jhoneycutt@apple.com> + + Build fix. Unreviewed. + + * win/WebKit2Generated.make: + Copy over WKBundleHitTestResult.h. + +2010-10-12 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin "Sometimes" Barraclough. + + Add API to get the target frame from a HitTestResult. + + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: + (WKBundleHitTestResultGetFrame): + (WKBundleHitTestResultGetTargetFrame): + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: + (WebKit::InjectedBundleHitTestResult::frame): Rename from webFrame. + (WebKit::InjectedBundleHitTestResult::targetFrame): + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: + +2010-10-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Paint the find overlay background + https://bugs.webkit.org/show_bug.cgi?id=47565 + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::findString): + Don't show the overlay if we have too many matches. + + * WebProcess/WebPage/FindPageOverlay.cpp: + (WebKit::FindPageOverlay::rectsForTextMatches): + Get the rects for all text matches. + + (WebKit::FindPageOverlay::drawRect): + Assert that we're only being called if there are any text matches. + Paint the background. + +2010-10-12 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + When a provisional load fails, the provisional URL returned + from WKFrameCopyProvisionalURL should be empty + <rdar://problem/8540878> + https://bugs.webkit.org/show_bug.cgi?id=47546 + + API Tests: FailedLoad (updated). + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didFailProvisionalLoad): Empty out the provisional URL. + +2010-10-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Start fleshing out find page overlays + https://bugs.webkit.org/show_bug.cgi?id=47559 + + * UIProcess/API/C/WKAPICast.h: + (WebKit::toFindOptions): + Handle the kWKFindOptionsShowFindIndicator flag. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/FindController.cpp: + (WebKit::FindController::FindController): + Initialize the find page overlay. + + (WebKit::FindController::findString): + Hide or show the find page overlay. + + (WebKit::FindController::findPageOverlayDestroyed): + Null out the find page overlay. + + * WebProcess/WebPage/FindPageOverlay.cpp: Added. + * WebProcess/WebPage/FindPageOverlay.h: Added. + Add stubbed out FindPageOverlay class. + + * WebProcess/WebPage/PageOverlay.cpp: Added. + (WebKit::PageOverlay::setPage): + Set the parent web page. + + (WebKit::PageOverlay::setNeedsDisplay): + Invalidate the parent web page. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::drawRect): + If there's a page overlay, ask it to draw on top of the page contents. + + (WebKit::WebPage::installPageOverlay): + Set the page overlay. + + (WebKit::WebPage::uninstallPageOverlay): + Clear the page overlay. + + * win/WebKit2.vcproj: + Add new files. + +2010-10-12 Jessie Berlin <jberlin@apple.com> + + Reviewed by Jon Honeycutt. + + Add ability for WK2 to register a scheme as secure. + https://bugs.webkit.org/show_bug.cgi?id=47557 + + Add the schemes that need to be registered as secure to the WebProcessCreationParameters. + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + + * UIProcess/API/C/WKContext.cpp: + (WKContextRegisterURLSchemeAsSecure): + * UIProcess/API/C/WKContextPrivate.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Copy over the schemes that are to be registered as secure to the + WebProcessCreationParameters. + (WebKit::WebContext::registerURLSchemeAsSecure): + Only send a message to the WebProcess if it is valid. + * UIProcess/WebContext.h: + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + Register the schemes that need to be registered as secure from the + WebProcessCreationParameters. + (WebKit::WebProcess::registerURLSchemeAsSecure): + * WebProcess/WebProcess.h: + + * WebProcess/WebProcess.messages.in: + Add the RegisterURLSchemeAsSecure message. + +2010-10-12 John Sullivan <sullivan@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=47556 + WKBundleNodeHandlePrivate.h should be marked private, not project + + * WebKit2.xcodeproj/project.pbxproj: + Marked WKBundleNodeHandlePrivate.h as private. + +2010-10-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add FindController class + https://bugs.webkit.org/show_bug.cgi?id=47555 + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/FindController.cpp: Added. + (WebKit::FindController::FindController): + (WebKit::FindController::findString): + Ask WebCore to find the given string for us. + + (WebKit::FindController::hideFindUI): + Add stub. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + Initialize the find controller. + + (WebKit::WebPage::findString): + (WebKit::WebPage::hideFindUI): + Call the find controller. + + * win/WebKit2.vcproj: + Add new files. + +2010-10-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Need WebKit2 API to get the cell above a table cell + <rdar://problem/8537111> + https://bugs.webkit.org/show_bug.cgi?id=47532 + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleCopyHTMLTableCellElementCellAbove): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::copyHTMLTableCellElementCellAbove): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + +2010-10-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add BinarySemaphore class to CoreIPC and use it in Connection::waitForSyncReply + https://bugs.webkit.org/show_bug.cgi?id=47526 + + * Platform/CoreIPC/BinarySemaphore.cpp: Added. + * Platform/CoreIPC/BinarySemaphore.h: Added. + Add BinarySemaphore class. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendSyncMessage): + (CoreIPC::Connection::waitForSyncReply): + (CoreIPC::Connection::processIncomingMessage): + Use the binary semaphore and the newly added m_pendingSyncRepliesMutex. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-10-12 Adam Roben <aroben@apple.com> + + Bring WebKit2 .vcproj files up-to-date with reality + + * win/WebKit2.vcproj: + * win/WebKit2Generated.vcproj: + Added missing files, removed non-existent files. + +2010-10-12 Mark Rowe <mrowe@apple.com> + + Fix the 32-bit WebKit2 build. + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Change currentIndex to be of + type CFIndex and specify kCFNumberCFIndexType when calling CFNumberGetValue. This avoids a warning + when comparing currentIndex with another variable of type CFIndex later in the function. + +2010-10-12 Mark Rowe <mrowe@apple.com> + + Fix class vs struct forward declaration issues in WebKit2 observed when using clang. + + * Scripts/webkit2/messages.py: Add WebCore::ViewportArguments to the set of structs. + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.h: + +2010-10-12 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Antti Koivisto. + + [Qt] Adding Qt WebKit2 API for zooming. + https://bugs.webkit.org/show_bug.cgi?id=47539 + + Adding zoom methods to QWKPage. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::textZoomFactor): Added + (QWKPage::setTextZoomFactor): Added + (QWKPage::pageZoomFactor): Added + (QWKPage::setPageZoomFactor): Added + (QWKPage::setPageAndTextZoomFactors): Added + * UIProcess/API/qt/qwkpage.h: + +2010-10-11 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler of the past. + + Address some of Darin's review feedback in https://bugs.webkit.org/show_bug.cgi?id=47354 + that wasn't left till after my original commit. + + * UIProcess/API/C/WKPage.cpp: + (WKPageCopySessionState): Nuke the temporary variable. + * UIProcess/API/C/WKPage.h: + + * UIProcess/WebPageProxy.h: Fix up function declarations. + + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::sessionStateData): Use sizeof(UInt32) instead of 4. + (WebKit::WebPageProxy::restoreFromSessionStateData): Ditto. + +2010-10-11 Brady Eidson <beidson@apple.com> + + Reviewed by BUILD FIX. + + Build fix for Windows in https://bugs.webkit.org/show_bug.cgi?id=47354 + + * UIProcess/cf/WebPageProxyCF.cpp: + (WebKit::WebPageProxy::sessionStateData): Change to use CF APIs that exist on Windows. + (WebKit::WebPageProxy::restoreFromSessionStateData): Ditto. + +2010-10-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WebKit2 equivalents for setValueForUser and setAutofilled + <rdar://problem/8475934> + https://bugs.webkit.org/show_bug.cgi?id=47524 + + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleSetHTMLInputElementValueForUser): + (WKBundleNodeHandleSetHTMLInputElementAutofilled): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser): + (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + +2010-10-11 Brian Weinstein <bweinstein@apple.com> + + Windows build fix. Add a needed include. + + * UIProcess/cf/WebPageProxyCF.cpp: + +2010-10-11 Brian Weinstein <bweinstein@apple.com> + + Windows build fix. Wrap calls to CFSTR in parentheses. + + * UIProcess/cf/WebBackForwardListCF.cpp: + * UIProcess/cf/WebPageProxyCF.cpp: + +2010-10-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to convert from a JSObjectRef back to a WKBundleNodeHandleRef + https://bugs.webkit.org/show_bug.cgi?id=47509 + + Add SPI to convert a JSObjectRef to a WKBundleNodeHandleRef. + + * DerivedSources.pro: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleCreate): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: Added. + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::getOrCreate): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-10-11 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler and Sam Weinig. + + <rdar://problem/8262202> and https://bugs.webkit.org/show_bug.cgi?id=47354 + Need WKPage API for serializing and restoring a page's state + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * WebKit2Prefix.h: Add DEFINE_STATIC_GETTER convenience. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetSessionHistoryURLValueType): + (WKPageCopySessionState): Change to use a filter function to allow the API client to decide what + types of things get serialized as session state. For now it only filters based on URL in + session history entries. + (WKPageRestoreFromSessionState): + * UIProcess/API/C/WKPage.h: + + * UIProcess/WebBackForwardList.h: + (WebKit::WebBackForwardList::restoredCurrentURL): + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::sessionStateData): Leave stubs for non-CF platform builds. + (WebKit::WebPageProxy::restoreFromSessionStateData): Ditto. + * UIProcess/WebPageProxy.h: + + * UIProcess/cf: Added. + * UIProcess/cf/WebBackForwardListCF.cpp: Added. + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Store back/forward list info CF property list style. + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): Restore from that data - but for now we don't + actually put the back/forward list back into place and instead only remember the current URL. + + * UIProcess/cf/WebPageProxyCF.cpp: Added. + (WebKit::WebPageProxy::sessionStateData): Create the sessions state date CF property list style, plus a version header. + (WebKit::WebPageProxy::restoreFromSessionStateData): Restore from that property list style session state data. + +2010-10-11 Adam Roben <aroben@apple.com> + + Implement SharedMemory on Windows + + This makes visited links be colored correctly. + + Fixes <http://webkit.org/b/47499> <rdar://problem/8422725>. + + Reviewed by Anders Carlsson. + + * Platform/SharedMemory.h: Add Windows-specific members to + SharedMemory and SharedMemory::Handle. + + * Platform/win/SharedMemoryWin.cpp: + (WebKit::SharedMemory::Handle::Handle): Initialize our members. + (WebKit::SharedMemory::Handle::~Handle): Close our HANDLE if we have + one. + (WebKit::SharedMemory::Handle::encode): Encode our size, HANDLE, and + PID. Null out our HANDLE member, as it is now the receiving process's + responsibility to close the HANDLE. + (WebKit::SharedMemory::Handle::decode): Copy the handle from the + sending process into the receiving process and close the HANDLE the + sending process gave us. + (WebKit::SharedMemory::create): Map some memory and store it in a new + SharedMemory object. + (WebKit::accessRights): Helper function to convert a + SharedMemory::Protection to a file-mapping access right. + (WebKit::SharedMemory::create): Map the memory represented by the + Handle, and adopt the HANDLE from it. + (WebKit::SharedMemory::~SharedMemory): Clean up our memory mapping. + (WebKit::SharedMemory::createHandle): Give the Handle a copy of our + HANDLE with the specified protection. + +2010-10-11 Adam Roben <aroben@apple.com> + + Make it possible to restart a RunLoop::Timer on Windows + + Fixes <http://webkit.org/b/47505> RunLoop::Timer only ever fires once + on Windows + + Reviewed by Anders Carlsson. + + * Platform/win/RunLoopWin.cpp: + (RunLoop::TimerBase::timerFired): Remove non-repeating timers from the + set of active timers when they fire, just like we do when stopping + them manually. + +2010-10-11 Jessie Berlin <jberlin@apple.com> + + Reviewed by Darin Adler. + + Add Private API for creating a WebKit2 WebSerializedScriptValue from the internal + representation of a WebKit1 WebSerializedJSValue. + https://bugs.webkit.org/show_bug.cgi?id=47439 + + * Shared/API/c/WKSerializedScriptValue.cpp: + (WKSerializedScriptValueCreateWithInternalRepresentation): + Use the existing WebSerializedScriptValue constructor that takes a pointer to the internal + representation (a WebCore::SerializedScriptValue). + * Shared/API/c/WKSerializedScriptValuePrivate.h: + +2010-10-11 Mike Thole <mthole@apple.com> + + Reviewed by Darin Adler. + + Rename WKCertificateInfoGetPeerCertificates() to WKCertificateInfoGetCertificateChain() + https://bugs.webkit.org/show_bug.cgi?id=47495 + + * Shared/API/c/mac/WKCertificateInfoMac.h: + Renamed WKCertificateInfoGetPeerCertificates() to WKCertificateInfoGetCertificateChain() + * Shared/API/c/mac/WKCertificateInfoMac.mm: + (WKCertificateInfoGetCertificateChain): Updated for name change. + * Shared/mac/PlatformCertificateInfo.h: + (WebKit::PlatformCertificateInfo::certificateChain): Renamed from peerCertificates() + * Shared/mac/PlatformCertificateInfo.mm: + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): Updated for name change. + (WebKit::PlatformCertificateInfo::encode): Ditto. + (WebKit::PlatformCertificateInfo::decode): Ditto. + (WebKit::PlatformCertificateInfo::dump): Ditto. + +2010-10-11 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Issue a warning when an InjectedBundle can't be loaded. + https://bugs.webkit.org/show_bug.cgi?id=47497 + + The original author of the patch is Jocelyn Turcotte <jocelyn.turcotte@nokia.com>. + + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + (WebKit::InjectedBundle::load): + +2010-10-11 Sam Weinig <sam@webkit.org> + + Reviewed by Simon Fraser. + + Rename transformToDeviceSpace to convertToDeviceSpace and + transformToUserSpace to convertToUserSpace at Simon's request. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::convertToDeviceSpace): + (WebKit::PageClientImpl::convertToUserSpace): + * UIProcess/API/mac/WKView.mm: + (-[WKView _convertToDeviceSpace:]): + (-[WKView _convertToUserSpace:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::convertToDeviceSpace): + (QWKPagePrivate::convertToUserSpace): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setWindowFrame): + (WebKit::WebPageProxy::getWindowFrame): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::convertToDeviceSpace): + (WebKit::WebView::convertToUserSpace): + * UIProcess/win/WebView.h: + +2010-10-11 Sam Weinig <sam@webkit.org> + + Try to fix the Mac release build. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _transformToDeviceSpace:]): + (-[WKView _transformToUserSpace:]): + * UIProcess/API/mac/WKViewInternal.h: + +2010-10-11 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + WebProcess ASSERTs with a null application cache dir creation parameter + https://bugs.webkit.org/show_bug.cgi?id=47489 + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + +2010-10-11 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Andreas Kling. + + Unlink the files used for I/O mapped memory as soon as they are + created. + + * Shared/qt/UpdateChunk.cpp: + (WebKit::mapMemory): + (WebKit::mapFile): + +2010-10-11 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Rubberstamped by Andreas Kling. + + Build fix when using MeeGo Touch + + * WebProcess/qt/WebProcessMainQt.cpp: + +2010-10-11 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Andreas Kling. + + Use raster for the QtWebProcess. + + * WebProcess/qt/WebProcessMainQt.cpp: + (WebKit::WebProcessMainQt): + +2010-10-11 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Unreviewed win build fix. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + +2010-10-08 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Sam Weinig. + + Adding Qt WebKit2 API for dealing with viewport meta info + https://bugs.webkit.org/show_bug.cgi?id=47202 + + Add new API for setting scale and layout viewport given the data + provided by the viewport meta tag. + + Any Qt view components who wants to support this, will need to + compute the viewport attributes before first load using + viewportAttributesForSize(..), and then again everytime + the viewport attributes gets invalidates (loading a new page, + navigating page cache) or every time on of the browser + attributes change, such as when the device is rotates (which + changes the actual visible viewport). A signal + viewportChangeRequested() is provided for the former. + + * Shared/WebCoreArgumentCoders.h: + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setViewportArguments): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::setViewportArguments): + (QWKPage::ViewportAttributes::ViewportAttributes): + (QWKPage::ViewportAttributes::~ViewportAttributes): + (QWKPage::ViewportAttributes::operator=): + (QWKPage::viewportAttributesForSize): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + (QtViewportAttributesPrivate::QtViewportAttributesPrivate): + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didChangeViewportData): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setViewportArguments): + * UIProcess/win/WebView.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::dispatchViewportDataDidChange): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-10-11 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Andreas Kling. + + [Qt] WebKit2 build scripts are buggy + https://bugs.webkit.org/show_bug.cgi?id=47377 + + Generated sources must depends on WebKit2/Scripts/webkit2/messages.py too. + + * DerivedSources.pro: Missing dependencies added. + +2010-10-09 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + WKFrameGetFrameLoadState() returns kWKFrameLoadStateCommitted after the load has been stopped + <rdar://problem/8173667> + https://bugs.webkit.org/show_bug.cgi?id=47461 + + API Test: WebKit2/FailedLoad + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didFailProvisionalLoad): + (WebKit::WebFrameProxy::didFailLoad): + * UIProcess/WebFrameProxy.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): + (WebKit::WebPageProxy::didFailLoadForFrame): + Set the frame load state to LoadStateFinished for both didFailProvisionalLoadForFrame + and didFailLoadForFrame. + +2010-10-09 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage + <rdar://problem/8447690> + https://bugs.webkit.org/show_bug.cgi?id=47459 + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setWindowFrame): + (WebKit::WebPageProxy::getWindowFrame): + (WebKit::WebPageProxy::canRunBeforeUnloadConfirmPanel): + (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel): + (WebKit::WebUIClient::runBeforeUnloadConfirmPanel): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel): + (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): + Pipe calls through to the UIProcess. + +2010-10-09 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Need implementation of ChromeClient windowRect related functions. + <rdar://problem/8469476> + https://bugs.webkit.org/show_bug.cgi?id=47386 + + * Shared/API/c/WKGeometry.h: Added. + Adds WKPoint, WKSize and WKRect structs. + + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toImpl): + (WebKit::toAPI): + Add conversion functions for WKRect. + + * Shared/WebCoreArgumentCoders.h: + Add encoding for FloatPoint, FloatSize and FloatRect. + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::transformToDeviceSpace): + (WebKit::PageClientImpl::transformToUserSpace): + * UIProcess/API/mac/WKView.mm: + (-[WKView _transformToDeviceSpace:]): + (-[WKView _transformToUserSpace:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::transformToDeviceSpace): + (QWKPagePrivate::transformToUserSpace): + (QWKPage::QWKPage): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setWindowFrame): + (WebKit::WebPageProxy::getWindowFrame): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::setWindowFrame): + (WebKit::WebUIClient::windowFrame): + * UIProcess/WebUIClient.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setEditCommandState): + (WebKit::WebView::transformToDeviceSpace): + (WebKit::WebView::transformToUserSpace): + * UIProcess/win/WebView.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setWindowFrame): + (WebKit::WebChromeClient::windowFrame): + Pipe calls through to the UIProcess, and give ports a chance to transform + the rect (via the PageClient) before it is passed on. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2010-10-07 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Add Private API for creating a WebKit1 WebSerializedJSValue from the internal + representation of a WebKit2 WebSerializedScriptValue. + https://bugs.webkit.org/show_bug.cgi?id=47390 + + * Shared/API/c/WKSerializedScriptValue.cpp: + (WKSerializedScriptValueGetInternalRepresentation): + * Shared/API/c/WKSerializedScriptValuePrivate.h: Added. + + * Shared/WebSerializedScriptValue.h: + (WebKit::WebSerializedScriptValue::internalRepresentation): + Return the WebCore::SerializedScriptValue as a void* so that it can be passed through the + API. + + * WebKit2.xcodeproj/project.pbxproj: + Add WKSerializedScriptValuePrivate.h. + * win/WebKit2.vcproj: + Ditto, also some sorting. + + * win/WebKit2Generated.make: + Copy over WKSerializedScriptValuePrivate.h. + +2010-10-08 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Fix WKStringQt.h and WKURLQt.h API problems. + https://bugs.webkit.org/show_bug.cgi?id=47412 + + * UIProcess/API/cpp/qt/WKStringQt.h: + Remove the extern "C" + * UIProcess/API/cpp/qt/WKURLQt.h: + Remove the extern "C" + * UIProcess/API/qt/qgraphicswkview.h: + Fix the forwarded declaration + +2010-10-08 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Don't use -whole-archive to link-in libWebKit2.a except for libQtWebKit.so + https://bugs.webkit.org/show_bug.cgi?id=47347 + + * WebKit2.pri: + +2010-10-08 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Andreas Kling. + + Notify WebPage when QGraphicsWKView gains focus. Set both + active flag and focused flag, similar to QWebPage behavior. + + [Qt] WebKit2 should support focusing + https://bugs.webkit.org/show_bug.cgi?id=47168 + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::focusInEvent): Added. + (QGraphicsWKView::focusOutEvent): Added. + * UIProcess/API/qt/qgraphicswkview.h: Added declarations. + +2010-10-07 Ivan Krstić <ike@apple.com> + + Reviewed by Mark Rowe. + + <rdar://problem/8349882> Many WebProcess sandbox violations during basic browsing operations. + + * WebProcess/com.apple.WebProcess.sb: + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2010-10-07 Brady Eidson <beidson@apple.com> + + Build fix. + + GCC continued to mask the fact that I still hadn't declared the correct symbol. + + * Platform/Logging.cpp: + (initializeLogChannel): + * Platform/Logging.h: + +2010-10-07 Brian Weinstein <bweinstein@apple.com> + + Build Fix. Fix the vcproj to make it valid and openable by Visual Studio. + + * win/WebKit2.vcproj: + +2010-10-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a WKPageFindClient, hook up WKPageCountStringMatches + https://bugs.webkit.org/show_bug.cgi?id=47373 + + * Shared/APIClient.h: Added. + Add an APIClient class template which can be used to reduce duplicated + code in the client wrappers. + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageFindClient): + Initialize the page find client. + + * UIProcess/API/C/WKPage.h: + * UIProcess/WebFindClient.cpp: Added. + (WebKit::WebFindClient::didCountStringMatches): + Call the WKPageFindClient function. + + * UIProcess/WebFindClient.h: Added. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeFindClient): + Initialize the WebFindClient. + + (WebKit::WebPageProxy::findString): + Send a FindString message. + + (WebKit::WebPageProxy::hideFindUI): + Send a HideFindUI message. + + (WebKit::WebPageProxy::countStringMatches): + Send a CountStringMatches message. + + (WebKit::WebPageProxy::didCountStringMatches): + Call the find client. + + * UIProcess/WebPageProxy.messages.in: + Add new message. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::findString): + (WebKit::WebPage::hideFindUI): + Add stubs. + + (WebKit::WebPage::countStringMatches): + Figure out the number of matches and send them back in the DidCountStringMatches msessage. + + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + Add new messages. + + * win/WebKit2.vcproj: + Add new files. + +2010-10-07 Sam Weinig <sam@webkit.org> + + Update unit tests results. + + * Scripts/webkit2/messages_unittest.py: + +2010-10-07 Brady Eidson <beidson@apple.com> + + Reviewed by BUILD FIX for non-gcc builds. + + * Platform/Logging.cpp: + (initializeLogChannel): GCC optimized out the only caller of this function. Windows doesn't, and is breaking. + +2010-10-07 Darin Adler <darin@apple.com> + + Fix include mistake that makes build fail with non-Objective-C. + + * Shared/API/c/mac/WKCertificateInfoMac.h: Include CoreFoundation.h, + not Foundation.h. + +2010-10-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Generate the messages sent to the WebPageProxy + https://bugs.webkit.org/show_bug.cgi?id=47239 + + * DerivedSources.make: + * DerivedSources.pro: + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + * Scripts/webkit2/messages.py: + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Removed. + * Shared/StringPairVector.h: Added. + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::registerEditCommand): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::registerEditCommand): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebEditCommandProxy.cpp: + (WebKit::WebEditCommandProxy::unapply): + (WebKit::WebEditCommandProxy::reapply): + * UIProcess/WebFormClient.cpp: + (WebKit::WebFormClient::willSubmitForm): + * UIProcess/WebFormClient.h: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: Added. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::registerEditCommand): + * UIProcess/win/WebView.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::registerCommandForUndo): + (WebKit::WebEditorClient::clearUndoRedoOperations): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + * WebProcess/WebPage/WebPage.cpp: + * win/WebKit2.vcproj: + +2010-10-07 Brady Eidson <beidson@apple.com> + + Reviewed by BUILD FIX. + + Forgot this to keep the build working. + + * WebKit2Prefix.h: + +2010-10-07 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Start stubbing out the find API + https://bugs.webkit.org/show_bug.cgi?id=47366 + <rdar://problem/8524998> + + * Shared/FindOptions.h: Added. + * UIProcess/API/C/WKAPICast.h: + (WebKit::toFindDirection): + (WebKit::toFindOptions): + * UIProcess/API/C/WKPage.cpp: + (WKPageFindString): + (WKPageHideFindUI): + (WKPageCountStringMatches): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::findString): + (WebKit::WebPageProxy::hideFindUI): + (WebKit::WebPageProxy::countStringMatches): + * UIProcess/WebPageProxy.h: + +2010-10-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Andras Becsi <abecsi@webkit.org>, Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add WTR's InjectedBundle build files. + https://bugs.webkit.org/show_bug.cgi?id=47333 + + * WebKit2.pro: + +2010-10-07 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Part of https://bugs.webkit.org/show_bug.cgi?id=47354 - Add WebCore/WebKit1 style logging channel mechanism0 to WebKit2, + including the first channel to be used for SessionState work. + + * Platform/Logging.cpp: Added. + (initializeLogChannelsIfNecessary): + * Platform/Logging.h: Added. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-10-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r69315. + http://trac.webkit.org/changeset/69315 + https://bugs.webkit.org/show_bug.cgi?id=47363 + + Forgot to add the new files (Requested by kbalazs on #webkit). + + * WebKit2.pro: + +2010-10-07 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Fixing viewport meta tag user-scalable handling + https://bugs.webkit.org/show_bug.cgi?id=47330 + + user-scalable attribute was not considered in viewport meta tag handling. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::viewportConfigurationForSize): + +2010-10-07 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Andras Becsi <abecsi@webkit.org>, Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add WTR's InjectedBundle build files. + https://bugs.webkit.org/show_bug.cgi?id=47333 + + * WebKit2.pro: + +2010-10-07 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Some viewport meta tag api refactoring + https://bugs.webkit.org/show_bug.cgi?id=47334 + + WebCore::findConfigurationForViewportData renamed to computeViewportAttributes. + WebCore::ViewportAttributes::layoutViewport renamed to layoutSize. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::viewportConfigurationForSize): + +2010-10-06 Jessie Berlin <jberlin@apple.com> + + Reviewed by John Sullivan. + + Bundle should expose a reportException method. + https://bugs.webkit.org/show_bug.cgi?id=46769 + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleReportException): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::reportException): + Mimic the behavior of WebView::reportException. + * WebProcess/InjectedBundle/InjectedBundle.h: + +2010-10-07 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Adam Roben. + + [Qt] Webkit2 MacOS build fix + https://bugs.webkit.org/show_bug.cgi?id=47167 + + There were two problems when building Qt WebKit2 in Mac. The first was that + ld does not support flag -whole-archive and it needed to be replaced by flag -all_load. + The second problem was that __APPLE__ is been used to identify safari builds and, when + building Qt in MacOS, Qt was ending up using the wrong typedef. The solution was to use + a Qt specific WKNativeEvent.h that only has the proper Qt typedef instead of the original one. + + * UIProcess/API/C/qt/WKNativeEvent.h: Added. + * WebKit2.pri: + * WebKit2.pro: + +2010-10-07 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + WebKitTestRunner should be portable + https://bugs.webkit.org/show_bug.cgi?id=45393 + + Introducing additional URL API. + * Shared/API/c/WKURL.cpp: + (WKURLCreateWithUTF8CString): + (WKURLIsEqual): + * Shared/API/c/WKURL.h: + +2010-10-06 Balazs Kelemen <kbalazs@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add WebKitTestRunner's build files + https://bugs.webkit.org/show_bug.cgi?id=44155 + + * DerivedSources.pro: Changes according the new location + of generate-forwarding-headers.pl. + * UIProcess/API/C/WebKit2.h: Do not check the value of the + __APPLE__ define if it is not defined. + * WebKit2.pro: Changes according the new location + of generate-forwarding-headers.pl. Added missing files + to the build that provides API that is used by WTR. + * generate-forwarding-headers.pl: Moved to WebKitTools/Scripts + since from now this is not only used by WebKit2. + +2010-10-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Separate actually calling the member function from decoding/encoding arguments + and remove any ambiguities when calling the function. + + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::callMemberFunction): + (CoreIPC::handleMessage): + +2010-10-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More Arguments.h cleanup. + + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/HandleMessage.h: + Remove unnecessary typedefs, simplify. + + * Scripts/webkit2/messages.py: + * UIProcess/WebContext.h: + Fix clang++ build. + +2010-10-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Start cleaning up Arguments.h + https://bugs.webkit.org/show_bug.cgi?id=47304 + + This is a first step towards simplifying all the handleMessage overloads we have. + + * Platform/CoreIPC/Arguments.h: + (CoreIPC::Arguments1): + Make Arguments1 a struct and get rid of the FirstArgumentType typedef. Instead, add a + ValueType typedef which is defined to an Arguments1 type whose type parameter is not + a reference type. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Update for the Arguments1 change. Rename "arguments" to "argumentDecoder" and "reply" to + "replyEncoder". + +2010-10-06 Andras Becsi <abecsi@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix the build after API changes introduced in r69214. + + * UIProcess/API/cpp/qt/WKStringQt.cpp: + (WKStringCreateWithQString): + * UIProcess/API/cpp/qt/WKURLQt.cpp: + (WKURLCreateWithQUrl): + +2010-10-06 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r69210. + http://trac.webkit.org/changeset/69210 + https://bugs.webkit.org/show_bug.cgi?id=47297 + + This patch broke Windows (Requested by andersca on #webkit). + + * DerivedSources.make: + * DerivedSources.pro: + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + * Scripts/webkit2/messages.py: + * Scripts/webkit2/messages_unittest.py: + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Added. + * Shared/StringPairVector.h: Removed. + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::registerEditCommand): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::registerEditCommand): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebEditCommandProxy.cpp: + (WebKit::WebEditCommandProxy::unapply): + (WebKit::WebEditCommandProxy::reapply): + * UIProcess/WebFormClient.cpp: + (WebKit::WebFormClient::willSubmitForm): + * UIProcess/WebFormClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): + (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): + (WebKit::WebPageProxy::didCommitLoadForFrame): + (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): + (WebKit::WebPageProxy::didFinishLoadForFrame): + (WebKit::WebPageProxy::didFailLoadForFrame): + (WebKit::WebPageProxy::didReceiveTitleForFrame): + (WebKit::WebPageProxy::didFirstLayoutForFrame): + (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): + (WebKit::WebPageProxy::didRemoveFrameFromHierarchy): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + (WebKit::WebPageProxy::decidePolicyForMIMEType): + (WebKit::WebPageProxy::willSubmitForm): + (WebKit::WebPageProxy::createNewPage): + (WebKit::WebPageProxy::runJavaScriptAlert): + (WebKit::WebPageProxy::runJavaScriptConfirm): + (WebKit::WebPageProxy::runJavaScriptPrompt): + (WebKit::WebPageProxy::mouseDidMoveOverElement): + (WebKit::WebPageProxy::contentsSizeChanged): + (WebKit::WebPageProxy::addItemToBackForwardList): + (WebKit::WebPageProxy::goToItemInBackForwardList): + (WebKit::WebPageProxy::registerEditCommandForUndo): + (WebKit::WebPageProxy::registerEditCommandForRedo): + (WebKit::WebPageProxy::didReceiveEvent): + (WebKit::WebPageProxy::didChangeAcceleratedCompositing): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: Removed. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::registerEditCommand): + * UIProcess/win/WebView.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setWindowRect): + (WebKit::WebChromeClient::takeFocus): + (WebKit::WebChromeClient::createWindow): + (WebKit::WebChromeClient::runJavaScriptAlert): + (WebKit::WebChromeClient::runJavaScriptConfirm): + (WebKit::WebChromeClient::runJavaScriptPrompt): + (WebKit::WebChromeClient::setStatusbarText): + (WebKit::WebChromeClient::contentsSizeChanged): + (WebKit::WebChromeClient::mouseDidMoveOverElement): + (WebKit::WebChromeClient::setToolTip): + (WebKit::WebChromeClient::setCursor): + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::registerCommandForUndo): + (WebKit::WebEditorClient::clearUndoRedoOperations): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::detachedFromParent2): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFirstLayout): + (WebKit::WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + (WebKit::WebFrameLoaderClient::postProgressStartedNotification): + (WebKit::WebFrameLoaderClient::postProgressEstimateChangedNotification): + (WebKit::WebFrameLoaderClient::postProgressFinishedNotification): + (WebKit::WebFrameLoaderClient::createFrame): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::addItem): + (WebKit::WebBackForwardListProxy::goToItem): + (WebKit::WebBackForwardListProxy::backItem): + (WebKit::WebBackForwardListProxy::currentItem): + (WebKit::WebBackForwardListProxy::forwardItem): + (WebKit::WebBackForwardListProxy::itemAtIndex): + (WebKit::WebBackForwardListProxy::backListCount): + (WebKit::WebBackForwardListProxy::forwardListCount): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::changeAcceleratedCompositingMode): + (WebKit::WebPage::enterAcceleratedCompositingMode): + (WebKit::WebPage::sendClose): + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + (WebKit::WebPage::validateMenuItem): + (WebKit::WebPage::touchEvent): + (WebKit::WebPage::show): + (WebKit::WebPage::runJavaScriptInMainFrame): + (WebKit::WebPage::getRenderTreeExternalRepresentation): + (WebKit::WebPage::getSourceForFrame): + * win/WebKit2.vcproj: + +2010-10-06 Jessie Berlin <jberlin@apple.com> + + Rubber-stamped by Dan Bernstein. + + WKSerializedScriptValue.h needs to be copied over into the WEBKITOUTPUTDIR on Windows. + https://bugs.webkit.org/show_bug.cgi?id=47287 + + * win/WebKit2Generated.make: + Copy WKSerializedScriptValue.h into $(WEBKITOUTPUTDIR)\include\WebKit2. + +2010-10-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename toRef/toWK to toAPI/toImpl + https://bugs.webkit.org/show_bug.cgi?id=47281 + + * Shared/API/c/WKArray.cpp: + * Shared/API/c/WKCertificateInfo.cpp: + * Shared/API/c/WKData.cpp: + * Shared/API/c/WKDictionary.cpp: + * Shared/API/c/WKError.cpp: + * Shared/API/c/WKMutableArray.cpp: + * Shared/API/c/WKMutableDictionary.cpp: + * Shared/API/c/WKNumber.cpp: + * Shared/API/c/WKSerializedScriptValue.cpp: + * Shared/API/c/WKSharedAPICast.h: + * 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/cf/WKStringCF.cpp: + * Shared/API/c/cf/WKURLCF.cpp: + * Shared/API/c/cf/WKURLRequestCF.cpp: + * Shared/API/c/cf/WKURLResponseCF.cpp: + * Shared/API/c/mac/WKCertificateInfoMac.mm: + * Shared/API/c/mac/WKURLRequestNS.mm: + * Shared/API/c/mac/WKURLResponseNS.mm: + * Shared/API/c/win/WKCertificateInfoWin.cpp: + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBackForwardList.cpp: + * UIProcess/API/C/WKBackForwardListItem.cpp: + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/WKFormSubmissionListener.cpp: + * UIProcess/API/C/WKFrame.cpp: + * UIProcess/API/C/WKFramePolicyListener.cpp: + * UIProcess/API/C/WKNavigationData.cpp: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPageNamespace.cpp: + * UIProcess/API/C/WKPreferences.cpp: + * UIProcess/API/C/WKPreferencesPrivate.cpp: + * UIProcess/API/C/win/WKContextWin.cpp: + * UIProcess/API/C/win/WKView.cpp: + * UIProcess/API/cpp/qt/WKStringQt.cpp: + * UIProcess/API/cpp/qt/WKURLQt.cpp: + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/mac/WKView.mm: + * UIProcess/API/qt/ClientImpl.cpp: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/GenericCallback.h: + * UIProcess/WebContextInjectedBundleClient.cpp: + * UIProcess/WebFormClient.cpp: + * UIProcess/WebHistoryClient.cpp: + * UIProcess/WebLoaderClient.cpp: + * UIProcess/WebPolicyClient.cpp: + * UIProcess/WebUIClient.cpp: + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * 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/WKBundleRangeHandle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: + +2010-10-06 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Renaming WebCore::ViewportConfiguration to WebCore::ViewportAttributes + https://bugs.webkit.org/show_bug.cgi?id=47268 + + Renaming WebCore::ViewportConfiguration to WebCore::ViewportAttributes + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::viewportConfigurationForSize): + +2010-10-06 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Generate the messages sent to the WebPageProxy + https://bugs.webkit.org/show_bug.cgi?id=47239 + + * Platform/CoreIPC/Arguments.h: + Add additional typedefs. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add more handleMessage implementations. + + * Scripts/webkit2/messages.py: + * Scripts/webkit2/messages_unittest.py: + Add headers for reply argument types. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Removed. + + * Shared/StringPairVector.h: Added. + This file is a hack to work around a deficiency in the generator + which can't deal with class templates with more than one argument. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/WebEditCommandProxy.cpp: + * UIProcess/WebFormClient.cpp: + * UIProcess/WebFormClient.h: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + * WebProcess/WebPage/WebPage.cpp: + Migrate to generated calls. + + * UIProcess/WebPageProxy.messages.in: Added. + New messages definitions file. + + * DerivedSources.make: + * DerivedSources.pro: + * win/WebKit2.vcproj: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-10-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send null events and mouse events + https://bugs.webkit.org/show_bug.cgi?id=47223 + + * WebKit2.xcodeproj/project.pbxproj: + Add "-Wno-deprecated-declarations" to the COMPILER_FLAGS for NetscapePluginMac.mm since + we call Button() which is deprecated. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize the null event timer. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + Start the null event timer. + + (WebKit::NetscapePlugin::platformDestroy): + Stop the null event timer. + + (WebKit::NetscapePlugin::platformHandleMouseEvent): + Initialize the event record and call NPP_HandleEvent. + + (WebKit::NetscapePlugin::nullEventTimerFired): + Send a null event with the current mouse position. + +2010-10-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Start sending Carbon plug-in events in th Carbon event model + https://bugs.webkit.org/show_bug.cgi?id=47209 + <rdar://problem/8515677> + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize the NP_CGContext struct. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + Create a fake Carbon window. + + (WebKit::NetscapePlugin::platformDestroy): + Destroy the Carbon window. + + (WebKit::modifiersForEvent): + Given a WebEvent, return the EventRecord modifiers. + + (WebKit::NetscapePlugin::platformPaint): + (WebKit::NetscapePlugin::platformHandleMouseEvent): + (WebKit::NetscapePlugin::platformHandleWheelEvent): + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + (WebKit::NetscapePlugin::platformSetFocus): + (WebKit::NetscapePlugin::windowFocusChanged): + Create Carbon EventRecords and call NPP_HandleEvent. + +2010-10-05 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Add MIMEType accessor to WKFrame + <rdar://problem/8347683> + https://bugs.webkit.org/show_bug.cgi?id=47138 + + Tests: WebKit2/FrameMIMETypePNG + WebKit2/FrameMIMETypeHTML + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameCopyMIMEType): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::setMIMEType): + (WebKit::WebFrameProxy::mimeType): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didCommitLoadForFrame): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + +2010-10-05 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Implement API call for setting custom user agent + (QWKPage::setCustomUserAgent) + + [Qt] Ability to set custom userAgent for WebKit2/WebKit + https://bugs.webkit.org/show_bug.cgi?id=44265 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::setCustomUserAgent): Added. + * UIProcess/API/qt/qwkpage.h: Add setCustomUserAgent. + +2010-10-05 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r69103. + http://trac.webkit.org/changeset/69103 + https://bugs.webkit.org/show_bug.cgi?id=47177 + + Breaking Windows and Mac build. (Requested by lca on #webkit). + + * UIProcess/API/C/WKNativeEvent.h: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage.h: + * WebKit2.pri: + +2010-10-05 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Webkit2 MacOS build fix + https://bugs.webkit.org/show_bug.cgi?id=47167 + + Qt WebKit2 MacOS build fix. + + * UIProcess/API/C/WKNativeEvent.h: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage.h: + * WebKit2.pri: + +2010-10-04 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Fix the build when sandboxing is enabled. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + * UIProcess/WebProcessProxy.cpp: + +2010-10-04 Andras Becsi <abecsi@webkit.org> + + Reviewed Csaba Osztrogonác. + + [Qt] Build fix after r69037. + Also remove dummy setUpAcceleratedCompositing() from the source file, + since it has been removed from the header. + + * UIProcess/WebProcessProxy.cpp: + +2010-10-04 Andras Becsi <abecsi@webkit.org> + + Rubber-stamped by Csaba Osztrogonác. + + [Qt] Fix the WebKit2 build after r69029. + + * DerivedSources.pro: + +2010-10-04 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Change WebProcess initialization to be done with an + auxiliary struct. + + * Platform/CoreIPC/mac/MachPort.h: + * Shared/WebProcessCreationParameters.cpp: Added. + (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: Added. + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + * UIProcess/WebContext.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): + * UIProcess/WebProcessProxy.h: + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): + * UIProcess/mac/WebProcessProxyMac.mm: Removed. + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::applicationCacheDirectory): + (WebKit::WebContext::platformInitializeWebProcess): + * UIProcess/win/WebContextWin.cpp: + (WebKit::WebContext::platformInitializeWebProcess): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::initializeWebProcess): + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: + * win/WebKit2.vcproj: + +2010-10-04 Brent Fulgham <bfulgham@webkit.org> + + Unreviewed build fixes after r68260 and r68686. + + * Platform/CoreIPC/DataReference.h: Add include directive for + <inttypes.h>, needed for WinCairo build. + * Shared/win/PlatformCertificateInfo.cpp: + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + Conditionalize logic specific to WebKitSystemInterface and + add a stub implementation for WinCairo. + +2010-10-04 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Generate messages sent to the WebProcess class. + https://bugs.webkit.org/show_bug.cgi?id=47097 + + * DerivedSources.make: + Add new file to generate and new directory to search. + + * Scripts/webkit2/messages.py: + (forward_declarations_and_headers): Special case class templates. + (headers_for_type): Special case Vector. + * Scripts/webkit2/messages_unittest.py: + Make this script work for passing a templated type. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: Removed. + + * UIProcess/VisitedLinkProvider.cpp: + (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::initializeHistoryClient): + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::registerURLSchemeAsEmptyDocument): + (WebKit::WebContext::setCacheModel): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): Always pass both + the bundle path and a key, even if the key is null, which it will be for + all non-mac builds for now. + * UIProcess/mac/WebProcessProxyMac.mm: + (WebKit::WebProcessProxy::setUpAcceleratedCompositing): + * UIProcess/win/WebContextWin.cpp: + (WebKit::WebContext::setShouldPaintNativeControls): + (WebKit::WebContext::platformSetUpWebProcess): + Use the new syntax for sending the messages. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::setShouldTrackVisitedLinks): + (WebKit::WebProcess::setCacheModel): + (WebKit::WebProcess::setupAcceleratedCompositingPort): + (WebKit::WebProcess::setShouldPaintNativeControls): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + Convert to using generated didReceiveWebProcessMessage. + + * WebProcess/WebProcess.messages.in: Added. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Update projects. + +2010-10-04 Sam Weinig <sam@webkit.org> + + Fix the Mac build. + + * WebProcess/mac/WebProcessMac.mm: + +2010-10-04 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to set the CacheModel in Webkit2 + https://bugs.webkit.org/show_bug.cgi?id=47066 + + Add WKContext function to set the cache model for the context. + + * Shared/CacheModel.h: Added. + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + * UIProcess/API/C/WKAPICast.h: + (WebKit::toCacheModel): + (WebKit::toRef): + * UIProcess/API/C/WKContext.cpp: + (WKContextSetCacheModel): + (WKContextGetCacheModel): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::setCacheModel): + * UIProcess/WebContext.h: + (WebKit::WebContext::cacheModel): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::setCacheModel): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + * WebProcess/mac/WebProcessMac.mm: Added. + (WebKit::memorySize): + (WebKit::volumeFreeSize): + (WebKit::WebProcess::platformSetCacheModel): + * WebProcess/qt/WebProcessQt.cpp: Added. + (WebKit::WebProcess::platformSetCacheModel): + * WebProcess/win/WebProcessWin.cpp: Added. + (WebKit::WebProcess::platformSetCacheModel): + * win/WebKit2.vcproj: + +2010-10-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement newly added Plugin/PluginController member functions for out of process plug-ins + https://bugs.webkit.org/show_bug.cgi?id=47065 + <rdar://problem/8507194> + + * Platform/CoreIPC/Arguments.h: + Add typedefs. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add new handleMessage overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::create): + Add an isPrivateBrowsingEnabled boolean. + + (WebKit::PluginControllerProxy::PluginControllerProxy): + Add an isPrivateBrowsingEnabled boolean. + + (WebKit::PluginControllerProxy::proxiesForURL): + (WebKit::PluginControllerProxy::cookiesForURL): + (WebKit::PluginControllerProxy::setCookiesForURL): + Send messages to the web process. + + (WebKit::PluginControllerProxy::isPrivateBrowsingEnabled): + Return whether private browsing is enabled or not. + + (WebKit::PluginControllerProxy::handleKeyboardEvent): + Call Plugin::handleKeyboardEvent. + + (WebKit::PluginControllerProxy::privateBrowsingStateChanged): + Call Plugin::privateBrowsingStateChanged. + + * PluginProcess/PluginControllerProxy.messages.in: + Add new messages. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): + Pass the isPrivateBrowsingEnabled flag. + + * PluginProcess/WebProcessConnection.h: + * PluginProcess/WebProcessConnection.messages.in: + Update CreatePlugin message parameters. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didReceiveMessage): + (WebKit::PluginProcessConnection::didReceiveSyncMessage): + It's OK for a plug-in to not get a sync message. + + * WebProcess/Plugins/PluginProcessConnection.h: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::handleKeyboardEvent): + (WebKit::PluginProxy::privateBrowsingStateChanged): + Send messages. + + (WebKit::PluginProxy::proxiesForURL): + (WebKit::PluginProxy::cookiesForURL): + (WebKit::PluginProxy::setCookiesForURL): + Call the plug-in controller. + + * WebProcess/Plugins/PluginProxy.messages.in: + Add new messages. + +2010-10-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send keyboard events to plug-ins + https://bugs.webkit.org/show_bug.cgi?id=47064 + <rdar://problem/8507148> + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::handleKeyboardEvent): + Call platformHandleKeyboardEvent. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::modifierFlags): + Return the modifier flags given a WebKeyboardEvent. + + (WebKit::initializeKeyboardEvent): + Initialize an NPCocoaEvent from a WebKeyboardEvent. + + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + Initialize the event and dispatch it using NPP_HandleEvent. + + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + Add stub. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::platformHandleKeyboardEvent): + Add stub. + + * WebProcess/Plugins/Plugin.h: + Add handleKeyboardEvent. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + Call Plugin::handleKeyboardEvent if we see a keydown or keyup event. + +2010-10-01 Mark Rowe <mrowe@apple.com> + + Build fix. + + Clear the executable bit from a number of source files. + + * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h: + +2010-10-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Plug-ins should have access to the private browsing state. + https://bugs.webkit.org/show_bug.cgi?id=47031 + <rdar://problem/8505405> + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Handle NPNVprivateModeBool. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::isPrivateBrowsingEnabled): + Call PluginController::isPrivateBrowsingEnabled. + + (WebKit::NetscapePlugin::NPP_SetValue): + Add NPP_SetValue wrapper. + + (WebKit::NetscapePlugin::privateBrowsingStateChanged): + Call NPP_SetValue with the updated state. + + * WebProcess/Plugins/Plugin.h: + Add privateBrowsingStateChanged pure virtual member function. + + * WebProcess/Plugins/PluginController.h: + Add isPrivateBrowsingEnabled pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::privateBrowsingStateChanged): + Call Plugin::privateBrowsingStateChanged. + +2010-10-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add SPI to convert a WKStringRef to a JSStringRef and vice-versa. + + API Test: WebKit2/WKStringJSString + + * Shared/API/c/WKString.cpp: + (WKStringCreateWithJSString): + (WKStringCopyJSString): + * Shared/API/c/WKStringPrivate.h: Added. + * Shared/WebString.h: + (WebKit::WebString::create): + (WebKit::WebString::createJSString): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-10-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement proxiesForURL, cookiesForURL and setCookiesForURL + https://bugs.webkit.org/show_bug.cgi?id=47029 + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::proxiesForURL): + (WebKit::PluginView::cookiesForURL): + (WebKit::PluginView::setCookiesForURL): + +2010-10-01 Sam Weinig <sam@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Add additional WKString API + https://bugs.webkit.org/show_bug.cgi?id=46958 + + API Test: WebKit2/WKString + + * Shared/API/c/WKString.cpp: + (WKStringCreateWithUTF8CString): + (WKStringGetMaximumUTF8CStringSize): + (WKStringGetUTF8CString): + (WKStringIsEqual): + (WKStringIsEqualToUTF8CString): + * Shared/API/c/WKString.h: + * Shared/WebString.h: + (WebKit::WebString::createFromUTF8String): + (WebKit::WebString::maximumUTF8CStringSize): + (WebKit::WebString::getUTF8CString): + (WebKit::WebString::equal): + (WebKit::WebString::equalToUTF8String): + +2010-10-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Implement NPN_GetValueForURL/NPN_SetValueForURL and stub out PluginController functions + https://bugs.webkit.org/show_bug.cgi?id=46992 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::copyCString): + Helper function for allocating a string using NPN_MemAlloc. + + (WebKit::NPN_GetValueForURL): + Ask the plug-in for either the proxy or the cookies given an URL. + + (WebKit::NPN_SetValueForURL): + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + Tell the plug-in to set the cookies for the given URL. + + (WebKit::NetscapePlugin::proxiesForURL): + (WebKit::NetscapePlugin::cookiesForURL): + (WebKit::NetscapePlugin::setCookiesForURL): + Call the corresponding PluginController functions. + + * WebProcess/Plugins/PluginController.h: + Add new pure virtual member functions. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::proxiesForURL): + (WebKit::PluginView::cookiesForURL): + (WebKit::PluginView::setCookiesForURL): + Add stubbed out implementations of the new PluginController functions. + + * WebProcess/Plugins/PluginView.h: + +2010-10-01 Adam Roben <aroben@apple.com> + + Implement NPN_GetValue(NPNVnetscapeWindow) + + Fixes <http://webkit.org/b/46726> <rdar://problem/8486319> + Right-clicking on windowless Flash plugin in WebKit2 makes a context + menu appear in the bottom-right corner of the screen + + Test: platform/win/plugins/get-value-netscape-window.html + + Reviewed by Anders Carlsson. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): Added case for NPNVnetscapeWindow that calls + through to NetscapePlugin::containingWindow. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added containingWindow + on Windows. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::containingWindow): Added. Calls through to + the PluginController. + (WebKit::NetscapePlugin::platformPostInitialize): Changed to use + containingWindow. + +2010-09-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + Background doesn't draw when entering accelerated compositing + https://bugs.webkit.org/show_bug.cgi?id=45848 + + LayerBackedDrawingArea::setSize() is normally called in response + to a message from the UI process, so this can come some time after + LayerBackedDrawingArea creation. Depending on the timing, we could + end up being at size 0x0 for the first invalidate and paint, resulting + in missing content. + + The fix is to size the backing layer on creation, using the WebView's size. + + Also changed various calls to syncCompositingStateForThisLayerOnly() + to do lazy updates via scheduleCompositingLayerSync(). + + Also add the fix for https://bugs.webkit.org/show_bug.cgi?id=46226 (r68028) + to the WebKit2 code, in scheduleUpdateLayoutRunLoopObserver(). + + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::setNeedsDisplay): + (WebKit::LayerBackedDrawingArea::setSize): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformInit): + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + (WebKit::LayerBackedDrawingArea::detachCompositingContext): + (WebKit::LayerBackedDrawingArea::setRootCompositingLayer): + (WebKit::LayerBackedDrawingArea::syncCompositingLayers): + (WebKit::LayerBackedDrawingArea::scheduleUpdateLayoutRunLoopObserver): + +2010-09-29 Jon Honeycutt <jhoneycutt@apple.com> + + WebKit2 on Windows should use Windows fonts for the various standard + font families + https://bugs.webkit.org/show_bug.cgi?id=43499 + <rdar://problem/8272758> + + Reviewed by Adam Roben. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + Use Windows fonts on Windows. + +2010-09-30 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46774 - Add WKStringIsEqual API + + * Shared/API/c/WKString.cpp: + (WKStringIsEqual): + * Shared/API/c/WKString.h: + +2010-09-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Forward declare structs with 'struct' in the message headers + https://bugs.webkit.org/show_bug.cgi?id=46925 + <rdar://problem/8497940> + + * Scripts/webkit2/messages.py: + (struct_or_class): New function which given a type and a namespace returns the correct + forward declaration syntax (struct or class). + + * Scripts/webkit2/messages_unittest.py: + Update expected results. + +2010-09-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Antti Koivisto. + + Original patch by Zalan Bujtas. + + The m_readBuffer might be smaller than the incoming message size and + thus result in memory corruption. Do a similar fix as the win port, + resizing the m_readBuffer to have room for the message. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::readyReadHandler): + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Calling Connection::send/sendSync from Connection::Client::didClose should always fail + https://bugs.webkit.org/show_bug.cgi?id=46859 + <rdar://problem/8212583> + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchConnectionDidClose): + +2010-09-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Assertion then crash closing WebKit2 window with accelerated compositing in + https://bugs.webkit.org/show_bug.cgi?id=46857 + + Fix two issues when closing a WebKit2 window using accelerated + compositing. + + The first is that the response to the sync DidChangeAcceleratedCompositing message + sent by changeAcceleratedCompositingMode() may be empty, because the corresponding + page may have been destroyed already in the UI process. In that case newDrawingAreaInfo + is not filled in, so we get a DrawingArea::Type of None. Don't attempt to make a new + drawing area in that case. + + We then have to null-check the drawing area in WebPage::didReceiveMessage(), + in the case where the UI process is calling back with a SuspendPainting message, + before our page has gone away. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): + (WebKit::WebPage::didReceiveMessage): + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement more of PluginProxy and PLuginControllerProxy. + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::decodeBytes): + * Platform/CoreIPC/ArgumentDecoder.h: + Add new overload that takes a DataReference. Wrap the debug function in #ifndef NDEBUG. + + * Platform/CoreIPC/ArgumentEncoder.cpp: + * Platform/CoreIPC/ArgumentEncoder.h: + Wrap the debug function in #ifndef NDEBUG. + + * Platform/CoreIPC/Arguments.h: + Add new typedefs. + + * Platform/CoreIPC/DataReference.cpp: + * Platform/CoreIPC/DataReference.h: + Add a DataReference class. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add new overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::didEvaluateJavaScript): + (WebKit::PluginControllerProxy::streamDidReceiveResponse): + (WebKit::PluginControllerProxy::streamDidReceiveData): + (WebKit::PluginControllerProxy::streamDidFinishLoading): + (WebKit::PluginControllerProxy::streamDidFail): + call Plugin member functions. + + * PluginProcess/PluginControllerProxy.messages.in: + Add new messages. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add DataReference.cpp and DataReference.h + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::didEvaluateJavaScript): + (WebKit::PluginProxy::streamDidReceiveResponse): + (WebKit::PluginProxy::streamDidReceiveData): + (WebKit::PluginProxy::streamDidFinishLoading): + (WebKit::PluginProxy::streamDidFail): + Send messages. + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Update expected results. + + * Scripts/webkit2/messages_unittest.py: + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement LoadURL + https://bugs.webkit.org/show_bug.cgi?id=46826 + + * Platform/CoreIPC/ArgumentCoders.h: + Move String argument coder here from WebCoreArgumentCoders.h. Add + argument coder for AtomicString. + + * Platform/CoreIPC/Arguments.h: + Add typedefs for Arguments7. + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add handleMessage overload that takes 7 parameters. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::loadURL): + Send the LoadURL message. + + * Scripts/webkit2/messages.py: + (parse_parameter_string): Use rsplit in case the type name contains spaces. + (argument_coder_headers_for_type): Special case Vector. + + * Scripts/webkit2/messages_unittest.py: + Update results. + + * Shared/WebCoreArgumentCoders.h: + Add argument coder for HTTPHeaderMap. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::loadURL): + Ask the plug-in controller to load the URL. + + * WebProcess/Plugins/PluginProxy.messages.in: + Add LoadURL message. + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle getting the user agent in the plug-in process + https://bugs.webkit.org/show_bug.cgi?id=46819 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add new handleMessage overload. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::create): + (WebKit::PluginControllerProxy::PluginControllerProxy): + Pass the user agent to the plug-in controller proxy. + + (WebKit::PluginControllerProxy::userAgent): + Return the user agent. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): + Pass the user agent when creating the plug-in controller proxy. + + * PluginProcess/WebProcessConnection.messages.in: + Add userAgent. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::userAgent): + * WebProcess/Plugins/PluginController.h: + Remove the URL parameter to userAgent. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::initialize): + Pass the user agent to WebProcessConnection::CreatePlugin. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::userAgent): + Remove url parameter. + +2010-09-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement more PluginProxy member functions + https://bugs.webkit.org/show_bug.cgi?id=46815 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::handleMouseEvent): + (WebKit::PluginControllerProxy::handleWheelEvent): + (WebKit::PluginControllerProxy::handleMouseEnterEvent): + (WebKit::PluginControllerProxy::handleMouseLeaveEvent): + (WebKit::PluginControllerProxy::setFocus): + (WebKit::PluginControllerProxy::windowFocusChanged): + (WebKit::PluginControllerProxy::windowFrameChanged): + (WebKit::PluginControllerProxy::windowVisibilityChanged): + Call the appropriate Plugin member functions. + + * PluginProcess/PluginControllerProxy.messages.in: + Add new messages. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveMessage): + It's OK to get a message for a plug-in controller proxy that has gone away. + + (WebKit::WebProcessConnection::didReceiveSyncMessage): + Forward the message to the PluginControllerProxy handler. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::handleMouseEvent): + (WebKit::PluginProxy::handleWheelEvent): + (WebKit::PluginProxy::handleMouseEnterEvent): + (WebKit::PluginProxy::handleMouseLeaveEvent): + (WebKit::PluginProxy::setFocus): + (WebKit::PluginProxy::windowFocusChanged): + (WebKit::PluginProxy::windowFrameChanged): + (WebKit::PluginProxy::windowVisibilityChanged): + Send messages to the plug-in process. + + (WebKit::PluginProxy::controller): + Return the plug-in controller. + +2010-09-29 Adam Roben <aroben@apple.com> + + Look for WebKit.dll (not WebKit_debug.dll) when launching the web + process in Debug builds + + Fixes <http://webkit.org/b/46809> <rdar://problem/8491809> REGRESSION + (r67979): All tests crashing on Windows WebKit2 test bot + + Reviewed by Sam Weinig. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: WebKit_debug.dll is + only used in Debug_All builds (but WebKit2WebProcess_debug.exe is used + in all non-Debug_Internal debug-style builds). + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Paint the plug-in backing store into the WebProcess backing store + https://bugs.webkit.org/show_bug.cgi?id=46768 + + * DerivedSources.make: + Add PluginProxy. + + * Platform/CoreIPC/MessageID.h: + Add PluginProxy message class. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::paint): + Let the web process know that we've painted. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didReceiveMessage): + Pass the message on to a plug-in proxy. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::paint): + Paint our backing store into the graphics context. + + (WebKit::PluginProxy::controller): + Add notImplemented(). + + (WebKit::PluginProxy::update): + Blit the plug-in backing store into the local backing store and tell the plug-in + controller that we want to repaint. + + * WebProcess/Plugins/PluginProxy.messages.in: Added. + +2010-09-28 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Added oldPage param to FrameLoaderClient::didTransferChildFrameToNewDocument. + https://bugs.webkit.org/show_bug.cgi?id=46663 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::didTransferChildFrameToNewDocument): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Begin hooking up painting in the plug-in process + https://bugs.webkit.org/show_bug.cgi?id=46766 + + * DerivedSources.make: + Add PluginControllerProxy. + + * Platform/CoreIPC/MessageID.h: + Add a MessageClassPluginControllerProxy message class. + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::PluginControllerProxy): + Initialize the paint timer. + + (WebKit::PluginControllerProxy::paint): + Create a graphics context referencing our backing store and paint into it. + + (WebKit::PluginControllerProxy::invalidate): + Update the dirty rect and start the paint timer if necessary. + + (WebKit::PluginControllerProxy::geometryDidChange): + If we're passed a new backing store handle, reinitialize the backing store. + + * PluginProcess/PluginControllerProxy.messages.in: Added. + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveMessage): + If the message has a destination ID, forward it to the plug-in controller proxy. + + * Scripts/webkit2/messages.py: + Always include WebCoreArgumentCoders.h if the type is in the WebCore namespace. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::geometryDidChange): + Update the size of the backing store. Create a new plug-in backing store if needed and send + it over to the plug-in process. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + ASSERT when launching the plugin process + https://bugs.webkit.org/show_bug.cgi?id=46754 + <rdar://problem/8484570> + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + Don't assert if we fail to launch the process. Instead, set the connection identifier + and process ID to null and deallocate the port we created. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch): + Move all code from didClose here. + + (WebKit::PluginProcessProxy::didClose): + Call pluginProcessCrashedOrFailedToLaunch. + + (WebKit::PluginProcessProxy::didFinishLaunching): + If we failed to launch, call pluginProcessCrashedOrFailedToLaunch. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Differentiate waitForSyncReply from waitForReply + https://bugs.webkit.org/show_bug.cgi?id=46752 + + Since waitForSyncReply is going to need to dispatch incoming sync messages while + waiting for the correct reply, we need to add a new waitForSyncReply function that + can do this. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendSyncMessage): + Push the pending sync reply information on the m_pendingSyncReplies stack, + send the message, wait for a reply and pop the information off the stack. + + (CoreIPC::Connection::waitForSyncReply): + Block while waiting for a reply to the sync message with the given ID. + + (CoreIPC::Connection::processIncomingMessage): + If the incoming message is a sync reply, set the didReceiveReply flag and the replyDecoder + members in the pending sync reply and signal the client thread to wakeup. + + * Platform/CoreIPC/Connection.h: + Add a stack of PendingSyncReply structs. + +2010-09-28 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler and Dave Hyatt. + + Vertical scroll bar on apple.com is too short with WebKit2 + <rdar://problem/8379230> + https://bugs.webkit.org/show_bug.cgi?id=46739 + + This gets us most of the way to having correct scroll corner behavior. We should + follow this up by moving to painting the window re-sizer in WebCore. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _ownsWindowGrowBox]): + (-[WKView _updateGrowBoxForWindowFrameChange]): Calculate whether we should + be taking the scroll corner into account when laying out scrollbars. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setWindowResizerSize): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setWindowResizerSize): + (WebKit::WebPage::windowResizerRect): This now returns IntRect() for + non-mac platforms (or any platform that never sends a setWindowResizerSize + message). + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/WebPage.messages.in: + +2010-09-28 Adam Roben <aroben@apple.com> + + Tell the UI client when a key event is not handled + + When the web process receives an event, it sends a + WebPageProxyMessage::DidReceiveEvent message back to the UI process. + That message is now sent after handling the event, and includes a + boolean signifying whether or not the event was actually handled. + + Every time WebPageProxy receives a key event, it adds it to a queue. + When it receives a WebPageProxyMessage::DidReceiveEvent for a key + event, the event is removed from the queue. If the event was not + handled, we tell the UI client. + + Fixes <http://webkit.org/b/46660> <rdar://problem/8483465> Need API to + tell a WebKit2 client application that a key event was not handled + + Reviewed by Kenneth Rohde Christiansen and Sam Weinig. + + * Shared/NativeWebKeyboardEvent.h: Added. This class wraps a + WebKeyboardEvent and the native event that was used to construct it. + (WebKit::NativeWebKeyboardEvent::nativeEvent): Simple getter. + + * Shared/WebEvent.h: Made isKeyboardEventType public for + WebPageProxy's benefit. + + * Shared/mac/NativeWebKeyboardEventMac.mm: Added. + (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): + * Shared/qt/NativeWebKeyboardEventQt.cpp: Added. + (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): + * Shared/win/NativeWebKeyboardEventWin.cpp: Added. + (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): + The constructor creates a WebKeyboardEvent and stores the native + event. + + * UIProcess/API/C/WKNativeEvent.h: Added. + + * UIProcess/API/C/WKPage.h: Added WKPageDidNotHandleKeyEventCallback + and WKPageUIClient::didNotHandleKeyEvent. + + * UIProcess/API/mac/WKView.mm: + (-[WKView keyUp:]): + (-[WKView keyDown:]): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onKeyEvent): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::keyPressEvent): + (QWKPagePrivate::keyReleaseEvent): + Changed to use NativeWebKeyboardEvent. + + (QWKPage::QWKPage): Updated for addition of didNotHandleKeyEvent. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::handleKeyboardEvent): Changed to take a + NativeWebKeyboardEvent and to add it to m_keyEventQueue. + (WebKit::WebPageProxy::didReceiveMessage): Changed to expect a boolean + parameter in WebPageProxyMessage::DidReceiveEvent. + (WebKit::WebPageProxy::didReceiveEvent): Added a boolean "handled" + parameter. If the event was a keyboard event, we remove it from + m_keyEventQueue, and if it wasn't handled by WebCore, we tell the UI + client. + + * UIProcess/WebPageProxy.h: Added m_keyEventQueue. + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::didNotHandleKeyEvent): + * UIProcess/WebUIClient.h: + Added. Just calls through to the WKPageUIClient. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::handleMouseEvent): + (WebKit::WebPage::mouseEvent): + (WebKit::handleWheelEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::handleKeyEvent): + (WebKit::WebPage::keyEvent): + (WebKit::handleTouchEvent): + (WebKit::WebPage::touchEvent): + Moved code from the *Event functions into new helper handle*Event + functions, and changed to pass a boolean to + WebPageProxyMessage::DidReceiveEvent signaling whether the event was + handled or not. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Added WKNativeEvent.h and NativeWebKeyboardEvent. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Implement PluginProxy::destroy + https://bugs.webkit.org/show_bug.cgi?id=46737 + + * Platform/CoreIPC/HandleMessage.h: + (CoreIPC::handleMessage): + Add overload for a sync message with one in parameter and no out parameters. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::destroyPluginControllerProxy): + Rename this to avoid conflicts with the destroyPlugin message handler. + + (WebKit::WebProcessConnection::destroyPlugin): + Call destroyPluginControllerProxy. + + * PluginProcess/WebProcessConnection.messages.in: + Add DestroyPlugin message. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didClose): + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::PluginProxy): + (WebKit::PluginProxy::~PluginProxy): + Don't add and/the plug-in proxy from the map in the constructor/destructor. Instead, + do it in initialize/destroy, since otherwise we could be calling pluginProcessCrashed on a + PluginController that had already been freed. + + (WebKit::PluginProxy::initialize): + (WebKit::PluginProxy::destroy): + send the DestroyPlugin message. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Improve plug-in process lifecycle handling + https://bugs.webkit.org/show_bug.cgi?id=46734 + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::destroyPlugin): + Destroy and delete the plug-in. + + (WebKit::WebProcessConnection::didClose): + Our web process crashed, go through and delete all plug-in instances. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didClose): + The plug-in process crashed. Go through all pending replies and send them so the + web processes won't be blocked waiting for a reply. + + (WebKit::PluginProcessProxy::didCreateWebProcessConnection): + We need to remove the pending reply connection once we've sent the reply. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::didClose): + The plug-in process crashed. Iterate over all proxies and let them know that the plug-in + process has crashed. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::pluginProcessCrashed): + Tell our controller that the plug-in process crashed. + + (WebKit::PluginProxy::destroy): + Null out the controller. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Implement PluginControllerProxy::initialize and have it create a plug-in + https://bugs.webkit.org/show_bug.cgi?id=46731 + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::initialize): + Create the plug-in and try to initialize it. + + (WebKit::PluginControllerProxy::destroy): + Destroy the plug-in. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::addPluginControllerProxy): + Add the given plug-in controller proxy to the map and assume ownership of it. + + (WebKit::WebProcessConnection::removePluginControllerProxy): + Remove the given plug-in controller proxy from the map and delete it. + + (WebKit::WebProcessConnection::createPlugin): + Create a plug-in controller proxy and try to initialize it. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add PluginControllerProxy class + https://bugs.webkit.org/show_bug.cgi?id=46728 + + * PluginProcess/PluginControllerProxy.cpp: Added. + * PluginProcess/PluginControllerProxy.h: Added. + Add stubbed out PluginControllerProxy class. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::~WebProcessConnection): + Assert that we don't have any live plug-in controller proxies. + + (WebKit::WebProcessConnection::addPluginControllerProxy): + Add the plug-in controller proxy to the map. + + (WebKit::WebProcessConnection::removePluginControllerProxy): + Remove the plug-in controller proxy from the map. If the last plug-in controller + proxy went away, invalidate the connection. + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + +2010-09-28 Adam Roben <aroben@apple.com> + + Don't call NPP_SetWindow until the plugin's HWND has been + sized/positioned + + Test: platform/win/plugins/window-geometry-initialized-before-set-window.html + + Reviewed by Anders Carlsson. + + Fixes <http://webkit.org/b/46716> <rdar://problem/8482014> Full-page + Adobe Reader does not paint until window is resized + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::geometryDidChange): Call NPP_SetWindow after + updating the platform (HWND) geometry. + +2010-09-28 Anders Carlsson <andersca@apple.com> + + Out of process plug-ins shouldn't be turned on just yet... + + * WebKit2Prefix.h: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] ProcessLauncherHelper should not leave stray socket files in /tmp. + https://bugs.webkit.org/show_bug.cgi?id=46722 + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::~ProcessLauncherHelper): close the socket. + (WebKit::ProcessLauncherHelper::ProcessLauncherHelper): delete the helper on exit. + +2010-09-28 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Remove support for Qt 4.5 + https://bugs.webkit.org/show_bug.cgi?id=46718 + + Remove the code for versions of Qt prior to 4.6. + + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::event): + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage_p.h: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] Fix generation of WebPageMessages.h and WebPageMessageReceiver.cpp + to avoid rebuilding them every time. + + * DerivedSources.pro: add target to extra compilers. + +2010-09-27 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=46688 - Add an API to get the WKBackForwardItem at an arbitrary index. + + * UIProcess/API/C/WKBackForwardList.cpp: + (WKBackForwardListGetItemAtIndex): + * UIProcess/API/C/WKBackForwardList.h: + +2010-09-27 Anders Carlsson <andersca@apple.com> + + Turns out people other than me might want to build this thing. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-09-27 Darin Adler <darin@apple.com> + + * Scripts/webkit2: Added property svn:ignore. + +2010-09-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::sendSync): + Add new sendSync overload that takes a message struct. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveSyncMessage): + Call didReceiveSyncWebProcessConnectionMessage. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::addPluginProxy): + Add the plug-in proxy to the map. + + (WebKit::PluginProcessConnection::removePluginProxy): + Remove the plug-in proxy from the map. If the map is empty, disconnect from the + plug-in process. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::generatePluginInstanceID): + Generate a unique plug-in instance ID. + + (WebKit::PluginProxy::PluginProxy): + Add the plug-in proxy to the map. + + (WebKit::PluginProxy::~PluginProxy): + Remove the plug-in proxy from the map. + + (WebKit::PluginProxy::initialize): + Ask the plug-in process to create a plug-in. + +2010-09-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add remaining event handlers to WKView. + + Also fixes <rdar://problem/8467058> + Does not get decidePolicyForNavigationAction callback when middle clicking a link + + - Adds otherButton and rightButton NSResponder event handlers to WKView. + - Renames WebPageProxy event handlers to use the handle prefix. + - Uses a macro to reduce duplicate code for WKView event handlers. + - Add view parameter to WebEventFactory::createWebKeyboardEvent on the mac + for uniformity. + + * Shared/mac/WebEventFactory.h: + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebKeyboardEvent): + * UIProcess/API/mac/WKView.mm: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::keyPressEvent): + (QWKPagePrivate::keyReleaseEvent): + (QWKPagePrivate::mouseMoveEvent): + (QWKPagePrivate::mousePressEvent): + (QWKPagePrivate::mouseReleaseEvent): + (QWKPagePrivate::mouseDoubleClickEvent): + (QWKPagePrivate::wheelEvent): + (QWKPagePrivate::touchEvent): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::handleMouseEvent): + (WebKit::WebPageProxy::handleWheelEvent): + (WebKit::WebPageProxy::handleKeyboardEvent): + (WebKit::WebPageProxy::handleTouchEvent): + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onMouseEvent): + (WebKit::WebView::onWheelEvent): + (WebKit::WebView::onKeyEvent): + +2010-09-27 Ivan Krstić <ike@apple.com> + + Reviewed by Mark Rowe. + + <rdar://problem/8348990> / <http://webkit.org/b/46633> Make it possible to disable sandboxing of + web process via runtime flag. + + Enable sandboxing of the web process only if the DisableSandbox user default is not set for the + web process. + + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2010-09-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add WebProcessConnection CreatePlugin message + https://bugs.webkit.org/show_bug.cgi?id=46668 + + * DerivedSources.make: + Add WebProcessConnection. + + * Platform/CoreIPC/HandleMessage.h: + Add handleMessage overload for a sync message with two input parameters + and one output parameter. + + (CoreIPC::handleMessage): + * Platform/CoreIPC/MessageID.h: + Add MessageClassWebProcessConnection. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): + Add stub. + + * PluginProcess/WebProcessConnection.messages.in: Added. + * Scripts/webkit2/messages.py: + Include headers directly for types that we believe are nested structs. + + * Scripts/webkit2/messages_unittest.py: + Update expected results. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-09-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add support for autogenerating synchronous message handlers + https://bugs.webkit.org/show_bug.cgi?id=46654 + + * Scripts/webkit2/messages.py: + (reply_type): Renamed from reply_base_class. + (delayed_reply_type): Renamed from delayed_reply_base_class. + (message_to_struct_declaration): Add a Reply type typedef. + (async_case_statement): Rename from case_statement. + (generate_message_handler): Generate a sync message handler as well. + + * Scripts/webkit2/messages_unittest.py: + Update expected results. + +2010-09-27 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] Make generate-forwarding-headers.pl aware of moved headers + https://bugs.webkit.org/show_bug.cgi?id=46621 + + * generate-forwarding-headers.pl: + +2010-09-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + The mouseDidMoveOverElement callback in the injected bundle should include modifier info + https://bugs.webkit.org/show_bug.cgi?id=46629 + + - Moves event related API enums to WKEvent.h which can be shared between + both the bundle and the main API. + + * Shared/API/c/WKEvent.h: Added. + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toRef): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKPage.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::mouseDidMoveOverElement): + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-27 Adam Roben <aroben@apple.com> + + Give mouse wheel events the right coordinates on Windows + + Fixes <http://webkit.org/b/46625> <rdar://problem/8481161> Placing + mouse cursor inside a scrollable area and scrolling the mouse wheel + generally doesn't scroll the area + + Reviewed by Sam Weinig. + + * Shared/win/WebEventFactory.cpp: + (WebKit::point): Renamed from positionForEvent. The old name implied + that all events used the same relative origin, which is untrue. + (WebKit::WebEventFactory::createWebMouseEvent): Changed to use point + and ::ClientToScreen explicitly rather than relying on + positionForEvent/globalPositionForEvent. + (WebKit::WebEventFactory::createWebWheelEvent): Changed to use point + and ::ScreenToClient. The old code was assuming that wheel event + points are relative to the client area, but they are in fact relative + to the screen. + +2010-09-27 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Opening links in a new window asserts while decoding decidePolicyForNewWindowAction. + <rdar://problem/8479445> + https://bugs.webkit.org/show_bug.cgi?id=46623 + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Fix the order of decoding to + match the order of encoding. (Swapping url and mouseButton). + +2010-09-27 Adam Roben <aroben@apple.com> + + Stop leaking the web process's process handle on Windows + + Fixes <http://webkit.org/b/46133> <rdar://problem/8455343> + + Reviewed by Anders Carlsson. + + * UIProcess/Launcher/ProcessLauncher.cpp: + (WebKit::ProcessLauncher::invalidate): Call platformInvalidate. + + * UIProcess/Launcher/ProcessLauncher.h: Added platformInvalidate. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::platformInvalidate): + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncher::platformInvalidate): + Stubbed out. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::platformInvalidate): Close the process + handle like MSDN says we should. + +2010-09-27 Adam Roben <aroben@apple.com> + + Don't double-free CERT_CONTEXTs when copying PlatformCertificateInfos + on Windows + + Fixes <http://webkit.org/b/46536> <rdar://problem/8477292> REGRESSION + (r68260): Crash in PlatformCertificateInfo::~PlatformCertificateInfo + when navigating away from Gmail + + Reviewed by Sam Weinig. + + * Shared/win/PlatformCertificateInfo.cpp: + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::operator=): + * Shared/win/PlatformCertificateInfo.h: + Added a copy constructor and assigment operator to handle correctly + reffing/dereffing the CERT_CONTEXTs when copying a + PlatformCertificateInfo. + +2010-09-26 Sam Weinig <sam@webkit.org> + + Reviewed by Simon Fraser. + + MiniBrowser crashes when opening main menu item + https://bugs.webkit.org/show_bug.cgi?id=46588 + + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setEditCommandState): Don't allow default + String -> NSString conversion to take place, and use the increasingly + misnamed nsStringFromWebCoreString instead. + +2010-09-26 Sam Weinig <sam@webkit.org> + + Another windows build fix windows attempt. + + * win/WebKit2Common.vsprops: + +2010-09-26 Sam Weinig <sam@webkit.org> + + Another windows build fix windows attempt. + + * win/WebKit2Generated.make: + +2010-09-26 Sam Weinig <sam@webkit.org> + + Attempt to fix windows build. + + * win/WebKit2Common.vsprops: + +2010-09-26 Sam Weinig <sam@webkit.org> + + Attempt to fix Qt build. + + * WebKit2.pro: + +2010-09-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move shared WebKit2 API (used by both bundle and main API) to WebKit2/Shared/API + https://bugs.webkit.org/show_bug.cgi?id=46587 + + - Moves shared types (WKArrayRef, WKDictionaryRef, etc) to Shared/API/c. + - Removes WKBundleBase.h and moves all opaque type declarations to WKBase.h (which + moves to Shared/API/c). + - Adds WKSharedAPICast.h which includes shared API casting logic and is included + by both WKAPICast.h and WKBundleAPICast.h now. Moved to using macros for API + mappings to reduce verbosity. + - Move windows c API files from UIProcess/API/win to UIProcess/API/C/win. + + * Shared/API: Added. + * Shared/API/c: Added. + * Shared/API/c/WKArray.cpp: Copied from UIProcess/API/C/WKArray.cpp. + * Shared/API/c/WKArray.h: Copied from UIProcess/API/C/WKArray.h. + * Shared/API/c/WKBase.h: Copied from UIProcess/API/C/WKBase.h. + * Shared/API/c/WKCertificateInfo.cpp: Copied from UIProcess/API/C/WKCertificateInfo.cpp. + * Shared/API/c/WKCertificateInfo.h: Copied from UIProcess/API/C/WKCertificateInfo.h. + * Shared/API/c/WKData.cpp: Copied from UIProcess/API/C/WKData.cpp. + * Shared/API/c/WKData.h: Copied from UIProcess/API/C/WKData.h. + * Shared/API/c/WKDictionary.cpp: Copied from UIProcess/API/C/WKDictionary.cpp. + * Shared/API/c/WKDictionary.h: Copied from UIProcess/API/C/WKDictionary.h. + * Shared/API/c/WKError.cpp: Copied from UIProcess/API/C/WKError.cpp. + * Shared/API/c/WKError.h: Copied from UIProcess/API/C/WKError.h. + * Shared/API/c/WKMutableArray.cpp: Copied from UIProcess/API/C/WKMutableArray.cpp. + * Shared/API/c/WKMutableArray.h: Copied from UIProcess/API/C/WKMutableArray.h. + * Shared/API/c/WKMutableDictionary.cpp: Copied from UIProcess/API/C/WKMutableDictionary.cpp. + * Shared/API/c/WKMutableDictionary.h: Copied from UIProcess/API/C/WKMutableDictionary.h. + * Shared/API/c/WKNumber.cpp: Copied from UIProcess/API/C/WKNumber.cpp. + * Shared/API/c/WKNumber.h: Copied from UIProcess/API/C/WKNumber.h. + * Shared/API/c/WKSerializedScriptValue.cpp: Copied from UIProcess/API/C/WKSerializedScriptValue.cpp. + * Shared/API/c/WKSerializedScriptValue.h: Copied from UIProcess/API/C/WKSerializedScriptValue.h. + * Shared/API/c/WKSharedAPICast.h: Copied from UIProcess/API/C/WKAPICast.h. + * Shared/API/c/WKString.cpp: Copied from UIProcess/API/C/WKString.cpp. + * Shared/API/c/WKString.h: Copied from UIProcess/API/C/WKString.h. + * Shared/API/c/WKType.cpp: Copied from UIProcess/API/C/WKType.cpp. + * Shared/API/c/WKType.h: Copied from UIProcess/API/C/WKType.h. + * Shared/API/c/WKURL.cpp: Copied from UIProcess/API/C/WKURL.cpp. + * Shared/API/c/WKURL.h: Copied from UIProcess/API/C/WKURL.h. + * Shared/API/c/WKURLRequest.cpp: Copied from UIProcess/API/C/WKURLRequest.cpp. + * Shared/API/c/WKURLRequest.h: Copied from UIProcess/API/C/WKURLRequest.h. + * Shared/API/c/WKURLResponse.cpp: Copied from UIProcess/API/C/WKURLResponse.cpp. + * Shared/API/c/WKURLResponse.h: Copied from UIProcess/API/C/WKURLResponse.h. + * Shared/API/c/cf: Copied from UIProcess/API/C/cf. + * Shared/API/c/mac: Copied from UIProcess/API/C/mac. + * Shared/API/c/win: Added. + * Shared/API/c/win/WKBaseWin.h: Copied from UIProcess/API/win/WKBaseWin.h. + * Shared/API/c/win/WKCertificateInfoWin.cpp: Copied from UIProcess/API/C/win/WKCertificateInfoWin.cpp. + * Shared/API/c/win/WKCertificateInfoWin.h: Copied from UIProcess/API/C/win/WKCertificateInfoWin.h. + * UIProcess/API/C/WKAPICast.h: Replaced. + * UIProcess/API/C/WKArray.cpp: Removed. + * UIProcess/API/C/WKArray.h: Removed. + * UIProcess/API/C/WKBase.h: Removed. + * UIProcess/API/C/WKCertificateInfo.cpp: Removed. + * UIProcess/API/C/WKCertificateInfo.h: Removed. + * UIProcess/API/C/WKData.cpp: Removed. + * UIProcess/API/C/WKData.h: Removed. + * UIProcess/API/C/WKDictionary.cpp: Removed. + * UIProcess/API/C/WKDictionary.h: Removed. + * UIProcess/API/C/WKError.cpp: Removed. + * UIProcess/API/C/WKError.h: Removed. + * UIProcess/API/C/WKMutableArray.cpp: Removed. + * UIProcess/API/C/WKMutableArray.h: Removed. + * UIProcess/API/C/WKMutableDictionary.cpp: Removed. + * UIProcess/API/C/WKMutableDictionary.h: Removed. + * UIProcess/API/C/WKNumber.cpp: Removed. + * UIProcess/API/C/WKNumber.h: Removed. + * UIProcess/API/C/WKSerializedScriptValue.cpp: Removed. + * UIProcess/API/C/WKSerializedScriptValue.h: Removed. + * UIProcess/API/C/WKString.cpp: Removed. + * UIProcess/API/C/WKString.h: Removed. + * UIProcess/API/C/WKType.cpp: Removed. + * UIProcess/API/C/WKType.h: Removed. + * UIProcess/API/C/WKURL.cpp: Removed. + * UIProcess/API/C/WKURL.h: Removed. + * UIProcess/API/C/WKURLRequest.cpp: Removed. + * UIProcess/API/C/WKURLRequest.h: Removed. + * UIProcess/API/C/WKURLResponse.cpp: Removed. + * UIProcess/API/C/WKURLResponse.h: Removed. + * UIProcess/API/C/cf: Removed. + * UIProcess/API/C/cf/WKStringCF.cpp: Removed. + * UIProcess/API/C/cf/WKStringCF.h: Removed. + * UIProcess/API/C/cf/WKURLCF.cpp: Removed. + * UIProcess/API/C/cf/WKURLCF.h: Removed. + * UIProcess/API/C/cf/WKURLRequestCF.cpp: Removed. + * UIProcess/API/C/cf/WKURLRequestCF.h: Removed. + * UIProcess/API/C/cf/WKURLResponseCF.cpp: Removed. + * UIProcess/API/C/cf/WKURLResponseCF.h: Removed. + * UIProcess/API/C/mac: Removed. + * UIProcess/API/C/mac/WKCertificateInfoMac.h: Removed. + * UIProcess/API/C/mac/WKCertificateInfoMac.mm: Removed. + * UIProcess/API/C/mac/WKURLRequestNS.h: Removed. + * UIProcess/API/C/mac/WKURLRequestNS.mm: Removed. + * UIProcess/API/C/mac/WKURLResponseNS.h: Removed. + * UIProcess/API/C/mac/WKURLResponseNS.mm: Removed. + * UIProcess/API/C/win/WKAPICastWin.h: Copied from UIProcess/API/win/WKAPICastWin.h. + * UIProcess/API/C/win/WKBaseWin.h: Copied from UIProcess/API/win/WKBaseWin.h. + * UIProcess/API/C/win/WKCertificateInfoWin.cpp: Removed. + * UIProcess/API/C/win/WKCertificateInfoWin.h: Removed. + * UIProcess/API/C/win/WKView.cpp: Copied from UIProcess/API/win/WKView.cpp. + * UIProcess/API/C/win/WKView.h: Copied from UIProcess/API/win/WKView.h. + * UIProcess/API/win: Removed. + * UIProcess/API/win/WKAPICastWin.h: Removed. + * UIProcess/API/win/WKBaseWin.h: Removed. + * UIProcess/API/win/WKView.cpp: Removed. + * UIProcess/API/win/WKView.h: Removed. + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: Removed. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: + * WebProcess/InjectedBundle/API/c/WKBundleInitialize.h: + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h: + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Fix non-Mac builds. + + * Platform/SharedMemory.h: + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::isNull): + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginProxy class + https://bugs.webkit.org/show_bug.cgi?id=46586 + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + + * WebProcess/Plugins/PluginProxy.cpp: Added. + * WebProcess/Plugins/PluginProxy.h: Added. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Create a PluginProxy wrapper. + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make it possible to encode null SharedMemory::Handle objects + https://bugs.webkit.org/show_bug.cgi?id=46585 + + * Platform/SharedMemory.h: + (WebKit::SharedMemory::Handle::isNull): + Add isNull. + + * Platform/mac/SharedMemoryMac.cpp: + (WebKit::SharedMemory::Handle::encode): + Remove asserts. + + (WebKit::SharedMemory::create): + Bail if we see a null handle. Also work around a kernel bug where + mach_vm_map fails if the given address to map is already mapped, even if + VM_FLAG_ANYWHERE is set. + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add BackingStore class + https://bugs.webkit.org/show_bug.cgi?id=46584 + + * Shared/BackingStore.cpp: Added. + (WebKit::BackingStore::create): + Create a backing store backed by fastMalloc memory. + + (WebKit::BackingStore::createSharable): + Create a backing store backed by shared memory. + + (WebKit::BackingStore::createHandle): + Create a handle that can be sent over the wire. + + (WebKit::BackingStore::resize): + Resize the backing store memory. + + (WebKit::BackingStore::data): + Return the backing store data. + + * Shared/mac/BackingStoreMac.mm: Added. + (WebKit::BackingStore::createGraphicsContext): + Create a graphics context that will paint into the backing store. + + (WebKit::BackingStore::paint): + Paint the backing store in a graphics context. + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Establish a connection between the plug-in process and the web process + https://bugs.webkit.org/show_bug.cgi?id=46583 + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::didReceiveMessage): + Call the auto-generated didReceivePluginProcessMessage. + + * PluginProcess/PluginProcess.h: + Add didReceivePluginProcessMessage declaration. + + * PluginProcess/PluginProcess.messages.in: + Add new "CreateWebProcessConnection" message. + + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::didReceiveMessage): + (WebKit::WebProcessConnection::didReceiveSyncMessage): + (WebKit::WebProcessConnection::didClose): + (WebKit::WebProcessConnection::didReceiveInvalidMessage): + Add stubbed out member functions. + + * UIProcess/Plugins/PluginProcessManager.cpp: + (WebKit::PluginProcessManager::getPluginProcessConnection): + Ask the plug-in process proxy to create a connection. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::createWebProcessConnection): + Add the WebProcessProxy and the reply encoder to the queue of pending replies. + If the process is still launching, keep track of how many pending requests we have, otherwise + just send the request. + + (WebKit::PluginProcessProxy::didReceiveMessage): + Call the auto-generated didReceivePluginProcessMessage. + + (WebKit::PluginProcessProxy::didFinishLaunching): + Send all pending connection requests. + + (WebKit::PluginProcessProxy::didCreateWebProcessConnection): + Get the first pending reply and send it with the mach port. + + * WebKit2.xcodeproj/project.pbxproj: + Actually compile PluginProcessMessageReceiver. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::PluginProcessConnection): + Create a CoreIPC connection. + + (WebKit::PluginProcessConnection::didReceiveMessage): + (WebKit::PluginProcessConnection::didClose): + (WebKit::PluginProcessConnection::didReceiveInvalidMessage): + Add stubbed out member functions. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Ask the plug-in process connection manager for a connection. + +2010-09-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Generated message handlers should include argument coder headers for some types + https://bugs.webkit.org/show_bug.cgi?id=46582 + + * Scripts/webkit2/messages.py: + When determining which headers to use when generating a message handler, consider the + argument coder headers. + + * Scripts/webkit2/messages_unittest.py: + Update test result. + +2010-09-24 Sam Weinig <sam@webkit.org> + + Fix release build. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + +2010-09-24 Enrica Casucci <enrica@apple.com> + + One more build fix. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::setEditCommandState): + +2010-09-24 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Implement WebKit2 callback equivalent to -[WebUIDelegate mouseDidMoveOverElement:modifierFlags:] + <rdar://problem/8359279> + https://bugs.webkit.org/show_bug.cgi?id=46546 + + - Adds new WKBundleHitTestResultRef object to represent a content under a cursor. + - Adds new Bundle and UI level mouseDidMoveOverElement UIClient callbacks, with + pass through userData to communicate context up to the UIProcess + + * Shared/APIObject.h: + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::mouseDidMoveOverElement): + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::mouseDidMoveOverElement): + * UIProcess/WebUIClient.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp: Added. + (WKBundleHitTestResultGetTypeID): + (WKBundleHitTestResultGetNodeHandle): + (WKBundleHitTestResultGetFrame): + (WKBundleHitTestResultCopyAbsoluteLinkURL): + * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: Added. + (WebKit::InjectedBundleHitTestResult::create): + (WebKit::InjectedBundleHitTestResult::nodeHandle): + (WebKit::InjectedBundleHitTestResult::webFrame): + (WebKit::InjectedBundleHitTestResult::absoluteLinkURL): + * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h: Added. + (WebKit::InjectedBundleHitTestResult::coreHitTestResult): + (WebKit::InjectedBundleHitTestResult::InjectedBundleHitTestResult): + (WebKit::InjectedBundleHitTestResult::type): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::mouseDidMoveOverElement): + * win/WebKit2.vcproj: + +2010-09-24 Enrica Casucci <enrica@apple.com> + + Build fix. + + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::setEditCommandState): + * UIProcess/win/WebView.h: + +2010-09-24 Enrica Casucci <enrica@apple.com> + + Reviewed by Darin Adler. + + Maui: Pasteboard support (42317) + <rdar://problem/7660537> + https://bugs.webkit.org/show_bug.cgi?id=42317 + + This is the final piece of the pasteboard support for WebKit2. + The menu validation has been hooked up for Mac. The validation is + performed asynchronously and the menu entries updated while the menu + is visible. I've created a generic mechanism to call editing commands + that will make it easy to add new commands we will support in the future. + The commands supported now are copy, cut, paste, pasteAsPlainText, delete + and selectAll. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Added DidValidateMenuItem. + * UIProcess/API/mac/PageClientImpl.h: Added setEditCommandState. + * UIProcess/API/mac/PageClientImpl.mm: Added setEditCommandState implementation. + (WebKit::PageClientImpl::setEditCommandState): Added. + * UIProcess/API/mac/WKView.mm: + (WebCore::MenuItemInfo::MenuItemInfo): + (-[WKView initWithFrame:pageNamespaceRef:]): + (createSelectorExceptionMap): Added. + (commandNameForSelector): Added. + (-[WKView validateUserInterfaceItem:]): Added implementation. + (-[WKView _setUserInterfaceItemState:enabled:state:]): Added. + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::validateMenuItem): + (WebKit::WebPageProxy::executeEditCommand): + (WebKit::WebPageProxy::didReceiveMessage): Now processing also + DidValidateMenuItem. + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::executeEditingCommand): Fixed. + (WebKit::WebPage::isEditingCommandEnabled): Fixed. + (WebKit::WebPage::validateMenuItem): Added. + (WebKit::WebPage::executeEditCommand): Added. + * WebProcess/WebPage/WebPage.h: Removed cut, copy, paste, selectAll. + Added validateMenuItem and executeEditCommand. + * WebProcess/WebPage/WebPage.messages.in: Added new messages. + * UIProcess/API/qt/qwkpage.cpp: + (WebKit::QWKPage::setEditCommandState): Added. + * UIProcess/API/qt/qwkpage_p.h: Added + + +2010-09-24 Anders Carlsson <andersca@apple.com> + + Build fix. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-09-24 Adam Roben <aroben@apple.com> + + Give windowed Netscape plugins their own window + + The plugin window is a child of the WebView's window. The WebView's + window is in the UI process, and the plugin's window is in the web + process (though someday it will be in the plugin process), but Windows + mostly handles this just fine. Right now we move the plugin's window + in the web process, but we need to do it at paint time in the UI + process instead so that the plugin windows will stay in sync with the + web page's contents. There are also a whole bunch of plugin quirks + that WebKit1 supports that we don't support yet, but that's a task for + another day. + + Fixes <http://webkit.org/b/44428> Get basic in-process windowed + plugins working in WebKit2 on Windows + + Reviewed by Anders Carlsson. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::destroy): + (WebKit::NetscapePlugin::geometryDidChange): + Call the new platform-specific functions. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added + platformDestroy/platformGeometryDidChange, and an m_window member on + Windows to hold our window. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformDestroy): + (WebKit::NetscapePlugin::platformGeometryDidChange): + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + (WebKit::NetscapePlugin::platformDestroy): + (WebKit::NetscapePlugin::platformGeometryDidChange): + Stubbed these out. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::registerPluginView): Added. The code came from + WebCore's PluginViewWin.cpp, though I changed it to add one to + COLOR_WINDOW, since that's what MSDN says we should do. + (WebKit::NetscapePlugin::platformPostInitialize): If we're windowed, + create a window for the plugin and make it a child of the WebView's + window. If we're not windowed, just set m_window to 0. + (WebKit::NetscapePlugin::platformDestroy): Destroy our window if we + have one and it hasn't been destroyed already. + (WebKit::NetscapePlugin::platformGeometryDidChange): Update our + window's size and position. + + * WebProcess/Plugins/PluginController.h: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::nativeParentWindow): + * WebProcess/Plugins/PluginView.h: + Added nativeParentWindow on Windows to return the WebView's window. + +2010-09-24 Adam Roben <aroben@apple.com> + + Pass the WebView's HWND over to the web process + + The HWND is packaged up in the WebPageCreationParameters and stored in + the WebPage. It will eventually be used by windowed plugins. + + Fixes <http://webkit.org/b/46512> WebPage needs access to its + corresponding HWND from the UI process + + Reviewed by Anders Carlsson. + + * Shared/WebPageCreationParameters.cpp: + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + Encode and decode the HWND as a uint64_t. + + * Shared/WebPageCreationParameters.h: Added a nativeWindow member to + store the HWND. + + * UIProcess/PageClient.h: Added a nativeWindow function on Windows. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::creationParameters): Store the HWND from the + page client in the struct to be sent to the web process. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): Moved the call to initializeWebPage after + we've created our window so that our window will be ready when + WebPageProxy asks for it to send it to the web process. + (WebKit::WebView::nativeWindow): Added. Just returns our window. + + * UIProcess/win/WebView.h: Added nativeWindow. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Store the HWND in the new m_nativeWindow + member. + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::nativeWindow): Added this simple getter. + +2010-09-24 Adam Roben <aroben@apple.com> + + Add WebPageProxy::creationParameters + + Fixes <http://webkit.org/b/46510> WebPageProxy has a bunch of + duplicated WebPageCreationParameters code + + Reviewed by Anders Carlsson. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + Use creationParameters. + + (WebKit::WebPageProxy::creationParameters): + * UIProcess/WebPageProxy.h: + Added creationParameters. + +2010-09-24 Adam Roben <aroben@apple.com> + + Make WebPage::create take a WebPageCreationParameter struct + + It only makes sense, after all. + + Fixes <http://webkit.org/b/46502>. + + Reviewed by Anders Carlsson. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::create): + (WebKit::WebPage::WebPage): + * WebProcess/WebPage/WebPage.h: + Changed to take a WebPageCreationParameters struct. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::createWebPage): Changed to pass a + WebPageCreationParameters struct. + +2010-09-24 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Andreas Kling. + + Expose all WebKit2 C API preferences via the Qt API. + + Also rename a wrongly named C method (was using Web instead of WK). + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesCopyStandardFontFamily): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/qt/qwkpreferences.cpp: + (QWKPreferences::setFontFamily): + (QWKPreferences::fontFamily): + (QWKPreferences::testAttribute): + (QWKPreferences::setAttribute): + * UIProcess/API/qt/qwkpreferences.h: + +2010-09-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Fill in more of PluginProcess + https://bugs.webkit.org/show_bug.cgi?id=46534 + + * DerivedSources.make: + Add PluginProcessProxy. + + * Platform/CoreIPC/MessageID.h: + Add a MessageClassPluginProcessProxy message class. + + * PluginProcess/PluginProcess.cpp: + (WebKit::PluginProcess::PluginProcess): + Initialize the shutdown timer. + + (WebKit::PluginProcess::initializeConnection): + Rename this to initializeConnection to avoid conflicts in the CoreIPC message handler. + + (WebKit::PluginProcess::removeWebProcessConnection): + Remove the given web process connection from our vector. + + (WebKit::PluginProcess::initialize): + Create the plug-in module. + + (WebKit::PluginProcess::createWebProcessConnection): + Create a connection handle and send it to the UI process. + + (WebKit::PluginProcess::shutdownTimerFired): + Quit. + + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + Call initializeConnection. + + * Scripts/webkit2/messages.py: + Add CoreIPC::MachPort as a special case. + + * Scripts/webkit2/messages_unittest.py: + Add test case. + + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::didCreateWebProcessConnection): + Add empty function. + + * UIProcess/Plugins/PluginProcessProxy.messages.in: Added. + * WebKit2.xcodeproj/project.pbxproj: + Add PluginProcessProxy.messages.in. + + * WebKit2Prefix.h: + Add an ENABLE_PLUGIN_PROCESS #define which is 0 for now. + +2010-09-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + messages_unittest.py should compare the generated results against expected results + https://bugs.webkit.org/show_bug.cgi?id=46490 + + * Scripts/webkit2/messages_unittest.py: + +2010-09-24 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antonio Gomes. + + Make it possible to get the page preferences for Qt WebKit2 port. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPage::preferences): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/API/qt/qwkpreferences.cpp: + (QWKPreferencesPrivate::createPreferences): + (QWKPreferencesPrivate::createSharedPreferences): + (QWKPreferences::sharedPreferences): + (QWKPreferences::QWKPreferences): + * UIProcess/API/qt/qwkpreferences.h: + +2010-09-24 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Sam Weinig. + + Add WebKit2 C API for setting/getting frame flattening and plugin settings. + http://webkit.org/b/46477 + + NOTE: The plugin setting was partly done but there was no C API. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * Shared/WebPreferencesStore.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetFrameFlatteningEnabled): + (WKPreferencesGetFrameFlatteningEnabled): + (WKPreferencesSetPluginsEnabled): + (WKPreferencesGetPluginsEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setFrameFlatteningEnabled): + (WebKit::WebPreferences::frameFlatteningEnabled): + (WebKit::WebPreferences::setPluginsEnabled): + (WebKit::WebPreferences::pluginsEnabled): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::preferencesDidChange): + +2010-09-24 Adam Roben <aroben@apple.com> + + Add WebPageCreationParameters + + This struct is used in any messages that end up creating a WebPage. + Using a struct instead of individual parameters will make it easier to + add platform-specific data, such as an HWND on Windows. + + Fixes <http://webkit.org/b/46470> Pass parameters for creating a + WebPage in a single struct + + Reviewed by Anders Carlsson. + + * Shared/WebPageCreationParameters.cpp: Added. + (WebKit::WebPageCreationParameters::encode): + (WebKit::WebPageCreationParameters::decode): + Simple encode/decode functions. + + * Shared/WebPageCreationParameters.h: Added. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createWindow): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::createWebPage): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + Changed to use WebPageCreationParameters instead of passing the + values individually. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Added WebPageCreationParameters. + +2010-09-24 Adam Roben <aroben@apple.com> + + Stop pretending that we know how to encode a DrawingArea and just + encode the DrawingAreaInfo directly + + DrawingAreaBase and friends were trying to hide the fact that they + were just encoding/decoding a DrawingAreaInfo behind the scenes, but + everyone knew what was going on and it was getting embarassing. + + Fixes <http://webkit.org/b/46469> Code to encode/decode a + DrawingAreaInfo is confusing + + Reviewed by Anders Carlsson. + + * Shared/DrawingAreaBase.cpp: Removed. + * Shared/DrawingAreaBase.h: Removed encode/decode. + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: Removed encode override. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + Changed to encode the DrawingAreaInfo directly. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Removed DrawingAreaBase.cpp. + +2010-09-24 Adam Roben <aroben@apple.com> + + Expose a whole DrawingAreaInfo instead of its constituent parts from + DrawingAreaBase + + This is just a step toward cleaning up how drawing areas are + encoded/ecoded. + + Fixes <http://webkit.org/b/46468> DrawingAreaInfo should be used in + more places + + Reviewed by Anders Carlsson. + + * Shared/DrawingAreaBase.cpp: + (WebKit::DrawingAreaBase::encode): Changed to use info(). + + * Shared/DrawingAreaBase.h: + (WebKit::DrawingAreaBase::info): Added. Replaces type() and id(). + (WebKit::DrawingAreaBase::DrawingAreaBase): Changed to store a + DrawingAreaInfo instead of storing its constituent parts. + + * UIProcess/API/mac/WKView.mm: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + * WebProcess/WebPage/WebPage.cpp: + Updated to use info(). + +2010-09-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add WebProcessConnection class + https://bugs.webkit.org/show_bug.cgi?id=46478 + + * PluginProcess/WebProcessConnection.cpp: Added. + * PluginProcess/WebProcessConnection.h: Added. + Add stubbed out WebProcessConnection class. + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + +2010-09-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginProcess class + https://bugs.webkit.org/show_bug.cgi?id=46476 + + * PluginProcess/PluginProcess.cpp: Added. + * PluginProcess/PluginProcess.h: Added. + Add stubbed out PluginProcess class. + + * PluginProcess/mac/PluginProcessMainMac.mm: + (WebKit::PluginProcessMain): + Initialize the plug-in process. + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + + * WebProcess/Plugins/PluginProcessConnection.h: + Add a comment about which connection this is. + +2010-09-24 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * Shared/win/PlatformCertificateInfo.cpp: + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + +2010-09-23 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Add Windows implementation of PlatformCertificateInfo + Part of <rdar://problem/8350189> + https://bugs.webkit.org/show_bug.cgi?id=46450 + + * Shared/win/PlatformCertificateInfo.cpp: Added. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::~PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + (WebKit::organizationNameForCertificate): + * Shared/win/PlatformCertificateInfo.h: + (WebKit::PlatformCertificateInfo::certificateContext): + * UIProcess/API/C/win/WKCertificateInfoWin.cpp: Added. + (WKCertificateInfoGetCertificateContext): + * UIProcess/API/C/win/WKCertificateInfoWin.h: Added. + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-23 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Sam Weinig. + + Add WebKit2 C API for setting the font families. + https://bugs.webkit.org/show_bug.cgi?id=46408 + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetStandardFontFamily): + (WebPreferencesCopyStandardFontFamily): + (WKPreferencesSetFixedFontFamily): + (WKPreferencesCopyFixedFontFamily): + (WKPreferencesSetSerifFontFamily): + (WKPreferencesCopySerifFontFamily): + (WKPreferencesSetSansSerifFontFamily): + (WKPreferencesCopySansSerifFontFamily): + (WKPreferencesSetCursiveFontFamily): + (WKPreferencesCopyCursiveFontFamily): + (WKPreferencesSetFantasyFontFamily): + (WKPreferencesCopyFantasyFontFamily): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setStandardFontFamily): + (WebKit::WebPreferences::standardFontFamily): + (WebKit::WebPreferences::setFixedFontFamily): + (WebKit::WebPreferences::fixedFontFamily): + (WebKit::WebPreferences::setSerifFontFamily): + (WebKit::WebPreferences::serifFontFamily): + (WebKit::WebPreferences::setSansSerifFontFamily): + (WebKit::WebPreferences::sansSerifFontFamily): + (WebKit::WebPreferences::setCursiveFontFamily): + (WebKit::WebPreferences::cursiveFontFamily): + (WebKit::WebPreferences::setFantasyFontFamily): + (WebKit::WebPreferences::fantasyFontFamily): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::preferencesDidChange): + +2010-09-23 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed buildfix after r68220 on WebKit2. + + WebKit2 API: Need way to know when a frame is removed from the hierarchy + https://bugs.webkit.org/show_bug.cgi?id=46432 + + [Qt] qt_wk_didRemoveFrameFromHierarchy needs to be implemented + + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_didRemoveFrameFromHierarchy): + * UIProcess/API/qt/ClientImpl.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + +2010-09-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 API: Need way to know when a frame is removed from the hierarchy + <rdar://problem/8414062> + https://bugs.webkit.org/show_bug.cgi?id=46432 + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didRemoveFrameFromHierarchy): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didRemoveFrameFromHierarchy): + * UIProcess/WebPageProxy.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::detachedFromParent2): + (WebKit::WebFrameLoaderClient::didTransferChildFrameToNewDocument): + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginProcessConnection and PluginProcessConnectionManager + https://bugs.webkit.org/show_bug.cgi?id=46425 + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + + * WebProcess/Plugins/PluginProcessConnection.cpp: + Add empty file for now. + + * WebProcess/Plugins/PluginProcessConnection.h: + Add header. + + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: Added. + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): + Check for an existing plug-in process connection. If we don't have one, ask the + UI process to create one. + + (WebKit::PluginProcessConnectionManager::removePluginProcessConnection): + Remove the connection from our global vector. + +2010-09-23 Adam Roben <aroben@apple.com> + + Remove the DrawingAreaProxy parameter to + WebPagProxy::initializeWebPage + + Callers are now required to set the drawing area via + WebPageProxy::setDrawingArea before calling initializeWebPage. This + will allow us to delay calling initializeWebPage on Windows until + after we've created the WebView's HWND, which in turn will allow us to + send the HWND over to the web process when the page is created. (The + drawing area must be set before creating the HWND so that its size can + be updated, etc., as the window is created.) + + Fixes <http://webkit.org/b/46409> DrawingAreaProxy parameter to + initializeWebPage is unnecessary, and causes problems on Windows + + Reviewed by Anders Carlsson. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::init): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + Added explicit calls to setDrawingArea. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + * UIProcess/WebPageProxy.h: + Removed the DrawingAreaProxy parameter and a stray puts(), and added + an assertion. + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Implement handlers for the GetPluginProcessConnection message + https://bugs.webkit.org/show_bug.cgi?id=46415 + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + Add GetPluginProcessConnection message kind + + * UIProcess/Plugins/PluginProcessManager.cpp: + (WebKit::PluginProcessManager::PluginProcessManager): + Add missing constructor. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginProcessConnection): + Ask the plug-in process manager for a connection. + + (WebKit::WebProcessProxy::didReceiveSyncMessage): + Call getPluginProcessConnection. + + * UIProcess/WebProcessProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Send the GetPluginProcessConnection message. + +2010-09-23 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Reduce minimum DOMTimer interval + https://bugs.webkit.org/show_bug.cgi?id=45362 + + * WebProcess/WebPage/WebPage.cpp: + Updating set interval call to use Settings' static version. + +2010-09-23 Adam Roben <aroben@apple.com> + + Try to fix the Windows build + + * win/WebKit2Common.vsprops: Add WebKit2/PluginProcess to the include + path. + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginProcessMain files + https://bugs.webkit.org/show_bug.cgi?id=46379 + + * PluginProcess/PluginProcessMain.h: Added. + * PluginProcess/mac/PluginProcessMainMac.mm: Added. + + * WebKit2.xcodeproj/project.pbxproj: + Add PluginProcessMain files. Remove PluginProcess.messages.in from the target so it + won't be installed in the WebKit2.framework bundle. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): + Call PluginProcessMain if the process type is ProcessLauncher::PluginProcess. + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginProcessProxy class + https://bugs.webkit.org/show_bug.cgi?id=46377 + + * DerivedSources.make: + Add PluginProcess. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::send): + Add send overload that takes a message. + + * Platform/CoreIPC/MessageID.h: + Add MessageClassPluginProcess message kind. + + * PluginProcess/PluginProcess.messages.in: Added. + Add PluginProcess messages. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::infoForPluginWithPath): + * UIProcess/Plugins/PluginInfoStore.h: + New function that returns the plug-in info for a plug-in with the given path. + + * UIProcess/Plugins/PluginProcessManager.cpp: + (WebKit::PluginProcessManager::getPluginProcessConnection): + Look for an existing plug-in process proxy. + + * UIProcess/Plugins/PluginProcessProxy.cpp: Added. + (WebKit::PluginProcessProxy::create): + Launch the process. + + (WebKit::PluginProcessProxy::didReceiveMessage): + (WebKit::PluginProcessProxy::didReceiveInvalidMessage): + Add stubbed out functions. + + (WebKit::PluginProcessProxy::didClose): + Delete the plug-in process proxy. + + (WebKit::PluginProcessProxy::didFinishLaunching): + Open a connection to the plug-in process proxy. + + * UIProcess/Plugins/PluginProcessProxy.h: Added. + (WebKit::PluginProcessProxy::pluginInfo): + Return the plug-in info. + + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::context): + Add a context getter. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + +2010-09-23 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + Expose the BundlePage on the BundleFrame in the API. + https://bugs.webkit.org/show_bug.cgi?id=46366 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetPage): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + +2010-09-23 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Andreas Kling. + + Add a preference class for Qt for WebKit2. + + * UIProcess/API/qt/qwkpreferences.cpp: Added. + (QWKPreferences::globalPreferences): + (QWKPreferences::QWKPreferences): + (QWKPreferences::~QWKPreferences): + (QWKPreferences::testAttribute): + (QWKPreferences::setAttribute): + * UIProcess/API/qt/qwkpreferences.h: Added. + * WebKit2.pro: + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + It should be possible to conditionally define an entire group of messages + https://bugs.webkit.org/show_bug.cgi?id=46368 + + * Scripts/webkit2/messages.py: + Check for a condition when parsing the "messages -> " string and set it as the + message receiver condition. + + * Scripts/webkit2/messages_unittest.py: + Add test. + +2010-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Message autogeneration script should parse sync message syntax + https://bugs.webkit.org/show_bug.cgi?id=46359 + + * Scripts/webkit2/messages.py: + (MessageReceiver.parse): Expand the regular expression to handle sync messages. + (function_parameter_type): Use a const reference for all parameters except the known builtins. + (base_class): Returns the base class for a sync message reply struct. + (delayed_base_class): Returns the base class for a delayed sync message reply struct. + + * Scripts/webkit2/messages_unittest.py: + Add unit tests for various sync messages. + +2010-09-22 Andras Becsi <abecsi@webkit.org> + + Unreviewed build fix after r68079. + + [Qt] Also generate WebPage's message-receiving code and message types + for the Qt port of WebKit2. + + * DerivedSources.pro: + * WebKit2.pro: + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Stub out a PluginProcessManager class + https://bugs.webkit.org/show_bug.cgi?id=46305 + + * UIProcess/Plugins/PluginProcessManager.cpp: Added. + (WebKit::PluginProcessManager::shared): + (WebKit::PluginProcessManager::getPluginProcessConnection): + (WebKit::PluginProcessManager::removePluginProcessProxy): + * UIProcess/Plugins/PluginProcessManager.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-09-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Antonio Gomes. + + Add a ViewportConfiguration class for the Qt WebKit2 API, which + currently calculated a fallback viewport configuration. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::ViewportConfiguration::ViewportConfiguration): + (QWKPage::ViewportConfiguration::~ViewportConfiguration): + (QWKPage::ViewportConfiguration::operator=): + (QWKPage::viewportConfigurationForSize): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + (QtViewportConfigurationPrivate::QtViewportConfigurationPrivate): + +2010-09-22 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebProcess/WebKitMain.cpp: + (WebKitMain): Fix typo + +2010-09-22 Adam Roben <aroben@apple.com> + + Autogenerate WebPage's message-receiving code and message types + + This patch encompasses several changes that allow message types and + receiving code to be generated by a script, and add some type-safety + as a bonus. Messages are now represented by structs instead of an ID + + ArgumentCoder. The struct contains the arguments and the ID together, + and has a constructor that enforces the use of correct types. + Correspondingly, a new overload of WebProcessProxy::send that takes a + message struct (instead of a message ID and separate arguments) has + been added. Eventually all callers should use this overload and the + old one can be removed. + + This patch only touches WebPage's messages. We should transition other + message receivers over to this new system eventually. + + Fixes <http://webkit.org/b/43636> <rdar://problem/8282462> Add a + type-safe IPC mechanism to WebKit2 + + Reviewed by Anders Carlsson. + + * DerivedSources.make: Added. Calls generate-message-receiver.py and + generate-messages-header.py for each message receiver it knows about + (just WebPage for now). + + * Platform/CoreIPC/Arguments.h: Added First/Second/ThirdArgumentType + typedefs for use in handleMessage. + + * Platform/CoreIPC/HandleMessage.h: Added. + (CoreIPC::handleMessage): This overloaded function template decodes + arguments and passes them along to the specified function. + + * Scripts/generate-message-receiver.py: Added. + * Scripts/generate-messages-header.py: Added. + These scripts just wrap functionality in messages.py. + + * Scripts/webkit2/__init__.py: Added. This just exists so that Python + will treat this directory as a package. + + * Scripts/webkit2/messages.py: Added. Contains the code to parse + messages files and generate .cpp/.h files from them. + (MessageReceiver.__init__): This class represents a single receiver of + messages. + (MessageReceiver.iterparameters): Returns a generator that can be used + to iterate over all the parameters of all the messages of this + receiver. + (MessageReceiver.parse): Reads a messages file from a file-like object + and parses it into a MessageReceiver object. + (Message.__init__): This class represents a single message. + (Message.id): Returns the ID name for this message. + (Parameter.__init__): This class represents a single parameter for a + message. + (messages_header_filename): Returns the name of the header that + defines the messages for a given receiver. + (surround_in_condition): Surrounds the given string in #if/#endif if + there is an associated condition. + (messages_to_kind_enum): Returns a string that defines the Kind enum + for these messages. + (function_parameter_type): Returns the type that should be used when + passing a value of the given type as a parameter to a function. + (base_class): Returns the base class for a message struct. + (message_to_struct_declaration): Returns a string that declares the + struct for this message. + (forward_declarations_for_namespace): Returns a string that contains + forward-declarations for a set of types in a given namespace. + (forward_declarations): Returns a string that contains all the + forward-declarations needed in order to declare all the message + structs for this receiver. + (generate_header_file): Returns a string containing the messages + header file for this receiver. + (handler_function): Returns the name of the function that handles a + given message for a given receiver. + (case_statement): Returns a string containing a case statement for + handling the given message. + (header_for_type): Returns the header needed to define a given type, + enclosed in quotes or angle brackets as needed. + (generate_message_handler): Returns a string containing the contents + of a .cpp file that defines a didReceive*Message function. + + * Scripts/webkit2/messages_unittest.py: Added. Contains tests for + messages.py. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: Removed. This has been + replaced by a generated WebPageMessages.h header. + + * UIProcess/WebEditCommandProxy.cpp: + * UIProcess/WebPageProxy.cpp: + Updated to use the new message structs and WebProcessProxy::send + overload. + + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): Added this new overload that takes a + message struct. + + * WebKit2.xcodeproj/project.pbxproj: Added a Derived Sources shell + script target that invokes DerivedSources.make. Added "Derived + Sources" and "Scripts" groups that contain the various new files. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceivePolicyDecision): + (WebKit::WebPage::getSourceForFrame): + Changed these functions to take the raw IPC types and do the necessary + translation themselves. This keeps the generated code from need to + know how to perform the translation. + + (WebKit::WebPage::didReceiveMessage): Replaced handling of WebPage + messages with a call to didReceiveWebPageMessage, whose implementation + is generated by the scripts. + + * WebProcess/WebPage/WebPage.h: Added didReceiveWebPageMessage. + + * WebProcess/WebPage/WebPage.messages.in: Added. This file declares + all of the messages that WebPage receives, roughly grouped by + functionality. + + * win/WebKit2.vcproj: Added "Derived Sources" and "Scripts" filters + that contain the various new files. Let VS resort some other files. + + * win/WebKit2Common.vsprops: Added + $(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources to the include + path so that the generated messages header can be found. + + * win/WebKit2.make: Copy the generated source files to $(DSTROOT). + + * win/WebKit2Generated.make: Added a call to build-generated-files.sh. + + * win/WebKit2Generated.vcproj: Added build-generated-files.sh. + + * win/build-generated-files.sh: Added. Invokes DerivedSources.make. + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Enhance ProcessLauncher to be able to launch plug-in processes + https://bugs.webkit.org/show_bug.cgi?id=46295 + + * UIProcess/Launcher/ProcessLauncher.cpp: + (WebKit::ProcessLauncher::ProcessLauncher): + Make the ProcessLauncher constructor take a LaunchOptions struct. + + (WebKit::ProcessLauncher::processTypeAsString): + Given a process type, return its string representation. + + (WebKit::ProcessLauncher::getProcessTypeFromString): + And vice versa. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + Rename "mode" to "type" and pass the type as a string based on the LaunchOptions struct. + Also, set the launch architecture from the LaunchOptions struct. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::launchProcess): + Rename "mode" to "type." + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::connect): + Initialize a LaunchOptions struct. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): + Factor code that can be shared between the mac and windows WebKitMain code out into a + WebKitMain overload that takes a CommandLine. + + * WebProcess/WebProcessMain.h: + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + * WebProcess/win/WebProcessMainWin.cpp: + (WebKit::WebProcessMain): + Change WebProcessMain to take a const CommandLine reference instead of a pointer. + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Rename GetPluginHostConnection to GetPluginPath + https://bugs.webkit.org/show_bug.cgi?id=46292 + + Rename GetPluginHostConnection to GetPluginPath since this message will always get the + plug-in path. We'll add another message to actually get the connection. + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginPath): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move plug-in creation to WebPage::createPlugin + https://bugs.webkit.org/show_bug.cgi?id=46289 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Call WebPage::createPlugin. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): + Create the plug-in. + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Random plug-in cleanups + https://bugs.webkit.org/show_bug.cgi?id=46279 + + * WebProcess/Plugins/Plugin.cpp: + (WebKit::Plugin::Parameters::encode): + (WebKit::Plugin::Parameters::decode): + Add CoreIPC coding support for the Plugin::Parameters struct. + + * WebProcess/Plugins/PluginController.h: + Add pluginProcessCrashed pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + handleEvent can be called when m_plugin is null. + + (WebKit::PluginView::pluginProcessCrashed): + Ask the renderer to show the crashed plug-in indicator. + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Don't listen for some window notifications on all windows + https://bugs.webkit.org/show_bug.cgi?id=46277 + + Only listen for NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification notifications + on all windows; this matches old WebKit and fixes a crash where we would send notifications to views whose + underlying pages were invalid. + + * UIProcess/API/mac/WKView.mm: + (-[WKView addWindowObserversForWindow:]): + (-[WKView removeWindowObservers]): + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Crash when running plug-in layout tests + https://bugs.webkit.org/show_bug.cgi?id=46269 + + Store the web page directly in the PluginView class, instead of getting it from the frame + of the plug-in element; this fixes two crashes, one where the plug-in element had been deallocated + before the plug-in view, and another where the plug-in element's document did not have a frame. + + This also makes things more robust since we're asserting in the WebPage destructor that no plug-ins have + an outstanding reference to it. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::webPage): + (WebKit::PluginView::PluginView): + (WebKit::PluginView::~PluginView): + (WebKit::PluginView::initializePlugin): + * WebProcess/Plugins/PluginView.h: + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Change a bunch of Vector<char> to Vector<uint8_t> to better indicate that we're + dealing with raw bytes. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::parsePostBuffer): + (WebKit::NPN_GetURL): + (WebKit::NPN_PostURL): + (WebKit::NPN_GetURLNotify): + (WebKit::NPN_PostURLNotify): + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::loadURL): + (WebKit::NetscapePlugin::initialize): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::deliverData): + (WebKit::NetscapePluginStream::deliverDataToPlugin): + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + * WebProcess/Plugins/PluginController.h: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::loadURL): + * WebProcess/Plugins/PluginView.h: + +2010-09-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Assertion fails in [WKView _updateWindowFrame] when closing a WebKit2 window + https://bugs.webkit.org/show_bug.cgi?id=46264 + <rdar://problem/8463534> + + * UIProcess/API/mac/WKView.mm: + (-[WKView viewDidMoveToWindow]): + Only update window visibility and frame when we're moving to a window. + +2010-09-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] PluginStrategy implementation is broken + https://bugs.webkit.org/show_bug.cgi?id=46078 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + Initialize the WebPlatformStrategies at the UI side as well because + we are using the LocalizationStrategy in the UI process. + Added a FIXME since this should be fixed in the future. + +2010-09-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + PluginStrategy should satisfy the needs of Qt + https://bugs.webkit.org/show_bug.cgi?id=45857 + No new functionality so no new tests. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::getPluginInfo): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2010-09-21 Steve Falkenburg <sfalken@apple.com> + + Rubber stamped by Simon Fraser. + + Add DirectX SDK include path. + + * win/WebKit2DirectX.vsprops: + +2010-09-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Forward window focus changes to the plug-in + https://bugs.webkit.org/show_bug.cgi?id=46227 + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::windowFocusChanged): + Send the NPCocoaEventWindowFocusChanged event. + + (WebKit::NetscapePlugin::windowFrameChanged): + (WebKit::NetscapePlugin::windowVisibilityChanged): + Add stubs. + + * WebProcess/Plugins/Plugin.h: + Add windowFocusChanged, windowFrameChanged and windowVisibilityChanged. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::webPage): + Make webPage a member function instead. + + (WebKit::PluginView::setWindowIsFocused): + Call the plug-in member function. + + (WebKit::PluginView::initializePlugin): + When the plug-in has been initialized, update its window frame, window visibility + and window focus states. + + (WebKit::PluginView::setParent): + Move viewGeometryDidChange to initializePlugin. + + * WebProcess/Plugins/PluginView.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setActive): + Tell all plug-in views about the new window focus state. + + (WebKit::WebPage::windowIsFocused): + Return whether the window is focused or not. + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::windowIsVisible): + (WebKit::WebPage::windowFrame): + Add getters. + +2010-09-21 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Handle booleans in injected bundle messages + https://bugs.webkit.org/show_bug.cgi?id=46213 + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + +2010-09-21 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + WebKit2 should look for WebKit2WebProcess.exe next to WebKit.dll + https://bugs.webkit.org/show_bug.cgi?id=46209 + <rdar://problem/8445639> + + Find WebKit2WebProcess.exe by getting the full path to WebKit.dll, and then + removing the last path component and replacing it with WebKit2WebProcess.exe. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::launchProcess): + +2010-09-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Send window visibility and window frame change sizes to the plug-in + https://bugs.webkit.org/show_bug.cgi?id=46202 + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateWindowVisibility]): + Call WebPageProxy::setWindowIsVisible. + + (-[WKView addWindowObserversForWindow:]): + Add additional observers. + + (-[WKView removeWindowObservers]): + Remove observers. + + (-[WKView _updateWindowFrame]): + Call WebPageProxy::setWindowFrame. + + (-[WKView viewDidMoveToWindow]): + Update the window visibility and the web frame. + + (-[WKView _windowDidMiniaturize:]): + (-[WKView _windowDidDeminiaturize:]): + Update the window visibility. + + (-[WKView _windowFrameDidChange:]): + Update the window frame. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setWindowIsVisible): + (WebKit::WebPageProxy::setWindowFrame): + Send messages along to the web process. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Register the plug-in view. + + (WebKit::PluginView::~PluginView): + Unregister the plug-in view. + + (WebKit::PluginView::setWindowIsVisible): + (WebKit::PluginView::setWindowFrame): + Add empty stubs. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + Initialize m_windowIsVisible. + + (WebKit::WebPage::~WebPage): + Assert that all plug-in views have been removed. + + (WebKit::WebPage::setWindowIsVisible): + Notify all plug-ins about the window visibility change. + + (WebKit::WebPage::setWindowFrame): + Notify all plug-ins about the window frame change. + + (WebKit::WebPage::didReceiveMessage): + Handle setWindowIsVisible and setWindowFrame. + +2010-09-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Mark Rowe. + + * Configurations/WebKit2.xcconfig: + Add a note about keeping the path in MainMac.cpp in sync with the install path. + + * mac/MainMac.cpp: + (main): + Use the correct framework path. + +2010-09-21 Anders Carlsson <andersca@apple.com> + + Fix build. + + * mac/MainMac.cpp: + (closeUnusedFileDescriptors): + Move this out into a separate function. + + (main): + Don't use the soft linking macros, they were bringing in WTFReportAssertionFailure. + +2010-09-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Zombie WebProcesses are left around + https://bugs.webkit.org/show_bug.cgi?id=46148 + <rdar://problem/8455898> + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::setupTerminationNotificationHandler): + Register a dispatch handler that calls waitpid when the child process exits. This prevents zombies from + staying around after the child process has quit. + + (WebKit::ProcessLauncher::launchProcess): + Pass POSIX_SPAWN_START_SUSPENDED to posix_spawn to avoid race conditions when setting up the termination + notification handler. When the handler is set up we send the SIGCONT signal to the child process. + + * mac/MainMac.cpp: + (main): + Loop through all file descriptors except for stdin, stdout and stderr and close them. + + * WebKit2.xcodeproj/project.pbxproj: + Soft-link the Web process with WebKit2. We do this so we can ensure that we won't accidentally close any + file descriptors opened by initialization code that would have been called before main(). + +2010-09-21 Andras Becsi <abecsi@inf.u-szeged.hu> + + Reviewed by Csaba Osztrogonác. + + [Qt] QtWebProcess should clean up shared memory map files on close + https://bugs.webkit.org/show_bug.cgi?id=45984 + + Relocate MappedMemory struct code to it's own header and implement + a singleton pool class (MappedMemoryPool) which tracks shared memory + to be able to clean up map files from disk if RunLoop stops. + + * Shared/qt/MappedMemory.h: Added. + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::isFree): + * Shared/qt/MappedMemoryPool.cpp: Added. + (WebKit::MappedMemoryPool::MappedMemoryPool): + (WebKit::MappedMemoryPool::instance): + (WebKit::MappedMemoryPool::size): + (WebKit::MappedMemoryPool::at): + (WebKit::MappedMemoryPool::append): + (WebKit::MappedMemoryPool::cleanUp): + * Shared/qt/UpdateChunk.cpp: + (WebKit::mapMemory): + (WebKit::mapFile): + * Shared/qt/UpdateChunk.h: + * WebKit2.pro: + +2010-09-20 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson. + + [GTK] enhanced context menu for media elements + https://bugs.webkit.org/show_bug.cgi?id=45021 + + New localized strings for the media element context-menu. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow): + (WebKit::WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow): + (WebKit::WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard): + (WebKit::WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard): + (WebKit::WebPlatformStrategies::contextMenuItemTagToggleMediaControls): + (WebKit::WebPlatformStrategies::contextMenuItemTagToggleMediaLoop): + (WebKit::WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen): + (WebKit::WebPlatformStrategies::contextMenuItemTagMediaPlay): + (WebKit::WebPlatformStrategies::contextMenuItemTagMediaPause): + (WebKit::WebPlatformStrategies::contextMenuItemTagMediaMute): + (WebKit::WebPlatformStrategies::contextMenuItemTagMediaUnMute): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2010-09-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a way to delay sending replies to sync requests + https://bugs.webkit.org/show_bug.cgi?id=46117 + + Change the didReceiveSyncMessage client message to return a SyncReplyMode. If the SyncReplyMode is + AutomaticReply, the reply will be sent when the didReceiveSyncMessage function returns. However, if it is + ManualReply, then the client is handed ownership of the reply ArgumentEncoder and can choose to send it + at a later time using Connection::sendSyncReply. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendSyncReply): + Send the message as a sync reply. + + (CoreIPC::Connection::dispatchMessages): + Check the return value of didReceiveSyncMessage. If it is AutomaticReply, immediately send the reply. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::MessageReceiver::didReceiveSyncMessage): + Change return type. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + Update for changed return type. + +2010-09-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Don't use bufferIsLargeEnoughToContain for Vectors with variable sized elements + https://bugs.webkit.org/show_bug.cgi?id=46109 + + Add a new VectorArgumentCoder class template, with specializations based on whether the + element is fixed size or not. Then update the ArgumentEncoder<Vector<T>> specialization to choose the + right VectorArgumentCoder specialization. To determine this, we use the "IsArithmetic" type trait, + which holds true for all integer types and all floating point types. + + * Platform/CoreIPC/ArgumentCoders.h: + +2010-09-20 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Pasteboard doesn't work in WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=42317 + <rdar://problem/7660537> + + Adding support for RTF, RTFD and NSUrl formats on the Mac. + Still missing the selective enabling of the menu entries. + + * WebKit2.xcodeproj/project.pbxproj: Added WebEditorClientMac.mm. + * WebProcess/WebCoreSupport/WebEditorClient.cpp: Removed Mac only methods + that are now in WebEditorClientMac.mm + * WebProcess/WebCoreSupport/WebEditorClient.h: Fixed style and changed parameter + type in documentFragmentFromAttributedString to be a Vector of RefPtr. + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Added. + All the following methods have been moved from WebEditorClient.cpp. + (WebKit::WebEditorClient::userVisibleString): Added implementation. + (WebKit::createExcludedElementsForAttributedStringConversion): Added. + (WebKit::WebEditorClient::documentFragmentFromAttributedString): Added implementation. + (WebKit::WebEditorClient::setInsertionPasteboard): + (WebKit::WebEditorClient::pasteboardTypesForSelection): + (WebKit::WebEditorClient::uppercaseWord): + (WebKit::WebEditorClient::lowercaseWord): + (WebKit::WebEditorClient::capitalizeWord): + (WebKit::WebEditorClient::showSubstitutionsPanel): + (WebKit::WebEditorClient::substitutionsPanelIsShowing): + (WebKit::WebEditorClient::toggleSmartInsertDelete): + (WebKit::WebEditorClient::isAutomaticQuoteSubstitutionEnabled): + (WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): + (WebKit::WebEditorClient::isAutomaticLinkDetectionEnabled): + (WebKit::WebEditorClient::toggleAutomaticLinkDetection): + (WebKit::WebEditorClient::isAutomaticDashSubstitutionEnabled): + (WebKit::WebEditorClient::toggleAutomaticDashSubstitution): + (WebKit::WebEditorClient::isAutomaticTextReplacementEnabled): + (WebKit::WebEditorClient::toggleAutomaticTextReplacement): + (WebKit::WebEditorClient::isAutomaticSpellingCorrectionEnabled): + (WebKit::WebEditorClient::toggleAutomaticSpellingCorrection): + (WebKit::WebEditorClient::checkTextOfParagraph): + (WebKit::WebEditorClient::showCorrectionPanel): + (WebKit::WebEditorClient::dismissCorrectionPanel): + (WebKit::WebEditorClient::isShowingCorrectionPanel): + +2010-09-20 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + Fix a style issue and add a FIXME to make the AppleConnect plug-in + workaround dependent on site-specific quirks being enabled, which + WebKit2 does not yet support in its WebPreferences implementation. + https://bugs.webkit.org/show_bug.cgi?id=45960 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-09-20 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Add WebKit2 API to load a string as plain text + https://bugs.webkit.org/show_bug.cgi?id=46091 + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadPlainTextString): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadPlainTextString): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadData): + (WebKit::WebPage::loadHTMLString): + (WebKit::WebPage::loadPlainTextString): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-09-19 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * UIProcess/API/C/WKPage.h: + +2010-09-19 Sam Weinig <sam@webkit.org> + + Attempt to fix Qt build. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::doTextFieldCommandFromEvent): + +2010-09-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WebKit2 equivalent of the WebFormDelegate's doCommandBySelector + <rdar://problem/8377088> + https://bugs.webkit.org/show_bug.cgi?id=46073 + + Add bundle client to match the behavior of: + - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame; + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + (WebKit::InjectedBundlePageFormClient::shouldPerformActionInTextField): + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::getActionTypeForKeyEvent): + (WebKit::WebEditorClient::doTextFieldCommandFromEvent): + (WebKit::WebEditorClient::textWillBeDeletedInTextField): + +2010-09-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 decidePolicyForNavigationAction should include mouse button information + <rdar://problem/8413165> + https://bugs.webkit.org/show_bug.cgi?id=46060 + + * UIProcess/API/C/WKAPICast.h: + (WebKit::toRef): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + * UIProcess/WebPolicyClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::findMouseEvent): + (WebKit::mouseButtonForNavigationAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + +2010-09-19 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Unreviewed buildfix after r67813. + + Replace WKBundleRangeRef with WKBundleRangeHandleRef. + https://bugs.webkit.org/show_bug.cgi?id=46054 + + * DerivedSources.pro: Add WebCore/generated/JSRange.h to WEBCORE_GENERATED_HEADERS_FOR_WEBKIT2 + +2010-09-19 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Unreviewed buildfix after r67802. + + WebKit2: Improve/unify the PageLoadClient interfaces. + https://bugs.webkit.org/show_bug.cgi?id=46043 + + * UIProcess/API/qt/ClientImpl.h: + +2010-09-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Replace WKBundleRangeRef with WKBundleRangeHandleRef. + https://bugs.webkit.org/show_bug.cgi?id=46054 + + The new one acts like WKBundleNodeHandleRef and allows for getting a + wrapper in a specific world for the handle. + + * Shared/APIObject.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetJavaScriptWrapperForRangeForWorld): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Removed. + * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Removed. + * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp: Added. + (WKBundleRangeHandleGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h: Added. + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::getOrCreate): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: Added. + (WebKit::domHandleCache): + (WebKit::InjectedBundleRangeHandle::getOrCreate): + (WebKit::InjectedBundleRangeHandle::create): + (WebKit::InjectedBundleRangeHandle::InjectedBundleRangeHandle): + (WebKit::InjectedBundleRangeHandle::~InjectedBundleRangeHandle): + (WebKit::InjectedBundleRangeHandle::coreRange): + * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: Added. + (WebKit::InjectedBundleRangeHandle::type): + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): + (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): + (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): + (WebKit::InjectedBundlePageEditorClient::shouldInsertText): + (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): + (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): + (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::jsWrapperForWorld): + * WebProcess/WebPage/WebFrame.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-18 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Improve/unify the PageLoadClient interfaces. + https://bugs.webkit.org/show_bug.cgi?id=46043 + + - Ensure that all the PageLoadClient functions (that are load related) + have bundle API equivalents (this meant adding didFirstLayoutForFrame + and didFirstVisuallyNonEmptyLayoutForFrame to the BundlePageLoadClient). + - Add a userData out parameters to all the now paired BundlePageLoadClient + functions, and a matching userData parameter to the PageLoadClient ones. + + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_didStartProvisionalLoadForFrame): + (qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame): + (qt_wk_didFailProvisionalLoadWithErrorForFrame): + (qt_wk_didCommitLoadForFrame): + (qt_wk_didFinishDocumentLoadForFrame): + (qt_wk_didFinishLoadForFrame): + (qt_wk_didFailLoadWithErrorForFrame): + (qt_wk_didReceiveTitleForFrame): + (qt_wk_didFirstLayoutForFrame): + (qt_wk_didFirstVisuallyNonEmptyLayoutForFrame): + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didStartProvisionalLoadForFrame): + (WebKit::WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::WebLoaderClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::WebLoaderClient::didCommitLoadForFrame): + (WebKit::WebLoaderClient::didFinishDocumentLoadForFrame): + (WebKit::WebLoaderClient::didFinishLoadForFrame): + (WebKit::WebLoaderClient::didFailLoadWithErrorForFrame): + (WebKit::WebLoaderClient::didReceiveTitleForFrame): + (WebKit::WebLoaderClient::didFirstLayoutForFrame): + (WebKit::WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): + (WebKit::WebLoaderClient::didStartProgress): + (WebKit::WebLoaderClient::didChangeProgress): + (WebKit::WebLoaderClient::didFinishProgress): + (WebKit::WebLoaderClient::didBecomeUnresponsive): + (WebKit::WebLoaderClient::didBecomeResponsive): + (WebKit::WebLoaderClient::processDidExit): + (WebKit::WebLoaderClient::didChangeBackForwardList): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): + (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): + (WebKit::WebPageProxy::didCommitLoadForFrame): + (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): + (WebKit::WebPageProxy::didFinishLoadForFrame): + (WebKit::WebPageProxy::didFailLoadForFrame): + (WebKit::WebPageProxy::didReceiveTitleForFrame): + (WebKit::WebPageProxy::didFirstLayoutForFrame): + (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame): + * UIProcess/WebPageProxy.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::InjectedBundlePageLoaderClient::didCommitLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFinishDocumentLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFinishLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFailLoadWithErrorForFrame): + (WebKit::InjectedBundlePageLoaderClient::didReceiveTitleForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFirstLayoutForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): + (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame): + (WebKit::InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame): + (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame): + (WebKit::InjectedBundlePageLoaderClient::didChangeLocationWithinPageForFrame): + (WebKit::InjectedBundlePageLoaderClient::didHandleOnloadEventsForFrame): + (WebKit::InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame): + (WebKit::InjectedBundlePageLoaderClient::didRunInsecureContentForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFirstLayout): + (WebKit::WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout): + +2010-09-18 Ademar de Souza Reis Jr <ademar.reis@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Enable Platform Strategies on Qt + + [Qt] Turn on PLATFORM_STRATEGIES + https://bugs.webkit.org/show_bug.cgi?id=45831 + + * WebKit2.pro: Added Added WebPlatformStrategies.{cpp,h} + +2010-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Need a way to load data (as plain text) in a WKPage + <rdar://problem/8424239> + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadHTMLString): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadHTMLString): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadHTMLString): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-09-17 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Anders Carlsson. + + Replace all uses of WTF::String and WTF::AtomicString with + String and AtomicString. + + * Platform/Module.h: + * Shared/CommandLine.h: + (WebKit::CommandLine::operator[]): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebEvent.h: + (WebKit::WebKeyboardEvent::WebKeyboardEvent): + (WebKit::WebKeyboardEvent::text): + (WebKit::WebKeyboardEvent::unmodifiedText): + (WebKit::WebKeyboardEvent::keyIdentifier): + (WebKit::WebKeyboardEvent::decode): + * Shared/WebNavigationDataStore.h: + * Shared/WebPreferencesStore.h: + * Shared/WebString.h: + (WebKit::WebString::create): + (WebKit::WebString::string): + (WebKit::WebString::WebString): + * Shared/WebURL.h: + (WebKit::WebURL::create): + (WebKit::WebURL::string): + (WebKit::WebURL::WebURL): + * UIProcess/API/C/WKAPICast.h: + (WebKit::toRef): + (WebKit::toURLRef): + (WebKit::toCopiedRef): + (WebKit::toCopiedURLRef): + (WebKit::toWTFString): + * UIProcess/API/C/WKContext.cpp: + (WKContextCreate): + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::nsStringFromWebCoreString): + * UIProcess/PageClient.h: + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::setAdditionalPluginsDirectories): + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::getMIMETypeForExtension): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::create): + (WebKit::WebBackForwardListItem::setOriginalURL): + (WebKit::WebBackForwardListItem::originalURL): + (WebKit::WebBackForwardListItem::setURL): + (WebKit::WebBackForwardListItem::url): + (WebKit::WebBackForwardListItem::setTitle): + (WebKit::WebBackForwardListItem::title): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + (WebKit::WebContext::setAdditionalPluginsDirectory): + * UIProcess/WebContext.h: + (WebKit::WebContext::injectedBundlePath): + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didReceiveTitle): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::url): + (WebKit::WebFrameProxy::provisionalURL): + * UIProcess/WebHistoryClient.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didReceiveTitleForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebNavigationData.h: + (WebKit::WebNavigationData::title): + (WebKit::WebNavigationData::url): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::pageTitle): + (WebKit::WebPageProxy::toolTip): + (WebKit::WebPageProxy::urlAtProcessExit): + * UIProcess/WebPolicyClient.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginHostConnection): + * UIProcess/WebProcessProxy.h: + * UIProcess/WebUIClient.h: + * WebProcess/InjectedBundle/InjectedBundle.h: + (WebKit::InjectedBundle::create): + (WebKit::InjectedBundle::setSandboxToken): + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::start): + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + * WebProcess/Plugins/Plugin.h: + * WebProcess/Plugins/PluginController.h: + * WebProcess/Plugins/PluginView.h: + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebCoreSupport/WebContextMenuClient.h: + * WebProcess/WebCoreSupport/WebDragClient.h: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::showCorrectionPanel): + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + * WebProcess/WebCoreSupport/WebInspectorClient.h: + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: + (WebKit::WebSearchPopupMenu::saveRecentSearches): + (WebKit::WebSearchPopupMenu::loadRecentSearches): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::runJavaScriptInMainFrame): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::registerURLSchemeAsEmptyDocument): + * WebProcess/WebProcess.h: + +2010-09-17 Sam Weinig <sam@webkit.org> + + Fix Windows and Qt builds. + + * Shared/qt/PlatformCertificateInfo.h: + (WebKit::PlatformCertificateInfo::decode): + * Shared/win/PlatformCertificateInfo.h: + (WebKit::PlatformCertificateInfo::decode): + +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::textZoomFactor): + (WebKit::WebPage::setTextZoomFactor): + (WebKit::WebPage::pageZoomFactor): + (WebKit::WebPage::setPageZoomFactor): + (WebKit::WebPage::setPageAndTextZoomFactors): + Call functions on Frame instead of FrameView. + +2010-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Resize corner jiggles when resizing slowly in WebKit2 + <rdar://problem/7897425> + https://bugs.webkit.org/show_bug.cgi?id=45601 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::windowResizerRect): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::windowResizerRect): + * WebProcess/WebPage/WebPage.h: + Move resize corner logic to WebPage and use the FrameView's size instead of the WebPages + stored size, which doesn't get updated at the right time. This is in line with all other + scrollbar metrics which are in terms of the FrameView's size. + +2010-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make certificate data available to the WKFrameRef after it is committed + Part of <rdar://problem/8350189> + https://bugs.webkit.org/show_bug.cgi?id=45998 + + * Shared/APIObject.h: + Add new type. + + * Shared/WebCertificateInfo.h: Added. + (WebKit::WebCertificateInfo::create): + (WebKit::WebCertificateInfo::platformCertificateInfo): + (WebKit::WebCertificateInfo::WebCertificateInfo): + (WebKit::WebCertificateInfo::type): + Add API type for vending. + + * Shared/mac/PlatformCertificateInfo.h: Added. + (WebKit::PlatformCertificateInfo::peerCertificates): + * Shared/mac/PlatformCertificateInfo.mm: Added. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + (WebKit::PlatformCertificateInfo::dump): + * Shared/qt/PlatformCertificateInfo.h: Added. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + * Shared/win/PlatformCertificateInfo.h: Added. + (WebKit::PlatformCertificateInfo::PlatformCertificateInfo): + (WebKit::PlatformCertificateInfo::encode): + (WebKit::PlatformCertificateInfo::decode): + Add platform specific holder for certificate data and encode/decode functions + to send it over the wire. Right now, this only implemented for the mac. + + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKCertificateInfo.cpp: Added. + (WKCertificateInfoGetTypeID): + * UIProcess/API/C/WKCertificateInfo.h: Added. + Add wrapper for WebCertificateInfo. + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetCertificateInfo): + * UIProcess/API/C/WKFrame.h: + Add getter for a WKCertificateInfo. + + * UIProcess/API/C/mac/WKCertificateInfoMac.h: Added. + * UIProcess/API/C/mac/WKCertificateInfoMac.mm: Added. + (WKCertificateInfoGetPeerCertificates): + Add mac specific getters for the platform specific certificate + data. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::setCertificateInfo): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::certificateInfo): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didCommitLoadForFrame): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + Pipe the certificate info through to the WebFrameProxy on + commit. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2010-09-17 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Reduce minimum DOMTimer interval + https://bugs.webkit.org/show_bug.cgi?id=45362 + + * WebProcess/WebPage/WebPage.cpp: Added in a call to set the mimimum allowed DOMTimer to 4ms. + +2010-09-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + CoreIPC argument coder improvements + https://bugs.webkit.org/show_bug.cgi?id=45999 + + * Platform/CoreIPC/ArgumentCoders.h: + Add explicit specialization for a vector of bytes. + + * Platform/CoreIPC/Arguments.h: + (CoreIPC::Arguments1::decode): + (CoreIPC::Arguments2::decode): + (CoreIPC::Arguments3::decode): + (CoreIPC::Arguments4::decode): + (CoreIPC::Arguments5::decode): + (CoreIPC::Arguments6::decode): + Use the injected class name for less typing. + + (CoreIPC::Arguments7::Arguments7): + (CoreIPC::Arguments7::encode): + (CoreIPC::Arguments7::decode): + (CoreIPC::In): + (CoreIPC::Out): + Add Arguments7 class. + +2010-09-17 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8440903> WK2: REGRESSION (r66156): Web sites using + AppleConnect fail to log in: "HTTP Status 404 - /ssowebapp/scriptFrame" + https://bugs.webkit.org/show_bug.cgi?id=45960 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make WebNumbers immutable matching CF. + + * Shared/WebNumber.h: + (WebKit::WebNumber::value): + (WebKit::WebNumber::WebNumber): + * UIProcess/API/C/WKNumber.cpp: + (WKUInt64GetValue): + * UIProcess/API/C/WKNumber.h: + +2010-09-17 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Add bool wrapper for WebKit2 API + https://bugs.webkit.org/show_bug.cgi?id=45985 + + * Shared/APIObject.h: + * Shared/WebNumber.h: + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKNumber.cpp: + (WKBooleanGetTypeID): + (WKBooleanCreate): + (WKBooleanGetValue): + (WKBooleanSetValue): + * UIProcess/API/C/WKNumber.h: + +2010-09-16 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add support for sending synchronous messages from the InjectedBundle to the WKContext + <rdar://problem/8365320> + https://bugs.webkit.org/show_bug.cgi?id=44785 + + * Shared/CoreIPCSupport/WebContextMessageKinds.h: + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveSynchronousMessageFromInjectedBundle): + (WebKit::WebContext::didReceiveMessage): + (WebKit::WebContext::didReceiveSyncMessage): + * UIProcess/WebContext.h: + * UIProcess/WebContextInjectedBundleClient.cpp: + (WebKit::WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle): + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundlePostSynchronousMessage): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postSynchronousMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + +2010-09-16 Balazs Kelemen <kbalazs@webkit.org> + + Unreviewed trivial typo fix. + + Remove old debug helper code inside |#if 0| from ConnectionQt.cpp + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::readyReadHandler): + +2010-09-15 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Pasteboard doesn't work in WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=42317 + <rdar://problem/7660537> + + Initial work to support cut, copy, paste and selectAll in WebKit2. + It still does not support RTF and RTFD format for Mac and the selective + enabling of the editing menu entries. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: Added messages to support the + new editing commands. + * UIProcess/API/mac/WKView.mm: + (-[WKView validateUserInterfaceItem:]): Added. + (-[WKView copy:]): Added. + (-[WKView cut:]): Added. + (-[WKView paste:]): Addded. + (-[WKView selectAll:]): Added. + * UIProcess/WebPageProxy.cpp: Added all the proxy methods. + (WebKit::WebPageProxy::selectAll): + (WebKit::WebPageProxy::copy): + (WebKit::WebPageProxy::cut): + (WebKit::WebPageProxy::paste): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::documentFragmentFromAttributedString): Added but not + implemented. This is needed to support RTF and RTFD. + (WebKit::WebEditorClient::setInsertionPasteboard): Added but not implemented. + This is needed only to support Mail on the Mac. + * WebProcess/WebPage/WebPage.cpp: Added all the stub methods. + (WebKit::WebPage::selectAll): + (WebKit::WebPage::copy): + (WebKit::WebPage::cut): + (WebKit::WebPage::paste): + (WebKit::WebPage::didReceiveMessage): Modified to handle the new messages from + the UI process. + * WebProcess/WebPage/WebPage.h: + +2010-09-16 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Jian Li. + + Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM. + https://bugs.webkit.org/show_bug.cgi?id=45798 + + * Configurations/FeatureDefines.xcconfig: + +2010-09-15 Jessie Berlin <jberlin@apple.com> + + Reviewed by Sam Weinig. + + WebKit2 should be able to encode and decode objects of type APIObject::TypeURL. + https://bugs.webkit.org/show_bug.cgi?id=45819 + + * Shared/UserMessageCoders.h: + Add the ability to encode and decode the URL type. + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + +2010-09-15 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Add user message coding for WebUInt64 type. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + +2010-09-15 Jessie Berlin <jberlin@apple.com> + + Reviewed by Jon Honeycutt. + + We should save messages that can't be sent when postMessageToInjectedBundle is called and + send them in ensureWebProcess. + https://bugs.webkit.org/show_bug.cgi?id=45822 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + Post any messages to the Injected Bundle that couldn't be sent earlier because the + WebProcess hadn't been initialized yet. + (WebKit::WebContext::postMessageToInjectedBundle): + * UIProcess/WebContext.h: + +2010-09-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8214099> Mousewheel scrolling in WebKit2 is wonky + + Use floats so that fractional scrollwheel deltas don't get lost. + + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebWheelEvent): + +2010-09-15 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Add WKUInt64Ref wrapper for sending uint64_ts. + + * Shared/APIObject.h: + * Shared/WebNumber.h: + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKNumber.cpp: + (WKUInt64GetTypeID): + (WKUInt64Create): + (WKUInt64GetValue): + (WKUInt64SetValue): + * UIProcess/API/C/WKNumber.h: + +2010-09-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=44715 + maps.google.com flips upside down when zooming map using trackpad in WebKit2 on Mac + + Move geometry flipping to platform-specific code. + + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformInit): + +2010-09-14 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::isShowingCorrectionPanel): Dummy implementation. + + * WebProcess/WebCoreSupport/WebEditorClient.h: Adopt new method delcared in base class. + +2010-09-14 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * win/WebKit2Generated.make: + +2010-09-14 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Remove WKBundleNodeRef, replacing uses with WKBundleNodeHandleRef. + https://bugs.webkit.org/show_bug.cgi?id=45785 + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Remove files. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Removed. + * WebProcess/InjectedBundle/API/c/WKBundleNode.h: Removed. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: + (WKBundleRangeCopyStartContainer): + (WKBundleRangeCopyEndContainer): + * WebProcess/InjectedBundle/API/c/WKBundleRange.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): + Change to be in terms of WKBundleNodeHandleRef. + +2010-09-14 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + Exceptions are getting ignored on 64-bit Windows in the Web Process + https://bugs.webkit.org/show_bug.cgi?id=45779 + + * WebProcess/WebKitMain.cpp: + (disableProcessCallbackFilterForExceptions): + Clear the PROCESS_CALLBACK_FILTER_ENABLED flag so that exceptions thrown in callback routines + are not ignored, as described in http://support.microsoft.com/kb/976038 and + http://blog.paulbetts.org/index.php/2010/07/20/the-case-of-the-disappearing-onload-exception-user-mode-callback-exceptions-in-x64/. + (WebKitMain): + +2010-09-14 Brent Fulgham <bfulgham@webkit.org> + + Build correction, no review. + + * win/WebKit2.vcproj: Disable build for Cairo targets of + the WebURLRequestWin.cpp and WebURLResponseWin.cpp files. + +2010-09-14 Eric Seidel <eric@webkit.org> + + Unreviewed, reverting changes r67451 and r67451. + Broke lots of builders. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::dismissCorrectionPanel): + * WebProcess/WebCoreSupport/WebEditorClient.h: + +2010-09-14 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::isShowingCorrectionPanel): Dummy implementation. + + * WebProcess/WebCoreSupport/WebEditorClient.h: Adopt new method delcared in base class. + +2010-09-13 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + URL in address bar doesn't update when navigating to http://webkit.org/new-bug when using WebKit2 + <rdar://problem/8272775> + https://bugs.webkit.org/show_bug.cgi?id=45729 + + Pass an updated provisional url while notifying the UIProcess of + didReceiveServerRedirectForProvisionalLoadForFrame. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad): + * UIProcess/WebFrameProxy.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + +2010-09-13 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + +2010-09-13 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Threaded mode should work in WebKit2 MiniBrowser + https://bugs.webkit.org/show_bug.cgi?id=45727 + + - Make starting the web thread more like starting a new + process (encapsulate it in a thread launcher class). + - Make the call to didFinishLaunching asynchronous so that + WebProcess is fully constructed before it is called. + + * Platform/WorkItem.h: + (MemberFunctionWorkItem1::MemberFunctionWorkItem1): + (MemberFunctionWorkItem1::~MemberFunctionWorkItem1): + (MemberFunctionWorkItem1::execute): + (WorkItem::create): + * UIProcess/Launcher/ProcessLauncher.h: + * UIProcess/Launcher/ThreadLauncher.cpp: Added. + (WebKit::ThreadLauncher::ThreadLauncher): + (WebKit::ThreadLauncher::launchThread): + (WebKit::ThreadLauncher::didFinishLaunchingThread): + (WebKit::ThreadLauncher::invalidate): + * UIProcess/Launcher/ThreadLauncher.h: Added. + (WebKit::ThreadLauncher::Client::~Client): + (WebKit::ThreadLauncher::create): + (WebKit::ThreadLauncher::isLaunching): + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::terminateProcess): + * UIProcess/Launcher/mac/ThreadLauncherMac.mm: Added. + (WebKit::webThreadBody): + (WebKit::ThreadLauncher::createWebThread): + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + * UIProcess/Launcher/qt/ThreadLauncherQt.cpp: Added. + (WebKit::webThreadBody): + (WebKit::ProcessLauncher::createWebThread): + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + * UIProcess/Launcher/win/ThreadLauncherWin.cpp: Added. + (WebKit::webThreadBody): + (WebKit::ProcessLauncher::createWebThread): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + (WebKit::WebProcessProxy::connect): + (WebKit::WebProcessProxy::isLaunching): + (WebKit::WebProcessProxy::didFinishLaunching): + * UIProcess/WebProcessProxy.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-09-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + didFinishDocumentLoadForFrame() is not being sent by WebKit2 + <rdar://problem/8424171> + + Finish wiring up didFinishDocumentLoad to the UIProcess. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::documentFragmentFromAttributedString): Added. + (WebKit::WebEditorClient::setInsertionPasteboard): Added. + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::canShowMIMETypeAsHTML): Added. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-09-11 Daniel Bates <dbates@rim.com> + + Attempt to fix the Qt Linux Release build after changeset 67312 <http://trac.webkit.org/changeset/67312>. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): Add missing ',' in WKPageUIClient initialization list. + +2010-09-11 Adam Barth <abarth@webkit.org> + + Reviewed by Sam Weinig. + + Make SecurityOrigin::canDisplay an instance function + https://bugs.webkit.org/show_bug.cgi?id=45219 + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performFrameLoadURLRequest): + +2010-09-11 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Implement WebKit2 callback equivalent to - [WebUIDelegate webView:setStatusText:] + <rdar://problem/8359252> + https://bugs.webkit.org/show_bug.cgi?id=45605 + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::setStatusText): + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::setStatusText): + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setStatusbarText): + +2010-09-11 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add callback mechanism for the getting the source of a frame + <rdar://problem/8364681> + https://bugs.webkit.org/show_bug.cgi?id=45604 + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageGetSourceForFrame): + (callGetSourceForFrameBlockBlockAndDispose): + (WKPageGetSourceForFrame_b): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::getSourceForFrame): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didGetSourceForFrame): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::source): + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getSourceForFrame): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-09-10 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp: + * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h: + (WebFrameNetworkingContext::create): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add zoom support to WebKit2 API + <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45585 + + - Add UIProcess API for setting zoom factors. + - Change bundle zoom API to be in terms of doubles + for consistency. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageGetTextZoomFactor): + (WKPageSetTextZoomFactor): + (WKPageGetPageZoomFactor): + (WKPageSetPageZoomFactor): + (WKPageSetPageAndTextZoomFactors): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::setTextZoomFactor): + (WebKit::WebPageProxy::setPageZoomFactor): + (WebKit::WebPageProxy::setPageAndTextZoomFactors): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::textZoomFactor): + (WebKit::WebPageProxy::pageZoomFactor): + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetTextZoomFactor): + (WKBundlePageSetTextZoomFactor): + (WKBundlePageGetPageZoomFactor): + (WKBundlePageSetPageZoomFactor): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::textZoomFactor): + (WebKit::WebPage::setTextZoomFactor): + (WebKit::WebPage::pageZoomFactor): + (WebKit::WebPage::setPageZoomFactor): + (WebKit::WebPage::setPageAndTextZoomFactors): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-09-10 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Andreas Kling. + + Application cache directory should be checked before sending to the web process + https://bugs.webkit.org/show_bug.cgi?id=45462 + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): Check the return value of + m_context->applicationCacheDirectoy() to avoid sending a null string + to the web process what makes it asserting. + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + Now that WebCore doesn't require a mode, change the bundle API for zoom to not + require one either. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageStopLoading): + (WKBundlePageGetTextZoomFactor): + (WKBundlePageSetTextZoomFactor): + (WKBundlePageGetPageZoomFactor): + (WKBundlePageSetPageZoomFactor): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::textZoomFactor): + (WebKit::WebPage::setTextZoomFactor): + (WebKit::WebPage::pageZoomFactor): + (WebKit::WebPage::setPageZoomFactor): + * WebProcess/WebPage/WebPage.h: + +2010-09-10 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Andreas Kling. + + [Qt] Implement port specific part of WebKit::InjectedBundle + https://bugs.webkit.org/show_bug.cgi?id=45541 + + * WebProcess/InjectedBundle/InjectedBundle.h: Typedef PlatformBundle as QLibrary for qt. + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + (WebKit::InjectedBundle::load): Implemented. + +2010-09-10 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Andreas Kling. + + [Qt] MiniBrowser crashes with multiply windows when closing one of them + https://bugs.webkit.org/show_bug.cgi?id=45536 + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::~QWKPage): Do not call WKPageTerminate since this is designed + to terminate the web process. We are correctly detaching the page without + this call anyway. + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + This code looks copy/pasted from Mac. It's unclear whether whether all + the complexity is needed here, but I don't have a good way to find out. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::committedLoad): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-09-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Mark Rowe and Darin Adler. + + Set the visible name for the web process + https://bugs.webkit.org/show_bug.cgi?id=45564 + <rdar://problem/8416970> + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::processName): + Add a thread safe implementation of -[NSProcessInfo processName]. + + (WebKit::ProcessLauncher::launchProcess): + Pass the process name to the child process. + + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + Set the visible name. + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::receivedData): + +2010-09-10 Adam Roben <aroben@apple.com> + + Don't crash when a frame is destroyed after the UI process has + disconnected + + Fixes <http://webkit.org/b/45535> <rdar://problem/8412928> Crash in + WebProcess::removeWebFrame on exit with WebKit2 (Release builds only) + + Reviewed by Darin Adler. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::removeWebFrame): Null-check m_connection before + dereferencing it. + +2010-09-09 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + Scrollbars fail to render in composited iframes. + https://bugs.webkit.org/show_bug.cgi?id=45335 + + Use LocalWindowsContext when painting the plugin. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::platformPaint): + +2010-09-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Allow passing WebDoubles via postMessage. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + +2010-09-08 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + WebKit2 needs a way to box numbers (for Array, Dictionary, etc.) + <rdar://problem/8408844> + https://bugs.webkit.org/show_bug.cgi?id=45429 + + This adds a generic WebNumber class that can be used for any scalar + numeric type. Right now, we are only exposing a double version, but it + is designed to allow more. + + * Shared/APIObject.h: + * Shared/WebNumber.h: Added. + (WebKit::WebNumber::create): + (WebKit::WebNumber::value): + (WebKit::WebNumber::setValue): + (WebKit::WebNumber::WebNumber): + (WebKit::WebNumber::type): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKNumber.cpp: Added. + (WKDoubleGetTypeID): + (WKDoubleCreate): + (WKDoubleGetValue): + (WKDoubleSetValue): + * UIProcess/API/C/WKNumber.h: Added. + * UIProcess/API/C/WebKit2.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-08 Anders Carlsson <andersca@apple.com> + + Don't include the std namespace in a header. This hopefully fixes the Windows build. + + * Shared/WebCoreArgumentCoders.h: + +2010-09-08 Anders Carlsson <andersca@apple.com> + + Suggested and reviewed by Darin Adler. + + Fix an overflow bug in bufferIsLargeEnoughToContain. + + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughToContain): + +2010-09-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Improve CoreIPC encoding of strings + https://bugs.webkit.org/show_bug.cgi?id=45418 + + Encode and decode null Strings. Check that the string length isn't bogus. + + * Platform/CoreIPC/ArgumentCoders.h: + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughToContain): + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughToContain): + * Shared/WebCoreArgumentCoders.h: + +2010-09-08 Adam Roben <aroben@apple.com> + + Add a way to cause the web process to crash at a random time + + Setting the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable + will cause the web process to crash at a random point up to 3 minutes + after launching. + + Fixes <http://webkit.org/b/43058> <rdar://problem/8240150> + + Reviewed by Darin Adler. + + * WebProcess/WebProcess.cpp: + (WebKit::sleep): Added an implementation of this function for Windows. + It just calls through to ::Sleep. + (WebKit::randomCrashThread): Added. Sleeps for a random amount of time + up to 3 minutes, then crashes. + (WebKit::startRandomCrashThreadIfRequested): Added. Starts the crash + thread if the WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY environment variable + is set. + (WebKit::WebProcess::initialize): Added a call to + startRandomCrashThreadIfRequested. + +2010-09-08 Adam Roben <aroben@apple.com> + + Fix potential ref-counting issues with WorkItemWin + + Reviewed by Anders Carlsson. + + * Platform/WorkQueue.h: Changed WorkItemWin to inherit from + ThreadSafeShared instead of RefCounted so that its ref-count will stay + consistent when used on multiple threads. + +2010-09-08 Adam Roben <aroben@apple.com> + + Teach WorkQueue how to stop waiting on objects on Windows + + WorkQueue now uses a subclass of WorkItemWin, HandleWorkItem, to hold + the waited-upon HANDLE and its corresponding wait handle. When a + HANDLE is unregistered, we use the HandleWorkItem to cancel the wait + and destroy the HANDLE. + + Fixes <http://webkit.org/b/42826> <rdar://problem/8222253> Crash in + thread pool because WorkQueue keeps waiting on closed HANDLEs + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::platformInvalidate): Changed to call + WorkQueue::unregisterAndCloseHandle instead of closing our handles + manually. + + (CoreIPC::Connection::readEventHandler): + (CoreIPC::Connection::writeEventHandler): + Handle cases where the pipe has already closed by just bailing out. + This can happen if a WorkItem to call one of these functions has + already been scheduled before platformInvalidate is called. + + * Platform/WorkQueue.h: Gave WorkItemWin a virtual destructor, added + HandleWorkItem, changed m_handles to hold HandleWorkItems, and added + functions for unregistering waits. + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::WorkItemWin::~WorkItemWin): Added. This virtual destructor + ensures that HandleWorkItem's destructor gets called. + + (WorkQueue::HandleWorkItem::HandleWorkItem): + (WorkQueue::HandleWorkItem::createByAdoptingHandle): + Added simple constructor/creator. + + (WorkQueue::HandleWorkItem::~HandleWorkItem): Closes the handle we + adopted. + (WorkQueue::registerHandle): Changed to create a HandleWorkItemWin and + to store the wait handle in it. + (WorkQueue::unregisterAndCloseHandle): Added. Removes the + HandleWorkItem for this HANDLE from m_handles and then schedules its + wait to be unregistered and the item to be destroyed. + (WorkQueue::platformInvalidate): Added an assertion and removed an + obsolete FIXME. + (WorkQueue::unregisterWaitAndDestroyItemSoon): Added. Calls + unregisterWaitAndDestroyItemCallback on a worker thread, passing it + ownership of the HandleWorkItem. + (WorkQueue::unregisterWaitAndDestroyItemCallback): Added. Adopts the + passed-in HandleWorkItem, then unregisters the handle's wait, then + destroys the HandleWorkItem when the RefPtr holding it goes out of + scope. Destroying the HandleWorkItem closes the handle. + +2010-09-08 Adam Roben <aroben@apple.com> + + Remove WKSerializedScriptValue.cpp/h from the Copy Files build phase + + * WebKit2.xcodeproj/project.pbxproj: + +2010-09-08 Adam Roben <aroben@apple.com> + + Get rid of WorkQueue::m_performWorkEvent + + We were signaling m_performWorkEvent to spawn a worker thread. We can + use ::QueueUserWorkItem to spawn the thread instead. + + Fixes <http://webkit.org/b/45407> WorkQueue::m_performWorkEvent is + unnecessary + + Reviewed by Anders Carlsson. + + * Platform/WorkQueue.h: Removed m_performWorkEvent. + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::workThreadCallback): Replaced eventCallback with this + function. Its functionality is unchanged. + + (WorkQueue::platformInitialize): + (WorkQueue::platformInvalidate): + Removed code to set up and clean up m_performWorkEvent. + + (WorkQueue::scheduleWork): Use ::QueueUserWorkItem instead of + signaling m_performWorkEvent to spawn a worker thread. + +2010-09-08 Adam Roben <aroben@apple.com> + + Fix WebKit2Common.vsprops line-endings + + * win/WebKit2Common.vsprops: Made all line-endings be CRLF, as this is + the format Visual Studio wants. + +2010-09-07 Oliver Hunt <oliver@apple.com> + + Reviewed by Anders Carlsson. + + Support SerializedScriptValue in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=45340 + + Add wrappers and IPC serialization for SerializedScriptValue + + * Shared/APIObject.h: + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + * Shared/WebSerializedScriptValue.h: Added. + (WebKit::WebSerializedScriptValue::create): + (WebKit::WebSerializedScriptValue::adopt): + (WebKit::WebSerializedScriptValue::deserialize): + (WebKit::WebSerializedScriptValue::data): + (WebKit::WebSerializedScriptValue::WebSerializedScriptValue): + (WebKit::WebSerializedScriptValue::type): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKSerializedScriptValue.cpp: Added. + (WKSerializedScriptValueGetTypeID): + (WKSerializedScriptValueCreate): + (WKSerializedScriptValueDeserialize): + * UIProcess/API/C/WKSerializedScriptValue.h: Added. + * WebKit2.xcodeproj/project.pbxproj: + +2010-09-08 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Would like WKBundleFrameRef to turn into WKFrameRef across postMessage boundary, a la PageRef + <rdar://problem/8402804> + https://bugs.webkit.org/show_bug.cgi?id=45370 + + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::encode): + (WebKit::WebContextUserMessageDecoder::decode): + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + (WebKit::InjectedBundleUserMessageEncoder::encode): + (WebKit::InjectedBundleUserMessageDecoder::decode): + +2010-09-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed, another Qt release build fix attempt. + + * UIProcess/API/cpp/qt/WKURLQt.cpp: + +2010-09-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed, attempt to fix Qt release build. + + * UIProcess/API/cpp/qt/WKStringQt.cpp: + +2010-09-07 Brent Fulgham <bfulgham@webkit.org> + + Build correction, no review. + + * win/WebKit2.vcproj: Disable two unused files for + the WinCairo target. + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix clang++ build. + + * UIProcess/API/C/WKAPICast.h: + Move all functions into the WebKit namespace. + + * UIProcess/API/C/cf/WKStringCF.cpp: + Add using namespace WebKit. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + Move all functions into the WebKit namespace. + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8381749> -Wcast-align warning emitted when building with clang + + Remove the -Wcast-align-warning since it isn't really useful, and clang is more aggressive about warning than gcc. + + * Configurations/Base.xcconfig: + +2010-09-07 Sam Weinig <sam@webkit.org> + + Another windows fix. + + * UIProcess/win/WebView.cpp: + +2010-09-07 Sam Weinig <sam@webkit.org> + + Try and fix windows. + + * UIProcess/WebEditCommandProxy.h: + +2010-09-07 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Fix incorrect parameter name. + + * UIProcess/API/mac/PageClientImpl.mm: + +2010-09-07 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Add support for Undo/Redo + <rdar://problem/7660519> + https://bugs.webkit.org/show_bug.cgi?id=42781 + + Adds platform independent parts of Undo/Redo support and the mac + platform support. + + To work around the common assumption made by platforms, that a redo + item will be added synchronously while an undo is in progress, we + ignore the calls from WebCore to add redo items, and instead add add + them after telling WebCore to unapply the EditCommand. We similarly + need to ignore undos, that take place during a redo, and force the + addition ourselves. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + Add new messages. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (-[WebEditCommandObjC initWithWebEditCommandProxy:WebKit::]): + (-[WebEditCommandObjC WebKit::]): + (-[WebEditorUndoTargetObjC undoEditing:]): + (-[WebEditorUndoTargetObjC redoEditing:]): + (WebKit::PageClientImpl::PageClientImpl): + (WebKit::nameForEditAction): + (WebKit::PageClientImpl::registerEditCommand): + (WebKit::PageClientImpl::clearAllEditCommands): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::registerEditCommand): + (QWKPagePrivate::clearAllEditCommands): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/PageClient.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::registerEditCommand): + (WebKit::WebView::clearAllEditCommands): + * UIProcess/win/WebView.h: + Add platform specific hooks for undo/redo. + + * UIProcess/WebEditCommandProxy.cpp: Added. + (WebKit::WebEditCommandProxy::WebEditCommandProxy): + (WebKit::WebEditCommandProxy::~WebEditCommandProxy): + (WebKit::WebEditCommandProxy::unapply): + (WebKit::WebEditCommandProxy::reapply): + * UIProcess/WebEditCommandProxy.h: Added. + (WebKit::WebEditCommandProxy::create): + (WebKit::WebEditCommandProxy::commandID): + (WebKit::WebEditCommandProxy::editAction): + (WebKit::WebEditCommandProxy::invalidate): + A proxy for the WebEditCommands in the WebProcess. These are owned + by the platform back/forward list, with a weak reference back to the + WebPageProxy (which holds a weakset of live WebEditCommandProxys). + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::registerEditCommandForUndo): + (WebKit::WebPageProxy::clearAllEditCommands): + (WebKit::WebPageProxy::registerEditCommandForRedo): + (WebKit::WebPageProxy::addEditCommand): + (WebKit::WebPageProxy::removeEditCommand): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + Forward messages. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::registerCommandForUndo): + (WebKit::WebEditorClient::registerCommandForRedo): + (WebKit::WebEditorClient::clearUndoRedoOperations): + Send undo/redo registration and clearing to the UIProcess. + + * WebProcess/WebPage/WebEditCommand.cpp: Added. + (WebKit::generateCommandID): + (WebKit::WebEditCommand::WebEditCommand): + * WebProcess/WebPage/WebEditCommand.h: Added. + (WebKit::WebEditCommand::create): + (WebKit::WebEditCommand::command): + (WebKit::WebEditCommand::commandID): + Wrapper for WebCore::EditCommand, with an added unique ID. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::webEditCommand): + (WebKit::WebPage::addWebEditCommand): + (WebKit::WebPage::removeWebEditCommand): + (WebKit::WebPage::unapplyEditCommand): + (WebKit::WebPage::reapplyEditCommand): + (WebKit::WebPage::didRemoveEditCommand): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::isInRedo): + Forward messages. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add new files. + +2010-09-07 Jessie Berlin <jberlin@apple.com> + + Reviewed by Darin Adler. + + Indicate which one of the ScriptWorlds for a Frame the Window Object has been cleared for + https://bugs.webkit.org/show_bug.cgi?id=45217 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + +2010-09-06 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Rename SecurityOrigin::canLoad to canDisplay + https://bugs.webkit.org/show_bug.cgi?id=45214 + + Propagate name change. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performFrameLoadURLRequest): + +2010-09-04 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Allow passing null to postMessage API functions + https://bugs.webkit.org/show_bug.cgi?id=45234 + + * Shared/APIObject.h: Add TypeNull to enum. This is only used + for serialization purposes, and does not represent a concrete subclass + of APIObject. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Remove WillSubmitFormWithUserData + now that it is not needed. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + Add explicit encoding/decoding of null for user messages. + + * UIProcess/WebContextUserMessageCoders.h: + (WebKit::WebContextUserMessageEncoder::encode): + (WebKit::WebContextUserMessageDecoder::decode): + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: + (WebKit::InjectedBundleUserMessageEncoder::encode): + (WebKit::InjectedBundleUserMessageDecoder::decode): + Update UserMessageCoders subclasses to call the base class in the correct + way to work with null messages. This means moving the encoding/decoding + of the type down to the base class, which is a nice cleanup. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + Remove now redundant WillSubmitFormWithUserData implementation. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + Ditto. + +2010-09-03 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + Add FrameNetworkingContext implementation. + + * WebKit2.pro: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createNetworkingContext): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: + (WebKit::WebFrameNetworkingContext::needsSiteSpecificQuirks): + (WebKit::WebFrameNetworkingContext::localFileContentSniffingEnabled): + (WebKit::WebFrameNetworkingContext::scheduledRunLoopPairs): + (WebKit::WebFrameNetworkingContext::blockedError): + * WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp: Added. + (WebCore::WebFrameNetworkingContext::WebFrameNetworkingContext): + (WebCore::WebFrameNetworkingContext::create): + (WebCore::WebFrameNetworkingContext::originatingObject): + (WebCore::WebFrameNetworkingContext::networkAccessManager): + * WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h: Added. + * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp: Added. + * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h: Added. + (WebFrameNetworkingContext::create): + (WebFrameNetworkingContext::WebFrameNetworkingContext): + * win/WebKit2.vcproj: + * win/WebKit2Common.vsprops: + +2010-09-03 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add ability to send UserData to willSubmitForm + https://bugs.webkit.org/show_bug.cgi?id=45222 + + - Adds a willSubmitForm callback to the BundlePageFormClient with an out + parameter WKTypeRef* parameter. + - That out parameter gets serialized and then passed to the PageFormClient's + willSubmitForm, which now has WKTypeRef parameter. + + - Temporarily adds a new WillSubmitFormWithUserData message kind. This will + be replaced by the ability to explicitly serialize null as a UserMessage. + + * Platform/CoreIPC/Arguments.h: + (CoreIPC::Arguments6::Arguments6): + (CoreIPC::Arguments6::encode): + (CoreIPC::Arguments6::decode): + (CoreIPC::In): + (CoreIPC::Out): + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/WebFormClient.cpp: + (WebKit::WebFormClient::willSubmitForm): + * UIProcess/WebFormClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::willSubmitForm): + * UIProcess/WebPageProxy.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + (WebKit::InjectedBundlePageFormClient::textFieldDidBeginEditing): + (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing): + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField): + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea): + (WebKit::InjectedBundlePageFormClient::willSubmitForm): + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + +2010-09-03 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Change WKDictionaryIsMutable to take a WKDictionaryRef instead of a WKMutableDictionaryRef. + If the type is already states it is mutable, there would be no reason for the check. + + * UIProcess/API/C/WKMutableDictionary.cpp: + (WKDictionaryIsMutable): + * UIProcess/API/C/WKMutableDictionary.h: + +2010-09-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to send WKDictionaryRefs via post message. + https://bugs.webkit.org/show_bug.cgi?id=45151 + + * Shared/ImmutableDictionary.cpp: + (WebKit::ImmutableDictionary::ImmutableDictionary): + * Shared/ImmutableDictionary.h: + (WebKit::ImmutableDictionary::adopt): Remove tag, it wasn't doing anything. + (WebKit::ImmutableDictionary::isMutable): + (WebKit::ImmutableDictionary::map): Add accessor of internal + map for encoder. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + Add encoder/decoder. + +2010-09-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Share the common parts of UserMessage coding between both processes. + https://bugs.webkit.org/show_bug.cgi?id=45139 + + Add base classes UserMessageEncoder and UserMessageDecoder which implement + encoding/decoding of ImmutableArray and String (soon to be others as well, such + as ImmutableDictionary, Data, etc.) and add derived classes which implement the + process specific bits such as Page -> BundlePage conversion. + + * Shared/UserMessageCoders.h: Copied from WebProcess/InjectedBundle/InjectedBundle.cpp. + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageEncoder::UserMessageEncoder): + (WebKit::UserMessageDecoder::baseDecode): + (WebKit::UserMessageDecoder::UserMessageDecoder): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + (WebKit::WebContext::didReceiveMessage): + * UIProcess/WebContextUserMessageCoders.h: Copied from UIProcess/WebContext.cpp. + (WebKit::WebContextUserMessageEncoder::WebContextUserMessageEncoder): + (WebKit::WebContextUserMessageEncoder::encode): + (WebKit::WebContextUserMessageDecoder::WebContextUserMessageDecoder): + (WebKit::WebContextUserMessageDecoder::decode): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::didReceiveMessage): + * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: Copied from WebProcess/InjectedBundle/InjectedBundle.cpp. + (WebKit::InjectedBundleUserMessageEncoder::InjectedBundleUserMessageEncoder): + (WebKit::InjectedBundleUserMessageEncoder::encode): + (WebKit::InjectedBundleUserMessageDecoder::InjectedBundleUserMessageDecoder): + (WebKit::InjectedBundleUserMessageDecoder::decode): + * win/WebKit2.vcproj: + +2010-09-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Simplify ownership semantics of some WebKit2 types + https://bugs.webkit.org/show_bug.cgi?id=45120 + + - Make ImmutableArray and MutableArray use a Vector<RefPtr<APIObject> > and + therefore ref any items it takes in. + - Make the PostMessageDecoder operate on a RefPtr<APIObject>& to avoid the odd + leaking semantics. + + * Shared/ImmutableArray.cpp: + (WebKit::ImmutableArray::ImmutableArray): This constructor now uses a for-loop + instead of memcpy to ref each item. + (WebKit::ImmutableArray::~ImmutableArray): No longer necessary to manually deref. + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::adopt): + (WebKit::ImmutableArray::at): + Changes to accommodate entries being changed to a Vector<RefPtr<APIObject> >. + + * Shared/ImmutableDictionary.cpp: + (WebKit::ImmutableDictionary::keys): + Build a Vector<RefPtr<APIObject> >. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + Ditto. + + * UIProcess/WebContext.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::PostMessageDecoder): + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + (WebKit::WebContext::didReceiveMessage): + APIObject>& to avoid the odd leaking semantics. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::PostMessageDecoder): + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + (WebKit::InjectedBundle::didReceiveMessage): + Ditto. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::childFrames): + Build a Vector<RefPtr<APIObject> >. + +2010-09-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WKMutableDictionary API for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=45117 + + Add WKMutableDictionary API that inherits from WKDictionaryRef + the same way WKMutableArrayRef inherits from WKArrayRef. + + * Shared/ImmutableDictionary.h: + (WebKit::ImmutableDictionary::get): + (WebKit::ImmutableDictionary::isMutable): + * Shared/MutableDictionary.cpp: Added. + (WebKit::MutableDictionary::MutableDictionary): + (WebKit::MutableDictionary::~MutableDictionary): + (WebKit::MutableDictionary::add): + (WebKit::MutableDictionary::set): + * Shared/MutableDictionary.h: Added. + (WebKit::MutableDictionary::create): + (WebKit::MutableDictionary::isMutable): + * UIProcess/API/C/WKAPICast.h: + (toWK): + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKMutableDictionary.cpp: Added. + (WKMutableDictionaryCreate): + (WKDictionaryIsMutable): + (WKDictionaryAddItem): + (WKDictionarySetItem): + * UIProcess/API/C/WKMutableDictionary.h: Added. + * UIProcess/API/C/WebKit2.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-02 Jessie Berlin <jberlin@apple.com> + + Windows build fix. Unreviewed. + + * UIProcess/API/win/WKAPICastWin.h: + (toWK): + * UIProcess/API/win/WKBaseWin.h: + +2010-09-01 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Add support for autocorrection UI on Mac OS X. + https://bugs.webkit.org/show_bug.cgi?id=44958 + <rdar://problem/7326847> + + See detailed high level description in WebCore/ChangeLog. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::showCorrectionPanel): Dummy implementation. + (WebKit::WebEditorClient::dismissCorrectionPanel): Ditto + + * WebProcess/WebCoreSupport/WebEditorClient.h: Added new methods declared in base class. + +2010-09-01 Sam Weinig <sam@webkit.org> + + Fix the build. + + As with CF, const struct OpaqueType* should be the default type + so that const_casts are not necessary in user code. + + * UIProcess/API/C/WKArray.cpp: + (WKArrayCreate): + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKType.cpp: + (WKGetTypeID): + (WKRetain): + (WKRelease): + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (toWK): + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + +2010-09-01 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Add mutable array API to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=45082 + + Add a mutable API to WebKit2 called WKMutableArrayRef. Make it "inherit" from + WKArrayRef in the same way JSObjectRef can inherit from JSValueRef in the JSC + API, by abusing the c type system (WKArrayRef is defined as a const version of + WKMutableArrayRef). Add very basic mutable API to go along with it. + + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::isMutable): + Add ability to ask it an array is mutable. + + * Shared/MutableArray.cpp: Added. + (WebKit::MutableArray::MutableArray): + (WebKit::MutableArray::~MutableArray): + (WebKit::MutableArray::append): + * Shared/MutableArray.h: Added. + (WebKit::MutableArray::create): + (WebKit::MutableArray::isMutable): + Sketch out the mutable array interface. + + * UIProcess/API/C/WKAPICast.h: + (toWK): + Now that the opaque types can be const, use template magic to const_cast + it away. + + * UIProcess/API/C/WKBase.h: + Add new type and re-type WKArrayRef as const. + + * UIProcess/API/C/WKMutableArray.cpp: Added. + (WKMutableArrayCreate): + (WKArrayIsMutable): + (WKArrayAppendItem): + * UIProcess/API/C/WKMutableArray.h: Added. + Fill in basic API. + + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add files. + +2010-09-01 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement PluginInfoStore for UNIX + https://bugs.webkit.org/show_bug.cgi?id=45038 + + This implementation is generally just reusing the logic in WebCore since + there is no way to get informations from a UNIX plugin without loading it + - in contrast to mac bundles and windows dll-s. + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::pluginsDirectories): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + +2010-09-01 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Allow the web process to load frameworks other than WebKit2.framework from the build directory + when running engineering builds. + + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): Pass the path containing WebKit2.framework to the sandbox rather than + the path of the WebKit2.framework itself. + +2010-09-01 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Change ImmutableArray to be backed by a Vector + https://bugs.webkit.org/show_bug.cgi?id=45064 + + Change ImmutableArray to be backed by a Vector to work toward having + a mutable subclass and to improve the API when working with it in WebKit2 + itself. + + - Also remove WKArrayCreateAdoptingValues which was confusing and unused. + + * Shared/ImmutableArray.cpp: + (WebKit::ImmutableArray::ImmutableArray): + (WebKit::ImmutableArray::~ImmutableArray): + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::adopt): + (WebKit::ImmutableArray::at): + (WebKit::ImmutableArray::size): + * Shared/ImmutableDictionary.cpp: + (WebKit::ImmutableDictionary::keys): + * UIProcess/API/C/WKArray.cpp: + * UIProcess/API/C/WKArray.h: + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + * UIProcess/WebContext.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::childFrames): + +2010-09-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add URLResponse API for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=45062 + + Add WebURLResponse class and WKURLResponseRef C API to go with it. Right now, + instance of WKURLResponseRef are manipulated via platform types just like + WKURLRequestRef. + + This just adds the type and conversion functions, no uses yet. + + * Shared/APIObject.h: + * Shared/WebCoreArgumentCoders.h: + * Shared/WebURLResponse.cpp: Added. + (WebKit::WebURLResponse::WebURLResponse): + * Shared/WebURLResponse.h: Added. + (WebKit::WebURLResponse::create): + (WebKit::WebURLResponse::resourceResponse): + (WebKit::WebURLResponse::type): + * Shared/mac/WebCoreArgumentCodersMac.mm: + (CoreIPC::encodeWithNSKeyedArchiver): + (CoreIPC::decodeWithNSKeyedArchiver): + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + * Shared/mac/WebURLResponseMac.mm: Added. + (WebKit::WebURLResponse::WebURLResponse): + (WebKit::WebURLResponse::platformResponse): + * Shared/qt/WebURLResponseQt.cpp: Added. + (WebKit::WebURLResponse::WebURLResponse): + (WebKit::WebURLResponse::platformResponse): + * Shared/win/WebURLResponseWin.cpp: Added. + (WebKit::WebURLResponse::WebURLResponse): + (WebKit::WebURLResponse::platformResponse): + * UIProcess/API/C/WKURLResponse.cpp: Added. + (WKURLResponseGetTypeID): + * UIProcess/API/C/WKURLResponse.h: Added. + * UIProcess/API/C/cf/WKURLResponseCF.cpp: Added. + (WKURLResponseCreateWithCFURLResponse): + (WKURLResponseCopyCFURLResponse): + * UIProcess/API/C/cf/WKURLResponseCF.h: Added. + * UIProcess/API/C/mac/WKURLResponseNS.h: Added. + * UIProcess/API/C/mac/WKURLResponseNS.mm: Added. + (WKURLResponseCreateWithNSURLResponse): + (WKURLResponseCopyNSURLResponse): + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-09-01 Andras Becsi <abecsi@webkit.org> + + Reviewed by Antti Koivisto. + + [Qt] Auto-generate WebKit2 forwarding headers + https://bugs.webkit.org/show_bug.cgi?id=44692 + + * DerivedSources.pro: let the generate-forwarding-headers.pl + script generate forwarding headers. + * generate-forwarding-headers.pl: Added. + +2010-08-31 Dave Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=44863 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::layoutIfNeeded): + +2010-08-31 Jon Honeycutt <jhoneycutt@apple.com> + + Fix some copy/paste errors. + + Reviewed by Steve Falkenburg. + + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: + (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing): + Null check the correct callback. + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField): + Ditto. + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea): + Ditto. + +2010-08-31 Jon Honeycutt <jhoneycutt@apple.com> + + Crash when closing a page with a form field when using WebKit2. + + Reviewed by Anders Carlsson. + + The crash came from accessing a BundlePageFormClient that had been + destroyed. The client was intended to be cleared by a call to + WKBundlePageSetFormClient, but a null check there caused it not to be + cleared. + + I fixed this and all of the other WK "set client" functions. + + * UIProcess/API/C/WKContext.cpp: + (WKContextSetInjectedBundleClient): + Return early if the caller passed a client with a version not equal to + 0. + (WKContextSetHistoryClient): + Ditto. + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageLoaderClient): + Ditto. + (WKPageSetPagePolicyClient): + Ditto. + (WKPageSetPageFormClient): + Ditto. + (WKPageSetPageUIClient): + Ditto. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetClient): + Ditto. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetEditorClient): + Ditto. + (WKBundlePageSetFormClient): + Ditto. + (WKBundlePageSetLoaderClient): + Ditto. + (WKBundlePageSetUIClient): + Ditto. + +2010-08-31 Alexey Proskuryakov <ap@apple.com> + + Build fix. + + * Shared/WebPreferencesStore.h: Actually remove encode(), which has been moved to WebPreferencesStore.cpp. + +2010-08-31 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=42195 + <rdar://problem/8186761> WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): Initialize xssAuditorEnabled. + (WebKit::WebPreferencesStore::decode): Moved from header, added xssAuditorEnabled. + (WebKit::WebPreferencesStore::encode): Ditto. + (WebKit::WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner): Set an override, so + that decoding a WebPreferencesStore in the process will give the override result. WebProcess + doesn't hold to WebPreferencesStore, so there are no existing ones to patch. + (WebKit::WebPreferencesStore::removeTestRunnerOverrides): Remove the override. + + * Shared/WebPreferencesStore.h: Added xssAuditorEnabled. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetXSSAuditorEnabled): + (WKPreferencesGetXSSAuditorEnabled): + * UIProcess/API/C/WKPreferences.h: + Added an API method to change xssAuditorEnabled preference. + + * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preferencesDidChange): Added a comment + explaining how making this method smarter could affect WebKitTestRunner. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setXSSAuditorEnabled): + (WebKit::WebPreferences::xssAuditorEnabled): + * UIProcess/WebPreferences.h: + Implemented xssAuditorEnabled preference accessors. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleOverrideXSSAuditorEnabledForTestRunner): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + Added a private methods to temporarily change xssAuditor setting from an injected bundle, + not notifying UIProcess about the change. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): + * WebProcess/InjectedBundle/InjectedBundle.h: + Change the setting in existing pages, and override it for future ones. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Take xssAuditorEnabled from preferences store. + (WebKit::WebPage::preferencesDidChange): If preferences change, forget our override. This only + happens in WKRT when the next test begins. + +2010-08-31 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + WebKitTestRunner needs layoutTestController.addUserStyleSheet + https://bugs.webkit.org/show_bug.cgi?id=42680 + + WebKitTestRunner needs layoutTestController.addUserScript + https://bugs.webkit.org/show_bug.cgi?id=42681 + + Improve UserContent APIs to allow passing null in the same places + the WebKit1 API allowed. Add convenience function toWTFString to do + WKStringRef conversion with correct null string behavior. + + * UIProcess/API/C/WKAPICast.h: + (toWTFString): + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleAddUserScript): + (WKBundleAddUserStyleSheet): + (WKBundleRemoveUserScript): + (WKBundleRemoveUserStyleSheet): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::toStringVector): + +2010-08-31 Steve Falkenburg <sfalken@apple.com> + + Rubber stamped by Sam Weinig. + + Remove library directive from def file to fix Debug_All build. + + * win/WebKit2.def: + +2010-08-31 Adam Roben <aroben@apple.com> + + Handle WM_PRINTCLIENT in WebKit2 on Windows + + Reviewed by Sam Weinig. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): Call through to onPrintClientEvent when we + get a WM_PRINTCLIENT message. + (WebKit::WebView::onPrintClientEvent): Added. Paints the entire view + into the HDC provided by Windows. + + * UIProcess/win/WebView.h: Added onPrintClientEvent. + +2010-08-27 Adam Roben <aroben@apple.com> + + Don't send messages to the injected bundle if the web process has + exited + + Fixes <http://webkit.org/b/43046> <rdar://problem/8239455> Crash in + WKContextPostMessageToInjectedBundle if the web process has exited + + Reviewed by Sam Weinig. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): Only send messages + when we have a valid web process. + +2010-08-27 Adam Roben <aroben@apple.com> + + Use the Windows thread pool instead of a dedicated thread for + WorkQueue on Windows + + WorkQueue now uses ::RegisterWaitForSingleObject to find out when work + items need to be executed. This causes Windows to wait on the objects + on a thread pool wait thread, and then to spawn a thread pool worker + thread when an object is signaled. This is more efficient than using + our own dedicated thread to perform the wait and the work because + multiple WorkQueues (and even other parts of WebKit or other modules) + can all share the same wait thread and worker thread pool. + + Each time WorkQueue::m_performWorkEvent or any handle in + WorkQueue::m_handles is signaled, a worker thread will be spawned. + To maintain WorkQueue's serial nature, only one worker thread is + allowed to perform work items at a time. (The worker thread that is + actually performing work items is called the queue's "work thread".) + To accomplish this, worker threads must register as the queue's work + thread before performing work items. + WorkQueue::m_isWorkThreadRegistered is used as an atomic guard to make + sure that only one worker thread is registered at a time. + + Fixes <http://webkit.org/b/43150> <rdar://problem/8247280>. + + Reviewed by Anders Carlsson. + + * Platform/WorkQueue.h: + - Added the WorkItemWin class, which is used to wrap WorkItems for + WorkQueue's Windows implementation + - Changed m_workItemQueue and m_handles to hold + RefPtr<WorkItemWin>s + - Replaced "work queue thread"-related members with new members that + handle our thread pool code + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::WorkItemWin::WorkItemWin): + (WorkQueue::WorkItemWin::create): + Added simple constructor/creator. + + (WorkQueue::handleCallback): Added. This function is called whenever a + handle in WorkQueue::m_handles is signaled. We add the WorkItemWin + that corresponds to the handle (passed via the context parameter) to + the work item queue, then try to register as the work thread and + perform any queued work. If another thread is already registered as + the work thread, we just exit and let that thread handle the work we + queued. + (WorkQueue::registerHandle): Changed to wrap the WorkItem in a + WorkItemWin, and to use ::RegisterWaitForSingleObject to wait on the + handle. + (WorkQueue::eventCallback): Added. This function is called whenever + m_performWorkEvent is signaled. We try to register as the work thread + and perfom any queued work. If another thread is already registered as + the work thread, we just exit and let that thread handle the work. + (WorkQueue::performWorkOnRegisteredWorkThread): Added. Performs any + queued work in a loop until either the queue becomes invalid or no + work is left to perform. Unregisters as the work thread before exiting + so that other threads can perform work in the future. + (WorkQueue::platformInitialize): Added initialization of + m_isWorkThreadRegistered. Replaced code to spawn the old work queue + thread with a call to ::RegisterWaitForSingleObject so that a worker + thread from the thread pool will be spawned when m_performWorkEvent is + signaled. + (WorkQueue::tryRegisterAsWorkThread): Added. Attempts an atomic + compare-and-swap to change m_isWorkThreadRegistered from 0 to 1. If + sucessful, we return true to indicate that this thread is now + registered as the work thread. + (WorkQueue::unregisterAsWorkThread): Added. Uses an atomic + compare-and-swap to change m_isWorkThreadRegistered back from 1 to 0. + (WorkQueue::scheduleWork): Changed to wrap the WorkItem in a + WorkItemWin. Also added an optimization to avoid signaling + m_performWorkEvent when a work thread is already performing work, as + it will pick up the item we just queued without us having to do + anything. + +2010-08-31 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Fix warnings in WebKit2 directory + https://bugs.webkit.org/show_bug.cgi?id=44593 + + * Platform/CoreIPC/qt/ConnectionQt.cpp: Mark unused variables for compiler. + (CoreIPC::Connection::readyReadHandler): + (CoreIPC::Connection::sendOutgoingMessage): + * Shared/qt/WebEventFactoryQt.cpp: + (WebKit::WebEventFactory::createWebTouchEvent): Initialize state variable. Default case added. + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + (WebKit::toNP): Return initialized NPEvent. + +2010-08-31 Andras Becsi <abecsi@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Determine application path of MiniBrowser at runtime and use that path + for QtWebProcess if the executable exists in that path. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::launch): + +2010-08-31 Zoltan Horvath <zoltan@webkit.org> + + Build fix after r66448 on WebKit2. + + [Qt] qt_wk_didFinishDocumentLoadForFrame needs to be implemented + https://bugs.webkit.org/show_bug.cgi?id=44934 + + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_didFinishDocumentLoadForFrame): + * UIProcess/API/qt/ClientImpl.h: + +2010-08-30 Alice Liu <alice.liu@apple.com> + + Reviewed by Darin Adler. + + Add missing parts of didFinishDocumentLoadForFrame + https://bugs.webkit.org/show_bug.cgi?id=44913 + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Added new kind + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): Updated struct + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didFinishDocumentLoadForFrame): Added + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Added case for WebPageProxyMessage::DidFinishDocumentLoadForFrame + (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Added + * UIProcess/WebPageProxy.h: + + Just rearranging existing code in these: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didFinishDocumentLoadForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + +2010-08-30 Sam Weinig <sam@webkit.org> + + Try and fix the WebKit2 buildbot. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Add missing initialization of QTMovieDisableComponent. + +2010-08-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add URLRequest API for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=44910 + + Add WebURLRequest class and WKURLRequestRef C API to go with it. Right now, + instance of WKURLRequestRef are manipulated via platform types, a la the + WKStringRef and WKURLRef types. + + - Pipes WKPageLoadURLRequest through to the WebProcess. + + * Shared/APIObject.h: + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + * Shared/WebCoreArgumentCoders.h: + * Shared/WebURLRequest.cpp: Added. + (WebKit::WebURLRequest::WebURLRequest): + * Shared/WebURLRequest.h: Added. + (WebKit::WebURLRequest::create): + (WebKit::WebURLRequest::resourceRequest): + (WebKit::WebURLRequest::type): + * Shared/mac/WebCoreArgumentCodersMac.mm: Added. + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + * Shared/mac/WebURLRequestMac.mm: Added. + (WebKit::WebURLRequest::WebURLRequest): + (WebKit::WebURLRequest::platformRequest): + * Shared/qt/WebCoreArgumentCodersQt.cpp: Added. + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + * Shared/qt/WebURLRequestQt.cpp: Added. + (WebKit::WebURLRequest::WebURLRequest): + (WebKit::WebURLRequest::platformRequest): + * Shared/win/WebCoreArgumentCodersWin.cpp: Added. + (CoreIPC::encodeResourceRequest): + (CoreIPC::decodeResourceRequest): + * Shared/win/WebURLRequestWin.cpp: Added. + (WebKit::WebURLRequest::WebURLRequest): + (WebKit::WebURLRequest::platformRequest): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadURLRequest): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKURLRequest.cpp: Added. + (WKURLRequestGetTypeID): + * UIProcess/API/C/WKURLRequest.h: Added. + * UIProcess/API/C/WebKit2.h: + * UIProcess/API/C/cf/WKURLRequestCF.cpp: Added. + (WKURLRequestCreateWithCFURLRequest): + (WKURLRequestCopyCFURLRequest): + * UIProcess/API/C/cf/WKURLRequestCF.h: Added. + * UIProcess/API/C/mac: Added. + * UIProcess/API/C/mac/WKURLRequestNS.h: Added. + * UIProcess/API/C/mac/WKURLRequestNS.mm: Added. + (WKURLRequestCreateWithNSURLRequest): + (WKURLRequestCopyNSURLRequest): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::loadURLRequest): + * UIProcess/WebPageProxy.h: + * WebKit2.pro: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadURL): + (WebKit::WebPage::loadURLRequest): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-08-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WorkQueue leaks its dispatch queue + <rdar://problem/8358509> + https://bugs.webkit.org/show_bug.cgi?id=44689 + + * Platform/mac/WorkQueueMac.cpp: + (WorkQueue::platformInvalidate): + +2010-08-27 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Add UserContent API to WebKit2 InjectedBundle + <rdar://problem/8367587> + https://bugs.webkit.org/show_bug.cgi?id=44810 + + The new API differs from the version in WebKit1 in that the function do not take + a group name since we currently do not expose a way to make multiple PageGroups in + the API. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (toUserScriptInjectionTime): + (toUserContentInjectedFrames): + Add conversion functions for enums. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleAddUserScript): + (WKBundleAddUserStyleSheet): + (WKBundleRemoveUserScript): + (WKBundleRemoveUserStyleSheet): + (WKBundleRemoveUserScripts): + (WKBundleRemoveUserStyleSheets): + (WKBundleRemoveAllUserContent): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::toStringVector): + (WebKit::InjectedBundle::addUserScript): + (WebKit::InjectedBundle::addUserStyleSheet): + (WebKit::InjectedBundle::removeUserScript): + (WebKit::InjectedBundle::removeUserStyleSheet): + (WebKit::InjectedBundle::removeUserScripts): + (WebKit::InjectedBundle::removeUserStyleSheets): + (WebKit::InjectedBundle::removeAllUserContent): + * WebProcess/InjectedBundle/InjectedBundle.h: + Forward API to PageGroup. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::sharedPageGroup): + (WebKit::WebProcess::visitedLinkStateChanged): + (WebKit::WebProcess::allVisitedLinkStateChanged): + * WebProcess/WebProcess.h: Ad accessor for global PageGroup. + +2010-08-27 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Move WKBundle didCreatePage callback to outside the WebPage + constructor to avoid adoptRef errors. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::create): + (WebKit::WebPage::WebPage): + +2010-08-27 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/8147879> - Null URL passed to WebKit2 HistoryDelegate + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): WK2 now loads initial about:blank document's synchronously, + without consulting the policy delegate. + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto. + +2010-08-27 Adam Roben <aroben@apple.com> + + Handle ERROR_IO_INCOMPLETE more correctly in Connection + + We still don't know exactly why we're getting this error, but at least + we can do something sensible when we do. + + Fixes <http://webkit.org/b/44776> Occasional crash in + Connection::readEventHandler or assertion failure in + Connection::writeEventHandler due to ERROR_IO_INCOMPLETE + + Reviewed by Sam Weinig. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::readEventHandler): Bail out of this function + entirely when we get ERROR_IO_INCOMPLETE. We'll get called back later + when the read completes. Continuing in the function at this point + would cause us to treat an incomplete read as a complete one, leading + to a crash. Added an assertion to make the crash more understandable + in the future. + (CoreIPC::Connection::writeEventHandler): Bail out when we get + ERROR_IO_INCOMPLETE. We'll get called back later when the write + completes. + +2010-08-27 Adam Roben <aroben@apple.com> + + Make the web process pause on launch when the + WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH environment variable is set + + This is a bit easier to use than holding Ctrl-Alt-Shift during launch, + since the process can sometimes take a long time to launch under the + debugger. Ctrl-Alt-Shift still works, however. + + Fixes <http://webkit.org/b/44774> Would like an easier way to pause + the web process on launch + + Reviewed by Sam Weinig. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): + +2010-08-27 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Adam Roben. + + * WebKit2.xcodeproj/project.pbxproj: Make WKBundleScriptWorld.h public. + +2010-08-26 Daniel Bates <dbates@rim.com> + + Attempt to fix the Qt WebKit2 build. + + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Pass m_page.get() to WebKit::scroll() + instead of m_page since it expects a raw pointer. + +2010-08-26 Gavin Barraclough <barraclough@apple.com> + + Speculative windows build fix. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + +2010-08-26 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Adopt more uses OwnPtr/OwnArray in WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=44728 + + Also clears up weird create vs. adoption semantics. Now both create + and adopt both don't ref their pointers, adoption is just about the + buffer. + + * Shared/ImmutableArray.cpp: + (WebKit::ImmutableArray::ImmutableArray): + (WebKit::ImmutableArray::~ImmutableArray): + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::adopt): + * Shared/ImmutableDictionary.cpp: + (WebKit::ImmutableDictionary::keys): + * Shared/WebData.h: + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::create): + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaProxy::]): + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::QGraphicsWKView): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::init): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::create): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::create): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + * UIProcess/WebContext.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createPopupMenu): + (WebKit::WebChromeClient::createSearchPopupMenu): + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: + (WebKit::WebPopupMenu::create): + * WebProcess/WebCoreSupport/WebPopupMenu.h: + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: + (WebKit::WebSearchPopupMenu::create): + (WebKit::WebSearchPopupMenu::WebSearchPopupMenu): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::childFrames): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::close): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::corePage): + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + +2010-08-26 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=44726 + <rdar://problem/7935518> WebFrameProxies aren't destroyed until a page is destroyed + + Since frames can be moved across documents, they are not really a Page level concept. + Moved frame tracking to WebProcess/WebProcessProxy. + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::getStatistics): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::didCreateMainFrame): + (WebKit::WebPageProxy::didCreateSubFrame): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + (WebKit::WebProcessProxy::didClose): + (WebKit::WebProcessProxy::webFrame): + (WebKit::WebProcessProxy::frameCreated): + (WebKit::WebProcessProxy::frameDestroyed): + (WebKit::WebProcessProxy::disconnectFramesFromPage): + (WebKit::WebProcessProxy::frameCountInPage): + * UIProcess/WebProcessProxy.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::WebFrame): + (WebKit::WebFrame::invalidate): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::webFrame): + (WebKit::WebProcess::addWebFrame): + (WebKit::WebProcess::removeWebFrame): + * WebProcess/WebProcess.h: + +2010-08-26 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Add PassOwnArrayPtr + https://bugs.webkit.org/show_bug.cgi?id=44627 + + * UIProcess/WebContext.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + +2010-08-26 Peter Kasting <pkasting@google.com> + + Reviewed by Dimitri Glazkov. + + Misc. cleanup split off from bug 32356. + https://bugs.webkit.org/show_bug.cgi?id=44696 + + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + +2010-08-25 Brent Fulgham <bfulgham@webkit.org> + + Build fix, no review. + + Add conditional guards around Safari-specific + include files. + + * WebProcess/WebPage/win/WebPageWin.cpp: + +2010-08-25 Adam Roben <aroben@apple.com> + + Clean up Connection::open on Windows + + Fixes <http://webkit.org/b/44185>. + + Reviewed by Steve Falkenburg. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::platformInitialize): Set m_isConnected to true + since the pipe got connected before it was even given to us. + (CoreIPC::Connection::readEventHandler): Removed code that will never + run now that m_isConnected is always true when this function is + called. Since no outgoing messages will have been queued before + m_isConnected is set to true, there's no need to send them explicitly + here; they'll get sent as they're queued. + (CoreIPC::Connection::open): Removed the call to ::ConnectNamedPipe, + since the pipe is already connected by this point. Changed to schedule + a read in the server and client the same way (rather than using + ::SetEvent in the server). + +2010-08-19 Adam Roben <aroben@apple.com> + + Call NP_GetEntryPoints before NP_Initialize on Windows + + Doing otherwise will cause Flash and QuickTime to crash inside + NP_Initialize. + + Fixes <http://webkit.org/b/44270> <rdar://problem/8330393> Crash in + NP_Initialize when loading QuickTime when running + plugins/embed-attributes-setting.html in WebKit2 on Windows + + Reviewed by John Sullivan. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::tryLoad): On Windows, first call + NP_GetEntryPoints, then NP_Initialize. Do the reverse on Mac to + prevent Silverlight (e.g.) from crashing (see r38858). + +2010-08-25 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement WebKit::Module for qt + https://bugs.webkit.org/show_bug.cgi?id=44527 + + * Platform/Module.h: + * Platform/qt/ModuleQt.cpp: + (WebKit::Module::load): + (WebKit::Module::unload): + (WebKit::Module::platformFunctionPointer): + +2010-08-24 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + WebKit2 should launch the WebProcess in 32-bit mode if the UIProcess is in 32-bit mode + <rdar://problem/8348100> + https://bugs.webkit.org/show_bug.cgi?id=44537 + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): Use posix_spawnattr_setbinpref_np + to tell posix_spawn to launch the WebProcess in 32-bit mode when the UIProcess + is running in 32-bit mode. + +2010-08-24 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Sam Weinig. + + Set the install path of WebKit2.framework to the build directory for debug and release builds + to match our other frameworks. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-08-24 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Update profile. + + * WebProcess/com.apple.WebProcess.sb: + +2010-08-23 Darin Adler <darin@apple.com> + + Reviewed by Geoff Garen. + + * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: + (WKBundleNodeGetParent): Update since parent now returns a + ContainerNode*. The toRef function is a bit too picky to convert + it without a bit of help. + +2010-08-23 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65703. + http://trac.webkit.org/changeset/65703 + https://bugs.webkit.org/show_bug.cgi?id=44460 + + "Causing lots of crashes on Snow Leopard when running the + layout tests" (Requested by eseidel2 on #webkit). + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::tryLoad): + +2010-08-23 Jon Honeycutt <jhoneycutt@apple.com> + + Layout tests do not run when using WebKitTestRunner in a Debug build. + https://bugs.webkit.org/show_bug.cgi?id=44409 + + Reviewed by Dan Bernstein. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::launchProcess): + Use WebKit2WebProcess_debug.exe when building Debug. + +2010-08-23 Daniel Bates <dbates@rim.com> + + Rubber-stamped by Adam Roben. + + Substitute "sizeof("javascript:") - 1" for the hardcoded constant 11 when + extracting the JavaScript code portion of a JavaScript URL so as to make + it clearer that the 11 represents the length of the scheme portion of + a JavaScript URL. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performJavaScriptURLRequest): + +2010-08-23 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Ariya Hidayat. + + [Qt] Find needed forwarding headers for WebKit2 automatically + https://bugs.webkit.org/show_bug.cgi?id=44336 + + * DerivedSources.pro: Use the new enumerate-included-framework-headers script for generating + the list of forwarding headers we want to create. + +2010-08-23 Zoltan Horvath <zoltan@webkit.org> + + [Qt] Build fix. + + * DerivedSources.pro: + * WebKit2.pro: + * WebProcess/Plugins/Netscape/qt: Added. + * WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: Added. + (WebKit::NetscapePlugin::platformPostInitialize): + (WebKit::NetscapePlugin::platformPaint): + (WebKit::toNP): + (WebKit::NetscapePlugin::platformHandleMouseEvent): + (WebKit::NetscapePlugin::platformHandleWheelEvent): + (WebKit::NetscapePlugin::platformSetFocus): + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + +2010-08-22 Juha Savolainen <juha.savolainen@weego.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Add QTouchEvents support for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=44330 + + This patch adds support for QTouchEvents in WebKit2. A new WebEvent-class + is created for touchevents, WebTouchEvent. Also touchpoints needed a new + class, WebPlatformTouchPoint. This is similar solution like in other + events(like MouseEvent) on WebKit2. These classes are introduced in WebEvent.h + Also there was a need to create an empty constructor to PlatformTouchPoint-class. + + * DerivedSources.pro: + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + (WebPageMessage::): + * Shared/WebEvent.h: + (WebKit::WebEvent::): + (WebKit::WebTouchPoint::): + (WebKit::WebTouchPoint::WebTouchPoint): + (WebKit::WebTouchPoint::id): + (WebKit::WebTouchPoint::state): + (WebKit::WebTouchPoint::screenPosX): + (WebKit::WebTouchPoint::screenPosY): + (WebKit::WebTouchPoint::posX): + (WebKit::WebTouchPoint::posY): + (WebKit::WebTouchPoint::setState): + (WebKit::WebTouchPoint::encode): + (WebKit::WebTouchPoint::decode): + (WebKit::WebTouchEvent::WebTouchEvent): + (WebKit::WebTouchEvent::type): + (WebKit::WebTouchEvent::touchPoints): + (WebKit::WebTouchEvent::encode): + (WebKit::WebTouchEvent::decode): + (WebKit::WebTouchEvent::isTouchEventType): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint): + (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent): + (WebKit::platform): + * Shared/WebEventConversion.h: + * Shared/qt/WebEventFactoryQt.cpp: + (WebKit::webEventTypeForEvent): + (WebKit::WebEventFactory::createWebTouchEvent): + * Shared/qt/WebEventFactoryQt.h: + * UIProcess/API/qt/qgraphicswkview.cpp: + (QGraphicsWKView::event): + (QGraphicsWKView::touchEvent): + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::touchEvent): + * UIProcess/API/qt/qwkpage_p.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::touchEvent): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::touchEvent): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-08-21 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Remove specialized retain/release functions in favor of a single one for WKTypeRefs + https://bugs.webkit.org/show_bug.cgi?id=44386 + + * UIProcess/API/C/WKArray.cpp: + (WKArrayGetSize): + * UIProcess/API/C/WKArray.h: + * UIProcess/API/C/WKBackForwardList.cpp: + (WKBackForwardListCopyForwardListWithLimit): + * UIProcess/API/C/WKBackForwardList.h: + * UIProcess/API/C/WKBackForwardListItem.cpp: + (WKBackForwardListItemCopyTitle): + * UIProcess/API/C/WKBackForwardListItem.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKData.cpp: + (WKDataGetSize): + * UIProcess/API/C/WKData.h: + * UIProcess/API/C/WKDictionary.cpp: + (WKDictionaryCopyKeys): + * UIProcess/API/C/WKDictionary.h: + * UIProcess/API/C/WKError.h: + * UIProcess/API/C/WKFormSubmissionListener.cpp: + (WKFormSubmissionListenerContinue): + * UIProcess/API/C/WKFormSubmissionListener.h: + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetPage): + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKFramePolicyListener.cpp: + (WKFramePolicyListenerIgnore): + * UIProcess/API/C/WKFramePolicyListener.h: + * UIProcess/API/C/WKNavigationData.cpp: + (WKNavigationDataCopyURL): + * UIProcess/API/C/WKNavigationData.h: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPageNamespace.cpp: + (WKPageNamespaceGetContext): + * UIProcess/API/C/WKPageNamespace.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesCreate): + (WKPreferencesGetLocalStorageEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/C/WKString.cpp: + * UIProcess/API/C/WKString.h: + * UIProcess/API/C/WKType.cpp: + (WKRetain): + (WKRelease): + * UIProcess/API/C/WKType.h: + * UIProcess/API/C/WKURL.cpp: + (WKURLGetTypeID): + * UIProcess/API/C/WKURL.h: + * UIProcess/API/cpp/WKRetainPtr.h: + * UIProcess/API/win/WKView.cpp: + * UIProcess/API/win/WKView.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::shared): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: + (WKBundleNodeHandleGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp: + (WKBundleScriptWorldNormalWorld): + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h: + +2010-08-20 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Antonio Gomes. + + [Qt] Implement cursor change in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=44263 + + Implemented PageClient::setCursor. + * UIProcess/API/qt/qgraphicswkview.cpp: Added updateCursor slot to be connected to the QWKPage::setCursor signal. + (QGraphicsWKView::QGraphicsWKView): + (QGraphicsWKView::updateCursor): Sets the cursor of the widget. + * UIProcess/API/qt/qgraphicswkview.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::setCursor): Added implementation for PageClient::setCursor. Emitting singal through the QWKPage. + * UIProcess/API/qt/qwkpage.h: Added setCursor signal. + * UIProcess/API/qt/qwkpage_p.h: + +2010-08-19 David Kilzer <ddkilzer@apple.com> + + BUILD FIX: Fix Mac build after Windows WebKit2 changes for Netscape Plug-ins + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPaint): Changed frameRect() to + m_frameRect. + +2010-08-19 Adam Roben <aroben@apple.com> + + Send mouse events to windowless plugins on Windows + + This seems to have been the last issue blocking us from playing videos + on vimeo.com. + + Fixes <http://webkit.org/b/44276> <rdar://problem/8330398> Can't click + play button in vimeo.com Flash video player in WebKit2 on Windows + + Reviewed by Sam Weinig. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::toNP): Added. Converts a WebMouseEvent to an NPEvent. Code + was adapted from WebCore's PluginViewWin.cpp. + + (WebKit::NetscapePlugin::platformHandleMouseEvent): + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + Convert the WebMouseEvent to an NPEvent and send it to the plugin. + +2010-08-19 Adam Roben <aroben@apple.com> + + Add support for painting windowless plugins on Windows + + This gets the video on the front page of vimeo.com painting (though + you can't make it play because we don't support mouse events yet). + + Fixes <http://webkit.org/b/44274> <rdar://problem/8330395> Windowless + plugins don't paint in WebKit2 on Windows + + Reviewed by Sam Weinig. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): Tell the plugin that we support windowless + mode on Windows. + (WebKit::NPN_SetValue): Implemented handling of NPPVpluginWindowBool + by calling through to NetscapePlugin::setIsWindowed. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): Added initialization of + m_isWindowed. It defaults to false on Mac and true on other platforms, + matching WebCore's PluginView. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added m_isWindowed. + (WebKit::NetscapePlugin::setIsWindowed): Added standard setter. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPaint): Moved Mac-specific context + translation code here from PluginView::paint. + + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: + (WebKit::NetscapePlugin::platformPaint): Implemented. Code was ported + from WebCore's PluginViewWin.cpp. + + * WebProcess/Plugins/Plugin.h: Updated the comment for Plugin::paint + to explain the coordinate system of the context. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::paint): Changed to translate the context from + document to window coordinates. We were previously trying to translate + to plugin-local coordinates, but this only worked for documents whose + origin was the same as the window's origin (i.e., the main frame). The + plugin takes care of any further translations needed. (Mac translates + the context into plugin-local coordinates, and Windows leaves it in + window coordinates.) + +2010-08-19 Adam Roben <aroben@apple.com> + + Implement PluginInfoStore::pluginsDirectories + + This makes WebKit2 able to find and load Flash on Windows. + + Note that we aren't yet respecting the MozillaPlugins registry key. + That's covered by <http://webkit.org/b/44271>. + + Fixes <http://webkit.org/b/43510> <rdar://problem/8273827> WebKit2 + should load plugins from the same directories as old-WebKit + + Reviewed by Jon Honeycutt and Ada Chan. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::parseVersionString): + (WebKit::compareVersions): + (WebKit::safariPluginsDirectory): + (WebKit::addMozillaPluginDirectories): + (WebKit::addWindowsMediaPlayerPluginDirectory): + (WebKit::addQuickTimePluginDirectory): + (WebKit::addAdobeAcrobatPluginDirectory): + (WebKit::addMacromediaPluginDirectories): + (WebKit::PluginInfoStore::pluginsDirectories): + Ported (and ever-so-slightly cleaned up) code from WebCore's + PluginDatabaseWin.cpp. + +2010-08-19 Adam Roben <aroben@apple.com> + + Call NP_GetEntryPoints before NP_Initialize on Windows + + Doing otherwise will cause Flash and QuickTime to crash inside + NP_Initialize. + + Fixes <http://webkit.org/b/44270> <rdar://problem/8330393> Crash in + NP_Initialize when loading QuickTime when running + plugins/embed-attributes-setting.html in WebKit2 on Windows + + Reviewed by Sam Weinig. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::tryLoad): On Windows, first call + NP_GetEntryPoints, then NP_Initialize. Do the reverse on Mac to + prevent Silverlight (e.g.) from crashing (see r38858). + +2010-08-19 Adam Roben <aroben@apple.com> + + Add NetscapePluginWin.cpp + + Fixes <http://webkit.org/b/44269> <rdar://problem/8330391> + NetscapePlugin.h contains functions that should be in + NetscapePluginWin.cpp + + Reviewed by Sam Weinig. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Moved functions from + here... + * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp: ...to here. + + * win/WebKit2.vcproj: Added NetscapePluginWin.cpp and let VS reorder + the file list. + +2010-08-19 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Add modifier key info to policy client functions in WebKit2 + <rdar://problem/8185298> + https://bugs.webkit.org/show_bug.cgi?id=44280 + + * UIProcess/API/C/WKAPICast.h: + Add conversion function for modifiers and rename an incorrectly named + toWK to toRef. + + * UIProcess/API/C/WKPage.h: + Add WKEventModifiers enum. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + * UIProcess/WebPolicyClient.h: + Pipe through modifier info. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::modifiersForNavigationAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + Get modifier info out of the NavigationInfo class in the same manner as + WebKit1. + +2010-08-18 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Add ability to get all the keys from a WKDictionaryRef + https://bugs.webkit.org/show_bug.cgi?id=44221 + + * Shared/ImmutableDictionary.cpp: + (WebKit::ImmutableDictionary::keys): + * Shared/ImmutableDictionary.h: + Add keys function. + + * UIProcess/API/C/WKDictionary.cpp: + (WKDictionaryCopyKeys): + * UIProcess/API/C/WKDictionary.h: + Wrap keys function. + +2010-08-18 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Add ability to set custom userAgent for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=44215 + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + (WebPageMessage::): + * UIProcess/API/C/WKPage.cpp: + (WKPageSetCustomUserAgent): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setCustomUserAgent): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::userAgent): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setCustomUserAgent): + (WebKit::WebPage::userAgent): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-08-18 Sam Weinig <sam@webkit.org> + + Rubber-stamped by John Sullivan. + + Make WKBundleNodeHandleRef usable from WKRetainPtr. + + * WebKit2.xcodeproj/project.pbxproj: Make WKBundleNodeHandle.h public. + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: Add WKRetain/WKRelease overloads. + +2010-08-18 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Forwards QtWebProcess' stdout, stderr onto the UI process + https://bugs.webkit.org/show_bug.cgi?id=44159 + + For debugging purposes forwards stdout and stderr of QtWebProcess onto the UI process. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::launch): + +2010-08-17 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + Preparation: Just add the files to the build system. + + * WebKit2.xcodeproj/project.pbxproj: Added new files. + * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h: Added. + Placeholder with tentative code that might be changed when landing + the rest of it. + * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Added. + Empty placeholder for now. + +2010-08-16 Jon Honeycutt <jhoneycutt@apple.com> + + Allow some tests to pass in WebKitTestRunner before SharedMemory and + PluginInfoStore are implemented on Windows. + + Reviewed by Sam Weinig. + + * Platform/win/SharedMemoryWin.cpp: + Disable not implemented warnings. + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + Ditto. + +2010-08-16 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Remove unnecessary includes from UString.h, add new includes as necessary. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + +2010-08-16 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * Shared/win/CommandLineWin.cpp: + +2010-08-16 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Remove #includes of <WebCore/PlatformString.h> in favor of <wtf/text/WTFString.h> + + * Platform/Module.cpp: + * Platform/Module.h: + * Shared/CommandLine.h: + * Shared/WebCoreArgumentCoders.h: + * Shared/WebEvent.h: + * Shared/WebNavigationDataStore.h: + * Shared/WebPreferencesStore.h: + * Shared/WebString.h: + * Shared/WebURL.h: + * Shared/mac/CommandLineMac.cpp: + * Shared/qt/UpdateChunk.cpp: + * UIProcess/API/C/WKContext.cpp: + * UIProcess/API/C/cf/WKStringCF.cpp: + * UIProcess/API/C/cf/WKURLCF.cpp: + * UIProcess/API/cpp/qt/WKStringQt.cpp: + * UIProcess/API/cpp/qt/WKURLQt.cpp: + * UIProcess/API/mac/PageClientImpl.mm: + * UIProcess/API/qt/qgraphicswkview.cpp: + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + * UIProcess/WebBackForwardListItem.cpp: + * UIProcess/WebBackForwardListItem.h: + * UIProcess/WebContext.h: + * UIProcess/WebContextInjectedBundleClient.cpp: + * UIProcess/WebFrameProxy.cpp: + * UIProcess/WebFrameProxy.h: + * UIProcess/WebPageProxy.h: + * UIProcess/WebPolicyClient.cpp: + * UIProcess/WebProcessProxy.cpp: + * UIProcess/WebUIClient.cpp: + * UIProcess/win/WebView.cpp: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + * WebProcess/Plugins/JSNPObject.cpp: + * WebProcess/Plugins/NPJSObject.cpp: + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebKitMain.cpp: + * WebProcess/win/WebProcessMainWin.cpp: + +2010-08-16 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Null CFURLRef returned from provisionalURL after searching on zillow.com + <rdar://problem/8261812> + https://bugs.webkit.org/show_bug.cgi?id=44072 + + Conversion from WKURLRef to CFRURLRef was breaking on URLs using characters + such as '{'. + + * UIProcess/API/C/cf/WKURLCF.cpp: + (WKURLCopyCFURL): Use code similar to that found in KURLCFNet.cpp for conversion. + +2010-08-16 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Remove unnecessary copy constructor, assignment operator and swap function. + The defaults (for all except swap) should do just fine. + + * Shared/WebPreferencesStore.cpp: + * Shared/WebPreferencesStore.h: + +2010-08-16 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + Handle content size change in WebKit2 + Re-landing after fix. + + https://bugs.webkit.org/show_bug.cgi?id=43198 + + Based on the work of Antti Koivisto. + Send message to the UI client when the contents size has changed through the WebChromeClient + and propagate it to the WKPageUIClient. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): Added ContentsSizeChanged message kind. + * UIProcess/API/C/WKPage.h: Added WKPageContentsSizeChangedCallback callback to the WKPageUIClient. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): Initialize the new callback to 0. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Handle ContentsSizeChanged message. Calls contetsSizeChanged. + (WebKit::WebPageProxy::contentsSizeChanged): Added. Propagate the event to the the UI client. + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::contentsSizeChanged): Added. Propagate the event forward to the WKPageUIClient. + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): Implemented. + +2010-08-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65419. + http://trac.webkit.org/changeset/65419 + https://bugs.webkit.org/show_bug.cgi?id=44053 + + Broke the Windows build (Requested by bbandix on #webkit). + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + +2010-08-16 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + Handle content size change in WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=43198 + + Based on the work of Antti Koivisto. + Send message to the UI client when the contents size has changed through the WebChromeClient + and propagate it to the WKPageUIClient. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): Added ContentsSizeChanged message kind. + * UIProcess/API/C/WKPage.h: Added WKPageContentsSizeChangedCallback callback to the WKPageUIClient. + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): Initialize the new callback to 0. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Handle ContentsSizeChanged message. Calls contetsSizeChanged. + (WebKit::WebPageProxy::contentsSizeChanged): Added. Propagate the event to the the UI client. + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::contentsSizeChanged): Added. Propagate the event forward to the WKPageUIClient. + * UIProcess/WebUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): Implemented. + +2010-08-16 Balazs Kelemen <kb@inf.u-szeged.hu> + + Unreviewed Qt WebKit2 build fix. + + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::platformSetUpWebProcess): Added empty stub implementation. + * WebKit2.pro: Enumerate new files, include WebKit.pri for correct define macro set. + +2010-08-15 Dan Bernstein <mitz@apple.com> + + Revised build fix from r65363 based on suggestion from Darin Adler. + + * UIProcess/API/C/WKArray.h: Include stddef.h. + * UIProcess/API/C/WKBase.h: Uninclude ctype.h. + * UIProcess/API/C/WKData.h: Include stddef.h. + * UIProcess/API/C/WKDictionary.h: Ditto. + +2010-08-14 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson in Sweden. + + Clean build of WebKitTestRunner fails with “'size_t' has not been declared” in WKArray.h + https://bugs.webkit.org/show_bug.cgi?id=44005 + + * UIProcess/API/C/WKBase.h: Include ctype.h. + +2010-08-13 Sam Weinig <sam@webkit.org> + + Fix build. + + * WebKit2.xcodeproj/project.pbxproj: Make WKDictionary.h public. + +2010-08-13 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Pass values map to willSubmitForm in WebKit2 API + Part of <rdar://problem/8255932> + https://bugs.webkit.org/show_bug.cgi?id=43995 + + * Platform/CoreIPC/ArgumentCoders.h: + (CoreIPC::): + Add overload for std::pair. + + * Shared/ImmutableDictionary.h: + (WebKit::ImmutableDictionary::adopt): + Fix function signature by removing size parameter. + + * UIProcess/API/C/WKPage.h: + Add dictionary parameter to callback. + + * UIProcess/WebFormClient.cpp: + (WebKit::WebFormClient::willSubmitForm): + Create an ImmutableDictionary from the vector of string pairs. + + * UIProcess/WebFormClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::willSubmitForm): + * UIProcess/WebPageProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + Plumb through the values vector. + +2010-08-13 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Add dictionary API type + https://bugs.webkit.org/show_bug.cgi?id=43990 + + Add an immutable dictionary type (WKStringRef -> WKTypeRef). + + * Shared/APIObject.h: + (WebKit::APIObject::): + Add new APIType. + + * Shared/ImmutableDictionary.cpp: Added. + (WebKit::ImmutableDictionary::ImmutableDictionary): + (WebKit::ImmutableDictionary::~ImmutableDictionary): + * Shared/ImmutableDictionary.h: Added. + (WebKit::ImmutableDictionary::create): + (WebKit::ImmutableDictionary::adopt): + (WebKit::ImmutableDictionary::get): + (WebKit::ImmutableDictionary::size): + (WebKit::ImmutableDictionary::): + (WebKit::ImmutableDictionary::type): + Add basic implementation + + * UIProcess/API/C/WKAPICast.h: + (WebKit::): + Add new mappings. + + * UIProcess/API/C/WKBase.h: + Add new opaque type. + + * UIProcess/API/C/WKDictionary.cpp: Added. + (WKDictionaryGetTypeID): + (WKDictionaryGetItemForKey): + (WKDictionaryGetSize): + (WKDictionaryRetain): + (WKDictionaryRelease): + * UIProcess/API/C/WKDictionary.h: Added. + Add API wrappings. + + * UIProcess/API/C/WebKit2.h: + Add missing public headers. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add new files. + +2010-08-13 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Add form submission listener to WebKit2 + Part of <rdar://problem/8255932> + https://bugs.webkit.org/show_bug.cgi?id=43947 + + * Shared/APIObject.h: + Add TypeFormSubmissionListener APIType. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + Add WillSubmitForm message kind. + + * UIProcess/API/C/WKAPICast.h: + Add new mappings for WKFormSubmissionListenerRef -> WebFormSubmissionListener + + * UIProcess/API/C/WKBase.h: + Add OpaqueWKFormSubmissionListener and rename the other opaque types to match. + + * UIProcess/API/C/WKFormSubmissionListener.cpp: Added. + (WKFormSubmissionListenerGetTypeID): + (WKFormSubmissionListenerContinue): + (WKFormSubmissionListenerRetain): + (WKFormSubmissionListenerRelease): + * UIProcess/API/C/WKFormSubmissionListener.h: Added. + Add C wrapper for WebFormSubmissionListener. + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageFormClient): + * UIProcess/API/C/WKPage.h: + Add WKPageFormClient with willSubmitForm callback. Additional callbacks will be added as + needed. + + * UIProcess/API/C/WebKit2.h: + Add include for WKFormSubmissionListener.h + + * UIProcess/WebFormClient.cpp: Added. + (WebKit::WebFormClient::WebFormClient): + (WebKit::WebFormClient::initialize): + (WebKit::WebFormClient::willSubmitForm): + * UIProcess/WebFormClient.h: Added. + Add client for form related delagations. + + * UIProcess/WebFormSubmissionListenerProxy.cpp: Added. + (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy): + (WebKit::WebFormSubmissionListenerProxy::continueSubmission): + * UIProcess/WebFormSubmissionListenerProxy.h: Added. + (WebKit::WebFormSubmissionListenerProxy::create): + (WebKit::WebFormSubmissionListenerProxy::type): + * UIProcess/WebFrameListenerProxy.cpp: Copied from UIProcess/WebFramePolicyListenerProxy.cpp. + Add new type of listener for form submissions. It inherits from the new base class + for listeners, WebFrameListenerProxy. + + (WebKit::WebFrameListenerProxy::WebFrameListenerProxy): + (WebKit::WebFrameListenerProxy::~WebFrameListenerProxy): + (WebKit::WebFrameListenerProxy::invalidate): + (WebKit::WebFrameListenerProxy::receivedPolicyDecision): + * UIProcess/WebFrameListenerProxy.h: Copied from UIProcess/WebFramePolicyListenerProxy.h. + Move logic that would have to be shared between WebFramePolicyListenerProxy and + WebFormSubmissionListenerProxy into shared base class. + + * UIProcess/WebFramePolicyListenerProxy.cpp: + (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy): + * UIProcess/WebFramePolicyListenerProxy.h: + (WebKit::WebFramePolicyListenerProxy::create): + (WebKit::WebFramePolicyListenerProxy::type): + Move to inheriting from WebFrameListenerProxy. + + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::disconnect): + (WebKit::WebFrameProxy::receivedPolicyDecision): + (WebKit::WebFrameProxy::setUpPolicyListenerProxy): + (WebKit::WebFrameProxy::setUpFormSubmissionListenerProxy): + * UIProcess/WebFrameProxy.h: + Change listener functions to act on WebFrameListenerProxys and add setUpFormSubmissionListenerProxy. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeFormClient): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::willSubmitForm): + * UIProcess/WebPageProxy.h: + Plumb through willSubmitForm call as we do with the other listeners. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): + Ditto. + + * WebKit2.xcodeproj/project.pbxproj: Add new files. + * win/WebKit2.vcproj: Add new files. + * win/WebKit2Generated.make: Ditto. + +2010-08-13 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::npIdentifierFromIdentifier): + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::enumerate): + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65295. + http://trac.webkit.org/changeset/65295 + https://bugs.webkit.org/show_bug.cgi?id=43950 + + It broke 4 sputnik tests (Requested by Ossy on #webkit). + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::npIdentifierFromIdentifier): + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::enumerate): + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + +2010-08-12 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::npIdentifierFromIdentifier): + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::enumerate): + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + +2010-08-12 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Sam Weinig. + + WebKit2 crashes when WebFrame outlives WebPage + https://bugs.webkit.org/show_bug.cgi?id=43939 + + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebKit::WebChromeClient::page): Add this method, to allow + WebFrame to retrieve its WebPage following WebCore pointers. + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::WebFrame): Do not initialize m_page (it's gone). + (WebKit::WebFrame::page): Don't use the data member, get it from + WebCore. + (WebKit::WebFrame::invalidate): Use method to get page() and null check. + (WebKit::WebFrame::isMainFrame): ditto + * WebProcess/WebPage/WebFrame.h: + +2010-08-12 Jon Honeycutt <jhoneycutt@apple.com> + + WebKit2 needs to initialize SafariTheme + https://bugs.webkit.org/show_bug.cgi?id=43901 + + Reviewed by Sam Weinig. + + * WebProcess/win/WebProcessMainWin.cpp: + (WebKit::initializeSafariTheme): + Copied from old WebKit. + (WebKit::WebProcessMain): + If we're using SafariTheme, initialize it. + +2010-08-12 Jon Honeycutt <jhoneycutt@apple.com> + + WebKitTestRunner needs to run tests without using native controls + https://bugs.webkit.org/show_bug.cgi?id=43772 + + Reviewed by Sam Weinig. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + Add a new message. + + * UIProcess/API/C/win/WKContextPrivateWin.h: Added. + Declare WKContextSetShouldPaintNativeControls(). + + * UIProcess/API/C/win/WKContextWin.cpp: Added. + (WKContextSetShouldPaintNativeControls): + Call the WebContext's setShouldPaintNativeControls(). + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + Initialize m_shouldPaintNativeControls. + (WebKit::WebContext::ensureWebProcess): + If we created a web process, call platformSetUpWebProcess(). + + * UIProcess/WebContext.h: + Declare new functions and a member to store whether we should paint + native controls. + + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformSetUpWebProcess): + Stubbed. + + * UIProcess/win/WebContextWin.cpp: + (WebKit::WebContext::setShouldPaintNativeControls): + Set m_shouldPaintNativeControls. If we have a valid web process, send a + SetShouldPaintNativeControls message. + (WebKit::WebContext::platformSetUpWebProcess): + Send a SetShouldPaintNativeControls message. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + If this is a SetShouldPaintNativeControls message, decode the argument, + and call Settings::setShouldPaintNativeControls(). + + * win/WebKit2.vcproj: + Add WKContextPrivateWin.h and WKContextWin.cpp to project. + + * win/WebKit2Generated.make: + Copy WKContextPrivateWin.h. + +2010-08-11 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Add SPI to stop loading from the InjectedBundle. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageStopLoading): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.h: + +2010-08-11 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + WKPageStopLoading always asserts + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::didReceiveMessage): Switch break to return, break made us + hit the ASSERT_NOT_REACHED at the end of the function. + +2010-08-11 Balazs Kelemen <kb@inf.u-szeged.hu> + + Unreviewed build fix. + + [Qt] Update WebKit2 build environment, add stub implementation of SharedMemory. + + * DerivedSources.pro: + * Platform/qt/SharedMemoryQt.cpp: Added. + (WebKit::SharedMemory::Handle::Handle): + (WebKit::SharedMemory::Handle::~Handle): + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + (WebKit::SharedMemory::create): + (WebKit::SharedMemory::~SharedMemory): + (WebKit::SharedMemory::createHandle): + (WebKit::SharedMemory::systemPageSize): + * WebKit2.pro: + * WebKit2Prefix.h: + +2010-08-11 Mark Rowe <mrowe@apple.com> + + Build fix. Update references to StringHash.h. + + * Shared/CommandLine.h: + * UIProcess/WebContext.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/win/WebProcessMainWin.cpp: + +2010-08-10 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Add leakRef and clear to all RefPtr variants + https://bugs.webkit.org/show_bug.cgi?id=42389 + + * UIProcess/API/cpp/WKRetainPtr.h: Changed all uses of "template <...>" to + "template<...>". Defined many of the inlined functions outside the class + definition, to avoid style checker warnings about multiple statements on + a single line and for slightly better clarity of the class definition itself. + Renamed releaseRef to leakRef. Added a releaseRef that calls leakRef so we + don't have to rename all callers at once. Added a clear function. + +2010-08-10 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Antonio Gomes. + + [Qt] Build WebKit2 into a static lib + + https://bugs.webkit.org/show_bug.cgi?id=43621 + + * WebKit2.pri: Added. Defined addWebKit2Lib function that defines how to link against the static lib. + * WebKit2.pro: Build specification for the WebKit2 framework. + * WebProcess.pro: Copied from WebKit2/WebKit2.pro. Build specification for the WebProcess binary. + +2010-08-09 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey Garen. + + Add zoom support for injected bundle + https://bugs.webkit.org/show_bug.cgi?id=43759 + + Add SPI to change the zoom factor for a page. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (toZoomMode): + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetZoomFactor): + (WKBundlePageSetZoomFactor): + (WKBundlePageSetZoomMode): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::zoomFactor): + (WebKit::WebPage::setZoomFactor): + (WebKit::WebPage::setZoomMode): + * WebProcess/WebPage/WebPage.h: + +2010-08-06 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43594 - Add string forwards to Forward.h + This allows us to remove forward declarations for these classes from + WebCore/WebKit (a step in moving these class from WebCore:: to WTF::). + + * UIProcess/PageClient.h: + * UIProcess/VisitedLinkProvider.h: + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebFrameProxy.h: + * UIProcess/WebHistoryClient.h: + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPolicyClient.h: + * UIProcess/WebProcessProxy.h: + * UIProcess/WebUIClient.h: + * UIProcess/win/WebView.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + * WebProcess/Plugins/PluginController.h: + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.h: + +2010-08-09 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] No need for PageClientImpl + + https://bugs.webkit.org/show_bug.cgi?id=43728 + + Remove PageClientImpl, take the implementation of WebKit::PageClient into QWKPagePrivate. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::toolTipChanged): + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::pageDidEnterAcceleratedCompositing): + (QWKPagePrivate::pageDidLeaveAcceleratedCompositing): + (QWKPagePrivate::processDidExit): + (QWKPagePrivate::processDidRevive): + (QWKPagePrivate::setCursor): + (QWKPagePrivate::takeFocus): + +2010-08-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKitTestRunner needs to print onunload handler information + <rdar://problem/8213831> + https://bugs.webkit.org/show_bug.cgi?id=42703 + + Add SPI to get the number of pending unload events. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetPendingUnloadCount): + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::pendingUnloadCount): + * WebProcess/WebPage/WebFrame.h: + +2010-08-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add additional loader client functions need to complete WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=43684 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame): + (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame): + (WebKit::InjectedBundlePageLoaderClient::didChangeLocationWithinPageForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFinishDocumentLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didHandleOnloadEventsForFrame): + (WebKit::InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame): + (WebKit::InjectedBundlePageLoaderClient::didRunInsecureContentForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidHandleOnloadEvents): + (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect): + (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect): + (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): + (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): + (WebKit::WebFrameLoaderClient::didDisplayInsecureContent): + (WebKit::WebFrameLoaderClient::didRunInsecureContent): + +2010-08-07 Sam Weinig <sam@webkit.org> + + Another fix for the windows build. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::isAcceleratedCompositingEnabled): + +2010-08-07 Sam Weinig <sam@webkit.org> + + Fix windows build. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::platformLayer): + * WebProcess/Plugins/PluginView.h: + +2010-08-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKitTestRunner needs GCController + <rdar://problem/8213834> + https://bugs.webkit.org/show_bug.cgi?id=42701 + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleGarbageCollectJavaScriptObjects): + (WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging): + (WKBundleGetJavaScriptObjectsCount): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::garbageCollectJavaScriptObjects): + (WebKit::InjectedBundle::garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging): + (WebKit::InjectedBundle::javaScriptObjectsCount): + * WebProcess/InjectedBundle/InjectedBundle.h: + +2010-08-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + CA drawing model support for Mac Plugins + https://bugs.webkit.org/show_bug.cgi?id=43678 + <rdar://problem/7929701> + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Handle WKNVSupportsCompositingCoreAnimationPluginsBool and + NPNVsupportsCoreAnimationBool and return true if accelerated compositing is enabled. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::isAcceleratedCompositingEnabled): + Call PluginController::isAcceleratedCompositingEnabled. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::NetscapePlugin::platformPostInitialize): + If the plug-in uses the Core Animation drawing model, ask it for its layer. + + (WebKit::NetscapePlugin::platformPaint): + Don't send draw events if the Core Animation drawing model is used. + + (WebKit::NetscapePlugin::pluginLayer): + Return the plug-in layer. + + * WebProcess/Plugins/Plugin.h: + Add a pluginLayer pure virtual member function. + + * WebProcess/Plugins/PluginController.h: + Add an isAcceleratedCompositingEnabled pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::initializePlugin): + If the plug-in has a layer, enter compositing mode. + + (WebKit::PluginView::platformLayer): + Ask the plug-in for its layer. + + (WebKit::PluginView::isAcceleratedCompositingEnabled): + Call Settings::acceleratedCompositingEnabled. + + * WebProcess/Plugins/PluginView.h: + +2010-08-06 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Delete key doesn't go Back in WebKit2 + <rdar://problem/8272978> + https://bugs.webkit.org/show_bug.cgi?id=43665 + + - Adds support for delete key going back (mac only for now) + - Adds support for command-left/command right going back/forward + - Flesh out scrolling due to arrow keys on the mac to match old webkit. + - Made performDefaultBehaviorForKeyEvent platform specific and added + a boolean return value which will be used later to inform the UI process + about what events have been processed. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * UIProcess/API/mac/WKView.mm: + (-[WKView _wantsKeyDownForEvent:]): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveSyncMessage): + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::WebBackForwardListProxy::backItem): + (WebKit::WebBackForwardListProxy::forwardItem): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::keyEvent): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::scroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::scroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::scroll): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + +2010-08-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64904. + http://trac.webkit.org/changeset/64904 + https://bugs.webkit.org/show_bug.cgi?id=43671 + + Broke the Qt Windows builders. (Requested by bbandix on + #webkit). + + * WebKit2.pri: Removed. + * WebKit2.pro: + * WebProcess.pro: Removed. + +2010-08-07 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Eric Seidel. + + NPAPI headers should be included through npruntime_internal.h + + https://bugs.webkit.org/show_bug.cgi?id=43620 + + * DerivedSources.pro: + * WebProcess/Plugins/NPJSObject.h: + * WebProcess/Plugins/NPRuntimeUtilities.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + +2010-08-07 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Eric Seidel. + + [Qt] Build WebKit2 into a static lib + + https://bugs.webkit.org/show_bug.cgi?id=43621 + + * WebKit2.pri: Added. Defined addWebKit2Lib function that defines how to link against the static lib. + * WebKit2.pro: Build specification for the WebKit2 framework. + * WebProcess.pro: Copied from WebKit2/WebKit2.pro. Build specification for the WebProcess binary. + +2010-08-05 Jon Honeycutt <jhoneycutt@apple.com> + + WebKitTestRunner needs to be able to set the font smoothing type + https://bugs.webkit.org/show_bug.cgi?id=43406 + + Reviewed by Adam Roben. + + * Shared/FontSmoothingLevel.h: Added. + (WebKit::): + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + Initialize fontSmoothingLevel. + (WebKit::WebPreferencesStore::swap): + Copy fontSmoothingLevel. + + * Shared/WebPreferencesStore.h: + (WebKit::WebPreferencesStore::encode): + Encode fontSmoothingLevel. + (WebKit::WebPreferencesStore::decode): + Decode it. + + * UIProcess/API/C/WKPreferencesPrivate.cpp: Added. + (WKPreferencesSetFontSmoothingLevel): + Get the font smoothing level from the WKFontSmoothingLevel, and call + WebPreferences::setFontSmoothingLevel(). + (WKPreferencesGetFontSmoothingLevel): + Get the font smoothing level from WebPreferences, and translate it to a + WKFontSmoothingLevel. + + * UIProcess/API/C/WKPreferencesPrivate.h: Added. + Declare the font smoothing levels, and declare functions to get and set + the level. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setFontSmoothingLevel): + Set fontSmoothingLevel and call update(). + (WebKit::WebPreferences::fontSmoothingLevel): + Return the level. + + * UIProcess/WebPreferences.h: + Declare getter and setter for fontSmoothingLevel. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files to project. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::preferencesDidChange): + Call platformPreferencesDidChange(). + + * WebProcess/WebPage/WebPage.h: + Declare platformPreferencesDidChange(). + + * WebProcess/WebPage/mac/WebPageMac.mm: + (WebKit::WebPage::platformPreferencesDidChange): + Stubbed. + + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::platformPreferencesDidChange): + Stubbed. + + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::platformPreferencesDidChange): + On CG platforms, call wkSetFontSmoothingLevel(). This matches the code + in old WebKit's WebPreferences. Set the font rendering mode to either + normal (CG) or alternative (GDI) based on the font smoothing level. This + matches what was done in old WebKit's WebView. + + * win/WebKit2.vcproj: + Add FontSmoothingLevel.h and WKPreferencesPrivate.{h,cpp} to project. + + * win/WebKit2Generated.make: + Copy WKPreferencesPrivate.h. + +2010-08-06 Anders Carlsson <andersca@apple.com> + + Build fixes. + + * Platform/win/SharedMemoryWin.cpp: + (WebKit::SharedMemory::Handle::encode): + (WebKit::SharedMemory::Handle::decode): + * Shared/qt/UpdateChunk.cpp: + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + * Shared/qt/UpdateChunk.h: + * Shared/win/UpdateChunk.cpp: + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + * Shared/win/UpdateChunk.h: + +2010-08-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Change all ArgumentEncoder and ArgumentDecoder references to pointers + https://bugs.webkit.org/show_bug.cgi?id=43651 + + * Platform/CoreIPC/ArgumentCoder.h: + * Platform/CoreIPC/ArgumentDecoder.h: + * Platform/CoreIPC/Arguments.h: + * Platform/CoreIPC/Attachment.cpp: + * Platform/CoreIPC/Attachment.h: + * Platform/CoreIPC/mac/MachPort.h: + * Platform/SharedMemory.h: + * Platform/mac/SharedMemoryMac.cpp: + * Shared/DrawingAreaBase.cpp: + * Shared/DrawingAreaBase.h: + * Shared/WebEvent.h: + * Shared/WebNavigationDataStore.h: + * Shared/WebPreferencesStore.h: + * Shared/mac/UpdateChunk.cpp: + * Shared/mac/UpdateChunk.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/WebContext.cpp: + * UIProcess/WebContext.h: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * UIProcess/WebProcessProxy.cpp: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.cpp: + +2010-08-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't try to allocate a vector unless we know the buffer can contain it + https://bugs.webkit.org/show_bug.cgi?id=43647 + + * Platform/CoreIPC/ArgumentCoders.h: + (CoreIPC::): + Check that the argument decoder buffer actually can hold all the vector elements. + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughtToContain): + Align the current position to the given alignment, add the size and check if the position is + past the end of the buffer. + + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::bufferIsLargeEnoughtToContain): + Get the size and alignment and call the other bufferIsLargeEnoughtToContain overload. + +2010-08-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Detect invalid CoreIPC messages and call didReceiveInvalidMessage + https://bugs.webkit.org/show_bug.cgi?id=43643 + <rdar://problem/7891069> + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::alignBufferPosition): + If we can't correctly align the buffer position, mark the decoder as invalid. + + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::isInvalid): + Check if the argument decoder is valid. + + (CoreIPC::ArgumentDecoder::markInvalid): + Mark the argument decoder as invalid, by setting its buffer position past its end position. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchMessages): + Check if m_client is null before dispatching messages. If an argument decoder was marked invalid, call + Connection::Client::didReceiveInvalidMessage. + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::Message::releaseArguments): + Rename destroy to releaseArguments and make it return a PassOwnPtr. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + Call releaseArguments instead of destroy. + + (WebKit::WebProcessProxy::didReceiveInvalidMessage): + Kill the web process and invalidate its connection. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveInvalidMessage): + Don't do anything, if the UI process is sending invalid messages there's not much we can do. + + * WebProcess/WebProcess.h: + +2010-08-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add CoreIPC::MessageReceiver class + https://bugs.webkit.org/show_bug.cgi?id=43637 + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::MessageReceiver::~MessageReceiver): + Add MessageReceiver class and make Client inherit from it. + + (CoreIPC::Connection::MessageReceiver::didReceiveSyncMessage): + Change didReceiveSyncMessage from being a pure virtual member function and make it + assert by default instead. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + Remove ChunkedUpdateDrawingAreaProxy::didReceiveSyncMessage. + + * Shared/DrawingAreaBase.h: + Include "Connection.h" instead. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::didReceiveSyncMessage): + Change didReceiveSyncMessage from being a pure virtual member function and make it + assert by default instead. + + * WebProcess/WebProcess.cpp: + * WebProcess/WebProcess.h: + Remove didReceiveSyncMessage. + +2010-08-06 Jessie Berlin <jberlin@apple.com> + + Roll out http://trac.webkit.org/changeset/64801, which broke the Safari Windows Build. + Unreviewed. + + * UIProcess/PageClient.h: + * UIProcess/VisitedLinkProvider.h: + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebFrameProxy.h: + * UIProcess/WebHistoryClient.h: + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPolicyClient.h: + * UIProcess/WebProcessProxy.h: + * UIProcess/WebUIClient.h: + * UIProcess/win/WebView.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + * WebProcess/Plugins/PluginController.h: + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.h: + +2010-08-05 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add form client for injected bundle code + https://bugs.webkit.org/show_bug.cgi?id=43603 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetFormClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp: Added. + (WebKit::InjectedBundlePageFormClient::InjectedBundlePageFormClient): + (WebKit::InjectedBundlePageFormClient::initialize): + (WebKit::InjectedBundlePageFormClient::textFieldDidBeginEditing): + (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing): + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField): + (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea): + * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: Added. + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::textFieldDidBeginEditing): + (WebKit::WebEditorClient::textFieldDidEndEditing): + (WebKit::WebEditorClient::textDidChangeInTextField): + (WebKit::WebEditorClient::textDidChangeInTextArea): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleFormClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleFormClient): + * win/WebKit2.vcproj: + +2010-08-05 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to get a JSValueRef for a node handle and a world + https://bugs.webkit.org/show_bug.cgi?id=43591 + + - Add API to get a JSValueRef for a world, node and frame (the + frame is currently necessary to pick the right globalObject for + the node wrapper). + - Add API to a JSGlobalContextRef for a world and a frame. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetJavaScriptContextForWorld): + (WKBundleFrameGetJavaScriptWrapperForNodeForWorld): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + (WebKit::InjectedBundleNodeHandle::coreNode): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: + (WebKit::InjectedBundleScriptWorld::coreWorld): + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::jsContext): + (WebKit::WebFrame::jsContextForWorld): + (WebKit::WebFrame::jsWrapperForWorld): + * WebProcess/WebPage/WebFrame.h: + +2010-08-05 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43594 - Add string forwards to Forward.h + This allows us to remove forward declarations for these classes from + WebCore/WebKit (a step in moving these class from WebCore:: to WTF::). + + * UIProcess/PageClient.h: + * UIProcess/VisitedLinkProvider.h: + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebFrameProxy.h: + * UIProcess/WebHistoryClient.h: + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPolicyClient.h: + * UIProcess/WebProcessProxy.h: + * UIProcess/WebUIClient.h: + * UIProcess/win/WebView.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + * WebProcess/Plugins/PluginController.h: + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.h: + +2010-08-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Use the visited link provider for visited links + https://bugs.webkit.org/show_bug.cgi?id=43583 + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + Remove AddVisitedLink. + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + Remove PopulateVisitedLinks and add AddVisitedLink. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::sharedProcessContext): + Initialize the main run loop before creating the context. + + (WebKit::WebContext::sharedThreadContext): + Ditto. + + (WebKit::WebContext::create): + Ditto. + + (WebKit::WebContext::WebContext): + Initialize the visited link provider. + + (WebKit::WebContext::processDidFinishLaunching): + Ask the visited link provider to populate visited links. + + (WebKit::WebContext::addVisitedLink): + Ask the visited link provider to add the visited link. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::addVisitedLink): + Call WebContext::addVisitedLink. + + (WebKit::WebProcessProxy::didReceiveMessage): + Handle AddVisitedLink. + + (WebKit::WebProcessProxy::didFinishLaunching): + Call WebContext::processdidFinishLaunching. + + * UIProcess/WebProcessProxy.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::populateVisitedLinks): + Don't send the WebProcessProxyMessage::PopulateVisitedLinks message. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::isLinkVisited): + Call WebProcess::isLinkVisited. + + (WebKit::WebPlatformStrategies::addVisitedLink): + Call WebProcess::addVisitedLink. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::setVisitedLinkTable): + Create a shared memory object and tell the visited link table about it. + + (WebKit::WebProcess::visitedLinkStateChanged): + Go through the link hashes and call Page::visitedStateChanged. + + (WebKit::WebProcess::allVisitedLinkStateChanged): + Call Page::allVisitedStateChanged. + + (WebKit::WebProcess::isLinkVisited): + Call VisitedLinkTable::isLinkVisited. + + (WebKit::WebProcess::addVisitedLink): + Inform the UI process about the added link. + + (WebKit::WebProcess::didReceiveMessage): + Handle new messages. + +2010-08-05 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Add missing include path. + + * win/WebKit2Common.vsprops: + +2010-08-05 Brady Eidson <beidson@apple.com> + + Rubberstamped by Sam Weinig. + + Export WKError.h + + * WebKit2.xcodeproj/project.pbxproj: + +2010-08-05 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Correct vcproj nesting. + + * win/WebKit2.vcproj: + +2010-08-05 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Add script world API for injected bundles + https://bugs.webkit.org/show_bug.cgi?id=43577 + + * Shared/APIObject.h: + (WebKit::APIObject::): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (WebKit::): + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp: Added. + (WKBundleScriptWorldGetTypeID): + (WKBundleScriptWorldCreateWorld): + (WKBundleScriptWorldNormalWorld): + (WKBundleScriptWorldRetain): + (WKBundleScriptWorldRelease): + * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h: Added. + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: Added. + (WebKit::allWorlds): + (WebKit::InjectedBundleScriptWorld::create): + (WebKit::InjectedBundleScriptWorld::getOrCreate): + (WebKit::InjectedBundleScriptWorld::normalWorld): + (WebKit::InjectedBundleScriptWorld::InjectedBundleScriptWorld): + (WebKit::InjectedBundleScriptWorld::~InjectedBundleScriptWorld): + * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h: Added. + (WebKit::InjectedBundleScriptWorld::type): + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-08-05 Sam Weinig <sam@webkit.org> + + Reviewed Anders Carlsson. + + Add DOM Node wrapper class for injected bundle + https://bugs.webkit.org/show_bug.cgi?id=43524 + + - This class should not expose any DOM APIs, but just be a handle that can be used to get a JS + wrapper for the node in a specific world. + + * Shared/APIObject.h: + (WebKit::APIObject::): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (WebKit::): + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleNode.h: + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: Added. + (WKBundleNodeHandleGetTypeID): + (WKBundleNodeHandleRetain): + (WKBundleNodeHandleRelease): + * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h: Added. + * WebProcess/InjectedBundle/DOM: Added. + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: Added. + (WebKit::domHandleCache): + (WebKit::getDOMHandle): + (WebKit::setDOMHandle): + (WebKit::removeDOMHandle): + (WebKit::InjectedBundleNodeHandle::getOrCreate): + (WebKit::InjectedBundleNodeHandle::create): + (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle): + (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle): + * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: Added. + (WebKit::InjectedBundleNodeHandle::type): + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + +2010-08-05 Anders Carlsson <andersca@apple.com> + + Build fix. + + * Platform/mac/SharedMemoryMac.cpp: + +2010-08-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add VisitedLinkProvider class + https://bugs.webkit.org/show_bug.cgi?id=43570 + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + Add SetVisitedLinkTable, VisitedLinkStateChanged and AllVisitedLinkStateChanged. + + * UIProcess/VisitedLinkProvider.cpp: Added. + (WebKit::VisitedLinkProvider::VisitedLinkProvider): + Initialize table. + + (WebKit::VisitedLinkProvider::populateVisitedLinksIfNeeded): + Ask the context to populate visited links. + + (WebKit::VisitedLinkProvider::addVisitedLink): + Add the link hash to the set of pending visited links and start the timer. + + (WebKit::nextPowerOf2): + Add helper function. + + (WebKit::tableSizeForKeyCount): + Given a key count, returns a table size. The table size is always a power of two, and + is chosen so that the table is always at least half empty. + + (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired): + First, check if we need to resize the hash table and allocate new shared memory for it if that is the case. + Then, go through the pending link hash vector and insert all the elements in the table. Finally, notify the web + process about visited links whose state have changed. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + Add case statements. + + * win/WebKit2.vcproj: + * WebKit2.xcodeproj/project.pbxproj: + Add VisitedLinkProvider.cpp and VisitedLinkProvider.h. + +2010-08-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add VisitedLinkTable class + https://bugs.webkit.org/show_bug.cgi?id=43566 + + * Shared/VisitedLinkTable.cpp: Added. + (WebKit::VisitedLinkTable::VisitedLinkTable): + (WebKit::VisitedLinkTable::~VisitedLinkTable): + Add out of line constructors so we won't have to include SharedMemory.h in the + VisitedLinkTable.h header. + + (WebKit::isPowerOf2): + Add helper function. + + (WebKit::VisitedLinkTable::setSharedMemory): + Set the new shared memory and update the table size and hash. + + (WebKit::doubleHash): + Add helper function from the WTF HashTable. + + (WebKit::VisitedLinkTable::addLinkHash): + Add a link hash to the table. + + (WebKit::VisitedLinkTable::isLinkVisited): + See if there is an entry for the given link hash. + + * Shared/VisitedLinkTable.h: Added. + (WebKit::VisitedLinkTable::sharedMemory): + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add VisitedLinkTable.cpp and VisitedLinkTable.h + +2010-08-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add shared memory abstraction + https://bugs.webkit.org/show_bug.cgi?id=43535 + <rdar://problem/8275295> + + * Platform/SharedMemory.h: Added. + (WebKit::SharedMemory::): + (WebKit::SharedMemory::size): + Return the size, in bytes, of the shared memory object. + + (WebKit::SharedMemory::data): + Return a pointer to the shared memory object. + + * Platform/mac/SharedMemoryMac.cpp: Added. + (WebKit::SharedMemory::Handle): + A shared memory handle, which can be passed in a CoreIPC Connection. + + (WebKit::SharedMemory::create): + Allocate the shared memory. + + (WebKit::SharedMemory::~SharedMemory): + Deallocate the shared memory. + + (WebKit::SharedMemory::createHandle): + Create a mach port and pass it to the handle. + + (WebKit::SharedMemory::systemPageSize): + Return the system page size, in bytes. + + * Platform/win/SharedMemoryWin.cpp: Added. + Add stubbed out version. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Add files. + +2010-08-05 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Unify blob related feature defines to ENABLE(BLOB). + https://bugs.webkit.org/show_bug.cgi?id=43081 + + * Configurations/FeatureDefines.xcconfig: + +2010-08-05 Balazs Kelemen <kb@inf.u-szeged.hu> + + Rubber-stamped by Kenneth Rohde Christiansen. + + [Qt] Remove redundant include paths from WebKit2.pro. + + * WebKit2.pro: + +2010-08-04 Adam Roben <aroben@apple.com> + + Teach WebKit2 how to load the TestNetscapePlugin + + Fixes <http://webkit.org/b/43513> WebKitTestRunner on Windows fails to + load TestNetscapePlugin + + Reviewed by Jon Honeycutt. + + * Platform/Module.cpp: + (WebKit::Module::Module): Initialize m_module on Windows. + + * Platform/Module.h: Added m_module on Windows. + + * Platform/win/ModuleWin.cpp: + (WebKit::Module::load): Implemented using ::LoadLibraryExW. + (WebKit::Module::unload): Implemented using ::FreeLibrary. + (WebKit::Module::platformFunctionPointer): Implemented using + ::GetProcAddress. + + * Platform/win/RunLoopWin.cpp: + (RunLoop::TimerBase::timerFired): Kill the native timer before calling + the fired callback. This makes all our timers non-repeating, but + that's all we need currently. + (RunLoop::TimerBase::start): Added an assertion to help us figure out + when we need to implement repeating timers. Also fixed a typo. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::PluginInfoStore::pluginsDirectories): Added a FIXME. + + (WebKit::PathWalker::PathWalker): + (WebKit::PathWalker::~PathWalker): + (WebKit::PathWalker::isValid): + (WebKit::PathWalker::data): + (WebKit::PathWalker::step): + Added. This class wraps the ::FindFirstFile/::FindNextFile APIs. + + (WebKit::PluginInfoStore::pluginPathsInDirectory): Implemented by + porting logic from + WebCore::PluginDatabase::getPluginPathsInDirectories. + (WebKit::getVersionInfo): Copied from PluginDatabaseWin.cpp. + (WebKit::PluginInfoStore::getPluginInfo): Implemented by porting logic + from WebCore::PluginPackage::fetchInfo. + (WebKit::PluginInfoStore::shouldUsePlugin): Changed to always return + true for now. Added a FIXME about implementing this for real. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Removed PLATFORM(MAC) guards around plugin code. + + * win/WebKit2.vcproj: Let VS sort the file. + +2010-08-05 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + Use toCopiedRef for making WK objects + https://bugs.webkit.org/show_bug.cgi?id=43552 + + * UIProcess/API/cpp/qt/WKStringQt.cpp: + (WKStringCreateWithQString): + * UIProcess/API/cpp/qt/WKURLQt.cpp: + (WKURLCreateWithQUrl): + +2010-08-04 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Change callback APIs to include an Error object in one callback, instead of having a second callback for failure. + https://bugs.webkit.org/show_bug.cgi?id=43522 + + This includes adding a WKErrorRef object which - for now - either exists or doesn't. + In the future, it may contain useful information about the error. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + + * Shared/APIObject.h: + (WebKit::APIObject::): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + + * Shared/WebError.h: Added. + (WebKit::WebError::create): + (WebKit::WebError::WebError): + (WebKit::WebError::type): + + * UIProcess/API/C/WKError.cpp: Added. + (WKErrorGetTypeID): + * UIProcess/API/C/WKError.h: Added. + + * UIProcess/API/C/WKPage.cpp: + (WKPageRunJavaScriptInMainFrame): + (callRunJavaScriptBlockAndRelease): + (WKPageRunJavaScriptInMainFrame_b): + (WKPageRenderTreeExternalRepresentation): + (callRenderTreeExternalRepresentationBlockAndDispose): + (WKPageRenderTreeExternalRepresentation_b): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPagePrivate.h: + + * UIProcess/GenericCallback.h: + (WebKit::GenericCallback::create): + (WebKit::GenericCallback::performCallbackWithReturnValue): + (WebKit::GenericCallback::invalidate): + (WebKit::GenericCallback::GenericCallback): + +2010-08-04 Ada Chan <adachan@apple.com> + + Windows build fix + + * win/WebKit2Generated.make: + +2010-08-04 John Sullivan <sullivan@apple.com> + + Build fix, rubber-stamped by Brady Eidson. + + * WebKit2.xcodeproj/project.pbxproj: + Made WKData.h a public header. + +2010-08-04 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_SetValue): Removed unreachable code. + +2010-08-04 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_SetValue): Added some case statements that are compiled + on Windows to avoid a warning about having default but not cases. + +2010-08-04 Adam Roben <aroben@apple.com> + + Windows build fix + + * win/WebKit2.vcproj: Added NetscapeBrowserFuncs. + +2010-08-04 Adam Roben <aroben@apple.com> + + Windows build fix + + The functions in NetscapePluginModuleWin.cpp have been moved to + NetscapePluginModule.cpp. + + * WebProcess/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: Removed. + * win/WebKit2.vcproj: Removed NetscapePluginModuleWin. + +2010-08-04 Adam Roben <aroben@apple.com> + + Move bundle-loading code from NetscapePluginModule to a new Module + class + + This allows more NetscapePluginModule code to be cross-platform. + + Fixes <http://webkit.org/b/43497> NetscapePluginModule::try/unload + should be cross-platform + + Reviewed by Anders Carlsson. + + * Platform/Module.cpp: Added. + (WebKit::Module::Module): Store our path. + (WebKit::Module::~Module): Unload our native module. + + * Platform/Module.h: Added. + (WebKit::Module::leakBundle): Does what it says. + (WebKit::Module::functionPointer): Returns a pointer to the named + function, with the right type. + + * Platform/mac/ModuleMac.mm: Added. + (WebKit::Module::load): Code was moved here from + NetscapePluginModule::tryLoad. + (WebKit::Module::unload): Just clears our bundle. + (WebKit::Module::platformFunctionPointer): Code was moved here from + NetscapePluginModuleMac.cpp. + + * Platform/qt/ModuleQt.cpp: Added. + (WebKit::Module::load): + (WebKit::Module::unload): + (WebKit::Module::platformFunctionPointer): + * Platform/win/ModuleWin.cpp: Added. + (WebKit::Module::load): + (WebKit::Module::unload): + (WebKit::Module::platformFunctionPointer): + Just stubbed out these functions. + + * WebKit2.xcodeproj/project.pbxproj: Added Module. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::tryLoad): + (WebKit::NetscapePluginModule::unload): + Moved here from NetscapePluginModuleMac.cpp. Now uses the + cross-platform m_module member. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: Replaced + m_bundle with m_module. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: Removed. + + * win/WebKit2.vcproj: Added Module. + +2010-08-04 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Lay the groundwork for saving/restoring page session state to WK2 + https://bugs.webkit.org/show_bug.cgi?id=43495 + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + + * Shared/APIObject.h: + (WebKit::APIObject::): + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + + Arbitrary byte buffer: + * Shared/WebData.h: Added. + (WebKit::WebData::create): + (WebKit::WebData::bytes): + (WebKit::WebData::size): + (WebKit::WebData::WebData): + (WebKit::WebData::type): + + API facing object to act as a byte buffer: + * UIProcess/API/C/WKData.cpp: Added. + (WKDataGetTypeID): + (WKDataCreate): + (WKDataGetBytes): + (WKDataGetSize): + (WKDataRetain): + (WKDataRelease): + * UIProcess/API/C/WKData.h: Added. + + API for saving/restoring state: + * UIProcess/API/C/WKPage.cpp: + (WKPageCopySessionState): + (WKPageRestoreFromSessionState): + * UIProcess/API/C/WKPage.h: + + These will be filled in later: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::sessionState): + (WebKit::WebPageProxy::restoreFromSessionState): + * UIProcess/WebPageProxy.h: + + +2010-08-04 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Set correct default minimumFontSize. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + +2010-08-03 Adam Roben <aroben@apple.com> + + Turn on PLATFORM_STRATEGIES on Windows + + Fixes <http://webkit.org/b/43431>. + + Reviewed by Anders Carlsson. + + * win/WebKit2.vcproj: Added WebPlatformStrategies. Also let VS reorder + this file as it saw fit. + +2010-08-03 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Close the WebProcess + + https://bugs.webkit.org/show_bug.cgi?id=41690 + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::open): Registered connectionDidClose to be called when the client disconnected. + * Platform/qt/RunLoopQt.cpp: + (RunLoop::stop): Implemented by calling QCoreApplication::exit. + +2010-08-03 Jon Honeycutt <jhoneycutt@apple.com> + + WebKitTestRunner needs to activate the Mac font ascent hack + https://bugs.webkit.org/show_bug.cgi?id=43404 + + Reviewed by Darin Adler. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleActivateMacFontAscentHack): + Get the InjectedBundle, and calls its activateMacFontAscentHack(). + + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + Declare WKBundleActivateMacFontAscentHack(). + + * WebProcess/InjectedBundle/InjectedBundle.h: + Declare activateMacFontAscentHack(). + + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + (WebKit::InjectedBundle::activateMacFontAscentHack): + Stubbed. + + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: + (WebKit::InjectedBundle::activateMacFontAscentHack): + Stubbed. + + * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: + (WebKit::InjectedBundle::activateMacFontAscentHack): + Activate the ascent hack. + +2010-08-03 Simon Fraser <simon.fraser@apple.com> + + Fix typo in typo fix. + + * Shared/DrawingAreaBase.h: + (WebKit::DrawingAreaBase::DrawingAreaInfo::DrawingAreaInfo): + (WebKit::DrawingAreaBase::DrawingAreaBase): + +2010-08-03 Simon Fraser <simon.fraser@apple.com> + + Fix typo in previous commit. + + * Shared/DrawingAreaBase.h: + (WebKit::DrawingAreaBase::DrawingAreaInfo::DrawingAreaInfo): + (WebKit::DrawingAreaBase::DrawingAreaBase): + +2010-08-03 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Compositing iframe layout test crashes in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42860 + + Fix assertion caused by a DrawingArea handling a message that was targetted at an older DrawingArea + that it has replaced. + + This was done by assigning a unique ID to each DrawingAreaProxy that gets created, and passing + this ID, along with the type, to the WebProcess via an encoded DrawingAreaInfo. Each message + also includes this ID. Messages with an ID that doesn't match that of the current DrawingArea are ignored. + + Refactored some common code and data into a DrawingAreaBase class which is shared, and adding + encode/decode of DrawingAreaInfo. + + * Shared/DrawingAreaBase.cpp: Added. + (WebKit::DrawingAreaBase::encode): + (WebKit::DrawingAreaBase::decode): + * Shared/DrawingAreaBase.h: Added. + (WebKit::DrawingAreaBase::): + (WebKit::DrawingAreaBase::~DrawingAreaBase): + (WebKit::DrawingAreaBase::type): + (WebKit::DrawingAreaBase::id): + (WebKit::DrawingAreaBase::DrawingAreaInfo::DrawingAreaInfo): + (WebKit::DrawingAreaBase::DrawingAreaBase): + (CoreIPC::): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::setSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + * UIProcess/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + (WebKit::DrawingAreaProxy::nextDrawingAreaID): + * UIProcess/DrawingAreaProxy.h: + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::setSize): + (WebKit::LayerBackedDrawingAreaProxy::setPageIsVisible): + (WebKit::LayerBackedDrawingAreaProxy::update): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveSyncMessage): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::createWindow): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + (WebKit::DrawingArea::DrawingArea): + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::didReceiveMessage): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::create): + (WebKit::WebPage::WebPage): + (WebKit::WebPage::changeAcceleratedCompositingMode): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::createWebPage): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + * win/WebKit2.vcproj: + +2010-08-03 Alex Milowski <alex@milowski.com> + + Reviewed by Beth Dakin. + + Changed the ENABLE_MATHML value to enable MathML by default. + + * Configurations/FeatureDefines.xcconfig: + +2010-08-03 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Compositing iframe layout test crashes in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42860 + + Part one of the fix: make DrawingArea ref-counted, so that the object + can survide a swap in drawing areas inside the run loop observer callback. + + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformClear): + (WebKit::LayerBackedDrawingArea::updateLayoutRunLoopObserverCallback): + (WebKit::LayerBackedDrawingArea::updateLayoutRunLoopObserverFired): + +2010-08-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Frequent ASSERT_NOT_REACHED in Connection::processIncomingMessage when running regression tests + https://bugs.webkit.org/show_bug.cgi?id=42926 + <rdar://problem/8237329> + + Remove this assert, it's bogus. It would fire when a reply came in on the connection queue before + waitForReply was called on the client thread, but that case is already covered. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::processIncomingMessage): + +2010-08-03 Adam Roben <aroben@apple.com> + + Compile out two Mac-only localized strings on non-Mac platforms + + Fixes <http://webkit.org/b/43433> copyImageUnknownFileLabel and + AXARIAContentGroupText should only be compiled on Mac + + Reviewed by Anders Carlsson. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + Wrapped copyImageUnknownFileLabel and AXARIAContentGroupText in + PLATFORM(MAC). + +2010-08-03 Balazs Kelemen <kb@inf.u-szeged.hu> + + [Qt] Unreviewed typo fix in the WebKit2/DerivedSources.pro project file. + + Use QMAKE_MKDIR as the command for directory creation. + + * DerivedSources.pro: + +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Add VisitedLinkStrategy for each platform to implement + https://bugs.webkit.org/show_bug.cgi?id=43393 + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::createVisitedLinkStrategy): + (WebKit::WebPlatformStrategies::isLinkVisited): Call back into PageGroup's visited links, for now. + (WebKit::WebPlatformStrategies::addVisitedLink): Ditto. + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes WebPopupMenu and WebSearchPopupMenu inherit from PopupMenu and + SearchPopupMenu respectively. At this point they are just empty implementations. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Added. + (WebKit::WebPopupMenu::WebPopupMenu): + (WebKit::WebPopupMenu::~WebPopupMenu): + (WebKit::WebPopupMenu::disconnectClient): + (WebKit::WebPopupMenu::show): + (WebKit::WebPopupMenu::hide): + (WebKit::WebPopupMenu::updateFromElement): + * WebProcess/WebCoreSupport/WebPopupMenu.h: Added. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Added. + (WebKit::WebSearchPopupMenu::WebSearchPopupMenu): + (WebKit::WebSearchPopupMenu::popupMenu): + (WebKit::WebSearchPopupMenu::saveRecentSearches): + (WebKit::WebSearchPopupMenu::loadRecentSearches): + (WebKit::WebSearchPopupMenu::enabled): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Added. + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::WebChromeClient::createPopupMenu): + (WebKit::WebChromeClient::createSearchPopupMenu): + * WebProcess/WebCoreSupport/WebChromeClient.h: + + build issues: + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix plug-in test failures and remove tests from the Skipped list + https://bugs.webkit.org/show_bug.cgi?id=43389 + + * WebProcess/Plugins/JSNPMethod.cpp: + JSNPMethod::s_info should specify InternalFunction::info as its parent. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::cancelStreamLoad): + Special-case the manual stream and call PluginController::cancelManualStreamLoad. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::stop): + It's OK to call stop on a stream that hasn't been started. Remove assertion and return early. + + * WebProcess/Plugins/PluginController.h: + Add cancelManualStreamLoad. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::cancelManualStreamLoad): + Tell the document loader to cancel the main resource load. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::innerText): + Check for a null document element. + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add support for loading manual streams + https://bugs.webkit.org/show_bug.cgi?id=43380 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_loadManually to false. + + (WebKit::NetscapePlugin::removePluginStream): + Special case the manual stream. + + (WebKit::NetscapePlugin::initialize): + Don't request the stream if we're already loading. + + (WebKit::NetscapePlugin::manualStreamDidReceiveResponse): + Create the manual stream and pass the response to it. + + (WebKit::NetscapePlugin::manualStreamDidReceiveData): + Pass the data to the manual stream. + + (WebKit::NetscapePlugin::manualStreamDidFinishLoading): + Call the manual stream. + + (WebKit::NetscapePlugin::manualStreamDidFail): + Ditto. + + * WebProcess/Plugins/Plugin.h: + Add pure virtual member functions for manual stream loading. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::buildHTTPHeaders): + Put code in a function so both PluginView::Stream::didReceiveResponse and + manualLoadDidReceiveResponse can call it. + + (WebKit::PluginView::Stream::didReceiveResponse): + Call buildHTTPHeaders. + + (WebKit::PluginView::Stream::didFinishLoading): + Protect the plug-in when calling destroyStream. + + (WebKit::PluginView::manualLoadDidReceiveResponse): + Call Plugin::manualStreamDidReceiveResponse. + + (WebKit::PluginView::manualLoadDidReceiveData): + Call Plugin::manualStreamDidReceiveData. + + (WebKit::PluginView::manualLoadDidFinishLoading): + Call Plugin::manualStreamDidFinishLoading. + + (WebKit::PluginView::manualLoadDidFail): + Call Plugin::manualStreamDidFail. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::WebFrameLoaderClient): + Initialize m_hasSentResponseToPluginView to false. + + (WebKit::WebFrameLoaderClient::setMainDocumentError): + Call PluginView::manualLoadDidFail. + + (WebKit::WebFrameLoaderClient::committedLoad): + Call PluginView::manualLoadDidReceiveResponse. + + (WebKit::WebFrameLoaderClient::finishedLoading): + Call PluginView::manualLoadDidFinishLoading. + + (WebKit::WebFrameLoaderClient::redirectDataToPlugin): + Keep track of the plug-in view. + +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Basic WK2 visited link coloring + https://bugs.webkit.org/show_bug.cgi?id=43377 + + Add simple API that allows the WK2 app to add 1 visited link at a time. + For now, this just pipes each individual LinkHash down to WebCore. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + + * UIProcess/API/C/WKContext.cpp: + (WKContextAddVisitedLink): + * UIProcess/API/C/WKContext.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::addVisitedLink): + * UIProcess/WebContext.h: + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::addVisitedLinkHash): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + +2010-08-02 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs layoutTestController.setCanOpenWindows + https://bugs.webkit.org/show_bug.cgi?id=42321 + + WebKitTestRunner needs layoutTestController.setCloseRemainingWindowsWhenComplete + https://bugs.webkit.org/show_bug.cgi?id=42779 + + Implemented window.close, added a function that does a similar operation on behalf + of injected bundle code named WKBundlePageClose, and fixed the reference counting of + the result of the createNewPage client function. + + * UIProcess/API/cpp/WKRetainPtr.h: Added clear. Tweaked formatting. Renamed + releaseRef to leakRef. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateVisibility]): Handle the case where drawing area is 0. This + came up in WebKitTestRunner and other functions handle drawing area of 0. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveSyncMessage): Update now that createNewPage + returns a PassRefPtr. + (WebKit::WebPageProxy::createNewPage): Changed to return a PassRefPtr. + * UIProcess/WebPageProxy.h: Ditto. + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::createNewPage): Changed to return a PassRefPtr and adopt + the WKPageRef passed from the client. This follows the "create rule". + * UIProcess/WebUIClient.h: Ditto. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageClose): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Added WKBundlePageClose + and re-sorted the other functions in this file. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::closeWindowSoon): Implemented this. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): Called setJavaScriptCanOpenWindowsAutomatically(true). + I suppose we will need to revisit this later when we implement pop-up blocking. + (WebKit::WebPage::tryClose): Factored out the part of this that sends a message + to the other process. + (WebKit::WebPage::sendClose): This is where the part that sends a message went. + * WebProcess/WebPage/WebPage.h: Added sendClose, used by both closeWindowSoon + and WKBundlePageClose. + +2010-08-02 John Sullivan <sullivan@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=43369 + WebBackForwardList::forwardListAsImmutableArrayWithLimit can return partly-uninitialized array + + Reviewed by Ada Chan. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + Use a simpler and correct expression to determine "last". + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Protect the plug-in from being destroyed while in plug-in code + https://bugs.webkit.org/show_bug.cgi?id=43370 + + Add a PluginProtector to NPRuntimeObjectMap and use it in JSNPObject. + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::callMethod): + (WebKit::JSNPObject::callObject): + (WebKit::JSNPObject::callConstructor): + (WebKit::JSNPObject::put): + (WebKit::JSNPObject::getOwnPropertyNames): + (WebKit::JSNPObject::propertyGetter): + Add PluginProtector declarations. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::PluginProtector::PluginProtector): + Ref the plug-in view (unless it's being destroyed). + + (WebKit::NPRuntimeObjectMap::PluginProtector::~PluginProtector): + * WebProcess/Plugins/NPRuntimeObjectMap.h: + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Initialize m_isBeingDestroyed. + + (WebKit::PluginView::~PluginView): + Set m_isBeingDestroyed to true. + + (WebKit::PluginView::scriptObject): + Don't crash if the plug-in failed to initialize. + + (WebKit::PluginView::evaluate): + Remove comment. + + * WebProcess/Plugins/PluginView.h: + (WebKit::PluginView::isBeingDestroyed): + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cache JSNPObjects and fix bugs in the object map + https://bugs.webkit.org/show_bug.cgi?id=43368 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::JSNPObject): + Assert that we're not trying to wrap an NPJSObject. + + (WebKit::JSNPObject::~JSNPObject): + Tell the object map that we're gone. + + (WebKit::JSNPObject::invalidate): + Release the NPObject and null out the pointer. + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::create): + Assert that we're not trying to wrap a JSNPObject. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::getOrCreateNPObject): + If we're passed a JSNPObject, just extract its NPObject. + + (WebKit::NPRuntimeObjectMap::getOrCreateJSObject): + If we're passed an NPJSObject, just extract its JSObject. Otherwise, check if we already have + a JSObject for this NPObject and return it. + + (WebKit::NPRuntimeObjectMap::jsNPObjectDestroyed): + Remove the object from the map. + + (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue): + getOrCreateJSObject now checks for wrapped objects. + + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + getOrCreateNPObject now checks for wrapped objects. + + (WebKit::NPRuntimeObjectMap::invalidate): + Invalidate JSNPObjects as well. + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Removed. + * WebProcess/WebCoreSupport/WebPopupMenu.h: Removed. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Removed. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Removed. + * win/WebKit2.vcproj: + +2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Generate forwarding headers for WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=43336 + + * DerivedSources.pro: Added. + +2010-08-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_SetException + https://bugs.webkit.org/show_bug.cgi?id=43320 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::callConstructor): + (WebKit::JSNPObject::put): + (WebKit::JSNPObject::getOwnPropertyNames): + (WebKit::JSNPObject::propertyGetter): + Call NPRuntimeObjectMap::moveGlobalExceptionToExecState. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::globalExceptionString): + Add static global. + + (WebKit::NPRuntimeObjectMap::setGlobalException): + Set the global exception string. + + (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState): + Create an error from the exception string. + + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_SetException): + Call NetscapePlugin::setException. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::setException): + Call NPRuntimeObjectMap::setGlobalException. + +2010-08-01 Sam Weinig <sam@webkit.org> + + Roll r64446 out. It broke the test runner. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + +2010-08-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Don't send user messages to the injected bundle if the process is not active + https://bugs.webkit.org/show_bug.cgi?id=43317 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + +2010-08-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add ability to reset frame names for WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=43316 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageClearMainFrameName): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::clearMainFrameName): + * WebProcess/WebPage/WebPage.h: + +2010-08-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Minor NPRuntime fixes + https://bugs.webkit.org/show_bug.cgi?id=43318 + + * WebProcess/Plugins/JSNPObject.h: + (WebKit::JSNPObject::npObject): + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + If we see an JSNPObject, extract the NPObject. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetProperty): + Don't check for whether the property exists before getting it. + +2010-08-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_RemoveProperty + https://bugs.webkit.org/show_bug.cgi?id=43315 + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::removeProperty): + Try to remove the property. + + (WebKit::NPJSObject::npClass): + Add NP_RemoveProperty. + + (WebKit::NPJSObject::NP_RemoveProperty): + Call NPJSObject::removeProperty. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_RemoveProperty): + Call the NPClass::removeProperty function. + +2010-07-31 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Crash due to calling StringImpl::createCFString() from non-main thread in plug-in code + https://bugs.webkit.org/show_bug.cgi?id=43306 + <rdar://problem/8259687> + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::getMIMETypeForExtension): + (WebKit::PluginInfoStore::findPlugin): + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::safeCreateCFString): + (WebKit::PluginInfoStore::getMIMETypeForExtension): + Bypass MIMETypeRegistry in the UIProcess until we can safely convert Strings + to CFStringRefs. + +2010-07-31 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43305 + Add back WKBundleFrameCopyInnerText to fix ~50 test failures + due to SVGElements not having the innerText function. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyInnerText): + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::innerText): + * WebProcess/WebPage/WebFrame.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes WebPopupMenu and WebSearchPopupMenu inherit from PopupMenu and + SearchPopupMenu respectively. At this point they are just empty implementations. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Added. + (WebKit::WebPopupMenu::WebPopupMenu): + (WebKit::WebPopupMenu::~WebPopupMenu): + (WebKit::WebPopupMenu::disconnectClient): + (WebKit::WebPopupMenu::show): + (WebKit::WebPopupMenu::hide): + (WebKit::WebPopupMenu::updateFromElement): + * WebProcess/WebCoreSupport/WebPopupMenu.h: Added. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Added. + (WebKit::WebSearchPopupMenu::WebSearchPopupMenu): + (WebKit::WebSearchPopupMenu::popupMenu): + (WebKit::WebSearchPopupMenu::saveRecentSearches): + (WebKit::WebSearchPopupMenu::loadRecentSearches): + (WebKit::WebSearchPopupMenu::enabled): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Added. + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::WebChromeClient::createPopupMenu): + (WebKit::WebChromeClient::createSearchPopupMenu): + * WebProcess/WebCoreSupport/WebChromeClient.h: + + build issues: + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Removed. + * WebProcess/WebCoreSupport/WebPopupMenu.h: Removed. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Removed. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Removed. + * win/WebKit2.vcproj: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes WebPopupMenu and WebSearchPopupMenu inherit from PopupMenu and + SearchPopupMenu respectively. At this point they are just empty implementations. + + * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Added. + (WebKit::WebPopupMenu::WebPopupMenu): + (WebKit::WebPopupMenu::~WebPopupMenu): + (WebKit::WebPopupMenu::disconnectClient): + (WebKit::WebPopupMenu::show): + (WebKit::WebPopupMenu::hide): + (WebKit::WebPopupMenu::updateFromElement): + * WebProcess/WebCoreSupport/WebPopupMenu.h: Added. + * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Added. + (WebKit::WebSearchPopupMenu::WebSearchPopupMenu): + (WebKit::WebSearchPopupMenu::popupMenu): + (WebKit::WebSearchPopupMenu::saveRecentSearches): + (WebKit::WebSearchPopupMenu::loadRecentSearches): + (WebKit::WebSearchPopupMenu::enabled): + * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Added. + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural): + (WebKit::WebChromeClient::createPopupMenu): + (WebKit::WebChromeClient::createSearchPopupMenu): + * WebProcess/WebCoreSupport/WebChromeClient.h: + + build issues: + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-07-30 Darin Fisher <darin@chromium.org> + + Reviewed by Darin Adler. + + Eliminate BackForwardList::pushStateItem + https://bugs.webkit.org/show_bug.cgi?id=43282 + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + * WebProcess/WebPage/WebBackForwardListProxy.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43290 + Add structured message passing from the injected bundle to UIProcess + + * Platform/CoreIPC/MessageID.h: + * Shared/CoreIPCSupport/WebContextMessageKinds.h: Added. + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::): + (WebKit::PostMessageEncoder::PostMessageDecoder::PostMessageDecoder): + (WebKit::PostMessageEncoder::PostMessageDecoder::decode): + (WebKit::WebContext::didReceiveMessageFromInjectedBundle): + (WebKit::WebContext::didReceiveMessage): + * UIProcess/WebContext.h: + * UIProcess/WebContextInjectedBundleClient.cpp: + (WebKit::WebContextInjectedBundleClient::didReceiveMessageFromInjectedBundle): + * UIProcess/WebContextInjectedBundleClient.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundlePostMessage): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::): + (WebKit::InjectedBundle::InjectedBundle): + (WebKit::InjectedBundle::~InjectedBundle): + (WebKit::InjectedBundle::initializeClient): + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::setShouldTrackVisitedLinks): + (WebKit::InjectedBundle::removeAllVisitedLinks): + (WebKit::InjectedBundle::didCreatePage): + (WebKit::InjectedBundle::willDestroyPage): + (WebKit::InjectedBundle::didReceiveMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + +2010-07-30 Andy Estes <aestes@apple.com> + + Reviewed by David Kilzer. + + Add support to Xcode for compiling WebKit against iOS SDKs. + https://bugs.webkit.org/show_bug.cgi?id=42796 + + * Configurations/FeatureDefines.xcconfig: + +2010-07-30 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Cast the return value for the templated ImmutableArray::at(). + + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::at): + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43283 + Add APIObject template introspection support. + + Add a way to get the type the APIObject::Type from the APIObject subclass typenames + for template fun. Use this to make a type checking version of ImmutableArray::at. + + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::at): + (WebKit::ImmutableArray::type): + * Shared/WebString.h: + (WebKit::WebString::type): + * Shared/WebURL.h: + (WebKit::WebURL::type): + * UIProcess/API/C/WKArray.cpp: + (WKArrayGetTypeID): + * UIProcess/API/C/WKBackForwardList.cpp: + (WKBackForwardListGetTypeID): + * UIProcess/API/C/WKBackForwardListItem.cpp: + (WKBackForwardListItemGetTypeID): + * UIProcess/API/C/WKContext.cpp: + (WKContextGetTypeID): + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetTypeID): + * UIProcess/API/C/WKFramePolicyListener.cpp: + (WKFramePolicyListenerGetTypeID): + * UIProcess/API/C/WKNavigationData.cpp: + (WKNavigationDataGetTypeID): + * UIProcess/API/C/WKPage.cpp: + (WKPageGetTypeID): + * UIProcess/API/C/WKPageNamespace.cpp: + (WKPageNamespaceGetTypeID): + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesGetTypeID): + * UIProcess/API/C/WKString.cpp: + (WKStringGetTypeID): + * UIProcess/API/C/WKURL.cpp: + (WKURLGetTypeID): + * UIProcess/WebBackForwardList.h: + (WebKit::WebBackForwardList::type): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::type): + * UIProcess/WebContext.h: + (WebKit::WebContext::type): + * UIProcess/WebFramePolicyListenerProxy.h: + (WebKit::WebFramePolicyListenerProxy::type): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::type): + * UIProcess/WebNavigationData.h: + (WebKit::WebNavigationData::type): + * UIProcess/WebPageNamespace.h: + (WebKit::WebPageNamespace::type): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::type): + * UIProcess/WebPreferences.h: + (WebKit::WebPreferences::type): + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetTypeID): + * WebProcess/InjectedBundle/InjectedBundle.h: + (WebKit::InjectedBundle::type): + * WebProcess/WebPage/WebFrame.h: + (WebKit::WebFrame::type): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::type): + +2010-07-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43275 + Make WKArrayRef more usable. + + - Add Create functions. + - Make WKArrayGetItemAtIndex return a WKTypeRef. + + * UIProcess/API/C/WKArray.cpp: + (WKArrayCreate): + (WKArrayCreateAdoptingValues): + (WKArrayGetItemAtIndex): + * UIProcess/API/C/WKArray.h: + +2010-07-30 Ada Chan <adachan@apple.com> + + Reviewed by John Sullivan. + + Fix issue with populating the back list when limit is a huge number. + https://bugs.webkit.org/show_bug.cgi?id=43270 + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + +2010-07-29 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43274 + Add first pass of structured message passing. + + - Only supports passing messages from the UIProcess -> InjectedBundle + - Only supports passing Strings, Arrays, and WebPage references (NOTE: There + currently isn't a way to make an array). + - Changed ImmutableArray to operate on APIObjects instead of void*'s and + removed the retain/release abstraction. + + * Platform/CoreIPC/MessageID.h: + (CoreIPC::): + * Shared/CoreIPCSupport/InjectedBundleMessageKinds.h: Added. + (InjectedBundleMessage::): + (CoreIPC::): + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + * Shared/ImmutableArray.cpp: + (WebKit::ImmutableArray::ImmutableArray): + (WebKit::ImmutableArray::~ImmutableArray): + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::create): + (WebKit::ImmutableArray::adopt): + (WebKit::ImmutableArray::at): + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKContext.cpp: + (WKContextPostMessageToInjectedBundle): + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKType.cpp: + (WKGetTypeID): + * UIProcess/API/C/WebKit2.h: + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + (WebKit::WebContext::didReceiveMessageFromInjectedBundle): + * UIProcess/WebContext.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::didReceiveMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::childFrames): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + * win/WebKit2.vcproj: + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Evaluate + https://bugs.webkit.org/show_bug.cgi?id=43268 + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::evaluate): + Evaluate the passed in string. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_Evaluate): + Call NetscapePlugin::evaluate. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::evaluate): + Call PluginController::evaluate. + + * WebProcess/Plugins/PluginController.h: + Add evaluate pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::evaluate): + Update the popup window state and call NPRuntimeObjectMap::evaluate. + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_InvokeDefault + https://bugs.webkit.org/show_bug.cgi?id=43266 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::JSNPObject): + Remove ExecState parameter. + + (WebKit::JSNPObject::callObject): + Call the NPClass::invokeDefault function. + + (WebKit::callNPJSObject): + Call JSNPObject::callObject. + + (WebKit::JSNPObject::getCallData): + Check if the NPClass has an invokeDefault function. + + * WebProcess/Plugins/JSNPObject.h: + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::getOrCreateJSObject): + Remove ExecState parameter. + + (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue): + Remove ExecState parameter. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::scriptObject): + Remove ExecState parameter. + +2010-07-30 Adam Roben <aroben@apple.com> + + Roll our r64361 and r64363 + + We can't make these changes until QuartzCore.lib is included in + WebKitSupportLibrary. + +2010-07-30 Adam Roben <aroben@apple.com> + + Windows build fix + + * win/WebKit2Apple.vsprops: Always link against QuartzCore, since + WebKitSystemInterface requires it. + +2010-07-30 Balazs Kelemen <kb@inf.u-szeged.hu> + + Unreviewed build fix. + + [Qt] Build fix for recent API changes in WebKit2. + + * UIProcess/API/cpp/qt/WKStringQt.cpp: + (WKStringCopyQString): + * UIProcess/API/cpp/qt/WKURLQt.cpp: + (WKURLCopyQUrl): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::QWKPage): + +2010-07-29 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Setting empty document schemes on the WKContext shouldn't start the WebProcess + <rdar://problem/8253734> and https://bugs.webkit.org/show_bug.cgi?id=43222 + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::registerURLSchemeAsEmptyDocument): + * UIProcess/WebContext.h: + +2010-07-29 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Make all public facing client setters take const pointers + https://bugs.webkit.org/show_bug.cgi?id=43219 + + * UIProcess/API/C/WKContext.cpp: + (WKContextSetInjectedBundleClient): + (WKContextSetHistoryClient): + * UIProcess/API/C/WKContext.h: + + * UIProcess/API/C/WKPage.cpp: + (WKPageSetPageLoaderClient): + (WKPageSetPagePolicyClient): + (WKPageSetPageUIClient): + * UIProcess/API/C/WKPage.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::initializeInjectedBundleClient): + (WebKit::WebContext::initializeHistoryClient): + * UIProcess/WebContext.h: + + * UIProcess/WebContextInjectedBundleClient.cpp: + (WebKit::WebContextInjectedBundleClient::initialize): + * UIProcess/WebContextInjectedBundleClient.h: + + * UIProcess/WebHistoryClient.cpp: + (WebKit::WebHistoryClient::initialize): + * UIProcess/WebHistoryClient.h: + + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::initialize): + * UIProcess/WebLoaderClient.h: + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeLoaderClient): + (WebKit::WebPageProxy::initializePolicyClient): + (WebKit::WebPageProxy::initializeUIClient): + * UIProcess/WebPageProxy.h: + + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::initialize): + * UIProcess/WebPolicyClient.h: + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::initialize): + * UIProcess/WebUIClient.h: + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_SetProperty + https://bugs.webkit.org/show_bug.cgi?id=43217 + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::setProperty): + Convert the NPVariant to a JSValue and set it on the underlying JSObject. + + (WebKit::NPJSObject::NP_SetProperty): + Call NPJSObject::setProperty. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetProperty): + Remove unused parameter name. + + (WebKit::NPN_SetProperty): + Call the NPClass::setProperty function. + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Enumerate + https://bugs.webkit.org/show_bug.cgi?id=43215 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::npIdentifierFromIdentifier): + Get the UTF-8 string representation instead of the lossy ASCII representation. + + (WebKit::JSNPObject::getOwnPropertyNames): + Implement by calling the NPClass::enumerate function. + + * WebProcess/Plugins/JSNPObject.h: + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::enumerate): + Implement by calling JSObject::getPropertyNames. + + (WebKit::NPJSObject::npClass): + (WebKit::NPJSObject::NP_Enumerate): + Call NPJSObject::enumerate. + + * WebProcess/Plugins/NPJSObject.h: + * WebProcess/Plugins/NPRuntimeUtilities.cpp: + (WebKit::createNPObject): + Fix a comment. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_Enumerate): + Call the NPClass::enumerate function. + +2010-07-29 John Sullivan <sullivan@apple.com> + + <https://bugs.webkit.org/show_bug.cgi?id=43203> + WebBackForwardList::back/ForwardListWithLimit() crashes if passed a limit larger than max int + + Reviewed by Sam Weinig. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + Fixed casting so that a large unsigned won't become a negative int. + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + Ditto. + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Status + https://bugs.webkit.org/show_bug.cgi?id=43205 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_Status): + Convert the message char* to a String and call NetscapePlugin::setStatusbarText. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::setStatusbarText): + Call PluginController::setStatusbarText. + + * WebProcess/Plugins/PluginController.h: + Add setStatusbarText. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::setStatusbarText): + Call the Chrome member function. + +2010-07-29 Adam Roben <aroben@apple.com> + + Always say "plugins directory" when referring to a directory + containing one or more plugins + + Fixes <http://webkit.org/b/43197> WebKit2 often says "plugin + directory" when it means "plugins directory" + + Reviewed by John Sullivan. + + * UIProcess/API/C/WKContext.cpp: + (_WKContextSetAdditionalPluginsDirectory): + * UIProcess/API/C/WKContextPrivate.h: + Renamed from _WKContextSetAdditionalPluginDirectory. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::setAdditionalPluginsDirectories): Renamed + from setAdditionalPluginDirectories. + (WebKit::PluginInfoStore::loadPluginsIfNecessary): Updated for rename. + + * UIProcess/Plugins/PluginInfoStore.h: Renamed + m_additionalPluginDirectories to m_additionalPluginsDirectories. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::pluginsDirectories): + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::pluginsDirectories): + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::PluginInfoStore::pluginsDirectories): + Renamed from pluginDirectories. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::setAdditionalPluginsDirectory): + * UIProcess/WebContext.h: + Renamed from setAdditionalPluginDirectory. + +2010-07-29 Adam Roben <aroben@apple.com> + + Always say "directory" when referring to a plugin directory + + Fixes <http://webkit.org/b/43195> WebKit2 often says "plugin path" + when it means "plugin directory" + + Reviewed by John Sullivan. + + * UIProcess/API/C/WKContext.cpp: + (_WKContextSetAdditionalPluginDirectory): + * UIProcess/API/C/WKContextPrivate.h: + Renamed from _WKContextSetAdditionalPluginPath. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::setAdditionalPluginDirectories): Renamed + from setAdditionalPluginPaths. + (WebKit::PluginInfoStore::loadPluginsIfNecessary): Updated for rename. + + * UIProcess/Plugins/PluginInfoStore.h: Renamed m_additionalPluginPaths + to m_additionalPluginDirectories. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::setAdditionalPluginDirectory): + * UIProcess/WebContext.h: + Renamed from setAdditionalPluginPath, and updated for PluginInfoStore + rename. + +2010-07-29 Adam Roben <aroben@apple.com> + + Remove PluginInfoStore::mimeTypeFromExtension + + WebCore::MIMETypeRegistry already provides a cross-platform interface + for this. + + Fixes <http://webkit.org/b/43188> + PluginInfoStore::mimeTypeFromExtension is unnecessary + + Reviewed by Nikolas Zimmermann. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::findPlugin): Changed to use + MIMETypeRegistry. + + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + Removed mimeTypeFromExtension. + +2010-07-28 Sam Weinig <sam@webkit.org> + + Another Windows build fix. + + * UIProcess/API/C/WKBase.h: + * win/WebKit2Generated.make: + +2010-07-28 Sam Weinig <sam@webkit.org> + + Fix builds. + + * UIProcess/API/C/WKAPICast.h: + (WebKit::ProxyingRefPtr::operator APIType): + (toURLRef): + (toCopiedRef): + (toCopiedURLRef): + * UIProcess/win/WebView.h: + (WebKit::WebView::type): + +2010-07-28 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43163 + Add a CF-style base type (WKTypeRef) as a base for polymorphic functions. + + - Add first polymorphic function, WKGetTypeID. + - Add functions to each WK type to get their respective TypeIDs. + - Adds WebURL to complement WebString. + + * Shared/APIObject.h: + (WebKit::APIObject::): + (WebKit::APIObject::~APIObject): + * Shared/ImmutableArray.h: + (WebKit::ImmutableArray::type): + * Shared/WebString.h: + (WebKit::WebString::type): + * Shared/WebURL.h: Added. + (WebKit::WebURL::create): + (WebKit::WebURL::type): + (WebKit::WebURL::isNull): + (WebKit::WebURL::isEmpty): + (WebKit::WebURL::string): + (WebKit::WebURL::WebURL): + * UIProcess/API/C/WKAPICast.h: + (WebKit::ProxyingRefPtr::ProxyingRefPtr): + (WebKit::ProxyingRefPtr::operator APIType): + (toRef): + (toURLRef): + (toCopiedURLRef): + * UIProcess/API/C/WKArray.cpp: + (WKArrayGetTypeID): + * UIProcess/API/C/WKArray.h: + * UIProcess/API/C/WKBackForwardList.cpp: + (WKBackForwardListGetTypeID): + * UIProcess/API/C/WKBackForwardList.h: + * UIProcess/API/C/WKBackForwardListItem.cpp: + (WKBackForwardListItemGetTypeID): + * UIProcess/API/C/WKBackForwardListItem.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKContext.cpp: + (WKContextGetTypeID): + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetTypeID): + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKFramePolicyListener.cpp: + (WKFramePolicyListenerGetTypeID): + * UIProcess/API/C/WKFramePolicyListener.h: + * UIProcess/API/C/WKNavigationData.cpp: + (WKNavigationDataGetTypeID): + * UIProcess/API/C/WKNavigationData.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageGetTypeID): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPageNamespace.cpp: + (WKPageNamespaceGetTypeID): + * UIProcess/API/C/WKPageNamespace.h: + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesGetTypeID): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/C/WKString.cpp: + (WKStringGetTypeID): + * UIProcess/API/C/WKString.h: + * UIProcess/API/C/WKType.cpp: Added. + (WKGetTypeID): + * UIProcess/API/C/WKType.h: Added. + * UIProcess/API/C/WKURL.cpp: + (WKURLGetTypeID): + * UIProcess/API/C/WKURL.h: + * UIProcess/API/win/WKView.cpp: + (WKViewGetTypeID): + * UIProcess/API/win/WKView.h: + * UIProcess/WebBackForwardList.h: + (WebKit::WebBackForwardList::type): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::type): + * UIProcess/WebContext.h: + (WebKit::WebContext::type): + * UIProcess/WebFramePolicyListenerProxy.h: + (WebKit::WebFramePolicyListenerProxy::type): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::type): + * UIProcess/WebNavigationData.h: + (WebKit::WebNavigationData::type): + * UIProcess/WebPageNamespace.h: + (WebKit::WebPageNamespace::type): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::type): + * UIProcess/WebPreferences.h: + (WebKit::WebPreferences::type): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetTypeID): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetTypeID): + (WKBundlePageSetEditorClient): + (WKBundlePageSetLoaderClient): + (WKBundlePageSetUIClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebFrame.h: + (WebKit::WebFrame::type): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::type): + * win/WebKit2.vcproj: + +2010-07-28 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.execCommand + <https://bugs.webkit.org/show_bug.cgi?id=42538> + + WebKitTestRunner needs layoutTestController.isCommandEnabled + <https://bugs.webkit.org/show_bug.cgi?id=42671> + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageExecuteEditingCommand): Added. + (WKBundlePageIsEditingCommandEnabled): Added. + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Ditto. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::executeEditingCommand): Added. + (WebKit::WebPage::isEditingCommandEnabled): Added. + * WebProcess/WebPage/WebPage.h: Ditto. + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Fix 64-bit build. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + +2010-07-28 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + First pass at visited link support for WK2 + https://bugs.webkit.org/show_bug.cgi?id=43157 + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + + Move HistoryClient support from the page...: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + + ...to the Context + * UIProcess/API/C/WKContext.cpp: + (WKContextSetHistoryClient): + * UIProcess/API/C/WKContext.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::initializeHistoryClient): + (WebKit::WebContext::ensureWebProcess): When a new WebProcess is created, set its "should track visited links" mode. + (WebKit::WebContext::didNavigateWithNavigationData): + (WebKit::WebContext::didPerformClientRedirect): + (WebKit::WebContext::didPerformServerRedirect): + (WebKit::WebContext::didUpdateHistoryTitle): + (WebKit::WebContext::populateVisitedLinks): + * UIProcess/WebContext.h: + (WebKit::WebContext::hasValidProcess): + + * UIProcess/WebHistoryClient.cpp: + (WebKit::WebHistoryClient::initialize): + (WebKit::WebHistoryClient::didNavigateWithNavigationData): + (WebKit::WebHistoryClient::didPerformClientRedirect): + (WebKit::WebHistoryClient::didPerformServerRedirect): + (WebKit::WebHistoryClient::didUpdateHistoryTitle): + (WebKit::WebHistoryClient::populateVisitedLinks): + * UIProcess/WebHistoryClient.h: + (WebKit::WebHistoryClient::shouldTrackVisitedLinks): + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + * UIProcess/WebPageProxy.h: + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::populateVisitedLinks): + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::updateGlobalHistory): + (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): + (WebKit::WebFrameLoaderClient::setTitle): + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::didReceiveMessage): + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add JSNPObject::getConstructData + https://bugs.webkit.org/show_bug.cgi?id=43165 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::callMethod): + Add a null check for m_npObject. + + (WebKit::JSNPObject::callConstructor): + Call NPClass::construct. + + (WebKit::JSNPObject::getConstructData): + Set up the construct data. + + (WebKit::JSNPObject::propertyGetter): + convertNPVariantToJSValue now takes a JSGlobalObject as well. + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::invoke): + (WebKit::NPJSObject::invokeDefault): + (WebKit::NPJSObject::construct): + convertNPVariantToJSValue now takes a JSGlobalObject as well. + + * WebProcess/Plugins/NPJSObject.h: + Make isNPJSObject and toNPJSObject public. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue): + Convert NPObjects correctly. + + (WebKit::NPRuntimeObjectMap::globalObject): + Get the globalObject from the frame. + + (WebKit::NPRuntimeObjectMap::globalExec): + Call globalObject. + + * WebProcess/Plugins/NPRuntimeObjectMap.h: + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_InvokeDefault and NPN_Construct + https://bugs.webkit.org/show_bug.cgi?id=43160 + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::invoke): + Just call invoke directly. + + (WebKit::NPJSObject::invokeDefault): + Call invoke. + + (WebKit::NPJSObject::construct): + Implement this. + + (WebKit::NPJSObject::invoke): + Add new invoke overload that takes the function as a JSValue. + + (WebKit::NPJSObject::npClass): + Add NP_Construct. + + (WebKit::NPJSObject::NP_InvokeDefault): + Call NPJSObject::invokeDefault. + + (WebKit::NPJSObject::NP_Construct): + Call NPJSObject::construct. + + * WebProcess/Plugins/NPJSObject.h: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Handle the Core Animation drawing model and the Carbon event model. + + (WebKit::NPN_InvokeDefault): + Call the NPClass::invokeDefault function. + + (WebKit::NPN_Construct): + Call the NPClass::construct function. + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Invoke + https://bugs.webkit.org/show_bug.cgi?id=43158 + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::hasMethod): + Use the free getCallData function. + + (WebKit::NPJSObject::invoke): + Get the JavaScript function and call it. + + (WebKit::NPJSObject::NP_Invoke): + Call NPJSObject::invoke. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_Invoke): + Call the NPClass::invoke function. + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_HasMethod + https://bugs.webkit.org/show_bug.cgi?id=43155 + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::hasMethod): + Check if the JSObject has a property with the given name. If it does, check that the value is a function. + + (WebKit::NPJSObject::hasProperty): + Add a JSLock. + + (WebKit::NPJSObject::npClass): + Add some stubbed out functions. + + (WebKit::NPJSObject::NP_HasMethod): + Call NPJSObject::hasMethod. + + (WebKit::NPJSObject::NP_Invoke): + (WebKit::NPJSObject::NP_InvokeDefault): + (WebKit::NPJSObject::NP_SetProperty): + Stub out functions. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_HasMethod): + Call the NPClass::hasMethod function. + +2010-07-28 Brady Eidson <beidson@apple.com> + + Rubberstamped by Sam Weinig. + + Make sure new pages are always added to the same PageGroup (for now). + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2010-07-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43097 + Make all objects in the WebKit2 API inherit from a single base class + + - Adds an APIObject base class for all objects which one can get through + the C API to inherit from. + - Adds a WebString class which wraps WebCore::String for now. I am not too fond of + this solution, so we should continue to iterate on it. + - This is a first step toward make a CF-style base type (eg. CFTypeRef) for the C-API. + + * Shared/APIObject.h: Added. + (WebKit::APIObject::APIObject): + Base class for API objects. + + * Shared/ImmutableArray.h: + Make inherit from APIObject. + + * Shared/WebString.h: Added. + (WebKit::WebString::create): + (WebKit::WebString::isNull): + (WebKit::WebString::isEmpty): + (WebKit::WebString::string): + (WebKit::WebString::WebString): + Wraps a WebCore::String so that it can be passed out to the API + and still inherit from APIObject. + + * UIProcess/API/C/WKAPICast.h: + (WebKit::WebStringAdaptor::WebStringAdaptor): + (WebKit::WebStringAdaptor::operator WKStringRef): + (WebKit::WebStringAdaptor::operator WKURLRef): + Update conversion methods to deal in terms of WebStrings. Added WebStringAdaptor + to ease passing strings to client functions. + + * UIProcess/API/C/WKContext.cpp: + (WKContextCreateWithInjectedBundlePath): + (WKContextPostMessageToInjectedBundle): + (_WKContextSetAdditionalPluginPath): + (_WKContextRegisterURLSchemeAsEmptyDocument): + Get the WebCore::String from the WebString. + + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadURL): + Ditto. + + * UIProcess/API/C/WKString.cpp: + (WKStringIsEmpty): + Implement in terms of WebString. + + * UIProcess/API/C/WKURL.cpp: + * UIProcess/API/C/cf/WKStringCF.cpp: + (WKStringCreateWithCFString): + (WKStringCopyCFString): + Ditto. + + * UIProcess/API/C/cf/WKURLCF.cpp: + (WKURLCreateWithCFURL): + (WKURLCopyCFURL): + Ditto. + + * UIProcess/WebBackForwardList.h: + Make inherit from APIObject. + + * UIProcess/WebBackForwardListItem.h: + Ditto. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveMessageFromInjectedBundle): + (WebKit::WebContext::postMessageToInjectedBundle): + (WebKit::WebContext::registerURLSchemeAsEmptyDocument): + Use String instead of StringImpl to be consistent. + + * UIProcess/WebContext.h: + Make inherit from APIObject. + + * UIProcess/WebFramePolicyListenerProxy.h: + Ditto. + + * UIProcess/WebFrameProxy.h: + Ditto. + + * UIProcess/WebNavigationData.h: + Ditto. + + * UIProcess/WebPageNamespace.h: + Ditto. + + * UIProcess/WebPageProxy.h: + Ditto. + + * UIProcess/WebPreferences.h: + Ditto. + + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::runJavaScriptPrompt): + Implement in terms of WebString. + + * UIProcess/win/WebView.h: + Make inherit from APIObject. + + * WebKit2.xcodeproj/project.pbxproj: + Add new files. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundlePostMessage): + Get the WebCore::String from the WebString. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFramePauseAnimationOnElementWithId): + Ditto. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + Use String instead of StringImpl to be consistent. + + * WebProcess/WebPage/WebFrame.h: + Make inherit from APIObject. + + * WebProcess/WebPage/WebPage.h: + Make inherit from APIObject. + + * win/WebKit2.vcproj: + Add new files. + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement JSNPObject::put + https://bugs.webkit.org/show_bug.cgi?id=43149 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::getOwnPropertySlot): + Fix a typo. + + (WebKit::JSNPObject::getOwnPropertyDescriptor): + Implement this in the same way as it's implemented in RuntimeObject. + + (WebKit::JSNPObject::put): + Implement this, call NPClass::setProperty. + + * WebProcess/Plugins/JSNPObject.h: + +2010-07-28 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add support for calling NPObject methods + https://bugs.webkit.org/show_bug.cgi?id=43145 + + * WebKit2.xcodeproj/project.pbxproj: + Add JSNPMethod.cpp and JSNPMethod.h + + * WebProcess/Plugins/JSNPMethod.cpp: Added. + * WebProcess/Plugins/JSNPMethod.h: Added. + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::): + Add a ClassInfo static variable for JSNPObject. + + (WebKit::JSNPObject::callMethod): + Convert the passed in arguments, call the method and convert the result back. + + (WebKit::JSNPObject::getOwnPropertySlot): + Check if the NPObject has a method. + + (WebKit::JSNPObject::methodGetter): + Return a new JSNPMethod. + + * WebProcess/Plugins/JSNPObject.h: + (WebKit::JSNPObject::classInfo): + Return the s_info. + + * WebProcess/Plugins/NPJSObject.cpp: + (WebKit::NPJSObject::getProperty): + Get the property from the JSObject. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + Convert the given JSValue to an NPVariant. + + * win/WebKit2.vcproj: + Add JSNPMethod.cpp and JSNPMethod.h + +2010-07-28 Adam Roben <aroben@apple.com> + + Teach CoreIPC how to handle with a pipe closing during a write + + Fixes <http://webkit.org/b/43131> Assertion failure in + Connection::sendOutgoingMessage if the other process exits at just the + wrong time + + Reviewed by Darin Adler. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::sendOutgoingMessage): If ::WriteFile fails with + ERROR_NO_DATA, the pipe (and thus the connection) has closed. + +2010-07-28 Adam Roben <aroben@apple.com> + + Teach CoreIPC the right way to send large messages on Windows + + r63776 added support for ::WriteFile failing with ERROR_IO_PENDING, + but it had a major flaw: we didn't ensure that the data being sent + (which is owned by the ArgumentEncoder) stayed around until the write + finished. We'd destroy the data immediately, leading to ::WriteFile + accessing that freed memory later. This seemed to always manifest + itself as a crash in ::WaitForMultipleObjects. + + The correct solution (as hinted above) is to make sure that the data + being written is not destroyed until the write completes. When + ::WriteFile fails with ERROR_IO_PENDING, we store the data being sent + in Connection::m_pendingWriteArguments, and don't send any more + messages until that write completes. We use an event in the OVERLAPPED + structure passed to ::WriteFile to detect when the write has completed + (similar to what we do for reads). + + Fixes <http://webkit.org/b/42785> <rdar://problem/8218522> Crash in + WebKit2WebProcess in WaitForMultipleObjects beneath + WorkQueue::workQueueThreadBody when running tests that produce a lot + of output + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::canSendOutgoingMessages): Added. This calls out + to a platform-specific function to allow each platform to have its own + policy for when messages can and can't be sent. + (CoreIPC::Connection::sendOutgoingMessages): Use the new + canSendOutgoingMessages to determine whether we can send any messages + right now. We now remove one message at a time from m_outgoingMessages + and send it. We stop sending messages when sendOutgoingMessage returns + false. + + * Platform/CoreIPC/Connection.h: Added m_pendingWriteArguments and + m_writeState on Windows. + (CoreIPC::Connection::Message::Message): Added this default + constructor. + + * Platform/CoreIPC/MessageID.h: + (CoreIPC::MessageID::MessageID): Made the default constructor public + for Message's benefit. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformCanSendOutgoingMessages): Added. Always + returns true. + (CoreIPC::Connection::sendOutgoingMessage): Changed to return a + boolean indicating whether more messages can be sent at this time. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::platformCanSendOutgoingMessages): Added. Returns + true if we have a socket. + (CoreIPC::Connection::sendOutgoingMessage): Changed a null-check of + m_socket to an assertion since it should be checked for null in + platformCanSendOutgoingMessages. Changed to return a boolean + indicating whether more messages can be sent at this time. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::platformInitialize): Added initialization of + m_writeState. + (CoreIPC::Connection::platformInvalidate): Close m_writeState's event + handle. + (CoreIPC::Connection::writeEventHandler): Added. Checks if the pending + write has completed, cleans up our pending write state, and sends any + remaining messages. + (CoreIPC::Connection::open): Register our write event with the + WorkQueue so that writeEventHandler will be called when the event is + signaled. + (CoreIPC::Connection::platformCanSendOutgoingMessages): Added. We can + only send messages if there isn't a write pending. + (CoreIPC::Connection::sendOutgoingMessage): Changed to return a + boolean indicating whether more messages can be sent at this time. We + now pass m_writeState to ::WriteFile instead of an empty OVERLAPPED + struct so that our write event will be signaled when the write + completes. We also no longer pass a pointer to receive how many bytes + were written, as recommended by MSDN. If ::WriteFile fails with + ERROR_IO_PENDING, we save the ArgumentEncoder for this message and + return false to indicate that no more messages can be sent at this + time. + +2010-07-28 Adam Roben <aroben@apple.com> + + Stop leaking Connection::m_readState.hEvent on Windows + + Fixes <http://webkit.org/b/43129> CoreIPC::Connection leaks its read + event on Windows + + Reviewed by Darin Adler. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::platformInvalidate): Close the event handle. + +2010-07-26 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Page clients should be passed to Page constructor via structure of pointers + https://bugs.webkit.org/show_bug.cgi?id=42834 + + * WebKit2/WebProcess/WebPage/WebPage.cpp: + (WebPage::WebPage): + +2010-07-28 Andras Becsi <abecsi@webkit.org> + + Unreviewed trivial build fix. + + [Qt] Follow the API changes after r64172. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::url): + (QWKPage::title): + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::propertyGetter): + Remove unreachable code. + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement JSNPObject::propertyGetter + https://bugs.webkit.org/show_bug.cgi?id=43091 + + * WebProcess/Plugins/JSNPObject.cpp: + (WebKit::JSNPObject::propertyGetter): + Ask the NPObject for its property. + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::jsNPObjectDestroyed): + Add a stub. + + (WebKit::NPRuntimeObjectMap::convertNPVariantToValue): + Implement this for everything except objects. + +2010-07-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43087 + Clean up handling of strings at the WebKit2 API layer. + + - Always use the "copy" rule for functions that return WKStringRefs or WKURLRefs. + - Never return a null WKStringRef or WKURLRef. + + * UIProcess/API/C/WKAPICast.h: + (toRef): + (toURLRef): + (toCopiedRef): + (toCopiedURLRef): + * UIProcess/API/C/WKBackForwardListItem.cpp: + (WKBackForwardListItemCopyOriginalURL): + (WKBackForwardListItemCopyURL): + (WKBackForwardListItemCopyTitle): + * UIProcess/API/C/WKBackForwardListItem.h: + * UIProcess/API/C/WKFrame.cpp: + (WKFrameIsMainFrame): + (WKFrameCopyProvisionalURL): + (WKFrameCopyURL): + (WKFrameGetPage): + (WKFrameRetain): + (WKFrameRelease): + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKNavigationData.cpp: + (WKNavigationDataCopyTitle): + (WKNavigationDataCopyURL): + * UIProcess/API/C/WKNavigationData.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageCopyTitle): + * UIProcess/API/C/WKPage.h: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyURL): + (WKBundleFrameCopyName): + (WKBundleFrameCopyCounterValue): + (WKBundleFrameCopyMarkerText): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: + (WKBundleNodeCopyNodeName): + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCopyRenderTreeExternalRepresentation): + +2010-07-27 Adam Roben <aroben@apple.com> + + Fix PageClient ownership in WebPageProxy + + WKView now owns the PageClient, similar to how things work on Windows + (where the WebView is the PageClient). + + Fixes <http://webkit.org/b/40185> WebPageProxy should keep a weak + reference to the PageClient + + Reviewed by Anders Carlsson. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): Store the PageClientImpl + on our WKViewData object and pass it to the WebPageProxy. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setPageClient): + * UIProcess/WebPageProxy.h: + Removed Mac-specific code that put the PageClient in an OwnPtr. We now + store it in a bare pointer just like on Windows. + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add JSNPObject, a JSObject that wraps an NPObject + https://bugs.webkit.org/show_bug.cgi?id=43079 + + * WebKit2.xcodeproj/project.pbxproj: + Add JSNPObject.cpp and JSNPObject.h + + * WebProcess/Plugins/JSNPObject.cpp: Added. + (WebKit::npIdentifierFromIdentifier): + (WebKit::JSNPObject::JSNPObject): + (WebKit::JSNPObject::~JSNPObject): + (WebKit::JSNPObject::getOwnPropertySlot): + Check if the NPObject has the given property. + + (WebKit::JSNPObject::propertyGetter): + (WebKit::JSNPObject::throwInvalidAccessError): + * WebProcess/Plugins/JSNPObject.h: Added. + (WebKit::JSNPObject::createStructure): + * WebProcess/Plugins/NPJSObject.h: + + * win/WebKit2.vcproj: + Add JSNPObject.cpp and JSNPObject.h + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Expose interface for returning the plug-in script JSObject + https://bugs.webkit.org/show_bug.cgi?id=43074 + + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::getOrCreateJSObject): + Add empty stub. + + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::pluginScriptableNPObject): + Ask the plug-in for it's scriptable NPObject. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/Plugin.h: + Add pluginScritableNPObject. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Call PluginViewBase constructor. + + (WebKit::PluginView::scriptObject): + Ask the plug-in for its scriptable object and wrap it. + + * WebProcess/Plugins/PluginView.h: + PluginView now inherits from PluginViewBase. + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Move NPJSObject out into separate files + https://bugs.webkit.org/show_bug.cgi?id=43068 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/NPJSObject.cpp: Added. + (WebKit::NPJSObject::create): + (WebKit::NPJSObject::NPJSObject): + (WebKit::NPJSObject::~NPJSObject): + (WebKit::NPJSObject::isNPJSObject): + (WebKit::NPJSObject::initialize): + (WebKit::identifierFromIdentifierRep): + (WebKit::NPJSObject::hasProperty): + (WebKit::NPJSObject::getProperty): + (WebKit::NPJSObject::npClass): + (WebKit::NPJSObject::NP_Allocate): + (WebKit::NPJSObject::NP_Deallocate): + (WebKit::NPJSObject::NP_HasProperty): + (WebKit::NPJSObject::NP_GetProperty): + * WebProcess/Plugins/NPJSObject.h: Added. + (WebKit::NPJSObject::jsObject): + (WebKit::NPJSObject::toNPJSObject): + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::npJSObjectDestroyed): + (WebKit::NPRuntimeObjectMap::globalExec): + * WebProcess/Plugins/NPRuntimeObjectMap.h: + * win/WebKit2.vcproj: + +2010-07-27 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Rename NPJSObjectMap to NPRuntimeObjectMap + https://bugs.webkit.org/show_bug.cgi?id=43066 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/NPJSObjectMap.cpp: Removed. + * WebProcess/Plugins/NPJSObjectMap.h: Removed. + * WebProcess/Plugins/NPRuntimeObjectMap.cpp: Added. + (WebKit::NPJSObject::NPJSObject): + (WebKit::NPJSObject::~NPJSObject): + (WebKit::NPJSObject::toNPJSObject): + (WebKit::NPJSObject::create): + (WebKit::NPJSObject::isNPJSObject): + (WebKit::NPJSObject::initialize): + (WebKit::identifierFromIdentifierRep): + (WebKit::NPJSObject::hasProperty): + (WebKit::NPJSObject::getProperty): + (WebKit::NPJSObject::npClass): + (WebKit::NPJSObject::NP_Allocate): + (WebKit::NPJSObject::NP_Deallocate): + (WebKit::NPJSObject::NP_HasProperty): + (WebKit::NPJSObject::NP_GetProperty): + (WebKit::NPRuntimeObjectMap::NPRuntimeObjectMap): + (WebKit::NPRuntimeObjectMap::getOrCreateNPObject): + (WebKit::NPRuntimeObjectMap::invalidate): + * WebProcess/Plugins/NPRuntimeObjectMap.h: Added. + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + (WebKit::PluginView::~PluginView): + (WebKit::PluginView::windowScriptNPObject): + (WebKit::PluginView::pluginElementNPObject): + * WebProcess/Plugins/PluginView.h: + * win/WebKit2.vcproj: + +2010-07-27 Adam Roben <aroben@apple.com> + + Make preferences APIs robust against web process crashes + + Fixes <http://webkit.org/b/43049> Crash in + WebPageNamespace::preferencesDidChange if preferences are changed + after the web process crashes + + Reviewed by Anders Carlsson. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::preferencesDidChange): Bail out if we don't have + a web process. The new preference values will get propogated to the + web process if and when it launches. + +2010-07-27 Adam Roben <aroben@apple.com> + + Add a ProcessDidExit callback to the WKPageLoaderClient + + Fixes <http://webkit.org/b/43048> UI process needs a way to find out + when the web process crashes + + Reviewed by Anders Carlsson. + + * UIProcess/API/C/WKPage.h: Added WKPageProcessDidExitCallback, and a + processDidExit member of that type to WKPageLoaderClient. + + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::processDidExit): Added. Calls through to the + WKPageLoaderClient. + + * UIProcess/WebLoaderClient.h: Added processDidExit. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::processDidExit): Tell the loader client the + process exited. + +2010-07-27 Andras Becsi <abecsi@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WebEventFactory::createWebMouseEvent should follow WebKit2 API changes + https://bugs.webkit.org/show_bug.cgi?id=43042 + + * Shared/qt/WebEventFactoryQt.cpp: + (WebKit::WebEventFactory::createWebMouseEvent): + Set deltaX, deltaY and deltaZ arguments. + +2010-07-27 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WebKit::PageClient implementation needs a dedicated class + + https://bugs.webkit.org/show_bug.cgi?id=42974 + + * UIProcess/API/qt/qwkpage.cpp: + (PageClientImpl::PageClientImpl): Added. + (PageClientImpl::pageDidEnterAcceleratedCompositing): Moved from QWKPagePrivate. + (PageClientImpl::pageDidLeaveAcceleratedCompositing): Ditto. + (PageClientImpl::processDidExit): Ditto. + (PageClientImpl::processDidRevive): Ditto. + (PageClientImpl::setCursor): Ditto. + (PageClientImpl::takeFocus): Ditto. + (PageClientImpl::toolTipChanged): Ditto. + (QWKPagePrivate::QWKPagePrivate): Set a new instance of the PageClientImpl as PageClient rather than 'this'. + * UIProcess/API/qt/qwkpage_p.h: Removed PageClient implementation methods from QWKPagePrivate. + +2010-07-26 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.counterValueForElementById + https://bugs.webkit.org/show_bug.cgi?id=42537 + + WebKitTestRunner needs layoutTestController.markerTextForListItem + https://bugs.webkit.org/show_bug.cgi?id=42549 + + * UIProcess/API/C/WKString.cpp: + (WKStringIsEmpty): Added. + * UIProcess/API/C/WKString.h: Added WKStringIsEmpty. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (copiedString): Added. Helper for functions that return a + WKStringRef that follows the copy rule. + (WKBundleFrameCopyName): Use copiedString. + (WKBundleFrameCopyCounterValue): Added. Calls counterValue. + (WKBundleFrameCopyMarkerText): Added. Calls markerText. + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: + Added WKBundleFrameCopyCounterValue and WKBundleFrameCopyMarkerText. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::computedStyleIncludingVisitedInfo): + Renamed argument to streamline function a bit. + (WebKit::WebFrame::counterValue): Added. + (WebKit::WebFrame::markerText): Added. + * WebProcess/WebPage/WebFrame.h: Added counterValue and markerText. + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Part 2 of https://bugs.webkit.org/show_bug.cgi?id=43013 + <rdar://problem/8152434> + Add support for scrolling using the keyboard in WebKit2 + + Add support for scrolling with the space bar and ensure that we don't scroll + if WebCore is handling the event in another way. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::keyEvent): + (WebKit::getScrollMapping): + (WebKit::WebPage::performDefaultBehaviorForKeyEvent): + * WebProcess/WebPage/WebPage.h: + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43013 + Part of <rdar://problem/8152434> + Add support for scrolling using the keyboard in WebKit2 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::getScrollMapping): + (WebKit::WebPage::keyEvent): + Scroll the page in response to keyDown. + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/WebPageMac.mm: + Use WindowsKeyboardCodes.h instead of redefining the constants. + +2010-07-26 Ada Chan <adachan@apple.com> + + Fix Windows build. + + * win/WebKit2Generated.make: + +2010-07-26 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + +2010-07-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle mouseenter/mouseleave + focus events + https://bugs.webkit.org/show_bug.cgi?id=42997 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::handleMouseEnterEvent): + Call platformHandleMouseEnterEvent. + + (WebKit::NetscapePlugin::handleMouseLeaveEvent): + Call platformHandleMouseExitEvent. + + (WebKit::NetscapePlugin::setFocus): + Call platformSetFocus. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: + (WebKit::fillInCocoaEventFromMouseEvent): + Factor out code that fills in an NPCocoaEvent from a WebMouseEvent. + + (WebKit::initializeMouseEvent): + Call fillInCocoaEventFromMouseEvent. + + (WebKit::NetscapePlugin::platformHandleMouseEnterEvent): + Send an NPCocoaEventMouseEntered event. + + (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent): + Send an NPCocoaEventMouseExited event. + + (WebKit::NetscapePlugin::platformSetFocus): + Send an NPCocoaEventFocusChanged. + + * WebProcess/Plugins/Plugin.h: + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + Dispatch mouse enter and mouse leave events. Call focusPluginElement on mousedown. + + (WebKit::PluginView::focusPluginElement): + Focus the plug-in's containing frame and its element. + + (WebKit::PluginView::setFocus): + Call Plugin::setFocus. + +2010-07-26 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Add ability for WK2 to register a scheme to always be displayed as an empty document + https://bugs.webkit.org/show_bug.cgi?id=42995 + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + + * UIProcess/API/C/WKContext.cpp: + (_WKContextRegisterURLSchemeAsEmptyDocument): + * UIProcess/API/C/WKContextPrivate.h: + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::registerURLSchemeAsEmptyDocument): + * UIProcess/WebContext.h: + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::registerURLSchemeAsEmptyDocument): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + +2010-07-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Get rid of the dummy plug-in. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/DummyPlugin.cpp: Removed. + * WebProcess/Plugins/DummyPlugin.h: Removed. + * win/WebKit2.vcproj: + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move some non-APIish functions into private headers. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h: Copied from WebProcess/InjectedBundle/API/c/WKBundleFrame.h. + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Copied from WebProcess/InjectedBundle/API/c/WKBundle.h. + * win/WebKit2.vcproj: + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=42986 + Add prompt and confirm client functions to WebKit2 + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::runJavaScriptAlert): + (WebKit::WebPageProxy::runJavaScriptConfirm): + (WebKit::WebPageProxy::runJavaScriptPrompt): + * UIProcess/WebPageProxy.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::runJavaScriptAlert): + (WebKit::WebUIClient::runJavaScriptConfirm): + (WebKit::WebUIClient::runJavaScriptPrompt): + * UIProcess/WebUIClient.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::runJavaScriptConfirm): + (WebKit::WebChromeClient::runJavaScriptPrompt): + +2010-07-26 Adam Roben <aroben@apple.com> + + Windows build fix + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + Removed empty attributes so the values will be picked up from the + vsprops files. (Also removed a couple of attributes that accidentally + duplicated values from the vsprops files.) + +2010-07-26 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Composited layers don't scroll in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42771 + + In WebKit2, do the compositing layer geometry flipping on the drawing area's main + backing layer. This both avoids us having to flip the layer contents, and also avoids issues + with the positioning of the root platform layer, which we want top-left. Doing the flipping + lower down would require that the root platform layer know where the scrollbar is. + + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + +2010-07-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Deliver mouse and wheel events to plug-ins + https://bugs.webkit.org/show_bug.cgi?id=42988 + + * Shared/WebEvent.h: + (WebKit::WebMouseEvent::WebMouseEvent): + (WebKit::WebMouseEvent::deltaX): + (WebKit::WebMouseEvent::deltaY): + (WebKit::WebMouseEvent::deltaZ): + * Shared/mac/WebEventFactory.mm: + (WebKit::WebEventFactory::createWebMouseEvent): + Add deltaX, deltaY and deltaZ member variables to WebMosueEvent. + + * WebKit2.xcodeproj/project.pbxproj: + Rename NetscapePluginMac.cpp to NetscapePluginMac.mm. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_HandleEvent): + Add NPP_ wrapper. + + (WebKit::NetscapePlugin::handleMouseEvent): + (WebKit::NetscapePlugin::handleWheelEvent): + Call the platform variants. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: Added. + (WebKit::modifierFlags): + (WebKit::buttonNumber): + (WebKit::initializeMouseEvent): + (WebKit::NetscapePlugin::platformHandleMouseEvent): + Create an NPCocoaEvent and send it to the plug-in. + + (WebKit::NetscapePlugin::platformHandleWheelEvent): + Ditto. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + Get the current WebEvent and send it to the plug-in if necessary. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::currentEvent): + (WebKit::CurrentEvent::CurrentEvent): + (WebKit::CurrentEvent::~CurrentEvent): + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + * WebProcess/WebPage/WebPage.h: + Add RAII object for keeping track of the current event. + +2010-07-26 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Clean up event handling functions + https://bugs.webkit.org/show_bug.cgi?id=42977 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-07-25 Darin Adler <darin@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKitTestRunner needs to support layoutTestController.keepWebHistory + https://bugs.webkit.org/show_bug.cgi?id=42323 + + Added WKBundleSetShouldTrackVisitedLinks, WKBundleRemoveAllVisitedLinks, + and WKBundleFrameGetComputedStyleIncludingVisitedInfo. + + Also fixed misspellings of the word "receive". + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetShouldTrackVisitedLinks): Added. + (WKBundleRemoveAllVisitedLinks): Added. + * WebProcess/InjectedBundle/API/c/WKBundle.h: Added functions and + fixed mispellings of receive. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetJavaScriptContext): Moved the code from here into WebFrame, + to be consistent with the rest of the functions in this file. + (WKBundleFrameGetComputedStyleIncludingVisitedInfo): Added. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Added + WKBundleFrameGetComputedStyleIncludingVisitedInfo and tried to rearrange the + file to be more logically ordered and grouped. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setShouldTrackVisitedLinks): Added. + (WebKit::InjectedBundle::removeAllVisitedLinks): Added. + (WebKit::InjectedBundle::didReceiveMessage): Fixed mispellings of receive. + * WebProcess/InjectedBundle/InjectedBundle.h: Ditto. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::jsContext): Added. Contains the code that used to be in + WKBundleFrameGetJavaScriptContext. + (WebKit::WebFrame::computedStyleIncludingVisitedInfo): Added. + * WebProcess/WebPage/WebFrame.h: Ditto. + + * UIProcess/API/C/WKContext.h: Fixed misspellings of receive. + * UIProcess/WebContext.cpp: + (WebKit::WebContext::didReceiveMessageFromInjectedBundle): Ditto. + * UIProcess/WebContext.h: Ditto. + * UIProcess/WebContextInjectedBundleClient.cpp: + (WebKit::WebContextInjectedBundleClient::didReceiveMessageFromInjectedBundle): Ditto. + * UIProcess/WebContextInjectedBundleClient.h: Ditto. + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::forwardMessageToWebContext): Ditto. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::forwardMessageToInjectedBundle): Ditto. + +2010-07-25 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=42193 + Support layoutTestController.dumpEditingDelegates in WebKitTestRunner + + Step 2 - add the rest of editing delegates. + + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + Added enums for EditorInsertAction and EAffinity. Also added a dummy type for + CSSStyleDeclaration - neither DumpRenderTree not WebKitTestRunner actually use that. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: + (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): + (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): + (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): + (WebKit::InjectedBundlePageEditorClient::shouldInsertText): + (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): + (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): + (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): + (WebKit::InjectedBundlePageEditorClient::didBeginEditing): + (WebKit::InjectedBundlePageEditorClient::didEndEditing): + (WebKit::InjectedBundlePageEditorClient::didChange): + (WebKit::InjectedBundlePageEditorClient::didChangeSelection): + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::shouldDeleteRange): + (WebKit::WebEditorClient::shouldEndEditing): + (WebKit::WebEditorClient::shouldInsertNode): + (WebKit::WebEditorClient::shouldInsertText): + (WebKit::WebEditorClient::shouldChangeSelectedRange): + (WebKit::WebEditorClient::shouldApplyStyle): + (WebKit::WebEditorClient::didBeginEditing): + (WebKit::WebEditorClient::respondToChangedContents): + (WebKit::WebEditorClient::respondToChangedSelection): + (WebKit::WebEditorClient::didEndEditing): + Added remaining delagates that are needed for WebKitTestRunner. + +2010-07-19 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Setup the QtWebProcess + + https://bugs.webkit.org/show_bug.cgi?id=42623 + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + Remove the framework entry point from here to WebProcess/qt/WebProcessMainQt.cpp to match with with the mac and the win port. + * WebKit2.pro: Added. + * WebProcess/qt/WebProcessMainQt.cpp: Added. + (WebKit::WebProcessMainQt): Framework entry point for Qt. + * qt/MainQt.cpp: Added. + (main): + +2010-07-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Eliminate unneeded WKBundleFrameCopyInnerText function from WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42847 + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: Removed WKBundleFrameCopyInnerText. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Ditto. + * WebProcess/WebPage/WebFrame.cpp: Removed innerText. + * WebProcess/WebPage/WebFrame.h: Ditto. + +2010-07-22 Alexey Proskuryakov <ap@apple.com> + + More Windows build fixing. + + * win/WebKit2Generated.make: Copy the new public headers to $(WEBKITOUTPUTDIR)\include\WebKit2. + +2010-07-22 Alexey Proskuryakov <ap@apple.com> + + Windows build fix. + + * win/WebKit2.vcproj: Added new files. + +2010-07-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig and Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=42193 + Support layoutTestController.dumpEditingDelegates in WebKitTestRunner + + Step 1: Add the method, and implement one actual delegate call as proof of concept. No tests + fixed, but this makes difference one line smaller on many editing tests. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp: Added. + (WKBundleNodeCopyNodeName): + (WKBundleNodeGetParent): + * WebProcess/InjectedBundle/API/c/WKBundleNode.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetEditorClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundleRange.cpp: Added. + (WKBundleRangeGetStartOffset): + (WKBundleRangeGetStartContainer): + (WKBundleRangeGetEndOffset): + (WKBundleRangeGetEndContainer): + * WebProcess/InjectedBundle/API/c/WKBundleRange.h: Added. + Added WKBundleRangeRef and WKBundleNodeRef types for injected bundles. These are just pointers + to respective WebCore objects, without any WebKit2 wrappers. + + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: Added. + (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): + (WebKit::InjectedBundlePageEditorClient::initialize): + (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): + * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Added. + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::shouldBeginEditing): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleEditorClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleEditorClient): + Added the plumbing for invoking injected bundle code for editor client. There is no real API + for editor client yet. + +2010-07-22 Ivan Krstić <ike@apple.com> + + Reviewed by Anders Carlsson. + + Adapt sandbox for new WebProcess bootstrap service naming scheme. + <rdar://problem/8225000> + + * WebProcess/com.apple.WebProcess.sb: + +2010-07-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + It should be possible to attach to the WebProcess in gdb during startup + https://bugs.webkit.org/show_bug.cgi?id=42853 + + Create an unique bootstrap service name and pass it to the web process, instead of registering a per process + name (which was incorrect anyway). This lets us get rid of the requirement that the UI process always should be + the parent process of the web process, something which is false when running under the debugger. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + +2010-07-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't assert when Connection::invalidate is called before Connection::dispatchConnectionDidClose + https://bugs.webkit.org/show_bug.cgi?id=42851 + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::dispatchConnectionDidClose): + Just return early if m_client is 0. + +2010-07-22 Adam Roben <aroben@apple.com> + + Use ::MessageBox instead of ::DebugBreak to make the web process wait + for a debugger + + While ::DebugBreak can make it easier to attach a debugger (because it + brings up the Just-in-Time debugger window), using ::MessageBox has + two advantages: + 1) It explains to the user what's going on, so it's harder to + mistake this debugging aid for a bug. + 2) It allows you to debug the UI process and the web process using + the same debugger, if desired. + + Special thanks to John Sullivan for help with the text that's shown in + the alert. + + Fixes <http://webkit.org/b/42848> WebKit2's wait-for-debugger + debugging aid should explain to the user what's happening + + Reviewed by John Sullivan and Anders Carlsson. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): Use a ::MessageBox instead of a ::DebugBreak to wait for + the debugger. The alert explains to the user what's going on. + +2010-07-22 Adam Roben <aroben@apple.com> + + Make WorkQueue aware of potential errors with ::WaitForMultipleObjects + + Fixes <http://webkit.org/b/42846> WorkQueue should detect + ::WaitForMultipleObject failures + + Reviewed by Anders Carlsson. + + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::workQueueThreadBody): Added some assertions about the + various things that can fail with ::WaitForMultipleObjects, + specifically: + - Passing too many objects + - Timeouts (which shouldn't happen since we pass a timeout interval + of INFINITE) + - Abandoned mutexes (which shouldn't happen since we don't wait on + any mutexes currently) + - Miscellaneous failures + +2010-07-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42836 + Add localized strings stubs for WebKit2. + + Gets us below 200 tests failing in WebKitTestRunner. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2010-07-22 Andras Becsi <abecsi@webkit.org> + + Unreviewed trivial build fix. + + [Qt] Mend remaining issues to fix the WebKit2 build. + + * Shared/qt/UpdateChunk.h: add missing function + (WebKit::UpdateChunk::isEmpty): + * UIProcess/API/qt/qwkpage_p.h: Add stub implementation + (QWKPagePrivate::pageDidEnterAcceleratedCompositing): + (QWKPagePrivate::pageDidLeaveAcceleratedCompositing): + +2010-07-22 Andras Becsi <abecsi@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Implement WebContext::applicationCacheDirectory() for the Qt port of WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=42830 + + * UIProcess/qt/WebContextQt.cpp: Added. + (WebKit::WebContext::applicationCacheDirectory): + +2010-07-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Unreviewed build fix. + + [Qt] Fix WebKit2 build + + https://bugs.webkit.org/show_bug.cgi?id=42638 + + * UIProcess/API/qt/qwkpage_p.h: + (QWKPagePrivate::setCursor): Added empty implementation. + +2010-07-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Antonio Gomes. + + Lazy cursor creation should be guarded by #if USE(LAZY_NATIVE_CURSOR) in WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=42622 + + * Shared/WebCoreArgumentCoders.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setCursor): + +2010-07-22 Jon Honeycutt <jhoneycutt@apple.com> + + Build fix. Unreviewed. + + * win/WebKit2WebProcess.vcproj: + Remove the pre- and post-build events, so that they will use the value + inherited from the vsprops. + +2010-07-21 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions + https://bugs.webkit.org/show_bug.cgi?id=42548 + + Added WKBundleFrameCopyName. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyName): Added. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Ditto. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::name): Added. + * WebProcess/WebPage/WebFrame.h: Ditto. + +2010-07-21 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support dumping of scroll position + https://bugs.webkit.org/show_bug.cgi?id=42514 + + Added WKBundleFrameGetJavaScriptContext function. + + * WebKit2.xcodeproj: Added property svn:ignore. + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetJavaScriptContext): Added. + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Ditto. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + Use JSGlobalContextRef instead of JSContextRef and context instead of ct. + +2010-07-21 Adam Roben <aroben@apple.com> + + Handle broken pipes in more places in CoreIPC + + Fixes <http://webkit.org/b/42784> Assertion failure in + Connection::readEventHandler when WebKitTestRunner exits + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::readEventHandler): Check for a broken pipe + whenever we call ::PeekNamedPipe. + +2010-07-21 Adam Roben <aroben@apple.com> + + Teach CoreIPC how to handle messages that are larger than the pipe's + buffer + + ::GetOverlappedResult and ::ReadFile can fail with ERROR_MORE_DATA + when there is more data available on the pipe than was requested in + the read operation. In those cases, the appropriate response is to + perform another read operation to read the extra data. We now do this. + + Also, MSDN says that, because we are doing asynchronous read + operations, we should not pass a pointer to ::ReadFile to find out how + many bytes were read. Instead we should always call + ::GetOverlappedResult to find this out. I've changed + Connection::readEventHandler to have a single loop that calls + ::GetOverlappedResult and ::ReadFile in alternation, rather than + sometimes calling ::ReadFile multiple times in a row, to satisfy this + requirement. + + In order to simplify the logic in this function, I've made us request + only a single byte from the pipe when there are no messages already in + the pipe. (Previously we were requesting 4096 bytes in this case.) + This allows us not to have to consider the case where the received + message is smaller than our read buffer. If we decide that this has a + negative impact on performance, we can of course change it. I've + mitigated this somewhat by using ::PeekNamedMessage to find out the + size of the next message in the pipe (if any), so that we can read it + all in one read operation. + + Fixes <http://webkit.org/b/42710> <rdar://problem/8197571> Assertion + in Connection::readEventHandler when launching WebKitTestRunner + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::readEventHandler): Put the call to + ::GetOverlappedResult in the same loop as ::ReadFile so that we will + call them alternately. If ::GetOverlappedResult fails with + ERROR_MORE_DATA, use ::PeekNamedPipe to determine the size of the rest + of the message, then read it from the pipe. After dispatching the + message, use ::PeekNamedPipe to find out the size of the next message + in the pipe so we can read it all in one operation. If there's no + message in the pipe, we'll request just a single byte of the next + message that becomes available, and Windows will tell us when the rest + of the message is ready. If ::ReadFile fails with ERROR_MORE_DATA it + means there is data available now even though we didn't think there + was any. We go back to the top of the loop in this case and call + ::GetOverlappedResult again to retrieve the available data. + +2010-07-21 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42539 + WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages + + - Convert injected bundle UIClient functions to will-style, at least until we establish + more concrete use cases for them past the TestRunner. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::willAddMessageToConsole): + (WebKit::InjectedBundlePageUIClient::willSetStatusbarText): + (WebKit::InjectedBundlePageUIClient::willRunJavaScriptAlert): + (WebKit::InjectedBundlePageUIClient::willRunJavaScriptConfirm): + (WebKit::InjectedBundlePageUIClient::willRunJavaScriptPrompt): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::addMessageToConsole): + (WebKit::WebChromeClient::runJavaScriptAlert): + (WebKit::WebChromeClient::runJavaScriptConfirm): + (WebKit::WebChromeClient::runJavaScriptPrompt): + (WebKit::WebChromeClient::setStatusbarText): + +2010-07-21 Simon Fraser <simon.fraser@apple.com> + + Windows build fix. + + Need to supply implementations of PageClient::pageDidEnterAcceleratedCompositing() + and pageDidLeaveAcceleratedCompositing() for WebView on Windows. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::pageDidEnterAcceleratedCompositing): + (WebKit::WebView::pageDidLeaveAcceleratedCompositing): + * UIProcess/win/WebView.h: + +2010-07-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't assert when clicking on a plug-in in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42762 + + Add stub for PluginView::handleEvent. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + * WebProcess/Plugins/PluginView.h: + +2010-07-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Get accelerated compositing working with webkit2 + https://bugs.webkit.org/show_bug.cgi?id=41084 + + Hook up dynamic DrawingArea switching, so that when the WebProcess hits a page + that requires accelerated compositing, we switch to the LayerBackedDrawingArea. + + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: + (DrawingAreaProxyMessage::): + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::pageDidEnterAcceleratedCompositing): + (WebKit::PageClientImpl::pageDidLeaveAcceleratedCompositing): + * UIProcess/API/mac/WKView.mm: + (-[WKView _startAcceleratedCompositing:]): + (-[WKView _switchToDrawingAreaTypeIfNecessary:DrawingAreaProxy::]): + (-[WKView _pageDidEnterAcceleratedCompositing]): + (-[WKView _pageDidLeaveAcceleratedCompositing]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::didReceiveSyncMessage): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::): + (WebKit::DrawingAreaProxy::type): + * UIProcess/LayerBackedDrawingAreaProxy.cpp: + (WebKit::LayerBackedDrawingAreaProxy::didSetSize): + (WebKit::LayerBackedDrawingAreaProxy::didReceiveMessage): + (WebKit::LayerBackedDrawingAreaProxy::didReceiveSyncMessage): + * UIProcess/LayerBackedDrawingAreaProxy.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setDrawingArea): + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::didEnterAcceleratedCompositing): + (WebKit::WebPageProxy::didLeaveAcceleratedCompositing): + * UIProcess/WebPageProxy.h: + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + (WebKit::LayerBackedDrawingAreaProxy::attachCompositingContext): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::attachRootGraphicsLayer): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: + (WebKit::ChunkedUpdateDrawingArea::attachCompositingContext): + (WebKit::ChunkedUpdateDrawingArea::setRootCompositingLayer): + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::): + (WebKit::DrawingArea::type): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::setNeedsDisplay): + (WebKit::LayerBackedDrawingArea::setSize): + (WebKit::LayerBackedDrawingArea::didUpdate): + (WebKit::LayerBackedDrawingArea::setRootCompositingLayer): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::changeAcceleratedCompositingMode): + (WebKit::WebPage::enterAcceleratedCompositingMode): + (WebKit::WebPage::exitAcceleratedCompositingMode): + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformInit): + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + (WebKit::LayerBackedDrawingArea::detachCompositingContext): + (WebKit::LayerBackedDrawingArea::setRootCompositingLayer): + +2010-07-20 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + WebKit on Windows should build optionally with an unversioned ICU DLL + https://bugs.webkit.org/show_bug.cgi?id=42722 + <rdar://problem/8211767> WebKit needs to link against unversioned ICU + + To get the proper value for U_DISABLE_RENAMING into all source files, we force + the include of ICUVersion.h (our generated header) via the compiler options. + + Since the versioned and unversioned ICU have different filenames (libicuuc.lib vs icuuc.lib) + we copy the ICU lib to an intermediate location under obj with a common name. This + allows us to link properly with either without adding a new build configuration. + + * win/WebKit2Common.vsprops: + Copy ICU libs into a common location with a common name. + Add additional library search path to pick up icu lib. + Change ICU library filename specified to linker. + Add forced include of ICUVersion.h. + +2010-07-21 Adam Roben <aroben@apple.com> + + Windows build fix + + * Shared/win/UpdateChunk.h: + (WebKit::UpdateChunk::isEmpty): Added to match the Mac definition. + +2010-07-21 Anders Carlsson <andersca@apple.com> + + Land file I forgot to add. + + * WebProcess/com.apple.WebProcess.sb: Added. + +2010-07-21 Adam Roben <aroben@apple.com> + + Move WebKit2WebProcess's settings to a vsprops file + + Fixes <http://webkit.org/b/42751> WebKit2WebProcess should use vsprops + files + + Reviewed by Darin Adler. + + * win/WebKit2WebProcess.vcproj: Moved settings from here... + * win/WebKit2WebProcessCommon.vsprops: ...to here. + +2010-07-20 Ivan Krstić <ike@apple.com> + + Reviewed and tweaked by Anders Carlsson and Sam Weinig. + + Put WebProcess in a sandbox. All of the following changes are + Mac-only. + <rdar://problem/7865269> + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): + Send Sandbox extension for injected bundle to WebProcess. + + * WebKit2.xcodeproj/project.pbxproj: + Add Sandbox profile to Resources for WebProcess. + + * WebProcess/InjectedBundle/InjectedBundle.h: + New function InjectedBundle::setSandboxToken. + + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + (WebKit::InjectedBundle::load): + Consume Sandbox token for the bundle if present. + + (WebKit::InjectedBundle::setSandboxToken): + Set Sandbox token for the bundle. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::loadInjectedBundle): + Extra function parameter for Sandbox token. + + (WebKit::WebProcess::didReceiveMessage): + Pass Sandbox token to loadInjectedBundle(). + + * WebProcess/WebProcess.h: + Extra function parameter for Sandbox token in loadInjectedBundle(). + + * WebProcess/com.apple.WebProcess.sb: Added. + Sandbox profile for WebProcess. + + * WebProcess/mac/WebProcessMainMac.mm: + (WebKit::WebProcessMain): + Initialize Sandbox, exit on failure. + +2010-07-20 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42719 + Make Acid2 pass in WebKit2 + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::objectContentType): Check for supported image mimetypes + before falling back to plugins. + +2010-07-20 Adam Roben <aroben@apple.com> + + Remove WebKit2.sln + + WebKit.sln builds all the same projects. + + Rubber-stamped in advance by Steve Falkenburg. + + * WebKit2.sln: Removed. + +2010-07-20 Adam Roben <aroben@apple.com> + + Make the web process break into the debugger when Ctrl-Alt-Shift is + held during launch + + Fixes <http://webkit.org/b/42670> Would like a way to break into the + debugger when the web process launches + + Reviewed by Anders Carlsson. + + * WebProcess/WebKitMain.cpp: + (WebKitMain): If the Control, Alt, and Shift keys are held down in a + Debug build, call DebugBreak() so that we will break into the + debugger. + +2010-07-20 Adam Roben <aroben@apple.com> + + Teach Connection how to handle a slow receiver + + Fixes <http://webkit.org/b/42667> Assertion in + Connection::sendOutgoingMessage when browser or web process is paused + + Reviewed by Anders Carlsson. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::sendOutgoingMessage): If WriteFile returns FALSE + and the last error is ERROR_IO_PENDING, Windows will write the data as + soon as the current write operation is completed. We don't need to do + anything special in this case, so there's no need to assert about it. + +2010-07-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Handle WKView visibility changes + <rdar://problem/7891077> + + * Shared/mac/UpdateChunk.h: + (WebKit::UpdateChunk::isEmpty): + Add convenience getter. + + * UIProcess/API/mac/WKView.mm: + (-[WKView viewDidMoveToWindow]): + Reorder the calls to _updateActiveState and _updateVisibility based on whether the view is moved to + a window or away from a window. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + Initialize m_forceRepaintWhenResumingPainting to false. + + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + Pass the m_forceRepaintWhenResumingPainting along to the DrawingAreaMessage::ResumePainting message. + + (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize): + Don't try to paint empty update chunks. + + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + Don't paint the update chunk if we're not visible. Instead, make sure that the entire page is being redrawn + when its shown again. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::suspendPainting): + Rename m_shouldPaint to m_isPaintingSuspended and invert its logic. + + (WebKit::ChunkedUpdateDrawingArea::scheduleDisplay): + Don't schedule a display timer if the dirty rect is empty. + + (WebKit::ChunkedUpdateDrawingArea::setSize): + If painting is suspended, just send back an empty update chunk in the DidSetSize message. + + (WebKit::ChunkedUpdateDrawingArea::resumePainting): + If forceRepaint is true, repaint the entire drawing area. + +2010-07-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Implement NPN_GetURL and NPN_PostURL + https://bugs.webkit.org/show_bug.cgi?id=42650 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::parsePostBuffer): + Add a FIXME about deleting the file. + + (WebKit::makeURLString): + Move this static method before NPN_GetURL. + + (WebKit::NPN_GetURL): + Call NetscapePLugin::LoadURL. + + (WebKit::NPN_PostURL): + Ditto. + + (WebKit::NPN_PostURLNotify): + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + Remove unreached code. + + (WebKit::NetscapePluginStream::deliverDataToPlugin): + Stop the stream if the plug-in returns -1 from NPP_Write. + +2010-07-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner and WebProcess simultaneously stall in CoreIPC::Connection::sendOutgoingMessage + https://bugs.webkit.org/show_bug.cgi?id=42356 + + Up the port queue length from 5 to 1024. While this does solve the problem, we should still try to + make sendOutgoingMessage not block. I've filed https://bugs.webkit.org/show_bug.cgi?id=42611 to track + doing this on Mac and Windows. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::open): + Call setMachPortQueueLength. + + * Platform/mac/MachUtilities.cpp: Added. + (setMachPortQueueLength): + Given a mach port receive right, sets the port queue length. + + * Platform/mac/MachUtilities.h: Added. + + * WebKit2.xcodeproj/project.pbxproj: + Add MachUtilities.cpp and MachUtilities.h + +2010-07-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler, Adam Roben, Dan Bernstein and Sam Weinig. + + Handle NP_ASFILE and NP_ASFILEONLY transfer modes + https://bugs.webkit.org/show_bug.cgi?id=42587 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_StreamAsFile): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add NPP_ wrapper. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::NetscapePluginStream): + Initialize m_fileHandle. + + (WebKit::isSupportedTransferMode): + NP_ASFILE and NP_ASFILEONLY is now supported. + + (WebKit::NetscapePluginStream::deliverData): + Call deliverDataToFile if necessary. + + (WebKit::NetscapePluginStream::deliverDataToFile): + Create a temporary file and write the data into it. + + (WebKit::NetscapePluginStream::stop): + If the transfer mode is either NP_ASFILE or NP_ASFILEONLY, make sure to + call NPP_StreamAsFile and close the file and delete it. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::cancelStreamLoad): + Keep a reference to the Stream since cancelling it will remove it from the map. + +2010-07-19 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_PostURLNotify + https://bugs.webkit.org/show_bug.cgi?id=42602 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::parsePostBuffer): + Read the buffer from a file if necessary and parse it. + + (WebKit::NPN_GetURLNotify): + Add extra arguments. + + (WebKit::NPN_PostURLNotify): + Parse the post buffer, then call NetscapePlugin::loadURL. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::loadURL): + Pass the method, the header fields and form data along. + + (WebKit::NetscapePlugin::allowPopups): + Just return false for now. + + (WebKit::NetscapePlugin::initialize): + Pass extra arguments to loadURL. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + * WebProcess/Plugins/PluginController.h: + Add method, header fields and form data. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::loadURL): + Set the method, add the header fields and set the body. + +2010-07-19 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Add local storage support for WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42584 + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + (WebKit::WebPreferencesStore::swap): + * Shared/WebPreferencesStore.h: + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetLocalStorageEnabled): + (WKPreferencesGetLocalStorageEnabled): + * UIProcess/API/C/WKPreferences.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setLocalStorageEnabled): + (WebKit::WebPreferences::localStorageEnabled): + * UIProcess/WebPreferences.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::preferencesDidChange): + +2010-07-19 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Uae an OwnPtr for the drawing area in WebPage (fixes a leak!). + + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::drawingArea): + +2010-07-19 Anders carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + WebKit2 does not have application cache + https://bugs.webkit.org/show_bug.cgi?id=42552 + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + Add SetApplicationCacheDirectory. + + * Shared/WebPreferencesStore.h: + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + add offlineWebApplicationCacheEnabled. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesSetOfflineWebApplicationCacheEnabled): + (WKPreferencesGetOfflineWebApplicationCacheEnabled): + * UIProcess/API/C/WKPreferences.h: + Add getters/setters for whether the application cache is enabled. + + * UIProcess/WebContext.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::setOfflineWebApplicationCacheEnabled): + Update the store and call update(). + + * UIProcess/WebPreferences.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): + Ask the web process to set the application cache directory. + + * UIProcess/mac/WebContextMac.mm: Added. + (WebKit::WebContext::applicationCacheDirectory): + Return the application cache directory. + + * UIProcess/win/WebContextWin.cpp: Added. + (WebKit::WebContext::applicationCacheDirectory): + Ditto. + + * WebKit2.xcodeproj/project.pbxproj: + Add WebContextMac.mm + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::preferencesDidChange): + + (WebKit::WebPage::didReceiveMessage): + Handle PreferencesDidChange. Get rid of the default: case statement so we'll + get warnings if we have unhandled message kinds. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::setApplicationCacheDirectory): + Set the application cache directory. + + (WebKit::WebProcess::didReceiveMessage): + Handle SetApplicationCacheDirectory. + + win/WebKit2.vcproj: + Add WebContextWin.cpp + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Another attempt at fixing the Windows build. + + * WebProcess/Plugins/NPJSObjectMap.h: + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Try to fix Windows build. + + * win/WebKit2.vcproj: + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More NPRuntime work + https://bugs.webkit.org/show_bug.cgi?id=42526 + + * WebProcess/Plugins/NPJSObjectMap.cpp: + (WebKit::identifierFromIdentifierRep): + (WebKit::NPJSObject::hasProperty): + Check if the JSObject has the given property. + + (WebKit::NPJSObject::getProperty): + Add stubbed out function. + + (WebKit::NPJSObject::npClass): + Add NP_HasProperty and NP_GetProperty. + + (WebKit::NPJSObject::NP_HasProperty): + Call NPJSObject::hasProperty. + + (WebKit::NPJSObject::NP_GetProperty): + Call NPJSObject::getProperty. + + * WebProcess/Plugins/NPRuntimeUtilities.cpp: + (WebKit::releaseNPVariantValue): + Release the given NPVariant. + + * WebProcess/Plugins/NPRuntimeUtilities.h: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetProperty): + Call the NPClass GetProperty function. + + (WebKit::NPN_HasProperty): + Call the NPClass HasProperty function. + + (WebKit::NPN_ReleaseVariantValue): + Call releaseNPVariantValue. + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add NPJSObjectMap class + https://bugs.webkit.org/show_bug.cgi?id=42524 + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + + * WebProcess/Plugins/NPJSObjectMap.cpp: Added. + * WebProcess/Plugins/NPJSObjectMap.h: Added. + Add NPJSObjectMap, a map which contains NPObjects that wrap JavaScript objects. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Initialize the map. + + (WebKit::PluginView::~PluginView): + Invalidate the map. + + (WebKit::PluginView::frame): + Add frame getter. + + (WebKit::PluginView::windowScriptNPObject): + Wrap the window object. + + (WebKit::PluginView::pluginElementNPObject): + Wrap the plug-in element object. + + * WebProcess/Plugins/PluginView.h: + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement more NPRuntime related NPN_ functions + https://bugs.webkit.org/show_bug.cgi?id=42520 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/NPRuntimeUtilities.cpp: Added. + * WebProcess/Plugins/NPRuntimeUtilities.h: Added. + Add new file with NPRuntime related utility functions. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_CreateObject): + (WebKit::NPN_RetainObject): + (WebKit::NPN_ReleaseObject): + Call the corresponding NPRuntimeUtilities functions. + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Begin work on NPRuntime support + https://bugs.webkit.org/show_bug.cgi?id=42519 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetValue): + Handle NPNVWindowNPObject and NPNVPluginElementNPObject. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::windowScriptNPObject): + (WebKit::NetscapePlugin::pluginElementNPObject): + Call the plug-in controller. + + * WebProcess/Plugins/PluginController.h: + Add new windowScriptNPObject and pluginElementNPObject functions. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::windowScriptNPObject): + (WebKit::PluginView::pluginElementNPObject): + Add stubbed out functions. + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Implement some NPRuntime related NPN_ functions + https://bugs.webkit.org/show_bug.cgi?id=42518 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_GetStringIdentifier): + (WebKit::NPN_GetStringIdentifiers): + (WebKit::NPN_GetIntIdentifier): + (WebKit::NPN_IdentifierIsString): + (WebKit::NPN_UTF8FromIdentifier): + (WebKit::NPN_IntFromIdentifier): + (WebKit::NPN_CreateObject): + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add dumping of statusbar text to WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=42516 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + Add setStatusbarText callback to WKBundlePageUIClient. + + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: + (WebKit::InjectedBundlePageUIClient::setStatusbarText): + Call setStatusbarText. + + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setStatusbarText): + Call the bundle page UI client. + +2010-07-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKitTestRunner should load the test plug-in + https://bugs.webkit.org/show_bug.cgi?id=42509 + + * UIProcess/API/C/WKContext.cpp: + (_WKContextSetAdditionalPluginPath): + Add a private function for setting a single additional plug-in path. the WebKit1 SPI that does the + same thing takes an array of paths, but this is good enough for now. + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::setAdditionalPluginPaths): + Set the additional plug-in paths vector and refresh the database. + + (WebKit::PluginInfoStore::loadPluginsIfNecessary): + First try to load plug-ins in the additional plug-in paths. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::setAdditionalPluginPath): + Call PluginInfoStore::setAdditionalPluginPaths. + + * UIProcess/WebContext.h: + (WebKit::WebContext::pluginInfoStore): + Make the plug-in info store per context instead of having a single shared info store. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPlugins): + (WebKit::WebProcessProxy::getPluginHostConnection): + * UIProcess/WebProcessProxy.h: + Get the plug-in info store from the context. + +2010-07-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Stop all NPStreams before destroying a plug-in + https://bugs.webkit.org/show_bug.cgi?id=42504 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::stopAllStreams): + Go through all streams and stop them. + + (WebKit::NetscapePlugin::destroy): + Call stopAllStreams. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add stopAllStreams. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + Make stop public. + +2010-07-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Open streams should not keep a plug-in view alive + https://bugs.webkit.org/show_bug.cgi?id=42503 + + PluginView::Stream now has a weak reference to its PluginView. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::~Stream): + Assert that the plug-in view is null. + + (WebKit::PluginView::Stream::didFail): + After calling removeStream, set the plug-in view member variable to 0. This is OK to do + since we keep a reference to the Stream, so we're sure that the call to removeStream does not + destroy the stream. + + (WebKit::PluginView::Stream::didFinishLoading): + Ditto . + + (WebKit::PluginView::~PluginView): + Cancel all streams. + + (WebKit::PluginView::cancelAllStreams): + Cancel all streams. + +2010-07-16 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION(r61484): Broke focus behaviour on Qt and probably other platforms + https://bugs.webkit.org/show_bug.cgi?id=42253 + + Dummy implementation of EditorClient::willSetInputMethodState. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::willSetInputMethodState): + * WebProcess/WebCoreSupport/WebEditorClient.h: + +2010-07-16 Alice Liu <alice.liu@apple.com> + + Build fix, not reviewed. + + Reverted http://trac.webkit.org/changeset/63585 because getopt isn't + available in the OpenSource support libraries + + * WebKit2.sln: + +2010-07-16 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=42482 + <rdar://problem/8197701> + Add notification of when the BackForwardList changes + to aid invalidation of Back/Forward related UI elements. + + * UIProcess/API/C/WKPage.h: + Add didChangeBackForwardList to the WKPageLoaderClient. This + fires whenever an item is added or removed from the back forward + list or when the cursor changes position. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::addItem): + (WebKit::WebBackForwardList::goToItem): + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didChangeBackForwardList): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didChangeBackForwardList): + * UIProcess/WebPageProxy.h: + Pipe changes to the WebBackForwardList up to the page load client. + +2010-07-16 Alice Liu <alice.liu@apple.com> + + Reviewed by Sam Weinig. + + Add WebKitTestRunner to the WebKit2 solution + + * WebKit2.sln: Add InjectedBundle and WebKitTestRunner projects. Also change the build dependency order from + DumpRunderTree --> WebKitAPITest to + DumpRenderTree --> InjectedBundle --> WebKitTestRunner --> WebKitAPITest + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Set notifyData to the stream's notification data + https://bugs.webkit.org/show_bug.cgi?id=42429 + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::start): + +2010-07-15 Brent Fulgham <bfulgham@webkit.org> + + Build fix. Don't include CoreGraphics.h on non-CG builds. + + * WebKit2Prefix.h: Conditionalize include of CoreGraphics.h + to avoid build break on WinCairo. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + If needed, NPN_GetURL the src URL + https://bugs.webkit.org/show_bug.cgi?id=42424 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_GetValue): + Add NPP_GetValue wrapper. + + (WebKit::NetscapePlugin::shouldLoadSrcURL): + Check whether the src url should be cancelled. + + (WebKit::NetscapePlugin::initialize): + If the src URL should be loaded, then load it. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Stop the plug-in stream when it's finished loading + https://bugs.webkit.org/show_bug.cgi?id=42423 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::streamDidFinishLoading): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stub. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::streamDidFinishLoading): + Call NetscapePluginStream::didFinishLoading. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::didFinishLoading): + Stop the stream with NPRES_DONE. + + * WebProcess/Plugins/Plugin.h: + Add streamDidFinishLoading. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::didFinishLoading): + Call Plugin::streamDidFinishLoading. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass URL stream data to the plug-in + https://bugs.webkit.org/show_bug.cgi?id=42420 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::streamDidReceiveData): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stub. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::streamDidReceiveData): + Call NetscapePluginStream::didReceiveData. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::didReceiveData): + Deliver the data to the plug-in. + + * WebProcess/Plugins/Plugin.h: + Add pure virtual streamDidReceiveData member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::didReceiveData): + Call Plugin::streamDidReceiveData. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Handle failed loads correctly + https://bugs.webkit.org/show_bug.cgi?id=42418 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::streamDidFail): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stub. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::streamDidFail): + Call NetscapePluginStream::didFail. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::didReceiveResponse): + Take a reference to the plug-in stream in case starting it causes it to be destroyed. + + (WebKit::NetscapePluginStream::didFail): + Take a reference to the plug-in stream in case stopping it causes it to be destroyed. + + (WebKit::NetscapePluginStream::destroy): + Cancel the stream. + + (WebKit::NetscapePluginStream::start): + If we fail to start the stream, cancel the load. + + (WebKit::NetscapePluginStream::cancel): + Call NetscapePlugin::cancelStreamLoad. + + (WebKit::NetscapePluginStream::notifyAndDestroyStream): + Don't call cancel here. notifyAndDestroyStream can be called when we don't want to cancel the + load, such as when it's already failed to load. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + Add didFail. + + * WebProcess/Plugins/Plugin.h: + Add pure virtual streamDidFail member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::Stream): + Initialize m_streamWasCancelled to false. + + (WebKit::PluginView::Stream::cancel): + Set m_streamWasCancelled to true. + + (WebKit::PluginView::Stream::didFail): + Call Plugin::streamDidFail. + +2010-07-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=42358 + <rdar://problem/8194512> + Hyphenation tests crash the Web process + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Add missing initializer. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Attempt to fix the Windows build. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::didReceiveResponse): + expectedContentLength should be a signed long long. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Cancel stream loads when destroying NetscapePluginStreams + https://bugs.webkit.org/show_bug.cgi?id=42413 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::cancelStreamLoad): + Call PluginController::cancelStreamLoad. + + (WebKit::NetscapePlugin::streamDidReceiveResponse): + Call NetscapePluginStream::didReceiveResponse. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::didReceiveResponse): + Try to start the stream. + + (WebKit::NetscapePluginStream::sendJavaScriptStream): + Don't stop the stream if it can't be started. start handles that now. + + (WebKit::isSupportedTransferMode): + Return whether the given transfer mode is supported. + + (WebKit::NetscapePluginStream::start): + If the stream fails to start, call notifyAndDestroyStream. If it starts successfully but has + an unsupported transfer mode, call stop. + + (WebKit::NetscapePluginStream::notifyAndDestroyStream): + Cancel the stream load unless it's being destroyed because it has finished loading. + + * WebProcess/Plugins/PluginController.h: + Add cancelStreamLoad pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::Stream::cancel): + Tell the stream loader to cancel and null it out. + + (WebKit::PluginView::cancelStreamLoad): + Get the stream and cancel it. + + * WebProcess/Plugins/PluginView.h: + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Start loading plug-in streams + https://bugs.webkit.org/show_bug.cgi?id=42407 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::streamDidReceiveResponse): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stub. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::streamDidReceiveResponse): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add empty stub. + + * WebProcess/Plugins/Plugin.h: + Add streamDidReceiveResponse pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + Make PluginView::Stream a NetscapePlugInStreamLoaderClient. + + (WebKit::PluginView::Stream::start): + Create a plug-in loader and start loading. + + (WebKit::PluginView::Stream::didReceiveResponse): + Get the necessary data out of the resource response and call streamDidReceiveResponse. + + (WebKit::PluginView::Stream::didReceiveData): + (WebKit::PluginView::Stream::didFail): + (WebKit::PluginView::Stream::didFinishLoading): + Add empty stubs. + +2010-07-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42396 + Give the navigation type in the policy client callbacks meaning. + + - Use the new WKFrameNavigationType instead of just uint32_t. + + * UIProcess/API/C/WKAPICast.h: + (toWK): + Add conversion method from WebCore::NavigationType to WKFrameNavigationType. + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + * UIProcess/WebPolicyClient.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a PluginView::Stream class + https://bugs.webkit.org/show_bug.cgi?id=42398 + + * WebProcess/Plugins/PluginView.cpp: + Add the Stream class. + + (WebKit::PluginView::performURLRequest): + Create the stream and start it. + + (WebKit::PluginView::addStream): + Add the stream to the map. + + (WebKit::PluginView::removeStream): + Remove the stream from the map. + + * WebProcess/Plugins/PluginView.h: + Add Stream forward declaration and the m_streams map. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't allow multiple calls to NetscapePluginStream::stop + https://bugs.webkit.org/show_bug.cgi?id=42395 + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::NetscapePluginStream): + Initialize m_urlNotifyHasBeenCalled. + + (WebKit::NetscapePluginStream::~NetscapePluginStream): + Assert that the stream didn't need a URL notification or that one was sent. + + (WebKit::NetscapePluginStream::sendJavaScriptStream): + Don't call stop in the JS failure case because the stream won't be started. + + (WebKit::NetscapePluginStream::stop): + Remove m_isStarted check and add an assertion instead. Move code that calls NPP_URLNotify and + destroys the stream out to a separate function. + + (WebKit::NetscapePluginStream::notifyAndDestroyStream): + Call NPP_URLNotify if necessary and destroy the stream. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_DestroyStream + https://bugs.webkit.org/show_bug.cgi?id=42393 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + (WebKit::NPN_DestroyStream): + Call NetscapePlugin::destroyStream. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::destroyStream): + Check if the stream is valid, and if it is call NetscapePluginStream::destroy. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::sendJavaScriptStream): + Keep a reference to the stream in case it's destroyed by an NPP_ call. + + (WebKit::NetscapePluginStream::destroy): + Verify that the stream can be destroyed and stop it. + + (WebKit::NetscapePluginStream::deliverDataToPlugin): + Add m_isStarted checks after any calls to NPP_ functions. + + (WebKit::NetscapePluginStream::stop): + Set m_isStarted to false before calling NPP_DestroyStream. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + (WebKit::NetscapePluginStream::npStream): + Add NPStream getter. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + WebKitTestRunner goes off the deep end, spinning in a dispatch queue thread + https://bugs.webkit.org/show_bug.cgi?id=42355 + + Sometimes, when receiving a message whose size is very close to the inlineMessageMaxSize, + mach_msg would return with MACH_RCV_TOO_LARGE. In debug builds we would assert, but in release + builds we would just bail and the receiveSourceEventHandler would be run again shortly since we didn't + actually pull the message off the mach message queue. + + Fix this by setting the receive source buffer size to include the maximum message trailer size, which + mach_msg requires. Also, handle mach_msg returning MACH_RCV_TOO_LARGE (even though in theory it would never happen + now that the receivedBufferSize always includes the maximum message trailer size. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::receiveSourceEventHandler): + Use a Vector with inline data instead of a char array. This way we can resize the Vector if the message received + is too big. + +2010-07-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Send JavaScript stream data to plug-ins + https://bugs.webkit.org/show_bug.cgi?id=42384 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_WriteReady): + (WebKit::NetscapePlugin::NPP_Write): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add NPP_ wrappers. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::NetscapePluginStream): + Initialize m_deliveryDataTimer and m_stopstreamWhenDoneDelivering. + + (WebKit::NetscapePluginStream::sendJavaScriptStream): + Call deliverData and stop. + + (WebKit::NetscapePluginStream::deliverData): + Add the data to m_deliveryData and call deliverDataToPlugin. + + (WebKit::NetscapePluginStream::deliverDataToPlugin): + Deliver the data in m_deliveryData to the plug-in. Call NPP_WriteReady to see how much + data the plug-in can handle right now. If the plug-in returns zero or a negative value, delay the + delivery using the delivery data timer. Otherwise, call NPP_Write in chunks until all the data has been + delivered, then stop the stream if needed. + + (WebKit::NetscapePluginStream::stop): + If the reason for stopping the stream is that it's finished and the plug-in hasn't processed all the data, + don't close the stream now. Instead, set m_stopStreamWhenDoneDelivering to true which will cause the stream to be + closed once all data has been delivered. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: + Add member functions and member variables. + +2010-07-14 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Steve Falkenburg. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42299 + Correct WinCairo build for new WebKit2 project structure. + + * win/WebKit2Apple.vsprops: Put WebKit2.def here. + * win/WebKit2CFLite.def: Added CFLite version of def file. + * win/WebKit2CFLite.vsprops: Add new WebKit2CFLite.def here. + * win/WebKit2Common.vsprops: Remove WebKit2.def definition as + WinCairo and Apple need different versions of this. + * win/WebKit2WebProcess.vcproj: Add a new Debug_Cairo target + for the WebKit2WebProcess project. + +2010-07-15 Mark Rowe <mrowe@apple.com> + + Update the sorting in the Xcode project files. + + * WebKit2.xcodeproj/project.pbxproj: + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42315 + <rdar://problem/8185281> + All text in WebKit2 draws with no subpixel antialiasing + + - Change CGBitmapInfo passed to CGBitmapContextCreate and CGImageCreate + from kCGImageAlphaPremultipliedLast to kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host. + + * Shared/mac/UpdateChunk.cpp: + (WebKit::UpdateChunk::createImage): + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp: + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + +2010-07-14 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Mark Rowe. + + - Fix WebKitTestRunner build + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add stdint.h include. + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Try to fix Windows build. + + * win/WebKit2.vcproj: + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + More work on plug-in streams + https://bugs.webkit.org/show_bug.cgi?id=42308 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::loadURL): + If the target is null, create a NetscapePluginStream and add it to the m_streams map. + + (WebKit::NetscapePlugin::removePluginStream): + Remove the given NetscapePluginStream from the m_streams map. + + (WebKit::NetscapePlugin::NPP_NewStream): + (WebKit::NetscapePlugin::NPP_DestroyStream): + Add NPP_ wrappers. + + (WebKit::NetscapePlugin::streamFromID): + Return the plug-in stream given a stream ID. + + (WebKit::NetscapePlugin::didEvaluateJavaScript): + Find the plug-in stream and call sendJavaScriptStream. + + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: + (WebKit::NetscapePluginStream::NetscapePluginStream): + Initialize member variables. + + (WebKit::NetscapePluginStream::~NetscapePluginStream): + Assert that we aren't started. + + (WebKit::NetscapePluginStream::sendJavaScriptStream): + If the JavaScript request was successful, start the stream. Otherwise call stop() which just + ends up calling NPP_URLNotify when the stream isn't started. + + (WebKit::NetscapePluginStream::start): + Set up the NPStream object. Call NPP_NewStream. Return false if the call was not successful, or if + the requested stream type is one that we don't yet support. + + (WebKit::NetscapePluginStream::stop): + Call NPP_DestroyStream if the stream is started. Call NPP_URLNotify if necessary. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performJavaScriptURLRequest): + Remove unneeded comment. + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Make Back/Forward work. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::goForward): Pass the item ID to avoid roundtrip. + (WebKit::WebPageProxy::goBack): Ditto. + (WebKit::WebPageProxy::didReceiveMessage): Implement WebPageProxyMessage::BackForwardGoToItem. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::goForward): Use m_page->goToItem with the correct type instead of the Page shortcut. + (WebKit::WebPage::goBack): Ditto. + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + Remove unused m_canGoBack and m_canGoForward. + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + Add NetscapePluginStream class + https://bugs.webkit.org/show_bug.cgi?id=42296 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: Added. + (WebKit::NetscapePluginStream::NetscapePluginStream): + (WebKit::NetscapePluginStream::~NetscapePluginStream): + * WebProcess/Plugins/Netscape/NetscapePluginStream.h: Added. + (WebKit::NetscapePluginStream::create): + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42297 + <rdar://problem/8187355> + Make titles in WebBackForwardListItems work. + + - Make WebBackForwardListItemMap per WebProcessProxy to allow updating + them separate from a page. They are conceptually per process anyway. + - Add a message to add or update a WebBackForwardListItemMap triggered + by the WebCore::notifyHistoryItemChanged mechanism. + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + Add AddOrUpdateBackForwardItem message. + + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::setOriginalURL): + (WebKit::WebBackForwardListItem::setURL): + (WebKit::WebBackForwardListItem::setTitle): + Add setters. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + BackForwardAddItem now assumes the item has already been created, so + now just forwards the add message onto the WebBackForwardList. + + (WebKit::WebPageProxy::addItemToBackForwardList): Take a WebBackForwardList instead of an ID. + (WebKit::WebPageProxy::goToItemInBackForwardList): Ditto. + * UIProcess/WebPageProxy.h: Ditto. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::webBackForwardItem): + (WebKit::WebProcessProxy::addOrUpdateBackForwardListItem): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + Have the WebProcessProxy manage the WebBackForwardListItems. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::updateBackForwardItem): + (WebKit::WK2NotifyHistoryItemChanged): Use this to notify UIProcess + of HistoryItem changes (such as the title being added). + (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): + Register the notifyHistoryItemChanged function. + (WebKit::WebBackForwardListProxy::addItem): + Just send the ID as the updateBackForwardItem is already going to have + been called by this time. + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Call NPN_URLNotify for frame loads initiated by plug-ins + https://bugs.webkit.org/show_bug.cgi?id=42291 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::loadURL): + If needed, keep track of the request ID and URL so we can call NPP_URLNotify at a later point. + + (WebKit::NetscapePlugin::frameDidFinishLoading): + Get the notification data and the URL from the map and call NPP_URLNotify. + + (WebKit::NetscapePlugin::frameDidFail): + Get the notification data and the URL from the map and call NPP_URLNotify. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add NetscapePlugin::NPP_ member functions for calling into the plug-in + https://bugs.webkit.org/show_bug.cgi?id=42287 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NPP_New): + (WebKit::NetscapePlugin::NPP_Destroy): + (WebKit::NetscapePlugin::NPP_SetWindow): + (WebKit::NetscapePlugin::NPP_URLNotify): + (WebKit::NetscapePlugin::callSetWindow): + (WebKit::NetscapePlugin::initialize): + (WebKit::NetscapePlugin::destroy): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + +2010-07-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Send JavaScript url request results back to the plug-in + https://bugs.webkit.org/show_bug.cgi?id=42277 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::didEvaluateJavaScript): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stub. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::didEvaluateJavaScript): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add Empty stub. + + * WebProcess/Plugins/Plugin.h: + Add didEvaluateJavaScript pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performJavaScriptURLRequest): + If target is not null, Call Plugin::frameDidFail or Plugin::frameDidFinishLoading. + If target is null, call didEvaluateJavaScript with the result string. + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42232 + Make changing Cursors work in WebKit2. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + Add SetCursor message. + + * Shared/WebCoreArgumentCoders.h: + Add encoding/decoding of Cursors. For now we don't support Custom + cursors. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::setCursor): + * UIProcess/PageClient.h: + Add pass through functions to get the cursor from the WebPageProxy + to the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _setCursor:]): + * UIProcess/API/mac/WKViewInternal.h: + Implement changing the cursor. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::setCursor): + * UIProcess/WebPageProxy.h: + Decode the cursor. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): + (WebKit::WebView::WebView): + (WebKit::WebView::onSetCursor): + (WebKit::WebView::setCursor): + * UIProcess/win/WebView.h: + Implement changing the cursor. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::setCursor): + (WebKit::WebChromeClient::setLastSetCursorToCurrentCursor): + * WebProcess/WebCoreSupport/WebChromeClient.h: + Encode the cursor when setCursor is called. + +2010-07-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add support for loading javascript: URLs + https://bugs.webkit.org/show_bug.cgi?id=42221 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::controller): + * WebProcess/Plugins/DummyPlugin.h: + Add stub function. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::destroy): + Set the plug-in controller to 0. + + (WebKit::NetscapePlugin::controller): + Return the plug-in controller. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add controller() member function. + + * WebProcess/Plugins/Plugin.h: + Add controller() pure virtual member function. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performURLRequest): + If the given URL request has a javascript: protocol, call + performJavaScriptURLRequest. + + (WebKit::PluginView::performFrameLoadURLRequest): + Add a security origin check. + + (WebKit::PluginView::performJavaScriptURLRequest): + Evaluate the JavaScript code, Get the resulting string. + + * WebProcess/Plugins/PluginView.h: + Add performJavaScriptURLRequest. + +2010-07-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add support for URL frame loading using NPN_GetURLNotify + https://bugs.webkit.org/show_bug.cgi?id=42192 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::frameDidFinishLoading): + (WebKit::DummyPlugin::frameDidFail): + * WebProcess/Plugins/DummyPlugin.h: + Add empty stubs. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + Implement NPN_GetURLNotify and have it call NetscapePlugin::loadURL. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_nextRequestID to 0. + + (WebKit::NetscapePlugin::loadURL): + Ask the plug-in controller to load the URL. + + (WebKit::NetscapePlugin::frameDidFinishLoading): + (WebKit::NetscapePlugin::frameDidFail): + Add empty stubs for now. + + * WebProcess/Plugins/Plugin.h: + Add new member functions for frame load notifications. + + * WebProcess/Plugins/PluginController.h: + Add loadURL. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::URLRequest::URLRequest): + Add class that represents an URL request. + + (WebKit::PluginView::PluginView): + Initialize m_pendingURLRequestsTimer. + + (WebKit::PluginView::~PluginView): + Unset all active load listeners. + + (WebKit::PluginView::pendingURLRequestsTimerFired): + Take the first request in the queue and process it. + + (WebKit::PluginView::performURLRequest): + Call performFrameLoadURLRequest if necessary. + + (WebKit::PluginView::performFrameLoadURLRequest): + Find a frame to load the request in. If a frame doesn't exist try to create a new frame. + + (WebKit::PluginView::loadURL): + Create a URLRequest and add it to the queue. + + (WebKit::PluginView::didFinishLoad): + Get the pending frame load request and call Plugin::frameDidFinishLoading. + + (WebKit::PluginView::didFailLoad): + Get the pending frame load request and call Plugin::frameDidFail. + + * WebProcess/Plugins/PluginView.h: + Inherit from WebFrame::LoadListener. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + (WebKit::WebFrameLoaderClient::didFinishLoad): + Call the WebFrame's load listener if needed. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::WebFrame): + Initialize m_loadListener to 0. + + * WebProcess/WebPage/WebFrame.h: + Add a LoadListener class that the plug-in view can use to track frame loads. + + (WebKit::WebFrame::LoadListener::~LoadListener): + (WebKit::WebFrame::setLoadListener): + (WebKit::WebFrame::loadListener): + +2010-07-13 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WebKit2] Hook up navigation actions + https://bugs.webkit.org/show_bug.cgi?id=42183 + + Make Back, Forward, Stop and Reload being enable/disabled according + page loading. + + * UIProcess/API/qt/ClientImpl.cpp: + (qt_wk_didStartProvisionalLoadForFrame): + (qt_wk_didCommitLoadForFrame): + (qt_wk_didFinishLoadForFrame): + (qt_wk_didFailLoadWithErrorForFrame): + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::updateAction): + +2010-07-13 John Sullivan <sullivan@apple.com> + + Written by Simon Fraser, reviewed by me. + + Cleaner fix for previous check-in. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + Use std::max<int> for int-casting brevity. + +2010-07-13 John Sullivan <sullivan@apple.com> + + Reviewed by Sam Weinig. + + Fixed signed/unsigned problem that led to bogus contents in the array + returned by WKBackForwardListCopyBackListWithLimit(). + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + Cast m_current and limit to signed values in std::max call. + +2010-07-13 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Ada Chan. + + Fix missing resources causing layout test failures + https://bugs.webkit.org/show_bug.cgi?id=42179 + + Quick fix to get the layout tests going again. + I'll work on getting resource.h from WebKit into a cross-project + propagated header after this lands. + + * win/WebKit2.rc: + * win/resource.h: Copied from WebKit/win/WebKit.vcproj/resource.h. + +2010-07-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Make all NPN_ functions static. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + +2010-07-13 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Document the member functions of the abstract Plugin and PluginController classes. + + * WebProcess/Plugins/Plugin.h: + * WebProcess/Plugins/PluginController.h: + +2010-07-13 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Trivial build fix. + + Provide a stub for mimeTypeFromExtension() that uses notImplemented(). + + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: + (WebKit::PluginInfoStore::mimeTypeFromExtension): + +2010-07-13 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Tweaks needed to compile WebKit2 with Qt + https://bugs.webkit.org/show_bug.cgi?id=41604 + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::launch): Adjust to PassOwnPtr API changes. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Don't include JavaScriptCore.h, + as it unconditionally includes JSStringRefCF. Instead include JavaScript.h. + +2010-07-12 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Don't build MiniBrowser except for Debug_Internal. + + * WebKit2.sln: + +2010-07-12 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Maciej Stachowiak. + + Make WebKit2 be built by build-webkit (so it will be built by build.webkit.org bots) + https://bugs.webkit.org/show_bug.cgi?id=40922 + + Add additional dependent projects. Necessary since our WebKit build on + Windows is packaged into a DLL with WebKit2. + + * WebKit2.sln: + +2010-07-12 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Maciej Stachowiak. + + Fix WebKit2 to use the same compiler-selection logic as the other projects. + + * WebKit2.xcodeproj/project.pbxproj: Don't hard-code WebKit2 to build with GCC 4.2. + +2010-07-12 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + WKView should override setFrameSize: instead of setFrame: + https://bugs.webkit.org/show_bug.cgi?id=42127 + + * UIProcess/API/mac/WKView.mm: + (-[WKView setFrameSize:]): Override this method instead of setFrame:, + since that is the right way to do it. + +2010-07-12 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Alice Liu. + + <rdar://problem/8113038> WebKit1 and WebKit2 should build as a single DLL + https://bugs.webkit.org/show_bug.cgi?id=40921 + + Pre-WebKit2 WebKit now builds into a static library named WebKitLib.lib. + WebKit.dll now links in WebCore.lib, WebKitLib.lib and WebKit2 code. + + This is a first step. We'll likely want to migrate the remainder of + the non-deprecated WebKit code (strings, DLLMain, resources) into WebKit2. + + * UIProcess/API/C/WKBase.h: Updated to new BUILDING_ name. + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: Updated to new BUILDING_ name. + * WebProcess/WebCoreSupport/win/WebCoreLocalizedStrings.cpp: Removed. + * WebProcess/win/DllMain.cpp: Removed. Overlaps with implementation in WebKitLib.lib. + * WebProcess/win/WebLocalizableStrings.cpp: Removed. Overlaps with implementation in WebKitLib.lib. + * WebProcess/win/WebLocalizableStrings.h: Removed. Overlaps with implementation in WebKitLib.lib. + * win/WebKit2.def: Added. Copied from WebKit project. + * win/WebKit2.rc: Added resources previously in WebKit. + * win/WebKit2.vcproj: Changed project name to WebKit so we will link output to WebKit.dll. + Removed implementations overlapping with WebKitLib (WebCoreLocalizedStrings, DllMain, WebLocalizableStrings, WebProcessMain). + * win/WebKit2Common.vsprops: Use a framework name of WebKit instead of WebKit2 to reflect project name. + Renamed BUILDING_WEBKIT2 to BUILDING_WEBKIT since there is now just a single WebKit.dll. + * win/WebKit2WebProcess.vcproj: Link against WebKit instead of WebKit2 due to renaming. + * win/deleteButton.png: Copied from ../WebKit/win/WebKit.vcproj/deleteButton.png. + * win/deleteButtonPressed.png: Copied from ../WebKit/win/WebKit.vcproj/deleteButtonPressed.png. + * win/fsVideoAudioVolumeHigh.png: Copied from ../WebKit/win/WebKit.vcproj/fsVideoAudioVolumeHigh.png. + * win/fsVideoAudioVolumeLow.png: Copied from ../WebKit/win/WebKit.vcproj/fsVideoAudioVolumeLow.png. + * win/fsVideoExitFullscreen.png: Copied from ../WebKit/win/WebKit.vcproj/fsVideoExitFullscreen.png. + * win/fsVideoPause.png: Copied from ../WebKit/win/WebKit.vcproj/fsVideoPause.png. + * win/fsVideoPlay.png: Copied from ../WebKit/win/WebKit.vcproj/fsVideoPlay.png. + * win/missingImage.png: Copied from ../WebKit/win/WebKit.vcproj/missingImage.png. + * win/nullplugin.png: Copied from ../WebKit/win/WebKit.vcproj/nullplugin.png. + * win/panEastCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panEastCursor.png. + * win/panIcon.png: Copied from ../WebKit/win/WebKit.vcproj/panIcon.png. + * win/panNorthCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panNorthCursor.png. + * win/panNorthEastCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panNorthEastCursor.png. + * win/panNorthWestCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panNorthWestCursor.png. + * win/panSouthCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panSouthCursor.png. + * win/panSouthEastCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panSouthEastCursor.png. + * win/panSouthWestCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panSouthWestCursor.png. + * win/panWestCursor.png: Copied from ../WebKit/win/WebKit.vcproj/panWestCursor.png. + * win/searchCancel.png: Copied from ../WebKit/win/WebKit.vcproj/searchCancel.png. + * win/searchCancelPressed.png: Copied from ../WebKit/win/WebKit.vcproj/searchCancelPressed.png. + * win/searchMagnifier.png: Copied from ../WebKit/win/WebKit.vcproj/searchMagnifier.png. + * win/searchMagnifierResults.png: Copied from ../WebKit/win/WebKit.vcproj/searchMagnifierResults.png. + * win/textAreaResizeCorner.png: Copied from ../WebKit/win/WebKit.vcproj/textAreaResizeCorner.png. + * win/verticalTextCursor.png: Copied from ../WebKit/win/WebKit.vcproj/verticalTextCursor.png. + * win/zoomInCursor.png: Copied from ../WebKit/win/WebKit.vcproj/zoomInCursor.png. + * win/zoomOutCursor.png: Copied from ../WebKit/win/WebKit.vcproj/zoomOutCursor.png. + +2010-07-12 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Anders Carlsson. + + Get rid of auto_ptr use in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42119 + + Replace all use of auto_ptr with OwnPtr/PassOwnPtr. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + (CoreIPC::Connection::waitForMessage): + (CoreIPC::Connection::sendSyncMessage): + (CoreIPC::Connection::processIncomingMessage): + (CoreIPC::Connection::sendOutgoingMessages): + (CoreIPC::Connection::dispatchMessages): + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::Message::Message): + (CoreIPC::Connection::send): + (CoreIPC::Connection::sendSync): + (CoreIPC::Connection::waitFor): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + (CoreIPC::createArgumentDecoder): + (CoreIPC::Connection::receiveSourceEventHandler): + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::readyReadHandler): + (CoreIPC::Connection::sendOutgoingMessage): + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::readEventHandler): + (CoreIPC::Connection::sendOutgoingMessage): + * Platform/RunLoop.cpp: + (RunLoop::performWork): + (RunLoop::scheduleWork): + * Platform/RunLoop.h: + * Platform/WorkItem.h: + (WorkItem::create): + * Platform/WorkQueue.h: + * Platform/mac/WorkQueueMac.cpp: + (WorkQueue::executeWorkItem): + (WorkQueue::scheduleWork): + (WorkQueue::EventSource::EventSource): + (WorkQueue::registerMachPortEventHandler): + * Platform/qt/WorkQueueQt.cpp: + (WorkQueue::connectSignal): + (WorkQueue::scheduleWork): + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::registerHandle): + (WorkQueue::scheduleWork): + (WorkQueue::performWork): + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::sendMessage): + (WebKit::WebProcessProxy::didFinishLaunching): + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::send): + +2010-07-12 Ada Chan <adachan@apple.com> + + Build fix. Copy WKArray.h to the include directory. + + * win/WebKit2Generated.make: + +2010-07-12 Mark Rowe <mrowe@apple.com> + + Re-do an Xcode project change that Xcode decided not to save. + + * WebKit2.xcodeproj/project.pbxproj: Remove WebKit2.exp from the project. + For some reason it was being copied in to the framework wrapper. + +2010-07-12 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Remove the exports file from WebKit2. + + * Configurations/Base.xcconfig: Have symbols default to hidden visibility. + * Configurations/WebKit2.xcconfig: Remove the export file. + * UIProcess/API/mac/WKView.h: Export the WKView class. + * WebProcess/WebKitMain.cpp: Export the WebKitMain function. + * mac/WebKit2.exp: Removed. + +2010-07-12 Adam Roben <aroben@apple.com> + + Move WebKit2.vcproj's settings into .vsprops files + + This makes it easier to make changes that affect all configurations. + + Fixes <http://webkit.org/b/42097> WebKit2 should use .vsprops files + + Reviewed by Steve Falkenburg. + + * win/WebKit2.vcproj: Moved settings from here to the files below. + * win/WebKit2Apple.vsprops: Added. Links against Apple-specific + libraries. + * win/WebKit2CFLite.vsprops: Added. Links against CFLite. + * win/WebKit2Common.vsprops: Added. Contains settings shared by all + configurations. + * win/WebKit2DirectX.vsprops: Added. Contains settings to help with + linking against DirectX. + +2010-07-12 Adam Roben <aroben@apple.com> + + Stop generating stripped symbols for Release builds + + It turns out we can strip the symbols after-the-fact using PDBCopy. + + Fixes <http://webkit.org/b/42085>. + + Reviewed by Steve Falkenburg. + + * win/WebKit2.vcproj: Removed the no-longer-needed Release override of + the StripPrivateSymbols attribute. (This attribute is no longer set in + release.vsprops, so doesn't need to be overridden.) + +2010-07-12 Brian Weinstein <bweinstein@apple.com> + + WebKit2 build fix for Windows. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: Remove some stub function definitions. + * win/WebKit2.vcproj: Add PluginController.h to the vcproj. + +2010-07-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add a PluginController class, use it for invalidation and getting the user agent + https://bugs.webkit.org/show_bug.cgi?id=42084 + + * WebKit2.xcodeproj/project.pbxproj: + Add PluginController.h + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::initialize): + * WebProcess/Plugins/DummyPlugin.h: + Pass the PluginController to initialize. + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + Implement NPN_UserAgent, NPN_MemAlloc, NPN_MemFree, NPN_InvalidateRect and NPN_InvalidateRegion. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_pluginController to null. + + (WebKit::NetscapePlugin::invalidate): + Ask the plug-in controller to invalidate. + + (WebKit::NetscapePlugin::userAgent):´ + Ask the plug-in controller for the user agent. + + (WebKit::NetscapePlugin::initialize): + Set the m_pluginController member variable. + + * WebProcess/Plugins/Plugin.h: + Make initialize take a PluginController. + + * WebProcess/Plugins/PluginController.h: Added. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::initializePlugin): + Pass the PluginController to initialize. + + (WebKit::PluginView::invalidateRect): + Tell the host window to invalidate the given rect. + + (WebKit::PluginView::invalidate): + Call invalidateRect. + + (WebKit::PluginView::userAgent): + Ask the frame loader client for the user agent. + + * WebProcess/Plugins/PluginView.h: + +2010-07-12 Adam Roben <aroben@apple.com> + + Windows build fix + + * WebProcess/Plugins/Netscape/win/NetscapePluginModuleWin.cpp: Added. + (WebKit::NetscapePluginModule::tryLoad): + (WebKit::NetscapePluginModule::unload): + Stubbed these out. + + * win/WebKit2.vcproj: Added a Netscape filter beneath + WebProcess/Plugins, and moved NetscapePlugin into it. Added + NetscapePluginModule to the new Netscape filter. Added + WebProcess/Plugins to the include path for all configurations (it was + only added to Release and Debug_Internal previously) and added + WebProcess/Plugins/Netscape to the include path for all + configurations. + +2010-07-11 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + Implement animation-related methods for WebKitTestRunner + https://bugs.webkit.org/show_bug.cgi?id=42053 + + Implemented some helpers for WebKitTestRunner; + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameGetNumberOfActiveAnimations): + (WKBundleFramePauseAnimationOnElementWithId): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::numberOfActiveAnimations): + (WebKit::WebFrame::pauseAnimationOnElementWithId): + * WebProcess/WebPage/WebFrame.h: + * mac/WebKit2.exp: + +2010-07-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't initialize plug-ins until allowed by the page + https://bugs.webkit.org/show_bug.cgi?id=42033 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::paint): + (WebKit::NetscapePlugin::geometryDidChange): + Assert that the plug-in is started. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Initialize m_isWaitingUntilMediaCanStart. + + (WebKit::PluginView::~PluginView): + If necessary, remove the plug-in view as a MediaCanStartListener. + + (WebKit::PluginView::initializePlugin): + If we're not allowed to initialize the plug-in, add the plug-in view as a MediaCanStartListener. + + (WebKit::PluginView::paint): + Check that the plug-in is initialized. + + (WebKit::PluginView::viewGeometryDidChange): + Ditto. + + (WebKit::PluginView::mediaCanStart): + Initialize the plug-in. + + * WebProcess/Plugins/PluginView.h: + +2010-07-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Have the plug-in view initialize the plug-in + https://bugs.webkit.org/show_bug.cgi?id=42030 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::initialize): + * WebProcess/Plugins/DummyPlugin.h: + Plugin::initialize now takes a struct. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::initialize): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Plugin::initialize now takes a struct. + + * WebProcess/Plugins/Plugin.h: + Add Parameters struct. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Add Parameters parameter. + + (WebKit::PluginView::~PluginView): + Add m_plugin null check. + + (WebKit::PluginView::initializePlugin): + Try to initialize the plug-in and zero out the plug-in if initialization fails. + + (WebKit::PluginView::paint): + Add m_plugin null check. + + (WebKit::PluginView::setParent): + Initialize the plug-in. + + * WebProcess/Plugins/PluginView.h: + (WebKit::PluginView::create): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Don't initialize the plug-in here. + +2010-07-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Call Page::canStartMedia when the WKView is added to/removed from a window + https://bugs.webkit.org/show_bug.cgi?id=42029 + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + (WebPageMessage::): + Add SetIsInWindow. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + Call setIsInWindow. + + (-[WKView _updateVisibility]): + Call setIsInWindow. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize m_isInWindow. + + (WebKit::WebPageProxy::setIsInWindow): + Send WebPageMessage::SetIsInWindow. + + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setIsInWindow): + Call Page::canStartMedia. + + (WebKit::WebPage::didReceiveMessage): + Handle the SetIsInWindow message. + + * WebProcess/WebPage/WebPage.h: + +2010-07-10 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Reuse initialized NetscapePluginModules, pass parameters to NPP_New + https://bugs.webkit.org/show_bug.cgi?id=42028 + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Let the plug-in module know that a plug-in has been created. + + (WebKit::NetscapePlugin::~NetscapePlugin): + Let the plug-in module know that a plug-in has been destroyed. + + (WebKit::NetscapePlugin::initialize): + Pass the MIME type and parameters to the plug-in. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::initializedNetscapePluginModules): + Add list of initialized plug-in modules. + + (WebKit::NetscapePluginModule::NetscapePluginModule): + Initialize m_pluginCount to 0. + + (WebKit::NetscapePluginModule::~NetscapePluginModule): + Assert that we're not in the list of initialized plug-ins. + + (WebKit::NetscapePluginModule::pluginCreated): + Increment the plug-in count. + + (WebKit::NetscapePluginModule::pluginDestroyed): + Decrement the plug-in count and call shutdown if it's 0. + + (WebKit::NetscapePluginModule::shutdown): + Call NP_Shutdown and remove the plug-in from the list of initialized plug-ins. + + (WebKit::NetscapePluginModule::getOrCreate): + Look for an already initialized plug-in module before creating one. + + (WebKit::NetscapePluginModule::load): + Set m_isInitialized to true. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: + (WebKit::NetscapePluginModule::unload): + Leak the CFBundleRef to avoid possible crashes. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Call getOrCreate instead of create. + +2010-07-09 Leon Clarke <leonclarke@google.com> + + Reviewed by Adam Barth. + + add support for link prefetching + https://bugs.webkit.org/show_bug.cgi?id=3652 + + * Configurations/FeatureDefines.xcconfig: + +2010-07-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig and Dan Bernstein. + + Handle setting of drawing and event models + https://bugs.webkit.org/show_bug.cgi?id=41994 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + Handle NPPVpluginDrawingModel and NPPVpluginEventModel. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_inNPPNew. + + (WebKit::NetscapePlugin::~NetscapePlugin): + Assert that we aren't still running. + + (WebKit::NetscapePlugin::fromNPP): + New function that returns a NetscapePlugin object given a NPP pointer. + + (WebKit::NetscapePlugin::initialize): + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.cpp: + (WebKit::NetscapePlugin::setDrawingModel): + Set the drawing model. + + (WebKit::NetscapePlugin::setEventModel): + Set the event model. + + (WebKit::initializeEvent): + (WebKit::NetscapePlugin::platformPaint): + Only send the Cocoa event when using the Cocoa event model. + +2010-07-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41971 + Add really basic BackForwardList support. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + (WebPageMessage::): + Add new message kind. + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + Add new message kinds. Remove DidChangeCanGoBack and DidChangeCanGoForward. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGoToBackForwardListItem): + * UIProcess/API/C/WKPage.h: + Add function to initiate a navigation to a BackForward item. The + BackForward list will be updated to use this as the current item + asynchronously. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::WebBackForwardList): + (WebKit::WebBackForwardList::addItem): Added. + (WebKit::WebBackForwardList::goToItem): Added. + (WebKit::WebBackForwardList::itemAtIndex): Added. + (WebKit::WebBackForwardList::backListCount): Changed to return int matching WebCore. + (WebKit::WebBackForwardList::forwardListCount): Ditto. + (WebKit::WebBackForwardList::backListWithLimit): Add cast to int. + (WebKit::WebBackForwardList::forwardListWithLimit): Ditto. + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): Ditto. + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): Ditto. + * UIProcess/WebBackForwardList.h: + + * UIProcess/WebBackForwardListItem.cpp: + (WebKit::WebBackForwardListItem::WebBackForwardListItem): + * UIProcess/WebBackForwardListItem.h: + (WebKit::WebBackForwardListItem::create): + (WebKit::WebBackForwardListItem::itemID): + Added itemID. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::canGoForward): + (WebKit::WebPageProxy::canGoBack): + (WebKit::WebPageProxy::goToBackForwardItem): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didReceiveSyncMessage): + (WebKit::WebPageProxy::addItemToBackForwardList): + (WebKit::WebPageProxy::goToItemInBackForwardList): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + - Removed m_canGoBack and m_canGoForward booleans and instead use the BackForwardList. + - Forward goToBackForwardItem to the WebProcess. + - Respond to messages from the WebBackForwardListProxy in the WebProcess, + forwarding to the WebBackForwardList. + + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: + (WebKit::WebBackForwardControllerClient::createBackForwardList): + Start using a WebBackForwardListProxy instead of a BackForwardListImpl. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidAddBackForwardItem): + (WebKit::WebFrameLoaderClient::dispatchDidRemoveBackForwardItem): + (WebKit::WebFrameLoaderClient::dispatchDidChangeBackForwardIndex): + Remove calls backForwardListDidChange() now that we communicate much more + information than just this state. + + * WebProcess/WebPage/WebBackForwardListProxy.cpp: + (WebKit::idToHistoryItemMap): + (WebKit::historyItemToIDMap): + (WebKit::generateHistoryItemID): + (WebKit::getIDForHistoryItem): + (WebKit::WebBackForwardListProxy::itemForID): + Add leaking cached maps of HistoryItems to IDs, the life time of these + objects will be improved in a subsequent patch. + + (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): + (WebKit::WebBackForwardListProxy::addItem): + (WebKit::WebBackForwardListProxy::goBack): + (WebKit::WebBackForwardListProxy::goForward): + (WebKit::WebBackForwardListProxy::goToItem): + (WebKit::WebBackForwardListProxy::backItem): + (WebKit::WebBackForwardListProxy::currentItem): + (WebKit::WebBackForwardListProxy::forwardItem): + (WebKit::WebBackForwardListProxy::itemAtIndex): + (WebKit::WebBackForwardListProxy::backListWithLimit): + (WebKit::WebBackForwardListProxy::forwardListWithLimit): + (WebKit::WebBackForwardListProxy::capacity): + (WebKit::WebBackForwardListProxy::setCapacity): + (WebKit::WebBackForwardListProxy::enabled): + (WebKit::WebBackForwardListProxy::setEnabled): + (WebKit::WebBackForwardListProxy::backListCount): + (WebKit::WebBackForwardListProxy::forwardListCount): + (WebKit::WebBackForwardListProxy::containsItem): + (WebKit::WebBackForwardListProxy::close): + (WebKit::WebBackForwardListProxy::closed): + (WebKit::WebBackForwardListProxy::removeItem): + (WebKit::WebBackForwardListProxy::entries): + (WebKit::WebBackForwardListProxy::pushStateItem): + * WebProcess/WebPage/WebBackForwardListProxy.h: + Forward functions to the UIProcess. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::goToBackForwardItem): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + Respond to GoToBackForwardItem message. + + * mac/WebKit2.exp: Add new API function. + +2010-07-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Verify drawing coordinates, add crude painting support + https://bugs.webkit.org/show_bug.cgi?id=41984 + + * WebKit2.xcodeproj/project.pbxproj: + Add NetscapePluginMac.cpp. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize drawing and event models. + + (WebKit::NetscapePlugin::initialize): + Call platformPostInitialize. + + (WebKit::NetscapePlugin::destroy): + Call NPP_Destroy. + + (WebKit::NetscapePlugin::paint): + Call platformPaint. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add member functions. + + * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.cpp: Added. + (WebKit::NetscapePlugin::platformPostInitialize): + Set default event and drawing models and verify that they are compatible. + + (WebKit::NetscapePlugin::platformPaint): + Send a paint event (assuming the Cocoa event model currently). + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::paint): + Change the paint rect to be in window coordinates. + + (WebKit::PluginView::viewGeometryDidChange): + (WebKit::PluginView::clipRectInWindowCoordinates): + * WebProcess/Plugins/PluginView.h: + +2010-07-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Pass a clip rect to the plugin and call NPP_SetWindow + https://bugs.webkit.org/show_bug.cgi?id=41969 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::geometryDidChange): + * WebProcess/Plugins/DummyPlugin.h: + Add clip rect parameter. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Initialize m_npWindow. + + (WebKit::NetscapePlugin::callSetWindow): + Call NPP_SetWindow. + + (WebKit::NetscapePlugin::initialize): + Set the window type to NPWindowTypeDrawable for now. + + (WebKit::NetscapePlugin::geometryDidChange): + Update the frame and clip rects and call NPP_SetWindow. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Add an NPWindow member variable. + + * WebProcess/Plugins/Plugin.h: + Add a clipRect parameter to geometryDidChange. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + Add the plug-in element to the constructor. + + (WebKit::PluginView::viewGeometryDidChange): + Compute the clip rect and pass it to the plug-in. + + * WebProcess/Plugins/PluginView.h: + (WebKit::PluginView::create): + Pass the plug-in element to the constructor. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Pass the plug-in element to PluginView::create. + +2010-07-09 Anders Carlsson <andersca@apple.com> + + Reviewed by Simon Fraser. + + Instantiate Netscape plug-ins, pass geometry information to Plugin + https://bugs.webkit.org/show_bug.cgi?id=41960 + + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: + Handle NPNVsupportsCoreGraphicsBool and NPNVsupportsCocoaBool. + + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: + (WebKit::NetscapePlugin::NetscapePlugin): + Set npp.ndata. + + (WebKit::NetscapePlugin::initialize): + Try to instantiate the plug-in by calling NPP_New. + + * WebProcess/Plugins/Netscape/NetscapePlugin.h: + Store the NetscapePluginModule and the NPP struct. + + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: + Add a getter for the NPPluginFuncs vtable. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::frameRectsChanged): + Make sure to call viewGeometryDidChange. + + (WebKit::PluginView::setParent): + Ditto. + + (WebKit::PluginView::viewGeometryDidChange): + Convert the frame rect to window coordinates and pass it to the plug-in. + + * WebProcess/Plugins/PluginView.h: + Add function declarations. + +2010-07-08 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [WebKit2] Make QWKPage call _q_webActionTriggered as a private slot + https://bugs.webkit.org/show_bug.cgi?id=41880 + + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage.h: + +2010-07-09 Antti Koivisto <koivisto@iki.fi> + + Not reviewed. + + Build fix. + + * UIProcess/API/qt/qwkpage.h: + +2010-07-08 Brian Weinstein <bweinstein@apple.com> + + WebKit2 build fix for Windows. + + * WebProcess/Plugins/PluginView.h: Change the forward declaration of Plugin + to an include. + * win/WebKit2.vcproj: Update the include paths for Release to match Debug, and + add some files to the vcproj that were added on Mac. + +2010-07-08 Sam Weinig <sam@webkit.org> + + Attempt to fix the windows build. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add NetscapePlugin class + https://bugs.webkit.org/show_bug.cgi?id=41919 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: Added. + (WebKit::NetscapePlugin::NetscapePlugin): + (WebKit::NetscapePlugin::~NetscapePlugin): + (WebKit::NetscapePlugin::initialize): + (WebKit::NetscapePlugin::destroy): + (WebKit::NetscapePlugin::paint): + (WebKit::NetscapePlugin::geometryDidChange): + * WebProcess/Plugins/Netscape/NetscapePlugin.h: Added. + (WebKit::NetscapePlugin::create): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Enable notImplemented messages by default and have the various clients explicitly disable them. + + * Shared/NotImplemented.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: + * WebProcess/WebCoreSupport/WebDragClient.cpp: + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add stubbed out NPN functions + https://bugs.webkit.org/show_bug.cgi?id=41917 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: Added. + (WebKit::initializeBrowserFuncs): + (WebKit::netscapeBrowserFuncs): + * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h: Added. + * WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: + (WebKit::NetscapePluginModule::tryLoad): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + +2010-07-08 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Spelling and style correction + https://bugs.webkit.org/show_bug.cgi?id=41891 + + Correcting a spelling and a style mistakes. + + * UIProcess/Launcher/ProcessLauncher.h: + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement more of NetscapePluginModule + https://bugs.webkit.org/show_bug.cgi?id=41910 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: + (WebKit::NetscapePluginModule::create): + (WebKit::NetscapePluginModule::load): + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: + * WebProcess/Plugins/Netscape/mac/NetscapePluginModuleMac.cpp: Added. + (WebKit::NetscapePluginModule::unload): + (WebKit::pointerToFunction): + (WebKit::NetscapePluginModule::tryLoad): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add stubbed out NetscapePluginModule class + https://bugs.webkit.org/show_bug.cgi?id=41901 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp: Added. + (WebKit::NetscapePluginModule::NetscapePluginModule): + * WebProcess/Plugins/Netscape/NetscapePluginModule.h: Added. + (WebKit::NetscapePluginModule::create): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Move socket objects to connection's thread + https://bugs.webkit.org/show_bug.cgi?id=41897 + + To receive network related notifications in the WorkQueue thread, the + QLocalSocket instances must be moved to that thread. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::open): + * Platform/WorkQueue.h: + * Platform/qt/WorkQueueQt.cpp: + (WorkQueue::moveSocketToWorkThread): + +2010-07-08 Alice Liu <alice.liu@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=41653 + Add new WebKitTestRunner project for Windows + + * win/WebKit2Generated.make: Add files needed for WebKitTestRunner + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a GetPluginHostConnection WebProcessProxy message + https://bugs.webkit.org/show_bug.cgi?id=41893 + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginHostConnection): + (WebKit::WebProcessProxy::didReceiveMessage): + (WebKit::WebProcessProxy::didReceiveSyncMessage): + * UIProcess/WebProcessProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add more parameters to Plugin::initialize + https://bugs.webkit.org/show_bug.cgi?id=41890 + + * WebProcess/Plugins/DummyPlugin.cpp: + (WebKit::DummyPlugin::initialize): + * WebProcess/Plugins/DummyPlugin.h: + * WebProcess/Plugins/Plugin.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/Plugins/DummyPlugin.h: + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a Plugin abstract base class and a DummyPlugin that implements it + https://bugs.webkit.org/show_bug.cgi?id=41885 + + * WebKit2.xcodeproj/project.pbxproj: + Add files. + + * WebProcess/Plugins/DummyPlugin.cpp: Added. + (WebKit::DummyPlugin::paint): + Paint a red rectangle. + + * WebProcess/Plugins/Plugin.cpp: Added. + * WebProcess/Plugins/Plugin.h: Added. + Add Plugin, an abstract baseclass. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::PluginView): + (WebKit::PluginView::~PluginView): + (WebKit::PluginView::paint): + (WebKit::PluginView::viewGeometryDidChange): + * WebProcess/Plugins/PluginView.h: + (WebKit::PluginView::create): + Add a Plugin member function and forward PluginView calls to it. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Make a DummyPlugin and pass it to the PluginView. + + * win/WebKit2.vcproj: + Add files. + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add stubbed out PluginView class + https://bugs.webkit.org/show_bug.cgi?id=41879 + + * WebKit2.xcodeproj/project.pbxproj: + Add PluginView.cpp and PluginView.h + + * WebProcess/Plugins/PluginView.cpp: Added. + (WebKit::PluginView::PluginView): + (WebKit::PluginView::~PluginView): + (WebKit::PluginView::setFrameRect): + (WebKit::PluginView::paint): + (WebKit::PluginView::viewGeometryDidChange): + (WebKit::PluginView::invalidateRect): + Stub out these functions. + + * WebProcess/Plugins/PluginView.h: Added. + (WebKit::PluginView::create): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::createPlugin): + Create a plug-in view. + + * win/WebKit2.vcproj: + Add PluginView.cpp and PluginView.h. + +2010-07-08 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Adam Roben. + + WebKit2 on Windows needs a version resource + https://bugs.webkit.org/show_bug.cgi?id=41870 + <rdar://problem/8170501> + + * win/WebKit2.rc: Added. + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.rc: Added. + * win/WebKit2WebProcess.vcproj: + +2010-07-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41874 + Add stubbed out WebBackForwardListProxy + + - No behavior change. + - Rename the old WebBackForwardListProxy to WebBackForwardList since it + will be the implementation, not the proxy. + + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBackForwardList.cpp: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/WebBackForwardList.cpp: Copied from UIProcess/WebBackForwardListProxy.cpp. + * UIProcess/WebBackForwardList.h: Copied from UIProcess/WebBackForwardListProxy.h. + (WebKit::WebBackForwardList::create): + * UIProcess/WebBackForwardListProxy.cpp: Removed. + * UIProcess/WebBackForwardListProxy.h: Removed. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::backForwardList): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/WebBackForwardListProxy.cpp: Added. + * WebProcess/WebPage/WebBackForwardListProxy.h: Added. + (WebKit::WebBackForwardListProxy::create): + * win/WebKit2.vcproj: + +2010-07-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Pass Page to BackForwardControllerClient::createBackForwardList since it + may be called before implementations of BackForwardControllerClient have + access to a Page. + + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: + (WebKit::WebBackForwardControllerClient::createBackForwardList): + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.h: + +2010-07-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix fallout from Darin's adoptRef assertion changes. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::sharedProcessContext): + (WebKit::WebContext::sharedThreadContext): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::createMainFrame): + (WebKit::WebFrame::createSubframe): + (WebKit::WebFrame::create): + (WebKit::WebFrame::WebFrame): + * WebProcess/WebPage/WebFrame.h: + +2010-07-08 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Mark Rowe. + + WebKit2 should enable DEP (Data Execution Prevention) on Windows via /NXCOMPAT + https://bugs.webkit.org/show_bug.cgi?id=41837 + <rdar://problem/8170505> + + * win/WebKit2WebProcess.vcproj: + +2010-07-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41826 + Convert BackForwardList to an abstract base class and add BackForwardListImpl + as the concrete implementation of it. + + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: + (WebKit::WebBackForwardControllerClient::createBackForwardList): + +2010-07-08 Luiz Agostini <luiz@webkit.org>, Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Antti Koivisto. + + [Qt] Improve QtWebkit2 secondary process launching procedure + https://bugs.webkit.org/show_bug.cgi?id=41853 + + Changing secondary process launching procedure to make sure that the method + ProcessLauncher::didFinishLaunchingProcess will only be called after secondary + process has been launched and the connection has been stablished between the + UIProcess and WebProcess. + + This solves the timing issues ocasionaly observed when launching MiniBrowser. + + QLocalServer object and related code has been removed from the class Connection. + Server instances of the Connection class now get the QLocalSocket via ProcessLauncher. + + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::platformInitialize): + (CoreIPC::Connection::platformInvalidate): + (CoreIPC::Connection::open): + + Using QProcess* as PlatformProcessIdentifier. + + * Platform/PlatformProcessIdentifier.h: + + A new singleton class named ProcessLauncherHelper was created to handle the QLocalServer + object used to receive connections. This class launches the process and waits for it to connect + before calling ProcessLauncher::didFinishLaunchingProcess. + + * UIProcess/Launcher/ProcessLauncher.h: + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: + (WebKit::ProcessLauncherHelper::launch): + (WebKit::ProcessLauncherHelper::takePendingConnection): + (WebKit::ProcessLauncherHelper::ProcessLauncherHelper): + (WebKit::ProcessLauncherHelper::instance): + (WebKit::ProcessLauncherHelper::newConnection): + (WebKit::ProcessLauncher::launchProcess): + (WebKit::ProcessLauncher::terminateProcess): + (_qt_takePendingConnection): + +2010-07-08 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Random build fixes. + + * Shared/qt/WebEventFactoryQt.cpp: + * UIProcess/API/qt/ClientImpl.cpp: + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/qwkpage.h: + * UIProcess/DrawingAreaProxy.h: + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: + * WebProcess/WebProcess.cpp: + +2010-07-07 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Terminate QtWebProcess on exit + https://bugs.webkit.org/show_bug.cgi?id=41766 + + Call WKPageTerminate to terminate QtWebProcess on exit. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPage::~QWKPage): + +2010-07-07 Steve Falkenburg <sfalken@apple.com> + + Windows release build fix. + Don't generate public symbols since this is exceeding address space on our builders. + + * win/WebKit2.vcproj: + +2010-07-07 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41772 + Add basic piping for BackForwardControllerClient. + + - Add very basic WebBackForwardControllerClient. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp: Added. + (WebKit::WebBackForwardControllerClient::backForwardControllerDestroyed): + (WebKit::WebBackForwardControllerClient::createBackForwardList): + * WebProcess/WebCoreSupport/WebBackForwardControllerClient.h: Added. + (WebKit::WebBackForwardControllerClient::WebBackForwardControllerClient): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + * win/WebKit2.vcproj: + +2010-07-07 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add Qt section to the prefix header. + + * WebKit2Prefix.h: + +2010-07-07 Antti Koivisto <koivisto@iki.fi> + + Not reviewed. + + Fix build, remove some left over debugging code. + + * Platform/CoreIPC/qt/ConnectionQt.cpp: + (CoreIPC::Connection::readyReadHandler): + (CoreIPC::Connection::sendOutgoingMessage): + +2010-07-07 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Implement WebPage for Qt. + + * WebProcess/WebPage/qt/WebPageQt.cpp: Added. + (WebKit::WebPage::platformInitialize): + (WebKit::): + (WebKit::WebPage::interpretKeyEvent): + + +2010-07-06 Anders Carlsson <andersca@apple.com> + + Fix Windows WebKit2 build. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: + (WebKit::PluginInfoStore::mimeTypeFromExtension): + +2010-07-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginInfoStore::findPlugin + https://bugs.webkit.org/show_bug.cgi?id=41719 + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::getPlugins): + (WebKit::PluginInfoStore::findPluginForMIMEType): + (WebKit::PluginInfoStore::findPluginForExtension): + (WebKit::pathExtension): + (WebKit::PluginInfoStore::findPlugin): + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::mimeTypeFromExtension): + +2010-07-06 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add injected bundle API for exposing console messages. + + - Split WKBundlePageClient into multiple clients matching WKPage. + (For now we only have a loader client and a UI client) + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetLoaderClient): + (WKBundlePageSetUIClient): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageClient.cpp: Removed. + * WebProcess/InjectedBundle/InjectedBundlePageClient.h: Removed. + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: Copied from WebProcess/InjectedBundle/InjectedBundlePageClient.cpp. + (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient): + (WebKit::InjectedBundlePageLoaderClient::initialize): + (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::InjectedBundlePageLoaderClient::didCommitLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFinishLoadForFrame): + (WebKit::InjectedBundlePageLoaderClient::didFailLoadWithErrorForFrame): + (WebKit::InjectedBundlePageLoaderClient::didReceiveTitleForFrame): + (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: Copied from WebProcess/InjectedBundle/InjectedBundlePageClient.h. + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: Added. + (WebKit::InjectedBundlePageUIClient::InjectedBundlePageUIClient): + (WebKit::InjectedBundlePageUIClient::initialize): + (WebKit::InjectedBundlePageUIClient::addMessageToConsole): + * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Added. + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::addMessageToConsole): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleLoaderClient): + (WebKit::WebPage::initializeInjectedBundleUIClient): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleLoaderClient): + (WebKit::WebPage::injectedBundleUIClient): + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-07-06 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41707 + Add ability to dump frame inner text for the test runner + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyInnerText): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::innerText): + * WebProcess/WebPage/WebFrame.h: + * mac/WebKit2.exp: + +2010-07-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Only export a single WebKitMain function for the Web Process to call + https://bugs.webkit.org/show_bug.cgi?id=41702 + + * Shared/CommandLine.h: + Add windows CommandLine::parse overload. + + * Shared/win/CommandLineWin.cpp: Added. + (WebKit::CommandLine::parse): + Move parse overload from WebProcess/win/WebProcessMain.cpp. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: + (WebKit::ProcessLauncher::launchProcess): + Pass the right mode to. + + * WebKit2.xcodeproj/project.pbxproj: + Update for moves. + + * WebProcess/Launching/mac/WebProcessMain.mm: Removed. + * WebProcess/Launching/win/WebProcessWinMain.cpp: Removed. + * WebProcess/WebKitMain.cpp: Added. + (WebKitMain): + (enableTerminationOnHeapCorruption): + Add WebKitMain functions for Mac and Windows. + + * WebProcess/WebProcessMain.h: Added. + * WebProcess/mac/WebProcessMainMac.mm: Added. + (WebKit::WebProcessMain): + Add Mac version of WebProcessMain. + + * WebProcess/win/WebProcessMain.cpp: Removed. + * WebProcess/win/WebProcessMain.h: Removed. + * WebProcess/win/WebProcessMainWin.cpp: Added. + (WebKit::WebProcessMain): + Add Windows version of WebProcessMain. + + * mac/MainMac.cpp: Added. + (main): + Add Mac WebProcess main function. + + * mac/WebKit2.exp: + Remove functions that we don't need to export. + + * win/MainWin.cpp: Added. + (wWinMain): + Add Windows WebProcess main function. + + * win/WebKit2.vcproj: + * win/WebKit2WebProcess.vcproj: + Update for moves. + +2010-07-05 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WebKit2 triple click + https://bugs.webkit.org/show_bug.cgi?id=41629 + + QtWebkit2 triple click implementation. + + * UIProcess/API/qt/qwkpage.cpp: + (QWKPagePrivate::mousePressEvent): + (QWKPagePrivate::mouseDoubleClickEvent): + (QWKPage::timerEvent): + * UIProcess/API/qt/qwkpage.h: + * UIProcess/API/qt/qwkpage_p.h: + +2010-07-05 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add stubs + + * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp: Copied from WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp. + (WebKit::PluginInfoStore::pluginDirectories): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp: Added. + (WebKit::InjectedBundle::load): + +2010-07-05 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add WebErrorsQt + + * WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp: Added. + (WebKit::): + (WebKit::cancelledError): + (WebKit::blockedError): + (WebKit::cannotShowURLError): + (WebKit::interruptForPolicyChangeError): + (WebKit::cannotShowMIMETypeError): + (WebKit::fileDoesNotExistError): + +2010-07-05 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add Qt C API integration. + + * UIProcess/API/cpp/qt/WKStringQt.cpp: Added. + (WKStringCreateWithQString): + (WKStringCopyQString): + * UIProcess/API/cpp/qt/WKStringQt.h: Added. + * UIProcess/API/cpp/qt/WKURLQt.cpp: Added. + (WKURLCreateWithQUrl): + (WKURLCopyQUrl): + * UIProcess/API/cpp/qt/WKURLQt.h: Added. + +2010-07-05 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add the Qt process launcher. + + * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Added. + (WebKit::ProcessLauncher::launchProcess): + (WebKit::ProcessLauncher::terminateProcess): + (WebKit::webThreadBody): + (WebKit::ProcessLauncher::createWebThread): + (webProcessMain): + +2010-07-05 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Implement ChunkedUpdateDrawingArea + Proxy for Qt. Not built yet. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + * UIProcess/qt: Added. + * UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::page): + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * WebProcess/WebPage/qt: Added. + * WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + +2010-07-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add simple command line parser and pass mode argument to the web process + https://bugs.webkit.org/show_bug.cgi?id=41586 + + * Shared/CommandLine.h: + (WebKit::CommandLine::operator[]): + Add CommandLine class. + + * Shared/mac/CommandLineMac.cpp: + (WebKit::CommandLine::parse): + Implement Mac version of CommandLine::parse. + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: + (WebKit::ProcessLauncher::launchProcess): + Add "legacywebprocess" mode to the posix_spawn call. + + * WebKit2.xcodeproj/project.pbxproj: + Add CommandLine to the xcode project. + + * WebProcess/Launching/mac/WebProcessMain.mm: + (webProcessMain): + (main): + Parse the command line and check the mode. + +2010-07-04 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Mark Rowe. + + WebProcess crashes in release for simple layout tests + https://bugs.webkit.org/show_bug.cgi?id=41575 + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCopyRenderTreeExternalRepresentation): ref external representation StringImpl* + before taking it out of its parent String, to avoid returning freed memory. + +2010-07-03 Maciej Stachowiak <mjs@apple.com> + + Rubber stamped by Anders Carlsson. + + Add stdint.h include to fix WebKitTestRunner build. + + * UIProcess/API/C/WKPage.h: + +2010-07-02 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong method name in file Connection.h + https://bugs.webkit.org/show_bug.cgi?id=41536 + + Method openConnectionHandler was spelled as openConnection in class Connection. + + * Platform/CoreIPC/Connection.h: + +2010-07-02 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Sam Weinig. + + Adding notification and touch events methods to WebChromeClient + https://bugs.webkit.org/show_bug.cgi?id=41527 + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::notificationPresenter): + (WebKit::WebChromeClient::needTouchEvents): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-07-02 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Sam Weinig. + + Removing CoreFoundation.h include from WKFrame.h + https://bugs.webkit.org/show_bug.cgi?id=41528 + + * UIProcess/API/C/WKFrame.h: + +2010-07-02 Sam Weinig <sam@webkit.org> + + Reviewed by Oliver Hunt. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41540 + WebKit2: Add InjectedCode API to get a list of subframes + + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyChildFrames): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::childFrameRef): + (WebKit::childFrameDeref): + (WebKit::WebFrame::childFrames): + * WebProcess/WebPage/WebFrame.h: + * mac/WebKit2.exp: + +2010-07-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Turn off the Objective-C garbage collection for the WebProcess. + + * Configurations/WebProcess.xcconfig: + * WebProcess/Launching/mac/WebProcessMain.mm: + (main): Assert that GC is off. + +2010-07-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + There is no longer a reason to check that the process is valid when posting + a message to the bundle, the process code will take care of that for us. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + +2010-07-02 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Use send instead of connection()->send(), now that connections() are created + asynchronously it can be null at this point and the message needs to be queued. + + * UIProcess/mac/WebProcessProxyMac.mm: + (WebKit::WebProcessProxy::setUpAcceleratedCompositing): + +2010-07-01 Steve Falkenburg <sfalken@apple.com> + + Even more Windows build fixing. + Removed bogus post-build event commands. + Removed unnecessary link libraries. + + * win/WebKit2.vcproj: + +2010-07-01 Steve Falkenburg <sfalken@apple.com> + + Fix Windows while not breaking Qt (didn't realize this was building for Qt). + + * WebProcess/WebProcess.cpp: + +2010-07-01 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * win/WebKit2Generated.make: + +2010-07-01 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * WebProcess/WebProcess.cpp: + +2010-07-01 Sam Weinig <sam@webkit.org> + + Reviewed by Jon Honeycutt. + + Make WebKit2 compile (though not work) on Leopard. + + * Platform/WorkQueue.h: + * Platform/mac/WorkQueueMac.cpp: + (WorkQueue::EventSource::EventSource): + (WorkQueue::scheduleWork): + (WorkQueue::registerMachPortEventHandler): + (WorkQueue::unregisterMachPortEventHandler): + (WorkQueue::platformInitialize): + (WorkQueue::platformInvalidate): + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + (WebKit::LayerBackedDrawingAreaProxy::attachCompositingContext): + * UIProcess/mac/WebProcessProxyMac.mm: + (WebKit::WebProcessProxy::setUpAcceleratedCompositing): + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: + (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): + (WebKit::LayerBackedDrawingArea::setNeedsDisplay): + * WebProcess/WebPage/LayerBackedDrawingArea.h: + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::platformClear): + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + +2010-07-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=41491 + Add first stab at back/forward list API. + + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBackForwardList.cpp: Added. + * UIProcess/API/C/WKBackForwardList.h: Added. + * UIProcess/API/C/WKBackForwardListItem.cpp: Added. + * UIProcess/API/C/WKBackForwardListItem.h: Added. + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WebKit2.h: + * UIProcess/WebBackForwardListItem.cpp: Added. + * UIProcess/WebBackForwardListItem.h: Added. + * UIProcess/WebBackForwardListProxy.cpp: Added. + * UIProcess/WebBackForwardListProxy.h: Added. + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-07-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make process launching asynchronous + https://bugs.webkit.org/show_bug.cgi?id=41489 + + * Platform/CoreIPC/Connection.h: + Make OutgoingMessage public. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + Don't wait for a paint reply when the process is starting up. + + * UIProcess/Launcher/ProcessLauncher.cpp: Added. + Add new ProcessLauncher class. + + (WebKit::processLauncherWorkQueue): + Returns the work queue where process launching will happen. + + (WebKit::ProcessLauncher::ProcessLauncher): + Schedule launching the process. + + (WebKit::ProcessLauncher::didFinishLaunchingProcess): + Call the client method. + + (WebKit::ProcessLauncher::invalidate): + Set the client to 0. + + * UIProcess/Launcher/ProcessLauncher.h: Added. + * UIProcess/Launcher/WebProcessLauncher.h: Removed. + Rename WebProcessLauncher.h -> ProcessLauncher.h + + * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Added. + * UIProcess/Launcher/mac/WebProcessLauncher.mm: Removed. + Rename WebProcessLauncher.mm -> ProcessLauncherMac.mm, update for ProcessLauncher changes. + + * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added. + * UIProcess/Launcher/win/WebProcessLauncher.cpp: Removed. + Rename WebProcessLauncher.cpp -> ProcessLauncherWin.cpp, update for ProcessLauncher changes. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::~WebProcessProxy): + Delete any unsent messages. + + (WebKit::WebProcessProxy::connect): + Use the new ProcessLauncher. + + (WebKit::WebProcessProxy::sendMessage): + If we're waiting for the process to launch, the messages need to be enqueued. + + (WebKit::WebProcessProxy::didFinishLaunching): + Send the outgoing messages. + + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + Update for renames. + +2010-07-01 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Get accelerated compositing working with webkit2 + https://bugs.webkit.org/show_bug.cgi?id=41084 + + Start up the CA render server in the UI process (currently, at launch time), and + pass the server port over to the web process for use by the layer-backed drawing area. + + Fix some style issues pointed out by Dan Bernstein. + + Implement the WebChromeClient methods that pass the attach/detach calls through + to the drawing area. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView _startAcceleratedCompositing:]): + * UIProcess/API/mac/WKViewInternal.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): + (WebKit::WebProcessProxy::setUpAcceleratedCompositing): + * UIProcess/WebProcessProxy.h: + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: + * UIProcess/mac/WebProcessProxyMac.mm: Added. + (WebKit::WebProcessProxy::setUpAcceleratedCompositing): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::attachRootGraphicsLayer): + (WebKit::WebChromeClient::scheduleCompositingLayerSync): + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: + (WebKit::LayerBackedDrawingArea::attachCompositingContext): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::compositingRenderServerPort): + +2010-07-01 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Get accelerated compositing working with webkit2 + https://bugs.webkit.org/show_bug.cgi?id=41084 + + Add a new kind of DrawingArea, which is a LayerBackedDrawingArea, which will be used + when the page goes into accelerated compositing mode. It is not wired up yet. + + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: New 'attach' and 'detach' messages + related to accelerated compositing. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _startAcceleratedCompositing:]): + (-[WKView _stopAcceleratedCompositing]): + * UIProcess/API/mac/WKViewInternal.h: + Add a subview of the WKView which has layer-backing enabled, and put the drawing area's + layer inside of that. + + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: + (WebKit::ChunkedUpdateDrawingAreaProxy::attachCompositingContext): + (WebKit::ChunkedUpdateDrawingAreaProxy::detachCompositingContext): These methods will never be called + on the ChunkedUpdateDrawingArea. Stub them out. + + * UIProcess/DrawingAreaProxy.h: + Add attachCompositingContext() and detachCompositingContext() methods, and a new drawing area + type to the enum. + + * UIProcess/LayerBackedDrawingAreaProxy.cpp: Added. + * UIProcess/LayerBackedDrawingAreaProxy.h: Added. + * UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm: Added. + + * WebKit2.xcodeproj/project.pbxproj: Add LayerBackedDrawingArea files. + + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: Add virtual methods stubs. + + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): Create a LayerBackedDrawingArea if asked. + * WebProcess/WebPage/DrawingArea.h: New LayerBackedDrawingAreaType type, and new virtual + methods related to accelerated compositing. + + * WebProcess/WebPage/LayerBackedDrawingArea.cpp: Added. + * WebProcess/WebPage/LayerBackedDrawingArea.h: Added. + * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm: Added. + +2010-07-01 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Rubberstamped by Sam Weinig. + + Export symbols on Linux with GCC, like JSC does. + + * UIProcess/API/C/WKBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + +2010-07-01 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add implementation of the UI and loader client for Qt. + + * UIProcess/API/qt/qwkpage.cpp: + * UIProcess/API/qt/ClientImpl.cpp: Added. + (toQWKPage): + (qt_wk_didStartProvisionalLoadForFrame): + (qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame): + (qt_wk_didFailProvisionalLoadWithErrorForFrame): + (qt_wk_didCommitLoadForFrame): + (qt_wk_didFinishLoadForFrame): + (qt_wk_didFailLoadWithErrorForFrame): + (qt_wk_didReceiveTitleForFrame): + (qt_wk_didFirstLayoutForFrame): + (qt_wk_didFirstVisuallyNonEmptyLayoutForFrame): + (qt_wk_didStartProgress): + (qt_wk_didChangeProgress): + (qt_wk_didFinishProgress): + (qt_wk_didBecomeUnresponsive): + (qt_wk_didBecomeResponsive): + (qt_wk_createNewPage): + (qt_wk_showPage): + (qt_wk_close): + (qt_wk_runJavaScriptAlert): + * UIProcess/API/qt/ClientImpl.h: Added. + +2010-07-01 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Change the CoreIPC connection identifier to be a HANDLE on Windows + https://bugs.webkit.org/show_bug.cgi?id=41479 + + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::createServerAndClientIdentifiers): + New function that creates a server and client HANDLE. + + (CoreIPC::Connection::platformInitialize): + Don't open the connections here. + + (CoreIPC::Connection::readEventHandler): + (CoreIPC::Connection::open): + + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + (WebKit::webThreadBody): + Get the handle from the thread. + + (WebKit::launchWebProcess): + Mark the client identifier as inheritable and pass it along to the web process. + + * WebProcess/win/WebProcessMain.cpp: + (WebKit::CommandLine::CommandLine): + (WebKit::CommandLine::parse): + (WebKit::CommandLine::operator[]): + Add simple command line parser. + + (WebKit::WebProcessMain): + Get the handle identifier from the command line. + + * WebProcess/win/WebProcessMain.h: + +2010-07-01 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add initial Qt API for WebKit2 + + * UIProcess/API/qt/WKView.h: Added. + * UIProcess/API/qt/qgraphicswkview.cpp: Added. + (QGraphicsWKViewPrivate::pageRef): + (QGraphicsWKView::QGraphicsWKView): + (QGraphicsWKView::~QGraphicsWKView): + (QGraphicsWKView::page): + (QGraphicsWKView::paint): + (QGraphicsWKView::setGeometry): + (QGraphicsWKView::load): + (QGraphicsWKView::setUrl): + (QGraphicsWKView::url): + (QGraphicsWKView::title): + (QGraphicsWKView::triggerPageAction): + (QGraphicsWKView::back): + (QGraphicsWKView::forward): + (QGraphicsWKView::reload): + (QGraphicsWKView::stop): + (QGraphicsWKView::itemChange): + (QGraphicsWKView::event): + (QGraphicsWKView::sizeHint): + (QGraphicsWKView::inputMethodQuery): + (QGraphicsWKView::keyPressEvent): + (QGraphicsWKView::keyReleaseEvent): + (QGraphicsWKView::hoverMoveEvent): + (QGraphicsWKView::mouseMoveEvent): + (QGraphicsWKView::mousePressEvent): + (QGraphicsWKView::mouseReleaseEvent): + (QGraphicsWKView::mouseDoubleClickEvent): + (QGraphicsWKView::wheelEvent): + (QGraphicsWKViewPrivate::QGraphicsWKViewPrivate): + (QGraphicsWKView::visibleRect): + * UIProcess/API/qt/qgraphicswkview.h: Added. + * UIProcess/API/qt/qwkpage.cpp: Added. + (QWKPagePrivate::QWKPagePrivate): + (QWKPagePrivate::~QWKPagePrivate): + (QWKPagePrivate::init): + (QWKPagePrivate::toolTipChanged): + (QWKPagePrivate::paint): + (QWKPagePrivate::keyPressEvent): + (QWKPagePrivate::keyReleaseEvent): + (QWKPagePrivate::mouseMoveEvent): + (QWKPagePrivate::mousePressEvent): + (QWKPagePrivate::mouseReleaseEvent): + (QWKPagePrivate::mouseDoubleClickEvent): + (QWKPagePrivate::wheelEvent): + (QWKPagePrivate::updateAction): + (QWKPagePrivate::updateNavigationActions): + (QWKPagePrivate::_q_webActionTriggered): + (QWKPage::QWKPage): + (QWKPage::~QWKPage): + (QWKPage::pageRef): + (QWKPage::setCreateNewPageFunction): + (QWKPage::load): + (QWKPage::setUrl): + (QWKPage::url): + (QWKPage::title): + (QWKPage::setViewportSize): + (QWKPage::requestZoomRect): + (QWKPage::triggerAction): + (QWKPage::action): + * UIProcess/API/qt/qwkpage.h: Added. + * UIProcess/API/qt/qwkpage_p.h: Added. + (QWKPagePrivate::get): + (QWKPagePrivate::processDidExit): + (QWKPagePrivate::processDidRevive): + (QWKPagePrivate::takeFocus): + +2010-07-01 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * mac/WebKit2.exp: + Added _WKFramePolicyListenerDownload and _WKFramePolicyListenerIgnore. + +2010-07-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r62267. + http://trac.webkit.org/changeset/62267 + https://bugs.webkit.org/show_bug.cgi?id=41468 + + broke stuff (Requested by weinig on #webkit). + + * UIProcess/API/C/WKBase.h: + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: + +2010-07-01 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Sam Weinig. + + * mac/WebKit2.exp: + Added _WKFramePolicyListenerRelease and _WKFramePolicyListenerRetain. + +2010-07-01 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add our event factory for converting Qt events to something WebKit2 + understands. + + * Shared/qt/WebEventFactoryQt.cpp: Added. + (WebKit::mouseButtonForEvent): + (WebKit::webEventTypeForEvent): + (WebKit::modifiersForEvent): + (WebKit::WebEventFactory::createWebMouseEvent): + (WebKit::WebEventFactory::createWebWheelEvent): + (WebKit::WebEventFactory::createWebKeyboardEvent): + * Shared/qt/WebEventFactoryQt.h: Added. + +2010-07-01 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Add UpdateChunk. This one is mmap based, using Qt abstractions. + + * Shared/qt: Added. + * Shared/qt/UpdateChunk.cpp: Added. + (WebKit::MappedMemory::markUsed): + (WebKit::MappedMemory::markFree): + (WebKit::MappedMemory::isFree): + (WebKit::mapMemory): + (WebKit::mapFile): + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::~UpdateChunk): + (WebKit::UpdateChunk::data): + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + (WebKit::UpdateChunk::createImage): + * Shared/qt/UpdateChunk.h: Added. + (WebKit::UpdateChunk::rect): + (WebKit::UpdateChunk::size): + +2010-07-01 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Include some stdlib headers to fix linux build. + + * Platform/CoreIPC/ArgumentDecoder.cpp: + * Platform/CoreIPC/ArgumentEncoder.cpp: + * UIProcess/WebLoaderClient.cpp: + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebUIClient.cpp: + +2010-07-01 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Implement CoreIPC::Connection and PlatformProcessIdentifier for Qt. Not built yet. + + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/qt: Added. + * Platform/CoreIPC/qt/ConnectionQt.cpp: Added. + (CoreIPC::Connection::platformInitialize): + (CoreIPC::Connection::platformInvalidate): + (CoreIPC::Connection::newConnectionHandler): + (CoreIPC::Connection::readyReadHandler): + (CoreIPC::Connection::openConnection): + (CoreIPC::Connection::open): + (CoreIPC::Connection::sendOutgoingMessage): + * Platform/PlatformProcessIdentifier.h: + +2010-07-01 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Implement WorkQueue for Qt. Not built yet. + + * Platform/WorkQueue.h: + * Platform/qt/WorkQueueQt.cpp: Added. + (WorkQueue::WorkItemQt::WorkItemQt): + (WorkQueue::WorkItemQt::~WorkItemQt): + (WorkQueue::WorkItemQt::execute): + (WorkQueue::WorkItemQt::timerEvent): + (WorkQueue::connectSignal): + (WorkQueue::disconnectSignal): + (WorkQueue::platformInitialize): + (WorkQueue::platformInvalidate): + (WorkQueue::scheduleWork): + +2010-07-01 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Initial WebKit2 implementation + https://bugs.webkit.org/show_bug.cgi?id=40233 + + Implement RunLoop for Qt. Not built yet. + + * Platform/RunLoop.h: + * Platform/qt: Added. + * Platform/qt/RunLoopQt.cpp: Added. + (RunLoop::TimerObject::TimerObject): + (RunLoop::TimerObject::performWork): + (RunLoop::TimerObject::wakeUp): + (RunLoop::TimerObject::timerEvent): + (RunLoop::run): + (RunLoop::stop): + (RunLoop::RunLoop): + (RunLoop::~RunLoop): + (RunLoop::wakeUp): + (RunLoop::TimerBase::timerFired): + (RunLoop::TimerBase::TimerBase): + (RunLoop::TimerBase::~TimerBase): + (RunLoop::TimerBase::start): + (RunLoop::TimerBase::stop): + (RunLoop::TimerBase::isActive): + +2010-06-30 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41426 + Add ImmutableArray class and WKArrayRef API to go with it. This will be used + in a few follow up patches. + + * Shared/ImmutableArray.cpp: Added. + (WebKit::ImmutableArray::ImmutableArray): + (WebKit::ImmutableArray::~ImmutableArray): + * Shared/ImmutableArray.h: Added. + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKArray.cpp: Added. + * UIProcess/API/C/WKArray.h: Added. + * UIProcess/API/C/WKBase.h: + * WebKit2.xcodeproj/project.pbxproj: + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add WebProcessProxy::send + https://bugs.webkit.org/show_bug.cgi?id=41416 + + * Platform/CoreIPC/Connection.h: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + (WebKit::ChunkedUpdateDrawingAreaProxy::setSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeWebPage): + (WebKit::WebPageProxy::reinitializeWebPage): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::tryClose): + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::stopLoading): + (WebKit::WebPageProxy::reload): + (WebKit::WebPageProxy::goForward): + (WebKit::WebPageProxy::goBack): + (WebKit::WebPageProxy::setFocused): + (WebKit::WebPageProxy::setActive): + (WebKit::WebPageProxy::mouseEvent): + (WebKit::WebPageProxy::wheelEvent): + (WebKit::WebPageProxy::keyEvent): + (WebKit::WebPageProxy::receivedPolicyDecision): + (WebKit::WebPageProxy::runJavaScriptInMainFrame): + (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): + (WebKit::WebPageProxy::preferencesDidChange): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::WebProcessProxy): + (WebKit::WebProcessProxy::sendMessage): + * UIProcess/WebProcessProxy.h: + (WebKit::WebProcessProxy::connection): + (WebKit::WebProcessProxy::send): + +2010-06-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a private Message class template + https://bugs.webkit.org/show_bug.cgi?id=41370 + + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::Message::Message): + (CoreIPC::Connection::Message::arguments): + +2010-06-28 John Gregg <johnnyg@google.com> + + Unreviewed, build fix (removing merge conflict from previous). + + * Configurations/FeatureDefines.xcconfig: + +2010-06-23 John Gregg <johnnyg@google.com> + + Reviewed by Kent Tamura. + + add ENABLE_DIRECTORY_UPLOAD build support + https://bugs.webkit.org/show_bug.cgi?id=41100 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-28 Sam Weinig <sam@webkit.org> + + Rubber-stamped Geoffrey Garen. + + Add WKBundleFrameIsMainFrame to exports file. + + * mac/WebKit2.exp: + +2010-06-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=41288 + WebKit2: Add frame API for InjectedBundle code + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: Added. + (WKBundleFrameIsMainFrame): + (WKBundleFrameGetURL): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageGetMainFrame): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::isMainFrame): + (WebKit::WebFrame::url): + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::mainFrame): + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-27 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Maciej Stachowiak. + + Update guards related to blocks to check whether __BLOCKS__ is defined, rather than checking its value. + This matches how similar checks are performed in system headers, and avoids a compile error when __BLOCKS__ + is not defined. + + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPagePrivate.h: + +2010-06-26 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add an ENABLE_WEB_TIMING option for enabling Web Timing support. + https://bugs.webkit.org/show_bug.cgi?id=38924 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-25 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * win/WebKit2.vcproj: + +2010-06-25 Ada Chan <adachan@apple.com> + + Rubber-stamped by Mark Rowe. + + Add additional include search paths relative to $(WebKitLibrariesDir) to fix a build. + + * win/WebKit2.vcproj: + +2010-06-25 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WKBundlePageRenderTreeExternalRepresentation really needs to be + WKBundlePageCopyRenderTreeExternalRepresentation so we don't have dangling + pointers and adhere to naming conventions. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCopyRenderTreeExternalRepresentation): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + * mac/WebKit2.exp: + +2010-06-24 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * win/WebKit2.make: Added. + * win/WebKit2.submit.sln: Added. + +2010-06-24 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + * win/WebKit2WebProcess.vcproj: + +2010-06-24 Sam Weinig <sam@webkit.org> + + Reviewed by Brady Eidson. + + Add WKBundlePageRenderTreeExternalRepresentation for WebKitTestRunner. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageRenderTreeExternalRepresentation): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Added. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::renderTreeExternalRepresentation): + (WebKit::WebPage::getRenderTreeExternalRepresentation): + * WebProcess/WebPage/WebPage.h: + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-24 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Ada Chan. + + * mac/WebKit2.exp: + Added _WKNavigationDataRelease and _WKNavigationDataRetain. + +2010-06-24 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * mac/WebKit2.exp: + Added _WKPageReloadFromOrigin. + +2010-06-24 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=41168 + <rdar://problem/8124605> + Webkit2: Add WKPageReloadFromOrigin() to match old-WebKit functionality + + * UIProcess/API/C/WKPage.cpp: + (WKPageReload): + (WKPageReloadFromOrigin): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::reload): + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::reload): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + +2010-06-24 Adam Roben <aroben@apple.com> + + Windows build fix + + Fixes <http://webkit.org/b/41158>. + + Reviewed by Anders Carlsson. + + * Shared/win/UpdateChunk.cpp: Updated header name. + + * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: Added. + (WebKit::PluginInfoStore::pluginDirectories): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + Stubbed these out. + + * win/WebKit2.vcproj: Added UIProcess/Plugins to the include path for + all configurations. Added UIProcess/Plugins files to the project. + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Have the UI process compute the plug-in data + https://bugs.webkit.org/show_bug.cgi?id=41118 + + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: + (WebProcessProxyMessage::): + Add GetPlugin message kind. + + * Shared/WebCoreArgumentCoders.h: + Add argument coders for PluginInfo and MimeClassInfo. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::safeCreateCFString): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::PluginInfoStore::getPluginInfo): + Use safeCreateCFString. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPlugins): + Ask the plug-in info store for the plug-in list. + + (WebKit::WebProcessProxy::didReceiveSyncMessage): + Handle GetPlugins. + + * UIProcess/WebProcessProxy.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::objectContentType): + Implement. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::populatePluginCache): + Send a sync GetPlugins message. + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Add ArgumentCoder for vectors. + + * Platform/CoreIPC/ArgumentCoders.h: + (CoreIPC::): + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Rename WebCoreTypeArgumentMarshalling.h to WebCoreArgumentCoders.h + + * Shared/WebCoreArgumentCoders.h: Copied from Shared/WebCoreTypeArgumentMarshalling.h. + * Shared/WebCoreTypeArgumentMarshalling.h: Removed. + * Shared/WebEvent.h: + * Shared/WebNavigationDataStore.h: + * Shared/WebPreferencesStore.h: + * Shared/mac/UpdateChunk.cpp: + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: + * UIProcess/WebContext.cpp: + * UIProcess/WebPageProxy.cpp: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebProcess.cpp: + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + MessageIDs should always have the most significant bit zeroed out + https://bugs.webkit.org/show_bug.cgi?id=41112 + + The most significant bit is used by the Mac implementation of CoreIPC, and + should always be zero in MessageID objects. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::waitForMessage): + * Platform/CoreIPC/MessageID.h: + (CoreIPC::MessageID::): + (CoreIPC::MessageID::MessageID): + (CoreIPC::MessageID::operator==): + (CoreIPC::MessageID::fromInt): + (CoreIPC::MessageID::isSync): + (CoreIPC::MessageID::stripMostSignificantBit): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + (CoreIPC::createArgumentDecoder): + +2010-06-23 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * mac/WebKit2.exp: + Added yet another symbol needed by Mac clients. + +2010-06-23 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * mac/WebKit2.exp: + Added another symbol needed by Mac clients. + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename SimpleArgumentCoder.h to ArgumentCoders.h + + * Platform/CoreIPC/ArgumentCoders.h: Copied from Platform/CoreIPC/SimpleArgumentCoder.h. + * Platform/CoreIPC/SimpleArgumentCoder.h: Removed. + * Shared/WebCoreTypeArgumentMarshalling.h: + * WebKit2.xcodeproj/project.pbxproj: + +2010-06-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a plug-in info cache to WebPlatformStrategies + https://bugs.webkit.org/show_bug.cgi?id=41087 + + This is in preparation for proxying the getPlugins call over to the UI process. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::WebPlatformStrategies): + (WebKit::WebPlatformStrategies::populatePluginCache): + (WebKit::WebPlatformStrategies::refreshPlugins): + (WebKit::WebPlatformStrategies::getPluginInfo): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + +2010-06-23 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Stop silently ignoring crashes. + + * WebProcess/Launching/mac/WebProcessMain.mm: + +2010-06-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add missing include to WKRetainPtr. + + * UIProcess/API/cpp/WKRetainPtr.h: + +2010-06-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=41073 + WebKit2: Flesh out more of the InjectedBundle client API + + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::willDestroyPage): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/InjectedBundle/InjectedBundlePageClient.cpp: + (WebKit::InjectedBundlePageClient::didStartProvisionalLoadForFrame): + (WebKit::InjectedBundlePageClient::didReceiveServerRedirectForProvisionalLoadForFrame): + (WebKit::InjectedBundlePageClient::didFailProvisionalLoadWithErrorForFrame): + (WebKit::InjectedBundlePageClient::didCommitLoadForFrame): + (WebKit::InjectedBundlePageClient::didFinishLoadForFrame): + (WebKit::InjectedBundlePageClient::didFailLoadWithErrorForFrame): + (WebKit::InjectedBundlePageClient::didReceiveTitleForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageClient.h: + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: + (WebKit::InjectedBundle::load): Add some error logging on failure to load the bundle. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): + (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFailLoad): + (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::close): + * mac/WebKit2.exp: + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a SimpleArgumentCoder class template that works on POD types + https://bugs.webkit.org/show_bug.cgi?id=41023 + + * Platform/CoreIPC/SimpleArgumentCoder.h: Added. + (CoreIPC::SimpleArgumentCoder::encode): + (CoreIPC::SimpleArgumentCoder::decode): + * Shared/WebCoreTypeArgumentMarshalling.h: + (CoreIPC::): + * WebKit2.xcodeproj/project.pbxproj: + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Use the ArgumentCoder class template for decoding + https://bugs.webkit.org/show_bug.cgi?id=41021 + + * Platform/CoreIPC/ArgumentCoder.h: + (CoreIPC::ArgumentCoder::decode): + * Platform/CoreIPC/ArgumentDecoder.h: + (CoreIPC::ArgumentDecoder::decode): + * Shared/WebCoreTypeArgumentMarshalling.h: + (CoreIPC::): + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Change the encode functions to be specializations of a class template + https://bugs.webkit.org/show_bug.cgi?id=41015 + + * Platform/CoreIPC/ArgumentCoder.h: Added. + (CoreIPC::ArgumentCoder::encode): + * Platform/CoreIPC/ArgumentEncoder.h: + (CoreIPC::ArgumentEncoder::encode): + * Shared/WebCoreTypeArgumentMarshalling.h: + (CoreIPC::): + * WebKit2.xcodeproj/project.pbxproj: + +2010-06-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement PluginInfoStore::shouldUsePlugin. + + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + * WebKit2.xcodeproj/project.pbxproj: + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Support reading plug-in info from Carbon resources + https://bugs.webkit.org/show_bug.cgi?id=40959 + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::ResourceMap::ResourceMap): + (WebKit::ResourceMap::~ResourceMap): + (WebKit::ResourceMap::isValid): + (WebKit::getStringListResource): + (WebKit::getPluginInfoFromCarbonResources): + (WebKit::PluginInfoStore::getPluginInfo): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Build fix. + + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: + (WebKit::PluginInfoStore::getPluginInfo): + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Have PluginInfoStoreMac actually get plug-in info and populate the plug-in list + https://bugs.webkit.org/show_bug.cgi?id=40957 + + * UIProcess/Plugins/PluginInfoStore.cpp: + (WebKit::PluginInfoStore::loadPluginsIfNecessary): + (WebKit::PluginInfoStore::loadPluginsInDirectory): + (WebKit::PluginInfoStore::loadPlugin): + (WebKit::PluginInfoStore::getPlugins): + * UIProcess/Plugins/PluginInfoStore.h: + * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: Added. + (WebKit::PluginInfoStore::pluginDirectories): + (WebKit::PluginInfoStore::pluginPathsInDirectory): + (WebKit::getPluginArchitecture): + (WebKit::getPluginInfoFromPropertyLists): + (WebKit::PluginInfoStore::getPluginInfo): + (WebKit::PluginInfoStore::shouldUsePlugin): + * WebKit2.xcodeproj/project.pbxproj: + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add PluginInfoStore class + https://bugs.webkit.org/show_bug.cgi?id=40949 + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::WebPreferencesStore): + * Shared/WebPreferencesStore.h: + (WebKit::WebPreferencesStore::encode): + (WebKit::WebPreferencesStore::decode): + Add plugInsEnabled to the preferences store. + + * UIProcess/Plugins: Added. + * UIProcess/Plugins/PluginInfoStore.cpp: Added. + (WebKit::PluginInfoStore::shared): + (WebKit::PluginInfoStore::PluginInfoStore): + (WebKit::PluginInfoStore::refresh): + (WebKit::PluginInfoStore::getPlugins): + * UIProcess/Plugins/PluginInfoStore.h: Added. + * UIProcess/Plugins/mac: Added. + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::refreshPlugins): + (WebKit::WebPlatformStrategies::getPluginInfo): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2010-06-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Rename DrawingAreaProxyUpdateChunk to ChunkedUpdateDrawingArea + https://bugs.webkit.org/show_bug.cgi?id=40948 + + Rename UIProcess version of DrawingAreaUpdateChunk to ChunkedUpdateDrawingAreaProxy, + and rename the Mac/Win versions of the various DrawingArea files too. + + Also rename the DrawingAreaUpdateChunkType enum to ChunkedUpdateDrawingAreaType. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + * UIProcess/ChunkedUpdateDrawingArea.cpp: Removed. + * UIProcess/ChunkedUpdateDrawingArea.h: Removed. + * UIProcess/ChunkedUpdateDrawingAreaProxy.cpp: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy): + (WebKit::ChunkedUpdateDrawingAreaProxy::~ChunkedUpdateDrawingAreaProxy): + (WebKit::ChunkedUpdateDrawingAreaProxy::paint): + (WebKit::ChunkedUpdateDrawingAreaProxy::setSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingAreaProxy::didSetSize): + (WebKit::ChunkedUpdateDrawingAreaProxy::update): + (WebKit::ChunkedUpdateDrawingAreaProxy::didReceiveMessage): + * UIProcess/ChunkedUpdateDrawingAreaProxy.h: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::encode): + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::): + * UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::page): + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm: Removed. + * UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp: Added. + (WebKit::ChunkedUpdateDrawingAreaProxy::page): + (WebKit::ChunkedUpdateDrawingAreaProxy::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint): + (WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore): + * UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: Removed. + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::~ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::invalidateWindow): + (WebKit::ChunkedUpdateDrawingArea::invalidateContentsAndWindow): + (WebKit::ChunkedUpdateDrawingArea::invalidateContentsForSlowScroll): + (WebKit::ChunkedUpdateDrawingArea::scroll): + (WebKit::ChunkedUpdateDrawingArea::setNeedsDisplay): + (WebKit::ChunkedUpdateDrawingArea::display): + (WebKit::ChunkedUpdateDrawingArea::scheduleDisplay): + (WebKit::ChunkedUpdateDrawingArea::setSize): + (WebKit::ChunkedUpdateDrawingArea::suspendPainting): + (WebKit::ChunkedUpdateDrawingArea::resumePainting): + (WebKit::ChunkedUpdateDrawingArea::didUpdate): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * WebProcess/WebPage/ChunkedUpdateDrawingArea.h: Added. + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::): + * WebProcess/WebPage/DrawingAreaUpdateChunk.cpp: Removed. + * WebProcess/WebPage/DrawingAreaUpdateChunk.h: Removed. + * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunkMac.cpp: Removed. + * WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk): + * WebProcess/WebPage/win/DrawingAreaUpdateChunkWin.cpp: Removed. + * win/WebKit2.vcproj: + +2010-06-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Rename DrawingAreaProxyUpdateChunk to ChunkedUpdateDrawingArea + https://bugs.webkit.org/show_bug.cgi?id=40948 + + Rename DrawingAreaUpdateChunk to ChunkedUpdateDrawingArea. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:pageNamespaceRef:]): + * UIProcess/ChunkedUpdateDrawingArea.cpp: Added. + (WebKit::ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::~ChunkedUpdateDrawingArea): + (WebKit::ChunkedUpdateDrawingArea::paint): + (WebKit::ChunkedUpdateDrawingArea::setSize): + (WebKit::ChunkedUpdateDrawingArea::setPageIsVisible): + (WebKit::ChunkedUpdateDrawingArea::didSetSize): + (WebKit::ChunkedUpdateDrawingArea::update): + (WebKit::ChunkedUpdateDrawingArea::didReceiveMessage): + * UIProcess/ChunkedUpdateDrawingArea.h: Added. + (WebKit::ChunkedUpdateDrawingArea::encode): + * UIProcess/DrawingAreaProxyUpdateChunk.cpp: Removed. + * UIProcess/DrawingAreaProxyUpdateChunk.h: Removed. + * UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm: + (WebKit::ChunkedUpdateDrawingArea::page): + (WebKit::ChunkedUpdateDrawingArea::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingArea::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingArea::platformPaint): + (WebKit::ChunkedUpdateDrawingArea::drawUpdateChunkIntoBackingStore): + * UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: + (WebKit::ChunkedUpdateDrawingArea::page): + (WebKit::ChunkedUpdateDrawingArea::ensureBackingStore): + (WebKit::ChunkedUpdateDrawingArea::invalidateBackingStore): + (WebKit::ChunkedUpdateDrawingArea::platformPaint): + (WebKit::ChunkedUpdateDrawingArea::drawUpdateChunkIntoBackingStore): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-06-21 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=40940 + Add message passing support to the WebKit2 API. + + Adds message passing for both InjectedBundle -> WebContext + and WebContext -> InjectedBundle. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: Added. + (WebProcessProxyMessage::): + (CoreIPC::): + * UIProcess/API/C/WKContext.cpp: + (WKContextSetInjectedBundleClient): + (WKContextPostMessageToInjectedBundle): + * UIProcess/API/C/WKContext.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::initializeInjectedBundleClient): + (WebKit::WebContext::forwardMessageToWebContext): + (WebKit::WebContext::postMessageToInjectedBundle): + * UIProcess/WebContext.h: + * UIProcess/WebContextInjectedBundleClient.cpp: Added. + (WebKit::WebContextInjectedBundleClient::WebContextInjectedBundleClient): + (WebKit::WebContextInjectedBundleClient::initialize): + (WebKit::WebContextInjectedBundleClient::didRecieveMessageFromInjectedBundle): + * UIProcess/WebContextInjectedBundleClient.h: Added. + * UIProcess/WebProcessManager.cpp: + (WebKit::WebProcessManager::processDidClose): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::didReceiveInjectedBundleMessage): + (WebKit::WebProcessProxy::didReceiveMessage): + * UIProcess/WebProcessProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundlePostMessage): + * WebProcess/InjectedBundle/API/c/WKBundle.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::postMessage): + (WebKit::InjectedBundle::didCreatePage): + (WebKit::InjectedBundle::didRecieveMessage): + * WebProcess/InjectedBundle/InjectedBundle.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::loadInjectedBundle): + (WebKit::WebProcess::forwardMessageToInjectedBundle): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make WebKit2 build with clang++ + + * Platform/CoreIPC/Connection.h: + * UIProcess/API/mac/WKView.mm: + (-[WKView keyUp:]): + (-[WKView keyDown:]): + * UIProcess/WebHistoryClient.h: + * UIProcess/WebPageProxy.h: + * WebProcess/WebPage/WebPage.h: + * WebProcess/WebProcess.h: + +2010-06-21 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Speech Input Patch 0: Added compilation argument to conditionally compile pending patches. + + Speech Input Patch 0: Added compilation argument to conditionally compile pending patches. + https://bugs.webkit.org/show_bug.cgi?id=40878 + + * Configurations/FeatureDefines.xcconfig: + +2010-06-20 Jessie Berlin <jberlin@apple.com> + + Reviewed by Dan Bernstein. + + Add #if USE(PLATFORM_STRATEGIES) where WebPlatformStrategies is being used. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + Only initialize the web platform strategies if PLATFORM_STRATEGIES is being used. + +2010-06-19 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=40882 + Add ability to have a WebProcess per WebContext. + + - Move to a one-to-one correspondence of WebContexts to WebProcessProxies. + - Add explicit shared contexts for general use. + - Only non-shared contexts can use injected bundles. + + * UIProcess/API/C/WKContext.cpp: + (WKContextCreate): + (WKContextCreateWithInjectedBundlePath): + (WKContextGetSharedProcessContext): + (WKContextGetSharedThreadContext): + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKContextPrivate.h: + Change API for WKContext to no longer take a WKProcessModel type and instead + have explicit Create/Get functions for the different kind of contexts. Added + two shared contexts, one threaded, one process, and made the threaded on private + for now. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:]): + Make WKViews that don't have an explicit context use the shared process + context by default. + + * UIProcess/Launcher/WebProcessLauncher.h: + * UIProcess/Launcher/mac/WebProcessLauncher.mm: + (WebKit::launchWebProcess): + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + (WebKit::launchWebProcess): + Use a boolean argument to note whether we are using a thread or a process + instead of using the process model enum. + + * UIProcess/ProcessModel.h: + (WebKit::): + Convert to using explicit Shared modifier for shared contexts. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::sharedProcessContext): + (WebKit::WebContext::sharedThreadContext): + (WebKit::WebContext::ensureWebProcess): + (WebKit::WebContext::createWebPage): + (WebKit::WebContext::reviveIfNecessary): + * UIProcess/WebContext.h: + (WebKit::WebContext::create): + (WebKit::WebContext::process): + * UIProcess/WebPageNamespace.cpp: + (WebKit::WebPageNamespace::createWebPage): + (WebKit::WebPageNamespace::preferencesDidChange): + (WebKit::WebPageNamespace::getStatistics): + * UIProcess/WebPageNamespace.h: + (WebKit::WebPageNamespace::process): + (WebKit::WebPageNamespace::reviveIfNecessary): + Move WebProcessProxy creation logic up into WebContext. + + * UIProcess/WebProcessManager.cpp: + (WebKit::WebProcessManager::getWebProcess): + (WebKit::WebProcessManager::processDidClose): + * UIProcess/WebProcessManager.h: + Keep a map of WebContexts to WebProcessProxies in addition to the two + shared processes. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::create): + (WebKit::WebProcessProxy::WebProcessProxy): + (WebKit::WebProcessProxy::connect): + (WebKit::WebProcessProxy::didClose): + * UIProcess/WebProcessProxy.h: + Store a WebContext instead of the process model. + + * mac/WebKit2.exp: + Add new functions. + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Make WebCoreSystemInterface.h a C++ only header + https://bugs.webkit.org/show_bug.cgi?id=40867 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/mac/WebSystemInterface.h: + * WebProcess/WebCoreSupport/mac/WebSystemInterface.m: Removed. + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: Copied from WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.m. + * mac/WebKit2.exp: + +2010-06-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add platform strategies for WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=40863 + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Added. + (WebKit::WebPlatformStrategies::initialize): + (WebKit::WebPlatformStrategies::WebPlatformStrategies): + (WebKit::WebPlatformStrategies::createPluginStrategy): + (WebKit::WebPlatformStrategies::refreshPlugins): + (WebKit::WebPlatformStrategies::getPluginInfo): + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Added. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + +2010-06-18 Sam Weinig <weinig@apple.com> + + Rolling http://trac.webkit.org/changeset/61297 back in. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: Added. + (WKBundlePageSetClient): + (WKBundlePageGetMainFrameURL): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Added. + * WebProcess/InjectedBundle/InjectedBundlePageClient.cpp: Added. + (WebKit::InjectedBundlePageClient::InjectedBundlePageClient): + (WebKit::InjectedBundlePageClient::initialize): + (WebKit::InjectedBundlePageClient::didClearWindowObjectForFrame): + * WebProcess/InjectedBundle/InjectedBundlePageClient.h: Added. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleClient): + (WebKit::WebPage::mainFrameURL): + * WebProcess/WebPage/WebPage.h: + (WebKit::WebPage::injectedBundleClient): + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix a race condition during startup where we would never send the InitializeConnection message to the server. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::open): + +2010-06-17 Ada Chan <adachan@apple.com> + + Rolling out http://trac.webkit.org/changeset/61297 due to build errors. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: Removed. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Removed. + * WebProcess/InjectedBundle/InjectedBundlePageClient.cpp: Removed. + * WebProcess/InjectedBundle/InjectedBundlePageClient.h: Removed. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/WebPage.h: + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + +2010-06-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for <rdar://problem/8010805> + Assertion failure ("mainThreadPthread") in isMainThread() mousing over cnn.com in Mini Browser + + Don't use WebCore::String::operator NSString*() from the UIProcess, since it uses + StringImpl::createCFString() which expects to be called from WebCore's main thread. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::nsStringFromWebCoreString): + (WebKit::PageClientImpl::toolTipChanged): + * UIProcess/API/mac/WKView.mm: + (-[WKView view:stringForToolTip:point:userData:]): + +2010-06-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=40630 + WebKit2: Add mechanism to inject code into the WebProcess on startup + + Add initial InjectedBundle support. + + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: + (WebProcessMessage::): + Add new LoadInjectedBundle message kind. + + * UIProcess/API/C/WKContext.cpp: + (toWK): + (WKContextCreate): + (WKContextCreateWithInjectedBundlePath): + * UIProcess/API/C/WKContext.h: + Rename WKContextCreateWithProcessModel to WKContextCreate and add + WKContextCreateWithInjectedBundlePath for creating a context with + a bundle. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + * UIProcess/WebContext.h: + (WebKit::WebContext::create): + (WebKit::WebContext::processModel): + (WebKit::WebContext::bundlePath): + * UIProcess/WebPageNamespace.cpp: + (WebKit::WebPageNamespace::ensureWebProcess): + (WebKit::WebPageNamespace::reviveIfNecessary): + * UIProcess/WebProcessManager.cpp: + (WebKit::WebProcessManager::getWebProcess): + * UIProcess/WebProcessManager.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::create): + (WebKit::WebProcessProxy::WebProcessProxy): + * UIProcess/WebProcessProxy.h: + Thread the bundle path through process creation. + + * WebProcess/InjectedBundle: Added. + * WebProcess/InjectedBundle/API: Added. + * WebProcess/InjectedBundle/API/c: Added. + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: Added. + (WKBundleSetClient): + * WebProcess/InjectedBundle/API/c/WKBundle.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Added. + (WebKit::): + (toWK): + (toRef): + * WebProcess/InjectedBundle/API/c/WKBundleBase.h: Added. + * WebProcess/InjectedBundle/API/c/WKBundleInitialize.h: Added. + * WebProcess/InjectedBundle/InjectedBundle.cpp: Added. + (WebKit::InjectedBundle::InjectedBundle): + (WebKit::InjectedBundle::~InjectedBundle): + (WebKit::InjectedBundle::initializeClient): + (WebKit::InjectedBundle::didCreatePage): + * WebProcess/InjectedBundle/InjectedBundle.h: Added. + (WebKit::InjectedBundle::create): + Add bundle boilerplate. + + * WebProcess/InjectedBundle/mac: Added. + * WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: Added. + (WebKit::InjectedBundle::load): + Load the InjectedBundle using CFBundle. + + * WebProcess/InjectedBundle/win: Added. + * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: Added. + (WebKit::pathGetFileName): + (WebKit::directoryName): + (WebKit::InjectedBundle::load): + Load the InjectedBundle using HMODULE. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + Add initial bundle callback for page creation. More to come. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::loadInjectedBundle): + (WebKit::WebProcess::didReceiveMessage): + * WebProcess/WebProcess.h: + (WebKit::WebProcess::injectedBundle): + Load the InjectedBundle on LoadInjectedBundle message. + + * WebKit2.xcodeproj/project.pbxproj: + * mac/WebKit2.exp: + * win/WebKit2.vcproj: + * win/WebKit2Generated.make: + Add the new files. + +2010-06-15 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions out of Frame class that were marked "move to Chrome" + https://bugs.webkit.org/show_bug.cgi?id=39636 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::tryClose): Call shouldClose on FrameLoader instead of + going through Frame. + +2010-06-14 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Reorder build event to fix cygwin path issue. + + * win/WebKit2Generated.vcproj: + +2010-06-14 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Add build failure stopping code. + + * win/WebKit2WebProcess.vcproj: + +2010-06-14 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + Add build failure stopping code. + + * win/WebKit2Generated.vcproj: + +2010-06-14 Ada Chan <adachan@apple.com> + + Rubber-stamped by Steve Falkenburg. + + - Fix the release configuration to use release.vsprops. + - Add Debug_Internal and Debug_All configurations to the WebKit2WebProcess project. + - Fix launchWebProcess() to get the right path to the WebKit2WebProcess executable. + + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + (WebKit::launchWebProcess): + * win/WebKit2WebProcess.vcproj: + +2010-06-12 Ada Chan <adachan@apple.com> + + Unreviewed fix for a linking error with WebKit2LocalizableStringsBundle for Windows release build. + + * WebProcess/win/WebLocalizableStrings.cpp: + (findCachedString): + +2010-06-11 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Use -Os for optimized builds instead of -02. -02 wasn't giving the + right trade off at this time. + + * Configurations/Base.xcconfig: + +2010-06-11 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move WKRetain and WKRelease overloaded functions out of WKRetainPtr + and into the files of the type they overload (eg, WKRetain(WKFrameRef + moves to WKFrame.h)). + + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKContext.h: + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKFramePolicyListener.h: + * UIProcess/API/C/WKNavigationData.h: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPageNamespace.h: + * UIProcess/API/C/WKPreferences.h: + * UIProcess/API/C/WKString.h: + * UIProcess/API/C/WKURL.h: + * UIProcess/API/cpp/WKRetainPtr.h: + * UIProcess/API/win/WKView.h: + +2010-06-10 John Sullivan <sullivan@apple.com> + + Reviewed by Dan Bernstein. + + * mac/WebKit2.exp: + Added another symbol needed by Mac clients. + +2010-06-09 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed build fix. + + * WebProcess/WebCoreSupport/WebInspectorClient.h: + +2010-06-09 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed build fix. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebProcess/WebCoreSupport/WebInspectorClient.cpp: + (WebKit::WebInspectorClient::sendMessageToFrontend): + * WebProcess/WebCoreSupport/WebInspectorClient.h: + +2010-06-08 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/8071268> WebKit2 URLs are displayed as 1-character strings in log statements + + Create a CFString from our WebCore string and then create the CFURL from the CFString. + + * UIProcess/API/C/cf/WKURLCF.cpp: + (WKURLCopyCFURL): + +2010-06-08 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + * mac/WebKit2.exp: + Added _WKPageGetEstimatedProgress and _WKFrameGetPage + +2010-06-08 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Would like a way to query WKPageRef for the current progress value + https://bugs.webkit.org/show_bug.cgi?id=40310 + <rdar://problem/8071299> + + Add WKPageGetEstimatedProgress. Remove the progress parameter from the didChangeProgress + loader client callback function. + + * UIProcess/API/C/WKPage.cpp: + (WKPageGetEstimatedProgress): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didChangeProgress): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::didStartProgress): + (WebKit::WebPageProxy::didChangeProgress): + (WebKit::WebPageProxy::didFinishProgress): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::estimatedProgress): + +2010-06-08 Anders Carlsson <andersca@apple.com> + + Reviewed by John Sullivan. + + Would like a way to tell which WKPageRef a WKFrameRef is part of + https://bugs.webkit.org/show_bug.cgi?id=40308 + <rdar://problem/8071251> + + Add and implement WKFrameGetPage. + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetPage): + * UIProcess/API/C/WKFrame.h: + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::page): + +2010-06-08 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Mark Rowe. + + * mac/WebKit2.exp: + Added a few more symbols needed by Mac clients. + +2010-06-08 MORITA Hajime <morrita@google.com> + + Unreviewed. An attempt to fix test break. + + * Configurations/FeatureDefines.xcconfig: + +2010-06-06 MORITA Hajime <morrita@google.com> + + Unreviewd, follow up to r60820 + + https://bugs.webkit.org/show_bug.cgi?id=40219 + [Mac] ENABLE_METER_TAG should be enabled + + * Configurations/FeatureDefines.xcconfig: + +2010-06-05 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Dan Bernstein. + + <rdar://problem/8063622> Failure to launch WebProcess.app when framework is outside of the build directory + + * Configurations/WebProcess.xcconfig: + +2010-06-04 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Ada Chan. + + Added a couple of symbols needed to start using WKFrameRefs in Mac clients. + + * mac/WebKit2.exp: + Added _WKFrameRelease and _WKFrameRetain. + +2010-06-04 Ada Chan <adachan@apple.com> + + Reviewed by Anders Carlsson. + + http://bugs.webkit.org/show_bug.cgi?id=40186 + + Need to close WebPageProxy when the WebView is destroyed. + Also, WebPageProxy shouldn't hold an OwnPtr to the PageClient, which is the WebView on Windows. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::setPageClient): + * UIProcess/WebPageProxy.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::close): + +2010-06-03 Ada Chan <adachan@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=40152 + + Need to remove the WebView from WindowMessageBroadcaster's listeners list when the WebView is destroyed. + + * UIProcess/API/win/WKView.cpp: + (WKViewSetHostWindow): Expose API to change the host window of a WKView. + (WKViewWindowAncestryDidChange): Expose API to allow clients to notify WebKit when a WKView's window ancestry has changed. + * UIProcess/API/win/WKView.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): Set the WebView's host window to 0 when it's destroyed. setHostWindow() will call + windowAncestryDidChange(), which will remove this WebView from the WindowMessageBroadcaster's listeners list. + (WebKit::WebView::WebView): Initialize m_isBeingDestroyed. + (WebKit::WebView::setHostWindow): Update the window's parent window and call windowAncestryDidChange(). + (WebKit::WebView::close): Set the host window to 0. + * UIProcess/win/WebView.h: + +2010-06-04 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Utilize new takeFirst() method where appropriate. + https://bugs.webkit.org/show_bug.cgi?id=40089 + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::removeAttachment): + +2010-06-03 Ada Chan <adachan@apple.com> + + Reviewed by Anders Carlsson. + + Add UIProcess\API\cpp to the list of additional include directories. + Allow WKViewRef to work with WKRetainPtr on Windows. + + * UIProcess/API/cpp/WKRetainPtr.h: + * win/WebKit2.vcproj: + +2010-06-01 Alice Liu <alice.liu@apple.com> + + Build fix. Not reviewed + + * win/WebKit2Generated.make: Added WKRetainPtr.h + +2010-06-01 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + Added _WKRetainPtr to .exp file, and added .exp file to Xcode project. + + * WebKit2.xcodeproj/project.pbxproj: + Added mac/WebKit2.exp. + + * mac/WebKit2.exp: + Added _WKRetainPtr. + +2010-06-01 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Anders Carlsson. + + Fixed typo/wordo that prevented a certain flavor of constructor from compiling. + + * UIProcess/API/cpp/WKRetainPtr.h: + (WebKit::WKRetainPtr::WKRetainPtr): + Changed the mysterious "retainWKPtr" to "WKRetain". + +2010-05-28 John Sullivan <sullivan@apple.com> + + Rubber-stamped by Dan Bernstein. + + Add a using declaration for AdoptWK to match the one just added for WKRetainPtr. + + * UIProcess/API/cpp/WKRetainPtr.h: + +2010-05-28 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add a using declaration for WKRetainPtr matching what we do for our + other smart pointers and fix the destructor. + + * UIProcess/API/cpp/WKRetainPtr.h: + (WebKit::WKRetainPtr::~WKRetainPtr): + +2010-05-25 Ada Chan <adachan@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=39686 + + Fix the ProjectGUID of the WebKit2 project so it doesn't conflict with the one in WebKit. + + * WebKit2.sln: + * win/WebKit2.vcproj: + +2010-05-24 Ada Chan <adachan@apple.com> + + Rubber-stamped by Mark Rowe. + + Build fix for 32bit systems. + + * mac/WebKit2.exp: + +2010-05-21 Mark Rowe <mrowe@apple.com> + + Reviewed by Oliver Hunt. + + Teach WebKit2 to build in the Production configuration. + + * Configurations/Base.xcconfig: Restrict WebKit2 to Intel, and disable the order file. + * Configurations/BaseTarget.xcconfig: Fix the path to the umbrella framework directory. + This path is used to locate WebCore.framework, so it needs to be relative to WebKit.framework + rather than WebKit2.framework. + * Configurations/WebKit2.xcconfig: Update the install path. Add an exports file. + * Configurations/WebProcess.xcconfig: Update the install path. + * WebKit2.xcodeproj/project.pbxproj: Add a Production configuration. + * mac/WebKit2.exp: Added. + +2010-05-21 Steve Block <steveblock@google.com> + + Unreviewed build fix for WebKit2 + + Pass 0 to Page constructor for DeviceOrientationClient. + See http://trac.webkit.org/changeset/59935 + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + +2010-05-11 Mark Rowe <mrowe@apple.com> + + Fix the world. + + In r59162 a change was made to WebCore's FeatureDefines.xcconfig that enabled FILE_READER and FILE_WRITER. + The author and reviewer of that patch ignored the carefully-worded warning at the top of that file asking + that changes to the file be kept in sync across JavaScriptCore, WebCore and WebKit, as well as being kept + in sync with build-webkit. This led to WebCore and WebKit having different views of Document's vtable + and results in crashes in Safari shortly after launch when virtual function calls resulted in the wrong + function in WebCore being called. + + We fix this by bringing the FeatureDefines.xcconfig files in to sync. Based on the ChangeLog message and + other changes in r59162 it appears that enabling FILE_WRITER was unintentional so that particular change + has been reverted. + + * Configurations/FeatureDefines.xcconfig: + +2010-05-04 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + [WebKit2] The web process doesn't need to paint when the web view is hidden. + https://bugs.webkit.org/show_bug.cgi?id=38549 + + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + (DrawingAreaMessage::): + Add SuspendPainting/ResumePainting messages. + + * UIProcess/DrawingAreaProxyUpdateChunk.cpp: + (WebKit::DrawingAreaProxyUpdateChunk::setPageIsVisible): + Suspend and resume painting accordingly. + + * WebProcess/WebPage/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk): + Initialize m_shouldPaint to true. + + (WebKit::DrawingAreaUpdateChunk::display): + Return if m_shouldPaint is false. + + (WebKit::DrawingAreaUpdateChunk::scheduleDisplay): + Ditto. + + (WebKit::DrawingAreaUpdateChunk::setSize): + Assert that we should paint here. + + (WebKit::DrawingAreaUpdateChunk::suspendPainting): + Set m_shouldPaint to false and stop the timer. + + (WebKit::DrawingAreaUpdateChunk::resumePainting): + Set m_shouldPaint to true and paint if needed. + + (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): + handle SuspendPainting/ResumePainting messages. + + * WebProcess/WebPage/DrawingAreaUpdateChunk.h: + +2010-05-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Jon Honeycutt. + + [WebKit2] WKView should respond to WM_SHOWWINDOW messages + https://bugs.webkit.org/show_bug.cgi?id=38496 + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::wndProc): + Add case for WM_SHOWWINDOW. + + (WebKit::WebView::onShowWindowEvent): + Update the page visibility accordingly. + + * UIProcess/win/WebView.h: + +2010-05-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Dan Bernstein. + + Get rid of PageClient::isPageVisible and pass visibility directly in setPageIsVisible + https://bugs.webkit.org/show_bug.cgi?id=38493 + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + Remove isPageVisible. + + * UIProcess/API/mac/WKView.mm: + (isViewVisible): + New function (moved here from PageClientImpl). + + (-[WKView _updateVisibility]): + Call didChangeVisibility. + + (-[WKView viewDidMoveToWindow]): + (-[WKView viewDidHide]): + (-[WKView viewDidUnhide]): + Call _updateVisibility. + + * UIProcess/DrawingAreaProxy.h: + Rename didChangeVisibility to setPageIsVisible and add an isVisible parameter. + + * UIProcess/DrawingAreaProxyUpdateChunk.cpp: + (WebKit::DrawingAreaProxyUpdateChunk::setPageIsVisible): + Don't call WebPageProxy::isVisible. + + * UIProcess/DrawingAreaProxyUpdateChunk.h: + + * UIProcess/PageClient.h: + Remove isPageVisible. + + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + Remove isVisible. + +2010-05-03 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Implement PageClient::isPageVisible on Windows. + https://bugs.webkit.org/show_bug.cgi?id=38483 + + * UIProcess/PageClient.h: + * UIProcess/win/WebView.cpp: + (WebKit::WebView::isPageVisible): + * UIProcess/win/WebView.h: + +2010-05-03 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * Platform/CoreIPC/win/ConnectionWin.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + * Shared/win/UpdateChunk.cpp: + (WebKit::UpdateChunk::UpdateChunk): + (WebKit::UpdateChunk::encode): + (WebKit::UpdateChunk::decode): + * Shared/win/UpdateChunk.h: + (WebKit::UpdateChunk::rect): + * UIProcess/DrawingAreaProxy.h: + * UIProcess/DrawingAreaProxyUpdateChunk.h: + * UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: + (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): + * WebProcess/WebPage/win/DrawingAreaUpdateChunkWin.cpp: + (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): + * WebProcess/win/WebProcessMain.cpp: + +2010-04-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=38415 + Have the WKView notify the DrawingAreaProxy when its visibility changes. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::isPageVisible): + * UIProcess/API/mac/WKView.mm: + (-[WKView viewDidMoveToWindow]): + (-[WKView viewDidHide]): + (-[WKView viewDidUnhide]): + * UIProcess/DrawingAreaProxy.h: + * UIProcess/DrawingAreaProxyUpdateChunk.cpp: + (WebKit::DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk): + (WebKit::DrawingAreaProxyUpdateChunk::didChangeVisibility): + * UIProcess/DrawingAreaProxyUpdateChunk.h: + * UIProcess/PageClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::isVisible): + * UIProcess/WebPageProxy.h: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent): + +2010-05-01 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38471 + Add generic callback mechanism + + Added GenericCallback class replacing RenderTreeExternalRepresentationCallback + and ScriptReturnValueCallback. + + Also, + - Standardize C API callbacks to take the context last. + - Standardize C API callbacks to not have the _f suffix (now the block + variants have a _b suffix). + - Re-write toWK and toRef methods as a set of template functions using + the generic API->implementation mapping information. + + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKPage.cpp: + (WKPageRunJavaScriptInMainFrame): + (callRunJavaScriptBlockAndRelease): + (disposeRunJavaScriptBlock): + (WKPageRunJavaScriptInMainFrame_b): + (WKPageRenderTreeExternalRepresentation): + (WKPageRenderTreeExternalRepresentation_b): + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WKPagePrivate.h: + * UIProcess/GenericCallback.h: Added. + (WebKit::GenericCallback::create): + (WebKit::GenericCallback::~GenericCallback): + (WebKit::GenericCallback::performCallbackWithReturnValue): + (WebKit::GenericCallback::invalidate): + (WebKit::GenericCallback::callbackID): + (WebKit::GenericCallback::generateCallbackID): + (WebKit::GenericCallback::GenericCallback): + * UIProcess/RenderTreeExternalRepresentationCallback.cpp: Removed. + * UIProcess/RenderTreeExternalRepresentationCallback.h: Removed. + * UIProcess/ScriptReturnValueCallback.cpp: Removed. + * UIProcess/ScriptReturnValueCallback.h: Removed. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didRunJavaScriptInMainFrame): + (WebKit::WebPageProxy::didGetRenderTreeExternalRepresentation): + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-04-30 Sam Weinig <sam@webkit.org> + + Fix the build. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: Add missing #include. + +2010-04-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=38413 + Add callback based API to get the textual representation of the RenderTree. + + - Also ensures that any pending callbacks are invalidated if the WebPage + closes (expectedly or unexpectedly). + - A follow up patch will unify the callback mechanism with a common base + class. + + * Shared/CoreIPCSupport/WebPageMessageKinds.h: + (WebPageMessage::): + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * UIProcess/API/C/WKPage.cpp: + (WKPageRunJavaScriptInMainFrame_f): + (WKPageRenderTreeExternalRepresentation_f): + (callRenderTreeExternalRepresentationBlockAndDispose): + (disposeRenderTreeExternalRepresentationBlock): + (WKPageRenderTreeExternalRepresentation): + * UIProcess/API/C/WKPagePrivate.h: Added. + * UIProcess/RenderTreeExternalRepresentationCallback.cpp: Added. + (WebKit::generateCallbackID): + (WebKit::RenderTreeExternalRepresentationCallback::RenderTreeExternalRepresentationCallback): + (WebKit::RenderTreeExternalRepresentationCallback::~RenderTreeExternalRepresentationCallback): + (WebKit::RenderTreeExternalRepresentationCallback::performCallbackWithReturnValue): + (WebKit::RenderTreeExternalRepresentationCallback::invalidate): + * UIProcess/RenderTreeExternalRepresentationCallback.h: Added. + (WebKit::RenderTreeExternalRepresentationCallback::create): + (WebKit::RenderTreeExternalRepresentationCallback::callbackID): + * UIProcess/ScriptReturnValueCallback.cpp: + (WebKit::ScriptReturnValueCallback::~ScriptReturnValueCallback): + (WebKit::ScriptReturnValueCallback::performCallbackWithReturnValue): + (WebKit::ScriptReturnValueCallback::invalidate): + * UIProcess/ScriptReturnValueCallback.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didRunJavaScriptInMainFrame): + (WebKit::WebPageProxy::didGetRenderTreeExternalRepresentation): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getRenderTreeExternalRepresentation): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: + * win/WebKit2.vcproj: + +2010-04-30 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38406 + Add support for sending messages with a size greater than 4096 bytes + + Adds support by putting message bodies that are larger than 4096 bytes + in OOL memory. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + (CoreIPC::Connection::waitForMessage): + (CoreIPC::Connection::sendSyncMessage): + (CoreIPC::Connection::dispatchMessages): + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::OutgoingMessage::OutgoingMessage): + (CoreIPC::Connection::OutgoingMessage::messageID): + (CoreIPC::Connection::send): + (CoreIPC::Connection::sendSync): + * Platform/CoreIPC/MessageID.h: + (CoreIPC::MessageID::): + (CoreIPC::MessageID::MessageID): + (CoreIPC::MessageID::equalIgnoringFlags): + (CoreIPC::MessageID::copyAddingFlags): + (CoreIPC::MessageID::fromInt): + (CoreIPC::MessageID::toInt): + (CoreIPC::MessageID::isMessageBodyOOL): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + (CoreIPC::createArgumentDecoder): + +2010-04-28 Mike Thole <mthole@apple.com> + + Build fix, not reviewed. + + Fix WebKit2 build by stubbing out WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(). + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-04-28 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Only build on SnowLeopard and later when using the Makefile. + + * Makefile: + +2010-04-27 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38238 + Allow both WebKit and WebKit2 to link to the same WebCore.framework + + * Configurations/WebKit2.xcconfig: Remove the OTHER_LDFLAGS. We don't + need to set WebCore as a sub_umbrella of WebKit2, since we are not + reexporting any of its symbols. + +2010-04-27 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey Garen. + + Add comment about not using StringImpl::createCFString in WKStringCopyCFString. + + * UIProcess/API/C/cf/WKStringCF.cpp: + (WKStringCopyCFString): + +2010-04-27 Sam Weinig <sam@webkit.org> + + Reviewed by Geoffrey Garen. + + Remove call to StringImpl::createCFString and instead use CFStringCreateWithCharacters + directly. StringImpl::createCFString only an optimization when called + from the thread that WebCore is running on, which is never the case for + WKStringCopyCFString. We should revisit this later, perhaps adding a + threadspecific allocator. We also now honor the passed in allocator. + + * UIProcess/API/C/cf/WKStringCF.cpp: + (WKStringCopyCFString): + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * UIProcess/Launcher/mac/WebProcessLauncher.mm: + (WebKit::webThreadBody): Add call to initializeMainThread. + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + (WebKit::webThreadBody): Ditto. + * WebProcess/Launching/mac/WebProcessMain.mm: + (main): Ditto. + * WebProcess/win/WebProcessMain.cpp: + (WebKit::WebProcessMain): Ditto. + +2010-04-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=38065 + Merge mac and win DrawingAreaProxyUpdateChunk implementations. + + * UIProcess/API/mac/WKView.mm: + (-[WKView drawRect:]): + * UIProcess/DrawingAreaProxy.cpp: Copied from UIProcess/mac/DrawingAreaProxy.mm. + * UIProcess/DrawingAreaProxy.h: Copied from UIProcess/mac/DrawingAreaProxy.h. + * UIProcess/DrawingAreaProxyUpdateChunk.cpp: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm. + (WebKit::DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk): + (WebKit::DrawingAreaProxyUpdateChunk::paint): + (WebKit::DrawingAreaProxyUpdateChunk::setSize): + (WebKit::DrawingAreaProxyUpdateChunk::didSetSize): + (WebKit::DrawingAreaProxyUpdateChunk::update): + (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage): + * UIProcess/DrawingAreaProxyUpdateChunk.h: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.h. + * UIProcess/mac/DrawingAreaProxy.h: Removed. + * UIProcess/mac/DrawingAreaProxy.mm: Removed. + * UIProcess/mac/DrawingAreaProxyUpdateChunk.h: Removed. + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: Removed. + * UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm. + (WebKit::DrawingAreaProxyUpdateChunk::page): + (WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore): + (WebKit::DrawingAreaProxyUpdateChunk::platformPaint): + (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): + * UIProcess/win/DrawingAreaProxy.cpp: Removed. + * UIProcess/win/DrawingAreaProxy.h: Removed. + * UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: Copied from UIProcess/win/DrawingAreaProxy.cpp. + (WebKit::DrawingAreaProxyUpdateChunk::page): + (WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore): + (WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore): + (WebKit::DrawingAreaProxyUpdateChunk::platformPaint): + (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): + * UIProcess/win/WebView.cpp: + (WebKit::WebView::WebView): + (WebKit::WebView::onPaintEvent): + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-04-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38059 + Merge mac and win DrawingAreaUpdateChunk implementations. + + * UIProcess/win/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::didSetSize): + (WebKit::DrawingAreaProxy::didReceiveMessage): + * UIProcess/win/DrawingAreaProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebPage/DrawingAreaUpdateChunk.cpp: Copied from WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp. + (WebKit::DrawingAreaUpdateChunk::setSize): + * WebProcess/WebPage/DrawingAreaUpdateChunk.h: Copied from WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h. + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: Removed. + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h: Removed. + * WebProcess/WebPage/mac/DrawingAreaUpdateChunkMac.cpp: Copied from WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp. + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: Removed. + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.h: Removed. + * WebProcess/WebPage/win/DrawingAreaUpdateChunkWin.cpp: Copied from WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp. + (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): + * win/WebKit2.vcproj: + +2010-04-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove an assert. (It's not valid when resizing). + + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::didUpdate): + +2010-04-23 Anders Carlsson <andersca@apple.com> + + Fix build. + + * UIProcess/win/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::paint): + (WebKit::DrawingAreaProxy::setSize): + (WebKit::DrawingAreaProxy::didReceiveMessage): + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::setSize): + (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): + +2010-04-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove an assert. (It's not valid when resizing). + + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::didUpdate): + +2010-04-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Merge the prefix headers. + + * Configurations/BaseTarget.xcconfig: + * WebKit2.xcodeproj/project.pbxproj: + * WebKit2Prefix.h: + * WebKit2_Prefix.pch: Removed. + +2010-04-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't pass the new size when calling didSetSize, it's possible to get + the size from the update chunk. + + * UIProcess/mac/DrawingAreaProxyUpdateChunk.h: + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: + (WebKit::DrawingAreaProxyUpdateChunk::didSetSize): + (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::setSize): + +2010-04-22 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Rename SetFrame and DidSetFrame to SetSize and DidSetSize. + + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + (DrawingAreaMessage::): + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: + (DrawingAreaProxyMessage::): + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: + (WebKit::DrawingAreaProxyUpdateChunk::drawRectIntoContext): + (WebKit::DrawingAreaProxyUpdateChunk::setSize): + (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::setSize): + (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): + +2010-04-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38002 + Add rudimentary statistics gathering for WebKit2 + + * UIProcess/API/C/WKContext.cpp: + (WKContextGetStatistics): + * UIProcess/API/C/WKContextPrivate.h: Copied from WebKit2/UIProcess/API/C/WKContext.h. + * UIProcess/API/C/WKPageNamespace.cpp: + (WKPageNamespaceGetContext): + * UIProcess/API/C/WKPageNamespace.h: + * UIProcess/WebContext.cpp: + (WebKit::WebContext::getStatistics): + * UIProcess/WebContext.h: + * UIProcess/WebPageNamespace.cpp: + (WebKit::WebPageNamespace::getStatistics): + * UIProcess/WebPageNamespace.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::getStatistics): + * UIProcess/WebPageProxy.h: + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::numberOfPages): + * UIProcess/WebProcessProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-04-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't paint the web page before we've blit the last update chunk to the backing store. + + * UIProcess/win/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::update): + (WebKit::DrawingAreaProxy::didReceiveMessage): + * UIProcess/win/DrawingAreaProxy.h: + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk): + (WebKit::DrawingAreaUpdateChunk::display): + (WebKit::DrawingAreaUpdateChunk::scheduleDisplay): + (WebKit::DrawingAreaUpdateChunk::setSize): + (WebKit::DrawingAreaUpdateChunk::didUpdate): + (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.h: + +2010-04-20 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::receivedData): + +2010-04-20 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Don't paint the web page before we've blit the last update chunk to the backing store + https://bugs.webkit.org/show_bug.cgi?id=37896 + + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: + (DrawingAreaMessage::): + * UIProcess/mac/DrawingAreaProxyUpdateChunk.h: + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: + (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): + (WebKit::DrawingAreaProxyUpdateChunk::update): + (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk): + (WebKit::DrawingAreaUpdateChunk::display): + (WebKit::DrawingAreaUpdateChunk::scheduleDisplay): + (WebKit::DrawingAreaUpdateChunk::setSize): + (WebKit::DrawingAreaUpdateChunk::didUpdate): + (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h: + +2010-04-20 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::chooseIconForFiles): + * WebProcess/WebCoreSupport/WebChromeClient.h: + +2010-04-19 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidChangeIcons): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + +2010-04-17 Sam Weinig <weinig@apple.com> + + Reviewed by Jon "The Belly" Honeycutt. + + Remove the need for a .defs file! Define WK_EXPORT. + + * UIProcess/API/C/WKBase.h: + * WebProcess/win/WebProcessMain.h: + * win/WebKit2.def: Removed. + * win/WebKit2.vcproj: + +2010-04-17 Sam Weinig <weinig@apple.com> + + Reviewed by Adam Roben. + + Teach windows MiniBrowser how to work with window.open() + and targeted links. + + Export WKPageSetPageUIClient. + + * win/WebKit2.def: + +2010-04-16 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix window.open() and targeted links. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveSyncMessage): Pass in the new pageID + instead of 0. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::createWebPage): Allow for the page to have already + been created, as is the case with programmatic window opening from within + WebCore (e.g. window.open() or <a target="_blank">). + +2010-04-16 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + Don't optimize debug builds. + + * WebKit2.xcodeproj/project.pbxproj: Define GCC_OPTIMIZATION_LEVEL correctly. + +2010-04-16 Anders Carlsson <andersca@apple.com> + + Fix build. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::runJavaScriptInMainFrame): + +2010-04-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix windows build. + + * Platform/win/RunLoopWin.cpp: + (RunLoop::run): + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + (WebKit::webThreadBody): + (WebKit::launchWebProcess): + * WebProcess/win/WebProcessMain.cpp: + (WebKit::WebProcessMain): + +2010-04-16 Sam Weinig <weinig@apple.com> + + Reviewed by Anders Carlsson. + + Make resizing responsive on Windows. + + - Use the same waitFor logic as do for the Mac resizing + DrawingAreaUpdateChunk code. + + * Shared/win/UpdateChunk.cpp: + (WebKit::UpdateChunk::UpdateChunk): + * Shared/win/UpdateChunk.h: + Add a constructor that only takes an IntRect and allocates + the shared memory mapping for you. + * UIProcess/win/DrawingAreaProxy.cpp: + (WebKit::DrawingAreaProxy::DrawingAreaProxy): + (WebKit::DrawingAreaProxy::ensureBackingStore): + (WebKit::DrawingAreaProxy::paint): + (WebKit::DrawingAreaProxy::drawUpdateChunkIntoBackingStore): + (WebKit::DrawingAreaProxy::setSize): + (WebKit::DrawingAreaProxy::didSetSize): + (WebKit::DrawingAreaProxy::didReceiveMessage): + * UIProcess/win/DrawingAreaProxy.h: + Perform wait in paint as we do on the mac. + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::onSizeEvent): + Change to use an IntSize. + + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): + (WebKit::DrawingAreaUpdateChunk::display): + (WebKit::DrawingAreaUpdateChunk::setSize): + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.h: + Specialize setSize() drawing and factor out painting + into a helper function. + +2010-04-16 Anders Carlsson <andersca@apple.com> + + Reviewed by David Hyatt. + + Make run loops be allocated as thread specific data. + https://bugs.webkit.org/show_bug.cgi?id=37723 + + * Platform/RunLoop.cpp: + (RunLoop::initializeMainRunLoop): + (RunLoop::current): + (RunLoop::main): + * Platform/RunLoop.h: + * Platform/mac/RunLoopMac.mm: + (RunLoop::run): + (RunLoop::stop): + * UIProcess/Launcher/mac/WebProcessLauncher.mm: + (WebKit::webThreadBody): + (WebKit::launchWebProcess): + * UIProcess/ResponsivenessTimer.cpp: + (WebKit::ResponsivenessTimer::ResponsivenessTimer): + * WebProcess/Launching/mac/WebProcessMain.mm: + (main): + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::isSeparateProcess): + +2010-04-16 Sam Weinig <weinig@apple.com> + + Reviewed by Adam Roben. + + Use GDI text rendering on Windows by default. + + * WebProcess/WebPage/win/WebPageWin.cpp: + (WebKit::WebPage::platformInitialize): Use the AlternateRenderingMode + setting. + +2010-04-16 Sam Weinig <weinig@apple.com> + + Reviewed by Adam Roben. + + Fix crash when trying to load an invalid URL. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadURL): Use constructor for ResourceRequest + that takes a KURL instead of the one that takes a String. The one + that takes a string expects a valid URL. + +2010-04-16 Sam Weinig <weinig@apple.com> + + Reviewed by Adam Roben. + + Make tooltips work. Thanks Adam! + + * UIProcess/win/WebView.cpp: + (WebKit::WebView::toolTipChanged): Pass the WebView's HWND, not the tooltip's. + +2010-04-15 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Fix build dependencies. + + * WebKit2.sln: + +2010-04-15 Adam Roben <aroben@apple.com> + + Fix Windows WebKit2 build. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::processDidExit): + * win/WebKit2Generated.make: + +2010-04-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WebHistoryClient support. + https://bugs.webkit.org/show_bug.cgi?id=37671 + + Adds the following callbacks: + didNavigateWithNavigationData + didPerformClientRedirect + didPerformServerRedirect + didUpdateHistoryTitle + + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: + (WebPageProxyMessage::): + * Shared/WebNavigationDataStore.h: Added. + * UIProcess/API/C/WKAPICast.h: + * UIProcess/API/C/WKBase.h: + * UIProcess/API/C/WKNavigationData.cpp: Added. + * UIProcess/API/C/WKNavigationData.h: Added. + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + * UIProcess/API/C/WebKit2.h: + * UIProcess/WebHistoryClient.cpp: Copied from UIProcess/WebUIClient.cpp. + * UIProcess/WebHistoryClient.h: Copied from UIProcess/WebUIClient.h. + * UIProcess/WebNavigationData.cpp: Added. + * UIProcess/WebNavigationData.h: Added. + * UIProcess/WebPageProxy.cpp: + * UIProcess/WebPageProxy.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * win/WebKit2.vcproj: + +2010-04-15 Sam Weinig <sam@webkit.org> + + Reviewed by Adam Roben. + + Remove empty file configurations. + + * win/WebKit2.vcproj: + +2010-04-15 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix WebKit2s build. Don't return temporaries. + + * UIProcess/API/C/cf/WKStringCF.cpp: + (WKStringCreateWithCFString): + * UIProcess/API/C/cf/WKURLCF.cpp: + (WKURLCreateWithCFURL): + (WKURLCopyCFURL): + +2010-04-12 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Anders Carlsson. + + Fixed complexity and performance FIXME created by using KURL in the UI + process -- it turned out that everywhere we were using KURL, we could + have just used String instead. (That's how Windows WebKit works, too.) + + I kept WKURLRef and WKStringRef distinct opaque types in the API for now, + though, since there may be profit in changing their backing stores in the + future, and it's nice for the API to encode a difference between generic + strings and strings that are valid, canonical URLs. + + * Shared/KURLWrapper.h: Removed. Yay! + + * Shared/WebCoreTypeArgumentMarshalling.h: Nixed KURL marshalling functions. + Old callers marshal Strings now, instead. (This is what KURL was doing + under the covers, anyway.) + + * UIProcess/API/C/WKAPICast.h: + (toWK): Backed by StringImpl* now. + (toURLRef): Added a disambiguating function for specifying that you want + a WKURLRef, since StringImpl* converts to WKStringRef by default. + + * UIProcess/API/C/WKFrame.cpp: + (WKFrameGetProvisionalURL): + (WKFrameGetURL): + * UIProcess/API/C/WKPage.cpp: + (WKPageLoadURL): + * UIProcess/API/C/WKURL.cpp: + * UIProcess/API/C/cf/WKURLCF.cpp: + (WKURLCreateWithCFURL): + (WKURLCopyCFURL): + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didStartProvisionalLoad): + (WebKit::WebFrameProxy::didCommitLoad): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::url): + (WebKit::WebFrameProxy::provisionalURL): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::loadURL): + (WebKit::WebPageProxy::didReceiveMessage): + (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + (WebKit::WebPageProxy::decidePolicyForMIMEType): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::urlAtProcessExit): + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + (WebKit::WebPolicyClient::decidePolicyForMIMEType): + * UIProcess/WebPolicyClient.h: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::loadURL): + (WebKit::WebPage::didReceiveMessage): + * WebProcess/WebPage/WebPage.h: Replaced KURL / KURLWrapper with String. + +2010-04-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix horizontal scrollbar repainting + https://bugs.webkit.org/show_bug.cgi?id=37626 + + Make sure that the update chunk is flipped because that's what WebCore expects. + + * Shared/mac/UpdateChunk.cpp: + (WebKit::UpdateChunk::createImage): + * Shared/mac/UpdateChunk.h: + Add new createImage member function that creates a CGImageRef from the update chunk. + + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: + (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): + Pass the right rectangle here; CoreGraphics wants it in non-flipped coordinates. + + (WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore): + Create a flipped backing store. + + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): + Flip the update chunk. + +2010-04-14 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add WKRetainPtr helper class as private header + https://bugs.webkit.org/show_bug.cgi?id=37603 + + WKRetainPtr is just like RetainPtr, but works for WK types instead of + CF/NS types. + + * UIProcess/API/cpp: Added. + * UIProcess/API/cpp/WKRetainPtr.h: Added. + * WebKit2.xcodeproj/project.pbxproj: Add new file. + * win/WebKit2.vcproj: Ditto. + +2010-04-14 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Make the WebProcess a LSUIElement to suppress its icon from the Dock. + + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess/Info.plist: + +2010-04-14 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Factor code to paint into an update chunk out into a separate function. + https://bugs.webkit.org/show_bug.cgi?id=37594 + + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): + (WebKit::DrawingAreaUpdateChunk::display): + (WebKit::DrawingAreaUpdateChunk::setSize): + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h: + +2010-04-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix reported leaks when quitting MiniBrowser with open pages. + + * WebProcess/WebPage/WebPage.h: Make close() public. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::WebProcess): + (WebKit::WebProcess::removeWebPage): + (WebKit::WebProcess::didClose): If the UIProcess disappears, close + the live pages in an effort to not leak. + * WebProcess/WebProcess.h: + +2010-04-13 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Do a JS collection and clear the memory cache to improve leaks output + when exiting. Only do this in debug builds as it is slow. + + * UIProcess/API/mac/WKView.h: + * UIProcess/WebProcessProxy.cpp: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::shutdown): + (WebKit::WebProcess::didClose): + +2010-04-13 Sam Weinig <sam@webkit.org> + + Reviewed by Adele Peterson. + + Post a null event after calling [NSApp stop] to flush the run loop + and finish teardown. + + * Platform/mac/RunLoopMac.mm: + (RunLoop::stop): + +2010-04-12 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add #ifdef so that WKView is not included on the mac if not + compiling objective-c. + + * UIProcess/API/C/WebKit2.h: + +2010-04-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Add WebKit2 solution file. + + * WebKit2.sln: Added. + +2010-04-11 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=37417 + Move duplicated internal CoreIPC message kinds to a + header. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::processIncomingMessage): + * Platform/CoreIPC/CoreIPCMessageKinds.h: Added. + (CoreIPC::CoreIPCMessage::): + (CoreIPC::): + * Platform/CoreIPC/mac/ConnectionMac.cpp: + * WebKit2.xcodeproj/project.pbxproj: + * win/WebKit2.vcproj: + +2010-04-11 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Anders Carlsson. + + Disable not-implemented warnings by default for now. + + * Shared/NotImplemented.h: + +2010-04-10 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=37399 + Remove use of STL data structures from CoreIPC code + + * Platform/CoreIPC/ArgumentDecoder.cpp: + (CoreIPC::ArgumentDecoder::ArgumentDecoder): + (CoreIPC::ArgumentDecoder::decodeBytes): + (CoreIPC::ArgumentDecoder::removeAttachment): + * Platform/CoreIPC/ArgumentDecoder.h: + Use WTF::Deque instead of std::queue and WTF::Vector + instead of std::vector. Replace use of malloc/free with + fastMalloc/fastFree. + + * Platform/CoreIPC/ArgumentEncoder.cpp: + (CoreIPC::ArgumentEncoder::addAttachment): + (CoreIPC::ArgumentEncoder::releaseAttachments): + * Platform/CoreIPC/ArgumentEncoder.h: + Use WTF::Vector instead of std::list. Replace use of malloc/free + with fastMalloc/fastFree. + + * Platform/CoreIPC/Connection.cpp: + (CoreIPC::Connection::sendMessage): + (CoreIPC::Connection::waitForMessage): + (CoreIPC::Connection::processIncomingMessage): + (CoreIPC::Connection::sendOutgoingMessages): + (CoreIPC::Connection::dispatchMessages): + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::sendOutgoingMessage): + (CoreIPC::createArgumentDecoder): + Use WTF::Vector instead of std::queue. + + * Platform/RunLoop.cpp: + (RunLoop::performWork): + (RunLoop::scheduleWork): + * Platform/RunLoop.h: + Ditto. + + * Platform/WorkQueue.h: + * Platform/win/WorkQueueWin.cpp: + (WorkQueue::scheduleWork): + (WorkQueue::performWork): + Ditto. + +2010-04-10 Mark Rowe <mrowe@apple.com> + + Fix an obviously incorrect part of the Xcode configuration cleanup that resulted in debug builds + asserting shortly after launch. + + * WebKit2.xcodeproj/project.pbxproj: Fix the setting of DEBUG_DEFINES for the Debug configuration. + +2010-04-09 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Bring the WebKit2 Xcode configuration in to sync with recent changes to the WebKit Xcode configuration files. + + In particular, this updates the FEATURE_DEFINES to match those used in the other projects, and brings in + the changes to support building WebKit for older Mac OS X versions from the current Mac OS X version. + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/Version.xcconfig: + +2010-04-09 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Clean up the Xcode project configuration. + + Common target settings are pulled out in to BaseTarget.xcconfig. The majority of setting overrides are + removed from the Xcode project itself. Info.plist files are updated to match those used in other frameworks. + + * Configurations/BaseTarget.xcconfig: Copied from WebKit2/Configurations/WebKit2.xcconfig. + * Configurations/WebKit2.xcconfig: + * Configurations/WebProcess.xcconfig: Copied from WebKit2/Configurations/WebKit2.xcconfig. + * Info.plist: + * WebKit2.xcodeproj/project.pbxproj: + * WebProcess-Info.plist: Removed. + * WebProcess/Info.plist: Moved from WebProcess-Info.plist. + +2010-04-09 Mark Rowe <mrowe@apple.com> + + Build fix. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.m: + (InitWebCoreSystemInterface): Update for recent WKSI changes. + +2010-04-09 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=37351 + Cannot build with build-webkit --webkit2 + + Add some headers that it seems others are not getting + already. + + * Platform/mac/WorkQueueMac.cpp: #inlude <mach/mach_port.h> + * Shared/mac/UpdateChunk.cpp: #inlude <mach/vm_map.h> + +2010-04-09 Anders Carlsson <andersca@apple.com> + + More build fixes. + + * WebProcess/win/WebProcessMain.h: + Include windows.h here. + + * win/WebKit2.def: + Add new exports. + + * win/WebKit2.vcproj: + Add new files. + +2010-04-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add new WKString.h and WKURL.h headers to top + level include. + + * UIProcess/API/C/WebKit2.h: + +2010-04-09 Anders Carlsson <andersca@apple.com> + + More Windows build fixes. + + * Shared/NotImplemented.h: + * UIProcess/API/C/cf/WKURLCF.cpp: + Fix typo. + + (WKURLCreateWithCFURL): + * UIProcess/API/C/cf/WKURLCF.h: + Ditto. + + * win/WebKit2Generated.make: + Copy the new CF headers. + +2010-04-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Two more #include sorting issues. + + * Shared/NotImplemented.h: + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: + +2010-04-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix minor style nits found by the style-script. + + * Platform/CoreIPC/ArgumentDecoder.h: + * Platform/CoreIPC/ArgumentEncoder.cpp: + * Platform/CoreIPC/Attachment.cpp: + * Platform/CoreIPC/Connection.cpp: + * Platform/CoreIPC/Connection.h: + * Platform/CoreIPC/mac/ConnectionMac.cpp: + * Platform/CoreIPC/win/ConnectionWin.cpp: + * Platform/WorkQueue.h: + * Platform/mac/WorkQueueMac.cpp: + * Platform/win/RunLoopWin.cpp: + * Shared/KURLWrapper.h: + * Shared/WebCoreTypeArgumentMarshalling.h: + * Shared/mac/UpdateChunk.cpp: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKURL.cpp: + * UIProcess/Launcher/win/WebProcessLauncher.cpp: + * UIProcess/ResponsivenessTimer.cpp: + * UIProcess/WebLoaderClient.cpp: + * UIProcess/WebPageProxy.h: + * UIProcess/WebPolicyClient.cpp: + * UIProcess/WebUIClient.cpp: + * UIProcess/win/DrawingAreaProxy.cpp: + * UIProcess/win/WebView.cpp: + * WebProcess/Launching/win/WebProcessWinMain.cpp: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + * WebProcess/WebCoreSupport/mac/WebSystemInterface.h: + * WebProcess/WebCoreSupport/win/WebCoreLocalizedStrings.cpp: + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: + * WebProcess/WebPage/WebFrame.h: + * WebProcess/WebPage/WebPage.cpp: + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: + * WebProcess/WebProcess.h: + * WebProcess/win/WebLocalizableStrings.cpp: + * WebProcess/win/WebLocalizableStrings.h: + * WebProcess/win/WebProcessMain.cpp: + +2010-04-09 Anders Carlsson <andersca@apple.com> + + Fix Windows build. + + * Shared/NotImplemented.h: + Include stdio.h. + +2010-04-09 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=37347 + Don't use CF types in the new C API + + Replace all uses of CF types in the C API. + - Replace CFStringRef with WKStringRef. + - Replace CFURLRef with WKURLRef. + + * WebKit2.xcodeproj/project.pbxproj: Add new files. + + * Shared/KURLWrapper.h: Added. RefCounted wrapper around KURL. + * UIProcess/API/C/WKAPICast.h: Add new conversions. + * UIProcess/API/C/WKBase.h: Add new types. + * UIProcess/API/C/WKFrame.cpp: + * UIProcess/API/C/WKFrame.h: + * UIProcess/API/C/WKPage.cpp: + * UIProcess/API/C/WKPage.h: + Replace uses of CF types with WK equivalents. + + * UIProcess/API/C/WKString.cpp: Added. + * UIProcess/API/C/WKString.h: Added. + Represents a WebCore::StringImpl*. + + * UIProcess/API/C/WKURL.cpp: Added. + * UIProcess/API/C/WKURL.h: Added. + Represents a WebKit::KURLWrapper*. + + * UIProcess/API/C/cf: Added. + * UIProcess/API/C/cf/WKStringCF.cpp: Added. + * UIProcess/API/C/cf/WKStringCF.h: Added. + * UIProcess/API/C/cf/WKURLCF.cpp: Added. + * UIProcess/API/C/cf/WKURLCF.h: Added. + CoreFoundation conversion files. Allows converting + WKStringRef <-> CFStringRef + WKURLRef <-> CFURLRef + + * UIProcess/ScriptReturnValueCallback.cpp: + (WebKit::ScriptReturnValueCallback::performCallbackWithReturnValue): + * UIProcess/ScriptReturnValueCallback.h: + * UIProcess/WebFrameProxy.cpp: + (WebKit::WebFrameProxy::didStartProvisionalLoad): + (WebKit::WebFrameProxy::didCommitLoad): + * UIProcess/WebFrameProxy.h: + (WebKit::WebFrameProxy::url): + (WebKit::WebFrameProxy::provisionalURL): + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didReceiveTitleForFrame): + * UIProcess/WebLoaderClient.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::close): + (WebKit::WebPageProxy::didReceiveTitleForFrame): + (WebKit::WebPageProxy::decidePolicyForNavigationAction): + (WebKit::WebPageProxy::decidePolicyForNewWindowAction): + (WebKit::WebPageProxy::decidePolicyForMIMEType): + (WebKit::WebPageProxy::runJavaScriptAlert): + (WebKit::WebPageProxy::didRunJavaScriptInMainFrame): + (WebKit::WebPageProxy::processDidExit): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::pageTitle): + (WebKit::WebPageProxy::urlAtProcessExit): + * UIProcess/WebPolicyClient.cpp: + (WebKit::WebPolicyClient::decidePolicyForNavigationAction): + (WebKit::WebPolicyClient::decidePolicyForNewWindowAction): + (WebKit::WebPolicyClient::decidePolicyForMIMEType): + * UIProcess/WebPolicyClient.h: + * UIProcess/WebUIClient.cpp: + (WebKit::WebUIClient::runJavaScriptAlert): + * UIProcess/WebUIClient.h: + Don't use CF types internally at all. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::frameLoaderDestroyed): + Fix typo. + +2010-04-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Add build support for WebKit2. + + * Configurations: Added. + * Configurations/Base.xcconfig: Added. + * Configurations/DebugRelease.xcconfig: Added. + * Configurations/FeatureDefines.xcconfig: Added. + * Configurations/Version.xcconfig: Added. + * Configurations/WebKit2.xcconfig: Added. + * English.lproj: Added. + * English.lproj/InfoPlist.strings: Added. + * Info.plist: Added. + * Makefile: Added. + * WebKit2.xcodeproj: Added. + * WebKit2.xcodeproj/project.pbxproj: Added. + * WebKit2Prefix.cpp: Added. + * WebKit2Prefix.h: Added. + * WebKit2_Prefix.pch: Added. + * WebProcess-Info.plist: Added. + * version.plist: Added. + * win: Added. + * win/WebKit2.def: Added. + * win/WebKit2.vcproj: Added. + * win/WebKit2Generated.make: Added. + * win/WebKit2Generated.vcproj: Added. + * win/WebKit2WebProcess.vcproj: Added. + +2010-04-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=37301 + Add WebKit2/UIProcess directory. + + * UIProcess: Added. + * UIProcess/API: Added. + * UIProcess/API/C: Added. + * UIProcess/API/C/WKAPICast.h: Added. + * UIProcess/API/C/WKBase.h: Added. + * UIProcess/API/C/WKContext.cpp: Added. + * UIProcess/API/C/WKContext.h: Added. + * UIProcess/API/C/WKFrame.cpp: Added. + * UIProcess/API/C/WKFrame.h: Added. + * UIProcess/API/C/WKFramePolicyListener.cpp: Added. + * UIProcess/API/C/WKFramePolicyListener.h: Added. + * UIProcess/API/C/WKPage.cpp: Added. + * UIProcess/API/C/WKPage.h: Added. + * UIProcess/API/C/WKPageNamespace.cpp: Added. + * UIProcess/API/C/WKPageNamespace.h: Added. + * UIProcess/API/C/WKPreferences.cpp: Added. + * UIProcess/API/C/WKPreferences.h: Added. + * UIProcess/API/C/WebKit2.h: Added. + * UIProcess/API/mac: Added. + * UIProcess/API/mac/PageClientImpl.h: Added. + * UIProcess/API/mac/PageClientImpl.mm: Added. + * UIProcess/API/mac/WKView.h: Added. + * UIProcess/API/mac/WKView.mm: Added. + * UIProcess/API/mac/WKViewInternal.h: Added. + * UIProcess/API/win: Added. + * UIProcess/API/win/WKAPICastWin.h: Added. + * UIProcess/API/win/WKBaseWin.h: Added. + * UIProcess/API/win/WKView.cpp: Added. + * UIProcess/API/win/WKView.h: Added. + * UIProcess/Launcher: Added. + * UIProcess/Launcher/WebProcessLauncher.h: Added. + * UIProcess/Launcher/mac: Added. + * UIProcess/Launcher/mac/WebProcessLauncher.mm: Added. + * UIProcess/Launcher/win: Added. + * UIProcess/Launcher/win/WebProcessLauncher.cpp: Added. + * UIProcess/PageClient.h: Added. + * UIProcess/ProcessModel.h: Added. + * UIProcess/ResponsivenessTimer.cpp: Added. + * UIProcess/ResponsivenessTimer.h: Added. + * UIProcess/ScriptReturnValueCallback.cpp: Added. + * UIProcess/ScriptReturnValueCallback.h: Added. + * UIProcess/WebContext.cpp: Added. + * UIProcess/WebContext.h: Added. + * UIProcess/WebFramePolicyListenerProxy.cpp: Added. + * UIProcess/WebFramePolicyListenerProxy.h: Added. + * UIProcess/WebFrameProxy.cpp: Added. + * UIProcess/WebFrameProxy.h: Added. + * UIProcess/WebLoaderClient.cpp: Added. + * UIProcess/WebLoaderClient.h: Added. + * UIProcess/WebPageNamespace.cpp: Added. + * UIProcess/WebPageNamespace.h: Added. + * UIProcess/WebPageProxy.cpp: Added. + * UIProcess/WebPageProxy.h: Added. + * UIProcess/WebPolicyClient.cpp: Added. + * UIProcess/WebPolicyClient.h: Added. + * UIProcess/WebPreferences.cpp: Added. + * UIProcess/WebPreferences.h: Added. + * UIProcess/WebProcessManager.cpp: Added. + * UIProcess/WebProcessManager.h: Added. + * UIProcess/WebProcessProxy.cpp: Added. + * UIProcess/WebProcessProxy.h: Added. + * UIProcess/WebUIClient.cpp: Added. + * UIProcess/WebUIClient.h: Added. + * UIProcess/mac: Added. + * UIProcess/mac/DrawingAreaProxy.h: Added. + * UIProcess/mac/DrawingAreaProxy.mm: Added. + * UIProcess/mac/DrawingAreaProxyUpdateChunk.h: Added. + * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: Added. + * UIProcess/win: Added. + * UIProcess/win/DrawingAreaProxy.cpp: Added. + * UIProcess/win/DrawingAreaProxy.h: Added. + * UIProcess/win/WebView.cpp: Added. + * UIProcess/win/WebView.h: Added. + +2010-04-08 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig and Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=37300 + Add WebKit2/WebProcess directory. + + * WebProcess: Added. + * WebProcess/Launching: Added. + * WebProcess/Launching/mac: Added. + * WebProcess/Launching/mac/WebProcessMain.mm: Added. + * WebProcess/Launching/win: Added. + * WebProcess/Launching/win/WebProcessWinMain.cpp: Added. + * WebProcess/WebCoreSupport: Added. + * WebProcess/WebCoreSupport/WebChromeClient.cpp: Added. + * WebProcess/WebCoreSupport/WebChromeClient.h: Added. + * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: Added. + * WebProcess/WebCoreSupport/WebContextMenuClient.h: Added. + * WebProcess/WebCoreSupport/WebDragClient.cpp: Added. + * WebProcess/WebCoreSupport/WebDragClient.h: Added. + * WebProcess/WebCoreSupport/WebEditorClient.cpp: Added. + * WebProcess/WebCoreSupport/WebEditorClient.h: Added. + * WebProcess/WebCoreSupport/WebErrors.h: Added. + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Added. + * WebProcess/WebCoreSupport/WebInspectorClient.h: Added. + * WebProcess/WebCoreSupport/mac: Added. + * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Added. + * WebProcess/WebCoreSupport/mac/WebSystemInterface.h: Added. + * WebProcess/WebCoreSupport/mac/WebSystemInterface.m: Added. + * WebProcess/WebCoreSupport/win: Added. + * WebProcess/WebCoreSupport/win/WebCoreLocalizedStrings.cpp: Added. + * WebProcess/WebCoreSupport/win/WebErrorsWin.cpp: Added. + * WebProcess/WebPage: Added. + * WebProcess/WebPage/DrawingArea.cpp: Added. + * WebProcess/WebPage/DrawingArea.h: Added. + * WebProcess/WebPage/WebFrame.cpp: Added. + * WebProcess/WebPage/WebFrame.h: Added. + * WebProcess/WebPage/WebPage.cpp: Added. + * WebProcess/WebPage/WebPage.h: Added. + * WebProcess/WebPage/mac: Added. + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: Added. + * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.h: Added. + * WebProcess/WebPage/mac/WebPageMac.mm: Added. + * WebProcess/WebPage/win: Added. + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.cpp: Added. + * WebProcess/WebPage/win/DrawingAreaUpdateChunk.h: Added. + * WebProcess/WebPage/win/WebPageWin.cpp: Added. + * WebProcess/WebProcess.cpp: Added. + * WebProcess/WebProcess.h: Added. + * WebProcess/win: Added. + * WebProcess/win/DllMain.cpp: Added. + * WebProcess/win/WebLocalizableStrings.cpp: Added. + * WebProcess/win/WebLocalizableStrings.h: Added. + * WebProcess/win/WebProcessMain.cpp: Added. + * WebProcess/win/WebProcessMain.h: Added. + +2010-04-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=37295 + Add WebKit2/Shared directory. + + * Shared: Added. + * Shared/CoreIPCSupport: Added. + * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: Added. + * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h: Added. + * Shared/CoreIPCSupport/WebPageMessageKinds.h: Added. + * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Added. + * Shared/CoreIPCSupport/WebProcessMessageKinds.h: Added. + * Shared/NotImplemented.h: Added. + * Shared/WebCoreTypeArgumentMarshalling.h: Added. + * Shared/WebEvent.h: Added. + * Shared/WebEventConversion.cpp: Added. + * Shared/WebEventConversion.h: Added. + * Shared/WebPreferencesStore.cpp: Added. + * Shared/WebPreferencesStore.h: Added. + * Shared/mac: Added. + * Shared/mac/UpdateChunk.cpp: Added. + * Shared/mac/UpdateChunk.h: Added. + * Shared/mac/WebEventFactory.h: Added. + * Shared/mac/WebEventFactory.mm: Added. + * Shared/win: Added. + * Shared/win/UpdateChunk.cpp: Added. + * Shared/win/UpdateChunk.h: Added. + * Shared/win/WebEventFactory.cpp: Added. + * Shared/win/WebEventFactory.h: Added. + +2010-04-08 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=37293 + Add WebKit2/Platform directory. + + * Platform: Added. + * Platform/CoreIPC: Added. + * Platform/CoreIPC/ArgumentDecoder.cpp: Added. + * Platform/CoreIPC/ArgumentDecoder.h: Added. + * Platform/CoreIPC/ArgumentEncoder.cpp: Added. + * Platform/CoreIPC/ArgumentEncoder.h: Added. + * Platform/CoreIPC/Arguments.h: Added. + * Platform/CoreIPC/Attachment.cpp: Added. + * Platform/CoreIPC/Attachment.h: Added. + * Platform/CoreIPC/Connection.cpp: Added. + * Platform/CoreIPC/Connection.h: Added. + * Platform/CoreIPC/MessageID.h: Added. + * Platform/CoreIPC/mac: Added. + * Platform/CoreIPC/mac/ConnectionMac.cpp: Added. + * Platform/CoreIPC/mac/MachPort.h: Added. + * Platform/CoreIPC/win: Added. + * Platform/CoreIPC/win/ConnectionWin.cpp: Added. + * Platform/PlatformProcessIdentifier.h: Added. + * Platform/RunLoop.cpp: Added. + * Platform/RunLoop.h: Added. + * Platform/WorkItem.h: Added. + * Platform/WorkQueue.cpp: Added. + * Platform/WorkQueue.h: Added. + * Platform/mac: Added. + * Platform/mac/RunLoopMac.mm: Added. + * Platform/mac/WorkQueueMac.cpp: Added. + * Platform/win: Added. + * Platform/win/RunLoopWin.cpp: Added. + +2010-04-08 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Mark Rowe. + + Add WebKit2 directory. diff --git a/Source/WebKit2/Configurations/Base.xcconfig b/Source/WebKit2/Configurations/Base.xcconfig new file mode 100644 index 0000000..4005a47 --- /dev/null +++ b/Source/WebKit2/Configurations/Base.xcconfig @@ -0,0 +1,109 @@ +// 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. ``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 +// 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. + +DEBUG_INFORMATION_FORMAT = dwarf; +GCC_C_LANGUAGE_STANDARD = gnu99; +GCC_DEBUGGING_SYMBOLS = default; +GCC_DYNAMIC_NO_PIC = NO; +GCC_ENABLE_CPP_EXCEPTIONS = NO; +GCC_ENABLE_CPP_RTTI = NO; +GCC_ENABLE_OBJC_EXCEPTIONS = YES; +GCC_ENABLE_OBJC_GC = supported; +GCC_ENABLE_SYMBOL_SEPARATION = NO; +GCC_FAST_OBJC_DISPATCH = YES; +GCC_GENERATE_DEBUGGING_SYMBOLS = YES; +GCC_MODEL_TUNING = G5; +GCC_OBJC_CALL_CXX_CDTORS = YES; +GCC_PRECOMPILE_PREFIX_HEADER = YES; +GCC_SYMBOLS_PRIVATE_EXTERN = YES; +GCC_THREADSAFE_STATICS = NO; +GCC_TREAT_WARNINGS_AS_ERRORS = YES; +GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; +GCC_WARN_ABOUT_MISSING_NEWLINE = YES; +GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; +GCC_WARN_ABOUT_RETURN_TYPE = YES; +GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_UNUSED_VARIABLE = YES; +LINKER_DISPLAYS_MANGLED_NAMES = YES; +OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); +PREBINDING = NO; +VALID_ARCHS = i386 x86_64; +// FIXME: <rdar://problem/5070292> WebKit should build with -Wshorten-64-to-32 +WARNING_CFLAGS = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; + + +REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); +REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); +REAL_PLATFORM_NAME_macosx = macosx; + +TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); + + +// DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL, STRIP_INSTALLED_PRODUCT and DEAD_CODE_STRIPPING vary between the debug and normal variants. +// We set up the values for each variant here, and have the Debug configuration in the Xcode project use the _debug variant. +DEBUG_DEFINES_debug = DISABLE_THREAD_CHECK; +DEBUG_DEFINES_normal = NDEBUG; +DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT)); + +GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT)); +GCC_OPTIMIZATION_LEVEL_normal = s; +GCC_OPTIMIZATION_LEVEL_debug = 0; + +STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT)); +STRIP_INSTALLED_PRODUCT_normal = YES; +STRIP_INSTALLED_PRODUCT_debug = NO; + +// Dead code stripping needs to be on in the debug variant to avoid link errors. This is due to unconditionally +// building the MiG bindings for WebKitPluginClient even when the functions that the bindings wrap are not built. +DEAD_CODE_STRIPPING = YES; + +// FIXME: Production builds should use an order file. +// SECTORDER_FLAGS = -sectorder __TEXT __text mac/WebKit2.order; + +// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. +// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version +// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and +// XCODE_VERSION_ACTUAL for the full version number. +TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGET_GCC_VERSION_ = $(TARGET_GCC_VERSION_1040); +TARGET_GCC_VERSION_1040 = GCC_40; +TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR)); +TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); +TARGET_GCC_VERSION_1050_0310 = GCC_42; +TARGET_GCC_VERSION_1050_0320 = GCC_42; +TARGET_GCC_VERSION_1060 = GCC_42; +TARGET_GCC_VERSION_1070 = LLVM_GCC_42; + +GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); +GCC_VERSION_GCC_40 = 4.0; +GCC_VERSION_GCC_42 = 4.2; +GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42; + +// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. +SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SDKROOT_1050_1040 = macosx10.4; +SDKROOT_1060_1040 = macosx10.4; +SDKROOT_1060_1050 = macosx10.5; +SDKROOT_1070_1040 = macosx10.4; +SDKROOT_1070_1050 = macosx10.5; +SDKROOT_1070_1060 = macosx10.6; diff --git a/Source/WebKit2/Configurations/BaseTarget.xcconfig b/Source/WebKit2/Configurations/BaseTarget.xcconfig new file mode 100644 index 0000000..b7d0798 --- /dev/null +++ b/Source/WebKit2/Configurations/BaseTarget.xcconfig @@ -0,0 +1,38 @@ +// 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. ``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 +// 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 "FeatureDefines.xcconfig" +#include "Version.xcconfig" + +FRAMEWORK_SEARCH_PATHS = $(UMBRELLA_FRAMEWORKS_DIR) $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); +GCC_PREFIX_HEADER = WebKit2Prefix.h; +GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit2 +HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(BUILT_PRODUCTS_DIR)/usr/local/include $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(HEADER_SEARCH_PATHS); + +UMBRELLA_FRAMEWORKS_DIR = $(UMBRELLA_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); +UMBRELLA_FRAMEWORKS_DIR_macosx_Release = $(UMBRELLA_FRAMEWORKS_DIR_engineering); +UMBRELLA_FRAMEWORKS_DIR_macosx_Debug = $(UMBRELLA_FRAMEWORKS_DIR_engineering); +UMBRELLA_FRAMEWORKS_DIR_macosx_Production = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; +UMBRELLA_FRAMEWORKS_DIR_engineering = $(BUILT_PRODUCTS_DIR); + +WEBCORE_PRIVATE_HEADERS_DIR = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; diff --git a/Source/WebKit2/Configurations/DebugRelease.xcconfig b/Source/WebKit2/Configurations/DebugRelease.xcconfig new file mode 100644 index 0000000..77f7893 --- /dev/null +++ b/Source/WebKit2/Configurations/DebugRelease.xcconfig @@ -0,0 +1,51 @@ +// Copyright (C) 2009 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. ``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 +// 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 "Base.xcconfig" + +ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ARCHS_ = $(ARCHS_1040); +ARCHS_1040 = $(NATIVE_ARCH); +ARCHS_1050 = $(NATIVE_ARCH); +ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); + +ONLY_ACTIVE_ARCH = YES; + +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +MACOSX_DEPLOYMENT_TARGET_ = 10.4; +MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; +MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; +MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; + +GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; + +SECTORDER_FLAGS = ; + +WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +WEBKIT_SYSTEM_INTERFACE_LIBRARY_ = WebKitSystemInterfaceTiger; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1040 = WebKitSystemInterfaceTiger; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1050 = WebKitSystemInterfaceLeopard; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1060 = WebKitSystemInterfaceSnowLeopard; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_1070 = WebKitSystemInterfaceSnowLeopard; diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig new file mode 100644 index 0000000..46d5de4 --- /dev/null +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -0,0 +1,124 @@ +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. +// Copyright (C) 2009 Google 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. ``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 +// 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. + +// The contents of this file must be kept in sync with FeatureDefines.xcconfig in JavaScriptCore, +// WebCore and WebKit. Also the default values of the ENABLE_FEATURE_NAME macros in build-webkit +// should match the values below, but they do not need to be in the same order. + +// Keep this list of features (not enabled/disabled state) in sync with FeatureDefines.vsprops +// and FeatureDefinesCairo.vsprops in WebKitLibraries/win/tools/vsprops. + +// Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature. + +ENABLE_LINK_PREFETCH = ; + +ENABLE_ACCELERATED_2D_CANVAS = $(ENABLE_ACCELERATED_2D_CANVAS_$(REAL_PLATFORM_NAME)); +ENABLE_ACCELERATED_2D_CANVAS_macosx = $(ENABLE_ACCELERATED_2D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +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_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); +ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos); +ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING; + +ENABLE_BLOB = $(ENABLE_BLOB_$(REAL_PLATFORM_NAME)); +ENABLE_BLOB_macosx = ENABLE_BLOB; + +ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME)); +ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING; + +ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); +ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; + +ENABLE_DATABASE = ENABLE_DATABASE; +ENABLE_DATAGRID = ; + +ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); +ENABLE_DATALIST_macosx = ENABLE_DATALIST; + +ENABLE_DEVICE_ORIENTATION = ; +ENABLE_DIRECTORY_UPLOAD = ; +ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; +ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; + +ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); +ENABLE_FILTERS_macosx = ENABLE_FILTERS; + +ENABLE_FILE_SYSTEM = ; +ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API; +ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; + +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; + +ENABLE_IMAGE_RESIZER = ; +ENABLE_INDEXED_DATABASE = ; +ENABLE_INPUT_SPEECH = ; +ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; +ENABLE_MATHML = ENABLE_MATHML; +ENABLE_METER_TAG = ENABLE_METER_TAG; +ENABLE_NOTIFICATIONS = ; +ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; +ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; + +ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; + +ENABLE_SVG = ENABLE_SVG; +ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; +ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; + +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; + +ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; +ENABLE_SVG_USE = ENABLE_SVG_USE; +ENABLE_VIDEO = ENABLE_VIDEO; + +ENABLE_WEB_AUDIO = ; + +ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); +ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS; + +ENABLE_WEB_TIMING = ; +ENABLE_WML = ; + +ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_WORKERS_macosx = ENABLE_WORKERS; + +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); diff --git a/Source/WebKit2/Configurations/PluginProcessShim.xcconfig b/Source/WebKit2/Configurations/PluginProcessShim.xcconfig new file mode 100644 index 0000000..a607b72 --- /dev/null +++ b/Source/WebKit2/Configurations/PluginProcessShim.xcconfig @@ -0,0 +1,28 @@ +// 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. ``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 +// 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 "Version.xcconfig" + +GCC_DYNAMIC_NO_PIC = NO; +PRODUCT_NAME = PluginProcessShim; +SKIP_INSTALL = YES; diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig new file mode 100644 index 0000000..d9d6bbc --- /dev/null +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -0,0 +1,58 @@ +// 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. ``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 +// 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. + +MAJOR_VERSION = 534; +MINOR_VERSION = 16; +TINY_VERSION = 0; +FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); + +// The bundle version and short version string are set based on the current build configuration, see below. +BUNDLE_VERSION = $(BUNDLE_VERSION_$(CONFIGURATION)); +SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) + +// The system version prefix is based on the current system version. +SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. +SYSTEM_VERSION_PREFIX_1040 = 4; +SYSTEM_VERSION_PREFIX_1050 = 5; +SYSTEM_VERSION_PREFIX_1060 = 6; +SYSTEM_VERSION_PREFIX_1070 = 7; + +// The production build always uses the full version with a system version prefix. +BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION); +BUNDLE_VERSION_ = $(BUNDLE_VERSION_Production); + +// The production build always uses the major version with a system version prefix +SHORT_VERSION_STRING_Production = $(SYSTEM_VERSION_PREFIX)$(MAJOR_VERSION); +SHORT_VERSION_STRING_ = $(SHORT_VERSION_STRING_Production); + +// Local builds are the full version with a plus suffix. +BUNDLE_VERSION_Release = $(FULL_VERSION)+; +BUNDLE_VERSION_Debug = $(BUNDLE_VERSION_Release); + +// Local builds use the major version with a plus suffix +SHORT_VERSION_STRING_Release = $(MAJOR_VERSION)+; +SHORT_VERSION_STRING_Debug = $(SHORT_VERSION_STRING_Release); + +DYLIB_COMPATIBILITY_VERSION = 1; +DYLIB_CURRENT_VERSION = $(FULL_VERSION); diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig new file mode 100644 index 0000000..01771c2 --- /dev/null +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -0,0 +1,34 @@ +// 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. ``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 +// 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 "BaseTarget.xcconfig" + +PRODUCT_NAME = WebKit2; +INFOPLIST_FILE = Info.plist; + +// The framework location specified in mac/MainMac.cpp needs to be kept in sync with the install path. +INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; + +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; diff --git a/Source/WebKit2/Configurations/WebProcess.xcconfig b/Source/WebKit2/Configurations/WebProcess.xcconfig new file mode 100644 index 0000000..9909eda --- /dev/null +++ b/Source/WebKit2/Configurations/WebProcess.xcconfig @@ -0,0 +1,29 @@ +// 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. ``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 +// 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 "BaseTarget.xcconfig" + +GCC_ENABLE_OBJC_GC = NO; +PRODUCT_NAME = WebProcess; +INFOPLIST_FILE = WebProcess/Info.plist; +INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/WebKit2.framework; diff --git a/Source/WebKit2/DerivedSources.make b/Source/WebKit2/DerivedSources.make new file mode 100644 index 0000000..4350226 --- /dev/null +++ b/Source/WebKit2/DerivedSources.make @@ -0,0 +1,81 @@ +# 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. + +VPATH = \ + $(WebKit2)/PluginProcess \ + $(WebKit2)/Shared/Plugins \ + $(WebKit2)/WebProcess/Authentication \ + $(WebKit2)/WebProcess/Geolocation \ + $(WebKit2)/WebProcess/Plugins \ + $(WebKit2)/WebProcess/WebCoreSupport \ + $(WebKit2)/WebProcess/WebPage \ + $(WebKit2)/WebProcess \ + $(WebKit2)/UIProcess \ + $(WebKit2)/UIProcess/Downloads \ + $(WebKit2)/UIProcess/Plugins \ +# + +MESSAGE_RECEIVERS = \ + AuthenticationManager \ + DrawingArea \ + DrawingAreaProxy \ + DownloadProxy \ + NPObjectMessageReceiver \ + PluginControllerProxy \ + PluginProcess \ + PluginProcessProxy \ + PluginProxy \ + WebContext \ + WebDatabaseManager \ + WebDatabaseManagerProxy \ + WebGeolocationManager \ + WebGeolocationManagerProxy \ + WebInspector \ + WebInspectorProxy \ + WebPage \ + WebPageProxy \ + WebProcess \ + WebProcessConnection \ + WebProcessProxy \ +# + +SCRIPTS = \ + $(WebKit2)/Scripts/generate-message-receiver.py \ + $(WebKit2)/Scripts/generate-messages-header.py \ + $(WebKit2)/Scripts/webkit2/__init__.py \ + $(WebKit2)/Scripts/webkit2/messages.py \ +# + +.PHONY : all + +all : \ + $(MESSAGE_RECEIVERS:%=%MessageReceiver.cpp) \ + $(MESSAGE_RECEIVERS:%=%Messages.h) \ +# + +%MessageReceiver.cpp : %.messages.in $(SCRIPTS) + @echo Generating messages header for $*... + @python $(WebKit2)/Scripts/generate-message-receiver.py $< > $@ + +%Messages.h : %.messages.in $(SCRIPTS) + @echo Generating message receiver for $*... + @python $(WebKit2)/Scripts/generate-messages-header.py $< > $@ diff --git a/Source/WebKit2/DerivedSources.pro b/Source/WebKit2/DerivedSources.pro new file mode 100644 index 0000000..4f6c7d9 --- /dev/null +++ b/Source/WebKit2/DerivedSources.pro @@ -0,0 +1,146 @@ +TEMPLATE = lib +TARGET = dummy + +CONFIG -= debug_and_release + +CONFIG(standalone_package) { + isEmpty(WEBKIT2_GENERATED_SOURCES_DIR):WEBKIT2_GENERATED_SOURCES_DIR = $$PWD/generated + isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/../../Source/WebCore/generated +} else { + isEmpty(WEBKIT2_GENERATED_SOURCES_DIR):WEBKIT2_GENERATED_SOURCES_DIR = generated + isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = ../../Source/WebCore/generated +} + +WEBCORE_GENERATED_HEADERS_FOR_WEBKIT2 += \ + $$WC_GENERATED_SOURCES_DIR/HTMLNames.h \ + $$WC_GENERATED_SOURCES_DIR/JSCSSStyleDeclaration.h \ + $$WC_GENERATED_SOURCES_DIR/JSDOMWindow.h \ + $$WC_GENERATED_SOURCES_DIR/JSElement.h \ + $$WC_GENERATED_SOURCES_DIR/JSHTMLElement.h \ + $$WC_GENERATED_SOURCES_DIR/JSNode.h \ + $$WC_GENERATED_SOURCES_DIR/JSRange.h \ + +QUOTE = "" +DOUBLE_ESCAPED_QUOTE = "" +ESCAPE = "" +win32-msvc*|symbian { + ESCAPE = "^" +} else:win32-g++*:isEmpty(QMAKE_SH) { + # MinGW's make will run makefile commands using sh, even if make + # was run from the Windows shell, if it finds sh in the path. + ESCAPE = "^" +} else { + QUOTE = "\'" + DOUBLE_ESCAPED_QUOTE = "\\\'" +} + +SBOX_CHECK = $$(_SBOX_DIR) +!isEmpty(SBOX_CHECK) { + PYTHON = python2.6 +} else { + PYTHON = python +} + +SRC_ROOT_DIR = $$replace(PWD, /Source/WebKit2, /) + +defineTest(addExtraCompiler) { + eval($${1}.CONFIG = target_predeps no_link) + eval($${1}.variable_out =) + eval($${1}.dependency_type = TYPE_C) + + wkScript = $$eval($${1}.wkScript) + eval($${1}.depends += $$wkScript) + + export($${1}.CONFIG) + export($${1}.variable_out) + export($${1}.dependency_type) + export($${1}.depends) + + QMAKE_EXTRA_COMPILERS += $$1 + generated_files.depends += compiler_$${1}_make_all + export(QMAKE_EXTRA_COMPILERS) + export(generated_files.depends) + return(true) +} + +defineReplace(message_header_generator_output) { + FILENAME=$$basename(1) + return($$WEBKIT2_GENERATED_SOURCES_DIR/$$replace(FILENAME, ".messages.in","Messages.h")) +} + +defineReplace(message_receiver_generator_output) { + FILENAME=$$basename(1) + return($$WEBKIT2_GENERATED_SOURCES_DIR/$$replace(FILENAME, ".messages.in","MessageReceiver.cpp")) +} + +VPATH = \ + PluginProcess \ + WebProcess/Authentication \ + WebProcess/Geolocation \ + WebProcess/Plugins \ + WebProcess/WebCoreSupport \ + WebProcess/WebPage \ + WebProcess \ + UIProcess \ + UIProcess/Downloads \ + UIProcess/Plugins + +MESSAGE_RECEIVERS = \ + AuthenticationManager.messages.in \ + DownloadProxy.messages.in \ + PluginControllerProxy.messages.in \ + PluginProcess.messages.in \ + PluginProcessProxy.messages.in \ + PluginProxy.messages.in \ + WebContext.messages.in \ + WebDatabaseManager.messages.in \ + WebDatabaseManagerProxy.messages.in \ + WebGeolocationManager.messages.in \ + WebGeolocationManagerProxy.messages.in \ + WebInspectorProxy.messages.in \ + WebPage/WebInspector.messages.in \ + WebPage/WebPage.messages.in \ + WebPageProxy.messages.in \ + WebProcess.messages.in \ + WebProcessConnection.messages.in \ + WebProcessProxy.messages.in + +SCRIPTS = \ + $$PWD/Scripts/generate-message-receiver.py \ + $$PWD/Scripts/generate-messages-header.py \ + $$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.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.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.depends = $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl +generated_files.depends += fwheader_generator +QMAKE_EXTRA_TARGETS += fwheader_generator + +for(HEADER, WEBCORE_GENERATED_HEADERS_FOR_WEBKIT2) { + HEADER_NAME = $$basename(HEADER) + HEADER_PATH = $$HEADER + HEADER_TARGET = $$replace(HEADER_PATH, [^a-zA-Z0-9_], -) + HEADER_TARGET = "qtheader-$${HEADER_TARGET}" + DESTDIR = $$OUTPUT_DIR/include/"WebCore" + + eval($${HEADER_TARGET}.target = $$DESTDIR/$$HEADER_NAME) + eval($${HEADER_TARGET}.depends = $$HEADER_PATH) + eval($${HEADER_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$HEADER_PATH\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${HEADER_TARGET}.target)) + + QMAKE_EXTRA_TARGETS += $$HEADER_TARGET + generated_files.depends += $$eval($${HEADER_TARGET}.target) +} + +QMAKE_EXTRA_TARGETS += generated_files diff --git a/Source/WebKit2/English.lproj/InfoPlist.strings b/Source/WebKit2/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..88f65cf --- /dev/null +++ b/Source/WebKit2/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am new file mode 100644 index 0000000..be64c8e --- /dev/null +++ b/Source/WebKit2/GNUmakefile.am @@ -0,0 +1,846 @@ +# WebKit2 Convenience libraries +noinst_LTLIBRARIES += \ + libWebKit2.la + +libWebKit2_ladir = $(prefix)/include/webkit2-@WEBKITGTK_API_VERSION@/WebKit2 +libWebKit2_la_HEADERS = \ + $(WebKit2)/Shared/API/c/WKArray.h \ + $(WebKit2)/Shared/API/c/WKBase.h \ + $(WebKit2)/Shared/API/c/WKCertificateInfo.h \ + $(WebKit2)/Shared/API/c/WKContextMenuItem.h \ + $(WebKit2)/Shared/API/c/WKContextMenuItemTypes.h \ + $(WebKit2)/Shared/API/c/WKData.h \ + $(WebKit2)/Shared/API/c/WKDictionary.h \ + $(WebKit2)/Shared/API/c/WKError.h \ + $(WebKit2)/Shared/API/c/WKEvent.h \ + $(WebKit2)/Shared/API/c/WKFindOptions.h \ + $(WebKit2)/Shared/API/c/WKGeometry.h \ + $(WebKit2)/Shared/API/c/WKImage.h \ + $(WebKit2)/Shared/API/c/WKMutableArray.h \ + $(WebKit2)/Shared/API/c/WKMutableDictionary.h \ + $(WebKit2)/Shared/API/c/WKNumber.h \ + $(WebKit2)/Shared/API/c/WKPageLoadTypes.h \ + $(WebKit2)/Shared/API/c/WKSecurityOrigin.h \ + $(WebKit2)/Shared/API/c/WKSerializedScriptValue.h \ + $(WebKit2)/Shared/API/c/WKSerializedScriptValuePrivate.h \ + $(WebKit2)/Shared/API/c/WKSharedAPICast.h \ + $(WebKit2)/Shared/API/c/WKString.h \ + $(WebKit2)/Shared/API/c/WKStringPrivate.h \ + $(WebKit2)/Shared/API/c/WKType.h \ + $(WebKit2)/Shared/API/c/WKURL.h \ + $(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/WebKit2.h \ + $(WebKit2)/UIProcess/API/C/WKAPICast.h \ + $(WebKit2)/UIProcess/API/C/WKAuthenticationChallenge.h \ + $(WebKit2)/UIProcess/API/C/WKAuthenticationDecisionListener.h \ + $(WebKit2)/UIProcess/API/C/WKBackForwardList.h \ + $(WebKit2)/UIProcess/API/C/WKBackForwardListItem.h \ + $(WebKit2)/UIProcess/API/C/WKContext.h \ + $(WebKit2)/UIProcess/API/C/WKContextPrivate.h \ + $(WebKit2)/UIProcess/API/C/WKCredential.h \ + $(WebKit2)/UIProcess/API/C/WKCredentialTypes.h \ + $(WebKit2)/UIProcess/API/C/WKDatabaseManager.h \ + $(WebKit2)/UIProcess/API/C/WKDownload.h \ + $(WebKit2)/UIProcess/API/C/WKFormSubmissionListener.h \ + $(WebKit2)/UIProcess/API/C/WKFrame.h \ + $(WebKit2)/UIProcess/API/C/WKFramePolicyListener.h \ + $(WebKit2)/UIProcess/API/C/WKInspector.h \ + $(WebKit2)/UIProcess/API/C/WKNativeEvent.h \ + $(WebKit2)/UIProcess/API/C/WKNavigationData.h \ + $(WebKit2)/UIProcess/API/C/WKOpenPanelParameters.h \ + $(WebKit2)/UIProcess/API/C/WKOpenPanelResultListener.h \ + $(WebKit2)/UIProcess/API/C/WKPageGroup.h \ + $(WebKit2)/UIProcess/API/C/WKPage.h \ + $(WebKit2)/UIProcess/API/C/WKPagePrivate.h \ + $(WebKit2)/UIProcess/API/C/WKPreferences.h \ + $(WebKit2)/UIProcess/API/C/WKPreferencesPrivate.h \ + $(WebKit2)/UIProcess/API/C/WKProtectionSpace.h \ + $(WebKit2)/UIProcess/API/C/WKProtectionSpaceTypes.h + +nodist_libWebKit2_la_SOURCES = \ + $(webkit2_built_sources) + +libWebKit2_la_SOURCES = \ + Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h \ + Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h \ + Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp \ + Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h \ + Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp \ + Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h \ + Source/WebKit2/Platform/CoreIPC/Arguments.h \ + Source/WebKit2/Platform/CoreIPC/Attachment.cpp \ + Source/WebKit2/Platform/CoreIPC/Attachment.h \ + Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp \ + Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h \ + Source/WebKit2/Platform/CoreIPC/Connection.cpp \ + Source/WebKit2/Platform/CoreIPC/Connection.h \ + Source/WebKit2/Platform/CoreIPC/CoreIPCMessageKinds.h \ + Source/WebKit2/Platform/CoreIPC/DataReference.cpp \ + Source/WebKit2/Platform/CoreIPC/DataReference.h \ + Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp \ + Source/WebKit2/Platform/CoreIPC/HandleMessage.h \ + Source/WebKit2/Platform/CoreIPC/MessageID.h \ + Source/WebKit2/Platform/CoreIPC/MessageSender.h \ + Source/WebKit2/Platform/gtk/RunLoopGtk.cpp \ + Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp \ + Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \ + Source/WebKit2/Platform/Logging.cpp \ + Source/WebKit2/Platform/Logging.h \ + Source/WebKit2/Platform/Module.cpp \ + Source/WebKit2/Platform/Module.h \ + Source/WebKit2/Platform/PlatformProcessIdentifier.h \ + Source/WebKit2/Platform/RunLoop.cpp \ + Source/WebKit2/Platform/RunLoop.h \ + Source/WebKit2/Platform/SharedMemory.h \ + Source/WebKit2/Platform/WorkItem.h \ + Source/WebKit2/Platform/WorkQueue.cpp \ + Source/WebKit2/Platform/WorkQueue.h \ + Source/WebKit2/PluginProcess/PluginControllerProxy.cpp \ + Source/WebKit2/PluginProcess/PluginControllerProxy.h \ + Source/WebKit2/PluginProcess/PluginProcess.cpp \ + Source/WebKit2/PluginProcess/PluginProcess.h \ + Source/WebKit2/PluginProcess/PluginProcessMain.h \ + Source/WebKit2/PluginProcess/WebProcessConnection.cpp \ + Source/WebKit2/PluginProcess/WebProcessConnection.h \ + Source/WebKit2/Shared/APIClient.h \ + Source/WebKit2/Shared/API/c/WKArray.cpp \ + Source/WebKit2/Shared/API/c/WKArray.h \ + Source/WebKit2/Shared/API/c/WKBase.h \ + Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp \ + Source/WebKit2/Shared/API/c/WKCertificateInfo.h \ + Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp \ + Source/WebKit2/Shared/API/c/WKContextMenuItem.h \ + Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h \ + Source/WebKit2/Shared/API/c/WKData.cpp \ + Source/WebKit2/Shared/API/c/WKData.h \ + Source/WebKit2/Shared/API/c/WKDictionary.cpp \ + Source/WebKit2/Shared/API/c/WKDictionary.h \ + Source/WebKit2/Shared/API/c/WKError.cpp \ + Source/WebKit2/Shared/API/c/WKError.h \ + 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/WKImage.cpp \ + Source/WebKit2/Shared/API/c/WKImage.h \ + Source/WebKit2/Shared/API/c/WKMutableArray.cpp \ + Source/WebKit2/Shared/API/c/WKMutableArray.h \ + Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp \ + Source/WebKit2/Shared/API/c/WKMutableDictionary.h \ + Source/WebKit2/Shared/API/c/WKNumber.cpp \ + Source/WebKit2/Shared/API/c/WKNumber.h \ + Source/WebKit2/Shared/API/c/WKPageLoadTypes.h \ + Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp \ + Source/WebKit2/Shared/API/c/WKSecurityOrigin.h \ + Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp \ + Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h \ + Source/WebKit2/Shared/API/c/WKSerializedScriptValuePrivate.h \ + Source/WebKit2/Shared/API/c/WKSharedAPICast.h \ + Source/WebKit2/Shared/API/c/WKString.cpp \ + Source/WebKit2/Shared/API/c/WKString.h \ + Source/WebKit2/Shared/API/c/WKStringPrivate.h \ + Source/WebKit2/Shared/API/c/WKType.cpp \ + Source/WebKit2/Shared/API/c/WKType.h \ + Source/WebKit2/Shared/API/c/WKURL.cpp \ + Source/WebKit2/Shared/API/c/WKURL.h \ + Source/WebKit2/Shared/API/c/WKURLRequest.cpp \ + Source/WebKit2/Shared/API/c/WKURLRequest.h \ + Source/WebKit2/Shared/API/c/WKURLResponse.cpp \ + Source/WebKit2/Shared/API/c/WKURLResponse.h \ + Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp \ + Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h \ + Source/WebKit2/Shared/APIObject.h \ + Source/WebKit2/Shared/ShareableBitmap.cpp \ + Source/WebKit2/Shared/ShareableBitmap.h \ + Source/WebKit2/Shared/CacheModel.h \ + Source/WebKit2/Shared/ChildProcess.cpp \ + Source/WebKit2/Shared/ChildProcess.h \ + Source/WebKit2/Shared/CommandLine.h \ + Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h \ + Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h \ + Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h \ + Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h \ + Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h \ + Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h \ + Source/WebKit2/Shared/DrawingAreaInfo.h \ + Source/WebKit2/Shared/FontSmoothingLevel.h \ + Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp \ + Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \ + Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp \ + Source/WebKit2/Shared/ImageOptions.h \ + Source/WebKit2/Shared/ImmutableArray.cpp \ + Source/WebKit2/Shared/ImmutableArray.h \ + Source/WebKit2/Shared/ImmutableDictionary.cpp \ + Source/WebKit2/Shared/ImmutableDictionary.h \ + Source/WebKit2/Shared/MutableArray.cpp \ + Source/WebKit2/Shared/MutableArray.h \ + Source/WebKit2/Shared/MutableDictionary.cpp \ + Source/WebKit2/Shared/MutableDictionary.h \ + Source/WebKit2/Shared/NativeWebKeyboardEvent.h \ + Source/WebKit2/Shared/NotImplemented.h \ + Source/WebKit2/Shared/OriginAndDatabases.cpp \ + Source/WebKit2/Shared/OriginAndDatabases.h \ + Source/WebKit2/Shared/PlatformPopupMenuData.cpp \ + Source/WebKit2/Shared/PlatformPopupMenuData.h \ + Source/WebKit2/Shared/PrintInfo.cpp \ + Source/WebKit2/Shared/PrintInfo.h \ + Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp \ + Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h \ + Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp \ + Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp \ + Source/WebKit2/Shared/Plugins/NPIdentifierData.h \ + Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp \ + Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h \ + Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp \ + Source/WebKit2/Shared/Plugins/NPObjectProxy.h \ + Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp \ + Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.h \ + Source/WebKit2/Shared/Plugins/NPVariantData.cpp \ + Source/WebKit2/Shared/Plugins/NPVariantData.h \ + Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp \ + Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h \ + Source/WebKit2/Shared/Plugins/PluginQuirks.h \ + Source/WebKit2/Shared/SameDocumentNavigationType.h \ + Source/WebKit2/Shared/SandboxExtension.h \ + Source/WebKit2/Shared/SelectionState.h \ + Source/WebKit2/Shared/SessionState.cpp \ + Source/WebKit2/Shared/SessionState.h \ + Source/WebKit2/Shared/StringPairVector.h \ + Source/WebKit2/Shared/TextCheckerState.h \ + Source/WebKit2/Shared/UserMessageCoders.h \ + Source/WebKit2/Shared/VisitedLinkTable.cpp \ + Source/WebKit2/Shared/VisitedLinkTable.h \ + Source/WebKit2/Shared/WebBackForwardListItem.cpp \ + Source/WebKit2/Shared/WebBackForwardListItem.h \ + Source/WebKit2/Shared/WebCertificateInfo.h \ + Source/WebKit2/Shared/WebContextMenuItem.cpp \ + Source/WebKit2/Shared/WebContextMenuItemData.cpp \ + Source/WebKit2/Shared/WebContextMenuItemData.h \ + Source/WebKit2/Shared/WebContextMenuItem.h \ + Source/WebKit2/Shared/WebCoreArgumentCoders.h \ + Source/WebKit2/Shared/WebData.h \ + Source/WebKit2/Shared/WebError.cpp \ + Source/WebKit2/Shared/WebError.h \ + Source/WebKit2/Shared/WebEventConversion.cpp \ + Source/WebKit2/Shared/WebEventConversion.h \ + Source/WebKit2/Shared/WebEvent.cpp \ + Source/WebKit2/Shared/WebEvent.h \ + Source/WebKit2/Shared/WebFindOptions.h \ + Source/WebKit2/Shared/WebImage.cpp \ + Source/WebKit2/Shared/WebImage.h \ + Source/WebKit2/Shared/WebKeyboardEvent.cpp \ + Source/WebKit2/Shared/WebMouseEvent.cpp \ + Source/WebKit2/Shared/WebNavigationDataStore.h \ + Source/WebKit2/Shared/WebNumber.h \ + Source/WebKit2/Shared/WebOpenPanelParameters.cpp \ + Source/WebKit2/Shared/WebOpenPanelParameters.h \ + Source/WebKit2/Shared/WebPageCreationParameters.cpp \ + Source/WebKit2/Shared/WebPageCreationParameters.h \ + Source/WebKit2/Shared/WebPageGroupData.cpp \ + Source/WebKit2/Shared/WebPageGroupData.h \ + Source/WebKit2/Shared/WebPlatformTouchPoint.cpp \ + Source/WebKit2/Shared/WebPopupItem.cpp \ + Source/WebKit2/Shared/WebPopupItem.h \ + Source/WebKit2/Shared/WebPreferencesStore.cpp \ + Source/WebKit2/Shared/WebPreferencesStore.h \ + Source/WebKit2/Shared/WebProcessCreationParameters.cpp \ + Source/WebKit2/Shared/WebProcessCreationParameters.h \ + Source/WebKit2/Shared/WebSecurityOrigin.h \ + Source/WebKit2/Shared/WebSerializedScriptValue.h \ + Source/WebKit2/Shared/WebString.h \ + Source/WebKit2/Shared/WebTouchEvent.cpp \ + Source/WebKit2/Shared/WebURL.h \ + Source/WebKit2/Shared/WebURLRequest.cpp \ + Source/WebKit2/Shared/WebURLRequest.h \ + Source/WebKit2/Shared/WebURLResponse.cpp \ + 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/WebKit2.h \ + Source/WebKit2/UIProcess/API/C/WKAPICast.h \ + Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp \ + Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h \ + Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp \ + Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h \ + Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp \ + Source/WebKit2/UIProcess/API/C/WKBackForwardList.h \ + Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp \ + Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h \ + Source/WebKit2/UIProcess/API/C/WKContext.cpp \ + Source/WebKit2/UIProcess/API/C/WKContext.h \ + Source/WebKit2/UIProcess/API/C/WKContextPrivate.h \ + Source/WebKit2/UIProcess/API/C/WKCredential.cpp \ + Source/WebKit2/UIProcess/API/C/WKCredential.h \ + Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h \ + Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp \ + Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h \ + Source/WebKit2/UIProcess/API/C/WKDownload.cpp \ + Source/WebKit2/UIProcess/API/C/WKDownload.h \ + Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp \ + Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h \ + Source/WebKit2/UIProcess/API/C/WKFrame.cpp \ + Source/WebKit2/UIProcess/API/C/WKFrame.h \ + Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp \ + Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h \ + Source/WebKit2/UIProcess/API/C/WKInspector.cpp \ + Source/WebKit2/UIProcess/API/C/WKInspector.h \ + Source/WebKit2/UIProcess/API/C/WKNativeEvent.h \ + Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp \ + Source/WebKit2/UIProcess/API/C/WKNavigationData.h \ + Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp \ + Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h \ + Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp \ + Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h \ + Source/WebKit2/UIProcess/API/C/WKPage.cpp \ + Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp \ + Source/WebKit2/UIProcess/API/C/WKPageGroup.h \ + Source/WebKit2/UIProcess/API/C/WKPage.h \ + Source/WebKit2/UIProcess/API/C/WKPagePrivate.h \ + Source/WebKit2/UIProcess/API/C/WKPreferences.cpp \ + Source/WebKit2/UIProcess/API/C/WKPreferences.h \ + Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h \ + Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp \ + Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h \ + Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h \ + Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp \ + Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h \ + Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp \ + Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h \ + Source/WebKit2/UIProcess/Authentication/WebCredential.cpp \ + Source/WebKit2/UIProcess/Authentication/WebCredential.h \ + Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp \ + Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h \ + Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp \ + Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h \ + Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp \ + Source/WebKit2/UIProcess/Downloads/DownloadProxy.h \ + Source/WebKit2/UIProcess/DrawingAreaProxy.cpp \ + Source/WebKit2/UIProcess/DrawingAreaProxy.h \ + Source/WebKit2/UIProcess/FindIndicator.cpp \ + Source/WebKit2/UIProcess/FindIndicator.h \ + Source/WebKit2/UIProcess/GenericCallback.h \ + Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp \ + Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp \ + Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp \ + Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp \ + Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp \ + Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp \ + Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp \ + Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h \ + Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp \ + Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h \ + Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp \ + Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h \ + Source/WebKit2/UIProcess/PageClient.h \ + Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp \ + Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp \ + Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h \ + Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp \ + Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h \ + Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp \ + Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h \ + Source/WebKit2/UIProcess/ProcessModel.h \ + Source/WebKit2/UIProcess/ResponsivenessTimer.cpp \ + Source/WebKit2/UIProcess/ResponsivenessTimer.h \ + Source/WebKit2/UIProcess/TextChecker.h \ + Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp \ + Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h \ + Source/WebKit2/UIProcess/TiledDrawingAreaTile.h \ + Source/WebKit2/UIProcess/VisitedLinkProvider.cpp \ + Source/WebKit2/UIProcess/VisitedLinkProvider.h \ + Source/WebKit2/UIProcess/WebBackForwardList.cpp \ + Source/WebKit2/UIProcess/WebBackForwardList.h \ + Source/WebKit2/UIProcess/WebContext.cpp \ + Source/WebKit2/UIProcess/WebContext.h \ + Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp \ + Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h \ + Source/WebKit2/UIProcess/WebContextMenuProxy.cpp \ + Source/WebKit2/UIProcess/WebContextMenuProxy.h \ + Source/WebKit2/UIProcess/WebContextUserMessageCoders.h \ + Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp \ + Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h \ + Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp \ + Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h \ + Source/WebKit2/UIProcess/WebDownloadClient.cpp \ + Source/WebKit2/UIProcess/WebDownloadClient.h \ + Source/WebKit2/UIProcess/WebEditCommandProxy.cpp \ + Source/WebKit2/UIProcess/WebEditCommandProxy.h \ + Source/WebKit2/UIProcess/WebFindClient.cpp \ + Source/WebKit2/UIProcess/WebFindClient.h \ + Source/WebKit2/UIProcess/WebFormClient.cpp \ + Source/WebKit2/UIProcess/WebFormClient.h \ + Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp \ + Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.h \ + Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp \ + Source/WebKit2/UIProcess/WebFrameListenerProxy.h \ + Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp \ + Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h \ + Source/WebKit2/UIProcess/WebFrameProxy.cpp \ + Source/WebKit2/UIProcess/WebFrameProxy.h \ + Source/WebKit2/UIProcess/WebHistoryClient.cpp \ + Source/WebKit2/UIProcess/WebHistoryClient.h \ + Source/WebKit2/UIProcess/WebInspectorProxy.cpp \ + Source/WebKit2/UIProcess/WebInspectorProxy.h \ + Source/WebKit2/UIProcess/WebLoaderClient.cpp \ + Source/WebKit2/UIProcess/WebLoaderClient.h \ + Source/WebKit2/UIProcess/WebNavigationData.cpp \ + Source/WebKit2/UIProcess/WebNavigationData.h \ + Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp \ + Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h \ + Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp \ + Source/WebKit2/UIProcess/WebPageContextMenuClient.h \ + Source/WebKit2/UIProcess/WebPageGroup.cpp \ + Source/WebKit2/UIProcess/WebPageGroup.h \ + Source/WebKit2/UIProcess/WebPageProxy.cpp \ + Source/WebKit2/UIProcess/WebPageProxy.h \ + Source/WebKit2/UIProcess/WebPolicyClient.cpp \ + Source/WebKit2/UIProcess/WebPolicyClient.h \ + Source/WebKit2/UIProcess/WebPopupMenuProxy.h \ + Source/WebKit2/UIProcess/WebPreferences.cpp \ + Source/WebKit2/UIProcess/WebPreferences.h \ + Source/WebKit2/UIProcess/WebProcessManager.cpp \ + Source/WebKit2/UIProcess/WebProcessManager.h \ + Source/WebKit2/UIProcess/WebProcessProxy.cpp \ + Source/WebKit2/UIProcess/WebProcessProxy.h \ + Source/WebKit2/UIProcess/WebResourceLoadClient.cpp \ + Source/WebKit2/UIProcess/WebResourceLoadClient.h \ + Source/WebKit2/UIProcess/WebUIClient.cpp \ + Source/WebKit2/UIProcess/WebUIClient.h \ + Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp \ + Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h \ + Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp \ + Source/WebKit2/WebProcess/Downloads/Download.cpp \ + Source/WebKit2/WebProcess/Downloads/Download.h \ + Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp \ + Source/WebKit2/WebProcess/Downloads/DownloadManager.h \ + Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp \ + Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp \ + Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h \ + 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/WKBundleNodeHandle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h \ + Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h \ + Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h \ + Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp \ + Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.h \ + Source/WebKit2/WebProcess/Plugins/PluginController.h \ + Source/WebKit2/WebProcess/Plugins/Plugin.cpp \ + Source/WebKit2/WebProcess/Plugins/Plugin.h \ + Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp \ + Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h \ + Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp \ + Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h \ + Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp \ + Source/WebKit2/WebProcess/Plugins/PluginProxy.h \ + 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 \ + Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp \ + Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h \ + Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp \ + 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 \ + Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h \ + Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp \ + Source/WebKit2/WebProcess/WebPage/DrawingArea.h \ + Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp \ + Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h \ + Source/WebKit2/WebProcess/WebPage/FindController.cpp \ + Source/WebKit2/WebProcess/WebPage/FindController.h \ + Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp \ + Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp \ + Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h \ + Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp \ + Source/WebKit2/WebProcess/WebPage/PageOverlay.h \ + Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp \ + Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h \ + Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp \ + Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h \ + Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp \ + Source/WebKit2/WebProcess/WebPage/WebContextMenu.h \ + Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp \ + Source/WebKit2/WebProcess/WebPage/WebEditCommand.h \ + Source/WebKit2/WebProcess/WebPage/WebFrame.cpp \ + Source/WebKit2/WebProcess/WebPage/WebFrame.h \ + Source/WebKit2/WebProcess/WebPage/WebInspector.cpp \ + Source/WebKit2/WebProcess/WebPage/WebInspector.h \ + Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp \ + Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h \ + Source/WebKit2/WebProcess/WebPage/WebPage.cpp \ + Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp \ + 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 + +libWebKit2_la_CPPFLAGS = \ + -fno-strict-aliasing \ + $(global_cppflags) \ + -include $(srcdir)/Source/WebKit2/WebKit2Prefix.h \ + -I$(srcdir)/Source/WebKit2 \ + -I$(srcdir)/Source/WebKit2/gtk \ + -I$(srcdir)/Source/WebKit2/Platform \ + -I$(srcdir)/Source/WebKit2/Platform/CoreIPC \ + -I$(srcdir)/Source/WebKit2/Platform/CoreIPC/gtk \ + -I$(srcdir)/Source/WebKit2/Platform/gtk \ + -I$(srcdir)/Source/WebKit2/PluginProcess \ + -I$(srcdir)/Source/WebKit2/Shared \ + -I$(srcdir)/Source/WebKit2/Shared/API \ + -I$(srcdir)/Source/WebKit2/Shared/API/c \ + -I$(srcdir)/Source/WebKit2/Shared/API/c/gtk \ + -I$(srcdir)/Source/WebKit2/Shared/CoreIPCSupport \ + -I$(srcdir)/Source/WebKit2/Shared/gtk \ + -I$(srcdir)/Source/WebKit2/Shared/Plugins \ + -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape \ + -I$(srcdir)/Source/WebKit2/Shared/Plugins/Netscape/x11 \ + -I$(srcdir)/Source/WebKit2/UIProcess \ + -I$(srcdir)/Source/WebKit2/UIProcess/API \ + -I$(srcdir)/Source/WebKit2/UIProcess/API/C \ + -I$(srcdir)/Source/WebKit2/UIProcess/API/C/gtk \ + -I$(srcdir)/Source/WebKit2/UIProcess/API/cpp \ + -I$(srcdir)/Source/WebKit2/UIProcess/Authentication \ + -I$(srcdir)/Source/WebKit2/UIProcess/Downloads \ + -I$(srcdir)/Source/WebKit2/UIProcess/gtk \ + -I$(srcdir)/Source/WebKit2/UIProcess/Launcher \ + -I$(srcdir)/Source/WebKit2/UIProcess/Launcher/gtk \ + -I$(srcdir)/Source/WebKit2/UIProcess/Plugins \ + -I$(srcdir)/Source/WebKit2/UIProcess/Plugins/gtk \ + -I$(srcdir)/Source/WebKit2/WebProcess \ + -I$(srcdir)/Source/WebKit2/WebProcess/Authentication \ + -I$(srcdir)/Source/WebKit2/WebProcess/Downloads \ + -I$(srcdir)/Source/WebKit2/WebProcess/gtk \ + -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle \ + -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API \ + -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/API/c \ + -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/DOM \ + -I$(srcdir)/Source/WebKit2/WebProcess/InjectedBundle/gtk \ + -I$(srcdir)/Source/WebKit2/WebProcess/Launching \ + -I$(srcdir)/Source/WebKit2/WebProcess/Plugins \ + -I$(srcdir)/Source/WebKit2/WebProcess/Plugins/Netscape \ + -I$(srcdir)/Source/WebKit2/WebProcess/Plugins/Netscape/gtk \ + -I$(srcdir)/Source/WebKit2/WebProcess/WebCoreSupport \ + -I$(srcdir)/Source/WebKit2/WebProcess/WebCoreSupport/gtk \ + -I$(srcdir)/Source/WebKit2/WebProcess/WebPage \ + -I$(srcdir)/Source/WebKit2/WebProcess/WebPage/gtk \ + -I$(top_builddir)/DerivedSources/WebKit2 \ + -I$(top_builddir)/DerivedSources/WebKit2/include \ + -I$(top_builddir)/DerivedSources/WebKit2/include/JavaScriptCore \ + -I$(top_builddir)/DerivedSources/WebKit2/include/WebCore \ + -I$(top_builddir)/DerivedSources/WebKit2/include/WebKit2 \ + $(webcore_cppflags) \ + $(webcoregtk_cppflags) \ + $(javascriptcore_cppflags) + +libWebKit2_la_CXXFLAGS = \ + $(global_cxxflags) \ + $(libWebKit2_la_CFLAGS) + +libWebKit2_la_CFLAGS = \ + $(global_cflags) \ + $(COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GTK_CFLAGS) \ + $(LIBSOUP_CFLAGS) \ + $(UNICODE_CFLAGS) \ + $(XT_CFLAGS) + +libWebKit2_la_LIBADD = \ + -lpthread \ + $(CAIRO_LIBS) \ + $(COVERAGE_LDFLAGS) \ + $(GLIB_LIBS) \ + $(GTK_LIBS) \ + $(LIBSOUP_LIBS) \ + $(UNICODE_LIBS) \ + $(XT_LIBS) + +# Shared libraries +lib_LTLIBRARIES += \ + libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la + +nodist_EXTRA_libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOURCES = \ + $(webcore_built_nosources) + +nodist_libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOURCES = \ + $(webcore_built_sources) + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOURCES = \ + $(webcore_sources) \ + $(webcoregtk_sources) + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CXXFLAGS = \ + $(global_cxxflags) + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CFLAGS = \ + $(global_cflags) + +# When building WebCore, we want WebCore/config.h and NOT JavaScriptCore/config.h, +# hence, it's important that WebCore/ should come first before JavaScriptCore in the +# include path. +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPFLAGS = \ + -DBUILDING_WEBKIT \ + -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ + -DDATA_DIR=\"${datadir}\" \ + $(global_cppflags) \ + $(webcore_cppflags) \ + $(webcoregtk_cppflags) \ + $(javascriptcore_cppflags) \ + -fno-strict-aliasing \ + $(COVERAGE_CFLAGS) \ + $(ENCHANT_CFLAGS) \ + $(GAIL_CFLAGS) \ + $(GEOCLUE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GSTREAMER_CFLAGS) \ + $(GTK_CFLAGS) \ + $(HILDON_CFLAGS) \ + $(HILDON_CPPFLAGS) \ + $(LIBSOUP_CFLAGS) \ + $(LIBXML_CFLAGS) \ + $(LIBXSLT_CFLAGS) \ + $(SQLITE3_CFLAGS) \ + $(UNICODE_CFLAGS) \ + $(XT_CFLAGS) + +# For the Gtk port we want to use XP_UNIX both in X11 and Mac +if !TARGET_WIN32 +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPFLAGS += \ + -DXP_UNIX +endif + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LDFLAGS = \ + -version-info @LIBWEBKITGTK_VERSION@ \ + $(version_script) \ + $(no_undefined) + +libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD = \ + -lpthread \ + libJavaScriptCore.la \ + libWebKit2.la \ + $(COVERAGE_LDFLAGS) \ + $(ENCHANT_LIBS) \ + $(GAIL_LIBS) \ + $(GEOCLUE_LIBS) \ + $(GLIB_LIBS) \ + $(GSTREAMER_LIBS) \ + $(GTK_LIBS) \ + $(HILDON_LIBS) \ + $(JPEG_LIBS) \ + $(LIBSOUP_LIBS) \ + $(LIBXML_LIBS) \ + $(LIBXSLT_LIBS) \ + $(PANGO_LIBS) \ + $(PNG_LIBS) \ + $(SQLITE3_LIBS) \ + $(UNICODE_LIBS) \ + $(XT_LIBS) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = Source/WebKit2/gtk/@WEBKITGTK_PC_NAME@-@WEBKITGTK_API_VERSION@.pc + +# WebKit2 specific variables +webkit2_built_sources += \ + DerivedSources/WebKit2/AuthenticationManagerMessageReceiver.cpp \ + DerivedSources/WebKit2/AuthenticationManagerMessages.h \ + DerivedSources/WebKit2/DownloadProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/DownloadProxyMessages.h \ + DerivedSources/WebKit2/NPObjectMessageReceiverMessageReceiver.cpp \ + DerivedSources/WebKit2/NPObjectMessageReceiverMessages.h \ + DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/PluginControllerProxyMessages.h \ + DerivedSources/WebKit2/PluginProcessMessageReceiver.cpp \ + DerivedSources/WebKit2/PluginProcessMessages.h \ + DerivedSources/WebKit2/PluginProcessProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/PluginProcessProxyMessages.h \ + DerivedSources/WebKit2/PluginProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/PluginProxyMessages.h \ + DerivedSources/WebKit2/WebContextMessageReceiver.cpp \ + DerivedSources/WebKit2/WebContextMessages.h \ + DerivedSources/WebKit2/WebDatabaseManagerMessageReceiver.cpp \ + DerivedSources/WebKit2/WebDatabaseManagerMessages.h \ + DerivedSources/WebKit2/WebDatabaseManagerProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/WebDatabaseManagerProxyMessages.h \ + DerivedSources/WebKit2/WebInspectorMessageReceiver.cpp \ + DerivedSources/WebKit2/WebInspectorMessages.h \ + DerivedSources/WebKit2/WebInspectorProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/WebInspectorProxyMessages.h \ + DerivedSources/WebKit2/WebPageProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/WebPageProxyMessages.h \ + DerivedSources/WebKit2/WebPageMessageReceiver.cpp \ + DerivedSources/WebKit2/WebPageMessages.h \ + DerivedSources/WebKit2/WebProcessConnectionMessageReceiver.cpp \ + DerivedSources/WebKit2/WebProcessConnectionMessages.h \ + DerivedSources/WebKit2/WebProcessMessageReceiver.cpp \ + DerivedSources/WebKit2/WebProcessMessages.h \ + DerivedSources/WebKit2/WebProcessProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/WebProcessProxyMessages.h + +BUILT_SOURCES += \ + $(webkit2_built_sources) \ + generate-webkit2-forwarding-headers + +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 + +vpath %.messages.in = \ + $(WebKit2)/PluginProcess \ + $(WebKit2)/Shared/Plugins \ + $(WebKit2)/UIProcess \ + $(WebKit2)/UIProcess/Downloads \ + $(WebKit2)/UIProcess/Plugins \ + $(WebKit2)/WebProcess \ + $(WebKit2)/WebProcess/Authentication \ + $(WebKit2)/WebProcess/Plugins \ + $(WebKit2)/WebProcess/WebCoreSupport \ + $(WebKit2)/WebProcess/WebPage + +message_gen_scripts = \ + $(WebKit2)/Scripts/generate-message-receiver.py \ + $(WebKit2)/Scripts/generate-messages-header.py \ + $(WebKit2)/Scripts/webkit2/__init__.py \ + $(WebKit2)/Scripts/webkit2/messages.py + +# Message header generation +DerivedSources/WebKit2/%MessageReceiver.cpp: %.messages.in $(message_gen_scripts) + $(AM_V_GEN)$(PYTHON) $(WebKit2)/Scripts/generate-message-receiver.py $< > $@ + +DerivedSources/WebKit2/%Messages.h: %.messages.in $(message_gen_scripts) + $(AM_V_GEN)$(PYTHON) $(WebKit2)/Scripts/generate-messages-header.py $< > $@ + +CLEANFILES += \ + $(BUILT_SOURCES) \ + $(top_builddir)/WebKit2/gtk/@WEBKITGTK_PC_NAME@-@WEBKITGTK_API_VERSION@.pc \ + $(top_builddir)/Programs/WebKitWebProcess + +# WebKitWebProcess +bin_PROGRAMS += \ + Programs/WebKitWebProcess + +Programs_WebKitWebProcess_CPPFLAGS = \ + -I$(srcdir)/Source/WebKit2 \ + -I$(srcdir)/Source/WebKit2/UIProcess/API/C \ + -I$(srcdir)/Source/WebKit2/WebProcess/gtk \ + -I$(top_builddir)/DerivedSources/WebKit2 \ + -I$(top_builddir)/DerivedSources/WebKit2/include \ + -I$(top_builddir)/DerivedSources/WebKit2/include/WebCore \ + $(global_cppflags) \ + $(javascriptcore_cppflags) + +Programs_WebKitWebProcess_CFLAGS = \ + $(global_cflags) \ + $(GLIB_CFLAGS) \ + $(GTK_CFLAGS) \ + $(LIBSOUP_CFLAGS) + +Programs_WebKitWebProcess_SOURCES = \ + Source/WebKit2/gtk/MainGtk.cpp + +Programs_WebKitWebProcess_LDADD = \ + libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ + $(GLIB_LIBS) \ + $(GTK_LIBS) \ + $(LIBSOUP_LIBS) + +Programs_WebKitWebProcess_LDFLAGS = \ + -no-fast-install \ + -no-install diff --git a/Source/WebKit2/Info.plist b/Source/WebKit2/Info.plist new file mode 100644 index 0000000..34ec7d4 --- /dev/null +++ b/Source/WebKit2/Info.plist @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleGetInfoString</key> + <string>${BUNDLE_VERSION}, Copyright 2003-2011 Apple Inc.</string> + <key>CFBundleIdentifier</key> + <string>com.apple.${PRODUCT_NAME}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>${SHORT_VERSION_STRING}</string> + <key>CFBundleVersion</key> + <string>${BUNDLE_VERSION}</string> +</dict> +</plist> diff --git a/Source/WebKit2/Makefile b/Source/WebKit2/Makefile new file mode 100644 index 0000000..99177a6 --- /dev/null +++ b/Source/WebKit2/Makefile @@ -0,0 +1,20 @@ +# Build WebKit2 only on SnowLeopard and later. + +OSX_VERSION ?= $(shell sw_vers -productVersion | cut -d. -f 2) +BUILD_WEBKIT2 = $(shell (( $(OSX_VERSION) >= 6 )) && echo "YES" ) + +ifeq "$(BUILD_WEBKIT2)" "YES" + +include ../Makefile.shared + +else + +all: ; + +debug d development dev develop: ; + +release r deployment dep deploy: ; + +clean: ; + +endif diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h new file mode 100644 index 0000000..bd15f51 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h @@ -0,0 +1,50 @@ +/* + * 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 ArgumentCoder_h +#define ArgumentCoder_h + +#include <wtf/TypeTraits.h> + +namespace CoreIPC { + +class ArgumentDecoder; +class ArgumentEncoder; + +template<typename T> struct ArgumentCoder { + static void encode(ArgumentEncoder* encoder, const T& t) + { + t.encode(encoder); + } + + static bool decode(ArgumentDecoder* decoder, T& t) + { + return T::decode(decoder, t); + } +}; + +} + +#endif // ArgumentCoder_h diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h new file mode 100644 index 0000000..1cc1a7d --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.h @@ -0,0 +1,301 @@ +/* + * 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 SimpleArgumentCoder_h +#define SimpleArgumentCoder_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <utility> +#include <wtf/HashMap.h> +#include <wtf/TypeTraits.h> +#include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + +// An argument coder works on POD types +template<typename T> struct SimpleArgumentCoder { + static void encode(ArgumentEncoder* encoder, const T& t) + { + encoder->encodeBytes(reinterpret_cast<const uint8_t*>(&t), sizeof(T)); + } + static bool decode(ArgumentDecoder* decoder, T& t) + { + return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(T)); + } +}; + +template<typename T, typename U> struct ArgumentCoder<std::pair<T, U> > { + static void encode(ArgumentEncoder* encoder, const std::pair<T, U>& pair) + { + encoder->encode(pair.first); + encoder->encode(pair.second); + } + + static bool decode(ArgumentDecoder* decoder, std::pair<T, U>& pair) + { + T first; + if (!decoder->decode(first)) + return false; + + U second; + if (!decoder->decode(second)) + return false; + + pair.first = first; + pair.second = second; + return true; + } +}; + +template<bool fixedSizeElements, typename T> struct VectorArgumentCoder; + +template<typename T> struct VectorArgumentCoder<false, T> { + static void encode(ArgumentEncoder* encoder, const Vector<T>& vector) + { + encoder->encodeUInt64(vector.size()); + for (size_t i = 0; i < vector.size(); ++i) + encoder->encode(vector[i]); + } + + static bool decode(ArgumentDecoder* decoder, Vector<T>& vector) + { + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + Vector<T> tmp; + for (size_t i = 0; i < size; ++i) { + T element; + if (!decoder->decode(element)) + return false; + + tmp.append(element); + } + + tmp.shrinkToFit(); + vector.swap(tmp); + return true; + } +}; + +template<typename T> struct VectorArgumentCoder<true, T> { + static void encode(ArgumentEncoder* encoder, const Vector<T>& vector) + { + encoder->encodeUInt64(vector.size()); + // FIXME: If we could tell the encoder to align the buffer, we could just do an encodeBytes here. + for (size_t i = 0; i < vector.size(); ++i) + encoder->encode(vector[i]); + } + + static bool decode(ArgumentDecoder* decoder, Vector<T>& vector) + { + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + // Since we know the total size of the elements, we can allocate the vector in + // one fell swoop. Before allocating we must however make sure that the decoder buffer + // is big enough. + if (!decoder->bufferIsLargeEnoughToContain<T>(size)) { + decoder->markInvalid(); + return false; + } + + Vector<T> tmp; + tmp.reserveCapacity(size); + + for (size_t i = 0; i < size; ++i) { + T element; + if (!decoder->decode(element)) + return false; + + tmp.uncheckedAppend(element); + } + + vector.swap(tmp); + return true; + } +}; + +template<typename T> struct ArgumentCoder<Vector<T> > : VectorArgumentCoder<WTF::IsArithmetic<T>::value, T> { }; + +// Specialization for Vector<uint8_t> +template<> struct ArgumentCoder<Vector<uint8_t> > { + static void encode(ArgumentEncoder* encoder, const Vector<uint8_t>& vector) + { + encoder->encodeBytes(vector.data(), vector.size()); + } + + static bool decode(ArgumentDecoder* decoder, Vector<uint8_t>& vector) + { + return decoder->decodeBytes(vector); + } +}; + +template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> struct ArgumentCoder<HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> > { + typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType; + + static void encode(ArgumentEncoder* encoder, const HashMapType& hashMap) + { + encoder->encodeUInt64(hashMap.size()); + for (typename HashMapType::const_iterator it = hashMap.begin(), end = hashMap.end(); it != end; ++it) + encoder->encode(*it); + } + + static bool decode(ArgumentDecoder* decoder, HashMapType& hashMap) + { + uint64_t hashMapSize; + if (!decoder->decode(hashMapSize)) + return false; + + HashMapType tempHashMap; + for (uint64_t i = 0; i < hashMapSize; ++i) { + KeyArg key; + MappedArg value; + if (!decoder->decode(key)) + return false; + if (!decoder->decode(value)) + return false; + + if (!tempHashMap.add(key, value).second) { + // The hash map already has the specified key, bail. + decoder->markInvalid(); + return false; + } + } + + hashMap.swap(tempHashMap); + return true; + } +}; + +template<> struct ArgumentCoder<CString> { + static void encode(ArgumentEncoder* encoder, const CString& string) + { + // Special case the null string. + if (string.isNull()) { + encoder->encodeUInt32(std::numeric_limits<uint32_t>::max()); + return; + } + + uint32_t length = string.length(); + encoder->encode(length); + encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.data()), length); + } + + static bool decode(ArgumentDecoder* decoder, CString& result) + { + uint32_t length; + if (!decoder->decode(length)) + return false; + + if (length == std::numeric_limits<uint32_t>::max()) { + // This is the null string. + result = CString(); + return true; + } + + // Before allocating the string, make sure that the decoder buffer is big enough. + if (!decoder->bufferIsLargeEnoughToContain<char>(length)) { + decoder->markInvalid(); + return false; + } + + char* buffer; + CString string = CString::newUninitialized(length, buffer); + if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length)) + return false; + + result = string; + return true; + } +}; + +template<> struct ArgumentCoder<String> { + static void encode(ArgumentEncoder* encoder, const String& string) + { + // Special case the null string. + if (string.isNull()) { + encoder->encodeUInt32(std::numeric_limits<uint32_t>::max()); + return; + } + + uint32_t length = string.length(); + encoder->encode(length); + encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.characters()), length * sizeof(UChar)); + } + + static bool decode(ArgumentDecoder* decoder, String& result) + { + uint32_t length; + if (!decoder->decode(length)) + return false; + + if (length == std::numeric_limits<uint32_t>::max()) { + // This is the null string. + result = String(); + return true; + } + + // Before allocating the string, make sure that the decoder buffer is big enough. + if (!decoder->bufferIsLargeEnoughToContain<UChar>(length)) { + decoder->markInvalid(); + return false; + } + + UChar* buffer; + String string = String::createUninitialized(length, buffer); + if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar))) + return false; + + result = string; + return true; + } +}; + +template<> struct ArgumentCoder<AtomicString> { + static void encode(ArgumentEncoder* encoder, const AtomicString& atomicString) + { + encoder->encode(atomicString.string()); + } + + static bool decode(ArgumentDecoder* decoder, AtomicString& atomicString) + { + String string; + if (!decoder->decode(string)) + return false; + + atomicString = string; + return true; + } +}; + +} // namespace CoreIPC + +#endif // SimpleArgumentCoder_h diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp new file mode 100644 index 0000000..336f72f --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.cpp @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ArgumentDecoder.h" + +#include "DataReference.h" +#include <stdio.h> + +namespace CoreIPC { + +ArgumentDecoder::ArgumentDecoder(const uint8_t* buffer, size_t bufferSize) +{ + initialize(buffer, bufferSize); +} + +ArgumentDecoder::ArgumentDecoder(const uint8_t* buffer, size_t bufferSize, Deque<Attachment>& attachments) +{ + initialize(buffer, bufferSize); + + m_attachments.swap(attachments); +} + +ArgumentDecoder::~ArgumentDecoder() +{ + ASSERT(m_buffer); + fastFree(m_buffer); + // FIXME: We need to dispose of the mach ports in cases of failure. +} + +void ArgumentDecoder::initialize(const uint8_t* buffer, size_t bufferSize) +{ + m_buffer = static_cast<uint8_t*>(fastMalloc(bufferSize)); + m_bufferPos = m_buffer; + m_bufferEnd = m_buffer + bufferSize; + memcpy(m_buffer, buffer, bufferSize); + + // Decode the destination ID. + decodeUInt64(m_destinationID); +} + +static inline uint8_t* roundUpToAlignment(uint8_t* ptr, unsigned alignment) +{ + return (uint8_t*)(((uintptr_t)ptr + alignment - 1) & ~(uintptr_t)(alignment - 1)); +} + +bool ArgumentDecoder::alignBufferPosition(unsigned alignment, size_t size) +{ + uint8_t* buffer = roundUpToAlignment(m_bufferPos, alignment); + if (buffer + size > m_bufferEnd) { + // We've walked off the end of this buffer. + markInvalid(); + return false; + } + + m_bufferPos = buffer; + return true; +} + +bool ArgumentDecoder::bufferIsLargeEnoughToContain(unsigned alignment, size_t size) const +{ + return roundUpToAlignment(m_bufferPos, alignment) + size <= m_bufferEnd; +} + +bool ArgumentDecoder::decodeBytes(Vector<uint8_t>& buffer) +{ + uint64_t size; + if (!decodeUInt64(size)) + return false; + + if (!alignBufferPosition(1, size)) + return false; + + buffer.resize(size); + if (size > 0) + memcpy(&buffer[0], m_bufferPos, size); + m_bufferPos += size; + return true; +} + +bool ArgumentDecoder::decodeBytes(DataReference& dataReference) +{ + uint64_t size; + if (!decodeUInt64(size)) + return false; + + if (!alignBufferPosition(1, size)) + return false; + + uint8_t* data = m_bufferPos; + m_bufferPos += size; + + dataReference = DataReference(data, size); + return true; +} + +bool ArgumentDecoder::decodeBytes(uint8_t* buffer, size_t bufferSize) +{ + // FIXME: Decoding the size is not strictly necessary here since we know the size upfront. + uint64_t size; + if (!decodeUInt64(size)) + return false; + + ASSERT(size == bufferSize); + if (size != bufferSize) + return false; + + if (!alignBufferPosition(1, size)) + return false; + + memcpy(buffer, m_bufferPos, size); + m_bufferPos += size; + return true; +} + +bool ArgumentDecoder::decodeBool(bool& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<bool*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeUInt32(uint32_t& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<uint32_t*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeUInt64(uint64_t& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<uint64_t*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeInt32(int32_t& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<uint32_t*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeInt64(int64_t& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<uint64_t*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeFloat(float& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<float*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::decodeDouble(double& result) +{ + if (!alignBufferPosition(__alignof(result), sizeof(result))) + return false; + + result = *reinterpret_cast<double*>(m_bufferPos); + m_bufferPos += sizeof(result); + return true; +} + +bool ArgumentDecoder::removeAttachment(Attachment& attachment) +{ + if (m_attachments.isEmpty()) + return false; + + attachment = m_attachments.takeFirst(); + return true; +} + +#ifndef NDEBUG +void ArgumentDecoder::debug() +{ + printf("ArgumentDecoder::debug()\n"); + printf("Number of Attachments: %d\n", (int)m_attachments.size()); + printf("Size of buffer: %d\n", (int)(m_bufferEnd - m_buffer)); +} +#endif + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h new file mode 100644 index 0000000..dcf67ad --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h @@ -0,0 +1,161 @@ +/* + * 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 ArgumentDecoder_h +#define ArgumentDecoder_h + +#include "ArgumentCoder.h" +#include "Attachment.h" +#include <wtf/Deque.h> +#include <wtf/TypeTraits.h> +#include <wtf/Vector.h> + +namespace CoreIPC { + +class DataReference; + +class ArgumentDecoder { +public: + ArgumentDecoder(const uint8_t* buffer, size_t bufferSize); + ArgumentDecoder(const uint8_t* buffer, size_t bufferSize, Deque<Attachment>&); + ~ArgumentDecoder(); + + uint64_t destinationID() const { return m_destinationID; } + + bool isInvalid() const { return m_bufferPos > m_bufferEnd; } + void markInvalid() { m_bufferPos = m_bufferEnd + 1; } + + bool decodeBytes(Vector<uint8_t>&); + bool decodeBytes(uint8_t*, size_t); + + // The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object. + bool decodeBytes(DataReference&); + + bool decodeBool(bool&); + bool decodeUInt32(uint32_t&); + bool decodeUInt64(uint64_t&); + bool decodeInt32(int32_t&); + bool decodeInt64(int64_t&); + bool decodeFloat(float&); + bool decodeDouble(double&); + + template<typename T> bool decodeEnum(T& result) + { + COMPILE_ASSERT(sizeof(T) <= sizeof(uint64_t), enum_type_must_not_be_larger_than_64_bits); + + uint64_t value; + if (!decodeUInt64(value)) + return false; + + result = static_cast<T>(value); + return true; + } + + template<typename T> + bool bufferIsLargeEnoughToContain(size_t numElements) const + { + COMPILE_ASSERT(WTF::IsArithmetic<T>::value, type_must_have_known_encoded_size); + + if (numElements > std::numeric_limits<size_t>::max() / sizeof(T)) + return false; + + return bufferIsLargeEnoughToContain(__alignof(T), numElements * sizeof(T)); + } + + // Generic type decode function. + template<typename T> bool decode(T& t) + { + return ArgumentCoder<T>::decode(this, t); + } + + // This overload exists so we can pass temporaries to decode. In the Star Trek future, it + // can take an rvalue reference instead. + template<typename T> bool decode(const T& t) + { + return decode(const_cast<T&>(t)); + } + + bool removeAttachment(Attachment&); + +#ifndef NDEBUG + void debug(); +#endif + +private: + ArgumentDecoder(const ArgumentDecoder*); + ArgumentDecoder* operator=(const ArgumentDecoder*); + + void initialize(const uint8_t* buffer, size_t bufferSize); + + bool alignBufferPosition(unsigned alignment, size_t size); + bool bufferIsLargeEnoughToContain(unsigned alignment, size_t size) const; + + uint64_t m_destinationID; + + uint8_t* m_buffer; + uint8_t* m_bufferPos; + uint8_t* m_bufferEnd; + + Deque<Attachment> m_attachments; +}; + +template<> inline bool ArgumentDecoder::decode(bool& n) +{ + return decodeBool(n); +} + +template<> inline bool ArgumentDecoder::decode(uint32_t& n) +{ + return decodeUInt32(n); +} + +template<> inline bool ArgumentDecoder::decode(uint64_t& n) +{ + return decodeUInt64(n); +} + +template<> inline bool ArgumentDecoder::decode(int32_t& n) +{ + return decodeInt32(n); +} + +template<> inline bool ArgumentDecoder::decode(int64_t& n) +{ + return decodeInt64(n); +} + +template<> inline bool ArgumentDecoder::decode(float& n) +{ + return decodeFloat(n); +} + +template<> inline bool ArgumentDecoder::decode(double& n) +{ + return decodeDouble(n); +} + +} // namespace CoreIPC + +#endif // ArgumentDecoder_h diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp new file mode 100644 index 0000000..1340c0a --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ArgumentEncoder.h" + +#include <algorithm> +#include <stdio.h> + +namespace CoreIPC { + +PassOwnPtr<ArgumentEncoder> ArgumentEncoder::create(uint64_t destinationID) +{ + return adoptPtr(new ArgumentEncoder(destinationID)); +} + +ArgumentEncoder::ArgumentEncoder(uint64_t destinationID) + : m_buffer(0) + , m_bufferPointer(0) + , m_bufferSize(0) + , m_bufferCapacity(0) +{ + // Encode the destination ID. + encodeUInt64(destinationID); +} + +ArgumentEncoder::~ArgumentEncoder() +{ + if (m_buffer) + fastFree(m_buffer); + // FIXME: We need to dispose of the attachments in cases of failure. +} + +static inline size_t roundUpToAlignment(size_t value, unsigned alignment) +{ + return ((value + alignment - 1) / alignment) * alignment; +} + +uint8_t* ArgumentEncoder::grow(unsigned alignment, size_t size) +{ + size_t alignedSize = roundUpToAlignment(m_bufferSize, alignment); + + if (alignedSize + size > m_bufferCapacity) { + size_t newCapacity = std::max(alignedSize + size, std::max(static_cast<size_t>(32), m_bufferCapacity + m_bufferCapacity / 4 + 1)); + if (!m_buffer) + m_buffer = static_cast<uint8_t*>(fastMalloc(newCapacity)); + else + m_buffer = static_cast<uint8_t*>(fastRealloc(m_buffer, newCapacity)); + + // FIXME: What should we do if allocating memory fails? + + m_bufferCapacity = newCapacity; + } + + m_bufferSize = alignedSize + size; + m_bufferPointer = m_buffer + alignedSize + size; + + return m_buffer + alignedSize; +} + +void ArgumentEncoder::encodeBytes(const uint8_t* bytes, size_t size) +{ + // Encode the size. + encodeUInt64(static_cast<uint64_t>(size)); + + uint8_t* buffer = grow(1, size); + + memcpy(buffer, bytes, size); +} + +void ArgumentEncoder::encodeBool(bool n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<bool*>(buffer) = n; +} + +void ArgumentEncoder::encodeUInt32(uint32_t n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<uint32_t*>(buffer) = n; +} + +void ArgumentEncoder::encodeUInt64(uint64_t n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<uint64_t*>(buffer) = n; +} + +void ArgumentEncoder::encodeInt32(int32_t n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<int32_t*>(buffer) = n; +} + +void ArgumentEncoder::encodeInt64(int64_t n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<int64_t*>(buffer) = n; +} + +void ArgumentEncoder::encodeFloat(float n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<float*>(buffer) = n; +} + +void ArgumentEncoder::encodeDouble(double n) +{ + uint8_t* buffer = grow(__alignof(n), sizeof(n)); + + *reinterpret_cast<double*>(buffer) = n; +} + +void ArgumentEncoder::addAttachment(const Attachment& attachment) +{ + m_attachments.append(attachment); +} + +Vector<Attachment> ArgumentEncoder::releaseAttachments() +{ + Vector<Attachment> newList; + newList.swap(m_attachments); + return newList; +} + +#ifndef NDEBUG +void ArgumentEncoder::debug() +{ + printf("ArgumentEncoder::debug()\n"); + printf("Number of Attachments: %d\n", (int)m_attachments.size()); + printf("Size of buffer: %d\n", (int)m_bufferSize); +} +#endif + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h new file mode 100644 index 0000000..97f0262 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.h @@ -0,0 +1,127 @@ +/* + * 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 ArgumentEncoder_h +#define ArgumentEncoder_h + +#include "ArgumentCoder.h" +#include "Attachment.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/TypeTraits.h> +#include <wtf/Vector.h> + +namespace CoreIPC { + +class ArgumentEncoder; + +class ArgumentEncoder { +public: + static PassOwnPtr<ArgumentEncoder> create(uint64_t destinationID); + ~ArgumentEncoder(); + + void encodeBytes(const uint8_t*, size_t); + + void encodeBool(bool); + void encodeUInt32(uint32_t); + void encodeUInt64(uint64_t); + void encodeInt32(int32_t); + void encodeInt64(int64_t); + void encodeFloat(float); + void encodeDouble(double); + + template<typename T> void encodeEnum(T t) + { + COMPILE_ASSERT(sizeof(T) <= sizeof(uint64_t), enum_type_must_not_be_larger_than_64_bits); + + encodeUInt64(static_cast<uint64_t>(t)); + } + + // Generic type encode function. + template<typename T> void encode(const T& t) + { + ArgumentCoder<T>::encode(this, t); + } + + uint8_t* buffer() const { return m_buffer; } + size_t bufferSize() const { return m_bufferSize; } + + void addAttachment(const Attachment&); + Vector<Attachment> releaseAttachments(); + +#ifndef NDEBUG + void debug(); +#endif + +private: + explicit ArgumentEncoder(uint64_t destinationID); + uint8_t* grow(unsigned alignment, size_t size); + + uint8_t* m_buffer; + uint8_t* m_bufferPointer; + + size_t m_bufferSize; + size_t m_bufferCapacity; + + Vector<Attachment> m_attachments; +}; + +template<> inline void ArgumentEncoder::encode(const bool& n) +{ + encodeBool(n); +} + +template<> inline void ArgumentEncoder::encode(const uint32_t& n) +{ + encodeUInt32(n); +} + +template<> inline void ArgumentEncoder::encode(const uint64_t& n) +{ + encodeUInt64(n); +} + +template<> inline void ArgumentEncoder::encode(const int32_t& n) +{ + encodeInt32(n); +} + +template<> inline void ArgumentEncoder::encode(const int64_t& n) +{ + encodeInt64(n); +} + +template<> inline void ArgumentEncoder::encode(const float& n) +{ + encodeFloat(n); +} + +template<> inline void ArgumentEncoder::encode(const double& n) +{ + encodeDouble(n); +} + +} // namespace CoreIPC + +#endif // ArgumentEncoder_h diff --git a/Source/WebKit2/Platform/CoreIPC/Arguments.h b/Source/WebKit2/Platform/CoreIPC/Arguments.h new file mode 100644 index 0000000..ba7c7e8 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/Arguments.h @@ -0,0 +1,401 @@ +/* + * 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 Arguments_h +#define Arguments_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <wtf/TypeTraits.h> + +namespace CoreIPC { + +struct Arguments0 { + typedef Arguments0 ValueType; + + void encode(ArgumentEncoder*) const + { + } + + static bool decode(ArgumentDecoder*, Arguments0&) + { + return true; + } +}; + +inline Arguments0 In() +{ + return Arguments0(); +} + +inline Arguments0 Out() +{ + return Arguments0(); +} + +template<typename T1> struct Arguments1 { + typedef Arguments1<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type> ValueType; + + Arguments1() + { + } + + Arguments1(T1 t1) + : argument1(t1) + { + } + + void encode(ArgumentEncoder* encoder) const + { + encoder->encode(argument1); + } + + static bool decode(ArgumentDecoder* decoder, Arguments1& result) + { + return decoder->decode(result.argument1); + } + + T1 argument1; +}; + +template<typename T1> Arguments1<const T1&> In(const T1& t1) +{ + return Arguments1<const T1&>(t1); +} + +template<typename T1> Arguments1<T1&> Out(T1& t1) +{ + return Arguments1<T1&>(t1); +} + +template<typename T1, typename T2> struct Arguments2 : Arguments1<T1> { + typedef Arguments2<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type> ValueType; + + Arguments2() + { + } + + Arguments2(T1 t1, T2 t2) + : Arguments1<T1>(t1) + , argument2(t2) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments1<T1>::encode(encoder); + encoder->encode(argument2); + } + + static bool decode(ArgumentDecoder* decoder, Arguments2& result) + { + if (!Arguments1<T1>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument2); + } + + T2 argument2; +}; + +template<typename T1, typename T2> Arguments2<const T1&, const T2&> In(const T1& t1, const T2& t2) +{ + return Arguments2<const T1&, const T2&>(t1, t2); +} + +template<typename T1, typename T2> Arguments2<T1&, T2&> Out(T1& t1, T2& t2) +{ + return Arguments2<T1&, T2&>(t1, t2); +} + +template<typename T1, typename T2, typename T3> struct Arguments3 : Arguments2<T1, T2> { + typedef Arguments3<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type> ValueType; + + Arguments3() + { + } + + Arguments3(T1 t1, T2 t2, T3 t3) + : Arguments2<T1, T2>(t1, t2) + , argument3(t3) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments2<T1, T2>::encode(encoder); + encoder->encode(argument3); + } + + static bool decode(ArgumentDecoder* decoder, Arguments3& result) + { + if (!Arguments2<T1, T2>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument3); + } + + T3 argument3; +}; + +template<typename T1, typename T2, typename T3> Arguments3<const T1&, const T2&, const T3&> In(const T1& t1, const T2& t2, const T3 &t3) +{ + return Arguments3<const T1&, const T2&, const T3&>(t1, t2, t3); +} + +template<typename T1, typename T2, typename T3> Arguments3<T1&, T2&, T3&> Out(T1& t1, T2& t2, T3& t3) +{ + return Arguments3<T1&, T2&, T3&>(t1, t2, t3); +} + +template<typename T1, typename T2, typename T3, typename T4> struct Arguments4 : Arguments3<T1, T2, T3> { + typedef Arguments4<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type> ValueType; + + Arguments4() + { + } + + Arguments4(T1 t1, T2 t2, T3 t3, T4 t4) + : Arguments3<T1, T2, T3>(t1, t2, t3) + , argument4(t4) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments3<T1, T2, T3>::encode(encoder); + encoder->encode(argument4); + } + + static bool decode(ArgumentDecoder* decoder, Arguments4& result) + { + if (!Arguments3<T1, T2, T3>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument4); + } + + T4 argument4; +}; + +template<typename T1, typename T2, typename T3, typename T4> Arguments4<const T1&, const T2&, const T3&, const T4&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4) +{ + return Arguments4<const T1&, const T2&, const T3&, const T4&>(t1, t2, t3, t4); +} + +template<typename T1, typename T2, typename T3, typename T4> Arguments4<T1&, T2&, T3&, T4&> Out(T1& t1, T2& t2, T3& t3, T4& t4) +{ + return Arguments4<T1&, T2&, T3&, T4&>(t1, t2, t3, t4); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5> struct Arguments5 : Arguments4<T1, T2, T3, T4> { + typedef Arguments5<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T5>::Type>::Type> ValueType; + + Arguments5() + { + } + + Arguments5(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) + : Arguments4<T1, T2, T3, T4>(t1, t2, t3, t4) + , argument5(t5) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments4<T1, T2, T3, T4>::encode(encoder); + encoder->encode(argument5); + } + + static bool decode(ArgumentDecoder* decoder, Arguments5& result) + { + if (!Arguments4<T1, T2, T3, T4>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument5); + } + + T5 argument5; +}; + +template<typename T1, typename T2, typename T3, typename T4, typename T5> Arguments5<const T1&, const T2&, const T3&, const T4&, const T5&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5) +{ + return Arguments5<const T1&, const T2&, const T3&, const T4&, const T5&>(t1, t2, t3, t4, t5); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5> Arguments5<T1&, T2&, T3&, T4&, T5&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) +{ + return Arguments5<T1&, T2&, T3&, T4&, T5&>(t1, t2, t3, t4, t5); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct Arguments6 : Arguments5<T1, T2, T3, T4, T5> { + typedef Arguments6<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T5>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T6>::Type>::Type> ValueType; + + Arguments6() + { + } + + Arguments6(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) + : Arguments5<T1, T2, T3, T4, T5>(t1, t2, t3, t4, t5) + , argument6(t6) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments5<T1, T2, T3, T4, T5>::encode(encoder); + encoder->encode(argument6); + } + + static bool decode(ArgumentDecoder* decoder, Arguments6& result) + { + if (!Arguments5<T1, T2, T3, T4, T5>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument6); + } + + T6 argument6; +}; + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6) +{ + return Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&>(t1, t2, t3, t4, t5, t6); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<T1&, T2&, T3&, T4&, T5&, T6&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6) +{ + return Arguments6<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct Arguments7 : Arguments6<T1, T2, T3, T4, T5, T6> { + typedef Arguments7<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T5>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T6>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T7>::Type>::Type> ValueType; + + Arguments7() + { + } + + Arguments7(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) + : Arguments6<T1, T2, T3, T4, T5, T6>(t1, t2, t3, t4, t5, t6) + , argument7(t7) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments6<T1, T2, T3, T4, T5, T6>::encode(encoder); + encoder->encode(argument7); + } + + static bool decode(ArgumentDecoder* decoder, Arguments7& result) + { + if (!Arguments6<T1, T2, T3, T4, T5, T6>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument7); + } + + T7 argument7; +}; + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) +{ + return Arguments7<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&>(t1, t2, t3, t4, t5, t6, t7); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7) +{ + return Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, t7); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct Arguments8 : Arguments7<T1, T2, T3, T4, T5, T6, T7> { + typedef Arguments8<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T5>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T6>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T7>::Type>::Type, + typename WTF::RemoveConst<typename WTF::RemoveReference<T8>::Type>::Type> ValueType; + + Arguments8() { } + + Arguments8(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) + : Arguments7<T1, T2, T3, T4, T5, T6, T7>(t1, t2, t3, t4, t5, t6, t7) + , argument8(t8) + { + } + + void encode(ArgumentEncoder* encoder) const + { + Arguments7<T1, T2, T3, T4, T5, T6, T7>::encode(encoder); + encoder->encode(argument8); + } + + static bool decode(ArgumentDecoder* decoder, Arguments8& result) + { + if (!Arguments7<T1, T2, T3, T4, T5, T6, T7>::decode(decoder, result)) + return false; + + return decoder->decode(result.argument8); + } + + T8 argument8; +}; + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) +{ + return Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&>(t1, t2, t3, t4, t5, t6, t7, t8); +} + +template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8) +{ + return Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>(t1, t2, t3, t4, t5, t6, t7, t8); +} + +} // namespace CoreIPC + +#endif // Arguments_h diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.cpp b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp new file mode 100644 index 0000000..c8d35f4 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Attachment.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" + +namespace CoreIPC { + +Attachment::Attachment() + : m_type(Uninitialized) +{ +} + +#if PLATFORM(MAC) +Attachment::Attachment(mach_port_name_t port, mach_msg_type_name_t disposition) + : m_type(MachPortType) +{ + m_port.port = port; + m_port.disposition = disposition; +} + +Attachment::Attachment(void* address, mach_msg_size_t size, mach_msg_copy_options_t copyOptions, bool deallocate) + : m_type(MachOOLMemoryType) +{ + m_oolMemory.address = address; + m_oolMemory.size = size; + m_oolMemory.copyOptions = copyOptions; + m_oolMemory.deallocate = deallocate; +} + +void Attachment::release() +{ + m_type = Uninitialized; +} +#endif + +void Attachment::encode(ArgumentEncoder* encoder) const +{ + encoder->addAttachment(*this); +} + +bool Attachment::decode(ArgumentDecoder* decoder, Attachment& attachment) +{ + if (!decoder->removeAttachment(attachment)) + return false; + return true; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/Attachment.h b/Source/WebKit2/Platform/CoreIPC/Attachment.h new file mode 100644 index 0000000..55a09c9 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/Attachment.h @@ -0,0 +1,91 @@ +/* + * 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 Attachment_h +#define Attachment_h + +namespace CoreIPC { + +class ArgumentDecoder; +class ArgumentEncoder; + +class Attachment { +public: + Attachment(); + + enum Type { + Uninitialized, +#if PLATFORM(MAC) + MachPortType, + MachOOLMemoryType +#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); +#endif + + Type type() const { return m_type; } + +#if PLATFORM(MAC) + void release(); + + // MachPortType + mach_port_name_t port() const { ASSERT(m_type == MachPortType); return m_port.port; } + mach_msg_type_name_t disposition() const { ASSERT(m_type == MachPortType); return m_port.disposition; } + + // MachOOLMemoryType + void* address() const { ASSERT(m_type == MachOOLMemoryType); return m_oolMemory.address; } + 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; } +#endif + + void encode(ArgumentEncoder*) const; + static bool decode(ArgumentDecoder*, Attachment&); + +private: + Type m_type; + +#if PLATFORM(MAC) + union { + struct { + mach_port_name_t port; + mach_msg_type_name_t disposition; + } m_port; + struct { + void* address; + mach_msg_size_t size; + mach_msg_copy_options_t copyOptions; + bool deallocate; + } m_oolMemory; + }; +#endif +}; + +} // namespace CoreIPC + +#endif // Attachment_h diff --git a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp new file mode 100644 index 0000000..c975dff --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "BinarySemaphore.h" + +namespace CoreIPC { + +BinarySemaphore::BinarySemaphore() + : m_isSet(false) +{ +} + +BinarySemaphore::~BinarySemaphore() +{ +} + +void BinarySemaphore::signal() +{ + MutexLocker locker(m_mutex); + + m_isSet = true; + m_condition.signal(); +} + +bool BinarySemaphore::wait(double absoluteTime) +{ + MutexLocker locker(m_mutex); + + bool timedOut = false; + while (!m_isSet) { + timedOut = !m_condition.timedWait(m_mutex, absoluteTime); + if (timedOut) + return false; + } + + // Reset the semaphore. + m_isSet = false; + return true; +} + + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h new file mode 100644 index 0000000..8113236 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/BinarySemaphore.h @@ -0,0 +1,54 @@ +/* + * 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 BinarySemaphore_h +#define BinarySemaphore_h + +#include <wtf/Noncopyable.h> +#include <wtf/ThreadingPrimitives.h> + +namespace CoreIPC { + +class BinarySemaphore { + WTF_MAKE_NONCOPYABLE(BinarySemaphore); + +public: + BinarySemaphore(); + ~BinarySemaphore(); + + void signal(); + bool wait(double absoluteTime); + +private: + bool m_isSet; + + Mutex m_mutex; + ThreadCondition m_condition; +}; + +} // namespace CoreIPC + + +#endif // BinarySemaphore_h diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp new file mode 100644 index 0000000..da92ce4 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -0,0 +1,453 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Connection.h" + +#include "CoreIPCMessageKinds.h" +#include "RunLoop.h" +#include "WorkItem.h" +#include <wtf/CurrentTime.h> + +using namespace std; + +namespace CoreIPC { + +PassRefPtr<Connection> Connection::createServerConnection(Identifier identifier, Client* client, RunLoop* clientRunLoop) +{ + return adoptRef(new Connection(identifier, true, client, clientRunLoop)); +} + +PassRefPtr<Connection> Connection::createClientConnection(Identifier identifier, Client* client, RunLoop* clientRunLoop) +{ + return adoptRef(new Connection(identifier, false, client, clientRunLoop)); +} + +Connection::Connection(Identifier identifier, bool isServer, Client* client, RunLoop* clientRunLoop) + : m_client(client) + , m_isServer(isServer) + , m_syncRequestID(0) + , m_isConnected(false) + , m_connectionQueue("com.apple.CoreIPC.ReceiveQueue") + , m_clientRunLoop(clientRunLoop) + , m_inDispatchMessageCount(0) + , m_didReceiveInvalidMessage(false) + , m_shouldWaitForSyncReplies(true) +{ + ASSERT(m_client); + + platformInitialize(identifier); +} + +Connection::~Connection() +{ + ASSERT(!isValid()); + + m_connectionQueue.invalidate(); +} + +void Connection::invalidate() +{ + if (!isValid()) { + // Someone already called invalidate(). + return; + } + + // Reset the client. + m_client = 0; + + m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::platformInvalidate)); +} + +void Connection::markCurrentlyDispatchedMessageAsInvalid() +{ + // This should only be called while processing a message. + ASSERT(m_inDispatchMessageCount > 0); + + m_didReceiveInvalidMessage = true; +} + +PassOwnPtr<ArgumentEncoder> Connection::createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID) +{ + OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); + + // Encode the sync request ID. + syncRequestID = ++m_syncRequestID; + argumentEncoder->encode(syncRequestID); + + return argumentEncoder.release(); +} + +bool Connection::sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +{ + if (!isValid()) + return false; + + MutexLocker locker(m_outgoingMessagesLock); + m_outgoingMessages.append(OutgoingMessage(messageID, arguments)); + + // FIXME: We should add a boolean flag so we don't call this when work has already been scheduled. + m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::sendOutgoingMessages)); + return true; +} + +bool Connection::sendSyncReply(PassOwnPtr<ArgumentEncoder> arguments) +{ + return sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), arguments); +} + +PassOwnPtr<ArgumentDecoder> Connection::waitForMessage(MessageID messageID, uint64_t destinationID, double timeout) +{ + // First, check if this message is already in the incoming messages queue. + { + MutexLocker locker(m_incomingMessagesLock); + + for (size_t i = 0; i < m_incomingMessages.size(); ++i) { + const IncomingMessage& message = m_incomingMessages[i]; + + if (message.messageID() == messageID && message.arguments()->destinationID() == destinationID) { + OwnPtr<ArgumentDecoder> arguments(message.arguments()); + + // Erase the incoming message. + m_incomingMessages.remove(i); + return arguments.release(); + } + } + } + + double absoluteTime = currentTime() + timeout; + + std::pair<unsigned, uint64_t> messageAndDestination(std::make_pair(messageID.toInt(), destinationID)); + + { + MutexLocker locker(m_waitForMessageMutex); + + // We don't support having multiple clients wait for the same message. + ASSERT(!m_waitForMessageMap.contains(messageAndDestination)); + + // Insert our pending wait. + m_waitForMessageMap.set(messageAndDestination, 0); + } + + // Now wait for it to be set. + while (true) { + MutexLocker locker(m_waitForMessageMutex); + + HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(messageAndDestination); + if (it->second) { + OwnPtr<ArgumentDecoder> arguments(it->second); + m_waitForMessageMap.remove(it); + + return arguments.release(); + } + + // Now we wait. + if (!m_waitForMessageCondition.timedWait(m_waitForMessageMutex, absoluteTime)) { + // We timed out, now remove the pending wait. + m_waitForMessageMap.remove(messageAndDestination); + + break; + } + } + + return PassOwnPtr<ArgumentDecoder>(); +} + +PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder> encoder, double timeout) +{ + // We only allow sending sync messages from the client run loop. + ASSERT(RunLoop::current() == m_clientRunLoop); + + if (!isValid()) + return 0; + + // Push the pending sync reply information on our stack. + { + MutexLocker locker(m_syncReplyStateMutex); + if (!m_shouldWaitForSyncReplies) + return 0; + + m_pendingSyncReplies.append(PendingSyncReply(syncRequestID)); + } + + // First send the message. + sendMessage(messageID, encoder); + + // 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); + OwnPtr<ArgumentDecoder> reply = waitForSyncReply(syncRequestID, timeout); + + // Finally, pop the pending sync reply information. + { + 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)); + } + } + } + + return reply.release(); +} + +PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, double timeout) +{ + double absoluteTime = currentTime() + timeout; + + bool timedOut = false; + while (!timedOut) { + { + 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()); + + PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last(); + ASSERT(pendingSyncReply.syncRequestID == syncRequestID); + + // We found the sync reply, or the connection was closed. + if (pendingSyncReply.didReceiveReply || !m_shouldWaitForSyncReplies) + return pendingSyncReply.releaseReplyDecoder(); + } + + // We didn't find a sync reply yet, keep waiting. + timedOut = !m_waitForSyncReplySemaphore.wait(absoluteTime); + } + + // We timed out. + return 0; +} + +void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<ArgumentDecoder> arguments) +{ + // Check if this is a sync reply. + if (messageID == MessageID(CoreIPCMessage::SyncMessageReply)) { + MutexLocker locker(m_syncReplyStateMutex); + ASSERT(!m_pendingSyncReplies.isEmpty()); + + PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last(); + ASSERT(pendingSyncReply.syncRequestID == arguments->destinationID()); + + pendingSyncReply.replyDecoder = arguments.leakPtr(); + pendingSyncReply.didReceiveReply = true; + + m_waitForSyncReplySemaphore.signal(); + 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)); + + // 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())); + if (it != m_waitForMessageMap.end()) { + it->second = arguments.leakPtr(); + + m_waitForMessageCondition.signal(); + return; + } + } + + MutexLocker locker(m_incomingMessagesLock); + m_incomingMessages.append(IncomingMessage(messageID, arguments)); + + m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchMessages)); +} + +void Connection::connectionDidClose() +{ + // The connection is now invalid. + platformInvalidate(); + + { + MutexLocker locker(m_syncReplyStateMutex); + + ASSERT(m_shouldWaitForSyncReplies); + m_shouldWaitForSyncReplies = false; + + if (!m_pendingSyncReplies.isEmpty()) + m_waitForSyncReplySemaphore.signal(); + } + + m_client->didCloseOnConnectionWorkQueue(&m_connectionQueue, this); + + m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchConnectionDidClose)); +} + +void Connection::dispatchConnectionDidClose() +{ + // If the connection has been explicitly invalidated before dispatchConnectionDidClose was called, + // then the client will be null here. + if (!m_client) + return; + + + // Because we define a connection as being "valid" based on wheter it has a null client, we null out + // the client before calling didClose here. Otherwise, sendSync will try to send a message to the connection and + // will then wait indefinitely for a reply. + Client* client = m_client; + m_client = 0; + + client->didClose(this); +} + +bool Connection::canSendOutgoingMessages() const +{ + return m_isConnected && platformCanSendOutgoingMessages(); +} + +void Connection::sendOutgoingMessages() +{ + if (!canSendOutgoingMessages()) + return; + + while (true) { + OutgoingMessage message; + { + MutexLocker locker(m_outgoingMessagesLock); + if (m_outgoingMessages.isEmpty()) + break; + message = m_outgoingMessages.takeFirst(); + } + + if (!sendOutgoingMessage(message.messageID(), adoptPtr(message.arguments()))) + break; + } +} + +void Connection::dispatchSyncMessage(MessageID messageID, ArgumentDecoder* arguments) +{ + ASSERT(messageID.isSync()); + + // Decode the sync request ID. + uint64_t syncRequestID = 0; + + if (!arguments->decodeUInt64(syncRequestID) || !syncRequestID) { + // We received an invalid sync message. + arguments->markInvalid(); + return; + } + + // Create our reply encoder. + ArgumentEncoder* replyEncoder = ArgumentEncoder::create(syncRequestID).leakPtr(); + + // Hand off both the decoder and encoder to the client.. + SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, messageID, arguments, replyEncoder); + + // FIXME: If the message was invalid, we should send back a SyncMessageError. + ASSERT(!arguments->isInvalid()); + + if (syncReplyMode == ManualReply) { + // The client will take ownership of the reply encoder and send it at some point in the future. + // We won't do anything here. + return; + } + + // Send the reply. + sendSyncReply(replyEncoder); +} + +void Connection::dispatchMessages() +{ + Vector<IncomingMessage> incomingMessages; + + { + MutexLocker locker(m_incomingMessagesLock); + m_incomingMessages.swap(incomingMessages); + } + + // 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_inDispatchMessageCount++; + + 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()); + + m_didReceiveInvalidMessage |= arguments->isInvalid(); + m_inDispatchMessageCount--; + + if (m_didReceiveInvalidMessage) + m_client->didReceiveInvalidMessage(this, message.messageID()); + + m_didReceiveInvalidMessage = oldDidReceiveInvalidMessage; + } +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h new file mode 100644 index 0000000..b7e5b0f --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -0,0 +1,362 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * 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. + */ + +#ifndef Connection_h +#define Connection_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Arguments.h" +#include "BinarySemaphore.h" +#include "MessageID.h" +#include "WorkQueue.h" +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/OwnPtr.h> +#include <wtf/Threading.h> + +#if PLATFORM(MAC) +#include <mach/mach_port.h> +#elif PLATFORM(WIN) +#include <string> +#elif PLATFORM(QT) +#include <QString> +class QLocalServer; +class QLocalSocket; +#endif + +class RunLoop; + +namespace CoreIPC { + +class MessageID; + +enum SyncReplyMode { + AutomaticReply, + ManualReply +}; + +#define MESSAGE_CHECK_BASE(assertion, connection) do \ + if (!(assertion)) { \ + ASSERT(assertion); \ + (connection)->markCurrentlyDispatchedMessageAsInvalid(); \ + return; \ + } \ +while (0) + +class Connection : public ThreadSafeShared<Connection> { +public: + class MessageReceiver { + protected: + virtual ~MessageReceiver() { } + + public: + virtual void didReceiveMessage(Connection*, MessageID, ArgumentDecoder*) = 0; + virtual SyncReplyMode didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, ArgumentEncoder*) { ASSERT_NOT_REACHED(); return AutomaticReply; } + }; + + class Client : public MessageReceiver { + protected: + virtual ~Client() { } + + 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*) { } + }; + +#if PLATFORM(MAC) + typedef mach_port_t Identifier; +#elif PLATFORM(WIN) + typedef HANDLE Identifier; + static bool createServerAndClientIdentifiers(Identifier& serverIdentifier, Identifier& clientIdentifier); +#elif PLATFORM(QT) + typedef const QString Identifier; +#elif PLATFORM(GTK) + typedef int Identifier; +#endif + + static PassRefPtr<Connection> createServerConnection(Identifier, Client*, RunLoop* clientRunLoop); + static PassRefPtr<Connection> createClientConnection(Identifier, Client*, RunLoop* clientRunLoop); + ~Connection(); + +#if PLATFORM(MAC) + void setShouldCloseConnectionOnMachExceptions(); +#endif + + bool open(); + void invalidate(); + void markCurrentlyDispatchedMessageAsInvalid(); + + // FIXME: This variant of send is deprecated, all clients should move to the overload that takes a message. + 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); + + static const unsigned long long NoTimeout = 10000000000ULL; + // FIXME: This variant of sendSync is deprecated, all clients should move to the overload that takes a message. + 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 T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout); + + template<typename E> PassOwnPtr<ArgumentDecoder> waitFor(E messageID, uint64_t destinationID, double timeout); + + PassOwnPtr<ArgumentEncoder> createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID); + bool sendMessage(MessageID, PassOwnPtr<ArgumentEncoder>); + bool sendSyncReply(PassOwnPtr<ArgumentEncoder>); + +private: + template<typename T> class Message { + public: + Message() + : m_arguments(0) + { + } + + Message(MessageID messageID, PassOwnPtr<T> arguments) + : m_messageID(messageID) + , m_arguments(arguments.leakPtr()) + { + } + + MessageID messageID() const { return m_messageID; } + T* arguments() const { return m_arguments; } + + PassOwnPtr<T> releaseArguments() + { + T* arguments = m_arguments; + m_arguments = 0; + + return arguments; + } + + private: + MessageID m_messageID; + T* m_arguments; + }; + +public: + typedef Message<ArgumentEncoder> OutgoingMessage; + +private: + Connection(Identifier, bool isServer, Client*, RunLoop* clientRunLoop); + void platformInitialize(Identifier); + void platformInvalidate(); + + bool isValid() const { return m_client; } + + PassOwnPtr<ArgumentDecoder> waitForMessage(MessageID, uint64_t destinationID, double timeout); + + PassOwnPtr<ArgumentDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder>, double timeout); + PassOwnPtr<ArgumentDecoder> waitForSyncReply(uint64_t syncRequestID, double timeout); + + // Called on the connection work queue. + void processIncomingMessage(MessageID, PassOwnPtr<ArgumentDecoder>); + bool canSendOutgoingMessages() const; + bool platformCanSendOutgoingMessages() const; + void sendOutgoingMessages(); + bool sendOutgoingMessage(MessageID, PassOwnPtr<ArgumentEncoder>); + void connectionDidClose(); + + // Called on the listener thread. + void dispatchConnectionDidClose(); + void dispatchMessages(); + void dispatchSyncMessage(MessageID, ArgumentDecoder*); + + Client* m_client; + bool m_isServer; + uint64_t m_syncRequestID; + + bool m_isConnected; + WorkQueue m_connectionQueue; + RunLoop* m_clientRunLoop; + + uint32_t m_inDispatchMessageCount; + bool m_didReceiveInvalidMessage; + + // Incoming messages. + typedef Message<ArgumentDecoder> IncomingMessage; + + Mutex m_incomingMessagesLock; + Vector<IncomingMessage> m_incomingMessages; + + // Outgoing messages. + Mutex m_outgoingMessagesLock; + Deque<OutgoingMessage> m_outgoingMessages; + + ThreadCondition m_waitForMessageCondition; + Mutex m_waitForMessageMutex; + HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*> m_waitForMessageMap; + + // Represents a sync request for which we're waiting on a reply. + struct PendingSyncReply { + // The request ID. + uint64_t syncRequestID; + + // The reply decoder, will be null if there was an error processing the sync + // message on the other side. + ArgumentDecoder* replyDecoder; + + // Will be set to true once a reply has been received or an error occurred. + bool didReceiveReply; + + PendingSyncReply() + : syncRequestID(0) + , replyDecoder(0) + , didReceiveReply(false) + { + } + + explicit PendingSyncReply(uint64_t syncRequestID) + : syncRequestID(syncRequestID) + , replyDecoder(0) + , didReceiveReply(0) + { + } + + PassOwnPtr<ArgumentDecoder> releaseReplyDecoder() + { + OwnPtr<ArgumentDecoder> reply = adoptPtr(replyDecoder); + replyDecoder = 0; + + return reply.release(); + } + }; + + BinarySemaphore m_waitForSyncReplySemaphore; + + Mutex m_syncReplyStateMutex; + bool m_shouldWaitForSyncReplies; + Vector<PendingSyncReply> m_pendingSyncReplies; + Vector<IncomingMessage> m_syncMessagesReceivedWhileWaitingForSyncReply; + +#if PLATFORM(MAC) + // Called on the connection queue. + void receiveSourceEventHandler(); + void initializeDeadNameSource(); + void exceptionSourceEventHandler(); + + mach_port_t m_sendPort; + mach_port_t m_receivePort; + + // If setShouldCloseConnectionOnMachExceptions has been called, this has + // the exception port that exceptions from the other end will be sent on. + mach_port_t m_exceptionPort; + +#elif PLATFORM(WIN) + // Called on the connection queue. + void readEventHandler(); + void writeEventHandler(); + + Vector<uint8_t> m_readBuffer; + OVERLAPPED m_readState; + OwnPtr<ArgumentEncoder> m_pendingWriteArguments; + OVERLAPPED m_writeState; + HANDLE m_connectionPipe; +#elif PLATFORM(QT) + // Called on the connection queue. + void readyReadHandler(); + + Vector<uint8_t> m_readBuffer; + size_t m_currentMessageSize; + QLocalSocket* m_socket; + QString m_serverName; +#elif PLATFORM(GTK) + void readEventHandler(); + void processCompletedMessage(); + bool messageProcessingCompleted() { return !m_currentMessageSize; } + + int m_socket; + Vector<uint8_t> m_readBuffer; + size_t m_currentMessageSize; + size_t m_pendingBytes; +#endif +}; + +template<typename E, typename T> +bool Connection::send(E messageID, uint64_t destinationID, const T& arguments) +{ + OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); + argumentEncoder->encode(arguments); + + return sendMessage(MessageID(messageID), argumentEncoder.release()); +} + +template<typename T> bool Connection::send(const T& message, uint64_t destinationID) +{ + OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); + argumentEncoder->encode(message); + + return sendMessage(MessageID(T::messageID), argumentEncoder.release()); +} + +template<typename E, typename T, typename U> +inline bool Connection::sendSync(E messageID, uint64_t destinationID, const T& arguments, const U& reply, double timeout) +{ + uint64_t syncRequestID = 0; + OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID); + + // Encode the input arguments. + argumentEncoder->encode(arguments); + + // Now send the message and wait for a reply. + OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout); + if (!replyDecoder) + return false; + + // Decode the reply. + return replyDecoder->decode(const_cast<U&>(reply)); +} + +template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout) +{ + uint64_t syncRequestID = 0; + OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID); + + // Encode the rest of the input arguments. + argumentEncoder->encode(message); + + // Now send the message and wait for a reply. + OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(T::messageID, MessageID::SyncMessage), syncRequestID, argumentEncoder.release(), timeout); + if (!replyDecoder) + return false; + + // Decode the reply. + return replyDecoder->decode(const_cast<typename T::Reply&>(reply)); +} + +template<typename E> inline PassOwnPtr<ArgumentDecoder> Connection::waitFor(E messageID, uint64_t destinationID, double timeout) +{ + return waitForMessage(MessageID(messageID), destinationID, timeout); +} + +} // namespace CoreIPC + +#endif // Connection_h diff --git a/Source/WebKit2/Platform/CoreIPC/CoreIPCMessageKinds.h b/Source/WebKit2/Platform/CoreIPC/CoreIPCMessageKinds.h new file mode 100644 index 0000000..b2a2813 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/CoreIPCMessageKinds.h @@ -0,0 +1,51 @@ +/* + * 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 CoreIPCMessageKinds_h +#define CoreIPCMessageKinds_h + +#include "MessageID.h" + +namespace CoreIPC { + +namespace CoreIPCMessage { + +enum Kind { + InitializeConnection, + SyncMessageReply, +#if PLATFORM(MAC) + SetExceptionPort, +#endif +}; + +} // namespace CoreIPCMessage + +template<> struct MessageKindTraits<CoreIPCMessage::Kind> { + static const MessageClass messageClass = MessageClassCoreIPC; +}; + +} // namespace CoreIPC + +#endif // CoreIPCMessageKinds_h diff --git a/Source/WebKit2/Platform/CoreIPC/DataReference.cpp b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp new file mode 100644 index 0000000..308fd6e --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/DataReference.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DataReference.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" + +namespace CoreIPC { + +void DataReference::encode(ArgumentEncoder* encoder) const +{ + encoder->encodeBytes(m_data, m_size); +} + +bool DataReference::decode(ArgumentDecoder* decoder, DataReference& dataReference) +{ + return decoder->decodeBytes(dataReference); +} + +} // namespace CoreIPC + + diff --git a/Source/WebKit2/Platform/CoreIPC/DataReference.h b/Source/WebKit2/Platform/CoreIPC/DataReference.h new file mode 100644 index 0000000..1657bea --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/DataReference.h @@ -0,0 +1,70 @@ +/* + * 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 DataReference_h +#define DataReference_h + +#include <inttypes.h> + +namespace CoreIPC { + +class ArgumentDecoder; +class ArgumentEncoder; + +class DataReference { +public: + DataReference() + : m_data(0) + , m_size(0) + { + } + + DataReference(const uint8_t* data, size_t size) + : m_data(data) + , m_size(size) + { + } + + bool isEmpty() const { return size() == 0; } + + size_t size() const { return m_size; } + const uint8_t* data() const + { + if (isEmpty()) + return 0; + return m_data; + } + + void encode(ArgumentEncoder* encoder) const; + static bool decode(ArgumentDecoder* decoder, DataReference& dataReference); + +private: + const uint8_t* m_data; + size_t m_size; +}; + +} // namespace CoreIPC + +#endif // DataReference_h diff --git a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h new file mode 100644 index 0000000..534e825 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h @@ -0,0 +1,248 @@ +#ifndef HandleMessage_h +#define HandleMessage_h + +#include "Arguments.h" + +namespace CoreIPC { + +// Dispatch functions with no reply arguments. + +template<typename C, typename MF> +void callMemberFunction(const Arguments0&, C* object, MF function) +{ + (object->*function)(); +} + +template<typename C, typename MF, typename P1> +void callMemberFunction(const Arguments1<P1>& args, C* object, MF function) +{ + (object->*function)(args.argument1); +} + +template<typename C, typename MF, typename P1, typename P2> +void callMemberFunction(const Arguments2<P1, P2>& args, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3> +void callMemberFunction(const Arguments3<P1, P2, P3>& args, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5> +void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> +void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6); +} + +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, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7); +} + +// Dispatch functions with reply arguments. + +template<typename C, typename MF> +void callMemberFunction(const Arguments0&, Arguments0&, C* object, MF function) +{ + (object->*function)(); +} + +template<typename C, typename MF, typename R1> +void callMemberFunction(const Arguments0&, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(replyArgs.argument1); +} + +template<typename C, typename MF, typename R1, typename R2> +void callMemberFunction(const Arguments0&, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(replyArgs.argument1, replyArgs.argument2); +} + +template<typename C, typename MF, typename P1> +void callMemberFunction(const Arguments1<P1>& args, Arguments0&, C* object, MF function) +{ + (object->*function)(args.argument1); +} + +template<typename C, typename MF, typename P1, typename R1> +void callMemberFunction(const Arguments1<P1>& args, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, replyArgs.argument1); +} + +template<typename C, typename MF, typename P1, typename R1, typename R2> +void callMemberFunction(const Arguments1<P1>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2); +} + +template<typename C, typename MF, typename P1, typename R1, typename R2, typename R3> +void callMemberFunction(const Arguments1<P1>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3); +} + +template<typename C, typename MF, typename P1, typename P2> +void callMemberFunction(const Arguments2<P1, P2>& args, Arguments0&, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2); +} + +template<typename C, typename MF, typename P1, typename R1, typename R2, typename R3, typename R4> +void callMemberFunction(const Arguments1<P1>& args, Arguments4<R1, R2, R3, R4>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3, replyArgs.argument4); +} + +template<typename C, typename MF, typename P1, typename P2, typename R1> +void callMemberFunction(const Arguments2<P1, P2>& args, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, replyArgs.argument1); +} + +template<typename C, typename MF, typename P1, typename P2, typename R1, typename R2> +void callMemberFunction(const Arguments2<P1, P2>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, replyArgs.argument1, replyArgs.argument2); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename R1> +void callMemberFunction(const Arguments3<P1, P2, P3>& args, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, replyArgs.argument1); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename R1, typename R2> +void callMemberFunction(const Arguments3<P1, P2, P3>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, replyArgs.argument1, replyArgs.argument2); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename R1> +void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, Arguments1<R1>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7, replyArgs.argument1); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename R1, typename R2> +void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function) +{ + (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 R1, typename R2, typename R3> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3); +} + +// Variadic dispatch functions. + +template<typename C, typename MF> +void callMemberFunction(const Arguments0&, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(argumentDecoder); +} + +template<typename C, typename MF, typename P1> +void callMemberFunction(const Arguments1<P1>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, argumentDecoder); +} + +template<typename C, typename MF, typename P1, typename P2> +void callMemberFunction(const Arguments2<P1, P2>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, argumentDecoder); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3> +void callMemberFunction(const Arguments3<P1, P2, P3>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, argumentDecoder); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4> +void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, argumentDecoder); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5> +void callMemberFunction(const Arguments5<P1, P2, P3, P4, P5>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, argumentDecoder); +} + +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> +void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, argumentDecoder); +} + + +// Main dispatch functions + +template<typename T, typename C, typename MF> +void handleMessage(ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + typename T::DecodeType::ValueType arguments; + if (!argumentDecoder->decode(arguments)) + return; + callMemberFunction(arguments, object, function); +} + +template<typename T, typename C, typename MF> +void handleMessage(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, replyArguments, object, function); + replyEncoder->encode(replyArguments); +} + +template<typename T, typename C, typename MF> +void handleMessageVariadic(ArgumentDecoder* argumentDecoder, C* object, MF function) +{ + typename T::DecodeType::ValueType arguments; + if (!argumentDecoder->decode(arguments)) + return; + callMemberFunction(arguments, argumentDecoder, object, function); +} + +} // namespace CoreIPC + +#endif // HandleMessage_h diff --git a/Source/WebKit2/Platform/CoreIPC/MessageID.h b/Source/WebKit2/Platform/CoreIPC/MessageID.h new file mode 100644 index 0000000..724302c --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/MessageID.h @@ -0,0 +1,156 @@ +/* + * 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 MessageID_h +#define MessageID_h + +namespace CoreIPC { + +enum MessageClass { + MessageClassReserved = 0, + + // Messages sent by Core IPC. + MessageClassCoreIPC, + + // Messages sent by the UI process to the web process. + MessageClassAuthenticationManager, + MessageClassDrawingArea, + MessageClassDrawingAreaLegacy, + MessageClassInjectedBundle, + MessageClassWebDatabaseManager, + MessageClassWebGeolocationManagerProxy, + MessageClassWebInspector, + MessageClassWebPage, + MessageClassWebProcess, + + // Messages sent by the web process to the UI process. + MessageClassDownloadProxy, + MessageClassDrawingAreaProxy, + MessageClassDrawingAreaProxyLegacy, + MessageClassWebContext, + MessageClassWebContextLegacy, + MessageClassWebDatabaseManagerProxy, + MessageClassWebGeolocationManager, + MessageClassWebInspectorProxy, + MessageClassWebPageProxy, + MessageClassWebProcessProxy, + MessageClassWebProcessProxyLegacy, + + // Messages sent by the UI process to the plug-in process. + MessageClassPluginProcess, + + // Messages sent by the plug-in process to the UI process. + MessageClassPluginProcessProxy, + + // Messages sent by the web process to the plug-in process. + MessageClassWebProcessConnection, + MessageClassPluginControllerProxy, + + // Messages sent by the plug-in process to the web process. + MessageClassPluginProxy, + + // NPObject messages sent by both the plug-in process and the web process. + MessageClassNPObjectMessageReceiver, +}; + +template<typename> struct MessageKindTraits { }; + + +/* + MessageID Layout (the most significant bit is reserved and therefore always zero) + + --------- + | Flags | 7 bits + |-------| + | Class | 8 bits + |-------| + | Msg | 16 bits + | Kind | + --------- +*/ + +class MessageID { +public: + enum Flags { + SyncMessage = 1 << 0, + }; + + MessageID() + : m_messageID(0) + { + } + + template <typename EnumType> + explicit MessageID(EnumType messageKind, unsigned char flags = 0) + : m_messageID(stripMostSignificantBit(flags << 24 | (MessageKindTraits<EnumType>::messageClass) << 16 | messageKind)) + { + } + + template <typename EnumType> + EnumType get() const + { + ASSERT(getClass() == MessageKindTraits<EnumType>::messageClass); + return static_cast<EnumType>(m_messageID & 0xffff); + } + + template <MessageClass K> + bool is() const + { + return getClass() == K; + } + + template <typename EnumType> + bool operator==(EnumType messageKind) const + { + return m_messageID == MessageID(messageKind).m_messageID; + } + + static MessageID fromInt(unsigned i) + { + MessageID messageID; + messageID.m_messageID = stripMostSignificantBit(i); + + return messageID; + } + + unsigned toInt() const { return m_messageID; } + + bool isSync() const { return getFlags() & SyncMessage; } + +private: + static inline unsigned stripMostSignificantBit(unsigned value) + { + return value & 0x7fffffff; + } + + unsigned char getFlags() const { return (m_messageID & 0xff000000) >> 24; } + unsigned char getClass() const { return (m_messageID & 0x00ff0000) >> 16; } + + unsigned m_messageID; +}; + +} // namespace CoreIPC + +#endif // MessageID_h diff --git a/Source/WebKit2/Platform/CoreIPC/MessageSender.h b/Source/WebKit2/Platform/CoreIPC/MessageSender.h new file mode 100644 index 0000000..e2ba0b5 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/MessageSender.h @@ -0,0 +1,73 @@ +/* + * 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 MessageSender_h +#define MessageSender_h + +#include <wtf/Assertions.h> +#include "Connection.h" + +namespace CoreIPC { + +template<typename T> class MessageSender { +public: + template<typename U> bool send(const U& message) + { + return send(message, static_cast<T*>(this)->destinationID()); + } + + template<typename U> bool send(const U& message, uint64_t destinationID) + { + OwnPtr<ArgumentEncoder> argumentEncoder = ArgumentEncoder::create(destinationID); + argumentEncoder->encode(message); + + return static_cast<T*>(this)->sendMessage(MessageID(U::messageID), argumentEncoder.release()); + } + + bool sendMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> argumentEncoder) + { + Connection* connection = static_cast<T*>(this)->connection(); + ASSERT(connection); + + return connection->sendMessage(messageID, argumentEncoder); + } + + template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, double timeout = Connection::NoTimeout) + { + return sendSync(message, reply, static_cast<T*>(this)->destinationID(), timeout); + } + + template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = Connection::NoTimeout) + { + Connection* connection = static_cast<T*>(this)->connection(); + ASSERT(connection); + + return connection->sendSync(message, reply, destinationID, timeout); + } +}; + +} // namespace CoreIPC + +#endif // MessageSender_h diff --git a/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp new file mode 100644 index 0000000..65b1254 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/gtk/ConnectionGtk.cpp @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Connection.h" + +#include "ArgumentEncoder.h" +#include "WorkItem.h" +#include <errno.h> +#include <glib.h> +#include <sys/fcntl.h> + +using namespace std; + +namespace CoreIPC { + +static const size_t initialMessageBufferSize = 4096; + +static int readBytesFromSocket(int fileDescriptor, uint8_t* ptr, size_t length) +{ + ASSERT(fileDescriptor > 0); + ASSERT(buffer); + ASSERT(length > 0); + + ssize_t numberOfBytesRead = 0; + size_t pendingBytesToRead = length; + uint8_t* buffer = ptr; + + while (pendingBytesToRead > 0) { + if ((numberOfBytesRead = read(fileDescriptor, buffer, pendingBytesToRead)) < 0) { + if (errno == EINTR) + numberOfBytesRead = 0; + else if (errno == EAGAIN || errno == EWOULDBLOCK) + break; + else + return 0; + } else if (!numberOfBytesRead) + break; + + buffer += numberOfBytesRead; + pendingBytesToRead -= numberOfBytesRead; + } + + return (length - pendingBytesToRead); +} + +static bool writeBytesToSocket(int fileDescriptor, uint8_t* ptr, size_t length) +{ + ASSERT(fileDescriptor > 0); + ASSERT(buffer); + ASSERT(length > 0); + + ssize_t numberOfBytesWritten = 0; + size_t pendingBytesToWrite = length; + uint8_t* buffer = ptr; + + // Keep writing to the socket till the complete message has been written. + while (pendingBytesToWrite > 0) { + if ((numberOfBytesWritten = write(fileDescriptor, buffer, pendingBytesToWrite)) < 0) { + if (errno == EINTR) + numberOfBytesWritten = 0; + else + return false; + } + buffer += numberOfBytesWritten; + pendingBytesToWrite -= numberOfBytesWritten; + } + + // Write operation failed if complete message is not written. + return !pendingBytesToWrite; +} + +void Connection::platformInitialize(Identifier identifier) +{ + m_currentMessageSize = 0; + m_pendingBytes = 0; + m_readBuffer.resize(initialMessageBufferSize); + m_socket = identifier; + m_isConnected = true; +} + +void Connection::platformInvalidate() +{ + if (!m_isConnected) + return; + + m_connectionQueue.unregisterEventSourceHandler(m_socket); + if (m_socket > 0) { + close(m_socket); + m_socket = -1; + } + + m_isConnected = false; +} + +void Connection::processCompletedMessage() +{ + size_t realBufferSize = m_currentMessageSize - sizeof(MessageID); + unsigned messageID = *reinterpret_cast<unsigned*>(m_readBuffer.data() + realBufferSize); + + processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize))); + + // Prepare for the next message. + m_currentMessageSize = 0; + m_pendingBytes = 0; +} + +void Connection::readEventHandler() +{ + if (m_socket < 0) + return; + + // Handle any previously unprocessed message. + if (!messageProcessingCompleted()) { + if ((m_pendingBytes -= readBytesFromSocket(m_socket, (m_readBuffer.data() + (m_currentMessageSize - m_pendingBytes)), m_pendingBytes)) > 0) + return; + + // Message received completely. Process the message now. + processCompletedMessage(); + } + + // Prepare to read the next message. + uint8_t sizeBuffer[sizeof(size_t)]; + memset(sizeBuffer, 0, sizeof(size_t)); + + while (messageProcessingCompleted()) { + if (readBytesFromSocket(m_socket, sizeBuffer, sizeof(size_t))) + m_currentMessageSize = *reinterpret_cast<size_t*>(sizeBuffer); + + if (!m_currentMessageSize) + break; + + if (m_readBuffer.size() < m_currentMessageSize) + m_readBuffer.grow(m_currentMessageSize); + + m_pendingBytes = m_currentMessageSize - readBytesFromSocket(m_socket, m_readBuffer.data(), m_currentMessageSize); + if (m_pendingBytes > 0) // Message partially received. + break; + + // Message received completely. Process the message now. + processCompletedMessage(); + + memset(sizeBuffer, 0, sizeof(size_t)); + } +} + +bool Connection::open() +{ + int flags = fcntl(m_socket, F_GETFL, 0); + fcntl(m_socket, F_SETFL, flags | O_NONBLOCK); + + // 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)); + return true; +} + +bool Connection::platformCanSendOutgoingMessages() const +{ + return (m_socket > 0); +} + +bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +{ + if (m_socket < 0) + return false; + + // We put the message ID last. + arguments->encodeUInt32(messageID.toInt()); + + size_t bufferSize = arguments->bufferSize(); + + // Send the message size first. + if (!writeBytesToSocket(m_socket, reinterpret_cast<uint8_t*>(&bufferSize), sizeof(size_t))) + return false; + + if (!writeBytesToSocket(m_socket, arguments->buffer(), arguments->bufferSize())) + return false; + + return true; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp new file mode 100644 index 0000000..5e7bbbc --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp @@ -0,0 +1,424 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Connection.h" + +#include "CoreIPCMessageKinds.h" +#include "MachPort.h" +#include "MachUtilities.h" +#include "RunLoop.h" +#include <mach/vm_map.h> + +using namespace std; + +namespace CoreIPC { + +static const size_t inlineMessageMaxSize = 4096; + +enum { + MessageBodyIsOOL = 1 << 31 +}; + +void Connection::platformInvalidate() +{ + if (!m_isConnected) + return; + + m_isConnected = false; + + ASSERT(m_sendPort); + ASSERT(m_receivePort); + + // Unregister our ports. + m_connectionQueue.unregisterMachPortEventHandler(m_sendPort); + m_sendPort = MACH_PORT_NULL; + + m_connectionQueue.unregisterMachPortEventHandler(m_receivePort); + m_receivePort = MACH_PORT_NULL; + + if (m_exceptionPort) { + m_connectionQueue.unregisterMachPortEventHandler(m_exceptionPort); + m_exceptionPort = MACH_PORT_NULL; + } +} + +void Connection::platformInitialize(Identifier identifier) +{ + m_exceptionPort = MACH_PORT_NULL; + + if (m_isServer) { + m_receivePort = identifier; + m_sendPort = MACH_PORT_NULL; + } else { + m_receivePort = MACH_PORT_NULL; + m_sendPort = identifier; + } +} + +bool Connection::open() +{ + if (m_isServer) { + ASSERT(m_receivePort); + ASSERT(!m_sendPort); + + } else { + ASSERT(!m_receivePort); + ASSERT(m_sendPort); + + // Create the receive port. + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_receivePort); + + 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)); + + // Set the dead name handler for our send port. + initializeDeadNameSource(); + } + + // Change the message queue length for the receive port. + setMachPortQueueLength(m_receivePort, MACH_PORT_QLIMIT_LARGE); + + // Register the data available handler. + m_connectionQueue.registerMachPortEventHandler(m_receivePort, WorkQueue::MachPortDataAvailable, WorkItem::create(this, &Connection::receiveSourceEventHandler)); + + // If we have an exception port, register the data available handler and send over the port to the other end. + 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)); + } + + return true; +} + +static inline size_t machMessageSize(size_t bodySize, size_t numberOfPortDescriptors = 0, size_t numberOfOOLMemoryDescriptors = 0) +{ + size_t size = sizeof(mach_msg_header_t) + bodySize; + if (numberOfPortDescriptors || numberOfOOLMemoryDescriptors) { + size += sizeof(mach_msg_body_t); + if (numberOfPortDescriptors) + size += (numberOfPortDescriptors * sizeof(mach_msg_port_descriptor_t)); + if (numberOfOOLMemoryDescriptors) + size += (numberOfOOLMemoryDescriptors * sizeof(mach_msg_ool_ports_descriptor_t)); + } + return round_msg(size); +} + +bool Connection::platformCanSendOutgoingMessages() const +{ + return true; +} + +bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +{ + Vector<Attachment> attachments = arguments->releaseAttachments(); + + size_t numberOfPortDescriptors = 0; + size_t numberOfOOLMemoryDescriptors = 0; + for (size_t i = 0; i < attachments.size(); ++i) { + Attachment::Type type = attachments[i].type(); + if (type == Attachment::MachPortType) + numberOfPortDescriptors++; + else if (type == Attachment::MachOOLMemoryType) + numberOfOOLMemoryDescriptors++; + } + + size_t messageSize = machMessageSize(arguments->bufferSize(), numberOfPortDescriptors, numberOfOOLMemoryDescriptors); + char buffer[inlineMessageMaxSize]; + + bool messageBodyIsOOL = false; + if (messageSize > sizeof(buffer)) { + messageBodyIsOOL = true; + + attachments.append(Attachment(arguments->buffer(), arguments->bufferSize(), MACH_MSG_VIRTUAL_COPY, false)); + numberOfOOLMemoryDescriptors++; + messageSize = machMessageSize(0, numberOfPortDescriptors, numberOfOOLMemoryDescriptors); + } + + bool isComplex = (numberOfPortDescriptors + numberOfOOLMemoryDescriptors > 0); + + mach_msg_header_t* header = reinterpret_cast<mach_msg_header_t*>(&buffer); + header->msgh_bits = isComplex ? MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND | MACH_MSGH_BITS_COMPLEX, 0) : MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); + header->msgh_size = messageSize; + header->msgh_remote_port = m_sendPort; + header->msgh_local_port = MACH_PORT_NULL; + header->msgh_id = messageID.toInt(); + if (messageBodyIsOOL) + header->msgh_id |= MessageBodyIsOOL; + + uint8_t* messageData; + + if (isComplex) { + mach_msg_body_t* body = reinterpret_cast<mach_msg_body_t*>(header + 1); + body->msgh_descriptor_count = numberOfPortDescriptors + numberOfOOLMemoryDescriptors; + + uint8_t* descriptorData = reinterpret_cast<uint8_t*>(body + 1); + for (size_t i = 0; i < attachments.size(); ++i) { + Attachment attachment = attachments[i]; + + mach_msg_descriptor_t* descriptor = reinterpret_cast<mach_msg_descriptor_t*>(descriptorData); + switch (attachment.type()) { + case Attachment::MachPortType: + descriptor->port.name = attachment.port(); + descriptor->port.disposition = attachment.disposition(); + descriptor->port.type = MACH_MSG_PORT_DESCRIPTOR; + + descriptorData += sizeof(mach_msg_port_descriptor_t); + break; + case Attachment::MachOOLMemoryType: + descriptor->out_of_line.address = attachment.address(); + descriptor->out_of_line.size = attachment.size(); + descriptor->out_of_line.copy = attachment.copyOptions(); + descriptor->out_of_line.deallocate = attachment.deallocate(); + descriptor->out_of_line.type = MACH_MSG_OOL_DESCRIPTOR; + + descriptorData += sizeof(mach_msg_ool_descriptor_t); + break; + default: + ASSERT_NOT_REACHED(); + } + } + + messageData = descriptorData; + } else + messageData = (uint8_t*)(header + 1); + + // Copy the data if it is not being sent out-of-line. + if (!messageBodyIsOOL) + memcpy(messageData, arguments->buffer(), arguments->bufferSize()); + + ASSERT(m_sendPort); + + // Send the message. + kern_return_t kr = mach_msg(header, MACH_SEND_MSG, messageSize, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (kr != KERN_SUCCESS) { + // FIXME: What should we do here? + } + + return true; +} + +void Connection::initializeDeadNameSource() +{ + m_connectionQueue.registerMachPortEventHandler(m_sendPort, WorkQueue::MachPortDeadNameNotification, WorkItem::create(this, &Connection::connectionDidClose)); +} + +static PassOwnPtr<ArgumentDecoder> createArgumentDecoder(mach_msg_header_t* header) +{ + if (!(header->msgh_bits & MACH_MSGH_BITS_COMPLEX)) { + // We have a simple message. + size_t bodySize = header->msgh_size - sizeof(mach_msg_header_t); + uint8_t* body = reinterpret_cast<uint8_t*>(header + 1); + + return adoptPtr(new ArgumentDecoder(body, bodySize)); + } + + bool messageBodyIsOOL = header->msgh_id & MessageBodyIsOOL; + + mach_msg_body_t* body = reinterpret_cast<mach_msg_body_t*>(header + 1); + mach_msg_size_t numDescriptors = body->msgh_descriptor_count; + ASSERT(numDescriptors); + + // Build attachment list + Deque<Attachment> attachments; + uint8_t* descriptorData = reinterpret_cast<uint8_t*>(body + 1); + + // If the message body was sent out-of-line, don't treat the last descriptor + // as an attachment, since it is really the message body. + if (messageBodyIsOOL) + --numDescriptors; + + for (mach_msg_size_t i = 0; i < numDescriptors; ++i) { + mach_msg_descriptor_t* descriptor = reinterpret_cast<mach_msg_descriptor_t*>(descriptorData); + + switch (descriptor->type.type) { + case MACH_MSG_PORT_DESCRIPTOR: + attachments.append(Attachment(descriptor->port.name, descriptor->port.disposition)); + descriptorData += sizeof(mach_msg_port_descriptor_t); + break; + case MACH_MSG_OOL_DESCRIPTOR: + attachments.append(Attachment(descriptor->out_of_line.address, descriptor->out_of_line.size, + descriptor->out_of_line.copy, descriptor->out_of_line.deallocate)); + descriptorData += sizeof(mach_msg_ool_descriptor_t); + break; + default: + ASSERT(false && "Unhandled descriptor type"); + } + } + + if (messageBodyIsOOL) { + mach_msg_descriptor_t* descriptor = reinterpret_cast<mach_msg_descriptor_t*>(descriptorData); + ASSERT(descriptor->type.type == MACH_MSG_OOL_DESCRIPTOR); + Attachment messageBodyAttachment(descriptor->out_of_line.address, descriptor->out_of_line.size, + descriptor->out_of_line.copy, descriptor->out_of_line.deallocate); + + uint8_t* messageBody = static_cast<uint8_t*>(messageBodyAttachment.address()); + size_t messageBodySize = messageBodyAttachment.size(); + + ArgumentDecoder* argumentDecoder; + + if (attachments.isEmpty()) + argumentDecoder = new ArgumentDecoder(messageBody, messageBodySize); + else + argumentDecoder = new ArgumentDecoder(messageBody, messageBodySize, attachments); + + vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(messageBodyAttachment.address()), messageBodyAttachment.size()); + + return adoptPtr(argumentDecoder); + } + + uint8_t* messageBody = descriptorData; + size_t messageBodySize = header->msgh_size - (descriptorData - reinterpret_cast<uint8_t*>(header)); + + return adoptPtr(new ArgumentDecoder(messageBody, messageBodySize, attachments)); +} + +// The receive buffer size should always include the maximum trailer size. +static const size_t receiveBufferSize = inlineMessageMaxSize + MAX_TRAILER_SIZE; +typedef Vector<char, receiveBufferSize> ReceiveBuffer; + +static mach_msg_header_t* readFromMachPort(mach_port_t machPort, ReceiveBuffer& buffer) +{ + buffer.resize(receiveBufferSize); + + mach_msg_header_t* header = reinterpret_cast<mach_msg_header_t*>(buffer.data()); + kern_return_t kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT, 0, buffer.size(), machPort, 0, MACH_PORT_NULL); + if (kr == MACH_RCV_TIMED_OUT) + return 0; + + if (kr == MACH_RCV_TOO_LARGE) { + // The message was too large, resize the buffer and try again. + buffer.resize(header->msgh_size + MAX_TRAILER_SIZE); + header = reinterpret_cast<mach_msg_header_t*>(buffer.data()); + + kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT, 0, buffer.size(), machPort, 0, MACH_PORT_NULL); + ASSERT(kr != MACH_RCV_TOO_LARGE); + } + + if (kr != MACH_MSG_SUCCESS) { + ASSERT_NOT_REACHED(); + return 0; + } + + return header; +} + +void Connection::receiveSourceEventHandler() +{ + ReceiveBuffer buffer; + + mach_msg_header_t* header = readFromMachPort(m_receivePort, buffer); + if (!header) + return; + + MessageID messageID = MessageID::fromInt(header->msgh_id); + OwnPtr<ArgumentDecoder> arguments = createArgumentDecoder(header); + ASSERT(arguments); + + if (messageID == MessageID(CoreIPCMessage::InitializeConnection)) { + ASSERT(m_isServer); + ASSERT(!m_isConnected); + ASSERT(!m_sendPort); + + MachPort port; + if (!arguments->decode(port)) { + // FIXME: Disconnect. + return; + } + + m_sendPort = port.port(); + + // Set the dead name source if needed. + if (m_sendPort) + initializeDeadNameSource(); + + m_isConnected = true; + + // Send any pending outgoing messages. + sendOutgoingMessages(); + + return; + } + + if (messageID == MessageID(CoreIPCMessage::SetExceptionPort)) { + MachPort exceptionPort; + if (!arguments->decode(exceptionPort)) + return; + + setMachExceptionPort(exceptionPort.port()); + return; + } + + processIncomingMessage(messageID, arguments.release()); +} + +void Connection::exceptionSourceEventHandler() +{ + ReceiveBuffer buffer; + + mach_msg_header_t* header = readFromMachPort(m_exceptionPort, buffer); + if (!header) + return; + + // We've read the exception message. Now send it on to the real exception port. + + // The remote port should have a send once right. + ASSERT(MACH_MSGH_BITS_REMOTE(header->msgh_bits) == MACH_MSG_TYPE_MOVE_SEND_ONCE); + + // Now get the real exception port. + mach_port_t exceptionPort = machExceptionPort(); + + // First, get the complex bit from the source message. + mach_msg_bits_t messageBits = header->msgh_bits & MACH_MSGH_BITS_COMPLEX; + messageBits |= MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_MOVE_SEND_ONCE); + + header->msgh_bits = messageBits; + header->msgh_local_port = header->msgh_remote_port; + header->msgh_remote_port = exceptionPort; + + // Now send along the message. + kern_return_t kr = mach_msg(header, MACH_SEND_MSG, header->msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (kr != KERN_SUCCESS) { + LOG_ERROR("Failed to send message to real exception port, error %x", kr); + ASSERT_NOT_REACHED(); + } + + connectionDidClose(); +} + +void Connection::setShouldCloseConnectionOnMachExceptions() +{ + ASSERT(m_exceptionPort == MACH_PORT_NULL); + + if (mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_exceptionPort) != KERN_SUCCESS) + ASSERT_NOT_REACHED(); + + if (mach_port_insert_right(mach_task_self(), m_exceptionPort, m_exceptionPort, MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS) + ASSERT_NOT_REACHED(); +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h b/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h new file mode 100644 index 0000000..ecce16e --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/mac/MachPort.h @@ -0,0 +1,75 @@ +/* + * 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 MachPort_h +#define MachPort_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Attachment.h" + +namespace CoreIPC { + +class MachPort { +public: + MachPort() + : m_port(MACH_PORT_NULL) + , m_disposition(0) + { + } + + MachPort(mach_port_name_t port, mach_msg_type_name_t disposition) + : m_port(port) + , m_disposition(disposition) + { + } + + void encode(ArgumentEncoder* encoder) const + { + encoder->encode(Attachment(m_port, m_disposition)); + } + + static bool decode(ArgumentDecoder* decoder, MachPort& p) + { + Attachment attachment; + if (!decoder->decode(attachment)) + return false; + + p.m_port = attachment.port(); + p.m_disposition = attachment.disposition(); + return true; + } + + mach_port_name_t port() const { return m_port; } + mach_msg_type_name_t disposition() const { return m_disposition; } + +private: + mach_port_name_t m_port; + mach_msg_type_name_t m_disposition; +}; + +} // namespace CoreIPC + +#endif // MachPort_h diff --git a/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp b/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp new file mode 100644 index 0000000..c0736b8 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp @@ -0,0 +1,142 @@ +/* + * 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 "Connection.h" + +#include "ArgumentEncoder.h" +#include "ProcessLauncher.h" +#include "WorkItem.h" +#include <QApplication> +#include <QLocalServer> +#include <QLocalSocket> + +using namespace std; + +namespace CoreIPC { + +// This is what other ports use... +static const size_t messageMaxSize = 4096; + +void Connection::platformInitialize(Identifier identifier) +{ + m_serverName = identifier; + m_socket = 0; + m_readBuffer.resize(messageMaxSize); + m_currentMessageSize = 0; +} + +void Connection::platformInvalidate() +{ + m_socket->disconnect(); + if (!m_isServer) + m_socket->deleteLater(); + m_socket = 0; +} + +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()); + } + + if (m_socket->bytesAvailable() < m_currentMessageSize) + return; + + if (m_readBuffer.size() < m_currentMessageSize) + m_readBuffer.grow(m_currentMessageSize); + + size_t numberOfBytesRead = m_socket->read(reinterpret_cast<char*>(m_readBuffer.data()), m_currentMessageSize); + ASSERT_UNUSED(numberOfBytesRead, numberOfBytesRead); + + // 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); + + processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize))); + + m_currentMessageSize = 0; + } +} + +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)); + } + } 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; +} + +bool Connection::platformCanSendOutgoingMessages() const +{ + return m_socket; +} + +bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +{ + ASSERT(m_socket); + + // We put the message ID last. + arguments->encodeUInt32(messageID.toInt()); + + size_t bufferSize = arguments->bufferSize(); + + // 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(); + return false; + } + + qint64 bytesWrittenForBuffer = m_socket->write(reinterpret_cast<char*>(arguments->buffer()), arguments->bufferSize()); + if (bytesWrittenForBuffer != arguments->bufferSize()) { + connectionDidClose(); + return false; + } + + m_socket->flush(); + + return true; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp b/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp new file mode 100644 index 0000000..695da78 --- /dev/null +++ b/Source/WebKit2/Platform/CoreIPC/win/ConnectionWin.cpp @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Connection.h" + +#include "ArgumentEncoder.h" +#include "WorkItem.h" +#include <wtf/RandomNumber.h> +#include <wtf/text/WTFString.h> + +using namespace std; +// We explicitly don't use the WebCore namespace here because CoreIPC should only use WTF types and +// WTF::String is really in WTF. +using WTF::String; + +namespace CoreIPC { + +// FIXME: Rename this or use a different constant on windows. +static const size_t inlineMessageMaxSize = 4096; + +bool Connection::createServerAndClientIdentifiers(HANDLE& serverIdentifier, HANDLE& clientIdentifier) +{ + String pipeName; + + while (true) { + unsigned uniqueID = randomNumber() * std::numeric_limits<unsigned>::max(); + pipeName = String::format("\\\\.\\pipe\\com.apple.WebKit.%x", uniqueID); + + serverIdentifier = ::CreateNamedPipe(pipeName.charactersWithNullTermination(), + PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 1, inlineMessageMaxSize, inlineMessageMaxSize, + 0, 0); + if (!serverIdentifier && ::GetLastError() == ERROR_PIPE_BUSY) { + // There was already a pipe with this name, try again. + continue; + } + + break; + } + + if (!serverIdentifier) + return false; + + clientIdentifier = ::CreateFileW(pipeName.charactersWithNullTermination(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); + if (!clientIdentifier) { + ::CloseHandle(serverIdentifier); + return false; + } + + DWORD mode = PIPE_READMODE_MESSAGE; + if (!::SetNamedPipeHandleState(clientIdentifier, &mode, 0, 0)) { + ::CloseHandle(serverIdentifier); + ::CloseHandle(clientIdentifier); + return false; + } + + return true; +} + +void Connection::platformInitialize(Identifier identifier) +{ + memset(&m_readState, 0, sizeof(m_readState)); + m_readState.hEvent = ::CreateEventW(0, FALSE, FALSE, 0); + + memset(&m_writeState, 0, sizeof(m_writeState)); + 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() +{ + if (m_connectionPipe == INVALID_HANDLE_VALUE) + return; + + m_connectionQueue.unregisterAndCloseHandle(m_readState.hEvent); + m_readState.hEvent = 0; + + m_connectionQueue.unregisterAndCloseHandle(m_writeState.hEvent); + m_writeState.hEvent = 0; + + ::CloseHandle(m_connectionPipe); + m_connectionPipe = INVALID_HANDLE_VALUE; +} + +void Connection::readEventHandler() +{ + if (m_connectionPipe == INVALID_HANDLE_VALUE) + return; + + while (true) { + // Check if we got some data. + DWORD numberOfBytesRead = 0; + if (!::GetOverlappedResult(m_connectionPipe, &m_readState, &numberOfBytesRead, FALSE)) { + DWORD error = ::GetLastError(); + + switch (error) { + case ERROR_BROKEN_PIPE: + connectionDidClose(); + return; + case ERROR_MORE_DATA: { + // Read the rest of the message out of the pipe. + + DWORD bytesToRead = 0; + if (!::PeekNamedPipe(m_connectionPipe, 0, 0, 0, 0, &bytesToRead)) { + DWORD error = ::GetLastError(); + if (error == ERROR_BROKEN_PIPE) { + connectionDidClose(); + return; + } + ASSERT_NOT_REACHED(); + return; + } + + // ::GetOverlappedResult told us there's more data. ::PeekNamedPipe shouldn't + // contradict it! + ASSERT(bytesToRead); + if (!bytesToRead) + break; + + m_readBuffer.grow(m_readBuffer.size() + bytesToRead); + if (!::ReadFile(m_connectionPipe, m_readBuffer.data() + numberOfBytesRead, bytesToRead, 0, &m_readState)) { + DWORD error = ::GetLastError(); + ASSERT_NOT_REACHED(); + return; + } + continue; + } + + // FIXME: We should figure out why we're getting this error. + case ERROR_IO_INCOMPLETE: + return; + default: + ASSERT_NOT_REACHED(); + } + } + + if (!m_readBuffer.isEmpty()) { + // We have a message, let's dispatch it. + + // The messageID is encoded at the end of the buffer. + // Note that we assume here that the message is the same size as m_readBuffer. We can + // assume this because we always size m_readBuffer to exactly match the size of the message, + // either when receiving ERROR_MORE_DATA from ::GetOverlappedResult above or when + // ::PeekNamedPipe tells us the size below. We never set m_readBuffer to a size larger + // than the message. + ASSERT(m_readBuffer.size() >= sizeof(MessageID)); + size_t realBufferSize = m_readBuffer.size() - sizeof(MessageID); + + unsigned messageID = *reinterpret_cast<unsigned*>(m_readBuffer.data() + realBufferSize); + + processIncomingMessage(MessageID::fromInt(messageID), adoptPtr(new ArgumentDecoder(m_readBuffer.data(), realBufferSize))); + } + + // Find out the size of the next message in the pipe (if there is one) so that we can read + // it all in one operation. (This is just an optimization to avoid an extra pass through the + // loop (if we chose a buffer size that was too small) or allocating extra memory (if we + // chose a buffer size that was too large).) + DWORD bytesToRead = 0; + if (!::PeekNamedPipe(m_connectionPipe, 0, 0, 0, 0, &bytesToRead)) { + DWORD error = ::GetLastError(); + if (error == ERROR_BROKEN_PIPE) { + connectionDidClose(); + return; + } + ASSERT_NOT_REACHED(); + } + if (!bytesToRead) { + // There's no message waiting in the pipe. Schedule a read of the first byte of the + // next message. We'll find out the message's actual size when it arrives. (If we + // change this to read more than a single byte for performance reasons, we'll have to + // deal with m_readBuffer potentially being larger than the message we read after + // calling ::GetOverlappedResult above.) + bytesToRead = 1; + } + + m_readBuffer.resize(bytesToRead); + + // Either read the next available message (which should occur synchronously), or start an + // asynchronous read of the next message that becomes available. + BOOL result = ::ReadFile(m_connectionPipe, m_readBuffer.data(), m_readBuffer.size(), 0, &m_readState); + if (result) { + // There was already a message waiting in the pipe, and we read it synchronously. + // Process it. + continue; + } + + DWORD error = ::GetLastError(); + + if (error == ERROR_IO_PENDING) { + // There are no messages in the pipe currently. readEventHandler will be called again once there is a message. + return; + } + + if (error == ERROR_MORE_DATA) { + // Either a message is available when we didn't think one was, or the message is larger + // than ::PeekNamedPipe told us. The former seems far more likely. Probably the message + // became available between our calls to ::PeekNamedPipe and ::ReadFile above. Go back + // to the top of the loop to use ::GetOverlappedResult to retrieve the available data. + continue; + } + + // FIXME: We need to handle other errors here. + ASSERT_NOT_REACHED(); + } +} + +void Connection::writeEventHandler() +{ + if (m_connectionPipe == INVALID_HANDLE_VALUE) + return; + + DWORD numberOfBytesWritten = 0; + if (!::GetOverlappedResult(m_connectionPipe, &m_writeState, &numberOfBytesWritten, FALSE)) { + DWORD error = ::GetLastError(); + if (error == ERROR_IO_INCOMPLETE) { + // FIXME: We should figure out why we're getting this error. + return; + } + ASSERT_NOT_REACHED(); + } + + // The pending write has finished, so we are now done with its arguments. Clearing this member + // will allow us to send messages again. + m_pendingWriteArguments = 0; + + // Now that the pending write has finished, we can try to send a new message. + sendOutgoingMessages(); +} + +bool Connection::open() +{ + // 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)); + + // Schedule a read. + m_connectionQueue.scheduleWork(WorkItem::create(this, &Connection::readEventHandler)); + + return true; +} + +bool Connection::platformCanSendOutgoingMessages() const +{ + // We only allow sending one asynchronous message at a time. If we wanted to send more than one + // at once, we'd have to use multiple OVERLAPPED structures and hold onto multiple pending + // ArgumentEncoders (one of each for each simultaneous asynchronous message). + return !m_pendingWriteArguments; +} + +bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEncoder> arguments) +{ + ASSERT(!m_pendingWriteArguments); + + // Just bail if the handle has been closed. + if (m_connectionPipe == INVALID_HANDLE_VALUE) + return false; + + // We put the message ID last. + arguments->encodeUInt32(messageID.toInt()); + + // Write the outgoing message. + + if (::WriteFile(m_connectionPipe, arguments->buffer(), arguments->bufferSize(), 0, &m_writeState)) { + // We successfully sent this message. + return true; + } + + DWORD error = ::GetLastError(); + + if (error == ERROR_NO_DATA) { + // The pipe is being closed. + connectionDidClose(); + return false; + } + + if (error != ERROR_IO_PENDING) { + ASSERT_NOT_REACHED(); + return false; + } + + // The message will be sent soon. Hold onto the arguments so that they won't be destroyed + // before the write completes. + m_pendingWriteArguments = arguments; + + // We can only send one asynchronous message at a time (see comment in platformCanSendOutgoingMessages). + return false; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Platform/Logging.cpp b/Source/WebKit2/Platform/Logging.cpp new file mode 100644 index 0000000..ca312ef --- /dev/null +++ b/Source/WebKit2/Platform/Logging.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Logging.h" + +#if !LOG_DISABLED + +WTFLogChannel LogSessionState = { 0x00000001, "WebKit2LogLevel", WTFLogChannelOff }; +WTFLogChannel LogContextMenu = { 0x00000002, "WebKit2LogLevel", WTFLogChannelOff }; +WTFLogChannel LogTextInput = { 0x00000004, "WebKit2LogLevel", WTFLogChannelOff }; +WTFLogChannel LogView = { 0x00000008, "WebKit2LogLevel", WTFLogChannelOff }; + +static inline void initializeLogChannel(WTFLogChannel* channel) +{ + // FIXME: This is a build fix. Each platform will need to define their own initializeLogChannel(). +} + +void initializeLogChannelsIfNecessary() +{ + static bool haveInitializedLogChannels = false; + if (haveInitializedLogChannels) + return; + haveInitializedLogChannels = true; + + initializeLogChannel(&LogContextMenu); + initializeLogChannel(&LogSessionState); + initializeLogChannel(&LogTextInput); + initializeLogChannel(&LogView); +} + +#endif // LOG_DISABLED diff --git a/Source/WebKit2/Platform/Logging.h b/Source/WebKit2/Platform/Logging.h new file mode 100644 index 0000000..b2cc391 --- /dev/null +++ b/Source/WebKit2/Platform/Logging.h @@ -0,0 +1,50 @@ +/* + * 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 Logging_h +#define Logging_h + +#include <wtf/Assertions.h> + +#if !LOG_DISABLED + +#ifndef LOG_CHANNEL_PREFIX +#define LOG_CHANNEL_PREFIX Log +#endif + +EXTERN_C_BEGIN + +extern WTFLogChannel LogContextMenu; +extern WTFLogChannel LogSessionState; +extern WTFLogChannel LogTextInput; +extern WTFLogChannel LogView; + +void initializeLogChannelsIfNecessary(void); + +EXTERN_C_END + +#endif // LOG_DISABLED + +#endif // Logging_h diff --git a/Source/WebKit2/Platform/Module.cpp b/Source/WebKit2/Platform/Module.cpp new file mode 100644 index 0000000..7a2def5 --- /dev/null +++ b/Source/WebKit2/Platform/Module.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Module.h" + +namespace WebKit { + +Module::Module(const String& path) + : m_path(path) +#if PLATFORM(WIN) + , m_module(0) +#endif +{ +} + +Module::~Module() +{ + unload(); +} + +} diff --git a/Source/WebKit2/Platform/Module.h b/Source/WebKit2/Platform/Module.h new file mode 100644 index 0000000..0825bf6 --- /dev/null +++ b/Source/WebKit2/Platform/Module.h @@ -0,0 +1,74 @@ +/* + * 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 Module_h +#define Module_h + +#include <wtf/Noncopyable.h> +#include <wtf/text/WTFString.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + +#if PLATFORM(QT) +#include <QLibrary> +#endif + +namespace WebKit { + +class Module : public Noncopyable { +public: + Module(const String& path); + ~Module(); + + bool load(); + // Note: On Mac this leaks the CFBundle to avoid crashes when a bundle is unloaded and there are + // live Objective-C objects whose methods come from that bundle. + void unload(); + + template<typename FunctionType> FunctionType functionPointer(const char* functionName) const; + +private: + void* platformFunctionPointer(const char* functionName) const; + + String m_path; +#if PLATFORM(MAC) + RetainPtr<CFBundleRef> m_bundle; +#elif PLATFORM(WIN) + HMODULE m_module; +#elif PLATFORM(QT) + QLibrary m_lib; +#endif +}; + +template<typename FunctionType> FunctionType Module::functionPointer(const char* functionName) const +{ + return reinterpret_cast<FunctionType>(platformFunctionPointer(functionName)); +} + +} + +#endif diff --git a/Source/WebKit2/Platform/PlatformProcessIdentifier.h b/Source/WebKit2/Platform/PlatformProcessIdentifier.h new file mode 100644 index 0000000..0363692 --- /dev/null +++ b/Source/WebKit2/Platform/PlatformProcessIdentifier.h @@ -0,0 +1,48 @@ +/* + * 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 PlatformProcessIdentifier_h +#define PlatformProcessIdentifier_h + +#if PLATFORM(QT) +class QProcess; +#endif + +namespace WebKit { + +#if PLATFORM(MAC) +typedef pid_t PlatformProcessIdentifier; +#elif PLATFORM(WIN) +typedef HANDLE PlatformProcessIdentifier; +#elif PLATFORM(QT) +typedef QProcess* PlatformProcessIdentifier; +#elif PLATFORM(GTK) +typedef pid_t PlatformProcessIdentifier; +#endif + +} // namespace WebKit + +#endif // PlatformProcessIdentifier_h diff --git a/Source/WebKit2/Platform/Region.cpp b/Source/WebKit2/Platform/Region.cpp new file mode 100644 index 0000000..a1cc24c --- /dev/null +++ b/Source/WebKit2/Platform/Region.cpp @@ -0,0 +1,454 @@ +/* + * 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 + * 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 "Region.h" + +// A region class based on the paper "Scanline Coherent Shape Algebra" +// by Jonathan E. Steinhart from the book "Graphics Gems II". +// +// This implementation uses two vectors instead of linked list, and +// also compresses regions when possible. + +using namespace WebCore; + +namespace WebKit { + +Region::Region() +{ +} + +Region::Region(const IntRect& rect) + : m_bounds(rect) + , m_shape(rect) +{ +} + +Vector<IntRect> Region::rects() const +{ + Vector<IntRect> rects; + + for (Shape::SpanIterator span = m_shape.spans_begin(), end = m_shape.spans_end(); span != end && span + 1 != end; ++span) { + int y = span->y; + int height = (span + 1)->y - y; + + for (Shape::SegmentIterator segment = m_shape.segments_begin(span), end = m_shape.segments_end(span); segment != end && segment + 1 != end; segment += 2) { + int x = *segment; + int width = *(segment + 1) - x; + + rects.append(IntRect(x, y, width, height)); + } + } + + return rects; +} + +Region::Shape::Shape() +{ +} + +Region::Shape::Shape(const IntRect& rect) +{ + appendSpan(rect.y()); + appendSegment(rect.x()); + appendSegment(rect.right()); + appendSpan(rect.bottom()); +} + +void Region::Shape::appendSpan(int y) +{ + m_spans.append(Span(y, m_segments.size())); +} + +bool Region::Shape::canCoalesce(SegmentIterator begin, SegmentIterator end) +{ + if (m_spans.isEmpty()) + return false; + + SegmentIterator lastSpanBegin = m_segments.data() + m_spans.last().segmentIndex; + SegmentIterator lastSpanEnd = m_segments.data() + m_segments.size(); + + // Check if both spans have an equal number of segments. + if (lastSpanEnd - lastSpanBegin != end - begin) + return false; + + // Check if both spans are equal. + if (!std::equal(begin, end, lastSpanBegin)) + return false; + + // Since the segments are equal the second segment can just be ignored. + return true; +} + +void Region::Shape::appendSpan(int y, SegmentIterator begin, SegmentIterator end) +{ + if (canCoalesce(begin, end)) + return; + + appendSpan(y); + m_segments.appendRange(begin, end); +} + +void Region::Shape::appendSpans(const Shape& shape, SpanIterator begin, SpanIterator end) +{ + for (SpanIterator it = begin; it != end; ++it) + appendSpan(it->y, shape.segments_begin(it), shape.segments_end(it)); +} + +void Region::Shape::appendSegment(int x) +{ + m_segments.append(x); +} + +Region::Shape::SpanIterator Region::Shape::spans_begin() const +{ + return m_spans.data(); +} + +Region::Shape::SpanIterator Region::Shape::spans_end() const +{ + return m_spans.data() + m_spans.size(); +} + +Region::Shape::SegmentIterator Region::Shape::segments_begin(SpanIterator it) const +{ + ASSERT(it >= m_spans.data()); + ASSERT(it < m_spans.data() + m_spans.size()); + + // Check if this span has any segments. + if (it->segmentIndex == m_segments.size()) + return 0; + + return &m_segments[it->segmentIndex]; +} + +Region::Shape::SegmentIterator Region::Shape::segments_end(SpanIterator it) const +{ + ASSERT(it >= m_spans.data()); + ASSERT(it < m_spans.data() + m_spans.size()); + + // Check if this span has any segments. + if (it->segmentIndex == m_segments.size()) + return 0; + + ASSERT(it + 1 < m_spans.data() + m_spans.size()); + size_t segmentIndex = (it + 1)->segmentIndex; + + ASSERT(segmentIndex <= m_segments.size()); + return m_segments.data() + segmentIndex; +} + +#ifndef NDEBUG +void Region::Shape::dump() const +{ + for (Shape::SpanIterator span = spans_begin(), end = spans_end(); span != end; ++span) { + printf("%6d: (", span->y); + + for (Shape::SegmentIterator segment = segments_begin(span), end = segments_end(span); segment != end; ++segment) + printf("%d ", *segment); + printf(")\n"); + } + + printf("\n"); +} +#endif + +IntRect Region::Shape::bounds() const +{ + if (isEmpty()) + return IntRect(); + + SpanIterator span = spans_begin(); + int minY = span->y; + + SpanIterator lastSpan = spans_end() - 1; + int maxY = lastSpan->y; + + int minX = std::numeric_limits<int>::max(); + int maxX = std::numeric_limits<int>::min(); + + while (span != lastSpan) { + SegmentIterator firstSegment = segments_begin(span); + SegmentIterator lastSegment = segments_end(span) - 1; + + if (firstSegment && lastSegment) { + ASSERT(firstSegment != lastSegment); + + if (*firstSegment < minX) + minX = *firstSegment; + + if (*lastSegment > maxX) + maxX = *lastSegment; + } + + ++span; + } + + ASSERT(minX <= maxX); + ASSERT(minY <= maxY); + + return IntRect(minX, minY, maxX - minX, maxY - minY); +} + +void Region::Shape::translate(const IntSize& offset) +{ + for (size_t i = 0; i < m_segments.size(); ++i) + m_segments[i] += offset.width(); + for (size_t i = 0; i < m_spans.size(); ++i) + m_spans[i].y += offset.height(); +} + +void Region::Shape::swap(Shape& other) +{ + m_segments.swap(other.m_segments); + m_spans.swap(other.m_spans); +} + +enum { + Shape1, + Shape2, +}; + +template<typename Operation> +Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& shape2) +{ + COMPILE_ASSERT(!(!Operation::shouldAddRemainingSegmentsFromSpan1 && Operation::shouldAddRemainingSegmentsFromSpan2), invalid_segment_combination); + COMPILE_ASSERT(!(!Operation::shouldAddRemainingSpansFromShape1 && Operation::shouldAddRemainingSpansFromShape2), invalid_span_combination); + + Shape result; + if (Operation::trySimpleOperation(shape1, shape2, result)) + return result; + + SpanIterator spans1 = shape1.spans_begin(); + SpanIterator spans1End = shape1.spans_end(); + + SpanIterator spans2 = shape2.spans_begin(); + SpanIterator spans2End = shape2.spans_end(); + + SegmentIterator segments1 = 0; + SegmentIterator segments1End = 0; + + SegmentIterator segments2 = 0; + SegmentIterator segments2End = 0; + + // Iterate over all spans. + while (spans1 != spans1End && spans2 != spans2End) { + int y; + int test = spans1->y - spans2->y; + + if (test <= 0) { + y = spans1->y; + + segments1 = shape1.segments_begin(spans1); + segments1End = shape1.segments_end(spans1); + ++spans1; + } + if (test >= 0) { + y = spans2->y; + + segments2 = shape2.segments_begin(spans2); + segments2End = shape2.segments_end(spans2); + ++spans2; + } + + int flag = 0; + int oldFlag = 0; + + SegmentIterator s1 = segments1; + SegmentIterator s2 = segments2; + + Vector<int> segments; + + // Now iterate over the segments in each span and construct a new vector of segments. + while (s1 != segments1End && s2 != segments2End) { + int test = *s1 - *s2; + int x; + + if (test <= 0) { + x = *s1; + flag = flag ^ 1; + ++s1; + } + if (test >= 0) { + x = *s2; + flag = flag ^ 2; + ++s2; + } + + if (flag == Operation::opCode || oldFlag == Operation::opCode) + segments.append(x); + + oldFlag = flag; + } + + // Add any remaining segments. + if (Operation::shouldAddRemainingSegmentsFromSpan1 && s1 != segments1End) + segments.appendRange(s1, segments1End); + else if (Operation::shouldAddRemainingSegmentsFromSpan2 && s2 != segments2End) + segments.appendRange(s2, segments2End); + + // Add the span. + if (!segments.isEmpty() || !result.isEmpty()) + result.appendSpan(y, segments.data(), segments.data() + segments.size()); + } + + // Add any remaining spans. + if (Operation::shouldAddRemainingSpansFromShape1 && spans1 != spans1End) + result.appendSpans(shape1, spans1, spans1End); + else if (Operation::shouldAddRemainingSpansFromShape2 && spans2 != spans2End) + result.appendSpans(shape2, spans2, spans2End); + + return result; +} + +struct Region::Shape::UnionOperation { + static bool trySimpleOperation(const Shape& shape1, const Shape& shape2, Shape& result) + { + if (shape1.isEmpty()) { + result = shape2; + return true; + } + + if (shape2.isEmpty()) { + result = shape1; + return true; + } + + return false; + } + + static const int opCode = 0; + + static const bool shouldAddRemainingSegmentsFromSpan1 = true; + static const bool shouldAddRemainingSegmentsFromSpan2 = true; + static const bool shouldAddRemainingSpansFromShape1 = true; + static const bool shouldAddRemainingSpansFromShape2 = true; +}; + +Region::Shape Region::Shape::unionShapes(const Shape& shape1, const Shape& shape2) +{ + return shapeOperation<UnionOperation>(shape1, shape2); +} + +struct Region::Shape::IntersectOperation { + static bool trySimpleOperation(const Shape& shape1, const Shape& shape2, Shape& result) + { + if (shape1.isEmpty()) { + result = Shape(); + return true; + } + + if (shape2.isEmpty()) { + result = shape1; + return true; + } + + return false; + } + + static const int opCode = 3; + + static const bool shouldAddRemainingSegmentsFromSpan1 = false; + static const bool shouldAddRemainingSegmentsFromSpan2 = false; + static const bool shouldAddRemainingSpansFromShape1 = false; + static const bool shouldAddRemainingSpansFromShape2 = false; +}; + +Region::Shape Region::Shape::intersectShapes(const Shape& shape1, const Shape& shape2) +{ + return shapeOperation<IntersectOperation>(shape1, shape2); +} + +struct Region::Shape::SubtractOperation { + static bool trySimpleOperation(const Shape& shape1, const Shape& shape2, Region::Shape& result) + { + + if (shape1.isEmpty() || shape2.isEmpty()) { + result = Shape(); + return true; + } + + return false; + } + + static const int opCode = 1; + + static const bool shouldAddRemainingSegmentsFromSpan1 = true; + static const bool shouldAddRemainingSegmentsFromSpan2 = false; + static const bool shouldAddRemainingSpansFromShape1 = true; + static const bool shouldAddRemainingSpansFromShape2 = false; +}; + +Region::Shape Region::Shape::subtractShapes(const Shape& shape1, const Shape& shape2) +{ + return shapeOperation<SubtractOperation>(shape1, shape2); +} + +#ifndef NDEBUG +void Region::dump() const +{ + printf("Bounds: (%d, %d, %d, %d)\n", + m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height()); + m_shape.dump(); +} +#endif + +void Region::intersect(const Region& region) +{ + if (!m_bounds.intersects(region.m_bounds)) { + m_shape = Shape(); + m_bounds = IntRect(); + return; + } + + Shape intersectedShape = Shape::intersectShapes(m_shape, region.m_shape); + + m_shape.swap(intersectedShape); + m_bounds = m_shape.bounds(); +} + +void Region::unite(const Region& region) +{ + Shape unitedShape = Shape::unionShapes(m_shape, region.m_shape); + + m_shape.swap(unitedShape); + m_bounds.unite(region.m_bounds); +} + +void Region::subtract(const Region& region) +{ + Shape subtractedShape = Shape::subtractShapes(m_shape, region.m_shape); + + m_shape.swap(subtractedShape); + m_bounds = m_shape.bounds(); +} + +void Region::translate(const IntSize& offset) +{ + m_bounds.move(offset); + m_shape.translate(offset); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Platform/Region.h b/Source/WebKit2/Platform/Region.h new file mode 100644 index 0000000..b44519f --- /dev/null +++ b/Source/WebKit2/Platform/Region.h @@ -0,0 +1,144 @@ +/* + * 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 + * 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 Region_h +#define Region_h + +#include <WebCore/IntRect.h> +#include <wtf/Vector.h> + +#include <vector> + +namespace WebKit { + +class Region { +public: + Region(); + Region(const WebCore::IntRect&); + + WebCore::IntRect bounds() const { return m_bounds; } + bool isEmpty() const { return m_bounds.isEmpty(); } + + Vector<WebCore::IntRect> rects() const; + + void unite(const Region&); + void intersect(const Region&); + void subtract(const Region&); + + void translate(const WebCore::IntSize&); + +#ifndef NDEBUG + void dump() const; +#endif + +private: + struct Span { + Span(int y, size_t segmentIndex) + : y(y), segmentIndex(segmentIndex) + { + } + + int y; + size_t segmentIndex; + }; + + class Shape { + public: + Shape(); + Shape(const WebCore::IntRect&); + + WebCore::IntRect bounds() const; + bool isEmpty() const { return m_spans.isEmpty(); } + + typedef const Span* SpanIterator; + SpanIterator spans_begin() const; + SpanIterator spans_end() const; + + typedef const int* SegmentIterator; + SegmentIterator segments_begin(SpanIterator) const; + SegmentIterator segments_end(SpanIterator) const; + + static Shape unionShapes(const Shape& shape1, const Shape& shape2); + static Shape intersectShapes(const Shape& shape1, const Shape& shape2); + static Shape subtractShapes(const Shape& shape1, const Shape& shape2); + + void translate(const WebCore::IntSize&); + void swap(Shape&); + +#ifndef NDEBUG + void dump() const; +#endif + + private: + struct UnionOperation; + struct IntersectOperation; + struct SubtractOperation; + + template<typename Operation> + static Shape shapeOperation(const Shape& shape1, const Shape& shape2); + + void appendSegment(int x); + void appendSpan(int y); + void appendSpan(int y, SegmentIterator begin, SegmentIterator end); + void appendSpans(const Shape&, SpanIterator begin, SpanIterator end); + + bool canCoalesce(SegmentIterator begin, SegmentIterator end); + + // FIXME: These vectors should have inline sizes. Figure out a good optimal value. + Vector<int> m_segments; + Vector<Span> m_spans; + }; + + WebCore::IntRect m_bounds; + Shape m_shape; +}; + +static inline Region intersect(const Region& a, const Region& b) +{ + Region result(a); + result.intersect(b); + + return result; +} + +static inline Region subtract(const Region& a, const Region& b) +{ + Region result(a); + result.subtract(b); + + return result; +} + +static inline Region translate(const Region& region, const WebCore::IntSize& offset) +{ + Region result(region); + result.translate(offset); + + return result; +} + +} // namespace WebKit + +#endif // Region_h diff --git a/Source/WebKit2/Platform/RunLoop.cpp b/Source/WebKit2/Platform/RunLoop.cpp new file mode 100644 index 0000000..606aba1 --- /dev/null +++ b/Source/WebKit2/Platform/RunLoop.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "RunLoop.h" + +#include "WorkItem.h" +#include <wtf/StdLibExtras.h> + +static RunLoop* s_mainRunLoop; + +void RunLoop::initializeMainRunLoop() +{ + if (s_mainRunLoop) + return; + s_mainRunLoop = RunLoop::current(); +} + +RunLoop* RunLoop::current() +{ + DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<RunLoop>, runLoopData, ()); + return &*runLoopData; +} + +RunLoop* RunLoop::main() +{ + ASSERT(s_mainRunLoop); + return s_mainRunLoop; +} + +void RunLoop::performWork() +{ + Vector<WorkItem*> workItemQueue; + { + MutexLocker locker(m_workItemQueueLock); + m_workItemQueue.swap(workItemQueue); + } + + for (size_t i = 0; i < workItemQueue.size(); ++i) { + OwnPtr<WorkItem> item(workItemQueue[i]); + item->execute(); + } +} + +void RunLoop::scheduleWork(PassOwnPtr<WorkItem> item) +{ + MutexLocker locker(m_workItemQueueLock); + m_workItemQueue.append(item.leakPtr()); + + wakeUp(); +} diff --git a/Source/WebKit2/Platform/RunLoop.h b/Source/WebKit2/Platform/RunLoop.h new file mode 100644 index 0000000..aa87506 --- /dev/null +++ b/Source/WebKit2/Platform/RunLoop.h @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * 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. + */ + +#ifndef RunLoop_h +#define RunLoop_h + +#include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/ThreadSpecific.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> +#if PLATFORM(GTK) +typedef struct _GSource GSource; +typedef struct _GMainLoop GMainLoop; +typedef struct _GMainContext GMainContext; +typedef int gboolean; +#endif + +class WorkItem; + +class RunLoop { +public: + // Must be called from the main thread. + static void initializeMainRunLoop(); + + static RunLoop* current(); + static RunLoop* main(); + + void scheduleWork(PassOwnPtr<WorkItem>); + + static void run(); + void stop(); + + class TimerBase { + friend class RunLoop; + public: + TimerBase(RunLoop*); + virtual ~TimerBase(); + + void startRepeating(double repeatInterval) { start(repeatInterval, true); } + void startOneShot(double interval) { start(interval, false); } + + void stop(); + bool isActive() const; + + virtual void fired() = 0; + + private: + void start(double nextFireInterval, bool repeat); + + RunLoop* m_runLoop; + +#if PLATFORM(WIN) + static void timerFired(RunLoop*, uint64_t ID); + uint64_t m_ID; + bool m_isRepeating; +#elif PLATFORM(MAC) + static void timerFired(CFRunLoopTimerRef, void*); + CFRunLoopTimerRef m_timer; +#elif PLATFORM(QT) + static void timerFired(RunLoop*, int ID); + int m_ID; + bool m_isRepeating; +#elif PLATFORM(GTK) + static gboolean oneShotTimerFired(RunLoop::TimerBase*); + static gboolean repeatingTimerFired(RunLoop::TimerBase*); + void resetTimerSource(); + GSource* m_timerSource; +#endif + }; + + template <typename TimerFiredClass> + class Timer : public TimerBase { + public: + typedef void (TimerFiredClass::*TimerFiredFunction)(); + + Timer(RunLoop* runLoop, TimerFiredClass* o, TimerFiredFunction f) + : TimerBase(runLoop) + , m_object(o) + , m_function(f) + { + } + + private: + virtual void fired() { (m_object->*m_function)(); } + + TimerFiredClass* m_object; + TimerFiredFunction m_function; + }; + +private: + friend class WTF::ThreadSpecific<RunLoop>; + + RunLoop(); + ~RunLoop(); + + void performWork(); + void wakeUp(); + + Mutex m_workItemQueueLock; + Vector<WorkItem*> m_workItemQueue; + +#if PLATFORM(WIN) + static bool registerRunLoopMessageWindowClass(); + static LRESULT CALLBACK RunLoopWndProc(HWND, UINT, WPARAM, LPARAM); + LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + HWND m_runLoopMessageWindow; + + typedef HashMap<uint64_t, TimerBase*> TimerMap; + TimerMap m_activeTimers; +#elif PLATFORM(MAC) + static void performWork(void*); + CFRunLoopRef m_runLoop; + CFRunLoopSourceRef m_runLoopSource; +#elif PLATFORM(QT) + typedef HashMap<int, TimerBase*> TimerMap; + TimerMap m_activeTimers; + class TimerObject; + TimerObject* m_timerObject; +#elif PLATFORM(GTK) +public: + static gboolean queueWork(RunLoop*); + GMainLoop* mainLoop(); +private: + GMainContext* m_runLoopContext; + GMainLoop* m_runLoopMain; +#endif +}; + +#endif // RunLoop_h diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h new file mode 100644 index 0000000..05dc0dd --- /dev/null +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -0,0 +1,105 @@ +/* + * 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 SharedMemory_h +#define SharedMemory_h + +#include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +#if PLATFORM(QT) +#include <QtGlobal> +QT_BEGIN_NAMESPACE +class QSharedMemory; +QT_END_NAMESPACE +#include <wtf/text/WTFString.h> +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class SharedMemory : public RefCounted<SharedMemory> { +public: + enum Protection { + ReadOnly, + ReadWrite + }; + + class Handle : Noncopyable { + public: + Handle(); + ~Handle(); + + bool isNull() const; + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Handle&); + + private: + friend class SharedMemory; +#if PLATFORM(MAC) + mutable mach_port_t m_port; +#elif PLATFORM(WIN) + mutable HANDLE m_handle; +#elif PLATFORM(QT) + mutable String m_key; +#endif + size_t m_size; + }; + + // Create a shared memory object with the given size. Will return 0 on failure. + static PassRefPtr<SharedMemory> create(size_t); + + // Create a shared memory object from the given handle and the requested protection. Will return 0 on failure. + static PassRefPtr<SharedMemory> create(const Handle&, Protection); + + ~SharedMemory(); + + bool createHandle(Handle&, Protection); + + size_t size() const { return m_size; } + void* data() const { return m_data; } + + // Return the system page size in bytes. + static unsigned systemPageSize(); + +private: + size_t m_size; + void* m_data; +#if PLATFORM(WIN) + HANDLE m_handle; +#elif PLATFORM(QT) + QSharedMemory* m_impl; +#endif +}; + +}; + +#endif // SharedMemory_h diff --git a/Source/WebKit2/Platform/WorkItem.h b/Source/WebKit2/Platform/WorkItem.h new file mode 100644 index 0000000..64bff58 --- /dev/null +++ b/Source/WebKit2/Platform/WorkItem.h @@ -0,0 +1,187 @@ +/* + * 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 WorkItem_h +#define WorkItem_h + +#include <wtf/PassOwnPtr.h> + +class WorkItem { +public: + template<typename C> + static PassOwnPtr<WorkItem> create(C*, void (C::*)()); + + template<typename C, typename T0> + static PassOwnPtr<WorkItem> create(C*, void (C::*)(T0), T0); + + template<typename C, typename T0, typename T1> + static PassOwnPtr<WorkItem> create(C*, void (C::*)(T0, T1), T0, T1); + + static PassOwnPtr<WorkItem> create(void (*)()); + + virtual ~WorkItem() { } + virtual void execute() = 0; + +protected: + WorkItem() { } + +private: + WorkItem(const WorkItem&); + WorkItem& operator=(const WorkItem&); +}; + +template <typename C> +class MemberFunctionWorkItem0 : private WorkItem { + // We only allow WorkItem to create this. + friend class WorkItem; + + typedef void (C::*FunctionType)(); + + MemberFunctionWorkItem0(C* ptr, FunctionType function) + : m_ptr(ptr) + , m_function(function) + { + m_ptr->ref(); + } + + ~MemberFunctionWorkItem0() + { + m_ptr->deref(); + } + + virtual void execute() + { + (m_ptr->*m_function)(); + } + + C* m_ptr; + FunctionType m_function; +}; + +template<typename C, typename T0> +class MemberFunctionWorkItem1 : private WorkItem { + // We only allow WorkItem to create this. + friend class WorkItem; + + typedef void (C::*FunctionType)(T0); + + MemberFunctionWorkItem1(C* ptr, FunctionType function, T0 t0) + : m_ptr(ptr) + , m_function(function) + , m_t0(t0) + { + m_ptr->ref(); + } + + ~MemberFunctionWorkItem1() + { + m_ptr->deref(); + } + + virtual void execute() + { + (m_ptr->*m_function)(m_t0); + } + + C* m_ptr; + FunctionType m_function; + T0 m_t0; +}; + +template<typename C, typename T0, typename T1> +class MemberFunctionWorkItem2 : private WorkItem { + // We only allow WorkItem to create this. + friend class WorkItem; + + typedef void (C::*FunctionType)(T0, T1); + + MemberFunctionWorkItem2(C* ptr, FunctionType function, T0 t0, T1 t1) + : m_ptr(ptr) + , m_function(function) + , m_t0(t0) + , m_t1(t1) + { + m_ptr->ref(); + } + + ~MemberFunctionWorkItem2() + { + m_ptr->deref(); + } + + virtual void execute() + { + (m_ptr->*m_function)(m_t0, m_t1); + } + + C* m_ptr; + FunctionType m_function; + T0 m_t0; + T1 m_t1; +}; + +template<typename C> +PassOwnPtr<WorkItem> WorkItem::create(C* ptr, void (C::*function)()) +{ + return adoptPtr(static_cast<WorkItem*>(new MemberFunctionWorkItem0<C>(ptr, function))); +} + +template<typename C, typename T0> +PassOwnPtr<WorkItem> WorkItem::create(C* ptr, void (C::*function)(T0), T0 t0) +{ + return adoptPtr(static_cast<WorkItem*>(new MemberFunctionWorkItem1<C, T0>(ptr, function, t0))); +} + +template<typename C, typename T0, typename T1> +PassOwnPtr<WorkItem> WorkItem::create(C* ptr, void (C::*function)(T0, T1), T0 t0, T1 t1) +{ + return adoptPtr(static_cast<WorkItem*>(new MemberFunctionWorkItem2<C, T0, T1>(ptr, function, t0, t1))); +} + +class FunctionWorkItem0 : private WorkItem { + // We only allow WorkItem to create this. + friend class WorkItem; + + typedef void (*FunctionType)(); + + FunctionWorkItem0(FunctionType function) + : m_function(function) + { + } + + virtual void execute() + { + (*m_function)(); + } + + FunctionType m_function; +}; + +inline PassOwnPtr<WorkItem> WorkItem::create(void (*function)()) +{ + return adoptPtr(static_cast<WorkItem*>(new FunctionWorkItem0(function))); +} + +#endif // WorkItem_h diff --git a/Source/WebKit2/Platform/WorkQueue.cpp b/Source/WebKit2/Platform/WorkQueue.cpp new file mode 100644 index 0000000..de82c80 --- /dev/null +++ b/Source/WebKit2/Platform/WorkQueue.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WorkQueue.h" + +WorkQueue::WorkQueue(const char* name) + : m_isValid(true) +{ + platformInitialize(name); +} + +WorkQueue::~WorkQueue() +{ +#if !ASSERT_DISABLED + MutexLocker locker(m_isValidMutex); + ASSERT(!m_isValid); +#endif +} + +void WorkQueue::invalidate() +{ + { + MutexLocker locker(m_isValidMutex); + m_isValid = false; + } + + platformInvalidate(); +} diff --git a/Source/WebKit2/Platform/WorkQueue.h b/Source/WebKit2/Platform/WorkQueue.h new file mode 100644 index 0000000..78fa8b7 --- /dev/null +++ b/Source/WebKit2/Platform/WorkQueue.h @@ -0,0 +1,176 @@ +/* + * 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. + */ + +#ifndef WorkQueue_h +#define WorkQueue_h + +#if PLATFORM(MAC) +#if HAVE(DISPATCH_H) +#include <dispatch/dispatch.h> +#endif +#endif + +#include "WorkItem.h" +#include <wtf/HashMap.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> + +#if PLATFORM(QT) +class QLocalSocket; +class QObject; +class QThread; +#elif PLATFORM(GTK) +typedef struct _GMainContext GMainContext; +typedef struct _GMainLoop GMainLoop; +#endif + +class WorkQueue { +public: + explicit WorkQueue(const char* name); + ~WorkQueue(); + + // Will schedule the given work item to run as soon as possible. + void scheduleWork(PassOwnPtr<WorkItem>); + + // Will schedule the given work item to run after the given delay (in seconds). + void scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double delay); + + void invalidate(); + +#if PLATFORM(MAC) + enum MachPortEventType { + // Fired when there is data on the given receive right. + MachPortDataAvailable, + + // Fired when the receive right for this send right has been destroyed. + MachPortDeadNameNotification + }; + + // Will execute the given work item whenever the given mach port event fires. + // Note that this will adopt the mach port and destroy it when the work queue is invalidated. + void registerMachPortEventHandler(mach_port_t, MachPortEventType, PassOwnPtr<WorkItem>); + void unregisterMachPortEventHandler(mach_port_t); +#elif PLATFORM(WIN) + 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*); +#elif PLATFORM(GTK) + void registerEventSourceHandler(int, int, PassOwnPtr<WorkItem>); + void unregisterEventSourceHandler(int); +#endif + +private: + // FIXME: Use an atomic boolean here instead. + Mutex m_isValidMutex; + bool m_isValid; + + void platformInitialize(const char* name); + void platformInvalidate(); + +#if PLATFORM(MAC) +#if HAVE(DISPATCH_H) + static void executeWorkItem(void*); + Mutex m_eventSourcesMutex; + class EventSource; + HashMap<mach_port_t, EventSource*> m_eventSources; + dispatch_queue_t m_dispatchQueue; +#endif +#elif PLATFORM(WIN) + class WorkItemWin : public ThreadSafeShared<WorkItemWin> { + public: + static PassRefPtr<WorkItemWin> create(PassOwnPtr<WorkItem>, WorkQueue*); + virtual ~WorkItemWin(); + + WorkItem* item() const { return m_item.get(); } + WorkQueue* queue() const { return m_queue; } + + protected: + WorkItemWin(PassOwnPtr<WorkItem>, WorkQueue*); + + private: + OwnPtr<WorkItem> m_item; + WorkQueue* m_queue; + }; + + class HandleWorkItem : public WorkItemWin { + public: + static PassRefPtr<HandleWorkItem> createByAdoptingHandle(HANDLE, PassOwnPtr<WorkItem>, WorkQueue*); + virtual ~HandleWorkItem(); + + void setWaitHandle(HANDLE waitHandle) { m_waitHandle = waitHandle; } + HANDLE waitHandle() const { return m_waitHandle; } + + private: + HandleWorkItem(HANDLE, PassOwnPtr<WorkItem>, WorkQueue*); + + HANDLE m_handle; + HANDLE m_waitHandle; + }; + + static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired); + static DWORD WINAPI workThreadCallback(void* context); + + bool tryRegisterAsWorkThread(); + void unregisterAsWorkThread(); + void performWorkOnRegisteredWorkThread(); + + static void unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem>); + static DWORD WINAPI unregisterWaitAndDestroyItemCallback(void* context); + + volatile LONG m_isWorkThreadRegistered; + + Mutex m_workItemQueueLock; + Vector<RefPtr<WorkItemWin> > m_workItemQueue; + + Mutex m_handlesLock; + HashMap<HANDLE, RefPtr<HandleWorkItem> > m_handles; +#elif PLATFORM(QT) + class WorkItemQt; + HashMap<QObject*, WorkItemQt*> m_signalListeners; + QThread* m_workThread; + friend class WorkItemQt; +#elif PLATFORM(GTK) + static void* startWorkQueueThread(WorkQueue*); + void workQueueThreadBody(); + + ThreadIdentifier m_workQueueThread; + GMainContext* m_eventContext; + Mutex m_eventLoopLock; + GMainLoop* m_eventLoop; + Mutex m_eventSourcesLock; + class EventSource; + HashMap<int, Vector<EventSource*> > m_eventSources; + typedef HashMap<int, Vector<EventSource*> >::iterator EventSourceIterator; +#endif +}; + +#endif // WorkQueue_h diff --git a/Source/WebKit2/Platform/cg/CGUtilities.cpp b/Source/WebKit2/Platform/cg/CGUtilities.cpp new file mode 100644 index 0000000..1e5dd33 --- /dev/null +++ b/Source/WebKit2/Platform/cg/CGUtilities.cpp @@ -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. + */ + +#include "CGUtilities.h" + +#include <wtf/RetainPtr.h> + +namespace WebKit { + +void paintBitmapContext(CGContextRef context, CGContextRef bitmapContext, CGPoint destination, CGRect source) +{ + void* bitmapData = CGBitmapContextGetData(bitmapContext); + ASSERT(bitmapData); + + size_t imageWidth = CGBitmapContextGetWidth(bitmapContext); + size_t imageHeight = CGBitmapContextGetHeight(bitmapContext); + + size_t bytesPerRow = CGBitmapContextGetBytesPerRow(bitmapContext); + + RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithData(0, bitmapData, bytesPerRow * imageHeight, 0)); + RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(imageWidth, imageHeight, + CGBitmapContextGetBitsPerComponent(bitmapContext), + CGBitmapContextGetBitsPerPixel(bitmapContext), + bytesPerRow, + CGBitmapContextGetColorSpace(bitmapContext), + CGBitmapContextGetBitmapInfo(bitmapContext), + dataProvider.get(), 0, false, kCGRenderingIntentDefault)); + + CGContextSaveGState(context); + + CGContextClipToRect(context, CGRectMake(destination.x, destination.y, source.size.width, source.size.height)); + CGContextScaleCTM(context, 1, -1); + + CGFloat destX = destination.x - source.origin.x; + CGFloat destY = -static_cast<CGFloat>(imageHeight) - destination.y + source.origin.y; + + CGContextDrawImage(context, CGRectMake(destX, destY, imageWidth, imageHeight), image.get()); + CGContextRestoreGState(context); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Platform/cg/CGUtilities.h b/Source/WebKit2/Platform/cg/CGUtilities.h new file mode 100644 index 0000000..3dca654 --- /dev/null +++ b/Source/WebKit2/Platform/cg/CGUtilities.h @@ -0,0 +1,35 @@ +/* + * 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 CGUtilities_h +#define CGUtilities_h + +namespace WebKit { + +void paintBitmapContext(CGContextRef, CGContextRef bitmapContext, CGPoint destination, CGRect source); + +} // namespace WebKit + +#endif // CGUtilities_h diff --git a/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp b/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp new file mode 100644 index 0000000..2c183fa --- /dev/null +++ b/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "RunLoop.h" + +#include "WKBase.h" +#include <glib.h> + +RunLoop::RunLoop() +{ + m_runLoopContext = g_main_context_default(); + ASSERT(m_runLoopContext); + m_runLoopMain = g_main_loop_new(m_runLoopContext, FALSE); + ASSERT(m_runLoopMain); +} + +RunLoop::~RunLoop() +{ + if (m_runLoopMain) { + g_main_loop_quit(m_runLoopMain); + g_main_loop_unref(m_runLoopMain); + } + + if (m_runLoopContext) + g_main_context_unref(m_runLoopContext); +} + +void RunLoop::run() +{ + g_main_loop_run(RunLoop::main()->mainLoop()); +} + +GMainLoop* RunLoop::mainLoop() +{ + return m_runLoopMain; +} + +void RunLoop::stop() +{ + g_main_loop_quit(m_runLoopMain); +} + +gboolean RunLoop::queueWork(RunLoop* runLoop) +{ + runLoop->performWork(); + return FALSE; +} + +void RunLoop::wakeUp() +{ + GSource* source = g_timeout_source_new(0); + g_source_set_callback(source, reinterpret_cast<GSourceFunc>(&RunLoop::queueWork), this, 0); + g_source_attach(source, m_runLoopContext); + + g_main_context_wakeup(m_runLoopContext); +} + +RunLoop::TimerBase::TimerBase(RunLoop* runLoop) + : m_runLoop(runLoop) + , m_timerSource(0) +{ +} + +RunLoop::TimerBase::~TimerBase() +{ + stop(); +} + +void RunLoop::TimerBase::resetTimerSource() +{ + m_timerSource = 0; +} + +gboolean RunLoop::TimerBase::oneShotTimerFired(RunLoop::TimerBase* timer) +{ + timer->fired(); + timer->resetTimerSource(); + return FALSE; +} + +gboolean RunLoop::TimerBase::repeatingTimerFired(RunLoop::TimerBase* timer) +{ + timer->fired(); + return TRUE; +} + +void RunLoop::TimerBase::start(double fireInterval, bool repeat) +{ + if (m_timerSource) + stop(); + + m_timerSource = g_timeout_source_new(static_cast<guint>(fireInterval)); + if (repeat) + g_source_set_callback(m_timerSource, reinterpret_cast<GSourceFunc>(&RunLoop::TimerBase::repeatingTimerFired), this, 0); + else + g_source_set_callback(m_timerSource, reinterpret_cast<GSourceFunc>(&RunLoop::TimerBase::oneShotTimerFired), this, 0); + g_source_attach(m_timerSource, m_runLoop->m_runLoopContext); +} + +void RunLoop::TimerBase::stop() +{ + if (!m_timerSource) + return; + + g_source_destroy(m_timerSource); + m_timerSource = 0; +} + +bool RunLoop::TimerBase::isActive() const +{ + return m_timerSource; +} diff --git a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp new file mode 100644 index 0000000..93fda95 --- /dev/null +++ b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "SharedMemory.h" + +#include "NotImplemented.h" + +namespace WebKit { + +SharedMemory::Handle::Handle() +{ + notImplemented(); +} + +SharedMemory::Handle::~Handle() +{ + notImplemented(); +} + +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + notImplemented(); +} + +bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + notImplemented(); + return false; +} + +PassRefPtr<SharedMemory> SharedMemory::create(size_t size) +{ + notImplemented(); + return 0; +} + +PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) +{ + notImplemented(); + return 0; +} + +SharedMemory::~SharedMemory() +{ + notImplemented(); +} + +bool SharedMemory::createHandle(Handle& handle, Protection protection) +{ + notImplemented(); + return false; +} + +unsigned SharedMemory::systemPageSize() +{ + unsigned pageSize = 0; + + return pageSize; +} + +} diff --git a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp new file mode 100644 index 0000000..995b531 --- /dev/null +++ b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WorkQueue.h" + +#include "NotImplemented.h" +#include "WKBase.h" +#include <glib.h> + +// WorkQueue::EventSource +class WorkQueue::EventSource { +public: + EventSource(GSource* dispatchSource, PassOwnPtr<WorkItem> workItem, WorkQueue* workQueue) + : m_dispatchSource(dispatchSource) + , m_workItem(workItem) + , m_workQueue(workQueue) + { + } + + GSource* dispatchSource() { return m_dispatchSource; } + + static gboolean performWorkOnce(EventSource* eventSource) + { + ASSERT(eventSource); + WorkQueue* queue = eventSource->m_workQueue; + { + MutexLocker locker(queue->m_isValidMutex); + if (!queue->m_isValid) + return FALSE; + } + + eventSource->m_workItem->execute(); + return FALSE; + } + + static gboolean performWork(GIOChannel* channel, GIOCondition condition, EventSource* eventSource) + { + ASSERT(eventSource); + + if (!(condition & G_IO_IN) && !(condition & G_IO_HUP) && !(condition & G_IO_ERR)) + return FALSE; + + WorkQueue* queue = eventSource->m_workQueue; + { + MutexLocker locker(queue->m_isValidMutex); + if (!queue->m_isValid) + return FALSE; + } + + eventSource->m_workItem->execute(); + + if ((condition & G_IO_HUP) || (condition & G_IO_ERR)) + return FALSE; + + return TRUE; + } + + static void deleteEventSource(EventSource* eventSource) + { + ASSERT(eventSource); + delete eventSource; + } + +public: + GSource* m_dispatchSource; + PassOwnPtr<WorkItem> m_workItem; + WorkQueue* m_workQueue; +}; + +// WorkQueue +void WorkQueue::platformInitialize(const char* name) +{ + m_eventContext = g_main_context_new(); + ASSERT(m_eventContext); + m_eventLoop = g_main_loop_new(m_eventContext, FALSE); + ASSERT(m_eventLoop); + m_workQueueThread = createThread(reinterpret_cast<WTF::ThreadFunction>(&WorkQueue::startWorkQueueThread), this, name); +} + +void WorkQueue::platformInvalidate() +{ + MutexLocker locker(m_eventLoopLock); + + if (m_eventLoop) { + if (g_main_loop_is_running(m_eventLoop)) + g_main_loop_quit(m_eventLoop); + + g_main_loop_unref(m_eventLoop); + m_eventLoop = 0; + } + + if (m_eventContext) { + g_main_context_unref(m_eventContext); + m_eventContext = 0; + } +} + +void* WorkQueue::startWorkQueueThread(WorkQueue* workQueue) +{ + workQueue->workQueueThreadBody(); + return 0; +} + +void WorkQueue::workQueueThreadBody() +{ + g_main_loop_run(m_eventLoop); +} + +void WorkQueue::registerEventSourceHandler(int fileDescriptor, int condition, PassOwnPtr<WorkItem> item) +{ + GIOChannel* channel = g_io_channel_unix_new(fileDescriptor); + ASSERT(channel); + GSource* dispatchSource = g_io_create_watch(channel, static_cast<GIOCondition>(condition)); + ASSERT(dispatchSource); + EventSource* eventSource = new EventSource(dispatchSource, item, this); + ASSERT(eventSource); + + g_source_set_callback(dispatchSource, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWork), + eventSource, reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); + + // 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()) + sources = it->second; + + sources.append(eventSource); + m_eventSources.set(fileDescriptor, sources); + } + + // Attach the event source to the GMainContext under the mutex since this is shared across multiple threads. + { + MutexLocker locker(m_eventLoopLock); + g_source_attach(dispatchSource, m_eventContext); + } +} + +void WorkQueue::unregisterEventSourceHandler(int fileDescriptor) +{ + ASSERT(fileDescriptor); + + MutexLocker locker(m_eventSourcesLock); + + EventSourceIterator it = m_eventSources.find(fileDescriptor); + ASSERT(it != m_eventSources.end()); + ASSERT(m_eventSources.contains(fileDescriptor)); + + if (it != m_eventSources.end()) { + Vector<EventSource*> sources = it->second; + for (unsigned i = 0; i < sources.size(); i++) + g_source_destroy(sources[i]->dispatchSource()); + + m_eventSources.remove(it); + } +} + +void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) +{ + GSource* dispatchSource = g_timeout_source_new(0); + ASSERT(dispatchSource); + EventSource* eventSource = new EventSource(dispatchSource, item, this); + + g_source_set_callback(dispatchSource, + reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce), + eventSource, + reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); + { + MutexLocker locker(m_eventLoopLock); + g_source_attach(dispatchSource, m_eventContext); + } +} + +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) +{ + notImplemented(); +} diff --git a/Source/WebKit2/Platform/mac/MachUtilities.cpp b/Source/WebKit2/Platform/mac/MachUtilities.cpp new file mode 100644 index 0000000..edb17dc --- /dev/null +++ b/Source/WebKit2/Platform/mac/MachUtilities.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "MachUtilities.h" + +#include <mach/task.h> + +void setMachPortQueueLength(mach_port_t receivePort, mach_port_msgcount_t queueLength) +{ + mach_port_limits_t portLimits; + portLimits.mpl_qlimit = queueLength; + + mach_port_set_attributes(mach_task_self(), receivePort, MACH_PORT_LIMITS_INFO, reinterpret_cast<mach_port_info_t>(&portLimits), MACH_PORT_LIMITS_INFO_COUNT); +} + +mach_port_t machExceptionPort() +{ + exception_mask_t exceptionMasks[EXC_TYPES_COUNT]; + exception_port_t exceptionHandlers[EXC_TYPES_COUNT]; + exception_behavior_t exceptionBehaviors[EXC_TYPES_COUNT]; + thread_state_flavor_t exceptionFlavors[EXC_TYPES_COUNT]; + mach_msg_type_number_t numExceptionMasks; + + kern_return_t kr = task_get_exception_ports(mach_task_self(), EXC_MASK_CRASH, exceptionMasks, &numExceptionMasks, exceptionHandlers, exceptionBehaviors, exceptionFlavors); + if (kr != KERN_SUCCESS) { + ASSERT_NOT_REACHED(); + return MACH_PORT_NULL; + } + + // We're just interested in the first exception handler. + return exceptionHandlers[0]; +} + +void setMachExceptionPort(mach_port_t exceptionPort) +{ + // Assert that we dont try to call setMachExceptionPort more than once per process. +#if !ASSERT_DISABLED + static mach_port_t taskExceptionPort = MACH_PORT_NULL; + ASSERT(taskExceptionPort == MACH_PORT_NULL); + taskExceptionPort = exceptionPort; +#endif + + if (task_set_exception_ports(mach_task_self(), EXC_MASK_CRASH, exceptionPort, EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, MACHINE_THREAD_STATE) != KERN_SUCCESS) + ASSERT_NOT_REACHED(); +} diff --git a/Source/WebKit2/Platform/mac/MachUtilities.h b/Source/WebKit2/Platform/mac/MachUtilities.h new file mode 100644 index 0000000..a8d0d6f --- /dev/null +++ b/Source/WebKit2/Platform/mac/MachUtilities.h @@ -0,0 +1,36 @@ +/* + * 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 MachUtilities_h +#define MachUtilities_h + +#include <mach/mach_port.h> + +void setMachPortQueueLength(mach_port_t, mach_port_msgcount_t queueLength); + +mach_port_t machExceptionPort(); +void setMachExceptionPort(mach_port_t exceptionPort); + +#endif // MachUtilities_h diff --git a/Source/WebKit2/Platform/mac/ModuleMac.mm b/Source/WebKit2/Platform/mac/ModuleMac.mm new file mode 100644 index 0000000..fa38745 --- /dev/null +++ b/Source/WebKit2/Platform/mac/ModuleMac.mm @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Module.h" + +namespace WebKit { + +bool Module::load() +{ + RetainPtr<CFStringRef> bundlePath(AdoptCF, m_path.createCFString()); + RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, FALSE)); + if (!bundleURL) + return false; + + RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); + if (!bundle) + return false; + + if (!CFBundleLoadExecutable(bundle.get())) + return false; + + m_bundle.adoptCF(bundle.releaseRef()); + return true; +} + +void Module::unload() +{ + // See the comment in Module.h for why we leak the bundle here. + m_bundle.releaseRef(); +} + +void* Module::platformFunctionPointer(const char* functionName) const +{ + if (!m_bundle) + return 0; + RetainPtr<CFStringRef> functionNameString(AdoptCF, CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, functionName, kCFStringEncodingASCII, kCFAllocatorNull)); + return CFBundleGetFunctionPointerForName(m_bundle.get(), functionNameString.get()); +} + +} diff --git a/Source/WebKit2/Platform/mac/RunLoopMac.mm b/Source/WebKit2/Platform/mac/RunLoopMac.mm new file mode 100644 index 0000000..ca044f3 --- /dev/null +++ b/Source/WebKit2/Platform/mac/RunLoopMac.mm @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "RunLoop.h" + +#include "WorkItem.h" + +void RunLoop::performWork(void* context) +{ + static_cast<RunLoop*>(context)->performWork(); +} + +RunLoop::RunLoop() +{ + m_runLoop = CFRunLoopGetCurrent(); + + CFRunLoopSourceContext context = { 0, this, 0, 0, 0, 0, 0, 0, 0, performWork }; + m_runLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context); + CFRunLoopAddSource(m_runLoop, m_runLoopSource, kCFRunLoopCommonModes); +} + +RunLoop::~RunLoop() +{ + // FIXME: Tear down the work item queue here. + CFRunLoopSourceInvalidate(m_runLoopSource); + CFRelease(m_runLoopSource); +} + +void RunLoop::run() +{ + if (current() == main()) { + // Use -[NSApplication run] for the main run loop. + [NSApp run]; + } else { + // Otherwise, use NSRunLoop. We do this because it sets up an autorelease pool for us. + [[NSRunLoop currentRunLoop] run]; + } +} + +void RunLoop::stop() +{ + ASSERT(m_runLoop == CFRunLoopGetCurrent()); + + if (m_runLoop == main()->m_runLoop) { + [NSApp stop:nil]; + NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined + location:NSMakePoint(0, 0) + modifierFlags:0 + timestamp:0.0 + windowNumber:0 + context:nil + subtype: 0 + data1:0 + data2:0]; + [NSApp postEvent:event atStart:true]; + } else + CFRunLoopStop(m_runLoop); +} + +void RunLoop::wakeUp() +{ + CFRunLoopSourceSignal(m_runLoopSource); + CFRunLoopWakeUp(m_runLoop); +} + +// RunLoop::Timer + +void RunLoop::TimerBase::timerFired(CFRunLoopTimerRef, void* context) +{ + TimerBase* timer = static_cast<TimerBase*>(context); + timer->fired(); +} + +RunLoop::TimerBase::TimerBase(RunLoop* runLoop) + : m_runLoop(runLoop) + , m_timer(0) +{ +} + +RunLoop::TimerBase::~TimerBase() +{ + stop(); +} + +void RunLoop::TimerBase::start(double nextFireInterval, bool repeat) +{ + if (m_timer) + stop(); + + CFRunLoopTimerContext context = { 0, this, 0, 0, 0 }; + CFTimeInterval repeatInterval = repeat ? nextFireInterval : 0; + m_timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context); + CFRunLoopAddTimer(m_runLoop->m_runLoop, m_timer, kCFRunLoopCommonModes); +} + +void RunLoop::TimerBase::stop() +{ + if (!m_timer) + return; + + CFRunLoopTimerInvalidate(m_timer); + CFRelease(m_timer); + m_timer = 0; +} + +bool RunLoop::TimerBase::isActive() const +{ + return m_timer && CFRunLoopTimerIsValid(m_timer); +} diff --git a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp new file mode 100644 index 0000000..07f942c --- /dev/null +++ b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "SharedMemory.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Arguments.h" +#include "MachPort.h" +#include <mach/mach_port.h> +#include <mach/mach_vm.h> +#include <mach/vm_map.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +SharedMemory::Handle::Handle() + : m_port(MACH_PORT_NULL) + , m_size(0) +{ +} + +SharedMemory::Handle::~Handle() +{ + if (m_port) + mach_port_deallocate(mach_task_self(), m_port); +} + +bool SharedMemory::Handle::isNull() const +{ + return !m_port; +} + +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encodeUInt64(m_size); + encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_COPY_SEND)); + m_port = MACH_PORT_NULL; +} + +bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + ASSERT(!handle.m_port); + ASSERT(!handle.m_size); + + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + CoreIPC::MachPort machPort; + if (!decoder->decode(CoreIPC::Out(machPort))) + return false; + + handle.m_size = size; + handle.m_port = machPort.port(); + return true; +} + +static inline void* toPointer(mach_vm_address_t address) +{ + return reinterpret_cast<void*>(static_cast<uintptr_t>(address)); +} + +static inline mach_vm_address_t toVMAddress(void* pointer) +{ + return static_cast<mach_vm_address_t>(reinterpret_cast<uintptr_t>(pointer)); +} + +PassRefPtr<SharedMemory> SharedMemory::create(size_t 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) + return 0; + + RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); + sharedMemory->m_size = size; + sharedMemory->m_data = toPointer(address); + + return sharedMemory.release(); +} + +static inline vm_prot_t machProtection(SharedMemory::Protection protection) +{ + switch (protection) { + case SharedMemory::ReadOnly: + return VM_PROT_READ; + case SharedMemory::ReadWrite: + return VM_PROT_READ | VM_PROT_WRITE; + } + + ASSERT_NOT_REACHED(); + return VM_PROT_NONE; +} + +PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) +{ + if (handle.isNull()) + return 0; + + // Map the memory. + vm_prot_t vmProtection = machProtection(protection); + mach_vm_address_t mappedAddress = 0; + kern_return_t kr = mach_vm_map(mach_task_self(), &mappedAddress, handle.m_size, 0, VM_FLAGS_ANYWHERE, handle.m_port, 0, false, vmProtection, vmProtection, VM_INHERIT_NONE); + if (kr != KERN_SUCCESS) + return 0; + + RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); + sharedMemory->m_size = handle.m_size; + sharedMemory->m_data = toPointer(mappedAddress); + + return sharedMemory.release(); +} + +SharedMemory::~SharedMemory() +{ + if (!m_data) + return; + + kern_return_t kr = mach_vm_deallocate(mach_task_self(), toVMAddress(m_data), round_page(m_size)); + ASSERT_UNUSED(kr, kr == KERN_SUCCESS); +} + +bool SharedMemory::createHandle(Handle& handle, Protection protection) +{ + ASSERT(!handle.m_port); + ASSERT(!handle.m_size); + + mach_vm_address_t address = toVMAddress(m_data); + memory_object_size_t size = round_page(m_size); + + // Create a mach port that represents the shared memory. + mach_port_t port; + kern_return_t kr = mach_make_memory_entry_64(mach_task_self(), &size, address, machProtection(protection), &port, MACH_PORT_NULL); + if (kr != KERN_SUCCESS) + return false; + + handle.m_port = port; + handle.m_size = size; + + return true; +} + +unsigned SharedMemory::systemPageSize() +{ + return vm_page_size; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp new file mode 100644 index 0000000..3651f8c --- /dev/null +++ b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WorkQueue.h" + +#include <mach/mach_port.h> +#include <wtf/PassOwnPtr.h> + +#if HAVE(DISPATCH_H) + +void WorkQueue::executeWorkItem(void* item) +{ + WorkQueue* queue = static_cast<WorkQueue*>(dispatch_get_context(dispatch_get_current_queue())); + OwnPtr<WorkItem> workItem(static_cast<WorkItem*>(item)); + + { + MutexLocker locker(queue->m_isValidMutex); + if (!queue->m_isValid) + return; + } + + workItem->execute(); +} + +void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) +{ + dispatch_async_f(m_dispatchQueue, item.leakPtr(), executeWorkItem); +} + +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem> item, double delay) +{ + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC); + + dispatch_after_f(delayTime, m_dispatchQueue, item.leakPtr(), executeWorkItem); +} + +class WorkQueue::EventSource { +public: + EventSource(MachPortEventType eventType, dispatch_source_t dispatchSource, PassOwnPtr<WorkItem> workItem) + : m_eventType(eventType) + , m_dispatchSource(dispatchSource) + , m_workItem(workItem) + { + } + + dispatch_source_t dispatchSource() const { return m_dispatchSource; } + + static void eventHandler(void* source) + { + EventSource* eventSource = static_cast<EventSource*>(source); + + eventSource->m_workItem->execute(); + } + + static void cancelHandler(void* source) + { + EventSource* eventSource = static_cast<EventSource*>(source); + + mach_port_t machPort = dispatch_source_get_handle(eventSource->m_dispatchSource); + + switch (eventSource->m_eventType) { + case MachPortDataAvailable: + // Release our receive right. + mach_port_mod_refs(mach_task_self(), machPort, MACH_PORT_RIGHT_RECEIVE, -1); + break; + case MachPortDeadNameNotification: + // Release our send right. + mach_port_deallocate(mach_task_self(), machPort); + break; + } + } + + static void finalizeHandler(void* source) + { + EventSource* eventSource = static_cast<EventSource*>(source); + + delete eventSource; + } + +private: + MachPortEventType m_eventType; + + // This is a weak reference, since m_dispatchSource references the event source. + dispatch_source_t m_dispatchSource; + + OwnPtr<WorkItem> m_workItem; +}; + +void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, PassOwnPtr<WorkItem> workItem) +{ + dispatch_source_type_t sourceType = 0; + switch (eventType) { + case MachPortDataAvailable: + sourceType = DISPATCH_SOURCE_TYPE_MACH_RECV; + break; + case MachPortDeadNameNotification: + sourceType = DISPATCH_SOURCE_TYPE_MACH_SEND; + break; + } + + dispatch_source_t dispatchSource = dispatch_source_create(sourceType, machPort, 0, m_dispatchQueue); + + EventSource* eventSource = new EventSource(eventType, dispatchSource, workItem); + dispatch_set_context(dispatchSource, eventSource); + + dispatch_source_set_event_handler_f(dispatchSource, &EventSource::eventHandler); + dispatch_source_set_cancel_handler_f(dispatchSource, &EventSource::cancelHandler); + dispatch_set_finalizer_f(dispatchSource, &EventSource::finalizeHandler); + + // Add the source to our set of sources. + { + MutexLocker locker(m_eventSourcesMutex); + + ASSERT(!m_eventSources.contains(machPort)); + + m_eventSources.set(machPort, eventSource); + + // And start it! + dispatch_resume(dispatchSource); + } +} + +void WorkQueue::unregisterMachPortEventHandler(mach_port_t machPort) +{ + ASSERT(machPort); + + MutexLocker locker(m_eventSourcesMutex); + + HashMap<mach_port_t, EventSource*>::iterator it = m_eventSources.find(machPort); + ASSERT(it != m_eventSources.end()); + + ASSERT(m_eventSources.contains(machPort)); + + EventSource* eventSource = it->second; + // Cancel and release the source. It will be deleted in its finalize handler. + dispatch_source_cancel(eventSource->dispatchSource()); + dispatch_release(eventSource->dispatchSource()); + + m_eventSources.remove(it); +} + +void WorkQueue::platformInitialize(const char* name) +{ + m_dispatchQueue = dispatch_queue_create(name, 0); + dispatch_set_context(m_dispatchQueue, this); +} + +void WorkQueue::platformInvalidate() +{ +#if !ASSERT_DISABLED + MutexLocker locker(m_eventSourcesMutex); + ASSERT(m_eventSources.isEmpty()); +#endif + + dispatch_release(m_dispatchQueue); +} + +#else /* !HAVE(DISPATCH_H) */ + +void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) +{ +} + +void WorkQueue::registerMachPortEventHandler(mach_port_t, MachPortEventType, PassOwnPtr<WorkItem>) +{ +} + +void WorkQueue::unregisterMachPortEventHandler(mach_port_t) +{ +} + +void WorkQueue::platformInitialize(const char*) +{ +} + +void WorkQueue::platformInvalidate() +{ +} + +#endif diff --git a/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp b/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp new file mode 100644 index 0000000..d36d82b --- /dev/null +++ b/Source/WebKit2/Platform/qt/MappedMemoryPool.cpp @@ -0,0 +1,114 @@ +/* + * 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 new file mode 100644 index 0000000..8d6af8c --- /dev/null +++ b/Source/WebKit2/Platform/qt/MappedMemoryPool.h @@ -0,0 +1,109 @@ +/* + * 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 new file mode 100644 index 0000000..8a68cf4 --- /dev/null +++ b/Source/WebKit2/Platform/qt/ModuleQt.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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. + */ + +#include "Module.h" + +namespace WebKit { + +bool Module::load() +{ + m_lib.setFileName(static_cast<QString>(m_path)); + return m_lib.load(); +} + +void Module::unload() +{ + m_lib.unload(); +} + +void* Module::platformFunctionPointer(const char* functionName) const +{ + // Unfortunately QLibrary::resolve is not const. + return const_cast<QLibrary*>(&m_lib)->resolve(functionName); +} + +} diff --git a/Source/WebKit2/Platform/qt/RunLoopQt.cpp b/Source/WebKit2/Platform/qt/RunLoopQt.cpp new file mode 100644 index 0000000..d7d859d --- /dev/null +++ b/Source/WebKit2/Platform/qt/RunLoopQt.cpp @@ -0,0 +1,145 @@ +/* + * 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 "RunLoop.h" + +#include "WorkItem.h" + +#include <QApplication> +#include <QAbstractEventDispatcher> +#include <QObject> +#include <QMetaMethod> +#include <QMetaObject> +#include <QTimerEvent> + +class RunLoop::TimerObject : public QObject +{ + Q_OBJECT +public: + TimerObject(RunLoop* runLoop) : m_runLoop(runLoop) + { + int methodIndex = metaObject()->indexOfMethod("performWork()"); + m_method = metaObject()->method(methodIndex); + } + + Q_SLOT void performWork() { m_runLoop->performWork(); } + inline void wakeUp() { m_method.invoke(this, Qt::QueuedConnection); } + +protected: + virtual void timerEvent(QTimerEvent* event) + { + RunLoop::TimerBase::timerFired(m_runLoop, event->timerId()); + } + +private: + RunLoop* m_runLoop; + QMetaMethod m_method; +}; + +void RunLoop::run() +{ + QCoreApplication::exec(); +} + +void RunLoop::stop() +{ + QCoreApplication::exit(); +} + +RunLoop::RunLoop() + : m_timerObject(new TimerObject(this)) +{ +} + +RunLoop::~RunLoop() +{ + delete m_timerObject; +} + +void RunLoop::wakeUp() +{ + m_timerObject->wakeUp(); +} + +// RunLoop::Timer + +void RunLoop::TimerBase::timerFired(RunLoop* runLoop, int ID) +{ + TimerMap::iterator it = runLoop->m_activeTimers.find(ID); + ASSERT(it != runLoop->m_activeTimers.end()); + TimerBase* timer = it->second; + + if (!timer->m_isRepeating) { + // Stop the timer (calling stop would need another hash table lookup). + runLoop->m_activeTimers.remove(it); + runLoop->m_timerObject->killTimer(timer->m_ID); + timer->m_ID = 0; + } + + timer->fired(); +} + +RunLoop::TimerBase::TimerBase(RunLoop* runLoop) + : m_runLoop(runLoop) + , m_ID(0) + , m_isRepeating(false) +{ +} + +RunLoop::TimerBase::~TimerBase() +{ + stop(); +} + +void RunLoop::TimerBase::start(double nextFireInterval, bool repeat) +{ + stop(); + int millis = static_cast<int>(nextFireInterval * 1000); + m_isRepeating = repeat; + m_ID = m_runLoop->m_timerObject->startTimer(millis); + ASSERT(m_ID); + m_runLoop->m_activeTimers.set(m_ID, this); +} + +void RunLoop::TimerBase::stop() +{ + if (!m_ID) + return; + TimerMap::iterator it = m_runLoop->m_activeTimers.find(m_ID); + if (it == m_runLoop->m_activeTimers.end()) + return; + + m_runLoop->m_activeTimers.remove(it); + m_runLoop->m_timerObject->killTimer(m_ID); + m_ID = 0; +} + +bool RunLoop::TimerBase::isActive() const +{ + return m_ID; +} + +#include "RunLoopQt.moc" diff --git a/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp b/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp new file mode 100644 index 0000000..f5fecfc --- /dev/null +++ b/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (c) 2010 University of Szeged + * 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 "SharedMemory.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "CleanupHandler.h" +#include "WebCoreArgumentCoders.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_size(0) +{ +} + +SharedMemory::Handle::~Handle() +{ +} + +bool SharedMemory::Handle::isNull() const +{ + return m_key.isNull(); +} + +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encodeUInt64(m_size); + encoder->encode(m_key); + m_key = String(); +} + +bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + ASSERT_ARG(handle, !handle.m_size); + ASSERT_ARG(handle, handle.m_key.isNull()); + + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + String key; + if (!decoder->decode(key)) + return false; + + handle.m_size = size; + handle.m_key = key; + + return true; +} + +static QString createUniqueKey() +{ + return QLatin1String("QWKSharedMemoryKey") + QUuid::createUuid().toString(); +} + +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); + + sharedMemory->m_impl = impl; + sharedMemory->m_size = size; + sharedMemory->m_data = impl->data(); + + // Do not leave the shared memory segment behind. + CleanupHandler::instance()->markForCleanup(impl); + + return sharedMemory.release(); +} + +static inline QSharedMemory::AccessMode accessMode(SharedMemory::Protection protection) +{ + switch (protection) { + case SharedMemory::ReadOnly: + return QSharedMemory::ReadOnly; + case SharedMemory::ReadWrite: + return QSharedMemory::ReadWrite; + } + + ASSERT_NOT_REACHED(); + return QSharedMemory::ReadWrite; +} + +PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) +{ + if (handle.isNull()) + return 0; + + QSharedMemory* impl = new QSharedMemory(QString(handle.m_key)); + bool attached = impl->attach(accessMode(protection)); + if (!attached) { + delete impl; + 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(); +} + +SharedMemory::~SharedMemory() +{ + if (CleanupHandler::instance()->hasStartedDeleting()) + return; + + CleanupHandler::instance()->unmark(m_impl); + delete m_impl; +} + +bool SharedMemory::createHandle(Handle& handle, Protection protection) +{ + ASSERT_ARG(handle, handle.m_key.isNull()); + ASSERT_ARG(handle, !handle.m_size); + + QString key = m_impl->key(); + if (key.isNull()) + return false; + handle.m_key = String(key); + handle.m_size = m_size; + + return true; +} + +unsigned SharedMemory::systemPageSize() +{ + static unsigned pageSize = 0; + + if (!pageSize) + pageSize = getpagesize(); + + return pageSize; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp new file mode 100644 index 0000000..271984f --- /dev/null +++ b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp @@ -0,0 +1,132 @@ +/* + * 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 "WorkQueue.h" + +#include <QLocalSocket> +#include <QObject> +#include <QThread> +#include <wtf/Threading.h> +#include "NotImplemented.h" + +class WorkQueue::WorkItemQt : public QObject { + Q_OBJECT +public: + WorkItemQt(WorkQueue* workQueue, WorkItem* workItem) + : m_queue(workQueue) + , m_source(0) + , m_signal(0) + , m_workItem(workItem) + { + } + + WorkItemQt(WorkQueue* workQueue, QObject* source, const char* signal, WorkItem* workItem) + : m_queue(workQueue) + , m_source(source) + , m_signal(signal) + , m_workItem(workItem) + { + connect(m_source, m_signal, SLOT(execute()), Qt::QueuedConnection); + } + + ~WorkItemQt() + { + delete m_workItem; + } + + Q_SLOT void execute() + { + if (m_queue->m_isValid) + m_workItem->execute(); + } + + virtual void timerEvent(QTimerEvent*) + { + execute(); + delete this; + } + + WorkQueue* m_queue; + QObject* m_source; + const char* m_signal; + 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) +{ + ASSERT(m_workThread); + ASSERT(socket); + + socket->setParent(0); + socket->moveToThread(m_workThread); +} + +void WorkQueue::platformInitialize(const char*) +{ + m_workThread = new QThread(); + m_workThread->start(); +} + +void WorkQueue::platformInvalidate() +{ + m_workThread->exit(); + m_workThread->wait(); + delete m_workThread; + deleteAllValues(m_signalListeners); +} + +void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) +{ + WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, item.leakPtr()); + itemQt->startTimer(0); + itemQt->moveToThread(m_workThread); +} + +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) +{ + notImplemented(); +} + +#include "WorkQueueQt.moc" diff --git a/Source/WebKit2/Platform/win/ModuleWin.cpp b/Source/WebKit2/Platform/win/ModuleWin.cpp new file mode 100644 index 0000000..2c2250d --- /dev/null +++ b/Source/WebKit2/Platform/win/ModuleWin.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Module.h" + +#include <shlwapi.h> + +namespace WebKit { + +bool Module::load() +{ + ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination())); + m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); + return m_module; +} + +void Module::unload() +{ + if (!m_module) + return; + ::FreeLibrary(m_module); + m_module = 0; +} + +void* Module::platformFunctionPointer(const char* functionName) const +{ + if (!m_module) + return 0; + + return ::GetProcAddress(m_module, functionName); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Platform/win/RunLoopWin.cpp b/Source/WebKit2/Platform/win/RunLoopWin.cpp new file mode 100644 index 0000000..4dfb4b5 --- /dev/null +++ b/Source/WebKit2/Platform/win/RunLoopWin.cpp @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "RunLoop.h" + +#include "WorkItem.h" + +static const UINT PerformWorkMessage = WM_USER + 1; +static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow"; + +LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); + + if (RunLoop* runLoop = reinterpret_cast<RunLoop*>(longPtr)) + return runLoop->wndProc(hWnd, message, wParam, lParam); + + if (message == WM_CREATE) { + LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); + + // Associate the RunLoop with the window. + ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); + return 0; + } + + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +LRESULT RunLoop::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case PerformWorkMessage: + performWork(); + return 0; + case WM_TIMER: + RunLoop::TimerBase::timerFired(this, wParam); + return 0; + } + + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +void RunLoop::run() +{ + MSG message; + while (BOOL result = ::GetMessage(&message, 0, 0, 0)) { + if (result == -1) + break; + ::TranslateMessage(&message); + ::DispatchMessage(&message); + } +} + +void RunLoop::stop() +{ + ::PostQuitMessage(0); +} + +bool RunLoop::registerRunLoopMessageWindowClass() +{ + // FIXME: This really only needs to be called once. + + WNDCLASSEX windowClass = { 0 }; + windowClass.cbSize = sizeof(windowClass); + windowClass.lpfnWndProc = RunLoop::RunLoopWndProc; + windowClass.cbWndExtra = sizeof(RunLoop*); + windowClass.lpszClassName = kRunLoopMessageWindowClassName; + + return !!::RegisterClassEx(&windowClass); +} + +RunLoop::RunLoop() +{ + registerRunLoopMessageWindowClass(); + + m_runLoopMessageWindow = ::CreateWindow(kRunLoopMessageWindowClassName, 0, 0, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, + HWND_MESSAGE, 0, 0, this); + ASSERT(::IsWindow(m_runLoopMessageWindow)); +} + +RunLoop::~RunLoop() +{ + // FIXME: Tear down the work item queue here. +} + +void RunLoop::wakeUp() +{ + // FIXME: No need to wake up the run loop if we've already called scheduleWork + // before the run loop has had the time to respond. + ::PostMessage(m_runLoopMessageWindow, PerformWorkMessage, reinterpret_cast<WPARAM>(this), 0); +} + +// RunLoop::Timer + +void RunLoop::TimerBase::timerFired(RunLoop* runLoop, uint64_t ID) +{ + TimerMap::iterator it = runLoop->m_activeTimers.find(ID); + ASSERT(it != runLoop->m_activeTimers.end()); + TimerBase* timer = it->second; + + if (!timer->m_isRepeating) { + runLoop->m_activeTimers.remove(it); + ::KillTimer(runLoop->m_runLoopMessageWindow, ID); + } + + timer->fired(); +} + +static uint64_t generateTimerID() +{ + static uint64_t uniqueTimerID = 1; + return uniqueTimerID++; +} + +RunLoop::TimerBase::TimerBase(RunLoop* runLoop) + : m_runLoop(runLoop) + , m_ID(generateTimerID()) + , m_isRepeating(false) +{ +} + +RunLoop::TimerBase::~TimerBase() +{ + stop(); +} + +void RunLoop::TimerBase::start(double nextFireInterval, bool repeat) +{ + m_isRepeating = repeat; + m_runLoop->m_activeTimers.set(m_ID, this); + ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval, 0); +} + +void RunLoop::TimerBase::stop() +{ + TimerMap::iterator it = m_runLoop->m_activeTimers.find(m_ID); + if (it == m_runLoop->m_activeTimers.end()) + return; + + m_runLoop->m_activeTimers.remove(it); + ::KillTimer(m_runLoop->m_runLoopMessageWindow, m_ID); +} + +bool RunLoop::TimerBase::isActive() const +{ + return m_runLoop->m_activeTimers.contains(m_ID); +} diff --git a/Source/WebKit2/Platform/win/SharedMemoryWin.cpp b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp new file mode 100644 index 0000000..260783a --- /dev/null +++ b/Source/WebKit2/Platform/win/SharedMemoryWin.cpp @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "SharedMemory.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <wtf/RefPtr.h> + +namespace WebKit { + +SharedMemory::Handle::Handle() + : m_handle(0) + , m_size(0) +{ +} + +SharedMemory::Handle::~Handle() +{ + if (!m_handle) + return; + + ::CloseHandle(m_handle); +} + +void SharedMemory::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encodeUInt64(m_size); + + // Hand off ownership of our HANDLE to the receiving process. It will close it for us. + // FIXME: If the receiving process crashes before it receives the memory, the memory will be + // leaked. See <http://webkit.org/b/47502>. + encoder->encodeUInt64(reinterpret_cast<uint64_t>(m_handle)); + m_handle = 0; + + // Send along our PID so that the receiving process can duplicate the HANDLE for its own use. + encoder->encodeUInt32(::GetCurrentProcessId()); +} + +bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + ASSERT_ARG(handle, !handle.m_handle); + ASSERT_ARG(handle, !handle.m_size); + + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + uint64_t sourceHandle; + if (!decoder->decodeUInt64(sourceHandle)) + return false; + + uint32_t sourcePID; + 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) + return false; + + handle.m_handle = duplicatedHandle; + handle.m_size = size; + return true; +} + +PassRefPtr<SharedMemory> SharedMemory::create(size_t size) +{ + HANDLE handle = ::CreateFileMappingW(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, 0); + if (!handle) + return 0; + + void* baseAddress = ::MapViewOfFile(handle, FILE_MAP_ALL_ACCESS, 0, 0, size); + if (!baseAddress) { + ::CloseHandle(handle); + return 0; + } + + RefPtr<SharedMemory> memory = adoptRef(new SharedMemory); + memory->m_size = size; + memory->m_data = baseAddress; + memory->m_handle = handle; + + return memory.release(); +} + +static DWORD accessRights(SharedMemory::Protection protection) +{ + switch (protection) { + case SharedMemory::ReadOnly: + return FILE_MAP_READ; + case SharedMemory::ReadWrite: + // FILE_MAP_WRITE implies read access, too. + return FILE_MAP_WRITE; + } + + ASSERT_NOT_REACHED(); + return 0; +} + +PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection protection) +{ + DWORD desiredAccess = accessRights(protection); + + void* baseAddress = ::MapViewOfFile(handle.m_handle, desiredAccess, 0, 0, handle.m_size); + if (!baseAddress) + return 0; + + RefPtr<SharedMemory> memory = adoptRef(new SharedMemory); + memory->m_size = handle.m_size; + memory->m_data = baseAddress; + + // Adopt the HANDLE. + memory->m_handle = handle.m_handle; + handle.m_handle = 0; + + return memory.release(); +} + +SharedMemory::~SharedMemory() +{ + ASSERT(m_data); + ASSERT(m_handle); + + ::UnmapViewOfFile(m_data); + ::CloseHandle(m_handle); +} + +bool SharedMemory::createHandle(Handle& handle, Protection protection) +{ + ASSERT_ARG(handle, !handle.m_handle); + ASSERT_ARG(handle, !handle.m_size); + + HANDLE processHandle = ::GetCurrentProcess(); + + HANDLE duplicatedHandle; + if (!::DuplicateHandle(processHandle, m_handle, processHandle, &duplicatedHandle, accessRights(protection), FALSE, 0)) + return false; + + handle.m_handle = duplicatedHandle; + handle.m_size = m_size; + return true; +} + +unsigned SharedMemory::systemPageSize() +{ + static unsigned pageSize = 0; + + if (!pageSize) { + SYSTEM_INFO systemInfo; + ::GetSystemInfo(&systemInfo); + pageSize = systemInfo.dwPageSize; + } + + return pageSize; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Platform/win/WorkQueueWin.cpp b/Source/WebKit2/Platform/win/WorkQueueWin.cpp new file mode 100644 index 0000000..f527432 --- /dev/null +++ b/Source/WebKit2/Platform/win/WorkQueueWin.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WorkQueue.h" + +#include <wtf/Threading.h> +#include "NotImplemented.h" + +inline WorkQueue::WorkItemWin::WorkItemWin(PassOwnPtr<WorkItem> item, WorkQueue* queue) + : m_item(item) + , m_queue(queue) +{ +} + +PassRefPtr<WorkQueue::WorkItemWin> WorkQueue::WorkItemWin::create(PassOwnPtr<WorkItem> item, WorkQueue* queue) +{ + return adoptRef(new WorkItemWin(item, queue)); +} + +WorkQueue::WorkItemWin::~WorkItemWin() +{ +} + +inline WorkQueue::HandleWorkItem::HandleWorkItem(HANDLE handle, PassOwnPtr<WorkItem> item, WorkQueue* queue) + : WorkItemWin(item, queue) + , m_handle(handle) + , m_waitHandle(0) +{ + ASSERT_ARG(handle, handle); +} + +PassRefPtr<WorkQueue::HandleWorkItem> WorkQueue::HandleWorkItem::createByAdoptingHandle(HANDLE handle, PassOwnPtr<WorkItem> item, WorkQueue* queue) +{ + return adoptRef(new HandleWorkItem(handle, item, queue)); +} + +WorkQueue::HandleWorkItem::~HandleWorkItem() +{ + ::CloseHandle(m_handle); +} + +void WorkQueue::handleCallback(void* context, BOOLEAN timerOrWaitFired) +{ + ASSERT_ARG(context, context); + ASSERT_ARG(timerOrWaitFired, !timerOrWaitFired); + + WorkItemWin* item = static_cast<WorkItemWin*>(context); + WorkQueue* queue = item->queue(); + + { + MutexLocker lock(queue->m_workItemQueueLock); + queue->m_workItemQueue.append(item); + + // If no other thread is performing work, we can do it on this thread. + if (!queue->tryRegisterAsWorkThread()) { + // Some other thread is performing work. Since we hold the queue lock, we can be sure + // that the work thread is not exiting due to an empty queue and will process the work + // item we just added to it. If we weren't holding the lock we'd have to signal + // m_performWorkEvent to make sure the work item got picked up. + return; + } + } + + queue->performWorkOnRegisteredWorkThread(); +} + +void WorkQueue::registerHandle(HANDLE handle, PassOwnPtr<WorkItem> item) +{ + RefPtr<HandleWorkItem> handleItem = HandleWorkItem::createByAdoptingHandle(handle, item, this); + + { + MutexLocker lock(m_handlesLock); + ASSERT_ARG(handle, !m_handles.contains(handle)); + m_handles.set(handle, handleItem); + } + + HANDLE waitHandle; + if (!::RegisterWaitForSingleObject(&waitHandle, handle, handleCallback, handleItem.get(), INFINITE, WT_EXECUTEDEFAULT)) { + DWORD error = ::GetLastError(); + ASSERT_NOT_REACHED(); + } + handleItem->setWaitHandle(waitHandle); +} + +void WorkQueue::unregisterAndCloseHandle(HANDLE handle) +{ + RefPtr<HandleWorkItem> item; + { + MutexLocker locker(m_handlesLock); + ASSERT_ARG(handle, m_handles.contains(handle)); + item = m_handles.take(handle); + } + + unregisterWaitAndDestroyItemSoon(item.release()); +} + +DWORD WorkQueue::workThreadCallback(void* context) +{ + ASSERT_ARG(context, context); + + WorkQueue* queue = static_cast<WorkQueue*>(context); + + if (!queue->tryRegisterAsWorkThread()) + return 0; + + queue->performWorkOnRegisteredWorkThread(); + return 0; +} + +void WorkQueue::performWorkOnRegisteredWorkThread() +{ + ASSERT(m_isWorkThreadRegistered); + + bool isValid = true; + + m_workItemQueueLock.lock(); + + while (isValid && !m_workItemQueue.isEmpty()) { + Vector<RefPtr<WorkItemWin> > workItemQueue; + m_workItemQueue.swap(workItemQueue); + + // Allow more work to be scheduled while we're not using the queue directly. + m_workItemQueueLock.unlock(); + for (size_t i = 0; i < workItemQueue.size(); ++i) { + MutexLocker locker(m_isValidMutex); + isValid = m_isValid; + if (!isValid) + break; + workItemQueue[i]->item()->execute(); + } + m_workItemQueueLock.lock(); + } + + // One invariant we maintain is that any work scheduled while a work thread is registered will + // be handled by that work thread. Unregister as the work thread while the queue lock is still + // held so that no work can be scheduled while we're still registered. + unregisterAsWorkThread(); + + m_workItemQueueLock.unlock(); +} + +void WorkQueue::platformInitialize(const char* name) +{ + m_isWorkThreadRegistered = 0; +} + +bool WorkQueue::tryRegisterAsWorkThread() +{ + LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 1, 0); + ASSERT(!result || result == 1); + return !result; +} + +void WorkQueue::unregisterAsWorkThread() +{ + LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 0, 1); + ASSERT_UNUSED(result, result == 1); +} + +void WorkQueue::platformInvalidate() +{ +#if !ASSERT_DISABLED + MutexLocker lock(m_handlesLock); + ASSERT(m_handles.isEmpty()); +#endif +} + +void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) +{ + MutexLocker locker(m_workItemQueueLock); + + m_workItemQueue.append(WorkItemWin::create(item, this)); + + // Spawn a work thread to perform the work we just added. As an optimization, we avoid + // spawning the thread if a work thread is already registered. This prevents multiple work + // threads from being spawned in most cases. (Note that when a work thread has been spawned but + // hasn't registered itself yet, m_isWorkThreadRegistered will be false and we'll end up + // spawning a second work thread here. But work thread registration process will ensure that + // only one thread actually ends up performing work.) + if (!m_isWorkThreadRegistered) + ::QueueUserWorkItem(workThreadCallback, this, WT_EXECUTEDEFAULT); +} + +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) +{ + notImplemented(); +} + +void WorkQueue::unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem> item) +{ + // We're going to make a blocking call to ::UnregisterWaitEx before closing the handle. (The + // blocking version of ::UnregisterWaitEx is much simpler than the non-blocking version.) If we + // do this on the current thread, we'll deadlock if we're currently in a callback function for + // the wait we're unregistering. So instead we do it asynchronously on some other worker thread. + + ::QueueUserWorkItem(unregisterWaitAndDestroyItemCallback, item.leakRef(), WT_EXECUTEDEFAULT); +} + +DWORD WINAPI WorkQueue::unregisterWaitAndDestroyItemCallback(void* context) +{ + ASSERT_ARG(context, context); + RefPtr<HandleWorkItem> item = adoptRef(static_cast<HandleWorkItem*>(context)); + + // Now that we know we're not in a callback function for the wait we're unregistering, we can + // make a blocking call to ::UnregisterWaitEx. + if (!::UnregisterWaitEx(item->waitHandle(), INVALID_HANDLE_VALUE)) { + DWORD error = ::GetLastError(); + ASSERT_NOT_REACHED(); + } + + return 0; +} diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp new file mode 100644 index 0000000..5eb8dd4 --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -0,0 +1,450 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginControllerProxy.h" + +#include "DataReference.h" +#include "NPObjectProxy.h" +#include "NPRemoteObjectMap.h" +#include "NPRuntimeUtilities.h" +#include "NPVariantData.h" +#include "NetscapePlugin.h" +#include "PluginProcess.h" +#include "PluginProxyMessages.h" +#include "ShareableBitmap.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcessConnection.h" +#include <WebCore/GraphicsContext.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<PluginControllerProxy> PluginControllerProxy::create(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) +{ + return adoptPtr(new PluginControllerProxy(connection, pluginInstanceID, userAgent, isPrivateBrowsingEnabled, isAcceleratedCompositingEnabled)); +} + +PluginControllerProxy::PluginControllerProxy(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) + : m_connection(connection) + , m_pluginInstanceID(pluginInstanceID) + , m_userAgent(userAgent) + , m_isPrivateBrowsingEnabled(isPrivateBrowsingEnabled) + , m_isAcceleratedCompositingEnabled(isAcceleratedCompositingEnabled) + , m_paintTimer(RunLoop::main(), this, &PluginControllerProxy::paint) + , m_waitingForDidUpdate(false) + , m_pluginCanceledManualStreamLoad(false) +#if PLATFORM(MAC) + , m_isComplexTextInputEnabled(false) +#endif +{ +} + +PluginControllerProxy::~PluginControllerProxy() +{ + ASSERT(!m_plugin); +} + +bool PluginControllerProxy::initialize(const Plugin::Parameters& parameters) +{ + ASSERT(!m_plugin); + + m_plugin = NetscapePlugin::create(PluginProcess::shared().netscapePluginModule()); + if (!m_plugin) + return false; + + if (!m_plugin->initialize(this, parameters)) { + m_plugin = 0; + return false; + } + + platformInitialize(); + + return true; +} + +void PluginControllerProxy::destroy() +{ + ASSERT(m_plugin); + + m_plugin->destroy(); + m_plugin = 0; + + platformDestroy(); +} + +void PluginControllerProxy::paint() +{ + ASSERT(!m_dirtyRect.isEmpty()); + m_paintTimer.stop(); + + if (!m_backingStore) + return; + + IntRect dirtyRect = m_dirtyRect; + m_dirtyRect = IntRect(); + + // Create a graphics context. + OwnPtr<GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext(); + graphicsContext->translate(-m_frameRect.x(), -m_frameRect.y()); + + ASSERT(m_plugin); + m_plugin->paint(graphicsContext.get(), dirtyRect); + + m_connection->connection()->send(Messages::PluginProxy::Update(dirtyRect), m_pluginInstanceID); +} + +void PluginControllerProxy::startPaintTimer() +{ + // Check if we should start the timer. + + if (m_dirtyRect.isEmpty()) + return; + + // FIXME: Check clip rect. + + if (m_paintTimer.isActive()) + return; + + if (m_waitingForDidUpdate) + return; + + // Start the timer. + m_paintTimer.startOneShot(0); + + m_waitingForDidUpdate = true; +} + +void PluginControllerProxy::invalidate(const IntRect& rect) +{ + // Convert the dirty rect to window coordinates. + IntRect dirtyRect = rect; + dirtyRect.move(m_frameRect.x(), m_frameRect.y()); + + // Make sure that the dirty rect is not greater than the plug-in itself. + dirtyRect.intersect(m_frameRect); + + m_dirtyRect.unite(dirtyRect); + + startPaintTimer(); +} + +String PluginControllerProxy::userAgent() +{ + return m_userAgent; +} + +void PluginControllerProxy::loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups) +{ + m_connection->connection()->send(Messages::PluginProxy::LoadURL(requestID, method, urlString, target, headerFields, httpBody, allowPopups), m_pluginInstanceID); +} + +void PluginControllerProxy::cancelStreamLoad(uint64_t streamID) +{ + m_connection->connection()->send(Messages::PluginProxy::CancelStreamLoad(streamID), m_pluginInstanceID); +} + +void PluginControllerProxy::cancelManualStreamLoad() +{ + m_pluginCanceledManualStreamLoad = true; + + m_connection->connection()->send(Messages::PluginProxy::CancelManualStreamLoad(), m_pluginInstanceID); +} + +NPObject* PluginControllerProxy::windowScriptNPObject() +{ + uint64_t windowScriptNPObjectID = 0; + + if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetWindowScriptNPObject(), Messages::PluginProxy::GetWindowScriptNPObject::Reply(windowScriptNPObjectID), m_pluginInstanceID)) + return 0; + + if (!windowScriptNPObjectID) + return 0; + + return m_connection->npRemoteObjectMap()->createNPObjectProxy(windowScriptNPObjectID); +} + +NPObject* PluginControllerProxy::pluginElementNPObject() +{ + uint64_t pluginElementNPObjectID = 0; + + if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetPluginElementNPObject(), Messages::PluginProxy::GetPluginElementNPObject::Reply(pluginElementNPObjectID), m_pluginInstanceID)) + return 0; + + if (!pluginElementNPObjectID) + return 0; + + return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginElementNPObjectID); +} + +bool PluginControllerProxy::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result, bool allowPopups) +{ + NPVariant npObjectAsNPVariant; + OBJECT_TO_NPVARIANT(npObject, npObjectAsNPVariant); + + // Send the NPObject over as an NPVariantData. + NPVariantData npObjectAsNPVariantData = m_connection->npRemoteObjectMap()->npVariantToNPVariantData(npObjectAsNPVariant); + + bool returnValue = false; + NPVariantData resultData; + + if (!m_connection->connection()->sendSync(Messages::PluginProxy::Evaluate(npObjectAsNPVariantData, scriptString, allowPopups), Messages::PluginProxy::Evaluate::Reply(returnValue, resultData), m_pluginInstanceID)) + return false; + + if (!returnValue) + return false; + + *result = m_connection->npRemoteObjectMap()->npVariantDataToNPVariant(resultData); + return true; +} + +void PluginControllerProxy::setStatusbarText(const String& statusbarText) +{ + m_connection->connection()->send(Messages::PluginProxy::SetStatusbarText(statusbarText), m_pluginInstanceID); +} + +bool PluginControllerProxy::isAcceleratedCompositingEnabled() +{ + return m_isAcceleratedCompositingEnabled; +} + +void PluginControllerProxy::pluginProcessCrashed() +{ + // This should never be called from here. + ASSERT_NOT_REACHED(); +} + +void PluginControllerProxy::setComplexTextInputEnabled(bool complexTextInputEnabled) +{ + if (m_isComplexTextInputEnabled == complexTextInputEnabled) + return; + + m_isComplexTextInputEnabled = complexTextInputEnabled; + + m_connection->connection()->send(Messages::PluginProxy::SetComplexTextInputEnabled(complexTextInputEnabled), m_pluginInstanceID); +} + +String PluginControllerProxy::proxiesForURL(const String& urlString) +{ + String proxyString; + + if (!m_connection->connection()->sendSync(Messages::PluginProxy::CookiesForURL(urlString), Messages::PluginProxy::CookiesForURL::Reply(proxyString), m_pluginInstanceID)) + return String(); + + return proxyString; +} + +String PluginControllerProxy::cookiesForURL(const String& urlString) +{ + String cookieString; + + if (!m_connection->connection()->sendSync(Messages::PluginProxy::CookiesForURL(urlString), Messages::PluginProxy::CookiesForURL::Reply(cookieString), m_pluginInstanceID)) + return String(); + + return cookieString; +} + +void PluginControllerProxy::setCookiesForURL(const String& urlString, const String& cookieString) +{ + m_connection->connection()->send(Messages::PluginProxy::SetCookiesForURL(urlString, cookieString), m_pluginInstanceID); +} + +bool PluginControllerProxy::isPrivateBrowsingEnabled() +{ + return m_isPrivateBrowsingEnabled; +} + +void PluginControllerProxy::frameDidFinishLoading(uint64_t requestID) +{ + m_plugin->frameDidFinishLoading(requestID); +} + +void PluginControllerProxy::frameDidFail(uint64_t requestID, bool wasCancelled) +{ + m_plugin->frameDidFail(requestID, wasCancelled); +} + +void PluginControllerProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect, const SharedMemory::Handle& backingStoreHandle) +{ + m_frameRect = frameRect; + m_clipRect = clipRect; + + ASSERT(m_plugin); + + if (!backingStoreHandle.isNull()) { + // Create a new backing store. + m_backingStore = ShareableBitmap::create(frameRect.size(), backingStoreHandle); + } + + m_plugin->geometryDidChange(frameRect, clipRect); + + platformGeometryDidChange(frameRect, clipRect); +} + +void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result) +{ + m_plugin->didEvaluateJavaScript(requestID, requestURLString, result); +} + +void PluginControllerProxy::streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers) +{ + m_plugin->streamDidReceiveResponse(streamID, KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers); +} + +void PluginControllerProxy::streamDidReceiveData(uint64_t streamID, const CoreIPC::DataReference& data) +{ + m_plugin->streamDidReceiveData(streamID, reinterpret_cast<const char*>(data.data()), data.size()); +} + +void PluginControllerProxy::streamDidFinishLoading(uint64_t streamID) +{ + m_plugin->streamDidFinishLoading(streamID); +} + +void PluginControllerProxy::streamDidFail(uint64_t streamID, bool wasCancelled) +{ + m_plugin->streamDidFail(streamID, wasCancelled); +} + +void PluginControllerProxy::manualStreamDidReceiveResponse(const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers) +{ + if (m_pluginCanceledManualStreamLoad) + return; + + m_plugin->manualStreamDidReceiveResponse(KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers); +} + +void PluginControllerProxy::manualStreamDidReceiveData(const CoreIPC::DataReference& data) +{ + if (m_pluginCanceledManualStreamLoad) + return; + + m_plugin->manualStreamDidReceiveData(reinterpret_cast<const char*>(data.data()), data.size()); +} + +void PluginControllerProxy::manualStreamDidFinishLoading() +{ + if (m_pluginCanceledManualStreamLoad) + return; + + m_plugin->manualStreamDidFinishLoading(); +} + +void PluginControllerProxy::manualStreamDidFail(bool wasCancelled) +{ + if (m_pluginCanceledManualStreamLoad) + return; + + m_plugin->manualStreamDidFail(wasCancelled); +} + +void PluginControllerProxy::handleMouseEvent(const WebMouseEvent& mouseEvent, bool& handled) +{ + handled = m_plugin->handleMouseEvent(mouseEvent); +} + +void PluginControllerProxy::handleWheelEvent(const WebWheelEvent& wheelEvent, bool& handled) +{ + handled = m_plugin->handleWheelEvent(wheelEvent); +} + +void PluginControllerProxy::handleMouseEnterEvent(const WebMouseEvent& mouseEnterEvent, bool& handled) +{ + handled = m_plugin->handleMouseEnterEvent(mouseEnterEvent); +} + +void PluginControllerProxy::handleMouseLeaveEvent(const WebMouseEvent& mouseLeaveEvent, bool& handled) +{ + handled = m_plugin->handleMouseLeaveEvent(mouseLeaveEvent); +} + +void PluginControllerProxy::handleKeyboardEvent(const WebKeyboardEvent& keyboardEvent, bool& handled) +{ + handled = m_plugin->handleKeyboardEvent(keyboardEvent); +} + +void PluginControllerProxy::paintEntirePlugin() +{ + m_dirtyRect = m_frameRect; + paint(); +} + +void PluginControllerProxy::setFocus(bool hasFocus) +{ + m_plugin->setFocus(hasFocus); +} + +void PluginControllerProxy::didUpdate() +{ + m_waitingForDidUpdate = false; + startPaintTimer(); +} + +void PluginControllerProxy::getPluginScriptableNPObject(uint64_t& pluginScriptableNPObjectID) +{ + NPObject* pluginScriptableNPObject = m_plugin->pluginScriptableNPObject(); + if (!pluginScriptableNPObject) { + pluginScriptableNPObjectID = 0; + return; + } + + pluginScriptableNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(pluginScriptableNPObject); + releaseNPObject(pluginScriptableNPObject); +} + +#if PLATFORM(MAC) +void PluginControllerProxy::windowFocusChanged(bool hasFocus) +{ + m_plugin->windowFocusChanged(hasFocus); +} + +void PluginControllerProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates) +{ + m_plugin->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates); +} + +void PluginControllerProxy::windowVisibilityChanged(bool isVisible) +{ + m_plugin->windowVisibilityChanged(isVisible); +} + +void PluginControllerProxy::sendComplexTextInput(const String& textInput) +{ + m_plugin->sendComplexTextInput(textInput); +} + +#endif + +void PluginControllerProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled) +{ + m_plugin->privateBrowsingStateChanged(isPrivateBrowsingEnabled); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h new file mode 100644 index 0000000..339c151 --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h @@ -0,0 +1,178 @@ +/* + * 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 PluginControllerProxy_h +#define PluginControllerProxy_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include "Plugin.h" +#include "PluginController.h" +#include "RunLoop.h" +#include "SharedMemory.h" +#include <wtf/Noncopyable.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> + +typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef; +#endif + +namespace CoreIPC { + class DataReference; +} + +namespace WebKit { + +class ShareableBitmap; +class WebProcessConnection; + +class PluginControllerProxy : PluginController { + WTF_MAKE_NONCOPYABLE(PluginControllerProxy); + +public: + static PassOwnPtr<PluginControllerProxy> create(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled); + ~PluginControllerProxy(); + + uint64_t pluginInstanceID() const { return m_pluginInstanceID; } + + bool initialize(const Plugin::Parameters&); + void destroy(); + + void didReceivePluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncPluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + +#if PLATFORM(MAC) + uint32_t remoteLayerClientID() const; +#endif + +private: + PluginControllerProxy(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled); + + void startPaintTimer(); + void paint(); + + // PluginController + virtual void invalidate(const WebCore::IntRect&); + virtual String userAgent(); + virtual void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups); + virtual void cancelStreamLoad(uint64_t streamID); + virtual void cancelManualStreamLoad(); + virtual NPObject* windowScriptNPObject(); + virtual NPObject* pluginElementNPObject(); + virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups); + virtual void setStatusbarText(const String&); + virtual bool isAcceleratedCompositingEnabled(); + virtual void pluginProcessCrashed(); + +#if PLATFORM(MAC) + virtual void setComplexTextInputEnabled(bool); +#endif + + virtual String proxiesForURL(const String&); + virtual String cookiesForURL(const String&); + virtual void setCookiesForURL(const String& urlString, const String& cookieString); + virtual bool isPrivateBrowsingEnabled(); + + // Message handlers. + void frameDidFinishLoading(uint64_t requestID); + void frameDidFail(uint64_t requestID, bool wasCancelled); + void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, const SharedMemory::Handle& backingStoreHandle); + void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result); + void streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers); + void streamDidReceiveData(uint64_t streamID, const CoreIPC::DataReference& data); + void streamDidFinishLoading(uint64_t streamID); + void streamDidFail(uint64_t streamID, bool wasCancelled); + void manualStreamDidReceiveResponse(const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers); + void manualStreamDidReceiveData(const CoreIPC::DataReference& data); + void manualStreamDidFinishLoading(); + void manualStreamDidFail(bool wasCancelled); + void handleMouseEvent(const WebMouseEvent&, bool& handled); + void handleWheelEvent(const WebWheelEvent&, bool& handled); + void handleMouseEnterEvent(const WebMouseEvent&, bool& handled); + void handleMouseLeaveEvent(const WebMouseEvent&, bool& handled); + void handleKeyboardEvent(const WebKeyboardEvent&, bool& handled); + void paintEntirePlugin(); + void setFocus(bool); + void didUpdate(); + void getPluginScriptableNPObject(uint64_t& pluginScriptableNPObjectID); + +#if PLATFORM(MAC) + void windowFocusChanged(bool); + void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates); + void windowVisibilityChanged(bool); + void sendComplexTextInput(const String& textInput); +#endif + + void privateBrowsingStateChanged(bool); + + void platformInitialize(); + void platformDestroy(); + void platformGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect); + + WebProcessConnection* m_connection; + uint64_t m_pluginInstanceID; + + String m_userAgent; + bool m_isPrivateBrowsingEnabled; + bool m_isAcceleratedCompositingEnabled; + + RefPtr<Plugin> m_plugin; + + // The plug-in rect and clip rect in window coordinates. + WebCore::IntRect m_frameRect; + WebCore::IntRect m_clipRect; + + // The dirty rect in plug-in coordinates. + WebCore::IntRect m_dirtyRect; + + // The paint timer, used for coalescing painting. + RunLoop::Timer<PluginControllerProxy> m_paintTimer; + + // Whether we're waiting for the plug-in proxy in the web process to draw the contents of its + // backing store into the web process backing store. + bool m_waitingForDidUpdate; + + // Whether the plug-in has canceled the manual stream load. + bool m_pluginCanceledManualStreamLoad; + +#if PLATFORM(MAC) + // Whether complex text input is enabled for this plug-in. + bool m_isComplexTextInputEnabled; + + // For CA plug-ins, this holds the information needed to export the layer hierarchy to the UI process. + RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient; +#endif + + // The backing store that this plug-in draws into. + RefPtr<ShareableBitmap> m_backingStore; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginControllerProxy_h diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in new file mode 100644 index 0000000..60fd3df --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in @@ -0,0 +1,107 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> PluginControllerProxy { + # Sent when the plug-in geometry changes. + GeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, WebKit::SharedMemory::Handle backingStoreHandle) + + # Sent when a frame has finished loading. + FrameDidFinishLoading(uint64_t requestID) + + # Sent when a frame dfailed to load. + FrameDidFail(uint64_t requestID, bool wasCancelled) + + # Sent when JavaScript that the plug-in asked to be evaluated has been evaluated. + DidEvaluateJavaScript(uint64_t requestID, WTF::String requestURLString, WTF::String result) + + # Sent when the plug-in receives a response for a stream. + StreamDidReceiveResponse(uint64_t streamID, WTF::String responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, WTF::String mimeType, WTF::String headers) + + # Sent when the plug-in receives data for a stream. + StreamDidReceiveData(uint64_t streamID, CoreIPC::DataReference data) + + # Sent when a plug-in stream has finishes loading. + StreamDidFinishLoading(uint64_t streamID) + + # Sent when a plug-in stream has failed to load. + StreamDidFail(uint64_t streamID, bool wasCancelled) + + # Sent when the plug-in receives a response for the manual stream. + ManualStreamDidReceiveResponse(WTF::String responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, WTF::String mimeType, WTF::String headers) + + # Sent when the plug-in receives data for the manual stream. + ManualStreamDidReceiveData(CoreIPC::DataReference data) + + # Sent when the plug-in manual stream has finishes loading. + ManualStreamDidFinishLoading() + + # Sent when the plug-in manual stream has failed to load. + ManualStreamDidFail(bool wasCancelled) + + # Sent when a mouse event (that isn't a mouse enter/leave event or a wheel event) should be processed. + HandleMouseEvent(WebKit::WebMouseEvent mouseEvent) -> (bool handled) + + # Sent when a mouse wheel event should be processed. + HandleWheelEvent(WebKit::WebWheelEvent wheelEvent) -> (bool handled) + + # Sent when a mouse enter event should be processed. + HandleMouseEnterEvent(WebKit::WebMouseEvent mouseEvent) -> (bool handled) + + # Sent when a mouse leave event should be processed. + HandleMouseLeaveEvent(WebKit::WebMouseEvent mouseEvent) -> (bool handled) + + # Sent when a keyboard should be processed. + HandleKeyboardEvent(WebKit::WebKeyboardEvent keyboardEvent) -> (bool handled) + + # Sent when the plug-in focus changes. + SetFocus(bool isFocused) + + # Sent when the update requested by Update has been painted. + DidUpdate() + + # Paint the entire plug-in. + PaintEntirePlugin() -> () + + # Get a reference to the plug-in's scriptable NPObject. + GetPluginScriptableNPObject() -> (uint64_t pluginScriptableNPObjectID) + + # Send the complex text input to the plug-in. + SendComplexTextInput(WTF::String textInput) + +#if PLATFORM(MAC) + # Sent when the containing NSWindow's focus changes + WindowFocusChanged(bool hasFocus) + + # Sent when the containing NSWindow or NSView frame changes + WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates) + + # Sent when the containing NSWindow's visibility changes + WindowVisibilityChanged(bool isVisible) +#endif + + # Set when private browsing is enabled or disabled + PrivateBrowsingStateChanged(bool isPrivateBrowsingEnabled) +} + +#endif diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp new file mode 100644 index 0000000..6c19c21 --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp @@ -0,0 +1,150 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcess.h" + +#include "MachPort.h" +#include "NetscapePluginModule.h" +#include "PluginProcessProxyMessages.h" +#include "PluginProcessCreationParameters.h" +#include "WebProcessConnection.h" + +namespace WebKit { + +static const double shutdownTimeout = 15.0; + +PluginProcess& PluginProcess::shared() +{ + DEFINE_STATIC_LOCAL(PluginProcess, pluginProcess, ()); + return pluginProcess; +} + +PluginProcess::PluginProcess() + : m_shutdownTimer(RunLoop::main(), this, &PluginProcess::shutdownTimerFired) +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + , m_compositingRenderServerPort(MACH_PORT_NULL) +#endif +{ +} + +PluginProcess::~PluginProcess() +{ +} + +void PluginProcess::initializeConnection(CoreIPC::Connection::Identifier serverIdentifier) +{ + ASSERT(!m_connection); + + m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, RunLoop::main()); + m_connection->open(); +} + +void PluginProcess::removeWebProcessConnection(WebProcessConnection* webProcessConnection) +{ + size_t vectorIndex = m_webProcessConnections.find(webProcessConnection); + ASSERT(vectorIndex != notFound); + + m_webProcessConnections.remove(vectorIndex); + + if (m_webProcessConnections.isEmpty()) { + // Start the shutdown timer. + m_shutdownTimer.startOneShot(shutdownTimeout); + } +} + +NetscapePluginModule* PluginProcess::netscapePluginModule() +{ + if (!m_pluginModule) { + ASSERT(!m_pluginPath.isNull()); + m_pluginModule = NetscapePluginModule::getOrCreate(m_pluginPath); + +#if PLATFORM(MAC) + if (m_pluginModule) { + if (m_pluginModule->pluginQuirks().contains(PluginQuirks::PrognameShouldBeWebKitPluginHost)) + setprogname("WebKitPluginHost"); + } +#endif + } + + return m_pluginModule.get(); +} + +void PluginProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceivePluginProcessMessage(connection, messageID, arguments); +} + +void PluginProcess::didClose(CoreIPC::Connection*) +{ + // The UI process has crashed, just go ahead and quit. + // FIXME: If the plug-in is spinning in the main loop, we'll never get this message. + RunLoop::current()->stop(); +} + +void PluginProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +{ +} + +void PluginProcess::initialize(const PluginProcessCreationParameters& parameters) +{ + ASSERT(!m_pluginModule); + + m_pluginPath = parameters.pluginPath; + +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); +#endif +} + +void PluginProcess::createWebProcessConnection() +{ + // FIXME: This is platform specific! + + // Create the listening port. + mach_port_t listeningPort; + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); + + // Create a listening connection. + RefPtr<WebProcessConnection> connection = WebProcessConnection::create(listeningPort); + m_webProcessConnections.append(connection.release()); + + CoreIPC::MachPort clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); + m_connection->send(Messages::PluginProcessProxy::DidCreateWebProcessConnection(clientPort), 0); + + // Stop the shutdown timer. + m_shutdownTimer.stop(); +} + +void PluginProcess::shutdownTimerFired() +{ + RunLoop::current()->stop(); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h new file mode 100644 index 0000000..e60d52d --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginProcess.h @@ -0,0 +1,101 @@ +/* + * 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 PluginProcess_h +#define PluginProcess_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "ChildProcess.h" +#include "RunLoop.h" +#include <wtf/Forward.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class NetscapePluginModule; +class WebProcessConnection; +struct PluginProcessCreationParameters; + +class PluginProcess : ChildProcess { +public: + static PluginProcess& shared(); + + void initializeConnection(CoreIPC::Connection::Identifier); + void removeWebProcessConnection(WebProcessConnection* webProcessConnection); + + NetscapePluginModule* netscapePluginModule(); + +#if PLATFORM(MAC) + void initializeShim(); + +#if USE(ACCELERATED_COMPOSITING) + mach_port_t compositingRenderServerPort() const { return m_compositingRenderServerPort; } +#endif +#endif + +private: + PluginProcess(); + ~PluginProcess(); + + // CoreIPC::Connection::Client + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual void didClose(CoreIPC::Connection*); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + // Message handlers. + void didReceivePluginProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void initialize(const PluginProcessCreationParameters&); + void createWebProcessConnection(); + + void shutdownTimerFired(); + + // The connection to the UI process. + RefPtr<CoreIPC::Connection> m_connection; + + // Our web process connections. + Vector<RefPtr<WebProcessConnection> > m_webProcessConnections; + + // The plug-in path. + String m_pluginPath; + + // The plug-in module. + RefPtr<NetscapePluginModule> m_pluginModule; + + // A timer used for the shutdown timeout. + RunLoop::Timer<PluginProcess> m_shutdownTimer; + +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + // The Mach port used for accelerated compositing. + mach_port_t m_compositingRenderServerPort; +#endif + +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcess_h diff --git a/Source/WebKit2/PluginProcess/PluginProcess.messages.in b/Source/WebKit2/PluginProcess/PluginProcess.messages.in new file mode 100644 index 0000000..e9b0fd3 --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginProcess.messages.in @@ -0,0 +1,35 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> PluginProcess { + # Initializes the plug-in. + Initialize(WebKit::PluginProcessCreationParameters processCreationParameters) + + # Creates a web process connection. When the connection has been created, + # The plug-in process sends back a DidCreateWebProcessConnection message with + # a connection identifier. + CreateWebProcessConnection() +} + +#endif diff --git a/Source/WebKit2/PluginProcess/PluginProcessMain.h b/Source/WebKit2/PluginProcess/PluginProcessMain.h new file mode 100644 index 0000000..3b3f38c --- /dev/null +++ b/Source/WebKit2/PluginProcess/PluginProcessMain.h @@ -0,0 +1,41 @@ +/* + * 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 PluginProcessMain_h +#define PluginProcessMain_h + +#if ENABLE(PLUGIN_PROCESS) + +namespace WebKit { + +class CommandLine; + +int PluginProcessMain(const CommandLine&); + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessMain_h diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp new file mode 100644 index 0000000..ae5d7ca --- /dev/null +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp @@ -0,0 +1,172 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "WebProcessConnection.h" + +#include "NPRemoteObjectMap.h" +#include "PluginControllerProxy.h" +#include "PluginProcess.h" +#include "RunLoop.h" + +namespace WebKit { + +PassRefPtr<WebProcessConnection> WebProcessConnection::create(CoreIPC::Connection::Identifier connectionIdentifier) +{ + return adoptRef(new WebProcessConnection(connectionIdentifier)); +} + +WebProcessConnection::~WebProcessConnection() +{ + ASSERT(m_pluginControllers.isEmpty()); + ASSERT(!m_npRemoteObjectMap); + ASSERT(!m_connection); +} + +WebProcessConnection::WebProcessConnection(CoreIPC::Connection::Identifier connectionIdentifier) +{ + m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); + m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get()); + + m_connection->open(); +} + +void WebProcessConnection::addPluginControllerProxy(PassOwnPtr<PluginControllerProxy> pluginController) +{ + uint64_t pluginInstanceID = pluginController->pluginInstanceID(); + + ASSERT(!m_pluginControllers.contains(pluginInstanceID)); + m_pluginControllers.set(pluginInstanceID, pluginController.leakPtr()); +} + +void WebProcessConnection::destroyPluginControllerProxy(PluginControllerProxy* pluginController) +{ + pluginController->destroy(); + + // This will delete the plug-in controller proxy object. + removePluginControllerProxy(pluginController); +} + +void WebProcessConnection::removePluginControllerProxy(PluginControllerProxy* pluginController) +{ + { + ASSERT(m_pluginControllers.contains(pluginController->pluginInstanceID())); + + OwnPtr<PluginControllerProxy> pluginControllerOwnPtr = adoptPtr(m_pluginControllers.take(pluginController->pluginInstanceID())); + ASSERT(pluginControllerOwnPtr == pluginController); + } + + if (!m_pluginControllers.isEmpty()) + return; + + // Invalidate our remote object map. + m_npRemoteObjectMap->invalidate(); + m_npRemoteObjectMap = nullptr; + + // The last plug-in went away, close this connection. + m_connection->invalidate(); + m_connection = nullptr; + + // This will cause us to be deleted. + PluginProcess::shared().removeWebProcessConnection(this); +} + +void WebProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (!arguments->destinationID()) { + ASSERT_NOT_REACHED(); + return; + } + + if (PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(arguments->destinationID())) + pluginControllerProxy->didReceivePluginControllerProxyMessage(connection, messageID, arguments); +} + +CoreIPC::SyncReplyMode WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + uint64_t destinationID = arguments->destinationID(); + + if (!destinationID) + return didReceiveSyncWebProcessConnectionMessage(connection, messageID, arguments, reply); + + if (messageID.is<CoreIPC::MessageClassNPObjectMessageReceiver>()) + return m_npRemoteObjectMap->didReceiveSyncMessage(connection, messageID, arguments, reply); + + if (PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(destinationID)) + return pluginControllerProxy->didReceiveSyncPluginControllerProxyMessage(connection, messageID, arguments, reply); + + return CoreIPC::AutomaticReply; +} + +void WebProcessConnection::didClose(CoreIPC::Connection*) +{ + // The web process crashed. Destroy all the plug-in controllers. Destroying the last plug-in controller + // will cause the web process connection itself to be destroyed. + Vector<PluginControllerProxy*> pluginControllers; + copyValuesToVector(m_pluginControllers, pluginControllers); + + for (size_t i = 0; i < pluginControllers.size(); ++i) + destroyPluginControllerProxy(pluginControllers[i]); +} + +void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID) +{ + PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(pluginInstanceID); + ASSERT(pluginControllerProxy); + + destroyPluginControllerProxy(pluginControllerProxy); +} + +void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +{ + // FIXME: Implement. +} + +void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters& parameters, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool& result, uint32_t& remoteLayerClientID) +{ + OwnPtr<PluginControllerProxy> pluginControllerProxy = PluginControllerProxy::create(this, pluginInstanceID, userAgent, isPrivateBrowsingEnabled, isAcceleratedCompositingEnabled); + + PluginControllerProxy* pluginControllerProxyPtr = pluginControllerProxy.get(); + + // Make sure to add the proxy to the map before initializing it, since the plug-in might call out to the web process from + // its NPP_New function. This will hand over ownership of the proxy to the web process connection. + addPluginControllerProxy(pluginControllerProxy.release()); + + // Now try to initialize the plug-in. + result = pluginControllerProxyPtr->initialize(parameters); + + if (result) { + remoteLayerClientID = pluginControllerProxyPtr->remoteLayerClientID(); + return; + } + + // We failed to initialize, remove the plug-in controller. This could cause us to be deleted. + removePluginControllerProxy(pluginControllerProxyPtr); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.h b/Source/WebKit2/PluginProcess/WebProcessConnection.h new file mode 100644 index 0000000..d965e49 --- /dev/null +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.h @@ -0,0 +1,81 @@ +/* + * 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 WebProcessConnection_h +#define WebProcessConnection_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include "Plugin.h" +#include <wtf/RefCounted.h> + +namespace WebKit { + +class NPRemoteObjectMap; +class PluginControllerProxy; + +// A connection from a plug-in process to a web process. + +class WebProcessConnection : public RefCounted<WebProcessConnection>, CoreIPC::Connection::Client { +public: + static PassRefPtr<WebProcessConnection> create(CoreIPC::Connection::Identifier); + virtual ~WebProcessConnection(); + + CoreIPC::Connection* connection() const { return m_connection.get(); } + + NPRemoteObjectMap* npRemoteObjectMap() const { return m_npRemoteObjectMap.get(); } + +private: + WebProcessConnection(CoreIPC::Connection::Identifier); + + void addPluginControllerProxy(PassOwnPtr<PluginControllerProxy>); + void removePluginControllerProxy(PluginControllerProxy*); + + void destroyPluginControllerProxy(PluginControllerProxy*); + + // CoreIPC::Connection::Client + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + virtual void didClose(CoreIPC::Connection*); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + // Message handlers. + CoreIPC::SyncReplyMode didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, const String& userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled, bool& result, uint32_t& remoteLayerClientID); + void destroyPlugin(uint64_t pluginInstanceID); + + RefPtr<CoreIPC::Connection> m_connection; + + HashMap<uint64_t, PluginControllerProxy*> m_pluginControllers; + RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + + +#endif // WebProcessConnection_h diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in b/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in new file mode 100644 index 0000000..1240074 --- /dev/null +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in @@ -0,0 +1,33 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> WebProcessConnection { + # Creates a plug-in instance with the given instance ID. + CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters, WTF::String userAgent, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) -> (bool result, uint32_t remoteLayerClientID) + + # Destroys the plug-in instance with the given instance ID. + DestroyPlugin(uint64_t pluginInstanceID) -> () +} + +#endif diff --git a/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm b/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm new file mode 100644 index 0000000..40d4f6d --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginControllerProxy.h" + +#include <QuartzCore/QuartzCore.h> +#include "PluginProcess.h" +#include "WebKitSystemInterface.h" + +using namespace WebCore; + +namespace WebKit { + +void PluginControllerProxy::platformInitialize() +{ + CALayer * platformLayer = m_plugin->pluginLayer(); + if (!platformLayer) + return; + + ASSERT(!m_remoteLayerClient); + + m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(PluginProcess::shared().compositingRenderServerPort()); + ASSERT(m_remoteLayerClient); + + WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), platformLayer); +} + +void PluginControllerProxy::platformDestroy() +{ + if (!m_remoteLayerClient) + return; + + WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get()); + m_remoteLayerClient = nullptr; +} + +uint32_t PluginControllerProxy::remoteLayerClientID() const +{ + if (!m_remoteLayerClient) + return 0; + + return WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get()); +} + +void PluginControllerProxy::platformGeometryDidChange(const IntRect& frameRect, const IntRect&) +{ + CALayer * pluginLayer = m_plugin->pluginLayer(); + + // We don't want to animate to the new size so we disable actions for this transaction. + [CATransaction begin]; + [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions]; + [pluginLayer setFrame:CGRectMake(0, 0, frameRect.width(), frameRect.height())]; + [CATransaction commit]; +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm new file mode 100644 index 0000000..ccf444c --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcess.h" + +#include "NetscapePlugin.h" +#include "PluginProcessShim.h" +#include <dlfcn.h> + +namespace WebKit { + +static bool isUserbreakSet = false; + +static void initShouldCallRealDebugger() +{ + char* var = getenv("USERBREAK"); + + if (var) + isUserbreakSet = atoi(var); +} + +static bool shouldCallRealDebugger() +{ + static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT; + pthread_once(&shouldCallRealDebuggerOnce, initShouldCallRealDebugger); + + return isUserbreakSet; +} + +static bool isWindowActive(WindowRef windowRef, bool& result) +{ +#ifndef NP_NO_CARBON + if (NetscapePlugin* plugin = NetscapePlugin::netscapePluginFromWindow(windowRef)) { + result = plugin->isWindowActive(); + return true; + } +#endif + return false; +} + +static UInt32 getCurrentEventButtonState() +{ +#ifndef NP_NO_CARBON + return NetscapePlugin::buttonState(); +#else + ASSERT_NOT_REACHED(); + return 0; +#endif +} + +void PluginProcess::initializeShim() +{ + const PluginProcessShimCallbacks callbacks = { + shouldCallRealDebugger, + isWindowActive, + getCurrentEventButtonState + }; + + PluginProcessShimInitializeFunc initFunc = reinterpret_cast<PluginProcessShimInitializeFunc>(dlsym(RTLD_DEFAULT, "WebKitPluginProcessShimInitialize")); + initFunc(callbacks); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm new file mode 100644 index 0000000..36cc2a1 --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm @@ -0,0 +1,98 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessMain.h" + +#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> + +// 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); + +#define SHOW_CRASH_REPORTER 1 + +namespace WebKit { + +// FIXME: There is much code here that is duplicated in WebProcessMainMac.mm, we should add a shared base class where +// we can put everything. + +int PluginProcessMain(const CommandLine& commandLine) +{ + // Unset DYLD_INSERT_LIBRARIES. We don't want our plug-in process shim to be loaded + // by any child processes that the plug-in may launch. + unsetenv("DYLD_INSERT_LIBRARIES"); + + String serviceName = commandLine["servicename"]; + if (serviceName.isEmpty()) + return EXIT_FAILURE; + + // Get the server port. + mach_port_t serverPort; + kern_return_t kr = bootstrap_look_up2(bootstrap_port, serviceName.utf8().data(), &serverPort, 0, 0); + if (kr) { + printf("bootstrap_look_up2 result: %x", kr); + return EXIT_FAILURE; + } + +#if !SHOW_CRASH_REPORTER + // Installs signal handlers that exit on a crash so that CrashReporter does not show up. + signal(SIGILL, _exit); + signal(SIGFPE, _exit); + signal(SIGBUS, _exit); + signal(SIGSEGV, _exit); +#endif + + // FIXME: It would be better to proxy set cursor calls over to the UI process instead of + // allowing plug-ins to change the mouse cursor at any time. + WKEnableSettingCursorWhenInBackground(); + + JSC::initializeThreading(); + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + + // Initialize the shim. + PluginProcess::shared().initializeShim(); + + // Initialize the plug-in process connection. + PluginProcess::shared().initializeConnection(serverPort); + + [NSApplication sharedApplication]; + + RunLoop::run(); + + return 0; +} + +} + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessShim.cpp b/Source/WebKit2/PluginProcess/mac/PluginProcessShim.cpp new file mode 100644 index 0000000..346ead9 --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessShim.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginProcessShim.h" + +#include <Carbon/Carbon.h> +#include <stdio.h> + +#define DYLD_INTERPOSE(_replacement,_replacee) \ + __attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \ + __attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee }; + +namespace WebKit { + +extern "C" void WebKitPluginProcessShimInitialize(const PluginProcessShimCallbacks& callbacks); + +PluginProcessShimCallbacks pluginProcessShimCallbacks; + +__attribute__((visibility("default"))) +void WebKitPluginProcessShimInitialize(const PluginProcessShimCallbacks& callbacks) +{ + pluginProcessShimCallbacks = callbacks; +} + +#ifndef __LP64__ +static void shimDebugger(void) +{ + if (!pluginProcessShimCallbacks.shouldCallRealDebugger()) + return; + + Debugger(); +} + +static UInt32 shimGetCurrentEventButtonState() +{ + return pluginProcessShimCallbacks.getCurrentEventButtonState(); +} + +static Boolean shimIsWindowActive(WindowRef window) +{ + bool result; + if (pluginProcessShimCallbacks.isWindowActive(window, result)) + return result; + + return IsWindowActive(window); +} + +DYLD_INTERPOSE(shimDebugger, Debugger); +DYLD_INTERPOSE(shimGetCurrentEventButtonState, GetCurrentEventButtonState); +DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive); + +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h b/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h new file mode 100644 index 0000000..0fbee23 --- /dev/null +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h @@ -0,0 +1,43 @@ +/* + * 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 PluginProcessShim_h +#define PluginProcessShim_h + +#include <Carbon/Carbon.h> + +namespace WebKit { + +struct PluginProcessShimCallbacks { + bool (*shouldCallRealDebugger)(); + bool (*isWindowActive)(WindowRef, bool& result); + UInt32 (*getCurrentEventButtonState)(); +}; + +typedef void (*PluginProcessShimInitializeFunc)(const PluginProcessShimCallbacks&); + +} + +#endif // PluginProcessShim_h diff --git a/Source/WebKit2/Scripts/generate-forwarding-headers.pl b/Source/WebKit2/Scripts/generate-forwarding-headers.pl new file mode 100755 index 0000000..6e2b2c2 --- /dev/null +++ b/Source/WebKit2/Scripts/generate-forwarding-headers.pl @@ -0,0 +1,103 @@ +#!/usr/bin/perl -w +# Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged +# 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. +# +# A script which searches for headers included by WebKit2 files +# and generates forwarding headers for these headers. + +use strict; +use Cwd qw(abs_path realpath); +use File::Find; +use File::Basename; +use File::Path qw(mkpath); +use File::Spec::Functions; + +my $srcRoot = realpath(File::Spec->catfile(dirname(abs_path($0)), "../..")); +my $incFromRoot = abs_path($ARGV[0]); +my @platformPrefixes = ("android", "brew", "cf", "chromium", "curl", "efl", "gtk", "haiku", "mac", "qt", "soup", "v8", "win", "wx"); +my @frameworks = ( "JavaScriptCore", "WebCore", "WebKit2"); +my @skippedPrefixes; +my @frameworkHeaders; +my $framework; +my %neededHeaders; + +shift; +my $outputDirectory = $ARGV[0]; +shift; +my $platform = $ARGV[0]; + +foreach my $prefix (@platformPrefixes) { + push(@skippedPrefixes, $prefix) unless ($prefix =~ $platform); +} + +foreach (@frameworks) { + $framework = $_; + + find(\&collectNeededHeaders, $incFromRoot); + find(\&collectFameworkHeaderPaths, File::Spec->catfile($srcRoot, $framework)); + createForwardingHeadersForFramework(); +} + +sub collectNeededHeaders { + my $filePath = $File::Find::name; + my $file = $_; + if ($filePath =~ '\.h$|\.cpp$') { + open(FILE, "<$file") or die "Could not open $filePath.\n"; + while (<FILE>) { + if (m/^#.*<$framework\/(.*\.h)/) { + $neededHeaders{$1} = 1; + } + } + close(FILE); + } +} + +sub collectFameworkHeaderPaths { + my $filePath = $File::Find::name; + 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)); + } +} + +sub createForwardingHeadersForFramework { + my $targetDirectory = File::Spec->catfile($outputDirectory, $framework); + mkpath($targetDirectory); + foreach my $header (@frameworkHeaders) { + my $forwardingHeaderPath = File::Spec->catfile($targetDirectory, basename($header)); + my $expectedIncludeStatement = "#include \"$header\""; + my $foundIncludeStatement = 0; + $foundIncludeStatement = <EXISTING_HEADER> if open(EXISTING_HEADER, "<$forwardingHeaderPath"); + chomp($foundIncludeStatement); + if (! $foundIncludeStatement || $foundIncludeStatement ne $expectedIncludeStatement) { + print "[Creating forwarding header for $framework/$header]\n"; + open(FORWARDING_HEADER, ">$forwardingHeaderPath") or die "Could not open $forwardingHeaderPath."; + print FORWARDING_HEADER "$expectedIncludeStatement\n"; + close(FORWARDING_HEADER); + } + close(EXISTING_HEADER); + } +} + diff --git a/Source/WebKit2/Scripts/generate-message-receiver.py b/Source/WebKit2/Scripts/generate-message-receiver.py new file mode 100644 index 0000000..7a6f1c9 --- /dev/null +++ b/Source/WebKit2/Scripts/generate-message-receiver.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# +# 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. + +from __future__ import with_statement +import sys + +import webkit2.messages + + +def main(argv=None): + if not argv: + argv = sys.argv + input_path = argv[1] + with open(input_path) as input_file: + print webkit2.messages.generate_message_handler(input_file), + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/Source/WebKit2/Scripts/generate-messages-header.py b/Source/WebKit2/Scripts/generate-messages-header.py new file mode 100644 index 0000000..fd888b3 --- /dev/null +++ b/Source/WebKit2/Scripts/generate-messages-header.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# +# 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. + +from __future__ import with_statement +import sys + +import webkit2.messages + + +def main(argv=None): + if not argv: + argv = sys.argv + input_path = argv[1] + with open(input_path) as input_file: + print webkit2.messages.generate_messages_header(input_file), + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/Source/WebKit2/Scripts/webkit2/__init__.py b/Source/WebKit2/Scripts/webkit2/__init__.py new file mode 100644 index 0000000..27e3fc3 --- /dev/null +++ b/Source/WebKit2/Scripts/webkit2/__init__.py @@ -0,0 +1,23 @@ +# 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. + +# Required for Python to search this directory for module files diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py new file mode 100644 index 0000000..8fc0eaa --- /dev/null +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -0,0 +1,519 @@ +# Copyright (C) 2010 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import collections +import itertools +import re + + +_license_header = """/* + * 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. + */ +""" + +class MessageReceiver(object): + def __init__(self, name, messages, condition): + self.name = name + self.messages = messages + self.condition = condition + + def iterparameters(self): + return itertools.chain((parameter for message in self.messages for parameter in message.parameters), + (reply_parameter for message in self.messages if message.reply_parameters for reply_parameter in message.reply_parameters)) + + @classmethod + def parse(cls, file): + destination = None + messages = [] + condition = None + master_condition = None + for line in file: + match = re.search(r'messages -> ([A-Za-z_0-9]+) {', line) + if match: + if condition: + master_condition = condition + condition = None + destination = match.group(1) + continue + if line.startswith('#'): + if line.startswith('#if '): + condition = line.rstrip()[4:] + elif line.startswith('#endif'): + condition = None + continue + match = re.search(r'([A-Za-z_0-9]+)\((.*?)\)(?:(?:\s+->\s+)\((.*?)\)(?:\s+(delayed))?)?', line) + if match: + name, parameters_string, reply_parameters_string, delayed_string = match.groups() + if parameters_string: + parameters = parse_parameter_string(parameters_string) + else: + parameters = [] + + delayed = delayed_string == 'delayed' + + if reply_parameters_string: + reply_parameters = parse_parameter_string(reply_parameters_string) + elif reply_parameters_string == '': + reply_parameters = [] + else: + reply_parameters = None + + messages.append(Message(name, parameters, reply_parameters, delayed, condition)) + return MessageReceiver(destination, messages, master_condition) + + +class Message(object): + def __init__(self, name, parameters, reply_parameters, delayed, condition): + self.name = name + self.parameters = parameters + self.reply_parameters = reply_parameters + if self.reply_parameters is not None: + self.delayed = delayed + self.condition = condition + if len(self.parameters) != 0: + self.is_variadic = parameter_type_is_variadic(self.parameters[-1].type) + else: + self.is_variadic = False + + def id(self): + return '%sID' % self.name + + +class Parameter(object): + def __init__(self, type, name): + self.type = type + self.name = name + + +def parse_parameter_string(parameter_string): + return [Parameter(*type_and_name.rsplit(' ', 1)) for type_and_name in parameter_string.split(', ')] + + +def messages_header_filename(receiver): + return '%sMessages.h' % receiver.name + + +def surround_in_condition(string, condition): + if not condition: + return string + return '#if %s\n%s#endif\n' % (condition, string) + + +def messages_to_kind_enum(messages): + result = [] + result.append('enum Kind {\n') + result += [surround_in_condition(' %s,\n' % message.id(), message.condition) for message in messages] + result.append('};\n') + return ''.join(result) + + +def parameter_type_is_variadic(type): + variadic_types = frozenset([ + 'WebKit::InjectedBundleUserMessageEncoder', + 'WebKit::WebContextUserMessageEncoder', + ]) + + return type in variadic_types + +def function_parameter_type(type): + # Don't use references for built-in types. + builtin_types = frozenset([ + 'bool', + 'float', + 'double', + 'uint8_t', + 'uint16_t', + 'uint32_t', + 'uint64_t', + 'int8_t', + 'int16_t', + 'int32_t', + 'int64_t', + ]) + + if type in builtin_types: + return type + + return 'const %s&' % type + + +def reply_parameter_type(type): + return '%s&' % type + + +def arguments_type(parameters, parameter_type_function): + arguments_type = 'CoreIPC::Arguments%d' % len(parameters) + if len(parameters): + arguments_type = '%s<%s>' % (arguments_type, ', '.join(parameter_type_function(parameter.type) for parameter in parameters)) + return arguments_type + + +def base_class(message): + return arguments_type(message.parameters, function_parameter_type) + + +def reply_type(message): + return arguments_type(message.reply_parameters, reply_parameter_type) + + +def decode_type(message): + if message.is_variadic: + return arguments_type(message.parameters[:-1], reply_parameter_type) + return base_class(message) + + +def delayed_reply_type(message): + return arguments_type(message.reply_parameters, function_parameter_type) + + +def message_to_struct_declaration(message): + result = [] + function_parameters = [(function_parameter_type(x.type), x.name) for x in message.parameters] + result.append('struct %s : %s' % (message.name, base_class(message))) + result.append(' {\n') + result.append(' static const Kind messageID = %s;\n' % message.id()) + if message.reply_parameters != None: + if message.delayed: + send_parameters = [(function_parameter_type(x.type), x.name) for x in message.reply_parameters] + result.append(' struct DelayedReply {\n') + result.append(' DelayedReply(PassRefPtr<CoreIPC::Connection> connection, PassOwnPtr<CoreIPC::ArgumentDecoder> arguments)\n') + result.append(' : m_connection(connection)\n') + result.append(' , m_arguments(arguments)\n') + result.append(' {\n') + result.append(' }\n') + result.append('\n') + result.append(' bool send(%s)\n' % ', '.join([' '.join(x) for x in send_parameters])) + result.append(' {\n') + result.append(' ASSERT(m_arguments);\n') + result += [' m_arguments->encode(%s);\n' % x.name for x in message.reply_parameters] + result.append(' bool result = m_connection->sendSyncReply(m_arguments.release());\n') + result.append(' m_connection = nullptr;\n') + result.append(' return result;\n') + result.append(' }\n') + result.append('\n') + result.append(' private:\n') + result.append(' RefPtr<CoreIPC::Connection> m_connection;\n') + result.append(' OwnPtr<CoreIPC::ArgumentDecoder> m_arguments;\n') + result.append(' };\n\n') + else: + result.append(' typedef %s Reply;\n' % reply_type(message)) + + result.append(' typedef %s DecodeType;\n' % decode_type(message)) + if len(function_parameters): + result.append(' %s%s(%s)' % (len(function_parameters) == 1 and 'explicit ' or '', message.name, ', '.join([' '.join(x) for x in function_parameters]))) + result.append('\n : %s(%s)\n' % (base_class(message), ', '.join([x[1] for x in function_parameters]))) + result.append(' {\n') + result.append(' }\n') + result.append('};\n') + return surround_in_condition(''.join(result), message.condition) + + +def struct_or_class(namespace, type): + structs = frozenset([ + 'WebCore::CompositionUnderline', + 'WebCore::KeypressCommand', + 'WebCore::PluginInfo', + 'WebCore::PrintInfo', + 'WebCore::ViewportArguments', + 'WebCore::WindowFeatures', + 'WebKit::DrawingAreaInfo', + 'WebKit::PlatformPopupMenuData', + 'WebKit::PluginProcessCreationParameters', + 'WebKit::WebNavigationDataStore', + 'WebKit::WebOpenPanelParameters::Data', + 'WebKit::WebPageCreationParameters', + 'WebKit::WebPreferencesStore', + 'WebKit::WebProcessCreationParameters', + ]) + + qualified_name = '%s::%s' % (namespace, type) + if qualified_name in structs: + return 'struct %s' % type + + return 'class %s' % type + +def forward_declarations_for_namespace(namespace, types): + result = [] + result.append('namespace %s {\n' % namespace) + result += [' %s;\n' % struct_or_class(namespace, x) for x in types] + result.append('}\n') + return ''.join(result) + + +def forward_declarations_and_headers(receiver): + types_by_namespace = collections.defaultdict(set) + + headers = set([ + '"Arguments.h"', + '"MessageID.h"', + ]) + + for parameter in receiver.iterparameters(): + type = parameter.type + + if type.find('<') != -1: + # Don't forward declare class templates. + headers.update(headers_for_type(type)) + continue + + split = type.split('::') + + if len(split) == 2: + namespace = split[0] + inner_type = split[1] + types_by_namespace[namespace].add(inner_type) + elif len(split) > 2: + # We probably have a nested struct, which means we can't forward declare it. + # Include its header instead. + headers.update(headers_for_type(type)) + + forward_declarations = '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.iteritems())]) + headers = ['#include %s\n' % header for header in sorted(headers)] + + return (forward_declarations, headers) + +def generate_messages_header(file): + receiver = MessageReceiver.parse(file) + header_guard = messages_header_filename(receiver).replace('.', '_') + + result = [] + + result.append(_license_header) + result.append('\n') + + result.append('#ifndef %s\n' % header_guard) + result.append('#define %s\n\n' % header_guard) + + if receiver.condition: + result.append('#if %s\n\n' % receiver.condition) + + forward_declarations, headers = forward_declarations_and_headers(receiver) + + result += headers + result.append('\n') + + result.append(forward_declarations) + result.append('\n') + + result.append('namespace Messages {\n\nnamespace %s {\n\n' % receiver.name) + result.append(messages_to_kind_enum(receiver.messages)) + result.append('\n') + result.append('\n'.join([message_to_struct_declaration(x) for x in receiver.messages])) + result.append('\n} // namespace %s\n\n} // namespace Messages\n' % receiver.name) + + result.append('\nnamespace CoreIPC {\n\n') + result.append('template<> struct MessageKindTraits<Messages::%s::Kind> {\n' % receiver.name) + result.append(' static const MessageClass messageClass = MessageClass%s;\n' % receiver.name) + result.append('};\n') + result.append('\n} // namespace CoreIPC\n') + + if receiver.condition: + result.append('\n#endif // %s\n' % receiver.condition) + + result.append('\n#endif // %s\n' % header_guard) + + return ''.join(result) + + +def handler_function(receiver, message): + return '%s::%s' % (receiver.name, message.name[0].lower() + message.name[1:]) + + +def async_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::%s<Messages::%s::%s>(arguments, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message))) + result.append(' return;\n') + return surround_in_condition(''.join(result), message.condition) + + +def sync_case_statement(receiver, message): + 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))) + # FIXME: Handle delayed replies + result.append(' return CoreIPC::AutomaticReply;\n') + return surround_in_condition(''.join(result), message.condition) + + +def argument_coder_headers_for_type(type): + # Check for Vector. + match = re.search(r'Vector<(.+)>', type) + if match: + element_type = match.groups()[0].strip() + return ['"ArgumentCoders.h"'] + argument_coder_headers_for_type(element_type) + + special_cases = { + 'WTF::String': '"ArgumentCoders.h"', + 'WebKit::InjectedBundleUserMessageEncoder': '"InjectedBundleUserMessageCoders.h"', + 'WebKit::WebContextUserMessageEncoder': '"WebContextUserMessageCoders.h"', + } + + if type in special_cases: + return [special_cases[type]] + + split = type.split('::') + if len(split) < 2: + return [] + if split[0] == 'WebCore': + return ['"WebCoreArgumentCoders.h"'] + + return [] + + +def headers_for_type(type): + # Check for Vector. + match = re.search(r'Vector<(.+)>', type) + if match: + element_type = match.groups()[0].strip() + return ['<wtf/Vector.h>'] + headers_for_type(element_type) + + special_cases = { + 'WTF::String': '<wtf/text/WTFString.h>', + 'WebCore::CompositionUnderline': '<WebCore/Editor.h>', + 'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>', + 'WebCore::PluginInfo': '<WebCore/PluginData.h>', + 'WebCore::TextCheckingResult': '<WebCore/EditorClient.h>', + 'WebKit::WebKeyboardEvent': '"WebEvent.h"', + 'WebKit::WebMouseEvent': '"WebEvent.h"', + 'WebKit::WebTouchEvent': '"WebEvent.h"', + 'WebKit::WebWheelEvent': '"WebEvent.h"', + } + if type in special_cases: + return [special_cases[type]] + + # We assume that we must include a header for a type iff it has a scope + # resolution operator (::). + split = type.split('::') + if len(split) < 2: + return [] + if split[0] == 'WebKit' or split[0] == 'CoreIPC': + return ['"%s.h"' % split[1]] + return ['<%s/%s.h>' % tuple(split)] + + +def generate_message_handler(file): + receiver = MessageReceiver.parse(file) + headers = set([ + '"%s"' % messages_header_filename(receiver), + '"HandleMessage.h"', + '"ArgumentDecoder.h"', + ]) + + for parameter in receiver.iterparameters(): + type = parameter.type + argument_encoder_headers = argument_coder_headers_for_type(parameter.type) + if argument_encoder_headers: + headers.update(argument_encoder_headers) + continue + + type_headers = headers_for_type(type) + headers.update(type_headers) + + for message in receiver.messages: + if message.reply_parameters is not None: + for reply_parameter in message.reply_parameters: + type = reply_parameter.type + argument_encoder_headers = argument_coder_headers_for_type(type) + if argument_encoder_headers: + headers.update(argument_encoder_headers) + continue + + type_headers = headers_for_type(type) + headers.update(type_headers) + + result = [] + + result.append(_license_header) + result.append('\n') + + if receiver.condition: + result.append('#if %s\n\n' % receiver.condition) + + result.append('#include "%s.h"\n\n' % receiver.name) + result += ['#include %s\n' % header for header in sorted(headers)] + result.append('\n') + + result.append('namespace WebKit {\n\n') + + async_messages = [] + sync_messages = [] + for message in receiver.messages: + if message.reply_parameters is not None: + sync_messages.append(message) + else: + async_messages.append(message) + + if async_messages: + result.append('void %s::didReceive%sMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)\n' % (receiver.name, receiver.name)) + result.append('{\n') + result.append(' switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name) + result += [async_case_statement(receiver, message) for message in async_messages] + result.append(' default:\n') + result.append(' break;\n') + result.append(' }\n\n') + result.append(' ASSERT_NOT_REACHED();\n') + result.append('}\n') + + if sync_messages: + result.append('\n') + result.append('CoreIPC::SyncReplyMode %s::didReceiveSync%sMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)\n' % (receiver.name, receiver.name)) + result.append('{\n') + result.append(' switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name) + result += [sync_case_statement(receiver, message) for message in sync_messages] + result.append(' default:\n') + result.append(' break;\n') + result.append(' }\n\n') + result.append(' ASSERT_NOT_REACHED();\n') + result.append(' return CoreIPC::AutomaticReply;\n') + result.append('}\n') + + result.append('\n} // namespace WebKit\n') + + if receiver.condition: + result.append('\n#endif // %s\n' % receiver.condition) + + return ''.join(result) diff --git a/Source/WebKit2/Scripts/webkit2/messages_unittest.py b/Source/WebKit2/Scripts/webkit2/messages_unittest.py new file mode 100644 index 0000000..25123c0 --- /dev/null +++ b/Source/WebKit2/Scripts/webkit2/messages_unittest.py @@ -0,0 +1,592 @@ +# Copyright (C) 2010 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import unittest +from StringIO import StringIO + +import messages + +_messages_file_contents = """# 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. + +#if ENABLE(WEBKIT2) + +messages -> WebPage { + LoadURL(WTF::String url) +#if ENABLE(TOUCH_EVENTS) + TouchEvent(WebKit::WebTouchEvent event) +#endif + DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) + Close() + + PreferencesDidChange(WebKit::WebPreferencesStore store) + SendDoubleAndFloat(double d, float f) + SendInts(Vector<uint64_t> ints, Vector<Vector<uint64_t> > intVectors) + + CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result) + RunJavaScriptAlert(uint64_t frameID, WTF::String message) -> () + GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins) + GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Connection::Handle connectionHandle) delayed + + DidCreateWebProcessConnection(CoreIPC::MachPort connectionIdentifier) + +#if PLATFORM(MAC) + # Keyboard support + InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName) +#endif +} + +#endif +""" + +_expected_results = { + 'name': 'WebPage', + 'condition': 'ENABLE(WEBKIT2)', + 'messages': ( + { + 'name': 'LoadURL', + 'parameters': ( + ('WTF::String', 'url'), + ), + 'condition': None, + }, + { + 'name': 'TouchEvent', + 'parameters': ( + ('WebKit::WebTouchEvent', 'event'), + ), + 'condition': 'ENABLE(TOUCH_EVENTS)', + }, + { + 'name': 'DidReceivePolicyDecision', + 'parameters': ( + ('uint64_t', 'frameID'), + ('uint64_t', 'listenerID'), + ('uint32_t', 'policyAction'), + ), + 'condition': None, + }, + { + 'name': 'Close', + 'parameters': (), + 'condition': None, + }, + { + 'name': 'PreferencesDidChange', + 'parameters': ( + ('WebKit::WebPreferencesStore', 'store'), + ), + 'condition': None, + }, + { + 'name': 'SendDoubleAndFloat', + 'parameters': ( + ('double', 'd'), + ('float', 'f'), + ), + 'condition': None, + }, + { + 'name': 'SendInts', + 'parameters': ( + ('Vector<uint64_t>', 'ints'), + ('Vector<Vector<uint64_t> >', 'intVectors') + ), + 'condition': None, + }, + { + 'name': 'CreatePlugin', + 'parameters': ( + ('uint64_t', 'pluginInstanceID'), + ('WebKit::Plugin::Parameters', 'parameters') + ), + 'reply_parameters': ( + ('bool', 'result'), + ), + 'condition': None, + }, + { + 'name': 'RunJavaScriptAlert', + 'parameters': ( + ('uint64_t', 'frameID'), + ('WTF::String', 'message') + ), + 'reply_parameters': (), + 'condition': None, + }, + { + 'name': 'GetPlugins', + 'parameters': ( + ('bool', 'refresh'), + ), + 'reply_parameters': ( + ('Vector<WebCore::PluginInfo>', 'plugins'), + ), + 'condition': None, + }, + { + 'name': 'GetPluginProcessConnection', + 'parameters': ( + ('WTF::String', 'pluginPath'), + ), + 'reply_parameters': ( + ('CoreIPC::Connection::Handle', 'connectionHandle'), + ), + 'condition': None, + }, + { + 'name': 'DidCreateWebProcessConnection', + 'parameters': ( + ('CoreIPC::MachPort', 'connectionIdentifier'), + ), + 'condition': None, + }, + { + 'name': 'InterpretKeyEvent', + 'parameters': ( + ('uint32_t', 'type'), + ), + 'reply_parameters': ( + ('Vector<WebCore::KeypressCommand>', 'commandName'), + ), + 'condition': 'PLATFORM(MAC)', + }, + ), +} + + +class MessagesTest(unittest.TestCase): + def setUp(self): + self.receiver = messages.MessageReceiver.parse(StringIO(_messages_file_contents)) + + +class ParsingTest(MessagesTest): + def check_message(self, message, expected_message): + self.assertEquals(message.name, expected_message['name']) + self.assertEquals(len(message.parameters), len(expected_message['parameters'])) + for index, parameter in enumerate(message.parameters): + self.assertEquals(parameter.type, expected_message['parameters'][index][0]) + self.assertEquals(parameter.name, expected_message['parameters'][index][1]) + if message.reply_parameters != None: + for index, parameter in enumerate(message.reply_parameters): + self.assertEquals(parameter.type, expected_message['reply_parameters'][index][0]) + self.assertEquals(parameter.name, expected_message['reply_parameters'][index][1]) + else: + self.assertFalse('reply_parameters' in expected_message) + self.assertEquals(message.condition, expected_message['condition']) + + def test_receiver(self): + """Receiver should be parsed as expected""" + self.assertEquals(self.receiver.name, _expected_results['name']) + self.assertEquals(self.receiver.condition, _expected_results['condition']) + self.assertEquals(len(self.receiver.messages), len(_expected_results['messages'])) + for index, message in enumerate(self.receiver.messages): + self.check_message(message, _expected_results['messages'][index]) + +_expected_header = """/* + * 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 WebPageMessages_h +#define WebPageMessages_h + +#if ENABLE(WEBKIT2) + +#include "Arguments.h" +#include "Connection.h" +#include "MessageID.h" +#include "Plugin.h" +#include <WebCore/KeyboardEvent.h> +#include <WebCore/PluginData.h> +#include <wtf/Vector.h> + +namespace CoreIPC { + class MachPort; +} + +namespace WTF { + class String; +} + +namespace WebKit { + struct WebPreferencesStore; + class WebTouchEvent; +} + +namespace Messages { + +namespace WebPage { + +enum Kind { + LoadURLID, +#if ENABLE(TOUCH_EVENTS) + TouchEventID, +#endif + DidReceivePolicyDecisionID, + CloseID, + PreferencesDidChangeID, + SendDoubleAndFloatID, + SendIntsID, + CreatePluginID, + RunJavaScriptAlertID, + GetPluginsID, + GetPluginProcessConnectionID, + DidCreateWebProcessConnectionID, +#if PLATFORM(MAC) + InterpretKeyEventID, +#endif +}; + +struct LoadURL : CoreIPC::Arguments1<const WTF::String&> { + static const Kind messageID = LoadURLID; + typedef CoreIPC::Arguments1<const WTF::String&> DecodeType; + explicit LoadURL(const WTF::String& url) + : CoreIPC::Arguments1<const WTF::String&>(url) + { + } +}; + +#if ENABLE(TOUCH_EVENTS) +struct TouchEvent : CoreIPC::Arguments1<const WebKit::WebTouchEvent&> { + static const Kind messageID = TouchEventID; + typedef CoreIPC::Arguments1<const WebKit::WebTouchEvent&> DecodeType; + explicit TouchEvent(const WebKit::WebTouchEvent& event) + : CoreIPC::Arguments1<const WebKit::WebTouchEvent&>(event) + { + } +}; +#endif + +struct DidReceivePolicyDecision : CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> { + static const Kind messageID = DidReceivePolicyDecisionID; + typedef CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t> DecodeType; + DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) + : CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t>(frameID, listenerID, policyAction) + { + } +}; + +struct Close : CoreIPC::Arguments0 { + static const Kind messageID = CloseID; + typedef CoreIPC::Arguments0 DecodeType; +}; + +struct PreferencesDidChange : CoreIPC::Arguments1<const WebKit::WebPreferencesStore&> { + static const Kind messageID = PreferencesDidChangeID; + typedef CoreIPC::Arguments1<const WebKit::WebPreferencesStore&> DecodeType; + explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store) + : CoreIPC::Arguments1<const WebKit::WebPreferencesStore&>(store) + { + } +}; + +struct SendDoubleAndFloat : CoreIPC::Arguments2<double, float> { + static const Kind messageID = SendDoubleAndFloatID; + typedef CoreIPC::Arguments2<double, float> DecodeType; + SendDoubleAndFloat(double d, float f) + : CoreIPC::Arguments2<double, float>(d, f) + { + } +}; + +struct SendInts : CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&> { + static const Kind messageID = SendIntsID; + typedef CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&> DecodeType; + SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t> >& intVectors) + : CoreIPC::Arguments2<const Vector<uint64_t>&, const Vector<Vector<uint64_t> >&>(ints, intVectors) + { + } +}; + +struct CreatePlugin : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> { + static const Kind messageID = CreatePluginID; + typedef CoreIPC::Arguments1<bool&> Reply; + typedef CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> DecodeType; + CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters) + : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&>(pluginInstanceID, parameters) + { + } +}; + +struct RunJavaScriptAlert : CoreIPC::Arguments2<uint64_t, const WTF::String&> { + static const Kind messageID = RunJavaScriptAlertID; + typedef CoreIPC::Arguments0 Reply; + typedef CoreIPC::Arguments2<uint64_t, const WTF::String&> DecodeType; + RunJavaScriptAlert(uint64_t frameID, const WTF::String& message) + : CoreIPC::Arguments2<uint64_t, const WTF::String&>(frameID, message) + { + } +}; + +struct GetPlugins : CoreIPC::Arguments1<bool> { + static const Kind messageID = GetPluginsID; + typedef CoreIPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply; + typedef CoreIPC::Arguments1<bool> DecodeType; + explicit GetPlugins(bool refresh) + : CoreIPC::Arguments1<bool>(refresh) + { + } +}; + +struct GetPluginProcessConnection : CoreIPC::Arguments1<const WTF::String&> { + static const Kind messageID = GetPluginProcessConnectionID; + struct DelayedReply { + DelayedReply(PassRefPtr<CoreIPC::Connection> connection, PassOwnPtr<CoreIPC::ArgumentDecoder> arguments) + : m_connection(connection) + , m_arguments(arguments) + { + } + + bool send(const CoreIPC::Connection::Handle& connectionHandle) + { + ASSERT(m_arguments); + m_arguments->encode(connectionHandle); + bool result = m_connection->sendSyncReply(m_arguments.release()); + m_connection = nullptr; + return result; + } + + private: + RefPtr<CoreIPC::Connection> m_connection; + OwnPtr<CoreIPC::ArgumentDecoder> m_arguments; + }; + + typedef CoreIPC::Arguments1<const WTF::String&> DecodeType; + explicit GetPluginProcessConnection(const WTF::String& pluginPath) + : CoreIPC::Arguments1<const WTF::String&>(pluginPath) + { + } +}; + +struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPort&> { + static const Kind messageID = DidCreateWebProcessConnectionID; + typedef CoreIPC::Arguments1<const CoreIPC::MachPort&> DecodeType; + explicit DidCreateWebProcessConnection(const CoreIPC::MachPort& connectionIdentifier) + : CoreIPC::Arguments1<const CoreIPC::MachPort&>(connectionIdentifier) + { + } +}; + +#if PLATFORM(MAC) +struct InterpretKeyEvent : CoreIPC::Arguments1<uint32_t> { + static const Kind messageID = InterpretKeyEventID; + typedef CoreIPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply; + typedef CoreIPC::Arguments1<uint32_t> DecodeType; + explicit InterpretKeyEvent(uint32_t type) + : CoreIPC::Arguments1<uint32_t>(type) + { + } +}; +#endif + +} // namespace WebPage + +} // namespace Messages + +namespace CoreIPC { + +template<> struct MessageKindTraits<Messages::WebPage::Kind> { + static const MessageClass messageClass = MessageClassWebPage; +}; + +} // namespace CoreIPC + +#endif // ENABLE(WEBKIT2) + +#endif // WebPageMessages_h +""" + +_expected_receiver_implementation = """/* + * 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. + */ + +#if ENABLE(WEBKIT2) + +#include "WebPage.h" + +#include "ArgumentCoders.h" +#include "ArgumentDecoder.h" +#include "Connection.h" +#include "HandleMessage.h" +#include "MachPort.h" +#include "Plugin.h" +#include "WebCoreArgumentCoders.h" +#include "WebEvent.h" +#include "WebPageMessages.h" +#include "WebPreferencesStore.h" + +namespace WebKit { + +void WebPage::didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<Messages::WebPage::Kind>()) { + case Messages::WebPage::LoadURLID: + CoreIPC::handleMessage<Messages::WebPage::LoadURL>(arguments, this, &WebPage::loadURL); + return; +#if ENABLE(TOUCH_EVENTS) + case Messages::WebPage::TouchEventID: + CoreIPC::handleMessage<Messages::WebPage::TouchEvent>(arguments, this, &WebPage::touchEvent); + return; +#endif + case Messages::WebPage::DidReceivePolicyDecisionID: + CoreIPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(arguments, this, &WebPage::didReceivePolicyDecision); + return; + case Messages::WebPage::CloseID: + CoreIPC::handleMessage<Messages::WebPage::Close>(arguments, this, &WebPage::close); + return; + case Messages::WebPage::PreferencesDidChangeID: + CoreIPC::handleMessage<Messages::WebPage::PreferencesDidChange>(arguments, this, &WebPage::preferencesDidChange); + return; + case Messages::WebPage::SendDoubleAndFloatID: + CoreIPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(arguments, this, &WebPage::sendDoubleAndFloat); + return; + case Messages::WebPage::SendIntsID: + CoreIPC::handleMessage<Messages::WebPage::SendInts>(arguments, this, &WebPage::sendInts); + return; + case Messages::WebPage::DidCreateWebProcessConnectionID: + CoreIPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(arguments, this, &WebPage::didCreateWebProcessConnection); + return; + default: + break; + } + + ASSERT_NOT_REACHED(); +} + +CoreIPC::SyncReplyMode WebPage::didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + switch (messageID.get<Messages::WebPage::Kind>()) { + case Messages::WebPage::CreatePluginID: + CoreIPC::handleMessage<Messages::WebPage::CreatePlugin>(arguments, reply, this, &WebPage::createPlugin); + return CoreIPC::AutomaticReply; + case Messages::WebPage::RunJavaScriptAlertID: + CoreIPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(arguments, reply, this, &WebPage::runJavaScriptAlert); + return CoreIPC::AutomaticReply; + case Messages::WebPage::GetPluginsID: + CoreIPC::handleMessage<Messages::WebPage::GetPlugins>(arguments, reply, this, &WebPage::getPlugins); + return CoreIPC::AutomaticReply; + case Messages::WebPage::GetPluginProcessConnectionID: + CoreIPC::handleMessage<Messages::WebPage::GetPluginProcessConnection>(arguments, reply, this, &WebPage::getPluginProcessConnection); + return CoreIPC::AutomaticReply; +#if PLATFORM(MAC) + case Messages::WebPage::InterpretKeyEventID: + CoreIPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(arguments, reply, this, &WebPage::interpretKeyEvent); + return CoreIPC::AutomaticReply; +#endif + default: + break; + } + + ASSERT_NOT_REACHED(); + return CoreIPC::AutomaticReply; +} + +} // namespace WebKit + +#endif // ENABLE(WEBKIT2) +""" + + +class GeneratedFileContentsTest(unittest.TestCase): + def assertGeneratedFileContentsEqual(self, first, second): + first_list = first.split('\n') + second_list = second.split('\n') + + for index, first_line in enumerate(first_list): + self.assertEquals(first_line, second_list[index]) + + self.assertEquals(len(first_list), len(second_list)) + + +class HeaderTest(GeneratedFileContentsTest): + def test_header(self): + file_contents = messages.generate_messages_header(StringIO(_messages_file_contents)) + self.assertGeneratedFileContentsEqual(file_contents, _expected_header) + + +class ReceiverImplementationTest(GeneratedFileContentsTest): + def test_receiver_implementation(self): + file_contents = messages.generate_message_handler(StringIO(_messages_file_contents)) + self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_implementation) + + +if __name__ == '__main__': + unittest.main() diff --git a/Source/WebKit2/Shared/API/c/WKArray.cpp b/Source/WebKit2/Shared/API/c/WKArray.cpp new file mode 100644 index 0000000..9e20b7e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKArray.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKArray.h" + +#include "ImmutableArray.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKArrayGetTypeID() +{ + return toAPI(ImmutableArray::APIType); +} + +WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues) +{ + RefPtr<ImmutableArray> array = ImmutableArray::create(reinterpret_cast<APIObject**>(const_cast<void**>(values)), numberOfValues); + return toAPI(array.release().releaseRef()); +} + +WKTypeRef WKArrayGetItemAtIndex(WKArrayRef arrayRef, size_t index) +{ + return toImpl(arrayRef)->at(index); +} + +size_t WKArrayGetSize(WKArrayRef arrayRef) +{ + return toImpl(arrayRef)->size(); +} diff --git a/Source/WebKit2/Shared/API/c/WKArray.h b/Source/WebKit2/Shared/API/c/WKArray.h new file mode 100644 index 0000000..da4560a --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKArray.h @@ -0,0 +1,48 @@ +/* + * 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 WKArray_h +#define WKArray_h + +#include <WebKit2/WKBase.h> + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKArrayGetTypeID(); + +WK_EXPORT WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues); + +WK_EXPORT WKTypeRef WKArrayGetItemAtIndex(WKArrayRef array, size_t index); +WK_EXPORT size_t WKArrayGetSize(WKArrayRef array); + +#ifdef __cplusplus +} +#endif + +#endif // WKArray_h diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h new file mode 100644 index 0000000..f906f9f --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -0,0 +1,119 @@ +/* + * 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 WKBase_h +#define WKBase_h + +#include <stdint.h> + +#if defined(WIN32) || defined(_WIN32) +#include <WebKit2/WKBaseWin.h> +#endif + +/* WebKit2 shared types */ + +typedef uint32_t WKTypeID; +typedef const void* WKTypeRef; + +typedef const struct OpaqueWKArray* WKArrayRef; +typedef struct OpaqueWKArray* WKMutableArrayRef; + +typedef const struct OpaqueWKDictionary* WKDictionaryRef; +typedef struct OpaqueWKDictionary* WKMutableDictionaryRef; + +typedef const struct OpaqueWKBoolean* WKBooleanRef; +typedef const struct OpaqueWKCertificateInfo* WKCertificateInfoRef; +typedef const struct OpaqueWKContextMenuItem* WKContextMenuItemRef; +typedef const struct OpaqueWKData* WKDataRef; +typedef const struct OpaqueWKDouble* WKDoubleRef; +typedef const struct OpaqueWKError* WKErrorRef; +typedef const struct OpaqueWKImage* WKImageRef; +typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef; +typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef; +typedef const struct OpaqueWKString* WKStringRef; +typedef const struct OpaqueWKUInt64* WKUInt64Ref; +typedef const struct OpaqueWKURL* WKURLRef; +typedef const struct OpaqueWKURLRequest* WKURLRequestRef; +typedef const struct OpaqueWKURLResponse* WKURLResponseRef; +typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef; + +/* WebKit2 main API types */ + +typedef const struct OpaqueWKAuthenticationChallenge* WKAuthenticationChallengeRef; +typedef const struct OpaqueWKAuthenticationDecisionListener* WKAuthenticationDecisionListenerRef; +typedef const struct OpaqueWKBackForwardList* WKBackForwardListRef; +typedef const struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef; +typedef const struct OpaqueWKContext* WKContextRef; +typedef const struct OpaqueWKCredential* WKCredentialRef; +typedef const struct OpaqueWKDatabaseManager* WKDatabaseManagerRef; +typedef const struct OpaqueWKDownload* WKDownloadRef; +typedef const struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef; +typedef const struct OpaqueWKFrame* WKFrameRef; +typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef; +typedef const struct OpaqueWKGeolocationManager* WKGeolocationManagerRef; +typedef const struct OpaqueWKGeolocationPermissionRequest* WKGeolocationPermissionRequestRef; +typedef const struct OpaqueWKGeolocationPosition* WKGeolocationPositionRef; +typedef const struct OpaqueWKInspector* WKInspectorRef; +typedef const struct OpaqueWKNavigationData* WKNavigationDataRef; +typedef const struct OpaqueWKOpenPanelParameters* WKOpenPanelParametersRef; +typedef const struct OpaqueWKOpenPanelResultListener* WKOpenPanelResultListenerRef; +typedef const struct OpaqueWKPage* WKPageRef; +typedef const struct OpaqueWKPageGroup* WKPageGroupRef; +typedef const struct OpaqueWKPreferences* WKPreferencesRef; +typedef const struct OpaqueWKProtectionSpace* WKProtectionSpaceRef; + +/* WebKit2 Bundle types */ + +typedef const struct OpaqueWKBundle* WKBundleRef; +typedef const struct OpaqueWKBundleBackForwardList* WKBundleBackForwardListRef; +typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListItemRef; +typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef; +typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef; +typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef; +typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef; +typedef const struct OpaqueWKBundlePage* WKBundlePageRef; +typedef const struct OpaqueWKBundlePageGroup* WKBundlePageGroupRef; +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 +#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__) +#define WK_EXPORT __attribute__((visibility("default"))) +#elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE) || defined(__CC_ARM) || defined(__ARMCC__) +#if BUILDING_WEBKIT +#define WK_EXPORT __declspec(dllexport) +#else +#define WK_EXPORT __declspec(dllimport) +#endif +#else /* !defined(WK_NO_EXPORT) */ +#define WK_EXPORT +#endif /* defined(WK_NO_EXPORT) */ + +#endif /* WKBase_h */ diff --git a/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp new file mode 100644 index 0000000..c5a3ad9 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKCertificateInfo.h" + +#include "WebCertificateInfo.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKCertificateInfoGetTypeID() +{ + return toAPI(WebCertificateInfo::APIType); +} diff --git a/Source/WebKit2/Shared/API/c/WKCertificateInfo.h b/Source/WebKit2/Shared/API/c/WKCertificateInfo.h new file mode 100644 index 0000000..d4a2ed9 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKCertificateInfo.h @@ -0,0 +1,41 @@ +/* + * 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 WKCertificateInfo_h +#define WKCertificateInfo_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKCertificateInfoGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKCertificateInfo_h */ diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp new file mode 100644 index 0000000..a4eaa53 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKContextMenuItem.h" + +#include "MutableArray.h" +#include "WebContextMenuItem.h" +#include "WebContextMenuItemData.h" +#include "WKAPICast.h" +#include "WKContextMenuItemTypes.h" + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKContextMenuItemGetTypeID() +{ + return toAPI(WebContextMenuItem::APIType); +} + +WKContextMenuItemRef WKContextMenuItemCreateAsAction(WKContextMenuItemTag tag, WKStringRef title, bool enabled) +{ + return toAPI(WebContextMenuItem::create(WebContextMenuItemData(ActionType, toImpl(tag), toImpl(title)->string(), enabled, false)).leakRef()); +} + +WKContextMenuItemRef WKContextMenuItemCreateAsCheckableAction(WKContextMenuItemTag tag, WKStringRef title, bool enabled, bool checked) +{ + return toAPI(WebContextMenuItem::create(WebContextMenuItemData(CheckableActionType, toImpl(tag), toImpl(title)->string(), enabled, checked)).leakRef()); +} + +WKContextMenuItemRef WKContextMenuItemCreateAsSubmenu(WKStringRef title, bool enabled, WKArrayRef submenuItems) +{ + return toAPI(WebContextMenuItem::create(toImpl(title)->string(), enabled, toImpl(submenuItems)).leakRef()); +} + +WKContextMenuItemRef WKContextMenuItemSeparatorItem() +{ + return toAPI(WebContextMenuItem::separatorItem()); +} + +WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef) +{ + return toAPI(toImpl(itemRef)->data()->action()); +} + +WKContextMenuItemType WKContextMenuItemGetType(WKContextMenuItemRef itemRef) +{ + return toAPI(toImpl(itemRef)->data()->type()); +} + +WKStringRef WKContextMenuItemCopyTitle(WKContextMenuItemRef itemRef) +{ + return toCopiedAPI(toImpl(itemRef)->data()->title().impl()); +} + +bool WKContextMenuItemGetEnabled(WKContextMenuItemRef itemRef) +{ + return toImpl(itemRef)->data()->enabled(); +} + +bool WKContextMenuItemGetChecked(WKContextMenuItemRef itemRef) +{ + return toImpl(itemRef)->data()->checked(); +} + +WKArrayRef WKContextMenuCopySubmenuItems(WKContextMenuItemRef itemRef) +{ + return toAPI(toImpl(itemRef)->submenuItemsAsImmutableArray().leakRef()); +} + +WKTypeRef WKContextMenuItemGetUserData(WKContextMenuItemRef itemRef) +{ + return toAPI(toImpl(itemRef)->userData()); +} + +void WKContextMenuItemSetUserData(WKContextMenuItemRef itemRef, WKTypeRef userDataRef) +{ + toImpl(itemRef)->setUserData(toImpl(userDataRef)); +} diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.h b/Source/WebKit2/Shared/API/c/WKContextMenuItem.h new file mode 100644 index 0000000..9b97840 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.h @@ -0,0 +1,57 @@ +/* + * 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 WKContextMenuItem_h +#define WKContextMenuItem_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKContextMenuItemTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKContextMenuItemGetTypeID(); + +WK_EXPORT WKContextMenuItemRef WKContextMenuItemCreateAsAction(WKContextMenuItemTag, WKStringRef title, bool enabled); +WK_EXPORT WKContextMenuItemRef WKContextMenuItemCreateAsCheckableAction(WKContextMenuItemTag, WKStringRef title, bool enabled, bool checked); +WK_EXPORT WKContextMenuItemRef WKContextMenuItemCreateAsSubmenu(WKStringRef title, bool enabled, WKArrayRef submenuItems); +WK_EXPORT WKContextMenuItemRef WKContextMenuItemSeparatorItem(); + +WK_EXPORT WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef); +WK_EXPORT WKContextMenuItemType WKContextMenuItemGetType(WKContextMenuItemRef); +WK_EXPORT WKStringRef WKContextMenuItemCopyTitle(WKContextMenuItemRef); +WK_EXPORT bool WKContextMenuItemGetEnabled(WKContextMenuItemRef); +WK_EXPORT bool WKContextMenuItemGetChecked(WKContextMenuItemRef); +WK_EXPORT WKArrayRef WKContextMenuCopySubmenuItems(WKContextMenuItemRef); + +WK_EXPORT WKTypeRef WKContextMenuItemGetUserData(WKContextMenuItemRef); +WK_EXPORT void WKContextMenuItemSetUserData(WKContextMenuItemRef, WKTypeRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextMenuItem_h */ diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h new file mode 100644 index 0000000..a3536d9 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h @@ -0,0 +1,132 @@ +/* + * 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 WKContextMenuItemTypes_h +#define WKContextMenuItemTypes_h + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKContextMenuItemTagNoAction = 0, + kWKContextMenuItemTagOpenLinkInNewWindow, + kWKContextMenuItemTagDownloadLinkToDisk, + kWKContextMenuItemTagCopyLinkToClipboard, + kWKContextMenuItemTagOpenImageInNewWindow, + kWKContextMenuItemTagDownloadImageToDisk, + kWKContextMenuItemTagCopyImageToClipboard, + kWKContextMenuItemTagOpenFrameInNewWindow, + kWKContextMenuItemTagCopy, + kWKContextMenuItemTagGoBack, + kWKContextMenuItemTagGoForward, + kWKContextMenuItemTagStop, + kWKContextMenuItemTagReload, + kWKContextMenuItemTagCut, + kWKContextMenuItemTagPaste, + kWKContextMenuItemTagSpellingGuess, + kWKContextMenuItemTagNoGuessesFound, + kWKContextMenuItemTagIgnoreSpelling, + kWKContextMenuItemTagLearnSpelling, + kWKContextMenuItemTagOther, + kWKContextMenuItemTagSearchInSpotlight, + kWKContextMenuItemTagSearchWeb, + kWKContextMenuItemTagLookUpInDictionary, + kWKContextMenuItemTagOpenWithDefaultApplication, + kWKContextMenuItemTagPDFActualSize, + kWKContextMenuItemTagPDFZoomIn, + kWKContextMenuItemTagPDFZoomOut, + kWKContextMenuItemTagPDFAutoSize, + kWKContextMenuItemTagPDFSinglePage, + kWKContextMenuItemTagPDFFacingPages, + kWKContextMenuItemTagPDFContinuous, + kWKContextMenuItemTagPDFNextPage, + kWKContextMenuItemTagPDFPreviousPage, + kWKContextMenuItemTagOpenLink, + kWKContextMenuItemTagIgnoreGrammar, + kWKContextMenuItemTagSpellingMenu, + kWKContextMenuItemTagShowSpellingPanel, + kWKContextMenuItemTagCheckSpelling, + kWKContextMenuItemTagCheckSpellingWhileTyping, + kWKContextMenuItemTagCheckGrammarWithSpelling, + kWKContextMenuItemTagFontMenu, + kWKContextMenuItemTagShowFonts, + kWKContextMenuItemTagBold, + kWKContextMenuItemTagItalic, + kWKContextMenuItemTagUnderline, + kWKContextMenuItemTagOutline, + kWKContextMenuItemTagStyles, + kWKContextMenuItemTagShowColors, + kWKContextMenuItemTagSpeechMenu, + kWKContextMenuItemTagStartSpeaking, + kWKContextMenuItemTagStopSpeaking, + kWKContextMenuItemTagWritingDirectionMenu, + kWKContextMenuItemTagDefaultDirection, + kWKContextMenuItemTagLeftToRight, + kWKContextMenuItemTagRightToLeft, + kWKContextMenuItemTagPDFSinglePageScrolling, + kWKContextMenuItemTagPDFFacingPagesScrolling, + kWKContextMenuItemTagInspectElement, + kWKContextMenuItemTagTextDirectionMenu, + kWKContextMenuItemTagTextDirectionDefault, + kWKContextMenuItemTagTextDirectionLeftToRight, + kWKContextMenuItemTagTextDirectionRightToLeft, + kWKContextMenuItemTagCorrectSpellingAutomatically, + kWKContextMenuItemTagSubstitutionsMenu, + kWKContextMenuItemTagShowSubstitutions, + kWKContextMenuItemTagSmartCopyPaste, + kWKContextMenuItemTagSmartQuotes, + kWKContextMenuItemTagSmartDashes, + kWKContextMenuItemTagSmartLinks, + kWKContextMenuItemTagTextReplacement, + kWKContextMenuItemTagTransformationsMenu, + kWKContextMenuItemTagMakeUpperCase, + kWKContextMenuItemTagMakeLowerCase, + kWKContextMenuItemTagCapitalize, + kWKContextMenuItemTagChangeBack, + kWKContextMenuItemTagOpenMediaInNewWindow, + kWKContextMenuItemTagCopyMediaLinkToClipboard, + kWKContextMenuItemTagToggleMediaControls, + kWKContextMenuItemTagToggleMediaLoop, + kWKContextMenuItemTagEnterVideoFullscreen, + kWKContextMenuItemTagMediaPlayPause, + kWKContextMenuItemTagMediaMute, + kWKContextMenuItemBaseApplicationTag = 10000 +}; +typedef uint32_t WKContextMenuItemTag; + +enum { + kWKContextMenuItemTypeAction, + kWKContextMenuItemTypeCheckableAction, + kWKContextMenuItemTypeSeparator, + kWKContextMenuItemTypeSubmenu +}; +typedef uint32_t WKContextMenuItemType; + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextMenuItemTypes_h */ diff --git a/Source/WebKit2/Shared/API/c/WKData.cpp b/Source/WebKit2/Shared/API/c/WKData.cpp new file mode 100644 index 0000000..aefe795 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKData.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKData.h" + +#include "WebData.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKDataGetTypeID() +{ + return toAPI(WebData::APIType); +} + +WKDataRef WKDataCreate(const unsigned char* bytes, size_t size) +{ + RefPtr<WebData> data = WebData::create(bytes, size); + return toAPI(data.release().releaseRef()); +} + +const unsigned char* WKDataGetBytes(WKDataRef dataRef) +{ + return toImpl(dataRef)->bytes(); +} + +size_t WKDataGetSize(WKDataRef dataRef) +{ + return toImpl(dataRef)->size(); +} diff --git a/Source/WebKit2/Shared/API/c/WKData.h b/Source/WebKit2/Shared/API/c/WKData.h new file mode 100644 index 0000000..a647ee4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKData.h @@ -0,0 +1,48 @@ +/* + * 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 WKData_h +#define WKData_h + +#include <WebKit2/WKBase.h> + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKDataGetTypeID(); + +WK_EXPORT WKDataRef WKDataCreate(const unsigned char* bytes, size_t size); + +WK_EXPORT const unsigned char* WKDataGetBytes(WKDataRef data); +WK_EXPORT size_t WKDataGetSize(WKDataRef data); + +#ifdef __cplusplus +} +#endif + +#endif // WKData_h diff --git a/Source/WebKit2/Shared/API/c/WKDictionary.cpp b/Source/WebKit2/Shared/API/c/WKDictionary.cpp new file mode 100644 index 0000000..6b336bf --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKDictionary.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKDictionary.h" + +#include "ImmutableArray.h" +#include "ImmutableDictionary.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKDictionaryGetTypeID() +{ + return toAPI(ImmutableDictionary::APIType); +} + +WKTypeRef WKDictionaryGetItemForKey(WKDictionaryRef dictionaryRef, WKStringRef key) +{ + return toImpl(dictionaryRef)->get(toImpl(key)->string()); +} + +size_t WKDictionaryGetSize(WKDictionaryRef dictionaryRef) +{ + return toImpl(dictionaryRef)->size(); +} + +WKArrayRef WKDictionaryCopyKeys(WKDictionaryRef dictionaryRef) +{ + RefPtr<ImmutableArray> keys = toImpl(dictionaryRef)->keys(); + return toAPI(keys.release().releaseRef()); +} diff --git a/Source/WebKit2/Shared/API/c/WKDictionary.h b/Source/WebKit2/Shared/API/c/WKDictionary.h new file mode 100644 index 0000000..1c39400 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKDictionary.h @@ -0,0 +1,48 @@ +/* + * 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 WKDictionary_h +#define WKDictionary_h + +#include <WebKit2/WKBase.h> + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKDictionaryGetTypeID(); + +WK_EXPORT WKTypeRef WKDictionaryGetItemForKey(WKDictionaryRef dictionary, WKStringRef key); +WK_EXPORT size_t WKDictionaryGetSize(WKDictionaryRef dictionary); + +WK_EXPORT WKArrayRef WKDictionaryCopyKeys(WKDictionaryRef dictionary); + +#ifdef __cplusplus +} +#endif + +#endif /* WKDictionary_h */ diff --git a/Source/WebKit2/Shared/API/c/WKError.cpp b/Source/WebKit2/Shared/API/c/WKError.cpp new file mode 100644 index 0000000..395cf3a --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKError.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKError.h" + +#include "WebError.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKErrorGetTypeID() +{ + return toAPI(WebError::APIType); +} + +WKStringRef WKErrorCopyWKErrorDomain() +{ + return toCopiedAPI(WebError::webKitErrorDomain()); +} + +WKStringRef WKErrorCopyDomain(WKErrorRef errorRef) +{ + return toCopiedAPI(toImpl(errorRef)->domain()); +} + +int WKErrorGetErrorCode(WKErrorRef errorRef) +{ + return toImpl(errorRef)->errorCode(); +} + +WKURLRef WKErrorCopyFailingURL(WKErrorRef errorRef) +{ + return toCopiedURLAPI(toImpl(errorRef)->failingURL()); +} + +WKStringRef WKErrorCopyLocalizedDescription(WKErrorRef errorRef) +{ + return toCopiedAPI(toImpl(errorRef)->localizedDescription()); +} diff --git a/Source/WebKit2/Shared/API/c/WKError.h b/Source/WebKit2/Shared/API/c/WKError.h new file mode 100644 index 0000000..6f1f4f3 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKError.h @@ -0,0 +1,61 @@ +/* + * 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 WKError_h +#define WKError_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKErrorCodeCannotShowMIMEType = 100, + kWKErrorCodeCannotShowURL = 101, + kWKErrorCodeFrameLoadInterruptedByPolicyChange = 102, + kWKErrorCodeCannotUseRestrictedPort = 103, + kWKErrorCodeCannotFindPlugIn = 200, + kWKErrorCodeCannotLoadPlugIn = 201, + kWKErrorCodeJavaUnavailable = 202, + kWKErrorCodePlugInCancelledConnection = 203, + kWKErrorCodePlugInWillHandleLoad = 204, +}; +typedef uint32_t WKErrorCode; + +WK_EXPORT WKTypeID WKErrorGetTypeID(); + +WK_EXPORT WKStringRef WKErrorCopyWKErrorDomain(); + +WK_EXPORT WKStringRef WKErrorCopyDomain(WKErrorRef error); +WK_EXPORT int WKErrorGetErrorCode(WKErrorRef error); +WK_EXPORT WKURLRef WKErrorCopyFailingURL(WKErrorRef error); +WK_EXPORT WKStringRef WKErrorCopyLocalizedDescription(WKErrorRef error); + +#ifdef __cplusplus +} +#endif + +#endif // WKError_h diff --git a/Source/WebKit2/Shared/API/c/WKEvent.h b/Source/WebKit2/Shared/API/c/WKEvent.h new file mode 100644 index 0000000..b15c47a --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKEvent.h @@ -0,0 +1,55 @@ +/* + * 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 WKEvent_h +#define WKEvent_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKEventModifiersShiftKey = 1 << 0, + kWKEventModifiersControlKey = 1 << 1, + kWKEventModifiersAltKey = 1 << 2, + kWKEventModifiersMetaKey = 1 << 3 +}; +typedef uint32_t WKEventModifiers; + +enum { + kWKEventMouseButtonNoButton = -1, + kWKEventMouseButtonLeftButton = 0, + kWKEventMouseButtonMiddleButton = 1, + kWKEventMouseButtonRightButton = 2, +}; +typedef int32_t WKEventMouseButton; + +#ifdef __cplusplus +} +#endif + +#endif /* WKEvent_h */ diff --git a/Source/WebKit2/Shared/API/c/WKFindOptions.h b/Source/WebKit2/Shared/API/c/WKFindOptions.h new file mode 100644 index 0000000..3330035 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKFindOptions.h @@ -0,0 +1,48 @@ +/* + * 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 WKFindOptions_h +#define WKFindOptions_h + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKFindOptionsCaseInsensitive = 1 << 0, + kWKFindOptionsAtWordStarts = 1 << 1, + kWKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2, + kWKFindOptionsBackwards = 1 << 3, + kWKFindOptionsWrapAround = 1 << 4, + kWKFindOptionsShowOverlay = 1 << 5, + kWKFindOptionsShowFindIndicator = 1 << 6 +}; +typedef uint32_t WKFindOptions; + +#ifdef __cplusplus +} +#endif + +#endif // WKFindOptions_h diff --git a/Source/WebKit2/Shared/API/c/WKGeometry.h b/Source/WebKit2/Shared/API/c/WKGeometry.h new file mode 100644 index 0000000..70ef969 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKGeometry.h @@ -0,0 +1,57 @@ +/* + * 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 WKGeometry_h +#define WKGeometry_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct WKPoint { + double x; + double y; +}; +typedef struct WKPoint WKPoint; + +struct WKSize { + double width; + double height; +}; +typedef struct WKSize WKSize; + +struct WKRect { + WKPoint origin; + WKSize size; +}; +typedef struct WKRect WKRect; + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeometry_h */ diff --git a/Source/WebKit2/Shared/API/c/WKImage.cpp b/Source/WebKit2/Shared/API/c/WKImage.cpp new file mode 100644 index 0000000..0bf21df --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKImage.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKImage.h" + +#include "WKSharedAPICast.h" +#include "WebImage.h" + +using namespace WebKit; + +WKTypeID WKImageGetTypeID() +{ + return toAPI(WebImage::APIType); +} + +WKImageRef WKImageCreate(WKSize size, WKImageOptions options) +{ + RefPtr<WebImage> webImage = WebImage::create(toIntSize(size), toImageOptions(options)); + return toAPI(webImage.release().leakRef()); +} + +WKSize WKImageGetSize(WKImageRef imageRef) +{ + return toAPI(toImpl(imageRef)->size()); +} diff --git a/Source/WebKit2/Shared/API/c/WKImage.h b/Source/WebKit2/Shared/API/c/WKImage.h new file mode 100644 index 0000000..e3a2f9e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKImage.h @@ -0,0 +1,51 @@ +/* + * 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 WKImage_h +#define WKImage_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKImageOptionsShareable = 1 << 0, +}; +typedef uint32_t WKImageOptions; + +WK_EXPORT WKTypeID WKImageGetTypeID(); + +WK_EXPORT WKImageRef WKImageCreate(WKSize size, WKImageOptions options); + +WK_EXPORT WKSize WKImageGetSize(WKImageRef image); + +#ifdef __cplusplus +} +#endif + +#endif /* WKImage_h */ diff --git a/Source/WebKit2/Shared/API/c/WKMutableArray.cpp b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp new file mode 100644 index 0000000..56bd72f --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKMutableArray.h" + +#include "MutableArray.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKMutableArrayRef WKMutableArrayCreate() +{ + RefPtr<MutableArray> array = MutableArray::create(); + return toAPI(array.release().releaseRef()); +} + +bool WKArrayIsMutable(WKArrayRef arrayRef) +{ + return toImpl(arrayRef)->isMutable(); +} + +void WKArrayAppendItem(WKMutableArrayRef arrayRef, WKTypeRef itemRef) +{ + toImpl(arrayRef)->append(toImpl(itemRef)); +} + +void WKArrayRemoveItemAtIndex(WKMutableArrayRef arrayRef, size_t index) +{ + toImpl(arrayRef)->removeItemAtIndex(index); +} + diff --git a/Source/WebKit2/Shared/API/c/WKMutableArray.h b/Source/WebKit2/Shared/API/c/WKMutableArray.h new file mode 100644 index 0000000..a0dc06a --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKMutableArray.h @@ -0,0 +1,51 @@ +/* + * 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 WKMutableArray_h +#define WKMutableArray_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKMutableArrayRef WKMutableArrayCreate(); + +WK_EXPORT bool WKArrayIsMutable(WKArrayRef array); + +WK_EXPORT void WKArrayAppendItem(WKMutableArrayRef array, WKTypeRef item); + +WK_EXPORT void WKArrayRemoveItemAtIndex(WKMutableArrayRef array, size_t index); + +#ifdef __cplusplus +} +#endif + +#endif /* WKMutableArray_h */ diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp new file mode 100644 index 0000000..df9f5a7 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKMutableDictionary.h" + +#include "MutableDictionary.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKMutableDictionaryRef WKMutableDictionaryCreate() +{ + RefPtr<MutableDictionary> dictionary = MutableDictionary::create(); + return toAPI(dictionary.release().releaseRef()); +} + +bool WKDictionaryIsMutable(WKDictionaryRef dictionaryRef) +{ + return toImpl(dictionaryRef)->isMutable(); +} + +bool WKDictionaryAddItem(WKMutableDictionaryRef dictionaryRef, WKStringRef keyRef, WKTypeRef itemRef) +{ + return toImpl(dictionaryRef)->add(toImpl(keyRef)->string(), toImpl(itemRef)); +} + +bool WKDictionarySetItem(WKMutableDictionaryRef dictionaryRef, WKStringRef keyRef, WKTypeRef itemRef) +{ + return toImpl(dictionaryRef)->set(toImpl(keyRef)->string(), toImpl(itemRef)); +} diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.h b/Source/WebKit2/Shared/API/c/WKMutableDictionary.h new file mode 100644 index 0000000..467c1d4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.h @@ -0,0 +1,50 @@ +/* + * 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 WKMutableDictionary_h +#define WKMutableDictionary_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKMutableDictionaryRef WKMutableDictionaryCreate(); + +WK_EXPORT bool WKDictionaryIsMutable(WKDictionaryRef dictionary); + +WK_EXPORT bool WKDictionaryAddItem(WKMutableDictionaryRef dictionary, WKStringRef key, WKTypeRef item); +WK_EXPORT bool WKDictionarySetItem(WKMutableDictionaryRef dictionary, WKStringRef key, WKTypeRef item); + +#ifdef __cplusplus +} +#endif + +#endif /* WKMutableDictionary_h */ diff --git a/Source/WebKit2/Shared/API/c/WKNumber.cpp b/Source/WebKit2/Shared/API/c/WKNumber.cpp new file mode 100644 index 0000000..4a413e1 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKNumber.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKNumber.h" + +#include "WKAPICast.h" +#include "WebNumber.h" + +using namespace WebKit; + +WKTypeID WKBooleanGetTypeID() +{ + return toAPI(WebBoolean::APIType); +} + +WKBooleanRef WKBooleanCreate(bool value) +{ + RefPtr<WebBoolean> booleanObject = WebBoolean::create(value); + return toAPI(booleanObject.release().releaseRef()); +} + +bool WKBooleanGetValue(WKBooleanRef booleanRef) +{ + return toImpl(booleanRef)->value(); +} + +WKTypeID WKDoubleGetTypeID() +{ + return toAPI(WebDouble::APIType); +} + +WKDoubleRef WKDoubleCreate(double value) +{ + RefPtr<WebDouble> doubleObject = WebDouble::create(value); + return toAPI(doubleObject.release().releaseRef()); +} + +double WKDoubleGetValue(WKDoubleRef doubleRef) +{ + return toImpl(doubleRef)->value(); +} + +WKTypeID WKUInt64GetTypeID() +{ + return toAPI(WebUInt64::APIType); +} + +WKUInt64Ref WKUInt64Create(uint64_t value) +{ + RefPtr<WebUInt64> uint64Object = WebUInt64::create(value); + return toAPI(uint64Object.release().releaseRef()); +} + +uint64_t WKUInt64GetValue(WKUInt64Ref uint64Ref) +{ + return toImpl(uint64Ref)->value(); +} diff --git a/Source/WebKit2/Shared/API/c/WKNumber.h b/Source/WebKit2/Shared/API/c/WKNumber.h new file mode 100644 index 0000000..1b07bef --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKNumber.h @@ -0,0 +1,54 @@ +/* + * 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 WKNumber_h +#define WKNumber_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* WKBoolean */ +WK_EXPORT WKTypeID WKBooleanGetTypeID(); +WK_EXPORT WKBooleanRef WKBooleanCreate(bool value); +WK_EXPORT bool WKBooleanGetValue(WKBooleanRef booleanRef); + +/* WKDouble */ +WK_EXPORT WKTypeID WKDoubleGetTypeID(); +WK_EXPORT WKDoubleRef WKDoubleCreate(double value); +WK_EXPORT double WKDoubleGetValue(WKDoubleRef doubleRef); + +/* WKUInt64 */ +WK_EXPORT WKTypeID WKUInt64GetTypeID(); +WK_EXPORT WKUInt64Ref WKUInt64Create(uint64_t value); +WK_EXPORT uint64_t WKUInt64GetValue(WKUInt64Ref doubleRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKNumber_h */ diff --git a/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h new file mode 100644 index 0000000..ec8ae99 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h @@ -0,0 +1,55 @@ +/* + * 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 WKPageLoadTypes_h +#define WKPageLoadTypes_h + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKFrameNavigationTypeLinkClicked = 0, + kWKFrameNavigationTypeFormSubmitted = 1, + kWKFrameNavigationTypeBackForward = 2, + kWKFrameNavigationTypeReload = 3, + kWKFrameNavigationTypeFormResubmitted = 4, + kWKFrameNavigationTypeOther = 5 +}; +typedef uint32_t WKFrameNavigationType; + +enum { + kWKSameDocumentNavigationAnchorNavigation, + kWKSameDocumentNavigationSessionStatePush, + kWKSameDocumentNavigationSessionStateReplace, + kWKSameDocumentNavigationSessionStatePop +}; +typedef uint32_t WKSameDocumentNavigationType; + +#ifdef __cplusplus +} +#endif + +#endif /* WKPageLoadTypes_h */ diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp new file mode 100644 index 0000000..761cbf8 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKSecurityOrigin.h" + +#include "WKAPICast.h" +#include "WebSecurityOrigin.h" + +using namespace WebKit; + +WKTypeID WKSecurityOriginGetTypeID() +{ + return toAPI(WebSecurityOrigin::APIType); +} + +WKSecurityOriginRef WKSecurityOriginCreateFromIdentifier(WKStringRef identifier) +{ + RefPtr<WebSecurityOrigin> securityOrigin = WebSecurityOrigin::create(toImpl(identifier)->string()); + return toAPI(securityOrigin.release().leakRef()); +} + +WKSecurityOriginRef WKSecurityOriginCreate(WKStringRef protocol, WKStringRef host, int port) +{ + RefPtr<WebSecurityOrigin> securityOrigin = WebSecurityOrigin::create(toImpl(protocol)->string(), toImpl(host)->string(), port); + return toAPI(securityOrigin.release().leakRef()); +} + +WKStringRef WKSecurityOriginGetProtocol(WKSecurityOriginRef securityOrigin) +{ + return toCopiedAPI(toImpl(securityOrigin)->protocol()); +} + +WKStringRef WKSecurityOriginGetHost(WKSecurityOriginRef securityOrigin) +{ + return toCopiedAPI(toImpl(securityOrigin)->host()); +} + +unsigned short WKSecurityOriginGetPort(WKSecurityOriginRef securityOrigin) +{ + return toImpl(securityOrigin)->port(); +} diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h new file mode 100644 index 0000000..9bffdd7 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h @@ -0,0 +1,48 @@ +/* + * 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 WKSecurityOrigin_h +#define WKSecurityOrigin_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKSecurityOriginGetTypeID(); + +WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromIdentifier(WKStringRef identifier); +WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreate(WKStringRef protocol, WKStringRef host, int port); + +WK_EXPORT WKStringRef WKSecurityOriginGetProtocol(WKSecurityOriginRef securityOrigin); +WK_EXPORT WKStringRef WKSecurityOriginGetHost(WKSecurityOriginRef securityOrigin); +WK_EXPORT unsigned short WKSecurityOriginGetPort(WKSecurityOriginRef securityOrigin); + +#ifdef __cplusplus +} +#endif + +#endif /* WKSecurityOrigin_h */ diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp new file mode 100644 index 0000000..4c642f0 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp @@ -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. + */ + +#include "WKSerializedScriptValue.h" +#include "WKSerializedScriptValuePrivate.h" + +#include "WKAPICast.h" +#include "WebSerializedScriptValue.h" + +using namespace WebKit; + +WKTypeID WKSerializedScriptValueGetTypeID() +{ + return toAPI(WebSerializedScriptValue::APIType); +} + +WKSerializedScriptValueRef WKSerializedScriptValueCreate(JSContextRef context, JSValueRef value, JSValueRef* exception) +{ + RefPtr<WebSerializedScriptValue> serializedValue = WebSerializedScriptValue::create(context, value, exception); + return toAPI(serializedValue.release().leakRef()); +} + +WKSerializedScriptValueRef WKSerializedScriptValueCreateWithInternalRepresentation(void* internalRepresentation) +{ + RefPtr<WebSerializedScriptValue> serializedValue = WebSerializedScriptValue::create(static_cast<WebCore::SerializedScriptValue*>(internalRepresentation)); + return toAPI(serializedValue.release().leakRef()); +} + +JSValueRef WKSerializedScriptValueDeserialize(WKSerializedScriptValueRef scriptValueRef, JSContextRef contextRef, JSValueRef* exception) +{ + return toImpl(scriptValueRef)->deserialize(contextRef, exception); +} + +void* WKSerializedScriptValueGetInternalRepresentation(WKSerializedScriptValueRef scriptValueRef) +{ + return toImpl(scriptValueRef)->internalRepresentation(); +} diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h new file mode 100644 index 0000000..95fc048 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.h @@ -0,0 +1,45 @@ +/* + * 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 WKSerializedScriptValue_h +#define WKSerializedScriptValue_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKSerializedScriptValueGetTypeID(); + +WK_EXPORT WKSerializedScriptValueRef WKSerializedScriptValueCreate(JSContextRef context, JSValueRef value, JSValueRef* exception); +WK_EXPORT JSValueRef WKSerializedScriptValueDeserialize(WKSerializedScriptValueRef scriptValue, JSContextRef constext, JSValueRef* exception); + +#ifdef __cplusplus +} +#endif + +#endif /* WKSerializedScriptValue_h */ diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValuePrivate.h b/Source/WebKit2/Shared/API/c/WKSerializedScriptValuePrivate.h new file mode 100644 index 0000000..27e1849 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValuePrivate.h @@ -0,0 +1,42 @@ +/* + * 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 WKSerializedScriptValuePrivate_h +#define WKSerializedScriptValuePrivate_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT void* WKSerializedScriptValueGetInternalRepresentation(WKSerializedScriptValueRef scriptValueRef); +WK_EXPORT WKSerializedScriptValueRef WKSerializedScriptValueCreateWithInternalRepresentation(void*); + +#ifdef __cplusplus +} +#endif + +#endif /* WKSerializedScriptValuePrivate_h */ diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h new file mode 100644 index 0000000..6dc80e8 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -0,0 +1,735 @@ +/* + * 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 WKSharedAPICast_h +#define WKSharedAPICast_h + +#include "ImageOptions.h" +#include "SameDocumentNavigationType.h" +#include "WKBase.h" +#include "WKContextMenuItemTypes.h" +#include "WKEvent.h" +#include "WKFindOptions.h" +#include "WKGeometry.h" +#include "WKImage.h" +#include "WKPageLoadTypes.h" +#include "WebError.h" +#include "WebEvent.h" +#include "WebFindOptions.h" +#include "WebNumber.h" +#include "WebString.h" +#include "WebURL.h" +#include <WebCore/ContextMenuItem.h> +#include <WebCore/FloatRect.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/IntRect.h> +#include <wtf/TypeTraits.h> + +namespace WebKit { + +class ImmutableArray; +class ImmutableDictionary; +class MutableArray; +class MutableDictionary; +class WebCertificateInfo; +class WebContextMenuItem; +class WebData; +class WebImage; +class WebSecurityOrigin; +class WebSerializedScriptValue; +class WebURLRequest; +class WebURLResponse; +class WebUserContentURLPattern; + +template<typename APIType> struct APITypeInfo { }; +template<typename ImplType> struct ImplTypeInfo { }; + +#define WK_ADD_API_MAPPING(TheAPIType, TheImplType) \ + template<> struct APITypeInfo<TheAPIType> { typedef TheImplType* ImplType; }; \ + template<> struct ImplTypeInfo<TheImplType*> { typedef TheAPIType APIType; }; + +WK_ADD_API_MAPPING(WKArrayRef, ImmutableArray) +WK_ADD_API_MAPPING(WKBooleanRef, WebBoolean) +WK_ADD_API_MAPPING(WKCertificateInfoRef, WebCertificateInfo) +WK_ADD_API_MAPPING(WKContextMenuItemRef, WebContextMenuItem) +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(WKImageRef, WebImage) +WK_ADD_API_MAPPING(WKMutableArrayRef, MutableArray) +WK_ADD_API_MAPPING(WKMutableDictionaryRef, MutableDictionary) +WK_ADD_API_MAPPING(WKSecurityOriginRef, WebSecurityOrigin) +WK_ADD_API_MAPPING(WKSerializedScriptValueRef, WebSerializedScriptValue) +WK_ADD_API_MAPPING(WKStringRef, WebString) +WK_ADD_API_MAPPING(WKTypeRef, APIObject) +WK_ADD_API_MAPPING(WKUInt64Ref, WebUInt64) +WK_ADD_API_MAPPING(WKURLRef, WebURL) +WK_ADD_API_MAPPING(WKURLRequestRef, WebURLRequest) +WK_ADD_API_MAPPING(WKURLResponseRef, WebURLResponse) +WK_ADD_API_MAPPING(WKUserContentURLPatternRef, WebUserContentURLPattern) + +template<typename ImplType, typename APIType = typename ImplTypeInfo<ImplType*>::APIType> +class ProxyingRefPtr { +public: + ProxyingRefPtr(PassRefPtr<ImplType> impl) + : m_impl(impl) + { + } + + operator APIType() { return toAPI(m_impl.get()); } + +private: + RefPtr<ImplType> m_impl; +}; + +/* Opaque typing convenience methods */ + +template<typename T> +inline typename APITypeInfo<T>::ImplType toImpl(T t) +{ + // An example of the conversions that take place: + // const struct OpaqueWKArray* -> const struct OpaqueWKArray -> struct OpaqueWKArray -> struct OpaqueWKArray* -> ImmutableArray* + + typedef typename WTF::RemovePointer<T>::Type PotentiallyConstValueType; + typedef typename WTF::RemoveConst<PotentiallyConstValueType>::Type NonConstValueType; + + return reinterpret_cast<typename APITypeInfo<T>::ImplType>(const_cast<NonConstValueType*>(t)); +} + +template<typename T> +inline typename ImplTypeInfo<T>::APIType toAPI(T t) +{ + return reinterpret_cast<typename ImplTypeInfo<T>::APIType>(t); +} + +/* Special cases. */ + +inline ProxyingRefPtr<WebString> toAPI(StringImpl* string) +{ + return ProxyingRefPtr<WebString>(WebString::create(string)); +} + +inline WKStringRef toCopiedAPI(const String& string) +{ + RefPtr<WebString> webString = WebString::create(string); + return toAPI(webString.release().releaseRef()); +} + +inline ProxyingRefPtr<WebURL> toURLRef(StringImpl* string) +{ + if (!string) + ProxyingRefPtr<WebURL>(0); + return ProxyingRefPtr<WebURL>(WebURL::create(String(string))); +} + +inline WKURLRef toCopiedURLAPI(const String& string) +{ + if (!string) + return 0; + RefPtr<WebURL> webURL = WebURL::create(string); + return toAPI(webURL.release().releaseRef()); +} + +inline String toWTFString(WKStringRef stringRef) +{ + if (!stringRef) + return String(); + return toImpl(stringRef)->string(); +} + +inline String toWTFString(WKURLRef urlRef) +{ + if (!urlRef) + return String(); + return toImpl(urlRef)->string(); +} + +inline ProxyingRefPtr<WebError> toAPI(const WebCore::ResourceError& error) +{ + return ProxyingRefPtr<WebError>(WebError::create(error)); +} + +/* Geometry conversions */ + +inline WebCore::FloatRect toFloatRect(const WKRect& wkRect) +{ + return WebCore::FloatRect(static_cast<float>(wkRect.origin.x), static_cast<float>(wkRect.origin.y), + static_cast<float>(wkRect.size.width), static_cast<float>(wkRect.size.height)); +} + +inline WebCore::IntSize toIntSize(const WKSize& wkSize) +{ + return WebCore::IntSize(static_cast<int>(wkSize.width), static_cast<int>(wkSize.height)); +} + +inline WebCore::IntPoint toIntPoint(const WKPoint& wkPoint) +{ + return WebCore::IntPoint(static_cast<int>(wkPoint.x), static_cast<int>(wkPoint.y)); +} + +inline WebCore::IntRect toIntRect(const WKRect& wkRect) +{ + return WebCore::IntRect(static_cast<int>(wkRect.origin.x), static_cast<int>(wkRect.origin.y), + static_cast<int>(wkRect.size.width), static_cast<int>(wkRect.size.height)); +} + +inline WKRect toAPI(const WebCore::FloatRect& rect) +{ + WKRect wkRect; + wkRect.origin.x = rect.x(); + wkRect.origin.y = rect.y(); + wkRect.size.width = rect.width(); + wkRect.size.height = rect.height(); + return wkRect; +} + +inline WKRect toAPI(const WebCore::IntRect& rect) +{ + WKRect wkRect; + wkRect.origin.x = rect.x(); + wkRect.origin.y = rect.y(); + wkRect.size.width = rect.width(); + wkRect.size.height = rect.height(); + return wkRect; +} + +inline WKSize toAPI(const WebCore::IntSize& size) +{ + WKSize wkSize; + wkSize.width = size.width(); + wkSize.height = size.height(); + return wkSize; +} + +inline WKPoint toAPI(const WebCore::IntPoint& point) +{ + WKPoint wkPoint; + wkPoint.x = point.x(); + wkPoint.y = point.y(); + return wkPoint; +} + +/* Enum conversions */ + +inline WKTypeID toAPI(APIObject::Type type) +{ + return static_cast<WKTypeID>(type); +} + +inline WKEventModifiers toAPI(WebEvent::Modifiers modifiers) +{ + WKEventModifiers wkModifiers = 0; + if (modifiers & WebEvent::ShiftKey) + wkModifiers |= kWKEventModifiersShiftKey; + if (modifiers & WebEvent::ControlKey) + wkModifiers |= kWKEventModifiersControlKey; + if (modifiers & WebEvent::AltKey) + wkModifiers |= kWKEventModifiersAltKey; + if (modifiers & WebEvent::MetaKey) + wkModifiers |= kWKEventModifiersMetaKey; + return wkModifiers; +} + +inline WKEventMouseButton toAPI(WebMouseEvent::Button mouseButton) +{ + WKEventMouseButton wkMouseButton = kWKEventMouseButtonNoButton; + + switch (mouseButton) { + case WebMouseEvent::NoButton: + wkMouseButton = kWKEventMouseButtonNoButton; + break; + case WebMouseEvent::LeftButton: + wkMouseButton = kWKEventMouseButtonLeftButton; + break; + case WebMouseEvent::MiddleButton: + wkMouseButton = kWKEventMouseButtonMiddleButton; + break; + case WebMouseEvent::RightButton: + wkMouseButton = kWKEventMouseButtonRightButton; + break; + } + + return wkMouseButton; +} + +inline WKContextMenuItemTag toAPI(WebCore::ContextMenuAction action) +{ + switch (action) { + case WebCore::ContextMenuItemTagNoAction: + return kWKContextMenuItemTagNoAction; + case WebCore::ContextMenuItemTagOpenLinkInNewWindow: + return kWKContextMenuItemTagOpenLinkInNewWindow; + case WebCore::ContextMenuItemTagDownloadLinkToDisk: + return kWKContextMenuItemTagDownloadLinkToDisk; + case WebCore::ContextMenuItemTagCopyLinkToClipboard: + return kWKContextMenuItemTagCopyLinkToClipboard; + case WebCore::ContextMenuItemTagOpenImageInNewWindow: + return kWKContextMenuItemTagOpenImageInNewWindow; + case WebCore::ContextMenuItemTagDownloadImageToDisk: + return kWKContextMenuItemTagDownloadImageToDisk; + case WebCore::ContextMenuItemTagCopyImageToClipboard: + return kWKContextMenuItemTagCopyImageToClipboard; + case WebCore::ContextMenuItemTagOpenFrameInNewWindow: + return kWKContextMenuItemTagOpenFrameInNewWindow; + case WebCore::ContextMenuItemTagCopy: + return kWKContextMenuItemTagCopy; + case WebCore::ContextMenuItemTagGoBack: + return kWKContextMenuItemTagGoBack; + case WebCore::ContextMenuItemTagGoForward: + return kWKContextMenuItemTagGoForward; + case WebCore::ContextMenuItemTagStop: + return kWKContextMenuItemTagStop; + case WebCore::ContextMenuItemTagReload: + return kWKContextMenuItemTagReload; + case WebCore::ContextMenuItemTagCut: + return kWKContextMenuItemTagCut; + case WebCore::ContextMenuItemTagPaste: + return kWKContextMenuItemTagPaste; + case WebCore::ContextMenuItemTagSpellingGuess: + return kWKContextMenuItemTagSpellingGuess; + case WebCore::ContextMenuItemTagNoGuessesFound: + return kWKContextMenuItemTagNoGuessesFound; + case WebCore::ContextMenuItemTagIgnoreSpelling: + return kWKContextMenuItemTagIgnoreSpelling; + case WebCore::ContextMenuItemTagLearnSpelling: + return kWKContextMenuItemTagLearnSpelling; + case WebCore::ContextMenuItemTagOther: + return kWKContextMenuItemTagOther; + case WebCore::ContextMenuItemTagSearchInSpotlight: + return kWKContextMenuItemTagSearchInSpotlight; + case WebCore::ContextMenuItemTagSearchWeb: + return kWKContextMenuItemTagSearchWeb; + case WebCore::ContextMenuItemTagLookUpInDictionary: + return kWKContextMenuItemTagLookUpInDictionary; + case WebCore::ContextMenuItemTagOpenWithDefaultApplication: + return kWKContextMenuItemTagOpenWithDefaultApplication; + case WebCore::ContextMenuItemPDFActualSize: + return kWKContextMenuItemTagPDFActualSize; + case WebCore::ContextMenuItemPDFZoomIn: + return kWKContextMenuItemTagPDFZoomIn; + case WebCore::ContextMenuItemPDFZoomOut: + return kWKContextMenuItemTagPDFZoomOut; + case WebCore::ContextMenuItemPDFAutoSize: + return kWKContextMenuItemTagPDFAutoSize; + case WebCore::ContextMenuItemPDFSinglePage: + return kWKContextMenuItemTagPDFSinglePage; + case WebCore::ContextMenuItemPDFFacingPages: + return kWKContextMenuItemTagPDFFacingPages; + case WebCore::ContextMenuItemPDFContinuous: + return kWKContextMenuItemTagPDFContinuous; + case WebCore::ContextMenuItemPDFNextPage: + return kWKContextMenuItemTagPDFNextPage; + case WebCore::ContextMenuItemPDFPreviousPage: + return kWKContextMenuItemTagPDFPreviousPage; + case WebCore::ContextMenuItemTagOpenLink: + return kWKContextMenuItemTagOpenLink; + case WebCore::ContextMenuItemTagIgnoreGrammar: + return kWKContextMenuItemTagIgnoreGrammar; + case WebCore::ContextMenuItemTagSpellingMenu: + return kWKContextMenuItemTagSpellingMenu; + case WebCore::ContextMenuItemTagShowSpellingPanel: + return kWKContextMenuItemTagShowSpellingPanel; + case WebCore::ContextMenuItemTagCheckSpelling: + return kWKContextMenuItemTagCheckSpelling; + case WebCore::ContextMenuItemTagCheckSpellingWhileTyping: + return kWKContextMenuItemTagCheckSpellingWhileTyping; + case WebCore::ContextMenuItemTagCheckGrammarWithSpelling: + return kWKContextMenuItemTagCheckGrammarWithSpelling; + case WebCore::ContextMenuItemTagFontMenu: + return kWKContextMenuItemTagFontMenu; + case WebCore::ContextMenuItemTagShowFonts: + return kWKContextMenuItemTagShowFonts; + case WebCore::ContextMenuItemTagBold: + return kWKContextMenuItemTagBold; + case WebCore::ContextMenuItemTagItalic: + return kWKContextMenuItemTagItalic; + case WebCore::ContextMenuItemTagUnderline: + return kWKContextMenuItemTagUnderline; + case WebCore::ContextMenuItemTagOutline: + return kWKContextMenuItemTagOutline; + case WebCore::ContextMenuItemTagStyles: + return kWKContextMenuItemTagStyles; + case WebCore::ContextMenuItemTagShowColors: + return kWKContextMenuItemTagShowColors; + case WebCore::ContextMenuItemTagSpeechMenu: + return kWKContextMenuItemTagSpeechMenu; + case WebCore::ContextMenuItemTagStartSpeaking: + return kWKContextMenuItemTagStartSpeaking; + case WebCore::ContextMenuItemTagStopSpeaking: + return kWKContextMenuItemTagStopSpeaking; + case WebCore::ContextMenuItemTagWritingDirectionMenu: + return kWKContextMenuItemTagWritingDirectionMenu; + case WebCore::ContextMenuItemTagDefaultDirection: + return kWKContextMenuItemTagDefaultDirection; + case WebCore::ContextMenuItemTagLeftToRight: + return kWKContextMenuItemTagLeftToRight; + case WebCore::ContextMenuItemTagRightToLeft: + return kWKContextMenuItemTagRightToLeft; + case WebCore::ContextMenuItemTagPDFSinglePageScrolling: + return kWKContextMenuItemTagPDFSinglePageScrolling; + case WebCore::ContextMenuItemTagPDFFacingPagesScrolling: + return kWKContextMenuItemTagPDFFacingPagesScrolling; +#if ENABLE(INSPECTOR) + case WebCore::ContextMenuItemTagInspectElement: + return kWKContextMenuItemTagInspectElement; +#endif + case WebCore::ContextMenuItemTagTextDirectionMenu: + return kWKContextMenuItemTagTextDirectionMenu; + case WebCore::ContextMenuItemTagTextDirectionDefault: + return kWKContextMenuItemTagTextDirectionDefault; + case WebCore::ContextMenuItemTagTextDirectionLeftToRight: + return kWKContextMenuItemTagTextDirectionLeftToRight; + case WebCore::ContextMenuItemTagTextDirectionRightToLeft: + return kWKContextMenuItemTagTextDirectionRightToLeft; + case WebCore::ContextMenuItemTagOpenMediaInNewWindow: + return kWKContextMenuItemTagOpenMediaInNewWindow; + case WebCore::ContextMenuItemTagCopyMediaLinkToClipboard: + return kWKContextMenuItemTagCopyMediaLinkToClipboard; + case WebCore::ContextMenuItemTagToggleMediaControls: + return kWKContextMenuItemTagToggleMediaControls; + case WebCore::ContextMenuItemTagToggleMediaLoop: + return kWKContextMenuItemTagToggleMediaLoop; + case WebCore::ContextMenuItemTagEnterVideoFullscreen: + return kWKContextMenuItemTagEnterVideoFullscreen; + case WebCore::ContextMenuItemTagMediaPlayPause: + return kWKContextMenuItemTagMediaPlayPause; + case WebCore::ContextMenuItemTagMediaMute: + return kWKContextMenuItemTagMediaMute; +#if PLATFORM(MAC) + case WebCore::ContextMenuItemTagCorrectSpellingAutomatically: + return kWKContextMenuItemTagCorrectSpellingAutomatically; + case WebCore::ContextMenuItemTagSubstitutionsMenu: + return kWKContextMenuItemTagSubstitutionsMenu; + case WebCore::ContextMenuItemTagShowSubstitutions: + return kWKContextMenuItemTagShowSubstitutions; + case WebCore::ContextMenuItemTagSmartCopyPaste: + return kWKContextMenuItemTagSmartCopyPaste; + case WebCore::ContextMenuItemTagSmartQuotes: + return kWKContextMenuItemTagSmartQuotes; + case WebCore::ContextMenuItemTagSmartDashes: + return kWKContextMenuItemTagSmartDashes; + case WebCore::ContextMenuItemTagSmartLinks: + return kWKContextMenuItemTagSmartLinks; + case WebCore::ContextMenuItemTagTextReplacement: + return kWKContextMenuItemTagTextReplacement; + case WebCore::ContextMenuItemTagTransformationsMenu: + return kWKContextMenuItemTagTransformationsMenu; + case WebCore::ContextMenuItemTagMakeUpperCase: + return kWKContextMenuItemTagMakeUpperCase; + case WebCore::ContextMenuItemTagMakeLowerCase: + return kWKContextMenuItemTagMakeLowerCase; + case WebCore::ContextMenuItemTagCapitalize: + return kWKContextMenuItemTagCapitalize; + case WebCore::ContextMenuItemTagChangeBack: + return kWKContextMenuItemTagChangeBack; +#endif + default: + if (action < WebCore::ContextMenuItemBaseApplicationTag) + LOG_ERROR("ContextMenuAction %i is an unknown tag but is below the allowable custom tag value of %i", action, WebCore:: ContextMenuItemBaseApplicationTag); + return static_cast<WKContextMenuItemTag>(action); + } +} + +inline WebCore::ContextMenuAction toImpl(WKContextMenuItemTag tag) +{ + switch (tag) { + case kWKContextMenuItemTagNoAction: + return WebCore::ContextMenuItemTagNoAction; + case kWKContextMenuItemTagOpenLinkInNewWindow: + return WebCore::ContextMenuItemTagOpenLinkInNewWindow; + case kWKContextMenuItemTagDownloadLinkToDisk: + return WebCore::ContextMenuItemTagDownloadLinkToDisk; + case kWKContextMenuItemTagCopyLinkToClipboard: + return WebCore::ContextMenuItemTagCopyLinkToClipboard; + case kWKContextMenuItemTagOpenImageInNewWindow: + return WebCore::ContextMenuItemTagOpenImageInNewWindow; + case kWKContextMenuItemTagDownloadImageToDisk: + return WebCore::ContextMenuItemTagDownloadImageToDisk; + case kWKContextMenuItemTagCopyImageToClipboard: + return WebCore::ContextMenuItemTagCopyImageToClipboard; + case kWKContextMenuItemTagOpenFrameInNewWindow: + return WebCore::ContextMenuItemTagOpenFrameInNewWindow; + case kWKContextMenuItemTagCopy: + return WebCore::ContextMenuItemTagCopy; + case kWKContextMenuItemTagGoBack: + return WebCore::ContextMenuItemTagGoBack; + case kWKContextMenuItemTagGoForward: + return WebCore::ContextMenuItemTagGoForward; + case kWKContextMenuItemTagStop: + return WebCore::ContextMenuItemTagStop; + case kWKContextMenuItemTagReload: + return WebCore::ContextMenuItemTagReload; + case kWKContextMenuItemTagCut: + return WebCore::ContextMenuItemTagCut; + case kWKContextMenuItemTagPaste: + return WebCore::ContextMenuItemTagPaste; + case kWKContextMenuItemTagSpellingGuess: + return WebCore::ContextMenuItemTagSpellingGuess; + case kWKContextMenuItemTagNoGuessesFound: + return WebCore::ContextMenuItemTagNoGuessesFound; + case kWKContextMenuItemTagIgnoreSpelling: + return WebCore::ContextMenuItemTagIgnoreSpelling; + case kWKContextMenuItemTagLearnSpelling: + return WebCore::ContextMenuItemTagLearnSpelling; + case kWKContextMenuItemTagOther: + return WebCore::ContextMenuItemTagOther; + case kWKContextMenuItemTagSearchInSpotlight: + return WebCore::ContextMenuItemTagSearchInSpotlight; + case kWKContextMenuItemTagSearchWeb: + return WebCore::ContextMenuItemTagSearchWeb; + case kWKContextMenuItemTagLookUpInDictionary: + return WebCore::ContextMenuItemTagLookUpInDictionary; + case kWKContextMenuItemTagOpenWithDefaultApplication: + return WebCore::ContextMenuItemTagOpenWithDefaultApplication; + case kWKContextMenuItemTagPDFActualSize: + return WebCore::ContextMenuItemPDFActualSize; + case kWKContextMenuItemTagPDFZoomIn: + return WebCore::ContextMenuItemPDFZoomIn; + case kWKContextMenuItemTagPDFZoomOut: + return WebCore::ContextMenuItemPDFZoomOut; + case kWKContextMenuItemTagPDFAutoSize: + return WebCore::ContextMenuItemPDFAutoSize; + case kWKContextMenuItemTagPDFSinglePage: + return WebCore::ContextMenuItemPDFSinglePage; + case kWKContextMenuItemTagPDFFacingPages: + return WebCore::ContextMenuItemPDFFacingPages; + case kWKContextMenuItemTagPDFContinuous: + return WebCore::ContextMenuItemPDFContinuous; + case kWKContextMenuItemTagPDFNextPage: + return WebCore::ContextMenuItemPDFNextPage; + case kWKContextMenuItemTagPDFPreviousPage: + return WebCore::ContextMenuItemPDFPreviousPage; + case kWKContextMenuItemTagOpenLink: + return WebCore::ContextMenuItemTagOpenLink; + case kWKContextMenuItemTagIgnoreGrammar: + return WebCore::ContextMenuItemTagIgnoreGrammar; + case kWKContextMenuItemTagSpellingMenu: + return WebCore::ContextMenuItemTagSpellingMenu; + case kWKContextMenuItemTagShowSpellingPanel: + return WebCore::ContextMenuItemTagShowSpellingPanel; + case kWKContextMenuItemTagCheckSpelling: + return WebCore::ContextMenuItemTagCheckSpelling; + case kWKContextMenuItemTagCheckSpellingWhileTyping: + return WebCore::ContextMenuItemTagCheckSpellingWhileTyping; + case kWKContextMenuItemTagCheckGrammarWithSpelling: + return WebCore::ContextMenuItemTagCheckGrammarWithSpelling; + case kWKContextMenuItemTagFontMenu: + return WebCore::ContextMenuItemTagFontMenu; + case kWKContextMenuItemTagShowFonts: + return WebCore::ContextMenuItemTagShowFonts; + case kWKContextMenuItemTagBold: + return WebCore::ContextMenuItemTagBold; + case kWKContextMenuItemTagItalic: + return WebCore::ContextMenuItemTagItalic; + case kWKContextMenuItemTagUnderline: + return WebCore::ContextMenuItemTagUnderline; + case kWKContextMenuItemTagOutline: + return WebCore::ContextMenuItemTagOutline; + case kWKContextMenuItemTagStyles: + return WebCore::ContextMenuItemTagStyles; + case kWKContextMenuItemTagShowColors: + return WebCore::ContextMenuItemTagShowColors; + case kWKContextMenuItemTagSpeechMenu: + return WebCore::ContextMenuItemTagSpeechMenu; + case kWKContextMenuItemTagStartSpeaking: + return WebCore::ContextMenuItemTagStartSpeaking; + case kWKContextMenuItemTagStopSpeaking: + return WebCore::ContextMenuItemTagStopSpeaking; + case kWKContextMenuItemTagWritingDirectionMenu: + return WebCore::ContextMenuItemTagWritingDirectionMenu; + case kWKContextMenuItemTagDefaultDirection: + return WebCore::ContextMenuItemTagDefaultDirection; + case kWKContextMenuItemTagLeftToRight: + return WebCore::ContextMenuItemTagLeftToRight; + case kWKContextMenuItemTagRightToLeft: + return WebCore::ContextMenuItemTagRightToLeft; + case kWKContextMenuItemTagPDFSinglePageScrolling: + return WebCore::ContextMenuItemTagPDFSinglePageScrolling; + case kWKContextMenuItemTagPDFFacingPagesScrolling: + return WebCore::ContextMenuItemTagPDFFacingPagesScrolling; +#if ENABLE(INSPECTOR) + case kWKContextMenuItemTagInspectElement: + return WebCore::ContextMenuItemTagInspectElement; +#endif + case kWKContextMenuItemTagTextDirectionMenu: + return WebCore::ContextMenuItemTagTextDirectionMenu; + case kWKContextMenuItemTagTextDirectionDefault: + return WebCore::ContextMenuItemTagTextDirectionDefault; + case kWKContextMenuItemTagTextDirectionLeftToRight: + return WebCore::ContextMenuItemTagTextDirectionLeftToRight; + case kWKContextMenuItemTagTextDirectionRightToLeft: + return WebCore::ContextMenuItemTagTextDirectionRightToLeft; + case kWKContextMenuItemTagOpenMediaInNewWindow: + return WebCore::ContextMenuItemTagOpenMediaInNewWindow; + case kWKContextMenuItemTagCopyMediaLinkToClipboard: + return WebCore::ContextMenuItemTagCopyMediaLinkToClipboard; + case kWKContextMenuItemTagToggleMediaControls: + return WebCore::ContextMenuItemTagToggleMediaControls; + case kWKContextMenuItemTagToggleMediaLoop: + return WebCore::ContextMenuItemTagToggleMediaLoop; + case kWKContextMenuItemTagEnterVideoFullscreen: + return WebCore::ContextMenuItemTagEnterVideoFullscreen; + case kWKContextMenuItemTagMediaPlayPause: + return WebCore::ContextMenuItemTagMediaPlayPause; + case kWKContextMenuItemTagMediaMute: + return WebCore::ContextMenuItemTagMediaMute; +#if PLATFORM(MAC) + case kWKContextMenuItemTagCorrectSpellingAutomatically: + return WebCore::ContextMenuItemTagCorrectSpellingAutomatically; + case kWKContextMenuItemTagSubstitutionsMenu: + return WebCore::ContextMenuItemTagSubstitutionsMenu; + case kWKContextMenuItemTagShowSubstitutions: + return WebCore::ContextMenuItemTagShowSubstitutions; + case kWKContextMenuItemTagSmartCopyPaste: + return WebCore::ContextMenuItemTagSmartCopyPaste; + case kWKContextMenuItemTagSmartQuotes: + return WebCore::ContextMenuItemTagSmartQuotes; + case kWKContextMenuItemTagSmartDashes: + return WebCore::ContextMenuItemTagSmartDashes; + case kWKContextMenuItemTagSmartLinks: + return WebCore::ContextMenuItemTagSmartLinks; + case kWKContextMenuItemTagTextReplacement: + return WebCore::ContextMenuItemTagTextReplacement; + case kWKContextMenuItemTagTransformationsMenu: + return WebCore::ContextMenuItemTagTransformationsMenu; + case kWKContextMenuItemTagMakeUpperCase: + return WebCore::ContextMenuItemTagMakeUpperCase; + case kWKContextMenuItemTagMakeLowerCase: + return WebCore::ContextMenuItemTagMakeLowerCase; + case kWKContextMenuItemTagCapitalize: + return WebCore::ContextMenuItemTagCapitalize; + case kWKContextMenuItemTagChangeBack: + return WebCore::ContextMenuItemTagChangeBack; +#endif + default: + if (tag < kWKContextMenuItemBaseApplicationTag) + LOG_ERROR("WKContextMenuItemTag %i is an unknown tag but is below the allowable custom tag value of %i", tag, kWKContextMenuItemBaseApplicationTag); + return static_cast<WebCore::ContextMenuAction>(tag); + } +} + +inline WKContextMenuItemType toAPI(WebCore::ContextMenuItemType type) +{ + switch(type) { + case WebCore::ActionType: + return kWKContextMenuItemTypeAction; + case WebCore::CheckableActionType: + return kWKContextMenuItemTypeCheckableAction; + case WebCore::SeparatorType: + return kWKContextMenuItemTypeSeparator; + case WebCore::SubmenuType: + return kWKContextMenuItemTypeSubmenu; + default: + ASSERT_NOT_REACHED(); + return kWKContextMenuItemTypeAction; + } +} + +inline FindOptions toFindOptions(WKFindOptions wkFindOptions) +{ + unsigned findOptions = 0; + + if (wkFindOptions & kWKFindOptionsCaseInsensitive) + findOptions |= FindOptionsCaseInsensitive; + if (wkFindOptions & kWKFindOptionsAtWordStarts) + findOptions |= FindOptionsAtWordStarts; + if (wkFindOptions & kWKFindOptionsTreatMedialCapitalAsWordStart) + findOptions |= FindOptionsTreatMedialCapitalAsWordStart; + if (wkFindOptions & kWKFindOptionsBackwards) + findOptions |= FindOptionsBackwards; + if (wkFindOptions & kWKFindOptionsWrapAround) + findOptions |= FindOptionsWrapAround; + if (wkFindOptions & kWKFindOptionsShowOverlay) + findOptions |= FindOptionsShowOverlay; + if (wkFindOptions & kWKFindOptionsShowFindIndicator) + findOptions |= FindOptionsShowFindIndicator; + + return static_cast<FindOptions>(findOptions); +} + +inline WKFrameNavigationType toAPI(WebCore::NavigationType type) +{ + WKFrameNavigationType wkType = kWKFrameNavigationTypeOther; + + switch (type) { + case WebCore::NavigationTypeLinkClicked: + wkType = kWKFrameNavigationTypeLinkClicked; + break; + case WebCore::NavigationTypeFormSubmitted: + wkType = kWKFrameNavigationTypeFormSubmitted; + break; + case WebCore::NavigationTypeBackForward: + wkType = kWKFrameNavigationTypeBackForward; + break; + case WebCore::NavigationTypeReload: + wkType = kWKFrameNavigationTypeReload; + break; + case WebCore::NavigationTypeFormResubmitted: + wkType = kWKFrameNavigationTypeFormResubmitted; + break; + case WebCore::NavigationTypeOther: + wkType = kWKFrameNavigationTypeOther; + break; + } + + return wkType; +} + +inline WKSameDocumentNavigationType toAPI(SameDocumentNavigationType type) +{ + WKFrameNavigationType wkType = kWKSameDocumentNavigationAnchorNavigation; + + switch (type) { + case SameDocumentNavigationAnchorNavigation: + wkType = kWKSameDocumentNavigationAnchorNavigation; + break; + case SameDocumentNavigationSessionStatePush: + wkType = kWKSameDocumentNavigationSessionStatePush; + break; + case SameDocumentNavigationSessionStateReplace: + wkType = kWKSameDocumentNavigationSessionStateReplace; + break; + case SameDocumentNavigationSessionStatePop: + wkType = kWKSameDocumentNavigationSessionStatePop; + break; + } + + return wkType; +} + +inline ImageOptions toImageOptions(WKImageOptions wkImageOptions) +{ + unsigned imageOptions = 0; + + if (wkImageOptions & kWKImageOptionsShareable) + imageOptions |= ImageOptionsShareable; + + return static_cast<ImageOptions>(imageOptions); +} + +} // namespace WebKit + +#endif // WKSharedAPICast_h diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp new file mode 100644 index 0000000..14f40fa --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKString.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKString.h" +#include "WKStringPrivate.h" + +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKStringGetTypeID() +{ + return toAPI(WebString::APIType); +} + +WKStringRef WKStringCreateWithUTF8CString(const char* string) +{ + RefPtr<WebString> webString = WebString::createFromUTF8String(string); + return toAPI(webString.release().leakRef()); +} + +bool WKStringIsEmpty(WKStringRef stringRef) +{ + return toImpl(stringRef)->isEmpty(); +} + +size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef) +{ + return toImpl(stringRef)->maximumUTF8CStringSize(); +} + +size_t WKStringGetUTF8CString(WKStringRef stringRef, char* buffer, size_t bufferSize) +{ + return toImpl(stringRef)->getUTF8CString(buffer, bufferSize); +} + +bool WKStringIsEqual(WKStringRef aRef, WKStringRef bRef) +{ + return toImpl(aRef)->equal(toImpl(bRef)); +} + +bool WKStringIsEqualToUTF8CString(WKStringRef aRef, const char* b) +{ + return toImpl(aRef)->equalToUTF8String(b); +} + +WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef) +{ + RefPtr<WebString> webString = WebString::create(jsStringRef); + return toAPI(webString.release().leakRef()); +} + +JSStringRef WKStringCopyJSString(WKStringRef stringRef) +{ + return toImpl(stringRef)->createJSString(); +} diff --git a/Source/WebKit2/Shared/API/c/WKString.h b/Source/WebKit2/Shared/API/c/WKString.h new file mode 100644 index 0000000..e79839e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKString.h @@ -0,0 +1,55 @@ +/* + * 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 WKString_h +#define WKString_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKStringGetTypeID(); + +WK_EXPORT WKStringRef WKStringCreateWithUTF8CString(const char* string); + +WK_EXPORT bool WKStringIsEmpty(WKStringRef string); + +WK_EXPORT size_t WKStringGetMaximumUTF8CStringSize(WKStringRef string); +WK_EXPORT size_t WKStringGetUTF8CString(WKStringRef string, char* buffer, size_t bufferSize); + +WK_EXPORT bool WKStringIsEqual(WKStringRef a, WKStringRef b); +WK_EXPORT bool WKStringIsEqualToUTF8CString(WKStringRef a, const char* b); + +#ifdef __cplusplus +} +#endif + +#endif /* WKString_h */ diff --git a/Source/WebKit2/Shared/API/c/WKStringPrivate.h b/Source/WebKit2/Shared/API/c/WKStringPrivate.h new file mode 100644 index 0000000..f174f01 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKStringPrivate.h @@ -0,0 +1,43 @@ +/* + * 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 WKStringPrivate_h +#define WKStringPrivate_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKStringCreateWithJSString(JSStringRef jsString); +WK_EXPORT JSStringRef WKStringCopyJSString(WKStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* WKStringPrivate_h */ diff --git a/Source/WebKit2/Shared/API/c/WKType.cpp b/Source/WebKit2/Shared/API/c/WKType.cpp new file mode 100644 index 0000000..a499737 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKType.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKType.h" + +#include "APIObject.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKGetTypeID(WKTypeRef typeRef) +{ + return toAPI(static_cast<APIObject*>(const_cast<void*>(typeRef))->type()); +} + +WKTypeRef WKRetain(WKTypeRef typeRef) +{ + static_cast<APIObject*>(const_cast<void*>(typeRef))->ref(); + return typeRef; +} + +void WKRelease(WKTypeRef typeRef) +{ + static_cast<APIObject*>(const_cast<void*>(typeRef))->deref(); +} diff --git a/Source/WebKit2/Shared/API/c/WKType.h b/Source/WebKit2/Shared/API/c/WKType.h new file mode 100644 index 0000000..02f036c --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKType.h @@ -0,0 +1,44 @@ +/* + * 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 WKType_h +#define WKType_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGetTypeID(WKTypeRef type); + +WK_EXPORT WKTypeRef WKRetain(WKTypeRef type); +WK_EXPORT void WKRelease(WKTypeRef type); + +#ifdef __cplusplus +} +#endif + +#endif /* WKType_h */ diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp new file mode 100644 index 0000000..0060b34 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURL.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURL.h" + +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKURLGetTypeID() +{ + return toAPI(WebURL::APIType); +} + +WKURLRef WKURLCreateWithUTF8CString(const char* string) +{ + return toAPI(WebURL::create(String::fromUTF8(string)).leakRef()); +} + +WKStringRef WKURLCopyString(WKURLRef url) +{ + return toCopiedAPI(toImpl(url)->string()); +} + +bool WKURLIsEqual(WKURLRef a, WKURLRef b) +{ + return toImpl(a)->string() == toImpl(b)->string(); +} diff --git a/Source/WebKit2/Shared/API/c/WKURL.h b/Source/WebKit2/Shared/API/c/WKURL.h new file mode 100644 index 0000000..738bce5 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURL.h @@ -0,0 +1,47 @@ +/* + * 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 WKURL_h +#define WKURL_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKURLGetTypeID(); + +WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string); + +WK_EXPORT WKStringRef WKURLCopyString(WKURLRef URL); + +WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURL_h */ diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp new file mode 100644 index 0000000..6ea66ec --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp @@ -0,0 +1,43 @@ +/* + * 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 + * 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 "WKURLRequest.h" + +#include "WKAPICast.h" +#include "WebURLRequest.h" +#include <WebCore/KURL.h> + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKURLRequestGetTypeID() +{ + return toAPI(WebURLRequest::APIType); +} + +WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef url) +{ + return toAPI(WebURLRequest::create(KURL(KURL(), toImpl(url)->string())).leakRef()); +} diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.h b/Source/WebKit2/Shared/API/c/WKURLRequest.h new file mode 100644 index 0000000..d78968d --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLRequest_h +#define WKURLRequest_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKURLRequestGetTypeID(); + +WK_EXPORT WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLRequest_h */ diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp new file mode 100644 index 0000000..12537bd --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLResponse.h" + +#include "WKAPICast.h" +#include "WebURLResponse.h" + +using namespace WebKit; + +WKTypeID WKURLResponseGetTypeID() +{ + return toAPI(WebURLResponse::APIType); +} + diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.h b/Source/WebKit2/Shared/API/c/WKURLResponse.h new file mode 100644 index 0000000..62e51f4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.h @@ -0,0 +1,41 @@ +/* + * 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 WKURLResponse_h +#define WKURLResponse_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKURLResponseGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLResponse_h */ diff --git a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp new file mode 100644 index 0000000..3eb24c4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKUserContentURLPattern.h" + +#include "WKAPICast.h" +#include "WebUserContentURLPattern.h" + +using namespace WebKit; + +WKTypeID WKUserContentURLPatternGetTypeID() +{ + return toAPI(WebUserContentURLPattern::APIType); +} + +WKUserContentURLPatternRef WKUserContentURLPatternCreate(WKStringRef patternRef) +{ + RefPtr<WebUserContentURLPattern> userContentURLPattern = WebUserContentURLPattern::create(toImpl(patternRef)->string()); + return toAPI(userContentURLPattern.release().leakRef()); +} + +bool WKUserContentURLPatternMatchesURL(WKUserContentURLPatternRef urlPatternRef, WKURLRef urlRef) +{ + return toImpl(urlPatternRef)->matchesURL(toWTFString(urlRef)); +} diff --git a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h new file mode 100644 index 0000000..80c9bab --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h @@ -0,0 +1,46 @@ +/* + * 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 WKUserContentURLPattern_h +#define WKUserContentURLPattern_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKUserContentURLPatternGetTypeID(); + +WK_EXPORT WKUserContentURLPatternRef WKUserContentURLPatternCreate(WKStringRef patternRef); + +WK_EXPORT bool WKUserContentURLPatternMatchesURL(WKUserContentURLPatternRef urlPatternRef, WKURLRef urlRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKUserContentURLPattern_h */ diff --git a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp new file mode 100644 index 0000000..b89110e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKStringCF.h" + +#include "WKAPICast.h" +#include <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace WebKit; + +WKStringRef WKStringCreateWithCFString(CFStringRef cfString) +{ + String string(cfString); + return toCopiedAPI(string); +} + +CFStringRef WKStringCopyCFString(CFAllocatorRef allocatorRef, WKStringRef stringRef) +{ + ASSERT(!toImpl(stringRef)->string().isNull()); + + // NOTE: This does not use StringImpl::createCFString() since that function + // expects to be called on the thread running WebCore. + return CFStringCreateWithCharacters(allocatorRef, reinterpret_cast<const UniChar*>(toImpl(stringRef)->string().characters()), toImpl(stringRef)->string().length()); +} diff --git a/Source/WebKit2/Shared/API/c/cf/WKStringCF.h b/Source/WebKit2/Shared/API/c/cf/WKStringCF.h new file mode 100644 index 0000000..f946853 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKStringCF.h @@ -0,0 +1,43 @@ +/* + * 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 WKStringCF_h +#define WKStringCF_h + +#include <CoreFoundation/CoreFoundation.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKStringCreateWithCFString(CFStringRef string); +WK_EXPORT CFStringRef WKStringCopyCFString(CFAllocatorRef alloc, WKStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* WKStringCF_h */ diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp new file mode 100644 index 0000000..a4627ce --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLCF.h" + +#include "WKAPICast.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/RetainPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace WebKit; + +WKURLRef WKURLCreateWithCFURL(CFURLRef cfURL) +{ + String urlString(CFURLGetString(cfURL)); + return toCopiedURLAPI(urlString); +} + +CFURLRef WKURLCopyCFURL(CFAllocatorRef allocatorRef, WKURLRef URLRef) +{ + ASSERT(!toImpl(URLRef)->string().isNull()); + + // We first create a CString and then create the CFURL from it. This will ensure that the CFURL is stored in + // UTF-8 which uses less memory and is what WebKit clients might expect. + + // This pattern of using UTF-8 and then falling back to Latin1 on failure matches KURL::createCFString with the + // major differnce being that KURL does not do a UTF-8 conversion and instead chops off the high bits of the UTF-16 + // character sequence. + + CString buffer = toImpl(URLRef)->string().utf8(); + CFURLRef result = CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingUTF8, 0, true); + if (!result) + result = CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingISOLatin1, 0, true); + return result; +} diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.h b/Source/WebKit2/Shared/API/c/cf/WKURLCF.h new file mode 100644 index 0000000..394800d --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLCF_h +#define WKURLCF_h + +#include <CoreFoundation/CoreFoundation.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKURLRef WKURLCreateWithCFURL(CFURLRef URL); +WK_EXPORT CFURLRef WKURLCopyCFURL(CFAllocatorRef alloc, WKURLRef URL); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLCF_h */ diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp new file mode 100644 index 0000000..98c801a --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLRequestCF.h" + +#include "WKAPICast.h" +#include "WebURLRequest.h" + +using namespace WebKit; + +WKURLRequestRef WKURLRequestCreateWithCFURLRequest(CFURLRequestRef urlRequest) +{ + CFURLRequestRef copiedURLRequest = CFURLRequestCreateCopy(kCFAllocatorDefault, urlRequest); + RefPtr<WebURLRequest> request = WebURLRequest::create(copiedURLRequest); + return toAPI(request.release().releaseRef()); +} + +CFURLRequestRef WKURLRequestCopyCFURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest) +{ + return CFURLRequestCreateCopy(alloc, toImpl(urlRequest)->platformRequest()); +} diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.h b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.h new file mode 100644 index 0000000..fb7dab2 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLRequestCF_h +#define WKURLRequestCF_h + +#include <CFNetwork/CFURLRequestPriv.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKURLRequestRef WKURLRequestCreateWithCFURLRequest(CFURLRequestRef urlRequest); +WK_EXPORT CFURLRequestRef WKURLRequestCopyCFURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLRequestCF_h */ diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp new file mode 100644 index 0000000..36d3f00 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLResponseCF.h" + +#include "WKAPICast.h" +#include "WebURLResponse.h" + +using namespace WebKit; + +WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlResponse) +{ + CFURLResponseRef copiedURLResponse = CFURLResponseCreateCopy(kCFAllocatorDefault, urlResponse); + RefPtr<WebURLResponse> response = WebURLResponse::create(copiedURLResponse); + return toAPI(response.release().releaseRef()); +} + +CFURLResponseRef WKURLResponseCopyCFURLResponse(CFAllocatorRef alloc, WKURLResponseRef urlResponse) +{ + return CFURLResponseCreateCopy(alloc, toImpl(urlResponse)->platformResponse()); +} diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.h b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.h new file mode 100644 index 0000000..5ce7184 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLResponseCF_h +#define WKURLResponseCF_h + +#include <CFNetwork/CFURLResponsePriv.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlResponse); +WK_EXPORT CFURLResponseRef WKURLResponseCopyCFURLResponse(CFAllocatorRef alloc, WKURLResponseRef urlResponse); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLResponseCF_h */ diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp new file mode 100644 index 0000000..34a8bf1 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKImageCG.h" + +#include "ShareableBitmap.h" +#include "WKSharedAPICast.h" +#include "WebImage.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebKit; +using namespace WebCore; + +CGImageRef WKImageCreateCGImage(WKImageRef imageRef) +{ + OwnPtr<GraphicsContext> sourceContext = toImpl(imageRef)->bitmap()->createGraphicsContext(); + return CGBitmapContextCreateImage(sourceContext->platformContext()); +} diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.h b/Source/WebKit2/Shared/API/c/cg/WKImageCG.h new file mode 100644 index 0000000..7705c31 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.h @@ -0,0 +1,42 @@ +/* + * 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 WKImageCG_h +#define WKImageCG_h + +#include <CoreGraphics/CGImage.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT CGImageRef WKImageCreateCGImage(WKImageRef image); + +#ifdef __cplusplus +} +#endif + +#endif /* WKImageCG_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h new file mode 100644 index 0000000..7d44478 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h @@ -0,0 +1,42 @@ +/* + * 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 WKCertificateInfoMac_h +#define WKCertificateInfoMac_h + +#include <CoreFoundation/CoreFoundation.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT CFArrayRef WKCertificateInfoGetCertificateChain(WKCertificateInfoRef certificateInfo); + +#ifdef __cplusplus +} +#endif + +#endif /* WKCertificateInfoMac_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm new file mode 100644 index 0000000..2ffc1f5 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKCertificateInfoMac.h" + +#include "WKAPICast.h" +#include "WebCertificateInfo.h" + +using namespace WebKit; + +CFArrayRef WKCertificateInfoGetCertificateChain(WKCertificateInfoRef certificateInfoRef) +{ + return toImpl(certificateInfoRef)->platformCertificateInfo().certificateChain(); +} diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.h b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.h new file mode 100644 index 0000000..4cdfec8 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLRequestNS_h +#define WKURLRequestNS_h + +#include <Foundation/Foundation.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest); +WK_EXPORT NSURLRequest* WKURLRequestCopyNSURLRequest(WKURLRequestRef urlRequest); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLRequestNS_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm new file mode 100644 index 0000000..7cc69fa --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLRequestNS.h" + +#include "WKAPICast.h" +#include "WebURLRequest.h" + +using namespace WebKit; + +WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest) +{ + RetainPtr<NSURLRequest> copiedURLRequest(AdoptNS, [urlRequest copy]); + RefPtr<WebURLRequest> request = WebURLRequest::create(copiedURLRequest.get()); + return toAPI(request.release().releaseRef()); +} + +NSURLRequest* WKURLRequestCopyNSURLRequest(WKURLRequestRef urlRequest) +{ + return [toImpl(urlRequest)->platformRequest() copy]; +} diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.h b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.h new file mode 100644 index 0000000..0bbc149 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.h @@ -0,0 +1,43 @@ +/* + * 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 WKURLResponseNS_h +#define WKURLResponseNS_h + +#include <Foundation/Foundation.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKURLResponseRef WKURLResponseCreateWithNSURLResponse(NSURLResponse* urlResponse); +WK_EXPORT NSURLResponse* WKURLResponseCopyNSURLResponse(WKURLResponseRef urlResponse); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLResponseNS_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm new file mode 100644 index 0000000..79b874d --- /dev/null +++ b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKURLResponseNS.h" + +#include "WKAPICast.h" +#include "WebURLResponse.h" + +using namespace WebKit; + +WKURLResponseRef WKURLResponseCreateWithNSURLResponse(NSURLResponse* urlResponse) +{ + RetainPtr<NSURLResponse> copiedURLResponse(AdoptNS, [urlResponse copy]); + RefPtr<WebURLResponse> response = WebURLResponse::create(copiedURLResponse.get()); + return toAPI(response.release().releaseRef()); +} + +NSURLResponse* WKURLResponseCopyNSURLResponse(WKURLResponseRef urlResponse) +{ + return [toImpl(urlResponse)->platformResponse() copy]; +} diff --git a/Source/WebKit2/Shared/API/c/win/WKBaseWin.h b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h new file mode 100644 index 0000000..e2ee9a7 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h @@ -0,0 +1,35 @@ +/* + * 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 WKBaseWin_h +#define WKBaseWin_h + +#ifndef WKBase_h +#error "Please #include \"WKBase.h\" instead of this file directly." +#endif + +typedef const struct OpaqueWKView* WKViewRef; + +#endif /* WKBaseWin_h */ diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp new file mode 100644 index 0000000..f4c7bb2 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKCertificateInfoWin.h" + +#include "WKAPICast.h" +#include "WebCertificateInfo.h" + +using namespace WebKit; + +size_t WKCertificateInfoGetCertificateChainLength(WKCertificateInfoRef certificateInfoRef) +{ + return toImpl(certificateInfoRef)->platformCertificateInfo().certificateChain().size(); +} + +PCCERT_CONTEXT WKCertificateInfoGetCertificateContextAtIndex(WKCertificateInfoRef certificateInfoRef, size_t index) +{ + const Vector<PCCERT_CONTEXT>& certificateChain = toImpl(certificateInfoRef)->platformCertificateInfo().certificateChain(); + if (index >= certificateChain.size()) + return 0; + return certificateChain[index]; +} diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h new file mode 100644 index 0000000..0fcd818 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h @@ -0,0 +1,43 @@ +/* + * 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 WKCertificateInfoWin_h +#define WKCertificateInfoWin_h + +#include <WebKit2/WKBase.h> +#include <Wincrypt.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT size_t WKCertificateInfoGetCertificateChainLength(WKCertificateInfoRef certificateInfo); +WK_EXPORT PCCERT_CONTEXT WKCertificateInfoGetCertificateContextAtIndex(WKCertificateInfoRef certificateInfo, size_t index); + +#ifdef __cplusplus +} +#endif + +#endif /* WKCertificateInfoWin_h */ diff --git a/Source/WebKit2/Shared/APIClient.h b/Source/WebKit2/Shared/APIClient.h new file mode 100644 index 0000000..db5b3e1 --- /dev/null +++ b/Source/WebKit2/Shared/APIClient.h @@ -0,0 +1,52 @@ +/* + * 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 APIClient_h +#define APIClient_h + +namespace WebKit { + +template<typename T> class APIClient { +public: + APIClient() + { + initialize(0); + } + + void initialize(const T* client) + { + if (client && !client->version) + m_client = *client; + else + memset(&m_client, 0, sizeof(m_client)); + } + +protected: + T m_client; +}; + +} // namespace WebKit + +#endif // APIClient_h diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h new file mode 100644 index 0000000..70ed0ba --- /dev/null +++ b/Source/WebKit2/Shared/APIObject.h @@ -0,0 +1,113 @@ +/* + * 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 APIObject_h +#define APIObject_h + +#include <wtf/RefCounted.h> + +namespace WebKit { + +class APIObject : public RefCounted<APIObject> { +public: + enum Type { + // Base types + TypeNull = 0, + TypeArray, + TypeAuthenticationChallenge, + TypeAuthenticationDecisionListener, + TypeCertificateInfo, + TypeContextMenuItem, + TypeCredential, + TypeData, + TypeDictionary, + TypeError, + TypeImage, + TypeProtectionSpace, + TypeSecurityOrigin, + TypeSerializedScriptValue, + TypeString, + TypeURL, + TypeURLRequest, + TypeURLResponse, + TypeUserContentURLPattern, + + // Base numeric types + TypeBoolean, + TypeDouble, + TypeUInt64, + + // UIProcess types + TypeBackForwardList, + TypeBackForwardListItem, + TypeContext, + TypeDatabaseManager, + TypeDownload, + TypeFormSubmissionListener, + TypeFrame, + TypeFramePolicyListener, + TypeGeolocationManager, + TypeGeolocationPermissionRequest, + TypeGeolocationPosition, + TypeInspector, + TypeNavigationData, + TypeOpenPanelParameters, + TypeOpenPanelResultListener, + TypePage, + TypePageGroup, + TypePreferences, + + // Bundle types + TypeBundle, + TypeBundleBackForwardList, + TypeBundleBackForwardListItem, + TypeBundleFrame, + TypeBundleHitTestResult, + TypeBundleNodeHandle, + TypeBundlePage, + TypeBundlePageGroup, + TypeBundlePageOverlay, + TypeBundleRangeHandle, + TypeBundleScriptWorld, + + // Platform specific + TypeView + }; + + virtual ~APIObject() + { + } + + virtual Type type() const = 0; + +protected: + APIObject() + { + } +}; + +} // namespace WebKit + +#endif // APIObject_h diff --git a/Source/WebKit2/Shared/CacheModel.h b/Source/WebKit2/Shared/CacheModel.h new file mode 100644 index 0000000..91704c4 --- /dev/null +++ b/Source/WebKit2/Shared/CacheModel.h @@ -0,0 +1,39 @@ +/* + * 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 CacheModel_h +#define CacheModel_h + +namespace WebKit { + +enum CacheModel { + CacheModelDocumentViewer, + CacheModelDocumentBrowser, + CacheModelPrimaryWebBrowser +}; + +} // namespace WebKit + +#endif // CacheModel_h diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp new file mode 100644 index 0000000..06217fd --- /dev/null +++ b/Source/WebKit2/Shared/ChildProcess.cpp @@ -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. + */ + +#include "ChildProcess.h" + +#if !OS(WINDOWS) +#include <unistd.h> +#endif + +namespace WebKit { + +ChildProcess::ChildProcess() +{ +} + +ChildProcess::~ChildProcess() +{ +} + +NO_RETURN static void watchdogCallback() +{ + // We use _exit here since the watchdog callback is called from another thread and we don't want + // global destructors or atexit handlers to be called from this thread while the main thread is busy + // doing its thing. + _exit(EXIT_FAILURE); +} + +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); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h new file mode 100644 index 0000000..78fe1f4 --- /dev/null +++ b/Source/WebKit2/Shared/ChildProcess.h @@ -0,0 +1,47 @@ +/* + * 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 ChildProcess_h +#define ChildProcess_h + +#include "Connection.h" +#include <wtf/Noncopyable.h> + +namespace WebKit { + +class ChildProcess : protected CoreIPC::Connection::Client { + WTF_MAKE_NONCOPYABLE(ChildProcess); + +protected: + ChildProcess(); + ~ChildProcess(); + +private: + void didCloseOnConnectionWorkQueue(WorkQueue*, CoreIPC::Connection*); +}; + +} // namespace WebKit + +#endif // ChildProcess_h diff --git a/Source/WebKit2/Shared/CommandLine.h b/Source/WebKit2/Shared/CommandLine.h new file mode 100644 index 0000000..f70601c --- /dev/null +++ b/Source/WebKit2/Shared/CommandLine.h @@ -0,0 +1,58 @@ +/* + * 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 CommandLine_h +#define CommandLine_h + +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +// Very specialized command line parser. Expects the command line arguments in +// -key value and will store the parsed arguments in a map. + +class CommandLine { +public: +#if PLATFORM(MAC) + bool parse(int argc, char** argv); +#elif PLATFORM(WIN) + bool parse(LPTSTR commandLineString); +#endif + String operator[](const String& key) const + { + return m_args.get(key); + } + +private: + bool m_parsedSuccessfully; + + HashMap<String, String> m_args; +}; + +} + +#endif // CommandLine_h diff --git a/Source/WebKit2/Shared/ContextMenuState.h b/Source/WebKit2/Shared/ContextMenuState.h new file mode 100644 index 0000000..8485bab --- /dev/null +++ b/Source/WebKit2/Shared/ContextMenuState.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 ContextMenuState_h +#define ContextMenuState_h + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +struct ContextMenuState { + String absoluteLinkURLString; + String absoluteImageURLString; + + void encode(CoreIPC::ArgumentEncoder* encoder) const + { + encoder->encode(absoluteLinkURLString); + encoder->encode(absoluteImageURLString); + } + + static bool decode(CoreIPC::ArgumentDecoder* decoder, ContextMenuState& result) + { + if (!decoder->decode(result.absoluteLinkURLString)) + return false; + if (!decoder->decode(result.absoluteImageURLString)) + return false; + + return true; + } +}; + +} // namespace WebKit + +#endif // ContextMenuState_h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h new file mode 100644 index 0000000..1976888 --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h @@ -0,0 +1,71 @@ +/* + * 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 DrawingAreaMessageKinds_h +#define DrawingAreaMessageKinds_h + +#include "MessageID.h" + +// Messages sent from the web process to the UI process. + +namespace DrawingAreaLegacyMessage { + +enum Kind { + // Called whenever the size of the drawing area needs to be updated. + SetSize, + + // Called when the drawing area should stop painting. + SuspendPainting, + + // Called when the drawing area should start painting again. + ResumePainting, + + // Called when an update chunk sent to the drawing area has been + // incorporated into the backing store. + DidUpdate, + +#if ENABLE(TILED_BACKING_STORE) + // Called to request a tile update. + RequestTileUpdate, + + // Called to cancel a requested tile update. + CancelTileUpdate, + + // Called to take a snapshot of the page contents. + TakeSnapshot, +#endif +}; + +} + +namespace CoreIPC { + +template<> struct MessageKindTraits<DrawingAreaLegacyMessage::Kind> { + static const MessageClass messageClass = MessageClassDrawingAreaLegacy; +}; + +} + +#endif // DrawingAreaMessageKinds_h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h new file mode 100644 index 0000000..c5ab54b --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.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 DrawingAreaProxyMessageKinds_h +#define DrawingAreaProxyMessageKinds_h + +#include "MessageID.h" + +// Messages sent from the web process to the WebPageProxy. + +namespace DrawingAreaProxyLegacyMessage { + +enum Kind { + Update, + DidSetSize, +#if USE(ACCELERATED_COMPOSITING) + AttachCompositingContext, +#endif +#if ENABLE(TILED_BACKING_STORE) + Invalidate, + TileUpdated, + AllTileUpdatesProcessed, + SnapshotTaken, +#endif +}; + +} + +namespace CoreIPC { + +template<> struct MessageKindTraits<DrawingAreaProxyLegacyMessage::Kind> { + static const MessageClass messageClass = MessageClassDrawingAreaProxyLegacy; +}; + +} + +#endif // DrawingAreaProxyMessageKinds_h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h new file mode 100644 index 0000000..1ddf0bf --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h @@ -0,0 +1,49 @@ +/* + * 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 InjectedBundleMessageKinds_h +#define InjectedBundleMessageKinds_h + +// Messages sent from WebKit to the injected bundle. + +#include "MessageID.h" + +namespace InjectedBundleMessage { + +enum Kind { + PostMessage +}; + +} + +namespace CoreIPC { + +template<> struct MessageKindTraits<InjectedBundleMessage::Kind> { + static const MessageClass messageClass = MessageClassInjectedBundle; +}; + +} + +#endif // InjectedBundleMessageKinds_h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h new file mode 100644 index 0000000..e8194b5 --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h @@ -0,0 +1,50 @@ +/* + * 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 WebContextMessageKinds_h +#define WebContextMessageKinds_h + +// Messages sent from the injected bundle to the WebContext. + +#include "MessageID.h" + +namespace WebContextLegacyMessage { + +enum Kind { + PostMessage, + PostSynchronousMessage +}; + +} + +namespace CoreIPC { + +template<> struct MessageKindTraits<WebContextLegacyMessage::Kind> { + static const MessageClass messageClass = MessageClassWebContextLegacy; +}; + +} + +#endif // InjectedBundleMessageKinds_h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h diff --git a/Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h b/Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h new file mode 100644 index 0000000..1f5a6be --- /dev/null +++ b/Source/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h @@ -0,0 +1,51 @@ +/* + * 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 WebProcessProxyMessageKinds_h +#define WebProcessProxyMessageKinds_h + +// Messages sent from the web process to the WebProcessProxy. + +#include "MessageID.h" + +namespace WebProcessProxyLegacyMessage { + +enum Kind { +#if ENABLE(PLUGIN_PROCESS) + GetPluginProcessConnection, +#endif +}; + +} + +namespace CoreIPC { + +template<> struct MessageKindTraits<WebProcessProxyLegacyMessage::Kind> { + static const MessageClass messageClass = MessageClassWebProcessProxyLegacy; +}; + +} + +#endif // WebProcessProxyMessageKinds_h diff --git a/Source/WebKit2/Shared/DragControllerAction.h b/Source/WebKit2/Shared/DragControllerAction.h new file mode 100644 index 0000000..b37e811 --- /dev/null +++ b/Source/WebKit2/Shared/DragControllerAction.h @@ -0,0 +1,40 @@ +/* + * 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 DragControllerAction_h +#define DragControllerAction_h + +namespace WebKit { + +enum DragControllerAction { + DragControllerActionEntered, + DragControllerActionUpdated, + DragControllerActionExited, + DragControllerActionPerformDrag +}; + +} // namespace WebKit + +#endif // DragControllerAction_h diff --git a/Source/WebKit2/Shared/DrawingAreaInfo.h b/Source/WebKit2/Shared/DrawingAreaInfo.h new file mode 100644 index 0000000..fdbfc75 --- /dev/null +++ b/Source/WebKit2/Shared/DrawingAreaInfo.h @@ -0,0 +1,76 @@ +/* + * 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 DrawingAreaInfo_h +#define DrawingAreaInfo_h + +#include "ArgumentCoders.h" +#include "Connection.h" + +namespace WebCore { + class IntRect; + class IntSize; +} + +namespace WebKit { + +struct DrawingAreaInfo { + enum Type { + None, + Impl, + ChunkedUpdate, +#if USE(ACCELERATED_COMPOSITING) + LayerBacked, +#endif +#if ENABLE(TILED_BACKING_STORE) + Tiled, +#endif + }; + + typedef uint64_t Identifier; + + DrawingAreaInfo() + : type(None) + , identifier(0) + { + } + + DrawingAreaInfo(Type type, Identifier identifier) + : type(type) + , identifier(identifier) + { + } + + Type type; + Identifier identifier; +}; + +} // namespace WebKit + +namespace CoreIPC { +template<> struct ArgumentCoder<WebKit::DrawingAreaInfo> : SimpleArgumentCoder<WebKit::DrawingAreaInfo> { }; +} + +#endif // DrawingAreaInfo_h diff --git a/Source/WebKit2/Shared/FontSmoothingLevel.h b/Source/WebKit2/Shared/FontSmoothingLevel.h new file mode 100644 index 0000000..75decd6 --- /dev/null +++ b/Source/WebKit2/Shared/FontSmoothingLevel.h @@ -0,0 +1,43 @@ +/* + * 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. ``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 + * 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 FontSmoothingLevel_h +#define FontSmoothingLevel_h + +namespace WebKit { + +enum FontSmoothingLevel { + FontSmoothingLevelNoSubpixelAntiAliasing = 0, + FontSmoothingLevelLight = 1, + FontSmoothingLevelMedium = 2, + FontSmoothingLevelStrong = 3, +#if PLATFORM(WIN) + FontSmoothingLevelWindows = 4, +#endif +}; + +} // namespace WebKit + +#endif // FontSmoothingLevel_h diff --git a/Source/WebKit2/Shared/ImageOptions.h b/Source/WebKit2/Shared/ImageOptions.h new file mode 100644 index 0000000..caf79bf --- /dev/null +++ b/Source/WebKit2/Shared/ImageOptions.h @@ -0,0 +1,37 @@ +/* + * 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 ImageOptions_h +#define ImageOptions_h + +namespace WebKit { + +enum ImageOptions { + ImageOptionsShareable = 1 << 0, +}; + +} // namespace WebKit + +#endif // ImageOptions_h diff --git a/Source/WebKit2/Shared/ImmutableArray.cpp b/Source/WebKit2/Shared/ImmutableArray.cpp new file mode 100644 index 0000000..2be62fd --- /dev/null +++ b/Source/WebKit2/Shared/ImmutableArray.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ImmutableArray.h" + +namespace WebKit { + +ImmutableArray::ImmutableArray() +{ +} + +ImmutableArray::ImmutableArray(APIObject** entries, size_t size) + : m_entries(size) +{ + for (size_t i = 0; i < size; ++i) + m_entries[i] = entries[i]; +} + +ImmutableArray::ImmutableArray(Vector<RefPtr<APIObject> >& entries) +{ + m_entries.swap(entries); +} + +ImmutableArray::~ImmutableArray() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/ImmutableArray.h b/Source/WebKit2/Shared/ImmutableArray.h new file mode 100644 index 0000000..e26e4aa --- /dev/null +++ b/Source/WebKit2/Shared/ImmutableArray.h @@ -0,0 +1,77 @@ +/* + * 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 ImmutableArray_h +#define ImmutableArray_h + +#include "APIObject.h" +#include <wtf/PassOwnArrayPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> + +namespace WebKit { + +// ImmutableArray - An immutable array type suitable for vending to an API. + +class ImmutableArray : public APIObject { +public: + static const Type APIType = TypeArray; + + static PassRefPtr<ImmutableArray> create() + { + return adoptRef(new ImmutableArray); + } + static PassRefPtr<ImmutableArray> create(APIObject** entries, size_t size) + { + return adoptRef(new ImmutableArray(entries, size)); + } + static PassRefPtr<ImmutableArray> adopt(Vector<RefPtr<APIObject> >& entries) + { + return adoptRef(new ImmutableArray(entries)); + } + + virtual ~ImmutableArray(); + + template<typename T> + T* at(size_t i) { if (m_entries[i]->type() != T::APIType) return 0; return static_cast<T*>(m_entries[i].get()); } + + APIObject* at(size_t i) { return m_entries[i].get(); } + size_t size() { return m_entries.size(); } + + virtual bool isMutable() { return false; } + +protected: + ImmutableArray(); + ImmutableArray(APIObject** entries, size_t size); + ImmutableArray(Vector<RefPtr<APIObject> >& entries); + + virtual Type type() const { return APIType; } + + Vector<RefPtr<APIObject> > m_entries; +}; + +} // namespace WebKit + +#endif // ImmutableArray_h diff --git a/Source/WebKit2/Shared/ImmutableDictionary.cpp b/Source/WebKit2/Shared/ImmutableDictionary.cpp new file mode 100644 index 0000000..488da2d --- /dev/null +++ b/Source/WebKit2/Shared/ImmutableDictionary.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ImmutableDictionary.h" + +#include "ImmutableArray.h" +#include "WebString.h" + +namespace WebKit { + +ImmutableDictionary::ImmutableDictionary() +{ +} + +ImmutableDictionary::ImmutableDictionary(MapType& map) +{ + m_map.swap(map); +} + +ImmutableDictionary::~ImmutableDictionary() +{ +} + +PassRefPtr<ImmutableArray> ImmutableDictionary::keys() const +{ + if (m_map.isEmpty()) + return ImmutableArray::create(); + + Vector<RefPtr<APIObject> > vector; + vector.reserveInitialCapacity(m_map.size()); + + MapType::const_iterator::Keys it = m_map.begin().keys(); + MapType::const_iterator::Keys end = m_map.end().keys(); + for (; it != end; ++it) + vector.uncheckedAppend(WebString::create(*it)); + + return ImmutableArray::adopt(vector); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/ImmutableDictionary.h b/Source/WebKit2/Shared/ImmutableDictionary.h new file mode 100644 index 0000000..3f592c5 --- /dev/null +++ b/Source/WebKit2/Shared/ImmutableDictionary.h @@ -0,0 +1,95 @@ +/* + * 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 ImmutableDictionary_h +#define ImmutableDictionary_h + +#include "APIObject.h" +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class ImmutableArray; + +// ImmutableDictionary - An immutable dictionary type suitable for vending to an API. + +class ImmutableDictionary : public APIObject { +public: + static const Type APIType = TypeDictionary; + + typedef HashMap<String, RefPtr<APIObject> > MapType; + + static PassRefPtr<ImmutableDictionary> create() + { + return adoptRef(new ImmutableDictionary); + } + static PassRefPtr<ImmutableDictionary> adopt(MapType& map) + { + return adoptRef(new ImmutableDictionary(map)); + } + + virtual ~ImmutableDictionary(); + + virtual bool isMutable() { return false; } + + template<typename T> + T* get(const String& key) + { + RefPtr<APIObject> item = m_map.get(key); + if (!item) + return 0; + + if (item->type() != T::APIType) + return 0; + + return static_cast<T*>(item.get()); + } + + APIObject* get(const String& key) + { + return m_map.get(key).get(); + } + + PassRefPtr<ImmutableArray> keys() const; + + size_t size() { return m_map.size(); } + + const MapType& map() { return m_map; } + +protected: + ImmutableDictionary(); + ImmutableDictionary(MapType& map); + + virtual Type type() const { return APIType; } + + MapType m_map; +}; + +} // namespace WebKit + +#endif // ImmutableDictionary_h diff --git a/Source/WebKit2/Shared/MutableArray.cpp b/Source/WebKit2/Shared/MutableArray.cpp new file mode 100644 index 0000000..00f718e --- /dev/null +++ b/Source/WebKit2/Shared/MutableArray.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "MutableArray.h" + +namespace WebKit { + +MutableArray::MutableArray() +{ +} + +MutableArray::~MutableArray() +{ +} + +void MutableArray::append(APIObject* item) +{ + m_entries.append(item); +} + +void MutableArray::reserveCapacity(unsigned capacity) +{ + m_entries.reserveCapacity(capacity); +} + +void MutableArray::removeItemAtIndex(unsigned index) +{ + m_entries.remove(index); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/MutableArray.h b/Source/WebKit2/Shared/MutableArray.h new file mode 100644 index 0000000..2718664 --- /dev/null +++ b/Source/WebKit2/Shared/MutableArray.h @@ -0,0 +1,56 @@ +/* + * 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 MutableArray_h +#define MutableArray_h + +#include "ImmutableArray.h" + +namespace WebKit { + +// MutableArray - A mutable array type suitable for vending to an API. + +class MutableArray : public ImmutableArray { +public: + static PassRefPtr<MutableArray> create() + { + return adoptRef(new MutableArray); + } + + ~MutableArray(); + + void append(APIObject*); + void reserveCapacity(unsigned); + void removeItemAtIndex(unsigned); + + virtual bool isMutable() { return true; } + +private: + MutableArray(); +}; + +} // namespace WebKit + +#endif // MutableArray_h diff --git a/Source/WebKit2/Shared/MutableDictionary.cpp b/Source/WebKit2/Shared/MutableDictionary.cpp new file mode 100644 index 0000000..c151dd6 --- /dev/null +++ b/Source/WebKit2/Shared/MutableDictionary.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "MutableDictionary.h" + +namespace WebKit { + +MutableDictionary::MutableDictionary() +{ +} + +MutableDictionary::~MutableDictionary() +{ +} + +bool MutableDictionary::add(const String& key, APIObject* item) +{ + std::pair<MapType::iterator, bool> result = m_map.add(key, item); + return result.second; +} + +bool MutableDictionary::set(const String& key, APIObject* item) +{ + std::pair<MapType::iterator, bool> result = m_map.set(key, item); + return result.second; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/MutableDictionary.h b/Source/WebKit2/Shared/MutableDictionary.h new file mode 100644 index 0000000..f5ee4e7 --- /dev/null +++ b/Source/WebKit2/Shared/MutableDictionary.h @@ -0,0 +1,55 @@ +/* + * 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 MutableDictionary_h +#define MutableDictionary_h + +#include "ImmutableDictionary.h" + +namespace WebKit { + +// MutableDictionary - A mutable dictionary type suitable for vending to an API. + +class MutableDictionary : public ImmutableDictionary { +public: + static PassRefPtr<MutableDictionary> create() + { + return adoptRef(new MutableDictionary); + } + + ~MutableDictionary(); + + bool add(const String& key, APIObject*); + bool set(const String& key, APIObject*); + + virtual bool isMutable() { return true; } + +private: + MutableDictionary(); +}; + +} // namespace WebKit + +#endif // MutableDictionary_h diff --git a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h new file mode 100644 index 0000000..9c4e480 --- /dev/null +++ b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h @@ -0,0 +1,74 @@ +/* + * 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 NativeWebKeyboardEvent_h +#define NativeWebKeyboardEvent_h + +#include "WebEvent.h" + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class NSView; +#else +class NSView; +#endif +#elif PLATFORM(QT) +#include <QKeyEvent> +#endif + +namespace WebKit { + +class NativeWebKeyboardEvent : public WebKeyboardEvent { +public: +#if PLATFORM(MAC) + NativeWebKeyboardEvent(NSEvent *, NSView *); +#elif PLATFORM(WIN) + NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM); +#elif PLATFORM(QT) + explicit NativeWebKeyboardEvent(QKeyEvent*); +#endif + +#if PLATFORM(MAC) + NSEvent *nativeEvent() const { return m_nativeEvent.get(); } +#elif PLATFORM(WIN) + const MSG* nativeEvent() const { return &m_nativeEvent; } +#elif PLATFORM(QT) + const QKeyEvent* nativeEvent() const { return &m_nativeEvent; } +#endif + +private: +#if PLATFORM(MAC) + RetainPtr<NSEvent> m_nativeEvent; +#elif PLATFORM(WIN) + MSG m_nativeEvent; +#elif PLATFORM(QT) + QKeyEvent m_nativeEvent; +#endif +}; + +} // namespace WebKit + +#endif // NativeWebKeyboardEvent_h diff --git a/Source/WebKit2/Shared/NotImplemented.h b/Source/WebKit2/Shared/NotImplemented.h new file mode 100644 index 0000000..d93da50 --- /dev/null +++ b/Source/WebKit2/Shared/NotImplemented.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007, 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 NotImplemented_h +#define NotImplemented_h + +#include <stdio.h> +#include <wtf/Assertions.h> + +#if defined(NDEBUG) || (defined(DISABLE_NOT_IMPLEMENTED_WARNINGS) && DISABLE_NOT_IMPLEMENTED_WARNINGS) +#define notImplemented() ((void)0) +#else + +#define notImplemented() do { \ +static bool havePrinted = false; \ +if (!havePrinted) { \ +printf("UNIMPLEMENTED: %s: %d - %s\n", __FILE__, __LINE__, WTF_PRETTY_FUNCTION); \ +havePrinted = true; \ +} \ +} while (0) + +#endif // NDEBUG + +#endif // NotImplemented_h diff --git a/Source/WebKit2/Shared/OriginAndDatabases.cpp b/Source/WebKit2/Shared/OriginAndDatabases.cpp new file mode 100644 index 0000000..4db7bf0 --- /dev/null +++ b/Source/WebKit2/Shared/OriginAndDatabases.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "OriginAndDatabases.h" + +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +void OriginAndDatabases::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(originIdentifier, originQuota, originUsage, databases)); +} + +bool OriginAndDatabases::decode(CoreIPC::ArgumentDecoder* decoder, OriginAndDatabases& originAndDatabases) +{ + return decoder->decode(CoreIPC::Out(originAndDatabases.originIdentifier, originAndDatabases.originQuota, originAndDatabases.originUsage, originAndDatabases.databases)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/OriginAndDatabases.h b/Source/WebKit2/Shared/OriginAndDatabases.h new file mode 100644 index 0000000..03f7261 --- /dev/null +++ b/Source/WebKit2/Shared/OriginAndDatabases.h @@ -0,0 +1,52 @@ +/* + * 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 OriginAndDatabases_h +#define OriginAndDatabases_h + +#include <WebCore/DatabaseDetails.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct OriginAndDatabases { + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, OriginAndDatabases&); + + String originIdentifier; + uint64_t originQuota; + uint64_t originUsage; + Vector<WebCore::DatabaseDetails> databases; +}; + +} // namespace WebKit + +#endif // OriginAndDatabases_h diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp new file mode 100644 index 0000000..6d90ce5 --- /dev/null +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PlatformPopupMenuData.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +PlatformPopupMenuData::PlatformPopupMenuData() +#if PLATFORM(WIN) + : m_clientPaddingLeft(0) + , m_clientPaddingRight(0) + , m_clientInsetLeft(0) + , m_clientInsetRight(0) + , m_popupWidth(0) + , m_itemHeight(0) +#endif +{ +} + +void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const +{ +#if PLATFORM(WIN) + encoder->encode(m_clientPaddingLeft); + encoder->encode(m_clientPaddingRight); + encoder->encode(m_clientInsetLeft); + encoder->encode(m_clientInsetRight); + encoder->encode(m_popupWidth); + encoder->encode(m_itemHeight); + encoder->encode(m_backingStoreSize); + + SharedMemory::Handle notSelectedBackingStoreHandle; + m_notSelectedBackingStore->createHandle(notSelectedBackingStoreHandle); + encoder->encode(notSelectedBackingStoreHandle); + + SharedMemory::Handle selectedBackingStoreHandle; + m_selectedBackingStore->createHandle(selectedBackingStoreHandle); + encoder->encode(selectedBackingStoreHandle); +#endif +} + +bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPopupMenuData& data) +{ +#if PLATFORM(WIN) + PlatformPopupMenuData d; + if (!decoder->decode(d.m_clientPaddingLeft)) + return false; + if (!decoder->decode(d.m_clientPaddingRight)) + return false; + if (!decoder->decode(d.m_clientInsetLeft)) + return false; + if (!decoder->decode(d.m_clientInsetRight)) + return false; + if (!decoder->decode(d.m_popupWidth)) + return false; + if (!decoder->decode(d.m_itemHeight)) + return false; + if (!decoder->decode(d.m_backingStoreSize)) + return false; + + SharedMemory::Handle notSelectedBackingStoreHandle; + if (!decoder->decode(notSelectedBackingStoreHandle)) + return false; + d.m_notSelectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, notSelectedBackingStoreHandle); + + SharedMemory::Handle selectedBackingStoreHandle; + if (!decoder->decode(selectedBackingStoreHandle)) + return false; + d.m_selectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, selectedBackingStoreHandle); + + data = d; +#endif + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.h b/Source/WebKit2/Shared/PlatformPopupMenuData.h new file mode 100644 index 0000000..88e03fc --- /dev/null +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.h @@ -0,0 +1,60 @@ +/* + * 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 PlatformPopupMenuData_h +#define PlatformPopupMenuData_h + +#include "ShareableBitmap.h" +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct PlatformPopupMenuData { + PlatformPopupMenuData(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, PlatformPopupMenuData&); + +#if PLATFORM(WIN) + int m_clientPaddingLeft; + int m_clientPaddingRight; + int m_clientInsetLeft; + int m_clientInsetRight; + int m_popupWidth; + int m_itemHeight; + WebCore::IntSize m_backingStoreSize; + RefPtr<ShareableBitmap> m_notSelectedBackingStore; + RefPtr<ShareableBitmap> m_selectedBackingStore; +#endif +}; + +} // namespace WebKit + +#endif // PlatformPopupMenuData_h diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp new file mode 100644 index 0000000..51dd6be --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "NPIdentifierData.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "NotImplemented.h" +#include "WebCoreArgumentCoders.h" +#include <WebCore/IdentifierRep.h> + +using namespace WebCore; + +namespace WebKit { + +NPIdentifierData::NPIdentifierData() + : m_isString(false) + , m_number(0) +{ +} + + +NPIdentifierData NPIdentifierData::fromNPIdentifier(NPIdentifier npIdentifier) +{ + NPIdentifierData npIdentifierData; + + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(npIdentifier); + npIdentifierData.m_isString = identifierRep->isString(); + + if (npIdentifierData.m_isString) + npIdentifierData.m_string = identifierRep->string(); + else + npIdentifierData.m_number = identifierRep->number(); + + return npIdentifierData; +} + +NPIdentifier NPIdentifierData::createNPIdentifier() const +{ + if (m_isString) + return static_cast<NPIdentifier>(IdentifierRep::get(m_string.data())); + + return static_cast<NPIdentifier>(IdentifierRep::get(m_number)); +} + +void NPIdentifierData::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_isString); + if (m_isString) + encoder->encode(m_string); + else + encoder->encodeInt32(m_number); +} + +bool NPIdentifierData::decode(CoreIPC::ArgumentDecoder* decoder, NPIdentifierData& result) +{ + if (!decoder->decode(result.m_isString)) + return false; + + if (result.m_isString) + return decoder->decode(result.m_string); + + return decoder->decodeInt32(result.m_number); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.h b/Source/WebKit2/Shared/Plugins/NPIdentifierData.h new file mode 100644 index 0000000..dbe979e --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.h @@ -0,0 +1,63 @@ +/* + * 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 NPIdentifierData_h +#define NPIdentifierData_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <WebCore/npruntime.h> +#include <wtf/text/CString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +// The CoreIPC representation of an NPIdentifier. + +class NPIdentifierData { +public: + NPIdentifierData(); + + static NPIdentifierData fromNPIdentifier(NPIdentifier); + NPIdentifier createNPIdentifier() const; + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, NPIdentifierData&); + +private: + bool m_isString; + CString m_string; + int m_number; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // NPIdentifierData_h diff --git a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp new file mode 100644 index 0000000..013d849 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp @@ -0,0 +1,245 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "NPObjectMessageReceiver.h" + +#include "NPIdentifierData.h" +#include "NPRemoteObjectMap.h" +#include "NPRuntimeUtilities.h" +#include "NPVariantData.h" + +// FIXME: This code shouldn't know about NPJSObject. +#include "NPJSObject.h" + +namespace WebKit { + +PassOwnPtr<NPObjectMessageReceiver> NPObjectMessageReceiver::create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID, NPObject* npObject) +{ + return adoptPtr(new NPObjectMessageReceiver(npRemoteObjectMap, npObjectID, npObject)); +} + +NPObjectMessageReceiver::NPObjectMessageReceiver(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID, NPObject* npObject) + : m_npRemoteObjectMap(npRemoteObjectMap) + , m_npObjectID(npObjectID) + , m_npObject(npObject) + , m_shouldReleaseObjectWhenInvalidating(!NPJSObject::isNPJSObject(npObject)) +{ + retainNPObject(m_npObject); +} + +NPObjectMessageReceiver::~NPObjectMessageReceiver() +{ + m_npRemoteObjectMap->unregisterNPObject(m_npObjectID); + + // If we're invalidating the remote object map, we don't always want to release the underlying NPObject. + // One example of this is NPJSObjects in the Web process, which have already been deallocated by the plug-in view. + // FIXME: This is not the ideal way to handle this. Maybe NPObjectMessageReceiver should be notified somehow when the underlying + // NPObject is deallocated. + if (m_npRemoteObjectMap->isInvalidating() && !m_shouldReleaseObjectWhenInvalidating) + return; + + releaseNPObject(m_npObject); +} + +void NPObjectMessageReceiver::deallocate() +{ + delete this; +} + +void NPObjectMessageReceiver::hasMethod(const NPIdentifierData& methodNameData, bool& returnValue) +{ + if (!m_npObject->_class->hasMethod) { + returnValue = false; + return; + } + + returnValue = m_npObject->_class->hasMethod(m_npObject, methodNameData.createNPIdentifier()); +} + +void NPObjectMessageReceiver::invoke(const NPIdentifierData& methodNameData, const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData) +{ + if (!m_npObject->_class->invoke) { + returnValue = false; + return; + } + + Vector<NPVariant> arguments; + for (size_t i = 0; i < argumentsData.size(); ++i) + arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i])); + + NPVariant result; + VOID_TO_NPVARIANT(result); + + returnValue = m_npObject->_class->invoke(m_npObject, methodNameData.createNPIdentifier(), arguments.data(), arguments.size(), &result); + if (returnValue) { + // Convert the NPVariant to an NPVariantData. + resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result); + } + + // Release all arguments. + for (size_t i = 0; i < argumentsData.size(); ++i) + releaseNPVariantValue(&arguments[i]); + + // And release the result. + releaseNPVariantValue(&result); +} + +void NPObjectMessageReceiver::invokeDefault(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData) +{ + if (!m_npObject->_class->invokeDefault) { + returnValue = false; + return; + } + + Vector<NPVariant> arguments; + for (size_t i = 0; i < argumentsData.size(); ++i) + arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i])); + + NPVariant result; + VOID_TO_NPVARIANT(result); + + returnValue = m_npObject->_class->invokeDefault(m_npObject, arguments.data(), arguments.size(), &result); + if (returnValue) { + // Convert the NPVariant to an NPVariantData. + resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result); + } + + // Release all arguments. + for (size_t i = 0; i < argumentsData.size(); ++i) + releaseNPVariantValue(&arguments[i]); + + // And release the result. + releaseNPVariantValue(&result); +} + +void NPObjectMessageReceiver::hasProperty(const NPIdentifierData& propertyNameData, bool& returnValue) +{ + if (!m_npObject->_class->hasProperty) { + returnValue = false; + return; + } + + returnValue = m_npObject->_class->hasProperty(m_npObject, propertyNameData.createNPIdentifier()); +} + +void NPObjectMessageReceiver::getProperty(const NPIdentifierData& propertyNameData, bool& returnValue, NPVariantData& resultData) +{ + if (!m_npObject->_class->getProperty) { + returnValue = false; + return; + } + + NPVariant result; + returnValue = m_npObject->_class->getProperty(m_npObject, propertyNameData.createNPIdentifier(), &result); + if (!returnValue) + return; + + // Convert the NPVariant to an NPVariantData. + resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result); + + // And release the result. + releaseNPVariantValue(&result); +} + +void NPObjectMessageReceiver::setProperty(const NPIdentifierData& propertyNameData, const NPVariantData& propertyValueData, bool& returnValue) +{ + if (!m_npObject->_class->setProperty) { + returnValue = false; + return; + } + + NPVariant propertyValue = m_npRemoteObjectMap->npVariantDataToNPVariant(propertyValueData); + + // Set the property. + returnValue = m_npObject->_class->setProperty(m_npObject, propertyNameData.createNPIdentifier(), &propertyValue); + + // And release the value. + releaseNPVariantValue(&propertyValue); +} + +void NPObjectMessageReceiver::removeProperty(const NPIdentifierData& propertyNameData, bool& returnValue) +{ + if (!m_npObject->_class->removeProperty) { + returnValue = false; + return; + } + + returnValue = m_npObject->_class->removeProperty(m_npObject, propertyNameData.createNPIdentifier()); +} + +void NPObjectMessageReceiver::enumerate(bool& returnValue, Vector<NPIdentifierData>& identifiersData) +{ + if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(m_npObject->_class) || !m_npObject->_class->enumerate) { + returnValue = false; + return; + } + + NPIdentifier* identifiers = 0; + uint32_t identifierCount = 0; + + returnValue = m_npObject->_class->enumerate(m_npObject, &identifiers, &identifierCount); + if (!returnValue) + return; + + for (uint32_t i = 0; i < identifierCount; ++i) + identifiersData.append(NPIdentifierData::fromNPIdentifier(identifiers[i])); + + npnMemFree(identifiers); +} + +void NPObjectMessageReceiver::construct(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData) +{ + if (!NP_CLASS_STRUCT_VERSION_HAS_CTOR(m_npObject->_class) || !m_npObject->_class->construct) { + returnValue = false; + return; + } + + Vector<NPVariant> arguments; + for (size_t i = 0; i < argumentsData.size(); ++i) + arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i])); + + NPVariant result; + VOID_TO_NPVARIANT(result); + + returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), arguments.size(), &result); + if (returnValue) { + // Convert the NPVariant to an NPVariantData. + resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result); + } + + // Release all arguments. + for (size_t i = 0; i < argumentsData.size(); ++i) + releaseNPVariantValue(&arguments[i]); + + // And release the result. + releaseNPVariantValue(&result); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + diff --git a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h new file mode 100644 index 0000000..cfb66e1 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h @@ -0,0 +1,79 @@ +/* + * 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 NPObjectMessageReceiver_h +#define NPObjectMessageReceiver_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include <WebCore/npruntime.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +class NPIdentifierData; +class NPRemoteObjectMap; +class NPVariantData; + +class NPObjectMessageReceiver { + WTF_MAKE_NONCOPYABLE(NPObjectMessageReceiver); + +public: + static PassOwnPtr<NPObjectMessageReceiver> create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID, NPObject* npObject); + ~NPObjectMessageReceiver(); + + CoreIPC::SyncReplyMode didReceiveSyncNPObjectMessageReceiverMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + NPObject* npObject() const { return m_npObject; } + +private: + NPObjectMessageReceiver(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID, NPObject* npObject); + + // Message handlers. + void deallocate(); + void hasMethod(const NPIdentifierData&, bool& returnValue); + void invoke(const NPIdentifierData&, const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData); + void invokeDefault(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData); + void hasProperty(const NPIdentifierData&, bool& returnValue); + void getProperty(const NPIdentifierData&, bool& returnValue, NPVariantData& resultData); + void setProperty(const NPIdentifierData&, const NPVariantData& propertyValueData, bool& returnValue); + void removeProperty(const NPIdentifierData&, bool& returnValue); + void enumerate(bool& returnValue, Vector<NPIdentifierData>& identifiersData); + void construct(const Vector<NPVariantData>& argumentsData, bool& returnValue, NPVariantData& resultData); + + NPRemoteObjectMap* m_npRemoteObjectMap; + uint64_t m_npObjectID; + NPObject* m_npObject; + bool m_shouldReleaseObjectWhenInvalidating; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + + +#endif // NPObjectMessageReceiver_h diff --git a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in new file mode 100644 index 0000000..d81ffc4 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in @@ -0,0 +1,38 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> NPObjectMessageReceiver { + Deallocate() -> () + HasMethod(WebKit::NPIdentifierData methodName) -> (bool returnValue) + Invoke(WebKit::NPIdentifierData methodName, Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData) + InvokeDefault(Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData) + HasProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue) + GetProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue, WebKit::NPVariantData resultData) + SetProperty(WebKit::NPIdentifierData propertyName, WebKit::NPVariantData propertyValueData) -> (bool returnValue) + RemoveProperty(WebKit::NPIdentifierData propertyName) -> (bool returnValue) + Enumerate() -> (bool returnValue, Vector<WebKit::NPIdentifierData> identifiersData) + Construct(Vector<WebKit::NPVariantData> argumentsData) -> (bool returnValue, WebKit::NPVariantData resultData) +} + +#endif diff --git a/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp new file mode 100644 index 0000000..e7fc47f --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp @@ -0,0 +1,340 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "NPObjectProxy.h" + +#include "ArgumentCoders.h" +#include "Connection.h" +#include "NPIdentifierData.h" +#include "NPObjectMessageReceiverMessages.h" +#include "NPRemoteObjectMap.h" +#include "NPRuntimeUtilities.h" +#include "NPVariantData.h" + +namespace WebKit { + +NPObjectProxy* NPObjectProxy::create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID) +{ + NPObjectProxy* npObjectProxy = toNPObjectProxy(createNPObject(0, npClass())); + npObjectProxy->initialize(npRemoteObjectMap, npObjectID); + + return npObjectProxy; +} + +NPObjectProxy::NPObjectProxy() + : m_npRemoteObjectMap(0) + , m_npObjectID(0) +{ +} + +NPObjectProxy::~NPObjectProxy() +{ + if (!m_npRemoteObjectMap) + return; + + m_npRemoteObjectMap->npObjectProxyDestroyed(this); + m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Deallocate(), Messages::NPObjectMessageReceiver::Deallocate::Reply(), m_npObjectID); +} + +bool NPObjectProxy::isNPObjectProxy(NPObject* npObject) +{ + return npObject->_class == npClass(); +} + +void NPObjectProxy::invalidate() +{ + ASSERT(m_npRemoteObjectMap); + + m_npRemoteObjectMap = 0; +} + +void NPObjectProxy::initialize(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID) +{ + ASSERT(!m_npRemoteObjectMap); + ASSERT(!m_npObjectID); + + ASSERT(npRemoteObjectMap); + ASSERT(npObjectID); + + m_npRemoteObjectMap = npRemoteObjectMap; + m_npObjectID = npObjectID; +} + +bool NPObjectProxy::hasMethod(NPIdentifier methodName) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData methodNameData = NPIdentifierData::fromNPIdentifier(methodName); + + bool returnValue = false; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::HasMethod(methodNameData), Messages::NPObjectMessageReceiver::HasMethod::Reply(returnValue), m_npObjectID)) + return false; + + return returnValue; +} + +bool NPObjectProxy::invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData methodNameData = NPIdentifierData::fromNPIdentifier(methodName); + Vector<NPVariantData> argumentsData; + for (uint32_t i = 0; i < argumentCount; ++i) + argumentsData.append(m_npRemoteObjectMap->npVariantToNPVariantData(arguments[i])); + + bool returnValue = false; + NPVariantData resultData; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Invoke(methodNameData, argumentsData), Messages::NPObjectMessageReceiver::Invoke::Reply(returnValue, resultData), m_npObjectID)) + return false; + + if (!returnValue) + return false; + + *result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData); + return true; +} + +bool NPObjectProxy::invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (!m_npRemoteObjectMap) + return false; + + Vector<NPVariantData> argumentsData; + for (uint32_t i = 0; i < argumentCount; ++i) + argumentsData.append(m_npRemoteObjectMap->npVariantToNPVariantData(arguments[i])); + + bool returnValue = false; + NPVariantData resultData; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::InvokeDefault(argumentsData), Messages::NPObjectMessageReceiver::InvokeDefault::Reply(returnValue, resultData), m_npObjectID)) + return false; + + if (!returnValue) + return false; + + *result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData); + return true; +} + +bool NPObjectProxy::hasProperty(NPIdentifier propertyName) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName); + + bool returnValue = false; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::HasProperty(propertyNameData), Messages::NPObjectMessageReceiver::HasProperty::Reply(returnValue), m_npObjectID)) + return false; + + return returnValue; +} + +bool NPObjectProxy::getProperty(NPIdentifier propertyName, NPVariant* result) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName); + + bool returnValue = false; + NPVariantData resultData; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::GetProperty(propertyNameData), Messages::NPObjectMessageReceiver::GetProperty::Reply(returnValue, resultData), m_npObjectID)) + return false; + + if (!returnValue) + return false; + + *result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData); + return true; +} + +bool NPObjectProxy::setProperty(NPIdentifier propertyName, const NPVariant* value) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName); + NPVariantData propertyValueData = m_npRemoteObjectMap->npVariantToNPVariantData(*value); + + bool returnValue = false; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::SetProperty(propertyNameData, propertyValueData), Messages::NPObjectMessageReceiver::SetProperty::Reply(returnValue), m_npObjectID)) + return false; + + return returnValue; +} + +bool NPObjectProxy::removeProperty(NPIdentifier propertyName) +{ + if (!m_npRemoteObjectMap) + return false; + + NPIdentifierData propertyNameData = NPIdentifierData::fromNPIdentifier(propertyName); + + bool returnValue = false; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::RemoveProperty(propertyNameData), Messages::NPObjectMessageReceiver::RemoveProperty::Reply(returnValue), m_npObjectID)) + return false; + + return returnValue; +} + +bool NPObjectProxy::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount) +{ + if (!m_npRemoteObjectMap) + return false; + + bool returnValue; + Vector<NPIdentifierData> identifiersData; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Enumerate(), Messages::NPObjectMessageReceiver::Enumerate::Reply(returnValue, identifiersData), m_npObjectID)) + return false; + + if (!returnValue) + return false; + + NPIdentifier* nameIdentifiers = npnMemNewArray<NPIdentifier>(identifiersData.size()); + + for (size_t i = 0; i < identifiersData.size(); ++i) + nameIdentifiers[i] = identifiersData[i].createNPIdentifier(); + + *identifiers = nameIdentifiers; + *identifierCount = identifiersData.size(); + return true; +} + +bool NPObjectProxy::construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (!m_npRemoteObjectMap) + return false; + + Vector<NPVariantData> argumentsData; + for (uint32_t i = 0; i < argumentCount; ++i) + argumentsData.append(m_npRemoteObjectMap->npVariantToNPVariantData(arguments[i])); + + bool returnValue = false; + NPVariantData resultData; + + if (!m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Construct(argumentsData), Messages::NPObjectMessageReceiver::Construct::Reply(returnValue, resultData), m_npObjectID)) + return false; + + if (!returnValue) + return false; + + *result = m_npRemoteObjectMap->npVariantDataToNPVariant(resultData); + return true; +} + +NPClass* NPObjectProxy::npClass() +{ + static NPClass npClass = { + NP_CLASS_STRUCT_VERSION, + NP_Allocate, + NP_Deallocate, + 0, + NP_HasMethod, + NP_Invoke, + NP_InvokeDefault, + NP_HasProperty, + NP_GetProperty, + NP_SetProperty, + NP_RemoveProperty, + NP_Enumerate, + NP_Construct + }; + + return &npClass; +} + +NPObject* NPObjectProxy::NP_Allocate(NPP npp, NPClass*) +{ + ASSERT_UNUSED(npp, !npp); + + return new NPObjectProxy; +} + +void NPObjectProxy::NP_Deallocate(NPObject* npObject) +{ + NPObjectProxy* npObjectProxy = toNPObjectProxy(npObject); + delete npObjectProxy; +} + +bool NPObjectProxy::NP_HasMethod(NPObject* npObject, NPIdentifier methodName) +{ + return toNPObjectProxy(npObject)->hasMethod(methodName); +} + +bool NPObjectProxy::NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPObjectProxy(npObject)->invoke(methodName, arguments, argumentCount, result); +} + +bool NPObjectProxy::NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPObjectProxy(npObject)->invokeDefault(arguments, argumentCount, result); +} + +bool NPObjectProxy::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName) +{ + return toNPObjectProxy(npObject)->hasProperty(propertyName); +} + +bool NPObjectProxy::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result) +{ + return toNPObjectProxy(npObject)->getProperty(propertyName, result); +} + +bool NPObjectProxy::NP_SetProperty(NPObject* npObject, NPIdentifier propertyName, const NPVariant* value) +{ + return toNPObjectProxy(npObject)->setProperty(propertyName, value); +} + +bool NPObjectProxy::NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) +{ + return toNPObjectProxy(npObject)->removeProperty(propertyName); +} + +bool NPObjectProxy::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount) +{ + return toNPObjectProxy(npObject)->enumerate(identifiers, identifierCount); +} + +bool NPObjectProxy::NP_Construct(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPObjectProxy(npObject)->construct(arguments, argumentCount, result); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/NPObjectProxy.h b/Source/WebKit2/Shared/Plugins/NPObjectProxy.h new file mode 100644 index 0000000..e4c00c5 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPObjectProxy.h @@ -0,0 +1,93 @@ +/* + * 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 NPObjectProxy_h +#define NPObjectProxy_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <WebCore/npruntime.h> +#include <wtf/Noncopyable.h> + +namespace WebKit { + +class NPRemoteObjectMap; + +class NPObjectProxy : public NPObject { + WTF_MAKE_NONCOPYABLE(NPObjectProxy); + +public: + static NPObjectProxy* create(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID); + + static bool isNPObjectProxy(NPObject*); + + static NPObjectProxy* toNPObjectProxy(NPObject* npObject) + { + ASSERT(isNPObjectProxy(npObject)); + return static_cast<NPObjectProxy*>(npObject); + } + + uint64_t npObjectID() const { return m_npObjectID; } + + void invalidate(); + +private: + NPObjectProxy(); + ~NPObjectProxy(); + + void initialize(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID); + + bool hasMethod(NPIdentifier methodName); + bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + bool invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + bool hasProperty(NPIdentifier propertyName); + bool getProperty(NPIdentifier propertyName, NPVariant* result); + bool setProperty(NPIdentifier propertyName, const NPVariant* value); + bool removeProperty(NPIdentifier propertyName); + bool enumerate(NPIdentifier** identifiers, uint32_t* identifierCount); + bool construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + + static NPClass* npClass(); + static NPObject* NP_Allocate(NPP, NPClass*); + static void NP_Deallocate(NPObject*); + static bool NP_HasMethod(NPObject*, NPIdentifier methodName); + static bool NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + static bool NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + static bool NP_HasProperty(NPObject*, NPIdentifier propertyName); + static bool NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result); + static bool NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value); + static bool NP_RemoveProperty(NPObject*, NPIdentifier propertyName); + static bool NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount); + static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + + NPRemoteObjectMap* m_npRemoteObjectMap; + uint64_t m_npObjectID; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // NPObjectProxy_h diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp new file mode 100644 index 0000000..5fea618 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp @@ -0,0 +1,221 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "NPRemoteObjectMap.h" + +#include "NPObjectMessageReceiver.h" +#include "NPObjectProxy.h" +#include "NPRuntimeUtilities.h" +#include "NPVariantData.h" +#include "NotImplemented.h" +#include <wtf/OwnPtr.h> + +namespace WebKit { + +static uint64_t generateNPObjectID() +{ + static uint64_t generateNPObjectID; + return ++generateNPObjectID; +} + +PassRefPtr<NPRemoteObjectMap> NPRemoteObjectMap::create(CoreIPC::Connection* connection) +{ + return adoptRef(new NPRemoteObjectMap(connection)); +} + +NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection) + : m_connection(connection) + , m_isInvalidating(false) +{ +} + +NPRemoteObjectMap::~NPRemoteObjectMap() +{ + ASSERT(m_npObjectProxies.isEmpty()); + ASSERT(m_registeredNPObjects.isEmpty()); +} + +NPObject* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID) +{ + NPObjectProxy* npObjectProxy = NPObjectProxy::create(this, remoteObjectID); + + m_npObjectProxies.add(npObjectProxy); + + return npObjectProxy; +} + +void NPRemoteObjectMap::npObjectProxyDestroyed(NPObject* npObject) +{ + ASSERT(NPObjectProxy::isNPObjectProxy(npObject)); + ASSERT(m_npObjectProxies.contains(npObject)); + + m_npObjectProxies.remove(npObject); +} + +uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject) +{ + uint64_t npObjectID = generateNPObjectID(); + m_registeredNPObjects.set(npObjectID, NPObjectMessageReceiver::create(this, npObjectID, npObject).leakPtr()); + + return npObjectID; +} + +void NPRemoteObjectMap::unregisterNPObject(uint64_t npObjectID) +{ + m_registeredNPObjects.remove(npObjectID); +} + +NPVariantData NPRemoteObjectMap::npVariantToNPVariantData(const NPVariant& variant) +{ + switch (variant.type) { + case NPVariantType_Void: + return NPVariantData::makeVoid(); + + case NPVariantType_Null: + return NPVariantData::makeNull(); + + case NPVariantType_Bool: + return NPVariantData::makeBool(variant.value.boolValue); + + case NPVariantType_Int32: + return NPVariantData::makeInt32(variant.value.intValue); + + case NPVariantType_Double: + return NPVariantData::makeDouble(variant.value.doubleValue); + + case NPVariantType_String: + return NPVariantData::makeString(variant.value.stringValue.UTF8Characters, variant.value.stringValue.UTF8Length); + + case NPVariantType_Object: { + NPObject* npObject = variant.value.objectValue; + if (NPObjectProxy::isNPObjectProxy(npObject)) { + NPObjectProxy* npObjectProxy = NPObjectProxy::toNPObjectProxy(npObject); + + uint64_t npObjectID = npObjectProxy->npObjectID(); + + // FIXME: Under some circumstances, this might leak the NPObjectProxy object. + // Figure out how to avoid that. + retainNPObject(npObjectProxy); + return NPVariantData::makeRemoteNPObjectID(npObjectID); + } + + uint64_t npObjectID = registerNPObject(npObject); + return NPVariantData::makeLocalNPObjectID(npObjectID); + } + + } + + ASSERT_NOT_REACHED(); + return NPVariantData::makeVoid(); +} + +NPVariant NPRemoteObjectMap::npVariantDataToNPVariant(const NPVariantData& npVariantData) +{ + NPVariant npVariant; + + switch (npVariantData.type()) { + case NPVariantData::Void: + VOID_TO_NPVARIANT(npVariant); + break; + case NPVariantData::Null: + NULL_TO_NPVARIANT(npVariant); + break; + case NPVariantData::Bool: + BOOLEAN_TO_NPVARIANT(npVariantData.boolValue(), npVariant); + break; + case NPVariantData::Int32: + INT32_TO_NPVARIANT(npVariantData.int32Value(), npVariant); + break; + case NPVariantData::Double: + DOUBLE_TO_NPVARIANT(npVariantData.doubleValue(), npVariant); + break; + case NPVariantData::String: { + NPString npString = createNPString(npVariantData.stringValue()); + STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, npVariant); + break; + } + case NPVariantData::LocalNPObjectID: { + uint64_t npObjectID = npVariantData.localNPObjectIDValue(); + ASSERT(npObjectID); + + NPObjectMessageReceiver* npObjectMessageReceiver = m_registeredNPObjects.get(npObjectID); + if (!npObjectMessageReceiver) { + ASSERT_NOT_REACHED(); + VOID_TO_NPVARIANT(npVariant); + break; + } + + NPObject* npObject = npObjectMessageReceiver->npObject(); + ASSERT(npObject); + + retainNPObject(npObject); + OBJECT_TO_NPVARIANT(npObject, npVariant); + break; + } + case NPVariantData::RemoteNPObjectID: { + NPObject* npObjectProxy = createNPObjectProxy(npVariantData.remoteNPObjectIDValue()); + OBJECT_TO_NPVARIANT(npObjectProxy, npVariant); + break; + } + } + + return npVariant; +} + +void NPRemoteObjectMap::invalidate() +{ + ASSERT(!m_isInvalidating); + + m_isInvalidating = true; + + Vector<NPObjectMessageReceiver*> messageReceivers; + copyValuesToVector(m_registeredNPObjects, messageReceivers); + + // Now delete all the receivers. + deleteAllValues(messageReceivers); + + ASSERT(m_registeredNPObjects.isEmpty()); + + for (HashSet<NPObject*>::const_iterator it = m_npObjectProxies.begin(), end = m_npObjectProxies.end(); it != end; ++it) + NPObjectProxy::toNPObjectProxy(*it)->invalidate(); + m_npObjectProxies.clear(); + + m_isInvalidating = false; +} + +CoreIPC::SyncReplyMode NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(arguments->destinationID()); + if (!messageReceiver) + return CoreIPC::AutomaticReply; + + return messageReceiver->didReceiveSyncNPObjectMessageReceiverMessage(connection, messageID, arguments, reply); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.h new file mode 100644 index 0000000..ff0bbbb --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.h @@ -0,0 +1,87 @@ +/* + * 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 NPRemoteObjectMap_h +#define NPRemoteObjectMap_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include <WebCore/npruntime.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class NPObjectMessageReceiver; +class NPObjectProxy; +class NPVariantData; + +class NPRemoteObjectMap : public RefCounted<NPRemoteObjectMap> { +public: + static PassRefPtr<NPRemoteObjectMap> create(CoreIPC::Connection*); + ~NPRemoteObjectMap(); + + // Creates an NPObjectProxy wrapper for the remote object with the given remote object ID. + NPObject* createNPObjectProxy(uint64_t remoteObjectID); + void npObjectProxyDestroyed(NPObject*); + + // Expose the given NPObject as a remote object. Returns the objectID. + uint64_t registerNPObject(NPObject*); + void unregisterNPObject(uint64_t); + + // Given an NPVariant, creates an NPVariantData object (a CoreIPC representation of an NPVariant). + NPVariantData npVariantToNPVariantData(const NPVariant&); + + // Given an NPVariantData, creates an NPVariant object. + NPVariant npVariantDataToNPVariant(const NPVariantData&); + + CoreIPC::Connection* connection() const { return m_connection; } + bool isInvalidating() const { return m_isInvalidating; } + + void invalidate(); + + CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply); + +private: + explicit NPRemoteObjectMap(CoreIPC::Connection*); + CoreIPC::Connection* m_connection; + + bool m_isInvalidating; + + // A map of NPObjectMessageReceiver classes, wrapping objects that we export to the + // other end of the connection. + HashMap<uint64_t, NPObjectMessageReceiver*> m_registeredNPObjects; + + // A set of NPObjectProxy objects associated with this map. + HashSet<NPObject*> m_npObjectProxies; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // NPRemoteObjectMap_h diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp new file mode 100644 index 0000000..b100589 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp @@ -0,0 +1,190 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "NPVariantData.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "NotImplemented.h" +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +NPVariantData::NPVariantData() + : m_type(NPVariantData::Void) + , m_boolValue(false) + , m_int32Value(0) + , m_doubleValue(0) + , m_localNPObjectIDValue(0) + , m_remoteNPObjectIDValue(0) +{ +} + +NPVariantData NPVariantData::makeVoid() +{ + return NPVariantData(); +} + +NPVariantData NPVariantData::makeNull() +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::Null; + + return npVariantData; +} + +NPVariantData NPVariantData::makeBool(bool value) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::Bool; + npVariantData.m_boolValue = value; + + return npVariantData; +} + +NPVariantData NPVariantData::makeInt32(int32_t value) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::Int32; + npVariantData.m_int32Value = value; + + return npVariantData; +} + +NPVariantData NPVariantData::makeDouble(double value) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::Double; + npVariantData.m_doubleValue = value; + + return npVariantData; +} + +NPVariantData NPVariantData::makeString(const char* string, unsigned length) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::String; + npVariantData.m_stringValue = CString(string, length); + + return npVariantData; +} + +NPVariantData NPVariantData::makeLocalNPObjectID(uint64_t value) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::LocalNPObjectID; + npVariantData.m_localNPObjectIDValue = value; + + return npVariantData; +} + +NPVariantData NPVariantData::makeRemoteNPObjectID(uint64_t value) +{ + NPVariantData npVariantData; + + npVariantData.m_type = NPVariantData::RemoteNPObjectID; + npVariantData.m_remoteNPObjectIDValue = value; + + return npVariantData; +} + +void NPVariantData::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_type); + + switch (type()) { + case NPVariantData::Void: + case NPVariantData::Null: + break; + case NPVariantData::Bool: + encoder->encode(boolValue()); + break; + case NPVariantData::Int32: + encoder->encode(int32Value()); + break; + case NPVariantData::Double: + encoder->encode(doubleValue()); + break; + case NPVariantData::String: + encoder->encode(stringValue()); + break; + case NPVariantData::LocalNPObjectID: + encoder->encode(localNPObjectIDValue()); + break; + case NPVariantData::RemoteNPObjectID: + encoder->encode(remoteNPObjectIDValue()); + break; + } +} + +bool NPVariantData::decode(CoreIPC::ArgumentDecoder* decoder, NPVariantData& result) +{ + uint32_t type; + if (!decoder->decode(type)) + return false; + + // We special-case LocalNPObjectID and RemoteNPObjectID here so a LocalNPObjectID is + // decoded as a RemoteNPObjectID and vice versa. + // This is done because the type is from the perspective of the other connection, and + // thus we have to adjust it to match our own perspective. + if (type == NPVariantData::LocalNPObjectID) + type = NPVariantData::RemoteNPObjectID; + else if (type == NPVariantData::RemoteNPObjectID) + type = NPVariantData::LocalNPObjectID; + + result.m_type = type; + + switch (result.m_type) { + case NPVariantData::Void: + case NPVariantData::Null: + return true; + case NPVariantData::Bool: + return decoder->decode(result.m_boolValue); + case NPVariantData::Int32: + return decoder->decode(result.m_int32Value); + case NPVariantData::Double: + return decoder->decode(result.m_doubleValue); + case NPVariantData::String: + return decoder->decode(result.m_stringValue); + case NPVariantData::LocalNPObjectID: + return decoder->decode(result.m_localNPObjectIDValue); + case NPVariantData::RemoteNPObjectID: + return decoder->decode(result.m_remoteNPObjectIDValue); + } + + return false; +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.h b/Source/WebKit2/Shared/Plugins/NPVariantData.h new file mode 100644 index 0000000..805640e --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.h @@ -0,0 +1,120 @@ +/* + * 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 NPVariantData_h +#define NPVariantData_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <wtf/text/CString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +// The CoreIPC representation of an NPVariant. + +class NPVariantData { +public: + enum Type { + Void, + Null, + Bool, + Int32, + Double, + String, + LocalNPObjectID, + RemoteNPObjectID, + }; + NPVariantData(); + + static NPVariantData makeVoid(); + static NPVariantData makeNull(); + static NPVariantData makeBool(bool value); + static NPVariantData makeInt32(int32_t value); + static NPVariantData makeDouble(double value); + static NPVariantData makeString(const char* string, unsigned length); + static NPVariantData makeLocalNPObjectID(uint64_t value); + static NPVariantData makeRemoteNPObjectID(uint64_t value); + + Type type() const { return static_cast<Type>(m_type); } + + bool boolValue() const + { + ASSERT(type() == NPVariantData::Bool); + return m_boolValue; + } + + int32_t int32Value() const + { + ASSERT(type() == NPVariantData::Int32); + return m_int32Value; + } + + double doubleValue() const + { + ASSERT(type() == NPVariantData::Double); + return m_doubleValue; + } + + const CString& stringValue() const + { + ASSERT(type() == NPVariantData::String); + return m_stringValue; + } + + uint64_t localNPObjectIDValue() const + { + ASSERT(type() == NPVariantData::LocalNPObjectID); + return m_localNPObjectIDValue; + } + + uint64_t remoteNPObjectIDValue() const + { + ASSERT(type() == NPVariantData::RemoteNPObjectID); + return m_remoteNPObjectIDValue; + } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, NPVariantData&); + +private: + uint32_t m_type; + bool m_boolValue; + int32_t m_int32Value; + double m_doubleValue; + CString m_stringValue; + uint64_t m_localNPObjectIDValue; + uint64_t m_remoteNPObjectIDValue; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // NPVariantData_h diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp new file mode 100644 index 0000000..fec00b3 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePluginModule.h" + +#include "Module.h" +#include "NetscapeBrowserFuncs.h" +#include <wtf/PassOwnPtr.h> + +namespace WebKit { + +static Vector<NetscapePluginModule*>& initializedNetscapePluginModules() +{ + DEFINE_STATIC_LOCAL(Vector<NetscapePluginModule*>, initializedNetscapePluginModules, ()); + return initializedNetscapePluginModules; +} + +NetscapePluginModule::NetscapePluginModule(const String& pluginPath) + : m_pluginPath(pluginPath) + , m_isInitialized(false) + , m_pluginCount(0) + , m_shutdownProcPtr(0) + , m_pluginFuncs() +{ +} + +NetscapePluginModule::~NetscapePluginModule() +{ + ASSERT(initializedNetscapePluginModules().find(this) == notFound); +} + +void NetscapePluginModule::pluginCreated() +{ + if (!m_pluginCount) { + // Load the plug-in module if necessary. + load(); + } + + m_pluginCount++; +} + +void NetscapePluginModule::pluginDestroyed() +{ + ASSERT(m_pluginCount > 0); + m_pluginCount--; + + if (!m_pluginCount) { + shutdown(); + unload(); + } +} + +void NetscapePluginModule::shutdown() +{ + ASSERT(m_isInitialized); + + m_shutdownProcPtr(); + + m_isInitialized = false; + + size_t pluginModuleIndex = initializedNetscapePluginModules().find(this); + ASSERT(pluginModuleIndex != notFound); + + initializedNetscapePluginModules().remove(pluginModuleIndex); +} + +PassRefPtr<NetscapePluginModule> NetscapePluginModule::getOrCreate(const String& pluginPath) +{ + // First, see if we already have a module with this plug-in path. + for (size_t i = 0; i < initializedNetscapePluginModules().size(); ++i) { + NetscapePluginModule* pluginModule = initializedNetscapePluginModules()[i]; + + if (pluginModule->m_pluginPath == pluginPath) + return pluginModule; + } + + RefPtr<NetscapePluginModule> pluginModule(adoptRef(new NetscapePluginModule(pluginPath))); + + // Try to load and initialize the plug-in module. + if (!pluginModule->load()) + return 0; + + return pluginModule.release(); +} + +bool NetscapePluginModule::load() +{ + if (m_isInitialized) { + ASSERT(initializedNetscapePluginModules().find(this) != notFound); + return true; + } + + if (!tryLoad()) { + unload(); + return false; + } + + m_isInitialized = true; + + ASSERT(initializedNetscapePluginModules().find(this) == notFound); + initializedNetscapePluginModules().append(this); + + determineQuirks(); + + return true; +} + +bool NetscapePluginModule::tryLoad() +{ + m_module = adoptPtr(new Module(m_pluginPath)); + if (!m_module->load()) + return false; + + NP_InitializeFuncPtr initializeFuncPtr = m_module->functionPointer<NP_InitializeFuncPtr>("NP_Initialize"); + if (!initializeFuncPtr) + return false; + + NP_GetEntryPointsFuncPtr getEntryPointsFuncPtr = m_module->functionPointer<NP_GetEntryPointsFuncPtr>("NP_GetEntryPoints"); + if (!getEntryPointsFuncPtr) + return false; + + m_shutdownProcPtr = m_module->functionPointer<NPP_ShutdownProcPtr>("NP_Shutdown"); + if (!m_shutdownProcPtr) + return false; + + m_pluginFuncs.size = sizeof(NPPluginFuncs); + m_pluginFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; + + // On Mac, NP_Initialize must be called first, then NP_GetEntryPoints. On Windows, the order is + // reversed. Failing to follow this order results in crashes (e.g., in Silverlight on Mac and + // in Flash and QuickTime on Windows). +#if PLATFORM(MAC) + if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR || getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR) + return false; +#elif PLATFORM(WIN) + if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR || initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR) + return false; +#endif + + return true; +} + +void NetscapePluginModule::unload() +{ + ASSERT(!m_isInitialized); + + m_module = 0; +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h new file mode 100644 index 0000000..a245b11 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h @@ -0,0 +1,81 @@ +/* + * 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 NetscapePluginModule_h +#define NetscapePluginModule_h + +#include "Module.h" +#include "PluginQuirks.h" +#include <WebCore/npfunctions.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +// FIXME: We should not include PluginInfoStore.h here. Instead, +// PluginInfoStore::Plugin should be moved out into its own header which we can +// put in Shared/Plugins. +#include "PluginInfoStore.h" + +namespace WebKit { + +class NetscapePluginModule : public RefCounted<NetscapePluginModule> { +public: + static PassRefPtr<NetscapePluginModule> getOrCreate(const String& pluginPath); + ~NetscapePluginModule(); + + const NPPluginFuncs& pluginFuncs() const { return m_pluginFuncs; } + + void pluginCreated(); + void pluginDestroyed(); + + static bool getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin&); + + const PluginQuirks& pluginQuirks() const { return m_pluginQuirks; } + +private: + explicit NetscapePluginModule(const String& pluginPath); + + void determineQuirks(); + + bool tryLoad(); + bool load(); + void unload(); + + void shutdown(); + + String m_pluginPath; + bool m_isInitialized; + unsigned m_pluginCount; + + PluginQuirks m_pluginQuirks; + + NPP_ShutdownProcPtr m_shutdownProcPtr; + NPPluginFuncs m_pluginFuncs; + + OwnPtr<Module> m_module; +}; + +} // namespace WebKit + +#endif // NetscapePluginModule_h diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm new file mode 100644 index 0000000..6ecacf0 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -0,0 +1,338 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePluginModule.h" + +#include <WebCore/WebCoreNSStringExtras.h> +#include <wtf/HashSet.h> + +using namespace WebCore; + +namespace WebKit { + +static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitecture) +{ + RetainPtr<CFArrayRef> pluginArchitecturesArray(AdoptCF, CFBundleCopyExecutableArchitectures(bundle)); + if (!pluginArchitecturesArray) + return false; + + // Turn the array into a set. + HashSet<unsigned> architectures; + for (CFIndex i = 0, numPluginArchitectures = CFArrayGetCount(pluginArchitecturesArray.get()); i < numPluginArchitectures; ++i) { + CFNumberRef number = static_cast<CFNumberRef>(CFArrayGetValueAtIndex(pluginArchitecturesArray.get(), i)); + + SInt32 architecture; + if (!CFNumberGetValue(number, kCFNumberSInt32Type, &architecture)) + continue; + architectures.add(architecture); + } + +#ifdef __x86_64__ + // We only support 64-bit Intel plug-ins on 64-bit Intel. + if (architectures.contains(kCFBundleExecutableArchitectureX86_64)) { + pluginArchitecture = CPU_TYPE_X86_64; + return true; + } + + // We also support 32-bit Intel plug-ins on 64-bit Intel. + if (architectures.contains(kCFBundleExecutableArchitectureI386)) { + pluginArchitecture = CPU_TYPE_X86; + return true; + } +#elif defined(__i386__) + // We only support 32-bit Intel plug-ins on 32-bit Intel. + if (architectures.contains(kCFBundleExecutableArchitectureI386)) { + pluginArchitecture = CPU_TYPE_X86; + return true; + } +#elif defined(__ppc64__) + // We only support 64-bit PPC plug-ins on 64-bit PPC. + if (architectures.contains(kCFBundleExecutableArchitecturePPC64)) { + pluginArchitecture = CPU_TYPE_POWERPC64; + return true; + } +#elif defined(__ppc__) + // We only support 32-bit PPC plug-ins on 32-bit PPC. + if (architectures.contains(kCFBundleExecutableArchitecturePPC)) { + pluginArchitecture = CPU_TYPE_POWERPC; + return true; + } +#else +#error "Unhandled architecture" +#endif + + return false; +} + +static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& pluginInfo) +{ + // FIXME: Handle WebPluginMIMETypesFilenameKey. + + CFDictionaryRef mimeTypes = static_cast<CFDictionaryRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypes"))); + if (!mimeTypes || CFGetTypeID(mimeTypes) != CFDictionaryGetTypeID()) + return false; + + // Get the plug-in name. + CFStringRef pluginName = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginName"))); + if (pluginName && CFGetTypeID(pluginName) == CFStringGetTypeID()) + pluginInfo.name = pluginName; + + // Get the plug-in description. + CFStringRef pluginDescription = static_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginDescription"))); + if (pluginDescription && CFGetTypeID(pluginDescription) == CFStringGetTypeID()) + pluginInfo.desc = pluginDescription; + + // Get the MIME type mapping dictionary. + CFIndex numMimeTypes = CFDictionaryGetCount(mimeTypes); + Vector<CFStringRef> mimeTypesVector(numMimeTypes); + Vector<CFDictionaryRef> mimeTypeInfoVector(numMimeTypes); + CFDictionaryGetKeysAndValues(mimeTypes, reinterpret_cast<const void**>(mimeTypesVector.data()), reinterpret_cast<const void**>(mimeTypeInfoVector.data())); + + for (CFIndex i = 0; i < numMimeTypes; ++i) { + MimeClassInfo mimeClassInfo; + + // If this MIME type is invalid, ignore it. + CFStringRef mimeType = mimeTypesVector[i]; + if (!mimeType || CFGetTypeID(mimeType) != CFStringGetTypeID() || CFStringGetLength(mimeType) == 0) + continue; + + // If this MIME type doesn't have a valid info dictionary, ignore it. + CFDictionaryRef mimeTypeInfo = mimeTypeInfoVector[i]; + if (!mimeTypeInfo || CFGetTypeID(mimeTypeInfo) != CFDictionaryGetTypeID()) + continue; + + // Get the MIME type description. + CFStringRef mimeTypeDescription = static_cast<CFStringRef>(CFDictionaryGetValue(mimeTypeInfo, CFSTR("WebPluginTypeDescription"))); + if (mimeTypeDescription && CFGetTypeID(mimeTypeDescription) != CFStringGetTypeID()) + mimeTypeDescription = 0; + + mimeClassInfo.type = String(mimeType).lower(); + mimeClassInfo.desc = mimeTypeDescription; + + // Now get the extensions for this MIME type. + CFIndex numExtensions = 0; + CFArrayRef extensionsArray = static_cast<CFArrayRef>(CFDictionaryGetValue(mimeTypeInfo, CFSTR("WebPluginExtensions"))); + if (extensionsArray && CFGetTypeID(extensionsArray) == CFArrayGetTypeID()) + numExtensions = CFArrayGetCount(extensionsArray); + + for (CFIndex i = 0; i < numExtensions; ++i) { + CFStringRef extension = static_cast<CFStringRef>(CFArrayGetValueAtIndex(extensionsArray, i)); + if (!extension || CFGetTypeID(extension) != CFStringGetTypeID()) + continue; + + mimeClassInfo.extensions.append(String(extension).lower()); + } + + // Add this MIME type. + pluginInfo.mimes.append(mimeClassInfo); + } + + return true; +} + +class ResourceMap { +public: + explicit ResourceMap(CFBundleRef bundle) + : m_bundle(bundle) + , m_currentResourceFile(CurResFile()) + , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle)) + { + UseResFile(m_bundleResourceMap); + } + + ~ResourceMap() + { + // Close the resource map. + CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap); + + // And restore the old resource. + UseResFile(m_currentResourceFile); + } + + bool isValid() const { return m_bundleResourceMap != -1; } + +private: + CFBundleRef m_bundle; + ResFileRefNum m_currentResourceFile; + ResFileRefNum m_bundleResourceMap; +}; + +static bool getStringListResource(ResID resourceID, Vector<String>& stringList) { + Handle stringListHandle = Get1Resource('STR#', resourceID); + if (!stringListHandle || !*stringListHandle) + return false; + + // Get the string list size. + Size stringListSize = GetHandleSize(stringListHandle); + if (stringListSize < static_cast<Size>(sizeof(UInt16))) + return false; + + CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle); + + unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle); + unsigned char* end = ptr + stringListSize; + + // Get the number of strings in the string list. + UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr); + ptr += sizeof(UInt16); + + for (UInt16 i = 0; i < numStrings; ++i) { + // We're past the end of the string, bail. + if (ptr >= end) + return false; + + // Get the string length. + unsigned char stringLength = *ptr++; + + RetainPtr<CFStringRef> cfString(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull)); + if (!cfString.get()) + return false; + + stringList.append(cfString.get()); + ptr += stringLength; + } + + if (ptr != end) + return false; + + return true; +} + +static const ResID PluginNameOrDescriptionStringNumber = 126; +static const ResID MIMEDescriptionStringNumber = 127; +static const ResID MIMEListStringStringNumber = 128; + +static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo) +{ + ResourceMap resourceMap(bundle); + if (!resourceMap.isValid()) + return false; + + // Get the description and name string list. + Vector<String> descriptionAndName; + if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName)) + return false; + + // Get the MIME types and extensions string list. This list needs to be a multiple of two. + Vector<String> mimeTypesAndExtensions; + if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions)) + return false; + + if (mimeTypesAndExtensions.size() % 2) + return false; + + size_t numMimeTypes = mimeTypesAndExtensions.size() / 2; + + // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types. + Vector<String> mimeTypeDescriptions; + if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions)) + return false; + + if (mimeTypeDescriptions.size() != numMimeTypes) + return false; + + // Add all MIME types. + for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) { + MimeClassInfo mimeClassInfo; + + const String& mimeType = mimeTypesAndExtensions[i * 2]; + const String& description = mimeTypeDescriptions[i]; + + mimeClassInfo.type = mimeType.lower(); + mimeClassInfo.desc = description; + + Vector<String> extensions; + mimeTypesAndExtensions[i * 2 + 1].split(',', extensions); + + for (size_t i = 0; i < extensions.size(); ++i) + mimeClassInfo.extensions.append(extensions[i].lower()); + + pluginInfo.mimes.append(mimeClassInfo); + } + + // Set the description and name if they exist. + if (descriptionAndName.size() > 0) + pluginInfo.desc = descriptionAndName[0]; + if (descriptionAndName.size() > 1) + pluginInfo.name = descriptionAndName[1]; + + return true; +} + +bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin) +{ + RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString()); + RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, false)); + + // Try to initialize the bundle. + RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get())); + if (!bundle) + return false; + + // Check if this bundle is an NPAPI plug-in. + UInt32 packageType = 0; + CFBundleGetPackageInfo(bundle.get(), &packageType, 0); + if (packageType != FOUR_CHAR_CODE('BRPL')) + return false; + + // Check that the architecture is valid. + cpu_type_t pluginArchitecture = 0; + if (!getPluginArchitecture(bundle.get(), pluginArchitecture)) + return false; + + // Check that there's valid info for this plug-in. + if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) && + !getPluginInfoFromCarbonResources(bundle.get(), plugin.info)) + return false; + + plugin.path = pluginPath; + plugin.pluginArchitecture = pluginArchitecture; + plugin.bundleIdentifier = CFBundleGetIdentifier(bundle.get()); + plugin.versionNumber = CFBundleGetVersionNumber(bundle.get()); + + RetainPtr<CFStringRef> filename(AdoptCF, CFURLCopyLastPathComponent(bundleURL.get())); + plugin.info.file = filename.get(); + + if (plugin.info.name.isNull()) + plugin.info.name = plugin.info.file; + if (plugin.info.desc.isNull()) + plugin.info.desc = plugin.info.file; + + return true; +} + +void NetscapePluginModule::determineQuirks() +{ + PluginInfoStore::Plugin plugin; + if (!getPluginInfo(m_pluginPath, plugin)) + return; + + if (plugin.bundleIdentifier == "com.macromedia.Flash Player.plugin") { + // Flash requires that the return value of getprogname() be "WebKitPluginHost". + m_pluginQuirks.add(PluginQuirks::PrognameShouldBeWebKitPluginHost); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp new file mode 100644 index 0000000..f969ba4 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePluginModule.h" + +#include <WebCore/FileSystem.h> +#include <wtf/OwnArrayPtr.h> + +using namespace WebCore; + +namespace WebKit { + +static String getVersionInfo(const LPVOID versionInfoData, const String& info) +{ + LPVOID buffer; + UINT bufferLength; + String subInfo = "\\StringfileInfo\\040904E4\\" + info; + if (!::VerQueryValueW(versionInfoData, const_cast<UChar*>(subInfo.charactersWithNullTermination()), &buffer, &bufferLength) || !bufferLength) + return String(); + + // Subtract 1 from the length; we don't want the trailing null character. + return String(reinterpret_cast<UChar*>(buffer), bufferLength - 1); +} + +static uint64_t fileVersion(DWORD leastSignificant, DWORD mostSignificant) +{ + ULARGE_INTEGER version; + version.LowPart = leastSignificant; + version.HighPart = mostSignificant; + return version.QuadPart; +} + +bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin) +{ + String pathCopy = pluginPath; + DWORD versionInfoSize = ::GetFileVersionInfoSizeW(pathCopy.charactersWithNullTermination(), 0); + if (!versionInfoSize) + return false; + + OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]); + if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get())) + return false; + + String name = getVersionInfo(versionInfoData.get(), "ProductName"); + String description = getVersionInfo(versionInfoData.get(), "FileDescription"); + if (name.isNull() || description.isNull()) + return false; + + VS_FIXEDFILEINFO* info; + UINT infoSize; + if (!::VerQueryValueW(versionInfoData.get(), L"\\", reinterpret_cast<void**>(&info), &infoSize) || infoSize < sizeof(VS_FIXEDFILEINFO)) + return false; + + Vector<String> types; + getVersionInfo(versionInfoData.get(), "MIMEType").split('|', types); + Vector<String> extensionLists; + getVersionInfo(versionInfoData.get(), "FileExtents").split('|', extensionLists); + Vector<String> descriptions; + getVersionInfo(versionInfoData.get(), "FileOpenName").split('|', descriptions); + + Vector<MimeClassInfo> mimes(types.size()); + for (size_t i = 0; i < types.size(); i++) { + String type = types[i].lower(); + String description = i < descriptions.size() ? descriptions[i] : ""; + String extensionList = i < extensionLists.size() ? extensionLists[i] : ""; + + Vector<String> extensionsVector; + extensionList.split(',', extensionsVector); + + // Get rid of the extension list that may be at the end of the description string. + int pos = description.find("(*"); + if (pos != -1) { + // There might be a space that we need to get rid of. + if (pos > 1 && description[pos - 1] == ' ') + pos--; + description = description.left(pos); + } + + mimes[i].type = type; + mimes[i].desc = description; + mimes[i].extensions.swap(extensionsVector); + } + + plugin.path = pluginPath; + plugin.info.desc = description; + plugin.info.name = name; + plugin.info.file = pathGetFileName(pluginPath); + plugin.info.mimes.swap(mimes); + plugin.fileVersion = fileVersion(info->dwFileVersionLS, info->dwFileVersionMS); + + return true; +} + +void NetscapePluginModule::determineQuirks() +{ +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp new file mode 100644 index 0000000..a02cdad --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePluginModule.h" + +#include "PluginDatabase.h" +#include "PluginPackage.h" + +using namespace WebCore; + +namespace WebKit { + +bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin) +{ + // We are loading the plugin here since it does not seem to be a standardized way to + // get the needed informations from a UNIX plugin without loading it. + + RefPtr<PluginPackage> package = PluginPackage::createPackage(pluginPath, 0 /*lastModified*/); + if (!package) + return false; + + plugin.path = pluginPath; + plugin.info.desc = package->description(); + plugin.info.file = package->fileName(); + + const MIMEToDescriptionsMap& descriptions = package->mimeToDescriptions(); + const MIMEToExtensionsMap& extensions = package->mimeToExtensions(); + MIMEToDescriptionsMap::const_iterator descEnd = descriptions.end(); + plugin.info.mimes.reserveCapacity(descriptions.size()); + unsigned i = 0; + for (MIMEToDescriptionsMap::const_iterator it = descriptions.begin(); it != descEnd; ++it) { + plugin.info.mimes.uncheckedAppend(MimeClassInfo()); + MimeClassInfo& mime = plugin.info.mimes[i++]; + mime.type = it->first; + mime.desc = it->second; + MIMEToExtensionsMap::const_iterator extensionIt = extensions.find(it->first); + ASSERT(extensionIt != extensions.end()); + mime.extensions = extensionIt->second; + } + + package->unload(); + return true; +} + +void NetscapePluginModule::determineQuirks() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp new file mode 100644 index 0000000..90bbf07 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -0,0 +1,63 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessCreationParameters.h" + +#include "ArgumentCoders.h" + +namespace WebKit { + +PluginProcessCreationParameters::PluginProcessCreationParameters() +{ +} + +void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(pluginPath); + +#if PLATFORM(MAC) + encoder->encode(acceleratedCompositingPort); +#endif +} + +bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginProcessCreationParameters::PluginProcessCreationParameters& result) +{ + if (!decoder->decode(result.pluginPath)) + return false; + +#if PLATFORM(MAC) + if (!decoder->decode(result.acceleratedCompositingPort)) + return false; +#endif + + return true; +} + + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h new file mode 100644 index 0000000..1aeef01 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h @@ -0,0 +1,61 @@ +/* + * 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 PluginProcessCreationParameters_h +#define PluginProcessCreationParameters_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <wtf/text/WTFString.h> + +#if PLATFORM(MAC) +#include "MachPort.h" +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct PluginProcessCreationParameters { + PluginProcessCreationParameters(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&); + + String pluginPath; + +#if PLATFORM(MAC) + CoreIPC::MachPort acceleratedCompositingPort; +#endif +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessCreationParameters_h diff --git a/Source/WebKit2/Shared/Plugins/PluginQuirks.h b/Source/WebKit2/Shared/Plugins/PluginQuirks.h new file mode 100644 index 0000000..8dd3a74 --- /dev/null +++ b/Source/WebKit2/Shared/Plugins/PluginQuirks.h @@ -0,0 +1,69 @@ +/* + * 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 PluginQuirks_h +#define PluginQuirks_h + +namespace WebKit { + +class PluginQuirks { +public: + enum PluginQuirk { + // Mac specific quirks: +#if PLATFORM(MAC) + // The plug-in wants the call to getprogame() to return "WebKitPluginHost". + // Adobe Flash Will not handle key down events otherwise. + PrognameShouldBeWebKitPluginHost, +#endif + + NumPluginQuirks + }; + + PluginQuirks() + : m_quirks(0) + { + COMPILE_ASSERT(sizeof(m_quirks) * 8 >= NumPluginQuirks, not_enough_room_for_quirks); + } + + void add(PluginQuirk quirk) + { + ASSERT(quirk >= 0); + ASSERT(quirk < NumPluginQuirks); + + m_quirks |= (1 << quirk); + } + + bool contains(PluginQuirk quirk) const + { + return m_quirks & (1 << quirk); + } + +private: + uint32_t m_quirks; +}; + +} // namespace WebKit + +#endif // PluginQuirkSet_h diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp new file mode 100644 index 0000000..2a9c5e0 --- /dev/null +++ b/Source/WebKit2/Shared/PrintInfo.cpp @@ -0,0 +1,51 @@ +/* + * 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 "PrintInfo.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Arguments.h" + +namespace WebKit { + +PrintInfo::PrintInfo() + : pageSetupScaleFactor(0) + , availablePaperWidth(0) + , availablePaperHeight(0) +{ +} + +void PrintInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(pageSetupScaleFactor, availablePaperWidth, availablePaperHeight)); +} + +bool PrintInfo::decode(CoreIPC::ArgumentDecoder* decoder, PrintInfo& info) +{ + return decoder->decode(CoreIPC::Out(info.pageSetupScaleFactor, info.availablePaperWidth, info.availablePaperHeight)); +} + +} diff --git a/Source/WebKit2/Shared/PrintInfo.h b/Source/WebKit2/Shared/PrintInfo.h new file mode 100644 index 0000000..d6ccd4a --- /dev/null +++ b/Source/WebKit2/Shared/PrintInfo.h @@ -0,0 +1,58 @@ +/* + * 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 PrintInfo_h +#define PrintInfo_h + +#include <wtf/Platform.h> + +#ifdef __OBJC__ +@class NSPrintInfo; +#else +class NSPrintInfo; +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct PrintInfo { + PrintInfo(); + explicit PrintInfo(NSPrintInfo *); + + float pageSetupScaleFactor; + float availablePaperWidth; + float availablePaperHeight; + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, PrintInfo&); +}; + +} + +#endif diff --git a/Source/WebKit2/Shared/SameDocumentNavigationType.h b/Source/WebKit2/Shared/SameDocumentNavigationType.h new file mode 100644 index 0000000..41a6fc2 --- /dev/null +++ b/Source/WebKit2/Shared/SameDocumentNavigationType.h @@ -0,0 +1,40 @@ +/* + * 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 SameDocumentNavigationType_h +#define SameDocumentNavigationType_h + +namespace WebKit { + +enum SameDocumentNavigationType { + SameDocumentNavigationAnchorNavigation, + SameDocumentNavigationSessionStatePush, + SameDocumentNavigationSessionStateReplace, + SameDocumentNavigationSessionStatePop +}; + +} // namespace WebKit + +#endif // SameDocumentNavigationType_h diff --git a/Source/WebKit2/Shared/SandboxExtension.h b/Source/WebKit2/Shared/SandboxExtension.h new file mode 100644 index 0000000..0dfcab0 --- /dev/null +++ b/Source/WebKit2/Shared/SandboxExtension.h @@ -0,0 +1,105 @@ +/* + * 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 SandboxExtension_h +#define SandboxExtension_h + +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +#if ENABLE(WEB_PROCESS_SANDBOX) +typedef struct __WKSandboxExtension* WKSandboxExtensionRef; +#endif + +namespace CoreIPC { + class ArgumentEncoder; + class ArgumentDecoder; +} + +namespace WebKit { + +class SandboxExtension : public RefCounted<SandboxExtension> { +public: + enum Type { + ReadOnly, + WriteOnly, + ReadWrite, + }; + + class Handle { + WTF_MAKE_NONCOPYABLE(Handle); + + public: + Handle(); + ~Handle(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Handle&); + + private: + friend class SandboxExtension; +#if ENABLE(WEB_PROCESS_SANDBOX) + mutable WKSandboxExtensionRef m_sandboxExtension; +#endif + }; + + static PassRefPtr<SandboxExtension> create(const Handle&); + static void createHandle(const String& path, Type type, Handle&); + static String createHandleForTemporaryFile(const String& prefix, Type type, Handle&); + ~SandboxExtension(); + + bool invalidate(); + bool consume(); + bool consumePermanently(); + +private: + explicit SandboxExtension(const Handle&); + +#if ENABLE(WEB_PROCESS_SANDBOX) + mutable WKSandboxExtensionRef m_sandboxExtension; +#endif +}; + +#if !ENABLE(WEB_PROCESS_SANDBOX) +inline SandboxExtension::Handle::Handle() { } +inline SandboxExtension::Handle::~Handle() { } +inline void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder*) const { } +inline bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder*, Handle&) { return true; } +inline PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle&) { return 0; } +inline void SandboxExtension::createHandle(const String& path, Type type, Handle&) { } +inline String SandboxExtension::createHandleForTemporaryFile(const String& prefix, Type type, Handle&) {return String();} +inline SandboxExtension::~SandboxExtension() { } +inline bool SandboxExtension::invalidate() { return true; } +inline bool SandboxExtension::consume() { return true; } +inline bool SandboxExtension::consumePermanently() { return true; } +#endif + +} // namespace WebKit + + +#endif // SandboxExtension_h diff --git a/Source/WebKit2/Shared/SelectionState.h b/Source/WebKit2/Shared/SelectionState.h new file mode 100644 index 0000000..2ce0e9c --- /dev/null +++ b/Source/WebKit2/Shared/SelectionState.h @@ -0,0 +1,70 @@ +/* + * 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 SelectionState_h +#define SelectionState_h + +#include "ArgumentCoders.h" +#include <wtf/NotFound.h> + +namespace WebKit { + +struct SelectionState { + SelectionState() + : isNone(true) + , isContentEditable(false) + , isInPasswordField(false) + , hasComposition(false) + , selectedRangeStart(notFound) + , selectedRangeLength(0) + { + } + + // Whether there is a selection at all. This will be false when there is a caret selection. + bool isNone; + + // Whether the selection is in a content editable area. + bool isContentEditable; + + // Whether the selection is in a password field. + bool isInPasswordField; + + // Whether the selection has a composition. + bool hasComposition; + + // The start of the selected range. + uint64_t selectedRangeStart; + + // The length of the selected range. + uint64_t selectedRangeLength; +}; + +} // namespace WebKit + +namespace CoreIPC { +template<> struct ArgumentCoder<WebKit::SelectionState> : SimpleArgumentCoder<WebKit::SelectionState> { }; +}; + +#endif // SelectionState_h diff --git a/Source/WebKit2/Shared/SessionState.cpp b/Source/WebKit2/Shared/SessionState.cpp new file mode 100644 index 0000000..109805f --- /dev/null +++ b/Source/WebKit2/Shared/SessionState.cpp @@ -0,0 +1,81 @@ +/* + * 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 "SessionState.h" + +namespace CoreIPC { + +// This assumes that when we encode a RefPtr we want to encode the object it points to and it is never null. +template<typename T> struct ArgumentCoder<RefPtr<T> > { + static void encode(ArgumentEncoder* encoder, const RefPtr<T>& item) + { + item->encode(*encoder); + } + + static bool decode(ArgumentDecoder* decoder, RefPtr<T>& item) + { + item = T::decode(*decoder); + return item; + } +}; + +} // namespace CoreIPC + +namespace WebKit { + +SessionState::SessionState() + : m_currentIndex(0) +{ +} + +SessionState::SessionState(const BackForwardListItemVector& list, uint32_t currentIndex) + : m_list(list) + , m_currentIndex(currentIndex) +{ +} + +bool SessionState::isEmpty() const +{ + // Because this might change later, callers should use this instead of + // calling list().isEmpty() directly themselves. + return m_list.isEmpty(); +} + +void SessionState::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_list); + encoder->encode(m_currentIndex); +} + +bool SessionState::decode(CoreIPC::ArgumentDecoder* decoder, SessionState& state) +{ + if (!decoder->decode(state.m_list)) + return false; + if (!decoder->decode(state.m_currentIndex)) + return false; + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/SessionState.h b/Source/WebKit2/Shared/SessionState.h new file mode 100644 index 0000000..8aa1894 --- /dev/null +++ b/Source/WebKit2/Shared/SessionState.h @@ -0,0 +1,58 @@ +/* + * 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 SessionState_h +#define SessionState_h + +#include "WebBackForwardList.h" + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class SessionState { +public: + SessionState(); + SessionState(const BackForwardListItemVector&, uint32_t currentIndex); + + const BackForwardListItemVector& list() const { return m_list; } + uint32_t currentIndex() const { return m_currentIndex; } + + bool isEmpty() const; + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, SessionState&); + +private: + BackForwardListItemVector m_list; + uint32_t m_currentIndex; +}; + +} // namespace WebKit + +#endif // SessionState_h diff --git a/Source/WebKit2/Shared/ShareableBitmap.cpp b/Source/WebKit2/Shared/ShareableBitmap.cpp new file mode 100644 index 0000000..90fa0d8 --- /dev/null +++ b/Source/WebKit2/Shared/ShareableBitmap.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ShareableBitmap.h" + +#include "SharedMemory.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<ShareableBitmap> ShareableBitmap::create(const WebCore::IntSize& size) +{ + size_t numBytes = numBytesForSize(size); + + void* data = 0; + if (!tryFastMalloc(numBytes).getValue(data)) + return 0; + + return adoptRef(new ShareableBitmap(size, data)); +} + +PassRefPtr<ShareableBitmap> ShareableBitmap::createShareable(const IntSize& size) +{ + size_t numBytes = numBytesForSize(size); + + RefPtr<SharedMemory> sharedMemory = SharedMemory::create(numBytes); + if (!sharedMemory) + return 0; + + return adoptRef(new ShareableBitmap(size, sharedMemory)); +} + +PassRefPtr<ShareableBitmap> ShareableBitmap::create(const WebCore::IntSize& size, const SharedMemory::Handle& handle) +{ + // Create the shared memory. + RefPtr<SharedMemory> sharedMemory = SharedMemory::create(handle, SharedMemory::ReadWrite); + if (!sharedMemory) + return 0; + + size_t numBytes = numBytesForSize(size); + ASSERT_UNUSED(numBytes, sharedMemory->size() >= numBytes); + + return adoptRef(new ShareableBitmap(size, sharedMemory)); +} + +bool ShareableBitmap::createHandle(SharedMemory::Handle& handle) +{ + ASSERT(isBackedBySharedMemory()); + + return m_sharedMemory->createHandle(handle, SharedMemory::ReadWrite); +} + +ShareableBitmap::ShareableBitmap(const IntSize& size, void* data) + : m_size(size) + , m_data(data) +{ +} + +ShareableBitmap::ShareableBitmap(const IntSize& size, PassRefPtr<SharedMemory> sharedMemory) + : m_size(size) + , m_sharedMemory(sharedMemory) + , m_data(0) +{ +} + +ShareableBitmap::~ShareableBitmap() +{ + if (!isBackedBySharedMemory()) + fastFree(m_data); +} + +bool ShareableBitmap::resize(const IntSize& size) +{ + // We can't resize backing stores that are backed by shared memory. + ASSERT(!isBackedBySharedMemory()); + + if (size == m_size) + return true; + + size_t newNumBytes = numBytesForSize(size); + + // Try to resize. + char* newData = 0; + if (!tryFastRealloc(m_data, newNumBytes).getValue(newData)) { + // We failed, but the backing store is still kept in a consistent state. + return false; + } + + m_size = size; + m_data = newData; + + return true; +} + +void* ShareableBitmap::data() const +{ + if (isBackedBySharedMemory()) + return m_sharedMemory->data(); + + ASSERT(m_data); + return m_data; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/ShareableBitmap.h b/Source/WebKit2/Shared/ShareableBitmap.h new file mode 100644 index 0000000..e44f4ad --- /dev/null +++ b/Source/WebKit2/Shared/ShareableBitmap.h @@ -0,0 +1,91 @@ +/* + * 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 ShareableBitmap_h +#define ShareableBitmap_h + +#include "SharedMemory.h" +#include <WebCore/IntRect.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class GraphicsContext; +} + +namespace WebKit { + +class ShareableBitmap : public RefCounted<ShareableBitmap> { +public: + // Create a shareable bitmap that uses malloced memory. + static PassRefPtr<ShareableBitmap> create(const WebCore::IntSize&); + + // Create a shareable bitmap whose backing memory can be shared with another process. + static PassRefPtr<ShareableBitmap> createShareable(const WebCore::IntSize&); + + // Create a shareable bitmap from a shared memory handle. + static PassRefPtr<ShareableBitmap> create(const WebCore::IntSize&, const SharedMemory::Handle&); + + // Create a shared memory handle. + bool createHandle(SharedMemory::Handle&); + + ~ShareableBitmap(); + + const WebCore::IntSize& size() const { return m_size; } + WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); } + + bool resize(const WebCore::IntSize& size); + + // Create a graphics context that can be used to paint into the backing store. + PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(); + + // Paint the backing store into the given context. + void paint(WebCore::GraphicsContext&, const WebCore::IntPoint& dstPoint, const WebCore::IntRect& srcRect); + + bool isBackedBySharedMemory() const { return m_sharedMemory; } + +private: + ShareableBitmap(const WebCore::IntSize&, void*); + ShareableBitmap(const WebCore::IntSize&, PassRefPtr<SharedMemory>); + + static size_t numBytesForSize(const WebCore::IntSize& size) { return size.width() * size.height() * 4; } + + void* data() const; + size_t sizeInBytes() const { return numBytesForSize(m_size); } + + WebCore::IntSize m_size; + + // If the shareable bitmap is backed by shared memory, this points to the shared memory object. + RefPtr<SharedMemory> m_sharedMemory; + + // If the shareable bitmap is backed by fastMalloced memory, this points to the data. + void* m_data; +}; + +} // namespace WebKit + +#endif // ShareableBitmap_h diff --git a/Source/WebKit2/Shared/StringPairVector.h b/Source/WebKit2/Shared/StringPairVector.h new file mode 100644 index 0000000..ce2da4a --- /dev/null +++ b/Source/WebKit2/Shared/StringPairVector.h @@ -0,0 +1,66 @@ +/* + * 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 StringPairVector_h +#define StringPairVector_h + +#include "ArgumentCoders.h" +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +// This class is a hack to work around the fact that the IPC message generator +// cannot deal with class templates with more than one paramter. +class StringPairVector { +public: + StringPairVector() + { + } + + StringPairVector(Vector<std::pair<String, String> > stringPairVector) + { + m_stringPairVector.swap(stringPairVector); + } + + void encode(CoreIPC::ArgumentEncoder* encoder) const + { + encoder->encode(m_stringPairVector); + } + + static bool decode(CoreIPC::ArgumentDecoder* decoder, StringPairVector& stringPairVector) + { + return decoder->decode(stringPairVector.m_stringPairVector); + } + + const Vector<std::pair<String, String> >& stringPairVector() const { return m_stringPairVector; } + +private: + Vector<std::pair<String, String> > m_stringPairVector; +}; + +} // namespace WebKit + +#endif // StringPairVector_h diff --git a/Source/WebKit2/Shared/TextCheckerState.h b/Source/WebKit2/Shared/TextCheckerState.h new file mode 100644 index 0000000..3bb5332 --- /dev/null +++ b/Source/WebKit2/Shared/TextCheckerState.h @@ -0,0 +1,52 @@ +/* + * 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 TextCheckerState_h +#define TextCheckerState_h + +#include "ArgumentCoders.h" + +namespace WebKit { + +struct TextCheckerState { + bool isContinuousSpellCheckingEnabled; + bool isGrammarCheckingEnabled; + +#if PLATFORM(MAC) + bool isAutomaticSpellingCorrectionEnabled; + bool isAutomaticQuoteSubstitutionEnabled; + bool isAutomaticDashSubstitutionEnabled; + bool isAutomaticLinkDetectionEnabled; + bool isAutomaticTextReplacementEnabled; +#endif +}; + +} // namespace WebKit + +namespace CoreIPC { +template<> struct ArgumentCoder<WebKit::TextCheckerState> : SimpleArgumentCoder<WebKit::TextCheckerState> { }; +}; + +#endif // TextCheckerState_h diff --git a/Source/WebKit2/Shared/UpdateInfo.cpp b/Source/WebKit2/Shared/UpdateInfo.cpp new file mode 100644 index 0000000..1b504ed --- /dev/null +++ b/Source/WebKit2/Shared/UpdateInfo.cpp @@ -0,0 +1,60 @@ +/* + * 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 "UpdateInfo.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(viewSize); + encoder->encode(scrollRect); + encoder->encode(scrollDelta); + encoder->encode(updateRectBounds); + encoder->encode(updateRects); + encoder->encode(bitmapHandle); +} + +bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result) +{ + if (!decoder->decode(result.viewSize)) + return false; + if (!decoder->decode(result.scrollRect)) + return false; + if (!decoder->decode(result.scrollDelta)) + return false; + if (!decoder->decode(result.updateRectBounds)) + return false; + if (!decoder->decode(result.updateRects)) + return false; + if (!decoder->decode(result.bitmapHandle)) + return false; + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/UpdateInfo.h b/Source/WebKit2/Shared/UpdateInfo.h new file mode 100644 index 0000000..850911c --- /dev/null +++ b/Source/WebKit2/Shared/UpdateInfo.h @@ -0,0 +1,68 @@ +/* + * 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 UpdateInfo_h +#define UpdateInfo_h + +#include "SharedMemory.h" +#include <WebCore/IntRect.h> +#include <wtf/Noncopyable.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class UpdateInfo { + WTF_MAKE_NONCOPYABLE(UpdateInfo); + +public: + UpdateInfo() { } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateInfo&); + + // The size of the web view. + WebCore::IntSize viewSize; + + // The rect and delta to be scrolled. + WebCore::IntRect scrollRect; + WebCore::IntSize scrollDelta; + + // The bounds of the update rects. + WebCore::IntRect updateRectBounds; + + // All the update rects, in view coordinates. + Vector<WebCore::IntRect> updateRects; + + // The handle of the shareable bitmap containing the updates. Will be null if there are no updates. + SharedMemory::Handle bitmapHandle; +}; + +} // namespace WebKit + +#endif // UpdateInfo_h diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h new file mode 100644 index 0000000..1326a98 --- /dev/null +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -0,0 +1,309 @@ +/* + * 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 UserMessageCoders_h +#define UserMessageCoders_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "ImmutableArray.h" +#include "ImmutableDictionary.h" +#include "ShareableBitmap.h" +#include "WebCoreArgumentCoders.h" +#include "WebImage.h" +#include "WebNumber.h" +#include "WebSerializedScriptValue.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebUserContentURLPattern.h" + +namespace WebKit { + +// - Null -> Null +// - Array -> Array +// - Dictionary -> Dictionary +// - SerializedScriptValue -> SerializedScriptValue +// - String -> String +// - UserContentURLPattern -> UserContentURLPattern +// - WebDouble -> WebDouble +// - WebImage -> WebImage +// - WebUInt64 -> WebUInt64 +// - WebURL -> WebURL + +template<typename Owner> +class UserMessageEncoder { +public: + bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type& type) const + { + if (!m_root) { + encoder->encodeUInt32(APIObject::TypeNull); + return true; + } + + type = m_root->type(); + encoder->encodeUInt32(type); + + switch (type) { + case APIObject::TypeArray: { + ImmutableArray* array = static_cast<ImmutableArray*>(m_root); + encoder->encode(static_cast<uint64_t>(array->size())); + for (size_t i = 0; i < array->size(); ++i) + encoder->encode(Owner(array->at(i))); + return true; + } + case APIObject::TypeDictionary: { + ImmutableDictionary* dictionary = static_cast<ImmutableDictionary*>(m_root); + const ImmutableDictionary::MapType& map = dictionary->map(); + encoder->encode(static_cast<uint64_t>(map.size())); + + ImmutableDictionary::MapType::const_iterator it = map.begin(); + ImmutableDictionary::MapType::const_iterator end = map.end(); + for (; it != end; ++it) { + encoder->encode(it->first); + encoder->encode(Owner(it->second.get())); + } + return true; + } + case APIObject::TypeString: { + WebString* string = static_cast<WebString*>(m_root); + encoder->encode(string->string()); + return true; + } + case APIObject::TypeSerializedScriptValue: { + WebSerializedScriptValue* scriptValue = static_cast<WebSerializedScriptValue*>(m_root); + encoder->encodeBytes(scriptValue->data().data(), scriptValue->data().size()); + return true; + } + case APIObject::TypeDouble: { + WebDouble* doubleObject = static_cast<WebDouble*>(m_root); + encoder->encode(doubleObject->value()); + return true; + } + case APIObject::TypeUInt64: { + WebUInt64* uint64Object = static_cast<WebUInt64*>(m_root); + encoder->encode(uint64Object->value()); + return true; + } + case APIObject::TypeBoolean: { + WebBoolean* booleanObject = static_cast<WebBoolean*>(m_root); + encoder->encode(booleanObject->value()); + return true; + } + case APIObject::TypeURL: { + WebURL* urlObject = static_cast<WebURL*>(m_root); + encoder->encode(urlObject->string()); + return true; + } + case APIObject::TypeUserContentURLPattern: { + WebUserContentURLPattern* urlPattern = static_cast<WebUserContentURLPattern*>(m_root); + encoder->encode(urlPattern->patternString()); + return true; + } + case APIObject::TypeImage: { + WebImage* image = static_cast<WebImage*>(m_root); + if (!image->bitmap()->isBackedBySharedMemory()) { + encoder->encode(false); + return true; + } + + SharedMemory::Handle handle; + if (!image->bitmap()->createHandle(handle)) + return false; + + encoder->encode(true); + + encoder->encode(image->size()); + encoder->encode(handle); + return true; + } + default: + break; + } + + return false; + } + +protected: + UserMessageEncoder(APIObject* root) + : m_root(root) + { + } + + APIObject* m_root; +}; + + +// Handles +// - Null -> Null +// - Array -> Array +// - Dictionary -> Dictionary +// - SerializedScriptValue -> SerializedScriptValue +// - String -> String +// - UserContentURLPattern -> UserContentURLPattern +// - WebDouble -> WebDouble +// - WebImage -> WebImage +// - WebUInt64 -> WebUInt64 +// - WebURL -> WebURL + +template<typename Owner> +class UserMessageDecoder { +public: + static bool baseDecode(CoreIPC::ArgumentDecoder* decoder, Owner& coder, APIObject::Type& type) + { + uint32_t typeAsUInt32; + if (!decoder->decode(typeAsUInt32)) + return false; + + type = static_cast<APIObject::Type>(typeAsUInt32); + + switch (type) { + case APIObject::TypeArray: { + uint64_t size; + if (!decoder->decode(size)) + return false; + + Vector<RefPtr<APIObject> > vector; + for (size_t i = 0; i < size; ++i) { + RefPtr<APIObject> element; + Owner messageCoder(coder, element); + if (!decoder->decode(messageCoder)) + return false; + vector.append(element.release()); + } + + coder.m_root = ImmutableArray::adopt(vector); + break; + } + case APIObject::TypeDictionary: { + uint64_t size; + if (!decoder->decode(size)) + return false; + + ImmutableDictionary::MapType map; + for (size_t i = 0; i < size; ++i) { + String key; + if (!decoder->decode(key)) + return false; + + RefPtr<APIObject> element; + Owner messageCoder(coder, element); + if (!decoder->decode(messageCoder)) + return false; + + std::pair<ImmutableDictionary::MapType::iterator, bool> result = map.set(key, element.release()); + if (!result.second) + return false; + } + + coder.m_root = ImmutableDictionary::adopt(map); + break; + } + case APIObject::TypeString: { + String string; + if (!decoder->decode(string)) + return false; + coder.m_root = WebString::create(string); + break; + } + case APIObject::TypeSerializedScriptValue: { + Vector<uint8_t> buffer; + if (!decoder->decodeBytes(buffer)) + return false; + coder.m_root = WebSerializedScriptValue::adopt(buffer); + break; + } + case APIObject::TypeDouble: { + double value; + if (!decoder->decode(value)) + return false; + coder.m_root = WebDouble::create(value); + break; + } + case APIObject::TypeUInt64: { + uint64_t value; + if (!decoder->decode(value)) + return false; + coder.m_root = WebUInt64::create(value); + break; + } + case APIObject::TypeBoolean: { + bool value; + if (!decoder->decode(value)) + return false; + coder.m_root = WebBoolean::create(value); + break; + } + case APIObject::TypeURL: { + String string; + if (!decoder->decode(string)) + return false; + coder.m_root = WebURL::create(string); + break; + } + case APIObject::TypeUserContentURLPattern: { + String string; + if (!decoder->decode(string)) + return false; + coder.m_root = WebUserContentURLPattern::create(string); + break; + } + case APIObject::TypeImage: { + bool didEncode = false; + if (!decoder->decode(didEncode)) + return false; + + if (!didEncode) + break; + + WebCore::IntSize size; + if (!decoder->decode(size)) + return false; + + SharedMemory::Handle handle; + if (!decoder->decode(handle)) + return false; + + coder.m_root = WebImage::create(ShareableBitmap::create(size, handle)); + return true; + } + default: + break; + } + + return true; + } + +protected: + UserMessageDecoder(RefPtr<APIObject>& root) + : m_root(root) + { + } + + RefPtr<APIObject>& m_root; +}; + +} // namespace WebKit + +#endif // UserMessageCoders_h diff --git a/Source/WebKit2/Shared/VisitedLinkTable.cpp b/Source/WebKit2/Shared/VisitedLinkTable.cpp new file mode 100644 index 0000000..746ec3e --- /dev/null +++ b/Source/WebKit2/Shared/VisitedLinkTable.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VisitedLinkTable.h" + +#include "SharedMemory.h" + +using namespace WebCore; + +namespace WebKit { + +VisitedLinkTable::VisitedLinkTable() + : m_tableSize(0) + , m_table(0) +{ +} + +VisitedLinkTable::~VisitedLinkTable() +{ +} + +static inline bool isPowerOf2(unsigned v) +{ + // Taken from http://www.cs.utk.edu/~vose/c-stuff/bithacks.html + + return !(v & (v - 1)) && v; +} + +void VisitedLinkTable::setSharedMemory(PassRefPtr<SharedMemory> sharedMemory) +{ + m_sharedMemory = sharedMemory; + + ASSERT(m_sharedMemory); + ASSERT(!(m_sharedMemory->size() % sizeof(LinkHash))); + + m_table = static_cast<LinkHash*>(m_sharedMemory->data()); + m_tableSize = m_sharedMemory->size() / sizeof(LinkHash); + ASSERT(isPowerOf2(m_tableSize)); + + m_tableSizeMask = m_tableSize - 1; +} + +static inline unsigned doubleHash(unsigned key) +{ + key = ~key + (key >> 23); + key ^= (key << 12); + key ^= (key >> 7); + key ^= (key << 2); + key ^= (key >> 20); + return key; +} + +bool VisitedLinkTable::addLinkHash(LinkHash linkHash) +{ + ASSERT(m_sharedMemory); + + int k = 0; + LinkHash* table = m_table; + int sizeMask = m_tableSizeMask; + unsigned h = static_cast<unsigned>(linkHash); + int i = h & sizeMask; + + LinkHash* entry; + while (1) { + entry = table + i; + + // Check if this bucket is empty. + if (!*entry) + break; + + // Check if the same link hash is in the table already. + if (*entry == linkHash) + return false; + + if (!k) + k = 1 | doubleHash(h); + i = (i + k) & sizeMask; + } + + *entry = linkHash; + return true; +} + +bool VisitedLinkTable::isLinkVisited(LinkHash linkHash) const +{ + if (!m_sharedMemory) + return false; + + int k = 0; + LinkHash* table = m_table; + int sizeMask = m_tableSizeMask; + unsigned h = static_cast<unsigned>(linkHash); + int i = h & sizeMask; + + LinkHash* entry; + while (1) { + entry = table + i; + + // Check if we've reached the end of the table. + if (!*entry) + break; + + if (*entry == linkHash) + return true; + + if (!k) + k = 1 | doubleHash(h); + i = (i + k) & sizeMask; + } + + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/VisitedLinkTable.h b/Source/WebKit2/Shared/VisitedLinkTable.h new file mode 100644 index 0000000..c7274c3 --- /dev/null +++ b/Source/WebKit2/Shared/VisitedLinkTable.h @@ -0,0 +1,61 @@ +/* + * 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 VisitedLinkTable_h +#define VisitedLinkTable_h + +#include <WebCore/LinkHash.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class SharedMemory; + +class VisitedLinkTable { +public: + VisitedLinkTable(); + ~VisitedLinkTable(); + + void setSharedMemory(PassRefPtr<SharedMemory>); + + // This should only be called from the UI process. + bool addLinkHash(WebCore::LinkHash); + + bool isLinkVisited(WebCore::LinkHash) const; + + SharedMemory* sharedMemory() const { return m_sharedMemory.get(); } + +private: + RefPtr<SharedMemory> m_sharedMemory; + + unsigned m_tableSize; + unsigned m_tableSizeMask; + WebCore::LinkHash* m_table; +}; + +} + +#endif // VisitedLinkTable_h diff --git a/Source/WebKit2/Shared/WebBackForwardListItem.cpp b/Source/WebKit2/Shared/WebBackForwardListItem.cpp new file mode 100644 index 0000000..07061e9 --- /dev/null +++ b/Source/WebKit2/Shared/WebBackForwardListItem.cpp @@ -0,0 +1,96 @@ +/* + * 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 + * 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 "WebBackForwardListItem.h" + +#include "DataReference.h" +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +static uint64_t highestUsedItemID = 0; + +WebBackForwardListItem::WebBackForwardListItem(const String& originalURL, const String& url, const String& title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID) + : m_originalURL(originalURL) + , m_url(url) + , m_title(title) + , m_itemID(itemID) +{ + if (m_itemID > highestUsedItemID) + highestUsedItemID = m_itemID; + + setBackForwardData(backForwardData, backForwardDataSize); +} + +WebBackForwardListItem::~WebBackForwardListItem() +{ +} + +uint64_t WebBackForwardListItem::highedUsedItemID() +{ + return highestUsedItemID; +} + +void WebBackForwardListItem::setBackForwardData(const uint8_t* data, size_t size) +{ + m_backForwardData.reserveCapacity(size); + m_backForwardData.append(data, size); +} + +void WebBackForwardListItem::encode(CoreIPC::ArgumentEncoder& encoder) const +{ + encoder.encode(m_originalURL); + encoder.encode(m_url); + encoder.encode(m_title); + encoder.encode(m_itemID); + encoder.encode(CoreIPC::DataReference(m_backForwardData.data(), m_backForwardData.size())); +} + +PassRefPtr<WebBackForwardListItem> WebBackForwardListItem::decode(CoreIPC::ArgumentDecoder& decoder) +{ + String originalURL; + if (!decoder.decode(originalURL)) + return 0; + + String url; + if (!decoder.decode(url)) + return 0; + + String title; + if (!decoder.decode(title)) + return 0; + + uint64_t itemID; + if (!decoder.decode(itemID)) + return 0; + + CoreIPC::DataReference data; + if (!decoder.decode(data)) + return 0; + + return create(originalURL, url, title, data.data(), data.size(), itemID); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebBackForwardListItem.h b/Source/WebKit2/Shared/WebBackForwardListItem.h new file mode 100644 index 0000000..2f34f5f --- /dev/null +++ b/Source/WebKit2/Shared/WebBackForwardListItem.h @@ -0,0 +1,84 @@ +/* + * 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 + * 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 WebBackForwardListItem_h +#define WebBackForwardListItem_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class WebBackForwardListItem : public APIObject { +public: + static const Type APIType = TypeBackForwardListItem; + + static PassRefPtr<WebBackForwardListItem> create(const String& originalURL, const String& url, const String& title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID) + { + return adoptRef(new WebBackForwardListItem(originalURL, url, title, backForwardData, backForwardDataSize, itemID)); + } + + virtual ~WebBackForwardListItem(); + + uint64_t itemID() const { return m_itemID; } + + void setOriginalURL(const String& originalURL) { m_originalURL = originalURL; } + const String& originalURL() const { return m_originalURL; } + + void setURL(const String& url) { m_url = url; } + const String& url() const { return m_url; } + + void setTitle(const String& title) { m_title = title; } + const String& title() const { return m_title; } + + void setBackForwardData(const uint8_t* buffer, size_t size); + const Vector<uint8_t>& backForwardData() const { return m_backForwardData; } + + void encode(CoreIPC::ArgumentEncoder&) const; + static PassRefPtr<WebBackForwardListItem> decode(CoreIPC::ArgumentDecoder&); + + static uint64_t highedUsedItemID(); + +private: + WebBackForwardListItem(const String& originalURL, const String& url, const String& title, const uint8_t* backForwardData, size_t backForwardDataSize, uint64_t itemID); + + virtual Type type() const { return APIType; } + + String m_originalURL; + String m_url; + String m_title; + uint64_t m_itemID; + Vector<uint8_t> m_backForwardData; +}; + +} // namespace WebKit + +#endif // WebBackForwardListItem_h diff --git a/Source/WebKit2/Shared/WebCertificateInfo.h b/Source/WebKit2/Shared/WebCertificateInfo.h new file mode 100644 index 0000000..84ff231 --- /dev/null +++ b/Source/WebKit2/Shared/WebCertificateInfo.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 WebCertificateInfo_h +#define WebCertificateInfo_h + +#include "APIObject.h" +#include "PlatformCertificateInfo.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebCertificateInfo : public APIObject { +public: + static const Type APIType = TypeCertificateInfo; + + static PassRefPtr<WebCertificateInfo> create(const PlatformCertificateInfo& info) + { + return adoptRef(new WebCertificateInfo(info)); + } + + const PlatformCertificateInfo& platformCertificateInfo() const { return m_platformCertificateInfo; } + +private: + explicit WebCertificateInfo(const PlatformCertificateInfo& info) + : m_platformCertificateInfo(info) + { + } + + virtual Type type() const { return APIType; } + + PlatformCertificateInfo m_platformCertificateInfo; +}; + +} // namespace WebKit + +#endif // WebCertificateInfo_h diff --git a/Source/WebKit2/Shared/WebContextMenuItem.cpp b/Source/WebKit2/Shared/WebContextMenuItem.cpp new file mode 100644 index 0000000..55fa70a --- /dev/null +++ b/Source/WebKit2/Shared/WebContextMenuItem.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuItem.h" + +#include "ImmutableArray.h" +#include <WebCore/ContextMenuItem.h> + +namespace WebKit { + +WebContextMenuItem::WebContextMenuItem(const WebContextMenuItemData& data) + : m_webContextMenuItemData(data) +{ +} + +PassRefPtr<WebContextMenuItem> WebContextMenuItem::create(const String& title, bool enabled, ImmutableArray* submenuItems) +{ + size_t size = submenuItems->size(); + + Vector<WebContextMenuItemData> submenu; + submenu.reserveCapacity(size); + + for (size_t i = 0; i < size; ++i) { + WebContextMenuItem* item = submenuItems->at<WebContextMenuItem>(i); + if (item) + submenu.append(*item->data()); + } + + return adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::ContextMenuItemTagNoAction, title, enabled, submenu))).leakRef(); +} + +WebContextMenuItem* WebContextMenuItem::separatorItem() +{ + static RefPtr<WebContextMenuItem> separatorItem = adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false))); + return separatorItem.get(); +} + +PassRefPtr<ImmutableArray> WebContextMenuItem::submenuItemsAsImmutableArray() const +{ + if (m_webContextMenuItemData.type() != WebCore::SubmenuType) + return ImmutableArray::create(); + + const Vector<WebContextMenuItemData>& submenuVector(m_webContextMenuItemData.submenu()); + unsigned size = submenuVector.size(); + + Vector<RefPtr<APIObject> > result; + result.reserveCapacity(size); + + for (unsigned i = 0; i < size; ++i) + result.append(WebContextMenuItem::create(submenuVector[i])); + + return ImmutableArray::adopt(result); +} + +APIObject* WebContextMenuItem::userData() const +{ + return m_webContextMenuItemData.userData(); +} + +void WebContextMenuItem::setUserData(APIObject* userData) +{ + m_webContextMenuItemData.setUserData(userData); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Shared/WebContextMenuItem.h b/Source/WebKit2/Shared/WebContextMenuItem.h new file mode 100644 index 0000000..142b811 --- /dev/null +++ b/Source/WebKit2/Shared/WebContextMenuItem.h @@ -0,0 +1,64 @@ +/* + * 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 WebContextMenuItem_h +#define WebContextMenuItem_h + +#include "APIObject.h" +#include "WebContextMenuItemData.h" + +namespace WebKit { + +class ImmutableArray; + +class WebContextMenuItem : public APIObject { +public: + static const Type APIType = TypeContextMenuItem; + + static PassRefPtr<WebContextMenuItem> create(const WebContextMenuItemData& data) + { + return adoptRef(new WebContextMenuItem(data)); + } + static PassRefPtr<WebContextMenuItem> create(const String& title, bool enabled, ImmutableArray* submenuItems); + static WebContextMenuItem* separatorItem(); + + PassRefPtr<ImmutableArray> submenuItemsAsImmutableArray() const; + + APIObject* userData() const; + void setUserData(APIObject*); + + WebContextMenuItemData* data() { return &m_webContextMenuItemData; } + +private: + WebContextMenuItem(const WebContextMenuItemData&); + + virtual Type type() const { return APIType; } + + WebContextMenuItemData m_webContextMenuItemData; +}; + +} // namespace WebKit + +#endif // WebContextMenuItem_h diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp new file mode 100644 index 0000000..aec8fa0 --- /dev/null +++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuItemData.h" + +#include "APIObject.h" +#include "ArgumentCoders.h" +#include "Arguments.h" +#include <wtf/text/CString.h> +#include <WebCore/ContextMenu.h> + +using namespace WebCore; + +namespace WebKit { + +WebContextMenuItemData::WebContextMenuItemData() + : m_type(WebCore::ActionType) + , m_action(WebCore::ContextMenuItemTagNoAction) + , m_enabled(true) + , m_checked(false) +{ +} + +WebContextMenuItemData::WebContextMenuItemData(WebCore::ContextMenuItemType type, WebCore::ContextMenuAction action, const String& title, bool enabled, bool checked) + : m_type(type) + , m_action(action) + , m_title(title) + , m_enabled(enabled) + , m_checked(checked) +{ + ASSERT(type == WebCore::ActionType || type == WebCore::CheckableActionType || type == WebCore::SeparatorType); +} + +WebContextMenuItemData::WebContextMenuItemData(WebCore::ContextMenuAction action, const String& title, bool enabled, const Vector<WebContextMenuItemData>& submenu) + : m_type(WebCore::SubmenuType) + , m_action(action) + , m_title(title) + , m_enabled(enabled) + , m_checked(false) + , m_submenu(submenu) +{ +} + +WebContextMenuItemData::WebContextMenuItemData(const WebCore::ContextMenuItem& item, WebCore::ContextMenu* menu) + : m_type(item.type()) + , m_action(item.action()) + , m_title(item.title()) +{ + if (m_type == WebCore::SubmenuType) { +#if USE(CROSS_PLATFORM_CONTEXT_MENUS) + const Vector<WebCore::ContextMenuItem>& coreSubmenu = item.subMenuItems(); +#else + Vector<WebCore::ContextMenuItem> coreSubmenu = WebCore::contextMenuItemVector(item.platformSubMenu()); +#endif + m_submenu = kitItems(coreSubmenu, menu); + } + + m_enabled = item.enabled(); + m_checked = item.checked(); +} + +ContextMenuItem WebContextMenuItemData::core() const +{ + if (m_type != SubmenuType) + return ContextMenuItem(m_type, m_action, m_title, m_enabled, m_checked); + + Vector<ContextMenuItem> subMenuItems = coreItems(m_submenu); + return ContextMenuItem(m_action, m_title, m_enabled, m_checked, subMenuItems); +} + +APIObject* WebContextMenuItemData::userData() const +{ + return m_userData.get(); +} + +void WebContextMenuItemData::setUserData(APIObject* userData) +{ + m_userData = userData; +} + +void WebContextMenuItemData::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), static_cast<uint32_t>(m_action), m_title, m_checked, m_enabled, m_submenu)); +} + +bool WebContextMenuItemData::decode(CoreIPC::ArgumentDecoder* decoder, WebContextMenuItemData& item) +{ + uint32_t type; + uint32_t action; + String title; + bool checked; + bool enabled; + Vector<WebContextMenuItemData> submenu; + + if (!decoder->decode(CoreIPC::Out(type, action, title, checked, enabled, submenu))) + return false; + + switch (type) { + case WebCore::ActionType: + case WebCore::SeparatorType: + case WebCore::CheckableActionType: + item = WebContextMenuItemData(static_cast<WebCore::ContextMenuItemType>(type), static_cast<WebCore::ContextMenuAction>(action), title, enabled, checked); + break; + case WebCore::SubmenuType: + item = WebContextMenuItemData(static_cast<WebCore::ContextMenuAction>(action), title, enabled, submenu); + break; + default: + ASSERT_NOT_REACHED(); + return false; + } + + return true; +} + +Vector<WebContextMenuItemData> kitItems(const Vector<WebCore::ContextMenuItem>& coreItemVector, WebCore::ContextMenu* menu) +{ + Vector<WebContextMenuItemData> result; + result.reserveCapacity(coreItemVector.size()); + for (unsigned i = 0; i < coreItemVector.size(); ++i) + result.append(WebContextMenuItemData(coreItemVector[i], menu)); + + return result; +} + +Vector<ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>& kitItemVector) +{ + Vector<ContextMenuItem> result; + result.reserveCapacity(kitItemVector.size()); + for (unsigned i = 0; i < kitItemVector.size(); ++i) + result.append(kitItemVector[i].core()); + + return result; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.h b/Source/WebKit2/Shared/WebContextMenuItemData.h new file mode 100644 index 0000000..24af288 --- /dev/null +++ b/Source/WebKit2/Shared/WebContextMenuItemData.h @@ -0,0 +1,82 @@ +/* + * 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 WebContextMenuItemData_h +#define WebContextMenuItemData_h + +#include <WebCore/ContextMenuItem.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebCore { + class ContextMenu; +} + +namespace WebKit { + +class APIObject; + +class WebContextMenuItemData { +public: + WebContextMenuItemData(); + WebContextMenuItemData(const WebCore::ContextMenuItem&, WebCore::ContextMenu* menu); + WebContextMenuItemData(WebCore::ContextMenuItemType, WebCore::ContextMenuAction, const String& title, bool enabled, bool checked); + WebContextMenuItemData(WebCore::ContextMenuAction, const String& title, bool enabled, const Vector<WebContextMenuItemData>& submenu); + + WebCore::ContextMenuItemType type() const { return m_type; } + WebCore::ContextMenuAction action() const { return m_action; } + const String& title() const { return m_title; } + bool enabled() const { return m_enabled; } + bool checked() const { return m_checked; } + const Vector<WebContextMenuItemData>& submenu() const { return m_submenu; } + + WebCore::ContextMenuItem core() const; + + APIObject* userData() const; + void setUserData(APIObject*); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebContextMenuItemData&); + +private: + WebCore::ContextMenuItemType m_type; + WebCore::ContextMenuAction m_action; + String m_title; + bool m_enabled; + bool m_checked; + Vector<WebContextMenuItemData> m_submenu; + RefPtr<APIObject> m_userData; +}; + +Vector<WebContextMenuItemData> kitItems(const Vector<WebCore::ContextMenuItem>&, WebCore::ContextMenu*); +Vector<WebCore::ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>&); + +} // namespace WebKit + +#endif // WebContextMenuItemData_h diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h new file mode 100644 index 0000000..62c68c7 --- /dev/null +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -0,0 +1,450 @@ +/* + * 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 WebCoreArgumentCoders_h +#define WebCoreArgumentCoders_h + +#include "ArgumentCoders.h" +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Arguments.h" +#include <WebCore/AuthenticationChallenge.h> +#include <WebCore/Credential.h> +#include <WebCore/Cursor.h> +#include <WebCore/DatabaseDetails.h> +#include <WebCore/Editor.h> +#include <WebCore/EditorClient.h> +#include <WebCore/FloatRect.h> +#include <WebCore/IntRect.h> +#include <WebCore/KeyboardEvent.h> +#include <WebCore/PluginData.h> +#include <WebCore/ProtectionSpace.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ViewportArguments.h> +#include <WebCore/WindowFeatures.h> +#include <limits> + +namespace CoreIPC { + +template<> struct ArgumentCoder<WebCore::IntPoint> : SimpleArgumentCoder<WebCore::IntPoint> { }; +template<> struct ArgumentCoder<WebCore::IntSize> : SimpleArgumentCoder<WebCore::IntSize> { }; +template<> struct ArgumentCoder<WebCore::IntRect> : SimpleArgumentCoder<WebCore::IntRect> { }; +template<> struct ArgumentCoder<WebCore::ViewportArguments> : SimpleArgumentCoder<WebCore::ViewportArguments> { }; + +template<> struct ArgumentCoder<WebCore::FloatPoint> : SimpleArgumentCoder<WebCore::FloatPoint> { }; +template<> struct ArgumentCoder<WebCore::FloatSize> : SimpleArgumentCoder<WebCore::FloatSize> { }; +template<> struct ArgumentCoder<WebCore::FloatRect> : SimpleArgumentCoder<WebCore::FloatRect> { }; + +template<> struct ArgumentCoder<WebCore::MimeClassInfo> { + static void encode(ArgumentEncoder* encoder, const WebCore::MimeClassInfo& mimeClassInfo) + { + encoder->encode(mimeClassInfo.type); + encoder->encode(mimeClassInfo.desc); + encoder->encode(mimeClassInfo.extensions); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::MimeClassInfo& mimeClassInfo) + { + if (!decoder->decode(mimeClassInfo.type)) + return false; + if (!decoder->decode(mimeClassInfo.desc)) + return false; + if (!decoder->decode(mimeClassInfo.extensions)) + return false; + + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::PluginInfo> { + static void encode(ArgumentEncoder* encoder, const WebCore::PluginInfo& pluginInfo) + { + encoder->encode(pluginInfo.name); + encoder->encode(pluginInfo.file); + encoder->encode(pluginInfo.desc); + encoder->encode(pluginInfo.mimes); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::PluginInfo& pluginInfo) + { + if (!decoder->decode(pluginInfo.name)) + return false; + if (!decoder->decode(pluginInfo.file)) + return false; + if (!decoder->decode(pluginInfo.desc)) + return false; + if (!decoder->decode(pluginInfo.mimes)) + return false; + + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::HTTPHeaderMap> { + static void encode(ArgumentEncoder* encoder, const WebCore::HTTPHeaderMap& headerMap) + { + encoder->encode(static_cast<const HashMap<AtomicString, String, CaseFoldingHash>&>(headerMap)); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::HTTPHeaderMap& headerMap) + { + return decoder->decode(static_cast<HashMap<AtomicString, String, CaseFoldingHash>&>(headerMap)); + } +}; + +template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> { + static void encode(ArgumentEncoder* encoder, const WebCore::AuthenticationChallenge& challenge) + { + encoder->encode(CoreIPC::In(challenge.protectionSpace(), challenge.proposedCredential(), challenge.previousFailureCount(), challenge.failureResponse(), challenge.error())); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& challenge) + { + WebCore::ProtectionSpace protectionSpace; + WebCore::Credential proposedCredential; + unsigned previousFailureCount; + WebCore::ResourceResponse failureResponse; + WebCore::ResourceError error; + + if (!decoder->decode(CoreIPC::Out(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error))) + return false; + + challenge = WebCore::AuthenticationChallenge(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error); + + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::ProtectionSpace> { + static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& space) + { + encoder->encode(CoreIPC::In(space.host(), space.port(), static_cast<uint32_t>(space.serverType()), space.realm(), static_cast<uint32_t>(space.authenticationScheme()))); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& space) + { + String host; + int port; + uint32_t serverType; + String realm; + uint32_t authenticationScheme; + + if (!decoder->decode(CoreIPC::Out(host, port, serverType, realm, authenticationScheme))) + return false; + + space = WebCore::ProtectionSpace(host, port, static_cast<WebCore::ProtectionSpaceServerType>(serverType), realm, static_cast<WebCore::ProtectionSpaceAuthenticationScheme>(authenticationScheme)); + + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::Credential> { + static void encode(ArgumentEncoder* encoder, const WebCore::Credential& credential) + { + encoder->encode(CoreIPC::In(credential.user(), credential.password(), static_cast<uint32_t>(credential.persistence()))); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::Credential& credential) + { + String user; + String password; + int persistence; + if (!decoder->decode(CoreIPC::Out(user, password, persistence))) + return false; + + credential = WebCore::Credential(user, password, static_cast<WebCore::CredentialPersistence>(persistence)); + return true; + } +}; + +#if USE(LAZY_NATIVE_CURSOR) +template<> struct ArgumentCoder<WebCore::Cursor> { + static void encode(ArgumentEncoder* encoder, const WebCore::Cursor& cursor) + { + // FIXME: Support custom cursors. + if (cursor.type() == WebCore::Cursor::Custom) + encoder->encode(static_cast<uint32_t>(WebCore::Cursor::Pointer)); + else + encoder->encode(static_cast<uint32_t>(cursor.type())); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::Cursor& cursor) + { + uint32_t typeInt; + if (!decoder->decode(typeInt)) + return false; + + WebCore::Cursor::Type type = static_cast<WebCore::Cursor::Type>(typeInt); + ASSERT(type != WebCore::Cursor::Custom); + + cursor = WebCore::Cursor::fromType(type); + return true; + } +}; +#endif + +// These two functions are implemented in a platform specific manner. +void encodeResourceRequest(ArgumentEncoder*, const WebCore::ResourceRequest&); +bool decodeResourceRequest(ArgumentDecoder*, WebCore::ResourceRequest&); + +template<> struct ArgumentCoder<WebCore::ResourceRequest> { + static void encode(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest) + { + encodeResourceRequest(encoder, resourceRequest); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest) + { + return decodeResourceRequest(decoder, resourceRequest); + } +}; + +// These two functions are implemented in a platform specific manner. +void encodeResourceResponse(ArgumentEncoder*, const WebCore::ResourceResponse&); +bool decodeResourceResponse(ArgumentDecoder*, WebCore::ResourceResponse&); + +template<> struct ArgumentCoder<WebCore::ResourceResponse> { + static void encode(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse) + { + encodeResourceResponse(encoder, resourceResponse); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse) + { + return decodeResourceResponse(decoder, resourceResponse); + } +}; + +template<> struct ArgumentCoder<WebCore::ResourceError> { + static void encode(ArgumentEncoder* encoder, const WebCore::ResourceError& resourceError) + { + encoder->encode(CoreIPC::In(resourceError.domain(), resourceError.errorCode(), resourceError.failingURL(), resourceError.localizedDescription())); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::ResourceError& resourceError) + { + String domain; + int errorCode; + String failingURL; + String localizedDescription; + if (!decoder->decode(CoreIPC::Out(domain, errorCode, failingURL, localizedDescription))) + return false; + resourceError = WebCore::ResourceError(domain, errorCode, failingURL, localizedDescription); + return true; + } +}; + + +template<> struct ArgumentCoder<WebCore::WindowFeatures> { + static void encode(ArgumentEncoder* encoder, const WebCore::WindowFeatures& windowFeatures) + { + encoder->encode(windowFeatures.x); + encoder->encode(windowFeatures.y); + encoder->encode(windowFeatures.width); + encoder->encode(windowFeatures.height); + encoder->encode(windowFeatures.xSet); + encoder->encode(windowFeatures.ySet); + encoder->encode(windowFeatures.widthSet); + encoder->encode(windowFeatures.heightSet); + encoder->encode(windowFeatures.menuBarVisible); + encoder->encode(windowFeatures.statusBarVisible); + encoder->encode(windowFeatures.toolBarVisible); + encoder->encode(windowFeatures.locationBarVisible); + encoder->encode(windowFeatures.scrollbarsVisible); + encoder->encode(windowFeatures.resizable); + encoder->encode(windowFeatures.fullscreen); + encoder->encode(windowFeatures.dialog); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::WindowFeatures& windowFeatures) + { + if (!decoder->decode(windowFeatures.x)) + return false; + if (!decoder->decode(windowFeatures.y)) + return false; + if (!decoder->decode(windowFeatures.width)) + return false; + if (!decoder->decode(windowFeatures.height)) + return false; + if (!decoder->decode(windowFeatures.xSet)) + return false; + if (!decoder->decode(windowFeatures.ySet)) + return false; + if (!decoder->decode(windowFeatures.widthSet)) + return false; + if (!decoder->decode(windowFeatures.heightSet)) + return false; + if (!decoder->decode(windowFeatures.menuBarVisible)) + return false; + if (!decoder->decode(windowFeatures.statusBarVisible)) + return false; + if (!decoder->decode(windowFeatures.toolBarVisible)) + return false; + if (!decoder->decode(windowFeatures.locationBarVisible)) + return false; + if (!decoder->decode(windowFeatures.scrollbarsVisible)) + return false; + if (!decoder->decode(windowFeatures.resizable)) + return false; + if (!decoder->decode(windowFeatures.fullscreen)) + return false; + if (!decoder->decode(windowFeatures.dialog)) + return false; + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::Color> { + static void encode(ArgumentEncoder* encoder, const WebCore::Color& color) + { + if (!color.isValid()) { + encoder->encodeBool(false); + return; + } + + encoder->encodeBool(true); + encoder->encode(color.rgb()); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::Color& color) + { + bool isValid; + if (!decoder->decode(isValid)) + return false; + + if (!isValid) { + color = WebCore::Color(); + return true; + } + + WebCore::RGBA32 rgba; + if (!decoder->decode(rgba)) + return false; + + color = WebCore::Color(rgba); + return true; + } +}; + +#if PLATFORM(MAC) +template<> struct ArgumentCoder<WebCore::KeypressCommand> { + static void encode(ArgumentEncoder* encoder, const WebCore::KeypressCommand& keypressCommand) + { + encoder->encode(CoreIPC::In(keypressCommand.commandName, keypressCommand.text)); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::KeypressCommand& keypressCommand) + { + return decoder->decode(CoreIPC::Out(keypressCommand.commandName, keypressCommand.text)); + } +}; +#endif + +template<> struct ArgumentCoder<WebCore::CompositionUnderline> { + static void encode(ArgumentEncoder* encoder, const WebCore::CompositionUnderline& underline) + { + encoder->encode(CoreIPC::In(underline.startOffset, underline.endOffset, underline.thick, underline.color.rgb())); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::CompositionUnderline& underline) + { + return decoder->decode(CoreIPC::Out(underline.startOffset, underline.endOffset, underline.thick, underline.color)); + } +}; + +template<> struct ArgumentCoder<WebCore::DatabaseDetails> { + static void encode(ArgumentEncoder* encoder, const WebCore::DatabaseDetails& details) + { + encoder->encode(CoreIPC::In(details.name(), details.displayName(), details.expectedUsage(), details.currentUsage())); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::DatabaseDetails& details) + { + String name; + String displayName; + uint64_t expectedUsage; + uint64_t currentUsage; + if (!decoder->decode(CoreIPC::Out(name, displayName, expectedUsage, currentUsage))) + return false; + + details = WebCore::DatabaseDetails(name, displayName, expectedUsage, currentUsage); + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::GrammarDetail> { + static void encode(ArgumentEncoder* encoder, const WebCore::GrammarDetail& detail) + { + encoder->encodeInt32(detail.location); + encoder->encodeInt32(detail.length); + encoder->encode(detail.guesses); + encoder->encode(detail.userDescription); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::GrammarDetail& detail) + { + if (!decoder->decodeInt32(detail.location)) + return false; + if (!decoder->decodeInt32(detail.length)) + return false; + if (!decoder->decode(detail.guesses)) + return false; + if (!decoder->decode(detail.userDescription)) + return false; + + return true; + } +}; + +template<> struct ArgumentCoder<WebCore::TextCheckingResult> { + static void encode(ArgumentEncoder* encoder, const WebCore::TextCheckingResult& result) + { + encoder->encodeEnum(result.type); + encoder->encodeInt32(result.location); + encoder->encodeInt32(result.length); + encoder->encode(result.details); + encoder->encode(result.replacement); + } + + static bool decode(ArgumentDecoder* decoder, WebCore::TextCheckingResult& result) + { + if (!decoder->decodeEnum(result.type)) + return false; + if (!decoder->decodeInt32(result.location)) + return false; + if (!decoder->decodeInt32(result.length)) + return false; + if (!decoder->decode(result.details)) + return false; + if (!decoder->decode(result.replacement)) + return false; + return true; + } +}; + +} // namespace CoreIPC + +#endif // WebCoreArgumentCoders_h diff --git a/Source/WebKit2/Shared/WebData.h b/Source/WebKit2/Shared/WebData.h new file mode 100644 index 0000000..789b965 --- /dev/null +++ b/Source/WebKit2/Shared/WebData.h @@ -0,0 +1,73 @@ +/* + * 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 WebData_h +#define WebData_h + +#include "APIObject.h" +#include <wtf/Forward.h> +#include <wtf/Vector.h> + +namespace WebKit { + +// WebData - A data buffer type suitable for vending to an API. + +class WebData : public APIObject { +public: + static const Type APIType = TypeData; + + static PassRefPtr<WebData> create(const unsigned char* bytes, size_t size) + { + return adoptRef(new WebData(bytes, size)); + } + + static PassRefPtr<WebData> create(const Vector<unsigned char>& buffer) + { + return adoptRef(new WebData(buffer)); + } + + const unsigned char* bytes() const { return m_buffer.data(); } + size_t size() const { return m_buffer.size(); } + +private: + WebData(const unsigned char* bytes, size_t size) + : m_buffer(size) + { + memcpy(m_buffer.data(), bytes, size); + } + + WebData(const Vector<unsigned char>& buffer) + : m_buffer(buffer) + { + } + + virtual Type type() const { return APIType; } + + Vector<unsigned char> m_buffer; +}; + +} // namespace WebKit + +#endif // WebData_h diff --git a/Source/WebKit2/Shared/WebError.cpp b/Source/WebKit2/Shared/WebError.cpp new file mode 100644 index 0000000..a401d71 --- /dev/null +++ b/Source/WebKit2/Shared/WebError.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "WebError.h" + +#include <wtf/text/WTFString.h> + +namespace WebKit { + +const String& WebError::webKitErrorDomain() +{ + DEFINE_STATIC_LOCAL(String, webKitErrorDomainString, ("WebKitErrorDomain")); + return webKitErrorDomainString; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebError.h b/Source/WebKit2/Shared/WebError.h new file mode 100644 index 0000000..9c5ddb0 --- /dev/null +++ b/Source/WebKit2/Shared/WebError.h @@ -0,0 +1,77 @@ +/* + * 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 WebError_h +#define WebError_h + +#include "APIObject.h" +#include <WebCore/ResourceError.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +// WebError - An error type suitable for vending to an API. + +class WebError : public APIObject { +public: + static const Type APIType = TypeError; + + static PassRefPtr<WebError> create() + { + return adoptRef(new WebError); + } + + static PassRefPtr<WebError> create(const WebCore::ResourceError& error) + { + return adoptRef(new WebError(error)); + } + + static const String& webKitErrorDomain(); + + const String& domain() const { return m_platformError.domain(); } + int errorCode() const { return m_platformError.errorCode();; } + const String& failingURL() const { return m_platformError.failingURL(); } + const String& localizedDescription() const { return m_platformError.localizedDescription(); } + + const WebCore::ResourceError& platformError() const { return m_platformError; } + +private: + WebError() + { + } + + WebError(const WebCore::ResourceError& error) + : m_platformError(error) + { + } + + virtual Type type() const { return APIType; } + + WebCore::ResourceError m_platformError; +}; + +} // namespace WebKit + +#endif // WebError_h diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp new file mode 100644 index 0000000..429622c --- /dev/null +++ b/Source/WebKit2/Shared/WebEvent.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEvent.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Arguments.h" + +namespace WebKit { + +WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp) + : m_type(type) + , m_modifiers(modifiers) + , m_timestamp(timestamp) +{ +} + +void WebEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(m_type, m_modifiers, m_timestamp)); +} + +bool WebEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& t) +{ + return decoder->decode(CoreIPC::Out(t.m_type, t.m_modifiers, t.m_timestamp)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h new file mode 100644 index 0000000..f048d6e --- /dev/null +++ b/Source/WebKit2/Shared/WebEvent.h @@ -0,0 +1,296 @@ +/* + * 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 WebEvent_h +#define WebEvent_h + +// FIXME: We should probably move to makeing the WebCore/PlatformFooEvents trivial classes so that +// we can use them as the event type. + +#include <WebCore/FloatSize.h> +#include <WebCore/IntPoint.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class WebEvent { +public: + enum Type { + // WebMouseEvent + MouseDown, + MouseUp, + MouseMove, + + // WebWheelEvent + Wheel, + + // WebKeyboardEvent + KeyDown, + KeyUp, + RawKeyDown, + Char +#if ENABLE(TOUCH_EVENTS) + , + TouchStart, + TouchMove, + TouchEnd, + TouchCancel +#endif + }; + + enum Modifiers { + ShiftKey = 1 << 0, + ControlKey = 1 << 1, + AltKey = 1 << 2, + MetaKey = 1 << 3, + }; + + Type type() const { return static_cast<Type>(m_type); } + + bool shiftKey() const { return m_modifiers & ShiftKey; } + bool controlKey() const { return m_modifiers & ControlKey; } + bool altKey() const { return m_modifiers & AltKey; } + bool metaKey() const { return m_modifiers & MetaKey; } + + Modifiers modifiers() const { return static_cast<Modifiers>(m_modifiers); } + + double timestamp() const { return m_timestamp; } + +protected: + WebEvent() { } + + WebEvent(Type, Modifiers, double timestamp); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebEvent&); + +private: + uint32_t m_type; // Type + uint32_t m_modifiers; // Modifiers + double m_timestamp; +}; + +// FIXME: Move this class to its own header file. +class WebMouseEvent : public WebEvent { +public: + enum Button { + NoButton = -1, + LeftButton, + MiddleButton, + RightButton + }; + + WebMouseEvent() { } + + WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp); +#if PLATFORM(WIN) + WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, bool didActivateWebView); +#endif + + Button button() const { return static_cast<Button>(m_button); } + const WebCore::IntPoint& position() const { return m_position; } + const WebCore::IntPoint& globalPosition() const { return m_globalPosition; } + float deltaX() const { return m_deltaX; } + float deltaY() const { return m_deltaY; } + float deltaZ() const { return m_deltaZ; } + int32_t clickCount() const { return m_clickCount; } +#if PLATFORM(WIN) + bool didActivateWebView() const { return m_didActivateWebView; } +#endif + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebMouseEvent&); + +private: + static bool isMouseEventType(Type); + + uint32_t m_button; + WebCore::IntPoint m_position; + WebCore::IntPoint m_globalPosition; + float m_deltaX; + float m_deltaY; + float m_deltaZ; + int32_t m_clickCount; +#if PLATFORM(WIN) + bool m_didActivateWebView; +#endif +}; + +// FIXME: Move this class to its own header file. +class WebWheelEvent : public WebEvent { +public: + enum Granularity { + ScrollByPageWheelEvent, + ScrollByPixelWheelEvent + }; + +#if PLATFORM(MAC) + enum Phase { + PhaseNone = 0, + PhaseBegan = 1 << 1, + PhaseStationary = 1 << 2, + PhaseChanged = 1 << 3, + PhaseEnded = 1 << 4, + PhaseCancelled = 1 << 5, + }; +#endif + + WebWheelEvent() { } + + 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); +#endif + + const WebCore::IntPoint position() const { return m_position; } + const WebCore::IntPoint globalPosition() const { return m_globalPosition; } + const WebCore::FloatSize delta() const { return m_delta; } + const WebCore::FloatSize wheelTicks() const { return m_wheelTicks; } + Granularity granularity() const { return static_cast<Granularity>(m_granularity); } +#if PLATFORM(MAC) + Phase phase() const { return static_cast<Phase>(m_phase); } +#endif + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebWheelEvent&); + +private: + static bool isWheelEventType(Type); + + WebCore::IntPoint m_position; + WebCore::IntPoint m_globalPosition; + WebCore::FloatSize m_delta; + WebCore::FloatSize m_wheelTicks; + uint32_t m_granularity; // Granularity +#if PLATFORM(MAC) + uint32_t m_phase; // Phase +#endif +}; + +// FIXME: Move this class to its own header file. +class WebKeyboardEvent : public WebEvent { +public: + WebKeyboardEvent() { } + + WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp); + + const String& text() const { return m_text; } + const String& unmodifiedText() const { return m_unmodifiedText; } + const String& keyIdentifier() const { return m_keyIdentifier; } + int32_t windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } + int32_t nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } + int32_t macCharCode() const { return m_macCharCode; } + bool isAutoRepeat() const { return m_isAutoRepeat; } + bool isKeypad() const { return m_isKeypad; } + bool isSystemKey() const { return m_isSystemKey; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebKeyboardEvent&); + + static bool isKeyboardEventType(Type); + +private: + String m_text; + String m_unmodifiedText; + String m_keyIdentifier; + int32_t m_windowsVirtualKeyCode; + int32_t m_nativeVirtualKeyCode; + int32_t m_macCharCode; + bool m_isAutoRepeat; + bool m_isKeypad; + bool m_isSystemKey; +}; + +#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. +class WebPlatformTouchPoint { +public: + enum TouchPointState { + TouchReleased, + TouchPressed, + TouchMoved, + TouchStationary, + TouchCancelled + }; + + WebPlatformTouchPoint() { } + + WebPlatformTouchPoint(uint32_t id, TouchPointState, const WebCore::IntPoint& screenPosition, const WebCore::IntPoint& position); + + uint32_t id() const { return m_id; } + TouchPointState state() const { return static_cast<TouchPointState>(m_state); } + + const WebCore::IntPoint& screenPosition() const { return m_screenPosition; } + const WebCore::IntPoint& position() const { return m_position; } + + void setState(TouchPointState state) { m_state = state; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebPlatformTouchPoint&); + +private: + uint32_t m_id; + uint32_t m_state; + WebCore::IntPoint m_screenPosition; + WebCore::IntPoint m_position; + +}; + +// FIXME: Move this class to its own header file. +class WebTouchEvent : public WebEvent { +public: + WebTouchEvent() { } + + // FIXME: It would be nice not to have to copy the Vector here. + WebTouchEvent(Type, Vector<WebPlatformTouchPoint>, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers, double timestamp); + + const Vector<WebPlatformTouchPoint>& touchPoints() const { return m_touchPoints; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebTouchEvent&); + +private: + static bool isTouchEventType(Type); + + Vector<WebPlatformTouchPoint> m_touchPoints; + bool m_ctrlKey; + bool m_altKey; + bool m_shiftKey; + bool m_metaKey; +}; + +#endif // ENABLE(TOUCH_EVENTS) + +} // namespace WebKit + +#endif // WebEvent_h diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp new file mode 100644 index 0000000..14c51b7 --- /dev/null +++ b/Source/WebKit2/Shared/WebEventConversion.cpp @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEventConversion.h" + +#include "WebEvent.h" +#include <WebCore/IntPoint.h> + +namespace WebKit { + +class WebKit2PlatformMouseEvent : public WebCore::PlatformMouseEvent { +public: + WebKit2PlatformMouseEvent(const WebMouseEvent& webEvent) + { + switch (webEvent.type()) { + case WebEvent::MouseDown: + m_eventType = WebCore::MouseEventPressed; + break; + case WebEvent::MouseUp: + m_eventType = WebCore::MouseEventReleased; + break; + case WebEvent::MouseMove: + m_eventType = WebCore::MouseEventMoved; + break; + default: + ASSERT_NOT_REACHED(); + } + + switch (webEvent.button()) { + case WebMouseEvent::NoButton: + m_button = WebCore::NoButton; + break; + case WebMouseEvent::LeftButton: + m_button = WebCore::LeftButton; + break; + case WebMouseEvent::MiddleButton: + m_button = WebCore::MiddleButton; + break; + case WebMouseEvent::RightButton: + m_button = WebCore::RightButton; + break; + default: + ASSERT_NOT_REACHED(); + } + + m_position = webEvent.position(); + m_globalPosition = webEvent.globalPosition(); + m_clickCount = webEvent.clickCount(); + m_timestamp = webEvent.timestamp(); + m_shiftKey = webEvent.shiftKey(); + m_ctrlKey = webEvent.controlKey(); + m_altKey = webEvent.altKey(); + m_metaKey = webEvent.metaKey(); + + m_modifierFlags = 0; + if (m_shiftKey) + m_modifierFlags |= WebEvent::ShiftKey; + if (m_ctrlKey) + m_modifierFlags |= WebEvent::ControlKey; + if (m_altKey) + m_modifierFlags |= WebEvent::AltKey; + if (m_metaKey) + m_modifierFlags |= WebEvent::MetaKey; + +#if PLATFORM(WIN) + m_didActivateWebView = webEvent.didActivateWebView(); +#endif + } +}; + +WebCore::PlatformMouseEvent platform(const WebMouseEvent& webEvent) +{ + return WebKit2PlatformMouseEvent(webEvent); +} + +class WebKit2PlatformWheelEvent : public WebCore::PlatformWheelEvent { +public: + WebKit2PlatformWheelEvent(const WebWheelEvent& webEvent) + { + m_position = webEvent.position(); + m_globalPosition = webEvent.globalPosition(); + m_deltaX = webEvent.delta().width(); + m_deltaY = webEvent.delta().height(); + m_wheelTicksX = webEvent.wheelTicks().width(); + m_wheelTicksY = webEvent.wheelTicks().height(); + m_granularity = (webEvent.granularity() == WebWheelEvent::ScrollByPageWheelEvent) ? WebCore::ScrollByPageWheelEvent : WebCore::ScrollByPixelWheelEvent; + m_shiftKey = webEvent.shiftKey(); + m_ctrlKey = webEvent.controlKey(); + m_altKey = webEvent.altKey(); + m_metaKey = webEvent.metaKey(); +#if PLATFORM(MAC) + m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase()); +#endif + } +}; + +WebCore::PlatformWheelEvent platform(const WebWheelEvent& webEvent) +{ + return WebKit2PlatformWheelEvent(webEvent); +} + +class WebKit2PlatformKeyboardEvent : public WebCore::PlatformKeyboardEvent { +public: + WebKit2PlatformKeyboardEvent(const WebKeyboardEvent& webEvent) + { + switch (webEvent.type()) { + case WebEvent::KeyDown: + m_type = PlatformKeyboardEvent::KeyDown; + break; + case WebEvent::KeyUp: + m_type = PlatformKeyboardEvent::KeyUp; + break; + case WebEvent::RawKeyDown: + m_type = PlatformKeyboardEvent::RawKeyDown; + break; + case WebEvent::Char: + m_type = PlatformKeyboardEvent::Char; + break; + default: + ASSERT_NOT_REACHED(); + } + m_text = webEvent.text(); + m_unmodifiedText = webEvent.unmodifiedText(); + m_keyIdentifier = webEvent.keyIdentifier(); + m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode(); + m_nativeVirtualKeyCode = webEvent.nativeVirtualKeyCode(); + m_autoRepeat = webEvent.isAutoRepeat(); + m_isKeypad = webEvent.isKeypad(); + m_shiftKey = webEvent.shiftKey(); + m_ctrlKey = webEvent.controlKey(); + m_altKey = webEvent.altKey(); + m_metaKey = webEvent.metaKey(); + +#if PLATFORM(WIN) + // FIXME: We should make m_isSystemKey available (and false) on all platforms + // to avoid this #define. + m_isSystemKey = webEvent.isSystemKey(); +#endif + } +}; + +WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent& webEvent) +{ + return WebKit2PlatformKeyboardEvent(webEvent); +} + +#if ENABLE(TOUCH_EVENTS) +class WebKit2PlatformTouchPoint : public WebCore::PlatformTouchPoint { +public: + WebKit2PlatformTouchPoint(const WebPlatformTouchPoint& webTouchPoint) + { + m_id = webTouchPoint.id(); + + switch (webTouchPoint.state()) { + case WebPlatformTouchPoint::TouchReleased: + m_state = PlatformTouchPoint::TouchReleased; + break; + case WebPlatformTouchPoint::TouchPressed: + m_state = PlatformTouchPoint::TouchPressed; + break; + case WebPlatformTouchPoint::TouchMoved: + m_state = PlatformTouchPoint::TouchMoved; + break; + case WebPlatformTouchPoint::TouchStationary: + m_state = PlatformTouchPoint::TouchStationary; + break; + case WebPlatformTouchPoint::TouchCancelled: + m_state = PlatformTouchPoint::TouchCancelled; + break; + default: + ASSERT_NOT_REACHED(); + } + + m_screenPos = webTouchPoint.screenPosition(); + m_pos = webTouchPoint.position(); + } +}; + +class WebKit2PlatformTouchEvent : public WebCore::PlatformTouchEvent { +public: + WebKit2PlatformTouchEvent(const WebTouchEvent& webEvent) + { + switch (webEvent.type()) { + case WebEvent::TouchStart: + m_type = WebCore::TouchStart; + break; + case WebEvent::TouchMove: + m_type = WebCore::TouchMove; + break; + case WebEvent::TouchEnd: + m_type = WebCore::TouchEnd; + break; + case WebEvent::TouchCancel: + m_type = WebCore::TouchCancel; + break; + default: + ASSERT_NOT_REACHED(); + } + + for (int i = 0; i < webEvent.touchPoints().size(); ++i) + m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); + + m_ctrlKey = webEvent.controlKey(); + m_altKey = webEvent.altKey(); + m_shiftKey = webEvent.shiftKey(); + m_metaKey = webEvent.metaKey(); + } +}; + +WebCore::PlatformTouchEvent platform(const WebTouchEvent& webEvent) +{ + return WebKit2PlatformTouchEvent(webEvent); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebEventConversion.h b/Source/WebKit2/Shared/WebEventConversion.h new file mode 100644 index 0000000..8fa0813 --- /dev/null +++ b/Source/WebKit2/Shared/WebEventConversion.h @@ -0,0 +1,55 @@ +/* + * 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 WebEventConversion_h +#define WebEventConversion_h + +#include <WebCore/PlatformKeyboardEvent.h> +#include <WebCore/PlatformMouseEvent.h> +#include <WebCore/PlatformWheelEvent.h> +#if ENABLE(TOUCH_EVENTS) +#include <WebCore/PlatformTouchEvent.h> +#include <WebCore/PlatformTouchPoint.h> +#endif + +namespace WebKit { + +class WebMouseEvent; +class WebWheelEvent; +class WebKeyboardEvent; +#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(TOUCH_EVENTS) +WebCore::PlatformTouchEvent platform(const WebTouchEvent&); +WebCore::PlatformTouchPoint platform(const WebTouchPoint&); +#endif +} // namespace WebKit + +#endif // WebEventConversion_h diff --git a/Source/WebKit2/Shared/WebFindOptions.h b/Source/WebKit2/Shared/WebFindOptions.h new file mode 100644 index 0000000..9c2a899 --- /dev/null +++ b/Source/WebKit2/Shared/WebFindOptions.h @@ -0,0 +1,43 @@ +/* + * 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 WebFindOptions_h +#define WebFindOptions_h + +namespace WebKit { + +enum FindOptions { + FindOptionsCaseInsensitive = 1 << 0, + FindOptionsAtWordStarts = 1 << 1, + FindOptionsTreatMedialCapitalAsWordStart = 1 << 2, + FindOptionsBackwards = 1 << 3, + FindOptionsWrapAround = 1 << 4, + FindOptionsShowOverlay = 1 << 5, + FindOptionsShowFindIndicator = 1 << 6 +}; + +} // namespace WebKit + +#endif // WebFindOptions_h diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp new file mode 100644 index 0000000..9cda350 --- /dev/null +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -0,0 +1,55 @@ +/* + * 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 "WebGeolocationPosition.h" + +#include "ArgumentCoders.h" +#include "Arguments.h" + +namespace WebKit { + +WebGeolocationPosition::WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy) +{ + m_data.timestamp = timestamp; + m_data.latitude = latitude; + m_data.longitude = longitude; + m_data.accuracy = accuracy; +} + +WebGeolocationPosition::~WebGeolocationPosition() +{ +} + +void WebGeolocationPosition::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(timestamp, latitude, longitude, accuracy)); +} + +bool WebGeolocationPosition::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data) +{ + return decoder->decode(CoreIPC::Out(data.timestamp, data.latitude, data.longitude, data.accuracy)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.h b/Source/WebKit2/Shared/WebGeolocationPosition.h new file mode 100644 index 0000000..6b268fb --- /dev/null +++ b/Source/WebKit2/Shared/WebGeolocationPosition.h @@ -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. + */ + +#ifndef WebGeolocationPosition_h +#define WebGeolocationPosition_h + +#include "APIObject.h" +#include "ArgumentEncoder.h" +#include "ArgumentDecoder.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebGeolocationPosition : public APIObject { +public: + static const Type APIType = TypeGeolocationPosition; + + struct Data { + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Data&); + + double timestamp; + double latitude; + double longitude; + double accuracy; + }; + + static PassRefPtr<WebGeolocationPosition> create(double timestamp, double latitude, double longitude, double accuracy) + { + return adoptRef(new WebGeolocationPosition(timestamp, latitude, longitude, accuracy)); + } + + virtual ~WebGeolocationPosition(); + + double timestamp() const { return m_data.timestamp; } + double latitude() const { return m_data.latitude; } + double longitude() const { return m_data.longitude; } + double accuracy() const { return m_data.accuracy; } + + const Data& data() const { return m_data; } + +private: + WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy); + + virtual Type type() const { return APIType; } + + Data m_data; +}; + +} // namespace WebKit + +#endif // WebGeolocationPosition_h diff --git a/Source/WebKit2/Shared/WebImage.cpp b/Source/WebKit2/Shared/WebImage.cpp new file mode 100644 index 0000000..1426690 --- /dev/null +++ b/Source/WebKit2/Shared/WebImage.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebImage.h" + +#include "ShareableBitmap.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebImage> WebImage::create(const IntSize& size, ImageOptions options) +{ + if (options & ImageOptionsShareable) + return WebImage::create(ShareableBitmap::createShareable(size)); + return WebImage::create(ShareableBitmap::create(size)); +} + +PassRefPtr<WebImage> WebImage::create(PassRefPtr<ShareableBitmap> bitmap) +{ + return adoptRef(new WebImage(bitmap)); +} + +WebImage::WebImage(PassRefPtr<ShareableBitmap> bitmap) + : m_bitmap(bitmap) +{ + ASSERT(m_bitmap); +} + +WebImage::~WebImage() +{ +} + +const IntSize& WebImage::size() const +{ + return m_bitmap->size(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebImage.h b/Source/WebKit2/Shared/WebImage.h new file mode 100644 index 0000000..0380b7d --- /dev/null +++ b/Source/WebKit2/Shared/WebImage.h @@ -0,0 +1,65 @@ +/* + * 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 WebImage_h +#define WebImage_h + +#include "APIObject.h" +#include "ImageOptions.h" +#include <wtf/RefPtr.h> + +namespace WebCore { + class IntSize; +} + +namespace WebKit { + +class ShareableBitmap; + +// WebImage - An image type suitable for vending to an API. + +class WebImage : public APIObject { +public: + static const Type APIType = TypeImage; + + static PassRefPtr<WebImage> create(const WebCore::IntSize&, ImageOptions); + static PassRefPtr<WebImage> create(PassRefPtr<ShareableBitmap>); + ~WebImage(); + + const WebCore::IntSize& size() const; + + ShareableBitmap* bitmap() const { return m_bitmap.get(); } + +private: + WebImage(PassRefPtr<ShareableBitmap>); + + virtual Type type() const { return APIType; } + + RefPtr<ShareableBitmap> m_bitmap; +}; + +} // namespace WebKit + +#endif // WebImage_h diff --git a/Source/WebKit2/Shared/WebKeyboardEvent.cpp b/Source/WebKit2/Shared/WebKeyboardEvent.cpp new file mode 100644 index 0000000..08aaab8 --- /dev/null +++ b/Source/WebKit2/Shared/WebKeyboardEvent.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEvent.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_text(text) + , m_unmodifiedText(unmodifiedText) + , m_keyIdentifier(keyIdentifier) + , m_windowsVirtualKeyCode(windowsVirtualKeyCode) + , m_nativeVirtualKeyCode(nativeVirtualKeyCode) + , m_macCharCode(macCharCode) + , m_isAutoRepeat(isAutoRepeat) + , m_isKeypad(isKeypad) + , m_isSystemKey(isSystemKey) +{ + ASSERT(isKeyboardEventType(type)); +} + +void WebKeyboardEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + + encoder->encode(CoreIPC::In(m_text, m_unmodifiedText, m_keyIdentifier, m_windowsVirtualKeyCode, m_nativeVirtualKeyCode, m_macCharCode)); + encoder->encode(CoreIPC::In(m_isAutoRepeat, m_isKeypad, m_isSystemKey)); +} + +bool WebKeyboardEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebKeyboardEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + + if (!decoder->decode(CoreIPC::Out(t.m_text, t.m_unmodifiedText, t.m_keyIdentifier, t.m_windowsVirtualKeyCode, t.m_nativeVirtualKeyCode, t.m_macCharCode))) + return false; + + return decoder->decode(CoreIPC::Out(t.m_isAutoRepeat, t.m_isKeypad, t.m_isSystemKey)); +} + +bool WebKeyboardEvent::isKeyboardEventType(Type type) +{ + return type == RawKeyDown || type == KeyDown || type == KeyUp || type == Char; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebMemorySampler.cpp b/Source/WebKit2/Shared/WebMemorySampler.cpp new file mode 100644 index 0000000..7b5c487 --- /dev/null +++ b/Source/WebKit2/Shared/WebMemorySampler.cpp @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 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. + * + */ + +#if ENABLE(MEMORY_SAMPLER) + +#include "WebMemorySampler.h" + +#include <wtf/text/CString.h> + +using namespace WebCore; + +namespace WebKit { + + +WebMemorySampler* WebMemorySampler::shared() +{ + static WebMemorySampler* sharedMemorySampler; + if (!sharedMemorySampler) + sharedMemorySampler = new WebMemorySampler(); + return sharedMemorySampler; +} + +WebMemorySampler::WebMemorySampler() + : m_separator(String("\t")) + , m_sampleTimer(this, &WebMemorySampler::sampleTimerFired) + , m_stopTimer(this, &WebMemorySampler::stopTimerFired) + , m_isRunning(false) + , m_runningTime(0) +{ +} + +void WebMemorySampler::start(const double interval) +{ + if (m_isRunning) + return; + + initializeTempLogFile(); + initializeTimers(interval); +} + +void WebMemorySampler::start(const SandboxExtension::Handle& sampleLogFileHandle, const String& sampleLogFilePath, const double interval) +{ + if (m_isRunning) + return; + + // If we are on a system without SandboxExtension the handle and filename will be empty + if (sampleLogFilePath.isEmpty()) { + start(interval); + return; + } + + initializeSandboxedLogFile(sampleLogFileHandle, sampleLogFilePath); + initializeTimers(interval); + +} + +void WebMemorySampler::initializeTimers(double interval) +{ + m_sampleTimer.startRepeating(1); + printf("Started memory sampler for process %s", processName().utf8().data()); + if (interval > 0) { + m_stopTimer.startOneShot(interval); + printf(" for a interval of %g seconds", interval); + } + printf("; Sampler log file stored at: %s\n", m_sampleLogFilePath.utf8().data()); + m_runningTime = interval; + m_isRunning = true; +} + +void WebMemorySampler::stop() +{ + if (!m_isRunning) + return; + m_sampleTimer.stop(); + m_sampleLogFile = 0; + printf("Stopped memory sampler for process %s\n", processName().utf8().data()); + // Flush stdout buffer so python script can be guaranteed to read up to this point. + fflush(stdout); + m_isRunning = false; + + if(m_stopTimer.isActive()) + m_stopTimer.stop(); + + if (m_sampleLogSandboxExtension) { + m_sampleLogSandboxExtension->invalidate(); + m_sampleLogSandboxExtension = 0; + } +} + +bool WebMemorySampler::isRunning() const +{ + return m_isRunning; +} + +void WebMemorySampler::initializeTempLogFile() +{ + m_sampleLogFilePath = String((openTemporaryFile(processName().utf8().data(), m_sampleLogFile)).data()); + writeHeaders(); +} + +void WebMemorySampler::initializeSandboxedLogFile(const SandboxExtension::Handle& sampleLogSandboxHandle, const String& sampleLogFilePath) +{ + m_sampleLogSandboxExtension = SandboxExtension::create(sampleLogSandboxHandle); + if (m_sampleLogSandboxExtension) + m_sampleLogSandboxExtension->consume(); + m_sampleLogFilePath = sampleLogFilePath; + m_sampleLogFile = openFile(m_sampleLogFilePath, OpenForWrite); + writeHeaders(); +} + +void WebMemorySampler::writeHeaders() +{ + String processDetails = String("Process: "); + processDetails.append(processName()); + processDetails.append(String("\n")); + writeToFile(m_sampleLogFile, processDetails.utf8().data(), processDetails.utf8().length()); + + String header; + WebMemoryStatistics stats = sampleWebKit(); + if (!stats.keys.isEmpty()) { + for (size_t i = 0; i < stats.keys.size(); ++i) { + header.append(m_separator); + header.append(stats.keys[i].utf8().data()); + } + } + header.append(String("\n")); + writeToFile(m_sampleLogFile, header.utf8().data(), header.utf8().length()); +} + +void WebMemorySampler::sampleTimerFired(Timer<WebMemorySampler>*) +{ + appendCurrentMemoryUsageToFile(m_sampleLogFile); +} + +void WebMemorySampler::stopTimerFired(Timer<WebMemorySampler>*) +{ + if (!m_isRunning) + return; + printf("%g seconds elapsed. Stopping memory sampler...\n", m_runningTime); + stop(); +} + +void WebMemorySampler::appendCurrentMemoryUsageToFile(PlatformFileHandle& file) +{ + // Collect statistics from allocators and get RSIZE metric + String statString; + WebMemoryStatistics memoryStats = sampleWebKit(); + + if (!memoryStats.values.isEmpty()) { + statString.append(m_separator); + for (size_t i = 0; i < memoryStats.values.size(); ++i) { + statString.append(m_separator); + statString.append(String::format("%lu", memoryStats.values[i])); + } + } + statString.append(String("\n")); + writeToFile(m_sampleLogFile, statString.utf8().data(), statString.utf8().length()); +} + +} + +#endif diff --git a/Source/WebKit2/Shared/WebMemorySampler.h b/Source/WebKit2/Shared/WebMemorySampler.h new file mode 100644 index 0000000..93254d9 --- /dev/null +++ b/Source/WebKit2/Shared/WebMemorySampler.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 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. + * + * The MemorySampler class samples a number of internal and external memory + * metrics every second while running. Sample data is written to a log file. + * Sampling occurs over a duration specified when started. If duration is set + * to 0 (default), the memory sampler will run indefinitely until the stop + * function is called. MemorySampler allows the option of sampling "in use" + * memory (committed memory minus free list byte count) or committed memory for + * any allocator which keeps a free list. This includes FastMalloc and the + * JavaScriptCore heap at this time. + * The following memory metrics are recorded: + * + * WebCore + * - FastMalloc allocations bytes (in use or committed) + * JavaScriptCore + * - Garbage collector heap bytes (in use or committed) + * - Stack bytes (committed only!) + * - JIT Code bytes (committed only!) + * Malloc zones + * - In use bytes for the following zones: + * * Default zone (in use or committed) + * * DispCon zone (in use or committed) + * * Purgable zone (in use or committed) + * Task Info + * - Resident size memory (RSIZE) + */ + +#ifndef WebMemorySampler_h +#define WebMemorySampler_h + +#if ENABLE(MEMORY_SAMPLER) + +#include "SandboxExtension.h" +#include <WebCore/Timer.h> +#include <WebCore/FileSystem.h> +#include <wtf/Noncopyable.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> +#include <wtf/Vector.h> + +namespace WebKit { + +struct SystemMallocStats; + +struct WebMemoryStatistics +{ + Vector<String> keys; + Vector<size_t> values; +}; + +class WebMemorySampler : public Noncopyable { + +public: + static WebMemorySampler* shared(); + void start(const double interval=0); + void start(const SandboxExtension::Handle&, const String&, const double interval=0); + void stop(); + bool isRunning() const; + +private: + WebMemorySampler(); + ~WebMemorySampler(); + + void initializeTempLogFile(); + void initializeSandboxedLogFile(const SandboxExtension::Handle&, const String&); + void writeHeaders(); + void initializeTimers(double); + void sampleTimerFired(WebCore::Timer<WebMemorySampler>*); + void stopTimerFired(WebCore::Timer<WebMemorySampler>*); + void appendCurrentMemoryUsageToFile(WebCore::PlatformFileHandle&); + + SystemMallocStats sampleSystemMalloc() const; + size_t sampleProcessCommittedBytes() const; + WebMemoryStatistics sampleWebKit() const; + String processName() const; + + WebCore::PlatformFileHandle m_sampleLogFile; + String m_sampleLogFilePath; + String m_separator; + WebCore::Timer<WebMemorySampler> m_sampleTimer; + WebCore::Timer<WebMemorySampler> m_stopTimer; + bool m_isRunning; + double m_runningTime; + RefPtr<SandboxExtension> m_sampleLogSandboxExtension; +}; + +} + +#endif + +#endif diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp new file mode 100644 index 0000000..fe30290 --- /dev/null +++ b/Source/WebKit2/Shared/WebMouseEvent.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEvent.h" + +#include "Arguments.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_button(button) + , m_position(position) + , m_globalPosition(globalPosition) + , m_deltaX(deltaX) + , m_deltaY(deltaY) + , m_deltaZ(deltaZ) + , m_clickCount(clickCount) +#if PLATFORM(WIN) + , m_didActivateWebView(false) +#endif +{ + ASSERT(isMouseEventType(type)); +} + +#if PLATFORM(WIN) +WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, bool didActivateWebView) + : WebEvent(type, modifiers, timestamp) + , m_button(button) + , m_position(position) + , m_globalPosition(globalPosition) + , m_deltaX(deltaX) + , m_deltaY(deltaY) + , m_deltaZ(deltaZ) + , m_clickCount(clickCount) + , m_didActivateWebView(didActivateWebView) +{ + ASSERT(isMouseEventType(type)); +} +#endif + +void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + +#if PLATFORM(WIN) + // Include m_didActivateWebView on Windows. + encoder->encode(CoreIPC::In(m_button, m_position, m_globalPosition, m_deltaX, m_deltaY, m_deltaZ, m_clickCount, m_didActivateWebView)); +#else + encoder->encode(CoreIPC::In(m_button, m_position, m_globalPosition, m_deltaX, m_deltaY, m_deltaZ, m_clickCount)); +#endif +} + +bool WebMouseEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebMouseEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + +#if PLATFORM(WIN) + // Include m_didActivateWebView on Windows. + return decoder->decode(CoreIPC::Out(t.m_button, t.m_position, t.m_globalPosition, t.m_deltaX, t.m_deltaY, t.m_deltaZ, t.m_clickCount, t.m_didActivateWebView)); +#else + return decoder->decode(CoreIPC::Out(t.m_button, t.m_position, t.m_globalPosition, t.m_deltaX, t.m_deltaY, t.m_deltaZ, t.m_clickCount)); +#endif +} + +bool WebMouseEvent::isMouseEventType(Type type) +{ + return type == MouseDown || type == MouseUp || type == MouseMove; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebNavigationDataStore.h b/Source/WebKit2/Shared/WebNavigationDataStore.h new file mode 100644 index 0000000..01fd429 --- /dev/null +++ b/Source/WebKit2/Shared/WebNavigationDataStore.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 WebNavigationDataStore_h +#define WebNavigationDataStore_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "WebCoreArgumentCoders.h" +#include <wtf/text/WTFString.h> + +namespace WebKit { + +struct WebNavigationDataStore { + void encode(CoreIPC::ArgumentEncoder* encoder) const + { + encoder->encode(url); + encoder->encode(title); + } + + static bool decode(CoreIPC::ArgumentDecoder* decoder, WebNavigationDataStore& store) + { + if (!decoder->decode(store.url)) + return false; + if (!decoder->decode(store.title)) + return false; + return true; + } + + // FIXME: Add the remaining items we want to track for history. + String url; + String title; +}; + +} // namespace WebKit + +#endif // WebNavigationDataStore_h diff --git a/Source/WebKit2/Shared/WebNumber.h b/Source/WebKit2/Shared/WebNumber.h new file mode 100644 index 0000000..0b092ef --- /dev/null +++ b/Source/WebKit2/Shared/WebNumber.h @@ -0,0 +1,63 @@ +/* + * 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 WebNumber_h +#define WebNumber_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +template<typename NumberType, APIObject::Type APIObjectType> +class WebNumber : public APIObject { +public: + static const Type APIType = APIObjectType; + + static PassRefPtr<WebNumber> create(NumberType value) + { + return adoptRef(new WebNumber(value)); + } + + NumberType value() const { return m_value; } + +private: + explicit WebNumber(NumberType value) + : m_value(value) + { + } + + virtual Type type() const { return APIType; } + + const NumberType m_value; +}; + +typedef WebNumber<bool, APIObject::TypeBoolean> WebBoolean; +typedef WebNumber<double, APIObject::TypeDouble> WebDouble; +typedef WebNumber<uint64_t, APIObject::TypeUInt64> WebUInt64; + +} // namespace WebKit + +#endif // WebNumber_h diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp new file mode 100644 index 0000000..821477b --- /dev/null +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebOpenPanelParameters.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +PassRefPtr<WebOpenPanelParameters> WebOpenPanelParameters::create(const Data& data) +{ + return adoptRef(new WebOpenPanelParameters(data)); +} + +WebOpenPanelParameters::WebOpenPanelParameters(const Data& data) + : m_data(data) +{ +} + +WebOpenPanelParameters::~WebOpenPanelParameters() +{ +} + +void WebOpenPanelParameters::Data::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(allowMultipleFiles, allowsDirectoryUpload, acceptTypes, filenames)); +} + +bool WebOpenPanelParameters::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& result) +{ + return decoder->decode(CoreIPC::Out(result.allowMultipleFiles, result.allowsDirectoryUpload, result.acceptTypes, result.filenames)); +} + +} // namespace WebCore diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.h b/Source/WebKit2/Shared/WebOpenPanelParameters.h new file mode 100644 index 0000000..e8546dc --- /dev/null +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.h @@ -0,0 +1,69 @@ +/* + * 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 WebOpenPanelParameters_h +#define WebOpenPanelParameters_h + +#include "APIObject.h" +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class WebOpenPanelParameters : public APIObject { +public: + static const Type APIType = TypeOpenPanelParameters; + + struct Data { + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Data&); + + bool allowMultipleFiles; + bool allowsDirectoryUpload; + String acceptTypes; + Vector<String> filenames; + }; + + static PassRefPtr<WebOpenPanelParameters> create(const Data&); + ~WebOpenPanelParameters(); + + bool allowMultipleFiles() const { return m_data.allowMultipleFiles; } + +private: + explicit WebOpenPanelParameters(const Data&); + + virtual Type type() const { return APIType; } + + Data m_data; +}; + +} // namespace WebKit + +#endif // WebOpenPanelParameters_h diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp new file mode 100644 index 0000000..5ab1212 --- /dev/null +++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageCreationParameters.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(viewSize); + encoder->encode(isActive); + encoder->encode(isFocused); + encoder->encode(isVisible); + encoder->encode(isInWindow); + + encoder->encode(store); + encoder->encode(drawingAreaInfo); + encoder->encode(pageGroupData); + encoder->encode(drawsBackground); + encoder->encode(drawsTransparentBackground); + encoder->encode(useFixedLayout); + encoder->encode(fixedLayoutSize); + encoder->encode(userAgent); + encoder->encode(sessionState); + encoder->encode(highestUsedBackForwardItemID); + +#if PLATFORM(MAC) + encoder->encode(isSmartInsertDeleteEnabled); +#endif + +#if PLATFORM(WIN) + encoder->encode(reinterpret_cast<uint64_t>(nativeWindow)); +#endif +} + +bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPageCreationParameters& parameters) +{ + if (!decoder->decode(parameters.viewSize)) + return false; + if (!decoder->decode(parameters.isActive)) + return false; + if (!decoder->decode(parameters.isFocused)) + return false; + if (!decoder->decode(parameters.isVisible)) + return false; + if (!decoder->decode(parameters.isInWindow)) + return false; + if (!decoder->decode(parameters.store)) + return false; + if (!decoder->decode(parameters.drawingAreaInfo)) + return false; + if (!decoder->decode(parameters.pageGroupData)) + return false; + if (!decoder->decode(parameters.drawsBackground)) + return false; + if (!decoder->decode(parameters.drawsTransparentBackground)) + return false; + if (!decoder->decode(parameters.useFixedLayout)) + return false; + if (!decoder->decode(parameters.fixedLayoutSize)) + return false; + if (!decoder->decode(parameters.userAgent)) + return false; + if (!decoder->decode(parameters.sessionState)) + return false; + if (!decoder->decode(parameters.highestUsedBackForwardItemID)) + return false; + +#if PLATFORM(MAC) + if (!decoder->decode(parameters.isSmartInsertDeleteEnabled)) + return false; +#endif + +#if PLATFORM(WIN) + uint64_t nativeWindow; + if (!decoder->decode(nativeWindow)) + return false; + parameters.nativeWindow = reinterpret_cast<HWND>(nativeWindow); +#endif + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.h b/Source/WebKit2/Shared/WebPageCreationParameters.h new file mode 100644 index 0000000..e698ce7 --- /dev/null +++ b/Source/WebKit2/Shared/WebPageCreationParameters.h @@ -0,0 +1,79 @@ +/* + * 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 WebPageCreationParameters_h +#define WebPageCreationParameters_h + +#include "DrawingAreaInfo.h" +#include "SessionState.h" +#include "WebPageGroupData.h" +#include "WebPreferencesStore.h" +#include <WebCore/IntSize.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct WebPageCreationParameters { + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebPageCreationParameters&); + + WebCore::IntSize viewSize; + + bool isActive; + bool isFocused; + bool isVisible; + bool isInWindow; + + WebPreferencesStore store; + DrawingAreaInfo drawingAreaInfo; + WebPageGroupData pageGroupData; + + bool drawsBackground; + bool drawsTransparentBackground; + + bool useFixedLayout; + WebCore::IntSize fixedLayoutSize; + + String userAgent; + + SessionState sessionState; + uint64_t highestUsedBackForwardItemID; + +#if PLATFORM(MAC) + bool isSmartInsertDeleteEnabled; +#endif +#if PLATFORM(WIN) + HWND nativeWindow; +#endif +}; + +} // namespace WebKit + +#endif // WebPageCreationParameters_h diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp new file mode 100644 index 0000000..f01f4a6 --- /dev/null +++ b/Source/WebKit2/Shared/WebPageGroupData.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageGroupData.h" + +#include "ArgumentCoders.h" +#include "Arguments.h" + +namespace WebKit { + +void WebPageGroupData::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + return encoder->encode(CoreIPC::In(identifer, pageGroupID, visibleToInjectedBundle)); +} + +bool WebPageGroupData::decode(CoreIPC::ArgumentDecoder* decoder, WebPageGroupData& data) +{ + return decoder->decode(CoreIPC::Out(data.identifer, data.pageGroupID, data.visibleToInjectedBundle)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPageGroupData.h b/Source/WebKit2/Shared/WebPageGroupData.h new file mode 100644 index 0000000..fedb5de --- /dev/null +++ b/Source/WebKit2/Shared/WebPageGroupData.h @@ -0,0 +1,50 @@ +/* + * 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 WebPageGroupData_h +#define WebPageGroupData_h + +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct WebPageGroupData { + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebPageGroupData&); + + String identifer; + uint64_t pageGroupID; + bool visibleToInjectedBundle; +}; + +} // namespace WebKit + + +#endif // WebPageGroupData_h diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp new file mode 100644 index 0000000..3954368 --- /dev/null +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#if ENABLE(TOUCH_EVENTS) + +#include "WebEvent.h" + +#include "Arguments.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, const IntPoint& screenPosition, const IntPoint& position) + : m_id(id) + , m_state(state) + , m_screenPosition(screenPosition) + , m_position(position) +{ +} + +void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(m_id, m_state, m_screenPosition, m_position)); +} + +bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t) +{ + return decoder->decode(CoreIPC::Out(t.m_id, t.m_state, t.m_screenPosition, t.m_position)); +} + +} // namespace WebKit + +#endif // ENABLE(TOUCH_EVENTS) diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp new file mode 100644 index 0000000..3a5f178 --- /dev/null +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupItem.h" + +#include "ArgumentCoders.h" +#include "Arguments.h" + +namespace WebKit { + +WebPopupItem::WebPopupItem() + : m_type(Item) + , m_isEnabled(true) +{ +} + +WebPopupItem::WebPopupItem(Type type) + : m_type(type) + , m_isEnabled(true) + , m_isLabel(false) +{ +} + +WebPopupItem::WebPopupItem(Type type, const String& text, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) + : m_type(type) + , m_text(text) + , m_toolTip(toolTip) + , m_accessibilityText(accessibilityText) + , m_isEnabled(isEnabled) + , m_isLabel(isLabel) +{ +} + +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)); +} + +bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) +{ + uint32_t type; + String text; + String toolTip; + String accessibilityText; + bool isEnabled; + bool isLabel; + if (!decoder->decode(CoreIPC::Out(type, text, toolTip, accessibilityText, isEnabled, isLabel))) + return false; + + item = WebPopupItem(static_cast<Type>(type), text, toolTip, accessibilityText, isEnabled, isLabel); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h new file mode 100644 index 0000000..c6874f8 --- /dev/null +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -0,0 +1,61 @@ +/* + * 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 WebPopupItem_h +#define WebPopupItem_h + +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct WebPopupItem { + enum Type { + Seperator, + Item + }; + + WebPopupItem(); + WebPopupItem(Type); + WebPopupItem(Type, const String& text, 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; + String m_toolTip; + String m_accessibilityText; + bool m_isEnabled; + bool m_isLabel; +}; + +} // namespace WebKit + +#endif // WebPopupItem_h diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp new file mode 100644 index 0000000..82b422b --- /dev/null +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -0,0 +1,200 @@ +/* + * 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 + * 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 "WebPreferencesStore.h" + +#include "FontSmoothingLevel.h" +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +namespace WebPreferencesKey { + +#define DEFINE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \ + const String& KeyLower##Key() \ + { \ + DEFINE_STATIC_LOCAL(String, key, (#KeyUpper)); \ + return key; \ + } + + FOR_EACH_WEBKIT_PREFERENCE(DEFINE_KEY_GETTERS) + +#undef DEFINE_KEY_GETTERS + +} // namespace WebPreferencesKey + + +static bool hasXSSAuditorEnabledTestRunnerOverride; +static bool xssAuditorEnabledTestRunnerOverride; + +WebPreferencesStore::WebPreferencesStore() +{ +} + +void WebPreferencesStore::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::In(m_stringValues, m_boolValues, m_uint32Values, m_doubleValues)); +} + +bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferencesStore& s) +{ + if (!decoder->decode(CoreIPC::Out(s.m_stringValues, s.m_boolValues, s.m_uint32Values, s.m_doubleValues))) + return false; + + if (hasXSSAuditorEnabledTestRunnerOverride) + s.m_boolValues.set(WebPreferencesKey::xssAuditorEnabledKey(), xssAuditorEnabledTestRunnerOverride); + + return true; +} + +void WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(bool enabled) +{ + hasXSSAuditorEnabledTestRunnerOverride = true; + xssAuditorEnabledTestRunnerOverride = enabled; +} + +void WebPreferencesStore::removeTestRunnerOverrides() +{ + hasXSSAuditorEnabledTestRunnerOverride = false; +} + + +template<typename MappedType> +MappedType defaultValueForKey(const String&); + +template<> +String defaultValueForKey(const String& key) +{ + static HashMap<String, String>& defaults = *new HashMap<String, String>; + if (defaults.isEmpty()) { +#define DEFINE_STRING_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) defaults.set(WebPreferencesKey::KeyLower##Key(), DefaultValue); + FOR_EACH_WEBKIT_STRING_PREFERENCE(DEFINE_STRING_DEFAULTS) +#undef DEFINE_STRING_DEFAULTS + } + + return defaults.get(key); +} + +template<> +bool defaultValueForKey(const String& key) +{ + static HashMap<String, bool>& defaults = *new HashMap<String, bool>; + if (defaults.isEmpty()) { +#define DEFINE_BOOL_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) defaults.set(WebPreferencesKey::KeyLower##Key(), DefaultValue); + FOR_EACH_WEBKIT_BOOL_PREFERENCE(DEFINE_BOOL_DEFAULTS) +#undef DEFINE_BOOL_DEFAULTS + } + + return defaults.get(key); +} + +template<> +uint32_t defaultValueForKey(const String& key) +{ + static HashMap<String, uint32_t>& defaults = *new HashMap<String, uint32_t>; + if (defaults.isEmpty()) { +#define DEFINE_UINT32_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) defaults.set(WebPreferencesKey::KeyLower##Key(), DefaultValue); + FOR_EACH_WEBKIT_UINT32_PREFERENCE(DEFINE_UINT32_DEFAULTS) +#undef DEFINE_UINT32_DEFAULTS + } + + return defaults.get(key); +} + +template<> +double defaultValueForKey(const String& key) +{ + static HashMap<String, double>& defaults = *new HashMap<String, double>; + if (defaults.isEmpty()) { +#define DEFINE_DOUBLE_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) defaults.set(WebPreferencesKey::KeyLower##Key(), DefaultValue); + FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(DEFINE_DOUBLE_DEFAULTS) +#undef DEFINE_DOUBLE_DEFAULTS + } + + return defaults.get(key); +} + +template<typename MapType> +static typename MapType::MappedType valueForKey(const MapType& map, const typename MapType::KeyType& key) +{ + typename MapType::const_iterator it = map.find(key); + if (it != map.end()) + return it->second; + + return defaultValueForKey<typename MapType::MappedType>(key); +} + +template<typename MapType> +static bool setValueForKey(MapType& map, const typename MapType::KeyType& key, const typename MapType::MappedType& value) +{ + typename MapType::MappedType existingValue = valueForKey(map, key); + if (existingValue == value) + return false; + + map.set(key, value); + return true; +} + +bool WebPreferencesStore::setStringValueForKey(const String& key, const String& value) +{ + return setValueForKey(m_stringValues, key, value); +} + +String WebPreferencesStore::getStringValueForKey(const String& key) const +{ + return valueForKey(m_stringValues, key); +} + +bool WebPreferencesStore::setBoolValueForKey(const String& key, bool value) +{ + return setValueForKey(m_boolValues, key, value); +} + +bool WebPreferencesStore::getBoolValueForKey(const String& key) const +{ + return valueForKey(m_boolValues, key); +} + +bool WebPreferencesStore::setUInt32ValueForKey(const String& key, uint32_t value) +{ + return setValueForKey(m_uint32Values, key, value); +} + +uint32_t WebPreferencesStore::getUInt32ValueForKey(const String& key) const +{ + return valueForKey(m_uint32Values, key); +} + +bool WebPreferencesStore::setDoubleValueForKey(const String& key, double value) +{ + return setValueForKey(m_doubleValues, key, value); +} + +double WebPreferencesStore::getDoubleValueForKey(const String& key) const +{ + return valueForKey(m_doubleValues, key); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h new file mode 100644 index 0000000..e8cf244 --- /dev/null +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -0,0 +1,162 @@ +/* + * 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 + * 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 WebPreferencesStore_h +#define WebPreferencesStore_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +// macro(KeyUpper, KeyLower, TypeNameUpper, TypeName, DefaultValue) + +#define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \ + macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \ + macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \ + macro(PluginsEnabled, pluginsEnabled, Bool, bool, true) \ + macro(JavaEnabled, javaEnabled, Bool, bool, true) \ + macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \ + macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true) \ + macro(DatabasesEnabled, databasesEnabled, Bool, bool, true) \ + macro(XSSAuditorEnabled, xssAuditorEnabled, Bool, bool, true) \ + macro(FrameFlatteningEnabled, frameFlatteningEnabled, Bool, bool, false) \ + macro(DeveloperExtrasEnabled, developerExtrasEnabled, Bool, bool, false) \ + macro(PrivateBrowsingEnabled, privateBrowsingEnabled, Bool, bool, false) \ + macro(TextAreasAreResizable, textAreasAreResizable, Bool, bool, true) \ + macro(JavaScriptCanOpenWindowsAutomatically, javaScriptCanOpenWindowsAutomatically, Bool, bool, true) \ + macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true) \ + macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false) \ + macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \ + macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \ + macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \ + macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \ + macro(TabsToLinks, tabsToLinks, Bool, bool, false) \ + macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \ + macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false) \ + macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false) \ + macro(UsesPageCache, usesPageCache, Bool, bool, true) \ + macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \ + macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \ + macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \ + macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \ + \ + +#define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ + macro(PDFScaleFactor, pdfScaleFactor, Double, double, 0) \ + \ + +#define FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \ + macro(FontSmoothingLevel, fontSmoothingLevel, UInt32, uint32_t, FontSmoothingLevelMedium) \ + macro(MinimumFontSize, minimumFontSize, UInt32, uint32_t, 0) \ + macro(MinimumLogicalFontSize, minimumLogicalFontSize, UInt32, uint32_t, 9) \ + macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \ + macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \ + macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \ + \ + +#if PLATFORM(WIN) + +#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ + macro(StandardFontFamily, standardFontFamily, String, String, "Times New Roman") \ + macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \ + macro(FantasyFontFamily, fantasyFontFamily, String, String, "Comic Sans MS") \ + macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \ + macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Arial") \ + macro(SerifFontFamily, serifFontFamily, String, String, "Times New Roman") \ + \ + +#else + +#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ + macro(StandardFontFamily, standardFontFamily, String, String, "Times") \ + macro(CursiveFontFamily, cursiveFontFamily, String, String, "Apple Chancery") \ + macro(FantasyFontFamily, fantasyFontFamily, String, String, "Papyrus") \ + macro(FixedFontFamily, fixedFontFamily, String, String, "Courier") \ + macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \ + macro(SerifFontFamily, serifFontFamily, String, String, "Times") \ + \ + +#endif + +#define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \ + FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ + macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, "ISO-8859-1") \ + macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, "") \ + \ + + +#define FOR_EACH_WEBKIT_PREFERENCE(macro) \ + FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \ + FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ + FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \ + FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \ + \ + +namespace WebPreferencesKey { + +#define DECLARE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) const String& KeyLower##Key(); + + FOR_EACH_WEBKIT_PREFERENCE(DECLARE_KEY_GETTERS) + +#undef DECLARE_KEY_GETTERS + +} // namespace WebPreferencesKey + +struct WebPreferencesStore { + WebPreferencesStore(); + + void encode(CoreIPC::ArgumentEncoder* encoder) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebPreferencesStore&); + + // NOTE: The getters in this class have non-standard names to aid in the use of the preference macros. + + bool setStringValueForKey(const String& key, const String& value); + String getStringValueForKey(const String& key) const; + + bool setBoolValueForKey(const String& key, bool value); + bool getBoolValueForKey(const String& key) const; + + bool setUInt32ValueForKey(const String& key, uint32_t value); + uint32_t getUInt32ValueForKey(const String& key) const; + + bool setDoubleValueForKey(const String& key, double value); + double getDoubleValueForKey(const String& key) const; + + static void overrideXSSAuditorEnabledForTestRunner(bool); + static void removeTestRunnerOverrides(); + + HashMap<String, String> m_stringValues; + HashMap<String, bool> m_boolValues; + HashMap<String, uint32_t> m_uint32Values; + HashMap<String, double> m_doubleValues; +}; + +} // namespace WebKit + +#endif // WebPreferencesStore_h diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp new file mode 100644 index 0000000..ceae6c1 --- /dev/null +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcessCreationParameters.h" + +#include "ArgumentCoders.h" + +namespace WebKit { + +WebProcessCreationParameters::WebProcessCreationParameters() + : shouldTrackVisitedLinks(false) + , shouldAlwaysUseComplexTextCodePath(false) +#if PLATFORM(MAC) + , nsURLCacheMemoryCapacity(0) + , nsURLCacheDiskCapacity(0) +#elif PLATFORM(WIN) + , shouldPaintNativeControls(false) +#endif +{ +} + +void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(injectedBundlePath); + encoder->encode(injectedBundlePathExtensionHandle); + encoder->encode(applicationCacheDirectory); + encoder->encode(urlSchemesRegistererdAsEmptyDocument); + encoder->encode(urlSchemesRegisteredAsSecure); + encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden); + encoder->encode(mimeTypesWithCustomRepresentation); + encoder->encodeEnum(cacheModel); + encoder->encode(shouldTrackVisitedLinks); + encoder->encode(shouldAlwaysUseComplexTextCodePath); + encoder->encode(languageCode); + encoder->encode(textCheckerState); +#if PLATFORM(MAC) + encoder->encode(presenterApplicationPid); + encoder->encode(nsURLCachePath); + encoder->encode(nsURLCacheMemoryCapacity); + encoder->encode(nsURLCacheDiskCapacity); + encoder->encode(acceleratedCompositingPort); + encoder->encode(uiProcessBundleResourcePath); +#elif PLATFORM(WIN) + encoder->encode(shouldPaintNativeControls); +#endif +} + +bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebProcessCreationParameters& parameters) +{ + if (!decoder->decode(parameters.injectedBundlePath)) + return false; + if (!decoder->decode(parameters.injectedBundlePathExtensionHandle)) + return false; + if (!decoder->decode(parameters.applicationCacheDirectory)) + return false; + if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument)) + return false; + if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure)) + return false; + if (!decoder->decode(parameters.urlSchemesForWhichDomainRelaxationIsForbidden)) + return false; + if (!decoder->decode(parameters.mimeTypesWithCustomRepresentation)) + return false; + if (!decoder->decodeEnum(parameters.cacheModel)) + return false; + if (!decoder->decode(parameters.shouldTrackVisitedLinks)) + return false; + if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath)) + return false; + if (!decoder->decode(parameters.languageCode)) + return false; + if (!decoder->decode(parameters.textCheckerState)) + return false; + +#if PLATFORM(MAC) + if (!decoder->decode(parameters.presenterApplicationPid)) + return false; + if (!decoder->decode(parameters.nsURLCachePath)) + return false; + if (!decoder->decode(parameters.nsURLCacheMemoryCapacity)) + return false; + if (!decoder->decode(parameters.nsURLCacheDiskCapacity)) + return false; + if (!decoder->decode(parameters.acceleratedCompositingPort)) + return false; + if (!decoder->decode(parameters.uiProcessBundleResourcePath)) + return false; +#elif PLATFORM(WIN) + if (!decoder->decode(parameters.shouldPaintNativeControls)) + return false; +#endif + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h new file mode 100644 index 0000000..fe582b3 --- /dev/null +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -0,0 +1,91 @@ +/* + * 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 WebProcessCreationParameters_h +#define WebProcessCreationParameters_h + +#include "CacheModel.h" +#include "SandboxExtension.h" +#include "TextCheckerState.h" +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +#if PLATFORM(MAC) +#include "MachPort.h" +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +struct WebProcessCreationParameters { + WebProcessCreationParameters(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebProcessCreationParameters&); + + String injectedBundlePath; + SandboxExtension::Handle injectedBundlePathExtensionHandle; + + String applicationCacheDirectory; + Vector<String> urlSchemesRegistererdAsEmptyDocument; + Vector<String> urlSchemesRegisteredAsSecure; + Vector<String> urlSchemesForWhichDomainRelaxationIsForbidden; + + // MIME types for which the UI process will handle showing the data. + Vector<String> mimeTypesWithCustomRepresentation; + + CacheModel cacheModel; + bool shouldTrackVisitedLinks; + + bool clearResourceCaches; + bool clearApplicationCache; + + bool shouldAlwaysUseComplexTextCodePath; + + String languageCode; + + TextCheckerState textCheckerState; + +#if PLATFORM(MAC) + pid_t presenterApplicationPid; + CString nsURLCachePath; + + uint64_t nsURLCacheMemoryCapacity; + uint64_t nsURLCacheDiskCapacity; + CoreIPC::MachPort acceleratedCompositingPort; + + CString uiProcessBundleResourcePath; +#elif PLATFORM(WIN) + bool shouldPaintNativeControls; +#endif +}; + +} // namespace WebKit + +#endif // WebProcessCreationParameters_h diff --git a/Source/WebKit2/Shared/WebSecurityOrigin.h b/Source/WebKit2/Shared/WebSecurityOrigin.h new file mode 100644 index 0000000..be684ab --- /dev/null +++ b/Source/WebKit2/Shared/WebSecurityOrigin.h @@ -0,0 +1,74 @@ +/* + * 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 WebSecurityOrigin_h +#define WebSecurityOrigin_h + +#include "APIObject.h" +#include <WebCore/SecurityOrigin.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebSecurityOrigin : public APIObject { +public: + static const Type APIType = TypeSecurityOrigin; + + static PassRefPtr<WebSecurityOrigin> create(const String& identifier) + { + RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromDatabaseIdentifier(identifier); + if (!securityOrigin) + return 0; + return adoptRef(new WebSecurityOrigin(securityOrigin.release())); + } + + static PassRefPtr<WebSecurityOrigin> create(const String& protocol, const String& host, int port) + { + RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(protocol, host, port); + if (!securityOrigin) + return 0; + return adoptRef(new WebSecurityOrigin(securityOrigin.release())); + } + + const String protocol() const { return m_securityOrigin->domain(); } + const String host() const { return m_securityOrigin->host(); } + unsigned short port() const { return m_securityOrigin->port(); } + + const String databaseIdentifier() const { return m_securityOrigin->databaseIdentifier(); } + +private: + WebSecurityOrigin(PassRefPtr<WebCore::SecurityOrigin> securityOrigin) + : m_securityOrigin(securityOrigin) + { + } + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::SecurityOrigin> m_securityOrigin; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/Shared/WebSerializedScriptValue.h b/Source/WebKit2/Shared/WebSerializedScriptValue.h new file mode 100644 index 0000000..8252aaf --- /dev/null +++ b/Source/WebKit2/Shared/WebSerializedScriptValue.h @@ -0,0 +1,80 @@ +/* + * 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 WebSerializedScriptValue_h +#define WebSerializedScriptValue_h + +#include "APIObject.h" + +#include <WebCore/SerializedScriptValue.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class WebSerializedScriptValue : public APIObject { +public: + static const Type APIType = TypeSerializedScriptValue; + + static PassRefPtr<WebSerializedScriptValue> create(WebCore::SerializedScriptValue* serializedValue) + { + return adoptRef(new WebSerializedScriptValue(serializedValue)); + } + + static PassRefPtr<WebSerializedScriptValue> create(JSContextRef context, JSValueRef value, JSValueRef* exception) + { + RefPtr<WebCore::SerializedScriptValue> serializedValue = WebCore::SerializedScriptValue::create(context, value, exception); + if (!serializedValue) + return 0; + return adoptRef(new WebSerializedScriptValue(serializedValue.get())); + } + + static PassRefPtr<WebSerializedScriptValue> adopt(Vector<uint8_t>& buffer) + { + return adoptRef(new WebSerializedScriptValue(WebCore::SerializedScriptValue::adopt(buffer))); + } + + JSValueRef deserialize(JSContextRef context, JSValueRef* exception) + { + return m_serializedScriptValue->deserialize(context, exception); + } + + const Vector<uint8_t>& data() { return m_serializedScriptValue->data(); } + + void* internalRepresentation() { return m_serializedScriptValue.get(); } + +private: + explicit WebSerializedScriptValue(PassRefPtr<WebCore::SerializedScriptValue> serializedScriptValue) + : m_serializedScriptValue(serializedScriptValue) + { + } + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::SerializedScriptValue> m_serializedScriptValue; +}; + +} + +#endif // WebSerializedScriptValue_h diff --git a/Source/WebKit2/Shared/WebString.h b/Source/WebKit2/Shared/WebString.h new file mode 100644 index 0000000..a77293b --- /dev/null +++ b/Source/WebKit2/Shared/WebString.h @@ -0,0 +1,95 @@ +/* + * 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 WebString_h +#define WebString_h + +#include "APIObject.h" +#include <JavaScriptCore/JSStringRef.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> +#include <wtf/unicode/UTF8.h> + +namespace WebKit { + +// WebString - A string type suitable for vending to an API. + +class WebString : public APIObject { +public: + static const Type APIType = TypeString; + + static PassRefPtr<WebString> create(const String& string) + { + return adoptRef(new WebString(string)); + } + + static PassRefPtr<WebString> create(JSStringRef jsStringRef) + { + return adoptRef(new WebString(String(JSStringGetCharactersPtr(jsStringRef), JSStringGetLength(jsStringRef)))); + } + + static PassRefPtr<WebString> createFromUTF8String(const char* string) + { + return adoptRef(new WebString(String::fromUTF8(string))); + } + + bool isNull() const { return m_string.isNull(); } + bool isEmpty() const { return m_string.isEmpty(); } + + size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; } + size_t getUTF8CString(char* buffer, size_t bufferSize) + { + if (!bufferSize) + return 0; + char* p = buffer; + const UChar* d = m_string.characters(); + WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&d, d + m_string.length(), &p, p + bufferSize - 1, /* strict */ true); + *p++ = '\0'; + if (result != WTF::Unicode::conversionOK && result != WTF::Unicode::targetExhausted) + return 0; + return p - buffer; + } + + bool equal(WebString* other) { return m_string == other->m_string; } + bool equalToUTF8String(const char* other) { return m_string == String::fromUTF8(other); } + + const String& string() const { return m_string; } + + JSStringRef createJSString() const { return JSStringCreateWithCharacters(m_string.characters(), m_string.length()); } + +private: + WebString(const String& string) + : m_string(!string.impl() ? String(StringImpl::empty()) : string) + { + } + + virtual Type type() const { return APIType; } + + String m_string; +}; + +} // namespace WebKit + +#endif // WebString_h diff --git a/Source/WebKit2/Shared/WebTouchEvent.cpp b/Source/WebKit2/Shared/WebTouchEvent.cpp new file mode 100644 index 0000000..f42f48c --- /dev/null +++ b/Source/WebKit2/Shared/WebTouchEvent.cpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#if ENABLE(TOUCH_EVENTS) + +#include "WebEvent.h" + +#include "ArgumentCoders.h" +#include "Arguments.h" + +namespace WebKit { + +WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> touchPoints, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_touchPoints(touchPoints) + , m_ctrlKey(ctrlKey) + , m_altKey(altKey) + , m_shiftKey(shiftKey) + , m_metaKey(metaKey) +{ + ASSERT(isTouchEventType(type)); +} + +void WebTouchEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + + encoder->encode(CoreIPC::In(m_touchPoints)); +} + +bool WebTouchEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + + return decoder->decode(CoreIPC::Out(t.m_touchPoints)); +} + +bool WebTouchEvent::isTouchEventType(Type type) +{ + return type == TouchStart || type == TouchMove || type == TouchEnd || type == TouchCancel; +} + +} // namespace WebKit + +#endif // ENABLE(TOUCH_EVENTS) diff --git a/Source/WebKit2/Shared/WebURL.h b/Source/WebKit2/Shared/WebURL.h new file mode 100644 index 0000000..1b0826b --- /dev/null +++ b/Source/WebKit2/Shared/WebURL.h @@ -0,0 +1,64 @@ +/* + * 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 WebURL_h +#define WebURL_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +// WebURL - A URL type suitable for vending to an API. + +class WebURL : public APIObject { +public: + static const Type APIType = TypeURL; + + static PassRefPtr<WebURL> create(const String& string) + { + return adoptRef(new WebURL(string)); + } + + bool isNull() const { return m_string.isNull(); } + bool isEmpty() const { return m_string.isEmpty(); } + + const String& string() const { return m_string; } + +private: + WebURL(const String& string) + : m_string(string) + { + } + + virtual Type type() const { return APIType; } + + String m_string; +}; + +} // namespace WebKit + +#endif // WebURL_h diff --git a/Source/WebKit2/Shared/WebURLRequest.cpp b/Source/WebKit2/Shared/WebURLRequest.cpp new file mode 100644 index 0000000..1e255c2 --- /dev/null +++ b/Source/WebKit2/Shared/WebURLRequest.cpp @@ -0,0 +1,26 @@ +/* + * WebURLRequest.cpp + * WebKit2 + * + * Created by Sam Weinig on 8/30/10. + * Copyright 2010 Apple Inc. All rights reserved. + * + */ + +#include "WebURLRequest.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebURLRequest> WebURLRequest::create(const KURL& url) +{ + return adoptRef(new WebURLRequest(ResourceRequest(url))); +} + +WebURLRequest::WebURLRequest(const ResourceRequest& request) + : m_request(request) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebURLRequest.h b/Source/WebKit2/Shared/WebURLRequest.h new file mode 100644 index 0000000..6cb5ba8 --- /dev/null +++ b/Source/WebKit2/Shared/WebURLRequest.h @@ -0,0 +1,73 @@ +/* + * 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 WebURLRequest_h +#define WebURLRequest_h + +#include "APIObject.h" +#include <WebCore/ResourceRequest.h> +#include <wtf/Forward.h> + +#if PLATFORM(MAC) +typedef NSURLRequest* PlatformRequest; +#elif PLATFORM(WIN) +typedef CFURLRequestRef PlatformRequest; +#else +typedef void* PlatformRequest; +#endif + +namespace WebKit { + +class WebURLRequest : public APIObject { +public: + static const Type APIType = TypeURLRequest; + + static PassRefPtr<WebURLRequest> create(const WebCore::KURL&); + + static PassRefPtr<WebURLRequest> create(const WebCore::ResourceRequest& request) + { + return adoptRef(new WebURLRequest(request)); + } + + static PassRefPtr<WebURLRequest> create(PlatformRequest platformRequest) + { + return adoptRef(new WebURLRequest(platformRequest)); + } + + PlatformRequest platformRequest() const; + const WebCore::ResourceRequest& resourceRequest() const { return m_request; } + +private: + explicit WebURLRequest(const WebCore::ResourceRequest&); + explicit WebURLRequest(PlatformRequest); + + virtual Type type() const { return APIType; } + + WebCore::ResourceRequest m_request; +}; + +} // namespace WebKit + +#endif // WebURLRequest_h diff --git a/Source/WebKit2/Shared/WebURLResponse.cpp b/Source/WebKit2/Shared/WebURLResponse.cpp new file mode 100644 index 0000000..8f8ec14 --- /dev/null +++ b/Source/WebKit2/Shared/WebURLResponse.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLResponse.h" + +namespace WebKit { + +WebURLResponse::WebURLResponse(const WebCore::ResourceResponse& response) + : m_response(response) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebURLResponse.h b/Source/WebKit2/Shared/WebURLResponse.h new file mode 100644 index 0000000..4f06db2 --- /dev/null +++ b/Source/WebKit2/Shared/WebURLResponse.h @@ -0,0 +1,71 @@ +/* + * 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 WebURLResponse_h +#define WebURLResponse_h + +#include "APIObject.h" +#include <WebCore/ResourceResponse.h> +#include <wtf/Forward.h> + +#if PLATFORM(MAC) +typedef NSURLResponse* PlatformResponse; +#elif PLATFORM(WIN) +typedef CFURLResponseRef PlatformResponse; +#else +typedef void* PlatformResponse; +#endif + +namespace WebKit { + +class WebURLResponse : public APIObject { +public: + static const Type APIType = TypeURLResponse; + + static PassRefPtr<WebURLResponse> create(const WebCore::ResourceResponse& response) + { + return adoptRef(new WebURLResponse(response)); + } + + static PassRefPtr<WebURLResponse> create(PlatformResponse platformResponse) + { + return adoptRef(new WebURLResponse(platformResponse)); + } + + PlatformResponse platformResponse() const; + const WebCore::ResourceResponse& resourceResponse() const { return m_response; } + +private: + explicit WebURLResponse(const WebCore::ResourceResponse&); + explicit WebURLResponse(PlatformResponse); + + virtual Type type() const { return APIType; } + + WebCore::ResourceResponse m_response; +}; + +} // namespace WebKit + +#endif // WebURLResponse_h diff --git a/Source/WebKit2/Shared/WebUserContentURLPattern.h b/Source/WebKit2/Shared/WebUserContentURLPattern.h new file mode 100644 index 0000000..a466e94 --- /dev/null +++ b/Source/WebKit2/Shared/WebUserContentURLPattern.h @@ -0,0 +1,65 @@ +/* + * 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 WebUserContentURLPattern_h +#define WebUserContentURLPattern_h + +#include "APIObject.h" + +#include <WebCore/KURL.h> +#include <WebCore/UserContentURLPattern.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class WebUserContentURLPattern : public APIObject { +public: + static const Type APIType = TypeUserContentURLPattern; + + static PassRefPtr<WebUserContentURLPattern> create(const String& pattern) + { + return adoptRef(new WebUserContentURLPattern(pattern)); + } + + bool matchesURL(const String& url) const { return m_pattern.matches(WebCore::KURL(WebCore::ParsedURLString, url)); } + + const String& patternString() const { return m_patternString; } + +private: + explicit WebUserContentURLPattern(const String& pattern) + : m_pattern(WebCore::UserContentURLPattern(pattern)) + , m_patternString(pattern) + { + } + + virtual Type type() const { return APIType; } + + WebCore::UserContentURLPattern m_pattern; + String m_patternString; +}; + +} + +#endif // WebUserContentURLPattern_h diff --git a/Source/WebKit2/Shared/WebWheelEvent.cpp b/Source/WebKit2/Shared/WebWheelEvent.cpp new file mode 100644 index 0000000..570b8e0 --- /dev/null +++ b/Source/WebKit2/Shared/WebWheelEvent.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEvent.h" + +#include "Arguments.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) + , m_delta(delta) + , m_wheelTicks(wheelTicks) + , m_granularity(granularity) +{ + 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) + : WebEvent(type, modifiers, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) + , m_delta(delta) + , m_wheelTicks(wheelTicks) + , m_granularity(granularity) + , m_phase(phase) +{ + ASSERT(isWheelEventType(type)); +} +#endif + +void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + + encoder->encode(m_position); + encoder->encode(m_globalPosition); + encoder->encode(m_delta); + encoder->encode(m_wheelTicks); + encoder->encode(m_granularity); +#if PLATFORM(MAC) + encoder->encode(m_phase); +#endif +} + +bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + if (!decoder->decode(t.m_position)) + return false; + if (!decoder->decode(t.m_globalPosition)) + return false; + if (!decoder->decode(t.m_delta)) + return false; + if (!decoder->decode(t.m_wheelTicks)) + return false; + if (!decoder->decode(t.m_granularity)) + return false; +#if PLATFORM(MAC) + if (!decoder->decode(t.m_phase)) + return false; +#endif + return true; +} + +bool WebWheelEvent::isWheelEventType(Type type) +{ + return type == Wheel; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp new file mode 100644 index 0000000..f5dbbc4 --- /dev/null +++ b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ShareableBitmap.h" + +#include "NotImplemented.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() +{ + notImplemented(); + return 0; +} + +void ShareableBitmap::paint(GraphicsContext&, const IntPoint&, const IntRect&) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp new file mode 100644 index 0000000..4edf46f --- /dev/null +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp @@ -0,0 +1,462 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ArgumentCodersCF.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "DataReference.h" +#include <wtf/Vector.h> + +namespace CoreIPC { + +CFTypeRef tokenNullTypeRef() +{ + static CFStringRef tokenNullType = CFSTR("WKNull"); + return tokenNullType; +} + +enum CFType { + CFArray, + CFBoolean, + CFData, + CFDictionary, + CFNull, + CFNumber, + CFString, + CFURL, + Null, + Unknown, +}; + +static CFType typeFromCFTypeRef(CFTypeRef type) +{ + ASSERT(type); + + if (type == tokenNullTypeRef()) + return Null; + + CFTypeID typeID = CFGetTypeID(type); + if (typeID == CFArrayGetTypeID()) + return CFArray; + if (typeID == CFBooleanGetTypeID()) + return CFBoolean; + if (typeID == CFDataGetTypeID()) + return CFData; + if (typeID == CFDictionaryGetTypeID()) + return CFDictionary; + if (typeID == CFNullGetTypeID()) + return CFNull; + if (typeID == CFNumberGetTypeID()) + return CFNumber; + if (typeID == CFStringGetTypeID()) + return CFString; + if (typeID == CFURLGetTypeID()) + return CFURL; + + ASSERT_NOT_REACHED(); + return Unknown; +} + +static void encode(ArgumentEncoder* encoder, CFTypeRef typeRef) +{ + CFType type = typeFromCFTypeRef(typeRef); + encoder->encodeEnum(type); + + switch (type) { + case CFArray: + encode(encoder, static_cast<CFArrayRef>(typeRef)); + return; + case CFBoolean: + encode(encoder, static_cast<CFBooleanRef>(typeRef)); + return; + case CFData: + encode(encoder, static_cast<CFDataRef>(typeRef)); + return; + case CFDictionary: + encode(encoder, static_cast<CFDictionaryRef>(typeRef)); + return; + case CFNull: + return; + case CFNumber: + encode(encoder, static_cast<CFNumberRef>(typeRef)); + return; + case CFString: + encode(encoder, static_cast<CFStringRef>(typeRef)); + return; + case CFURL: + encode(encoder, static_cast<CFURLRef>(typeRef)); + return; + case Null: + return; + case Unknown: + break; + } + + ASSERT_NOT_REACHED(); +} + +static bool decode(ArgumentDecoder* decoder, RetainPtr<CFTypeRef>& result) +{ + CFType type; + if (!decoder->decodeEnum(type)) + return false; + + switch (type) { + case CFArray: { + RetainPtr<CFArrayRef> array; + if (!decode(decoder, array)) + return false; + result.adoptCF(array.leakRef()); + return true; + } + case CFBoolean: { + RetainPtr<CFBooleanRef> boolean; + if (!decode(decoder, boolean)) + return false; + result.adoptCF(boolean.leakRef()); + return true; + } + case CFData: { + RetainPtr<CFDataRef> data; + if (!decode(decoder, data)) + return false; + result.adoptCF(data.leakRef()); + return true; + } + case CFDictionary: { + RetainPtr<CFDictionaryRef> dictionary; + if (!decode(decoder, dictionary)) + return false; + result.adoptCF(dictionary.leakRef()); + return true; + } + case CFNull: + result.adoptCF(kCFNull); + return true; + case CFNumber: { + RetainPtr<CFNumberRef> number; + if (!decode(decoder, number)) + return false; + result.adoptCF(number.leakRef()); + return true; + } + case CFString: { + RetainPtr<CFStringRef> string; + if (!decode(decoder, string)) + return false; + result.adoptCF(string.leakRef()); + return true; + } + case CFURL: { + RetainPtr<CFURLRef> url; + if (!decode(decoder, url)) + return false; + result.adoptCF(url.leakRef()); + return true; + } + case Null: + result = tokenNullTypeRef(); + return true; + case Unknown: + ASSERT_NOT_REACHED(); + return false; + } + + return false; +} + +void encode(ArgumentEncoder* encoder, CFArrayRef array) +{ + CFIndex size = CFArrayGetCount(array); + Vector<CFTypeRef, 32> values(size); + + CFArrayGetValues(array, CFRangeMake(0, size), values.data()); + + encoder->encodeUInt64(size); + for (CFIndex i = 0; i < size; ++i) { + ASSERT(values[i]); + + encode(encoder, values[i]); + } +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFArrayRef>& result) +{ + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks)); + + for (size_t i = 0; i < size; ++i) { + RetainPtr<CFTypeRef> element; + if (!decode(decoder, element)) + return false; + + CFArrayAppendValue(array.get(), element.get()); + } + + result.adoptCF(array.leakRef()); + return true; +} + +void encode(ArgumentEncoder* encoder, CFBooleanRef boolean) +{ + encoder->encodeBool(CFBooleanGetValue(boolean)); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFBooleanRef>& result) +{ + bool boolean; + if (!decoder->decode(boolean)) + return false; + + result.adoptCF(boolean ? kCFBooleanTrue : kCFBooleanFalse); + return true; +} + +void encode(ArgumentEncoder* encoder, CFDataRef data) +{ + CFIndex length = CFDataGetLength(data); + const UInt8* bytePtr = CFDataGetBytePtr(data); + + encoder->encodeBytes(bytePtr, length); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFDataRef>& result) +{ + CoreIPC::DataReference dataReference; + if (!decoder->decode(dataReference)) + return false; + + result.adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size())); + return true; +} + +void encode(ArgumentEncoder* encoder, CFDictionaryRef dictionary) +{ + CFIndex size = CFDictionaryGetCount(dictionary); + Vector<CFTypeRef, 32> keys(size); + Vector<CFTypeRef, 32> values(size); + + CFDictionaryGetKeysAndValues(dictionary, keys.data(), values.data()); + + encoder->encodeUInt64(size); + + for (CFIndex i = 0; i < size; ++i) { + ASSERT(keys[i]); + ASSERT(CFGetTypeID(keys[i]) == CFStringGetTypeID()); + ASSERT(values[i]); + + // Ignore values we don't recognize. + if (typeFromCFTypeRef(values[i]) == Unknown) + continue; + + encode(encoder, static_cast<CFStringRef>(keys[i])); + encode(encoder, values[i]); + } +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFDictionaryRef>& result) +{ + uint64_t size; + if (!decoder->decodeUInt64(size)) + return false; + + RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + for (uint64_t i = 0; i < size; ++i) { + // Try to decode the key name. + RetainPtr<CFStringRef> key; + if (!decode(decoder, key)) + return false; + + RetainPtr<CFTypeRef> value; + if (!decode(decoder, value)) + return false; + + CFDictionarySetValue(dictionary.get(), key.get(), value.get()); + } + + result.adoptCF(dictionary.releaseRef()); + return true; +} + +void encode(ArgumentEncoder* encoder, CFNumberRef number) +{ + CFNumberType numberType = CFNumberGetType(number); + + Vector<uint8_t> buffer(CFNumberGetByteSize(number)); + bool result = CFNumberGetValue(number, numberType, buffer.data()); + ASSERT_UNUSED(result, result); + + encoder->encodeEnum(numberType); + encoder->encodeBytes(buffer.data(), buffer.size()); +} + +static size_t sizeForNumberType(CFNumberType numberType) +{ + switch (numberType) { + case kCFNumberSInt8Type: + return sizeof(SInt8); + case kCFNumberSInt16Type: + return sizeof(SInt16); + case kCFNumberSInt32Type: + return sizeof(SInt32); + case kCFNumberSInt64Type: + return sizeof(SInt64); + case kCFNumberFloat32Type: + return sizeof(Float32); + case kCFNumberFloat64Type: + return sizeof(Float64); + case kCFNumberCharType: + return sizeof(char); + case kCFNumberShortType: + return sizeof(short); + case kCFNumberIntType: + return sizeof(int); + case kCFNumberLongType: + return sizeof(long); + case kCFNumberLongLongType: + return sizeof(long long); + case kCFNumberFloatType: + return sizeof(float); + case kCFNumberDoubleType: + return sizeof(double); + case kCFNumberCFIndexType: + return sizeof(CFIndex); + case kCFNumberNSIntegerType: +#ifdef __LP64__ + return sizeof(long); +#else + return sizeof(int); +#endif + case kCFNumberCGFloatType: +#ifdef __LP64__ + return sizeof(double); +#else + return sizeof(float); +#endif + } + + return 0; +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFNumberRef>& result) +{ + CFNumberType numberType; + if (!decoder->decodeEnum(numberType)) + return false; + + CoreIPC::DataReference dataReference; + if (!decoder->decode(dataReference)) + return false; + + size_t neededBufferSize = sizeForNumberType(numberType); + if (!neededBufferSize || dataReference.size() != neededBufferSize) + return false; + + ASSERT(dataReference.data()); + CFNumberRef number = CFNumberCreate(0, numberType, dataReference.data()); + result.adoptCF(number); + + return true; +} + +void encode(ArgumentEncoder* encoder, CFStringRef string) +{ + CFIndex length = CFStringGetLength(string); + CFStringEncoding encoding = CFStringGetFastestEncoding(string); + + CFRange range = CFRangeMake(0, length); + CFIndex bufferLength = 0; + + CFIndex numConvertedBytes = CFStringGetBytes(string, range, encoding, 0, false, 0, 0, &bufferLength); + ASSERT(numConvertedBytes == length); + + Vector<UInt8, 128> buffer(bufferLength); + numConvertedBytes = CFStringGetBytes(string, range, encoding, 0, false, buffer.data(), buffer.size(), &bufferLength); + ASSERT(numConvertedBytes == length); + + encoder->encodeEnum(encoding); + encoder->encodeBytes(buffer.data(), bufferLength); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFStringRef>& result) +{ + CFStringEncoding encoding; + if (!decoder->decodeEnum(encoding)) + return false; + + if (!CFStringIsEncodingAvailable(encoding)) + return false; + + CoreIPC::DataReference dataReference; + if (!decoder->decode(dataReference)) + return false; + + CFStringRef string = CFStringCreateWithBytes(0, dataReference.data(), dataReference.size(), encoding, false); + if (!string) + return false; + + result.adoptCF(string); + return true; +} + +void encode(ArgumentEncoder* encoder, CFURLRef url) +{ + CFURLRef baseURL = CFURLGetBaseURL(url); + encoder->encodeBool(baseURL); + if (baseURL) + encode(encoder, baseURL); + + encode(encoder, CFURLGetString(url)); +} + +bool decode(ArgumentDecoder* decoder, RetainPtr<CFURLRef>& result) +{ + RetainPtr<CFURLRef> baseURL; + bool hasBaseURL; + if (!decoder->decodeBool(hasBaseURL)) + return false; + if (hasBaseURL) { + if (!decode(decoder, baseURL)) + return false; + } + + RetainPtr<CFStringRef> string; + if (!decode(decoder, string)) + return false; + + CFURLRef url = CFURLCreateWithString(0, string.get(), baseURL.get()); + if (!url) + return false; + + result.adoptCF(url); + return true; +} + +} // namespace CoreIPC + diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.h b/Source/WebKit2/Shared/cf/ArgumentCodersCF.h new file mode 100644 index 0000000..4caec5f --- /dev/null +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.h @@ -0,0 +1,68 @@ +/* + * 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 ArgumentCodersCF_h +#define ArgumentCodersCF_h + +#include <wtf/RetainPtr.h> + +namespace CoreIPC { + +class ArgumentEncoder; +class ArgumentDecoder; + +// CFArrayRef +void encode(ArgumentEncoder*, CFArrayRef); +bool decode(ArgumentDecoder*, RetainPtr<CFArrayRef>& result); + +// CFBooleanRef +void encode(ArgumentEncoder*, CFBooleanRef); +bool decode(ArgumentDecoder*, RetainPtr<CFBooleanRef>& result); + +// CFDataRef +void encode(ArgumentEncoder*, CFDataRef); +bool decode(ArgumentDecoder*, RetainPtr<CFDataRef>& result); + +// CFDictionaryRef +void encode(ArgumentEncoder*, CFDictionaryRef); +bool decode(ArgumentDecoder*, RetainPtr<CFDictionaryRef>& result); + +// CFNumberRef +void encode(ArgumentEncoder*, CFNumberRef); +bool decode(ArgumentDecoder*, RetainPtr<CFNumberRef>& result); + +// CFStringRef +void encode(ArgumentEncoder*, CFStringRef); +bool decode(ArgumentDecoder*, RetainPtr<CFStringRef>& result); + +// CFURLRef +void encode(ArgumentEncoder*, CFURLRef); +bool decode(ArgumentDecoder*, RetainPtr<CFURLRef>& result); + +CFTypeRef tokenNullTypeRef(); + +} // namespace CoreIPC + +#endif // ArgumentCodersCF_h diff --git a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp new file mode 100644 index 0000000..08c5dc3 --- /dev/null +++ b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ShareableBitmap.h" + +#include <WebCore/GraphicsContext.h> +#include <wtf/RetainPtr.h> +#include "CGUtilities.h" + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() +{ + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(data(), m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(), + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + + // We want the origin to be in the top left corner so flip the backing store context. + CGContextTranslateCTM(bitmapContext.get(), 0, m_size.height()); + CGContextScaleCTM(bitmapContext.get(), 1, -1); + + return adoptPtr(new GraphicsContext(bitmapContext.get())); +} + +void ShareableBitmap::paint(WebCore::GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect) +{ + OwnPtr<GraphicsContext> sourceContext(createGraphicsContext()); + + paintBitmapContext(context.platformContext(), sourceContext->platformContext(), dstPoint, srcRect); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h b/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h new file mode 100644 index 0000000..989467e --- /dev/null +++ b/Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifndef PlatformCertificateInfo_h +#define PlatformCertificateInfo_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <WebCore/ResourceResponse.h> + +namespace WebKit { + +class PlatformCertificateInfo { +public: + PlatformCertificateInfo() + { + } + + explicit PlatformCertificateInfo(const WebCore::ResourceResponse&) + { + } + + void encode(CoreIPC::ArgumentEncoder*) const + { + } + + static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&) + { + return true; + } +}; + +} // namespace WebKit + +#endif // PlatformCertificateInfo_h diff --git a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp new file mode 100644 index 0000000..b84f05c --- /dev/null +++ b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ShareableBitmap.h" + +#include "NotImplemented.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() +{ + notImplemented(); + return 0; +} + +void ShareableBitmap::paint(WebCore::GraphicsContext&, const WebCore::IntPoint& dstPoint, const WebCore::IntRect& srcRect) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp new file mode 100644 index 0000000..95d6286 --- /dev/null +++ b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebCoreArgumentCoders.h" + +#include "NotImplemented.h" + +namespace CoreIPC { + +void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest) +{ + notImplemented(); +} + +bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest) +{ + notImplemented(); + return false; +} + +void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse) +{ + notImplemented(); +} + +bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse) +{ + notImplemented(); + return false; +} + +} diff --git a/Source/WebKit2/Shared/mac/CommandLineMac.cpp b/Source/WebKit2/Shared/mac/CommandLineMac.cpp new file mode 100644 index 0000000..185aaea --- /dev/null +++ b/Source/WebKit2/Shared/mac/CommandLineMac.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "CommandLine.h" + +namespace WebKit { + +// FIXME: There's nothing Mac specific about this command line parser. +// Maybe we should move it to CommandLinePosix.cpp instead. + +bool CommandLine::parse(int argc, char** argv) +{ + if ((argc % 2)) + return false; + + for (int i = 2; i < argc; i += 2) { + if (!argv[i] || *argv[i] != '-') + return false; + + String key = String::fromUTF8(argv[i] + 1); + if (key.isEmpty()) + return false; + + String value = String::fromUTF8(argv[i + 1]); + if (value.isEmpty()) + return false; + + if (!m_args.add(key, value).second) + return false; + } + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm new file mode 100644 index 0000000..d69082d --- /dev/null +++ b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "NativeWebKeyboardEvent.h" + +#import "WebEventFactory.h" + +namespace WebKit { + +NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, NSView *view) + : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, view)) + , m_nativeEvent(event) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h new file mode 100644 index 0000000..be7eb36 --- /dev/null +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.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 PlatformCertificateInfo_h +#define PlatformCertificateInfo_h + +#include <WebCore/ResourceResponse.h> +#include <wtf/RetainPtr.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class PlatformCertificateInfo { +public: + PlatformCertificateInfo(); + explicit PlatformCertificateInfo(const WebCore::ResourceResponse&); + + CFArrayRef certificateChain() const { return m_certificateChain.get(); } + + void encode(CoreIPC::ArgumentEncoder* encoder) const; + static bool decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& t); + +#ifndef NDEBUG + void dump() const; +#endif + +private: + RetainPtr<CFArrayRef> m_certificateChain; +}; + +} // namespace WebKit + +#endif // PlatformCertificateInfo_h diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm new file mode 100644 index 0000000..0f3fee7 --- /dev/null +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PlatformCertificateInfo.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <WebKitSystemInterface.h> +#include <Security/Security.h> + +using namespace WebCore; + +namespace WebKit { + +PlatformCertificateInfo::PlatformCertificateInfo() +{ +} + +PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& response) + : m_certificateChain(AdoptCF, WKCopyNSURLResponseCertificateChain(response.nsURLResponse())) +{ +} + +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + // Special case no certificates, + if (!m_certificateChain) { + encoder->encodeUInt64(std::numeric_limits<uint64_t>::max()); + return; + } + + uint64_t length = CFArrayGetCount(m_certificateChain.get()); + encoder->encodeUInt64(length); + + for (size_t i = 0; i < length; ++i) { + RetainPtr<CFDataRef> data(AdoptCF, SecCertificateCopyData((SecCertificateRef)CFArrayGetValueAtIndex(m_certificateChain.get(), i))); + encoder->encodeBytes(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get())); + } +} + +bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& c) +{ + uint64_t length; + if (!decoder->decode(length)) + return false; + + if (length == std::numeric_limits<uint64_t>::max()) { + // This is the no certificates case. + return true; + } + + RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, length, &kCFTypeArrayCallBacks)); + + for (size_t i = 0; i < length; ++i) { + Vector<uint8_t> bytes; + if (!decoder->decodeBytes(bytes)) + return false; + + RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, bytes.data(), bytes.size(), kCFAllocatorNull)); + RetainPtr<SecCertificateRef> certificate(AdoptCF, SecCertificateCreateWithData(0, data.get())); + CFArrayAppendValue(array.get(), certificate.get()); + } + + c.m_certificateChain = array; + return true; +} + +#ifndef NDEBUG +void PlatformCertificateInfo::dump() const +{ + unsigned entries = m_certificateChain ? CFArrayGetCount(m_certificateChain.get()) : 0; + + NSLog(@"PlatformCertificateInfo\n"); + NSLog(@" Entries: %d\n", entries); + for (unsigned i = 0; i < entries; ++i) { + RetainPtr<CFStringRef> summary(AdoptCF, SecCertificateCopySubjectSummary((SecCertificateRef)CFArrayGetValueAtIndex(m_certificateChain.get(), i))); + NSLog(@" %@", (NSString *)summary.get()); + } +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/PrintInfoMac.mm b/Source/WebKit2/Shared/mac/PrintInfoMac.mm new file mode 100644 index 0000000..78cf9df --- /dev/null +++ b/Source/WebKit2/Shared/mac/PrintInfoMac.mm @@ -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. + */ + +#import "PrintInfo.h" + +namespace WebKit { + +PrintInfo::PrintInfo(NSPrintInfo *printInfo) + : pageSetupScaleFactor([[[printInfo dictionary] objectForKey:NSPrintScalingFactor] floatValue]) + , availablePaperWidth([printInfo paperSize].width - [printInfo leftMargin] - [printInfo rightMargin]) + , availablePaperHeight([printInfo paperSize].height - [printInfo topMargin] - [printInfo bottomMargin]) +{ + ASSERT(printInfo); +} + +} diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm new file mode 100644 index 0000000..68b5849 --- /dev/null +++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm @@ -0,0 +1,190 @@ +/* + * 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. + */ + +#if ENABLE(WEB_PROCESS_SANDBOX) + +#include "SandboxExtension.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "DataReference.h" +#include "WebKitSystemInterface.h" +#include <WebCore/FileSystem.h> +#include <wtf/text/CString.h> + +using namespace WebCore; + +namespace WebKit { + +SandboxExtension::Handle::Handle() + : m_sandboxExtension(0) +{ +} + +SandboxExtension::Handle::~Handle() +{ + if (m_sandboxExtension) { + WKSandboxExtensionInvalidate(m_sandboxExtension); + WKSandboxExtensionDestroy(m_sandboxExtension); + } +} + +void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + if (!m_sandboxExtension) { + encoder->encodeBytes(0, 0); + return; + } + + size_t length = 0; + const char *serializedFormat = WKSandboxExtensionGetSerializedFormat(m_sandboxExtension, &length); + ASSERT(serializedFormat); + + encoder->encodeBytes(reinterpret_cast<const uint8_t*>(serializedFormat), length); + + // Encoding will destroy the sandbox extension locally. + WKSandboxExtensionDestroy(m_sandboxExtension); + m_sandboxExtension = 0; +} + +bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& result) +{ + ASSERT(!result.m_sandboxExtension); + + CoreIPC::DataReference dataReference; + if (!decoder->decodeBytes(dataReference)) + return false; + + if (dataReference.isEmpty()) + return true; + + result.m_sandboxExtension = WKSandboxExtensionCreateFromSerializedFormat(reinterpret_cast<const char*>(dataReference.data()), dataReference.size()); + return true; +} + +PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle& handle) +{ + if (!handle.m_sandboxExtension) + return 0; + + return adoptRef(new SandboxExtension(handle)); +} + +static WKSandboxExtensionType wkSandboxExtensionType(SandboxExtension::Type type) +{ + switch (type) { + case SandboxExtension::ReadOnly: + return WKSandboxExtensionTypeReadOnly; + case SandboxExtension::WriteOnly: + return WKSandboxExtensionTypeWriteOnly; + case SandboxExtension::ReadWrite: + return WKSandboxExtensionTypeReadWrite; + } + + ASSERT_NOT_REACHED(); + return WKSandboxExtensionTypeReadOnly; +} + +void SandboxExtension::createHandle(const String& path, Type type, Handle& handle) +{ + ASSERT(!handle.m_sandboxExtension); + + NSString *standardizedPath = [(NSString *)path stringByStandardizingPath]; + handle.m_sandboxExtension = WKSandboxExtensionCreate([standardizedPath fileSystemRepresentation], wkSandboxExtensionType(type)); +} + +String SandboxExtension::createHandleForTemporaryFile(const String& prefix, Type type, Handle& handle) +{ + ASSERT(!handle.m_sandboxExtension); + + Vector<char> path(PATH_MAX); + if (!confstr(_CS_DARWIN_USER_TEMP_DIR, path.data(), path.size())) + return String(); + + // Shrink the vector. + path.shrink(strlen(path.data())); + ASSERT(path.last() == '/'); + + // Append the file name. + path.append(prefix.utf8().data(), prefix.length()); + path.append('\0'); + + handle.m_sandboxExtension = WKSandboxExtensionCreate(fileSystemRepresentation(path.data()).data(), wkSandboxExtensionType(type)); + + if (!handle.m_sandboxExtension) { + return String(); + } + return String(path.data()); +} + +SandboxExtension::SandboxExtension(const Handle& handle) + : m_sandboxExtension(handle.m_sandboxExtension) +{ + handle.m_sandboxExtension = 0; +} + +SandboxExtension::~SandboxExtension() +{ + if (!m_sandboxExtension) + return; + + WKSandboxExtensionInvalidate(m_sandboxExtension); + WKSandboxExtensionDestroy(m_sandboxExtension); +} + +bool SandboxExtension::invalidate() +{ + ASSERT(m_sandboxExtension); + + bool result = WKSandboxExtensionInvalidate(m_sandboxExtension); + WKSandboxExtensionDestroy(m_sandboxExtension); + m_sandboxExtension = 0; + + return result; +} + +bool SandboxExtension::consume() +{ + ASSERT(m_sandboxExtension); + + return WKSandboxExtensionConsume(m_sandboxExtension); +} + +bool SandboxExtension::consumePermanently() +{ + ASSERT(m_sandboxExtension); + + bool result = WKSandboxExtensionConsume(m_sandboxExtension); + + // Destroy the extension without invalidating it. + WKSandboxExtensionDestroy(m_sandboxExtension); + m_sandboxExtension = 0; + + return result; +} + +} // namespace WebKit + +#endif // ENABLE(WEB_PROCESS_SANDBOX) diff --git a/Source/WebKit2/Shared/mac/UpdateChunk.cpp b/Source/WebKit2/Shared/mac/UpdateChunk.cpp new file mode 100644 index 0000000..a9376db --- /dev/null +++ b/Source/WebKit2/Shared/mac/UpdateChunk.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "UpdateChunk.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "Attachment.h" +#include "WebCoreArgumentCoders.h" +#include <WebCore/FloatRect.h> +#include <mach/vm_map.h> +#include <wtf/RetainPtr.h> + +using namespace WebCore; + +namespace WebKit { + +UpdateChunk::UpdateChunk() + : m_data(0) + , m_size(0) +{ +} + +UpdateChunk::UpdateChunk(const IntRect& rect) + : m_rect(rect) + , m_size(size()) +{ + vm_allocate(mach_task_self(), reinterpret_cast<vm_address_t*>(&m_data), m_size, VM_FLAGS_ANYWHERE); +} + +UpdateChunk::~UpdateChunk() +{ + if (m_data) + vm_deallocate(mach_task_self(), reinterpret_cast<vm_address_t>(m_data), m_size); +} + +RetainPtr<CGImageRef> UpdateChunk::createImage() +{ + RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithData(0, m_data, size(), 0)); + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(m_rect.width(), m_rect.height(), 8, 32, m_rect.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, provider.get(), 0, false, kCGRenderingIntentDefault)); + + return image; +} + +void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_rect); + encoder->encode(CoreIPC::Attachment(m_data, size(), MACH_MSG_VIRTUAL_COPY, true)); + + m_data = 0; +} + +bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) +{ + IntRect rect; + if (!decoder->decode(rect)) + return false; + chunk.m_rect = rect; + + CoreIPC::Attachment attachment; + if (!decoder->decode(attachment)) + return false; + + chunk.m_size = attachment.size(); + chunk.m_data = reinterpret_cast<uint8_t*>(attachment.address()); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/UpdateChunk.h b/Source/WebKit2/Shared/mac/UpdateChunk.h new file mode 100644 index 0000000..6d4fca0 --- /dev/null +++ b/Source/WebKit2/Shared/mac/UpdateChunk.h @@ -0,0 +1,66 @@ +/* + * 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 UpdateChunk_h +#define UpdateChunk_h + +#include <WebCore/IntRect.h> +#include <wtf/RetainPtr.h> + +namespace CoreIPC { + class ArgumentEncoder; + class ArgumentDecoder; +} + +namespace WebKit { + +class UpdateChunk { +public: + UpdateChunk(); + UpdateChunk(const WebCore::IntRect&); + ~UpdateChunk(); + + uint8_t* data() { return m_data; } + const WebCore::IntRect& rect() const { return m_rect; } + bool isEmpty() const { return m_rect.isEmpty(); } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&); + + RetainPtr<CGImageRef> createImage(); + +private: + size_t size() const { return m_rect.width() * 4 * m_rect.height(); } + + WebCore::IntRect m_rect; + + // This needs to be mutable, because encoding an update chunk will hand over its memory to the target process. + mutable uint8_t* m_data; + size_t m_size; +}; + +} // namespace WebKit + +#endif // UpdateChunk_h diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm new file mode 100644 index 0000000..8ffba8a --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebCoreArgumentCoders.h" + +#include "ArgumentCodersCF.h" +#include "WebKitSystemInterface.h" + +namespace CoreIPC { + +void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest) +{ + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLRequestCreateSerializableRepresentation(resourceRequest.nsURLRequest(), CoreIPC::tokenNullTypeRef())); + encode(encoder, dictionary.get()); +} + +bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest) +{ + RetainPtr<CFDictionaryRef> dictionary; + if (!decode(decoder, dictionary)) + return false; + + NSURLRequest *nsURLRequest = WKNSURLRequestFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); + if (!nsURLRequest) + return false; + + resourceRequest = WebCore::ResourceRequest(nsURLRequest); + return true; +} + +void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse) +{ + bool responseIsPresent = resourceResponse.nsURLResponse(); + encoder->encode(responseIsPresent); + + if (!responseIsPresent) + return; + + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLResponseCreateSerializableRepresentation(resourceResponse.nsURLResponse(), CoreIPC::tokenNullTypeRef())); + encode(encoder, dictionary.get()); +} + +bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse) +{ + bool responseIsPresent; + decoder->decode(responseIsPresent); + + if (!responseIsPresent) { + resourceResponse = WebCore::ResourceResponse(); + return true; + } + + RetainPtr<CFDictionaryRef> dictionary; + if (!decode(decoder, dictionary)) + return false; + + NSURLResponse* nsURLResponse = WKNSURLResponseFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); + if (!nsURLResponse) + return false; + + resourceResponse = WebCore::ResourceResponse(nsURLResponse); + return true; +} + + +} // namespace CoreIPC diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.h b/Source/WebKit2/Shared/mac/WebEventFactory.h new file mode 100644 index 0000000..7bc8d97 --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebEventFactory.h @@ -0,0 +1,45 @@ +/* + * 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 WebEventFactory_h +#define WebEventFactory_h + +#import "WebEvent.h" + +namespace WebKit { + +// FIXME: This is not needed in the WebProcess and should be moved to be a peer +// of WKView. + +class WebEventFactory { +public: + static WebMouseEvent createWebMouseEvent(NSEvent *event, NSView *windowView); + static WebWheelEvent createWebWheelEvent(NSEvent *event, NSView *windowView); + static WebKeyboardEvent createWebKeyboardEvent(NSEvent *event, NSView *windowView); +}; + +} // namespace WebKit + +#endif // WebEventFactory_h diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm new file mode 100644 index 0000000..46ff906 --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm @@ -0,0 +1,1047 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebEventFactory.h" + +#import "WebKitSystemInterface.h" +#import <wtf/ASCIICType.h> +#import <WebCore/Scrollbar.h> + +using namespace WebCore; + +namespace WebKit { + +static WebMouseEvent::Button mouseButtonForEvent(NSEvent *event) +{ + switch ([event type]) { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSLeftMouseDragged: + return WebMouseEvent::LeftButton; + case NSRightMouseDown: + case NSRightMouseUp: + case NSRightMouseDragged: + return WebMouseEvent::RightButton; + case NSOtherMouseDown: + case NSOtherMouseUp: + case NSOtherMouseDragged: + return WebMouseEvent::MiddleButton; + default: + return WebMouseEvent::NoButton; + } +} + +static WebEvent::Type mouseEventTypeForEvent(NSEvent* event) +{ + switch ([event type]) { + case NSLeftMouseDragged: + case NSMouseEntered: + case NSMouseExited: + case NSMouseMoved: + case NSOtherMouseDragged: + case NSRightMouseDragged: + return WebEvent::MouseMove; + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + return WebEvent::MouseDown; + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + return WebEvent::MouseUp; + default: + return WebEvent::MouseMove; + } +} + +static int clickCountForEvent(NSEvent *event) +{ + switch ([event type]) { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSLeftMouseDragged: + case NSRightMouseDown: + case NSRightMouseUp: + case NSRightMouseDragged: + case NSOtherMouseDown: + case NSOtherMouseUp: + case NSOtherMouseDragged: + return [event clickCount]; + default: + return 0; + } +} + +static NSScreen *screenForWindow(NSWindow *window) +{ + NSScreen *screen = [window screen]; // nil if the window is off-screen + if (screen) + return screen; + + NSArray *screens = [NSScreen screens]; + if ([screens count] > 0) + return [screens objectAtIndex:0]; // screen containing the menubar + + return nil; +} + +static NSPoint flipScreenPoint(const NSPoint& screenPoint, NSScreen *screen) +{ + NSPoint flippedPoint = screenPoint; + flippedPoint.y = NSMaxY([screen frame]) - flippedPoint.y; + return flippedPoint; +} + +static NSPoint globalPoint(const NSPoint& windowPoint, NSWindow *window) +{ + return flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)); +} + +static NSPoint globalPointForEvent(NSEvent *event) +{ + switch ([event type]) { + case NSLeftMouseDown: + case NSLeftMouseDragged: + case NSLeftMouseUp: + case NSMouseEntered: + case NSMouseExited: + case NSMouseMoved: + case NSOtherMouseDown: + case NSOtherMouseDragged: + case NSOtherMouseUp: + case NSRightMouseDown: + case NSRightMouseDragged: + case NSRightMouseUp: + case NSScrollWheel: + return globalPoint([event locationInWindow], [event window]); + default: + return NSZeroPoint; + } +} + +static NSPoint pointForEvent(NSEvent *event, NSView *windowView) +{ + switch ([event type]) { + case NSLeftMouseDown: + case NSLeftMouseDragged: + case NSLeftMouseUp: + case NSMouseEntered: + case NSMouseExited: + case NSMouseMoved: + case NSOtherMouseDown: + case NSOtherMouseDragged: + case NSOtherMouseUp: + case NSRightMouseDown: + case NSRightMouseDragged: + case NSRightMouseUp: + case NSScrollWheel: { + // Note: This will have its origin at the bottom left of the window unless windowView is flipped. + // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow. + NSPoint location = [event locationInWindow]; + if (windowView) + location = [windowView convertPoint:location fromView:nil]; + return location; + } + default: + return NSZeroPoint; + } +} + +static WebWheelEvent::Phase phaseForEvent(NSEvent *event) +{ +#if !defined(BUILDING_ON_SNOW_LEOPARD) + uint32_t phase = WebWheelEvent::PhaseNone; + if ([event momentumPhase] & NSEventPhaseBegan) + phase |= WebWheelEvent::PhaseBegan; + if ([event momentumPhase] & NSEventPhaseStationary) + phase |= WebWheelEvent::PhaseStationary; + if ([event momentumPhase] & NSEventPhaseChanged) + phase |= WebWheelEvent::PhaseChanged; + if ([event momentumPhase] & NSEventPhaseEnded) + phase |= WebWheelEvent::PhaseEnded; + if ([event momentumPhase] & NSEventPhaseCancelled) + phase |= WebWheelEvent::PhaseCancelled; + return static_cast<WebWheelEvent::Phase>(phase); +#else + return WebWheelEvent::PhaseNone; +#endif +} + +static inline String textFromEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + return String(""); + return String([event characters]); +} + +static inline String unmodifiedTextFromEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + return String(""); + return String([event charactersIgnoringModifiers]); +} + +static String keyIdentifierForKeyEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + switch ([event keyCode]) { + case 54: // Right Command + case 55: // Left Command + return String("Meta"); + + case 57: // Capslock + return String("CapsLock"); + + case 56: // Left Shift + case 60: // Right Shift + return String("Shift"); + + case 58: // Left Alt + case 61: // Right Alt + return String("Alt"); + + case 59: // Left Ctrl + case 62: // Right Ctrl + return String("Control"); + + default: + ASSERT_NOT_REACHED(); + return String(""); + } + + NSString *s = [event charactersIgnoringModifiers]; + if ([s length] != 1) + return String("Unidentified"); + + unichar c = [s characterAtIndex:0]; + switch (c) { + // Each identifier listed in the DOM spec is listed here. + // Many are simply commented out since they do not appear on standard Macintosh keyboards + // or are on a key that doesn't have a corresponding character. + + // "Accept" + // "AllCandidates" + + // "Alt" + case NSMenuFunctionKey: + return String("Alt"); + + // "Apps" + // "BrowserBack" + // "BrowserForward" + // "BrowserHome" + // "BrowserRefresh" + // "BrowserSearch" + // "BrowserStop" + // "CapsLock" + + // "Clear" + case NSClearLineFunctionKey: + return String("Clear"); + + // "CodeInput" + // "Compose" + // "Control" + // "Crsel" + // "Convert" + // "Copy" + // "Cut" + + // "Down" + case NSDownArrowFunctionKey: + return String("Down"); + // "End" + case NSEndFunctionKey: + return String("End"); + // "Enter" + case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM + return String("Enter"); + + // "EraseEof" + + // "Execute" + case NSExecuteFunctionKey: + return String("Execute"); + + // "Exsel" + + // "F1" + case NSF1FunctionKey: + return String("F1"); + // "F2" + case NSF2FunctionKey: + return String("F2"); + // "F3" + case NSF3FunctionKey: + return String("F3"); + // "F4" + case NSF4FunctionKey: + return String("F4"); + // "F5" + case NSF5FunctionKey: + return String("F5"); + // "F6" + case NSF6FunctionKey: + return String("F6"); + // "F7" + case NSF7FunctionKey: + return String("F7"); + // "F8" + case NSF8FunctionKey: + return String("F8"); + // "F9" + case NSF9FunctionKey: + return String("F9"); + // "F10" + case NSF10FunctionKey: + return String("F10"); + // "F11" + case NSF11FunctionKey: + return String("F11"); + // "F12" + case NSF12FunctionKey: + return String("F12"); + // "F13" + case NSF13FunctionKey: + return String("F13"); + // "F14" + case NSF14FunctionKey: + return String("F14"); + // "F15" + case NSF15FunctionKey: + return String("F15"); + // "F16" + case NSF16FunctionKey: + return String("F16"); + // "F17" + case NSF17FunctionKey: + return String("F17"); + // "F18" + case NSF18FunctionKey: + return String("F18"); + // "F19" + case NSF19FunctionKey: + return String("F19"); + // "F20" + case NSF20FunctionKey: + return String("F20"); + // "F21" + case NSF21FunctionKey: + return String("F21"); + // "F22" + case NSF22FunctionKey: + return String("F22"); + // "F23" + case NSF23FunctionKey: + return String("F23"); + // "F24" + case NSF24FunctionKey: + return String("F24"); + + // "FinalMode" + + // "Find" + case NSFindFunctionKey: + return String("Find"); + + // "FullWidth" + // "HalfWidth" + // "HangulMode" + // "HanjaMode" + + // "Help" + case NSHelpFunctionKey: + return String("Help"); + + // "Hiragana" + + // "Home" + case NSHomeFunctionKey: + return String("Home"); + // "Insert" + case NSInsertFunctionKey: + return String("Insert"); + + // "JapaneseHiragana" + // "JapaneseKatakana" + // "JapaneseRomaji" + // "JunjaMode" + // "KanaMode" + // "KanjiMode" + // "Katakana" + // "LaunchApplication1" + // "LaunchApplication2" + // "LaunchMail" + + // "Left" + case NSLeftArrowFunctionKey: + return String("Left"); + + // "Meta" + // "MediaNextTrack" + // "MediaPlayPause" + // "MediaPreviousTrack" + // "MediaStop" + + // "ModeChange" + case NSModeSwitchFunctionKey: + return String("ModeChange"); + + // "Nonconvert" + // "NumLock" + + // "PageDown" + case NSPageDownFunctionKey: + return String("PageDown"); + // "PageUp" + case NSPageUpFunctionKey: + return String("PageUp"); + + // "Paste" + + // "Pause" + case NSPauseFunctionKey: + return String("Pause"); + + // "Play" + // "PreviousCandidate" + + // "PrintScreen" + case NSPrintScreenFunctionKey: + return String("PrintScreen"); + + // "Process" + // "Props" + + // "Right" + case NSRightArrowFunctionKey: + return String("Right"); + + // "RomanCharacters" + + // "Scroll" + case NSScrollLockFunctionKey: + return String("Scroll"); + // "Select" + case NSSelectFunctionKey: + return String("Select"); + + // "SelectMedia" + // "Shift" + + // "Stop" + case NSStopFunctionKey: + return String("Stop"); + // "Up" + case NSUpArrowFunctionKey: + return String("Up"); + // "Undo" + case NSUndoFunctionKey: + return String("Undo"); + + // "VolumeDown" + // "VolumeMute" + // "VolumeUp" + // "Win" + // "Zoom" + + // More function keys, not in the key identifier specification. + case NSF25FunctionKey: + return String("F25"); + case NSF26FunctionKey: + return String("F26"); + case NSF27FunctionKey: + return String("F27"); + case NSF28FunctionKey: + return String("F28"); + case NSF29FunctionKey: + return String("F29"); + case NSF30FunctionKey: + return String("F30"); + case NSF31FunctionKey: + return String("F31"); + case NSF32FunctionKey: + return String("F32"); + case NSF33FunctionKey: + return String("F33"); + case NSF34FunctionKey: + return String("F34"); + case NSF35FunctionKey: + return String("F35"); + + // Turn 0x7F into 0x08, because backspace needs to always be 0x08. + case 0x7F: + return String("U+0008"); + // Standard says that DEL becomes U+007F. + case NSDeleteFunctionKey: + return String("U+007F"); + + // Always use 0x09 for tab instead of AppKit's backtab character. + case NSBackTabCharacter: + return String("U+0009"); + + case NSBeginFunctionKey: + case NSBreakFunctionKey: + case NSClearDisplayFunctionKey: + case NSDeleteCharFunctionKey: + case NSDeleteLineFunctionKey: + case NSInsertCharFunctionKey: + case NSInsertLineFunctionKey: + case NSNextFunctionKey: + case NSPrevFunctionKey: + case NSPrintFunctionKey: + case NSRedoFunctionKey: + case NSResetFunctionKey: + case NSSysReqFunctionKey: + case NSSystemFunctionKey: + case NSUserFunctionKey: + // FIXME: We should use something other than the vendor-area Unicode values for the above keys. + // For now, just fall through to the default. + default: + return String::format("U+%04X", toASCIIUpper(c)); + } +} + +static bool isKeypadEvent(NSEvent* event) +{ + // Check that this is the type of event that has a keyCode. + switch ([event type]) { + case NSKeyDown: + case NSKeyUp: + case NSFlagsChanged: + break; + default: + return false; + } + + switch ([event keyCode]) { + case 71: // Clear + case 81: // = + case 75: // / + case 67: // * + case 78: // - + case 69: // + + case 76: // Enter + case 65: // . + case 82: // 0 + case 83: // 1 + case 84: // 2 + case 85: // 3 + case 86: // 4 + case 87: // 5 + case 88: // 6 + case 89: // 7 + case 91: // 8 + case 92: // 9 + return true; + } + + return false; +} + +static int windowsKeyCodeForKeyEvent(NSEvent* event) +{ + switch ([event keyCode]) { + // VK_TAB (09) TAB key + case 48: return 0x09; + + // VK_APPS (5D) Right windows/meta key + case 54: // Right Command + return 0x5D; + + // VK_LWIN (5B) Left windows/meta key + case 55: // Left Command + return 0x5B; + + // VK_CAPITAL (14) caps locks key + case 57: // Capslock + return 0x14; + + // VK_SHIFT (10) either shift key + case 56: // Left Shift + case 60: // Right Shift + return 0x10; + + // VK_MENU (12) either alt key + case 58: // Left Alt + case 61: // Right Alt + return 0x12; + + // VK_CONTROL (11) either ctrl key + case 59: // Left Ctrl + case 62: // Right Ctrl + return 0x11; + + // VK_CLEAR (0C) CLEAR key + case 71: return 0x0C; + + // VK_NUMPAD0 (60) Numeric keypad 0 key + case 82: return 0x60; + // VK_NUMPAD1 (61) Numeric keypad 1 key + case 83: return 0x61; + // VK_NUMPAD2 (62) Numeric keypad 2 key + case 84: return 0x62; + // VK_NUMPAD3 (63) Numeric keypad 3 key + case 85: return 0x63; + // VK_NUMPAD4 (64) Numeric keypad 4 key + case 86: return 0x64; + // VK_NUMPAD5 (65) Numeric keypad 5 key + case 87: return 0x65; + // VK_NUMPAD6 (66) Numeric keypad 6 key + case 88: return 0x66; + // VK_NUMPAD7 (67) Numeric keypad 7 key + case 89: return 0x67; + // VK_NUMPAD8 (68) Numeric keypad 8 key + case 91: return 0x68; + // VK_NUMPAD9 (69) Numeric keypad 9 key + case 92: return 0x69; + // VK_MULTIPLY (6A) Multiply key + case 67: return 0x6A; + // VK_ADD (6B) Add key + case 69: return 0x6B; + + // VK_SUBTRACT (6D) Subtract key + case 78: return 0x6D; + // VK_DECIMAL (6E) Decimal key + case 65: return 0x6E; + // VK_DIVIDE (6F) Divide key + case 75: return 0x6F; + } + + NSString* s = [event charactersIgnoringModifiers]; + if ([s length] != 1) + return 0; + + switch ([s characterAtIndex:0]) { + // VK_LBUTTON (01) Left mouse button + // VK_RBUTTON (02) Right mouse button + // VK_CANCEL (03) Control-break processing + // VK_MBUTTON (04) Middle mouse button (three-button mouse) + // VK_XBUTTON1 (05) + // VK_XBUTTON2 (06) + + // VK_BACK (08) BACKSPACE key + case 8: case 0x7F: return 0x08; + // VK_TAB (09) TAB key + case 9: return 0x09; + + // VK_CLEAR (0C) CLEAR key + // handled by key code above + + // VK_RETURN (0D) + case 0xD: case 3: return 0x0D; + + // VK_SHIFT (10) SHIFT key + // VK_CONTROL (11) CTRL key + // VK_MENU (12) ALT key + + // VK_PAUSE (13) PAUSE key + case NSPauseFunctionKey: return 0x13; + + // VK_CAPITAL (14) CAPS LOCK key + // VK_KANA (15) Input Method Editor (IME) Kana mode + // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) + // VK_HANGUL (15) IME Hangul mode + // VK_JUNJA (17) IME Junja mode + // VK_FINAL (18) IME final mode + // VK_HANJA (19) IME Hanja mode + // VK_KANJI (19) IME Kanji mode + + // VK_ESCAPE (1B) ESC key + case 0x1B: return 0x1B; + + // VK_CONVERT (1C) IME convert + // VK_NONCONVERT (1D) IME nonconvert + // VK_ACCEPT (1E) IME accept + // VK_MODECHANGE (1F) IME mode change request + + // VK_SPACE (20) SPACEBAR + case ' ': return 0x20; + // VK_PRIOR (21) PAGE UP key + case NSPageUpFunctionKey: return 0x21; + // VK_NEXT (22) PAGE DOWN key + case NSPageDownFunctionKey: return 0x22; + // VK_END (23) END key + case NSEndFunctionKey: return 0x23; + // VK_HOME (24) HOME key + case NSHomeFunctionKey: return 0x24; + // VK_LEFT (25) LEFT ARROW key + case NSLeftArrowFunctionKey: return 0x25; + // VK_UP (26) UP ARROW key + case NSUpArrowFunctionKey: return 0x26; + // VK_RIGHT (27) RIGHT ARROW key + case NSRightArrowFunctionKey: return 0x27; + // VK_DOWN (28) DOWN ARROW key + case NSDownArrowFunctionKey: return 0x28; + // VK_SELECT (29) SELECT key + case NSSelectFunctionKey: return 0x29; + // VK_PRINT (2A) PRINT key + case NSPrintFunctionKey: return 0x2A; + // VK_EXECUTE (2B) EXECUTE key + case NSExecuteFunctionKey: return 0x2B; + // VK_SNAPSHOT (2C) PRINT SCREEN key + case NSPrintScreenFunctionKey: return 0x2C; + // VK_INSERT (2D) INS key + case NSInsertFunctionKey: case NSHelpFunctionKey: return 0x2D; + // VK_DELETE (2E) DEL key + case NSDeleteFunctionKey: return 0x2E; + + // VK_HELP (2F) HELP key + + // (30) 0 key + case '0': case ')': return 0x30; + // (31) 1 key + case '1': case '!': return 0x31; + // (32) 2 key + case '2': case '@': return 0x32; + // (33) 3 key + case '3': case '#': return 0x33; + // (34) 4 key + case '4': case '$': return 0x34; + // (35) 5 key + case '5': case '%': return 0x35; + // (36) 6 key + case '6': case '^': return 0x36; + // (37) 7 key + case '7': case '&': return 0x37; + // (38) 8 key + case '8': case '*': return 0x38; + // (39) 9 key + case '9': case '(': return 0x39; + // (41) A key + case 'a': case 'A': return 0x41; + // (42) B key + case 'b': case 'B': return 0x42; + // (43) C key + case 'c': case 'C': return 0x43; + // (44) D key + case 'd': case 'D': return 0x44; + // (45) E key + case 'e': case 'E': return 0x45; + // (46) F key + case 'f': case 'F': return 0x46; + // (47) G key + case 'g': case 'G': return 0x47; + // (48) H key + case 'h': case 'H': return 0x48; + // (49) I key + case 'i': case 'I': return 0x49; + // (4A) J key + case 'j': case 'J': return 0x4A; + // (4B) K key + case 'k': case 'K': return 0x4B; + // (4C) L key + case 'l': case 'L': return 0x4C; + // (4D) M key + case 'm': case 'M': return 0x4D; + // (4E) N key + case 'n': case 'N': return 0x4E; + // (4F) O key + case 'o': case 'O': return 0x4F; + // (50) P key + case 'p': case 'P': return 0x50; + // (51) Q key + case 'q': case 'Q': return 0x51; + // (52) R key + case 'r': case 'R': return 0x52; + // (53) S key + case 's': case 'S': return 0x53; + // (54) T key + case 't': case 'T': return 0x54; + // (55) U key + case 'u': case 'U': return 0x55; + // (56) V key + case 'v': case 'V': return 0x56; + // (57) W key + case 'w': case 'W': return 0x57; + // (58) X key + case 'x': case 'X': return 0x58; + // (59) Y key + case 'y': case 'Y': return 0x59; + // (5A) Z key + case 'z': case 'Z': return 0x5A; + + // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) + // VK_RWIN (5C) Right Windows key (Natural keyboard) + // VK_APPS (5D) Applications key (Natural keyboard) + // VK_SLEEP (5F) Computer Sleep key + + // VK_NUMPAD0 (60) Numeric keypad 0 key + // VK_NUMPAD1 (61) Numeric keypad 1 key + // VK_NUMPAD2 (62) Numeric keypad 2 key + // VK_NUMPAD3 (63) Numeric keypad 3 key + // VK_NUMPAD4 (64) Numeric keypad 4 key + // VK_NUMPAD5 (65) Numeric keypad 5 key + // VK_NUMPAD6 (66) Numeric keypad 6 key + // VK_NUMPAD7 (67) Numeric keypad 7 key + // VK_NUMPAD8 (68) Numeric keypad 8 key + // VK_NUMPAD9 (69) Numeric keypad 9 key + // VK_MULTIPLY (6A) Multiply key + // VK_ADD (6B) Add key + // handled by key code above + + // VK_SEPARATOR (6C) Separator key + + // VK_SUBTRACT (6D) Subtract key + // VK_DECIMAL (6E) Decimal key + // VK_DIVIDE (6F) Divide key + // handled by key code above + + // VK_F1 (70) F1 key + case NSF1FunctionKey: return 0x70; + // VK_F2 (71) F2 key + case NSF2FunctionKey: return 0x71; + // VK_F3 (72) F3 key + case NSF3FunctionKey: return 0x72; + // VK_F4 (73) F4 key + case NSF4FunctionKey: return 0x73; + // VK_F5 (74) F5 key + case NSF5FunctionKey: return 0x74; + // VK_F6 (75) F6 key + case NSF6FunctionKey: return 0x75; + // VK_F7 (76) F7 key + case NSF7FunctionKey: return 0x76; + // VK_F8 (77) F8 key + case NSF8FunctionKey: return 0x77; + // VK_F9 (78) F9 key + case NSF9FunctionKey: return 0x78; + // VK_F10 (79) F10 key + case NSF10FunctionKey: return 0x79; + // VK_F11 (7A) F11 key + case NSF11FunctionKey: return 0x7A; + // VK_F12 (7B) F12 key + case NSF12FunctionKey: return 0x7B; + // VK_F13 (7C) F13 key + case NSF13FunctionKey: return 0x7C; + // VK_F14 (7D) F14 key + case NSF14FunctionKey: return 0x7D; + // VK_F15 (7E) F15 key + case NSF15FunctionKey: return 0x7E; + // VK_F16 (7F) F16 key + case NSF16FunctionKey: return 0x7F; + // VK_F17 (80H) F17 key + case NSF17FunctionKey: return 0x80; + // VK_F18 (81H) F18 key + case NSF18FunctionKey: return 0x81; + // VK_F19 (82H) F19 key + case NSF19FunctionKey: return 0x82; + // VK_F20 (83H) F20 key + case NSF20FunctionKey: return 0x83; + // VK_F21 (84H) F21 key + case NSF21FunctionKey: return 0x84; + // VK_F22 (85H) F22 key + case NSF22FunctionKey: return 0x85; + // VK_F23 (86H) F23 key + case NSF23FunctionKey: return 0x86; + // VK_F24 (87H) F24 key + case NSF24FunctionKey: return 0x87; + + // VK_NUMLOCK (90) NUM LOCK key + + // VK_SCROLL (91) SCROLL LOCK key + case NSScrollLockFunctionKey: return 0x91; + + // VK_LSHIFT (A0) Left SHIFT key + // VK_RSHIFT (A1) Right SHIFT key + // VK_LCONTROL (A2) Left CONTROL key + // VK_RCONTROL (A3) Right CONTROL key + // VK_LMENU (A4) Left MENU key + // VK_RMENU (A5) Right MENU key + // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key + // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key + // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key + // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key + // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key + // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key + // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key + // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key + // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key + // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key + // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key + // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key + // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key + // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key + // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key + // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key + // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key + // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key + + // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key + case ';': case ':': return 0xBA; + // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key + case '=': case '+': return 0xBB; + // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key + case ',': case '<': return 0xBC; + // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key + case '-': case '_': return 0xBD; + // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key + case '.': case '>': return 0xBE; + // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key + case '/': case '?': return 0xBF; + // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key + case '`': case '~': return 0xC0; + // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key + case '[': case '{': return 0xDB; + // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key + case '\\': case '|': return 0xDC; + // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key + case ']': case '}': return 0xDD; + // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key + case '\'': case '"': return 0xDE; + + // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. + // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard + // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key + // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP + // VK_ATTN (F6) Attn key + // VK_CRSEL (F7) CrSel key + // VK_EXSEL (F8) ExSel key + // VK_EREOF (F9) Erase EOF key + // VK_PLAY (FA) Play key + // VK_ZOOM (FB) Zoom key + // VK_NONAME (FC) Reserved for future use + // VK_PA1 (FD) PA1 key + // VK_OEM_CLEAR (FE) Clear key + } + + return 0; +} + +static inline bool isKeyUpEvent(NSEvent *event) +{ + if ([event type] != NSFlagsChanged) + return [event type] == NSKeyUp; + // FIXME: This logic fails if the user presses both Shift keys at once, for example: + // we treat releasing one of them as keyDown. + switch ([event keyCode]) { + case 54: // Right Command + case 55: // Left Command + return ([event modifierFlags] & NSCommandKeyMask) == 0; + + case 57: // Capslock + return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0; + + case 56: // Left Shift + case 60: // Right Shift + return ([event modifierFlags] & NSShiftKeyMask) == 0; + + case 58: // Left Alt + case 61: // Right Alt + return ([event modifierFlags] & NSAlternateKeyMask) == 0; + + case 59: // Left Ctrl + case 62: // Right Ctrl + return ([event modifierFlags] & NSControlKeyMask) == 0; + + case 63: // Function + return ([event modifierFlags] & NSFunctionKeyMask) == 0; + } + return false; +} + +static inline WebEvent::Modifiers modifiersForEvent(NSEvent *event) +{ + unsigned modifiers = 0; + if ([event modifierFlags] & NSShiftKeyMask) + modifiers |= WebEvent::ShiftKey; + if ([event modifierFlags] & NSControlKeyMask) + modifiers |= WebEvent::ControlKey; + if ([event modifierFlags] & NSAlternateKeyMask) + modifiers |= WebEvent::AltKey; + if ([event modifierFlags] & NSCommandKeyMask) + modifiers |= WebEvent::MetaKey; + return (WebEvent::Modifiers)modifiers; +} + +WebMouseEvent WebEventFactory::createWebMouseEvent(NSEvent *event, NSView *windowView) +{ + NSPoint position = pointForEvent(event, windowView); + NSPoint globalPosition = globalPointForEvent(event); + + WebEvent::Type type = mouseEventTypeForEvent(event); + WebMouseEvent::Button button = mouseButtonForEvent(event); + float deltaX = [event deltaX]; + float deltaY = [event deltaY]; + float deltaZ = [event deltaZ]; + int clickCount = clickCountForEvent(event); + WebEvent::Modifiers modifiers = modifiersForEvent(event); + double timestamp = [event timestamp]; + + return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp); +} + +WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windowView) +{ + NSPoint position = pointForEvent(event, windowView); + NSPoint globalPosition = globalPointForEvent(event); + + WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent; + + BOOL continuous; + float deltaX = 0; + float deltaY = 0; + float wheelTicksX = 0; + float wheelTicksY = 0; + + WKGetWheelEventDeltas(event, &deltaX, &deltaY, &continuous); + + if (continuous) { + // smooth scroll events + wheelTicksX = deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep()); + wheelTicksY = deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep()); + } else { + // plain old wheel events + wheelTicksX = deltaX; + wheelTicksY = deltaY; + deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + } + + WebWheelEvent::Phase phase = phaseForEvent(event); + 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); +} + +WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *) +{ + WebEvent::Type type = isKeyUpEvent(event) ? WebEvent::KeyUp : WebEvent::KeyDown; + String text = textFromEvent(event); + String unmodifiedText = unmodifiedTextFromEvent(event); + String keyIdentifier = keyIdentifierForKeyEvent(event); + int windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event); + int nativeVirtualKeyCode = [event keyCode]; + int macCharCode = WKGetNSEventKeyChar(event); + bool autoRepeat = ([event type] != NSFlagsChanged) && [event isARepeat]; + bool isKeypad = isKeypadEvent(event); + bool isSystemKey = false; // SystemKey is always false on the Mac. + WebEvent::Modifiers modifiers = modifiersForEvent(event); + double timestamp = [event timestamp]; + + return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm new file mode 100644 index 0000000..5be52d4 --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 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. + * + */ + +#if ENABLE(MEMORY_SAMPLER) + +#include "WebMemorySampler.h" + +#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> + +using namespace WebCore; +using namespace JSC; +using namespace WTF; + +namespace WebKit { + +struct SystemMallocStats { + malloc_statistics_t defaultMallocZoneStats; + malloc_statistics_t dispatchContinuationMallocZoneStats; + malloc_statistics_t purgeableMallocZoneStats; +}; + +SystemMallocStats WebMemorySampler::sampleSystemMalloc() const +{ + static const char* defaultMallocZoneName = "DefaultMallocZone"; + static const char* dispatchContinuationMallocZoneName = "DispatchContinuations"; + static const char* purgeableMallocZoneName = "DefaultPurgeableMallocZone"; + SystemMallocStats mallocStats; + vm_address_t* zones; + unsigned count; + + // Zero out the structures in case a zone is missing + malloc_statistics_t stats; + stats.blocks_in_use = 0; + stats.size_in_use = 0; + stats.max_size_in_use = 0; + stats.size_allocated = 0; + mallocStats.defaultMallocZoneStats = stats; + mallocStats.dispatchContinuationMallocZoneStats = stats; + mallocStats.purgeableMallocZoneStats = stats; + + malloc_get_all_zones(mach_task_self(), 0, &zones, &count); + for (unsigned i = 0; i < count; i++) { + if (const char* name = malloc_get_zone_name(reinterpret_cast<malloc_zone_t*>(zones[i]))) { + stats.blocks_in_use = 0; + stats.size_in_use = 0; + stats.max_size_in_use = 0; + stats.size_allocated = 0; + malloc_zone_statistics(reinterpret_cast<malloc_zone_t*>(zones[i]), &stats); + if (!strcmp(name, defaultMallocZoneName)) + mallocStats.defaultMallocZoneStats = stats; + else if (!strcmp(name, dispatchContinuationMallocZoneName)) + mallocStats.dispatchContinuationMallocZoneStats = stats; + else if (!strcmp(name, purgeableMallocZoneName)) + mallocStats.purgeableMallocZoneStats = stats; + } + } + return mallocStats; +} + +size_t WebMemorySampler::sampleProcessCommittedBytes() const +{ + task_basic_info_64 taskInfo; + mach_msg_type_number_t count = TASK_BASIC_INFO_64_COUNT; + task_info(mach_task_self(), TASK_BASIC_INFO_64, reinterpret_cast<task_info_t>(&taskInfo), &count); + return taskInfo.resident_size; +} + +String WebMemorySampler::processName() const +{ + NSString *appName = [[NSBundle mainBundle] bundleIdentifier]; + if (!appName) + appName = [[NSProcessInfo processInfo] processName]; + return String(appName); +} + +WebMemoryStatistics WebMemorySampler::sampleWebKit() const +{ + size_t totalBytesInUse = 0, totalBytesCommitted = 0; + + WebMemoryStatistics webKitMemoryStats; + + FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics(); + size_t fastMallocBytesInUse = fastMallocStatistics.committedVMBytes - fastMallocStatistics.freeListBytes; + size_t fastMallocBytesCommitted = fastMallocStatistics.committedVMBytes; + totalBytesInUse += fastMallocBytesInUse; + totalBytesCommitted += fastMallocBytesCommitted; + + JSLock lock(SilenceAssertionsOnly); + MarkedSpace::Statistics heapMemoryStats = heapStatistics(JSDOMWindow::commonJSGlobalData()); + size_t jscHeapBytesInUse = heapMemoryStats.size - heapMemoryStats.free; + size_t jscHeapBytesCommitted = heapMemoryStats.size; + totalBytesInUse += jscHeapBytesInUse; + totalBytesCommitted += jscHeapBytesCommitted; + + GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics(); + totalBytesInUse += globalMemoryStats.stackBytes + globalMemoryStats.JITBytes; + totalBytesCommitted += globalMemoryStats.stackBytes + globalMemoryStats.JITBytes; + + SystemMallocStats systemStats = sampleSystemMalloc(); + + size_t defaultMallocZoneBytesInUse = systemStats.defaultMallocZoneStats.size_in_use; + size_t dispatchContinuationMallocZoneBytesInUse = systemStats.dispatchContinuationMallocZoneStats.size_in_use; + size_t purgeableMallocZoneBytesInUse = systemStats.purgeableMallocZoneStats.size_in_use; + size_t defaultMallocZoneBytesCommitted = systemStats.defaultMallocZoneStats.size_allocated; + size_t dispatchContinuationMallocZoneBytesCommitted = systemStats.dispatchContinuationMallocZoneStats.size_allocated; + size_t purgeableMallocZoneBytesCommitted = systemStats.purgeableMallocZoneStats.size_allocated; + totalBytesInUse += defaultMallocZoneBytesInUse + dispatchContinuationMallocZoneBytesInUse + purgeableMallocZoneBytesInUse; + totalBytesCommitted += defaultMallocZoneBytesCommitted + dispatchContinuationMallocZoneBytesCommitted + purgeableMallocZoneBytesCommitted; + + size_t residentSize = sampleProcessCommittedBytes(); + + double now = currentTime(); + + webKitMemoryStats.keys.append(String("Timestamp")); + webKitMemoryStats.values.append(now); + webKitMemoryStats.keys.append(String("Total Bytes of Memory In Use")); + webKitMemoryStats.values.append(totalBytesInUse); + webKitMemoryStats.keys.append(String("Fast Malloc Zone Bytes")); + webKitMemoryStats.values.append(fastMallocBytesInUse); + webKitMemoryStats.keys.append(String("Default Malloc Zone Bytes")); + webKitMemoryStats.values.append(defaultMallocZoneBytesInUse); + webKitMemoryStats.keys.append(String("Dispatch Continuation Malloc Zone Bytes")); + webKitMemoryStats.values.append(dispatchContinuationMallocZoneBytesInUse); + webKitMemoryStats.keys.append(String("Purgeable Malloc Zone Bytes")); + webKitMemoryStats.values.append(purgeableMallocZoneBytesInUse); + webKitMemoryStats.keys.append(String("JavaScript Heap Bytes")); + webKitMemoryStats.values.append(jscHeapBytesInUse); + webKitMemoryStats.keys.append(String("Total Bytes of Committed Memory")); + webKitMemoryStats.values.append(totalBytesCommitted); + webKitMemoryStats.keys.append(String("Fast Malloc Zone Bytes")); + webKitMemoryStats.values.append(fastMallocBytesCommitted); + webKitMemoryStats.keys.append(String("Default Malloc Zone Bytes")); + webKitMemoryStats.values.append(defaultMallocZoneBytesCommitted); + webKitMemoryStats.keys.append(String("Dispatch Continuation Malloc Zone Bytes")); + webKitMemoryStats.values.append(dispatchContinuationMallocZoneBytesCommitted); + webKitMemoryStats.keys.append(String("Purgeable Malloc Zone Bytes")); + webKitMemoryStats.values.append(purgeableMallocZoneBytesCommitted); + webKitMemoryStats.keys.append(String("JavaScript Heap Bytes")); + webKitMemoryStats.values.append(jscHeapBytesCommitted); + webKitMemoryStats.keys.append(String("JavaScript Stack Bytes")); + webKitMemoryStats.values.append(globalMemoryStats.stackBytes); + webKitMemoryStats.keys.append(String("JavaScript JIT Bytes")); + webKitMemoryStats.values.append(globalMemoryStats.JITBytes); + webKitMemoryStats.keys.append(String("Resident Size")); + webKitMemoryStats.values.append(residentSize); + + return webKitMemoryStats; +} + +} + +#endif + diff --git a/Source/WebKit2/Shared/mac/WebURLRequestMac.mm b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm new file mode 100644 index 0000000..a7196f7 --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLRequest.h" + +namespace WebKit { + +WebURLRequest::WebURLRequest(PlatformRequest platformRequest) + : m_request(platformRequest) +{ +} + +PlatformRequest WebURLRequest::platformRequest() const +{ + return m_request.nsURLRequest(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebURLResponseMac.mm b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm new file mode 100644 index 0000000..ff5b6e6 --- /dev/null +++ b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLResponse.h" + +namespace WebKit { + +WebURLResponse::WebURLResponse(PlatformResponse platformResponse) + : m_response(platformResponse) +{ +} + +PlatformResponse WebURLResponse::platformResponse() const +{ + return m_response.nsURLResponse(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.cpp b/Source/WebKit2/Shared/qt/CleanupHandler.cpp new file mode 100644 index 0000000..74c1d4c --- /dev/null +++ b/Source/WebKit2/Shared/qt/CleanupHandler.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 University of Szeged. 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 "CleanupHandler.h" + +#include "MappedMemoryPool.h" +#include "RunLoop.h" +#include <csignal> +#include <cstdlib> +#include <QApplication> + +namespace WebKit { + +CleanupHandler* CleanupHandler::theInstance = 0; + +CleanupHandler::CleanupHandler() + : m_hasStartedDeleting(false) +{ + moveToThread(qApp->thread()); // Ensure that we are acting on the main thread. + connect(qApp, SIGNAL(aboutToQuit()), SLOT(deleteObjects()), Qt::DirectConnection); + signal(SIGTERM, &CleanupHandler::sigTermHandler); +} + +void CleanupHandler::sigTermHandler(int) +{ + ::RunLoop::main()->stop(); +} + +void CleanupHandler::deleteObjects() +{ + m_hasStartedDeleting = true; + for (unsigned i = 0; i < m_objects.size(); ++i) + m_objects[i]->deleteLater(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.h b/Source/WebKit2/Shared/qt/CleanupHandler.h new file mode 100644 index 0000000..afd7723 --- /dev/null +++ b/Source/WebKit2/Shared/qt/CleanupHandler.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 University of Szeged. 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 CleanupHandler_h +#define CleanupHandler_h + +#include <QCoreApplication> +#include <QList> +#include <QObject> +#include <wtf/HashSet.h> +#include <wtf/StdLibExtras.h> + +namespace WebKit { + +class CleanupHandler : private QObject { + Q_OBJECT +public: + static CleanupHandler* instance() + { + if (!theInstance) + theInstance = new CleanupHandler(); + return theInstance; + } + + void markForCleanup(QObject* object) + { + m_objects.append(object); + } + + void unmark(QObject* object) + { + if (m_hasStartedDeleting) + return; + m_objects.removeOne(object); + } + + bool hasStartedDeleting() const { return m_hasStartedDeleting; } + +private slots: + void deleteObjects(); + +private: + static void sigTermHandler(int); + static CleanupHandler* theInstance; + + CleanupHandler(); + + QList<QObject*> m_objects; + bool m_hasStartedDeleting; +}; + +} // namespace WebKit + +#endif // CleanupHandler_h diff --git a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp new file mode 100644 index 0000000..d0d247c --- /dev/null +++ b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NativeWebKeyboardEvent.h" + +#include "WebEventFactoryQt.h" + +namespace WebKit { + +NativeWebKeyboardEvent::NativeWebKeyboardEvent(QKeyEvent* event) + : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event)) + , m_nativeEvent(*event) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h new file mode 100644 index 0000000..32776f7 --- /dev/null +++ b/Source/WebKit2/Shared/qt/PlatformCertificateInfo.h @@ -0,0 +1,57 @@ +/* + * 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 PlatformCertificateInfo_h +#define PlatformCertificateInfo_h + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <WebCore/ResourceResponse.h> + +namespace WebKit { + +class PlatformCertificateInfo { +public: + PlatformCertificateInfo() + { + } + + explicit PlatformCertificateInfo(const WebCore::ResourceResponse&) + { + } + + void encode(CoreIPC::ArgumentEncoder*) const + { + } + + static bool decode(CoreIPC::ArgumentDecoder*, PlatformCertificateInfo&) + { + return true; + } +}; + +} // namespace WebKit + +#endif // PlatformCertificateInfo_h diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp new file mode 100644 index 0000000..184b0f8 --- /dev/null +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ShareableBitmap.h" + +#include <QImage> +#include <QPainter> +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +static inline QImage createQImage(void* data, int width, int height) +{ + return QImage(reinterpret_cast<uchar*>(data), width, height, width * 4, QImage::Format_RGB32); +} + +PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() +{ + QImage* image = new QImage(createQImage(data(), m_size.width(), m_size.height())); + GraphicsContext* context = new GraphicsContext(new QPainter(image)); + context->takeOwnershipOfPlatformContext(); + return context; +} + +void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect) +{ + QImage image = createQImage(data(), m_size.width(), m_size.height()); + QPainter* painter = context.platformContext(); + painter->translate(-srcRect.x(), -srcRect.y()); + painter->drawImage(dstPoint, image, QRect(srcRect)); + painter->translate(srcRect.x(), srcRect.y()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/UpdateChunk.cpp b/Source/WebKit2/Shared/qt/UpdateChunk.cpp new file mode 100644 index 0000000..4d8e62d --- /dev/null +++ b/Source/WebKit2/Shared/qt/UpdateChunk.cpp @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#include "UpdateChunk.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "MappedMemoryPool.h" +#include "WebCoreArgumentCoders.h" +#include <QIODevice> +#include <QImage> +#include <QPixmap> +#include <WebCore/FloatRect.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +UpdateChunk::UpdateChunk() + : m_mappedMemory(0) +{ +} + +UpdateChunk::UpdateChunk(const IntRect& rect) + : m_rect(rect) + , m_mappedMemory(MappedMemoryPool::instance()->mapMemory(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())); + + m_mappedMemory = 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; + + if (chunk.isEmpty()) + return true; // Successfully decoded empty chunk. + + String fileName; + if (!decoder->decode(fileName)) + return false; + + chunk.m_mappedMemory = MappedMemoryPool::instance()->mapFile(fileName, chunk.size()); + return true; +} + +size_t UpdateChunk::size() const +{ + int bpp; + if (QPixmap::defaultDepth() == 16) + bpp = 2; + else + bpp = 4; + + return ((m_rect.width() * bpp + 3) & ~0x3) + * m_rect.height(); +} + +QImage UpdateChunk::createImage() const +{ + ASSERT(m_mappedMemory); + QImage::Format format; + int bpp; + if (QPixmap::defaultDepth() == 16) { + format = QImage::Format_RGB16; + bpp = 2; + } else { + format = QImage::Format_RGB32; + bpp = 4; + } + + return QImage(m_mappedMemory->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 new file mode 100644 index 0000000..f506ba7 --- /dev/null +++ b/Source/WebKit2/Shared/qt/UpdateChunk.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef UpdateChunk_h +#define UpdateChunk_h + +#include <QImage> +#include <WebCore/IntRect.h> + +namespace CoreIPC { +class ArgumentEncoder; +class ArgumentDecoder; +} + +namespace WebKit { + +class MappedMemory; + +class UpdateChunk { +public: + UpdateChunk(); + UpdateChunk(const WebCore::IntRect&); + ~UpdateChunk(); + + const WebCore::IntRect& rect() const { return m_rect; } + bool isEmpty() const { return m_rect.isEmpty(); } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&); + + QImage createImage() const; + +private: + size_t size() const; + + WebCore::IntRect m_rect; + + mutable MappedMemory* m_mappedMemory; +}; + +} // namespace WebKit + +#endif // UpdateChunk_h diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp new file mode 100644 index 0000000..80ab3f9 --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebCoreArgumentCoders.h" +#include "NotImplemented.h" + +namespace CoreIPC { + +void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest) +{ + notImplemented(); +} + +bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest) +{ + notImplemented(); + return false; +} + +void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse) +{ + notImplemented(); +} + +bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse) +{ + notImplemented(); + return false; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp new file mode 100644 index 0000000..39a6455 --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -0,0 +1,209 @@ +/* + * 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 "WebEventFactoryQt.h" +#include <qgraphicssceneevent.h> +#include <QApplication> +#include <QKeyEvent> +#include <WebCore/IntPoint.h> +#include <WebCore/FloatPoint.h> +#include <WebCore/PlatformKeyboardEvent.h> +#include <wtf/ASCIICType.h> +#include <wtf/CurrentTime.h> + +using namespace WebCore; + +namespace WebKit { + +static WebMouseEvent::Button mouseButtonForEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->button() == Qt::LeftButton || (event->buttons() & Qt::LeftButton)) + return WebMouseEvent::LeftButton; + else if (event->button() == Qt::RightButton || (event->buttons() & Qt::RightButton)) + return WebMouseEvent::RightButton; + else if (event->button() == Qt::MidButton || (event->buttons() & Qt::MidButton)) + return WebMouseEvent::MiddleButton; + return WebMouseEvent::NoButton; +} + +static WebEvent::Type webEventTypeForEvent(QEvent* event) +{ + switch (event->type()) { + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMousePress: + return WebEvent::MouseDown; + case QEvent::GraphicsSceneMouseRelease: + return WebEvent::MouseUp; + case QEvent::GraphicsSceneMouseMove: + return WebEvent::MouseMove; + case QEvent::Wheel: + return WebEvent::Wheel; + case QEvent::KeyPress: + return WebEvent::KeyDown; + case QEvent::KeyRelease: + return WebEvent::KeyUp; +#if ENABLE(TOUCH_EVENTS) + case QEvent::TouchBegin: + return WebEvent::TouchStart; + case QEvent::TouchUpdate: + return WebEvent::TouchMove; + case QEvent::TouchEnd: + return WebEvent::TouchEnd; +#endif + default: + // assert + return WebEvent::MouseMove; + } +} + +static inline WebEvent::Modifiers modifiersForEvent(Qt::KeyboardModifiers modifiers) +{ + unsigned result = 0; + if (modifiers & Qt::ShiftModifier) + result |= WebEvent::ShiftKey; + if (modifiers & Qt::ControlModifier) + result |= WebEvent::ControlKey; + if (modifiers & Qt::AltModifier) + result |= WebEvent::AltKey; + if (modifiers & Qt::MetaModifier) + result |= WebEvent::MetaKey; + return (WebEvent::Modifiers)result; +} + +WebMouseEvent WebEventFactory::createWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount) +{ + FloatPoint delta(event->pos().x() - event->lastPos().x(), event->pos().y() - event->lastPos().y()); + + WebEvent::Type type = webEventTypeForEvent(event); + WebMouseEvent::Button button = mouseButtonForEvent(event); + float deltaX = delta.x(); + float deltaY = delta.y(); + int clickCount = eventClickCount; + WebEvent::Modifiers modifiers = modifiersForEvent(event->modifiers()); + double timestamp = WTF::currentTime(); + + return WebMouseEvent(type, button, event->pos().toPoint(), event->screenPos(), deltaX, deltaY, 0.0f, clickCount, modifiers, timestamp); +} + +WebWheelEvent WebEventFactory::createWebWheelEvent(QGraphicsSceneWheelEvent* e) +{ + float deltaX = 0; + float deltaY = 0; + float wheelTicksX = 0; + float wheelTicksY = 0; + WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent; + WebEvent::Modifiers modifiers = modifiersForEvent(e->modifiers()); + double timestamp = WTF::currentTime(); + + // A delta that is not mod 120 indicates a device that is sending + // fine-resolution scroll events, so use the delta as number of wheel ticks + // and number of pixels to scroll.See also webkit.org/b/29601 + bool fullTick = !(e->delta() % 120); + + if (e->orientation() == Qt::Horizontal) { + deltaX = (fullTick) ? e->delta() / 120.0f : e->delta(); + wheelTicksX = deltaX; + } else { + deltaY = (fullTick) ? e->delta() / 120.0f : e->delta(); + wheelTicksY = deltaY; + } + + // Use the same single scroll step as QTextEdit + // (in QTextEditPrivate::init [h,v]bar->setSingleStep) + static const float cDefaultQtScrollStep = 20.f; +#ifndef QT_NO_WHEELEVENT + deltaX *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1; + deltaY *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1; +#endif + + return WebWheelEvent(WebEvent::Wheel, e->pos().toPoint(), e->screenPos(), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, modifiers, timestamp); +} + +WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(QKeyEvent* event) +{ + const int state = event->modifiers(); + WebEvent::Type type = webEventTypeForEvent(event); + const String text = event->text(); + const String unmodifiedText = event->text(); + bool isAutoRepeat = event->isAutoRepeat(); + bool isSystemKey = false; // FIXME: No idea what that is. + bool isKeypad = (state & Qt::KeypadModifier); + const String keyIdentifier = keyIdentifierForQtKeyCode(event->key()); + int windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), isKeypad); + int nativeVirtualKeyCode = event->nativeVirtualKey(); + int macCharCode = 0; + WebEvent::Modifiers modifiers = modifiersForEvent(event->modifiers()); + double timestamp = WTF::currentTime(); + + return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp); +} + +#if ENABLE(TOUCH_EVENTS) + +WebTouchEvent WebEventFactory::createWebTouchEvent(QTouchEvent* event) +{ + WebEvent::Type type = webEventTypeForEvent(event); + WebPlatformTouchPoint::TouchPointState state = static_cast<WebPlatformTouchPoint::TouchPointState>(0); + unsigned int id; + WebEvent::Modifiers modifiers = modifiersForEvent(event->modifiers()); + double timestamp = WTF::currentTime(); + + const QList<QTouchEvent::TouchPoint>& points = event->touchPoints(); + + Vector<WebPlatformTouchPoint> m_touchPoints; + for (int i = 0; i < points.count(); ++i) { + id = static_cast<unsigned>(points.at(i).id()); + switch (points.at(i).state()) { + case Qt::TouchPointReleased: + state = WebPlatformTouchPoint::TouchReleased; + break; + case Qt::TouchPointMoved: + state = WebPlatformTouchPoint::TouchMoved; + break; + case Qt::TouchPointPressed: + state = WebPlatformTouchPoint::TouchPressed; + break; + case Qt::TouchPointStationary: + state = WebPlatformTouchPoint::TouchStationary; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + m_touchPoints.append(WebPlatformTouchPoint(id, state, points.at(i).screenPos().toPoint(), points.at(i).pos().toPoint())); + } + + bool m_ctrlKey = (event->modifiers() & Qt::ControlModifier); + bool m_altKey = (event->modifiers() & Qt::AltModifier); + bool m_shiftKey = (event->modifiers() & Qt::ShiftModifier); + bool m_metaKey = (event->modifiers() & Qt::MetaModifier); + + return WebTouchEvent(type, m_touchPoints, m_ctrlKey, m_altKey, m_shiftKey, m_metaKey, modifiers, timestamp); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.h b/Source/WebKit2/Shared/qt/WebEventFactoryQt.h new file mode 100644 index 0000000..7864b16 --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef WebEventFactory_h +#define WebEventFactory_h + +#include "WebEvent.h" + +#if ENABLE(TOUCH_EVENTS) +class QTouchEvent; +#endif + +class QGraphicsSceneMouseEvent; +class QGraphicsSceneWheelEvent; +class QKeyEvent; + +namespace WebKit { + +class WebEventFactory { +public: + static WebMouseEvent createWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount); + static WebWheelEvent createWebWheelEvent(QGraphicsSceneWheelEvent* event); + static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent* event); +#if ENABLE(TOUCH_EVENTS) + static WebTouchEvent createWebTouchEvent(QTouchEvent* event); +#endif +}; + +} // namespace WebKit + +#endif // WebEventFactory_h diff --git a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp new file mode 100644 index 0000000..834353a --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLRequest.h" + +namespace WebKit { + +WebURLRequest::WebURLRequest(PlatformRequest) +{ + ASSERT_NOT_REACHED(); +} + +PlatformRequest WebURLRequest::platformRequest() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp new file mode 100644 index 0000000..abc0c29 --- /dev/null +++ b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLResponse.h" + +namespace WebKit { + +WebURLResponse::WebURLResponse(PlatformResponse) +{ + ASSERT_NOT_REACHED(); +} + +PlatformResponse WebURLResponse::platformResponse() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/CommandLineWin.cpp b/Source/WebKit2/Shared/win/CommandLineWin.cpp new file mode 100644 index 0000000..7d6c9e3 --- /dev/null +++ b/Source/WebKit2/Shared/win/CommandLineWin.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "CommandLine.h" + +namespace WebKit { + +bool CommandLine::parse(LPTSTR commandLineString) +{ + m_args.clear(); + + // Check if this is an empty command line. + if (!commandLineString || !commandLineString[0]) + return true; + + int argumentCount; + LPWSTR* commandLineArgs = ::CommandLineToArgvW(commandLineString, &argumentCount); + if (!commandLineArgs) + return false; + + if (argumentCount % 2) { + ::LocalFree(commandLineArgs); + return false; + } + + for (int i = 0; i < argumentCount ; i += 2) { + LPWSTR key = commandLineArgs[i]; + + if (key[0] != '-') { + ::LocalFree(commandLineArgs); + return false; + } + + m_args.set(&key[1], commandLineArgs[i + 1]); + } + + ::LocalFree(commandLineArgs); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp new file mode 100644 index 0000000..d947b87 --- /dev/null +++ b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NativeWebKeyboardEvent.h" + +#include "WebEventFactory.h" + +namespace WebKit { + +NativeWebKeyboardEvent::NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(hwnd, message, wParam, lParam)) + , m_nativeEvent() +{ + m_nativeEvent.hwnd = hwnd; + m_nativeEvent.message = message; + m_nativeEvent.wParam = wParam; + m_nativeEvent.lParam = lParam; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp new file mode 100644 index 0000000..b88a7ef --- /dev/null +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PlatformCertificateInfo.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include <WebCore/ResourceResponse.h> + +#if PLATFORM(CG) +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +PlatformCertificateInfo::PlatformCertificateInfo() +{ +} + +PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& response) +{ + CFURLResponseRef cfResponse = response.cfURLResponse(); + if (!cfResponse) + return; + +#if PLATFORM(CG) + CFDictionaryRef certificateInfo = wkGetSSLCertificateInfo(cfResponse); + if (!certificateInfo) + return; + + void* data = wkGetSSLCertificateChainContext(certificateInfo); + if (!data) + return; + + PCCERT_CHAIN_CONTEXT chainContext = static_cast<PCCERT_CHAIN_CONTEXT>(data); + if (chainContext->cChain < 1) + return; + + // The first simple chain starts with the leaf certificate and ends with a trusted root or self-signed certificate. + PCERT_SIMPLE_CHAIN firstSimpleChain = chainContext->rgpChain[0]; + for (unsigned i = 0; i < firstSimpleChain->cElement; ++i) { + PCCERT_CONTEXT certificateContext = firstSimpleChain->rgpElement[i]->pCertContext; + ::CertDuplicateCertificateContext(certificateContext); + m_certificateChain.append(certificateContext); + } +#else + // FIXME: WinCairo implementation +#endif +} + +PlatformCertificateInfo::~PlatformCertificateInfo() +{ + clearCertificateChain(); +} + +PlatformCertificateInfo::PlatformCertificateInfo(const PlatformCertificateInfo& other) +{ + for (size_t i = 0; i < other.m_certificateChain.size(); ++i) { + ::CertDuplicateCertificateContext(other.m_certificateChain[i]); + m_certificateChain.append(other.m_certificateChain[i]); + } +} + +PlatformCertificateInfo& PlatformCertificateInfo::operator=(const PlatformCertificateInfo& other) +{ + clearCertificateChain(); + for (size_t i = 0; i < other.m_certificateChain.size(); ++i) { + ::CertDuplicateCertificateContext(other.m_certificateChain[i]); + m_certificateChain.append(other.m_certificateChain[i]); + } + return *this; +} + +void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + // Special case no certificates + if (m_certificateChain.isEmpty()) { + encoder->encodeUInt64(std::numeric_limits<uint64_t>::max()); + return; + } + + uint64_t length = m_certificateChain.size(); + encoder->encodeUInt64(length); + + for (size_t i = 0; i < length; ++i) + encoder->encodeBytes(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded); +} + +bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& c) +{ + uint64_t length; + if (!decoder->decode(length)) + return false; + + if (length == std::numeric_limits<uint64_t>::max()) { + // This is the no certificates case. + return true; + } + + for (size_t i = 0; i < length; ++i) { + Vector<uint8_t> bytes; + if (!decoder->decodeBytes(bytes)) { + c.clearCertificateChain(); + return false; + } + + PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, bytes.data(), bytes.size()); + if (!certificateContext) { + c.clearCertificateChain(); + return false; + } + + c.m_certificateChain.append(certificateContext); + } + + return true; +} + +void PlatformCertificateInfo::clearCertificateChain() +{ + for (size_t i = 0; i < m_certificateChain.size(); ++i) + ::CertFreeCertificateContext(m_certificateChain[i]); + m_certificateChain.clear(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.h b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h new file mode 100644 index 0000000..e483d37 --- /dev/null +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h @@ -0,0 +1,64 @@ +/* + * 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 PlatformCertificateInfo_h +#define PlatformCertificateInfo_h + +#include <wtf/Vector.h> + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebCore { + class ResourceResponse; +} + +namespace WebKit { + +class PlatformCertificateInfo { +public: + PlatformCertificateInfo(); + explicit PlatformCertificateInfo(const WebCore::ResourceResponse&); + ~PlatformCertificateInfo(); + + PlatformCertificateInfo(const PlatformCertificateInfo&); + PlatformCertificateInfo& operator=(const PlatformCertificateInfo&); + + const Vector<PCCERT_CONTEXT>& certificateChain() const { return m_certificateChain; } + + void encode(CoreIPC::ArgumentEncoder* encoder) const; + static bool decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& t); + +private: + void clearCertificateChain(); + + Vector<PCCERT_CONTEXT> m_certificateChain; +}; + +} // namespace WebKit + +#endif // PlatformCertificateInfo_h diff --git a/Source/WebKit2/Shared/win/UpdateChunk.cpp b/Source/WebKit2/Shared/win/UpdateChunk.cpp new file mode 100644 index 0000000..2aabead --- /dev/null +++ b/Source/WebKit2/Shared/win/UpdateChunk.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "UpdateChunk.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +UpdateChunk::UpdateChunk() + : m_bitmapSharedMemory(0) +{ +} + +UpdateChunk::UpdateChunk(const IntRect& rect) + : m_rect(rect) +{ + // Create our shared memory mapping. + unsigned memorySize = rect.height() * rect.width() * 4; + m_bitmapSharedMemory = ::CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, memorySize, 0); +} + +UpdateChunk::UpdateChunk(const IntRect& rect, HANDLE bitmapSharedMemory) + : m_rect(rect) + , m_bitmapSharedMemory(bitmapSharedMemory) +{ +} + +void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_rect); + encoder->encode(reinterpret_cast<uintptr_t>(m_bitmapSharedMemory)); +} + +bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& updateChunk) +{ + IntRect rect; + if (!decoder->decode(rect)) + return false; + updateChunk.m_rect = rect; + + uintptr_t bitmapSharedMmemory; + if (!decoder->decode(bitmapSharedMmemory)) + return false; + + updateChunk.m_bitmapSharedMemory = reinterpret_cast<HANDLE>(bitmapSharedMmemory); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/UpdateChunk.h b/Source/WebKit2/Shared/win/UpdateChunk.h new file mode 100644 index 0000000..2ddeb8b --- /dev/null +++ b/Source/WebKit2/Shared/win/UpdateChunk.h @@ -0,0 +1,58 @@ +/* + * 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 UpdateChunk_h +#define UpdateChunk_h + +#include <WebCore/IntRect.h> + +namespace CoreIPC { + class ArgumentEncoder; + class ArgumentDecoder; +} + +namespace WebKit { + +class UpdateChunk { +public: + UpdateChunk(); + UpdateChunk(const WebCore::IntRect&); + UpdateChunk(const WebCore::IntRect&, HANDLE); + + const WebCore::IntRect& rect() const { return m_rect; } + HANDLE memory() const { return m_bitmapSharedMemory; } + bool isEmpty() const { return m_rect.isEmpty(); } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&); + +private: + WebCore::IntRect m_rect; + HANDLE m_bitmapSharedMemory; +}; + +} // namespace WebKit + +#endif // UpdateChunk_h diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp new file mode 100644 index 0000000..95d7de2 --- /dev/null +++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebCoreArgumentCoders.h" + +#if USE(CFNETWORK) +#include "ArgumentCodersCF.h" +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif + +namespace CoreIPC { + +// FIXME: These coders should really go in a WebCoreArgumentCodersCFNetwork file. + +void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest) +{ +#if USE(CFNETWORK) + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLRequestCreateSerializableRepresentation(resourceRequest.cfURLRequest(), CoreIPC::tokenNullTypeRef())); + encode(encoder, dictionary.get()); +#endif +} + +bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest) +{ +#if USE(CFNETWORK) + RetainPtr<CFDictionaryRef> dictionary; + if (!decode(decoder, dictionary)) + return false; + + CFURLRequestRef cfURLRequest = wkCFURLRequestCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); + if (!cfURLRequest) + return false; + + resourceRequest = WebCore::ResourceRequest(cfURLRequest); + return true; +#else + return false; +#endif +} + +void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse) +{ +#if USE(CFNETWORK) + bool responseIsPresent = resourceResponse.cfURLResponse(); + encoder->encode(responseIsPresent); + + if (!responseIsPresent) + return; + + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLResponseCreateSerializableRepresentation(resourceResponse.cfURLResponse(), CoreIPC::tokenNullTypeRef())); + encode(encoder, dictionary.get()); +#endif +} + +bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse) +{ +#if USE(CFNETWORK) + bool responseIsPresent; + decoder->decode(responseIsPresent); + + if (!responseIsPresent) { + resourceResponse = WebCore::ResourceResponse(); + return true; + } + + RetainPtr<CFDictionaryRef> dictionary; + if (!decode(decoder, dictionary)) + return false; + + CFURLResponseRef cfURLResponse = wkCFURLResponseCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef()); + if (!cfURLResponse) + return false; + + resourceResponse = WebCore::ResourceResponse(cfURLResponse); + return true; +#else + return false; +#endif +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Shared/win/WebEventFactory.cpp b/Source/WebKit2/Shared/win/WebEventFactory.cpp new file mode 100644 index 0000000..a4081fc --- /dev/null +++ b/Source/WebKit2/Shared/win/WebEventFactory.cpp @@ -0,0 +1,463 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2006-2009 Google 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 "WebEventFactory.h" + +#include <windowsx.h> +#include <wtf/ASCIICType.h> + +using namespace WebCore; + +namespace WebKit { + +static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000; +static const unsigned short SPI_GETWHEELSCROLLCHARS = 0x006C; + +static const unsigned WM_VISTA_MOUSEHWHEEL = 0x20E; + +static inline LPARAM relativeCursorPosition(HWND hwnd) +{ + POINT point = { -1, -1 }; + ::GetCursorPos(&point); + ::ScreenToClient(hwnd, &point); + return MAKELPARAM(point.x, point.y); +} + +static inline POINT point(LPARAM lParam) +{ + POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + return point; +} + +static int horizontalScrollChars() +{ + static ULONG scrollChars; + if (!scrollChars && !::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scrollChars, 0)) + scrollChars = 1; + return scrollChars; +} + +static int verticalScrollLines() +{ + static ULONG scrollLines; + if (!scrollLines && !::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0)) + scrollLines = 3; + return scrollLines; +} + +static inline int clickCount(WebEvent::Type type, WebMouseEvent::Button button, const POINT& position, double timeStampSeconds) +{ + static int gLastClickCount; + static double gLastClickTime; + static POINT lastClickPosition; + static WebMouseEvent::Button lastClickButton = WebMouseEvent::LeftButton; + + bool cancelPreviousClick = (abs(lastClickPosition.x - position.x) > (::GetSystemMetrics(SM_CXDOUBLECLK) / 2)) + || (abs(lastClickPosition.y - position.y) > (::GetSystemMetrics(SM_CYDOUBLECLK) / 2)) + || ((timeStampSeconds - gLastClickTime) * 1000.0 > ::GetDoubleClickTime()); + + if (type == WebEvent::MouseDown) { + if (!cancelPreviousClick && (button == lastClickButton)) + ++gLastClickCount; + else { + gLastClickCount = 1; + lastClickPosition = position; + } + gLastClickTime = timeStampSeconds; + lastClickButton = button; + } else if (type == WebEvent::MouseMove) { + if (cancelPreviousClick) { + gLastClickCount = 0; + lastClickPosition.x = 0; + lastClickPosition.y = 0; + gLastClickTime = 0; + } + } + + return gLastClickCount; +} + +static inline WebEvent::Modifiers modifiersForEvent(WPARAM wparam) +{ + unsigned modifiers = 0; + if (wparam & MK_CONTROL) + modifiers |= WebEvent::ControlKey; + if (wparam & MK_SHIFT) + modifiers |= WebEvent::ShiftKey; + if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT) + modifiers |= WebEvent::AltKey; + return static_cast<WebEvent::Modifiers>(modifiers); +} + +static inline WebEvent::Modifiers modifiersForCurrentKeyState() +{ + unsigned modifiers = 0; + if (::GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT) + modifiers |= WebEvent::ControlKey; + if (::GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT) + modifiers |= WebEvent::ShiftKey; + if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT) + modifiers |= WebEvent::AltKey; + return static_cast<WebEvent::Modifiers>(modifiers); +} + +static inline WebEvent::Type keyboardEventTypeForEvent(UINT message) +{ + switch (message) { + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + return WebEvent::RawKeyDown; + break; + case WM_SYSKEYUP: + case WM_KEYUP: + return WebEvent::KeyUp; + break; + case WM_IME_CHAR: + case WM_SYSCHAR: + case WM_CHAR: + return WebEvent::Char; + break; + default: + ASSERT_NOT_REACHED(); + return WebEvent::Char; + } +} + +static inline bool isSystemKeyEvent(UINT message) +{ + switch (message) { + case WM_SYSKEYDOWN: + case WM_SYSKEYUP: + case WM_SYSCHAR: + return true; + default: + return false; + } +} + +static bool isKeypadEvent(WPARAM wParam, LPARAM lParam, WebEvent::Type type) +{ + if (type != WebEvent::RawKeyDown && type != WebEvent::KeyUp) + return false; + + switch (wParam) { + case VK_NUMLOCK: + case VK_NUMPAD0: + case VK_NUMPAD1: + case VK_NUMPAD2: + case VK_NUMPAD3: + case VK_NUMPAD4: + case VK_NUMPAD5: + case VK_NUMPAD6: + case VK_NUMPAD7: + case VK_NUMPAD8: + case VK_NUMPAD9: + case VK_MULTIPLY: + case VK_ADD: + case VK_SEPARATOR: + case VK_SUBTRACT: + case VK_DECIMAL: + case VK_DIVIDE: + return true; + case VK_RETURN: + return HIWORD(lParam) & KF_EXTENDED; + case VK_INSERT: + case VK_DELETE: + case VK_PRIOR: + case VK_NEXT: + case VK_END: + case VK_HOME: + case VK_LEFT: + case VK_UP: + case VK_RIGHT: + case VK_DOWN: + return !(HIWORD(lParam) & KF_EXTENDED); + default: + return false; + } +} + +static String textFromEvent(WPARAM wparam, WebEvent::Type type) +{ + if (type != WebEvent::Char) + return String(); + + UChar c = static_cast<UChar>(wparam); + return String(&c, 1); +} + +static String unmodifiedTextFromEvent(WPARAM wparam, WebEvent::Type type) +{ + if (type != WebEvent::Char) + return String(); + + UChar c = static_cast<UChar>(wparam); + return String(&c, 1); +} + +static String keyIdentifierFromEvent(WPARAM wparam, WebEvent::Type type) +{ + if (type == WebEvent::Char) + return String(); + + unsigned short keyCode = static_cast<unsigned short>(wparam); + switch (keyCode) { + case VK_MENU: + return String("Alt"); + case VK_CONTROL: + return String("Control"); + case VK_SHIFT: + return String("Shift"); + case VK_CAPITAL: + return String("CapsLock"); + case VK_LWIN: + case VK_RWIN: + return String("Win"); + case VK_CLEAR: + return String("Clear"); + case VK_DOWN: + return String("Down"); + case VK_END: + return String("End"); + case VK_RETURN: + return String("Enter"); + case VK_EXECUTE: + return String("Execute"); + case VK_F1: + return String("F1"); + case VK_F2: + return String("F2"); + case VK_F3: + return String("F3"); + case VK_F4: + return String("F4"); + case VK_F5: + return String("F5"); + case VK_F6: + return String("F6"); + case VK_F7: + return String("F7"); + case VK_F8: + return String("F8"); + case VK_F9: + return String("F9"); + case VK_F10: + return String("F11"); + case VK_F12: + return String("F12"); + case VK_F13: + return String("F13"); + case VK_F14: + return String("F14"); + case VK_F15: + return String("F15"); + case VK_F16: + return String("F16"); + case VK_F17: + return String("F17"); + case VK_F18: + return String("F18"); + case VK_F19: + return String("F19"); + case VK_F20: + return String("F20"); + case VK_F21: + return String("F21"); + case VK_F22: + return String("F22"); + case VK_F23: + return String("F23"); + case VK_F24: + return String("F24"); + case VK_HELP: + return String("Help"); + case VK_HOME: + return String("Home"); + case VK_INSERT: + return String("Insert"); + case VK_LEFT: + return String("Left"); + case VK_NEXT: + return String("PageDown"); + case VK_PRIOR: + return String("PageUp"); + case VK_PAUSE: + return String("Pause"); + case VK_SNAPSHOT: + return String("PrintScreen"); + case VK_RIGHT: + return String("Right"); + case VK_SCROLL: + return String("Scroll"); + case VK_SELECT: + return String("Select"); + case VK_UP: + return String("Up"); + case VK_DELETE: + return String("U+007F"); // Standard says that DEL becomes U+007F. + default: + return String::format("U+%04X", toASCIIUpper(keyCode)); + } +} + +WebMouseEvent WebEventFactory::createWebMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool didActivateWebView) +{ + WebEvent::Type type; + WebMouseEvent::Button button = WebMouseEvent::NoButton; + switch (message) { + case WM_MOUSEMOVE: + type = WebEvent::MouseMove; + if (wParam & MK_LBUTTON) + button = WebMouseEvent::LeftButton; + else if (wParam & MK_MBUTTON) + button = WebMouseEvent::MiddleButton; + else if (wParam & MK_RBUTTON) + button = WebMouseEvent::RightButton; + break; + case WM_MOUSELEAVE: + type = WebEvent::MouseMove; + if (wParam & MK_LBUTTON) + button = WebMouseEvent::LeftButton; + else if (wParam & MK_MBUTTON) + button = WebMouseEvent::MiddleButton; + else if (wParam & MK_RBUTTON) + button = WebMouseEvent::RightButton; + + // Set the current mouse position (relative to the client area of the + // current window) since none is specified for this event. + lParam = relativeCursorPosition(hWnd); + break; + case WM_LBUTTONDOWN: + case WM_LBUTTONDBLCLK: + type = WebEvent::MouseDown; + button = WebMouseEvent::LeftButton; + break; + case WM_MBUTTONDOWN: + case WM_MBUTTONDBLCLK: + type = WebEvent::MouseDown; + button = WebMouseEvent::MiddleButton; + break; + case WM_RBUTTONDOWN: + case WM_RBUTTONDBLCLK: + type = WebEvent::MouseDown; + button = WebMouseEvent::RightButton; + break; + case WM_LBUTTONUP: + type = WebEvent::MouseUp; + button = WebMouseEvent::LeftButton; + break; + case WM_MBUTTONUP: + type = WebEvent::MouseUp; + button = WebMouseEvent::MiddleButton; + break; + case WM_RBUTTONUP: + type = WebEvent::MouseUp; + button = WebMouseEvent::RightButton; + break; + default: + ASSERT_NOT_REACHED(); + type = WebEvent::KeyDown; + } + + POINT position = point(lParam); + POINT globalPosition = position; + ::ClientToScreen(hWnd, &globalPosition); + + double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) + + int clickCount = WebKit::clickCount(type, button, position, timestamp); + WebEvent::Modifiers modifiers = modifiersForEvent(wParam); + + return WebMouseEvent(type, button, position, globalPosition, 0, 0, 0, clickCount, modifiers, timestamp, didActivateWebView); +} + +WebWheelEvent WebEventFactory::createWebWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + // Taken from WebCore + static const float cScrollbarPixelsPerLine = 100.0f / 3.0f; + + POINT globalPosition = point(lParam); + POINT position = globalPosition; + ::ScreenToClient(hWnd, &position); + + WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent; + + WebEvent::Modifiers modifiers = modifiersForEvent(wParam); + double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) + + int deltaX = 0; + int deltaY = 0; + int wheelTicksX = 0; + int wheelTicksY = 0; + + float delta = GET_WHEEL_DELTA_WPARAM(wParam) / static_cast<float>(WHEEL_DELTA); + bool isMouseHWheel = (message == WM_VISTA_MOUSEHWHEEL); + if (isMouseHWheel) { + wheelTicksX = delta; + wheelTicksY = 0; + delta = -delta; + } else { + wheelTicksX = 0; + wheelTicksY = delta; + } + if (isMouseHWheel || (modifiers & WebEvent::ShiftKey)) { + deltaX = delta * static_cast<float>(horizontalScrollChars()) * cScrollbarPixelsPerLine; + deltaY = 0; + granularity = WebWheelEvent::ScrollByPixelWheelEvent; + } else { + deltaX = 0; + deltaY = delta; + int verticalMultiplier = verticalScrollLines(); + if (verticalMultiplier == WHEEL_PAGESCROLL) + granularity = WebWheelEvent::ScrollByPageWheelEvent; + else { + granularity = WebWheelEvent::ScrollByPixelWheelEvent; + deltaY *= static_cast<float>(verticalMultiplier) * cScrollbarPixelsPerLine; + } + } + + return WebWheelEvent(WebEvent::Wheel, position, globalPosition, FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, modifiers, timestamp); +} + +WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) +{ + WebEvent::Type type = keyboardEventTypeForEvent(message); + String text = textFromEvent(wparam, type); + String unmodifiedText = unmodifiedTextFromEvent(wparam, type); + String keyIdentifier = keyIdentifierFromEvent(wparam, type); + int windowsVirtualKeyCode = static_cast<int>(wparam); + int nativeVirtualKeyCode = static_cast<int>(wparam); + int macCharCode = 0; + bool autoRepeat = HIWORD(lparam) & KF_REPEAT; + bool isKeypad = isKeypadEvent(wparam, lparam, type); + bool isSystemKey = isSystemKeyEvent(message); + WebEvent::Modifiers modifiers = modifiersForCurrentKeyState(); + double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) + + return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/WebEventFactory.h b/Source/WebKit2/Shared/win/WebEventFactory.h new file mode 100644 index 0000000..ce75cdf --- /dev/null +++ b/Source/WebKit2/Shared/win/WebEventFactory.h @@ -0,0 +1,45 @@ +/* + * 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 WebEventFactory_h +#define WebEventFactory_h + +#include "WebEvent.h" + +namespace WebKit { + +// FIXME: This is not needed in the WebProcess and should be moved to be a peer +// of WKView or removed altogether in favor of using PlatformEvents everywhere. + +class WebEventFactory { +public: + static WebMouseEvent createWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool didActivateWebView); + static WebWheelEvent createWebWheelEvent(HWND, UINT message, WPARAM, LPARAM); + static WebKeyboardEvent createWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM); +}; + +} // namespace WebKit + +#endif // WebEventFactory_h diff --git a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp new file mode 100644 index 0000000..e64d451 --- /dev/null +++ b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLRequest.h" + +namespace WebKit { + +WebURLRequest::WebURLRequest(PlatformRequest platformRequest) + : m_request(platformRequest) +{ +} + +PlatformRequest WebURLRequest::platformRequest() const +{ + return m_request.cfURLRequest(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp new file mode 100644 index 0000000..3b3f24c --- /dev/null +++ b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebURLResponse.h" + +namespace WebKit { + +WebURLResponse::WebURLResponse(PlatformResponse platformResponse) + : m_response(platformResponse) +{ +} + +PlatformResponse WebURLResponse::platformResponse() const +{ + return m_response.cfURLResponse(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h new file mode 100644 index 0000000..15cb7ee --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -0,0 +1,233 @@ +/* + * 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 WKAPICast_h +#define WKAPICast_h + +#include "CacheModel.h" +#include "FontSmoothingLevel.h" +#include "WKContext.h" +#include "WKCredentialTypes.h" +#include "WKPage.h" +#include "WKPreferencesPrivate.h" +#include "WKProtectionSpaceTypes.h" +#include "WKSharedAPICast.h" +#include <WebCore/Credential.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/ProtectionSpace.h> + +namespace WebKit { + +class AuthenticationChallengeProxy; +class AuthenticationDecisionListener; +class DownloadProxy; +class GeolocationPermissionRequestProxy; +class WebBackForwardList; +class WebBackForwardListItem; +class WebContext; +class WebCredential; +class WebDatabaseManagerProxy; +class WebFormSubmissionListenerProxy; +class WebFramePolicyListenerProxy; +class WebFrameProxy; +class WebGeolocationManagerProxy; +class WebGeolocationPosition; +class WebInspectorProxy; +class WebNavigationData; +class WebOpenPanelParameters; +class WebOpenPanelResultListenerProxy; +class WebPageGroup; +class WebPageProxy; +class WebPreferences; +class WebProtectionSpace; + +WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy) +WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener) +WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem) +WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList) +WK_ADD_API_MAPPING(WKContextRef, WebContext) +WK_ADD_API_MAPPING(WKCredentialRef, WebCredential) +WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy) +WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy) +WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy) +WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy) +WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy) +WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy) +WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy) +WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) +WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData) +WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters) +WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) +WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup) +WK_ADD_API_MAPPING(WKPageRef, WebPageProxy) +WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences) +WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace) + +#if ENABLE(INSPECTOR) +WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) +#endif + +/* Enum conversions */ + +inline CacheModel toCacheModel(WKCacheModel wkCacheModel) +{ + switch (wkCacheModel) { + case kWKCacheModelDocumentViewer: + return CacheModelDocumentViewer; + case kWKCacheModelDocumentBrowser: + return CacheModelDocumentBrowser; + case kWKCacheModelPrimaryWebBrowser: + return CacheModelPrimaryWebBrowser; + } + + ASSERT_NOT_REACHED(); + return CacheModelDocumentViewer; +} + +inline WKCacheModel toAPI(CacheModel cacheModel) +{ + switch (cacheModel) { + case CacheModelDocumentViewer: + return kWKCacheModelDocumentViewer; + case CacheModelDocumentBrowser: + return kWKCacheModelDocumentBrowser; + case CacheModelPrimaryWebBrowser: + return kWKCacheModelPrimaryWebBrowser; + } + + return kWKCacheModelDocumentViewer; +} + +inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel) +{ + switch (wkLevel) { + case kWKFontSmoothingLevelNoSubpixelAntiAliasing: + return FontSmoothingLevelNoSubpixelAntiAliasing; + case kWKFontSmoothingLevelLight: + return FontSmoothingLevelLight; + case kWKFontSmoothingLevelMedium: + return FontSmoothingLevelMedium; + case kWKFontSmoothingLevelStrong: + return FontSmoothingLevelStrong; +#if PLATFORM(WIN) + case kWKFontSmoothingLevelWindows: + return FontSmoothingLevelWindows; +#endif + } + + ASSERT_NOT_REACHED(); + return FontSmoothingLevelMedium; +} + + +inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level) +{ + switch (level) { + case FontSmoothingLevelNoSubpixelAntiAliasing: + return kWKFontSmoothingLevelNoSubpixelAntiAliasing; + case FontSmoothingLevelLight: + return kWKFontSmoothingLevelLight; + case FontSmoothingLevelMedium: + return kWKFontSmoothingLevelMedium; + case FontSmoothingLevelStrong: + return kWKFontSmoothingLevelStrong; +#if PLATFORM(WIN) + case FontSmoothingLevelWindows: + return kWKFontSmoothingLevelWindows; +#endif + } + + ASSERT_NOT_REACHED(); + return kWKFontSmoothingLevelMedium; +} + +inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type) +{ + switch (type) { + case WebCore::ProtectionSpaceServerHTTP: + return kWKProtectionSpaceServerTypeHTTP; + case WebCore::ProtectionSpaceServerHTTPS: + return kWKProtectionSpaceServerTypeHTTPS; + case WebCore::ProtectionSpaceServerFTP: + return kWKProtectionSpaceServerTypeFTP; + case WebCore::ProtectionSpaceServerFTPS: + return kWKProtectionSpaceServerTypeFTPS; + case WebCore::ProtectionSpaceProxyHTTP: + return kWKProtectionSpaceProxyTypeHTTP; + case WebCore::ProtectionSpaceProxyHTTPS: + return kWKProtectionSpaceProxyTypeHTTPS; + case WebCore::ProtectionSpaceProxyFTP: + return kWKProtectionSpaceProxyTypeFTP; + case WebCore::ProtectionSpaceProxySOCKS: + return kWKProtectionSpaceProxyTypeSOCKS; + } + return kWKProtectionSpaceServerTypeHTTP; +} + +inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type) +{ + switch (type) { + case WebCore::ProtectionSpaceAuthenticationSchemeDefault: + return kWKProtectionSpaceAuthenticationSchemeDefault; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic: + return kWKProtectionSpaceAuthenticationSchemeHTTPBasic; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest: + return kWKProtectionSpaceAuthenticationSchemeHTTPDigest; + case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm: + return kWKProtectionSpaceAuthenticationSchemeHTMLForm; + case WebCore::ProtectionSpaceAuthenticationSchemeNTLM: + return kWKProtectionSpaceAuthenticationSchemeNTLM; + case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate: + return kWKProtectionSpaceAuthenticationSchemeNegotiate; + case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested: + return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested; + case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested: + return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested; + default: + return kWKProtectionSpaceAuthenticationSchemeUnknown; + } +} + +inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type) +{ + switch (type) { + case kWKCredentialPersistenceNone: + return WebCore::CredentialPersistenceNone; + case kWKCredentialPersistenceForSession: + return WebCore::CredentialPersistenceForSession; + case kWKCredentialPersistencePermanent: + return WebCore::CredentialPersistencePermanent; + default: + return WebCore::CredentialPersistenceNone; + } +} + +} // namespace WebKit + +#if defined(WIN32) || defined(_WIN32) +#include "WKAPICastWin.h" +#endif + +#endif // WKAPICast_h diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp new file mode 100644 index 0000000..0997577 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKAuthenticationChallenge.h" + +#include "AuthenticationChallengeProxy.h" +#include "WebCredential.h" +#include "WebProtectionSpace.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKAuthenticationChallengeGetTypeID() +{ + return toAPI(AuthenticationChallengeProxy::APIType); +} + +WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->listener()); +} + +WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->protectionSpace()); +} + +WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->proposedCredential()); +} + +int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge) +{ + return toImpl(challenge)->previousFailureCount(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h new file mode 100644 index 0000000..3802f41 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h @@ -0,0 +1,46 @@ +/* + * 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 WKAuthenticationChallenge_h +#define WKAuthenticationChallenge_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKAuthenticationChallengeGetTypeID(); + +WK_EXPORT WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef); +WK_EXPORT WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef); +WK_EXPORT WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef); +WK_EXPORT int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKAuthenticationChallenge_h diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp new file mode 100644 index 0000000..959f5c2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKAuthenticationDecisionListener.h" + +#include "AuthenticationDecisionListener.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKAuthenticationDecisionListenerGetTypeID() +{ + return toAPI(AuthenticationDecisionListener::APIType); +} + +void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential) +{ + toImpl(authenticationListener)->useCredential(toImpl(credential)); +} + +void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener) +{ + toImpl(authenticationListener)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h new file mode 100644 index 0000000..f072461 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h @@ -0,0 +1,44 @@ +/* + * 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 WKAuthenticationDecisionListener_h +#define WKAuthenticationDecisionListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKAuthenticationDecisionListenerGetTypeID(); + +WK_EXPORT void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential); +WK_EXPORT void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFramePolicyListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp new file mode 100644 index 0000000..c2343ca --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBackForwardList.h" + +#include "WebBackForwardList.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKBackForwardListGetTypeID() +{ + return toAPI(WebBackForwardList::APIType); +} + +WKBackForwardListItemRef WKBackForwardListGetCurrentItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->currentItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetBackItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->backItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetForwardItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->forwardItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef listRef, int index) +{ + return toAPI(toImpl(listRef)->itemAtIndex(index)); +} + +unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef listRef) +{ + return toImpl(listRef)->backListCount(); +} + +unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef listRef) +{ + return toImpl(listRef)->forwardListCount(); +} + +WKArrayRef WKBackForwardListCopyBackListWithLimit(WKBackForwardListRef listRef, unsigned limit) +{ + return toAPI(toImpl(listRef)->backListAsImmutableArrayWithLimit(limit).releaseRef()); +} + +WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardListRef listRef, unsigned limit) +{ + return toAPI(toImpl(listRef)->forwardListAsImmutableArrayWithLimit(limit).releaseRef()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h new file mode 100644 index 0000000..214a6bc --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h @@ -0,0 +1,52 @@ +/* + * 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 WKBackForwardList_h +#define WKBackForwardList_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBackForwardListGetTypeID(); + +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetCurrentItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetBackItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetForwardItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef list, int index); + +WK_EXPORT unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef list); +WK_EXPORT unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef list); + +WK_EXPORT WKArrayRef WKBackForwardListCopyBackListWithLimit(WKBackForwardListRef list, unsigned limit); +WK_EXPORT WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardListRef list, unsigned limit); + +#ifdef __cplusplus +} +#endif + +#endif // WKBackForwardList_h diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp new file mode 100644 index 0000000..2165737 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp @@ -0,0 +1,46 @@ +/* + * 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 + * 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 "WKBackForwardListItem.h" + +#include "WKAPICast.h" +#include "WebBackForwardListItem.h" + +using namespace WebKit; + +WKTypeID WKBackForwardListItemGetTypeID() +{ + return toAPI(WebBackForwardListItem::APIType); +} + +WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef itemRef) +{ + return toCopiedURLAPI(toImpl(itemRef)->url()); +} + +WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef itemRef) +{ + return toCopiedAPI(toImpl(itemRef)->title()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h new file mode 100644 index 0000000..b0bf1de --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h @@ -0,0 +1,44 @@ +/* + * 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 + * 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 WKBackForwardListItem_h +#define WKBackForwardListItem_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBackForwardListItemGetTypeID(); + +WK_EXPORT WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef item); +WK_EXPORT WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef item); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBackForwardListItem_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp new file mode 100644 index 0000000..c207225 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKContext.h" +#include "WKContextPrivate.h" + +#include "WKAPICast.h" +#include "WebContext.h" +#include "WebURLRequest.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +WKTypeID WKContextGetTypeID() +{ + return toAPI(WebContext::APIType); +} + +WKContextRef WKContextCreate() +{ + RefPtr<WebContext> context = WebContext::create(String()); + return toAPI(context.release().releaseRef()); +} + +WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef pathRef) +{ + RefPtr<WebContext> context = WebContext::create(toImpl(pathRef)->string()); + return toAPI(context.release().releaseRef()); +} + +WKContextRef WKContextGetSharedProcessContext() +{ + return toAPI(WebContext::sharedProcessContext()); +} + +WKContextRef WKContextGetSharedThreadContext() +{ + return toAPI(WebContext::sharedThreadContext()); +} + +void WKContextSetInjectedBundleClient(WKContextRef contextRef, const WKContextInjectedBundleClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeInjectedBundleClient(wkClient); +} + +void WKContextSetHistoryClient(WKContextRef contextRef, const WKContextHistoryClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeHistoryClient(wkClient); +} + +void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownloadClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeDownloadClient(wkClient); +} + +void WKContextDownloadURLRequest(WKContextRef contextRef, const WKURLRequestRef requestRef) +{ + toImpl(contextRef)->download(0, toImpl(requestRef)->resourceRequest()); +} + +void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef contextRef, WKTypeRef userDataRef) +{ + toImpl(contextRef)->setInjectedBundleInitializationUserData(toImpl(userDataRef)); +} + +void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) +{ + toImpl(contextRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); +} + +void WKContextGetGlobalStatistics(WKContextStatistics* statistics) +{ + const WebContext::Statistics& webContextStatistics = WebContext::statistics(); + + statistics->wkViewCount = webContextStatistics.wkViewCount; + statistics->wkPageCount = webContextStatistics.wkPageCount; + statistics->wkFrameCount = webContextStatistics.wkViewCount; +} + +void WKContextAddVisitedLink(WKContextRef contextRef, WKStringRef visitedURL) +{ + toImpl(contextRef)->addVisitedLink(toImpl(visitedURL)->string()); +} + +void WKContextSetCacheModel(WKContextRef contextRef, WKCacheModel cacheModel) +{ + toImpl(contextRef)->setCacheModel(toCacheModel(cacheModel)); +} + +WKCacheModel WKContextGetCacheModel(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->cacheModel()); +} + +void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath) +{ + toImpl(contextRef)->setAlwaysUsesComplexTextCodePath(alwaysUseComplexTextCodePath); +} + +void _WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory) +{ + toImpl(contextRef)->setAdditionalPluginsDirectory(toImpl(pluginsDirectory)->string()); +} + +void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->registerURLSchemeAsEmptyDocument(toImpl(urlScheme)->string()); +} + +void WKContextRegisterURLSchemeAsSecure(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->registerURLSchemeAsSecure(toImpl(urlScheme)->string()); +} + +void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string()); +} + +void WKContextClearResourceCaches(WKContextRef contextRef) +{ + toImpl(contextRef)->clearResourceCaches(); +} + +void WKContextClearApplicationCache(WKContextRef contextRef) +{ + toImpl(contextRef)->clearApplicationCache(); +} + +WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->databaseManagerProxy()); +} + +WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->geolocationManagerProxy()); +} + +void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) +{ + toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); +} + +void WKContextStopMemorySampler(WKContextRef contextRef) +{ + toImpl(contextRef)->stopMemorySampler(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h new file mode 100644 index 0000000..810ad20 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -0,0 +1,133 @@ +/* + * 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 WKContext_h +#define WKContext_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKCacheModelDocumentViewer = 0, + kWKCacheModelDocumentBrowser = 1, + kWKCacheModelPrimaryWebBrowser = 2 +}; +typedef uint32_t WKCacheModel; + +// Injected Bundle Client +typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); +typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo); + +struct WKContextInjectedBundleClient { + int version; + const void * clientInfo; + WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; + WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; +}; +typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient; + +// History Client +typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo); + +struct WKContextHistoryClient { + int version; + const void * clientInfo; + WKContextDidNavigateWithNavigationDataCallback didNavigateWithNavigationData; + WKContextDidPerformClientRedirectCallback didPerformClientRedirect; + WKContextDidPerformServerRedirectCallback didPerformServerRedirect; + WKContextDidUpdateHistoryTitleCallback didUpdateHistoryTitle; + WKContextPopulateVisitedLinksCallback populateVisitedLinks; +}; +typedef struct WKContextHistoryClient WKContextHistoryClient; + +// Download Client +typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo); +typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo); +typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, bool* allowOverwrite, const void *clientInfo); +typedef void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo); +typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidFailCallback)(WKContextRef context, WKDownloadRef download, WKErrorRef error, const void *clientInfo); +typedef void (*WKContextDownloadDidCancel)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadProcessDidCrashCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); + +struct WKContextDownloadClient { + int version; + const void * clientInfo; + WKContextDownloadDidStartCallback didStart; + WKContextDownloadDidReceiveResponseCallback didReceiveResponse; + WKContextDownloadDidReceiveDataCallback didReceiveData; + WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType; + WKContextDownloadDecideDestinationWithSuggestedFilenameCallback decideDestinationWithSuggestedFilename; + WKContextDownloadDidCreateDestinationCallback didCreateDestination; + WKContextDownloadDidFinishCallback didFinish; + WKContextDownloadDidFailCallback didFail; + WKContextDownloadDidCancel didCancel; + WKContextDownloadProcessDidCrashCallback processDidCrash; +}; +typedef struct WKContextDownloadClient WKContextDownloadClient; + +WK_EXPORT WKTypeID WKContextGetTypeID(); + +WK_EXPORT WKContextRef WKContextCreate(); +WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path); +WK_EXPORT WKContextRef WKContextGetSharedProcessContext(); + +WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKContextInjectedBundleClient* client); +WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, const WKContextHistoryClient* client); +WK_EXPORT void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClient* client); + +WK_EXPORT void WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); + +WK_EXPORT void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef context, WKTypeRef userData); +WK_EXPORT void WKContextPostMessageToInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody); + +WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visitedURL); + +WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel); +WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); + +WK_EXPORT void WKContextClearResourceCaches(WKContextRef context); +WK_EXPORT void WKContextClearApplicationCache(WKContextRef context); + +WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); +WK_EXPORT void WKContextStopMemorySampler(WKContextRef context); + +WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context); +WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContext_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h new file mode 100644 index 0000000..8bcb1b6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -0,0 +1,61 @@ +/* + * 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 WKContextPrivate_h +#define WKContextPrivate_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKContext.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct WKContextStatistics { + unsigned wkViewCount; + unsigned wkPageCount; + unsigned wkFrameCount; +}; +typedef struct WKContextStatistics WKContextStatistics; + +WK_EXPORT void WKContextGetGlobalStatistics(WKContextStatistics* statistics); + +WK_EXPORT WKContextRef WKContextGetSharedThreadContext(); + +WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory); + +WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme); + +WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath); + +WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme); + +WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextPrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp new file mode 100644 index 0000000..25e1185 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKCredential.h" + +#include "WebCredential.h" +#include "WebString.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKCredentialGetTypeID() +{ + return toAPI(WebCredential::APIType); +} + +WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence persistence) +{ + RefPtr<WebCredential> credential = WebCredential::create(toImpl(username), toImpl(password), toCredentialPersistence(persistence)); + return toAPI(credential.release().releaseRef()); +} + +WKStringRef WKCredentialCopyUser(WKCredentialRef credentialRef) +{ + return toCopiedAPI(toImpl(credentialRef)->user()); +} + diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.h b/Source/WebKit2/UIProcess/API/C/WKCredential.h new file mode 100644 index 0000000..8b2602e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.h @@ -0,0 +1,45 @@ +/* + * 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 WKCredential_h +#define WKCredential_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKCredentialTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKCredentialGetTypeID(); + +WK_EXPORT WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence); +WK_EXPORT WKStringRef WKCredentialCopyUser(WKCredentialRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKCredential_h diff --git a/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h new file mode 100644 index 0000000..bba31ac --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h @@ -0,0 +1,44 @@ +/* + * 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 WKCredentialTypes_h +#define WKCredentialTypes_h + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKCredentialPersistenceNone, + kWKCredentialPersistenceForSession, + kWKCredentialPersistencePermanent +}; +typedef uint32_t WKCredentialPersistence; + +#ifdef __cplusplus +} +#endif + +#endif /* WKCredentialTypes_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp new file mode 100644 index 0000000..226ef8c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKDatabaseManager.h" + +#include "WebDatabaseManagerProxy.h" +#include "WKAPICast.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKDatabaseManagerGetTypeID() +{ + return toAPI(WebDatabaseManagerProxy::APIType); +} + +WKStringRef WKDatabaseManagerGetOriginKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetOriginQuotaKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originQuotaKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetOriginUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originUsageKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsNameKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsDisplayNameKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey()).releaseRef(); + return toAPI(key); +} + +void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManagerRef, const WKDatabaseManagerClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(databaseManagerRef)->initializeClient(wkClient); +} + +void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabasesByOriginFunction callback) +{ + toImpl(databaseManagerRef)->getDatabasesByOrigin(ArrayCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetDatabasesByOriginBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) +{ + WKDatabaseManagerGetDatabasesByOriginBlock block = (WKDatabaseManagerGetDatabasesByOriginBlock)context; + block(resultValue, errorRef); + Block_release(block); +} + +void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabasesByOriginBlock block) +{ + WKDatabaseManagerGetDatabasesByOrigin(databaseManagerRef, Block_copy(block), callGetDatabasesByOriginBlockAndDispose); +} +#endif + +void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction callback) +{ + toImpl(databaseManagerRef)->getDatabaseOrigins(ArrayCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetDatabaseOriginsBlockBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) +{ + WKDatabaseManagerGetDatabaseOriginsBlock block = (WKDatabaseManagerGetDatabaseOriginsBlock)context; + block(resultValue, errorRef); + Block_release(block); +} + +void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabaseOriginsBlock block) +{ + WKDatabaseManagerGetDatabaseOrigins(databaseManagerRef, Block_copy(block), callGetDatabaseOriginsBlockBlockAndDispose); +} +#endif + +void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManagerRef, WKStringRef databaseNameRef, WKSecurityOriginRef originRef) +{ + toImpl(databaseManagerRef)->deleteDatabaseWithNameForOrigin(toWTFString(databaseNameRef), toImpl(originRef)); +} + +void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef) +{ + toImpl(databaseManagerRef)->deleteDatabasesForOrigin(toImpl(originRef)); +} + +void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManagerRef) +{ + toImpl(databaseManagerRef)->deleteAllDatabases(); +} + +void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef, uint64_t quota) +{ + toImpl(databaseManagerRef)->setQuotaForOrigin(toImpl(originRef), quota); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h new file mode 100644 index 0000000..0a5eff6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h @@ -0,0 +1,106 @@ +/* + * 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 WKDatabaseManager_h +#define WKDatabaseManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Value type: WKSecurityOriginRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginQuotaKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginUsageKey(); + +/* Value type: WKArrayRef (array of WKDictionaryRef's with keys that include: + - WKDatabaseManagerGetDatabaseNameKey() + - WKDatabaseManagerGetDatabaseDisplayNameKey() + - WKDatabaseManagerGetDatabaseExpectedUsageKey() + - WKDatabaseManagerGetDatabaseCurrentUsageKey() + */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey(); + + +// Database Manager Client +typedef void (*WKDatabaseManagerDidModifyOriginCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, const void *clientInfo); +typedef void (*WKDatabaseManagerDidModifyDatabaseCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, WKStringRef databaseIdentifier, const void *clientInfo); + +struct WKDatabaseManagerClient { + int version; + const void * clientInfo; + WKDatabaseManagerDidModifyOriginCallback didModifyOrigin; + WKDatabaseManagerDidModifyDatabaseCallback didModifyDatabase; +}; +typedef struct WKDatabaseManagerClient WKDatabaseManagerClient; + + +WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID(); + +WK_EXPORT void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManager, const WKDatabaseManagerClient* client); + +typedef void (*WKDatabaseManagerGetDatabasesByOriginFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function); +#ifdef __BLOCKS__ +typedef void (^WKDatabaseManagerGetDatabasesByOriginBlock)(WKArrayRef, WKErrorRef); +WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabasesByOriginBlock block); +#endif + +typedef void (*WKDatabaseManagerGetDatabaseOriginsFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction function); +#ifdef __BLOCKS__ +typedef void (^WKDatabaseManagerGetDatabaseOriginsBlock)(WKArrayRef, WKErrorRef); +WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block); +#endif + +WK_EXPORT void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManager, WKStringRef databaseName, WKSecurityOriginRef origin); +WK_EXPORT void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin); +WK_EXPORT void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManager); + +WK_EXPORT void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, uint64_t quota); + +#ifdef __cplusplus +} +#endif + +#endif // WKDatabaseManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp new file mode 100644 index 0000000..8960e2a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKDownload.h" + +#include "DownloadProxy.h" +#include "WKAPICast.h" +#include "WebURLRequest.h" + +using namespace WebKit; + +WKTypeID WKDownloadGetTypeID() +{ + return toAPI(DownloadProxy::APIType); +} + +WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download) +{ + return toAPI(WebURLRequest::create(toImpl(download)->request()).leakRef()); +} + +WKDataRef WKDownloadGetResumeData(WKDownloadRef download) +{ + return toAPI(toImpl(download)->resumeData()); +} + +void WKDownloadCancel(WKDownloadRef download) +{ + return toImpl(download)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.h b/Source/WebKit2/UIProcess/API/C/WKDownload.h new file mode 100644 index 0000000..b812681 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.h @@ -0,0 +1,49 @@ +/* + * 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 WKDownload_h +#define WKDownload_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKDownloadGetTypeID(); + +WK_EXPORT WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download); +WK_EXPORT WKDataRef WKDownloadGetResumeData(WKDownloadRef download); +WK_EXPORT void WKDownloadCancel(WKDownloadRef download); + +#ifdef __cplusplus +} +#endif + +#endif // WKDownload_h diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp new file mode 100644 index 0000000..ae98831 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKFormSubmissionListener.h" + +#include "WKAPICast.h" +#include "WebFormSubmissionListenerProxy.h" + +using namespace WebKit; + +WKTypeID WKFormSubmissionListenerGetTypeID() +{ + return toAPI(WebFormSubmissionListenerProxy::APIType); +} + +void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener) +{ + toImpl(submissionListener)->continueSubmission(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h new file mode 100644 index 0000000..4b9b79a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h @@ -0,0 +1,43 @@ +/* + * 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 WKFormSubmissionListener_h +#define WKFormSubmissionListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKFormSubmissionListenerGetTypeID(); + +WK_EXPORT void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFormSubmissionListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp new file mode 100644 index 0000000..7c9ae11 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKFrame.h" + +#include "WKAPICast.h" +#include "WebFrameProxy.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKFrameGetTypeID() +{ + return toAPI(WebFrameProxy::APIType); +} + +bool WKFrameIsMainFrame(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isMainFrame(); +} + +WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef) +{ + WebFrameProxy* frame = toImpl(frameRef); + switch (frame->loadState()) { + case WebFrameProxy::LoadStateProvisional: + return kWKFrameLoadStateProvisional; + case WebFrameProxy::LoadStateCommitted: + return kWKFrameLoadStateCommitted; + case WebFrameProxy::LoadStateFinished: + return kWKFrameLoadStateFinished; + } + + ASSERT_NOT_REACHED(); + return kWKFrameLoadStateFinished; +} + +WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->provisionalURL()); +} + +WKURLRef WKFrameCopyURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->url()); +} + +WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->unreachableURL()); +} + +WKStringRef WKFrameCopyMIMEType(WKFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->mimeType()); +} + +WKStringRef WKFrameCopyTitle(WKFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->title()); +} + +WKPageRef WKFrameGetPage(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->page()); +} + +WKArrayRef WKFrameCopyChildFrames(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->childFrames().releaseRef()); +} + +WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->certificateInfo()); +} + +bool WKFrameCanProvideSource(WKFrameRef frameRef) +{ + return toImpl(frameRef)->canProvideSource(); +} + +bool WKFrameCanShowMIMEType(WKFrameRef frameRef, WKStringRef mimeTypeRef) +{ + return toImpl(frameRef)->canShowMIMEType(toWTFString(mimeTypeRef)); +} + +bool WKFrameIsDisplayingStandaloneImageDocument(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isDisplayingStandaloneImageDocument(); +} + +bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isDisplayingMarkupDocument(); +} + +bool WKFrameIsFrameSet(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isFrameSet(); +} + +void WKFrameGetMainResourceData(WKFrameRef frameRef, WKFrameGetMainResourceDataFunction callback, void* context) +{ + toImpl(frameRef)->getMainResourceData(DataCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetMainResourceDataBlockAndDispose(WKDataRef data, WKErrorRef error, void* context) +{ + WKFrameGetMainResourceDataBlock block = (WKFrameGetMainResourceDataBlock)context; + block(data, error); + Block_release(block); +} + +void WKFrameGetMainResourceData_b(WKFrameRef frameRef, WKFrameGetMainResourceDataBlock block) +{ + WKFrameGetMainResourceData(frameRef, callGetMainResourceDataBlockAndDispose, Block_copy(block)); +} +#endif + +void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context) +{ + toImpl(frameRef)->getWebArchive(DataCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetWebArchiveBlockAndDispose(WKDataRef archiveData, WKErrorRef error, void* context) +{ + WKFrameGetWebArchiveBlock block = (WKFrameGetWebArchiveBlock)context; + block(archiveData, error); + Block_release(block); +} + +void WKFrameGetWebArchive_b(WKFrameRef frameRef, WKFrameGetWebArchiveBlock block) +{ + WKFrameGetWebArchive(frameRef, callGetWebArchiveBlockAndDispose, Block_copy(block)); +} +#endif diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.h b/Source/WebKit2/UIProcess/API/C/WKFrame.h new file mode 100644 index 0000000..f812aeb --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.h @@ -0,0 +1,89 @@ +/* + * 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 WKFrame_h +#define WKFrame_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +enum WKFrameLoadState { + kWKFrameLoadStateProvisional = 0, + kWKFrameLoadStateCommitted = 1, + kWKFrameLoadStateFinished = 2 +}; +typedef enum WKFrameLoadState WKFrameLoadState; + +WK_EXPORT WKTypeID WKFrameGetTypeID(); + +WK_EXPORT bool WKFrameIsMainFrame(WKFrameRef frame); +WK_EXPORT WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frame); + +WK_EXPORT WKStringRef WKFrameCopyMIMEType(WKFrameRef frame); +WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame); + +WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame); + +WK_EXPORT WKArrayRef WKFrameCopyChildFrames(WKFrameRef frame); + +WK_EXPORT WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frame); + +WK_EXPORT bool WKFrameCanProvideSource(WKFrameRef frame); +WK_EXPORT bool WKFrameCanShowMIMEType(WKFrameRef frame, WKStringRef mimeType); + +WK_EXPORT bool WKFrameIsDisplayingStandaloneImageDocument(WKFrameRef frame); +WK_EXPORT bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frame); + +WK_EXPORT bool WKFrameIsFrameSet(WKFrameRef frame); + +typedef void (*WKFrameGetMainResourceDataFunction)(WKDataRef data, WKErrorRef error, void* functionContext); +WK_EXPORT void WKFrameGetMainResourceData(WKFrameRef frame, WKFrameGetMainResourceDataFunction function, void* functionContext); +#ifdef __BLOCKS__ +typedef void (^WKFrameGetMainResourceDataBlock)(WKDataRef data, WKErrorRef error); +WK_EXPORT void WKFrameGetMainResourceData_b(WKFrameRef frame, WKFrameGetMainResourceDataBlock block); +#endif + +typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext); +WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext); +#ifdef __BLOCKS__ +typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef error); +WK_EXPORT void WKFrameGetWebArchive_b(WKFrameRef frame, WKFrameGetWebArchiveBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKFrame_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp new file mode 100644 index 0000000..d44d0d3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKFramePolicyListener.h" + +#include "WKAPICast.h" +#include "WebFramePolicyListenerProxy.h" +#include "WebFrameProxy.h" + +using namespace WebKit; + +WKTypeID WKFramePolicyListenerGetTypeID() +{ + return toAPI(WebFramePolicyListenerProxy::APIType); +} + +void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->use(); +} + +void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->download(); +} + +void WKFramePolicyListenerIgnore(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->ignore(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h new file mode 100644 index 0000000..99b013d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h @@ -0,0 +1,45 @@ +/* + * 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 WKFramePolicyListener_h +#define WKFramePolicyListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKFramePolicyListenerGetTypeID(); + +WK_EXPORT void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListener); +WK_EXPORT void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListener); +WK_EXPORT void WKFramePolicyListenerIgnore(WKFramePolicyListenerRef policyListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFramePolicyListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp new file mode 100644 index 0000000..ed399ad --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp @@ -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. + */ + +#include "WKGeolocationManager.h" + +#include "WKAPICast.h" +#include "WebGeolocationManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKGeolocationManagerGetTypeID() +{ + return toAPI(WebGeolocationManagerProxy::APIType); +} + +void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManagerRef, const WKGeolocationProvider* wkProvider) +{ + if (wkProvider && wkProvider->version) + return; + toImpl(geolocationManagerRef)->initializeProvider(wkProvider); +} + +void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManagerRef, WKGeolocationPositionRef positionRef) +{ + toImpl(geolocationManagerRef)->providerDidChangePosition(toImpl(positionRef)); +} + +void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManagerRef) +{ + toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h new file mode 100644 index 0000000..07cbd79 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h @@ -0,0 +1,58 @@ +/* + * 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 WKGeolocationManager_h +#define WKGeolocationManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Provider. +typedef void (*WKGeolocationProviderStartUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); +typedef void (*WKGeolocationProviderStopUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); + +struct WKGeolocationProvider { + int version; + const void * clientInfo; + WKGeolocationProviderStartUpdatingCallback startUpdating; + WKGeolocationProviderStopUpdatingCallback stopUpdating; +}; +typedef struct WKGeolocationProvider WKGeolocationProvider; + +WK_EXPORT WKTypeID WKGeolocationManagerGetTypeID(); + +WK_EXPORT void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManager, const WKGeolocationProvider* provider); + +WK_EXPORT void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManager, WKGeolocationPositionRef position); +WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManager); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationManager_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp new file mode 100644 index 0000000..ca52798 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp @@ -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 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 "WKGeolocationPermissionRequest.h" + +#include "GeolocationPermissionRequestProxy.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKGeolocationPermissionRequestGetTypeID() +{ + return toAPI(GeolocationPermissionRequestProxy::APIType); +} + +void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef) +{ + return toImpl(geolocationPermissionRequestRef)->allow(); +} + +void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef) +{ + return toImpl(geolocationPermissionRequestRef)->deny(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h new file mode 100644 index 0000000..ee27b66 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h @@ -0,0 +1,44 @@ +/* + * 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 WKGeolocationPermissionRequest_h +#define WKGeolocationPermissionRequest_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGeolocationPermissionRequestGetTypeID(); + +WK_EXPORT void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequest); +WK_EXPORT void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequest); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationPermissionRequest_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp new file mode 100644 index 0000000..7977369 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.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 "WKGeolocationPosition.h" + +#include "WKAPICast.h" +#include "WebGeolocationPosition.h" + +using namespace WebKit; + +WKTypeID WKGeolocationPositionGetTypeID() +{ + return toAPI(WebGeolocationPosition::APIType); +} + +WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy) +{ + RefPtr<WebGeolocationPosition> position = WebGeolocationPosition::create(timestamp, latitude, longitude, accuracy); + return toAPI(position.release().releaseRef()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h new file mode 100644 index 0000000..85183fd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h @@ -0,0 +1,43 @@ +/* + * 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 WKGeolocationPosition_h +#define WKGeolocationPosition_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGeolocationPositionGetTypeID(); + +WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationPosition_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp new file mode 100644 index 0000000..7a87265 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKInspector.h" + +#if ENABLE(INSPECTOR) + +#include "WKAPICast.h" +#include "WebInspectorProxy.h" + +using namespace WebKit; + +WKTypeID WKInspectorGetTypeID() +{ + return toAPI(WebInspectorProxy::APIType); +} + +WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef) +{ + return toAPI(toImpl(inspectorRef)->page()); +} + +bool WKInspectorIsVisible(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isVisible(); +} + +void WKInspectorShow(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->show(); +} + +void WKInspectorClose(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->close(); +} + +void WKInspectorShowConsole(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->showConsole(); +} + +bool WKInspectorIsAttached(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isAttached(); +} + +void WKInspectorAttach(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->attach(); +} + +void WKInspectorDetach(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->detach(); +} + +bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isDebuggingJavaScript(); +} + +void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->toggleJavaScriptDebugging(); +} + +bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isProfilingJavaScript(); +} + +void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->toggleJavaScriptProfiling(); +} + +bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isProfilingPage(); +} + +void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->togglePageProfiling(); +} + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.h b/Source/WebKit2/UIProcess/API/C/WKInspector.h new file mode 100644 index 0000000..c147015 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.h @@ -0,0 +1,70 @@ +/* + * 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 WKInspector_h +#define WKInspector_h + +#include <WebKit2/WKBase.h> + +#if ENABLE(INSPECTOR) + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKInspectorGetTypeID(); + +WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector); +WK_EXPORT void WKInspectorShow(WKInspectorRef inspector); +WK_EXPORT void WKInspectorClose(WKInspectorRef inspector); + +WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector); +WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector); +WK_EXPORT void WKInspectorDetach(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspector); +WK_EXPORT void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspector); +WK_EXPORT void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector); +WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector); + +#ifdef __cplusplus +} +#endif + +#endif // ENABLE(INSPECTOR) + +#endif // WKInspector_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h new file mode 100644 index 0000000..ee0bd17 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h @@ -0,0 +1,52 @@ +/* + * 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 WKNativeEvent_h +#define WKNativeEvent_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __APPLE__ +#ifdef __OBJC__ +@class NSEvent; +#elif __cplusplus +class NSEvent; +#else +struct NSEvent; +#endif +typedef NSEvent *WKNativeEventPtr; +#elif defined(WIN32) || defined(_WIN32) +typedef const struct tagMSG* WKNativeEventPtr; +#else +typedef const void* WKNativeEventPtr; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKNativeEvent_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp new file mode 100644 index 0000000..90eb142 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKNavigationData.h" + +#include "WKAPICast.h" +#include "WebNavigationData.h" + +using namespace WebKit; + +WKTypeID WKNavigationDataGetTypeID() +{ + return toAPI(WebNavigationData::APIType); +} + +WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef) +{ + return toCopiedAPI(toImpl(navigationDataRef)->title()); +} + +WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationDataRef) +{ + return toCopiedURLAPI(toImpl(navigationDataRef)->url()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.h b/Source/WebKit2/UIProcess/API/C/WKNavigationData.h new file mode 100644 index 0000000..c855b54 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.h @@ -0,0 +1,44 @@ +/* + * 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 WKNavigationData_h +#define WKNavigationData_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKNavigationDataGetTypeID(); + +WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData); +WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData); + +#ifdef __cplusplus +} +#endif + +#endif /* WKNavigationData_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp new file mode 100644 index 0000000..3cf89cf --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKOpenPanelParameters.h" + +#include "WKAPICast.h" +#include "WebOpenPanelParameters.h" + +using namespace WebKit; + +WKTypeID WKOpenPanelParametersGetTypeID() +{ + return toAPI(WebOpenPanelParameters::APIType); +} + +bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parametersRef) +{ + return toImpl(parametersRef)->allowMultipleFiles(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h new file mode 100644 index 0000000..f32731c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h @@ -0,0 +1,47 @@ +/* + * 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 WKOpenPanelParameters_h +#define WKOpenPanelParameters_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKOpenPanelParametersGetTypeID(); + +WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parameters); + +#ifdef __cplusplus +} +#endif + +#endif /* WKOpenPanelParameters_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp new file mode 100644 index 0000000..5b143f2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKOpenPanelResultListener.h" + +#include "WKAPICast.h" +#include "WebOpenPanelResultListenerProxy.h" + +using namespace WebKit; + +WKTypeID WKOpenPanelResultListenerGetTypeID() +{ + return toAPI(WebOpenPanelResultListenerProxy::APIType); +} + +void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef) +{ + toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef)); +} + +void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef) +{ + toImpl(listenerRef)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h new file mode 100644 index 0000000..d581738 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h @@ -0,0 +1,44 @@ +/* + * 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 WKOpenPanelResultListener_h +#define WKOpenPanelResultListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKOpenPanelResultListenerGetTypeID(); + +WK_EXPORT void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listener, WKArrayRef fileURLs); +WK_EXPORT void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKOpenPanelResultListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp new file mode 100644 index 0000000..edcbf87 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -0,0 +1,431 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKPage.h" +#include "WKPagePrivate.h" + +#include "WKAPICast.h" +#include "WebBackForwardList.h" +#include "WebData.h" +#include "WebPageProxy.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKPageGetTypeID() +{ + return toAPI(WebPageProxy::APIType); +} + +WKContextRef WKPageGetContext(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->context()); +} + +WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->pageGroup()); +} + +void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef) +{ + toImpl(pageRef)->loadURL(toImpl(URLRef)->string()); +} + +void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef) +{ + toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef)); +} + +void WKPageLoadHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef) +{ + toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef)); +} + +void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef) +{ + toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef)); +} + +void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef) +{ + toImpl(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef)); +} + +void WKPageStopLoading(WKPageRef pageRef) +{ + toImpl(pageRef)->stopLoading(); +} + +void WKPageReload(WKPageRef pageRef) +{ + toImpl(pageRef)->reload(false); +} + +void WKPageReloadFromOrigin(WKPageRef pageRef) +{ + toImpl(pageRef)->reload(true); +} + +bool WKPageTryClose(WKPageRef pageRef) +{ + return toImpl(pageRef)->tryClose(); +} + +void WKPageClose(WKPageRef pageRef) +{ + toImpl(pageRef)->close(); +} + +bool WKPageIsClosed(WKPageRef pageRef) +{ + return toImpl(pageRef)->isClosed(); +} + +void WKPageGoForward(WKPageRef pageRef) +{ + toImpl(pageRef)->goForward(); +} + +bool WKPageCanGoForward(WKPageRef pageRef) +{ + return toImpl(pageRef)->canGoForward(); +} + +void WKPageGoBack(WKPageRef pageRef) +{ + toImpl(pageRef)->goBack(); +} + +bool WKPageCanGoBack(WKPageRef pageRef) +{ + return toImpl(pageRef)->canGoBack(); +} + +void WKPageGoToBackForwardListItem(WKPageRef pageRef, WKBackForwardListItemRef itemRef) +{ + toImpl(pageRef)->goToBackForwardItem(toImpl(itemRef)); +} + +WKBackForwardListRef WKPageGetBackForwardList(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->backForwardList()); +} + +WKStringRef WKPageCopyTitle(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->pageTitle()); +} + +WKFrameRef WKPageGetMainFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->mainFrame()); +} + +WKFrameRef WKPageGetFocusedFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->focusedFrame()); +} + +WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->frameSetLargestFrame()); +} + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WKInspectorRef WKPageGetInspector(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->inspector()); +} +#endif + +double WKPageGetEstimatedProgress(WKPageRef pageRef) +{ + return toImpl(pageRef)->estimatedProgress(); +} + +WKStringRef WKPageCopyUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->userAgent()); +} + +WKStringRef WKPageCopyApplicationNameForUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->applicationNameForUserAgent()); +} + +void WKPageSetApplicationNameForUserAgent(WKPageRef pageRef, WKStringRef applicationNameRef) +{ + toImpl(pageRef)->setApplicationNameForUserAgent(toWTFString(applicationNameRef)); +} + +WKStringRef WKPageCopyCustomUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->customUserAgent()); +} + +void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef) +{ + toImpl(pageRef)->setCustomUserAgent(toWTFString(userAgentRef)); +} + +bool WKPageSupportsTextEncoding(WKPageRef pageRef) +{ + return toImpl(pageRef)->supportsTextEncoding(); +} + +WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->customTextEncodingName()); +} + +void WKPageSetCustomTextEncodingName(WKPageRef pageRef, WKStringRef encodingNameRef) +{ + toImpl(pageRef)->setCustomTextEncodingName(toWTFString(encodingNameRef)); +} + +void WKPageTerminate(WKPageRef pageRef) +{ + toImpl(pageRef)->terminateProcess(); +} + +WKStringRef WKPageGetSessionHistoryURLValueType() +{ + static WebString* sessionHistoryURLValueType = WebString::create("SessionHistoryURL").releaseRef(); + return toAPI(sessionHistoryURLValueType); +} + +WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter) +{ + return toAPI(toImpl(pageRef)->sessionStateData(filter, context).releaseRef()); +} + +void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData) +{ + toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData)); +} + +double WKPageGetTextZoomFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->textZoomFactor(); +} + +bool WKPageSupportsTextZoom(WKPageRef pageRef) +{ + return toImpl(pageRef)->supportsTextZoom(); +} + +void WKPageSetTextZoomFactor(WKPageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setTextZoomFactor(zoomFactor); +} + +double WKPageGetPageZoomFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->pageZoomFactor(); +} + +void WKPageSetPageZoomFactor(WKPageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setPageZoomFactor(zoomFactor); +} + +void WKPageSetPageAndTextZoomFactors(WKPageRef pageRef, double pageZoomFactor, double textZoomFactor) +{ + toImpl(pageRef)->setPageAndTextZoomFactors(pageZoomFactor, textZoomFactor); +} + +void WKPageScaleWebView(WKPageRef pageRef, double scale, WKPoint origin) +{ + toImpl(pageRef)->scaleWebView(scale, toIntPoint(origin)); +} + +void WKPageSetUseFixedLayout(WKPageRef pageRef, bool fixed) +{ + toImpl(pageRef)->setUseFixedLayout(fixed); +} + +void WKPageSetFixedLayoutSize(WKPageRef pageRef, WKSize size) +{ + toImpl(pageRef)->setFixedLayoutSize(toIntSize(size)); +} + +bool WKPageUseFixedLayout(WKPageRef pageRef) +{ + return toImpl(pageRef)->useFixedLayout(); +} + +WKSize WKPageFixedLayoutSize(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->fixedLayoutSize()); +} + +double WKPageGetViewScaleFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->viewScaleFactor(); +} + +void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) +{ + toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount); +} + +void WKPageHideFindUI(WKPageRef pageRef) +{ + toImpl(pageRef)->hideFindUI(); +} + +void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) +{ + toImpl(pageRef)->countStringMatches(toImpl(string)->string(), toFindOptions(options), maxMatchCount); +} + +void WKPageSetPageContextMenuClient(WKPageRef pageRef, const WKPageContextMenuClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeContextMenuClient(wkClient); +} + +void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeFindClient(wkClient); +} + +void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeFormClient(wkClient); +} + +void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeLoaderClient(wkClient); +} + +void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializePolicyClient(wkClient); +} + +void WKPageSetPageResourceLoadClient(WKPageRef pageRef, const WKPageResourceLoadClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeResourceLoadClient(wkClient); +} + +void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeUIClient(wkClient); +} + +void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) +{ + toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callRunJavaScriptBlockAndRelease(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageRunJavaScriptInMainFrame_b(WKPageRef pageRef, WKStringRef scriptRef, WKPageRunJavaScriptBlock block) +{ + WKPageRunJavaScriptInMainFrame(pageRef, scriptRef, Block_copy(block), callRunJavaScriptBlockAndRelease); +} +#endif + +void WKPageRenderTreeExternalRepresentation(WKPageRef pageRef, void* context, WKPageRenderTreeExternalRepresentationFunction callback) +{ + toImpl(pageRef)->getRenderTreeExternalRepresentation(StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callRenderTreeExternalRepresentationBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageRenderTreeExternalRepresentationBlock block = (WKPageRenderTreeExternalRepresentationBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageRenderTreeExternalRepresentation_b(WKPageRef pageRef, WKPageRenderTreeExternalRepresentationBlock block) +{ + WKPageRenderTreeExternalRepresentation(pageRef, Block_copy(block), callRenderTreeExternalRepresentationBlockAndDispose); +} +#endif + +void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) +{ + toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetSourceForFrameBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageGetSourceForFrameBlock block = (WKPageGetSourceForFrameBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageGetSourceForFrame_b(WKPageRef pageRef, WKFrameRef frameRef, WKPageGetSourceForFrameBlock block) +{ + WKPageGetSourceForFrame(pageRef, frameRef, Block_copy(block), callGetSourceForFrameBlockBlockAndDispose); +} +#endif + +void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback) +{ + toImpl(pageRef)->getContentsAsString(StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callContentsAsStringBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageGetContentsAsStringBlock block = (WKPageGetContentsAsStringBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock block) +{ + WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose); +} +#endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h new file mode 100644 index 0000000..05730e5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -0,0 +1,352 @@ +/* + * 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 WKPage_h +#define WKPage_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKEvent.h> +#include <WebKit2/WKFindOptions.h> +#include <WebKit2/WKGeometry.h> +#include <WebKit2/WKNativeEvent.h> +#include <WebKit2/WKPageLoadTypes.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// FrameLoad Client +typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +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); + +// Progress Client +typedef void (*WKPageDidStartProgressCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidChangeProgressCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidFinishProgressCallback)(WKPageRef page, const void *clientInfo); + +// WebProcess Client +// FIXME: These three functions should not be part of this client. +typedef void (*WKPageProcessDidBecomeUnresponsiveCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageProcessDidBecomeResponsiveCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageProcessDidCrashCallback)(WKPageRef page, const void *clientInfo); + +typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, const void *clientInfo); + +struct WKPageLoaderClient { + int version; + const void * clientInfo; + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageDidStartProgressCallback didStartProgress; + WKPageDidChangeProgressCallback didChangeProgress; + WKPageDidFinishProgressCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageProcessDidBecomeUnresponsiveCallback processDidBecomeUnresponsive; + WKPageProcessDidBecomeResponsiveCallback processDidBecomeResponsive; + WKPageProcessDidCrashCallback processDidCrash; + + 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); + +struct WKPagePolicyClient { + int version; + const void * clientInfo; + WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; + WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKPageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType; +}; +typedef struct WKPagePolicyClient WKPagePolicyClient; + +// Form Client. +typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo); + +struct WKPageFormClient { + int version; + const void * clientInfo; + WKPageWillSubmitFormCallback willSubmitForm; +}; +typedef struct WKPageFormClient WKPageFormClient; + +// Resource Load Client. +typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, 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); +typedef void (*WKPageDidFinishLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, const void* clientInfo); +typedef void (*WKPageDidFailLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKErrorRef error, const void* clientInfo); + +struct WKPageResourceLoadClient { + int version; + const void * clientInfo; + WKPageDidInitiateLoadForResourceCallback didInitiateLoadForResource; + WKPageDidSendRequestForResourceCallback didSendRequestForResource; + WKPageDidReceiveResponseForResourceCallback didReceiveResponseForResource; + WKPageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource; + WKPageDidFinishLoadForResourceCallback didFinishLoadForResource; + WKPageDidFailLoadForResourceCallback didFailLoadForResource; +}; +typedef struct WKPageResourceLoadClient WKPageResourceLoadClient; + +// UI Client +typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); +typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); +typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); +typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); +typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo); +typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, const void* clientInfo); +typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); +typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo); +typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo); +typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo); +typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo); +typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo); +typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); +typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo); +typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo); +typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo); + +struct WKPageUIClient { + int version; + const void * clientInfo; + WKPageCreateNewPageCallback createNewPage; + WKPageShowPageCallback showPage; + WKPageCloseCallback close; + WKPageRunJavaScriptAlertCallback runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageMissingPluginButtonClickedCallback missingPluginButtonClicked; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; + WKPageDidDrawCallback didDraw; + WKPageDidScrollCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; +}; +typedef struct WKPageUIClient WKPageUIClient; + +// Find client. +typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); +typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo); +typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); + +struct WKPageFindClient { + int version; + const void * clientInfo; + WKPageDidFindStringCallback didFindString; + WKPageDidFailToFindStringCallback didFailToFindString; + WKPageDidCountStringMatchesCallback didCountStringMatches; +}; +typedef struct WKPageFindClient WKPageFindClient; + +enum { + kWKMoreThanMaximumMatchCount = -1 +}; + +// ContextMenu client +typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageCustomContextMenuItemSelectedCallback)(WKPageRef page, WKContextMenuItemRef contextMenuItem, const void* clientInfo); + +struct WKPageContextMenuClient { + int version; + const void * clientInfo; + WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; +}; +typedef struct WKPageContextMenuClient WKPageContextMenuClient; + +WK_EXPORT WKTypeID WKPageGetTypeID(); + +WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page); +WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page); + +WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url); +WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest); +WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL); +WK_EXPORT void WKPageLoadAlternateHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL); +WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString); + +WK_EXPORT void WKPageStopLoading(WKPageRef page); +WK_EXPORT void WKPageReload(WKPageRef page); +WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page); + +WK_EXPORT bool WKPageTryClose(WKPageRef page); +WK_EXPORT void WKPageClose(WKPageRef page); +WK_EXPORT bool WKPageIsClosed(WKPageRef page); + +WK_EXPORT void WKPageGoForward(WKPageRef page); +WK_EXPORT bool WKPageCanGoForward(WKPageRef page); +WK_EXPORT void WKPageGoBack(WKPageRef page); +WK_EXPORT bool WKPageCanGoBack(WKPageRef page); +WK_EXPORT void WKPageGoToBackForwardListItem(WKPageRef page, WKBackForwardListItemRef item); +WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page); + +WK_EXPORT WKStringRef WKPageCopyTitle(WKPageRef page); + +WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page); +WK_EXPORT WKFrameRef WKPageGetFocusedFrame(WKPageRef page); // The focused frame may be inactive. +WK_EXPORT WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef page); +WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page); + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page); +#endif + +WK_EXPORT WKStringRef WKPageCopyUserAgent(WKPageRef page); + +WK_EXPORT WKStringRef WKPageCopyApplicationNameForUserAgent(WKPageRef page); +WK_EXPORT void WKPageSetApplicationNameForUserAgent(WKPageRef page, WKStringRef applicationName); + +WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page); +WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent); + +WK_EXPORT bool WKPageSupportsTextEncoding(WKPageRef page); +WK_EXPORT WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef page); +WK_EXPORT void WKPageSetCustomTextEncodingName(WKPageRef page, WKStringRef encodingName); + +WK_EXPORT void WKPageTerminate(WKPageRef page); + +WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void); + +typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context); +WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback); +WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData); + +WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page); +WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page); +WK_EXPORT void WKPageSetTextZoomFactor(WKPageRef page, double zoomFactor); +WK_EXPORT double WKPageGetPageZoomFactor(WKPageRef page); +WK_EXPORT void WKPageSetPageZoomFactor(WKPageRef page, double zoomFactor); +WK_EXPORT void WKPageSetPageAndTextZoomFactors(WKPageRef page, double pageZoomFactor, double textZoomFactor); + +WK_EXPORT void WKPageScaleWebView(WKPageRef page, double scale, WKPoint origin); +WK_EXPORT double WKPageGetViewScaleFactor(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 void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); +WK_EXPORT void WKPageHideFindUI(WKPageRef page); +WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); + +WK_EXPORT void WKPageSetPageContextMenuClient(WKPageRef page, const WKPageContextMenuClient* client); +WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClient* client); +WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client); +WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client); +WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client); +WK_EXPORT void WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client); +WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client); + +typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageRunJavaScriptBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block); +#endif + +typedef void (*WKPageGetSourceForFrameFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetSourceForFrame(WKPageRef page, WKFrameRef frame, void* context, WKPageGetSourceForFrameFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageGetSourceForFrameBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageGetSourceForFrame_b(WKPageRef page, WKFrameRef frame, WKPageGetSourceForFrameBlock block); +#endif + +typedef void (*WKPageGetContentsAsStringFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetContentsAsString(WKPageRef page, void* context, WKPageGetContentsAsStringFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKPage_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp new file mode 100644 index 0000000..6c10014 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKPageGroup.h" + +#include "WKAPICast.h" +#include "WebPageGroup.h" +#include "WebPreferences.h" + +using namespace WebKit; + +WKTypeID WKPageGroupGetTypeID() +{ + return toAPI(WebPageGroup::APIType); +} + +WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier) +{ + RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(toWTFString(identifier)); + return toAPI(pageGroup.release().leakRef()); +} + +WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroupRef) +{ + return toCopiedAPI(toImpl(pageGroupRef)->identifier()); +} + +void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef preferencesRef) +{ + toImpl(pageGroupRef)->setPreferences(toImpl(preferencesRef)); +} + +WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroupRef) +{ + return toAPI(toImpl(pageGroupRef)->preferences()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h new file mode 100644 index 0000000..705df08 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h @@ -0,0 +1,48 @@ +/* + * 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 WKPageGroup_h +#define WKPageGroup_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPageGroupGetTypeID(); + +WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier); + +WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup); + +WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences); +WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPageGroup_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h new file mode 100644 index 0000000..3bf50c3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -0,0 +1,48 @@ +/* + * 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 WKPagePrivate_h +#define WKPagePrivate_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKPage.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function); + +#ifdef __BLOCKS__ +typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKPagePrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp new file mode 100644 index 0000000..379859c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -0,0 +1,451 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKPreferences.h" +#include "WKPreferencesPrivate.h" + +#include "WKAPICast.h" +#include "WebPreferences.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +using namespace WebKit; + +WKTypeID WKPreferencesGetTypeID() +{ + return toAPI(WebPreferences::APIType); +} + +WKPreferencesRef WKPreferencesCreate() +{ + RefPtr<WebPreferences> preferences = WebPreferences::create(); + return toAPI(preferences.release().leakRef()); +} + +WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef) +{ + RefPtr<WebPreferences> preferences = WebPreferences::create(toWTFString(identifierRef)); + return toAPI(preferences.release().releaseRef()); +} + +void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferencesRef, bool javaScriptEnabled) +{ + toImpl(preferencesRef)->setJavaScriptEnabled(javaScriptEnabled); +} + +bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptEnabled(); +} + +void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferencesRef, bool loadsImagesAutomatically) +{ + toImpl(preferencesRef)->setLoadsImagesAutomatically(loadsImagesAutomatically); +} + +bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->loadsImagesAutomatically(); +} + +void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef, bool offlineWebApplicationCacheEnabled) +{ + toImpl(preferencesRef)->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled); +} + +bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->offlineWebApplicationCacheEnabled(); +} + +void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferencesRef, bool localStorageEnabled) +{ + toImpl(preferencesRef)->setLocalStorageEnabled(localStorageEnabled); +} + +bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->localStorageEnabled(); +} + +void WKPreferencesSetDatabasesEnabled(WKPreferencesRef preferencesRef, bool databasesEnabled) +{ + toImpl(preferencesRef)->setDatabasesEnabled(databasesEnabled); +} + +bool WKPreferencesGetDatabasesEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->databasesEnabled(); +} + +void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferencesRef, bool xssAuditorEnabled) +{ + toImpl(preferencesRef)->setXSSAuditorEnabled(xssAuditorEnabled); +} + +bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->xssAuditorEnabled(); +} + +void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferencesRef, bool frameFlatteningEnabled) +{ + toImpl(preferencesRef)->setFrameFlatteningEnabled(frameFlatteningEnabled); +} + +bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->frameFlatteningEnabled(); +} + +void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferencesRef, bool pluginsEnabled) +{ + toImpl(preferencesRef)->setPluginsEnabled(pluginsEnabled); +} + +bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->pluginsEnabled(); +} + +void WKPreferencesSetJavaEnabled(WKPreferencesRef preferencesRef, bool javaEnabled) +{ + toImpl(preferencesRef)->setJavaEnabled(javaEnabled); +} + +bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaEnabled(); +} + +void WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef, bool javaScriptCanOpenWindowsAutomatically) +{ + toImpl(preferencesRef)->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); +} + +bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptCanOpenWindowsAutomatically(); +} + +void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef, bool hyperlinkAuditingEnabled) +{ + toImpl(preferencesRef)->setHyperlinkAuditingEnabled(hyperlinkAuditingEnabled); +} + +bool WKPreferencesGetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->hyperlinkAuditingEnabled(); +} + +void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setStandardFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->standardFontFamily()); +} + +void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setFixedFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyFixedFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->fixedFontFamily()); +} + +void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setSerifFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopySerifFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->serifFontFamily()); +} + +void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setSansSerifFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopySansSerifFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->sansSerifFontFamily()); +} + +void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setCursiveFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->cursiveFontFamily()); +} + +void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setFantasyFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->fantasyFontFamily()); +} + +void WKPreferencesSetDefaultFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setDefaultFontSize(size); +} + +uint32_t WKPreferencesGetDefaultFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->defaultFontSize(); +} + +void WKPreferencesSetDefaultFixedFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setDefaultFixedFontSize(size); +} + +uint32_t WKPreferencesGetDefaultFixedFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->defaultFixedFontSize(); +} + +void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setMinimumFontSize(size); +} + +uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->minimumFontSize(); +} + +void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name) +{ + toImpl(preferencesRef)->setDefaultTextEncodingName(toWTFString(name)); +} + +WKStringRef WKPreferencesCopyDefaultTextEncodingName(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->defaultTextEncodingName()); +} + +void WKPreferencesSetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPrivateBrowsingEnabled(enabled); +} + +bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->privateBrowsingEnabled(); +} + +void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDeveloperExtrasEnabled(enabled); +} + +bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->developerExtrasEnabled(); +} + +void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable) +{ + toImpl(preferencesRef)->setTextAreasAreResizable(resizable); +} + +bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->textAreasAreResizable(); +} + +void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef preferencesRef, WKFontSmoothingLevel wkLevel) +{ + toImpl(preferencesRef)->setFontSmoothingLevel(toFontSmoothingLevel(wkLevel)); +} + +WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef preferencesRef) +{ + return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel())); +} + +void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag); +} + +bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->acceleratedCompositingEnabled(); +} + +void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setCompositingBordersVisible(flag); +} + +bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->compositingBordersVisible(); +} + +void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setCompositingRepaintCountersVisible(flag); +} + +bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->compositingRepaintCountersVisible(); +} + +void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag); +} + +bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->needsSiteSpecificQuirks(); +} + +void WKPreferencesSetForceFTPDirectoryListings(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setForceFTPDirectoryListings(flag); +} + +bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->forceFTPDirectoryListings(); +} + +void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef, WKStringRef pathRef) +{ + toImpl(preferencesRef)->setFTPDirectoryTemplatePath(toWTFString(pathRef)); +} + +WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->ftpDirectoryTemplatePath()); +} + +void WKPreferencesSetTabsToLinks(WKPreferencesRef preferencesRef, bool tabsToLinks) +{ + toImpl(preferencesRef)->setTabsToLinks(tabsToLinks); +} + +bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->tabsToLinks(); +} + +void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDNSPrefetchingEnabled(enabled); +} + +bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->dnsPrefetchingEnabled(); +} + +void WKPreferencesSetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAuthorAndUserStylesEnabled(enabled); +} + +bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->authorAndUserStylesEnabled(); +} + +void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setShouldPrintBackgrounds(flag); +} + +bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->shouldPrintBackgrounds(); +} + +void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled); +} + +bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->webArchiveDebugModeEnabled(); +} + +void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setLocalFileContentSniffingEnabled(enabled); +} + +bool WKPreferencesGetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->localFileContentSniffingEnabled(); +} + +void WKPreferencesSetPageCacheEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setUsesPageCache(enabled); +} + +bool WKPreferencesGetPageCacheEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->usesPageCache(); +} + +void WKPreferencesSetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPaginateDuringLayoutEnabled(enabled); +} + +bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->paginateDuringLayoutEnabled(); +} + +void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDOMPasteAllowed(enabled); +} + +bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->domPasteAllowed(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h new file mode 100644 index 0000000..8116575 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -0,0 +1,153 @@ +/* + * 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 WKPreferences_h +#define WKPreferences_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPreferencesGetTypeID(); + +WK_EXPORT WKPreferencesRef WKPreferencesCreate(); +WK_EXPORT WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifier); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferences, bool javaScriptEnabled); +WK_EXPORT bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically); +WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences, bool offlineWebApplicationCacheEnabled); +WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferences, bool localStorageEnabled); +WK_EXPORT bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetDatabasesEnabled(WKPreferencesRef preferences, bool databasesEnabled); +WK_EXPORT bool WKPreferencesGetDatabasesEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferences, bool xssAuditorEnabled); +WK_EXPORT bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferences, bool frameFlatteningEnabled); +WK_EXPORT bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferences, bool pluginsEnabled); +WK_EXPORT bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaEnabled(WKPreferencesRef preferences, bool javaEnabled); +WK_EXPORT bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences, bool javaScriptCanOpenWindowsAutomatically); +WK_EXPORT bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferences, bool hyperlinkAuditingEnabled); +WK_EXPORT bool WKPreferencesGetHyperlinkAuditingEnabled(WKPreferencesRef preferences); + +WK_EXPORT void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyFixedFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopySerifFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopySansSerifFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef); + +// Defaults to 16. +WK_EXPORT void WKPreferencesSetDefaultFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetDefaultFontSize(WKPreferencesRef preferencesRef); + +// Defaults to 13. +WK_EXPORT void WKPreferencesSetDefaultFixedFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetDefaultFixedFontSize(WKPreferencesRef preferencesRef); + +// Defaults to 0. +WK_EXPORT void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name); +WK_EXPORT WKStringRef WKPreferencesCopyDefaultTextEncodingName(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable); +WK_EXPORT bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetTabsToLinks(WKPreferencesRef preferences, bool tabsToLinks); +WK_EXPORT bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetAuthorAndUserStylesEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferences, bool shouldPrintBackgrounds); +WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferences); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPreferences_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h new file mode 100644 index 0000000..7408c8e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -0,0 +1,99 @@ +/* + * 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 WKPreferencesPrivate_h +#define WKPreferencesPrivate_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum WKFontSmoothingLevel { + kWKFontSmoothingLevelNoSubpixelAntiAliasing = 0, + kWKFontSmoothingLevelLight = 1, + kWKFontSmoothingLevelMedium = 2, + kWKFontSmoothingLevelStrong = 3, +#if defined(WIN32) || defined(_WIN32) + kWKFontSmoothingLevelWindows = 4, +#endif +}; +typedef enum WKFontSmoothingLevel WKFontSmoothingLevel; + +// Defaults to kWKFontSmoothingLevelMedium. +WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel); +WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetForceFTPDirectoryListings(WKPreferencesRef preferences, bool force); +WK_EXPORT bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef preferences); + +// Defaults to the empty string. +WK_EXPORT void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferences, WKStringRef path); +WK_EXPORT WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetLocalFileContentSniffingEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetPageCacheEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetPageCacheEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetPaginateDuringLayoutEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferences); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPreferencesPrivate_h */ + diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp new file mode 100644 index 0000000..c72ee98 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKProtectionSpace.h" + +#include "WebProtectionSpace.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKProtectionSpaceGetTypeID() +{ + return toAPI(WebProtectionSpace::APIType); +} + +WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef protectionSpaceRef) +{ + return toCopiedAPI(toImpl(protectionSpaceRef)->host()); +} + +int WKProtectionSpaceGetPort(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->port(); +} + +WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef protectionSpaceRef) +{ + return toCopiedAPI(toImpl(protectionSpaceRef)->realm()); +} + +bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->isProxy(); +} + +WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef protectionSpaceRef) +{ + return toAPI(toImpl(protectionSpaceRef)->serverType()); +} + +bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->receivesCredentialSecurely(); +} + +WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef protectionSpaceRef) +{ + return toAPI(toImpl(protectionSpaceRef)->authenticationScheme()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h new file mode 100644 index 0000000..c77d93b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h @@ -0,0 +1,50 @@ +/* + * 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 WKProtectionSpace_h +#define WKProtectionSpace_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKProtectionSpaceTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKProtectionSpaceGetTypeID(); + +WK_EXPORT WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef); +WK_EXPORT int WKProtectionSpaceGetPort(WKProtectionSpaceRef); +WK_EXPORT WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef); +WK_EXPORT bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef); +WK_EXPORT WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef); +WK_EXPORT bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef); +WK_EXPORT WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKProtectionSpace_h diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h new file mode 100644 index 0000000..fd1bd09 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h @@ -0,0 +1,64 @@ +/* + * 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 WKProtectionSpaceTypes_h +#define WKProtectionSpaceTypes_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKProtectionSpaceServerTypeHTTP = 1, + kWKProtectionSpaceServerTypeHTTPS, + kWKProtectionSpaceServerTypeFTP, + kWKProtectionSpaceServerTypeFTPS, + kWKProtectionSpaceProxyTypeHTTP, + kWKProtectionSpaceProxyTypeHTTPS, + kWKProtectionSpaceProxyTypeFTP, + kWKProtectionSpaceProxyTypeSOCKS, +}; +typedef uint32_t WKProtectionSpaceServerType; + +enum { + kWKProtectionSpaceAuthenticationSchemeDefault = 1, + kWKProtectionSpaceAuthenticationSchemeHTTPBasic, + kWKProtectionSpaceAuthenticationSchemeHTTPDigest, + kWKProtectionSpaceAuthenticationSchemeHTMLForm, + kWKProtectionSpaceAuthenticationSchemeNTLM, + kWKProtectionSpaceAuthenticationSchemeNegotiate, + kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested, + kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested, + kWKProtectionSpaceAuthenticationSchemeUnknown = 100, +}; +typedef uint32_t WKProtectionSpaceAuthenticationScheme; + +#ifdef __cplusplus +} +#endif + +#endif // WKProtectionSpaceTypes_h diff --git a/Source/WebKit2/UIProcess/API/C/WebKit2.h b/Source/WebKit2/UIProcess/API/C/WebKit2.h new file mode 100644 index 0000000..02a339f --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WebKit2.h @@ -0,0 +1,63 @@ +/* + * 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 WebKit2_h +#define WebKit2_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKType.h> + +#include <WebKit2/WKArray.h> +#include <WebKit2/WKBackForwardList.h> +#include <WebKit2/WKBackForwardListItem.h> +#include <WebKit2/WKContext.h> +#include <WebKit2/WKData.h> +#include <WebKit2/WKDictionary.h> +#include <WebKit2/WKError.h> +#include <WebKit2/WKFormSubmissionListener.h> +#include <WebKit2/WKFrame.h> +#include <WebKit2/WKFramePolicyListener.h> +#include <WebKit2/WKGeolocationManager.h> +#include <WebKit2/WKGeolocationPermissionRequest.h> +#include <WebKit2/WKGeolocationPosition.h> +#include <WebKit2/WKMutableArray.h> +#include <WebKit2/WKMutableDictionary.h> +#include <WebKit2/WKNavigationData.h> +#include <WebKit2/WKNumber.h> +#include <WebKit2/WKOpenPanelParameters.h> +#include <WebKit2/WKOpenPanelResultListener.h> +#include <WebKit2/WKPage.h> +#include <WebKit2/WKPageGroup.h> +#include <WebKit2/WKPreferences.h> +#include <WebKit2/WKString.h> +#include <WebKit2/WKURL.h> +#include <WebKit2/WKURLRequest.h> +#include <WebKit2/WKURLResponse.h> + +#if !(defined(__APPLE__) && __APPLE__) || (defined(__OBJC__) && __OBJC__) +#include <WebKit2/WKView.h> +#endif + +#endif /* WebKit2_h */ diff --git a/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h new file mode 100644 index 0000000..78df4ac --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#ifndef WKNativeEvent_h +#define WKNativeEvent_h + +// a Qt specific WKNativeEvent.h file is needed because that the use of __APPLE__ +// in original WKNativeEvent.h file breaks Qt build in MacOS + +class QEvent; +typedef const QEvent* WKNativeEventPtr; + +#endif /* WKNativeEvent_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h new file mode 100644 index 0000000..6acb1a6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h @@ -0,0 +1,41 @@ +/* + * 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 WKAPICastWin_h +#define WKAPICastWin_h + +#ifndef WKAPICast_h +#error "Please #include \"WKAPICast.h\" instead of this file directly." +#endif + +namespace WebKit { + +class WebView; + +WK_ADD_API_MAPPING(WKViewRef, WebView) + +} + +#endif // WKAPICastWin_h diff --git a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h b/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h new file mode 100644 index 0000000..e2ee9a7 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h @@ -0,0 +1,35 @@ +/* + * 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 WKBaseWin_h +#define WKBaseWin_h + +#ifndef WKBase_h +#error "Please #include \"WKBase.h\" instead of this file directly." +#endif + +typedef const struct OpaqueWKView* WKViewRef; + +#endif /* WKBaseWin_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h new file mode 100644 index 0000000..c8a9c34 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h @@ -0,0 +1,47 @@ +/* + * 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 WKContextPrivateWin_h +#define WKContextPrivateWin_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKContext.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Defaults to true. +WK_EXPORT void WKContextSetShouldPaintNativeControls(WKContextRef, bool); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextPrivateWin_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp new file mode 100644 index 0000000..9906c81 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKContext.h" +#include "WKContextPrivateWin.h" + +#include "WKAPICast.h" +#include "WebContext.h" + +using namespace WebKit; + +void WKContextSetShouldPaintNativeControls(WKContextRef contextRef, bool b) +{ + toImpl(contextRef)->setShouldPaintNativeControls(b); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp new file mode 100644 index 0000000..612661e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKView.h" + +#include "WKAPICast.h" +#include "WebView.h" + +using namespace WebKit; + +WKTypeID WKViewGetTypeID() +{ + return toAPI(APIObject::TypeView); +} + +WKViewRef WKViewCreate(RECT rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef, HWND parentWindow) +{ + RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef), parentWindow); + return toAPI(view.release().releaseRef()); +} + +HWND WKViewGetWindow(WKViewRef viewRef) +{ + return toImpl(viewRef)->window(); +} + +WKPageRef WKViewGetPage(WKViewRef viewRef) +{ + return toAPI(toImpl(viewRef)->page()); +} + +void WKViewSetParentWindow(WKViewRef viewRef, HWND hostWindow) +{ + toImpl(viewRef)->setParentWindow(hostWindow); +} + +void WKViewWindowAncestryDidChange(WKViewRef viewRef) +{ + toImpl(viewRef)->windowAncestryDidChange(); +} + +void WKViewSetIsInWindow(WKViewRef viewRef, bool isInWindow) +{ + toImpl(viewRef)->setIsInWindow(isInWindow); +} + +void WKViewSetInitialFocus(WKViewRef viewRef, bool forward) +{ + toImpl(viewRef)->setInitialFocus(forward); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h new file mode 100644 index 0000000..f4226cd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -0,0 +1,53 @@ +/* + * 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 WKView_h +#define WKView_h + +#include <WebKit2/WKBase.h> +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKViewGetTypeID(); + +WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow); + +WK_EXPORT HWND WKViewGetWindow(WKViewRef view); + +WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); + +WK_EXPORT void WKViewSetParentWindow(WKViewRef view, HWND parentWindow); +WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view); +WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow); +WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward); + +#ifdef __cplusplus +} +#endif + +#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp new file mode 100644 index 0000000..00c3595 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKViewPrivate.h" + +#include "WKAPICast.h" +#include "WebView.h" + +using namespace WebKit; + +void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor) +{ + toImpl(viewRef)->setOverrideCursor(overrideCursor); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h new file mode 100644 index 0000000..5f89fd4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h @@ -0,0 +1,42 @@ +/* + * 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 WKViewPrivate_h +#define WKViewPrivate_h + +#include <WebKit2/WKBase.h> +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor); + +#ifdef __cplusplus +} +#endif + +#endif /* WKViewPrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h b/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h new file mode 100644 index 0000000..cb2a63e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h @@ -0,0 +1,212 @@ +/* + * 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 WKRetainPtr_h +#define WKRetainPtr_h + +#include <WebKit2/WKType.h> +#include <algorithm> + +namespace WebKit { + +enum WKAdoptTag { AdoptWK }; + +template<typename T> class WKRetainPtr { +public: + typedef T PtrType; + + WKRetainPtr() + : m_ptr(0) + { + } + + WKRetainPtr(PtrType ptr) + : m_ptr(ptr) + { + if (ptr) + WKRetain(ptr); + } + + WKRetainPtr(WKAdoptTag, PtrType ptr) + : m_ptr(ptr) + { + } + + template<typename U> WKRetainPtr(const WKRetainPtr<U>& o) + : m_ptr(o.get()) + { + if (PtrType ptr = m_ptr) + WKRetain(ptr); + } + + WKRetainPtr(const WKRetainPtr& o) + : m_ptr(o.m_ptr) + { + if (PtrType ptr = m_ptr) + WKRetain(ptr); + } + + ~WKRetainPtr() + { + if (PtrType ptr = m_ptr) + WKRelease(ptr); + } + + PtrType get() const { return m_ptr; } + + void clear() + { + PtrType ptr = m_ptr; + m_ptr = 0; + if (ptr) + WKRelease(ptr); + } + + PtrType leakRef() + { + PtrType ptr = m_ptr; + m_ptr = 0; + return ptr; + } + + PtrType operator->() const { return m_ptr; } + bool operator!() const { return !m_ptr; } + + // This conversion operator allows implicit conversion to bool but not to other integer types. + typedef PtrType WKRetainPtr::*UnspecifiedBoolType; + operator UnspecifiedBoolType() const { return m_ptr ? &WKRetainPtr::m_ptr : 0; } + + WKRetainPtr& operator=(const WKRetainPtr&); + template<typename U> WKRetainPtr& operator=(const WKRetainPtr<U>&); + WKRetainPtr& operator=(PtrType); + template<typename U> WKRetainPtr& operator=(U*); + + void adopt(PtrType); + void swap(WKRetainPtr&); + +private: + PtrType m_ptr; +}; + +template<typename T> inline WKRetainPtr<T>& WKRetainPtr<T>::operator=(const WKRetainPtr<T>& o) +{ + PtrType optr = o.get(); + if (optr) + WKRetain(optr); + PtrType ptr = m_ptr; + m_ptr = optr; + if (ptr) + WKRelease(ptr); + return *this; +} + +template<typename T> template<typename U> inline WKRetainPtr<T>& WKRetainPtr<T>::operator=(const WKRetainPtr<U>& o) +{ + PtrType optr = o.get(); + if (optr) + WKRetain(optr); + PtrType ptr = m_ptr; + m_ptr = optr; + if (ptr) + WKRelease(ptr); + return *this; +} + +template<typename T> inline WKRetainPtr<T>& WKRetainPtr<T>::operator=(PtrType optr) +{ + if (optr) + WKRetain(optr); + PtrType ptr = m_ptr; + m_ptr = optr; + if (ptr) + WKRelease(ptr); + return *this; +} + +template<typename T> inline void WKRetainPtr<T>::adopt(PtrType optr) +{ + PtrType ptr = m_ptr; + m_ptr = optr; + if (ptr) + WKRelease(ptr); +} + +template<typename T> template<typename U> inline WKRetainPtr<T>& WKRetainPtr<T>::operator=(U* optr) +{ + if (optr) + WKRetain(optr); + PtrType ptr = m_ptr; + m_ptr = optr; + if (ptr) + WKRelease(ptr); + return *this; +} + +template<typename T> inline void WKRetainPtr<T>::swap(WKRetainPtr<T>& o) +{ + std::swap(m_ptr, o.m_ptr); +} + +template<typename T> inline void swap(WKRetainPtr<T>& a, WKRetainPtr<T>& b) +{ + a.swap(b); +} + +template<typename T, typename U> inline bool operator==(const WKRetainPtr<T>& a, const WKRetainPtr<U>& b) +{ + return a.get() == b.get(); +} + +template<typename T, typename U> inline bool operator==(const WKRetainPtr<T>& a, U* b) +{ + return a.get() == b; +} + +template<typename T, typename U> inline bool operator==(T* a, const WKRetainPtr<U>& b) +{ + return a == b.get(); +} + +template<typename T, typename U> inline bool operator!=(const WKRetainPtr<T>& a, const WKRetainPtr<U>& b) +{ + return a.get() != b.get(); +} + +template<typename T, typename U> inline bool operator!=(const WKRetainPtr<T>& a, U* b) +{ + return a.get() != b; +} + +template<typename T, typename U> inline bool operator!=(T* a, const WKRetainPtr<U>& b) +{ + return a != b.get(); +} + +} // namespace WebKit + +using WebKit::WKRetainPtr; +using WebKit::AdoptWK; + +#endif // WKRetainPtr_h diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp new file mode 100644 index 0000000..0f2c946 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "WKStringQt.h" + +#include "WKAPICast.h" +#include <QString> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +WKStringRef WKStringCreateWithQString(const QString& qString) +{ + WTF::String string(qString); + return toCopiedAPI(string); +} + +QString WKStringCopyQString(WKStringRef stringRef) +{ + if (!stringRef) + return QString(); + const WTF::String& string = toImpl(stringRef)->string(); + return QString(reinterpret_cast<const QChar*>(string.characters()), string.length()); +} diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h new file mode 100644 index 0000000..cc46e42 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKStringQt.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WKStringQt_h +#define WKStringQt_h + +#include <QString> +#include <WebKit2/WKBase.h> + +WK_EXPORT WKStringRef WKStringCreateWithQString(const QString& string); +WK_EXPORT QString WKStringCopyQString(WKStringRef string); + +#endif /* WKStringQt_h */ diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp new file mode 100644 index 0000000..74eca86 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "WKURLQt.h" + +#include "WKAPICast.h" +#include <QString> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +WKURLRef WKURLCreateWithQUrl(const QUrl& qURL) +{ + WTF::String urlString(qURL.toString()); + return toCopiedURLAPI(urlString); +} + +QUrl WKURLCopyQUrl(WKURLRef urlRef) +{ + if (!urlRef) + return QUrl(); + const WTF::String& string = toImpl(urlRef)->string(); + return QUrl(QString(reinterpret_cast<const QChar*>(string.characters()), string.length())); +} diff --git a/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h new file mode 100644 index 0000000..2e41473 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WKURLQt_h +#define WKURLQt_h + +#include <QUrl> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKURL.h> + +WK_EXPORT WKURLRef WKURLCreateWithQUrl(const QUrl& url); +QUrl WKURLCopyQUrl(WKURLRef url); + +#endif /* WKURLCF_h */ diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h new file mode 100644 index 0000000..e8889b6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h @@ -0,0 +1,77 @@ +/* + * 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 FindIndicatorWindow_h +#define FindIndicatorWindow_h + +#import <wtf/Noncopyable.h> +#import <wtf/PassOwnPtr.h> +#import <wtf/RefPtr.h> +#import <wtf/RetainPtr.h> +#import "RunLoop.h" +#import "WebKitSystemInterface.h" + +@class WKView; +@class WebFindIndicatorWindowAnimation; + +namespace WebKit { + +class FindIndicator; + +class FindIndicatorWindow { + WTF_MAKE_NONCOPYABLE(FindIndicatorWindow); + +public: + static PassOwnPtr<FindIndicatorWindow> create(WKView *); + ~FindIndicatorWindow(); + + void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut); + +private: + explicit FindIndicatorWindow(WKView *); + void closeWindow(); + + void startFadeOutTimerFired(); + + void fadeOutAnimationCallback(double); + void fadeOutAnimationDidEnd(); + + void bounceAnimationCallback(double); + void bounceAnimationDidEnd(); + + WKView* m_wkView; + RefPtr<FindIndicator> m_findIndicator; + RetainPtr<NSWindow> m_findIndicatorWindow; + + WKWindowBounceAnimationContextRef m_bounceAnimationContext; + RetainPtr<WebFindIndicatorWindowAnimation> m_bounceAnimation; + + RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer; + RetainPtr<WebFindIndicatorWindowAnimation> m_fadeOutAnimation; +}; + +} // namespace WebKit + +#endif // FindIndicatorWindow_h diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm new file mode 100644 index 0000000..5b93a9e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "FindIndicatorWindow.h" + +#include "FindIndicator.h" +#include <WebCore/GraphicsContext.h> + +static const double bounceAnimationDuration = 0.12; +static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2; +static const double fadeOutAnimationDuration = 0.3; + +using namespace WebCore; + +@interface WebFindIndicatorView : NSView { + RefPtr<WebKit::FindIndicator> _findIndicator; +} + +- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator; +@end + +@implementation WebFindIndicatorView + +- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator +{ + if ((self = [super initWithFrame:NSZeroRect])) + _findIndicator = findIndicator; + + return self; +} + +- (void)drawRect:(NSRect)rect +{ + GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort])); + + _findIndicator->draw(graphicsContext, enclosingIntRect(rect)); +} + +- (BOOL)isFlipped +{ + return YES; +} + +@end + +@interface WebFindIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> { + WebKit::FindIndicatorWindow* _findIndicatorWindow; + void (WebKit::FindIndicatorWindow::*_animationProgressCallback)(double progress); + void (WebKit::FindIndicatorWindow::*_animationDidEndCallback)(); +} + +- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow + animationDuration:(CFTimeInterval)duration + animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback + animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback; +@end + +@implementation WebFindIndicatorWindowAnimation + +- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow + animationDuration:(CFTimeInterval)animationDuration + animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback + animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback +{ + if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) { + _findIndicatorWindow = findIndicatorWindow; + _animationProgressCallback = animationProgressCallback; + _animationDidEndCallback = animationDidEndCallback; + [self setDelegate:self]; + [self setAnimationBlockingMode:NSAnimationNonblocking]; + } + return self; +} + +- (void)setCurrentProgress:(NSAnimationProgress)progress +{ + (_findIndicatorWindow->*_animationProgressCallback)(progress); +} + +- (void)animationDidEnd:(NSAnimation *)animation +{ + ASSERT(animation == self); + + (_findIndicatorWindow->*_animationDidEndCallback)(); +} + +@end + +namespace WebKit { + +PassOwnPtr<FindIndicatorWindow> FindIndicatorWindow::create(WKView *wkView) +{ + return adoptPtr(new FindIndicatorWindow(wkView)); +} + +FindIndicatorWindow::FindIndicatorWindow(WKView *wkView) + : m_wkView(wkView) + , m_bounceAnimationContext(0) + , m_startFadeOutTimer(RunLoop::main(), this, &FindIndicatorWindow::startFadeOutTimerFired) +{ +} + +FindIndicatorWindow::~FindIndicatorWindow() +{ + closeWindow(); +} + +void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut) +{ + if (m_findIndicator == findIndicator) + return; + + m_findIndicator = findIndicator; + + // Get rid of the old window. + closeWindow(); + + if (!m_findIndicator) + return; + + NSRect contentRect = m_findIndicator->frameRect(); + NSRect windowFrameRect = NSIntegralRect([m_wkView convertRect:contentRect toView:nil]); + windowFrameRect.origin = [[m_wkView window] convertBaseToScreen:windowFrameRect.origin]; + + NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask]; + + m_findIndicatorWindow.adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect + styleMask:NSBorderlessWindowMask + backing:NSBackingStoreBuffered + defer:NO]); + + [m_findIndicatorWindow.get() setBackgroundColor:[NSColor clearColor]]; + [m_findIndicatorWindow.get() setOpaque:NO]; + [m_findIndicatorWindow.get() setIgnoresMouseEvents:YES]; + + RetainPtr<WebFindIndicatorView> findIndicatorView(AdoptNS, [[WebFindIndicatorView alloc] _initWithFindIndicator:m_findIndicator]); + [m_findIndicatorWindow.get() setContentView:findIndicatorView.get()]; + + [[m_wkView window] addChildWindow:m_findIndicatorWindow.get() ordered:NSWindowAbove]; + [m_findIndicatorWindow.get() setReleasedWhenClosed:NO]; + + // Start the bounce animation. + m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get()); + m_bounceAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this + animationDuration:bounceAnimationDuration + animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback + animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]); + [m_bounceAnimation.get() startAnimation]; + + if (fadeOut) + m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts); +} + +void FindIndicatorWindow::closeWindow() +{ + if (!m_findIndicatorWindow) + return; + + m_startFadeOutTimer.stop(); + + if (m_fadeOutAnimation) { + [m_fadeOutAnimation.get() stopAnimation]; + m_fadeOutAnimation = nullptr; + } + + if (m_bounceAnimation) { + [m_bounceAnimation.get() stopAnimation]; + m_bounceAnimation = nullptr; + } + + if (m_bounceAnimationContext) + WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext); + + [[m_findIndicatorWindow.get() parentWindow] removeChildWindow:m_findIndicatorWindow.get()]; + [m_findIndicatorWindow.get() close]; + m_findIndicatorWindow = nullptr; +} + +void FindIndicatorWindow::startFadeOutTimerFired() +{ + ASSERT(!m_fadeOutAnimation); + + m_fadeOutAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this + animationDuration:fadeOutAnimationDuration + animationProgressCallback:&FindIndicatorWindow::fadeOutAnimationCallback + animationDidEndCallback:&FindIndicatorWindow::fadeOutAnimationDidEnd]); + [m_fadeOutAnimation.get() startAnimation]; +} + +void FindIndicatorWindow::fadeOutAnimationCallback(double progress) +{ + ASSERT(m_fadeOutAnimation); + + [m_findIndicatorWindow.get() setAlphaValue:1.0 - progress]; +} + +void FindIndicatorWindow::fadeOutAnimationDidEnd() +{ + ASSERT(m_fadeOutAnimation); + ASSERT(m_findIndicatorWindow); + + closeWindow(); +} + +void FindIndicatorWindow::bounceAnimationCallback(double progress) +{ + ASSERT(m_bounceAnimation); + ASSERT(m_bounceAnimationContext); + + WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress); +} + +void FindIndicatorWindow::bounceAnimationDidEnd() +{ + ASSERT(m_bounceAnimation); + ASSERT(m_bounceAnimationContext); + ASSERT(m_findIndicatorWindow); + + WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext); + m_bounceAnimationContext = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.h b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h new file mode 100644 index 0000000..2c4a235 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h @@ -0,0 +1,74 @@ +/* + * 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 PDFViewController_h +#define PDFViewController_h + +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RetainPtr.h> + +@class PDFView; +@class WKView; +@class WKPDFView; + +namespace CoreIPC { + class DataReference; +} + +namespace WebKit { + +class PDFViewController { + WTF_MAKE_NONCOPYABLE(PDFViewController); + +public: + static PassOwnPtr<PDFViewController> create(WKView *); + ~PDFViewController(); + + WKView* wkView() const { return m_wkView; } + void setPDFDocumentData(const String& mimeType, const CoreIPC::DataReference&); + + double zoomFactor() const; + void setZoomFactor(double); + + static Class pdfPreviewViewClass(); + + NSPrintOperation *makePrintOperation(NSPrintInfo *); + +private: + explicit PDFViewController(WKView *wkView); + + static Class pdfDocumentClass(); + static NSBundle* pdfKitBundle(); + + WKView* m_wkView; + RetainPtr<WKPDFView> m_wkPDFView; + PDFView* m_pdfView; +}; + +} // namespace WebKit + +#endif // PDFViewController_h diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm new file mode 100644 index 0000000..a92c2d4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm @@ -0,0 +1,297 @@ +/* + * 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 + * 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 "PDFViewController.h" + +#import "DataReference.h" +#import "WKAPICast.h" +#import "WKView.h" +#import "WebPageGroup.h" +#import "WebPageProxy.h" +#import "WebPreferences.h" +#import <PDFKit/PDFKit.h> +#import <wtf/text/WTFString.h> + +// Redeclarations of PDFKit notifications. We can't use the API since we use a weak link to the framework. +#define _webkit_PDFViewDisplayModeChangedNotification @"PDFViewDisplayModeChanged" +#define _webkit_PDFViewScaleChangedNotification @"PDFViewScaleChanged" +#define _webkit_PDFViewPageChangedNotification @"PDFViewChangedPage" + +using namespace WebKit; + +@class PDFDocument; +@class PDFView; + +@interface PDFDocument (PDFDocumentDetails) +- (NSPrintOperation *)getPrintOperationForPrintInfo:(NSPrintInfo *)printInfo autoRotate:(BOOL)doRotate; +@end + +extern "C" NSString *_NSPathForSystemFramework(NSString *framework); + +@interface WKPDFView : NSView +{ + PDFViewController* _pdfViewController; + + RetainPtr<NSView> _pdfPreviewView; + PDFView *_pdfView; + BOOL _ignoreScaleAndDisplayModeAndPageNotifications; + BOOL _willUpdatePreferencesSoon; +} + +- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController; +- (void)invalidate; +- (PDFView *)pdfView; +- (void)setDocument:(PDFDocument *)pdfDocument; + +- (void)_applyPDFPreferences; + +@end + +@implementation WKPDFView + +- (id)initWithFrame:(NSRect)frame PDFViewController:(PDFViewController*)pdfViewController +{ + if ((self = [super initWithFrame:frame])) { + _pdfViewController = pdfViewController; + + [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + + Class previewViewClass = PDFViewController::pdfPreviewViewClass(); + ASSERT(previewViewClass); + + _pdfPreviewView.adoptNS([[previewViewClass alloc] initWithFrame:frame]); + [_pdfPreviewView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + [self addSubview:_pdfPreviewView.get()]; + + _pdfView = [_pdfPreviewView.get() performSelector:@selector(pdfView)]; + } + + return self; +} + +- (void)invalidate +{ + _pdfViewController = 0; +} + +- (PDFView *)pdfView +{ + return _pdfView; +} + +- (void)setDocument:(PDFDocument *)pdfDocument +{ + _ignoreScaleAndDisplayModeAndPageNotifications = YES; + [_pdfView setDocument:pdfDocument]; + [self _applyPDFPreferences]; + _ignoreScaleAndDisplayModeAndPageNotifications = NO; +} + +- (void)_applyPDFPreferences +{ + if (!_pdfViewController) + return; + + WebPreferences *preferences = toImpl([_pdfViewController->wkView() pageRef])->pageGroup()->preferences(); + + CGFloat scaleFactor = preferences->pdfScaleFactor(); + if (!scaleFactor) + [_pdfView setAutoScales:YES]; + else { + [_pdfView setAutoScales:NO]; + [_pdfView setScaleFactor:scaleFactor]; + } + [_pdfView setDisplayMode:preferences->pdfDisplayMode()]; +} + +- (void)_updatePreferences:(id)ignored +{ + _willUpdatePreferencesSoon = NO; + + if (!_pdfViewController) + return; + + WebPreferences* preferences = toImpl([_pdfViewController->wkView() pageRef])->pageGroup()->preferences(); + + CGFloat scaleFactor = [_pdfView autoScales] ? 0 : [_pdfView scaleFactor]; + preferences->setPDFScaleFactor(scaleFactor); + preferences->setPDFDisplayMode([_pdfView displayMode]); +} + +- (void)_updatePreferencesSoon +{ + if (_willUpdatePreferencesSoon) + return; + + [self performSelector:@selector(_updatePreferences:) withObject:nil afterDelay:0]; + _willUpdatePreferencesSoon = YES; +} + +- (void)_scaleOrDisplayModeOrPageChanged:(NSNotification *)notification +{ + ASSERT_ARG(notification, [notification object] == _pdfView); + if (!_ignoreScaleAndDisplayModeAndPageNotifications) + [self _updatePreferencesSoon]; +} + +- (void)viewDidMoveToWindow +{ + if (![self window]) + return; + + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewScaleChangedNotification object:_pdfView]; + [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView]; + [notificationCenter addObserver:self selector:@selector(_scaleOrDisplayModeOrPageChanged:) name:_webkit_PDFViewPageChangedNotification object:_pdfView]; +} + +- (void)viewWillMoveToWindow:(NSWindow *)newWindow +{ + if (![self window]) + return; + + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter removeObserver:self name:_webkit_PDFViewScaleChangedNotification object:_pdfView]; + [notificationCenter removeObserver:self name:_webkit_PDFViewDisplayModeChangedNotification object:_pdfView]; + [notificationCenter removeObserver:self name:_webkit_PDFViewPageChangedNotification object:_pdfView]; +} + +@end + +namespace WebKit { + +PassOwnPtr<PDFViewController> PDFViewController::create(WKView *wkView) +{ + return adoptPtr(new PDFViewController(wkView)); +} + +PDFViewController::PDFViewController(WKView *wkView) + : m_wkView(wkView) + , m_wkPDFView(AdoptNS, [[WKPDFView alloc] initWithFrame:[m_wkView bounds] PDFViewController:this]) + , m_pdfView([m_wkPDFView.get() pdfView]) +{ + [m_wkView addSubview:m_wkPDFView.get()]; +} + +PDFViewController::~PDFViewController() +{ + [m_wkPDFView.get() removeFromSuperview]; + [m_wkPDFView.get() invalidate]; + m_wkPDFView = nullptr; +} + +static RetainPtr<CFDataRef> convertPostScriptDataSourceToPDF(const CoreIPC::DataReference& dataReference) +{ + // Convert PostScript to PDF using Quartz 2D API + // http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_ps_convert/chapter_16_section_1.html + + CGPSConverterCallbacks callbacks = { 0, 0, 0, 0, 0, 0, 0, 0 }; + RetainPtr<CGPSConverterRef> converter(AdoptCF, CGPSConverterCreate(0, &callbacks, 0)); + ASSERT(converter); + + RetainPtr<NSData> nsData(AdoptNS, [[NSData alloc] initWithBytesNoCopy:const_cast<uint8_t*>(dataReference.data()) length:dataReference.size() freeWhenDone:NO]); + + RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithCFData((CFDataRef)nsData.get())); + ASSERT(provider); + + RetainPtr<CFMutableDataRef> result(AdoptCF, CFDataCreateMutable(kCFAllocatorDefault, 0)); + ASSERT(result); + + RetainPtr<CGDataConsumerRef> consumer(AdoptCF, CGDataConsumerCreateWithCFData(result.get())); + ASSERT(consumer); + + CGPSConverterConvert(converter.get(), provider.get(), consumer.get(), 0); + + if (!result) + return 0; + + return result; +} + +void PDFViewController::setPDFDocumentData(const String& mimeType, const CoreIPC::DataReference& dataReference) +{ + RetainPtr<CFDataRef> data; + + if (equalIgnoringCase(mimeType, "application/postscript")) { + data = convertPostScriptDataSourceToPDF(dataReference); + if (!data) + return; + } else { + // Make sure to copy the data. + data.adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size())); + } + + RetainPtr<PDFDocument> pdfDocument(AdoptNS, [[pdfDocumentClass() alloc] initWithData:(NSData *)data.get()]); + [m_wkPDFView.get() setDocument:pdfDocument.get()]; +} + +double PDFViewController::zoomFactor() const +{ + return [m_pdfView scaleFactor]; +} + +void PDFViewController::setZoomFactor(double zoomFactor) +{ + [m_pdfView setScaleFactor:zoomFactor]; +} + +Class PDFViewController::pdfDocumentClass() +{ + static Class pdfDocumentClass = [pdfKitBundle() classNamed:@"PDFDocument"]; + + return pdfDocumentClass; +} + +Class PDFViewController::pdfPreviewViewClass() +{ + static Class pdfPreviewViewClass = [pdfKitBundle() classNamed:@"PDFPreviewView"]; + + return pdfPreviewViewClass; +} + +NSBundle* PDFViewController::pdfKitBundle() +{ + static NSBundle *pdfKitBundle; + if (pdfKitBundle) + return pdfKitBundle; + + NSString *pdfKitPath = [_NSPathForSystemFramework(@"Quartz.framework") stringByAppendingString:@"/Frameworks/PDFKit.framework"]; + if (!pdfKitPath) { + LOG_ERROR("Couldn't find PDFKit.framework"); + return nil; + } + + pdfKitBundle = [NSBundle bundleWithPath:pdfKitPath]; + if (![pdfKitBundle load]) + LOG_ERROR("Couldn't load PDFKit.framework"); + return pdfKitBundle; +} + +NSPrintOperation *PDFViewController::makePrintOperation(NSPrintInfo *printInfo) +{ + return [[m_pdfView document] getPrintOperationForPrintInfo:printInfo autoRotate:YES]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h new file mode 100644 index 0000000..8322465 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h @@ -0,0 +1,103 @@ +/* + * 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 PageClientImpl_h +#define PageClientImpl_h + +#include "PageClient.h" +#include <wtf/RetainPtr.h> + +@class WKView; +@class WebEditorUndoTargetObjC; + +namespace WebKit { + +class FindIndicatorWindow; + +// NOTE: This does not use String::operator NSString*() since that function +// expects to be called on the thread running WebCore. +NSString* nsStringFromWebCoreString(const String&); + +class PageClientImpl : public PageClient { +public: + static PassOwnPtr<PageClientImpl> create(WKView*); + virtual ~PageClientImpl(); + +private: + PageClientImpl(WKView*); + + virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); + virtual void setViewNeedsDisplay(const WebCore::IntRect&); + virtual void displayView(); + + virtual WebCore::IntSize viewSize(); + virtual bool isViewWindowActive(); + virtual bool isViewFocused(); + virtual bool isViewVisible(); + virtual bool isViewInWindow(); + + virtual void processDidCrash(); + virtual void didRelaunchProcess(); + virtual void takeFocus(bool direction); + virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip); + virtual void setCursor(const WebCore::Cursor&); + virtual void setViewportArguments(const WebCore::ViewportArguments&); + + virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); + virtual void clearAllEditCommands(); + virtual void setEditCommandState(const String& commandName, bool isEnabled, int state); + virtual void interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines); + + virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); + virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); + + virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&); + + virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); + virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); + + void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut); + +#if USE(ACCELERATED_COMPOSITING) + virtual void pageDidEnterAcceleratedCompositing(); + virtual void pageDidLeaveAcceleratedCompositing(); +#endif + + virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&); + virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled); + + virtual void didCommitLoadForMainFrame(bool useCustomRepresentation); + virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); + + virtual double customRepresentationZoomFactor(); + virtual void setCustomRepresentationZoomFactor(double); + + WKView* m_wkView; + RetainPtr<WebEditorUndoTargetObjC> m_undoTarget; +}; + +} // namespace WebKit + +#endif // PageClientImpl_h diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm new file mode 100644 index 0000000..c37b641 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "NativeWebKeyboardEvent.h" +#import "PageClientImpl.h" + +#import "DataReference.h" +#import "FindIndicator.h" +#import "WKAPICast.h" +#import "WKStringCF.h" +#import "WKViewInternal.h" +#import "WebContextMenuProxyMac.h" +#import "WebEditCommandProxy.h" +#import "WebPopupMenuProxyMac.h" +#import <WebCore/Cursor.h> +#import <WebCore/FloatRect.h> +#import <WebCore/FoundationExtras.h> +#import <WebCore/KeyboardEvent.h> +#import <wtf/PassOwnPtr.h> +#import <wtf/text/CString.h> +#import <wtf/text/WTFString.h> + +using namespace WebCore; + +@interface WebEditCommandObjC : NSObject +{ + RefPtr<WebKit::WebEditCommandProxy> m_command; +} + +- (id)initWithWebEditCommandProxy:(PassRefPtr<WebKit::WebEditCommandProxy>)command; +- (WebKit::WebEditCommandProxy*)command; + +@end + +@implementation WebEditCommandObjC + +- (id)initWithWebEditCommandProxy:(PassRefPtr<WebKit::WebEditCommandProxy>)command +{ + self = [super init]; + if (!self) + return nil; + + m_command = command; + return self; +} + +- (WebKit::WebEditCommandProxy*)command +{ + return m_command.get(); +} + +@end + +@interface WebEditorUndoTargetObjC : NSObject + +- (void)undoEditing:(id)sender; +- (void)redoEditing:(id)sender; + +@end + +@implementation WebEditorUndoTargetObjC + +- (void)undoEditing:(id)sender +{ + ASSERT([sender isKindOfClass:[WebEditCommandObjC class]]); + [sender command]->unapply(); +} + +- (void)redoEditing:(id)sender +{ + ASSERT([sender isKindOfClass:[WebEditCommandObjC class]]); + [sender command]->reapply(); +} + +@end + +namespace WebKit { + +NSString* nsStringFromWebCoreString(const String& string) +{ + return string.impl() ? HardAutorelease(WKStringCopyCFString(0, toAPI(string.impl()))) : @""; +} + +PassOwnPtr<PageClientImpl> PageClientImpl::create(WKView* wkView) +{ + return adoptPtr(new PageClientImpl(wkView)); +} + +PageClientImpl::PageClientImpl(WKView* wkView) + : m_wkView(wkView) + , m_undoTarget(AdoptNS, [[WebEditorUndoTargetObjC alloc] init]) +{ +} + +PageClientImpl::~PageClientImpl() +{ +} + +PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy() +{ + return [m_wkView _createDrawingAreaProxy]; +} + +void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect) +{ + [m_wkView setNeedsDisplayInRect:rect]; +} + +void PageClientImpl::displayView() +{ + [m_wkView displayIfNeeded]; +} + +IntSize PageClientImpl::viewSize() +{ + return IntSize([m_wkView bounds].size); +} + +bool PageClientImpl::isViewWindowActive() +{ + return [[m_wkView window] isKeyWindow]; +} + +bool PageClientImpl::isViewFocused() +{ + return [m_wkView _isFocused]; +} + +bool PageClientImpl::isViewVisible() +{ + if (![m_wkView window]) + return false; + + if ([m_wkView isHiddenOrHasHiddenAncestor]) + return false; + + return true; +} + +bool PageClientImpl::isViewInWindow() +{ + return [m_wkView window]; +} + +void PageClientImpl::processDidCrash() +{ + [m_wkView _processDidCrash]; +} + +void PageClientImpl::didRelaunchProcess() +{ + [m_wkView _didRelaunchProcess]; +} + +void PageClientImpl::takeFocus(bool direction) +{ + [m_wkView _takeFocus:direction]; +} + +void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip) +{ + [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)]; +} + +void PageClientImpl::setCursor(const WebCore::Cursor& cursor) +{ + [m_wkView _setCursor:cursor.platformCursor()]; +} + +void PageClientImpl::setViewportArguments(const WebCore::ViewportArguments&) +{ + +} + +static NSString* nameForEditAction(EditAction editAction) +{ + // FIXME: Use localized strings. + // FIXME: Move this to a platform independent location. + + switch (editAction) { + case EditActionUnspecified: return nil; + case EditActionSetColor: return @"Set Color"; + case EditActionSetBackgroundColor: return @"Set Background Color"; + case EditActionTurnOffKerning: return @"Turn Off Kerning"; + case EditActionTightenKerning: return @"Tighten Kerning"; + case EditActionLoosenKerning: return @"Loosen Kerning"; + case EditActionUseStandardKerning: return @"Use Standard Kerning"; + case EditActionTurnOffLigatures: return @"Turn Off Ligatures"; + case EditActionUseStandardLigatures: return @"Use Standard Ligatures"; + case EditActionUseAllLigatures: return @"Use All Ligatures"; + case EditActionRaiseBaseline: return @"Raise Baseline"; + case EditActionLowerBaseline: return @"Lower Baseline"; + case EditActionSetTraditionalCharacterShape: return @"Set Traditional Character Shape"; + case EditActionSetFont: return @"Set Font"; + case EditActionChangeAttributes: return @"Change Attributes"; + case EditActionAlignLeft: return @"Align Left"; + case EditActionAlignRight: return @"Align Right"; + case EditActionCenter: return @"Center"; + case EditActionJustify: return @"Justify"; + case EditActionSetWritingDirection: return @"Set Writing Direction"; + case EditActionSubscript: return @"Subscript"; + case EditActionSuperscript: return @"Superscript"; + case EditActionUnderline: return @"Underline"; + case EditActionOutline: return @"Outline"; + case EditActionUnscript: return @"Unscript"; + case EditActionDrag: return @"Drag"; + case EditActionCut: return @"Cut"; + case EditActionPaste: return @"Paste"; + case EditActionPasteFont: return @"Paste Font"; + case EditActionPasteRuler: return @"Paste Ruler"; + case EditActionTyping: return @"Typing"; + case EditActionCreateLink: return @"Create Link"; + case EditActionUnlink: return @"Unlink"; + case EditActionInsertList: return @"Insert List"; + case EditActionFormatBlock: return @"Formatting"; + case EditActionIndent: return @"Indent"; + case EditActionOutdent: return @"Outdent"; + } + return nil; +} + +void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo) +{ + RefPtr<WebEditCommandProxy> command = prpCommand; + + RetainPtr<WebEditCommandObjC> commandObjC(AdoptNS, [[WebEditCommandObjC alloc] initWithWebEditCommandProxy:command]); + NSString *actionName = nameForEditAction(command->editAction()); + + NSUndoManager *undoManager = [m_wkView undoManager]; + [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()]; + if (actionName) + [undoManager setActionName:actionName]; +} + +void PageClientImpl::clearAllEditCommands() +{ + [[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()]; +} + +void PageClientImpl::setEditCommandState(const String& commandName, bool isEnabled, int newState) +{ + [m_wkView _setUserInterfaceItemState:nsStringFromWebCoreString(commandName) enabled:isEnabled state:newState]; +} + +void PageClientImpl::interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines) +{ + commandsList = [m_wkView _interceptKeyEvent:event.nativeEvent()]; + [m_wkView _getTextInputState:selectionStart selectionEnd:selectionEnd underlines:underlines]; +} + +FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect) +{ + return [m_wkView _convertToDeviceSpace:rect]; +} + +FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect) +{ + return [m_wkView _convertToUserSpace:rect]; +} + +void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event) +{ + NSEvent* nativeEvent = event.nativeEvent(); + if ([nativeEvent type] == NSKeyDown) { + [m_wkView _setEventBeingResent:nativeEvent]; + [[NSApplication sharedApplication] sendEvent:nativeEvent]; + } +} + +PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page) +{ + return WebPopupMenuProxyMac::create(m_wkView, page); +} + +PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page) +{ + return WebContextMenuProxyMac::create(m_wkView, page); +} + +void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut) +{ + [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut]; +} + +void PageClientImpl::accessibilityChildTokenReceived(const CoreIPC::DataReference& data) +{ + NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; + [m_wkView _setAccessibilityChildToken:remoteToken]; +} + +#if USE(ACCELERATED_COMPOSITING) +void PageClientImpl::pageDidEnterAcceleratedCompositing() +{ + [m_wkView _pageDidEnterAcceleratedCompositing]; +} + +void PageClientImpl::pageDidLeaveAcceleratedCompositing() +{ + [m_wkView _pageDidLeaveAcceleratedCompositing]; +} +#endif // USE(ACCELERATED_COMPOSITING) + +void PageClientImpl::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) +{ + [m_wkView _setComplexTextInputEnabled:complexTextInputEnabled pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; +} + +void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation) +{ + [m_wkView _setPageHasCustomRepresentation:useCustomRepresentation]; +} + +void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference) +{ + [m_wkView _didFinishLoadingDataForCustomRepresentation:dataReference]; +} + +double PageClientImpl::customRepresentationZoomFactor() +{ + return [m_wkView _customRepresentationZoomFactor]; +} + +void PageClientImpl::setCustomRepresentationZoomFactor(double zoomFactor) +{ + [m_wkView _setCustomRepresentationZoomFactor:zoomFactor]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h new file mode 100644 index 0000000..b2ad3b0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009, 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. ``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 + * 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 WKTextInputWindowController_h +#define WKTextInputWindowController_h + +@class WKTextInputPanel; + +@interface WKTextInputWindowController : NSObject { + WKTextInputPanel *_panel; +} + ++ (WKTextInputWindowController *)sharedTextInputWindowController; + +- (NSTextInputContext *)inputContext; +- (BOOL)interpretKeyEvent:(NSEvent *)event string:(NSString **)string; + +- (void)keyboardInputSourceChanged; + +@end + +#endif // WKTextInputWindowController_h diff --git a/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm new file mode 100644 index 0000000..b7dae31 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKTextInputWindowController.mm @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKTextInputWindowController.h" + +#include <WebKitSystemInterface.h> + +@interface WKTextInputPanel : NSPanel { + NSTextView *_inputTextView; +} + +- (NSTextInputContext *)_inputContext; +- (BOOL)_interpretKeyEvent:(NSEvent *)event string:(NSString **)string; + +@end + +#define inputWindowHeight 20 + +@implementation WKTextInputPanel + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [_inputTextView release]; + + [super dealloc]; +} + +- (id)init +{ + self = [super initWithContentRect:NSZeroRect styleMask:WKGetInputPanelWindowStyle() backing:NSBackingStoreBuffered defer:YES]; + if (!self) + return nil; + + // Set the frame size. + NSRect visibleFrame = [[NSScreen mainScreen] visibleFrame]; + NSRect frame = NSMakeRect(visibleFrame.origin.x, visibleFrame.origin.y, visibleFrame.size.width, inputWindowHeight); + + [self setFrame:frame display:NO]; + + _inputTextView = [[NSTextView alloc] initWithFrame:[self.contentView frame]]; + _inputTextView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable | NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin; + + NSScrollView* scrollView = [[NSScrollView alloc] initWithFrame:[self.contentView frame]]; + scrollView.documentView = _inputTextView; + self.contentView = scrollView; + [scrollView release]; + + [self setFloatingPanel:YES]; + + return self; +} + +- (void)_keyboardInputSourceChanged +{ + [_inputTextView setString:@""]; + [self orderOut:nil]; +} + +- (BOOL)_interpretKeyEvent:(NSEvent *)event string:(NSString **)string +{ + BOOL hadMarkedText = [_inputTextView hasMarkedText]; + + *string = nil; + + if (![[_inputTextView inputContext] handleEvent:event]) + return NO; + + if ([_inputTextView hasMarkedText]) { + // Don't show the input method window for dead keys + if ([[event characters] length] > 0) + [self orderFront:nil]; + + return YES; + } + + if (hadMarkedText) { + [self orderOut:nil]; + + NSString *text = [[_inputTextView textStorage] string]; + if ([text length] > 0) + *string = [[text copy] autorelease]; + } + + [_inputTextView setString:@""]; + return hadMarkedText; +} + +- (NSTextInputContext *)_inputContext +{ + return [_inputTextView inputContext]; +} + +@end + +@implementation WKTextInputWindowController + ++ (WKTextInputWindowController *)sharedTextInputWindowController +{ + static WKTextInputWindowController *textInputWindowController; + if (!textInputWindowController) + textInputWindowController = [[WKTextInputWindowController alloc] init]; + + return textInputWindowController; +} + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + + _panel = [[WKTextInputPanel alloc] init]; + + return self; +} + +- (NSTextInputContext *)inputContext +{ + return [_panel _inputContext]; +} + +- (BOOL)interpretKeyEvent:(NSEvent *)event string:(NSString **)string +{ + return [_panel _interpretKeyEvent:event string:string]; +} + +- (void)keyboardInputSourceChanged +{ + [_panel _keyboardInputSourceChanged]; +} + +@end diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.h b/Source/WebKit2/UIProcess/API/mac/WKView.h new file mode 100644 index 0000000..618bbc4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKView.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Cocoa/Cocoa.h> +#import <WebKit2/WKBase.h> + +@class WKViewData; + +WK_EXPORT +@interface WKView : NSView <NSTextInput> { + WKViewData *_data; +} + +- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef; +- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef; + +- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef; +- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef; + +@property(readonly) WKPageRef pageRef; + +@property BOOL drawsBackground; +@property BOOL drawsTransparentBackground; + +@end diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm new file mode 100644 index 0000000..da9b7c9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -0,0 +1,1795 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WKView.h" + +#import "ChunkedUpdateDrawingAreaProxy.h" +#import "DataReference.h" +#import "DrawingAreaProxyImpl.h" +#import "FindIndicator.h" +#import "FindIndicatorWindow.h" +#import "LayerBackedDrawingAreaProxy.h" +#import "Logging.h" +#import "NativeWebKeyboardEvent.h" +#import "PDFViewController.h" +#import "PageClientImpl.h" +#import "PrintInfo.h" +#import "RunLoop.h" +#import "TextChecker.h" +#import "TextCheckerState.h" +#import "WKAPICast.h" +#import "WKStringCF.h" +#import "WKTextInputWindowController.h" +#import "WebContext.h" +#import "WebEventFactory.h" +#import "WebPage.h" +#import "WebPageProxy.h" +#import "WebProcessManager.h" +#import "WebProcessProxy.h" +#import "WebSystemInterface.h" +#import <QuartzCore/QuartzCore.h> +#import <WebCore/ColorMac.h> +#import <WebCore/DragController.h> +#import <WebCore/DragData.h> +#import <WebCore/FloatRect.h> +#import <WebCore/IntRect.h> +#import <WebCore/KeyboardEvent.h> +#import <WebCore/PlatformMouseEvent.h> +#import <WebCore/PlatformScreen.h> +#import <WebKitSystemInterface.h> +#import <wtf/RefPtr.h> +#import <wtf/RetainPtr.h> + +// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized +#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str] + +@interface NSApplication (Details) +- (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; +- (BOOL)_updateGrowBoxForWindowFrameChange; +@end + +extern "C" { + // Need to declare this attribute name because AppKit exports it but does not make it available in API or SPI headers. + // <rdar://problem/8631468> tracks the request to make it available. This code should be removed when the bug is closed. + extern NSString *NSTextInputReplacementRangeAttributeName; +} + +using namespace WebKit; +using namespace WebCore; + +namespace WebKit { + +typedef id <NSValidatedUserInterfaceItem> ValidationItem; +typedef Vector<RetainPtr<ValidationItem> > ValidationVector; +typedef HashMap<String, ValidationVector> ValidationMap; + +} + +@interface WKViewData : NSObject { +@public + OwnPtr<PageClientImpl> _pageClient; + RefPtr<WebPageProxy> _page; + + // For ToolTips. + NSToolTipTag _lastToolTipTag; + id _trackingRectOwner; + void* _trackingRectUserData; + +#if USE(ACCELERATED_COMPOSITING) + NSView *_layerHostingView; +#endif + + RetainPtr<id> _remoteAccessibilityChild; + + // For asynchronous validation. + ValidationMap _validationMap; + + OwnPtr<PDFViewController> _pdfViewController; + + OwnPtr<FindIndicatorWindow> _findIndicatorWindow; + // We keep here the event when resending it to + // the application to distinguish the case of a new event from one + // that has been already sent to WebCore. + NSEvent *_keyDownEventBeingResent; + Vector<KeypressCommand> _commandsList; + + // The identifier of the plug-in we want to send complex text input to, or 0 if there is none. + uint64_t _pluginComplexTextInputIdentifier; + + Vector<CompositionUnderline> _underlines; + unsigned _selectionStart; + unsigned _selectionEnd; + + Vector<IntRect> _printingPageRects; + double _totalScaleFactorForPrinting; + + bool _inBecomeFirstResponder; + bool _inResignFirstResponder; +} +@end + +@implementation WKViewData +@end + +@interface WebFrameWrapper : NSObject { +@public + RefPtr<WebFrameProxy> _frame; +} + +- (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(); +} + +@end + +NSString * const PrintedFrameKey = @"WebKitPrintedFrameKey"; + +@interface NSObject (NSTextInputContextDetails) +- (BOOL)wantsToHandleMouseEvents; +- (BOOL)handleMouseEvent:(NSEvent *)event; +@end + +@implementation WKView + +static bool useNewDrawingArea() +{ + static bool useNewDrawingArea = getenv("USE_NEW_DRAWING_AREA"); + + return useNewDrawingArea; +} + +- (id)initWithFrame:(NSRect)frame +{ + return [self initWithFrame:frame contextRef:toAPI(WebContext::sharedProcessContext())]; +} + +- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef +{ + return [self initWithFrame:frame contextRef:contextRef pageGroupRef:nil]; +} + +static NSString * const WebArchivePboardType = @"Apple Web Archive pasteboard type"; +static NSString * const WebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; +static NSString * const WebURLPboardType = @"public.url"; +static NSString * const WebURLNamePboardType = @"public.url-name"; + +- (void)_registerDraggedTypes +{ + NSArray *editableTypes = [NSArray arrayWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType, +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) + NSPICTPboardType, +#endif + NSURLPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSColorPboardType, kUTTypePNG, nil]; + NSArray *URLTypes = [NSArray arrayWithObjects:WebURLsWithTitlesPboardType, NSURLPboardType, WebURLPboardType, WebURLNamePboardType, NSStringPboardType, NSFilenamesPboardType, nil]; + NSMutableSet *types = [[NSMutableSet alloc] initWithArray:editableTypes]; + [types addObjectsFromArray:URLTypes]; + [self registerForDraggedTypes:[types allObjects]]; + [types release]; +} + +- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef +{ + self = [super initWithFrame:frame]; + if (!self) + return nil; + + InitWebCoreSystemInterface(); + RunLoop::initializeMainRunLoop(); + + NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:frame + options:(NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect) + owner:self + userInfo:nil]; + [self addTrackingArea:trackingArea]; + [trackingArea release]; + + _data = [[WKViewData alloc] init]; + + _data->_pageClient = PageClientImpl::create(self); + _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef)); + _data->_page->initializeWebPage(); + + [self _registerDraggedTypes]; + + 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; +} + +- (void)dealloc +{ + _data->_page->close(); + + [_data release]; + + WebContext::statistics().wkViewCount--; + + [super dealloc]; +} + +- (WKPageRef)pageRef +{ + return toAPI(_data->_page.get()); +} + +- (void)setDrawsBackground:(BOOL)drawsBackground +{ + _data->_page->setDrawsBackground(drawsBackground); +} + +- (BOOL)drawsBackground +{ + return _data->_page->drawsBackground(); +} + +- (void)setDrawsTransparentBackground:(BOOL)drawsTransparentBackground +{ + _data->_page->setDrawsTransparentBackground(drawsTransparentBackground); +} + +- (BOOL)drawsTransparentBackground +{ + return _data->_page->drawsTransparentBackground(); +} + +- (BOOL)acceptsFirstResponder +{ + return YES; +} + +- (BOOL)becomeFirstResponder +{ + NSSelectionDirection direction = [[self window] keyViewSelectionDirection]; + + _data->_inBecomeFirstResponder = true; + _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused); + _data->_inBecomeFirstResponder = false; + + if (direction != NSDirectSelection) + _data->_page->setInitialFocus(direction == NSSelectingNext); + + return YES; +} + +- (BOOL)resignFirstResponder +{ + _data->_inResignFirstResponder = true; + _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused); + _data->_inResignFirstResponder = false; + + return YES; +} + +- (BOOL)isFlipped +{ + return YES; +} + +- (void)setFrameSize:(NSSize)size +{ + [super setFrameSize:size]; + + if (!_data->_page->drawingArea()) + return; + + _data->_page->drawingArea()->setSize(IntSize(size)); +} + +- (void)_updateWindowAndViewFrames +{ + NSWindow *window = [self window]; + ASSERT(window); + + NSRect windowFrameInScreenCoordinates = [window frame]; + NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil]; + NSPoint accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue]; + + _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates), IntPoint(accessibilityPosition)); +} + +- (void)renewGState +{ + // Hide the find indicator. + _data->_findIndicatorWindow = nullptr; + + // Update the view frame. + if ([self window]) + [self _updateWindowAndViewFrames]; + + [super renewGState]; +} + +typedef HashMap<SEL, String> SelectorNameMap; + +// Map selectors into Editor command names. +// This is not needed for any selectors that have the same name as the Editor command. +static const SelectorNameMap* createSelectorExceptionMap() +{ + SelectorNameMap* map = new HashMap<SEL, String>; + + map->add(@selector(insertNewlineIgnoringFieldEditor:), "InsertNewline"); + map->add(@selector(insertParagraphSeparator:), "InsertNewline"); + map->add(@selector(insertTabIgnoringFieldEditor:), "InsertTab"); + map->add(@selector(pageDown:), "MovePageDown"); + map->add(@selector(pageDownAndModifySelection:), "MovePageDownAndModifySelection"); + map->add(@selector(pageUp:), "MovePageUp"); + map->add(@selector(pageUpAndModifySelection:), "MovePageUpAndModifySelection"); + + return map; +} + +static String commandNameForSelector(SEL selector) +{ + // Check the exception map first. + static const SelectorNameMap* exceptionMap = createSelectorExceptionMap(); + SelectorNameMap::const_iterator it = exceptionMap->find(selector); + if (it != exceptionMap->end()) + return it->second; + + // Remove the trailing colon. + // No need to capitalize the command name since Editor command names are + // not case sensitive. + const char* selectorName = sel_getName(selector); + size_t selectorNameLength = strlen(selectorName); + if (selectorNameLength < 2 || selectorName[selectorNameLength - 1] != ':') + return String(); + return String(selectorName, selectorNameLength - 1); +} + +// Editing commands + +#define WEBCORE_COMMAND(command) - (void)command:(id)sender { _data->_page->executeEditCommand(commandNameForSelector(_cmd)); } + +WEBCORE_COMMAND(copy) +WEBCORE_COMMAND(cut) +WEBCORE_COMMAND(paste) +WEBCORE_COMMAND(delete) +WEBCORE_COMMAND(pasteAsPlainText) +WEBCORE_COMMAND(selectAll) +WEBCORE_COMMAND(takeFindStringFromSelection) + +#undef WEBCORE_COMMAND + +// Menu items validation + +static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item) +{ + if (![(NSObject *)item isKindOfClass:[NSMenuItem class]]) + return nil; + return (NSMenuItem *)item; +} + +static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item) +{ + if (![(NSObject *)item isKindOfClass:[NSToolbarItem class]]) + return nil; + return (NSToolbarItem *)item; +} + +- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item +{ + SEL action = [item action]; + + if (action == @selector(showGuessPanel:)) { + if (NSMenuItem *menuItem = ::menuItem(item)) { + BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible]; + [menuItem setTitle:panelShowing + ? UI_STRING("Hide Spelling and Grammar", "menu item title") + : UI_STRING("Show Spelling and Grammar", "menu item title")]; + } + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(checkSpelling:) || action == @selector(changeSpelling:)) + return _data->_page->selectionState().isContentEditable; + + if (action == @selector(toggleContinuousSpellChecking:)) { + bool enabled = TextChecker::isContinuousSpellCheckingAllowed(); + bool checked = enabled && TextChecker::state().isContinuousSpellCheckingEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return enabled; + } + + if (action == @selector(toggleGrammarChecking:)) { + bool checked = TextChecker::state().isGrammarCheckingEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return YES; + } + + if (action == @selector(toggleAutomaticSpellingCorrection:)) { + bool checked = TextChecker::state().isAutomaticSpellingCorrectionEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(orderFrontSubstitutionsPanel:)) { + if (NSMenuItem *menuItem = ::menuItem(item)) { + BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] substitutionsPanel] isVisible]; + [menuItem setTitle:panelShowing + ? UI_STRING("Hide Substitutions", "menu item title") + : UI_STRING("Show Substitutions", "menu item title")]; + } + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(toggleSmartInsertDelete:)) { + bool checked = _data->_page->isSmartInsertDeleteEnabled(); + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(toggleAutomaticQuoteSubstitution:)) { + bool checked = TextChecker::state().isAutomaticQuoteSubstitutionEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(toggleAutomaticDashSubstitution:)) { + bool checked = TextChecker::state().isAutomaticDashSubstitutionEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(toggleAutomaticLinkDetection:)) { + bool checked = TextChecker::state().isAutomaticLinkDetectionEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(toggleAutomaticTextReplacement:)) { + bool checked = TextChecker::state().isAutomaticTextReplacementEnabled; + [menuItem(item) setState:checked ? NSOnState : NSOffState]; + return _data->_page->selectionState().isContentEditable; + } + + if (action == @selector(uppercaseWord:) || action == @selector(lowercaseWord:) || action == @selector(capitalizeWord:)) + return _data->_page->selectionState().selectedRangeLength && _data->_page->selectionState().isContentEditable; + + if (action == @selector(stopSpeaking:)) + return [NSApp isSpeaking]; + + // Next, handle editor commands. Start by returning YES for anything that is not an editor command. + // Returning YES is the default thing to do in an AppKit validate method for any selector that is not recognized. + String commandName = commandNameForSelector([item action]); + if (!Editor::commandIsSupportedFromMenuOrKeyBinding(commandName)) + return YES; + + // Add this item to the vector of items for a given command that are awaiting validation. + pair<ValidationMap::iterator, bool> addResult = _data->_validationMap.add(commandName, ValidationVector()); + addResult.first->second.append(item); + if (addResult.second) { + // If we are not already awaiting validation for this command, start the asynchronous validation process. + // FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time + // we asked for the same command; there is no guarantee the answer is still valid. + // FIXME: The function called here should be renamed validateCommand because it is not specific to menu items. + _data->_page->validateMenuItem(commandName); + } + + // Treat as enabled until we get the result back from the web process and _setUserInterfaceItemState is called. + // FIXME <rdar://problem/8803459>: This means disabled items will flash enabled at first for a moment. + // But returning NO here would be worse; that would make keyboard commands such as command-C fail. + return YES; +} + +static void speakString(WKStringRef string, WKErrorRef error, void*) +{ + if (error) + return; + if (!string) + return; + + NSString *convertedString = toImpl(string)->string(); + [NSApp speakString:convertedString]; +} + +- (IBAction)startSpeaking:(id)sender +{ + _data->_page->getSelectionOrContentsAsString(StringCallback::create(0, speakString)); +} + +- (IBAction)stopSpeaking:(id)sender +{ + [NSApp stopSpeaking:sender]; +} + +- (IBAction)showGuessPanel:(id)sender +{ + NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; + if (!checker) { + LOG_ERROR("No NSSpellChecker"); + return; + } + + NSPanel *spellingPanel = [checker spellingPanel]; + if ([spellingPanel isVisible]) { + [spellingPanel orderOut:sender]; + return; + } + + _data->_page->advanceToNextMisspelling(true); + [spellingPanel orderFront:sender]; +} + +- (IBAction)checkSpelling:(id)sender +{ + _data->_page->advanceToNextMisspelling(false); +} + +- (void)changeSpelling:(id)sender +{ + NSString *word = [[sender selectedCell] stringValue]; + + _data->_page->changeSpellingToWord(word); +} + +- (IBAction)toggleContinuousSpellChecking:(id)sender +{ + bool spellCheckingEnabled = !TextChecker::state().isContinuousSpellCheckingEnabled; + TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled); + + _data->_page->process()->updateTextCheckerState(); + + if (!spellCheckingEnabled) + _data->_page->unmarkAllMisspellings(); +} + +- (IBAction)toggleGrammarChecking:(id)sender +{ + bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled; + TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled); + + _data->_page->process()->updateTextCheckerState(); + + if (!grammarCheckingEnabled) + _data->_page->unmarkAllBadGrammar(); +} + +- (IBAction)toggleAutomaticSpellingCorrection:(id)sender +{ + TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled); + + _data->_page->process()->updateTextCheckerState(); +} + +- (void)orderFrontSubstitutionsPanel:(id)sender +{ + NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; + if (!checker) { + LOG_ERROR("No NSSpellChecker"); + return; + } + + NSPanel *substitutionsPanel = [checker substitutionsPanel]; + if ([substitutionsPanel isVisible]) { + [substitutionsPanel orderOut:sender]; + return; + } + [substitutionsPanel orderFront:sender]; +} + +- (IBAction)toggleSmartInsertDelete:(id)sender +{ + _data->_page->setSmartInsertDeleteEnabled(!_data->_page->isSmartInsertDeleteEnabled()); +} + +- (BOOL)isAutomaticQuoteSubstitutionEnabled +{ + return TextChecker::state().isAutomaticQuoteSubstitutionEnabled; +} + +- (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag +{ + if (static_cast<bool>(flag) == TextChecker::state().isAutomaticQuoteSubstitutionEnabled) + return; + + TextChecker::setAutomaticQuoteSubstitutionEnabled(flag); + _data->_page->process()->updateTextCheckerState(); +} + +- (void)toggleAutomaticQuoteSubstitution:(id)sender +{ + TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled); + _data->_page->process()->updateTextCheckerState(); +} + +- (BOOL)isAutomaticDashSubstitutionEnabled +{ + return TextChecker::state().isAutomaticDashSubstitutionEnabled; +} + +- (void)setAutomaticDashSubstitutionEnabled:(BOOL)flag +{ + if (static_cast<bool>(flag) == TextChecker::state().isAutomaticDashSubstitutionEnabled) + return; + + TextChecker::setAutomaticDashSubstitutionEnabled(flag); + _data->_page->process()->updateTextCheckerState(); +} + +- (void)toggleAutomaticDashSubstitution:(id)sender +{ + TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled); + _data->_page->process()->updateTextCheckerState(); +} + +- (BOOL)isAutomaticLinkDetectionEnabled +{ + return TextChecker::state().isAutomaticLinkDetectionEnabled; +} + +- (void)setAutomaticLinkDetectionEnabled:(BOOL)flag +{ + if (static_cast<bool>(flag) == TextChecker::state().isAutomaticLinkDetectionEnabled) + return; + + TextChecker::setAutomaticLinkDetectionEnabled(flag); + _data->_page->process()->updateTextCheckerState(); +} + +- (void)toggleAutomaticLinkDetection:(id)sender +{ + TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled); + _data->_page->process()->updateTextCheckerState(); +} + +- (BOOL)isAutomaticTextReplacementEnabled +{ + return TextChecker::state().isAutomaticTextReplacementEnabled; +} + +- (void)setAutomaticTextReplacementEnabled:(BOOL)flag +{ + if (static_cast<bool>(flag) == TextChecker::state().isAutomaticTextReplacementEnabled) + return; + + TextChecker::setAutomaticTextReplacementEnabled(flag); + _data->_page->process()->updateTextCheckerState(); +} + +- (void)toggleAutomaticTextReplacement:(id)sender +{ + TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled); + _data->_page->process()->updateTextCheckerState(); +} + +- (void)uppercaseWord:(id)sender +{ + _data->_page->uppercaseWord(); +} + +- (void)lowercaseWord:(id)sender +{ + _data->_page->lowercaseWord(); +} + +- (void)capitalizeWord:(id)sender +{ + _data->_page->capitalizeWord(); +} + +// Events + +// Override this so that AppKit will send us arrow keys as key down events so we can +// support them via the key bindings mechanism. +- (BOOL)_wantsKeyDownForEvent:(NSEvent *)event +{ + return YES; +} + +#define EVENT_HANDLER(Selector, Type) \ + - (void)Selector:(NSEvent *)theEvent \ + { \ + Web##Type##Event webEvent = WebEventFactory::createWeb##Type##Event(theEvent, self); \ + _data->_page->handle##Type##Event(webEvent); \ + } + +EVENT_HANDLER(mouseEntered, Mouse) +EVENT_HANDLER(mouseExited, Mouse) +EVENT_HANDLER(mouseMoved, Mouse) +EVENT_HANDLER(otherMouseDown, Mouse) +EVENT_HANDLER(otherMouseDragged, Mouse) +EVENT_HANDLER(otherMouseMoved, Mouse) +EVENT_HANDLER(otherMouseUp, Mouse) +EVENT_HANDLER(rightMouseDown, Mouse) +EVENT_HANDLER(rightMouseDragged, Mouse) +EVENT_HANDLER(rightMouseMoved, Mouse) +EVENT_HANDLER(rightMouseUp, Mouse) +EVENT_HANDLER(scrollWheel, Wheel) + +#undef EVENT_HANDLER + +#define MOUSE_EVENT_HANDLER(Selector) \ + - (void)Selector:(NSEvent *)theEvent \ + { \ + NSInputManager *currentInputManager = [NSInputManager currentInputManager]; \ + if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:theEvent]) \ + return; \ + WebMouseEvent webEvent = WebEventFactory::createWebMouseEvent(theEvent, self); \ + _data->_page->handleMouseEvent(webEvent); \ + } + +MOUSE_EVENT_HANDLER(mouseDown) +MOUSE_EVENT_HANDLER(mouseDragged) +MOUSE_EVENT_HANDLER(mouseUp) + +#undef MOUSE_EVENT_HANDLER + +- (void)doCommandBySelector:(SEL)selector +{ + if (selector != @selector(noop:)) + _data->_commandsList.append(KeypressCommand(commandNameForSelector(selector))); +} + +- (void)insertText:(id)string +{ + BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; // Otherwise, NSString + + LOG(TextInput, "insertText:\"%@\"", isAttributedString ? [string string] : string); + NSString *text; + bool isFromInputMethod = _data->_page->selectionState().hasComposition; + + if (isAttributedString) { + text = [string string]; + // We deal with the NSTextInputReplacementRangeAttributeName attribute from NSAttributedString here + // simply because it is used by at least one Input Method -- it corresonds to the kEventParamTextInputSendReplaceRange + // event in TSM. This behaviour matches that of -[WebHTMLView setMarkedText:selectedRange:] when it receives an + // NSAttributedString + NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:NULL inRange:NSMakeRange(0, [text length])]; + LOG(TextInput, "ReplacementRange: %@", rangeString); + if (rangeString) + isFromInputMethod = YES; + } else + text = string; + + String eventText = text; + + if (!isFromInputMethod) + _data->_commandsList.append(KeypressCommand("insertText", text)); + else { + eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore + _data->_commandsList.append(KeypressCommand("insertText", eventText)); + } +} + +- (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event +{ + if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) != NSCommandKeyMask) + return NO; + + // Here we special case cmd+b and cmd+i but not cmd+u, for historic reason. + // This should not be changed, since it could break some Mac applications that + // rely on this inherent behavior. + // See https://bugs.webkit.org/show_bug.cgi?id=24943 + + NSString *string = [event characters]; + if ([string caseInsensitiveCompare:@"b"] == NSOrderedSame) { + _data->_page->executeEditCommand("ToggleBold"); + return YES; + } + if ([string caseInsensitiveCompare:@"i"] == NSOrderedSame) { + _data->_page->executeEditCommand("ToggleItalic"); + return YES; + } + + return NO; +} + +- (BOOL)performKeyEquivalent:(NSEvent *)event +{ + // There's a chance that responding to this event will run a nested event loop, and + // fetching a new event might release the old one. Retaining and then autoreleasing + // the current event prevents that from causing a problem inside WebKit or AppKit code. + [[event retain] autorelease]; + + BOOL eventWasSentToWebCore = (_data->_keyDownEventBeingResent == event); + + // Pass key combos through WebCore if there is a key binding available for + // this event. This lets web pages have a crack at intercepting key-modified keypresses. + // But don't do it if we have already handled the event. + // Pressing Esc results in a fake event being sent - don't pass it to WebCore. + if (!eventWasSentToWebCore && event == [NSApp currentEvent] && self == [[self window] firstResponder]) { + [_data->_keyDownEventBeingResent release]; + _data->_keyDownEventBeingResent = nil; + + _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, self)); + return YES; + } + + 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)); +} + +- (void)keyDown:(NSEvent *)theEvent +{ + if (_data->_pluginComplexTextInputIdentifier) { + // Try feeding the keyboard event directly to the plug-in. + NSString *string = nil; + if ([[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:theEvent string:&string]) { + if (string) + _data->_page->sendComplexTextInputToPlugin(_data->_pluginComplexTextInputIdentifier, string); + return; + } + } + + _data->_underlines.clear(); + _data->_selectionStart = 0; + _data->_selectionEnd = 0; + // We could be receiving a key down from AppKit if we have re-sent an event + // that maps to an action that is currently unavailable (for example a copy when + // there is no range selection). + // If this is the case we should ignore the key down. + if (_data->_keyDownEventBeingResent == theEvent) { + [_data->_keyDownEventBeingResent release]; + _data->_keyDownEventBeingResent = nil; + [super keyDown:theEvent]; + return; + } + _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); +} + +- (NSTextInputContext *)inputContext { + if (_data->_pluginComplexTextInputIdentifier) + return [[WKTextInputWindowController sharedTextInputWindowController] inputContext]; + + return [super inputContext]; +} + +- (NSRange)selectedRange +{ + if (_data->_page->selectionState().isNone || !_data->_page->selectionState().isContentEditable) + return NSMakeRange(NSNotFound, 0); + + LOG(TextInput, "selectedRange -> (%u, %u)", _data->_page->selectionState().selectedRangeStart, _data->_page->selectionState().selectedRangeLength); + return NSMakeRange(_data->_page->selectionState().selectedRangeStart, _data->_page->selectionState().selectedRangeLength); +} + +- (BOOL)hasMarkedText +{ + LOG(TextInput, "hasMarkedText -> %u", _data->_page->selectionState().hasComposition); + return _data->_page->selectionState().hasComposition; +} + +- (void)unmarkText +{ + LOG(TextInput, "unmarkText"); + + _data->_commandsList.append(KeypressCommand("unmarkText")); +} + +- (NSArray *)validAttributesForMarkedText +{ + static NSArray *validAttributes; + if (!validAttributes) { + validAttributes = [[NSArray alloc] initWithObjects: + NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, + NSMarkedClauseSegmentAttributeName, NSTextInputReplacementRangeAttributeName, nil]; + // NSText also supports the following attributes, but it's + // hard to tell which are really required for text input to + // work well; I have not seen any input method make use of them yet. + // NSFontAttributeName, NSForegroundColorAttributeName, + // NSBackgroundColorAttributeName, NSLanguageAttributeName. + CFRetain(validAttributes); + } + LOG(TextInput, "validAttributesForMarkedText -> (...)"); + return validAttributes; +} + +static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnderline>& result) +{ + int length = [[string string] length]; + + int i = 0; + while (i < length) { + NSRange range; + NSDictionary *attrs = [string attributesAtIndex:i longestEffectiveRange:&range inRange:NSMakeRange(i, length - i)]; + + if (NSNumber *style = [attrs objectForKey:NSUnderlineStyleAttributeName]) { + Color color = Color::black; + if (NSColor *colorAttr = [attrs objectForKey:NSUnderlineColorAttributeName]) + color = colorFromNSColor([colorAttr colorUsingColorSpaceName:NSDeviceRGBColorSpace]); + result.append(CompositionUnderline(range.location, NSMaxRange(range), color, [style intValue] > 1)); + } + + i = range.location + range.length; + } +} + +- (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange +{ + BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; // Otherwise, NSString + + LOG(TextInput, "setMarkedText:\"%@\" selectedRange:(%u, %u)", isAttributedString ? [string string] : string, newSelRange.location, newSelRange.length); + + NSString *text = string; + + if (isAttributedString) { + text = [string string]; + extractUnderlines(string, _data->_underlines); + } + + _data->_commandsList.append(KeypressCommand("setMarkedText", text)); + _data->_selectionStart = newSelRange.location; + _data->_selectionEnd = NSMaxRange(newSelRange); +} + +- (NSRange)markedRange +{ + uint64_t location; + uint64_t length; + + _data->_page->getMarkedRange(location, length); + LOG(TextInput, "markedRange -> (%u, %u)", location, length); + return NSMakeRange(location, length); +} + +- (NSAttributedString *)attributedSubstringFromRange:(NSRange)nsRange +{ + // This is not implemented for now. Need to figure out how to serialize the attributed string across processes. + LOG(TextInput, "attributedSubstringFromRange"); + return nil; +} + +- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint +{ + NSWindow *window = [self window]; + + if (window) + thePoint = [window convertScreenToBase:thePoint]; + thePoint = [self convertPoint:thePoint fromView:nil]; // the point is relative to the main frame + + uint64_t result = _data->_page->characterIndexForPoint(IntPoint(thePoint)); + LOG(TextInput, "characterIndexForPoint:(%f, %f) -> %u", thePoint.x, thePoint.y, result); + return result; +} + +- (NSRect)firstRectForCharacterRange:(NSRange)theRange +{ + // Just to match NSTextView's behavior. Regression tests cannot detect this; + // to reproduce, use a test application from http://bugs.webkit.org/show_bug.cgi?id=4682 + // (type something; try ranges (1, -1) and (2, -1). + if ((theRange.location + theRange.length < theRange.location) && (theRange.location + theRange.length != 0)) + theRange.length = 0; + + NSRect resultRect = _data->_page->firstRectForCharacterRange(theRange.location, theRange.length); + resultRect = [self convertRect:resultRect toView:nil]; + + NSWindow *window = [self window]; + if (window) + resultRect.origin = [window convertBaseToScreen:resultRect.origin]; + + LOG(TextInput, "firstRectForCharacterRange:(%u, %u) -> (%f, %f, %f, %f)", theRange.location, theRange.length, resultRect.origin.x, resultRect.origin.y, resultRect.size.width, resultRect.size.height); + return resultRect; +} + +- (DragApplicationFlags)applicationFlags:(id <NSDraggingInfo>)draggingInfo +{ + uint32_t flags = 0; + if ([NSApp modalWindow]) + flags = DragApplicationIsModal; + if ([[self window] attachedSheet]) + flags |= DragApplicationHasAttachedSheet; + if ([draggingInfo draggingSource] == self) + flags |= DragApplicationIsSource; + if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) + flags |= DragApplicationIsCopyKeyDown; + return static_cast<DragApplicationFlags>(flags); +} + +- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)draggingInfo +{ + IntPoint client([self convertPoint:[draggingInfo draggingLocation] fromView:nil]); + IntPoint global(globalPoint([draggingInfo draggingLocation], [self window])); + DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]); + + _data->_page->performDragControllerAction(DragControllerActionEntered, &dragData, [[draggingInfo draggingPasteboard] name]); + return NSDragOperationCopy; +} + +- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)draggingInfo +{ + IntPoint client([self convertPoint:[draggingInfo draggingLocation] fromView:nil]); + IntPoint global(globalPoint([draggingInfo draggingLocation], [self window])); + DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]); + _data->_page->performDragControllerAction(DragControllerActionUpdated, &dragData, [[draggingInfo draggingPasteboard] name]); + return _data->_page->dragOperation(); +} + +- (void)draggingExited:(id <NSDraggingInfo>)draggingInfo +{ + IntPoint client([self convertPoint:[draggingInfo draggingLocation] fromView:nil]); + IntPoint global(globalPoint([draggingInfo draggingLocation], [self window])); + DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]); + _data->_page->performDragControllerAction(DragControllerActionExited, &dragData, [[draggingInfo draggingPasteboard] name]); + _data->_page->resetDragOperation(); +} + +- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)draggingInfo +{ + return YES; +} + +- (BOOL)performDragOperation:(id <NSDraggingInfo>)draggingInfo +{ + IntPoint client([self convertPoint:[draggingInfo draggingLocation] fromView:nil]); + IntPoint global(globalPoint([draggingInfo draggingLocation], [self window])); + DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]); + _data->_page->performDragControllerAction(DragControllerActionPerformDrag, &dragData, [[draggingInfo draggingPasteboard] name]); + return YES; +} + +- (void)_updateWindowVisibility +{ + _data->_page->updateWindowIsVisible(![[self window] isMiniaturized]); +} + +- (BOOL)_ownsWindowGrowBox +{ + NSWindow* window = [self window]; + if (!window) + return NO; + + NSView *superview = [self superview]; + if (!superview) + return NO; + + NSRect growBoxRect = [window _growBoxRect]; + if (NSIsEmptyRect(growBoxRect)) + return NO; + + NSRect visibleRect = [self visibleRect]; + if (NSIsEmptyRect(visibleRect)) + return NO; + + NSRect visibleRectInWindowCoords = [self convertRect:visibleRect toView:nil]; + if (!NSIntersectsRect(growBoxRect, visibleRectInWindowCoords)) + return NO; + + return YES; +} + +- (BOOL)_updateGrowBoxForWindowFrameChange +{ + // Temporarily enable the resize indicator to make a the _ownsWindowGrowBox calculation work. + BOOL wasShowingIndicator = [[self window] showsResizeIndicator]; + [[self window] setShowsResizeIndicator:YES]; + + BOOL ownsGrowBox = [self _ownsWindowGrowBox]; + _data->_page->setWindowResizerSize(ownsGrowBox ? enclosingIntRect([[self window] _growBoxRect]).size() : IntSize()); + + // Once WebCore can draw the window resizer, this should read: + // if (wasShowingIndicator) + // [[self window] setShowsResizeIndicator:!ownsGrowBox]; + [[self window] setShowsResizeIndicator:wasShowingIndicator]; + + return ownsGrowBox; +} + +- (void)addWindowObserversForWindow:(NSWindow *)window +{ + if (window) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) + name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) + name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMiniaturize:) + name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:) + name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:) + name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:) + name:NSWindowDidResizeNotification object:window]; + } +} + +- (void)removeWindowObservers +{ + NSWindow *window = [self window]; + if (!window) + return; + + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window]; +} + +- (void)viewWillMoveToWindow:(NSWindow *)window +{ + if (window != [self window]) { + [self removeWindowObservers]; + [self addWindowObserversForWindow:window]; + } +} + +- (void)viewDidMoveToWindow +{ + // We want to make sure to update the active state while hidden, so if the view is about to become visible, we + // update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then + // update the active state. + if ([self window]) { + _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); + _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow); + [self _updateWindowVisibility]; + [self _updateWindowAndViewFrames]; + } else { + _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); + _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow); + } + +} + +- (void)_windowDidBecomeKey:(NSNotification *)notification +{ + NSWindow *keyWindow = [notification object]; + if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) + _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); +} + +- (void)_windowDidResignKey:(NSNotification *)notification +{ + NSWindow *formerKeyWindow = [notification object]; + if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) + _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); +} + +- (void)_windowDidMiniaturize:(NSNotification *)notification +{ + [self _updateWindowVisibility]; +} + +- (void)_windowDidDeminiaturize:(NSNotification *)notification +{ + [self _updateWindowVisibility]; +} + +- (void)_windowFrameDidChange:(NSNotification *)notification +{ + [self _updateWindowAndViewFrames]; +} + +- (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); + if (useNewDrawingArea()) { + if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(_data->_page->drawingArea())) { + CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + drawingArea->paint(context, enclosingIntRect(rect)); + } else if (_data->_page->drawsBackground()) { + [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set]; + NSRectFill(rect); + } + + _data->_page->didDraw(); + return; + } + + if (_data->_page->isValid() && _data->_page->drawingArea()) { + CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + _data->_page->drawingArea()->paint(IntRect(rect), context); + _data->_page->didDraw(); + } else if (_data->_page->drawsBackground()) { + [_data->_page->drawsTransparentBackground() ? [NSColor clearColor] : [NSColor whiteColor] set]; + NSRectFill(rect); + } +} + +- (BOOL)isOpaque +{ + return _data->_page->drawsBackground(); +} + +- (void)viewDidHide +{ + _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); +} + +- (void)viewDidUnhide +{ + _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; +} + +- (id)accessibilityHitTest:(NSPoint)point +{ + return _data->_remoteAccessibilityChild.get(); +} + +- (id)accessibilityAttributeValue:(NSString*)attribute +{ + if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { + if (!_data->_remoteAccessibilityChild) + return nil; + return [NSArray arrayWithObject:_data->_remoteAccessibilityChild.get()]; + } + if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) + return NSAccessibilityGroupRole; + if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) + return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil); + if ([attribute isEqualToString:NSAccessibilityParentAttribute]) + return NSAccessibilityUnignoredAncestor([self superview]); + if ([attribute isEqualToString:NSAccessibilityEnabledAttribute]) + return [NSNumber numberWithBool:YES]; + + return [super accessibilityAttributeValue:attribute]; +} + +- (NSView *)hitTest:(NSPoint)point +{ + NSView *hitView = [super hitTest:point]; +#if USE(ACCELERATED_COMPOSITING) + if (hitView && _data && hitView == _data->_layerHostingView) + hitView = self; +#endif + return hitView; +} + +- (NSInteger)conversationIdentifier +{ + 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]; +} + +- (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]; + + _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; + } + + 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); +} + +// 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 + +@implementation WKView (Internal) + +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy +{ + if (useNewDrawingArea()) + return DrawingAreaProxyImpl::create(_data->_page.get()); + + return ChunkedUpdateDrawingAreaProxy::create(self, _data->_page.get()); +} + +- (BOOL)_isFocused +{ + if (_data->_inBecomeFirstResponder) + return YES; + if (_data->_inResignFirstResponder) + return NO; + return [[self window] firstResponder] == self; +} + +- (void)_processDidCrash +{ + [self setNeedsDisplay:YES]; +} + +- (void)_didRelaunchProcess +{ + [self setNeedsDisplay:YES]; +} + +- (void)_takeFocus:(BOOL)forward +{ + if (forward) + [[self window] selectKeyViewFollowingView:self]; + else + [[self window] selectKeyViewPrecedingView:self]; +} + +- (void)_setCursor:(NSCursor *)cursor +{ + if ([NSCursor currentCursor] == cursor) + return; + [cursor set]; +} + +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState +{ + ValidationVector items = _data->_validationMap.take(commandName); + size_t size = items.size(); + for (size_t i = 0; i < size; ++i) { + ValidationItem item = items[i].get(); + [menuItem(item) setState:newState]; + [menuItem(item) setEnabled:isEnabled]; + [toolbarItem(item) setEnabled:isEnabled]; + // FIXME <rdar://problem/8803392>: If the item is neither a menu nor toolbar item, it will be left enabled. + } +} + +- (NSRect)_convertToDeviceSpace:(NSRect)rect +{ + return toDeviceSpace(rect, [self window]); +} + +- (NSRect)_convertToUserSpace:(NSRect)rect +{ + return toUserSpace(rect, [self window]); +} + +// Any non-zero value will do, but using something recognizable might help us debug some day. +#define TRACKING_RECT_TAG 0xBADFACE + +- (NSTrackingRectTag)addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside +{ + ASSERT(_data->_trackingRectOwner == nil); + _data->_trackingRectOwner = owner; + _data->_trackingRectUserData = data; + return TRACKING_RECT_TAG; +} + +- (NSTrackingRectTag)_addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside useTrackingNum:(int)tag +{ + ASSERT(tag == 0 || tag == TRACKING_RECT_TAG); + ASSERT(_data->_trackingRectOwner == nil); + _data->_trackingRectOwner = owner; + _data->_trackingRectUserData = data; + return TRACKING_RECT_TAG; +} + +- (void)_addTrackingRects:(NSRect *)rects owner:(id)owner userDataList:(void **)userDataList assumeInsideList:(BOOL *)assumeInsideList trackingNums:(NSTrackingRectTag *)trackingNums count:(int)count +{ + ASSERT(count == 1); + ASSERT(trackingNums[0] == 0 || trackingNums[0] == TRACKING_RECT_TAG); + ASSERT(_data->_trackingRectOwner == nil); + _data->_trackingRectOwner = owner; + _data->_trackingRectUserData = userDataList[0]; + trackingNums[0] = TRACKING_RECT_TAG; +} + +- (void)removeTrackingRect:(NSTrackingRectTag)tag +{ + if (tag == 0) + return; + + if (_data && (tag == TRACKING_RECT_TAG)) { + _data->_trackingRectOwner = nil; + return; + } + + if (_data && (tag == _data->_lastToolTipTag)) { + [super removeTrackingRect:tag]; + _data->_lastToolTipTag = 0; + return; + } + + // If any other tracking rect is being removed, we don't know how it was created + // and it's possible there's a leak involved (see 3500217) + ASSERT_NOT_REACHED(); +} + +- (void)_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count +{ + int i; + for (i = 0; i < count; ++i) { + int tag = tags[i]; + if (tag == 0) + continue; + ASSERT(tag == TRACKING_RECT_TAG); + if (_data != nil) { + _data->_trackingRectOwner = nil; + } + } +} + +- (void)_sendToolTipMouseExited +{ + // Nothing matters except window, trackingNumber, and userData. + NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited + location:NSMakePoint(0, 0) + modifierFlags:0 + timestamp:0 + windowNumber:[[self window] windowNumber] + context:NULL + eventNumber:0 + trackingNumber:TRACKING_RECT_TAG + userData:_data->_trackingRectUserData]; + [_data->_trackingRectOwner mouseExited:fakeEvent]; +} + +- (void)_sendToolTipMouseEntered +{ + // Nothing matters except window, trackingNumber, and userData. + NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered + location:NSMakePoint(0, 0) + modifierFlags:0 + timestamp:0 + windowNumber:[[self window] windowNumber] + context:NULL + eventNumber:0 + trackingNumber:TRACKING_RECT_TAG + userData:_data->_trackingRectUserData]; + [_data->_trackingRectOwner mouseEntered:fakeEvent]; +} + +- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data +{ + return nsStringFromWebCoreString(_data->_page->toolTip()); +} + +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip +{ + if (oldToolTip) + [self _sendToolTipMouseExited]; + + if (newToolTip && [newToolTip length] > 0) { + // See radar 3500217 for why we remove all tooltips rather than just the single one we created. + [self removeAllToolTips]; + NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000); + _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL]; + [self _sendToolTipMouseEntered]; + } +} + +- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut +{ + if (!findIndicator) { + _data->_findIndicatorWindow = 0; + return; + } + + if (!_data->_findIndicatorWindow) + _data->_findIndicatorWindow = FindIndicatorWindow::create(self); + + _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut); +} + +#if USE(ACCELERATED_COMPOSITING) +- (void)_startAcceleratedCompositing:(CALayer *)rootLayer +{ + if (!_data->_layerHostingView) { + NSView *hostingView = [[NSView alloc] initWithFrame:[self bounds]]; +#if !defined(BUILDING_ON_LEOPARD) + [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; +#endif + + [self addSubview:hostingView]; + [hostingView release]; + _data->_layerHostingView = hostingView; + } + + // Make a container layer, which will get sized/positioned by AppKit and CA. + CALayer *viewLayer = [CALayer layer]; + +#ifndef NDEBUG + [viewLayer setName:@"hosting layer"]; +#endif + +#if defined(BUILDING_ON_LEOPARD) + // Turn off default animations. + NSNull *nullValue = [NSNull null]; + NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: + nullValue, @"anchorPoint", + nullValue, @"bounds", + nullValue, @"contents", + nullValue, @"contentsRect", + nullValue, @"opacity", + nullValue, @"position", + nullValue, @"sublayerTransform", + nullValue, @"sublayers", + nullValue, @"transform", + nil]; + [viewLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]]; +#endif + +#if !defined(BUILDING_ON_LEOPARD) + // If we aren't in the window yet, we'll use the screen's scale factor now, and reset the scale + // via -viewDidMoveToWindow. + CGFloat scaleFactor = [self window] ? [[self window] userSpaceScaleFactor] : [[NSScreen mainScreen] userSpaceScaleFactor]; + [viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; +#endif + + [_data->_layerHostingView setLayer:viewLayer]; + [_data->_layerHostingView setWantsLayer:YES]; + + // Parent our root layer in the container layer + [viewLayer addSublayer:rootLayer]; +} + +- (void)_stopAcceleratedCompositing +{ + if (_data->_layerHostingView) { + [_data->_layerHostingView setLayer:nil]; + [_data->_layerHostingView setWantsLayer:NO]; + [_data->_layerHostingView removeFromSuperview]; + _data->_layerHostingView = nil; + } +} + +- (void)_switchToDrawingAreaTypeIfNecessary:(DrawingAreaInfo::Type)type +{ + DrawingAreaInfo::Type existingDrawingAreaType = _data->_page->drawingArea() ? _data->_page->drawingArea()->info().type : DrawingAreaInfo::None; + if (existingDrawingAreaType == type) + return; + + OwnPtr<DrawingAreaProxy> newDrawingArea; + switch (type) { + case DrawingAreaInfo::Impl: + case DrawingAreaInfo::None: + break; + case DrawingAreaInfo::ChunkedUpdate: { + newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(self, _data->_page.get()); + break; + } + case DrawingAreaInfo::LayerBacked: { + newDrawingArea = LayerBackedDrawingAreaProxy::create(self, _data->_page.get()); + break; + } + } + + newDrawingArea->setSize(IntSize([self frame].size)); + + _data->_page->drawingArea()->detachCompositingContext(); + _data->_page->setDrawingArea(newDrawingArea.release()); +} + +- (void)_pageDidEnterAcceleratedCompositing +{ + [self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::LayerBacked]; +} + +- (void)_pageDidLeaveAcceleratedCompositing +{ + // FIXME: we may want to avoid flipping back to the non-layer-backed drawing area until the next page load, to avoid thrashing. + [self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::ChunkedUpdate]; +} +#endif // USE(ACCELERATED_COMPOSITING) + +- (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier +{ + BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier; + + if (complexTextInputEnabled) { + // Check if we're already allowing text input for this plug-in. + if (pluginComplexTextInputIdentifier == _data->_pluginComplexTextInputIdentifier) + return; + + _data->_pluginComplexTextInputIdentifier = pluginComplexTextInputIdentifier; + + } else { + // Check if we got a request to disable complex text input for a plug-in that is not the current plug-in. + if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) + return; + + _data->_pluginComplexTextInputIdentifier = 0; + } + + if (inputSourceChanged) { + // Inform the out of line window that the input source changed. + [[WKTextInputWindowController sharedTextInputWindowController] keyboardInputSourceChanged]; + } +} + +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation +{ + _data->_pdfViewController = nullptr; + + if (pageHasCustomRepresentation) + _data->_pdfViewController = PDFViewController::create(self); +} + +- (void)_didFinishLoadingDataForCustomRepresentation:(const CoreIPC::DataReference&)dataReference +{ + ASSERT(_data->_pdfViewController); + + _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), dataReference); +} + +- (double)_customRepresentationZoomFactor +{ + if (!_data->_pdfViewController) + return 1; + + return _data->_pdfViewController->zoomFactor(); +} + +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor +{ + if (!_data->_pdfViewController) + return; + + _data->_pdfViewController->setZoomFactor(zoomFactor); +} + +@end diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h new file mode 100644 index 0000000..1c70b38 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WKView.h" +#import <WebCore/Editor.h> +#import <WebCore/KeyboardEvent.h> + +namespace WebKit { + class DrawingAreaProxy; + class FindIndicator; +} + +@interface WKView (Internal) +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; +- (BOOL)_isFocused; +- (void)_processDidCrash; +- (void)_didRelaunchProcess; +- (void)_takeFocus:(BOOL)direction; +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; +- (void)_setCursor:(NSCursor *)cursor; +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState; +- (Vector<WebCore::KeypressCommand>&)_interceptKeyEvent:(NSEvent *)theEvent; +- (void)_getTextInputState:(unsigned)start selectionEnd:(unsigned)end underlines:(Vector<WebCore::CompositionUnderline>&)lines; +- (void)_setEventBeingResent:(NSEvent *)event; +- (NSRect)_convertToDeviceSpace:(NSRect)rect; +- (NSRect)_convertToUserSpace:(NSRect)rect; +- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut; + +#if USE(ACCELERATED_COMPOSITING) +- (void)_startAcceleratedCompositing:(CALayer *)rootLayer; +- (void)_stopAcceleratedCompositing; +- (void)_pageDidEnterAcceleratedCompositing; +- (void)_pageDidLeaveAcceleratedCompositing; +#endif + +- (void)_setAccessibilityChildToken:(NSData *)data; +- (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; + +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; +- (void)_didFinishLoadingDataForCustomRepresentation:(const CoreIPC::DataReference&)dataReference; +- (double)_customRepresentationZoomFactor; +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor; + +@end diff --git a/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp new file mode 100644 index 0000000..642e529 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp @@ -0,0 +1,169 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "ClientImpl.h" + +#include "WebFrameProxy.h" +#include "WKAPICast.h" +#include "WKStringQt.h" +#include "WKURLQt.h" +#include <qwkpage.h> +#include <qwkpage_p.h> +#include <WKFrame.h> +#include <WKType.h> + +using namespace WebKit; + +static QWKPage* toQWKPage(const void* clientInfo) +{ + if (clientInfo) + return reinterpret_cast<QWKPage*>(const_cast<void*>(clientInfo)); + return 0; +} + +static void loadFinished(WKFrameRef frame, const void* clientInfo, bool ok) +{ + if (!WKFrameIsMainFrame(frame)) + return; + emit toQWKPage(clientInfo)->loadFinished(ok); + QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions(); +} + +void qt_wk_didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + emit toQWKPage(clientInfo)->loadStarted(); + QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions(); +} + +void qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ +} + +void qt_wk_didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) +{ + loadFinished(frame, clientInfo, false); +} + +void qt_wk_didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + WebFrameProxy* wkframe = toImpl(frame); + QString urlStr(wkframe->url()); + QUrl qUrl = urlStr; + emit toQWKPage(clientInfo)->urlChanged(qUrl); + QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions(); +} + +void qt_wk_didFinishDocumentLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + // FIXME: Implement (bug #44934) +} + +void qt_wk_didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + loadFinished(frame, clientInfo, true); +} + +void qt_wk_didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) +{ + loadFinished(frame, clientInfo, false); +} + +void qt_wk_didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + QString qTitle = WKStringCopyQString(title); + emit toQWKPage(clientInfo)->titleChanged(qTitle); +} + +void qt_wk_didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + emit toQWKPage(clientInfo)->initialLayoutCompleted(); +} + +void qt_wk_didRemoveFrameFromHierarchy(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + // FIXME: Implement (bug #46432) +} + +void qt_wk_didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) +{ + if (!WKFrameIsMainFrame(frame)) + return; + // FIXME: emit toWKView(clientInfo)->initialLayoutCompleted(); +} + +void qt_wk_didStartProgress(WKPageRef page, const void* clientInfo) +{ + emit toQWKPage(clientInfo)->loadProgress(0); +} + +void qt_wk_didChangeProgress(WKPageRef page, const void* clientInfo) +{ + emit toQWKPage(clientInfo)->loadProgress(WKPageGetEstimatedProgress(page) * 100); +} + +void qt_wk_didFinishProgress(WKPageRef page, const void* clientInfo) +{ + emit toQWKPage(clientInfo)->loadProgress(100); +} + +void qt_wk_didBecomeUnresponsive(WKPageRef page, const void* clientInfo) +{ +} + +void qt_wk_didBecomeResponsive(WKPageRef page, const void* clientInfo) +{ +} + +WKPageRef qt_wk_createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo) +{ + QWKPage* wkPage = toQWKPage(clientInfo); + QWKPagePrivate* d = QWKPagePrivate::get(wkPage); + QWKPage::CreateNewPageFn createNewPageFn = d->createNewPageFn; + + if (!createNewPageFn) + return 0; + + if (QWKPage* newPage = createNewPageFn(wkPage)) { + WKRetain(newPage->pageRef()); + return newPage->pageRef(); + } + + return 0; +} + +void qt_wk_showPage(WKPageRef page, const void* clientInfo) +{ +} + +void qt_wk_close(WKPageRef page, const void* clientInfo) +{ + emit toQWKPage(clientInfo)->windowCloseRequested(); +} + +void qt_wk_runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) +{ +} diff --git a/Source/WebKit2/UIProcess/API/qt/ClientImpl.h b/Source/WebKit2/UIProcess/API/qt/ClientImpl.h new file mode 100644 index 0000000..5d8c062 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/ClientImpl.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef DefaultClientCallbacksQt_h +#define DefaultClientCallbacksQt_h + +#include <WebKit2/WKPage.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// loader client +void qt_wk_didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef, const void* clientInfo); +void qt_wk_didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFinishDocumentLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef, const void* clientInfo); +void qt_wk_didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFirstLayoutForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didRemoveFrameFromHierarchy(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo); +void qt_wk_didStartProgress(WKPageRef, const void* clientInfo); +void qt_wk_didChangeProgress(WKPageRef, const void* clientInfo); +void qt_wk_didFinishProgress(WKPageRef, const void* clientInfo); +void qt_wk_didBecomeUnresponsive(WKPageRef, const void* clientInfo); +void qt_wk_didBecomeResponsive(WKPageRef, const void* clientInfo); + +// ui client +WKPageRef qt_wk_createNewPage(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); +void qt_wk_showPage(WKPageRef page, const void *clientInfo); +void qt_wk_close(WKPageRef page, const void *clientInfo); +void qt_wk_runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo); + +#ifdef __cplusplus +} +#endif + +#endif /* DefaultClientCallbacksQt_h */ + diff --git a/Source/WebKit2/UIProcess/API/qt/WKView.h b/Source/WebKit2/UIProcess/API/qt/WKView.h new file mode 100644 index 0000000..5bb95e8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/WKView.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WKView_h +#define WKView_h + +#include <WebKit2/qgraphicswkview.h> +#include <WebKit2/qwkcontext.h> +#include <WebKit2/qwkpage.h> +#include <WebKit2/qwkpreferences.h> + +#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp new file mode 100644 index 0000000..f01c5b2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp @@ -0,0 +1,442 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "qgraphicswkview.h" + +#include "ChunkedUpdateDrawingAreaProxy.h" +#include "IntSize.h" +#include "RunLoop.h" +#include "TiledDrawingAreaProxy.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "qwkpage.h" +#include "qwkpage_p.h" +#include <QApplication> +#include <QCursor> +#include <QGraphicsSceneMouseEvent> +#include <QGraphicsView> +#include <QMenu> +#include <QPainter> +#include <QScrollBar> +#include <QStyleOptionGraphicsItem> +#include <QUrl> +#include <QtDebug> +#include <WebKit2/WKRetainPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; +using namespace WebCore; + +struct QGraphicsWKViewPrivate { + QGraphicsWKViewPrivate(QGraphicsWKView* view); + WKPageRef pageRef() const { return page->pageRef(); } + + void onScaleChanged(); + void commitScale(); + + QGraphicsWKView* q; + QWKPage* page; + QMenu* activeMenu; + RunLoop::Timer<QGraphicsWKViewPrivate> m_scaleCommitTimer; + bool m_isChangingScale; +}; + +QGraphicsWKView::QGraphicsWKView(QWKContext* context, BackingStoreType backingStoreType, QGraphicsItem* parent) + : QGraphicsWidget(parent) + , d(new QGraphicsWKViewPrivate(this)) +{ + setFocusPolicy(Qt::StrongFocus); + setAcceptHoverEvents(true); + + PassOwnPtr<DrawingAreaProxy> drawingAreaProxy; + + d->page = new QWKPage(context); + + switch (backingStoreType) { +#if ENABLE(TILED_BACKING_STORE) + case Tiled: + drawingAreaProxy = TiledDrawingAreaProxy::create(this, toImpl(page()->pageRef())); + connect(this, SIGNAL(scaleChanged()), this, SLOT(onScaleChanged())); + break; +#endif + case Simple: + default: + drawingAreaProxy = ChunkedUpdateDrawingAreaProxy::create(this, toImpl(page()->pageRef())); + break; + } + + d->page->d->init(this, drawingAreaProxy); + connect(d->page, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page, SIGNAL(loadStarted()), this, SIGNAL(loadStarted())); + connect(d->page, SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool))); + connect(d->page, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); + connect(d->page, SIGNAL(initialLayoutCompleted()), this, SIGNAL(initialLayoutCompleted())); + connect(d->page, SIGNAL(urlChanged(const QUrl&)), this, SIGNAL(urlChanged(const QUrl&))); + connect(d->page, SIGNAL(cursorChanged(const QCursor&)), this, SLOT(updateCursor(const QCursor&))); + connect(d->page, SIGNAL(focusNextPrevChild(bool)), this, SLOT(focusNextPrevChildCallback(bool))); + connect(d->page, SIGNAL(showContextMenu(QMenu*)), this, SLOT(showContextMenu(QMenu*))); +} + +QGraphicsWKView::~QGraphicsWKView() +{ + delete d->page; + delete d; +} + +QWKPage* QGraphicsWKView::page() const +{ + return d->page; +} + +void QGraphicsWKView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) +{ + page()->d->paint(painter, option->exposedRect.toAlignedRect()); +} + +void QGraphicsWKView::setGeometry(const QRectF& rect) +{ + QSizeF oldSize = geometry().size(); + QGraphicsWidget::setGeometry(rect); + if (geometry().size() == oldSize) + return; + + // NOTE: call geometry() as setGeometry ensures that + // the geometry is within legal bounds (minimumSize, maximumSize) + page()->setViewportSize(geometry().size().toSize()); +} + +void QGraphicsWKView::load(const QUrl& url) +{ + page()->load(url); +} + +void QGraphicsWKView::setUrl(const QUrl& url) +{ + page()->setUrl(url); +} + +QUrl QGraphicsWKView::url() const +{ + return page()->url(); +} + +QString QGraphicsWKView::title() const +{ + return page()->title(); +} + +void QGraphicsWKView::triggerPageAction(QWKPage::WebAction action, bool checked) +{ + page()->triggerAction(action, checked); +} + +void QGraphicsWKView::back() +{ + page()->triggerAction(QWKPage::Back); +} + +void QGraphicsWKView::forward() +{ + page()->triggerAction(QWKPage::Forward); +} + +void QGraphicsWKView::reload() +{ + page()->triggerAction(QWKPage::Reload); +} + +void QGraphicsWKView::stop() +{ + page()->triggerAction(QWKPage::Stop); +} + +void QGraphicsWKView::updateCursor(const QCursor& cursor) +{ + setCursor(cursor); +} + +class FriendlyWidget : public QWidget +{ +public: + bool focusNextPrevChild(bool next); +}; + +void QGraphicsWKView::focusNextPrevChildCallback(bool next) +{ + if (hasFocus()) { + // find the view which has the focus: + QList<QGraphicsView*> views = scene()->views(); + const int viewCount = views.count(); + QGraphicsView* focusedView = 0; + for (int i = 0; i < viewCount; ++i) { + if (views[i]->hasFocus()) { + focusedView = views[i]; + break; + } + } + + if (focusedView) { + QWidget* window = focusedView->window(); + FriendlyWidget* friendlyWindow = static_cast<FriendlyWidget*>(window); + friendlyWindow->focusNextPrevChild(next); + } + } +} + +/*! \reimp +*/ +bool QGraphicsWKView::focusNextPrevChild(bool next) +{ + QKeyEvent ev(QEvent::KeyPress, Qt::Key_Tab, Qt::KeyboardModifiers(next ? Qt::NoModifier : Qt::ShiftModifier)); + page()->d->keyPressEvent(&ev); + return true; +} + +/*! \reimp +*/ +QVariant QGraphicsWKView::itemChange(GraphicsItemChange change, const QVariant& value) +{ + // Here so that it can be reimplemented without breaking ABI. + return QGraphicsWidget::itemChange(change, value); +} + +/*! \reimp +*/ +bool QGraphicsWKView::event(QEvent* event) +{ + QEvent::Type eventType = event->type(); + switch (eventType) { + case QEvent::TouchBegin: + case QEvent::TouchEnd: + case QEvent::TouchUpdate: + touchEvent(static_cast<QTouchEvent*>(event)); + return true; + case QEvent::Show: + page()->d->page->drawingArea()->setPageIsVisible(true); + break; + case QEvent::Hide: + page()->d->page->drawingArea()->setPageIsVisible(false); + break; + default: + break; + } + + // Here so that it can be reimplemented without breaking ABI. + return QGraphicsWidget::event(event); +} + +/*! \reimp +*/ +QSizeF QGraphicsWKView::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const +{ + if (which == Qt::PreferredSize) + return QSizeF(800, 600); + return QGraphicsWidget::sizeHint(which, constraint); +} + +/*! \reimp +*/ +QVariant QGraphicsWKView::inputMethodQuery(Qt::InputMethodQuery query) const +{ + // implement + return QVariant(); +} + +/*! \reimp +*/ +void QGraphicsWKView::keyPressEvent(QKeyEvent* ev) +{ + page()->d->keyPressEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWKView::keyReleaseEvent(QKeyEvent* ev) +{ + page()->d->keyReleaseEvent(ev); +} + +void QGraphicsWKView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) +{ + QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMouseMove); + me.setPos(ev->pos()); + me.setScreenPos(ev->screenPos()); + + page()->d->mouseMoveEvent(&me); + + if (!ev->isAccepted()) + QGraphicsItem::hoverMoveEvent(ev); +} + +void QGraphicsWKView::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) +{ + page()->d->mouseMoveEvent(ev); + if (!ev->isAccepted()) + QGraphicsItem::mouseMoveEvent(ev); +} + +void QGraphicsWKView::mousePressEvent(QGraphicsSceneMouseEvent* ev) +{ + page()->d->mousePressEvent(ev); + if (!ev->isAccepted()) + QGraphicsItem::mousePressEvent(ev); +} + +void QGraphicsWKView::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) +{ + page()->d->mouseReleaseEvent(ev); + if (!ev->isAccepted()) + QGraphicsItem::mouseReleaseEvent(ev); +} + +void QGraphicsWKView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) +{ + page()->d->mouseDoubleClickEvent(ev); + if (!ev->isAccepted()) + QGraphicsItem::mouseReleaseEvent(ev); +} + +void QGraphicsWKView::wheelEvent(QGraphicsSceneWheelEvent* ev) +{ + page()->d->wheelEvent(ev); + if (!ev->isAccepted()) + QGraphicsItem::wheelEvent(ev); +} + +void QGraphicsWKView::touchEvent(QTouchEvent* ev) +{ + page()->d->touchEvent(ev); +} + +void QGraphicsWKView::focusInEvent(QFocusEvent*) +{ + page()->d->page->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); +} + +void QGraphicsWKView::focusOutEvent(QFocusEvent*) +{ + page()->d->page->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); +} + +void QGraphicsWKView::showContextMenu(QMenu* menu) +{ + // Remove the active menu in case this function is called twice. + if (d->activeMenu) + d->activeMenu->hide(); + + d->activeMenu = menu; + + QWidget* view = 0; + if (QGraphicsScene* myScene = scene()) { + const QList<QGraphicsView*> views = myScene->views(); + for (unsigned i = 0; i < views.size(); ++i) { + if (views.at(i) == QApplication::focusWidget()) { + view = views.at(i); + break; + } + } + if (!view) + view = views.value(0, 0); + } + if (view) + menu->setParent(view, menu->windowFlags()); + menu->exec(view->mapToGlobal(menu->pos())); + if (d->activeMenu == menu) + d->activeMenu = 0; +} + +void QGraphicsWKView::takeSnapshot(const QSize& size, const QRect& contentsRect) +{ +#if ENABLE(TILED_BACKING_STORE) + DrawingAreaProxy* drawingArea = page()->d->page->drawingArea(); + if (drawingArea->info().type != DrawingAreaInfo::Tiled) + return; + TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(drawingArea); + tiledDrawingArea->takeSnapshot(size, contentsRect); +#endif +} + +QGraphicsWKViewPrivate::QGraphicsWKViewPrivate(QGraphicsWKView* view) + : q(view) + , activeMenu(0) + , m_scaleCommitTimer(RunLoop::current(), this, &QGraphicsWKViewPrivate::commitScale) + , m_isChangingScale(false) +{ +} + +QRectF QGraphicsWKView::visibleRect() const +{ + if (!scene()) + return QRectF(); + + QList<QGraphicsView*> views = scene()->views(); + if (views.isEmpty()) + return QRectF(); + + QGraphicsView* graphicsView = views.at(0); + int xOffset = graphicsView->horizontalScrollBar()->value(); + int yOffset = graphicsView->verticalScrollBar()->value(); + return mapRectFromScene(QRectF(QPointF(xOffset, yOffset), graphicsView->viewport()->size())); +} + +void QGraphicsWKView::prepareScaleChange() +{ +#if ENABLE(TILED_BACKING_STORE) + ASSERT(!d->m_isChangingScale); + d->m_isChangingScale = true; + d->m_scaleCommitTimer.stop(); +#endif +} + +void QGraphicsWKView::commitScaleChange() +{ +#if ENABLE(TILED_BACKING_STORE) + ASSERT(d->m_isChangingScale); + d->m_isChangingScale = false; + d->commitScale(); +#endif +} + +void QGraphicsWKViewPrivate::onScaleChanged() +{ +#if ENABLE(TILED_BACKING_STORE) + if (!m_isChangingScale) + m_scaleCommitTimer.startOneShot(0.1); +#endif +} + +void QGraphicsWKViewPrivate::commitScale() +{ +#if ENABLE(TILED_BACKING_STORE) + DrawingAreaProxy* drawingArea = page->d->page->drawingArea(); + float newScale = q->scale(); + if (drawingArea->info().type == DrawingAreaInfo::Tiled) { + TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(drawingArea); + if (tiledDrawingArea->contentsScale() == newScale) + return; + tiledDrawingArea->setContentsScale(newScale); + // For now we block until complete. + tiledDrawingArea->waitUntilUpdatesComplete(); + } +#endif +} + +#include "moc_qgraphicswkview.cpp" diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h new file mode 100644 index 0000000..caf8e0d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h @@ -0,0 +1,102 @@ +#ifndef qgraphicswkview_h +#define qgraphicswkview_h + +#include "qwebkitglobal.h" + +#include <WebKit2/WKBase.h> +#include <QGraphicsWidget> +#include "qwkpage.h" + +QT_BEGIN_NAMESPACE +class QCursor; +QT_END_NAMESPACE + +class QWKContext; +class QGraphicsWKViewPrivate; + +WKStringRef WKStringCreateWithQString(const QString& qString); +QString WKStringCopyQString(WKStringRef stringRef); + +class QWEBKIT_EXPORT QGraphicsWKView : public QGraphicsWidget { + Q_OBJECT + Q_PROPERTY(QString title READ title) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + +public: + enum BackingStoreType { Simple, Tiled }; + QGraphicsWKView(QWKContext* context, BackingStoreType backingStoreType = Simple, QGraphicsItem* parent = 0); + + virtual ~QGraphicsWKView(); + + QWKPage* page() const; + + virtual void setGeometry(const QRectF&); + + void load(const QUrl&); + void setUrl(const QUrl&); + QUrl url() const; + + QString title() const; + + void triggerPageAction(QWKPage::WebAction action, bool checked = false); + + virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + virtual QVariant itemChange(GraphicsItemChange, const QVariant&); + virtual bool event(QEvent*); + virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF&) const; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + + void takeSnapshot(const QSize& size, const QRect& documentRect); + + // FIXME: should not be public + virtual QRectF visibleRect() const; + + void prepareScaleChange(); + void commitScaleChange(); + +public: + Q_SIGNAL void titleChanged(const QString& title); + Q_SIGNAL void loadStarted(); + Q_SIGNAL void loadFinished(bool ok); + Q_SIGNAL void loadProgress(int progress); + Q_SIGNAL void initialLayoutCompleted(); + Q_SIGNAL void urlChanged(const QUrl&); + Q_SIGNAL void snapshotTaken(const QImage&); + +public Q_SLOTS: + void back(); + void forward(); + void reload(); + void stop(); + +protected: + virtual void keyPressEvent(QKeyEvent*); + virtual void keyReleaseEvent(QKeyEvent*); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*); + virtual void mousePressEvent(QGraphicsSceneMouseEvent*); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); + virtual void wheelEvent(QGraphicsSceneWheelEvent*); + virtual void touchEvent(QTouchEvent*); + + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*); + + Q_SLOT void updateCursor(const QCursor&); + Q_SLOT void focusNextPrevChildCallback(bool next); + + virtual bool focusNextPrevChild(bool next); + virtual void focusInEvent(QFocusEvent*); + virtual void focusOutEvent(QFocusEvent*); + +private Q_SLOTS: + void showContextMenu(QMenu*); + +private: + Q_PRIVATE_SLOT(d, void onScaleChanged()); + + QGraphicsWKViewPrivate* d; + friend class QGraphicsWKViewPrivate; + friend class TiledDrawingAreaProxy; +}; + +#endif /* qgraphicswkview_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp new file mode 100644 index 0000000..b17c100 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "qwkcontext.h" +#include "qwkcontext_p.h" + +#include "WebPlatformStrategies.h" + +using namespace WebKit; + +static inline void initializePlatformStrategiesIfNeeded() +{ + static bool initialized = false; + if (initialized) + return; + + WebPlatformStrategies::initialize(); + initialized = true; +} + +QWKContextPrivate::QWKContextPrivate(QWKContext* qq) + : q(qq) +{ + initializePlatformStrategiesIfNeeded(); +} + +QWKContextPrivate::~QWKContextPrivate() +{ +} + +QWKContext::QWKContext(QObject* parent) + : QObject(parent) + , d(new QWKContextPrivate(this)) +{ + d->context = WebContext::create(String()); +} + +QWKContext::QWKContext(WKContextRef contextRef, QObject* parent) + : QObject(parent) + , d(new QWKContextPrivate(this)) +{ + d->context = toImpl(contextRef); +} + +QWKContext::~QWKContext() +{ + delete d; +} + +#include "moc_qwkcontext.cpp" diff --git a/Source/WebKit2/UIProcess/API/qt/qwkcontext.h b/Source/WebKit2/UIProcess/API/qt/qwkcontext.h new file mode 100644 index 0000000..384d629 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkcontext.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef qwkcontext_h +#define qwkcontext_h + +#include "qwebkitglobal.h" +#include <QObject> +#include <WebKit2/WKContext.h> + +class QWKContextPrivate; + +class QWEBKIT_EXPORT QWKContext : public QObject { + Q_OBJECT +public: + QWKContext(QObject* parent = 0); + virtual ~QWKContext(); + + // Bridge from the C API + QWKContext(WKContextRef contextRef, QObject* parent = 0); + +private: + QWKContextPrivate* d; + + friend class QWKPagePrivate; +}; + +#endif /* qwkcontext_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkcontext_p.h b/Source/WebKit2/UIProcess/API/qt/qwkcontext_p.h new file mode 100644 index 0000000..625e87c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkcontext_p.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef qwkcontext_p_h +#define qwkcontext_p_h + +#include "WebContext.h" +#include <wtf/RefPtr.h> + +class QWKContextPrivate { +public: + QWKContextPrivate(QWKContext*); + ~QWKContextPrivate(); + + QWKContext* q; + + RefPtr<WebKit::WebContext> context; +}; + +#endif /* qkcontext_p_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkhistory.cpp b/Source/WebKit2/UIProcess/API/qt/qwkhistory.cpp new file mode 100644 index 0000000..3f424b5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkhistory.cpp @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi) + * + * 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 "qwkhistory.h" + +#include <QSharedData> +#include <QString> +#include <QUrl> +#include "qwkhistory_p.h" +#include "WebBackForwardList.h" +#include <WebKit2/WKArray.h> +#include <WebKit2/WKRetainPtr.h> +#include "WKBackForwardList.h" +#include "WKStringQt.h" +#include "WKURL.h" +#include "WKURLQt.h" + +using namespace WebKit; + +QWKHistoryItemPrivate::QWKHistoryItemPrivate(WKBackForwardListItemRef listItem) + : m_backForwardListItem(listItem) +{ +} + +QWKHistoryItemPrivate::~QWKHistoryItemPrivate() +{ +} + +QWKHistoryItem::QWKHistoryItem(const QWKHistoryItem& other) + : d(other.d) +{ +} + +QWKHistoryItem& QWKHistoryItem::QWKHistoryItem::operator=(const QWKHistoryItem& other) +{ + d = other.d; + return *this; +} + +QWKHistoryItem::QWKHistoryItem(WKBackForwardListItemRef item) + : d(new QWKHistoryItemPrivate(item)) +{ +} + +QWKHistoryItem::~QWKHistoryItem() +{ +} + +QString QWKHistoryItem::title() const +{ + if (!d->m_backForwardListItem) + return QString(); + WKRetainPtr<WKStringRef> title = WKBackForwardListItemCopyTitle(d->m_backForwardListItem.get()); + return WKStringCopyQString(title.get()); +} + +QUrl QWKHistoryItem::url() const +{ + if (!d->m_backForwardListItem) + return QUrl(); + WKRetainPtr<WKURLRef> url = WKBackForwardListItemCopyURL(d->m_backForwardListItem.get()); + return WKURLCopyQUrl(url.get()); +} + +QWKHistoryPrivate::QWKHistoryPrivate(WebKit::WebBackForwardList* list) + : m_backForwardList(list) +{ +} + +QWKHistory* QWKHistoryPrivate::createHistory(WebKit::WebBackForwardList* list) +{ + QWKHistory* history = new QWKHistory(); + history->d = new QWKHistoryPrivate(list); + return history; +} + +QWKHistoryPrivate::~QWKHistoryPrivate() +{ +} + +QWKHistory::QWKHistory() +{ +} + +QWKHistory::~QWKHistory() +{ + delete d; +} + +int QWKHistory::backListCount() const +{ + return WKBackForwardListGetBackListCount(toAPI(d->m_backForwardList)); +} + +int QWKHistory::forwardListCount() const +{ + return WKBackForwardListGetForwardListCount(toAPI(d->m_backForwardList)); +} + +int QWKHistory::count() const +{ + return backListCount() + forwardListCount(); +} + +QWKHistoryItem QWKHistory::currentItem() const +{ + WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetCurrentItem(toAPI(d->m_backForwardList)); + QWKHistoryItem item(itemRef.get()); + return item; +} + +QWKHistoryItem QWKHistory::backItem() const +{ + WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetBackItem(toAPI(d->m_backForwardList)); + QWKHistoryItem item(itemRef.get()); + return item; +} + +QWKHistoryItem QWKHistory::forwardItem() const +{ + WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetForwardItem(toAPI(d->m_backForwardList)); + QWKHistoryItem item(itemRef.get()); + return item; +} + +QWKHistoryItem QWKHistory::itemAt(int index) const +{ + WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetItemAtIndex(toAPI(d->m_backForwardList), index); + QWKHistoryItem item(itemRef.get()); + return item; +} + +QList<QWKHistoryItem> QWKHistory::backItems(int maxItems) const +{ + WKArrayRef arrayRef = WKBackForwardListCopyBackListWithLimit(toAPI(d->m_backForwardList), maxItems); + int size = WKArrayGetSize(arrayRef); + QList<QWKHistoryItem> itemList; + for (int i = 0; i < size; ++i) { + WKTypeRef wkHistoryItem = WKArrayGetItemAtIndex(arrayRef, i); + WKBackForwardListItemRef itemRef = static_cast<WKBackForwardListItemRef>(wkHistoryItem); + QWKHistoryItem item(itemRef); + itemList.append(item); + } + return itemList; +} + +QList<QWKHistoryItem> QWKHistory::forwardItems(int maxItems) const +{ + WKArrayRef arrayRef = WKBackForwardListCopyForwardListWithLimit(toAPI(d->m_backForwardList), maxItems); + int size = WKArrayGetSize(arrayRef); + QList<QWKHistoryItem> itemList; + for (int i = 0; i < size; ++i) { + WKTypeRef wkHistoryItem = WKArrayGetItemAtIndex(arrayRef, i); + WKBackForwardListItemRef itemRef = static_cast<WKBackForwardListItemRef>(wkHistoryItem); + QWKHistoryItem item(itemRef); + itemList.append(item); + } + return itemList; +} + diff --git a/Source/WebKit2/UIProcess/API/qt/qwkhistory.h b/Source/WebKit2/UIProcess/API/qt/qwkhistory.h new file mode 100644 index 0000000..81081c9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkhistory.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi) + * + * 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 qwkhistory_h +#define qwkhistory_h + +#include "qwebkitglobal.h" +#include <QObject> +#include <QSharedData> +#include "WKBackForwardListItem.h" + +class QWKHistoryPrivate; +class QWKHistoryItemPrivate; +class QUrl; +class QString; + +namespace WebKit { +class WebBackForwardList; +} + +class QWEBKIT_EXPORT QWKHistoryItem { +public: + QWKHistoryItem(const QWKHistoryItem& other); + QWKHistoryItem &operator=(const QWKHistoryItem& other); + + ~QWKHistoryItem(); + QString title() const; + QUrl url() const; + +private: + QWKHistoryItem(WKBackForwardListItemRef item); + + QExplicitlySharedDataPointer<QWKHistoryItemPrivate> d; + + friend class QWKHistory; + friend class QWKHistoryItemPrivate; +}; + +class QWEBKIT_EXPORT QWKHistory : public QObject { + Q_OBJECT +public: + int backListCount() const; + int forwardListCount() const; + int count() const; + QWKHistoryItem currentItem() const; + QWKHistoryItem backItem() const; + QWKHistoryItem forwardItem() const; + QWKHistoryItem itemAt(int index) const; + QList<QWKHistoryItem> backItems(int maxItems) const; + QList<QWKHistoryItem> forwardItems(int maxItems) const; + +private: + QWKHistory(); + ~QWKHistory(); + + QWKHistoryPrivate* d; + friend class QWKHistoryPrivate; + friend class QWKPagePrivate; +}; +#endif /* qwkhistory_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkhistory_p.h b/Source/WebKit2/UIProcess/API/qt/qwkhistory_p.h new file mode 100644 index 0000000..dd1d696 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkhistory_p.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi) + * + * 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 qwkhistory_p_h +#define qwkhistory_p_h + +#include <QSharedData> +#include "qwebkitglobal.h" +#include <WebKit2/WKBase.h> +#include <WebKit2/WKRetainPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { +class WebBackForwardList; +} + +class QWKHistory; + +class QWEBKIT_EXPORT QWKHistoryItemPrivate : public QSharedData { +public: + ~QWKHistoryItemPrivate(); +private: + QWKHistoryItemPrivate(WKBackForwardListItemRef listItem); + WKRetainPtr<WKBackForwardListItemRef> m_backForwardListItem; + + friend class QWKHistory; + friend class QWKHistoryItem; +}; + +class QWEBKIT_EXPORT QWKHistoryPrivate { +public: + static QWKHistory* createHistory(WebKit::WebBackForwardList* list); + +private: + QWKHistoryPrivate(WebKit::WebBackForwardList* list); + ~QWKHistoryPrivate(); + + WebKit::WebBackForwardList* m_backForwardList; + + friend class QWKHistory; +}; + +#endif /* qwkhistory_p_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp new file mode 100644 index 0000000..638d9e3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp @@ -0,0 +1,759 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "qwkpage.h" +#include "qwkpage_p.h" + +#include "qwkpreferences_p.h" + +#include "ChunkedUpdateDrawingAreaProxy.h" +#include "ClientImpl.h" +#include "qgraphicswkview.h" +#include "qwkcontext.h" +#include "qwkcontext_p.h" +#include "qwkhistory.h" +#include "qwkhistory_p.h" +#include "FindIndicator.h" +#include "LocalizedStrings.h" +#include "NativeWebKeyboardEvent.h" +#include "TiledDrawingAreaProxy.h" +#include "WebContext.h" +#include "WebContextMenuProxyQt.h" +#include "WebEventFactoryQt.h" +#include "WebPopupMenuProxyQt.h" +#include "WKStringQt.h" +#include "WKURLQt.h" +#include "ViewportArguments.h" +#include <QAction> +#include <QApplication> +#include <QGraphicsSceneMouseEvent> +#include <QStyle> +#include <QTouchEvent> +#include <QtDebug> +#include <WebCore/Cursor.h> +#include <WebCore/FloatRect.h> +#include <WebKit2/WKFrame.h> +#include <WebKit2/WKPageGroup.h> +#include <WebKit2/WKRetainPtr.h> + +using namespace WebKit; +using namespace WebCore; + +static WebCore::ContextMenuAction contextMenuActionForWebAction(QWKPage::WebAction action) +{ + switch (action) { + case QWKPage::OpenLink: + return WebCore::ContextMenuItemTagOpenLink; + case QWKPage::OpenLinkInNewWindow: + return WebCore::ContextMenuItemTagOpenLinkInNewWindow; + case QWKPage::CopyLinkToClipboard: + return WebCore::ContextMenuItemTagCopyLinkToClipboard; + case QWKPage::OpenImageInNewWindow: + return WebCore::ContextMenuItemTagOpenImageInNewWindow; + case QWKPage::Cut: + return WebCore::ContextMenuItemTagCut; + case QWKPage::Copy: + return WebCore::ContextMenuItemTagCopy; + case QWKPage::Paste: + return WebCore::ContextMenuItemTagPaste; + case QWKPage::SelectAll: + return WebCore::ContextMenuItemTagSelectAll; + default: + ASSERT(false); + break; + } + return WebCore::ContextMenuItemTagNoAction; +} + +QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c) + : q(qq) + , view(0) + , context(c) + , preferences(0) + , createNewPageFn(0) +{ + memset(actions, 0, sizeof(actions)); + page = context->d->context->createWebPage(this, 0); + history = QWKHistoryPrivate::createHistory(page->backForwardList()); +} + +QWKPagePrivate::~QWKPagePrivate() +{ + page->close(); + delete history; +} + +void QWKPagePrivate::init(QGraphicsItem* view, PassOwnPtr<DrawingAreaProxy> proxy) +{ + this->view = view; + page->setDrawingArea(proxy); + page->initializeWebPage(); +} + +void QWKPagePrivate::setCursor(const WebCore::Cursor& cursor) +{ +#ifndef QT_NO_CURSOR + emit q->cursorChanged(*cursor.platformCursor()); +#endif +} + +void QWKPagePrivate::setViewportArguments(const ViewportArguments& args) +{ + viewportArguments = args; + emit q->viewportChangeRequested(); +} + +void QWKPagePrivate::takeFocus(bool direction) +{ + emit q->focusNextPrevChild(direction); +} + +PassOwnPtr<DrawingAreaProxy> QWKPagePrivate::createDrawingAreaProxy() +{ + // FIXME: We should avoid this cast by decoupling the view from the page. + QGraphicsWKView* wkView = static_cast<QGraphicsWKView*>(view); + +#if ENABLE(TILED_BACKING_STORE) + if (page->drawingArea()->info().type == DrawingAreaInfo::Tiled) + return TiledDrawingAreaProxy::create(wkView, page.get()); +#endif + return ChunkedUpdateDrawingAreaProxy::create(wkView, page.get()); +} + +void QWKPagePrivate::setViewNeedsDisplay(const WebCore::IntRect& rect) +{ + view->update(QRect(rect)); +} + +void QWKPagePrivate::displayView() +{ + // FIXME: Implement. +} + +WebCore::IntSize QWKPagePrivate::viewSize() +{ + // FIXME: Implement. + return WebCore::IntSize(); +} + +bool QWKPagePrivate::isViewWindowActive() +{ + // FIXME: Implement. + return true; +} + +bool QWKPagePrivate::isViewFocused() +{ + // FIXME: Implement. + return true; +} + +bool QWKPagePrivate::isViewVisible() +{ + // FIXME: Implement. + return true; +} + +bool QWKPagePrivate::isViewInWindow() +{ + // FIXME: Implement. + return true; +} + +void QWKPagePrivate::pageDidRequestScroll(const IntSize& delta) +{ + emit q->scrollRequested(delta.width(), delta.height()); +} + +void QWKPagePrivate::didChangeContentsSize(const IntSize& newSize) +{ + emit q->contentsSizeChanged(QSize(newSize)); +} + +void QWKPagePrivate::toolTipChanged(const String&, const String& newTooltip) +{ + emit q->statusBarMessage(QString(newTooltip)); +} + +void QWKPagePrivate::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) +{ +} + +void QWKPagePrivate::clearAllEditCommands() +{ +} + +FloatRect QWKPagePrivate::convertToDeviceSpace(const FloatRect& rect) +{ + return rect; +} + +FloatRect QWKPagePrivate::convertToUserSpace(const FloatRect& rect) +{ + return rect; +} + +void QWKPagePrivate::selectionChanged(bool, bool, bool, bool) +{ +} + +void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&) +{ +} + +PassRefPtr<WebPopupMenuProxy> QWKPagePrivate::createPopupMenuProxy(WebPageProxy*) +{ + return WebPopupMenuProxyQt::create(); +} + +PassRefPtr<WebContextMenuProxy> QWKPagePrivate::createContextMenuProxy(WebPageProxy*) +{ + return WebContextMenuProxyQt::create(q); +} + +void QWKPagePrivate::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) +{ +} + +void QWKPagePrivate::didCommitLoadForMainFrame(bool useCustomRepresentation) +{ +} + +void QWKPagePrivate::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) +{ +} + +void QWKPagePrivate::paint(QPainter* painter, QRect area) +{ + if (page->isValid() && page->drawingArea()) + page->drawingArea()->paint(IntRect(area), painter); + else + painter->fillRect(area, Qt::white); +} + +void QWKPagePrivate::keyPressEvent(QKeyEvent* ev) +{ + page->handleKeyboardEvent(NativeWebKeyboardEvent(ev)); +} + +void QWKPagePrivate::keyReleaseEvent(QKeyEvent* ev) +{ + page->handleKeyboardEvent(NativeWebKeyboardEvent(ev)); +} + +void QWKPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) +{ + // For some reason mouse press results in mouse hover (which is + // converted to mouse move for WebKit). We ignore these hover + // events by comparing lastPos with newPos. + // NOTE: lastPos from the event always comes empty, so we work + // around that here. + static QPointF lastPos = QPointF(); + if (lastPos == ev->pos()) + return; + lastPos = ev->pos(); + + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(ev, 0); + page->handleMouseEvent(mouseEvent); +} + +void QWKPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) +{ + if (tripleClickTimer.isActive() && (ev->pos() - tripleClick).manhattanLength() < QApplication::startDragDistance()) { + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(ev, 3); + page->handleMouseEvent(mouseEvent); + return; + } + + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(ev, 1); + page->handleMouseEvent(mouseEvent); +} + +void QWKPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) +{ + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(ev, 0); + page->handleMouseEvent(mouseEvent); +} + +void QWKPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) +{ + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(ev, 2); + page->handleMouseEvent(mouseEvent); + + tripleClickTimer.start(QApplication::doubleClickInterval(), q); + tripleClick = ev->pos().toPoint(); +} + +void QWKPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev) +{ + WebWheelEvent wheelEvent = WebEventFactory::createWebWheelEvent(ev); + page->handleWheelEvent(wheelEvent); +} + +void QWKPagePrivate::setEditCommandState(const WTF::String&, bool, int) +{ +} + +void QWKPagePrivate::updateAction(QWKPage::WebAction action) +{ +#ifdef QT_NO_ACTION + Q_UNUSED(action) +#else + QAction* a = actions[action]; + if (!a) + return; + + RefPtr<WebKit::WebFrameProxy> mainFrame = page->mainFrame(); + if (!mainFrame) + return; + + bool enabled = a->isEnabled(); + bool checked = a->isChecked(); + + switch (action) { + case QWKPage::Back: + enabled = page->canGoBack(); + break; + case QWKPage::Forward: + enabled = page->canGoForward(); + break; + case QWKPage::Stop: + enabled = !(WebFrameProxy::LoadStateFinished == mainFrame->loadState()); + break; + case QWKPage::Reload: + enabled = (WebFrameProxy::LoadStateFinished == mainFrame->loadState()); + break; + default: + break; + } + + a->setEnabled(enabled); + + if (a->isCheckable()) + a->setChecked(checked); +#endif // QT_NO_ACTION +} + +void QWKPagePrivate::updateNavigationActions() +{ + updateAction(QWKPage::Back); + updateAction(QWKPage::Forward); + updateAction(QWKPage::Stop); + updateAction(QWKPage::Reload); +} + +#ifndef QT_NO_ACTION +void QWKPagePrivate::_q_webActionTriggered(bool checked) +{ + QAction* a = qobject_cast<QAction*>(q->sender()); + if (!a) + return; + QWKPage::WebAction action = static_cast<QWKPage::WebAction>(a->data().toInt()); + q->triggerAction(action, checked); +} +#endif // QT_NO_ACTION + +void QWKPagePrivate::touchEvent(QTouchEvent* event) +{ +#if ENABLE(TOUCH_EVENTS) + WebTouchEvent touchEvent = WebEventFactory::createWebTouchEvent(event); + page->handleTouchEvent(touchEvent); +#else + event->ignore(); +#endif +} + +QWKPage::QWKPage(QWKContext* context) + : d(new QWKPagePrivate(this, context)) +{ + WKPageLoaderClient loadClient = { + 0, /* version */ + this, /* clientInfo */ + qt_wk_didStartProvisionalLoadForFrame, + qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame, + qt_wk_didFailProvisionalLoadWithErrorForFrame, + qt_wk_didCommitLoadForFrame, + qt_wk_didFinishDocumentLoadForFrame, + qt_wk_didFinishLoadForFrame, + qt_wk_didFailLoadWithErrorForFrame, + 0, /* didSameDocumentNavigationForFrame */ + qt_wk_didReceiveTitleForFrame, + qt_wk_didFirstLayoutForFrame, + qt_wk_didFirstVisuallyNonEmptyLayoutForFrame, + qt_wk_didRemoveFrameFromHierarchy, + 0, /* didDisplayInsecureContentForFrame */ + 0, /* didRunInsecureContentForFrame */ + 0, /* canAuthenticateAgainstProtectionSpaceInFrame */ + 0, /* didReceiveAuthenticationChallengeInFrame */ + qt_wk_didStartProgress, + qt_wk_didChangeProgress, + qt_wk_didFinishProgress, + qt_wk_didBecomeUnresponsive, + qt_wk_didBecomeResponsive, + 0, /* processDidCrash */ + 0 /* didChangeBackForwardList */ + }; + WKPageSetPageLoaderClient(pageRef(), &loadClient); + + WKPageUIClient uiClient = { + 0, /* version */ + this, /* clientInfo */ + qt_wk_createNewPage, + qt_wk_showPage, + qt_wk_close, + qt_wk_runJavaScriptAlert, + 0, /* runJavaScriptConfirm */ + 0, /* runJavaScriptPrompt */ + 0, /* setStatusText */ + 0, /* mouseDidMoveOverElement */ + 0, /* missingPluginButtonClicked */ + 0, /* didNotHandleKeyEvent */ + 0, /* toolbarsAreVisible */ + 0, /* setToolbarsAreVisible */ + 0, /* menuBarIsVisible */ + 0, /* setMenuBarIsVisible */ + 0, /* statusBarIsVisible */ + 0, /* setStatusBarIsVisible */ + 0, /* isResizable */ + 0, /* setIsResizable */ + 0, /* getWindowFrame */ + 0, /* setWindowFrame */ + 0, /* runBeforeUnloadConfirmPanel */ + 0, /* didDraw */ + 0, /* pageDidScroll */ + 0, /* exceededDatabaseQuota */ + 0, /* runOpenPanel */ + 0 /* decidePolicyForGeolocationPermissionRequest */ + }; + WKPageSetPageUIClient(pageRef(), &uiClient); +} + +QWKPage::~QWKPage() +{ + delete d; +} + +QWKPage::ViewportAttributes::ViewportAttributes() + : d(0) + , m_initialScaleFactor(-1.0) + , m_minimumScaleFactor(-1.0) + , m_maximumScaleFactor(-1.0) + , m_devicePixelRatio(-1.0) + , m_isUserScalable(true) + , m_isValid(false) +{ + +} + +QWKPage::ViewportAttributes::ViewportAttributes(const QWKPage::ViewportAttributes& other) + : d(other.d) + , m_initialScaleFactor(other.m_initialScaleFactor) + , m_minimumScaleFactor(other.m_minimumScaleFactor) + , m_maximumScaleFactor(other.m_maximumScaleFactor) + , m_devicePixelRatio(other.m_devicePixelRatio) + , m_isUserScalable(other.m_isUserScalable) + , m_isValid(other.m_isValid) + , m_size(other.m_size) +{ + +} + +QWKPage::ViewportAttributes::~ViewportAttributes() +{ + +} + +QWKPage::ViewportAttributes& QWKPage::ViewportAttributes::operator=(const QWKPage::ViewportAttributes& other) +{ + if (this != &other) { + d = other.d; + m_initialScaleFactor = other.m_initialScaleFactor; + m_minimumScaleFactor = other.m_minimumScaleFactor; + m_maximumScaleFactor = other.m_maximumScaleFactor; + m_devicePixelRatio = other.m_devicePixelRatio; + m_isUserScalable = other.m_isUserScalable; + m_isValid = other.m_isValid; + m_size = other.m_size; + } + + return *this; +} + +QWKPage::ViewportAttributes QWKPage::viewportAttributesForSize(const QSize& availableSize) const +{ + static int desktopWidth = 980; + static int deviceDPI = 160; + + ViewportAttributes result; + + if (availableSize.isEmpty()) + return result; // Returns an invalid instance. + + // FIXME: Add a way to get these data via the platform plugin and fall back + // to the size of the view. + int deviceWidth = 480; + int deviceHeight = 864; + + WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize); + + result.m_isValid = true; + result.m_size = conf.layoutSize; + result.m_initialScaleFactor = conf.initialScale; + result.m_minimumScaleFactor = conf.minimumScale; + result.m_maximumScaleFactor = conf.maximumScale; + result.m_devicePixelRatio = conf.devicePixelRatio; + result.m_isUserScalable = conf.userScalable; + + return result; +} + +void QWKPage::setActualVisibleContentsRect(const QRect& rect) const +{ +#if ENABLE(TILED_BACKING_STORE) + d->page->setActualVisibleContentRect(rect); +#endif +} + +void QWKPage::timerEvent(QTimerEvent* ev) +{ + int timerId = ev->timerId(); + if (timerId == d->tripleClickTimer.timerId()) + d->tripleClickTimer.stop(); + else + QObject::timerEvent(ev); +} + +WKPageRef QWKPage::pageRef() const +{ + return toAPI(d->page.get()); +} + +QWKContext* QWKPage::context() const +{ + return d->context; +} + +QWKPreferences* QWKPage::preferences() const +{ + if (!d->preferences) { + WKPageGroupRef pageGroupRef = WKPageGetPageGroup(pageRef()); + d->preferences = QWKPreferencesPrivate::createPreferences(pageGroupRef); + } + + return d->preferences; +} + +void QWKPage::setCreateNewPageFunction(CreateNewPageFn function) +{ + d->createNewPageFn = function; +} + +void QWKPage::setCustomUserAgent(const QString& userAgent) +{ + WKRetainPtr<WKStringRef> wkUserAgent(WKStringCreateWithQString(userAgent)); + WKPageSetCustomUserAgent(pageRef(), wkUserAgent.get()); +} + +QString QWKPage::customUserAgent() const +{ + return WKStringCopyQString(WKPageCopyCustomUserAgent(pageRef())); +} + +void QWKPage::load(const QUrl& url) +{ + WKRetainPtr<WKURLRef> wkurl(WKURLCreateWithQUrl(url)); + WKPageLoadURL(pageRef(), wkurl.get()); +} + +void QWKPage::setUrl(const QUrl& url) +{ + load(url); +} + +QUrl QWKPage::url() const +{ + WKRetainPtr<WKFrameRef> frame = WKPageGetMainFrame(pageRef()); + if (!frame) + return QUrl(); + return WKURLCopyQUrl(WKFrameCopyURL(frame.get())); +} + +QString QWKPage::title() const +{ + return WKStringCopyQString(WKPageCopyTitle(pageRef())); +} + +void QWKPage::setViewportSize(const QSize& size) +{ + if (d->page->drawingArea()) + d->page->drawingArea()->setSize(IntSize(size)); +} + +qreal QWKPage::textZoomFactor() const +{ + return WKPageGetTextZoomFactor(pageRef()); +} + +void QWKPage::setTextZoomFactor(qreal zoomFactor) +{ + WKPageSetTextZoomFactor(pageRef(), zoomFactor); +} + +qreal QWKPage::pageZoomFactor() const +{ + return WKPageGetPageZoomFactor(pageRef()); +} + +void QWKPage::setPageZoomFactor(qreal zoomFactor) +{ + WKPageSetPageZoomFactor(pageRef(), zoomFactor); +} + +void QWKPage::setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor) +{ + WKPageSetPageAndTextZoomFactors(pageRef(), pageZoomFactor, textZoomFactor); +} + +QWKHistory* QWKPage::history() const +{ + return d->history; +} + +void QWKPage::setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize) +{ +#if ENABLE(TILED_BACKING_STORE) + d->page->setResizesToContentsUsingLayoutSize(targetLayoutSize); +#endif +} + +#ifndef QT_NO_ACTION +void QWKPage::triggerAction(WebAction webAction, bool) +{ + switch (webAction) { + case Back: + d->page->goBack(); + return; + case Forward: + d->page->goForward(); + return; + case Stop: + d->page->stopLoading(); + return; + case Reload: + d->page->reload(/* reloadFromOrigin */ true); + return; + default: + break; + } + + QAction* qtAction = action(webAction); + WebKit::WebContextMenuItemData menuItemData(ActionType, contextMenuActionForWebAction(webAction), qtAction->text(), qtAction->isEnabled(), qtAction->isChecked()); + d->page->contextMenuItemSelected(menuItemData); +} +#endif // QT_NO_ACTION + +#ifndef QT_NO_ACTION +QAction* QWKPage::action(WebAction action) const +{ + if (action == QWKPage::NoWebAction || action >= WebActionCount) + return 0; + + if (d->actions[action]) + return d->actions[action]; + + QString text; + QIcon icon; + QStyle* style = qobject_cast<QApplication*>(QCoreApplication::instance())->style(); + bool checkable = false; + + switch (action) { + case OpenLink: + text = contextMenuItemTagOpenLink(); + break; + case OpenLinkInNewWindow: + text = contextMenuItemTagOpenLinkInNewWindow(); + break; + case CopyLinkToClipboard: + text = contextMenuItemTagCopyLinkToClipboard(); + break; + case OpenImageInNewWindow: + text = contextMenuItemTagOpenImageInNewWindow(); + break; + case Back: + text = contextMenuItemTagGoBack(); + icon = style->standardIcon(QStyle::SP_ArrowBack); + break; + case Forward: + text = contextMenuItemTagGoForward(); + icon = style->standardIcon(QStyle::SP_ArrowForward); + break; + case Stop: + text = contextMenuItemTagStop(); + icon = style->standardIcon(QStyle::SP_BrowserStop); + break; + case Reload: + text = contextMenuItemTagReload(); + icon = style->standardIcon(QStyle::SP_BrowserReload); + break; + case Cut: + text = contextMenuItemTagCut(); + break; + case Copy: + text = contextMenuItemTagCopy(); + break; + case Paste: + text = contextMenuItemTagPaste(); + break; + case SelectAll: + text = contextMenuItemTagSelectAll(); + break; + default: + return 0; + break; + } + + if (text.isEmpty()) + return 0; + + QAction* a = new QAction(d->q); + a->setText(text); + a->setData(action); + a->setCheckable(checkable); + a->setIcon(icon); + + connect(a, SIGNAL(triggered(bool)), this, SLOT(_q_webActionTriggered(bool))); + + d->actions[action] = a; + d->updateAction(action); + return a; +} +#endif // QT_NO_ACTION + +void QWKPage::findZoomableAreaForPoint(const QPoint& point) +{ + d->page->findZoomableAreaForPoint(point); +} + +void QWKPagePrivate::didFindZoomableArea(const IntRect& area) +{ + emit q->zoomableAreaFound(QRect(area)); +} + +#include "moc_qwkpage.cpp" diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.h b/Source/WebKit2/UIProcess/API/qt/qwkpage.h new file mode 100644 index 0000000..e0bb4c3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.h @@ -0,0 +1,151 @@ +#ifndef qwkpage_h +#define qwkpage_h + +#include "qwebkitglobal.h" +#include <QAction> +#include <QObject> +#include <QPoint> +#include <QRect> +#include <QSize> +#include <QUrl> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKPage.h> + +class QCursor; +class QGraphicsItem; +class QWKContext; +class QWKGraphicsWidget; +class QWKPreferences; +class QWKPagePrivate; +class QtViewportAttributesPrivate; +class QWKHistory; + +class QWEBKIT_EXPORT QWKPage : public QObject { + Q_OBJECT + Q_PROPERTY(QString title READ title) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + +public: + enum WebAction { + NoWebAction = - 1, + + OpenLink, + OpenLinkInNewWindow, + CopyLinkToClipboard, + OpenImageInNewWindow, + + Back, + Forward, + Stop, + Reload, + + Cut, + Copy, + Paste, + SelectAll, + + WebActionCount + }; + + class ViewportAttributes { + public: + ViewportAttributes(); + ViewportAttributes(const QWKPage::ViewportAttributes& other); + + ~ViewportAttributes(); + + QWKPage::ViewportAttributes& operator=(const QWKPage::ViewportAttributes& other); + + inline qreal initialScaleFactor() const { return m_initialScaleFactor; }; + inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; }; + inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; }; + inline qreal devicePixelRatio() const { return m_devicePixelRatio; }; + inline bool isUserScalable() const { return m_isUserScalable; }; + inline bool isValid() const { return m_isValid; }; + inline QSize size() const { return m_size; }; + + private: + QSharedDataPointer<QtViewportAttributesPrivate> d; + qreal m_initialScaleFactor; + qreal m_minimumScaleFactor; + qreal m_maximumScaleFactor; + qreal m_devicePixelRatio; + bool m_isUserScalable; + bool m_isValid; + QSize m_size; + + friend class QWKPage; + }; + + QWKPage(QWKContext*); + virtual ~QWKPage(); + + WKPageRef pageRef() const; + + QWKPreferences* preferences() const; + + void load(const QUrl& url); + void setUrl(const QUrl& url); + QUrl url() const; + + QString title() const; + + void setViewportSize(const QSize&); + ViewportAttributes viewportAttributesForSize(const QSize& availableSize) const; + + void setActualVisibleContentsRect(const QRect& rect) const; + + void setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize); + + QAction* action(WebAction action) const; + void triggerAction(WebAction action, bool checked = false); + + typedef QWKPage* (*CreateNewPageFn)(QWKPage*); + void setCreateNewPageFunction(CreateNewPageFn function); + + void setCustomUserAgent(const QString&); + QString customUserAgent() const; + + qreal textZoomFactor() const; + qreal pageZoomFactor() const; + void setTextZoomFactor(qreal zoomFactor); + void setPageZoomFactor(qreal zoomFactor); + void setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor); + + QWKHistory* history() const; + QWKContext* context() const; + + void findZoomableAreaForPoint(const QPoint&); + +public: + Q_SIGNAL void statusBarMessage(const QString&); + Q_SIGNAL void titleChanged(const QString&); + Q_SIGNAL void loadStarted(); + Q_SIGNAL void loadFinished(bool ok); + Q_SIGNAL void loadProgress(int progress); + Q_SIGNAL void initialLayoutCompleted(); + Q_SIGNAL void urlChanged(const QUrl&); + Q_SIGNAL void contentsSizeChanged(const QSize&); + Q_SIGNAL void scrollRequested(int dx, int dy); + Q_SIGNAL void cursorChanged(const QCursor&); + Q_SIGNAL void viewportChangeRequested(); + Q_SIGNAL void windowCloseRequested(); + Q_SIGNAL void zoomableAreaFound(const QRect&); + Q_SIGNAL void focusNextPrevChild(bool); + Q_SIGNAL void showContextMenu(QMenu*); + +protected: + void timerEvent(QTimerEvent*); + +private: +#ifndef QT_NO_ACTION + Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)); +#endif + QWKPagePrivate* d; + + friend class QGraphicsWKView; + friend class QGraphicsWKViewPrivate; + friend class QWKPagePrivate; +}; + +#endif /* qwkpage_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h new file mode 100644 index 0000000..85135c2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef qwkpage_p_h +#define qwkpage_p_h + +#include "DrawingAreaProxy.h" +#include "PageClient.h" +#include "qwkpage.h" +#include "WebPageProxy.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/RefPtr.h> +#include <QBasicTimer> +#include <QGraphicsView> +#include <QKeyEvent> + +class QGraphicsWKView; +class QWKPreferences; + +class QWKPagePrivate : WebKit::PageClient { +public: + QWKPagePrivate(QWKPage*, QWKContext*); + ~QWKPagePrivate(); + + static QWKPagePrivate* get(QWKPage* page) { return page->d; } + + void init(QGraphicsItem*, WTF::PassOwnPtr<WebKit::DrawingAreaProxy>); + + // PageClient + virtual PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy(); + virtual void setViewNeedsDisplay(const WebCore::IntRect&); + virtual void displayView(); + + virtual WebCore::IntSize viewSize(); + virtual bool isViewWindowActive(); + virtual bool isViewFocused(); + virtual bool isViewVisible(); + virtual bool isViewInWindow(); + +#if USE(ACCELERATED_COMPOSITING) + void pageDidEnterAcceleratedCompositing() { } + void pageDidLeaveAcceleratedCompositing() { } +#endif // USE(ACCELERATED_COMPOSITING) + virtual void pageDidRequestScroll(const WebCore::IntSize&); + virtual void processDidCrash() { } + virtual void didRelaunchProcess() { } + virtual void didChangeContentsSize(const WebCore::IntSize&); + virtual void didFindZoomableArea(const WebCore::IntRect&); + virtual void setCursor(const WebCore::Cursor&); + virtual void setViewportArguments(const WebCore::ViewportArguments&); + virtual void takeFocus(bool direction); + virtual void toolTipChanged(const WTF::String&, const WTF::String&); + virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo); + 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 selectionChanged(bool, bool, bool, bool); + virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*); + virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*); + + virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut); + + virtual void didCommitLoadForMainFrame(bool useCustomRepresentation); + virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); + virtual double customRepresentationZoomFactor() { return 1; } + virtual void setCustomRepresentationZoomFactor(double) { } + + void paint(QPainter* painter, QRect); + + void keyPressEvent(QKeyEvent*); + void keyReleaseEvent(QKeyEvent*); + void mouseMoveEvent(QGraphicsSceneMouseEvent*); + void mousePressEvent(QGraphicsSceneMouseEvent*); + void mouseReleaseEvent(QGraphicsSceneMouseEvent*); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); + void wheelEvent(QGraphicsSceneWheelEvent*); + + void updateAction(QWKPage::WebAction action); + void updateNavigationActions(); + void updateEditorActions(); + void setEditCommandState(const WTF::String&, bool, int); + + void _q_webActionTriggered(bool checked); + + void touchEvent(QTouchEvent*); + + QWKPage* q; + + QGraphicsItem* view; + QWKContext* context; + QWKHistory* history; + + QAction* actions[QWKPage::WebActionCount]; + QWKPreferences* preferences; + + RefPtr<WebKit::WebPageProxy> page; + + WebCore::ViewportArguments viewportArguments; + + QWKPage::CreateNewPageFn createNewPageFn; + + QPoint tripleClick; + QBasicTimer tripleClickTimer; +}; + +class QtViewportAttributesPrivate : public QSharedData { +public: + QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq) + : q(qq) + { } + + QWKPage::ViewportAttributes* q; +}; + + +#endif /* qkpage_p_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp new file mode 100644 index 0000000..dea18aa --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp @@ -0,0 +1,185 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "qwkpreferences.h" + +#include "WKPageGroup.h" +#include "WKPreferences.h" +#include "WKStringQt.h" +#include "WKRetainPtr.h" +#include "qwkpreferences_p.h" + + +QWKPreferences* QWKPreferencesPrivate::createPreferences(WKPageGroupRef pageGroupRef) +{ + QWKPreferences* prefs = new QWKPreferences; + prefs->d->ref = WKPageGroupGetPreferences(pageGroupRef); + return prefs; +} + +QWKPreferences* QWKPreferencesPrivate::createSharedPreferences() +{ + QWKPreferences* prefs = new QWKPreferences; + prefs->d->ref = WKPreferencesCreate(); + return prefs; +} + +QWKPreferences* QWKPreferences::sharedPreferences() +{ + static QWKPreferences* instance = 0; + + if (!instance) + instance = QWKPreferencesPrivate::createSharedPreferences(); + return instance; +} + +QWKPreferences::QWKPreferences() + : d(new QWKPreferencesPrivate) +{ +} + +QWKPreferences::~QWKPreferences() +{ + delete d; +} + +void QWKPreferences::setFontFamily(FontFamily which, const QString& family) +{ + switch (which) { + case StandardFont: + WKPreferencesSetStandardFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + case FixedFont: + WKPreferencesSetFixedFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + case SerifFont: + WKPreferencesSetSerifFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + case SansSerifFont: + WKPreferencesSetSansSerifFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + case CursiveFont: + WKPreferencesSetCursiveFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + case FantasyFont: + WKPreferencesSetFantasyFontFamily(d->ref, WKStringCreateWithQString(family)); + break; + default: + break; + } +} + +QString QWKPreferences::fontFamily(FontFamily which) const +{ + switch (which) { + case StandardFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyStandardFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + case FixedFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFixedFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + case SerifFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySerifFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + case SansSerifFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySansSerifFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + case CursiveFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyCursiveFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + case FantasyFont: { + WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFantasyFontFamily(d->ref)); + return WKStringCopyQString(stringRef.get()); + } + default: + return QString(); + } +} + +bool QWKPreferences::testAttribute(WebAttribute attr) const +{ + switch (attr) { + case AutoLoadImages: + return WKPreferencesGetLoadsImagesAutomatically(d->ref); + case JavascriptEnabled: + return WKPreferencesGetJavaScriptEnabled(d->ref); + case PluginsEnabled: + return WKPreferencesGetPluginsEnabled(d->ref); + case OfflineWebApplicationCacheEnabled: + return WKPreferencesGetOfflineWebApplicationCacheEnabled(d->ref); + case LocalStorageEnabled: + return WKPreferencesGetLocalStorageEnabled(d->ref); + case XSSAuditingEnabled: + return WKPreferencesGetXSSAuditorEnabled(d->ref); + case FrameFlatteningEnabled: + return WKPreferencesGetFrameFlatteningEnabled(d->ref); + case PrivateBrowsingEnabled: + return WKPreferencesGetPrivateBrowsingEnabled(d->ref); + case DeveloperExtrasEnabled: + return WKPreferencesGetDeveloperExtrasEnabled(d->ref); + case DnsPrefetchEnabled: + return WKPreferencesGetDNSPrefetchingEnabled(d->ref); + default: + ASSERT_NOT_REACHED(); + return false; + } +} + +void QWKPreferences::setAttribute(WebAttribute attr, bool on) +{ + switch (attr) { + case AutoLoadImages: + WKPreferencesSetLoadsImagesAutomatically(d->ref, on); + break; + case JavascriptEnabled: + WKPreferencesSetJavaScriptEnabled(d->ref, on); + break; + case PluginsEnabled: + WKPreferencesSetPluginsEnabled(d->ref, on); + break; + case OfflineWebApplicationCacheEnabled: + WKPreferencesSetOfflineWebApplicationCacheEnabled(d->ref, on); + break; + case LocalStorageEnabled: + WKPreferencesSetLocalStorageEnabled(d->ref, on); + break; + case XSSAuditingEnabled: + WKPreferencesSetXSSAuditorEnabled(d->ref, on); + break; + case FrameFlatteningEnabled: + WKPreferencesSetFrameFlatteningEnabled(d->ref, on); + break; + case PrivateBrowsingEnabled: + WKPreferencesSetPrivateBrowsingEnabled(d->ref, on); + break; + case DeveloperExtrasEnabled: + WKPreferencesSetDeveloperExtrasEnabled(d->ref, on); + break; + case DnsPrefetchEnabled: + WKPreferencesSetDNSPrefetchingEnabled(d->ref, on); + break; + default: + ASSERT_NOT_REACHED(); + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h new file mode 100644 index 0000000..d9f7bc0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWKPREFERENCES_H +#define QWKPREFERENCES_H + +#include "qwebkitglobal.h" + +class QWKPage; +class QWKPreferencesPrivate; + +class QWEBKIT_EXPORT QWKPreferences { +public: + enum FontFamily { + StandardFont, + FixedFont, + SerifFont, + SansSerifFont, + CursiveFont, + FantasyFont + }; + + enum WebAttribute { + AutoLoadImages, + JavascriptEnabled, + PluginsEnabled, + OfflineWebApplicationCacheEnabled, + LocalStorageEnabled, + XSSAuditingEnabled, + FrameFlatteningEnabled, + PrivateBrowsingEnabled, + DeveloperExtrasEnabled, + DnsPrefetchEnabled + }; + + static QWKPreferences* sharedPreferences(); + + void setFontFamily(FontFamily which, const QString& family); + QString fontFamily(FontFamily which) const; + + void setAttribute(WebAttribute attr, bool on); + bool testAttribute(WebAttribute attr) const; + +private: + Q_DISABLE_COPY(QWKPreferences) + + QWKPreferences(); + ~QWKPreferences(); + + QWKPreferencesPrivate *d; + + friend class QWKPage; + friend class QWKPreferencesPrivate; +}; + +#endif // QWKPREFERENCES_H diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpreferences_p.h new file mode 100644 index 0000000..7fe2389 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences_p.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "WKPreferences.h" + +class QWKPreferencesPrivate { +public: + static QWKPreferences* createPreferences(WKPageGroupRef); + static QWKPreferences* createSharedPreferences(); + + WKPreferencesRef ref; +}; diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp new file mode 100644 index 0000000..07b39b2 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "AuthenticationChallengeProxy.h" + +#include "AuthenticationDecisionListener.h" +#include "AuthenticationManagerMessages.h" +#include "WebCoreArgumentCoders.h" +#include "WebCredential.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" +#include "WebProtectionSpace.h" + +namespace WebKit { + +AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page) + : m_coreAuthenticationChallenge(authenticationChallenge) + , m_challengeID(challengeID) + , m_page(page) +{ + ASSERT(m_challengeID); + m_listener = AuthenticationDecisionListener::create(this); +} + +AuthenticationChallengeProxy::~AuthenticationChallengeProxy() +{ + // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet, + // we cancel it here so the WebProcess isn't waiting for an answer forever. + if (m_challengeID && m_page->process()) + m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID()); + + if (m_listener) + m_listener->detachChallenge(); +} + +void AuthenticationChallengeProxy::useCredential(WebCredential* credential) +{ + if (!m_challengeID) + return; + + if (!credential) + m_page->process()->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), m_page->pageID()); + else + m_page->process()->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core()), m_page->pageID()); + + m_challengeID = 0; +} + +void AuthenticationChallengeProxy::cancel() +{ + if (!m_challengeID) + return; + + m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID()); + + m_challengeID = 0; +} + +WebCredential* AuthenticationChallengeProxy::proposedCredential() const +{ + if (!m_webCredential) + m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); + + return m_webCredential.get(); +} + +WebProtectionSpace* AuthenticationChallengeProxy::protectionSpace() const +{ + if (!m_webProtectionSpace) + m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); + + return m_webProtectionSpace.get(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h new file mode 100644 index 0000000..d4e76dd --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h @@ -0,0 +1,80 @@ +/* + * 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 AuthenticationChallengeProxy_h +#define AuthenticationChallengeProxy_h + +#include "APIObject.h" +#include <WebCore/AuthenticationChallenge.h> +#include <wtf/PassRefPtr.h> + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebKit { + +class AuthenticationDecisionListener; +class WebCredential; +class WebPageProxy; +class WebProtectionSpace; + +class AuthenticationChallengeProxy : public APIObject { +public: + static const Type APIType = TypeAuthenticationChallenge; + + static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page) + { + return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, page)); + } + + ~AuthenticationChallengeProxy(); + + void useCredential(WebCredential*); + void cancel(); + + AuthenticationDecisionListener* listener() const { return m_listener.get(); } + WebCredential* proposedCredential() const; + WebProtectionSpace* protectionSpace() const; + int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); } + +private: + AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebPageProxy* page); + + virtual Type type() const { return APIType; } + + WebCore::AuthenticationChallenge m_coreAuthenticationChallenge; + uint64_t m_challengeID; + RefPtr<WebPageProxy> m_page; + RefPtr<AuthenticationDecisionListener> m_listener; + mutable RefPtr<WebCredential> m_webCredential; + mutable RefPtr<WebProtectionSpace> m_webProtectionSpace; +}; + +} // namespace WebKit + +#endif // WebAuthenticationChallengeProxy_h diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp new file mode 100644 index 0000000..ddcc6c6 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "AuthenticationDecisionListener.h" + +#include "AuthenticationChallengeProxy.h" +#include "AuthenticationManagerMessages.h" +#include "WebCredential.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +namespace WebKit { + +AuthenticationDecisionListener::AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge) + : m_challengeProxy(authenticationChallenge) +{ +} + +void AuthenticationDecisionListener::useCredential(WebCredential* credential) +{ + if (m_challengeProxy) + m_challengeProxy->useCredential(credential); +} + +void AuthenticationDecisionListener::cancel() +{ + if (m_challengeProxy) + m_challengeProxy->cancel(); +} + +void AuthenticationDecisionListener::detachChallenge() +{ + m_challengeProxy = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h new file mode 100644 index 0000000..00af849 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h @@ -0,0 +1,62 @@ +/* + * 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 AuthenticationDecisionListener_h +#define AuthenticationDecisionListener_h + +#include "APIObject.h" + +#include <wtf/RefPtr.h> + +namespace WebKit { + +class AuthenticationChallengeProxy; +class WebCredential; + +class AuthenticationDecisionListener : public APIObject { +public: + static const Type APIType = TypeAuthenticationDecisionListener; + + static PassRefPtr<AuthenticationDecisionListener> create(AuthenticationChallengeProxy* authenticationChallenge) + { + return adoptRef(new AuthenticationDecisionListener(authenticationChallenge)); + } + + void useCredential(WebCredential*); + void cancel(); + + void detachChallenge(); + +private: + AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge); + + virtual Type type() const { return APIType; } + + AuthenticationChallengeProxy* m_challengeProxy; +}; + +} // namespace WebKit + +#endif // WebAuthenticationDecisionListener_h diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp new file mode 100644 index 0000000..b9a346e --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebCredential.h" + +namespace WebKit { + +WebCredential::WebCredential(const WebCore::Credential& credential) + : m_coreCredential(credential) +{ +} + +const WebCore::Credential& WebCredential::core() +{ + return m_coreCredential; +} + +const String& WebCredential::user() const +{ + return m_coreCredential.user(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/WebCredential.h b/Source/WebKit2/UIProcess/Authentication/WebCredential.h new file mode 100644 index 0000000..7beac04 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebCredential.h @@ -0,0 +1,66 @@ +/* + * 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 WebCredential_h +#define WebCredential_h + +#include "APIObject.h" +#include "WebString.h" + +#include <WebCore/Credential.h> +#include <wtf/PassRefPtr.h> + + +namespace WebKit { + +class WebCredential : public APIObject { +public: + static const Type APIType = TypeCredential; + + static PassRefPtr<WebCredential> create(const WebCore::Credential& credential) + { + return adoptRef(new WebCredential(credential)); + } + + static PassRefPtr<WebCredential> create(WebString* username, WebString* password, WebCore::CredentialPersistence persistence) + { + return adoptRef(new WebCredential(WebCore::Credential(username->string(), password->string(), persistence))); + } + + const WebCore::Credential& core(); + + const String& user() const; + +private: + WebCredential(const WebCore::Credential&); + + virtual Type type() const { return APIType; } + + WebCore::Credential m_coreCredential; +}; + +} // namespace WebKit + +#endif // WebCredential_h diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp new file mode 100644 index 0000000..1671371 --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProtectionSpace.h" + +#include <WebCore/SharedBuffer.h> + +namespace WebKit { + +WebProtectionSpace::WebProtectionSpace(const WebCore::ProtectionSpace& coreProtectionSpace) + : m_coreProtectionSpace(coreProtectionSpace) +{ +} + +const String& WebProtectionSpace::host() const +{ + return m_coreProtectionSpace.host(); +} + +int WebProtectionSpace::port() const +{ + return m_coreProtectionSpace.port(); +} + +const String& WebProtectionSpace::realm() const +{ + return m_coreProtectionSpace.realm(); +} + +bool WebProtectionSpace::isProxy() const +{ + return m_coreProtectionSpace.isProxy(); +} + +WebCore::ProtectionSpaceServerType WebProtectionSpace::serverType() const +{ + return m_coreProtectionSpace.serverType(); +} + +bool WebProtectionSpace::receivesCredentialSecurely() const +{ + return m_coreProtectionSpace.receivesCredentialSecurely(); +} + +WebCore::ProtectionSpaceAuthenticationScheme WebProtectionSpace::authenticationScheme() const +{ + return m_coreProtectionSpace.authenticationScheme(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h new file mode 100644 index 0000000..604236a --- /dev/null +++ b/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h @@ -0,0 +1,63 @@ +/* + * 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 WebProtectionSpace_h +#define WebProtectionSpace_h + +#include "APIObject.h" +#include <WebCore/ProtectionSpace.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebProtectionSpace : public APIObject { +public: + static const Type APIType = TypeProtectionSpace; + + static PassRefPtr<WebProtectionSpace> create(const WebCore::ProtectionSpace& protectionSpace) + { + return adoptRef(new WebProtectionSpace(protectionSpace)); + } + + const String& protocol() const; + const String& host() const; + int port() const; + const String& realm() const; + bool isProxy() const; + WebCore::ProtectionSpaceServerType serverType() const; + bool receivesCredentialSecurely() const; + WebCore::ProtectionSpaceAuthenticationScheme authenticationScheme() const; + +private: + WebProtectionSpace(const WebCore::ProtectionSpace&); + + virtual Type type() const { return APIType; } + + WebCore::ProtectionSpace m_coreProtectionSpace; +}; + +} // namespace WebKit + +#endif // WebProtectionSpace_h diff --git a/Source/WebKit2/UIProcess/BackingStore.cpp b/Source/WebKit2/UIProcess/BackingStore.cpp new file mode 100644 index 0000000..06d66af --- /dev/null +++ b/Source/WebKit2/UIProcess/BackingStore.cpp @@ -0,0 +1,51 @@ +/* + * 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 "BackingStore.h" + +using namespace WebCore; + +#if !PLATFORM(MAC) +#error "This class is not ready for use by other ports yet." +#endif + +namespace WebKit { + +PassOwnPtr<BackingStore> BackingStore::create(const IntSize& size) +{ + return adoptPtr(new BackingStore(size)); +} + +BackingStore::BackingStore(const IntSize& size) + : m_size(size) +{ + ASSERT(!m_size.isEmpty()); +} + +BackingStore::~BackingStore() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/BackingStore.h b/Source/WebKit2/UIProcess/BackingStore.h new file mode 100644 index 0000000..e196a55 --- /dev/null +++ b/Source/WebKit2/UIProcess/BackingStore.h @@ -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. + */ + +#ifndef BackingStore_h +#define BackingStore_h + +#include <WebCore/IntSize.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + +namespace WebCore { + class IntRect; +} + +namespace WebKit { + +class UpdateInfo; +class WebPageProxy; + +class BackingStore { + WTF_MAKE_NONCOPYABLE(BackingStore); + +public: + static PassOwnPtr<BackingStore> create(const WebCore::IntSize&); + ~BackingStore(); + +#if PLATFORM(MAC) + typedef CGContextRef PlatformGraphicsContext; +#endif + + void paint(PlatformGraphicsContext, const WebCore::IntRect&); + void incorporateUpdate(const UpdateInfo&); + +private: + explicit BackingStore(const WebCore::IntSize&); + + void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); + + WebCore::IntSize m_size; + +#if PLATFORM(MAC) + RetainPtr<CGContextRef> m_bitmapContext; +#endif +}; + +} // namespace WebKit + +#endif // BackingStore_h diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp new file mode 100644 index 0000000..22e9c84 --- /dev/null +++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "UpdateChunk.h" +#include "WebCoreArgumentCoders.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<ChunkedUpdateDrawingAreaProxy> ChunkedUpdateDrawingAreaProxy::create(PlatformWebView* webView, WebPageProxy* webPageProxy) +{ + return adoptPtr(new ChunkedUpdateDrawingAreaProxy(webView, webPageProxy)); +} + +ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy) + : DrawingAreaProxy(DrawingAreaInfo::ChunkedUpdate, webPageProxy) + , m_isWaitingForDidSetFrameNotification(false) + , m_isVisible(true) + , m_forceRepaintWhenResumingPainting(false) + , m_webView(webView) +{ +} + +ChunkedUpdateDrawingAreaProxy::~ChunkedUpdateDrawingAreaProxy() +{ +} + +bool ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) +{ + if (m_isWaitingForDidSetFrameNotification) { + WebPageProxy* page = this->page(); + if (!page->isValid()) + return false; + + if (page->process()->isLaunching()) + return false; + + OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04); + if (arguments) + didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyLegacyMessage::DidSetSize), arguments.get()); + } + + return platformPaint(rect, context); +} + +void ChunkedUpdateDrawingAreaProxy::sizeDidChange() +{ + sendSetSize(); +} + +void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible) +{ + WebPageProxy* page = this->page(); + + if (isVisible == m_isVisible) + return; + + m_isVisible = isVisible; + if (!page->isValid()) + return; + + 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)); + return; + } + + // The page is now visible, resume painting. + page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting)); + m_forceRepaintWhenResumingPainting = false; +} + +void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk) +{ + ASSERT(m_isWaitingForDidSetFrameNotification); + m_isWaitingForDidSetFrameNotification = false; + + IntSize viewSize = updateChunk->rect().size(); + + if (viewSize != m_size) + sendSetSize(); + + invalidateBackingStore(); + if (!updateChunk->isEmpty()) + drawUpdateChunkIntoBackingStore(updateChunk); + + WebPageProxy* page = this->page(); + page->process()->responsivenessTimer()->stop(); +} + +void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk) +{ + if (!m_isVisible) { + // We got an update request that must have been sent before we told the web process to suspend painting. + // Don't paint this into the backing store, because that could leave the backing store in an inconsistent state. + // Instead, we will just tell the drawing area to repaint everything when we resume painting. + m_forceRepaintWhenResumingPainting = true; + } else { + // Just paint into backing store. + drawUpdateChunkIntoBackingStore(updateChunk); + } + + WebPageProxy* page = this->page(); + page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); +} + +void ChunkedUpdateDrawingAreaProxy::sendSetSize() +{ + if (!m_webPageProxy->isValid()) + return; + + if (m_isWaitingForDidSetFrameNotification) + return; + m_isWaitingForDidSetFrameNotification = true; + + m_webPageProxy->process()->responsivenessTimer()->start(); + m_webPageProxy->process()->send(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size)); +} + +void ChunkedUpdateDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) { + case DrawingAreaProxyLegacyMessage::Update: { + UpdateChunk updateChunk; + if (!arguments->decode(updateChunk)) + return; + + update(&updateChunk); + break; + } + case DrawingAreaProxyLegacyMessage::DidSetSize: { + UpdateChunk updateChunk; + if (!arguments->decode(CoreIPC::Out(updateChunk))) + return; + + didSetSize(&updateChunk); + break; + } + default: + ASSERT_NOT_REACHED(); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h new file mode 100644 index 0000000..348d04f --- /dev/null +++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h @@ -0,0 +1,109 @@ +/* + * 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 DrawingAreaProxyUpdateChunk_h +#define DrawingAreaProxyUpdateChunk_h + +#include "DrawingAreaProxy.h" +#include <WebCore/IntSize.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class WKView; +#else +class WKView; +#endif +#elif PLATFORM(QT) +#include <QImage> +class QGraphicsWKView; +#endif + +namespace WebKit { + +class UpdateChunk; +class WebPageProxy; + +#if PLATFORM(MAC) +typedef WKView PlatformWebView; +#elif PLATFORM(WIN) +class WebView; +typedef WebView PlatformWebView; +#elif PLATFORM(QT) +typedef QGraphicsWKView PlatformWebView; +#endif + +class ChunkedUpdateDrawingAreaProxy : public DrawingAreaProxy { +public: + static PassOwnPtr<ChunkedUpdateDrawingAreaProxy> create(PlatformWebView*, WebPageProxy*); + + virtual ~ChunkedUpdateDrawingAreaProxy(); + +private: + ChunkedUpdateDrawingAreaProxy(PlatformWebView*, WebPageProxy*); + + WebPageProxy* page(); + + // DrawingAreaProxy + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext); + virtual void sizeDidChange(); + virtual void setPageIsVisible(bool isVisible); + + void ensureBackingStore(); + void invalidateBackingStore(); + bool platformPaint(const WebCore::IntRect&, PlatformDrawingContext); + void drawUpdateChunkIntoBackingStore(UpdateChunk*); + void didSetSize(UpdateChunk*); + void update(UpdateChunk*); + + void sendSetSize(); + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext(uint32_t) { } + virtual void detachCompositingContext() { } +#endif + + bool m_isWaitingForDidSetFrameNotification; + bool m_isVisible; + bool m_forceRepaintWhenResumingPainting; + +#if PLATFORM(MAC) + // BackingStore + RetainPtr<CGContextRef> m_bitmapContext; +#elif PLATFORM(WIN) + // BackingStore + OwnPtr<HDC> m_backingStoreDC; + OwnPtr<HBITMAP> m_backingStoreBitmap; +#elif PLATFORM(QT) + QImage m_backingStoreImage; +#endif + + PlatformWebView* m_webView; +}; + +} // namespace WebKit + +#endif // DrawingAreaProxyUpdateChunk_h diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp new file mode 100644 index 0000000..fcc4a75 --- /dev/null +++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DownloadProxy.h" + +#include "DataReference.h" +#include "WebContext.h" +#include "WebData.h" +#include "WebProcessMessages.h" +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +static uint64_t generateDownloadID() +{ + static uint64_t uniqueDownloadID = 0; + return ++uniqueDownloadID; +} + +PassRefPtr<DownloadProxy> DownloadProxy::create(WebContext* webContext) +{ + return adoptRef(new DownloadProxy(webContext)); +} + +DownloadProxy::DownloadProxy(WebContext* webContext) + : m_webContext(webContext) + , m_downloadID(generateDownloadID()) +{ +} + +DownloadProxy::~DownloadProxy() +{ + ASSERT(!m_webContext); +} + +void DownloadProxy::cancel() +{ + if (!m_webContext) + return; + + m_webContext->process()->send(Messages::WebProcess::CancelDownload(m_downloadID), 0); +} + +void DownloadProxy::invalidate() +{ + ASSERT(m_webContext); + m_webContext = 0; +} + +void DownloadProxy::processDidClose() +{ + if (!m_webContext) + return; + + m_webContext->downloadClient().processDidCrash(m_webContext, this); +} + +void DownloadProxy::didStart(const ResourceRequest& request) +{ + m_request = request; + + if (!m_webContext) + return; + + m_webContext->downloadClient().didStart(m_webContext, this); +} + +void DownloadProxy::didReceiveResponse(const ResourceResponse& response) +{ + if (!m_webContext) + return; + + m_webContext->downloadClient().didReceiveResponse(m_webContext, this, response); +} + +void DownloadProxy::didReceiveData(uint64_t length) +{ + if (!m_webContext) + return; + + m_webContext->downloadClient().didReceiveData(m_webContext, this, length); +} + +void DownloadProxy::shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result) +{ + if (!m_webContext) + return; + + result = m_webContext->downloadClient().shouldDecodeSourceDataOfMIMEType(m_webContext, this, mimeType); +} + +void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle) +{ + if (!m_webContext) + return; + + destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename, allowOverwrite); + + if (!destination.isNull()) + SandboxExtension::createHandle(destination, SandboxExtension::WriteOnly, sandboxExtensionHandle); +} + +void DownloadProxy::didCreateDestination(const String& path) +{ + if (!m_webContext) + return; + + m_webContext->downloadClient().didCreateDestination(m_webContext, this, path); +} + +void DownloadProxy::didFinish() +{ + if (!m_webContext) + return; + + m_webContext->downloadClient().didFinish(m_webContext, this); + + // This can cause the DownloadProxy object to be deleted. + m_webContext->downloadFinished(this); +} + +static PassRefPtr<WebData> createWebData(const CoreIPC::DataReference& data) +{ + if (data.isEmpty()) + return 0; + + return WebData::create(data.data(), data.size()); +} + +void DownloadProxy::didFail(const ResourceError& error, const CoreIPC::DataReference& resumeData) +{ + if (!m_webContext) + return; + + m_resumeData = createWebData(resumeData); + + m_webContext->downloadClient().didFail(m_webContext, this, error); + + // This can cause the DownloadProxy object to be deleted. + m_webContext->downloadFinished(this); +} + +void DownloadProxy::didCancel(const CoreIPC::DataReference& resumeData) +{ + m_resumeData = createWebData(resumeData); + + m_webContext->downloadClient().didCancel(m_webContext, this); + + // This can cause the DownloadProxy object to be deleted. + m_webContext->downloadFinished(this); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h new file mode 100644 index 0000000..a155d72 --- /dev/null +++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h @@ -0,0 +1,90 @@ +/* + * 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 DownloadProxy_h +#define DownloadProxy_h + +#include "APIObject.h" +#include "Connection.h" +#include "SandboxExtension.h" +#include <WebCore/ResourceRequest.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + class ResourceError; + class ResourceResponse; +} + +namespace WebKit { + +class WebContext; +class WebData; + +class DownloadProxy : public APIObject { +public: + static const Type APIType = TypeDownload; + + static PassRefPtr<DownloadProxy> create(WebContext*); + ~DownloadProxy(); + + uint64_t downloadID() const { return m_downloadID; } + const WebCore::ResourceRequest& request() const { return m_request; } + WebData* resumeData() const { return m_resumeData.get(); } + + void cancel(); + + void invalidate(); + void processDidClose(); + + void didReceiveDownloadProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncDownloadProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + +private: + explicit DownloadProxy(WebContext*); + + virtual Type type() const { return APIType; } + + // Message handlers. + void didStart(const WebCore::ResourceRequest&); + void didReceiveResponse(const WebCore::ResourceResponse&); + void didReceiveData(uint64_t length); + void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result); + void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle); + void didCreateDestination(const String& path); + void didFinish(); + void didFail(const WebCore::ResourceError&, const CoreIPC::DataReference& resumeData); + void didCancel(const CoreIPC::DataReference& resumeData); + + WebContext* m_webContext; + uint64_t m_downloadID; + + RefPtr<WebData> m_resumeData; + WebCore::ResourceRequest m_request; +}; + +} // namespace WebKit + +#endif // DownloadProxy_h diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in new file mode 100644 index 0000000..999080b --- /dev/null +++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in @@ -0,0 +1,33 @@ +# 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. + +messages -> DownloadProxy { + DidStart(WebCore::ResourceRequest request) + DidReceiveResponse(WebCore::ResourceResponse response) + DidReceiveData(uint64_t length) + ShouldDecodeSourceDataOfMIMEType(String mimeType) -> (bool result) + DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite, WebKit::SandboxExtension::Handle sandboxExtensionHandle) + DidCreateDestination(WTF::String path) + DidFinish() + DidFail(WebCore::ResourceError error, CoreIPC::DataReference resumeData) + DidCancel(CoreIPC::DataReference resumeData) +} diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp new file mode 100644 index 0000000..fa16641 --- /dev/null +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DrawingAreaProxy.h" + +#include "WebPageProxy.h" + +using namespace WebCore; + +namespace WebKit { + +DrawingAreaProxy::DrawingAreaProxy(DrawingAreaInfo::Type type, WebPageProxy* webPageProxy) + : m_info(type, nextIdentifier()) + , m_webPageProxy(webPageProxy) + , m_size(webPageProxy->viewSize()) +{ +} + +DrawingAreaProxy::~DrawingAreaProxy() +{ +} + +DrawingAreaInfo::Identifier DrawingAreaProxy::nextIdentifier() +{ + static DrawingAreaInfo::Identifier nextID = 1; + return ++nextID; +} + +void DrawingAreaProxy::setSize(const IntSize& size) +{ + if (m_size == size) + return; + + m_size = size; + sizeDidChange(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h new file mode 100644 index 0000000..a58a0d9 --- /dev/null +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -0,0 +1,97 @@ +/* + * 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 DrawingAreaProxy_h +#define DrawingAreaProxy_h + +#include "DrawingAreaInfo.h" +#include <WebCore/IntSize.h> + +#if PLATFORM(QT) +class QPainter; +#endif + +namespace WebKit { + +class WebPageProxy; +struct UpdateInfo; + +#if PLATFORM(MAC) +typedef CGContextRef PlatformDrawingContext; +#elif PLATFORM(WIN) +typedef HDC PlatformDrawingContext; +#elif PLATFORM(QT) +typedef QPainter* PlatformDrawingContext; +#endif + +class DrawingAreaProxy { + WTF_MAKE_NONCOPYABLE(DrawingAreaProxy); + +public: + static DrawingAreaInfo::Identifier nextIdentifier(); + + virtual ~DrawingAreaProxy(); + +#ifdef __APPLE__ + void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); +#endif + + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0; + virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*) { ASSERT_NOT_REACHED(); } + + // Returns true if painting was successful, false otherwise. + virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0; + + virtual void sizeDidChange() = 0; + virtual void setPageIsVisible(bool isVisible) = 0; + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext(uint32_t contextID) = 0; + virtual void detachCompositingContext() = 0; +#endif + + const DrawingAreaInfo& info() const { return m_info; } + + const WebCore::IntSize& size() const { return m_size; } + void setSize(const WebCore::IntSize&); + +protected: + explicit DrawingAreaProxy(DrawingAreaInfo::Type, WebPageProxy*); + + DrawingAreaInfo m_info; + WebPageProxy* m_webPageProxy; + + WebCore::IntSize m_size; + +private: + // CoreIPC message handlers. + // FIXME: These should be pure virtual. + virtual void update(const UpdateInfo&) { } + virtual void didSetSize() { } +}; + +} // namespace WebKit + +#endif // DrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in new file mode 100644 index 0000000..7e340d4 --- /dev/null +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -0,0 +1,26 @@ +# 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 +# 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. + +messages -> DrawingAreaProxy { + Update(WebKit::UpdateInfo updateInfo) + DidSetSize() +} diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp new file mode 100644 index 0000000..02b0dd2 --- /dev/null +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp @@ -0,0 +1,137 @@ +/* + * 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 "DrawingAreaProxyImpl.h" + +#include "DrawingAreaMessages.h" +#include "UpdateInfo.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +#ifndef __APPLE__ +#error "This drawing area is not ready for use by other ports yet." +#endif + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webPageProxy) +{ + return adoptPtr(new DrawingAreaProxyImpl(webPageProxy)); +} + +DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy) + : DrawingAreaProxy(DrawingAreaInfo::Impl, webPageProxy) +{ +} + +DrawingAreaProxyImpl::~DrawingAreaProxyImpl() +{ +} + +void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect) +{ + if (!m_backingStore) + return; + + m_backingStore->paint(context, rect); +} + +void DrawingAreaProxyImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) +{ + ASSERT_NOT_REACHED(); +} + +void DrawingAreaProxyImpl::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*) +{ + ASSERT_NOT_REACHED(); +} + +bool DrawingAreaProxyImpl::paint(const WebCore::IntRect&, PlatformDrawingContext) +{ + ASSERT_NOT_REACHED(); + return false; +} + +void DrawingAreaProxyImpl::sizeDidChange() +{ + sendSetSize(); +} + +void DrawingAreaProxyImpl::setPageIsVisible(bool pageIsVisible) +{ + // FIXME: Implement. +} + +void DrawingAreaProxyImpl::attachCompositingContext(uint32_t contextID) +{ + ASSERT_NOT_REACHED(); +} + +void DrawingAreaProxyImpl::detachCompositingContext() +{ + ASSERT_NOT_REACHED(); +} + +void DrawingAreaProxyImpl::update(const UpdateInfo& updateInfo) +{ + // FIXME: Handle the case where the view is hidden. + + incorporateUpdate(updateInfo); + m_webPageProxy->process()->send(Messages::DrawingArea::DidUpdate(), m_webPageProxy->pageID()); +} + +void DrawingAreaProxyImpl::didSetSize() +{ +} + +void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo) +{ + // FIXME: Check for the update bounds being empty here. + + if (!m_backingStore) + m_backingStore = BackingStore::create(updateInfo.viewSize); + + m_backingStore->incorporateUpdate(updateInfo); + + for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) + m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]); + + if (!updateInfo.scrollRect.isEmpty()) { + m_webPageProxy->setViewNeedsDisplay(updateInfo.scrollRect); + m_webPageProxy->displayView(); + } +} + +void DrawingAreaProxyImpl::sendSetSize() +{ + if (!m_webPageProxy->isValid()) + return; + + m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size), m_webPageProxy->pageID()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h new file mode 100644 index 0000000..0de7ada --- /dev/null +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h @@ -0,0 +1,65 @@ +/* + * 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 DrawingAreaProxyImpl_h +#define DrawingAreaProxyImpl_h + +#include "BackingStore.h" +#include "DrawingAreaProxy.h" + +namespace WebKit { + +class DrawingAreaProxyImpl : public DrawingAreaProxy { +public: + static PassOwnPtr<DrawingAreaProxyImpl> create(WebPageProxy*); + virtual ~DrawingAreaProxyImpl(); + + void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&); + +private: + explicit DrawingAreaProxyImpl(WebPageProxy*); + + // DrawingAreaProxy + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext); + virtual void sizeDidChange(); + virtual void setPageIsVisible(bool); + virtual void attachCompositingContext(uint32_t contextID); + virtual void detachCompositingContext(); + + // CoreIPC message handlers + virtual void update(const UpdateInfo&); + virtual void didSetSize(); + + void incorporateUpdate(const UpdateInfo&); + void sendSetSize(); + + OwnPtr<BackingStore> m_backingStore; +}; + +} // namespace WebKit + +#endif // DrawingAreaProxyImpl_h diff --git a/Source/WebKit2/UIProcess/FindIndicator.cpp b/Source/WebKit2/UIProcess/FindIndicator.cpp new file mode 100644 index 0000000..f1357e7 --- /dev/null +++ b/Source/WebKit2/UIProcess/FindIndicator.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "FindIndicator.h" + +#include "ShareableBitmap.h" +#include <WebCore/Gradient.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/IntRect.h> +#include <WebCore/Path.h> + +using namespace WebCore; + +static const float cornerRadius = 3.0; + +static const float shadowOffsetX = 0.0; +static const float shadowOffsetY = 1.0; +static const float shadowBlurRadius = 3.0; + +static const int shadowRed = 0; +static const int shadowGreen = 0; +static const int shadowBlue = 0; +static const int shadowAlpha = 204; + +static const float lightBorderThickness = 1.0; +static const float horizontalPaddingInsideLightBorder = 3.0; +static const float verticalPaddingInsideLightBorder = 1.0; + +static const float horizontalBorderInsideShadow = lightBorderThickness + horizontalPaddingInsideLightBorder; +static const float verticalBorderInsideShadow = lightBorderThickness + verticalPaddingInsideLightBorder; + +static const float leftBorderThickness = horizontalBorderInsideShadow + shadowOffsetX + shadowBlurRadius / 2.0; +static const float topBorderThickness = verticalBorderInsideShadow - shadowOffsetY + shadowBlurRadius / 2.0; +static const float rightBorderThickness = horizontalBorderInsideShadow - shadowOffsetX + shadowBlurRadius / 2.0; +static const float bottomBorderThickness = verticalBorderInsideShadow + shadowOffsetY + shadowBlurRadius / 2.0; + +static const float horizontalOutsetToCenterOfLightBorder = horizontalBorderInsideShadow - lightBorderThickness / 2.0; +static const float verticalOutsetToCenterOfLightBorder = verticalBorderInsideShadow - lightBorderThickness / 2.0; + +static const int lightBorderRed = 245; +static const int lightBorderGreen = 230; +static const int lightBorderBlue = 0; +static const int lightBorderAlpha = 255; + +static const int gradientDarkRed = 237; +static const int gradientDarkGreen = 204; +static const int gradientDarkBlue = 0; +static const int gradientDarkAlpha = 255; + +static const int gradientLightRed = 242; +static const int gradientLightGreen = 239; +static const int gradientLightBlue = 0; +static const int gradientLightAlpha = 255; + +namespace WebKit { + +PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle) +{ + RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRect).size(), contentImageHandle); + if (!contentImage) + return 0; + + return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release())); +} + +FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage) + : m_selectionRect(selectionRect) + , m_textRects(textRects) + , m_contentImage(contentImage) +{ +} + +FindIndicator::~FindIndicator() +{ +} + +static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflateY) +{ + FloatRect inflatedRect = rect; + inflatedRect.inflateX(inflateX); + inflatedRect.inflateY(inflateY); + + return inflatedRect; +} + +FloatRect FindIndicator::frameRect() const +{ + return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness, + m_selectionRect.width() + rightBorderThickness + leftBorderThickness, + m_selectionRect.height() + topBorderThickness + bottomBorderThickness); +} + +static Color lightBorderColor() +{ + return Color(lightBorderRed, lightBorderGreen, lightBorderBlue, lightBorderAlpha); +} + +static Color shadowColor() +{ + return Color(shadowRed, shadowGreen, shadowBlue, shadowAlpha); +} + +static Color gradientLightColor() +{ + return Color(gradientLightRed, gradientLightGreen, gradientLightBlue, gradientLightAlpha); +} + +static Color gradientDarkColor() +{ + return Color(gradientDarkRed, gradientDarkGreen, gradientDarkBlue, gradientDarkAlpha); +} + +static Path pathWithRoundedRect(const FloatRect& pathRect, float radius) +{ + Path path; + path.addRoundedRect(pathRect, FloatSize(radius, radius)); + + return path; +} + +void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect) +{ + for (size_t i = 0; i < m_textRects.size(); ++i) { + FloatRect textRect = m_textRects[i]; + textRect.move(leftBorderThickness, topBorderThickness); + + graphicsContext.save(); + FloatRect outerPathRect = inflateRect(textRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder); + graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB); + graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB); + graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius)); + graphicsContext.restore(); + + 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())); + gradient->addColorStop(0, gradientLightColor()); + gradient->addColorStop(1, gradientDarkColor()); + graphicsContext.setFillGradient(gradient); + graphicsContext.fillRect(outerPathRect); + graphicsContext.restore(); + + graphicsContext.save(); + graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness))); + m_contentImage->paint(graphicsContext, IntPoint(0, 0), m_contentImage->bounds()); + graphicsContext.restore(); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/FindIndicator.h b/Source/WebKit2/UIProcess/FindIndicator.h new file mode 100644 index 0000000..997d537 --- /dev/null +++ b/Source/WebKit2/UIProcess/FindIndicator.h @@ -0,0 +1,66 @@ +/* + * 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 FindIndicator_h +#define FindIndicator_h + +#include "SharedMemory.h" +#include <WebCore/FloatRect.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + class GraphicsContext; +} + +namespace WebKit { + +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); + ~FindIndicator(); + + WebCore::FloatRect frameRect() const; + + const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; } + + ShareableBitmap* contentImage() const { return m_contentImage.get(); } + + void draw(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); + +private: + FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage); + + WebCore::FloatRect m_selectionRect; + Vector<WebCore::FloatRect> m_textRects; + RefPtr<ShareableBitmap> m_contentImage; +}; + +} // namespace WebKit + +#endif // FindIndicator_h diff --git a/Source/WebKit2/UIProcess/GenericCallback.h b/Source/WebKit2/UIProcess/GenericCallback.h new file mode 100644 index 0000000..b72314a --- /dev/null +++ b/Source/WebKit2/UIProcess/GenericCallback.h @@ -0,0 +1,105 @@ +/* + * 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 GenericCallback_h +#define GenericCallback_h + +#include "WKAPICast.h" + +#include "WebError.h" +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +template<typename APIReturnValueType, typename InternalReturnValueType = typename APITypeInfo<APIReturnValueType>::ImplType> +class GenericCallback : public RefCounted<GenericCallback<APIReturnValueType, InternalReturnValueType> > { +public: + typedef void (*CallbackFunction)(APIReturnValueType, WKErrorRef, void*); + + static PassRefPtr<GenericCallback> create(void* context, CallbackFunction callback) + { + return adoptRef(new GenericCallback(context, callback)); + } + + ~GenericCallback() + { + ASSERT(!m_callback); + } + + void performCallbackWithReturnValue(InternalReturnValueType returnValue) + { + ASSERT(m_callback); + + m_callback(toAPI(returnValue), 0, m_context); + + m_callback = 0; + } + + void invalidate() + { + ASSERT(m_callback); + + RefPtr<WebError> error = WebError::create(); + m_callback(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++; + } + + GenericCallback(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 T> +void invalidateCallbackMap(HashMap<uint64_t, T>& map) +{ + Vector<T> callbacksVector; + copyValuesToVector(map, callbacksVector); + for (size_t i = 0, size = callbacksVector.size(); i < size; ++i) + callbacksVector[i]->invalidate(); + map.clear(); +} + +} // namespace WebKit + +#endif // GenericCallback_h diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp new file mode 100644 index 0000000..285e329 --- /dev/null +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "GeolocationPermissionRequestManagerProxy.h" + +#include "WebPageMessages.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +namespace WebKit { + +GeolocationPermissionRequestManagerProxy::GeolocationPermissionRequestManagerProxy(WebPageProxy* page) + : m_page(page) +{ +} + +void GeolocationPermissionRequestManagerProxy::invalidateRequests() +{ + PendingRequestMap::const_iterator it = m_pendingRequests.begin(); + PendingRequestMap::const_iterator end = m_pendingRequests.end(); + for (; it != end; ++it) + it->second->invalidate(); + + m_pendingRequests.clear(); +} + +PassRefPtr<GeolocationPermissionRequestProxy> GeolocationPermissionRequestManagerProxy::createRequest(uint64_t geolocationID) +{ + RefPtr<GeolocationPermissionRequestProxy> request = GeolocationPermissionRequestProxy::create(this, geolocationID); + m_pendingRequests.add(geolocationID, request.get()); + return request.release(); +} + +void GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) +{ + if (!m_page->isValid()) + return; + + PendingRequestMap::iterator it = m_pendingRequests.find(geolocationID); + if (it == m_pendingRequests.end()) + return; + + m_page->process()->send(Messages::WebPage::DidReceiveGeolocationPermissionDecision(geolocationID, allowed), m_page->pageID()); + m_pendingRequests.remove(it); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.h new file mode 100644 index 0000000..98885bf --- /dev/null +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.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 GeolocationPermissionRequestManagerProxy_h +#define GeolocationPermissionRequestManagerProxy_h + +#include "GeolocationPermissionRequestProxy.h" +#include <wtf/HashMap.h> + +namespace WebKit { + +class WebPageProxy; + +class GeolocationPermissionRequestManagerProxy { +public: + explicit GeolocationPermissionRequestManagerProxy(WebPageProxy*); + + void invalidateRequests(); + + // Create a request to be presented to the user. + PassRefPtr<GeolocationPermissionRequestProxy> createRequest(uint64_t geolocationID); + + // Called by GeolocationPermissionRequestProxy when a decision is made by the user. + void didReceiveGeolocationPermissionDecision(uint64_t, bool allow); + +private: + typedef HashMap<uint64_t, RefPtr<GeolocationPermissionRequestProxy> > PendingRequestMap; + PendingRequestMap m_pendingRequests; + WebPageProxy* m_page; +}; + +} // namespace WebKit + +#endif // GeolocationPermissionRequestManagerProxy_h diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp new file mode 100644 index 0000000..9766ad2 --- /dev/null +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.cpp @@ -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. + */ + +#include "GeolocationPermissionRequestProxy.h" + +#include "GeolocationPermissionRequestManagerProxy.h" + +namespace WebKit { + +GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy(GeolocationPermissionRequestManagerProxy* manager, uint64_t geolocationID) + : m_manager(manager) + , m_geolocationID(geolocationID) +{ +} + +void GeolocationPermissionRequestProxy::allow() +{ + if (!m_manager) + return; + + m_manager->didReceiveGeolocationPermissionDecision(m_geolocationID, true); + m_manager = 0; +} + +void GeolocationPermissionRequestProxy::deny() +{ + if (!m_manager) + return; + + m_manager->didReceiveGeolocationPermissionDecision(m_geolocationID, false); + m_manager = 0; +} + +void GeolocationPermissionRequestProxy::invalidate() +{ + m_manager = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.h new file mode 100644 index 0000000..c34c3fd --- /dev/null +++ b/Source/WebKit2/UIProcess/GeolocationPermissionRequestProxy.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. + */ + +#ifndef GeolocationPermissionRequestProxy_h +#define GeolocationPermissionRequestProxy_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class GeolocationPermissionRequestManagerProxy; + +class GeolocationPermissionRequestProxy : public APIObject { +public: + static const Type APIType = TypeGeolocationPermissionRequest; + + static PassRefPtr<GeolocationPermissionRequestProxy> create(GeolocationPermissionRequestManagerProxy* manager, uint64_t geolocationID) + { + return adoptRef(new GeolocationPermissionRequestProxy(manager, geolocationID)); + } + + void allow(); + void deny(); + + void invalidate(); + +private: + GeolocationPermissionRequestProxy(GeolocationPermissionRequestManagerProxy*, uint64_t geolocationID); + + virtual Type type() const { return APIType; } + + GeolocationPermissionRequestManagerProxy* m_manager; + uint64_t m_geolocationID; +}; + +} // namespace WebKit + +#endif // GeolocationPermissionRequestProxy_h diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp new file mode 100644 index 0000000..507edfa --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ProcessLauncher.h" + +#include "WorkQueue.h" +#include <wtf/StdLibExtras.h> + +namespace WebKit { + +static WorkQueue& processLauncherWorkQueue() +{ + DEFINE_STATIC_LOCAL(WorkQueue, processLauncherWorkQueue, ("com.apple.WebKit.ProcessLauncher")); + return processLauncherWorkQueue; +} + +ProcessLauncher::ProcessLauncher(Client* client, const LaunchOptions& launchOptions) + : m_client(client) + , m_launchOptions(launchOptions) + , m_processIdentifier(0) +{ + // Launch the process. + m_isLaunching = true; + processLauncherWorkQueue().scheduleWork(WorkItem::create(this, &ProcessLauncher::launchProcess)); +} + +void ProcessLauncher::didFinishLaunchingProcess(PlatformProcessIdentifier processIdentifier, CoreIPC::Connection::Identifier identifier) +{ + m_processIdentifier = processIdentifier; + m_isLaunching = false; + + if (!m_client) { + // FIXME: Dispose of the connection identifier. + return; + } + + m_client->didFinishLaunching(this, identifier); +} + +void ProcessLauncher::invalidate() +{ + m_client = 0; + platformInvalidate(); +} + +const char* ProcessLauncher::processTypeAsString(ProcessType processType) +{ + switch (processType) { + case WebProcess: + return "webprocess"; + case PluginProcess: + return "pluginprocess"; + } + + ASSERT_NOT_REACHED(); + return 0; +} + +bool ProcessLauncher::getProcessTypeFromString(const char* string, ProcessType& processType) +{ + if (!strcmp(string, "webprocess")) { + processType = WebProcess; + return true; + } + + if (!strcmp(string, "pluginprocess")) { + processType = PluginProcess; + return true; + } + + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h new file mode 100644 index 0000000..31efd4d --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h @@ -0,0 +1,99 @@ +/* + * 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 WebProcessLauncher_h +#define WebProcessLauncher_h + +#include "Connection.h" +#include "PlatformProcessIdentifier.h" +#include <wtf/RefPtr.h> +#include <wtf/Threading.h> + +#if PLATFORM(QT) +class QLocalSocket; +#endif + +namespace WebKit { + +class ProcessLauncher : public ThreadSafeShared<ProcessLauncher> { +public: + class Client { + public: + virtual ~Client() { } + + virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier) = 0; + }; + + enum ProcessType { + WebProcess, + PluginProcess + }; + + struct LaunchOptions { + ProcessType processType; +#if PLATFORM(MAC) + static const cpu_type_t MatchCurrentArchitecture = 0; + cpu_type_t architecture; +#endif + }; + + static PassRefPtr<ProcessLauncher> create(Client* client, const LaunchOptions& launchOptions) + { + return adoptRef(new ProcessLauncher(client, launchOptions)); + } + + bool isLaunching() const { return m_isLaunching; } + PlatformProcessIdentifier processIdentifier() const { return m_processIdentifier; } + + void terminateProcess(); + void invalidate(); + + static bool getProcessTypeFromString(const char*, ProcessType&); + +#if PLATFORM(QT) + friend class ProcessLauncherHelper; + static QLocalSocket* takePendingConnection(); +#endif + +private: + ProcessLauncher(Client*, const LaunchOptions& launchOptions); + + static const char* processTypeAsString(ProcessType); + + void launchProcess(); + void didFinishLaunchingProcess(PlatformProcessIdentifier, CoreIPC::Connection::Identifier); + + void platformInvalidate(); + + Client* m_client; + + const LaunchOptions m_launchOptions; + bool m_isLaunching; + PlatformProcessIdentifier m_processIdentifier; +}; + +} // namespace WebKit + +#endif // WebProcessLauncher_h diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp new file mode 100644 index 0000000..69e4893 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ThreadLauncher.h" + +#include "RunLoop.h" + +namespace WebKit { + +ThreadLauncher::ThreadLauncher(Client* client) + : m_client(client) +{ + launchThread(); +} + +void ThreadLauncher::launchThread() +{ + m_isLaunching = true; + + CoreIPC::Connection::Identifier connectionIdentifier = createWebThread(); + + // We've finished launching the thread, message back to the main run loop. + RunLoop::main()->scheduleWork(WorkItem::create(this, &ThreadLauncher::didFinishLaunchingThread, connectionIdentifier)); +} + +void ThreadLauncher::didFinishLaunchingThread(CoreIPC::Connection::Identifier identifier) +{ + m_isLaunching = false; + + if (!m_client) { + // FIXME: Dispose of the connection identifier. + return; + } + + m_client->didFinishLaunching(this, identifier); +} + +void ThreadLauncher::invalidate() +{ + m_client = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h new file mode 100644 index 0000000..9c90fbd --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h @@ -0,0 +1,71 @@ +/* + * 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 ThreadLauncher_h +#define ThreadLauncher_h + +#include "Connection.h" +#include "PlatformProcessIdentifier.h" +#include <wtf/RefPtr.h> +#include <wtf/Threading.h> + +#if PLATFORM(QT) +class QLocalSocket; +#endif + +namespace WebKit { + +class ThreadLauncher : public ThreadSafeShared<ThreadLauncher> { +public: + class Client { + public: + virtual ~Client() { } + virtual void didFinishLaunching(ThreadLauncher*, CoreIPC::Connection::Identifier) = 0; + }; + + static PassRefPtr<ThreadLauncher> create(Client* client) + { + return adoptRef(new ThreadLauncher(client)); + } + + bool isLaunching() const { return m_isLaunching; } + + void invalidate(); + +private: + explicit ThreadLauncher(Client*); + + void launchThread(); + void didFinishLaunchingThread(CoreIPC::Connection::Identifier); + + static CoreIPC::Connection::Identifier createWebThread(); + + bool m_isLaunching; + Client* m_client; +}; + +} // namespace WebKit + +#endif // ThreadLauncher_h diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp new file mode 100644 index 0000000..2565a48 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp @@ -0,0 +1,86 @@ +/* + * 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 MOTOROLA 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 MOTOROLA 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 "ProcessLauncher.h" + +#include "Connection.h" +#include "RunLoop.h" +#include <WebCore/FileSystem.h> +#include <WebCore/ResourceHandle.h> +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> +#include <wtf/gobject/GOwnPtr.h> + +using namespace WebCore; + +namespace WebKit { + +const char* gWebKitWebProcessName = "WebKitWebProcess"; + +void ProcessLauncher::launchProcess() +{ + pid_t pid = 0; + + int sockets[2]; + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) { + fprintf(stderr, "Creation of socket failed with errno %d.\n", errno); + ASSERT_NOT_REACHED(); + return; + } + + pid = fork(); + if (!pid) { // child process + close(sockets[1]); + String socket = String::format("%d", sockets[0]); + GOwnPtr<gchar> binaryPath(g_build_filename(applicationDirectoryPath().data(), gWebKitWebProcessName, NULL)); + execl(binaryPath.get(), gWebKitWebProcessName, socket.utf8().data(), NULL); + } else if (pid > 0) { // parent process + close(sockets[0]); + m_processIdentifier = pid; + // We've finished launching the process, message back to the main run loop. + RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, pid, sockets[1])); + } else { + fprintf(stderr, "Unable to fork a new WebProcess with errno: %d.\n", errno); + ASSERT_NOT_REACHED(); + } +} + +void ProcessLauncher::terminateProcess() +{ + if (!m_processIdentifier) + return; + + kill(m_processIdentifier, SIGKILL); +} + +void ProcessLauncher::platformInvalidate() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp new file mode 100644 index 0000000..2841e0a --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ThreadLauncher.h" + +#include "NotImplemented.h" + +namespace WebKit { + +CoreIPC::Connection::Identifier ThreadLauncher::createWebThread() +{ + notImplemented(); + return -1; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm new file mode 100644 index 0000000..c285bae --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "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> + +using namespace WebCore; + +// FIXME: We should be doing this another way. +extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t); + +namespace WebKit { + +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +static const char* processName() +{ + return [[[NSProcessInfo processInfo] processName] fileSystemRepresentation]; +} +#else +// -[NSProcessInfo processName] isn't thread-safe on Leopard and Snow Leopard so we have our own implementation. +static const char* createProcessName() +{ + uint32_t bufferSize = MAXPATHLEN; + char executablePath[bufferSize]; + + if (_NSGetExecutablePath(executablePath, &bufferSize)) + return ""; + + const char *processName = strrchr(executablePath, '/') + 1; + return strdup(processName); +} + +static const char* processName() +{ + static const char* processName = createProcessName(); + return processName; +} +#endif + +static void setUpTerminationNotificationHandler(pid_t pid) +{ +#if HAVE(DISPATCH_H) + dispatch_source_t processDiedSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, pid, DISPATCH_PROC_EXIT, dispatch_get_current_queue()); + dispatch_source_set_event_handler(processDiedSource, ^{ + int status; + waitpid(dispatch_source_get_handle(processDiedSource), &status, 0); + dispatch_source_cancel(processDiedSource); + }); + dispatch_source_set_cancel_handler(processDiedSource, ^{ + dispatch_release(processDiedSource); + }); + dispatch_resume(processDiedSource); +#endif +} + +class EnvironmentVariables { + WTF_MAKE_NONCOPYABLE(EnvironmentVariables); + +public: + EnvironmentVariables() + : m_environmentPointer(*_NSGetEnviron()) + { + } + + ~EnvironmentVariables() + { + deleteAllValues(m_allocatedStrings); + } + + void set(const char* name, const char* value) + { + // Check if we need to copy the environment. + if (m_environmentPointer == *_NSGetEnviron()) + copyEnvironmentVariables(); + + // Allocate a string for the name and value. + char* nameAndValue = createStringForVariable(name, value); + + for (size_t i = 0; i < m_environmentVariables.size() - 1; ++i) { + char* environmentVariable = m_environmentVariables[i]; + + if (valueIfVariableHasName(environmentVariable, name)) { + // Just replace the environment variable. + m_environmentVariables[i] = nameAndValue; + return; + } + } + + // Append the new string. + ASSERT(!m_environmentVariables.last()); + m_environmentVariables.last() = nameAndValue; + m_environmentVariables.append(static_cast<char*>(0)); + + m_environmentPointer = m_environmentVariables.data(); + } + + char* get(const char* name) const + { + for (size_t i = 0; m_environmentPointer[i]; ++i) { + if (char* value = valueIfVariableHasName(m_environmentPointer[i], name)) + return value; + } + return 0; + } + + // Will append the value with the given separator if the environment variable already exists. + void appendValue(const char* name, const char* value, char separator) + { + char* existingValue = get(name); + if (!existingValue) { + set(name, value); + return; + } + + Vector<char, 128> newValue; + newValue.append(existingValue, strlen(existingValue)); + newValue.append(separator); + newValue.append(value, strlen(value) + 1); + + set(name, newValue.data()); + } + + char** environmentPointer() const { return m_environmentPointer; } + +private: + char *valueIfVariableHasName(const char* environmentVariable, const char* name) const + { + // Find the environment variable name. + char* equalsLocation = strchr(environmentVariable, '='); + ASSERT(equalsLocation); + + size_t nameLength = equalsLocation - environmentVariable; + if (strncmp(environmentVariable, name, nameLength)) + return 0; + + return equalsLocation + 1; + } + + char* createStringForVariable(const char* name, const char* value) + { + int nameLength = strlen(name); + int valueLength = strlen(value); + + // Allocate enough room to hold 'name=value' and the null character. + char* string = static_cast<char*>(fastMalloc(nameLength + 1 + valueLength + 1)); + memcpy(string, name, nameLength); + string[nameLength] = '='; + memcpy(string + nameLength + 1, value, valueLength); + string[nameLength + 1 + valueLength] = '\0'; + + m_allocatedStrings.append(string); + + return string; + } + + void copyEnvironmentVariables() + { + for (size_t i = 0; (*_NSGetEnviron())[i]; i++) + m_environmentVariables.append((*_NSGetEnviron())[i]); + + // Null-terminate the array. + m_environmentVariables.append(static_cast<char*>(0)); + } + + char** m_environmentPointer; + Vector<char*> m_environmentVariables; + + // These allocated strings will be freed in the destructor. + Vector<char*> m_allocatedStrings; +}; + +void ProcessLauncher::launchProcess() +{ + // Create the listening port. + mach_port_t listeningPort; + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); + + // Insert a send right so we can send to it. + mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); + + NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"]; + const char* bundlePath = [[webKit2Bundle executablePath] fileSystemRepresentation]; + + NSString *webProcessAppPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"]; + NSString *webProcessAppExecutablePath = [[NSBundle bundleWithPath:webProcessAppPath] executablePath]; + + // Make a unique, per pid, per process launcher web process service name. + CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8(); + + const char* path = [webProcessAppExecutablePath fileSystemRepresentation]; + const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 }; + + // Register ourselves. + kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0); + ASSERT_UNUSED(kr, kr == KERN_SUCCESS); + + posix_spawnattr_t attr; + posix_spawnattr_init(&attr); + + short flags = 0; + + // We want our process to receive all signals. + sigset_t signalMaskSet; + sigemptyset(&signalMaskSet); + + posix_spawnattr_setsigmask(&attr, &signalMaskSet); + flags |= POSIX_SPAWN_SETSIGMASK; + + // Determine the architecture to use. + cpu_type_t architecture = m_launchOptions.architecture; + if (architecture == LaunchOptions::MatchCurrentArchitecture) + architecture = _NSGetMachExecuteHeader()->cputype; + + cpu_type_t cpuTypes[] = { architecture }; + size_t outCount = 0; + posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount); + + // Start suspended so we can set up the termination notification handler. + flags |= POSIX_SPAWN_START_SUSPENDED; + + posix_spawnattr_setflags(&attr, flags); + + pid_t processIdentifier; + + EnvironmentVariables environmentVariables; + + if (m_launchOptions.processType == ProcessLauncher::PluginProcess) { + // We need to insert the plug-in process shim. + NSString *pluginProcessShimPathNSString = [[webProcessAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"]; + const char *pluginProcessShimPath = [pluginProcessShimPathNSString fileSystemRepresentation]; + + // Make sure that the file exists. + struct stat statBuf; + if (stat(pluginProcessShimPath, &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG) + environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", pluginProcessShimPath, ':'); + } + + int result = posix_spawn(&processIdentifier, path, 0, &attr, (char *const*)args, environmentVariables.environmentPointer()); + + posix_spawnattr_destroy(&attr); + + if (!result) { + // Set up the termination notification handler and then ask the child process to continue. + setUpTerminationNotificationHandler(processIdentifier); + kill(processIdentifier, SIGCONT); + } else { + // We failed to launch. Release the send right. + mach_port_deallocate(mach_task_self(), listeningPort); + + // And the receive right. + mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1); + + listeningPort = MACH_PORT_NULL; + processIdentifier = 0; + } + + // We've finished launching the process, message back to the main run loop. + RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, processIdentifier, listeningPort)); +} + +void ProcessLauncher::terminateProcess() +{ + if (!m_processIdentifier) + return; + + kill(m_processIdentifier, SIGKILL); +} + +void ProcessLauncher::platformInvalidate() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm new file mode 100644 index 0000000..8aac275 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ThreadLauncher.h" + +#include "RunLoop.h" +#include "WebProcess.h" +#include "WebSystemInterface.h" +#include <runtime/InitializeThreading.h> +#include <wtf/Threading.h> + +namespace WebKit { + +static void* webThreadBody(void* context) +{ + mach_port_t serverPort = static_cast<mach_port_t>(reinterpret_cast<uintptr_t>(context)); + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + InitWebCoreSystemInterface(); + JSC::initializeThreading(); + WTF::initializeMainThread(); + + WebProcess::shared().initialize(serverPort, RunLoop::current()); + + [pool drain]; + + RunLoop::current()->run(); + + return 0; +} + +CoreIPC::Connection::Identifier ThreadLauncher::createWebThread() +{ + // Create the service port. + mach_port_t listeningPort; + mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); + + // Insert a send right so we can send to it. + mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); + + if (!createThread(webThreadBody, reinterpret_cast<void*>(listeningPort), "WebKit2: WebThread")) { + mach_port_destroy(mach_task_self(), listeningPort); + return MACH_PORT_NULL; + } + + return listeningPort; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp new file mode 100644 index 0000000..7dff894 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp @@ -0,0 +1,223 @@ +/* + * 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 "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> +#include <QLocalServer> +#include <QMetaType> +#include <QProcess> +#include <QString> + +#include <QtCore/qglobal.h> + +#include <sys/resource.h> +#include <unistd.h> + +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 +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); +}; + +void QtWebProcess::processStateChanged(QProcess::ProcessState state) +{ + QProcess* process = qobject_cast<QProcess*>(sender()); + if (!process) + return; + + if (state == QProcess::Running) + processes()->add(process); + else if (state == QProcess::NotRunning) + processes()->remove(process); +} + +void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher) +{ + QString applicationPath = "%1 %2"; + + if (QFile::exists(QCoreApplication::applicationDirPath() + "/QtWebProcess")) { + applicationPath = applicationPath.arg(QCoreApplication::applicationDirPath() + "/QtWebProcess"); + } else { + applicationPath = applicationPath.arg("QtWebProcess"); + } + + QString program(applicationPath.arg(m_server.serverName())); + + QProcess* webProcess = new QtWebProcess(); + webProcess->setProcessChannelMode(QProcess::ForwardedChannels); + webProcess->start(program); + + if (!webProcess->waitForStarted()) { + qDebug() << "Failed to start" << program; + ASSERT_NOT_REACHED(); + delete webProcess; + return; + } + + 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); +} + +void ProcessLauncher::terminateProcess() +{ + if (!m_processIdentifier) + return; + + QObject::connect(m_processIdentifier, SIGNAL(finished(int)), m_processIdentifier, SLOT(deleteLater()), Qt::QueuedConnection); + m_processIdentifier->terminate(); +} + +QLocalSocket* ProcessLauncher::takePendingConnection() +{ + return ProcessLauncherHelper::instance()->takePendingConnection(); +} + +void ProcessLauncher::platformInvalidate() +{ + notImplemented(); +} + +} // namespace WebKit + +#include "ProcessLauncherQt.moc" diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp new file mode 100644 index 0000000..471a424 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp @@ -0,0 +1,77 @@ +/* + * 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 "ThreadLauncher.h" + +#include "RunLoop.h" +#include "WebProcess.h" +#include <runtime/InitializeThreading.h> +#include <wtf/Threading.h> + +#include <QApplication> +#include <QDebug> +#include <QFile> +#include <QLocalServer> +#include <QProcess> + +#include <QtCore/qglobal.h> + +#include <sys/resource.h> +#include <unistd.h> + +using namespace WebCore; + +namespace WebKit { + +static void* webThreadBody(void* /* context */) +{ + // Initialization + JSC::initializeThreading(); + WTF::initializeMainThread(); + + // FIXME: We do not support threaded mode for now. + + WebProcess::shared().initialize("foo", RunLoop::current()); + RunLoop::run(); + + return 0; +} + +CoreIPC::Connection::Identifier ThreadLauncher::createWebThread() +{ + srandom(time(0)); + int connectionIdentifier = random(); + + if (!createThread(webThreadBody, reinterpret_cast<void*>(connectionIdentifier), "WebKit2: WebThread")) { + qWarning() << "failed starting thread"; + return 0; + } + + QString serverIdentifier = QString::number(connectionIdentifier); + return serverIdentifier; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp new file mode 100644 index 0000000..7165a18 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ProcessLauncher.h" + +#include "Connection.h" +#include "RunLoop.h" +#include <shlwapi.h> +#include <wtf/text/WTFString.h> + +#ifdef DEBUG_ALL +const LPCWSTR webProcessName = L"WebKit2WebProcess_debug.exe"; +#else +const LPCWSTR webProcessName = L"WebKit2WebProcess.exe"; +#endif + +#ifdef DEBUG_ALL +const LPCWSTR webKitDLLName = L"WebKit_debug.dll"; +#else +const LPCWSTR webKitDLLName = L"WebKit.dll"; +#endif + +namespace WebKit { + +void ProcessLauncher::launchProcess() +{ + // First, create the server and client identifiers. + HANDLE serverIdentifier, clientIdentifier; + if (!CoreIPC::Connection::createServerAndClientIdentifiers(serverIdentifier, clientIdentifier)) { + // FIXME: What should we do here? + ASSERT_NOT_REACHED(); + } + + // Ensure that the child process inherits the client identifier. + ::SetHandleInformation(clientIdentifier, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); + + // To get the full file path to WebKit2WebProcess.exe, we fild the location of WebKit.dll, + // remove the last path component, and then append WebKit2WebProcess(_debug).exe. + HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName); + ASSERT(webKitModule); + if (!webKitModule) + return; + + WCHAR pathStr[MAX_PATH]; + if (!::GetModuleFileNameW(webKitModule, pathStr, WTF_ARRAY_LENGTH(pathStr))) + return; + + ::PathRemoveFileSpecW(pathStr); + if (!::PathAppendW(pathStr, webProcessName)) + return; + + String commandLine(pathStr); + + // FIXME: It would be nice if we could just create a CommandLine object and output a command line vector from it. + Vector<UChar> commandLineVector; + append(commandLineVector, commandLine); + append(commandLineVector, " -type webprocess"); + append(commandLineVector, " -clientIdentifier "); + append(commandLineVector, String::number(reinterpret_cast<uintptr_t>(clientIdentifier))); + commandLineVector.append('\0'); + + STARTUPINFO startupInfo = { 0 }; + startupInfo.cb = sizeof(startupInfo); + PROCESS_INFORMATION processInformation = { 0 }; + BOOL result = ::CreateProcessW(0, commandLineVector.data(), 0, 0, true, 0, 0, 0, &startupInfo, &processInformation); + + // We can now close the client identifier handle. + ::CloseHandle(clientIdentifier); + + if (!result) { + // FIXME: What should we do here? + DWORD error = ::GetLastError(); + ASSERT_NOT_REACHED(); + } + + // Don't leak the thread handle. + ::CloseHandle(processInformation.hThread); + + // We've finished launching the process, message back to the run loop. + RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, processInformation.hProcess, serverIdentifier)); +} + +void ProcessLauncher::terminateProcess() +{ + if (!m_processIdentifier) + return; + + ::TerminateProcess(m_processIdentifier, 0); +} + +void ProcessLauncher::platformInvalidate() +{ + if (!m_processIdentifier) + return; + + ::CloseHandle(m_processIdentifier); + m_processIdentifier = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp new file mode 100644 index 0000000..b8b2f64 --- /dev/null +++ b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ThreadLauncher.h" + +#include "RunLoop.h" +#include "WebProcess.h" +#include <runtime/InitializeThreading.h> +#include <wtf/Threading.h> + +using namespace WebCore; + +namespace WebKit { + +static void* webThreadBody(void* context) +{ + HANDLE clientIdentifier = reinterpret_cast<HANDLE>(context); + + // Initialization + JSC::initializeThreading(); + WTF::initializeMainThread(); + + WebProcess::shared().initialize(clientIdentifier, RunLoop::current()); + RunLoop::run(); + + return 0; +} + +CoreIPC::Connection::Identifier ThreadLauncher::createWebThread() +{ + // First, create the server and client identifiers. + HANDLE serverIdentifier, clientIdentifier; + if (!CoreIPC::Connection::createServerAndClientIdentifiers(serverIdentifier, clientIdentifier)) { + // FIXME: What should we do here? + ASSERT_NOT_REACHED(); + } + + if (!createThread(webThreadBody, reinterpret_cast<void*>(clientIdentifier), "WebKit2: WebThread")) { + ::CloseHandle(serverIdentifier); + ::CloseHandle(clientIdentifier); + return 0; + } + + return serverIdentifier; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp new file mode 100644 index 0000000..ffa91de --- /dev/null +++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp @@ -0,0 +1,171 @@ +/* + * 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. + */ + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerBackedDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "WebCoreArgumentCoders.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<LayerBackedDrawingAreaProxy> LayerBackedDrawingAreaProxy::create(PlatformWebView* webView, WebPageProxy* webPageProxy) +{ + return adoptPtr(new LayerBackedDrawingAreaProxy(webView, webPageProxy)); +} + +LayerBackedDrawingAreaProxy::LayerBackedDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy) + : DrawingAreaProxy(DrawingAreaInfo::LayerBacked, webPageProxy) + , m_isWaitingForDidSetFrameNotification(false) + , m_isVisible(true) + , m_webView(webView) +{ +} + +LayerBackedDrawingAreaProxy::~LayerBackedDrawingAreaProxy() +{ +} + +#if !PLATFORM(WIN) +bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) +{ + return true; +} +#endif + +void LayerBackedDrawingAreaProxy::sizeDidChange() +{ + WebPageProxy* page = this->page(); + if (!page->isValid()) + return; + + if (m_size.isEmpty()) + return; + + m_lastSetViewSize = m_size; + + platformSetSize(); + + if (m_isWaitingForDidSetFrameNotification) + return; + + m_isWaitingForDidSetFrameNotification = true; + + page->process()->responsivenessTimer()->start(); + page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size)); +} + +#if !PLATFORM(MAC) && !PLATFORM(WIN) +void LayerBackedDrawingAreaProxy::platformSetSize() +{ +} +#endif + +void LayerBackedDrawingAreaProxy::setPageIsVisible(bool isVisible) +{ + WebPageProxy* page = this->page(); + + if (isVisible == m_isVisible) + return; + + m_isVisible = isVisible; + if (!page->isValid()) + return; + + 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)); + return; + } + + // The page is now visible. + page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier)); + + // FIXME: We should request a full repaint here if needed. +} + +void LayerBackedDrawingAreaProxy::didSetSize(const IntSize& size) +{ + m_isWaitingForDidSetFrameNotification = false; + + if (size != m_lastSetViewSize) + setSize(m_lastSetViewSize); + + WebPageProxy* page = this->page(); + page->process()->responsivenessTimer()->stop(); +} + +void LayerBackedDrawingAreaProxy::update() +{ + WebPageProxy* page = this->page(); + page->process()->send(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier)); +} + +void LayerBackedDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) { + case DrawingAreaProxyLegacyMessage::Update: { + update(); + break; + } + case DrawingAreaProxyLegacyMessage::DidSetSize: { + IntSize size; + if (!arguments->decode(CoreIPC::Out(size))) + return; + didSetSize(size); + break; + } + default: + ASSERT_NOT_REACHED(); + } +} + +void LayerBackedDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder*) +{ + switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) { +#if USE(ACCELERATED_COMPOSITING) + case DrawingAreaProxyLegacyMessage::AttachCompositingContext: { + uint32_t contextID; + if (!arguments->decode(CoreIPC::Out(contextID))) + return; + attachCompositingContext(contextID); + break; + } +#endif + default: + ASSERT_NOT_REACHED(); + } +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h new file mode 100644 index 0000000..bbaa643 --- /dev/null +++ b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h @@ -0,0 +1,98 @@ +/* + * 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 LayerBackedDrawingAreaProxy_h +#define LayerBackedDrawingAreaProxy_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "DrawingAreaProxy.h" +#include <WebCore/IntSize.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class CALayer; +@class WKView; +#else +class CALayer; +class WKView; +#endif +#endif + +namespace WebKit { + +class WebPageProxy; + +#if PLATFORM(MAC) +typedef WKView PlatformWebView; +#elif PLATFORM(WIN) +class WebView; +typedef WebView PlatformWebView; +#endif + +class LayerBackedDrawingAreaProxy : public DrawingAreaProxy { +public: + static PassOwnPtr<LayerBackedDrawingAreaProxy> create(PlatformWebView*, WebPageProxy*); + virtual ~LayerBackedDrawingAreaProxy(); + +private: + LayerBackedDrawingAreaProxy(PlatformWebView*, WebPageProxy*); + + WebPageProxy* page(); + + // DrawingAreaProxy + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext); + virtual void sizeDidChange(); + virtual void setPageIsVisible(bool isVisible); + + virtual void attachCompositingContext(uint32_t contextID); + virtual void detachCompositingContext(); + + void didSetSize(const WebCore::IntSize&); + void update(); + + void platformSetSize(); + + bool m_isWaitingForDidSetFrameNotification; + bool m_isVisible; + + WebCore::IntSize m_lastSetViewSize; + +#if PLATFORM(MAC) + RetainPtr<CALayer> m_compositingRootLayer; +#endif + + PlatformWebView* m_webView; +}; + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // LayerBackedDrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h new file mode 100644 index 0000000..5767b3c --- /dev/null +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -0,0 +1,135 @@ +/* + * 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 PageClient_h +#define PageClient_h + +#include "WebPageProxy.h" +#include "WebPopupMenuProxy.h" +#include <wtf/Forward.h> + +namespace WebCore { + class Cursor; + struct ViewportArguments; +} + +namespace WebKit { + +class DrawingAreaProxy; +class FindIndicator; +class NativeWebKeyboardEvent; +class NativeWebKeyboardEvent; +class WebContextMenuProxy; +class WebEditCommandProxy; +class WebPopupMenuProxy; + +class PageClient { +public: + virtual ~PageClient() { } + + // Create a new drawing area proxy for the given page. + virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0; + + // Tell the view to invalidate the given rect. The rect is in view coordinates. + virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0; + + // Tell the view to immediately display its invalid rect. + virtual void displayView() = 0; + + // Return the size of the view the page is associated with. + virtual WebCore::IntSize viewSize() = 0; + + // Return whether the view's containing window is active. + virtual bool isViewWindowActive() = 0; + + // Return whether the view is focused. + virtual bool isViewFocused() = 0; + + // Return whether the view is visible. + virtual bool isViewVisible() = 0; + + // Return whether the view is in a window. + virtual bool isViewInWindow() = 0; + + virtual void processDidCrash() = 0; + virtual void didRelaunchProcess() = 0; + + virtual void takeFocus(bool direction) = 0; + virtual void toolTipChanged(const String&, const String&) = 0; + +#if ENABLE(TILED_BACKING_STORE) + virtual void pageDidRequestScroll(const WebCore::IntSize&) = 0; +#endif +#if PLATFORM(QT) + virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; + virtual void didFindZoomableArea(const WebCore::IntRect&) = 0; +#endif + + virtual void setCursor(const WebCore::Cursor&) = 0; + virtual void setViewportArguments(const WebCore::ViewportArguments&) = 0; + + virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0; + 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 interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&, uint32_t, uint32_t, Vector<WebCore::CompositionUnderline>&) = 0; +#endif +#if PLATFORM(WIN) + virtual void compositionSelectionChanged(bool) = 0; +#endif + virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0; + virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0; + + virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0; + + virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0; + virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0; + + virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0; + +#if USE(ACCELERATED_COMPOSITING) + virtual void pageDidEnterAcceleratedCompositing() = 0; + virtual void pageDidLeaveAcceleratedCompositing() = 0; +#endif + +#if PLATFORM(WIN) + virtual HWND nativeWindow() = 0; +#endif + +#if PLATFORM(MAC) + virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0; +#endif + + // Custom representations. + virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0; + virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0; + virtual double customRepresentationZoomFactor() = 0; + virtual void setCustomRepresentationZoomFactor(double) = 0; +}; + +} // namespace WebKit + +#endif // PageClient_h diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp new file mode 100644 index 0000000..f4fb5ad --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginInfoStore.h" + +#include <WebCore/KURL.h> +#include <WebCore/MIMETypeRegistry.h> +#include <algorithm> +#include <wtf/StdLibExtras.h> + +using namespace std; +using namespace WebCore; + +namespace WebKit { + +PluginInfoStore::PluginInfoStore() + : m_pluginListIsUpToDate(false) +{ +} + +void PluginInfoStore::setAdditionalPluginsDirectories(const Vector<String>& directories) +{ + m_additionalPluginsDirectories = directories; + refresh(); +} + +void PluginInfoStore::refresh() +{ + m_pluginListIsUpToDate = false; +} + +template <typename T, typename U, typename V, typename W> +static void addFromVector(HashSet<T, U, V>& hashSet, const W& vector) +{ + for (size_t i = 0; i < vector.size(); ++i) + hashSet.add(vector[i]); +} + +#if OS(WINDOWS) +typedef HashSet<String, CaseFoldingHash> PathHashSet; +#else +typedef HashSet<String> PathHashSet; +#endif + +void PluginInfoStore::loadPluginsIfNecessary() +{ + if (m_pluginListIsUpToDate) + return; + + m_plugins.clear(); + + PathHashSet uniquePluginPaths; + + // First, load plug-ins from the additional plug-ins directories specified. + for (size_t i = 0; i < m_additionalPluginsDirectories.size(); ++i) + addFromVector(uniquePluginPaths, pluginPathsInDirectory(m_additionalPluginsDirectories[i])); + + // Then load plug-ins from the standard plug-ins directories. + Vector<String> directories = pluginsDirectories(); + for (size_t i = 0; i < directories.size(); ++i) + addFromVector(uniquePluginPaths, pluginPathsInDirectory(directories[i])); + + // Then load plug-ins that are not in the standard plug-ins directories. + addFromVector(uniquePluginPaths, individualPluginPaths()); + + PathHashSet::const_iterator end = uniquePluginPaths.end(); + for (PathHashSet::const_iterator it = uniquePluginPaths.begin(); it != end; ++it) + loadPlugin(*it); + + m_pluginListIsUpToDate = true; +} + +void PluginInfoStore::loadPlugin(const String& pluginPath) +{ + Plugin plugin; + + if (!getPluginInfo(pluginPath, plugin)) + return; + + if (!shouldUsePlugin(plugin)) + return; + + // Add the plug-in. + m_plugins.append(plugin); +} + +void PluginInfoStore::getPlugins(Vector<PluginInfo>& plugins) +{ + loadPluginsIfNecessary(); + + for (size_t i = 0; i < m_plugins.size(); ++i) + plugins.append(m_plugins[i].info); +} + +PluginInfoStore::Plugin PluginInfoStore::findPluginForMIMEType(const String& mimeType) +{ + ASSERT(!mimeType.isNull()); + + for (size_t i = 0; i < m_plugins.size(); ++i) { + const Plugin& plugin = m_plugins[i]; + + for (size_t j = 0; j < plugin.info.mimes.size(); ++j) { + const MimeClassInfo& mimeClassInfo = plugin.info.mimes[j]; + if (mimeClassInfo.type == mimeType) + return plugin; + } + } + + return Plugin(); +} + +PluginInfoStore::Plugin PluginInfoStore::findPluginForExtension(const String& extension, String& mimeType) +{ + ASSERT(!extension.isNull()); + + for (size_t i = 0; i < m_plugins.size(); ++i) { + const Plugin& plugin = m_plugins[i]; + + for (size_t j = 0; j < plugin.info.mimes.size(); ++j) { + const MimeClassInfo& mimeClassInfo = plugin.info.mimes[j]; + + const Vector<String>& extensions = mimeClassInfo.extensions; + + if (find(extensions.begin(), extensions.end(), extension) != extensions.end()) { + // We found a supported extension, set the correct MIME type. + mimeType = mimeClassInfo.type; + return plugin; + } + } + } + + return Plugin(); +} + +static inline String pathExtension(const KURL& url) +{ + String extension; + String filename = url.lastPathComponent(); + if (!filename.endsWith("/")) { + int extensionPos = filename.reverseFind('.'); + if (extensionPos != -1) + extension = filename.substring(extensionPos + 1); + } + + return extension; +} + +#if !PLATFORM(MAC) +String PluginInfoStore::getMIMETypeForExtension(const String& extension) +{ + return MIMETypeRegistry::getMIMETypeForExtension(extension); +} +#endif + +PluginInfoStore::Plugin PluginInfoStore::findPlugin(String& mimeType, const KURL& url) +{ + loadPluginsIfNecessary(); + + // First, check if we can get the plug-in based on its MIME type. + if (!mimeType.isNull()) { + Plugin plugin = findPluginForMIMEType(mimeType); + if (!plugin.path.isNull()) + return plugin; + } + + // Next, check if any plug-ins claim to support the URL extension. + String extension = pathExtension(url).lower(); + if (!extension.isNull() && mimeType.isEmpty()) { + Plugin plugin = findPluginForExtension(extension, mimeType); + if (!plugin.path.isNull()) + return plugin; + + // Finally, try to get the MIME type from the extension in a platform specific manner and use that. + String extensionMimeType = getMIMETypeForExtension(extension); + if (!extensionMimeType.isNull()) { + Plugin plugin = findPluginForMIMEType(extensionMimeType); + if (!plugin.path.isNull()) { + mimeType = extensionMimeType; + return plugin; + } + } + } + + return Plugin(); +} + +PluginInfoStore::Plugin PluginInfoStore::infoForPluginWithPath(const String& pluginPath) +{ + for (size_t i = 0; i < m_plugins.size(); ++i) { + if (m_plugins[i].path == pluginPath) + return m_plugins[i]; + } + + ASSERT_NOT_REACHED(); + return Plugin(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h new file mode 100644 index 0000000..b342203 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h @@ -0,0 +1,94 @@ +/* + * 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 PluginInfoStore_h +#define PluginInfoStore_h + +#include <WebCore/PluginData.h> + +namespace WebCore { + class KURL; +} + +namespace WebKit { + +class PluginInfoStore { +public: + PluginInfoStore(); + + void setAdditionalPluginsDirectories(const Vector<String>&); + + void refresh(); + void getPlugins(Vector<WebCore::PluginInfo>& plugins); + + // Represents a single plug-in. + struct Plugin { + String path; + WebCore::PluginInfo info; +#if PLATFORM(MAC) + cpu_type_t pluginArchitecture; + String bundleIdentifier; + unsigned versionNumber; +#elif PLATFORM(WIN) + uint64_t fileVersion; +#endif + }; + + // Returns the info for a plug-in that can handle the given MIME type. + // If the MIME type is null, the file extension of the given url will be used to infer the + // plug-in type. In that case, mimeType will be filled in with the right MIME type. + Plugin findPlugin(String& mimeType, const WebCore::KURL& url); + + // Returns the info for the plug-in with the given path. + Plugin infoForPluginWithPath(const String& pluginPath); + +private: + + Plugin findPluginForMIMEType(const String& mimeType); + Plugin findPluginForExtension(const String& extension, String& mimeType); + + void loadPluginsIfNecessary(); + void loadPlugin(const String& pluginPath); + + // Platform-specific member functions + + // Returns paths to directories that should be searched for plug-ins (via pluginPathsInDirectory). + static Vector<String> pluginsDirectories(); + // Returns paths to all plug-ins in the specified directory. + static Vector<String> pluginPathsInDirectory(const String& directory); + // Returns paths to individual plug-ins that won't be found via pluginsDirectories/pluginPathsInDirectory. + static Vector<String> individualPluginPaths(); + static bool getPluginInfo(const String& pluginPath, Plugin& plugin); + bool shouldUsePlugin(const Plugin& plugin); + static String getMIMETypeForExtension(const String& extension); + + Vector<String> m_additionalPluginsDirectories; + Vector<Plugin> m_plugins; + bool m_pluginListIsUpToDate; +}; + +} // namespace WebKit + +#endif // PluginInfoStore_h diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp new file mode 100644 index 0000000..ff44e25 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessManager.h" + +#include "PluginInfoStore.h" +#include "PluginProcessProxy.h" +#include "WebContext.h" +#include <wtf/StdLibExtras.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +PluginProcessManager& PluginProcessManager::shared() +{ + DEFINE_STATIC_LOCAL(PluginProcessManager, pluginProcessManager, ()); + return pluginProcessManager; +} + +PluginProcessManager::PluginProcessManager() +{ +} + +void PluginProcessManager::getPluginProcessConnection(const String& pluginPath, WebProcessProxy* webProcessProxy, CoreIPC::ArgumentEncoder* reply) +{ + ASSERT(!pluginPath.isNull()); + + PluginInfoStore::Plugin plugin = webProcessProxy->context()->pluginInfoStore()->infoForPluginWithPath(pluginPath); + + PluginProcessProxy* pluginProcess = 0; + + for (size_t i = 0; i < m_pluginProcesses.size(); ++i) { + if (m_pluginProcesses[i]->pluginInfo().path == plugin.path) { + pluginProcess = m_pluginProcesses[i]; + break; + } + } + + if (!pluginProcess) { + pluginProcess = PluginProcessProxy::create(this, plugin).leakPtr(); + m_pluginProcesses.append(pluginProcess); + } + + pluginProcess->createWebProcessConnection(webProcessProxy, reply); +} + +void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginProcessProxy) +{ + size_t vectorIndex = m_pluginProcesses.find(pluginProcessProxy); + ASSERT(vectorIndex != notFound); + + m_pluginProcesses.remove(vectorIndex); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h new file mode 100644 index 0000000..c265f2e --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -0,0 +1,61 @@ +/* + * 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 PluginProcessManager_h +#define PluginProcessManager_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/Vector.h> + +namespace CoreIPC { + class ArgumentEncoder; +} + +namespace WebKit { + +class PluginProcessProxy; +class WebProcessProxy; + +class PluginProcessManager : Noncopyable { +public: + static PluginProcessManager& shared(); + + void getPluginProcessConnection(const String& pluginPath, WebProcessProxy*, CoreIPC::ArgumentEncoder* reply); + void removePluginProcessProxy(PluginProcessProxy*); + +private: + PluginProcessManager(); + + Vector<PluginProcessProxy*> m_pluginProcesses; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessManager_h diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp new file mode 100644 index 0000000..093a31f --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -0,0 +1,154 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessProxy.h" + +#include "MachPort.h" +#include "PluginProcessCreationParameters.h" +#include "PluginProcessManager.h" +#include "PluginProcessMessages.h" +#include "RunLoop.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcessProxy.h" + +namespace WebKit { + +PassOwnPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginInfoStore::Plugin& pluginInfo) +{ + return adoptPtr(new PluginProcessProxy(PluginProcessManager, pluginInfo)); +} + +PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginInfoStore::Plugin& pluginInfo) + : m_pluginProcessManager(PluginProcessManager) + , m_pluginInfo(pluginInfo) + , m_numPendingConnectionRequests(0) +{ + ProcessLauncher::LaunchOptions launchOptions; + launchOptions.processType = ProcessLauncher::PluginProcess; +#if PLATFORM(MAC) + launchOptions.architecture = pluginInfo.pluginArchitecture; +#endif + + m_processLauncher = ProcessLauncher::create(this, launchOptions); +} + +PluginProcessProxy::~PluginProcessProxy() +{ +} + +// Asks the plug-in process to create a new connection to a web process. The connection identifier will be +// encoded in the given argument encoder and sent back to the connection of the given web process. +void PluginProcessProxy::createWebProcessConnection(WebProcessProxy* webProcessProxy, CoreIPC::ArgumentEncoder* reply) +{ + m_pendingConnectionReplies.append(make_pair(webProcessProxy, reply)); + + if (m_processLauncher->isLaunching()) { + m_numPendingConnectionRequests++; + return; + } + + // Ask the plug-in process to create a connection. + m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0); +} + +void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch() +{ + // The plug-in process must have crashed or exited, send any pending sync replies we might have. + while (!m_pendingConnectionReplies.isEmpty()) { + RefPtr<WebProcessProxy> replyWebProcessProxy = m_pendingConnectionReplies.first().first.release(); + CoreIPC::ArgumentEncoder* reply = m_pendingConnectionReplies.first().second; + m_pendingConnectionReplies.removeFirst(); + + // FIXME: This is Mac specific. + reply->encode(CoreIPC::MachPort(0, MACH_MSG_TYPE_MOVE_SEND)); + replyWebProcessProxy->connection()->sendSyncReply(reply); + } + + // Tell the plug-in process manager to forget about this plug-in process proxy. + m_pluginProcessManager->removePluginProcessProxy(this); + delete this; +} + +void PluginProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceivePluginProcessProxyMessage(connection, messageID, arguments); +} + +void PluginProcessProxy::didClose(CoreIPC::Connection*) +{ + pluginProcessCrashedOrFailedToLaunch(); +} + +void PluginProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +{ +} + +void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) +{ + ASSERT(!m_connection); + + if (!connectionIdentifier) { + pluginProcessCrashedOrFailedToLaunch(); + return; + } + + m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); + m_connection->open(); + + PluginProcessCreationParameters parameters; + + parameters.pluginPath = m_pluginInfo.path; + + platformInitializePluginProcess(parameters); + + // Initialize the plug-in host process. + m_connection->send(Messages::PluginProcess::Initialize(parameters), 0); + + // Send all our pending requests. + for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i) + m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0); + + m_numPendingConnectionRequests = 0; +} + +void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::MachPort& machPort) +{ + ASSERT(!m_pendingConnectionReplies.isEmpty()); + + // Grab the first pending connection reply. + RefPtr<WebProcessProxy> replyWebProcessProxy = m_pendingConnectionReplies.first().first.release(); + CoreIPC::ArgumentEncoder* reply = m_pendingConnectionReplies.first().second; + m_pendingConnectionReplies.removeFirst(); + + // FIXME: This is Mac specific. + reply->encode(CoreIPC::MachPort(machPort.port(), MACH_MSG_TYPE_MOVE_SEND)); + replyWebProcessProxy->connection()->sendSyncReply(reply); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h new file mode 100644 index 0000000..23a6df0 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -0,0 +1,101 @@ +/* + * 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 PluginProcessProxy_h +#define PluginProcessProxy_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include "PluginInfoStore.h" +#include "ProcessLauncher.h" +#include <wtf/Deque.h> + +// FIXME: This is platform specific. +namespace CoreIPC { + class MachPort; +} + +namespace WebKit { + +class PluginProcessManager; +class WebProcessProxy; +struct PluginProcessCreationParameters; + +class PluginProcessProxy : CoreIPC::Connection::Client, ProcessLauncher::Client { +public: + static PassOwnPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginInfoStore::Plugin&); + ~PluginProcessProxy(); + + const PluginInfoStore::Plugin& pluginInfo() const { return m_pluginInfo; } + + // Asks the plug-in process to create a new connection to a web process. The connection identifier will be + // encoded in the given argument encoder and sent back to the connection of the given web process. + void createWebProcessConnection(WebProcessProxy*, CoreIPC::ArgumentEncoder* reply); + +private: + PluginProcessProxy(PluginProcessManager*, const PluginInfoStore::Plugin&); + + void pluginProcessCrashedOrFailedToLaunch(); + + // CoreIPC::Connection::Client + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual void didClose(CoreIPC::Connection*); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + // ProcessLauncher::Client + virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); + + // Message handlers + void didReceivePluginProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didCreateWebProcessConnection(const CoreIPC::MachPort&); + + void platformInitializePluginProcess(PluginProcessCreationParameters& parameters); + + // The plug-in host process manager. + PluginProcessManager* m_pluginProcessManager; + + // Information about the plug-in. + PluginInfoStore::Plugin m_pluginInfo; + + // The connection to the plug-in host process. + RefPtr<CoreIPC::Connection> m_connection; + + // The process launcher for the plug-in host process. + RefPtr<ProcessLauncher> m_processLauncher; + + Deque<std::pair<RefPtr<WebProcessProxy>, CoreIPC::ArgumentEncoder*> > m_pendingConnectionReplies; + + // If createPluginConnection is called while the process is still launching we'll keep count of it and send a bunch of requests + // when the process finishes launching. + unsigned m_numPendingConnectionRequests; + +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessProxy_h diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in new file mode 100644 index 0000000..cbd5abc --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in @@ -0,0 +1,30 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> PluginProcessProxy { + # FIXME: This is platform specific + DidCreateWebProcessConnection(CoreIPC::MachPort connectionIdentifier) +} + +#endif diff --git a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp new file mode 100644 index 0000000..8a6e86c --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "PluginInfoStore.h" + +#include "NotImplemented.h" +#include "PluginDatabase.h" +#include "PluginPackage.h" + +using namespace WebCore; + +namespace WebKit { + +Vector<String> PluginInfoStore::pluginsDirectories() +{ + notImplemented(); + return Vector<String>(); +} + +Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) +{ + notImplemented(); + return Vector<String>(); +} + +Vector<String> PluginInfoStore::individualPluginPaths() +{ + return Vector<String>(); +} + +bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin) +{ + notImplemented(); + return false; +} + +bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin) +{ + notImplemented(); + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm new file mode 100644 index 0000000..b787101 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginInfoStore.h" + +#include "NetscapePluginModule.h" +#include "WebKitSystemInterface.h" +#include <WebCore/WebCoreNSStringExtras.h> +#include <wtf/HashSet.h> +#include <wtf/RetainPtr.h> + +using namespace WebCore; + +namespace WebKit { + +Vector<String> PluginInfoStore::pluginsDirectories() +{ + Vector<String> pluginsDirectories; + + pluginsDirectories.append([NSHomeDirectory() stringByAppendingPathComponent:@"Library/Internet Plug-Ins"]); + pluginsDirectories.append("/Library/Internet Plug-Ins"); + + return pluginsDirectories; +} + +// FIXME: Once the UI process knows the difference between the main thread and the web thread we can drop this and just use +// String::createCFString. +static CFStringRef safeCreateCFString(const String& string) +{ + return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(string.characters()), string.length()); +} + +Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) +{ + Vector<String> pluginPaths; + + RetainPtr<CFStringRef> directoryCFString(AdoptCF, safeCreateCFString(directory)); + + NSArray *filenames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:(NSString *)directoryCFString.get() error:nil]; + for (NSString *filename in filenames) + pluginPaths.append([(NSString *)directoryCFString.get() stringByAppendingPathComponent:filename]); + + return pluginPaths; +} + +Vector<String> PluginInfoStore::individualPluginPaths() +{ + return Vector<String>(); +} + +bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin) +{ + return NetscapePluginModule::getPluginInfo(pluginPath, plugin); +} + +bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin) +{ + for (size_t i = 0; i < m_plugins.size(); ++i) { + const Plugin& loadedPlugin = m_plugins[i]; + + // If a plug-in with the same bundle identifier already exists, we don't want to load it. + if (loadedPlugin.bundleIdentifier == plugin.bundleIdentifier) + return false; + } + + return true; +} + +String PluginInfoStore::getMIMETypeForExtension(const String& extension) +{ + // FIXME: This should just call MIMETypeRegistry::getMIMETypeForExtension and be + // strength reduced into the callsite once we can safely convert String + // to CFStringRef off the main thread. + + RetainPtr<CFStringRef> extensionCFString(AdoptCF, safeCreateCFString(extension)); + return WKGetMIMETypeForExtension((NSString *)extensionCFString.get()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm new file mode 100644 index 0000000..81c8620 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessProxy.h" + +#include "PluginProcessCreationParameters.h" +#include "WebKitSystemInterface.h" + +namespace WebKit { + +void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters) +{ +#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) + mach_port_t renderServerPort = WKInitializeRenderServer(); + if (renderServerPort != MACH_PORT_NULL) + parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND); +#endif +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp new file mode 100644 index 0000000..fc77663 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp @@ -0,0 +1,72 @@ +/* + * 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. + */ + +// Note: this file is only for UNIX. On other platforms we can reuse the native implementation. + +#include "PluginInfoStore.h" + +#include "NetscapePluginModule.h" +#include "PluginDatabase.h" +#include "PluginPackage.h" + +using namespace WebCore; + +namespace WebKit { + +Vector<String> PluginInfoStore::pluginsDirectories() +{ + return PluginDatabase::defaultPluginDirectories(); +} + +Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) +{ + Vector<String> result; + Vector<String> pluginPaths = listDirectory(directory, String("*.so")); + Vector<String>::const_iterator end = pluginPaths.end(); + for (Vector<String>::const_iterator it = pluginPaths.begin(); it != end; ++it) { + if (fileExists(*it)) + result.append(*it); + } + + return result; +} + +Vector<String> PluginInfoStore::individualPluginPaths() +{ + return Vector<String>(); +} + +bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin) +{ + return NetscapePluginModule::getPluginInfo(pluginPath, plugin); +} + +bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin) +{ + // We do not do any black-listing presently. + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp new file mode 100644 index 0000000..485f892 --- /dev/null +++ b/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp @@ -0,0 +1,417 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginInfoStore.h" + +#include "NetscapePluginModule.h" +#include <shlwapi.h> + +using namespace WebCore; + +namespace WebKit { + +static inline Vector<int> parseVersionString(const String& versionString) +{ + Vector<int> version; + + unsigned startPos = 0; + unsigned endPos; + + while (startPos < versionString.length()) { + for (endPos = startPos; endPos < versionString.length(); ++endPos) + if (versionString[endPos] == '.' || versionString[endPos] == '_') + break; + + int versionComponent = versionString.substring(startPos, endPos - startPos).toInt(); + version.append(versionComponent); + + startPos = endPos + 1; + } + + return version; +} + +// This returns whether versionA is higher than versionB +static inline bool compareVersions(const Vector<int>& versionA, const Vector<int>& versionB) +{ + for (unsigned i = 0; i < versionA.size(); i++) { + if (i >= versionB.size()) + return true; + + if (versionA[i] > versionB[i]) + return true; + else if (versionA[i] < versionB[i]) + return false; + } + + // If we come here, the versions are either the same or versionB has an extra component, just return false + return false; +} + +static inline String safariPluginsDirectory() +{ + static String pluginsDirectory; + static bool cachedPluginDirectory = false; + + if (!cachedPluginDirectory) { + cachedPluginDirectory = true; + + WCHAR moduleFileNameStr[MAX_PATH]; + int moduleFileNameLen = ::GetModuleFileNameW(0, moduleFileNameStr, WTF_ARRAY_LENGTH(moduleFileNameStr)); + + if (!moduleFileNameLen || moduleFileNameLen == WTF_ARRAY_LENGTH(moduleFileNameStr)) + return pluginsDirectory; + + if (!::PathRemoveFileSpecW(moduleFileNameStr)) + return pluginsDirectory; + + pluginsDirectory = String(moduleFileNameStr) + "\\Plugins"; + } + + return pluginsDirectory; +} + +static inline void addMozillaPluginDirectories(Vector<String>& directories) +{ + // Enumerate all Mozilla plugin directories in the registry + HKEY key; + LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Mozilla", 0, KEY_READ, &key); + if (result != ERROR_SUCCESS) + return; + + WCHAR name[128]; + FILETIME lastModified; + + // Enumerate subkeys + for (int i = 0;; i++) { + DWORD nameLen = WTF_ARRAY_LENGTH(name); + result = ::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified); + + if (result != ERROR_SUCCESS) + break; + + String extensionsPath = String(name, nameLen) + "\\Extensions"; + HKEY extensionsKey; + + // Try opening the key + result = ::RegOpenKeyExW(key, extensionsPath.charactersWithNullTermination(), 0, KEY_READ, &extensionsKey); + + if (result == ERROR_SUCCESS) { + // Now get the plugins directory + WCHAR pluginsDirectoryStr[MAX_PATH]; + DWORD pluginsDirectorySize = sizeof(pluginsDirectoryStr); + DWORD type; + + result = ::RegQueryValueExW(extensionsKey, L"Plugins", 0, &type, reinterpret_cast<LPBYTE>(&pluginsDirectoryStr), &pluginsDirectorySize); + + if (result == ERROR_SUCCESS && type == REG_SZ) + directories.append(String(pluginsDirectoryStr, pluginsDirectorySize / sizeof(WCHAR) - 1)); + + ::RegCloseKey(extensionsKey); + } + } + + ::RegCloseKey(key); +} + +static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& directories) +{ + // The new WMP Firefox plugin is installed in \PFiles\Plugins if it can't find any Firefox installs + WCHAR pluginDirectoryStr[MAX_PATH + 1]; + DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(L"%SYSTEMDRIVE%\\PFiles\\Plugins", pluginDirectoryStr, WTF_ARRAY_LENGTH(pluginDirectoryStr)); + + if (pluginDirectorySize > 0 && pluginDirectorySize <= WTF_ARRAY_LENGTH(pluginDirectoryStr)) + directories.append(String(pluginDirectoryStr, pluginDirectorySize - 1)); + + DWORD type; + WCHAR installationDirectoryStr[MAX_PATH]; + DWORD installationDirectorySize = sizeof(installationDirectoryStr); + + HRESULT result = ::SHGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MediaPlayer", L"Installation Directory", &type, reinterpret_cast<LPBYTE>(&installationDirectoryStr), &installationDirectorySize); + + if (result == ERROR_SUCCESS && type == REG_SZ) + directories.append(String(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1)); +} + +static inline void addQuickTimePluginDirectory(Vector<String>& directories) +{ + DWORD type; + WCHAR installationDirectoryStr[MAX_PATH]; + DWORD installationDirectorySize = sizeof(installationDirectoryStr); + + HRESULT result = ::SHGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Apple Computer, Inc.\\QuickTime", L"InstallDir", &type, reinterpret_cast<LPBYTE>(&installationDirectoryStr), &installationDirectorySize); + + if (result == ERROR_SUCCESS && type == REG_SZ) { + String pluginDir = String(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1) + "\\plugins"; + directories.append(pluginDir); + } +} + +static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories) +{ + HKEY key; + HRESULT result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Adobe\\Acrobat Reader", 0, KEY_READ, &key); + if (result != ERROR_SUCCESS) + return; + + WCHAR name[128]; + FILETIME lastModified; + + Vector<int> latestAcrobatVersion; + String latestAcrobatVersionString; + + // Enumerate subkeys + for (int i = 0;; i++) { + DWORD nameLen = WTF_ARRAY_LENGTH(name); + result = ::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified); + + if (result != ERROR_SUCCESS) + break; + + Vector<int> acrobatVersion = parseVersionString(String(name, nameLen)); + if (compareVersions(acrobatVersion, latestAcrobatVersion)) { + latestAcrobatVersion = acrobatVersion; + latestAcrobatVersionString = String(name, nameLen); + } + } + + if (!latestAcrobatVersionString.isNull()) { + DWORD type; + WCHAR acrobatInstallPathStr[MAX_PATH]; + DWORD acrobatInstallPathSize = sizeof(acrobatInstallPathStr); + + String acrobatPluginKeyPath = "Software\\Adobe\\Acrobat Reader\\" + latestAcrobatVersionString + "\\InstallPath"; + result = ::SHGetValueW(HKEY_LOCAL_MACHINE, acrobatPluginKeyPath.charactersWithNullTermination(), 0, &type, reinterpret_cast<LPBYTE>(acrobatInstallPathStr), &acrobatInstallPathSize); + + if (result == ERROR_SUCCESS) { + String acrobatPluginDirectory = String(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser"; + directories.append(acrobatPluginDirectory); + } + } + + ::RegCloseKey(key); +} + +static inline void addMacromediaPluginDirectories(Vector<String>& directories) +{ +#if !OS(WINCE) + WCHAR systemDirectoryStr[MAX_PATH]; + + if (!::GetSystemDirectoryW(systemDirectoryStr, WTF_ARRAY_LENGTH(systemDirectoryStr))) + return; + + WCHAR macromediaDirectoryStr[MAX_PATH]; + + if (!::PathCombineW(macromediaDirectoryStr, systemDirectoryStr, L"macromed\\Flash")) + return; + + directories.append(macromediaDirectoryStr); + + if (!::PathCombineW(macromediaDirectoryStr, systemDirectoryStr, L"macromed\\Shockwave 10")) + return; + + directories.append(macromediaDirectoryStr); +#endif +} + +Vector<String> PluginInfoStore::pluginsDirectories() +{ + Vector<String> directories; + + String ourDirectory = safariPluginsDirectory(); + if (!ourDirectory.isNull()) + directories.append(ourDirectory); + + addQuickTimePluginDirectory(directories); + addAdobeAcrobatPluginDirectory(directories); + addMozillaPluginDirectories(directories); + addWindowsMediaPlayerPluginDirectory(directories); + addMacromediaPluginDirectories(directories); + + return directories; +} + +class PathWalker : public Noncopyable { +public: + PathWalker(const String& directory) + { + String pattern = directory + "\\*"; + m_handle = ::FindFirstFileW(pattern.charactersWithNullTermination(), &m_data); + } + + ~PathWalker() + { + if (!isValid()) + return; + ::FindClose(m_handle); + } + + bool isValid() const { return m_handle != INVALID_HANDLE_VALUE; } + const WIN32_FIND_DATAW& data() const { return m_data; } + + bool step() { return ::FindNextFileW(m_handle, &m_data); } + +private: + HANDLE m_handle; + WIN32_FIND_DATAW m_data; +}; + +Vector<String> PluginInfoStore::pluginPathsInDirectory(const String& directory) +{ + Vector<String> paths; + + PathWalker walker(directory); + if (!walker.isValid()) + return paths; + + do { + if (walker.data().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + continue; + + String filename = walker.data().cFileName; + if ((!filename.startsWith("np", false) || !filename.endsWith("dll", false)) && (!equalIgnoringCase(filename, "Plugin.dll") || !directory.endsWith("Shockwave 10", false))) + continue; + + paths.append(directory + "\\" + filename); + } while (walker.step()); + + return paths; +} + +static void addPluginPathsFromRegistry(HKEY rootKey, Vector<String>& paths) +{ + HKEY key; + if (::RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, KEY_ENUMERATE_SUB_KEYS, &key) != ERROR_SUCCESS) + return; + + for (size_t i = 0; ; ++i) { + // MSDN says that key names have a maximum length of 255 characters. + wchar_t name[256]; + DWORD nameLen = WTF_ARRAY_LENGTH(name); + if (::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, 0) != ERROR_SUCCESS) + break; + + wchar_t path[MAX_PATH]; + DWORD pathSizeInBytes = sizeof(path); + DWORD type; + if (::SHGetValueW(key, name, L"Path", &type, path, &pathSizeInBytes) != ERROR_SUCCESS) + continue; + if (type != REG_SZ) + continue; + + paths.append(path); + } + + ::RegCloseKey(key); +} + +Vector<String> PluginInfoStore::individualPluginPaths() +{ + Vector<String> paths; + + addPluginPathsFromRegistry(HKEY_LOCAL_MACHINE, paths); + addPluginPathsFromRegistry(HKEY_CURRENT_USER, paths); + + return paths; +} + +static uint64_t fileVersion(DWORD leastSignificant, DWORD mostSignificant) +{ + ULARGE_INTEGER version; + version.LowPart = leastSignificant; + version.HighPart = mostSignificant; + return version.QuadPart; +} + +bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin) +{ + return NetscapePluginModule::getPluginInfo(pluginPath, plugin); +} + +static bool isOldWindowsMediaPlayerPlugin(const PluginInfoStore::Plugin& plugin) +{ + return equalIgnoringCase(plugin.info.file, "npdsplay.dll"); +} + +static bool isNewWindowsMediaPlayerPlugin(const PluginInfoStore::Plugin& plugin) +{ + return equalIgnoringCase(plugin.info.file, "np-mswmp.dll"); +} + +bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin) +{ + // FIXME: We should prefer a newer version of a plugin to an older version, rather than loading + // both. <http://webkit.org/b/49075> + + if (plugin.info.name == "Citrix ICA Client") { + // The Citrix ICA Client plug-in requires a Mozilla-based browser; see <rdar://6418681>. + return false; + } + + if (plugin.info.name == "Silverlight Plug-In") { + // workaround for <rdar://5557379> Crash in Silverlight when opening microsoft.com. + // the latest 1.0 version of Silverlight does not reproduce this crash, so allow it + // and any newer versions + static const uint64_t minimumRequiredVersion = fileVersion(0x51BE0000, 0x00010000); + return plugin.fileVersion >= minimumRequiredVersion; + } + + if (equalIgnoringCase(plugin.info.file, "npmozax.dll")) { + // Bug 15217: Mozilla ActiveX control complains about missing xpcom_core.dll + return false; + } + + if (plugin.info.name == "Yahoo Application State Plugin") { + // https://bugs.webkit.org/show_bug.cgi?id=26860 + // Bug in Yahoo Application State plug-in earlier than 1.0.0.6 leads to heap corruption. + static const uint64_t minimumRequiredVersion = fileVersion(0x00000006, 0x00010000); + return plugin.fileVersion >= minimumRequiredVersion; + } + + if (isOldWindowsMediaPlayerPlugin(plugin)) { + // Don't load the old Windows Media Player plugin if we've already loaded the new Windows + // Media Player plugin. + for (size_t i = 0; i < m_plugins.size(); ++i) { + if (!isNewWindowsMediaPlayerPlugin(m_plugins[i])) + continue; + return false; + } + return true; + } + + if (isNewWindowsMediaPlayerPlugin(plugin)) { + // Unload the old Windows Media Player plugin if we've already loaded it. + for (size_t i = 0; i < m_plugins.size(); ++i) { + if (!isOldWindowsMediaPlayerPlugin(m_plugins[i])) + continue; + m_plugins.remove(i); + } + return true; + } + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/ProcessModel.h b/Source/WebKit2/UIProcess/ProcessModel.h new file mode 100644 index 0000000..0e89c65 --- /dev/null +++ b/Source/WebKit2/UIProcess/ProcessModel.h @@ -0,0 +1,39 @@ +/* + * 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 ProcessModel_h +#define ProcessModel_h + +namespace WebKit { + +enum ProcessModel { + ProcessModelSharedSecondaryProcess, + ProcessModelSharedSecondaryThread, + ProcessModelSecondaryProcess +}; + +} // namespace WebKit + +#endif // ProcessModel_h diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp new file mode 100644 index 0000000..da54a7e --- /dev/null +++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ResponsivenessTimer.h" + +#include "WorkItem.h" + +namespace WebKit { + +static const double kResponsivenessTimeout = 3; + +ResponsivenessTimer::ResponsivenessTimer(ResponsivenessTimer::Client* client) + : m_client(client) + , m_isResponsive(true) + , m_timer(RunLoop::main(), this, &ResponsivenessTimer::timerFired) +{ +} + +ResponsivenessTimer::~ResponsivenessTimer() +{ + m_timer.stop(); +} + +void ResponsivenessTimer::invalidate() +{ + m_timer.stop(); +} + +void ResponsivenessTimer::timerFired() +{ + // We'll never schedule the timer unless we're responsive. + ASSERT(m_isResponsive); + + m_isResponsive = false; + m_client->didBecomeUnresponsive(this); + + m_timer.stop(); +} + +void ResponsivenessTimer::start() +{ + if (m_timer.isActive()) + return; + + if (!m_isResponsive) + return; + + m_timer.startOneShot(kResponsivenessTimeout); +} + +void ResponsivenessTimer::stop() +{ + if (!m_isResponsive) { + // We got a life sign from the web process! + m_client->didBecomeResponsive(this); + m_isResponsive = true; + } + + m_timer.stop(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.h b/Source/WebKit2/UIProcess/ResponsivenessTimer.h new file mode 100644 index 0000000..6591916 --- /dev/null +++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.h @@ -0,0 +1,64 @@ +/* + * 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 ResponsivenessTimer_h +#define ResponsivenessTimer_h + +#include "RunLoop.h" + +namespace WebKit { + +class ResponsivenessTimer { +public: + class Client { + public: + virtual ~Client() { } + virtual void didBecomeUnresponsive(ResponsivenessTimer*) = 0; + virtual void didBecomeResponsive(ResponsivenessTimer*) = 0; + }; + + ResponsivenessTimer(ResponsivenessTimer::Client*); + ~ResponsivenessTimer(); + + void start(); + void stop(); + + void invalidate(); + + bool isResponsive() { return m_isResponsive; } + +private: + void timerFired(); + + ResponsivenessTimer::Client* m_client; + bool m_isResponsive; + + RunLoop::Timer<ResponsivenessTimer> m_timer; +}; + +} // namespace WebKit + +#endif // ResponsivenessTimer_h + diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h new file mode 100644 index 0000000..7415da3 --- /dev/null +++ b/Source/WebKit2/UIProcess/TextChecker.h @@ -0,0 +1,66 @@ +/* + * 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 TextChecker_h +#define TextChecker_h + +#include <WebCore/EditorClient.h> + +namespace WebKit { + +class TextCheckerState; + +class TextChecker { +public: + static const TextCheckerState& state(); + static bool isContinuousSpellCheckingAllowed(); + + static void setContinuousSpellCheckingEnabled(bool); + static void setGrammarCheckingEnabled(bool); + +#if PLATFORM(MAC) + static void setAutomaticSpellingCorrectionEnabled(bool); + static void setAutomaticQuoteSubstitutionEnabled(bool); + static void setAutomaticDashSubstitutionEnabled(bool); + static void setAutomaticLinkDetectionEnabled(bool); + static void setAutomaticTextReplacementEnabled(bool); + + static bool isSmartInsertDeleteEnabled(); + static void setSmartInsertDeleteEnabled(bool); +#endif + + static int64_t uniqueSpellDocumentTag(); + static void closeSpellDocumentWithTag(int64_t); + + static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes); + static void updateSpellingUIWithMisspelledWord(const String& misspelledWord); + static void getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses); + static void learnWord(const String& word); + static void ignoreWord(int64_t spellDocumentTag, const String& word); +}; + +} // namespace WebKit + +#endif // TextChecker_h diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp new file mode 100644 index 0000000..b687192 --- /dev/null +++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp @@ -0,0 +1,624 @@ +/* + * 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 "TiledDrawingAreaProxy.h" + +#if ENABLE(TILED_BACKING_STORE) +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "UpdateChunk.h" +#include "WebCoreArgumentCoders.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +using namespace WebCore; + +namespace WebKit { + +static const int defaultTileWidth = 1024; +static const int defaultTileHeight = 1024; + +PassOwnPtr<TiledDrawingAreaProxy> TiledDrawingAreaProxy::create(PlatformWebView* webView, WebPageProxy* webPageProxy) +{ + return adoptPtr(new TiledDrawingAreaProxy(webView, webPageProxy)); +} + +TiledDrawingAreaProxy::TiledDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy) + : DrawingAreaProxy(DrawingAreaInfo::Tiled, webPageProxy) + , m_isWaitingForDidSetFrameNotification(false) + , m_isVisible(true) + , m_webView(webView) + , m_tileBufferUpdateTimer(RunLoop::main(), this, &TiledDrawingAreaProxy::tileBufferUpdateTimerFired) + , m_tileCreationTimer(RunLoop::main(), this, &TiledDrawingAreaProxy::tileCreationTimerFired) + , m_tileSize(defaultTileWidth, defaultTileHeight) + , m_tileCreationDelay(0.01) + , m_keepAreaMultiplier(2.5, 4.5) + , m_coverAreaMultiplier(2, 3) + , m_contentsScale(1) +{ +} + +TiledDrawingAreaProxy::~TiledDrawingAreaProxy() +{ +} + +void TiledDrawingAreaProxy::sizeDidChange() +{ + WebPageProxy* page = this->page(); + if (!page || !page->isValid()) + return; + + if (m_size.isEmpty()) + return; + + m_viewSize = m_size; + m_lastSetViewSize = m_size; + + if (m_isWaitingForDidSetFrameNotification) + return; + m_isWaitingForDidSetFrameNotification = true; + + page->process()->responsivenessTimer()->start(); + page->process()->send(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(m_size)); +} + +void TiledDrawingAreaProxy::setPageIsVisible(bool isVisible) +{ + WebPageProxy* page = this->page(); + + if (isVisible == m_isVisible) + return; + + m_isVisible = isVisible; + if (!page || !page->isValid()) + return; + + 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()); + return; + } + + // The page is now visible. + page->process()->send(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In()); + + // FIXME: We should request a full repaint here if needed. +} + +void TiledDrawingAreaProxy::didSetSize(const IntSize& viewSize) +{ + ASSERT(m_isWaitingForDidSetFrameNotification); + m_isWaitingForDidSetFrameNotification = false; + + if (viewSize != m_lastSetViewSize) + setSize(m_lastSetViewSize); + + WebPageProxy* page = this->page(); + page->process()->responsivenessTimer()->stop(); +} + +void TiledDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) { + case DrawingAreaProxyLegacyMessage::TileUpdated: { + int tileID; + UpdateChunk updateChunk; + float scale; + unsigned pendingUpdateCount; + if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount))) + return; + + TiledDrawingAreaTile* tile = m_tilesByID.get(tileID); + ASSERT(!tile || tile->ID() == tileID); + if (tile) + tile->updateFromChunk(&updateChunk, scale); + tileBufferUpdateComplete(); + break; + } + case DrawingAreaProxyLegacyMessage::DidSetSize: { + IntSize size; + if (!arguments->decode(CoreIPC::Out(size))) + return; + + didSetSize(size); + break; + } + case DrawingAreaProxyLegacyMessage::Invalidate: { + IntRect rect; + if (!arguments->decode(CoreIPC::Out(rect))) + return; + + invalidate(rect); + break; + } + case DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed: { + tileBufferUpdateComplete(); + break; + } + case DrawingAreaProxyLegacyMessage::SnapshotTaken: { + UpdateChunk chunk; + if (!arguments->decode(CoreIPC::Out(chunk))) + return; + snapshotTaken(chunk); + break; + } + default: + ASSERT_NOT_REACHED(); + } +} + +void TiledDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&) +{ + ASSERT_NOT_REACHED(); +} + +void TiledDrawingAreaProxy::requestTileUpdate(int tileID, const IntRect& dirtyRect) +{ + page()->process()->connection()->send(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale())); +} + +void TiledDrawingAreaProxy::waitUntilUpdatesComplete() +{ + while (hasPendingUpdates()) { + int tileID; + UpdateChunk updateChunk; + float scale; + unsigned pendingUpdateCount; + static const double tileUpdateTimeout = 10.0; + OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout); + if (!arguments) + break; + if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount))) + break; + TiledDrawingAreaTile* tile = m_tilesByID.get(tileID); + ASSERT(!tile || tile->ID() == tileID); + if (tile) + tile->updateFromChunk(&updateChunk, scale); + } + tileBufferUpdateComplete(); +} + +PassRefPtr<TiledDrawingAreaTile> TiledDrawingAreaProxy::createTile(const TiledDrawingAreaTile::Coordinate& coordinate) +{ + RefPtr<TiledDrawingAreaTile> tile = TiledDrawingAreaTile::create(this, coordinate); + setTile(coordinate, tile); + return tile; +} + +void TiledDrawingAreaProxy::setTileSize(const IntSize& size) +{ + if (m_tileSize == size) + return; + m_tileSize = size; + removeAllTiles(); + startTileCreationTimer(); +} + +void TiledDrawingAreaProxy::setTileCreationDelay(double delay) +{ + m_tileCreationDelay = delay; +} + +void TiledDrawingAreaProxy::setKeepAndCoverAreaMultipliers(const FloatSize& keepMultiplier, const FloatSize& coverMultiplier) +{ + m_keepAreaMultiplier = keepMultiplier; + m_coverAreaMultiplier = coverMultiplier; + startTileCreationTimer(); +} + +void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect) +{ + WebPageProxy* page = this->page(); + page->process()->send(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()); + + 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) { + RefPtr<TiledDrawingAreaTile> currentTile = tileAt(TiledDrawingAreaTile::Coordinate(xCoordinate, yCoordinate)); + if (!currentTile) + continue; + if (!currentTile->rect().intersects(dirtyRect)) + continue; + // If a tile outside out current cover rect gets invalidated, just drop it instead of updating. + if (!currentTile->rect().intersects(coverRect)) { + tilesToRemove.append(currentTile->coordinate()); + continue; + } + currentTile->invalidate(dirtyRect); + } + } + + unsigned removeCount = tilesToRemove.size(); + for (unsigned n = 0; n < removeCount; ++n) + removeTile(tilesToRemove[n]); + + startTileBufferUpdateTimer(); +} + +void TiledDrawingAreaProxy::updateTileBuffers() +{ + Vector<RefPtr<TiledDrawingAreaTile> > newDirtyTiles; + TileMap::iterator end = m_tiles.end(); + for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { + RefPtr<TiledDrawingAreaTile>& current = it->second; + if (!current->isDirty()) + continue; + newDirtyTiles.append(it->second); + } + + if (newDirtyTiles.isEmpty()) + return; + + unsigned size = newDirtyTiles.size(); + for (unsigned n = 0; n < size; ++n) + newDirtyTiles[n]->updateBackBuffer(); +} + +void TiledDrawingAreaProxy::tileBufferUpdateComplete() +{ + // Bail out if all tile back buffers have not been updated. + Vector<TiledDrawingAreaTile*> tilesToFlip; + TileMap::iterator end = m_tiles.end(); + for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { + RefPtr<TiledDrawingAreaTile>& current = it->second; + if (current->isReadyToPaint() && (current->isDirty() || current->hasBackBufferUpdatePending())) + return; + if (current->hasReadyBackBuffer()) + tilesToFlip.append(current.get()); + } + // Everything done, move back buffers to front. + Vector<IntRect> paintedArea; + unsigned size = tilesToFlip.size(); + for (unsigned n = 0; n < size; ++n) { + TiledDrawingAreaTile* tile = tilesToFlip[n]; + tile->swapBackBufferToFront(); + // FIXME: should not request system repaint for the full tile. + paintedArea.append(mapToContents(tile->rect())); + } + if (size) + updateWebView(paintedArea); + + m_tileCreationTimer.startOneShot(0); +} + +bool TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context) +{ + if (m_isWaitingForDidSetFrameNotification) { + WebPageProxy* page = this->page(); + if (!page->isValid()) + return false; + + if (page->process()->isLaunching()) + return false; + } + + adjustVisibleRect(); + + GraphicsContext gc(context); + gc.save(); + + // Assumes the backing store is painted with the scale transform applied. + // Since tile content is already scaled, first revert the scaling from the painter. + gc.scale(FloatSize(1 / m_contentsScale, 1 / m_contentsScale)); + + IntRect dirtyRect = mapFromContents(rect); + + TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.topLeft()); + TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(dirtyRect.bottomRight()); + + 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()) + currentTile->paint(&gc, dirtyRect); + } + } + + gc.restore(); + return true; +} + +void TiledDrawingAreaProxy::adjustVisibleRect() +{ + IntRect visibleRect = mapFromContents(webViewVisibleRect()); + if (m_previousVisibleRect == visibleRect) + return; + m_previousVisibleRect = visibleRect; + + startTileCreationTimer(); +} + +void TiledDrawingAreaProxy::setContentsScale(float scale) +{ + if (m_contentsScale == scale) + return; + m_contentsScale = scale; + removeAllTiles(); + createTiles(); +} + +void TiledDrawingAreaProxy::removeAllTiles() +{ + Vector<RefPtr<TiledDrawingAreaTile> > tilesToRemove; + copyValuesToVector(m_tiles, tilesToRemove); + unsigned removeCount = tilesToRemove.size(); + for (unsigned n = 0; n < removeCount; ++n) + removeTile(tilesToRemove[n]->coordinate()); +} + +double TiledDrawingAreaProxy::tileDistance(const IntRect& viewport, const TiledDrawingAreaTile::Coordinate& tileCoordinate) +{ + if (viewport.intersects(tileRectForCoordinate(tileCoordinate))) + return 0; + + IntPoint viewCenter = viewport.location() + IntSize(viewport.width() / 2, viewport.height() / 2); + TiledDrawingAreaTile::Coordinate centerCoordinate = tileCoordinateForPoint(viewCenter); + + // Manhattan distance, biased so that vertical distances are shorter. + const double horizontalBias = 1.3; + return abs(centerCoordinate.y() - tileCoordinate.y()) + horizontalBias * abs(centerCoordinate.x() - tileCoordinate.x()); +} + +IntRect TiledDrawingAreaProxy::calculateKeepRect(const IntRect& visibleRect) const +{ + IntRect result = visibleRect; + result.inflateX(visibleRect.width() * (m_keepAreaMultiplier.width() - 1)); + result.inflateY(visibleRect.height() * (m_keepAreaMultiplier.height() - 1)); + result.intersect(contentsRect()); + return result; +} + +IntRect TiledDrawingAreaProxy::calculateCoverRect(const IntRect& visibleRect) const +{ + IntRect result = visibleRect; + result.inflateX(visibleRect.width() * (m_coverAreaMultiplier.width() - 1)); + result.inflateY(visibleRect.height() * (m_coverAreaMultiplier.height() - 1)); + result.intersect(contentsRect()); + return result; +} + +void TiledDrawingAreaProxy::createTiles() +{ + IntRect visibleRect = mapFromContents(webViewVisibleRect()); + m_previousVisibleRect = visibleRect; + + if (visibleRect.isEmpty()) + return; + + // Resize tiles on edges in case the contents size has changed. + bool didResizeTiles = resizeEdgeTiles(); + + // Remove tiles outside out current maximum keep rect. + dropTilesOutsideRect(calculateKeepRect(visibleRect)); + + // Cover the cover rect with tiles. + IntRect coverRect = calculateCoverRect(visibleRect); + + // Search for the tile position closest to the viewport center that does not yet contain a tile. + // Which position is considered the closest depends on the tileDistance function. + double shortestDistance = std::numeric_limits<double>::infinity(); + 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 currentCoordinate(xCoordinate, yCoordinate); + // Distance is 0 for all currently visible tiles. + double distance = tileDistance(visibleRect, currentCoordinate); + + RefPtr<TiledDrawingAreaTile> tile = tileAt(currentCoordinate); + if (!distance && (!tile || !tile->isReadyToPaint())) + hasVisibleCheckers = true; + if (tile) + continue; + + ++requiredTileCount; + + if (distance > shortestDistance) + continue; + if (distance < shortestDistance) { + tilesToCreate.clear(); + shortestDistance = distance; + } + tilesToCreate.append(currentCoordinate); + } + } + + if (hasVisibleCheckers && shortestDistance > 0) + return; + + // Now construct the tile(s). + unsigned tilesToCreateCount = tilesToCreate.size(); + for (unsigned n = 0; n < tilesToCreateCount; ++n) + createTile(tilesToCreate[n]); + + requiredTileCount -= tilesToCreateCount; + + // Paint the content of the newly created tiles. + if (tilesToCreateCount || didResizeTiles) + updateTileBuffers(); + + // Keep creating tiles until the whole coverRect is covered. + if (requiredTileCount) + m_tileCreationTimer.startOneShot(m_tileCreationDelay); +} + +bool TiledDrawingAreaProxy::resizeEdgeTiles() +{ + IntRect contentsRect = this->contentsRect(); + bool wasResized = false; + + Vector<TiledDrawingAreaTile::Coordinate> tilesToRemove; + TileMap::iterator end = m_tiles.end(); + for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { + TiledDrawingAreaTile::Coordinate tileCoordinate = it->second->coordinate(); + IntRect tileRect = it->second->rect(); + IntRect expectedTileRect = tileRectForCoordinate(tileCoordinate); + if (!contentsRect.contains(tileRect)) + tilesToRemove.append(tileCoordinate); + else if (expectedTileRect != tileRect) { + it->second->resize(expectedTileRect.size()); + wasResized = true; + } + } + unsigned removeCount = tilesToRemove.size(); + for (unsigned n = 0; n < removeCount; ++n) + removeTile(tilesToRemove[n]); + return wasResized; +} + +void TiledDrawingAreaProxy::dropTilesOutsideRect(const IntRect& keepRect) +{ + FloatRect keepRectF = keepRect; + + Vector<TiledDrawingAreaTile::Coordinate> toRemove; + TileMap::iterator end = m_tiles.end(); + for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) { + TiledDrawingAreaTile::Coordinate coordinate = it->second->coordinate(); + FloatRect tileRect = it->second->rect(); + if (!tileRect.intersects(keepRectF)) + toRemove.append(coordinate); + } + unsigned removeCount = toRemove.size(); + for (unsigned n = 0; n < removeCount; ++n) + removeTile(toRemove[n]); +} + +PassRefPtr<TiledDrawingAreaTile> TiledDrawingAreaProxy::tileAt(const TiledDrawingAreaTile::Coordinate& coordinate) const +{ + return m_tiles.get(coordinate); +} + +void TiledDrawingAreaProxy::setTile(const TiledDrawingAreaTile::Coordinate& coordinate, RefPtr<TiledDrawingAreaTile> tile) +{ + m_tiles.set(coordinate, tile); + m_tilesByID.set(tile->ID(), tile.get()); +} + +void TiledDrawingAreaProxy::removeTile(const TiledDrawingAreaTile::Coordinate& coordinate) +{ + RefPtr<TiledDrawingAreaTile> tile = m_tiles.take(coordinate); + + m_tilesByID.remove(tile->ID()); + + if (!tile->hasBackBufferUpdatePending()) + return; + WebPageProxy* page = this->page(); + page->process()->send(DrawingAreaLegacyMessage::CancelTileUpdate, page->pageID(), CoreIPC::In(tile->ID())); +} + +IntRect TiledDrawingAreaProxy::mapToContents(const IntRect& rect) const +{ + return enclosingIntRect(FloatRect(rect.x() / m_contentsScale, + rect.y() / m_contentsScale, + rect.width() / m_contentsScale, + rect.height() / m_contentsScale)); +} + +IntRect TiledDrawingAreaProxy::mapFromContents(const IntRect& rect) const +{ + return enclosingIntRect(FloatRect(rect.x() * m_contentsScale, + rect.y() * m_contentsScale, + rect.width() * m_contentsScale, + rect.height() * m_contentsScale)); +} + +IntRect TiledDrawingAreaProxy::contentsRect() const +{ + return mapFromContents(IntRect(IntPoint(0, 0), m_viewSize)); +} + +IntRect TiledDrawingAreaProxy::tileRectForCoordinate(const TiledDrawingAreaTile::Coordinate& coordinate) const +{ + IntRect rect(coordinate.x() * m_tileSize.width(), + coordinate.y() * m_tileSize.height(), + m_tileSize.width(), + m_tileSize.height()); + + rect.intersect(contentsRect()); + return rect; +} + +TiledDrawingAreaTile::Coordinate TiledDrawingAreaProxy::tileCoordinateForPoint(const IntPoint& point) const +{ + int x = point.x() / m_tileSize.width(); + int y = point.y() / m_tileSize.height(); + return TiledDrawingAreaTile::Coordinate(std::max(x, 0), std::max(y, 0)); +} + + +void TiledDrawingAreaProxy::startTileBufferUpdateTimer() +{ + if (m_tileBufferUpdateTimer.isActive()) + return; + m_tileBufferUpdateTimer.startOneShot(0); +} + +void TiledDrawingAreaProxy::tileBufferUpdateTimerFired() +{ + updateTileBuffers(); +} + +void TiledDrawingAreaProxy::startTileCreationTimer() +{ + if (m_tileCreationTimer.isActive()) + return; + m_tileCreationTimer.startOneShot(0); +} + +void TiledDrawingAreaProxy::tileCreationTimerFired() +{ + createTiles(); +} + +bool TiledDrawingAreaProxy::hasPendingUpdates() const +{ + TileMap::const_iterator end = m_tiles.end(); + for (TileMap::const_iterator it = m_tiles.begin(); it != end; ++it) { + const RefPtr<TiledDrawingAreaTile>& current = it->second; + if (current->hasBackBufferUpdatePending()) + return true; + } + return false; +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h new file mode 100644 index 0000000..80bc20d --- /dev/null +++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h @@ -0,0 +1,189 @@ +/* + * 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. + */ + +#ifndef TiledDrawingAreaProxy_h +#define TiledDrawingAreaProxy_h + +#if ENABLE(TILED_BACKING_STORE) + +#include "DrawingAreaProxy.h" +#include <WebCore/GraphicsContext.h> +#include <WebCore/IntSize.h> +#include <WebCore/IntRect.h> +#include <wtf/HashSet.h> + +#include "RunLoop.h" +#include "TiledDrawingAreaTile.h" + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class WKView; +#else +class WKView; +#endif +#elif PLATFORM(QT) +class QGraphicsWKView; +#include <QImage> +#endif + +namespace WebKit { + +class UpdateChunk; +class WebPageProxy; + +#if PLATFORM(MAC) +typedef WKView PlatformWebView; +#elif PLATFORM(WIN) +class WebView; +typedef WebView PlatformWebView; +#elif PLATFORM(QT) +typedef QGraphicsWKView PlatformWebView; +#endif + +class TiledDrawingAreaProxy : public DrawingAreaProxy { +public: + static PassOwnPtr<TiledDrawingAreaProxy> create(PlatformWebView* webView, WebPageProxy*); + + TiledDrawingAreaProxy(PlatformWebView*, WebPageProxy*); + virtual ~TiledDrawingAreaProxy(); + + float contentsScale() const { return m_contentsScale; } + void setContentsScale(float); + + void waitUntilUpdatesComplete(); + + void takeSnapshot(const WebCore::IntSize& size, const WebCore::IntRect& contentsRect); + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext(uint32_t /* contextID */) { } + virtual void detachCompositingContext() { } +#endif + + void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); + + WebCore::IntSize tileSize() { return m_tileSize; } + void setTileSize(const WebCore::IntSize&); + + double tileCreationDelay() const { return m_tileCreationDelay; } + void setTileCreationDelay(double delay); + + // Tiled are dropped outside the keep area, and created for cover area. The values a relative to the viewport size. + void getKeepAndCoverAreaMultipliers(WebCore::FloatSize& keepMultiplier, WebCore::FloatSize& coverMultiplier) + { + keepMultiplier = m_keepAreaMultiplier; + coverMultiplier = m_coverAreaMultiplier; + } + void setKeepAndCoverAreaMultipliers(const WebCore::FloatSize& keepMultiplier, const WebCore::FloatSize& coverMultiplier); + + void tileBufferUpdateComplete(); + + WebCore::IntRect mapToContents(const WebCore::IntRect&) const; + WebCore::IntRect mapFromContents(const WebCore::IntRect&) const; + + bool hasPendingUpdates() const; + +private: + WebPageProxy* page(); + WebCore::IntRect webViewVisibleRect(); + void updateWebView(const Vector<WebCore::IntRect>& paintedArea); + + void snapshotTaken(UpdateChunk&); + + // DrawingAreaProxy + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&); + virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext); + virtual void sizeDidChange(); + virtual void setPageIsVisible(bool isVisible); + + void didSetSize(const WebCore::IntSize&); + void invalidate(const WebCore::IntRect& rect); + void adjustVisibleRect(); + + void requestTileUpdate(int tileID, const WebCore::IntRect& dirtyRect); + + PassRefPtr<TiledDrawingAreaTile> createTile(const TiledDrawingAreaTile::Coordinate&); + + void startTileBufferUpdateTimer(); + void startTileCreationTimer(); + + void tileBufferUpdateTimerFired(); + void tileCreationTimerFired(); + + void updateTileBuffers(); + void createTiles(); + + bool resizeEdgeTiles(); + void dropTilesOutsideRect(const WebCore::IntRect&); + + PassRefPtr<TiledDrawingAreaTile> tileAt(const TiledDrawingAreaTile::Coordinate&) const; + void setTile(const TiledDrawingAreaTile::Coordinate& coordinate, RefPtr<TiledDrawingAreaTile> tile); + void removeTile(const TiledDrawingAreaTile::Coordinate& coordinate); + void removeAllTiles(); + + WebCore::IntRect contentsRect() const; + + WebCore::IntRect calculateKeepRect(const WebCore::IntRect& visibleRect) const; + WebCore::IntRect calculateCoverRect(const WebCore::IntRect& visibleRect) const; + + WebCore::IntRect tileRectForCoordinate(const TiledDrawingAreaTile::Coordinate&) const; + TiledDrawingAreaTile::Coordinate tileCoordinateForPoint(const WebCore::IntPoint&) const; + double tileDistance(const WebCore::IntRect& viewport, const TiledDrawingAreaTile::Coordinate&); + +private: + bool m_isWaitingForDidSetFrameNotification; + bool m_isVisible; + + WebCore::IntSize m_viewSize; // Size of the BackingStore as well. + WebCore::IntSize m_lastSetViewSize; + + PlatformWebView* m_webView; + + typedef HashMap<TiledDrawingAreaTile::Coordinate, RefPtr<TiledDrawingAreaTile> > TileMap; + TileMap m_tiles; + + WTF::HashMap<int, TiledDrawingAreaTile*> m_tilesByID; + + typedef RunLoop::Timer<TiledDrawingAreaProxy> TileTimer; + TileTimer m_tileBufferUpdateTimer; + TileTimer m_tileCreationTimer; + + WebCore::IntSize m_tileSize; + double m_tileCreationDelay; + WebCore::FloatSize m_keepAreaMultiplier; + WebCore::FloatSize m_coverAreaMultiplier; + + WebCore::IntRect m_previousVisibleRect; + float m_contentsScale; + + friend class TiledDrawingAreaTile; +}; + +} // namespace WebKit + +#endif // TILED_BACKING_STORE + +#endif // TiledDrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h b/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h new file mode 100644 index 0000000..c818a3f --- /dev/null +++ b/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#ifndef TiledDrawingAreaTile_h +#define TiledDrawingAreaTile_h + +#include "IntPoint.h" +#include "IntPointHash.h" +#include "IntRect.h" +#include "GraphicsContext.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +#if PLATFORM(QT) +#include <QPixmap> +#include <QRegion> +#endif + +namespace WebKit { + +class TiledDrawingAreaProxy; +class UpdateChunk; + +class TiledDrawingAreaTile : public RefCounted<TiledDrawingAreaTile> { +public: + typedef WebCore::IntPoint Coordinate; + + static PassRefPtr<TiledDrawingAreaTile> create(TiledDrawingAreaProxy* proxy, const Coordinate& tileCoordinate) { return adoptRef(new TiledDrawingAreaTile(proxy, tileCoordinate)); } + ~TiledDrawingAreaTile(); + + bool isDirty() const; + void invalidate(const WebCore::IntRect&); + void updateBackBuffer(); + bool hasReadyBackBuffer() const; + void swapBackBufferToFront(); + bool isReadyToPaint() const; + void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); + bool hasBackBufferUpdatePending() const { return m_hasUpdatePending; } + + const TiledDrawingAreaTile::Coordinate& coordinate() const { return m_coordinate; } + const WebCore::IntRect& rect() const { return m_rect; } + void resize(const WebCore::IntSize&); + + void updateFromChunk(UpdateChunk* updateChunk, float); + + int ID() const { return m_ID; } + +private: + TiledDrawingAreaTile(TiledDrawingAreaProxy* proxy, const TiledDrawingAreaTile::Coordinate& tileCoordinate); + + TiledDrawingAreaProxy* m_proxy; + Coordinate m_coordinate; + WebCore::IntRect m_rect; + + int m_ID; + bool m_hasUpdatePending; + +#if PLATFORM(QT) + QPixmap m_buffer; + QPixmap m_backBuffer; + QRegion m_dirtyRegion; +#endif +}; + +} + +#endif diff --git a/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp new file mode 100644 index 0000000..6beafff --- /dev/null +++ b/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VisitedLinkProvider.h" + +#include "SharedMemory.h" +#include "VisitedLinkTable.h" +#include "WebContext.h" +#include "WebProcessMessages.h" + +using namespace WebCore; + +namespace WebKit { + +static const int VisitedLinkTableMaxLoad = 2; + +VisitedLinkProvider::VisitedLinkProvider(WebContext* context) + : m_context(context) + , m_visitedLinksPopulated(false) + , m_webProcessHasVisitedLinkState(false) + , m_keyCount(0) + , m_tableSize(0) + , m_pendingVisitedLinksTimer(RunLoop::main(), this, &VisitedLinkProvider::pendingVisitedLinksTimerFired) +{ +} + +void VisitedLinkProvider::processDidFinishLaunching() +{ + m_webProcessHasVisitedLinkState = false; + + if (m_keyCount) + m_pendingVisitedLinksTimer.startOneShot(0); + + if (m_visitedLinksPopulated) + return; + + m_context->populateVisitedLinks(); + + m_visitedLinksPopulated = true; +} + +void VisitedLinkProvider::addVisitedLink(LinkHash linkHash) +{ + m_pendingVisitedLinks.add(linkHash); + + if (!m_pendingVisitedLinksTimer.isActive()) + m_pendingVisitedLinksTimer.startOneShot(0); +} + +void VisitedLinkProvider::processDidClose() +{ + m_pendingVisitedLinksTimer.stop(); +} + +static unsigned nextPowerOf2(unsigned v) +{ + // Taken from http://www.cs.utk.edu/~vose/c-stuff/bithacks.html + // Devised by Sean Anderson, Sepember 14, 2001 + + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + + return v; +} + +static unsigned tableSizeForKeyCount(unsigned keyCount) +{ + // We want the table to be at least half empty. + unsigned tableSize = nextPowerOf2(keyCount * VisitedLinkTableMaxLoad); + + // Ensure that the table size is at least the size of a page. + size_t minimumTableSize = SharedMemory::systemPageSize() / sizeof(LinkHash); + if (tableSize < minimumTableSize) + return minimumTableSize; + + return tableSize; +} + +void VisitedLinkProvider::pendingVisitedLinksTimerFired() +{ + Vector<WebCore::LinkHash> pendingVisitedLinks; + copyToVector(m_pendingVisitedLinks, pendingVisitedLinks); + m_pendingVisitedLinks.clear(); + + unsigned currentTableSize = m_tableSize; + unsigned newTableSize = tableSizeForKeyCount(m_keyCount + pendingVisitedLinks.size()); + + // Links that were added. + Vector<WebCore::LinkHash> addedVisitedLinks; + + if (currentTableSize != newTableSize) { + // Create a new table. + RefPtr<SharedMemory> newTableMemory = SharedMemory::create(newTableSize * sizeof(LinkHash)); + + // We failed to create the shared memory. + if (!newTableMemory) + return; + + memset(newTableMemory->data(), 0, newTableMemory->size()); + + RefPtr<SharedMemory> currentTableMemory = m_table.sharedMemory(); + + m_table.setSharedMemory(newTableMemory); + m_tableSize = newTableSize; + + if (currentTableMemory) { + ASSERT(currentTableMemory->size() == currentTableSize * sizeof(LinkHash)); + + // Go through the current hash table and re-add all entries to the new hash table. + const LinkHash* currentLinkHashes = static_cast<const LinkHash*>(currentTableMemory->data()); + for (unsigned i = 0; i < currentTableSize; ++i) { + LinkHash linkHash = currentLinkHashes[i]; + + if (!linkHash) + continue; + + // It should always be possible to add the link hash to a new table. + if (!m_table.addLinkHash(linkHash)) + ASSERT_NOT_REACHED(); + } + } + } + + for (size_t i = 0; i < pendingVisitedLinks.size(); ++i) { + if (m_table.addLinkHash(pendingVisitedLinks[i])) + addedVisitedLinks.append(pendingVisitedLinks[i]); + } + + m_keyCount += pendingVisitedLinks.size(); + + if (!m_webProcessHasVisitedLinkState || currentTableSize != newTableSize) { + // Send the new visited link table. + + SharedMemory::Handle handle; + if (!m_table.sharedMemory()->createHandle(handle, SharedMemory::ReadOnly)) + return; + + m_context->process()->send(Messages::WebProcess::SetVisitedLinkTable(handle), 0); + } + + // We now need to let the web process know that we've added links. + if (m_webProcessHasVisitedLinkState && addedVisitedLinks.size() <= 20) { + m_context->process()->send(Messages::WebProcess::VisitedLinkStateChanged(addedVisitedLinks), 0); + return; + } + + // Just recalculate all the visited links. + m_context->process()->send(Messages::WebProcess::AllVisitedLinkStateChanged(), 0); + m_webProcessHasVisitedLinkState = true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/VisitedLinkProvider.h b/Source/WebKit2/UIProcess/VisitedLinkProvider.h new file mode 100644 index 0000000..015515c --- /dev/null +++ b/Source/WebKit2/UIProcess/VisitedLinkProvider.h @@ -0,0 +1,66 @@ +/* + * 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 VisitedLinkProvider_h +#define VisitedLinkProvider_h + +#include "RunLoop.h" +#include "VisitedLinkTable.h" +#include <WebCore/LinkHash.h> +#include <wtf/Forward.h> +#include <wtf/HashSet.h> +#include <wtf/Noncopyable.h> + +namespace WebKit { + +class WebContext; + +class VisitedLinkProvider : Noncopyable { +public: + explicit VisitedLinkProvider(WebContext*); + + void addVisitedLink(WebCore::LinkHash); + + void processDidFinishLaunching(); + void processDidClose(); + +private: + void pendingVisitedLinksTimerFired(); + + WebContext* m_context; + bool m_visitedLinksPopulated; + bool m_webProcessHasVisitedLinkState; + + unsigned m_keyCount; + unsigned m_tableSize; + VisitedLinkTable m_table; + + HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_pendingVisitedLinks; + RunLoop::Timer<VisitedLinkProvider> m_pendingVisitedLinksTimer; +}; + +} // namespace WebKit + +#endif // VisitedLinkProvider_h diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.cpp b/Source/WebKit2/UIProcess/WebBackForwardList.cpp new file mode 100644 index 0000000..b351418 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebBackForwardList.cpp @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebBackForwardList.h" + +#include "WebPageProxy.h" + +namespace WebKit { + +static const unsigned DefaultCapacity = 100; +static const unsigned NoCurrentItemIndex = UINT_MAX; + +WebBackForwardList::WebBackForwardList(WebPageProxy* page) + : m_page(page) + , m_current(NoCurrentItemIndex) + , m_capacity(DefaultCapacity) + , m_closed(true) + , m_enabled(true) +{ +} + +WebBackForwardList::~WebBackForwardList() +{ +} + +void WebBackForwardList::pageClosed() +{ + if (m_page) { + size_t size = m_entries.size(); + for (size_t i = 0; i < size; ++i) + m_page->backForwardRemovedItem(m_entries[i]->itemID()); + } + + m_page = 0; +} + +void WebBackForwardList::addItem(WebBackForwardListItem* newItem) +{ + if (m_capacity == 0 || !m_enabled) + return; + + // Toss anything in the forward list + if (m_current != NoCurrentItemIndex) { + unsigned targetSize = m_current + 1; + while (m_entries.size() > targetSize) { + if (m_page) + m_page->backForwardRemovedItem(m_entries.last()->itemID()); + m_entries.removeLast(); + } + } + + // Toss the first item if the list is getting too big, as long as we're not using it + // (or even if we are, if we only want 1 entry). + if (m_entries.size() == m_capacity && (m_current != 0 || m_capacity == 1)) { + if (m_page) + m_page->backForwardRemovedItem(m_entries[0]->itemID()); + m_entries.remove(0); + m_current--; + } + + m_entries.insert(m_current + 1, newItem); + m_current++; + + if (m_page) + m_page->didChangeBackForwardList(); +} + +void WebBackForwardList::goToItem(WebBackForwardListItem* item) +{ + if (!m_entries.size() || !item) + return; + + unsigned index = 0; + for (; index < m_entries.size(); ++index) { + if (m_entries[index] == item) + break; + } + if (index < m_entries.size()) { + m_current = index; + if (m_page) + m_page->didChangeBackForwardList(); + } +} + +WebBackForwardListItem* WebBackForwardList::currentItem() +{ + if (m_current != NoCurrentItemIndex) + return m_entries[m_current].get(); + return 0; +} + +WebBackForwardListItem* WebBackForwardList::backItem() +{ + if (m_current && m_current != NoCurrentItemIndex) + return m_entries[m_current - 1].get(); + return 0; +} + +WebBackForwardListItem* WebBackForwardList::forwardItem() +{ + if (m_entries.size() && m_current < m_entries.size() - 1) + return m_entries[m_current + 1].get(); + return 0; +} + +WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index) +{ + // Do range checks without doing math on index to avoid overflow. + if (index < -static_cast<int>(m_current)) + return 0; + + if (index > forwardListCount()) + return 0; + + return m_entries[index + m_current].get(); +} + +int WebBackForwardList::backListCount() +{ + return m_current == NoCurrentItemIndex ? 0 : m_current; +} + +int WebBackForwardList::forwardListCount() +{ + return m_current == NoCurrentItemIndex ? 0 : static_cast<int>(m_entries.size()) - (m_current + 1); +} + +PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned limit) +{ + unsigned backListSize = static_cast<unsigned>(backListCount()); + unsigned size = std::min(backListSize, limit); + if (!size) + return ImmutableArray::create(); + + Vector<RefPtr<APIObject> > vector; + vector.reserveInitialCapacity(size); + + ASSERT(backListSize >= size); + for (unsigned i = backListSize - size; i < backListSize; ++i) + vector.uncheckedAppend(m_entries[i].get()); + + return ImmutableArray::adopt(vector); +} + +PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLimit(unsigned limit) +{ + unsigned size = std::min(static_cast<unsigned>(forwardListCount()), limit); + if (!size) + return ImmutableArray::create(); + + Vector<RefPtr<APIObject> > vector; + vector.reserveInitialCapacity(size); + + unsigned last = m_current + size; + ASSERT(last < m_entries.size()); + for (unsigned i = m_current + 1; i <= last; ++i) + vector.uncheckedAppend(m_entries[i].get()); + + return ImmutableArray::adopt(vector); +} + +void WebBackForwardList::clear() +{ + size_t size = m_entries.size(); + if (size <= 1) + return; + + RefPtr<WebBackForwardListItem> currentItem = this->currentItem(); + + if (m_page) { + for (size_t i = 0; i < size; ++i) { + if (m_entries[i] != currentItem) + m_page->backForwardRemovedItem(m_entries[i]->itemID()); + } + } + + m_entries.shrink(1); + m_entries[0] = currentItem.release(); + + m_current = 0; + + if (m_page) + m_page->didChangeBackForwardList(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h new file mode 100644 index 0000000..f51ab26 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebBackForwardList.h @@ -0,0 +1,100 @@ +/* + * 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 + * 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 WebBackForwardList_h +#define WebBackForwardList_h + +#include "APIObject.h" +#include "ImmutableArray.h" +#include "WebBackForwardListItem.h" +#include "WebPageProxy.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> +#if PLATFORM(CF) +#include <CoreFoundation/CFDictionary.h> +#endif + +namespace WebKit { + +typedef Vector<RefPtr<WebBackForwardListItem> > BackForwardListItemVector; + +/* + * Current + * |---------*--------------| Entries + * Back Forward + */ + +class WebBackForwardList : public APIObject { +public: + static const Type APIType = TypeBackForwardList; + + static PassRefPtr<WebBackForwardList> create(WebPageProxy* page) + { + return adoptRef(new WebBackForwardList(page)); + } + void pageClosed(); + + virtual ~WebBackForwardList(); + + void addItem(WebBackForwardListItem*); + void goToItem(WebBackForwardListItem*); + void clear(); + + WebBackForwardListItem* currentItem(); + WebBackForwardListItem* backItem(); + WebBackForwardListItem* forwardItem(); + WebBackForwardListItem* itemAtIndex(int); + + const BackForwardListItemVector& entries() const { return m_entries; } + + uint32_t currentIndex() { return m_current; } + int backListCount(); + int forwardListCount(); + + PassRefPtr<ImmutableArray> backListAsImmutableArrayWithLimit(unsigned limit); + PassRefPtr<ImmutableArray> forwardListAsImmutableArrayWithLimit(unsigned limit); + +#if PLATFORM(CF) + CFDictionaryRef createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback, void* context) const; + bool restoreFromCFDictionaryRepresentation(CFDictionaryRef); +#endif + +private: + WebBackForwardList(WebPageProxy*); + + virtual Type type() const { return APIType; } + + WebPageProxy* m_page; + BackForwardListItemVector m_entries; + uint32_t m_current; + uint32_t m_capacity; + bool m_closed; + bool m_enabled; +}; + +} // namespace WebKit + +#endif // WebBackForwardList_h diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp new file mode 100644 index 0000000..2c75cf2 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -0,0 +1,602 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContext.h" + +#include "DownloadProxy.h" +#include "ImmutableArray.h" +#include "InjectedBundleMessageKinds.h" +#include "RunLoop.h" +#include "SandboxExtension.h" +#include "TextChecker.h" +#include "WKContextPrivate.h" +#include "WebContextMessageKinds.h" +#include "WebContextUserMessageCoders.h" +#include "WebCoreArgumentCoders.h" +#include "WebDatabaseManagerProxy.h" +#include "WebGeolocationManagerProxy.h" +#include "WebPageGroup.h" +#include "WebMemorySampler.h" +#include "WebProcessCreationParameters.h" +#include "WebProcessManager.h" +#include "WebProcessMessages.h" +#include "WebProcessProxy.h" +#include <WebCore/Language.h> +#include <WebCore/LinkHash.h> +#include <wtf/CurrentTime.h> + +#ifndef NDEBUG +#include <wtf/RefCountedLeakCounter.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +#ifndef NDEBUG +static WTF::RefCountedLeakCounter webContextCounter("WebContext"); +#endif + +WebContext* WebContext::sharedProcessContext() +{ + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + static WebContext* context = adoptRef(new WebContext(ProcessModelSharedSecondaryProcess, String())).leakRef(); + return context; +} + +WebContext* WebContext::sharedThreadContext() +{ + RunLoop::initializeMainRunLoop(); + static WebContext* context = adoptRef(new WebContext(ProcessModelSharedSecondaryThread, String())).leakRef(); + return context; +} + +PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath) +{ + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + return adoptRef(new WebContext(ProcessModelSecondaryProcess, injectedBundlePath)); +} + +WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePath) + : m_processModel(processModel) + , m_defaultPageGroup(WebPageGroup::create()) + , m_injectedBundlePath(injectedBundlePath) + , m_visitedLinkProvider(this) + , m_alwaysUsesComplexTextCodePath(false) + , m_cacheModel(CacheModelDocumentViewer) + , m_clearResourceCachesForNewWebProcess(false) + , m_clearApplicationCacheForNewWebProcess(false) + , m_memorySamplerEnabled(false) + , m_memorySamplerInterval(1400.0) + , m_databaseManagerProxy(WebDatabaseManagerProxy::create(this)) + , m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this)) +#if PLATFORM(WIN) + , m_shouldPaintNativeControls(true) +#endif +{ + addLanguageChangeObserver(this, languageChanged); + +#ifndef NDEBUG + webContextCounter.increment(); +#endif +} + +WebContext::~WebContext() +{ + removeLanguageChangeObserver(this); + + WebProcessManager::shared().contextWasDestroyed(this); + + m_geolocationManagerProxy->invalidate(); + m_geolocationManagerProxy->clearContext(); + +#ifndef NDEBUG + webContextCounter.decrement(); +#endif +} + +void WebContext::initializeInjectedBundleClient(const WKContextInjectedBundleClient* client) +{ + m_injectedBundleClient.initialize(client); +} + +void WebContext::initializeHistoryClient(const WKContextHistoryClient* client) +{ + m_historyClient.initialize(client); + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::SetShouldTrackVisitedLinks(m_historyClient.shouldTrackVisitedLinks()), 0); +} + +void WebContext::initializeDownloadClient(const WKContextDownloadClient* client) +{ + m_downloadClient.initialize(client); +} + +void WebContext::languageChanged(void* context) +{ + static_cast<WebContext*>(context)->languageChanged(); +} + +void WebContext::languageChanged() +{ + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::LanguageChanged(defaultLanguage()), 0); +} + +void WebContext::ensureWebProcess() +{ + if (m_process) + return; + + m_process = WebProcessManager::shared().getWebProcess(this); + + WebProcessCreationParameters parameters; + + parameters.applicationCacheDirectory = applicationCacheDirectory(); + + if (!injectedBundlePath().isEmpty()) { + parameters.injectedBundlePath = injectedBundlePath(); + + SandboxExtension::createHandle(parameters.injectedBundlePath, SandboxExtension::ReadOnly, parameters.injectedBundlePathExtensionHandle); + } + + parameters.shouldTrackVisitedLinks = m_historyClient.shouldTrackVisitedLinks(); + parameters.cacheModel = m_cacheModel; + parameters.languageCode = defaultLanguage(); + parameters.applicationCacheDirectory = applicationCacheDirectory(); + parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess; + parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess; +#if PLATFORM(MAC) + parameters.presenterApplicationPid = getpid(); +#endif + + m_clearResourceCachesForNewWebProcess = false; + m_clearApplicationCacheForNewWebProcess = false; + + copyToVector(m_schemesToRegisterAsEmptyDocument, parameters.urlSchemesRegistererdAsEmptyDocument); + copyToVector(m_schemesToRegisterAsSecure, parameters.urlSchemesRegisteredAsSecure); + copyToVector(m_schemesToSetDomainRelaxationForbiddenFor, parameters.urlSchemesForWhichDomainRelaxationIsForbidden); + + parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath; + + parameters.textCheckerState = TextChecker::state(); + + // Add any platform specific parameters + platformInitializeWebProcess(parameters); + + m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(m_injectedBundleInitializationUserData.get())), 0); + + 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_pendingMessagesToPostToInjectedBundle.clear(); +} + +void WebContext::processDidFinishLaunching(WebProcessProxy* process) +{ + // FIXME: Once we support multiple processes per context, this assertion won't hold. + ASSERT_UNUSED(process, process == m_process); + + m_visitedLinkProvider.processDidFinishLaunching(); + + // Sometimes the memorySampler gets initialized after process initialization has happened but before the process has finished launching + // so check if it needs to be started here + if(m_memorySamplerEnabled) { + SandboxExtension::Handle sampleLogSandboxHandle; + double now = WTF::currentTime(); + String sampleLogFilePath = String::format("WebProcess%llu", static_cast<uint64_t>(now)); + sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle); + + m_process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0); + } +} + +void WebContext::processDidClose(WebProcessProxy* process) +{ + // FIXME: Once we support multiple processes per context, this assertion won't hold. + ASSERT_UNUSED(process, process == m_process); + + m_visitedLinkProvider.processDidClose(); + + // Invalidate all outstanding downloads. + for (HashMap<uint64_t, RefPtr<DownloadProxy> >::iterator::Values it = m_downloads.begin().values(), end = m_downloads.end().values(); it != end; ++it) { + (*it)->processDidClose(); + (*it)->invalidate(); + } + + m_downloads.clear(); + + m_databaseManagerProxy->invalidate(); + m_geolocationManagerProxy->invalidate(); + + m_process = 0; +} + +WebPageProxy* WebContext::createWebPage(PageClient* pageClient, WebPageGroup* pageGroup) +{ + ensureWebProcess(); + + if (!pageGroup) + pageGroup = m_defaultPageGroup.get(); + + return m_process->createWebPage(pageClient, this, pageGroup); +} + +void WebContext::relaunchProcessIfNecessary() +{ + ensureWebProcess(); +} + +void WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest& request) +{ + uint64_t downloadID = createDownloadProxy(); + uint64_t initiatingPageID = initiatingPage ? initiatingPage->pageID() : 0; + + process()->send(Messages::WebProcess::DownloadRequest(downloadID, initiatingPageID, request), 0); +} + +void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) +{ + if (!m_process || !m_process->canSendMessage()) { + m_pendingMessagesToPostToInjectedBundle.append(make_pair(messageName, messageBody)); + return; + } + + // 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))); +} + +// InjectedBundle client + +void WebContext::didReceiveMessageFromInjectedBundle(const String& messageName, APIObject* messageBody) +{ + m_injectedBundleClient.didReceiveMessageFromInjectedBundle(this, messageName, messageBody); +} + +void WebContext::didReceiveSynchronousMessageFromInjectedBundle(const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData) +{ + m_injectedBundleClient.didReceiveSynchronousMessageFromInjectedBundle(this, messageName, messageBody, returnData); +} + +// HistoryClient + +void WebContext::didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore& store, uint64_t frameID) +{ + WebFrameProxy* frame = m_process->webFrame(frameID); + if (!frame->page()) + return; + + m_historyClient.didNavigateWithNavigationData(this, frame->page(), store, frame); +} + +void WebContext::didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID) +{ + WebFrameProxy* frame = m_process->webFrame(frameID); + if (!frame->page()) + return; + + m_historyClient.didPerformClientRedirect(this, frame->page(), sourceURLString, destinationURLString, frame); +} + +void WebContext::didPerformServerRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID) +{ + WebFrameProxy* frame = m_process->webFrame(frameID); + if (!frame->page()) + return; + + m_historyClient.didPerformServerRedirect(this, frame->page(), sourceURLString, destinationURLString, frame); +} + +void WebContext::didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID) +{ + WebFrameProxy* frame = m_process->webFrame(frameID); + if (!frame->page()) + return; + + m_historyClient.didUpdateHistoryTitle(this, frame->page(), title, url, frame); +} + +void WebContext::populateVisitedLinks() +{ + m_historyClient.populateVisitedLinks(this); +} + +WebContext::Statistics& WebContext::statistics() +{ + static Statistics statistics = Statistics(); + + return statistics; +} + +void WebContext::setAdditionalPluginsDirectory(const String& directory) +{ + Vector<String> directories; + directories.append(directory); + + m_pluginInfoStore.setAdditionalPluginsDirectories(directories); +} + +void WebContext::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText) +{ + m_alwaysUsesComplexTextCodePath = alwaysUseComplexText; + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::SetAlwaysUsesComplexTextCodePath(alwaysUseComplexText), 0); +} + +void WebContext::registerURLSchemeAsEmptyDocument(const String& urlScheme) +{ + m_schemesToRegisterAsEmptyDocument.add(urlScheme); + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::RegisterURLSchemeAsEmptyDocument(urlScheme), 0); +} + +void WebContext::registerURLSchemeAsSecure(const String& urlScheme) +{ + m_schemesToRegisterAsSecure.add(urlScheme); + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::RegisterURLSchemeAsSecure(urlScheme), 0); +} + +void WebContext::setDomainRelaxationForbiddenForURLScheme(const String& urlScheme) +{ + m_schemesToSetDomainRelaxationForbiddenFor.add(urlScheme); + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::SetDomainRelaxationForbiddenForURLScheme(urlScheme), 0); +} + +void WebContext::setCacheModel(CacheModel cacheModel) +{ + m_cacheModel = cacheModel; + + if (!hasValidProcess()) + return; + m_process->send(Messages::WebProcess::SetCacheModel(static_cast<uint32_t>(m_cacheModel)), 0); +} + +void WebContext::addVisitedLink(const String& visitedURL) +{ + if (visitedURL.isEmpty()) + return; + + LinkHash linkHash = visitedLinkHash(visitedURL.characters(), visitedURL.length()); + addVisitedLinkHash(linkHash); +} + +void WebContext::addVisitedLinkHash(LinkHash linkHash) +{ + m_visitedLinkProvider.addVisitedLink(linkHash); +} + +void WebContext::getPlugins(bool refresh, Vector<PluginInfo>& plugins) +{ + if (refresh) + pluginInfoStore()->refresh(); + pluginInfoStore()->getPlugins(plugins); +} + +void WebContext::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath) +{ + String newMimeType = mimeType.lower(); + + PluginInfoStore::Plugin plugin = pluginInfoStore()->findPlugin(newMimeType, KURL(ParsedURLString, urlString)); + if (!plugin.path) + return; + + pluginPath = plugin.path; +} + +uint64_t WebContext::createDownloadProxy() +{ + RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this); + uint64_t downloadID = downloadProxy->downloadID(); + + m_downloads.set(downloadID, downloadProxy.release()); + + return downloadID; +} + +void WebContext::downloadFinished(DownloadProxy* downloadProxy) +{ + ASSERT(m_downloads.contains(downloadProxy->downloadID())); + + downloadProxy->invalidate(); + m_downloads.remove(downloadProxy->downloadID()); +} + +// FIXME: This is not the ideal place for this function. +HashSet<String, CaseFoldingHash> WebContext::pdfAndPostScriptMIMETypes() +{ + HashSet<String, CaseFoldingHash> mimeTypes; + + mimeTypes.add("application/pdf"); + mimeTypes.add("application/postscript"); + mimeTypes.add("text/pdf"); + + return mimeTypes; +} + +void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (messageID.is<CoreIPC::MessageClassWebContext>()) { + didReceiveWebContextMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassDownloadProxy>()) { + if (DownloadProxy* downloadProxy = m_downloads.get(arguments->destinationID()).get()) + downloadProxy->didReceiveDownloadProxyMessage(connection, messageID, arguments); + + return; + } + + if (messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) { + m_databaseManagerProxy->didReceiveWebDatabaseManagerProxyMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()) { + m_geolocationManagerProxy->didReceiveMessage(connection, messageID, arguments); + return; + } + + switch (messageID.get<WebContextLegacyMessage::Kind>()) { + case WebContextLegacyMessage::PostMessage: { + String messageName; + RefPtr<APIObject> messageBody; + WebContextUserMessageDecoder messageDecoder(messageBody, this); + if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) + return; + + didReceiveMessageFromInjectedBundle(messageName, messageBody.get()); + return; + } + case WebContextLegacyMessage::PostSynchronousMessage: + ASSERT_NOT_REACHED(); + } + + ASSERT_NOT_REACHED(); +} + +CoreIPC::SyncReplyMode WebContext::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + if (messageID.is<CoreIPC::MessageClassWebContext>()) + return didReceiveSyncWebContextMessage(connection, messageID, arguments, reply); + + if (messageID.is<CoreIPC::MessageClassDownloadProxy>()) { + if (DownloadProxy* downloadProxy = m_downloads.get(arguments->destinationID()).get()) + return downloadProxy->didReceiveSyncDownloadProxyMessage(connection, messageID, arguments, reply); + + return CoreIPC::AutomaticReply; + } + + switch (messageID.get<WebContextLegacyMessage::Kind>()) { + case WebContextLegacyMessage::PostSynchronousMessage: { + // FIXME: We should probably encode something in the case that the arguments do not decode correctly. + + String messageName; + RefPtr<APIObject> messageBody; + WebContextUserMessageDecoder messageDecoder(messageBody, this); + if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) + return CoreIPC::AutomaticReply; + + RefPtr<APIObject> returnData; + didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody.get(), returnData); + reply->encode(CoreIPC::In(WebContextUserMessageEncoder(returnData.get()))); + return CoreIPC::AutomaticReply; + } + case WebContextLegacyMessage::PostMessage: + ASSERT_NOT_REACHED(); + } + + return CoreIPC::AutomaticReply; +} + +void WebContext::clearResourceCaches() +{ + if (!hasValidProcess()) { + // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to + // clear the resource cache will be respected. But if the user quits the application before another WebProcess is created, + // their request will be ignored. + m_clearResourceCachesForNewWebProcess = true; + return; + } + + m_process->send(Messages::WebProcess::ClearResourceCaches(), 0); +} + +void WebContext::clearApplicationCache() +{ + if (!hasValidProcess()) { + // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to + // clear the application cache will be respected. But if the user quits the application before another WebProcess is created, + // their request will be ignored. + m_clearApplicationCacheForNewWebProcess = true; + return; + } + + m_process->send(Messages::WebProcess::ClearApplicationCache(), 0); +} + +void WebContext::startMemorySampler(const double interval) +{ + // For new WebProcesses we will also want to start the Memory Sampler + m_memorySamplerEnabled = true; + m_memorySamplerInterval = interval; + + // For UIProcess +#if ENABLE(MEMORY_SAMPLER) + WebMemorySampler::shared()->start(interval); +#endif + + if (!hasValidProcess()) + return; + + // For WebProcess + SandboxExtension::Handle sampleLogSandboxHandle; + double now = WTF::currentTime(); + String sampleLogFilePath = String::format("WebProcess%llu", static_cast<uint64_t>(now)); + sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle); + + m_process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, interval), 0); +} + +void WebContext::stopMemorySampler() +{ + // For WebProcess + m_memorySamplerEnabled = false; + + // For UIProcess +#if ENABLE(MEMORY_SAMPLER) + WebMemorySampler::shared()->stop(); +#endif + + if (!hasValidProcess()) + return; + + m_process->send(Messages::WebProcess::StopMemorySampler(), 0); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h new file mode 100644 index 0000000..9996198 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -0,0 +1,210 @@ +/* + * 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 WebContext_h +#define WebContext_h + +#include "APIObject.h" +#include "PluginInfoStore.h" +#include "ProcessModel.h" +#include "VisitedLinkProvider.h" +#include "WebContextInjectedBundleClient.h" +#include "WebDownloadClient.h" +#include "WebHistoryClient.h" +#include "WebProcessProxy.h" +#include <WebCore/LinkHash.h> +#include <wtf/Forward.h> +#include <wtf/HashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class DownloadProxy; +class WebDatabaseManagerProxy; +class WebGeolocationManagerProxy; +class WebPageGroup; +class WebPageProxy; +struct WebProcessCreationParameters; + +class WebContext : public APIObject { +public: + static const Type APIType = TypeContext; + + static WebContext* sharedProcessContext(); + static WebContext* sharedThreadContext(); + + static PassRefPtr<WebContext> create(const String& injectedBundlePath); + virtual ~WebContext(); + + void initializeInjectedBundleClient(const WKContextInjectedBundleClient*); + void initializeHistoryClient(const WKContextHistoryClient*); + void initializeDownloadClient(const WKContextDownloadClient*); + + ProcessModel processModel() const { return m_processModel; } + WebProcessProxy* process() const { return m_process.get(); } + + void processDidFinishLaunching(WebProcessProxy*); + void processDidClose(WebProcessProxy*); + + WebPageProxy* createWebPage(PageClient*, WebPageGroup*); + + void relaunchProcessIfNecessary(); + + const String& injectedBundlePath() const { return m_injectedBundlePath; } + + void download(WebPageProxy* initiatingPage, const WebCore::ResourceRequest&); + + void setInjectedBundleInitializationUserData(PassRefPtr<APIObject> userData) { m_injectedBundleInitializationUserData = userData; } + APIObject* injectedBundleInitializationUserData() const { return m_injectedBundleInitializationUserData.get(); } + + void postMessageToInjectedBundle(const String&, APIObject*); + + // InjectedBundle client + void didReceiveMessageFromInjectedBundle(const String&, APIObject*); + void didReceiveSynchronousMessageFromInjectedBundle(const String&, APIObject*, RefPtr<APIObject>& returnData); + + void populateVisitedLinks(); + + void setAdditionalPluginsDirectory(const String&); + + PluginInfoStore* pluginInfoStore() { return &m_pluginInfoStore; } + String applicationCacheDirectory(); + + void setAlwaysUsesComplexTextCodePath(bool); + + void registerURLSchemeAsEmptyDocument(const String&); + void registerURLSchemeAsSecure(const String&); + void setDomainRelaxationForbiddenForURLScheme(const String&); + + void addVisitedLink(const String&); + void addVisitedLinkHash(WebCore::LinkHash); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + void setCacheModel(CacheModel); + CacheModel cacheModel() const { return m_cacheModel; } + void clearResourceCaches(); + void clearApplicationCache(); + + void startMemorySampler(const double interval); + void stopMemorySampler(); + +#if PLATFORM(WIN) + void setShouldPaintNativeControls(bool); +#endif + + // Downloads. + uint64_t createDownloadProxy(); + WebDownloadClient& downloadClient() { return m_downloadClient; } + void downloadFinished(DownloadProxy*); + + static HashSet<String, CaseFoldingHash> pdfAndPostScriptMIMETypes(); + + WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); } + WebGeolocationManagerProxy* geolocationManagerProxy() const { return m_geolocationManagerProxy.get(); } + + struct Statistics { + unsigned wkViewCount; + unsigned wkPageCount; + unsigned wkFrameCount; + }; + static Statistics& statistics(); + +private: + WebContext(ProcessModel, const String& injectedBundlePath); + + virtual Type type() const { return APIType; } + + void ensureWebProcess(); + bool hasValidProcess() const { return m_process && m_process->isValid(); } + void platformInitializeWebProcess(WebProcessCreationParameters&); + + // History client + void didNavigateWithNavigationData(uint64_t pageID, const WebNavigationDataStore& store, uint64_t frameID); + void didPerformClientRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID); + void didPerformServerRedirect(uint64_t pageID, const String& sourceURLString, const String& destinationURLString, uint64_t frameID); + void didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID); + + // Plugins + void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins); + void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath); + + // Implemented in generated WebContextMessageReceiver.cpp + void didReceiveWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + static void languageChanged(void* context); + void languageChanged(); + + ProcessModel m_processModel; + + // FIXME: In the future, this should be one or more WebProcessProxies. + RefPtr<WebProcessProxy> m_process; + + RefPtr<WebPageGroup> m_defaultPageGroup; + + RefPtr<APIObject> m_injectedBundleInitializationUserData; + String m_injectedBundlePath; + WebContextInjectedBundleClient m_injectedBundleClient; + + WebHistoryClient m_historyClient; + + PluginInfoStore m_pluginInfoStore; + VisitedLinkProvider m_visitedLinkProvider; + + HashSet<String> m_schemesToRegisterAsEmptyDocument; + HashSet<String> m_schemesToRegisterAsSecure; + HashSet<String> m_schemesToSetDomainRelaxationForbiddenFor; + + bool m_alwaysUsesComplexTextCodePath; + + Vector<pair<String, RefPtr<APIObject> > > m_pendingMessagesToPostToInjectedBundle; + + CacheModel m_cacheModel; + + WebDownloadClient m_downloadClient; + HashMap<uint64_t, RefPtr<DownloadProxy> > m_downloads; + + bool m_clearResourceCachesForNewWebProcess; + bool m_clearApplicationCacheForNewWebProcess; + + bool m_memorySamplerEnabled; + double m_memorySamplerInterval; + + RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy; + RefPtr<WebGeolocationManagerProxy> m_geolocationManagerProxy; + +#if PLATFORM(WIN) + bool m_shouldPaintNativeControls; +#endif +}; + +} // namespace WebKit + +#endif // WebContext_h diff --git a/Source/WebKit2/UIProcess/WebContext.messages.in b/Source/WebKit2/UIProcess/WebContext.messages.in new file mode 100644 index 0000000..dc15de2 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContext.messages.in @@ -0,0 +1,38 @@ +# 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. + +messages -> WebContext { + + # History client messages. + DidNavigateWithNavigationData(uint64_t pageID, WebKit::WebNavigationDataStore store, uint64_t frameID) + DidPerformClientRedirect(uint64_t pageID, WTF::String sourceURLString, WTF::String destinationURLString, uint64_t frameID) + DidPerformServerRedirect(uint64_t pageID, WTF::String sourceURLString, WTF::String destinationURLString, uint64_t frameID) + DidUpdateHistoryTitle(uint64_t pageID, WTF::String title, WTF::String url, uint64_t frameID) + + # Visited link provider messages. + AddVisitedLinkHash(uint64_t linkHash) + + # Plugin messages. + GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins) + GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath) + +} diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp new file mode 100644 index 0000000..97613f8 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextInjectedBundleClient.h" + +#include "WKAPICast.h" +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +void WebContextInjectedBundleClient::didReceiveMessageFromInjectedBundle(WebContext* context, const String& messageName, APIObject* messageBody) +{ + if (!m_client.didReceiveMessageFromInjectedBundle) + return; + + m_client.didReceiveMessageFromInjectedBundle(toAPI(context), toAPI(messageName.impl()), toAPI(messageBody), m_client.clientInfo); +} + +void WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle(WebContext* context, const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData) +{ + if (!m_client.didReceiveSynchronousMessageFromInjectedBundle) + return; + + WKTypeRef returnDataRef = 0; + m_client.didReceiveSynchronousMessageFromInjectedBundle(toAPI(context), toAPI(messageName.impl()), toAPI(messageBody), &returnDataRef, m_client.clientInfo); + returnData = adoptRef(toImpl(returnDataRef)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h new file mode 100644 index 0000000..d5eafc5 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h @@ -0,0 +1,46 @@ +/* + * 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 WebContextInjectedBundleClient_h +#define WebContextInjectedBundleClient_h + +#include "APIClient.h" +#include "WKContext.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class APIObject; +class WebContext; + +class WebContextInjectedBundleClient : public APIClient<WKContextInjectedBundleClient> { +public: + void didReceiveMessageFromInjectedBundle(WebContext*, const String&, APIObject*); + void didReceiveSynchronousMessageFromInjectedBundle(WebContext*, const String&, APIObject*, RefPtr<APIObject>& returnData); +}; + +} // namespace WebKit + +#endif // WebContextInjectedBundleClient_h diff --git a/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp new file mode 100644 index 0000000..887a260 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContextMenuProxy.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "WebContextMenuProxy.h" + +namespace WebKit { + +WebContextMenuProxy::WebContextMenuProxy() +{ +} + +WebContextMenuProxy::~WebContextMenuProxy() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContextMenuProxy.h b/Source/WebKit2/UIProcess/WebContextMenuProxy.h new file mode 100644 index 0000000..098552d --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContextMenuProxy.h @@ -0,0 +1,54 @@ +/* + * 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 WebContextMenuProxy_h +#define WebContextMenuProxy_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + class IntPoint; +} + +namespace WebKit { + +class WebContextMenuItemData; + +class WebContextMenuProxy : public RefCounted<WebContextMenuProxy> { +public: + virtual ~WebContextMenuProxy(); + + virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>& items) = 0; + virtual void hideContextMenu() = 0; + +protected: + WebContextMenuProxy(); +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxy_h diff --git a/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h new file mode 100644 index 0000000..bb2ba39 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "UserMessageCoders.h" +#include "WebContext.h" +#include "WebFrameProxy.h" +#include "WebPageGroup.h" +#include "WebPageGroupData.h" +#include "WebPageProxy.h" + +namespace WebKit { + +// Adds +// - Page -> BundlePage +// - Frame -> BundleFrame +// - PageGroup -> BundlePageGroup + +class WebContextUserMessageEncoder : public UserMessageEncoder<WebContextUserMessageEncoder> { +public: + typedef UserMessageEncoder<WebContextUserMessageEncoder> Base; + + WebContextUserMessageEncoder(APIObject* root) + : Base(root) + { + } + + void encode(CoreIPC::ArgumentEncoder* encoder) const + { + APIObject::Type type = APIObject::TypeNull; + if (baseEncode(encoder, type)) + return; + + switch (type) { + case APIObject::TypePage: { + WebPageProxy* page = static_cast<WebPageProxy*>(m_root); + encoder->encode(page->pageID()); + break; + } + case APIObject::TypeFrame: { + WebFrameProxy* frame = static_cast<WebFrameProxy*>(m_root); + encoder->encode(frame->frameID()); + break; + } + case APIObject::TypePageGroup: { + WebPageGroup* pageGroup = static_cast<WebPageGroup*>(m_root); + encoder->encode(pageGroup->data()); + break; + } + default: + ASSERT_NOT_REACHED(); + break; + } + } +}; + +// Adds +// - Page -> BundlePage +// - Frame -> BundleFrame +// - PageGroup -> BundlePageGroup + +class WebContextUserMessageDecoder : public UserMessageDecoder<WebContextUserMessageDecoder> { +public: + typedef UserMessageDecoder<WebContextUserMessageDecoder> Base; + + WebContextUserMessageDecoder(RefPtr<APIObject>& root, WebContext* context) + : Base(root) + , m_context(context) + { + } + + WebContextUserMessageDecoder(WebContextUserMessageDecoder& userMessageDecoder, RefPtr<APIObject>& root) + : Base(root) + , m_context(userMessageDecoder.m_context) + { + } + + static bool decode(CoreIPC::ArgumentDecoder* decoder, WebContextUserMessageDecoder& coder) + { + APIObject::Type type = APIObject::TypeNull; + if (!Base::baseDecode(decoder, coder, type)) + return false; + + if (coder.m_root || type == APIObject::TypeNull) + return true; + + switch (type) { + case APIObject::TypeBundlePage: { + uint64_t pageID; + if (!decoder->decode(pageID)) + return false; + coder.m_root = coder.m_context->process()->webPage(pageID); + break; + } + case APIObject::TypeBundleFrame: { + uint64_t frameID; + if (!decoder->decode(frameID)) + return false; + coder.m_root = coder.m_context->process()->webFrame(frameID); + break; + } + case APIObject::TypeBundlePageGroup: { + uint64_t pageGroupID; + if (!decoder->decode(pageGroupID)) + return false; + coder.m_root = WebPageGroup::get(pageGroupID); + break; + } + default: + return false; + } + + return true; + } + +private: + WebContext* m_context; +}; + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp new file mode 100644 index 0000000..6f382b7 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManagerProxy.h" + +#include "ImmutableArray.h" +#include "ImmutableDictionary.h" +#include "WebDatabaseManagerMessages.h" +#include "WebContext.h" +#include "WebSecurityOrigin.h" + +using namespace WebCore; + +namespace WebKit { + +String WebDatabaseManagerProxy::originKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerOriginKey")); + return key; +} + +String WebDatabaseManagerProxy::originQuotaKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerOriginQuotaKey")); + return key; +} + +String WebDatabaseManagerProxy::originUsageKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerOriginUsageKey")); + return key; +} + +String WebDatabaseManagerProxy::databaseDetailsKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerDatabaseDetailsKey")); + return key; +} + +String WebDatabaseManagerProxy::databaseDetailsNameKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerDatabaseDetailsNameKey")); + return key; +} + +String WebDatabaseManagerProxy::databaseDetailsDisplayNameKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerDatabaseDetailsDisplayNameKey")); + return key; +} + +String WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerDatabaseDetailsExpectedUsageKey")); + return key; +} + +String WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey() +{ + DEFINE_STATIC_LOCAL(String, key, ("WebDatabaseManagerDatabaseDetailsCurrentUsageKey")); + return key; +} + +PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext* webContext) +{ + return adoptRef(new WebDatabaseManagerProxy(webContext)); +} + +WebDatabaseManagerProxy::WebDatabaseManagerProxy(WebContext* webContext) + : m_webContext(webContext) +{ +} + +WebDatabaseManagerProxy::~WebDatabaseManagerProxy() +{ +} + +void WebDatabaseManagerProxy::invalidate() +{ + invalidateCallbackMap(m_arrayCallbacks); + + m_webContext = 0; +} + +void WebDatabaseManagerProxy::initializeClient(const WKDatabaseManagerClient* client) +{ + m_client.initialize(client); +} + +void WebDatabaseManagerProxy::getDatabasesByOrigin(PassRefPtr<ArrayCallback> prpCallback) +{ + RefPtr<ArrayCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_arrayCallbacks.set(callbackID, callback.release()); + m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabasesByOrigin(callbackID), 0); +} + + +void WebDatabaseManagerProxy::didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabasesVector, uint64_t callbackID) +{ + RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + size_t originAndDatabasesCount = originAndDatabasesVector.size(); + Vector<RefPtr<APIObject> > result(originAndDatabasesCount); + + for (size_t i = 0; i < originAndDatabasesCount; ++i) { + const OriginAndDatabases& originAndDatabases = originAndDatabasesVector[i]; + + RefPtr<APIObject> origin = WebSecurityOrigin::create(originAndDatabases.originIdentifier); + + size_t databasesCount = originAndDatabases.databases.size(); + Vector<RefPtr<APIObject> > databases(databasesCount); + + for (size_t j = 0; j < databasesCount; ++j) { + const DatabaseDetails& details = originAndDatabases.databases[i]; + HashMap<String, RefPtr<APIObject> > detailsMap; + + detailsMap.set(databaseDetailsNameKey(), WebString::create(details.name())); + detailsMap.set(databaseDetailsDisplayNameKey(), WebString::create(details.displayName())); + detailsMap.set(databaseDetailsExpectedUsageKey(), WebUInt64::create(details.expectedUsage())); + detailsMap.set(databaseDetailsCurrentUsageKey(), WebUInt64::create(details.currentUsage())); + databases.append(ImmutableDictionary::adopt(detailsMap)); + } + + HashMap<String, RefPtr<APIObject> > originAndDatabasesMap; + originAndDatabasesMap.set(originKey(), origin); + originAndDatabasesMap.set(originQuotaKey(), WebUInt64::create(originAndDatabases.originQuota)); + originAndDatabasesMap.set(originUsageKey(), WebUInt64::create(originAndDatabases.originUsage)); + originAndDatabasesMap.set(databaseDetailsKey(), ImmutableArray::adopt(databases)); + + result.append(ImmutableDictionary::adopt(originAndDatabasesMap)); + } + + RefPtr<ImmutableArray> resultArray = ImmutableArray::adopt(result); + callback->performCallbackWithReturnValue(resultArray.get()); +} + +void WebDatabaseManagerProxy::getDatabaseOrigins(PassRefPtr<ArrayCallback> prpCallback) +{ + RefPtr<ArrayCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_arrayCallbacks.set(callbackID, callback.release()); + m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabaseOrigins(callbackID), 0); +} + +void WebDatabaseManagerProxy::didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID) +{ + RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + size_t originIdentifiersCount = originIdentifiers.size(); + Vector<RefPtr<APIObject> > securityOrigins(originIdentifiersCount); + + for (size_t i = 0; i < originIdentifiersCount; ++i) + securityOrigins[i] = WebSecurityOrigin::create(originIdentifiers[i]); + + callback->performCallbackWithReturnValue(ImmutableArray::adopt(securityOrigins).get()); +} + +void WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, WebSecurityOrigin* origin) +{ + m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabaseWithNameForOrigin(databaseIdentifier, origin->databaseIdentifier()), 0); +} + +void WebDatabaseManagerProxy::deleteDatabasesForOrigin(WebSecurityOrigin* origin) +{ + m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabasesForOrigin(origin->databaseIdentifier()), 0); +} + +void WebDatabaseManagerProxy::deleteAllDatabases() +{ + m_webContext->process()->send(Messages::WebDatabaseManager::DeleteAllDatabases(), 0); +} + +void WebDatabaseManagerProxy::setQuotaForOrigin(WebSecurityOrigin* origin, uint64_t quota) +{ + m_webContext->process()->send(Messages::WebDatabaseManager::SetQuotaForOrigin(origin->databaseIdentifier(), quota), 0); +} + +void WebDatabaseManagerProxy::didModifyOrigin(const String& originIdentifier) +{ + RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier); + m_client.didModifyOrigin(this, origin.get()); +} + +void WebDatabaseManagerProxy::didModifyDatabase(const String& originIdentifier, const String& databaseIdentifier) +{ + RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier); + m_client.didModifyDatabase(this, origin.get(), databaseIdentifier); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h new file mode 100644 index 0000000..9878232 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h @@ -0,0 +1,98 @@ +/* + * 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 WebDatabaseManagerProxy_h +#define WebDatabaseManagerProxy_h + +#include "APIObject.h" +#include "Arguments.h" +#include "GenericCallback.h" +#include "OriginAndDatabases.h" +#include "WebDatabaseManagerProxyClient.h" +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> + +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +class MessageID; +} + +namespace WebKit { + +class WebContext; +class WebSecurityOrigin; + +typedef GenericCallback<WKArrayRef> ArrayCallback; + +class WebDatabaseManagerProxy : public APIObject { +public: + static const Type APIType = TypeDatabaseManager; + + static PassRefPtr<WebDatabaseManagerProxy> create(WebContext*); + virtual ~WebDatabaseManagerProxy(); + + void invalidate(); + + void initializeClient(const WKDatabaseManagerClient*); + + void getDatabasesByOrigin(PassRefPtr<ArrayCallback>); + void getDatabaseOrigins(PassRefPtr<ArrayCallback>); + void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, WebSecurityOrigin*); + void deleteDatabasesForOrigin(WebSecurityOrigin*); + void deleteAllDatabases(); + void setQuotaForOrigin(WebSecurityOrigin*, uint64_t quota); + + static String originKey(); + static String originQuotaKey(); + static String originUsageKey(); + static String databaseDetailsKey(); + static String databaseDetailsNameKey(); + static String databaseDetailsDisplayNameKey(); + static String databaseDetailsExpectedUsageKey(); + static String databaseDetailsCurrentUsageKey(); + + void didReceiveWebDatabaseManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + explicit WebDatabaseManagerProxy(WebContext*); + + virtual Type type() const { return APIType; } + + // Message handlers. + void didGetDatabasesByOrigin(const Vector<OriginAndDatabases>& originAndDatabases, uint64_t callbackID); + void didGetDatabaseOrigins(const Vector<String>& originIdentifiers, uint64_t callbackID); + void didModifyOrigin(const String& originIdentifier); + void didModifyDatabase(const String& originIdentifier, const String& databaseIdentifier); + + WebContext* m_webContext; + HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks; + + WebDatabaseManagerProxyClient m_client; +}; + +} // namespace WebKit + +#endif // DatabaseManagerProxy_h diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in new file mode 100644 index 0000000..37a9b89 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.messages.in @@ -0,0 +1,28 @@ +# 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. + +messages -> WebDatabaseManagerProxy { + DidGetDatabasesByOrigin(Vector<WebKit::OriginAndDatabases> originAndDatabases, uint64_t callbackID); + DidGetDatabaseOrigins(Vector<WTF::String> originIdentifiers, uint64_t callbackID) + DidModifyOrigin(WTF::String originIdentifier) + DidModifyDatabase(WTF::String originIdentifier, WTF::String databaseIdentifier) +} diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp new file mode 100644 index 0000000..8ba3a0e --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManagerProxyClient.h" + +#include "WKAPICast.h" + +namespace WebKit { + +void WebDatabaseManagerProxyClient::didModifyOrigin(WebDatabaseManagerProxy* databaseManager, WebSecurityOrigin* origin) +{ + if (!m_client.didModifyOrigin) + return; + + m_client.didModifyOrigin(toAPI(databaseManager), toAPI(origin), m_client.clientInfo); +} + +void WebDatabaseManagerProxyClient::didModifyDatabase(WebDatabaseManagerProxy* databaseManager, WebSecurityOrigin* origin, const String& databaseIdentifier) +{ + if (!m_client.didModifyDatabase) + return; + + m_client.didModifyDatabase(toAPI(databaseManager), toAPI(origin), toAPI(databaseIdentifier.impl()), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h new file mode 100644 index 0000000..f02c130 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxyClient.h @@ -0,0 +1,46 @@ +/* + * 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 WebDatabaseManagerProxyClient_h +#define WebDatabaseManagerProxyClient_h + +#include "APIClient.h" +#include "WKDatabaseManager.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class WebDatabaseManagerProxy; +class WebSecurityOrigin; + +class WebDatabaseManagerProxyClient : public APIClient<WKDatabaseManagerClient> { +public: + void didModifyOrigin(WebDatabaseManagerProxy*, WebSecurityOrigin*); + void didModifyDatabase(WebDatabaseManagerProxy*, WebSecurityOrigin*, const String& databaseIdentifier); +}; + +} // namespace WebKit + +#endif // WebDatabaseManagerProxyClient_h diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.cpp b/Source/WebKit2/UIProcess/WebDownloadClient.cpp new file mode 100644 index 0000000..d6a7bcb --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDownloadClient.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDownloadClient.h" + +#include "WKAPICast.h" +#include "WebURLResponse.h" +#include "WKRetainPtr.h" + +using namespace WebCore; + +namespace WebKit { + +void WebDownloadClient::didStart(WebContext* webContext, DownloadProxy* downloadProxy) +{ + if (!m_client.didStart) + return; + + m_client.didStart(toAPI(webContext), toAPI(downloadProxy), m_client.clientInfo); +} + +void WebDownloadClient::didReceiveResponse(WebContext* webContext, DownloadProxy* downloadProxy, const ResourceResponse& response) +{ + if (!m_client.didReceiveResponse) + return; + + m_client.didReceiveResponse(toAPI(webContext), toAPI(downloadProxy), toAPI(WebURLResponse::create(response).get()), m_client.clientInfo); +} + +void WebDownloadClient::didReceiveData(WebContext* webContext, DownloadProxy* downloadProxy, uint64_t length) +{ + if (!m_client.didReceiveData) + return; + + m_client.didReceiveData(toAPI(webContext), toAPI(downloadProxy), length, m_client.clientInfo); +} + +bool WebDownloadClient::shouldDecodeSourceDataOfMIMEType(WebContext* webContext, DownloadProxy* downloadProxy, const String& mimeType) +{ + if (!m_client.shouldDecodeSourceDataOfMIMEType) + return true; + + return m_client.shouldDecodeSourceDataOfMIMEType(toAPI(webContext), toAPI(downloadProxy), toAPI(mimeType.impl()), m_client.clientInfo); +} + +String WebDownloadClient::decideDestinationWithSuggestedFilename(WebContext* webContext, DownloadProxy* downloadProxy, const String& filename, bool& allowOverwrite) +{ + if (!m_client.decideDestinationWithSuggestedFilename) + return String(); + + WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(webContext), toAPI(downloadProxy), toAPI(filename.impl()), &allowOverwrite, m_client.clientInfo)); + return toWTFString(destination.get()); +} + +void WebDownloadClient::didCreateDestination(WebContext* webContext, DownloadProxy* downloadProxy, const String& path) +{ + if (!m_client.didCreateDestination) + return; + + m_client.didCreateDestination(toAPI(webContext), toAPI(downloadProxy), toAPI(path.impl()), m_client.clientInfo); +} + +void WebDownloadClient::didFinish(WebContext* webContext, DownloadProxy* downloadProxy) +{ + if (!m_client.didFinish) + return; + + m_client.didFinish(toAPI(webContext), toAPI(downloadProxy), m_client.clientInfo); +} + +void WebDownloadClient::didFail(WebContext* webContext, DownloadProxy* downloadProxy, const ResourceError& error) +{ + if (!m_client.didFail) + return; + + m_client.didFail(toAPI(webContext), toAPI(downloadProxy), toAPI(error), m_client.clientInfo); +} + +void WebDownloadClient::didCancel(WebContext* webContext, DownloadProxy* downloadProxy) +{ + if (!m_client.didCancel) + return; + + m_client.didCancel(toAPI(webContext), toAPI(downloadProxy), m_client.clientInfo); +} + +void WebDownloadClient::processDidCrash(WebContext* webContext, DownloadProxy* downloadProxy) +{ + if (!m_client.processDidCrash) + return; + + m_client.processDidCrash(toAPI(webContext), toAPI(downloadProxy), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebDownloadClient.h b/Source/WebKit2/UIProcess/WebDownloadClient.h new file mode 100644 index 0000000..902c870 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebDownloadClient.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 WebDownloadClient_h +#define WebDownloadClient_h + +#include "APIClient.h" +#include "WKContext.h" +#include <wtf/Forward.h> + +namespace WebCore { + class ResourceError; + class ResourceResponse; +} + +namespace WebKit { + +class DownloadProxy; +class WebContext; + +class WebDownloadClient : public APIClient<WKContextDownloadClient> { +public: + void didStart(WebContext*, DownloadProxy*); + void didReceiveResponse(WebContext*, DownloadProxy*, const WebCore::ResourceResponse&); + void didReceiveData(WebContext*, DownloadProxy*, uint64_t length); + bool shouldDecodeSourceDataOfMIMEType(WebContext*, DownloadProxy*, const String& mimeType); + String decideDestinationWithSuggestedFilename(WebContext*, DownloadProxy*, const String& filename, bool& allowOverwrite); + void didCreateDestination(WebContext*, DownloadProxy*, const String& path); + void didFinish(WebContext*, DownloadProxy*); + void didFail(WebContext*, DownloadProxy*, const WebCore::ResourceError&); + void didCancel(WebContext*, DownloadProxy*); + void processDidCrash(WebContext*, DownloadProxy*); +}; + +} // namespace WebKit + +#endif // WebDownloadClient_h diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp new file mode 100644 index 0000000..9a816e3 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEditCommandProxy.h" + +#include "WebPageMessages.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +using namespace WebCore; + +namespace WebKit { + +WebEditCommandProxy::WebEditCommandProxy(uint64_t commandID, WebCore::EditAction editAction, WebPageProxy* page) + : m_commandID(commandID) + , m_editAction(editAction) + , m_page(page) +{ + m_page->addEditCommand(this); +} + +WebEditCommandProxy::~WebEditCommandProxy() +{ + if (m_page) + m_page->removeEditCommand(this); +} + +void WebEditCommandProxy::unapply() +{ + if (!m_page || !m_page->isValid()) + return; + + m_page->process()->send(Messages::WebPage::UnapplyEditCommand(m_commandID), m_page->pageID()); + m_page->registerEditCommand(this, WebPageProxy::Undo); +} + +void WebEditCommandProxy::reapply() +{ + if (!m_page || !m_page->isValid()) + return; + + m_page->process()->send(Messages::WebPage::ReapplyEditCommand(m_commandID), m_page->pageID()); + m_page->registerEditCommand(this, WebPageProxy::Redo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebEditCommandProxy.h b/Source/WebKit2/UIProcess/WebEditCommandProxy.h new file mode 100644 index 0000000..2d21d3f --- /dev/null +++ b/Source/WebKit2/UIProcess/WebEditCommandProxy.h @@ -0,0 +1,63 @@ +/* + * 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 WebEditCommandProxy_h +#define WebEditCommandProxy_h + +#include <WebCore/EditAction.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebPageProxy; + +class WebEditCommandProxy : public RefCounted<WebEditCommandProxy> { +public: + static PassRefPtr<WebEditCommandProxy> create(uint64_t commandID, WebCore::EditAction editAction, WebPageProxy* page) + { + return adoptRef(new WebEditCommandProxy(commandID, editAction, page)); + } + ~WebEditCommandProxy(); + + uint64_t commandID() const { return m_commandID; } + WebCore::EditAction editAction() const { return m_editAction; } + + void invalidate() { m_page = 0; } + + void unapply(); + void reapply(); + +private: + WebEditCommandProxy(uint64_t commandID, WebCore::EditAction, WebPageProxy*); + + uint64_t m_commandID; + WebCore::EditAction m_editAction; + WebPageProxy* m_page; +}; + +} // namespace WebKit + +#endif // WebEditCommandProxy_h diff --git a/Source/WebKit2/UIProcess/WebFindClient.cpp b/Source/WebKit2/UIProcess/WebFindClient.cpp new file mode 100644 index 0000000..e2e8de5 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFindClient.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFindClient.h" +#include "WKAPICast.h" +#include <wtf/text/WTFString.h> + +namespace WebKit { + +void WebFindClient::didFindString(WebPageProxy* page, const String& string, uint32_t matchCount) +{ + if (!m_client.didFindString) + return; + + m_client.didFindString(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo); + +} + +void WebFindClient::didFailToFindString(WebPageProxy* page, const String& string) +{ + if (!m_client.didFailToFindString) + return; + + m_client.didFailToFindString(toAPI(page), toAPI(string.impl()), m_client.clientInfo); +} + +void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount) +{ + if (!m_client.didCountStringMatches) + return; + + m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/WebFindClient.h b/Source/WebKit2/UIProcess/WebFindClient.h new file mode 100644 index 0000000..c659c5d --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFindClient.h @@ -0,0 +1,46 @@ +/* + * 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 WebFindClient_h +#define WebFindClient_h + +#include "APIClient.h" +#include "WKPage.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class WebPageProxy; + +class WebFindClient : public APIClient<WKPageFindClient> { +public: + void didFindString(WebPageProxy*, const String&, uint32_t matchCount); + void didFailToFindString(WebPageProxy*, const String&); + void didCountStringMatches(WebPageProxy*, const String&, uint32_t matchCount); +}; + +} // namespace WebKit + +#endif // WebFindClient_h diff --git a/Source/WebKit2/UIProcess/WebFormClient.cpp b/Source/WebKit2/UIProcess/WebFormClient.cpp new file mode 100644 index 0000000..159a34c --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFormClient.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFormClient.h" + +#include "ImmutableDictionary.h" +#include "WKAPICast.h" +#include "WebString.h" +#include <wtf/text/WTFString.h> + +namespace WebKit { + +bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy* listener) +{ + if (!m_client.willSubmitForm) + return false; + + ImmutableDictionary::MapType map; + for (size_t i = 0; i < textFieldValues.size(); ++i) + map.set(textFieldValues[i].first, WebString::create(textFieldValues[i].second)); + RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map); + + m_client.willSubmitForm(toAPI(page), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), toAPI(userData), toAPI(listener), m_client.clientInfo); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebFormClient.h b/Source/WebKit2/UIProcess/WebFormClient.h new file mode 100644 index 0000000..40bc685 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFormClient.h @@ -0,0 +1,49 @@ +/* + * 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 WebFormClient_h +#define WebFormClient_h + +#include "APIClient.h" +#include "WKPage.h" +#include <utility> +#include <wtf/Forward.h> +#include <wtf/Vector.h> + +namespace WebKit { + +class APIObject; +class WebPageProxy; +class WebFrameProxy; +class WebFormSubmissionListenerProxy; + +class WebFormClient : public APIClient<WKPageFormClient> { +public: + bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, const Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy*); +}; + +} // namespace WebKit + +#endif // WebFormClient_h diff --git a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp new file mode 100644 index 0000000..10564a4 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFormSubmissionListenerProxy.h" + +namespace WebKit { + +WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy(WebFrameProxy* frame, uint64_t listenerID) + : WebFrameListenerProxy(frame, listenerID) +{ +} + +void WebFormSubmissionListenerProxy::continueSubmission() +{ + receivedPolicyDecision(WebCore::PolicyUse); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.h b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.h new file mode 100644 index 0000000..53ba3b9 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFormSubmissionListenerProxy.h @@ -0,0 +1,54 @@ +/* + * 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 WebFormSubmissionListenerProxy_h +#define WebFormSubmissionListenerProxy_h + +#include "WebFrameListenerProxy.h" + +namespace WebKit { + +class WebFrameProxy; + +class WebFormSubmissionListenerProxy : public WebFrameListenerProxy { +public: + static const Type APIType = TypeFormSubmissionListener; + + static PassRefPtr<WebFormSubmissionListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID) + { + return adoptRef(new WebFormSubmissionListenerProxy(frame, listenerID)); + } + + void continueSubmission(); + +private: + WebFormSubmissionListenerProxy(WebFrameProxy*, uint64_t listenerID); + + virtual Type type() const { return APIType; } +}; + +} // namespace WebKit + +#endif // WebFramePolicyListenerProxy_h diff --git a/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp new file mode 100644 index 0000000..c4e38ee --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFrameListenerProxy.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFrameListenerProxy.h" + +#include "WebFrameProxy.h" + +namespace WebKit { + +WebFrameListenerProxy::WebFrameListenerProxy(WebFrameProxy* frame, uint64_t listenerID) + : m_frame(frame) + , m_listenerID(listenerID) +{ +} + +WebFrameListenerProxy::~WebFrameListenerProxy() +{ +} + +void WebFrameListenerProxy::invalidate() +{ + m_frame = 0; +} + +void WebFrameListenerProxy::receivedPolicyDecision(WebCore::PolicyAction action) +{ + if (!m_frame) + return; + + m_frame->receivedPolicyDecision(action, m_listenerID); + m_frame = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebFrameListenerProxy.h b/Source/WebKit2/UIProcess/WebFrameListenerProxy.h new file mode 100644 index 0000000..fd9ad71 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFrameListenerProxy.h @@ -0,0 +1,57 @@ +/* + * 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 WebFrameListenerProxy_h +#define WebFrameListenerProxy_h + +#include "APIObject.h" +#include <WebCore/FrameLoaderTypes.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class WebFrameProxy; + +class WebFrameListenerProxy : public APIObject { +public: + virtual ~WebFrameListenerProxy(); + + void invalidate(); + uint64_t listenerID() const { return m_listenerID; } + +protected: + WebFrameListenerProxy(WebFrameProxy*, uint64_t listenerID); + + void receivedPolicyDecision(WebCore::PolicyAction); + +private: + RefPtr<WebFrameProxy> m_frame; + uint64_t m_listenerID; +}; + +} // namespace WebKit + +#endif // WebFrameListenerProxy_h diff --git a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp new file mode 100644 index 0000000..865d352 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFramePolicyListenerProxy.h" + +#include "WebFrameProxy.h" + +namespace WebKit { + +WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(WebFrameProxy* frame, uint64_t listenerID) + : WebFrameListenerProxy(frame, listenerID) +{ +} + +void WebFramePolicyListenerProxy::use() +{ + receivedPolicyDecision(WebCore::PolicyUse); +} + +void WebFramePolicyListenerProxy::download() +{ + receivedPolicyDecision(WebCore::PolicyDownload); +} + +void WebFramePolicyListenerProxy::ignore() +{ + receivedPolicyDecision(WebCore::PolicyIgnore); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h new file mode 100644 index 0000000..779d2a5 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFramePolicyListenerProxy.h @@ -0,0 +1,54 @@ +/* + * 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 WebFramePolicyListenerProxy_h +#define WebFramePolicyListenerProxy_h + +#include "WebFrameListenerProxy.h" + +namespace WebKit { + +class WebFramePolicyListenerProxy : public WebFrameListenerProxy { +public: + static const Type APIType = TypeFramePolicyListener; + + static PassRefPtr<WebFramePolicyListenerProxy> create(WebFrameProxy* frame, uint64_t listenerID) + { + return adoptRef(new WebFramePolicyListenerProxy(frame, listenerID)); + } + + void use(); + void download(); + void ignore(); + +private: + WebFramePolicyListenerProxy(WebFrameProxy*, uint64_t listenerID); + + virtual Type type() const { return APIType; } +}; + +} // namespace WebKit + +#endif // WebFramePolicyListenerProxy_h diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.cpp b/Source/WebKit2/UIProcess/WebFrameProxy.cpp new file mode 100644 index 0000000..d3a36f9 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFrameProxy.cpp @@ -0,0 +1,308 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFrameProxy.h" + +#include "WebCertificateInfo.h" +#include "WebContext.h" +#include "WebFormSubmissionListenerProxy.h" +#include "WebFramePolicyListenerProxy.h" +#include "WebPageProxy.h" +#include <WebCore/DOMImplementation.h> +#include <WebCore/Image.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +WebFrameProxy::WebFrameProxy(WebPageProxy* page, uint64_t frameID) + : m_page(page) + , m_parentFrame(0) + , m_nextSibling(0) + , m_previousSibling(0) + , m_firstChild(0) + , m_lastChild(0) + , m_loadState(LoadStateFinished) + , m_isFrameSet(false) + , m_frameID(frameID) +{ + WebContext::statistics().wkFrameCount++; +} + +WebFrameProxy::~WebFrameProxy() +{ + WebContext::statistics().wkFrameCount--; +} + +void WebFrameProxy::disconnect() +{ + m_page = 0; + m_parentFrame = 0; + m_nextSibling = 0; + m_previousSibling = 0; + m_firstChild = 0; + m_lastChild = 0; + + if (m_activeListener) { + m_activeListener->invalidate(); + m_activeListener = 0; + } +} + +bool WebFrameProxy::isMainFrame() const +{ + if (!m_page) + return false; + + return this == m_page->mainFrame(); +} + +bool WebFrameProxy::canProvideSource() const +{ + return isDisplayingMarkupDocument(); +} + +bool WebFrameProxy::canShowMIMEType(const String& mimeType) const +{ + if (!m_page) + return false; + + if (m_page->canShowMIMEType(mimeType)) + return true; + +#if PLATFORM(MAC) + // On Mac, we can show PDFs in the main frame. + if (isMainFrame() && !mimeType.isEmpty()) + return WebContext::pdfAndPostScriptMIMETypes().contains(mimeType); +#endif + + return false; +} + +bool WebFrameProxy::isDisplayingStandaloneImageDocument() const +{ + return Image::supportsType(m_MIMEType); +} + +bool WebFrameProxy::isDisplayingMarkupDocument() const +{ + // FIXME: This check should be moved to somewhere in WebCore. + // FIXME: This returns false when displaying a web archive. + return m_MIMEType == "text/html" || m_MIMEType == "image/svg+xml" || DOMImplementation::isXMLMIMEType(m_MIMEType); +} + +void WebFrameProxy::didStartProvisionalLoad(const String& url) +{ + ASSERT(!url.isEmpty()); + ASSERT(m_loadState == LoadStateFinished); + ASSERT(m_provisionalURL.isEmpty()); + m_loadState = LoadStateProvisional; + m_provisionalURL = 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(); +} + +void WebFrameProxy::didCommitLoad(const String& contentType, const PlatformCertificateInfo& certificateInfo) +{ + ASSERT(m_loadState == LoadStateProvisional); + ASSERT(!m_provisionalURL.isEmpty()); + m_loadState = LoadStateCommitted; + m_url = m_provisionalURL; + m_provisionalURL = String(); + m_title = String(); + m_MIMEType = contentType; + m_isFrameSet = false; + m_certificateInfo = WebCertificateInfo::create(certificateInfo); +} + +void WebFrameProxy::didFinishLoad() +{ + ASSERT(m_loadState == LoadStateCommitted); + ASSERT(m_provisionalURL.isEmpty()); + ASSERT(!m_url.isEmpty()); + m_loadState = LoadStateFinished; +} + +void WebFrameProxy::didFailLoad() +{ + ASSERT(m_loadState == LoadStateCommitted); + ASSERT(m_provisionalURL.isEmpty()); + ASSERT(!m_url.isEmpty()); + m_loadState = LoadStateFinished; + m_title = String(); +} + +void WebFrameProxy::didSameDocumentNavigation(const String& url) +{ + m_url = url; +} + +void WebFrameProxy::didChangeTitle(const String& title) +{ + m_title = title; +} + +void WebFrameProxy::appendChild(WebFrameProxy* child) +{ + ASSERT(child->page() == page()); + ASSERT(!child->m_parentFrame); + ASSERT(!child->m_nextSibling); + ASSERT(!child->m_previousSibling); + + child->m_parentFrame = this; + + WebFrameProxy* oldLast = m_lastChild; + m_lastChild = child; + + if (oldLast) { + ASSERT(!oldLast->m_nextSibling); + child->m_previousSibling = oldLast; + oldLast->m_nextSibling = child; + } else + m_firstChild = child; +} + +void WebFrameProxy::removeChild(WebFrameProxy* child) +{ + child->m_parentFrame = 0; + + WebFrameProxy*& newLocationForNext = m_firstChild == child ? m_firstChild : child->m_previousSibling->m_nextSibling; + WebFrameProxy*& newLocationForPrevious = m_lastChild == child ? m_lastChild : child->m_nextSibling->m_previousSibling; + swap(newLocationForNext, child->m_nextSibling); + swap(newLocationForPrevious, child->m_previousSibling); + child->m_previousSibling = 0; + child->m_nextSibling = 0; +} + +bool WebFrameProxy::isDescendantOf(const WebFrameProxy* ancestor) const +{ + if (!ancestor) + return false; + + if (m_page != ancestor->m_page) + return false; + + for (const WebFrameProxy* frame = this; frame; frame = frame->m_parentFrame) { + if (frame == ancestor) + return true; + } + + return false; +} + +void WebFrameProxy::dumpFrameTreeToSTDOUT(unsigned indent) +{ + if (!indent && m_parentFrame) + printf("NOTE: Printing subtree.\n"); + + for (unsigned i = 0; i < indent; ++i) + printf(" "); + printf("| FRAME %d %s\n", (int)m_frameID, m_url.utf8().data()); + + for (WebFrameProxy* child = m_firstChild; child; child = child->m_nextSibling) + child->dumpFrameTreeToSTDOUT(indent + 4); +} + +void WebFrameProxy::didRemoveFromHierarchy() +{ + if (m_parentFrame) + m_parentFrame->removeChild(this); +} + +PassRefPtr<ImmutableArray> WebFrameProxy::childFrames() +{ + if (!m_firstChild) + return ImmutableArray::create(); + + Vector<RefPtr<APIObject> > vector; + for (WebFrameProxy* child = m_firstChild; child; child = child->m_nextSibling) + vector.append(child); + + return ImmutableArray::adopt(vector); +} + +void WebFrameProxy::receivedPolicyDecision(WebCore::PolicyAction action, uint64_t listenerID) +{ + if (!m_page) + return; + + ASSERT(m_activeListener); + ASSERT(m_activeListener->listenerID() == listenerID); + m_page->receivedPolicyDecision(action, this, listenerID); +} + +WebFramePolicyListenerProxy* WebFrameProxy::setUpPolicyListenerProxy(uint64_t listenerID) +{ + if (m_activeListener) + m_activeListener->invalidate(); + m_activeListener = WebFramePolicyListenerProxy::create(this, listenerID); + return static_cast<WebFramePolicyListenerProxy*>(m_activeListener.get()); +} + +WebFormSubmissionListenerProxy* WebFrameProxy::setUpFormSubmissionListenerProxy(uint64_t listenerID) +{ + if (m_activeListener) + m_activeListener->invalidate(); + m_activeListener = WebFormSubmissionListenerProxy::create(this, listenerID); + return static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get()); +} + +void WebFrameProxy::getWebArchive(PassRefPtr<DataCallback> callback) +{ + if (!m_page) { + callback->invalidate(); + return; + } + + m_page->getWebArchiveOfFrame(this, callback); +} + +void WebFrameProxy::getMainResourceData(PassRefPtr<DataCallback> callback) +{ + if (!m_page) { + callback->invalidate(); + return; + } + + m_page->getMainResourceDataOfFrame(this, callback); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.h b/Source/WebKit2/UIProcess/WebFrameProxy.h new file mode 100644 index 0000000..84c1eb8 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebFrameProxy.h @@ -0,0 +1,159 @@ +/* + * 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 WebFrameProxy_h +#define WebFrameProxy_h + +#include "APIObject.h" +#include "ImmutableArray.h" +#include "GenericCallback.h" +#include "WebFrameListenerProxy.h" +#include <WebCore/FrameLoaderTypes.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebKit { + +class ImmutableArray; +class PlatformCertificateInfo; +class WebCertificateInfo; +class WebFormSubmissionListenerProxy; +class WebFramePolicyListenerProxy; +class WebPageProxy; + +typedef GenericCallback<WKDataRef> DataCallback; + +class WebFrameProxy : public APIObject { +public: + static const Type APIType = TypeFrame; + + static PassRefPtr<WebFrameProxy> create(WebPageProxy* page, uint64_t frameID) + { + return adoptRef(new WebFrameProxy(page, frameID)); + } + + virtual ~WebFrameProxy(); + + enum LoadState { + LoadStateProvisional, + LoadStateCommitted, + LoadStateFinished + }; + + uint64_t frameID() const { return m_frameID; } + WebPageProxy* page() { return m_page; } + + WebFrameProxy* parentFrame() { return m_parentFrame; } + WebFrameProxy* nextSibling() { return m_nextSibling; } + WebFrameProxy* previousSibling() { return m_previousSibling; } + WebFrameProxy* firstChild() { return m_firstChild; } + WebFrameProxy* lastChild() { return m_lastChild; } + + void disconnect(); + + bool isMainFrame() const; + + void setIsFrameSet(bool value) { m_isFrameSet = value; } + bool isFrameSet() const { return m_isFrameSet; } + + LoadState loadState() const { return m_loadState; } + + const String& url() const { return m_url; } + const String& provisionalURL() const { return m_provisionalURL; } + + void setUnreachableURL(const String& unreachableURL) { m_unreachableURL = unreachableURL; } + const String& unreachableURL() const { return m_unreachableURL; } + + const String& mimeType() const { return m_MIMEType; } + + const String& title() const { return m_title; } + + WebCertificateInfo* certificateInfo() const { return m_certificateInfo.get(); } + + bool canProvideSource() const; + bool canShowMIMEType(const String& mimeType) const; + + bool isDisplayingStandaloneImageDocument() const; + bool isDisplayingMarkupDocument() const; + + void getWebArchive(PassRefPtr<DataCallback>); + void getMainResourceData(PassRefPtr<DataCallback>); + + void didStartProvisionalLoad(const String& url); + void didReceiveServerRedirectForProvisionalLoad(const String& url); + void didFailProvisionalLoad(); + void didCommitLoad(const String& contentType, const PlatformCertificateInfo&); + void didFinishLoad(); + void didFailLoad(); + void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change. + void didChangeTitle(const String&); + + // Frame tree operations. + void appendChild(WebFrameProxy*); + void removeChild(WebFrameProxy*); + void didRemoveFromHierarchy(); + PassRefPtr<ImmutableArray> childFrames(); + bool isDescendantOf(const WebFrameProxy* ancestor) const; + void dumpFrameTreeToSTDOUT(unsigned indent = 0); + + // Policy operations. + void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID); + WebFramePolicyListenerProxy* setUpPolicyListenerProxy(uint64_t listenerID); + WebFormSubmissionListenerProxy* setUpFormSubmissionListenerProxy(uint64_t listenerID); + +private: + WebFrameProxy(WebPageProxy* page, uint64_t frameID); + + virtual Type type() const { return APIType; } + + WebPageProxy* m_page; + WebFrameProxy* m_parentFrame; + WebFrameProxy* m_nextSibling; + WebFrameProxy* m_previousSibling; + WebFrameProxy* m_firstChild; + WebFrameProxy* m_lastChild; + + LoadState m_loadState; + String m_url; + String m_provisionalURL; + String m_unreachableURL; + String m_MIMEType; + String m_title; + bool m_isFrameSet; + RefPtr<WebCertificateInfo> m_certificateInfo; + RefPtr<WebFrameListenerProxy> m_activeListener; + uint64_t m_frameID; +}; + +} // namespace WebKit + +#endif // WebFrameProxy_h diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp new file mode 100644 index 0000000..0842ca6 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -0,0 +1,99 @@ +/* + * 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 "WebGeolocationManagerProxy.h" + +#include "WebContext.h" +#include "WebGeolocationManagerMessages.h" + +namespace WebKit { + +PassRefPtr<WebGeolocationManagerProxy> WebGeolocationManagerProxy::create(WebContext* context) +{ + return adoptRef(new WebGeolocationManagerProxy(context)); +} + +WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context) + : m_isUpdating(false) + , m_context(context) +{ +} + +WebGeolocationManagerProxy::~WebGeolocationManagerProxy() +{ +} + +void WebGeolocationManagerProxy::invalidate() +{ + stopUpdating(); +} + +void WebGeolocationManagerProxy::initializeProvider(const WKGeolocationProvider* provider) +{ + m_provider.initialize(provider); +} + +void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) +{ + if (!m_context) + return; + + // FIXME: Should this check for a valid process? + m_context->process()->send(Messages::WebGeolocationManager::DidChangePosition(position->data()), 0); +} + +void WebGeolocationManagerProxy::providerDidFailToDeterminePosition() +{ + if (!m_context) + return; + + // FIXME: Should this check for a valid process? + m_context->process()->send(Messages::WebGeolocationManager::DidFailToDeterminePosition(), 0); +} + +void WebGeolocationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceiveWebGeolocationManagerProxyMessage(connection, messageID, arguments); +} + +void WebGeolocationManagerProxy::startUpdating() +{ + if (m_isUpdating) + return; + + m_provider.startUpdating(this); + m_isUpdating = true; +} + +void WebGeolocationManagerProxy::stopUpdating() +{ + if (!m_isUpdating) + return; + + m_provider.stopUpdating(this); + m_isUpdating = false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h new file mode 100644 index 0000000..5091693 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h @@ -0,0 +1,79 @@ +/* + * 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 WebGeolocationManagerProxy_h +#define WebGeolocationManagerProxy_h + +#include "APIObject.h" +#include "MessageID.h" +#include "WebGeolocationProvider.h" + +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +} + +namespace WebKit { + +class WebContext; +class WebGeolocationPosition; + +class WebGeolocationManagerProxy : public APIObject { +public: + static const Type APIType = TypeGeolocationManager; + + static PassRefPtr<WebGeolocationManagerProxy> create(WebContext*); + virtual ~WebGeolocationManagerProxy(); + + void invalidate(); + void clearContext() { m_context = 0; } + + void initializeProvider(const WKGeolocationProvider*); + + void providerDidChangePosition(WebGeolocationPosition*); + void providerDidFailToDeterminePosition(); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + explicit WebGeolocationManagerProxy(WebContext*); + + virtual Type type() const { return APIType; } + + // Implemented in generated WebGeolocationManagerProxyMessageReceiver.cpp + void didReceiveWebGeolocationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + void startUpdating(); + void stopUpdating(); + + bool m_isUpdating; + + WebContext* m_context; + WebGeolocationProvider m_provider; +}; + +} // namespace WebKit + +#endif // WebGeolocationManagerProxy_h diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.messages.in new file mode 100644 index 0000000..fe5a273 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.messages.in @@ -0,0 +1,26 @@ +# 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. + +messages -> WebGeolocationManagerProxy { + StartUpdating(); + StopUpdating(); +} diff --git a/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp new file mode 100644 index 0000000..c48ee89 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp @@ -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. + */ + +#include "WebGeolocationProvider.h" + +#include "WKAPICast.h" +#include "WebGeolocationManagerProxy.h" + +namespace WebKit { + +void WebGeolocationProvider::startUpdating(WebGeolocationManagerProxy* geolocationManager) +{ + if (!m_client.startUpdating) + return; + + m_client.startUpdating(toAPI(geolocationManager), m_client.clientInfo); +} + +void WebGeolocationProvider::stopUpdating(WebGeolocationManagerProxy* geolocationManager) +{ + if (!m_client.stopUpdating) + return; + + m_client.stopUpdating(toAPI(geolocationManager), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebGeolocationProvider.h b/Source/WebKit2/UIProcess/WebGeolocationProvider.h new file mode 100644 index 0000000..b5b8bd0 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebGeolocationProvider.h @@ -0,0 +1,45 @@ +/* + * 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 WebGeolocationProvider_h +#define WebGeolocationProvider_h + +#include "APIClient.h" +#include "WKGeolocationManager.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class WebGeolocationManagerProxy; + +class WebGeolocationProvider : public APIClient<WKGeolocationProvider> { +public: + void startUpdating(WebGeolocationManagerProxy*); + void stopUpdating(WebGeolocationManagerProxy*); +}; + +} // namespace WebKit + +#endif // WebGeolocationProvider_h diff --git a/Source/WebKit2/UIProcess/WebHistoryClient.cpp b/Source/WebKit2/UIProcess/WebHistoryClient.cpp new file mode 100644 index 0000000..d0ca71b --- /dev/null +++ b/Source/WebKit2/UIProcess/WebHistoryClient.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebHistoryClient.h" + +#include "WKAPICast.h" +#include "WebNavigationData.h" +#include <wtf/RefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +void WebHistoryClient::didNavigateWithNavigationData(WebContext* context, WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame) +{ + if (!m_client.didNavigateWithNavigationData) + return; + + RefPtr<WebNavigationData> navigationData = WebNavigationData::create(navigationDataStore); + m_client.didNavigateWithNavigationData(toAPI(context), toAPI(page), toAPI(navigationData.get()), toAPI(frame), m_client.clientInfo); +} + +void WebHistoryClient::didPerformClientRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) +{ + if (!m_client.didPerformClientRedirect) + return; + + m_client.didPerformClientRedirect(toAPI(context), toAPI(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(frame), m_client.clientInfo); +} + +void WebHistoryClient::didPerformServerRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) +{ + if (!m_client.didPerformServerRedirect) + return; + + m_client.didPerformServerRedirect(toAPI(context), toAPI(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(frame), m_client.clientInfo); +} + +void WebHistoryClient::didUpdateHistoryTitle(WebContext* context, WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame) +{ + if (!m_client.didUpdateHistoryTitle) + return; + + m_client.didUpdateHistoryTitle(toAPI(context), toAPI(page), toAPI(title.impl()), toURLRef(url.impl()), toAPI(frame), m_client.clientInfo); +} + +void WebHistoryClient::populateVisitedLinks(WebContext* context) +{ + if (!m_client.populateVisitedLinks) + return; + + m_client.populateVisitedLinks(toAPI(context), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebHistoryClient.h b/Source/WebKit2/UIProcess/WebHistoryClient.h new file mode 100644 index 0000000..bf50748 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebHistoryClient.h @@ -0,0 +1,53 @@ +/* + * 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 WebHistoryClient_h +#define WebHistoryClient_h + +#include "APIClient.h" +#include "WKContext.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class WebContext; +class WebFrameProxy; +class WebPageProxy; +struct WebNavigationDataStore; + +class WebHistoryClient : public APIClient<WKContextHistoryClient> { +public: + void didNavigateWithNavigationData(WebContext*, WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*); + void didPerformClientRedirect(WebContext*, WebPageProxy*, const String& sourceURL, const String& destinationURL, WebFrameProxy*); + void didPerformServerRedirect(WebContext*, WebPageProxy*, const String& sourceURL, const String& destinationURL, WebFrameProxy*); + void didUpdateHistoryTitle(WebContext*, WebPageProxy*, const String& title, const String& url, WebFrameProxy*); + void populateVisitedLinks(WebContext*); + + bool shouldTrackVisitedLinks() const { return m_client.populateVisitedLinks; } +}; + +} // namespace WebKit + +#endif // WebHistoryClient_h diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp new file mode 100644 index 0000000..dfeff6a --- /dev/null +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#include "WebInspectorMessages.h" +#include "WebPageProxy.h" +#include "WebPageCreationParameters.h" +#include "WebProcessProxy.h" +#include "WebPageGroup.h" + +#if PLATFORM(WIN) +#include "WebView.h" +#endif + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +WebPageGroup* WebInspectorProxy::inspectorPageGroup() +{ + static WebPageGroup* pageGroup = WebPageGroup::create("__WebInspectorPageGroup__", false).leakRef(); + return pageGroup; +} + +WebInspectorProxy::WebInspectorProxy(WebPageProxy* page) + : m_page(page) + , m_isVisible(false) + , m_isAttached(false) + , m_isDebuggingJavaScript(false) + , m_isProfilingJavaScript(false) + , m_isProfilingPage(false) +#if PLATFORM(WIN) + , m_inspectorWindow(0) +#endif +{ +} + +WebInspectorProxy::~WebInspectorProxy() +{ +} + +void WebInspectorProxy::invalidate() +{ + platformClose(); + + m_page = 0; + + m_isVisible = false; + m_isDebuggingJavaScript = false; + m_isProfilingJavaScript = false; + m_isProfilingPage = false; +} + +// Public APIs +void WebInspectorProxy::show() +{ + if (!m_page) + return; + + m_page->process()->send(Messages::WebInspector::Show(), m_page->pageID()); +} + +void WebInspectorProxy::close() +{ + if (!m_page) + return; + + m_page->process()->send(Messages::WebInspector::Close(), m_page->pageID()); +} + +void WebInspectorProxy::showConsole() +{ + if (!m_page) + return; + + m_page->process()->send(Messages::WebInspector::ShowConsole(), m_page->pageID()); +} + +void WebInspectorProxy::attach() +{ + notImplemented(); +} + +void WebInspectorProxy::detach() +{ + notImplemented(); +} + +void WebInspectorProxy::toggleJavaScriptDebugging() +{ + if (!m_page) + return; + + if (m_isDebuggingJavaScript) + m_page->process()->send(Messages::WebInspector::StopJavaScriptDebugging(), m_page->pageID()); + else + m_page->process()->send(Messages::WebInspector::StartJavaScriptDebugging(), m_page->pageID()); + + // FIXME: have the WebProcess notify us on state changes. + m_isDebuggingJavaScript = !m_isDebuggingJavaScript; +} + +void WebInspectorProxy::toggleJavaScriptProfiling() +{ + if (!m_page) + return; + + if (m_isProfilingJavaScript) + m_page->process()->send(Messages::WebInspector::StopJavaScriptProfiling(), m_page->pageID()); + else + m_page->process()->send(Messages::WebInspector::StartJavaScriptProfiling(), m_page->pageID()); + + // FIXME: have the WebProcess notify us on state changes. + m_isProfilingJavaScript = !m_isProfilingJavaScript; +} + +void WebInspectorProxy::togglePageProfiling() +{ + if (!m_page) + return; + + if (m_isProfilingPage) + m_page->process()->send(Messages::WebInspector::StopPageProfiling(), m_page->pageID()); + else + m_page->process()->send(Messages::WebInspector::StartPageProfiling(), m_page->pageID()); + + // FIXME: have the WebProcess notify us on state changes. + m_isProfilingPage = !m_isProfilingPage; +} + +// Called by WebInspectorProxy messages +void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters) +{ + inspectorPageID = 0; + + if (!m_page) + return; + + WebPageProxy* inspectorPage = platformCreateInspectorPage(); + ASSERT(inspectorPage); + if (!inspectorPage) + return; + + inspectorPageID = inspectorPage->pageID(); + inspectorPageParameters = inspectorPage->creationParameters(); + + inspectorPage->loadURL(inspectorPageURL()); +} + +void WebInspectorProxy::didLoadInspectorPage() +{ + m_isVisible = true; + + platformOpen(); +} + +void WebInspectorProxy::didClose() +{ + platformClose(); + + m_isVisible = false; +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h new file mode 100644 index 0000000..cc0725a --- /dev/null +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -0,0 +1,159 @@ +/* + * 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 WebInspectorProxy_h +#define WebInspectorProxy_h + +#if ENABLE(INSPECTOR) + +#include "APIObject.h" +#include "Connection.h" +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class NSWindow; +@class WKView; +@class WebInspectorProxyObjCAdapter; +#else +class NSWindow; +class WKView; +class WebInspectorProxyObjCAdapter; +#endif +#endif + +namespace WebKit { + +class WebPageGroup; +class WebPageProxy; +struct WebPageCreationParameters; + +#if PLATFORM(WIN) +class WebView; +#endif + +class WebInspectorProxy : public APIObject { +public: + static const Type APIType = TypeInspector; + + static PassRefPtr<WebInspectorProxy> create(WebPageProxy* page) + { + return adoptRef(new WebInspectorProxy(page)); + } + + ~WebInspectorProxy(); + + void invalidate(); + + // Public APIs + WebPageProxy* page() { return m_page; } + + bool isVisible() const { return m_isVisible; } + void show(); + void close(); + + void showConsole(); + + bool isAttached() const { return m_isAttached; } + void attach(); + void detach(); + + bool isDebuggingJavaScript() const { return m_isDebuggingJavaScript; } + void toggleJavaScriptDebugging(); + + bool isProfilingJavaScript() const { return m_isProfilingJavaScript; } + void toggleJavaScriptProfiling(); + + bool isProfilingPage() const { return m_isProfilingPage; } + void togglePageProfiling(); + +#if ENABLE(INSPECTOR) + // Implemented in generated WebInspectorProxyMessageReceiver.cpp + void didReceiveWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); +#endif + +private: + WebInspectorProxy(WebPageProxy* page); + + virtual Type type() const { return APIType; } + + WebPageProxy* platformCreateInspectorPage(); + void platformOpen(); + void platformClose(); + + // Implemented the platform WebInspectorProxy file + String inspectorPageURL() const; + + // Called by WebInspectorProxy messages + void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&); + void didLoadInspectorPage(); + void didClose(); + + static WebPageGroup* inspectorPageGroup(); + +#if PLATFORM(WIN) + static bool registerInspectorViewWindowClass(); + static LRESULT CALLBACK InspectorViewWndProc(HWND, UINT, WPARAM, LPARAM); + LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + LRESULT onSizeEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onMinMaxInfoEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onSetFocusEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onCloseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); +#endif + + static const unsigned minimumWindowWidth = 500; + static const unsigned minimumWindowHeight = 400; + + static const unsigned initialWindowWidth = 750; + static const unsigned initialWindowHeight = 650; + + WebPageProxy* m_page; + + bool m_isVisible; + bool m_isAttached; + bool m_isDebuggingJavaScript; + bool m_isProfilingJavaScript; + bool m_isProfilingPage; + +#if PLATFORM(MAC) + RetainPtr<WKView> m_inspectorView; + RetainPtr<NSWindow> m_inspectorWindow; + RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter; +#elif PLATFORM(WIN) + HWND m_inspectorWindow; + RefPtr<WebView> m_inspectorView; +#endif +}; + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) + +#endif // WebInspectorProxy_h diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in new file mode 100644 index 0000000..cc10248 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in @@ -0,0 +1,31 @@ +# 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. + +#if ENABLE(INSPECTOR) + +messages -> WebInspectorProxy { + CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters) + DidLoadInspectorPage() + DidClose() +} + +#endif diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp new file mode 100644 index 0000000..0b14a17 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp @@ -0,0 +1,219 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebLoaderClient.h" + +#include "WKAPICast.h" +#include <string.h> + +using namespace WebCore; + +namespace WebKit { + +void WebLoaderClient::didStartProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didStartProvisionalLoadForFrame) + return; + + m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame) + return; + + m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData) +{ + if (!m_client.didFailProvisionalLoadWithErrorForFrame) + return; + + m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didCommitLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didCommitLoadForFrame) + return; + + m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFinishDocumentLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didFinishDocumentLoadForFrame) + return; + + m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFinishLoadForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didFinishLoadForFrame) + return; + + m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFailLoadWithErrorForFrame(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData) +{ + if (!m_client.didFailLoadWithErrorForFrame) + return; + + m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didSameDocumentNavigationForFrame(WebPageProxy* page, WebFrameProxy* frame, SameDocumentNavigationType type, APIObject* userData) +{ + if (!m_client.didSameDocumentNavigationForFrame) + return; + + m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didReceiveTitleForFrame(WebPageProxy* page, const String& title, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didReceiveTitleForFrame) + return; + + m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFirstLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didFirstLayoutForFrame) + return; + + m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame) + return; + + m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didRemoveFrameFromHierarchy) + return; + + m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didDisplayInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didDisplayInsecureContentForFrame) + return; + + m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData) +{ + if (!m_client.didRunInsecureContentForFrame) + return; + + m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo); +} + +bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy* page, WebFrameProxy* frame, WebProtectionSpace* protectionSpace) +{ + if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame) + return false; + + return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(page), toAPI(frame), toAPI(protectionSpace), m_client.clientInfo); +} + +void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge) +{ + if (!m_client.didReceiveAuthenticationChallengeInFrame) + return; + + m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), m_client.clientInfo); +} + +void WebLoaderClient::didStartProgress(WebPageProxy* page) +{ + if (!m_client.didStartProgress) + return; + + m_client.didStartProgress(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::didChangeProgress(WebPageProxy* page) +{ + if (!m_client.didChangeProgress) + return; + + m_client.didChangeProgress(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::didFinishProgress(WebPageProxy* page) +{ + if (!m_client.didFinishProgress) + return; + + m_client.didFinishProgress(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::processDidBecomeUnresponsive(WebPageProxy* page) +{ + if (!m_client.processDidBecomeUnresponsive) + return; + + m_client.processDidBecomeUnresponsive(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::processDidBecomeResponsive(WebPageProxy* page) +{ + if (!m_client.processDidBecomeResponsive) + return; + + m_client.processDidBecomeResponsive(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::processDidCrash(WebPageProxy* page) +{ + if (!m_client.processDidCrash) + return; + + m_client.processDidCrash(toAPI(page), m_client.clientInfo); +} + +void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page) +{ + if (!m_client.didChangeBackForwardList) + return; + + m_client.didChangeBackForwardList(toAPI(page), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.h b/Source/WebKit2/UIProcess/WebLoaderClient.h new file mode 100644 index 0000000..0c250fe --- /dev/null +++ b/Source/WebKit2/UIProcess/WebLoaderClient.h @@ -0,0 +1,81 @@ +/* + * 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 WebLoaderClient_h +#define WebLoaderClient_h + +#include "APIClient.h" +#include "SameDocumentNavigationType.h" +#include "WKPage.h" +#include <wtf/Forward.h> + +namespace WebCore { +class ResourceError; +} + +namespace WebKit { + +class APIObject; +class AuthenticationChallengeProxy; +class AuthenticationDecisionListener; +class WebFrameProxy; +class WebPageProxy; +class WebProtectionSpace; + +class WebLoaderClient : public APIClient<WKPageLoaderClient> { +public: + void didStartProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didFailProvisionalLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*); + void didCommitLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didFinishDocumentLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didFinishLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didFailLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*); + void didSameDocumentNavigationForFrame(WebPageProxy*, WebFrameProxy*, SameDocumentNavigationType, APIObject*); + void didReceiveTitleForFrame(WebPageProxy*, const String&, WebFrameProxy*, APIObject*); + void didFirstLayoutForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didRemoveFrameFromHierarchy(WebPageProxy*, WebFrameProxy*, APIObject*); + void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*); + + bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*); + void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*); + + void didStartProgress(WebPageProxy*); + void didChangeProgress(WebPageProxy*); + void didFinishProgress(WebPageProxy*); + + // FIXME: These three functions should not be part of this client. + void processDidBecomeUnresponsive(WebPageProxy*); + void processDidBecomeResponsive(WebPageProxy*); + void processDidCrash(WebPageProxy*); + + void didChangeBackForwardList(WebPageProxy*); +}; + +} // namespace WebKit + +#endif // WebLoaderClient_h diff --git a/Source/WebKit2/UIProcess/WebNavigationData.cpp b/Source/WebKit2/UIProcess/WebNavigationData.cpp new file mode 100644 index 0000000..c4f17f3 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebNavigationData.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebNavigationData.h" + +namespace WebKit { + +WebNavigationData::WebNavigationData(const WebNavigationDataStore& store) + : m_store(store) +{ +} + +WebNavigationData::~WebNavigationData() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebNavigationData.h b/Source/WebKit2/UIProcess/WebNavigationData.h new file mode 100644 index 0000000..e6b6c31 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebNavigationData.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 WebNavigationData_h +#define WebNavigationData_h + +#include "APIObject.h" +#include "WebNavigationDataStore.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebNavigationData : public APIObject { +public: + static const Type APIType = TypeNavigationData; + + static PassRefPtr<WebNavigationData> create(const WebNavigationDataStore& store) + { + return adoptRef(new WebNavigationData(store)); + } + + virtual ~WebNavigationData(); + + String title() const { return m_store.title; } + String url() const { return m_store.url; } + +private: + WebNavigationData(const WebNavigationDataStore&); + + virtual Type type() const { return APIType; } + + WebNavigationDataStore m_store; +}; + +} // namespace WebKit + +#endif // WebNavigationData_h diff --git a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp new file mode 100644 index 0000000..de2d174 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebOpenPanelResultListenerProxy.h" + +#include "ImmutableArray.h" +#include "WebPageProxy.h" +#include <WebCore/KURL.h> +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy(WebPageProxy* page) + : m_page(page) +{ +} + +WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy() +{ +} + +void WebOpenPanelResultListenerProxy::chooseFiles(ImmutableArray* fileURLsArray) +{ + if (!m_page) + return; + + size_t size = fileURLsArray->size(); + + Vector<String> filePaths; + filePaths.reserveInitialCapacity(size); + + for (size_t i = 0; i < size; ++i) { + WebURL* webURL = fileURLsArray->at<WebURL>(i); + if (webURL) { + KURL url(KURL(), webURL->string()); + filePaths.uncheckedAppend(url.fileSystemPath()); + } + } + + m_page->didChooseFilesForOpenPanel(filePaths); +} + +void WebOpenPanelResultListenerProxy::cancel() +{ + if (!m_page) + return; + + m_page->didCancelForOpenPanel(); +} + +void WebOpenPanelResultListenerProxy::invalidate() +{ + m_page = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h new file mode 100644 index 0000000..ba931dc --- /dev/null +++ b/Source/WebKit2/UIProcess/WebOpenPanelResultListenerProxy.h @@ -0,0 +1,64 @@ +/* + * 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 WebOpenPanelResultListenerProxy_h +#define WebOpenPanelResultListenerProxy_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class ImmutableArray; +class WebPageProxy; + +class WebOpenPanelResultListenerProxy : public APIObject { +public: + static const Type APIType = TypeFramePolicyListener; + + static PassRefPtr<WebOpenPanelResultListenerProxy> create(WebPageProxy* page) + { + return adoptRef(new WebOpenPanelResultListenerProxy(page)); + } + + virtual ~WebOpenPanelResultListenerProxy(); + + void chooseFiles(ImmutableArray*); + void cancel(); + + void invalidate(); + +private: + WebOpenPanelResultListenerProxy(WebPageProxy*); + + virtual Type type() const { return APIType; } + + RefPtr<WebPageProxy> m_page; +}; + +} // namespace WebKit + +#endif // WebOpenPanelResultListenerProxy_h diff --git a/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp new file mode 100644 index 0000000..73220b2 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageContextMenuClient.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageContextMenuClient.h" + +#include "Logging.h" +#include "MutableArray.h" +#include "WebContextMenuItem.h" +#include "WKAPICast.h" +#include "WKSharedAPICast.h" + +namespace WebKit { + +bool WebPageContextMenuClient::getContextMenuFromProposedMenu(WebPageProxy* page, const Vector<WebContextMenuItemData>& proposedMenuVector, Vector<WebContextMenuItemData>& customMenu, APIObject* userData) +{ + if (!m_client.getContextMenuFromProposedMenu) + return false; + + unsigned size = proposedMenuVector.size(); + RefPtr<MutableArray> proposedMenu = MutableArray::create(); + proposedMenu->reserveCapacity(size); + for (unsigned i = 0; i < size; ++i) + proposedMenu->append(WebContextMenuItem::create(proposedMenuVector[i]).get()); + + WKArrayRef newMenu = 0; + m_client.getContextMenuFromProposedMenu(toAPI(page), toAPI(proposedMenu.get()), &newMenu, toAPI(userData), m_client.clientInfo); + RefPtr<ImmutableArray> array = adoptRef(toImpl(newMenu)); + + customMenu.clear(); + + size_t newSize = array ? array->size() : 0; + for (size_t i = 0; i < newSize; ++i) { + WebContextMenuItem* item = array->at<WebContextMenuItem>(i); + if (!item) { + LOG(ContextMenu, "New menu entry at index %i is not a WebContextMenuItem", (int)i); + continue; + } + + customMenu.append(*item->data()); + } + + return true; +} + +void WebPageContextMenuClient::customContextMenuItemSelected(WebPageProxy* page, const WebContextMenuItemData& itemData) +{ + if (!m_client.customContextMenuItemSelected) + return; + + RefPtr<WebContextMenuItem> item = WebContextMenuItem::create(itemData); + m_client.customContextMenuItemSelected(toAPI(page), toAPI(item.get()), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageContextMenuClient.h b/Source/WebKit2/UIProcess/WebPageContextMenuClient.h new file mode 100644 index 0000000..e0fff3d --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageContextMenuClient.h @@ -0,0 +1,47 @@ +/* + * 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 WebPageContextMenuClient_h +#define WebPageContextMenuClient_h + +#include "APIClient.h" +#include "WKPage.h" +#include <wtf/Vector.h> + +namespace WebKit { + +class APIObject; +class WebContextMenuItemData; +class WebPageProxy; + +class WebPageContextMenuClient : public APIClient<WKPageContextMenuClient> { +public: + bool getContextMenuFromProposedMenu(WebPageProxy*, const Vector<WebContextMenuItemData>& proposedMenu, Vector<WebContextMenuItemData>& customMenu, APIObject* userData); + void customContextMenuItemSelected(WebPageProxy*, const WebContextMenuItemData&); +}; + +} // namespace WebKit + +#endif // WebPageContextMenuClient_h diff --git a/Source/WebKit2/UIProcess/WebPageGroup.cpp b/Source/WebKit2/UIProcess/WebPageGroup.cpp new file mode 100644 index 0000000..901b393 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageGroup.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageGroup.h" + +#include "WebPageProxy.h" +#include "WebPreferences.h" +#include <wtf/HashMap.h> +#include <wtf/text/StringConcatenate.h> + +namespace WebKit { + +static uint64_t generatePageGroupID() +{ + static uint64_t uniquePageGroupID = 1; + return uniquePageGroupID++; +} + +typedef HashMap<uint64_t, WebPageGroup*> WebPageGroupMap; + +static WebPageGroupMap& webPageGroupMap() +{ + static WebPageGroupMap map; + return map; +} + +PassRefPtr<WebPageGroup> WebPageGroup::create(const String& identifier, bool visibleToInjectedBundle) +{ + RefPtr<WebPageGroup> pageGroup = adoptRef(new WebPageGroup(identifier, visibleToInjectedBundle)); + + webPageGroupMap().set(pageGroup->pageGroupID(), pageGroup.get()); + + return pageGroup.release(); +} + +WebPageGroup* WebPageGroup::get(uint64_t pageGroupID) +{ + return webPageGroupMap().get(pageGroupID); +} + +WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle) +{ + m_data.pageGroupID = generatePageGroupID(); + + if (!identifier.isNull()) { + m_data.identifer = identifier; + m_preferences = WebPreferences::create(identifier); + } else { + m_data.identifer = m_data.identifer = makeString("__uniquePageGroupID-", String::number(m_data.pageGroupID)); + m_preferences = WebPreferences::create(); + } + m_preferences->addPageGroup(this); + + m_data.visibleToInjectedBundle = visibleToInjectedBundle; +} + +WebPageGroup::~WebPageGroup() +{ + m_preferences->removePageGroup(this); + webPageGroupMap().remove(pageGroupID()); +} + +void WebPageGroup::addPage(WebPageProxy* page) +{ + m_pages.add(page); +} + +void WebPageGroup::removePage(WebPageProxy* page) +{ + m_pages.remove(page); +} + +void WebPageGroup::setPreferences(WebPreferences* preferences) +{ + if (preferences == m_preferences) + return; + + m_preferences->removePageGroup(this); + m_preferences = preferences; + m_preferences->addPageGroup(this); + + preferencesDidChange(); +} + +WebPreferences* WebPageGroup::preferences() const +{ + return m_preferences.get(); +} + +void WebPageGroup::preferencesDidChange() +{ + for (HashSet<WebPageProxy*>::iterator it = m_pages.begin(), end = m_pages.end(); it != end; ++it) { + WebPageProxy* page = *it; + page->preferencesDidChange(); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageGroup.h b/Source/WebKit2/UIProcess/WebPageGroup.h new file mode 100644 index 0000000..7859dfc --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageGroup.h @@ -0,0 +1,72 @@ +/* + * 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 WebPageGroup_h +#define WebPageGroup_h + +#include "APIObject.h" +#include "WebPageGroupData.h" +#include <wtf/Forward.h> +#include <wtf/HashSet.h> + +namespace WebKit { + +class WebPreferences; +class WebPageProxy; + +class WebPageGroup : public APIObject { +public: + static const Type APIType = TypePageGroup; + + static PassRefPtr<WebPageGroup> create(const String& identifier = String(), bool visibleToInjectedBundle = true); + static WebPageGroup* get(uint64_t pageGroupID); + + virtual ~WebPageGroup(); + + void addPage(WebPageProxy*); + void removePage(WebPageProxy*); + + const String& identifier() const { return m_data.identifer; } + uint64_t pageGroupID() const { return m_data.pageGroupID; } + + const WebPageGroupData& data() { return m_data; } + + void setPreferences(WebPreferences*); + WebPreferences* preferences() const; + void preferencesDidChange(); + +private: + WebPageGroup(const String& identifier, bool visibleToInjectedBundle); + + virtual Type type() const { return APIType; } + + WebPageGroupData m_data; + RefPtr<WebPreferences> m_preferences; + HashSet<WebPageProxy*> m_pages; +}; + +} // namespace WebKit + +#endif // WebPageGroup_h diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp new file mode 100644 index 0000000..f433fbd --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -0,0 +1,2367 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageProxy.h" + +#include "AuthenticationChallengeProxy.h" +#include "AuthenticationDecisionListener.h" +#include "DataReference.h" +#include "DrawingAreaProxy.h" +#include "FindIndicator.h" +#include "MessageID.h" +#include "NativeWebKeyboardEvent.h" +#include "PageClient.h" +#include "PrintInfo.h" +#include "SessionState.h" +#include "StringPairVector.h" +#include "TextChecker.h" +#include "TextCheckerState.h" +#include "WKContextPrivate.h" +#include "WebBackForwardList.h" +#include "WebBackForwardListItem.h" +#include "WebCertificateInfo.h" +#include "WebContext.h" +#include "WebContextMenuProxy.h" +#include "WebContextUserMessageCoders.h" +#include "WebCoreArgumentCoders.h" +#include "WebData.h" +#include "WebEditCommandProxy.h" +#include "WebEvent.h" +#include "WebFormSubmissionListenerProxy.h" +#include "WebFramePolicyListenerProxy.h" +#include "WebOpenPanelResultListenerProxy.h" +#include "WebPageCreationParameters.h" +#include "WebPageGroup.h" +#include "WebPageGroupData.h" +#include "WebPageMessages.h" +#include "WebPopupItem.h" +#include "WebPopupMenuProxy.h" +#include "WebPreferences.h" +#include "WebProcessManager.h" +#include "WebProcessMessages.h" +#include "WebProcessProxy.h" +#include "WebProtectionSpace.h" +#include "WebSecurityOrigin.h" +#include "WebURLRequest.h" +#include <WebCore/DragData.h> +#include <WebCore/FloatRect.h> +#include <WebCore/MIMETypeRegistry.h> +#include <WebCore/WindowFeatures.h> +#include <stdio.h> + +#ifndef NDEBUG +#include <wtf/RefCountedLeakCounter.h> +#endif + +// This controls what strategy we use for mouse wheel coalesing. +#define MERGE_WHEEL_EVENTS 0 + +#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process()->connection()) + +using namespace WebCore; + +namespace WebKit { + +#ifndef NDEBUG +static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy"); +#endif + +PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID) +{ + return adoptRef(new WebPageProxy(pageClient, context, pageGroup, pageID)); +} + +WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID) + : m_pageClient(pageClient) + , m_context(context) + , m_pageGroup(pageGroup) + , m_mainFrame(0) + , m_userAgent(standardUserAgent()) + , m_geolocationPermissionRequestManager(this) + , m_estimatedProgress(0) + , m_isInWindow(m_pageClient->isViewInWindow()) + , m_isVisible(m_pageClient->isViewVisible()) + , m_backForwardList(WebBackForwardList::create(this)) + , m_textZoomFactor(1) + , m_pageZoomFactor(1) + , m_viewScaleFactor(1) + , m_drawsBackground(true) + , m_drawsTransparentBackground(false) + , m_useFixedLayout(false) + , m_isValid(true) + , m_isClosed(false) + , m_isInPrintingMode(false) + , m_inDecidePolicyForMIMEType(false) + , m_syncMimeTypePolicyActionIsValid(false) + , m_syncMimeTypePolicyAction(PolicyUse) + , m_syncMimeTypePolicyDownloadID(0) + , m_processingWheelEvent(false) + , m_processingMouseMoveEvent(false) + , m_pageID(pageID) +#if PLATFORM(MAC) + , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled()) +#endif + , m_spellDocumentTag(0) + , m_hasSpellDocumentTag(false) + , m_pendingLearnOrIgnoreWordMessageCount(0) + , m_mainFrameHasCustomRepresentation(false) + , m_currentDragOperation(DragOperationNone) +{ +#ifndef NDEBUG + webPageProxyCounter.increment(); +#endif + + WebContext::statistics().wkPageCount++; + + m_pageGroup->addPage(this); +} + +WebPageProxy::~WebPageProxy() +{ + WebContext::statistics().wkPageCount--; + + if (m_hasSpellDocumentTag) + TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag); + + m_pageGroup->removePage(this); + +#ifndef NDEBUG + webPageProxyCounter.decrement(); +#endif +} + +WebProcessProxy* WebPageProxy::process() const +{ + return m_context->process(); +} + +bool WebPageProxy::isValid() +{ + // A page that has been explicitly closed is never valid. + if (m_isClosed) + return false; + + return m_isValid; +} + +void WebPageProxy::setDrawingArea(PassOwnPtr<DrawingAreaProxy> drawingArea) +{ + if (drawingArea == m_drawingArea) + return; + + m_drawingArea = drawingArea; +} + +void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient) +{ + m_loaderClient.initialize(loadClient); +} + +void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient) +{ + m_policyClient.initialize(policyClient); +} + +void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient) +{ + m_formClient.initialize(formClient); +} + +void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client) +{ + m_resourceLoadClient.initialize(client); +} + +void WebPageProxy::initializeUIClient(const WKPageUIClient* client) +{ + m_uiClient.initialize(client); +} + +void WebPageProxy::initializeFindClient(const WKPageFindClient* client) +{ + m_findClient.initialize(client); +} + +void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client) +{ + m_contextMenuClient.initialize(client); +} + +void WebPageProxy::reattachToWebProcess() +{ + m_isValid = true; + + context()->relaunchProcessIfNecessary(); + process()->addExistingWebPage(this, m_pageID); + + initializeWebPage(); + + m_pageClient->didRelaunchProcess(); +} + +void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item) +{ + if (item && item != m_backForwardList->currentItem()) + m_backForwardList->goToItem(item); + + reattachToWebProcess(); + process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); +} + +void WebPageProxy::initializeWebPage() +{ + ASSERT(isValid()); + + BackForwardListItemVector items = m_backForwardList->entries(); + for (size_t i = 0; i < items.size(); ++i) + process()->registerNewWebBackForwardListItem(items[i].get()); + + m_drawingArea = m_pageClient->createDrawingAreaProxy(); + ASSERT(m_drawingArea); + + process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0); +} + +void WebPageProxy::close() +{ + if (!isValid()) + return; + + m_isClosed = true; + + m_backForwardList->pageClosed(); + + process()->disconnectFramesFromPage(this); + m_mainFrame = 0; + +#if ENABLE(INSPECTOR) + if (m_inspector) { + m_inspector->invalidate(); + m_inspector = 0; + } +#endif + + if (m_openPanelResultListener) { + m_openPanelResultListener->invalidate(); + m_openPanelResultListener = 0; + } + + m_geolocationPermissionRequestManager.invalidateRequests(); + + m_toolTip = String(); + + invalidateCallbackMap(m_dataCallbacks); + invalidateCallbackMap(m_stringCallbacks); + + Vector<WebEditCommandProxy*> editCommandVector; + copyToVector(m_editCommandSet, editCommandVector); + m_editCommandSet.clear(); + for (size_t i = 0, size = editCommandVector.size(); i < size; ++i) + editCommandVector[i]->invalidate(); + + m_activePopupMenu = 0; + + m_estimatedProgress = 0.0; + + m_loaderClient.initialize(0); + m_policyClient.initialize(0); + m_uiClient.initialize(0); + + m_drawingArea.clear(); + + process()->send(Messages::WebPage::Close(), m_pageID); + process()->removeWebPage(m_pageID); +} + +bool WebPageProxy::tryClose() +{ + if (!isValid()) + return true; + + process()->send(Messages::WebPage::TryClose(), m_pageID); + return false; +} + +static void initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle) +{ + if (!url.isLocalFile()) + return; + + SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle); +} + +void WebPageProxy::loadURL(const String& url) +{ + if (!isValid()) + reattachToWebProcess(); + + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle); + process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID); +} + +void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest) +{ + if (!isValid()) + reattachToWebProcess(); + + SandboxExtension::Handle sandboxExtensionHandle; + initializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle); + process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID); +} + +void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID); +} + +void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL) +{ + if (!isValid()) + return; + + if (!m_mainFrame) + return; + + m_mainFrame->setUnreachableURL(unreachableURL); + process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID); +} + +void WebPageProxy::loadPlainTextString(const String& string) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID); +} + +void WebPageProxy::stopLoading() +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::StopLoading(), m_pageID); +} + +void WebPageProxy::reload(bool reloadFromOrigin) +{ + if (!isValid()) { + reattachToWebProcessWithItem(m_backForwardList->currentItem()); + return; + } + + process()->send(Messages::WebPage::Reload(reloadFromOrigin), m_pageID); +} + +void WebPageProxy::goForward() +{ + if (!isValid()) { + reattachToWebProcessWithItem(m_backForwardList->forwardItem()); + return; + } + + if (!canGoForward()) + return; + + process()->send(Messages::WebPage::GoForward(m_backForwardList->forwardItem()->itemID()), m_pageID); +} + +bool WebPageProxy::canGoForward() const +{ + return m_backForwardList->forwardItem(); +} + +void WebPageProxy::goBack() +{ + if (!isValid()) { + reattachToWebProcessWithItem(m_backForwardList->backItem()); + return; + } + + if (!canGoBack()) + return; + + process()->send(Messages::WebPage::GoBack(m_backForwardList->backItem()->itemID()), m_pageID); +} + +bool WebPageProxy::canGoBack() const +{ + return m_backForwardList->backItem(); +} + +void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item) +{ + if (!isValid()) { + reattachToWebProcessWithItem(item); + return; + } + + process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); +} + +void WebPageProxy::didChangeBackForwardList() +{ + m_loaderClient.didChangeBackForwardList(this); +} + + +bool WebPageProxy::canShowMIMEType(const String& mimeType) const +{ + if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) + return true; + + if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) + return true; + + String newMimeType = mimeType; + PluginInfoStore::Plugin plugin = context()->pluginInfoStore()->findPlugin(newMimeType, KURL()); + if (!plugin.path.isNull()) + return true; + + return false; +} + +void WebPageProxy::setDrawsBackground(bool drawsBackground) +{ + if (m_drawsBackground == drawsBackground) + return; + + m_drawsBackground = drawsBackground; + + if (isValid()) + process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID); +} + +void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground) +{ + if (m_drawsTransparentBackground == drawsTransparentBackground) + return; + + m_drawsTransparentBackground = drawsTransparentBackground; + + if (isValid()) + process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID); +} + +void WebPageProxy::setViewNeedsDisplay(const IntRect& rect) +{ + m_pageClient->setViewNeedsDisplay(rect); +} + +void WebPageProxy::displayView() +{ + m_pageClient->displayView(); +} + +void WebPageProxy::viewStateDidChange(ViewStateFlags flags) +{ + if (!isValid()) + return; + + if (flags & ViewIsFocused) + process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID); + + if (flags & ViewWindowIsActive) + process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID); + + if (flags & ViewIsVisible) { + bool isVisible = m_pageClient->isViewVisible(); + if (isVisible != m_isVisible) { + m_isVisible = isVisible; + m_drawingArea->setPageIsVisible(isVisible); + } + } + + if (flags & ViewIsInWindow) { + bool isInWindow = m_pageClient->isViewInWindow(); + if (m_isInWindow != isInWindow) { + m_isInWindow = isInWindow; + process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID); + } + } +} + +IntSize WebPageProxy::viewSize() const +{ + return m_pageClient->viewSize(); +} + +void WebPageProxy::setInitialFocus(bool forward) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::SetInitialFocus(forward), m_pageID); +} + +void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID); +} + +void WebPageProxy::validateMenuItem(const String& commandName) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::ValidateMenuItem(commandName), m_pageID); +} + +void WebPageProxy::executeEditCommand(const String& commandName) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID); +} + +#if PLATFORM(MAC) +void WebPageProxy::updateWindowIsVisible(bool windowIsVisible) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID); +} + +void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID); +} + +void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length) +{ + process()->sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID); +} + +uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point) +{ + uint64_t result; + process()->sendSync(Messages::WebPage::CharacterIndexForPoint(point), Messages::WebPage::CharacterIndexForPoint::Reply(result), m_pageID); + return result; +} + +WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length) +{ + IntRect resultRect; + process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID); + return resultRect; +} +#elif PLATFORM(WIN) +WebCore::IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition) +{ + IntRect resultRect; + process()->sendSync(Messages::WebPage::FirstRectForCharacterInSelectedRange(characterPosition), Messages::WebPage::FirstRectForCharacterInSelectedRange::Reply(resultRect), m_pageID); + return resultRect; +} + +String WebPageProxy::getSelectedText() +{ + String text; + process()->sendSync(Messages::WebPage::GetSelectedText(), Messages::WebPage::GetSelectedText::Reply(text), m_pageID); + return text; +} +#endif + +#if ENABLE(TILED_BACKING_STORE) +void WebPageProxy::setActualVisibleContentRect(const IntRect& rect) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::SetActualVisibleContentRect(rect), m_pageID); +} +#endif + +void WebPageProxy::performDragControllerAction(DragControllerAction action, WebCore::DragData* dragData, const String& dragStorageName) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags()), m_pageID); +} + +void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation) +{ + m_currentDragOperation = static_cast<DragOperation>(resultOperation); +} + +void WebPageProxy::handleMouseEvent(const WebMouseEvent& event) +{ + if (!isValid()) + return; + + // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction. + if (event.type() != WebEvent::MouseMove) + process()->responsivenessTimer()->start(); + else { + if (m_processingMouseMoveEvent) { + m_nextMouseMoveEvent = adoptPtr(new WebMouseEvent(event)); + return; + } + + m_processingMouseMoveEvent = true; + } + + process()->send(Messages::WebPage::MouseEvent(event), m_pageID); +} + +static PassOwnPtr<WebWheelEvent> coalesceWheelEvents(WebWheelEvent* oldNextWheelEvent, const WebWheelEvent& newWheelEvent) +{ +#if MERGE_WHEEL_EVENTS + // Merge model: Combine wheel event deltas (and wheel ticks) into a single wheel event. + if (!oldNextWheelEvent) + return adoptPtr(new WebWheelEvent(newWheelEvent)); + + if (oldNextWheelEvent->position() != newWheelEvent.position() || oldNextWheelEvent->modifiers() != newWheelEvent.modifiers() || oldNextWheelEvent->granularity() != newWheelEvent.granularity()) + return adoptPtr(new WebWheelEvent(newWheelEvent)); + + FloatSize mergedDelta = oldNextWheelEvent->delta() + newWheelEvent.delta(); + FloatSize mergedWheelTicks = oldNextWheelEvent->wheelTicks() + newWheelEvent.wheelTicks(); + + return adoptPtr(new WebWheelEvent(WebEvent::Wheel, newWheelEvent.position(), newWheelEvent.globalPosition(), mergedDelta, mergedWheelTicks, newWheelEvent.granularity(), newWheelEvent.modifiers(), newWheelEvent.timestamp())); +#else + // Simple model: Just keep the last event, dropping all interim events. + return adoptPtr(new WebWheelEvent(newWheelEvent)); +#endif +} + +void WebPageProxy::handleWheelEvent(const WebWheelEvent& event) +{ + if (!isValid()) + return; + + if (m_processingWheelEvent) { + m_nextWheelEvent = coalesceWheelEvents(m_nextWheelEvent.get(), event); + return; + } + + process()->responsivenessTimer()->start(); + process()->send(Messages::WebPage::WheelEvent(event), m_pageID); + m_processingWheelEvent = true; +} + +void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) +{ + if (!isValid()) + return; + + m_keyEventQueue.append(event); + + process()->responsivenessTimer()->start(); + process()->send(Messages::WebPage::KeyEvent(event), m_pageID); +} + +#if ENABLE(TOUCH_EVENTS) +void WebPageProxy::handleTouchEvent(const WebTouchEvent& event) +{ + if (!isValid()) + return; + process()->send(Messages::WebPage::TouchEvent(event), m_pageID); +} +#endif + +void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID) +{ + if (!isValid()) + return; + + uint64_t downloadID = 0; + if (action == PolicyDownload) { + // Create a download proxy. + downloadID = context()->createDownloadProxy(); + } + + // If we received a policy decision while in decidePolicyForMIMEType the decision will + // be sent back to the web process by decidePolicyForMIMEType. + if (m_inDecidePolicyForMIMEType) { + m_syncMimeTypePolicyActionIsValid = true; + m_syncMimeTypePolicyAction = action; + m_syncMimeTypePolicyDownloadID = downloadID; + return; + } + + process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID); +} + +String WebPageProxy::pageTitle() const +{ + // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has + // crashed, page has been closed). + if (!m_mainFrame) + return String(); + + return m_mainFrame->title(); +} + +void WebPageProxy::setUserAgent(const String& userAgent) +{ + if (m_userAgent == userAgent) + return; + m_userAgent = userAgent; + + if (!isValid()) + return; + process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID); +} + +void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName) +{ + if (m_applicationNameForUserAgent == applicationName) + return; + + m_applicationNameForUserAgent = applicationName; + if (!m_customUserAgent.isEmpty()) + return; + + setUserAgent(standardUserAgent(m_applicationNameForUserAgent)); +} + +void WebPageProxy::setCustomUserAgent(const String& customUserAgent) +{ + if (m_customUserAgent == customUserAgent) + return; + + m_customUserAgent = customUserAgent; + + if (m_customUserAgent.isEmpty()) { + setUserAgent(standardUserAgent(m_applicationNameForUserAgent)); + return; + } + + setUserAgent(m_customUserAgent); +} + +bool WebPageProxy::supportsTextEncoding() const +{ + return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument(); +} + +void WebPageProxy::setCustomTextEncodingName(const String& encodingName) +{ + if (m_customTextEncodingName == encodingName) + return; + m_customTextEncodingName = encodingName; + + if (!isValid()) + return; + process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID); +} + +void WebPageProxy::terminateProcess() +{ + if (!isValid()) + return; + + process()->terminate(); +} + +#if !PLATFORM(CF) || defined(BUILDING_QT__) +PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const +{ + // FIXME: Return session state data for saving Page state. + return 0; +} + +void WebPageProxy::restoreFromSessionStateData(WebData*) +{ + // FIXME: Restore the Page from the passed in session state data. +} +#endif + +bool WebPageProxy::supportsTextZoom() const +{ + if (m_mainFrameHasCustomRepresentation) + return false; + + // FIXME: This should also return false for standalone media and plug-in documents. + if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument()) + return false; + + return true; +} + +void WebPageProxy::setTextZoomFactor(double zoomFactor) +{ + if (!isValid()) + return; + + if (m_mainFrameHasCustomRepresentation) + return; + + if (m_textZoomFactor == zoomFactor) + return; + + m_textZoomFactor = zoomFactor; + process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); +} + +double WebPageProxy::pageZoomFactor() const +{ + return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor; +} + +void WebPageProxy::setPageZoomFactor(double zoomFactor) +{ + if (!isValid()) + return; + + if (m_mainFrameHasCustomRepresentation) { + m_pageClient->setCustomRepresentationZoomFactor(zoomFactor); + return; + } + + if (m_pageZoomFactor == zoomFactor) + return; + + m_pageZoomFactor = zoomFactor; + process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); +} + +void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor) +{ + if (!isValid()) + return; + + if (m_mainFrameHasCustomRepresentation) { + m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor); + return; + } + + if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor) + return; + + m_pageZoomFactor = pageZoomFactor; + m_textZoomFactor = textZoomFactor; + process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); +} + +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); +} + +void WebPageProxy::setUseFixedLayout(bool fixed) +{ + if (!isValid()) + return; + + if (fixed == m_useFixedLayout) + return; + + m_useFixedLayout = fixed; + if (!fixed) + m_fixedLayoutSize = IntSize(); + process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID); +} + +void WebPageProxy::setFixedLayoutSize(const IntSize& size) +{ + if (!isValid()) + return; + + if (size == m_fixedLayoutSize) + return; + + m_fixedLayoutSize = size; + process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); +} + +void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount) +{ + process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID); +} + +void WebPageProxy::hideFindUI() +{ + process()->send(Messages::WebPage::HideFindUI(), m_pageID); +} + +void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) +{ + process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID); +} + +void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<StringCallback> prpCallback) +{ + RefPtr<StringCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_stringCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID); +} + +void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback) +{ + RefPtr<StringCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_stringCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID); +} + +void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback) +{ + RefPtr<StringCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_stringCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID); +} + +void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback) +{ + RefPtr<StringCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_stringCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID); +} + +void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback) +{ + RefPtr<StringCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_stringCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID); +} + +void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback) +{ + RefPtr<DataCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_dataCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID); +} + +void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback) +{ + RefPtr<DataCallback> callback = prpCallback; + uint64_t callbackID = callback->callbackID(); + m_dataCallbacks.set(callbackID, callback.get()); + process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID); +} + +void WebPageProxy::preferencesDidChange() +{ + if (!isValid()) + return; + + // FIXME: It probably makes more sense to send individual preference changes. + // However, WebKitTestRunner depends on getting a preference change notification + // even if nothing changed in UI process, so that overrides get removed. + process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID); +} + +#if ENABLE(TILED_BACKING_STORE) +void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& targetLayoutSize) +{ + process()->send(Messages::WebPage::SetResizesToContentsUsingLayoutSize(targetLayoutSize), m_pageID); +} +#endif + +void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ +#ifdef __APPLE__ + if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) { + m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments); + return; + } +#endif + + if (messageID.is<CoreIPC::MessageClassDrawingAreaProxyLegacy>()) { + m_drawingArea->didReceiveMessage(connection, messageID, arguments); + return; + } + +#if ENABLE(INSPECTOR) + if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) { + if (WebInspectorProxy* inspector = this->inspector()) + inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments); + return; + } +#endif + + didReceiveWebPageProxyMessage(connection, messageID, arguments); +} + +void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + if (messageID.is<CoreIPC::MessageClassDrawingAreaProxyLegacy>()) { + m_drawingArea->didReceiveSyncMessage(connection, messageID, arguments, reply); + return; + } + +#if ENABLE(INSPECTOR) + if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) { + if (WebInspectorProxy* inspector = this->inspector()) + inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply); + return; + } +#endif + + // FIXME: Do something with reply. + didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply); +} + +#if PLATFORM(MAC) +void WebPageProxy::interpretKeyEvent(uint32_t type, Vector<KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<CompositionUnderline>& underlines) +{ + m_pageClient->interceptKeyEvent(m_keyEventQueue.first(), commandsList, selectionStart, selectionEnd, underlines); +} +#endif + +void WebPageProxy::didCreateMainFrame(uint64_t frameID) +{ + MESSAGE_CHECK(!m_mainFrame); + MESSAGE_CHECK(process()->canCreateFrame(frameID)); + + m_mainFrame = WebFrameProxy::create(this, frameID); + + // Add the frame to the process wide map. + process()->frameCreated(frameID, m_mainFrame.get()); +} + +void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID) +{ + MESSAGE_CHECK(m_mainFrame); + + WebFrameProxy* parentFrame = process()->webFrame(parentFrameID); + MESSAGE_CHECK(parentFrame); + MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get())); + + MESSAGE_CHECK(process()->canCreateFrame(frameID)); + + RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID); + + // Add the frame to the process wide map. + process()->frameCreated(frameID, subFrame.get()); + + // Insert the frame into the frame hierarchy. + parentFrame->appendChild(subFrame.get()); +} + +void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID) +{ + MESSAGE_CHECK(m_mainFrame); + + WebFrameProxy* subframe = process()->webFrame(frameID); + MESSAGE_CHECK(subframe); + + if (!subframe->parentFrame()) + return; + + MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get())); + + subframe->didRemoveFromHierarchy(); +} + +void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID) +{ + MESSAGE_CHECK(m_mainFrame); + + WebFrameProxy* subframe = process()->webFrame(frameID); + MESSAGE_CHECK(subframe); + MESSAGE_CHECK(!subframe->parentFrame()); + MESSAGE_CHECK(subframe->page() == m_mainFrame->page()); + + WebFrameProxy* parentFrame = process()->webFrame(parentFrameID); + MESSAGE_CHECK(parentFrame); + MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get())); + + // Insert the frame into the frame hierarchy. + parentFrame->appendChild(subframe); +} + +void WebPageProxy::didStartProgress() +{ + m_estimatedProgress = 0.0; + + m_loaderClient.didStartProgress(this); +} + +void WebPageProxy::didChangeProgress(double value) +{ + m_estimatedProgress = value; + + m_loaderClient.didChangeProgress(this); +} + +void WebPageProxy::didFinishProgress() +{ + m_estimatedProgress = 1.0; + + m_loaderClient.didFinishProgress(this); +} + +void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + if (!loadingSubstituteDataForUnreachableURL) + frame->setUnreachableURL(String()); + + frame->didStartProvisionalLoad(url); + m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didReceiveServerRedirectForProvisionalLoad(url); + + m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didFailProvisionalLoad(); + + m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get()); +} + +void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didCommitLoad(mimeType, certificateInfo); + + if (frame->isMainFrame()) { + m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation; + m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation); + } + + m_loaderClient.didCommitLoadForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didFinishLoad(); + + m_loaderClient.didFinishLoadForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didFailLoad(); + + m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get()); +} + +void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didSameDocumentNavigation(url); + + m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get()); +} + +void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didChangeTitle(title); + + m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get()); +} + +void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + frame->didRemoveFromHierarchy(); + + m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get()); +} + +void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get()); +} + +void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + 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); + MESSAGE_CHECK(frame); + + frame->setIsFrameSet(value); + if (frame->isMainFrame()) + m_frameSetLargestFrame = value ? m_mainFrame : 0; +} + +// PolicyClient + +void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType); + WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers); + 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())) + listener->use(); +} + +void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType); + WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers); + 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())) + 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) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID); + + ASSERT(!m_inDecidePolicyForMIMEType); + + m_inDecidePolicyForMIMEType = true; + m_syncMimeTypePolicyActionIsValid = false; + + if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get())) + listener->use(); + + m_inDecidePolicyForMIMEType = false; + + // Check if we received a policy decision already. If we did, we can just pass it back. + if (m_syncMimeTypePolicyActionIsValid) { + receivedPolicyAction = true; + policyAction = m_syncMimeTypePolicyAction; + downloadID = m_syncMimeTypePolicyDownloadID; + } +} + +// FormClient + +void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, 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); + + WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID); + MESSAGE_CHECK(sourceFrame); + + RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID); + if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get())) + listener->continueSubmission(); +} + +// ResourceLoad Client + +void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request); +} + +void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse); +} + +void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response); +} + +void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength); +} + +void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier); +} + +void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error); +} + +// UIClient + +void WebPageProxy::createNewPage(const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters) +{ + RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton)); + if (newPage) { + newPageID = newPage->pageID(); + newPageParameters = newPage->creationParameters(); + } else + newPageID = 0; +} + +void WebPageProxy::showPage() +{ + m_uiClient.showPage(this); +} + +void WebPageProxy::closePage() +{ + m_uiClient.close(this); +} + +void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_uiClient.runJavaScriptAlert(this, message, frame); +} + +void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + result = m_uiClient.runJavaScriptConfirm(this, message, frame); +} + +void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame); +} + +void WebPageProxy::setStatusText(const String& text) +{ + m_uiClient.setStatusText(this, text); +} + +void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers); + + m_uiClient.mouseDidMoveOverElement(this, modifiers, userData.get()); +} + +void WebPageProxy::missingPluginButtonClicked(const String& mimeType, const String& url) +{ + m_uiClient.missingPluginButtonClicked(this, mimeType, url); +} + +void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible) +{ + m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible); +} + +void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible) +{ + toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this); +} + +void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible) +{ + m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible); +} + +void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible) +{ + menuBarIsVisible = m_uiClient.menuBarIsVisible(this); +} + +void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible) +{ + m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible); +} + +void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible) +{ + statusBarIsVisible = m_uiClient.statusBarIsVisible(this); +} + +void WebPageProxy::setIsResizable(bool isResizable) +{ + m_uiClient.setIsResizable(this, isResizable); +} + +void WebPageProxy::getIsResizable(bool& isResizable) +{ + isResizable = m_uiClient.isResizable(this); +} + +void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame) +{ + m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame)); +} + +void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame) +{ + newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this)); +} + +void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun) +{ + canRun = m_uiClient.canRunBeforeUnloadConfirmPanel(); +} + +void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame); +} + +#if ENABLE(TILED_BACKING_STORE) +void WebPageProxy::pageDidRequestScroll(const IntSize& delta) +{ + m_pageClient->pageDidRequestScroll(delta); +} +#endif + +void WebPageProxy::didChangeViewportData(const ViewportArguments& args) +{ + m_pageClient->setViewportArguments(args); +} + +void WebPageProxy::pageDidScroll() +{ + m_uiClient.pageDidScroll(this); +} + +void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data& data) +{ + if (m_openPanelResultListener) { + m_openPanelResultListener->invalidate(); + m_openPanelResultListener = 0; + } + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this); + + if (!m_uiClient.runOpenPanel(this, frame, data, m_openPanelResultListener.get())) + didCancelForOpenPanel(); +} + +#if PLATFORM(QT) +void WebPageProxy::didChangeContentsSize(const WebCore::IntSize& size) +{ + m_pageClient->didChangeContentsSize(size); +} + +void WebPageProxy::didFindZoomableArea(const WebCore::IntRect& area) +{ + m_pageClient->didFindZoomableArea(area); +} + +void WebPageProxy::findZoomableAreaForPoint(const WebCore::IntPoint& point) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::FindZoomableAreaForPoint(point), m_pageID); +} +#endif + +void WebPageProxy::didDraw() +{ + m_uiClient.didDraw(this); +} + +// Inspector + +#if ENABLE(INSPECTOR) + +WebInspectorProxy* WebPageProxy::inspector() +{ + if (isClosed() || !isValid()) + return 0; + if (!m_inspector) + m_inspector = WebInspectorProxy::create(this); + return m_inspector.get(); +} + +#endif + +// BackForwardList + +void WebPageProxy::backForwardAddItem(uint64_t itemID) +{ + m_backForwardList->addItem(process()->webBackForwardItem(itemID)); +} + +void WebPageProxy::backForwardGoToItem(uint64_t itemID) +{ + m_backForwardList->goToItem(process()->webBackForwardItem(itemID)); +} + +void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID) +{ + WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index); + itemID = item ? item->itemID() : 0; +} + +void WebPageProxy::backForwardBackListCount(int32_t& count) +{ + count = m_backForwardList->backListCount(); +} + +void WebPageProxy::backForwardForwardListCount(int32_t& count) +{ + count = m_backForwardList->forwardListCount(); +} + +void WebPageProxy::selectionStateChanged(const SelectionState& selectionState) +{ + m_selectionState = selectionState; +} + +#if PLATFORM(MAC) +// Complex text input support for plug-ins. +void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::SendComplexTextInputToPlugin(pluginComplexTextInputIdentifier, textInput), m_pageID); +} +#endif + +#if PLATFORM(WIN) +void WebPageProxy::didChangeCompositionSelection(bool hasComposition) +{ + m_pageClient->compositionSelectionChanged(hasComposition); +} + +void WebPageProxy::confirmComposition(const String& compositionString) +{ + process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID); +} + +void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition) +{ + process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID); +} +#endif + +// Undo management + +void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction) +{ + registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo); +} + +void WebPageProxy::clearAllEditCommands() +{ + m_pageClient->clearAllEditCommands(); +} + +void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount) +{ + m_findClient.didCountStringMatches(this, string, matchCount); +} + +void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut) +{ + RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle); + m_pageClient->setFindIndicator(findIndicator.release(), fadeOut); +} + +void WebPageProxy::didFindString(const String& string, uint32_t matchCount) +{ + m_findClient.didFindString(this, string, matchCount); +} + +void WebPageProxy::didFailToFindString(const String& string) +{ + m_findClient.didFailToFindString(this, string); +} + +void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) +{ + process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID); +} + +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) +{ + if (m_activePopupMenu) + m_activePopupMenu->hidePopupMenu(); + else + 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; +} + +void WebPageProxy::hidePopupMenu() +{ + if (!m_activePopupMenu) + return; + + m_activePopupMenu->hidePopupMenu(); + m_activePopupMenu = 0; +} + +void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const ContextMenuState& contextMenuState, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, context()); + if (!arguments->decode(messageDecoder)) + return; + + m_activeContextMenuState = contextMenuState; + + if (m_activeContextMenu) + m_activeContextMenu->hideContextMenu(); + else + m_activeContextMenu = m_pageClient->createContextMenuProxy(this); + + // Give the PageContextMenuClient one last swipe at changing the menu. + Vector<WebContextMenuItemData> items; + + if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, userData.get())) { + m_activeContextMenu->showContextMenu(menuLocation, proposedItems); + return; + } + + if (items.size()) + m_activeContextMenu->showContextMenu(menuLocation, items); +} + +void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item) +{ + // Application custom items don't need to round-trip through to WebCore in the WebProcess. + if (item.action() >= ContextMenuItemBaseApplicationTag) { + m_contextMenuClient.customContextMenuItemSelected(this, item); + return; + } + +#if PLATFORM(MAC) + if (item.action() == ContextMenuItemTagSmartCopyPaste) { + setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled()); + return; + } + if (item.action() == ContextMenuItemTagSmartQuotes) { + TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled); + process()->updateTextCheckerState(); + return; + } + if (item.action() == ContextMenuItemTagSmartDashes) { + TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled); + process()->updateTextCheckerState(); + return; + } + if (item.action() == ContextMenuItemTagSmartLinks) { + TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled); + process()->updateTextCheckerState(); + return; + } + if (item.action() == ContextMenuItemTagTextReplacement) { + TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled); + process()->updateTextCheckerState(); + return; + } +#endif + if (item.action() == ContextMenuItemTagDownloadImageToDisk) { + m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteImageURLString)); + return; + } + if (item.action() == ContextMenuItemTagDownloadLinkToDisk) { + m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteLinkURLString)); + return; + } + + if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling) + ++m_pendingLearnOrIgnoreWordMessageCount; + + process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID); +} + +void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) +{ + if (!isValid()) + return; + + // FIXME: This also needs to send a sandbox extension for these paths. + process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); + + m_openPanelResultListener->invalidate(); + m_openPanelResultListener = 0; +} + +void WebPageProxy::didCancelForOpenPanel() +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID); + + m_openPanelResultListener->invalidate(); + m_openPanelResultListener = 0; +} + +void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) +{ + process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID); +} + +void WebPageProxy::changeSpellingToWord(const String& word) +{ + if (word.isEmpty()) + return; + + process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID); +} + +void WebPageProxy::unmarkAllMisspellings() +{ + process()->send(Messages::WebPage::UnmarkAllMisspellings(), m_pageID); +} + +void WebPageProxy::unmarkAllBadGrammar() +{ + process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID); +} + +#if PLATFORM(MAC) +void WebPageProxy::uppercaseWord() +{ + process()->send(Messages::WebPage::UppercaseWord(), m_pageID); +} + +void WebPageProxy::lowercaseWord() +{ + process()->send(Messages::WebPage::LowercaseWord(), m_pageID); +} + +void WebPageProxy::capitalizeWord() +{ + process()->send(Messages::WebPage::CapitalizeWord(), m_pageID); +} + +void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) +{ + if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled) + return; + + TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled); + m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; + process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID); +} +#endif + +void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo) +{ + m_pageClient->registerEditCommand(commandProxy, undoOrRedo); +} + +void WebPageProxy::addEditCommand(WebEditCommandProxy* command) +{ + m_editCommandSet.add(command); +} + +void WebPageProxy::removeEditCommand(WebEditCommandProxy* command) +{ + m_editCommandSet.remove(command); + + if (!isValid()) + return; + process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID); +} + +int64_t WebPageProxy::spellDocumentTag() +{ + if (!m_hasSpellDocumentTag) { + m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag(); + m_hasSpellDocumentTag = true; + } + + return m_spellDocumentTag; +} + +void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results) +{ + results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes); +} + +void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + TextChecker::updateSpellingUIWithMisspelledWord(misspelledWord); +} + +void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) +{ + TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses); +} + +void WebPageProxy::learnWord(const String& word) +{ + MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount); + --m_pendingLearnOrIgnoreWordMessageCount; + + TextChecker::learnWord(word); +} + +void WebPageProxy::ignoreWord(const String& word) +{ + MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount); + --m_pendingLearnOrIgnoreWordMessageCount; + + TextChecker::ignoreWord(spellDocumentTag(), word); +} + +// Other + +void WebPageProxy::takeFocus(bool direction) +{ + m_pageClient->takeFocus(direction); +} + +void WebPageProxy::setToolTip(const String& toolTip) +{ + String oldToolTip = m_toolTip; + m_toolTip = toolTip; + m_pageClient->toolTipChanged(oldToolTip, m_toolTip); +} + +void WebPageProxy::setCursor(const WebCore::Cursor& cursor) +{ + m_pageClient->setCursor(cursor); +} + +void WebPageProxy::didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state) +{ + m_pageClient->setEditCommandState(commandName, isEnabled, state); +} + +void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) +{ + WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType); + + switch (type) { + case WebEvent::MouseMove: + break; + + case WebEvent::MouseDown: + case WebEvent::MouseUp: + case WebEvent::Wheel: + case WebEvent::KeyDown: + case WebEvent::KeyUp: + case WebEvent::RawKeyDown: + case WebEvent::Char: + process()->responsivenessTimer()->stop(); + break; + } + + switch (type) { + case WebEvent::MouseMove: + m_processingMouseMoveEvent = false; + if (m_nextMouseMoveEvent) { + handleMouseEvent(*m_nextMouseMoveEvent); + m_nextMouseMoveEvent = nullptr; + } + break; + case WebEvent::MouseDown: + case WebEvent::MouseUp: + break; + + case WebEvent::Wheel: { + m_processingWheelEvent = false; + if (m_nextWheelEvent) { + handleWheelEvent(*m_nextWheelEvent); + m_nextWheelEvent = nullptr; + } + break; + } + + case WebEvent::KeyDown: + case WebEvent::KeyUp: + case WebEvent::RawKeyDown: + case WebEvent::Char: { + NativeWebKeyboardEvent event = m_keyEventQueue.first(); + MESSAGE_CHECK(type == event.type()); + + m_keyEventQueue.removeFirst(); + + if (handled) + break; + + m_pageClient->didNotHandleKeyEvent(event); + m_uiClient.didNotHandleKeyEvent(this, event); + break; + } + } +} + +void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID) +{ + RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get()); +} + +void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID) +{ + RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID); + if (!callback) { + // FIXME: Log error or assert. + return; + } + + callback->performCallbackWithReturnValue(resultString.impl()); +} + +#if PLATFORM(MAC) +void WebPageProxy::sendAccessibilityPresenterToken(const CoreIPC::DataReference& token) +{ + if (!isValid()) + return; + + process()->send(Messages::WebPage::SendAccessibilityPresenterToken(token), m_pageID); +} +#endif + +void WebPageProxy::focusedFrameChanged(uint64_t frameID) +{ + if (!frameID) { + m_focusedFrame = 0; + return; + } + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_focusedFrame = frame; +} + +void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID) +{ + if (!frameID) { + m_frameSetLargestFrame = 0; + return; + } + + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + m_frameSetLargestFrame = frame; +} + +#if USE(ACCELERATED_COMPOSITING) +void WebPageProxy::didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo& drawingAreaInfo) +{ + if (compositing) + didEnterAcceleratedCompositing(); + else + didLeaveAcceleratedCompositing(); + + drawingAreaInfo = drawingArea()->info(); +} +#endif + +void WebPageProxy::processDidBecomeUnresponsive() +{ + m_loaderClient.processDidBecomeUnresponsive(this); +} + +void WebPageProxy::processDidBecomeResponsive() +{ + m_loaderClient.processDidBecomeResponsive(this); +} + +void WebPageProxy::processDidCrash() +{ + ASSERT(m_pageClient); + + m_isValid = false; + + if (m_mainFrame) + m_urlAtProcessExit = m_mainFrame->url(); + + m_mainFrame = 0; + + m_drawingArea = nullptr; + +#if ENABLE(INSPECTOR) + if (m_inspector) { + m_inspector->invalidate(); + m_inspector = 0; + } +#endif + + if (m_openPanelResultListener) { + m_openPanelResultListener->invalidate(); + m_openPanelResultListener = 0; + } + + m_geolocationPermissionRequestManager.invalidateRequests(); + + m_toolTip = String(); + + invalidateCallbackMap(m_dataCallbacks); + invalidateCallbackMap(m_stringCallbacks); + + Vector<WebEditCommandProxy*> editCommandVector; + copyToVector(m_editCommandSet, editCommandVector); + m_editCommandSet.clear(); + for (size_t i = 0, size = editCommandVector.size(); i < size; ++i) + editCommandVector[i]->invalidate(); + m_pageClient->clearAllEditCommands(); + + m_activePopupMenu = 0; + + m_estimatedProgress = 0.0; + + m_pendingLearnOrIgnoreWordMessageCount = 0; + + m_pageClient->processDidCrash(); + m_loaderClient.processDidCrash(this); +} + +WebPageCreationParameters WebPageProxy::creationParameters() const +{ + WebPageCreationParameters parameters; + + parameters.viewSize = m_pageClient->viewSize(); + parameters.isActive = m_pageClient->isViewWindowActive(); + parameters.isFocused = m_pageClient->isViewFocused(); + parameters.isVisible = m_pageClient->isViewVisible(); + parameters.isInWindow = m_pageClient->isViewInWindow(); + + parameters.drawingAreaInfo = m_drawingArea->info(); + parameters.store = m_pageGroup->preferences()->store(); + parameters.pageGroupData = m_pageGroup->data(); + parameters.drawsBackground = m_drawsBackground; + parameters.drawsTransparentBackground = m_drawsTransparentBackground; + parameters.useFixedLayout = m_useFixedLayout; + parameters.fixedLayoutSize = m_fixedLayoutSize; + parameters.userAgent = userAgent(); + parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex()); + parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID(); + +#if PLATFORM(MAC) + parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled; +#endif + +#if PLATFORM(WIN) + parameters.nativeWindow = m_pageClient->nativeWindow(); +#endif + + return parameters; +} + +#if USE(ACCELERATED_COMPOSITING) + +void WebPageProxy::didEnterAcceleratedCompositing() +{ + m_pageClient->pageDidEnterAcceleratedCompositing(); +} + +void WebPageProxy::didLeaveAcceleratedCompositing() +{ + m_pageClient->pageDidLeaveAcceleratedCompositing(); +} + +#endif // USE(ACCELERATED_COMPOSITING) + +void WebPageProxy::backForwardClear() +{ + m_backForwardList->clear(); +} + +void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace& coreProtectionSpace, bool& canAuthenticate) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace); + + canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get()); +} + +void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this); + + m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get()); +} + +void WebPageProxy::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) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier); + + newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage); +} + +void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier) +{ + WebFrameProxy* frame = process()->webFrame(frameID); + MESSAGE_CHECK(frame); + + RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier); + RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID); + + if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get())) + request->deny(); +} + +void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference) +{ + m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference); +} + +#if PLATFORM(MAC) +void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) +{ + m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled); +} +#endif + +void WebPageProxy::backForwardRemovedItem(uint64_t itemID) +{ + process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID); +} + +void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo) +{ + if (m_isInPrintingMode) + return; + + m_isInPrintingMode = true; + process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID); +} + +void WebPageProxy::endPrinting() +{ + if (!m_isInPrintingMode) + return; + + m_isInPrintingMode = false; + process()->send(Messages::WebPage::EndPrinting(), m_pageID); +} + +void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting) +{ + // 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); +} + +#if PLATFORM(MAC) +void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, Vector<uint8_t>& pdfData) +{ + // 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); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h new file mode 100644 index 0000000..4a9e478 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -0,0 +1,621 @@ +/* + * 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 WebPageProxy_h +#define WebPageProxy_h + +#include "APIObject.h" +#include "ContextMenuState.h" +#include "DragControllerAction.h" +#include "DrawingAreaProxy.h" +#include "GeolocationPermissionRequestManagerProxy.h" +#include "SelectionState.h" +#include "SharedMemory.h" +#include "WKBase.h" +#include "WebContextMenuItemData.h" +#include "WebEvent.h" +#include "WebFindClient.h" +#include "WebFindOptions.h" +#include "WebFormClient.h" +#include "WebFrameProxy.h" +#include "WebHistoryClient.h" +#include "WebInspectorProxy.h" +#include "WebLoaderClient.h" +#include "WebPageContextMenuClient.h" +#include "WebPolicyClient.h" +#include "WebPopupMenuProxy.h" +#include "WebResourceLoadClient.h" +#include "WebUIClient.h" +#include <WebCore/DragActions.h> +#include <WebCore/EditAction.h> +#include <WebCore/Editor.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/KeyboardEvent.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebCore { + class AuthenticationChallenge; + class Cursor; + class DragData; + class FloatRect; + class IntSize; + class ProtectionSpace; + struct TextCheckingResult; + struct ViewportArguments; + struct WindowFeatures; +} + +namespace WebKit { + +class ContextMenuState; +class DrawingAreaProxy; +class NativeWebKeyboardEvent; +class PageClient; +class PlatformCertificateInfo; +class StringPairVector; +class WebOpenPanelResultListenerProxy; +class WebBackForwardList; +class WebBackForwardListItem; +class WebContextMenuProxy; +class WebData; +class WebEditCommandProxy; +class WebKeyboardEvent; +class WebMouseEvent; +class WebPageGroup; +class WebPopupMenuProxy; +class WebProcessProxy; +class WebURLRequest; +class WebWheelEvent; +struct PlatformPopupMenuData; +struct PrintInfo; +struct WebPageCreationParameters; +struct WebPopupItem; + +typedef GenericCallback<WKStringRef, StringImpl*> StringCallback; + +class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client { +public: + static const Type APIType = TypePage; + + static PassRefPtr<WebPageProxy> create(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID); + virtual ~WebPageProxy(); + + uint64_t pageID() const { return m_pageID; } + + WebFrameProxy* mainFrame() const { return m_mainFrame.get(); } + WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); } + WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); } + + DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); } + void setDrawingArea(PassOwnPtr<DrawingAreaProxy>); + + WebBackForwardList* backForwardList() { return m_backForwardList.get(); } + +#if ENABLE(INSPECTOR) + WebInspectorProxy* inspector(); +#endif + + void initializeContextMenuClient(const WKPageContextMenuClient*); + void initializeFindClient(const WKPageFindClient*); + void initializeFormClient(const WKPageFormClient*); + void initializeLoaderClient(const WKPageLoaderClient*); + void initializePolicyClient(const WKPagePolicyClient*); + void initializeResourceLoadClient(const WKPageResourceLoadClient*); + void initializeUIClient(const WKPageUIClient*); + + void initializeWebPage(); + + void close(); + bool tryClose(); + bool isClosed() const { return m_isClosed; } + + void loadURL(const String&); + void loadURLRequest(WebURLRequest*); + void loadHTMLString(const String& htmlString, const String& baseURL); + void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL); + void loadPlainTextString(const String& string); + + void stopLoading(); + void reload(bool reloadFromOrigin); + + void goForward(); + bool canGoForward() const; + void goBack(); + bool canGoBack() const; + + void goToBackForwardItem(WebBackForwardListItem*); + void didChangeBackForwardList(); + + bool canShowMIMEType(const String& mimeType) const; + + bool drawsBackground() const { return m_drawsBackground; } + void setDrawsBackground(bool); + + bool drawsTransparentBackground() const { return m_drawsTransparentBackground; } + void setDrawsTransparentBackground(bool); + + void setInitialFocus(bool); + void setWindowResizerSize(const WebCore::IntSize&); + + void setViewNeedsDisplay(const WebCore::IntRect&); + void displayView(); + + enum { + ViewWindowIsActive = 1 << 0, + ViewIsFocused = 1 << 1, + ViewIsVisible = 1 << 2, + ViewIsInWindow = 1 << 3 + }; + typedef unsigned ViewStateFlags; + void viewStateDidChange(ViewStateFlags flags); + + WebCore::IntSize viewSize() const; + + void executeEditCommand(const String& commandName); + void validateMenuItem(const String& commandName); + + const SelectionState& selectionState() const { return m_selectionState; } + +#if PLATFORM(MAC) + void updateWindowIsVisible(bool windowIsVisible); + void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates); + void getMarkedRange(uint64_t& location, uint64_t& length); + uint64_t characterIndexForPoint(const WebCore::IntPoint); + WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t); + void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput); +#endif +#if PLATFORM(WIN) + void didChangeCompositionSelection(bool); + void confirmComposition(const String&); + void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int); + WebCore::IntRect firstRectForCharacterInSelectedRange(int); + String getSelectedText(); +#endif +#if ENABLE(TILED_BACKING_STORE) + void setActualVisibleContentRect(const WebCore::IntRect& rect); +#endif + + void handleMouseEvent(const WebMouseEvent&); + void handleWheelEvent(const WebWheelEvent&); + void handleKeyboardEvent(const NativeWebKeyboardEvent&); +#if ENABLE(TOUCH_EVENTS) + void handleTouchEvent(const WebTouchEvent&); +#endif + + String pageTitle() const; + const String& toolTip() const { return m_toolTip; } + + void setUserAgent(const String&); + const String& userAgent() const { return m_userAgent; } + void setApplicationNameForUserAgent(const String&); + const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; } + void setCustomUserAgent(const String&); + const String& customUserAgent() const { return m_customUserAgent; } + + bool supportsTextEncoding() const; + void setCustomTextEncodingName(const String&); + String customTextEncodingName() const { return m_customTextEncodingName; } + + double estimatedProgress() const { return m_estimatedProgress; } + + void terminateProcess(); + + typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void* context); + PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const; + void restoreFromSessionStateData(WebData*); + + bool supportsTextZoom() const; + double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; } + void setTextZoomFactor(double); + double pageZoomFactor() const; + void setPageZoomFactor(double); + void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor); + + void scaleWebView(double scale, const WebCore::IntPoint& origin); + double viewScaleFactor() const { return m_viewScaleFactor; } + + void setUseFixedLayout(bool); + void setFixedLayoutSize(const WebCore::IntSize&); + bool useFixedLayout() const { return m_useFixedLayout; }; + const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; }; + +#if PLATFORM(MAC) + void sendAccessibilityPresenterToken(const CoreIPC::DataReference&); +#endif + + // Find. + void findString(const String&, FindOptions, unsigned maxMatchCount); + void hideFindUI(); + void countStringMatches(const String&, FindOptions, unsigned maxMatchCount); + + void getContentsAsString(PassRefPtr<StringCallback>); + void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>); + void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>); + void getSelectionOrContentsAsString(PassRefPtr<StringCallback>); + void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>); + void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>); + void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>); + + 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 didPerformDragControllerAction(uint64_t resultOperation); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + void processDidBecomeUnresponsive(); + void processDidBecomeResponsive(); + void processDidCrash(); + +#if USE(ACCELERATED_COMPOSITING) + void didEnterAcceleratedCompositing(); + void didLeaveAcceleratedCompositing(); +#endif + + void didDraw(); + + enum UndoOrRedo { Undo, Redo }; + void addEditCommand(WebEditCommandProxy*); + void removeEditCommand(WebEditCommandProxy*); + void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo); + + WebProcessProxy* process() const; + WebContext* context() const { return m_context.get(); } + + WebPageGroup* pageGroup() const { return m_pageGroup.get(); } + + bool isValid(); + + WebCore::DragOperation dragOperation() { return m_currentDragOperation; } + void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; } + + // REMOVE: For demo purposes only. + const String& urlAtProcessExit() const { return m_urlAtProcessExit; } + + void preferencesDidChange(); + +#if ENABLE(TILED_BACKING_STORE) + void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&); +#endif + + // Called by the WebContextMenuProxy. + void contextMenuItemSelected(const WebContextMenuItemData&); + + // Called by the WebOpenPanelResultListenerProxy. + void didChooseFilesForOpenPanel(const Vector<String>&); + void didCancelForOpenPanel(); + + WebPageCreationParameters creationParameters() const; + +#if PLATFORM(QT) + void findZoomableAreaForPoint(const WebCore::IntPoint&); +#endif + + void advanceToNextMisspelling(bool startBeforeSelection); + void changeSpellingToWord(const String& word); + void unmarkAllMisspellings(); + void unmarkAllBadGrammar(); +#if PLATFORM(MAC) + void uppercaseWord(); + void lowercaseWord(); + void capitalizeWord(); + + bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } + void setSmartInsertDeleteEnabled(bool); +#endif + + void beginPrinting(WebFrameProxy*, const PrintInfo&); + void endPrinting(); + void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting); +#if PLATFORM(MAC) + void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, Vector<uint8_t>& pdfData); +#endif + +private: + WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID); + + virtual Type type() const { return APIType; } + + // WebPopupMenuProxy::Client + virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex); + virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index); + + // Implemented in generated WebPageProxyMessageReceiver.cpp + void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + void didCreateMainFrame(uint64_t frameID); + void didCreateSubframe(uint64_t frameID, uint64_t parentFrameID); + void didSaveFrameToPageCache(uint64_t frameID); + void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID); + + void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*); + void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*); + void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*); + void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*); + void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*); + void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::ArgumentDecoder*); + void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*); + void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); + void frameDidBecomeFrameSet(uint64_t frameID, bool); + 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 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 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); + void didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier); + void didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceError&); + + // UI client + void createNewPage(const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&); + void showPage(); + void closePage(); + void runJavaScriptAlert(uint64_t frameID, const String&); + void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result); + void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result); + void setStatusText(const String&); + void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*); + void missingPluginButtonClicked(const String& mimeType, const String& url); + void setToolbarsAreVisible(bool toolbarsAreVisible); + void getToolbarsAreVisible(bool& toolbarsAreVisible); + void setMenuBarIsVisible(bool menuBarIsVisible); + void getMenuBarIsVisible(bool& menuBarIsVisible); + void setStatusBarIsVisible(bool statusBarIsVisible); + void getStatusBarIsVisible(bool& statusBarIsVisible); + void setIsResizable(bool isResizable); + void getIsResizable(bool& isResizable); + void setWindowFrame(const WebCore::FloatRect&); + void getWindowFrame(WebCore::FloatRect&); + void canRunBeforeUnloadConfirmPanel(bool& canRun); + void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose); + void didChangeViewportData(const WebCore::ViewportArguments&); + void pageDidScroll(); + void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&); + 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 reattachToWebProcess(); + void reattachToWebProcessWithItem(WebBackForwardListItem*); + +#if ENABLE(TILED_BACKING_STORE) + void pageDidRequestScroll(const WebCore::IntSize&); +#endif + +#if PLATFORM(QT) + void didChangeContentsSize(const WebCore::IntSize&); + void didFindZoomableArea(const WebCore::IntRect&); +#endif + + // Selection + void selectionStateChanged(const SelectionState&); + + // Back/Forward list management + void backForwardAddItem(uint64_t itemID); + void backForwardGoToItem(uint64_t itemID); + void backForwardItemAtIndex(int32_t index, uint64_t& itemID); + void backForwardBackListCount(int32_t& count); + void backForwardForwardListCount(int32_t& count); + void backForwardClear(); + + // Undo management + void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction); + void clearAllEditCommands(); + + // Keyboard handling +#if PLATFORM(MAC) + void interpretKeyEvent(uint32_t eventType, Vector<WebCore::KeypressCommand>&, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines); +#endif + + // 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 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 hidePopupMenu(); + + // Context Menu. + void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*); + + // Speech. +#if PLATFORM(MAC) + void getIsSpeaking(bool&); + void speak(const String&); + void stopSpeaking(); +#endif + + // Spelling and grammar. + int64_t spellDocumentTag(); + void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results); + void updateSpellingUIWithMisspelledWord(const String& misspelledWord); + void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); + void learnWord(const String& word); + void ignoreWord(const String& word); + + void takeFocus(bool direction); + void setToolTip(const String&); + void setCursor(const WebCore::Cursor&); + void didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state); + + void didReceiveEvent(uint32_t opaqueType, bool handled); + + void dataCallback(const CoreIPC::DataReference&, uint64_t); + void stringCallback(const String&, uint64_t); + + void focusedFrameChanged(uint64_t frameID); + void frameSetLargestFrameChanged(uint64_t frameID); + +#if USE(ACCELERATED_COMPOSITING) + void didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo&); +#endif + + void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate); + void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID); + + void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& data); + +#if PLATFORM(MAC) + void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled); +#endif + + static String standardUserAgent(const String& applicationName = String()); + + PageClient* m_pageClient; + WebLoaderClient m_loaderClient; + WebPolicyClient m_policyClient; + WebFormClient m_formClient; + WebResourceLoadClient m_resourceLoadClient; + WebUIClient m_uiClient; + WebFindClient m_findClient; + WebPageContextMenuClient m_contextMenuClient; + + OwnPtr<DrawingAreaProxy> m_drawingArea; + RefPtr<WebContext> m_context; + RefPtr<WebPageGroup> m_pageGroup; + RefPtr<WebFrameProxy> m_mainFrame; + RefPtr<WebFrameProxy> m_focusedFrame; + RefPtr<WebFrameProxy> m_frameSetLargestFrame; + + String m_userAgent; + String m_applicationNameForUserAgent; + String m_customUserAgent; + String m_customTextEncodingName; + +#if ENABLE(INSPECTOR) + RefPtr<WebInspectorProxy> m_inspector; +#endif + + HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks; + HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks; + + HashSet<WebEditCommandProxy*> m_editCommandSet; + + RefPtr<WebPopupMenuProxy> m_activePopupMenu; + RefPtr<WebContextMenuProxy> m_activeContextMenu; + ContextMenuState m_activeContextMenuState; + RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener; + GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager; + + double m_estimatedProgress; + + // Whether the web page is contained in a top-level window. + bool m_isInWindow; + + // Whether the page is visible; if the backing view is visible and inserted into a window. + bool m_isVisible; + + bool m_canGoBack; + bool m_canGoForward; + RefPtr<WebBackForwardList> m_backForwardList; + + String m_toolTip; + + SelectionState m_selectionState; + + // REMOVE: For demo purposes only. + String m_urlAtProcessExit; + + double m_textZoomFactor; + double m_pageZoomFactor; + double m_viewScaleFactor; + + bool m_drawsBackground; + bool m_drawsTransparentBackground; + + bool m_useFixedLayout; + WebCore::IntSize m_fixedLayoutSize; + + // If the process backing the web page is alive and kicking. + bool m_isValid; + + // Whether WebPageProxy::close() has been called on this page. + bool m_isClosed; + + bool m_isInPrintingMode; + + bool m_inDecidePolicyForMIMEType; + bool m_syncMimeTypePolicyActionIsValid; + WebCore::PolicyAction m_syncMimeTypePolicyAction; + uint64_t m_syncMimeTypePolicyDownloadID; + + Deque<NativeWebKeyboardEvent> m_keyEventQueue; + bool m_processingWheelEvent; + OwnPtr<WebWheelEvent> m_nextWheelEvent; + + bool m_processingMouseMoveEvent; + OwnPtr<WebMouseEvent> m_nextMouseMoveEvent; + + uint64_t m_pageID; + +#if PLATFORM(MAC) + bool m_isSmartInsertDeleteEnabled; +#endif + + int64_t m_spellDocumentTag; + bool m_hasSpellDocumentTag; + unsigned m_pendingLearnOrIgnoreWordMessageCount; + + bool m_mainFrameHasCustomRepresentation; + WebCore::DragOperation m_currentDragOperation; +}; + +} // namespace WebKit + +#endif // WebPageProxy_h diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in new file mode 100644 index 0000000..2d576be --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -0,0 +1,192 @@ +# 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. + +messages -> WebPageProxy { + # UI messages. + CreateNewPage(WebCore::WindowFeatures windowFeatures, uint32_t modifiers, int32_t mouseButton) -> (uint64_t newPageID, WebKit::WebPageCreationParameters newPageParameters) + ShowPage() + ClosePage() + RunJavaScriptAlert(uint64_t frameID, WTF::String message) -> () + RunJavaScriptConfirm(uint64_t frameID, WTF::String message) -> (bool result) + RunJavaScriptPrompt(uint64_t frameID, WTF::String message, WTF::String defaultValue) -> (WTF::String result) + MouseDidMoveOverElement(uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData); + MissingPluginButtonClicked(WTF::String mimeType, WTF::String url) + DidChangeViewportData(WebCore::ViewportArguments arguments) + DidReceiveEvent(uint32_t type, bool handled) + DidValidateMenuItem(WTF::String commandName, bool isEnabled, int32_t state) + SetCursor(WebCore::Cursor cursor) + SetStatusText(WTF::String statusText) + SetToolTip(WTF::String toolTip) + TakeFocus(bool direction) + FocusedFrameChanged(uint64_t frameID) + FrameSetLargestFrameChanged(uint64_t frameID) + SetToolbarsAreVisible(bool toolbarsAreVisible) + GetToolbarsAreVisible() -> (bool toolbarsAreVisible) + SetMenuBarIsVisible(bool menuBarIsVisible); + GetMenuBarIsVisible() -> (bool menuBarIsVisible); + SetStatusBarIsVisible(bool statusBarIsVisible) + GetStatusBarIsVisible() -> (bool statusBarIsVisible) + SetIsResizable(bool isResizable) + GetIsResizable() -> (bool isResizable) + SetWindowFrame(WebCore::FloatRect windowFrame) + GetWindowFrame() -> (WebCore::FloatRect windowFrame) + CanRunBeforeUnloadConfirmPanel() -> (bool canRun) + RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose) + PageDidScroll() + RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters) + +#if ENABLE(TILED_BACKING_STORE) + PageDidRequestScroll(WebCore::IntSize delta) +#endif +#if PLATFORM(QT) + DidChangeContentsSize(WebCore::IntSize newSize) + DidFindZoomableArea(WebCore::IntRect area) +#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) + + # Progress messages. + DidChangeProgress(double value) + DidFinishProgress() + DidStartProgress() + + # Frame lifetime messages. + DidCreateMainFrame(uint64_t frameID) + DidCreateSubframe(uint64_t frameID, uint64_t parentFrameID) + DidSaveFrameToPageCache(uint64_t frameID); + DidRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID); + + # Frame load messages. + DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData) + DidFailLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) + DidFailProvisionalLoadForFrame(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) + DidFinishDocumentLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFinishLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) + DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, bool loadingSubstituteDataForUnreachableURL, WebKit::InjectedBundleUserMessageEncoder userData) + DidReceiveTitleForFrame(uint64_t frameID, WTF::String title, WebKit::InjectedBundleUserMessageEncoder userData) + DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidRunInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) + DidSameDocumentNavigationForFrame(uint64_t frameID, uint32_t type, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData) + + FrameDidBecomeFrameSet(uint64_t frameID, bool value) + + # Resource load messages. + DidInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceRequest request) + 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) + DidFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier) + DidFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceError error) + + # Custom representations + DidFinishLoadingDataForCustomRepresentation(CoreIPC::DataReference data) + + # Forms messages. + WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) + + # Callback messages. + DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID) + StringCallback(WTF::String resultString, uint64_t callbackID) + + DidReceiveAccessibilityPageToken(CoreIPC::DataReference data) + +#if PLATFORM(MAC) + # Keyboard support messages. + InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines) +#endif + + # BackForward messages. + BackForwardAddItem(uint64_t itemID) + BackForwardGoToItem(uint64_t itemID) + BackForwardItemAtIndex(int32_t itemIndex) -> (uint64_t itemID) + BackForwardBackListCount() -> (int32_t count) + BackForwardForwardListCount() -> (int32_t count) + BackForwardClear() + + # Undo/Redo messages. + RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction) + ClearAllEditCommands() + + # Selection messages. + SelectionStateChanged(WebKit::SelectionState selectionState) + +#if PLATFORM(WIN) + DidChangeCompositionSelection(bool hasChanged) +#endif + + # Find messages. + DidCountStringMatches(WTF::String string, uint32_t matchCount) + SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut) + DidFindString(WTF::String string, uint32_t matchCount) + DidFailToFindString(WTF::String string) + + # PopupMenu messages. + ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex, WebKit::PlatformPopupMenuData data) + HidePopupMenu() + + # ContextMenu messages. + ShowContextMenu(WebCore::IntPoint menuLocation, WebKit::ContextMenuState state, Vector<WebKit::WebContextMenuItemData> items, WebKit::InjectedBundleUserMessageEncoder userData) + +#if USE(ACCELERATED_COMPOSITING) + # Accelerated compositing messages. + DidChangeAcceleratedCompositing(bool compositing) -> (WebKit::DrawingAreaInfo newDrawingArea) +#endif + + # Authentication messages. + CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate) + DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID) + + # Database messages. + ExceededDatabaseQuota(uint64_t frameID, WTF::String originIdentifier, WTF::String databaseName, WTF::String databaseDisplayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage) -> (uint64_t newQuota) + + # Geolocation messages. + RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, WTF::String originIdentifier) + + # Plug-in complex text input support messages. +#if PLATFORM(MAC) + SetComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) +#endif + + # Speech messages. +#if PLATFORM(MAC) + GetIsSpeaking() -> (bool isSpeaking) + Speak(WTF::String string) + StopSpeaking() +#endif + + # Spelling and grammar. + CheckTextOfParagraph(WTF::String text, uint64_t checkingTypes) -> (Vector<WebCore::TextCheckingResult> results) + UpdateSpellingUIWithMisspelledWord(WTF::String misspelledWord) + GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses) + LearnWord(WTF::String word); + IgnoreWord(WTF::String word); + + # Drag and drop. + DidPerformDragControllerAction(uint64_t resultOperation) +} diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.cpp b/Source/WebKit2/UIProcess/WebPolicyClient.cpp new file mode 100644 index 0000000..e7a8239 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPolicyClient.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPolicyClient.h" + +#include "WKAPICast.h" +#include <wtf/text/WTFString.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) +{ + 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); + return true; +} + +bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, NavigationType type, WebEvent::Modifiers modifiers, WebMouseEvent::Button mouseButton, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener) +{ + 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); + return true; +} + +bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, const String& MIMEType, const String& url, WebFrameProxy* frame, WebFramePolicyListenerProxy* listener) +{ + if (!m_client.decidePolicyForMIMEType) + return false; + + m_client.decidePolicyForMIMEType(toAPI(page), toAPI(MIMEType.impl()), toURLRef(url.impl()), toAPI(frame), toAPI(listener), m_client.clientInfo); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.h b/Source/WebKit2/UIProcess/WebPolicyClient.h new file mode 100644 index 0000000..797bc37 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPolicyClient.h @@ -0,0 +1,50 @@ +/* + * 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 WebPolicyClient_h +#define WebPolicyClient_h + +#include "APIClient.h" +#include "WKPage.h" +#include "WebEvent.h" +#include <WebCore/FrameLoaderTypes.h> +#include <wtf/Forward.h> + +namespace WebKit { + +class WebPageProxy; +class WebFrameProxy; +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*); +}; + +} // namespace WebKit + +#endif // WebPolicyClient_h diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h new file mode 100644 index 0000000..fd84928 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h @@ -0,0 +1,73 @@ +/* + * 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 WebPopupMenuProxy_h +#define WebPopupMenuProxy_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +namespace WebCore { + class IntRect; +} + +namespace WebKit { + +struct PlatformPopupMenuData; +struct WebPopupItem; + +class WebPopupMenuProxy : public RefCounted<WebPopupMenuProxy> { +public: + class Client { + protected: + virtual ~Client() + { + } + + public: + virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) = 0; + virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) = 0; + }; + + virtual ~WebPopupMenuProxy() + { + } + + virtual void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0; + virtual void hidePopupMenu() = 0; + +protected: + WebPopupMenuProxy(Client* client) + : m_client(client) + { + } + + Client* m_client; +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxy_h diff --git a/Source/WebKit2/UIProcess/WebPreferences.cpp b/Source/WebKit2/UIProcess/WebPreferences.cpp new file mode 100644 index 0000000..e33ebb2 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPreferences.cpp @@ -0,0 +1,105 @@ +/* + * 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 + * 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 "WebPreferences.h" + +#include "WebPageGroup.h" + +namespace WebKit { + +WebPreferences::WebPreferences() +{ + platformInitializeStore(); +} + +WebPreferences::WebPreferences(const String& identifier) + : m_identifier(identifier) +{ + platformInitializeStore(); +} + +WebPreferences::~WebPreferences() +{ +} + +void WebPreferences::addPageGroup(WebPageGroup* pageGroup) +{ + m_pageGroups.add(pageGroup); +} + +void WebPreferences::removePageGroup(WebPageGroup* pageGroup) +{ + m_pageGroups.remove(pageGroup); +} + +void WebPreferences::update() +{ + for (HashSet<WebPageGroup*>::iterator it = m_pageGroups.begin(), end = m_pageGroups.end(); it != end; ++it) + (*it)->preferencesDidChange(); +} + +void WebPreferences::updateStringValueForKey(const String& key, const String& value) +{ + platformUpdateStringValueForKey(key, value); + update(); // FIXME: Only send over the changed key and value. +} + +void WebPreferences::updateBoolValueForKey(const String& key, bool value) +{ + platformUpdateBoolValueForKey(key, value); + update(); // FIXME: Only send over the changed key and value. +} + +void WebPreferences::updateUInt32ValueForKey(const String& key, uint32_t value) +{ + platformUpdateUInt32ValueForKey(key, value); + update(); // FIXME: Only send over the changed key and value. +} + +void WebPreferences::updateDoubleValueForKey(const String& key, double value) +{ + platformUpdateDoubleValueForKey(key, value); + update(); // FIXME: Only send over the changed key and value. +} + +#define DEFINE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \ + void WebPreferences::set##KeyUpper(const Type& value) \ + { \ + if (!m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value)) \ + return; \ + update##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value); \ + \ + } \ + \ + Type WebPreferences::KeyLower() const \ + { \ + return m_store.get##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key()); \ + } \ + +FOR_EACH_WEBKIT_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS) + +#undef DEFINE_PREFERENCE_GETTER_AND_SETTERS + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPreferences.h b/Source/WebKit2/UIProcess/WebPreferences.h new file mode 100644 index 0000000..0f4943a --- /dev/null +++ b/Source/WebKit2/UIProcess/WebPreferences.h @@ -0,0 +1,98 @@ +/* + * 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 + * 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 WebPreferences_h +#define WebPreferences_h + +#include "APIObject.h" +#include "FontSmoothingLevel.h" +#include "WebPreferencesStore.h" +#include <wtf/HashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +#define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \ + void set##KeyUpper(const Type& value); \ + Type KeyLower() const; + +namespace WebKit { + +class WebPageGroup; + +class WebPreferences : public APIObject { +public: + static const Type APIType = TypePreferences; + + static PassRefPtr<WebPreferences> create() + { + return adoptRef(new WebPreferences); + } + static PassRefPtr<WebPreferences> create(const String& identifier) + { + return adoptRef(new WebPreferences(identifier)); + } + + virtual ~WebPreferences(); + + void addPageGroup(WebPageGroup*); + void removePageGroup(WebPageGroup*); + + const WebPreferencesStore& store() const { return m_store; } + +#define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \ + void set##KeyUpper(const Type& value); \ + Type KeyLower() const; \ + + FOR_EACH_WEBKIT_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS) + +#undef DECLARE_PREFERENCE_GETTER_AND_SETTERS + +private: + WebPreferences(); + WebPreferences(const String& identifier); + + void platformInitializeStore(); + + virtual Type type() const { return APIType; } + + void update(); + + void updateStringValueForKey(const String& key, const String& value); + void updateBoolValueForKey(const String& key, bool value); + void updateUInt32ValueForKey(const String& key, uint32_t value); + void updateDoubleValueForKey(const String& key, double value); + void platformUpdateStringValueForKey(const String& key, const String& value); + void platformUpdateBoolValueForKey(const String& key, bool value); + void platformUpdateUInt32ValueForKey(const String& key, uint32_t value); + void platformUpdateDoubleValueForKey(const String& key, double value); + + HashSet<WebPageGroup*> m_pageGroups; + WebPreferencesStore m_store; + String m_identifier; +}; + +} // namespace WebKit + +#endif // WebPreferences_h diff --git a/Source/WebKit2/UIProcess/WebProcessManager.cpp b/Source/WebKit2/UIProcess/WebProcessManager.cpp new file mode 100644 index 0000000..94556f8 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebProcessManager.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcessManager.h" + +#include "WebContext.h" + +namespace WebKit { + +WebProcessManager& WebProcessManager::shared() +{ + static WebProcessManager& manager = *new WebProcessManager; + return manager; +} + +WebProcessManager::WebProcessManager() +{ +} + +WebProcessProxy* WebProcessManager::getWebProcess(WebContext* context) +{ + switch (context->processModel()) { + case ProcessModelSharedSecondaryProcess: { + if (!m_sharedProcess) + m_sharedProcess = WebProcessProxy::create(context); + return m_sharedProcess.get(); + } + case ProcessModelSharedSecondaryThread: { + if (!m_sharedThread) + m_sharedThread = WebProcessProxy::create(context); + return m_sharedThread.get(); + } + case ProcessModelSecondaryProcess: { + std::pair<ProcessMap::iterator, bool> result = m_processMap.add(context, 0); + if (result.second) { + ASSERT(!result.first->second); + result.first->second = WebProcessProxy::create(context); + } + + ASSERT(result.first->second); + return result.first->second.get(); + } + } + + ASSERT_NOT_REACHED(); + return 0; +} + +void WebProcessManager::processDidClose(WebProcessProxy* process, WebContext* context) +{ + if (process == m_sharedProcess) { + ASSERT(context->processModel() == ProcessModelSharedSecondaryProcess); + m_sharedProcess = 0; + return; + } + + ProcessMap::iterator it = m_processMap.find(context); + if (it != m_processMap.end()) { + ASSERT(it->second == process); + m_processMap.remove(it); + return; + } + + // The shared thread connection should never be closed. + ASSERT_NOT_REACHED(); +} + +void WebProcessManager::contextWasDestroyed(WebContext* context) +{ + m_processMap.remove(context); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebProcessManager.h b/Source/WebKit2/UIProcess/WebProcessManager.h new file mode 100644 index 0000000..320829e --- /dev/null +++ b/Source/WebKit2/UIProcess/WebProcessManager.h @@ -0,0 +1,56 @@ +/* + * 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 WebProcessManager_h +#define WebProcessManager_h + +#include "WebProcessProxy.h" +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class WebProcessManager { +public: + static WebProcessManager& shared(); + + WebProcessProxy* getWebProcess(WebContext*); + void processDidClose(WebProcessProxy*, WebContext*); + + void contextWasDestroyed(WebContext*); + +private: + WebProcessManager(); + + RefPtr<WebProcessProxy> m_sharedThread; + RefPtr<WebProcessProxy> m_sharedProcess; + + typedef HashMap<WebContext*, RefPtr<WebProcessProxy> > ProcessMap; + ProcessMap m_processMap; +}; + +} // namespace WebKit + +#endif // WebProcessManager_h diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp new file mode 100644 index 0000000..c7e9382 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -0,0 +1,415 @@ +/* + * 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 + * 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 "WebProcessProxy.h" + +#include "DataReference.h" +#include "PluginInfoStore.h" +#include "PluginProcessManager.h" +#include "TextChecker.h" +#include "TextCheckerState.h" +#include "WebBackForwardListItem.h" +#include "WebContext.h" +#include "WebNavigationDataStore.h" +#include "WebPageProxy.h" +#include "WebProcessManager.h" +#include "WebProcessMessages.h" +#include "WebProcessProxyMessages.h" +#include "WebProcessProxyMessageKinds.h" +#include <WebCore/KURL.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +template<typename HashMap> +static inline bool isGoodKey(const typename HashMap::KeyType& key) +{ + return key != HashTraits<typename HashMap::KeyType>::emptyValue() && !HashTraits<typename HashMap::KeyType>::isDeletedValue(key); +} + +static uint64_t generatePageID() +{ + static uint64_t uniquePageID = 1; + return uniquePageID++; +} + +PassRefPtr<WebProcessProxy> WebProcessProxy::create(WebContext* context) +{ + return adoptRef(new WebProcessProxy(context)); +} + +WebProcessProxy::WebProcessProxy(WebContext* context) + : m_responsivenessTimer(this) + , m_context(context) +{ + connect(); +} + +WebProcessProxy::~WebProcessProxy() +{ + if (m_connection) + m_connection->invalidate(); + + for (size_t i = 0; i < m_pendingMessages.size(); ++i) + m_pendingMessages[i].releaseArguments(); + + if (m_processLauncher) { + m_processLauncher->invalidate(); + m_processLauncher = 0; + } + + if (m_threadLauncher) { + m_threadLauncher->invalidate(); + m_threadLauncher = 0; + } +} + +void WebProcessProxy::connect() +{ + if (m_context->processModel() == ProcessModelSharedSecondaryThread) { + ASSERT(!m_threadLauncher); + m_threadLauncher = ThreadLauncher::create(this); + } else { + ASSERT(!m_processLauncher); + + 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; +#endif + m_processLauncher = ProcessLauncher::create(this, launchOptions); + } +} + +bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments) +{ + // 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)); + return true; + } + + // If the web process has exited, m_connection will be null here. + if (!m_connection) + return false; + + return m_connection->sendMessage(messageID, arguments); +} + +bool WebProcessProxy::isLaunching() const +{ + if (m_processLauncher) + return m_processLauncher->isLaunching(); + if (m_threadLauncher) + return m_threadLauncher->isLaunching(); + + return false; +} + +void WebProcessProxy::terminate() +{ + if (m_processLauncher) + m_processLauncher->terminateProcess(); +} + +WebPageProxy* WebProcessProxy::webPage(uint64_t pageID) const +{ + return m_pageMap.get(pageID).get(); +} + +WebPageProxy* WebProcessProxy::createWebPage(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup) +{ + ASSERT(context->process() == this); + + unsigned pageID = generatePageID(); + RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, context, pageGroup, pageID); + m_pageMap.set(pageID, webPage); + return webPage.get(); +} + +void WebProcessProxy::addExistingWebPage(WebPageProxy* webPage, uint64_t pageID) +{ + m_pageMap.set(pageID, webPage); +} + +void WebProcessProxy::removeWebPage(uint64_t pageID) +{ + m_pageMap.remove(pageID); +} + +WebProcessProxy::pages_const_iterator WebProcessProxy::pages_begin() +{ + return m_pageMap.begin().values(); +} + +WebProcessProxy::pages_const_iterator WebProcessProxy::pages_end() +{ + return m_pageMap.end().values(); +} + +size_t WebProcessProxy::numberOfPages() +{ + return m_pageMap.size(); +} + +WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const +{ + return m_backForwardListItemMap.get(itemID).get(); +} + +void WebProcessProxy::registerNewWebBackForwardListItem(WebBackForwardListItem* item) +{ + // This item was just created by the UIProcess and is being added to the map for the first time + // so we should not already have an item for this ID. + ASSERT(!m_backForwardListItemMap.contains(item->itemID())); + + m_backForwardListItemMap.set(item->itemID(), item); +} + +void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& originalURL, const String& url, const String& title, const CoreIPC::DataReference& backForwardData) +{ + std::pair<WebBackForwardListItemMap::iterator, bool> result = m_backForwardListItemMap.add(itemID, 0); + if (result.second) { + // New item. + result.first->second = WebBackForwardListItem::create(originalURL, url, title, backForwardData.data(), backForwardData.size(), itemID); + return; + } + + // Update existing item. + result.first->second->setOriginalURL(originalURL); + result.first->second->setURL(url); + result.first->second->setTitle(title); + result.first->second->setBackForwardData(backForwardData.data(), backForwardData.size()); +} + +#if ENABLE(PLUGIN_PROCESS) +void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, CoreIPC::ArgumentEncoder* reply) +{ + PluginProcessManager::shared().getPluginProcessConnection(pluginPath, this, reply); +} +#endif + +void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (messageID.is<CoreIPC::MessageClassWebProcessProxy>()) { + didReceiveWebProcessProxyMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebContext>() + || messageID.is<CoreIPC::MessageClassWebContextLegacy>() + || messageID.is<CoreIPC::MessageClassDownloadProxy>() + || messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>() + || messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()) { + m_context->didReceiveMessage(connection, messageID, arguments); + return; + } + + uint64_t pageID = arguments->destinationID(); + if (!pageID) + return; + + WebPageProxy* pageProxy = webPage(pageID); + if (!pageProxy) + return; + + pageProxy->didReceiveMessage(connection, messageID, arguments); +} + +CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ +#if ENABLE(PLUGIN_PROCESS) + if (messageID.is<CoreIPC::MessageClassWebProcessProxyLegacy>()) { + switch (messageID.get<WebProcessProxyLegacyMessage::Kind>()) { + case WebProcessProxyLegacyMessage::GetPluginProcessConnection: { + String pluginPath; + + if (!arguments->decode(CoreIPC::Out(pluginPath))) + return CoreIPC::AutomaticReply; + + getPluginProcessConnection(pluginPath, reply); + return CoreIPC::ManualReply; + } + } + } +#endif + + if (messageID.is<CoreIPC::MessageClassWebContext>() || messageID.is<CoreIPC::MessageClassWebContextLegacy>() || messageID.is<CoreIPC::MessageClassDownloadProxy>()) + return m_context->didReceiveSyncMessage(connection, messageID, arguments, reply); + + uint64_t pageID = arguments->destinationID(); + if (!pageID) + return CoreIPC::AutomaticReply; + + WebPageProxy* pageProxy = webPage(pageID); + if (!pageProxy) + return CoreIPC::AutomaticReply; + + pageProxy->didReceiveSyncMessage(connection, messageID, arguments, reply); + return CoreIPC::AutomaticReply; +} + +void WebProcessProxy::didClose(CoreIPC::Connection*) +{ + // Protect ourselves, as the call to the shared WebProcessManager's processDidClose() + // below may otherwise cause us to be deleted before we can finish our work. + RefPtr<WebProcessProxy> protect(this); + + m_connection = nullptr; + m_responsivenessTimer.stop(); + + Vector<RefPtr<WebFrameProxy> > frames; + copyValuesToVector(m_frameMap, frames); + + for (size_t i = 0, size = frames.size(); i < size; ++i) + frames[i]->disconnect(); + m_frameMap.clear(); + + Vector<RefPtr<WebPageProxy> > pages; + copyValuesToVector(m_pageMap, pages); + + m_context->processDidClose(this); + + WebProcessManager::shared().processDidClose(this, m_context); + + for (size_t i = 0, size = pages.size(); i < size; ++i) + pages[i]->processDidCrash(); +} + +void WebProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID) +{ + // We received an invalid message from the web process, invalidate our connection and kill it. + m_connection->invalidate(); + + terminate(); +} + +void WebProcessProxy::didBecomeUnresponsive(ResponsivenessTimer*) +{ + Vector<RefPtr<WebPageProxy> > pages; + copyValuesToVector(m_pageMap, pages); + for (size_t i = 0, size = pages.size(); i < size; ++i) + pages[i]->processDidBecomeUnresponsive(); +} + +void WebProcessProxy::didBecomeResponsive(ResponsivenessTimer*) +{ + Vector<RefPtr<WebPageProxy> > pages; + copyValuesToVector(m_pageMap, pages); + for (size_t i = 0, size = pages.size(); i < size; ++i) + pages[i]->processDidBecomeResponsive(); +} + +void WebProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) +{ + didFinishLaunching(connectionIdentifier); +} + +void WebProcessProxy::didFinishLaunching(ThreadLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) +{ + didFinishLaunching(connectionIdentifier); +} + +void WebProcessProxy::didFinishLaunching(CoreIPC::Connection::Identifier connectionIdentifier) +{ + ASSERT(!m_connection); + + m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); +#if PLATFORM(MAC) + m_connection->setShouldCloseConnectionOnMachExceptions(); +#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())); + } + + m_pendingMessages.clear(); + + // Tell the context that we finished launching. + m_context->processDidFinishLaunching(this); +} + +WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const +{ + return isGoodKey<WebFrameProxyMap>(frameID) ? m_frameMap.get(frameID).get() : 0; +} + +bool WebProcessProxy::canCreateFrame(uint64_t frameID) const +{ + return isGoodKey<WebFrameProxyMap>(frameID) && !m_frameMap.contains(frameID); +} + +void WebProcessProxy::frameCreated(uint64_t frameID, WebFrameProxy* frameProxy) +{ + ASSERT(canCreateFrame(frameID)); + m_frameMap.set(frameID, frameProxy); +} + +void WebProcessProxy::didDestroyFrame(uint64_t frameID) +{ + // If the page is closed before it has had the chance to send the DidCreateMainFrame message + // back to the UIProcess, then the frameDestroyed message will still be received because it + // gets sent directly to the WebProcessProxy. + ASSERT(isGoodKey<WebFrameProxyMap>(frameID)); + m_frameMap.remove(frameID); +} + +void WebProcessProxy::disconnectFramesFromPage(WebPageProxy* page) +{ + Vector<RefPtr<WebFrameProxy> > frames; + copyValuesToVector(m_frameMap, frames); + for (size_t i = 0, size = frames.size(); i < size; ++i) { + if (frames[i]->page() == page) + frames[i]->disconnect(); + } +} + +size_t WebProcessProxy::frameCountInPage(WebPageProxy* page) const +{ + size_t result = 0; + for (HashMap<uint64_t, RefPtr<WebFrameProxy> >::const_iterator iter = m_frameMap.begin(); iter != m_frameMap.end(); ++iter) { + if (iter->second->page() == page) + ++result; + } + return result; +} + +void WebProcessProxy::updateTextCheckerState() +{ + if (!isValid()) + return; + + send(Messages::WebProcess::SetTextCheckerState(TextChecker::state()), 0); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h new file mode 100644 index 0000000..531d7fe --- /dev/null +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -0,0 +1,183 @@ +/* + * 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 + * 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 WebProcessProxy_h +#define WebProcessProxy_h + +#include "Connection.h" +#include "PlatformProcessIdentifier.h" +#include "PluginInfoStore.h" +#include "ProcessLauncher.h" +#include "ProcessModel.h" +#include "ResponsivenessTimer.h" +#include "ThreadLauncher.h" +#include "WebPageProxy.h" +#include <WebCore/LinkHash.h> +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + class KURL; +}; + +namespace WebKit { + +class WebBackForwardListItem; +class WebContext; +class WebPageGroup; +struct WebNavigationDataStore; + +class WebProcessProxy : public RefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, ThreadLauncher::Client { +public: + typedef HashMap<uint64_t, RefPtr<WebPageProxy> > WebPageProxyMap; + typedef WebPageProxyMap::const_iterator::Values pages_const_iterator; + typedef HashMap<uint64_t, RefPtr<WebFrameProxy> > WebFrameProxyMap; + typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap; + + static PassRefPtr<WebProcessProxy> create(WebContext*); + ~WebProcessProxy(); + + 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 U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = 1); + + CoreIPC::Connection* connection() const + { + ASSERT(m_connection); + + return m_connection.get(); + } + + WebContext* context() const { return m_context; } + + PlatformProcessIdentifier processIdentifier() const { return m_processLauncher->processIdentifier(); } + + WebPageProxy* webPage(uint64_t pageID) const; + WebPageProxy* createWebPage(PageClient*, WebContext*, WebPageGroup*); + void addExistingWebPage(WebPageProxy*, uint64_t pageID); + void removeWebPage(uint64_t pageID); + + pages_const_iterator pages_begin(); + pages_const_iterator pages_end(); + size_t numberOfPages(); + + WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const; + + ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; } + + bool isValid() const { return m_connection; } + bool isLaunching() const; + bool canSendMessage() const { return isValid() || isLaunching(); } + + WebFrameProxy* webFrame(uint64_t) const; + bool canCreateFrame(uint64_t frameID) const; + void frameCreated(uint64_t, WebFrameProxy*); + void didDestroyFrame(uint64_t); + void disconnectFramesFromPage(WebPageProxy*); // Including main frame. + size_t frameCountInPage(WebPageProxy*) const; // Including main frame. + + void updateTextCheckerState(); + + void registerNewWebBackForwardListItem(WebBackForwardListItem*); + +private: + explicit WebProcessProxy(WebContext*); + + void connect(); + + bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>); + + void addBackForwardItem(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title, const CoreIPC::DataReference& backForwardData); + +#if ENABLE(PLUGIN_PROCESS) + void getPluginProcessConnection(const String& pluginPath, CoreIPC::ArgumentEncoder* reply); +#endif + + // CoreIPC::Connection::Client + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + void didClose(CoreIPC::Connection*); + void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + // ResponsivenessTimer::Client + void didBecomeUnresponsive(ResponsivenessTimer*); + void didBecomeResponsive(ResponsivenessTimer*); + + // ProcessLauncher::Client + virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); + + // ThreadLauncher::Client + virtual void didFinishLaunching(ThreadLauncher*, CoreIPC::Connection::Identifier); + + void didFinishLaunching(CoreIPC::Connection::Identifier); + + // Implemented in generated WebProcessProxyMessageReceiver.cpp + void didReceiveWebProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + ResponsivenessTimer m_responsivenessTimer; + RefPtr<CoreIPC::Connection> m_connection; + + Vector<CoreIPC::Connection::OutgoingMessage> m_pendingMessages; + RefPtr<ProcessLauncher> m_processLauncher; + RefPtr<ThreadLauncher> m_threadLauncher; + + WebContext* m_context; + + WebPageProxyMap m_pageMap; + WebFrameProxyMap m_frameMap; + WebBackForwardListItemMap m_backForwardListItemMap; +}; + +template<typename E, typename T> +bool WebProcessProxy::send(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()); +} + +template<typename T> +bool WebProcessProxy::send(const T& message, uint64_t destinationID) +{ + OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder = CoreIPC::ArgumentEncoder::create(destinationID); + argumentEncoder->encode(message); + + return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release()); +} + +template<typename U> +bool WebProcessProxy::sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout) +{ + return m_connection->sendSync(message, reply, destinationID, timeout); +} + +} // namespace WebKit + +#endif // WebProcessProxy_h diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in new file mode 100644 index 0000000..86bc9e2 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -0,0 +1,28 @@ +# 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 +# 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. + +messages -> WebProcessProxy { + + AddBackForwardItem(uint64_t itemID, WTF::String originalURL, WTF::String url, WTF::String title, CoreIPC::DataReference backForwardData) + DidDestroyFrame(uint64_t frameID) + +} diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp new file mode 100644 index 0000000..675890f --- /dev/null +++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebResourceLoadClient.h" + +#include "WKAPICast.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" + +using namespace WebCore; + +namespace WebKit { + +void WebResourceLoadClient::didInitiateLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest) +{ + 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); +} + +void WebResourceLoadClient::didSendRequestForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceRequest& resourceRequest, const ResourceResponse& redirectResourceResponse) +{ + if (!m_client.didSendRequestForResource) + return; + + RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest); + RefPtr<WebURLResponse> response; + if (!redirectResourceResponse.isNull()) + response = WebURLResponse::create(redirectResourceResponse); + return m_client.didSendRequestForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(request.get()), toAPI(response.get()), m_client.clientInfo); +} + +void WebResourceLoadClient::didReceiveResponseForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceResponse& resourceResponse) +{ + if (!m_client.didReceiveResponseForResource) + return; + + RefPtr<WebURLResponse> response = WebURLResponse::create(resourceResponse); + return m_client.didReceiveResponseForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(response.get()), m_client.clientInfo); +} + +void WebResourceLoadClient::didReceiveContentLengthForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, uint64_t contentLength) +{ + if (!m_client.didReceiveContentLengthForResource) + return; + + return m_client.didReceiveContentLengthForResource(toAPI(page), toAPI(frame), resourceIdentifier, contentLength, m_client.clientInfo); +} + +void WebResourceLoadClient::didFinishLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier) +{ + if (!m_client.didFinishLoadForResource) + return; + + return m_client.didFinishLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, m_client.clientInfo); +} + +void WebResourceLoadClient::didFailLoadForResource(WebPageProxy* page, WebFrameProxy* frame, uint64_t resourceIdentifier, const ResourceError& error) +{ + if (!m_client.didFailLoadForResource) + return; + + return m_client.didFailLoadForResource(toAPI(page), toAPI(frame), resourceIdentifier, toAPI(error), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebResourceLoadClient.h b/Source/WebKit2/UIProcess/WebResourceLoadClient.h new file mode 100644 index 0000000..e2e322f --- /dev/null +++ b/Source/WebKit2/UIProcess/WebResourceLoadClient.h @@ -0,0 +1,56 @@ +/* + * 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 WebResourceLoadClient_h +#define WebResourceLoadClient_h + +#include "APIClient.h" +#include "WKPage.h" + +namespace WebCore { +class ResourceError; +class ResourceRequest; +class ResourceResponse; +} + +namespace WebKit { + +class APIObject; +class WebFrameProxy; +class WebPageProxy; + +class WebResourceLoadClient : public APIClient<WKPageResourceLoadClient> { +public: + void didInitiateLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceRequest&); + 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); + void didFinishLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier); + void didFailLoadForResource(WebPageProxy*, WebFrameProxy*, uint64_t resourceIdentifier, const WebCore::ResourceError&); +}; + +} // namespace WebKit + +#endif // WebResourceLoadClient_h diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp new file mode 100644 index 0000000..e95af34 --- /dev/null +++ b/Source/WebKit2/UIProcess/WebUIClient.cpp @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebUIClient.h" + +#include "ImmutableDictionary.h" +#include "NativeWebKeyboardEvent.h" +#include "WKAPICast.h" +#include "WebNumber.h" +#include "WebOpenPanelResultListenerProxy.h" +#include "WebPageProxy.h" +#include <WebCore/FloatRect.h> +#include <WebCore/IntSize.h> +#include <WebCore/WindowFeatures.h> +#include <string.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebPageProxy> WebUIClient::createNewPage(WebPageProxy* page, const WindowFeatures& windowFeatures, WebEvent::Modifiers modifiers, WebMouseEvent::Button button) +{ + if (!m_client.createNewPage) + return 0; + + ImmutableDictionary::MapType map; + if (windowFeatures.xSet) + map.set("x", WebDouble::create(windowFeatures.x)); + if (windowFeatures.ySet) + map.set("y", WebDouble::create(windowFeatures.y)); + if (windowFeatures.widthSet) + map.set("width", WebDouble::create(windowFeatures.width)); + if (windowFeatures.heightSet) + map.set("height", WebDouble::create(windowFeatures.height)); + map.set("menuBarVisible", WebBoolean::create(windowFeatures.menuBarVisible)); + map.set("statusBarVisible", WebBoolean::create(windowFeatures.statusBarVisible)); + map.set("toolBarVisible", WebBoolean::create(windowFeatures.toolBarVisible)); + map.set("scrollbarsVisible", WebBoolean::create(windowFeatures.scrollbarsVisible)); + map.set("resizable", WebBoolean::create(windowFeatures.resizable)); + map.set("fullscreen", WebBoolean::create(windowFeatures.fullscreen)); + map.set("dialog", WebBoolean::create(windowFeatures.dialog)); + RefPtr<ImmutableDictionary> featuresMap = ImmutableDictionary::adopt(map); + + return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(featuresMap.get()), toAPI(modifiers), toAPI(button), m_client.clientInfo))); +} + +void WebUIClient::showPage(WebPageProxy* page) +{ + if (!m_client.showPage) + return; + + m_client.showPage(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::close(WebPageProxy* page) +{ + if (!m_client.close) + return; + + m_client.close(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame) +{ + if (!m_client.runJavaScriptAlert) + return; + + m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo); +} + +bool WebUIClient::runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame) +{ + if (!m_client.runJavaScriptConfirm) + return false; + + return m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo); +} + +String WebUIClient::runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame) +{ + if (!m_client.runJavaScriptPrompt) + return String(); + + WebString* string = toImpl(m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.clientInfo)); + if (!string) + return String(); + + String result = string->string(); + string->deref(); + + return result; +} + +void WebUIClient::setStatusText(WebPageProxy* page, const String& text) +{ + if (!m_client.setStatusText) + return; + + m_client.setStatusText(toAPI(page), toAPI(text.impl()), m_client.clientInfo); +} + +void WebUIClient::mouseDidMoveOverElement(WebPageProxy* page, WebEvent::Modifiers modifiers, APIObject* userData) +{ + if (!m_client.mouseDidMoveOverElement) + return; + + m_client.mouseDidMoveOverElement(toAPI(page), toAPI(modifiers), toAPI(userData), m_client.clientInfo); +} + +void WebUIClient::missingPluginButtonClicked(WebPageProxy* page, const String& mimeType, const String& url) +{ + if (!m_client.missingPluginButtonClicked) + return; + + m_client.missingPluginButtonClicked(toAPI(page), toAPI(mimeType.impl()), toAPI(url.impl()), m_client.clientInfo); +} + +void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event) +{ + if (!m_client.didNotHandleKeyEvent) + return; + m_client.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_client.clientInfo); +} + +bool WebUIClient::toolbarsAreVisible(WebPageProxy* page) +{ + if (!m_client.toolbarsAreVisible) + return true; + return m_client.toolbarsAreVisible(toAPI(page), m_client.clientInfo); + +} +void WebUIClient::setToolbarsAreVisible(WebPageProxy* page, bool visible) +{ + if (!m_client.setToolbarsAreVisible) + return; + m_client.setToolbarsAreVisible(toAPI(page), visible, m_client.clientInfo); +} + +bool WebUIClient::menuBarIsVisible(WebPageProxy* page) +{ + if (!m_client.menuBarIsVisible) + return true; + return m_client.menuBarIsVisible(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::setMenuBarIsVisible(WebPageProxy* page, bool visible) +{ + if (!m_client.setMenuBarIsVisible) + return; + m_client.setMenuBarIsVisible(toAPI(page), visible, m_client.clientInfo); +} + +bool WebUIClient::statusBarIsVisible(WebPageProxy* page) +{ + if (!m_client.statusBarIsVisible) + return true; + return m_client.statusBarIsVisible(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::setStatusBarIsVisible(WebPageProxy* page, bool visible) +{ + if (!m_client.setStatusBarIsVisible) + return; + m_client.setStatusBarIsVisible(toAPI(page), visible, m_client.clientInfo); +} + +bool WebUIClient::isResizable(WebPageProxy* page) +{ + if (!m_client.isResizable) + return true; + return m_client.isResizable(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::setIsResizable(WebPageProxy* page, bool resizable) +{ + if (!m_client.setIsResizable) + return; + m_client.setIsResizable(toAPI(page), resizable, m_client.clientInfo); +} + +void WebUIClient::setWindowFrame(WebPageProxy* page, const FloatRect& frame) +{ + if (!m_client.setWindowFrame) + return; + + m_client.setWindowFrame(toAPI(page), toAPI(frame), m_client.clientInfo); +} + +FloatRect WebUIClient::windowFrame(WebPageProxy* page) +{ + if (!m_client.getWindowFrame) + return FloatRect(); + + return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.clientInfo)); +} + +bool WebUIClient::canRunBeforeUnloadConfirmPanel() +{ + return m_client.runBeforeUnloadConfirmPanel; +} + +bool WebUIClient::runBeforeUnloadConfirmPanel(WebPageProxy* page, const String& message, WebFrameProxy* frame) +{ + if (!m_client.runBeforeUnloadConfirmPanel) + return true; + + return m_client.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo); +} + +void WebUIClient::didDraw(WebPageProxy* page) +{ + if (!m_client.didDraw) + return; + + m_client.didDraw(toAPI(page), m_client.clientInfo); +} + +void WebUIClient::pageDidScroll(WebPageProxy* page) +{ + if (!m_client.pageDidScroll) + return; + + m_client.pageDidScroll(toAPI(page), m_client.clientInfo); +} + +unsigned long long WebUIClient::exceededDatabaseQuota(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage) +{ + if (!m_client.exceededDatabaseQuota) + return currentQuota; + + return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentUsage, expectedUsage, m_client.clientInfo); +} + +bool WebUIClient::runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, const WebOpenPanelParameters::Data& parameterData, WebOpenPanelResultListenerProxy* listener) +{ + if (!m_client.runOpenPanel) + return false; + + RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(parameterData); + m_client.runOpenPanel(toAPI(page), toAPI(frame), toAPI(parameters.get()), toAPI(listener), m_client.clientInfo); + return true; +} + +bool WebUIClient::decidePolicyForGeolocationPermissionRequest(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, GeolocationPermissionRequestProxy* permissionRequest) +{ + if (!m_client.decidePolicyForGeolocationPermissionRequest) + return false; + + m_client.decidePolicyForGeolocationPermissionRequest(toAPI(page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.clientInfo); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h new file mode 100644 index 0000000..a25b37f --- /dev/null +++ b/Source/WebKit2/UIProcess/WebUIClient.h @@ -0,0 +1,93 @@ +/* + * 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 WebUIClient_h +#define WebUIClient_h + +#include "APIClient.h" +#include "WKPage.h" +#include "WebEvent.h" +#include "WebOpenPanelParameters.h" +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + class FloatRect; + class IntSize; + struct WindowFeatures; +} + +namespace WebKit { + +class APIObject; +class GeolocationPermissionRequestProxy; +class NativeWebKeyboardEvent; +class WebFrameProxy; +class WebPageProxy; +class WebSecurityOrigin; +class WebOpenPanelResultListenerProxy; + +class WebUIClient : public APIClient<WKPageUIClient> { +public: + PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button); + void showPage(WebPageProxy*); + void close(WebPageProxy*); + + void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*); + bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*); + String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*); + + void setStatusText(WebPageProxy*, const String&); + void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*); + void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url); + void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&); + + bool toolbarsAreVisible(WebPageProxy*); + void setToolbarsAreVisible(WebPageProxy*, bool); + bool menuBarIsVisible(WebPageProxy*); + void setMenuBarIsVisible(WebPageProxy*, bool); + bool statusBarIsVisible(WebPageProxy*); + void setStatusBarIsVisible(WebPageProxy*, bool); + bool isResizable(WebPageProxy*); + void setIsResizable(WebPageProxy*, bool); + + void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&); + WebCore::FloatRect windowFrame(WebPageProxy*); + + bool canRunBeforeUnloadConfirmPanel(); + bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*); + + void didDraw(WebPageProxy*); + void pageDidScroll(WebPageProxy*); + + unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage); + + bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*); + bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*); +}; + +} // namespace WebKit + +#endif // WebUIClient_h diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp new file mode 100644 index 0000000..3f03980 --- /dev/null +++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp @@ -0,0 +1,144 @@ +/* + * 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 + * 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 "WebBackForwardList.h" +#include "Logging.h" +#include <wtf/RetainPtr.h> +#include <CoreFoundation/CoreFoundation.h> + +using namespace WebCore; + +namespace WebKit { + +static uint64_t generateWebBackForwardItemID() +{ + // These IDs exist in the UIProcess for items created by the UIProcess. + // The IDs generated here need to never collide with the IDs created in WebBackForwardListProxy in the WebProcess. + // We accomplish this by starting from 2, and only ever using even ids. + static uint64_t uniqueHistoryItemID = 0; + uniqueHistoryItemID += 2; + return uniqueHistoryItemID; +} + +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryCurrentIndexKey, (CFSTR("SessionHistoryCurrentIndex"))); +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntriesKey, (CFSTR("SessionHistoryEntries"))); +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryTitleKey, (CFSTR("SessionHistoryEntryTitle"))); +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryURLKey, (CFSTR("SessionHistoryEntryURL"))); +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryOriginalURLKey, (CFSTR("SessionHistoryEntryOriginalURL"))); +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHistoryEntryData"))); + +CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const +{ + RetainPtr<CFNumberRef> currentIndex(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &m_current)); + RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks)); + + const void* keys[2] = { SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() }; + const void* values[2] = { currentIndex.get(), entries.get() }; + + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + + 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)) + continue; + + RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString()); + RetainPtr<CFStringRef> title(AdoptCF, m_entries[i]->title().createCFString()); + RetainPtr<CFStringRef> originalURL(AdoptCF, m_entries[i]->originalURL().createCFString()); + RetainPtr<CFDataRef> entryData(AdoptCF, CFDataCreate(kCFAllocatorDefault, m_entries[i]->backForwardData().data(), m_entries[i]->backForwardData().size())); + + const void* keys[4] = { SessionHistoryEntryURLKey(), SessionHistoryEntryTitleKey(), SessionHistoryEntryOriginalURLKey(), SessionHistoryEntryDataKey() }; + const void* values[4] = { url.get(), title.get(), originalURL.get(), entryData.get() }; + + RetainPtr<CFDictionaryRef> entryDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + CFArrayAppendValue(entries.get(), entryDictionary.get()); + } + + return dictionary.leakRef(); +} + +bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef dictionary) +{ + CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey()); + if (!cfIndex || CFGetTypeID(cfIndex) != CFNumberGetTypeID()) { + LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index"); + return false; + } + + CFIndex currentIndex; + if (!CFNumberGetValue(cfIndex, kCFNumberCFIndexType, ¤tIndex)) { + LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid integer current index"); + return false; + } + + CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, SessionHistoryEntriesKey()); + if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) { + LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries"); + return false; + } + + CFIndex size = CFArrayGetCount(cfEntries); + BackForwardListItemVector newEntries; + newEntries.reserveCapacity(size); + for (CFIndex i = 0; i < size; ++i) { + CFDictionaryRef entryDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(cfEntries, i); + if (!entryDictionary || CFGetTypeID(entryDictionary) != CFDictionaryGetTypeID()) { + LOG(SessionState, "WebBackForwardList entry array does not have a valid entry at index %i", (int)i); + return false; + } + + CFStringRef entryURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryURLKey()); + if (!entryURL || CFGetTypeID(entryURL) != CFStringGetTypeID()) { + LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid URL", (int)i); + return false; + } + + CFStringRef entryTitle = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryTitleKey()); + if (!entryTitle || CFGetTypeID(entryTitle) != CFStringGetTypeID()) { + LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid title", (int)i); + return false; + } + + CFStringRef originalURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryOriginalURLKey()); + if (!originalURL || CFGetTypeID(originalURL) != CFStringGetTypeID()) { + LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid original URL", (int)i); + return false; + } + + CFDataRef backForwardData = (CFDataRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryDataKey()); + if (!backForwardData || CFGetTypeID(backForwardData) != CFDataGetTypeID()) { + LOG(SessionState, "WebBackForwardList entry at index %i does not have back/forward data", (int)i); + return false; + } + + newEntries.append(WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID())); + } + + m_current = currentIndex; + m_entries = newEntries; + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp new file mode 100644 index 0000000..c1b7971 --- /dev/null +++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp @@ -0,0 +1,138 @@ +/* + * 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 + * 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 "WebPageProxy.h" + +#include "DataReference.h" +#include "Logging.h" +#include "SessionState.h" +#include "WebBackForwardList.h" +#include "WebData.h" +#include "WebPageMessages.h" +#include "WebProcessProxy.h" + +#include <wtf/RetainPtr.h> +#include <CoreFoundation/CFPropertyList.h> + +using namespace WebCore; + +namespace WebKit { + +DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryKey, (CFSTR("SessionHistory"))); + +static const UInt32 CurrentSessionStateDataVersion = 2; + +PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback filter, void* context) const +{ + RetainPtr<CFDictionaryRef> sessionHistoryDictionary(AdoptCF, m_backForwardList->createCFDictionaryRepresentation(filter, context)); + + // For now we're only serializing the back/forward list. If that object is null, then the entire sessionState can be null. + if (!sessionHistoryDictionary) + return 0; + + const void* keys[1] = { SessionHistoryKey() }; + const void* values[1] = { sessionHistoryDictionary.get() }; + + RetainPtr<CFDictionaryRef> stateDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + + RetainPtr<CFWriteStreamRef> writeStream(AdoptCF, CFWriteStreamCreateWithAllocatedBuffers(0, 0)); + if (!writeStream) + return 0; + + if (!CFWriteStreamOpen(writeStream.get())) + return 0; + + if (!CFPropertyListWriteToStream(stateDictionary.get(), writeStream.get(), kCFPropertyListBinaryFormat_v1_0, 0)) + return 0; + + RetainPtr<CFDataRef> stateCFData(AdoptCF, (CFDataRef)CFWriteStreamCopyProperty(writeStream.get(), kCFStreamPropertyDataWritten)); + + CFIndex length = CFDataGetLength(stateCFData.get()); + Vector<unsigned char> stateVector(length + sizeof(UInt32)); + + // Put the session state version number at the start of the buffer + stateVector.data()[0] = (CurrentSessionStateDataVersion & 0xFF000000) >> 24; + stateVector.data()[1] = (CurrentSessionStateDataVersion & 0x00FF0000) >> 16; + stateVector.data()[2] = (CurrentSessionStateDataVersion & 0x0000FF00) >> 8; + stateVector.data()[3] = (CurrentSessionStateDataVersion & 0x000000FF); + + // Copy in the actual session state data + CFDataGetBytes(stateCFData.get(), CFRangeMake(0, length), stateVector.data() + sizeof(UInt32)); + + return WebData::create(stateVector); +} + +void WebPageProxy::restoreFromSessionStateData(WebData* webData) +{ + if (!webData || webData->size() < sizeof(UInt32)) + return; + + const unsigned char* buffer = webData->bytes(); + UInt32 versionHeader = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]; + + if (versionHeader != CurrentSessionStateDataVersion) { + LOG(SessionState, "Unrecognized version header for session state data - cannot restore"); + return; + } + + RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(0, webData->bytes() + sizeof(UInt32), webData->size() - sizeof(UInt32))); + + CFStringRef propertyListError = 0; + RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateFromXMLData(0, data.get(), kCFPropertyListImmutable, &propertyListError)); + if (propertyListError) { + CFRelease(propertyListError); + LOG(SessionState, "Could not read session state property list"); + return; + } + + if (!propertyList) + return; + + if (CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID()) { + LOG(SessionState, "SessionState property list is not a CFDictionaryRef (%i) - its CFTypeID is %i", (int)CFDictionaryGetTypeID(), (int)CFGetTypeID(propertyList.get())); + return; + } + + CFTypeRef sessionHistoryRef = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), SessionHistoryKey()); + if (!sessionHistoryRef || CFGetTypeID(sessionHistoryRef) != CFDictionaryGetTypeID()) { + LOG(SessionState, "SessionState dictionary does not contain a SessionHistoryDictionary key, it is of the wrong type"); + return; + } + + CFDictionaryRef sessionHistoryDictionary = static_cast<CFDictionaryRef>(sessionHistoryRef); + if (!m_backForwardList->restoreFromCFDictionaryRepresentation(sessionHistoryDictionary)) { + LOG(SessionState, "Failed to restore back/forward list from SessionHistoryDictionary"); + return; + } + + const BackForwardListItemVector& entries = m_backForwardList->entries(); + size_t size = entries.size(); + 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); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp new file mode 100644 index 0000000..7b89d04 --- /dev/null +++ b/Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPreferences.h" + +#if !PLATFORM(MAC) + +namespace WebKit { + +void WebPreferences::platformInitializeStore() +{ +} + +void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) +{ +} + +void WebPreferences::platformUpdateBoolValueForKey(const String&, bool) +{ +} + +void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t) +{ +} + +void WebPreferences::platformUpdateDoubleValueForKey(const String&, double) +{ +} + +} // namespace WebKit + +#endif // !PLATFORM(MAC) diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp new file mode 100644 index 0000000..3d7ba2d --- /dev/null +++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "TextChecker.h" + +#include "NotImplemented.h" +#include "TextCheckerState.h" + +using namespace WebCore; + +namespace WebKit { + +static TextCheckerState textCheckerState; + +const TextCheckerState& TextChecker::state() +{ + notImplemented(); + return textCheckerState; +} + +bool TextChecker::isContinuousSpellCheckingAllowed() +{ + notImplemented(); + return false; +} + +void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) +{ + notImplemented(); +} + +void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) +{ + notImplemented(); +} + +int64_t TextChecker::uniqueSpellDocumentTag() +{ + notImplemented(); + return 0; +} + +void TextChecker::closeSpellDocumentWithTag(int64_t) +{ + notImplemented(); +} + +Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +{ + notImplemented(); + return Vector<WebCore::TextCheckingResult>(); +} + +void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + notImplemented(); +} + +void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) +{ + notImplemented(); +} + +void TextChecker::learnWord(const String& word) +{ + notImplemented(); +} + +void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp new file mode 100644 index 0000000..86ae636 --- /dev/null +++ b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +namespace WebKit { + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + notImplemented(); + return 0; +} + +void WebInspectorProxy::platformOpen() +{ + notImplemented(); +} + +void WebInspectorProxy::platformClose() +{ + notImplemented(); +} + +String WebInspectorProxy::inspectorPageURL() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp new file mode 100644 index 0000000..71befa4 --- /dev/null +++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageProxy.h" + +namespace WebKit { + +String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) +{ + // FIXME: This should not be hard coded. + return "Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/534.7 (KHTML, like Gecko) Version/5.0 Safari/534.7"; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp new file mode 100644 index 0000000..3da7323 --- /dev/null +++ b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPreferences.h" + +#include "NotImplemented.h" + +namespace WebKit { + +void WebPreferences::platformInitializeStore() +{ + notImplemented(); +} + +void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) +{ + notImplemented(); +} + +void WebPreferences::platformUpdateBoolValueForKey(const String&, bool) +{ + notImplemented(); +} + +void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t) +{ + notImplemented(); +} + +void WebPreferences::platformUpdateDoubleValueForKey(const String&, double) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm new file mode 100644 index 0000000..979f755 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/BackingStoreMac.mm @@ -0,0 +1,93 @@ +/* + * 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 "BackingStore.h" + +#include "CGUtilities.h" +#include "ShareableBitmap.h" +#include "UpdateInfo.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +void BackingStore::paint(PlatformGraphicsContext context, const IntRect& rect) +{ + ASSERT(m_bitmapContext); + + paintBitmapContext(context, m_bitmapContext.get(), rect.location(), rect); +} + +void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo) +{ + ASSERT(m_size == updateInfo.viewSize); + + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle); + if (!bitmap) + return; + + if (!m_bitmapContext) { + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + + m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + + // We want the origin to be in the top left corner so flip the backing store context. + CGContextTranslateCTM(m_bitmapContext.get(), 0, m_size.height()); + CGContextScaleCTM(m_bitmapContext.get(), 1, -1); + } + + scroll(updateInfo.scrollRect, updateInfo.scrollDelta); + + IntPoint updateRectLocation = updateInfo.updateRectBounds.location(); + + GraphicsContext graphicsContext(m_bitmapContext.get()); + + // 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& scrollDelta) +{ + if (scrollDelta.isZero()) + return; + + CGContextSaveGState(m_bitmapContext.get()); + + CGContextClipToRect(m_bitmapContext.get(), scrollRect); + + CGPoint destination = CGPointMake(scrollRect.x() + scrollDelta.width(), scrollRect.y() + scrollDelta.height()); + paintBitmapContext(m_bitmapContext.get(), m_bitmapContext.get(), destination, scrollRect); + + CGContextRestoreGState(m_bitmapContext.get()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm new file mode 100644 index 0000000..909745b --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "WKView.h" +#include "WebPageProxy.h" + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* ChunkedUpdateDrawingAreaProxy::page() +{ + return toImpl([m_webView pageRef]); +} + +void ChunkedUpdateDrawingAreaProxy::ensureBackingStore() +{ + if (m_bitmapContext) + return; + + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + const IntSize& viewSize = size(); + m_bitmapContext.adoptCF(CGBitmapContextCreate(0, viewSize.width(), viewSize.height(), 8, viewSize.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + + // Flip the bitmap context coordinate system. + CGContextTranslateCTM(m_bitmapContext.get(), 0, viewSize.height()); + CGContextScaleCTM(m_bitmapContext.get(), 1, -1); +} + +void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore() +{ + m_bitmapContext = 0; +} + +bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, CGContextRef context) +{ + if (!m_bitmapContext) + return false; + + CGContextSaveGState(context); + + // Use the copy blend mode when drawing a background. + if (page()->drawsBackground()) + CGContextSetBlendMode(context, kCGBlendModeCopy); + + // Flip the destination. + CGContextScaleCTM(context, 1, -1); + CGContextTranslateCTM(context, 0, -m_size.height()); + + RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(m_bitmapContext.get())); + CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())), image.get()); + + CGContextRestoreGState(context); + return true; +} + +void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) +{ + ensureBackingStore(); + + RetainPtr<CGImageRef> image(updateChunk->createImage()); + IntRect updateChunkRect = updateChunk->rect(); + + CGContextSaveGState(m_bitmapContext.get()); + + // Use the copy blend mode to replace existing content. + CGContextSetBlendMode(m_bitmapContext.get(), kCGBlendModeCopy); + + // Flip the destination. + CGContextScaleCTM(m_bitmapContext.get(), 1, -1); + CGContextTranslateCTM(m_bitmapContext.get(), 0, -(updateChunkRect.y() + updateChunkRect.bottom())); + + CGContextDrawImage(m_bitmapContext.get(), updateChunkRect, image.get()); + + CGContextRestoreGState(m_bitmapContext.get()); + + [m_webView setNeedsDisplayInRect:NSRectFromCGRect(updateChunkRect)]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm new file mode 100644 index 0000000..846eb25 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "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" + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* LayerBackedDrawingAreaProxy::page() +{ + return toImpl([m_webView pageRef]); +} + +void LayerBackedDrawingAreaProxy::platformSetSize() +{ + [m_compositingRootLayer.get() setBounds:CGRectMake(0, 0, size().width(), size().height())]; +} + +void LayerBackedDrawingAreaProxy::attachCompositingContext(uint32_t contextID) +{ +#if HAVE(HOSTED_CORE_ANIMATION) + m_compositingRootLayer = WKMakeRenderLayer(contextID); + + // Turn off default animations. + NSNull *nullValue = [NSNull null]; + NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: + nullValue, @"anchorPoint", + nullValue, @"bounds", + nullValue, @"contents", + nullValue, @"contentsRect", + nullValue, @"opacity", + nullValue, @"position", + nullValue, @"sublayerTransform", + nullValue, @"sublayers", + nullValue, @"transform", + nil]; + [m_compositingRootLayer.get() setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]]; + + [m_compositingRootLayer.get() setAnchorPoint:CGPointZero]; + [m_compositingRootLayer.get() setBounds:CGRectMake(0, 0, size().width(), size().height())]; + + // FIXME: this fixes the layer jiggle when resizing the window, but breaks layer flipping because + // CA doesn't propagate the kCALayerFlagFlippedAbove through the remote layer. + // [m_compositingRootLayer.get() setGeometryFlipped:YES]; + +#ifndef NDEBUG + [m_compositingRootLayer.get() setName:@"Compositing root layer"]; +#endif + + [m_webView _startAcceleratedCompositing:m_compositingRootLayer.get()]; +#endif +} + +void LayerBackedDrawingAreaProxy::detachCompositingContext() +{ + [m_webView _stopAcceleratedCompositing]; + m_compositingRootLayer = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm new file mode 100644 index 0000000..c89011e --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm @@ -0,0 +1,328 @@ +/* + * 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 + * 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 "TextChecker.h" + +#include "TextCheckerState.h" +#include <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"; + +using namespace WebCore; + +namespace WebKit { + +TextCheckerState textCheckerState; + +static void initializeState() +{ + static bool didInitializeState; + if (didInitializeState) + return; + + textCheckerState.isContinuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled] && TextChecker::isContinuousSpellCheckingAllowed(); + textCheckerState.isGrammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled]; + textCheckerState.isAutomaticSpellingCorrectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticSpellingCorrectionEnabled]; + textCheckerState.isAutomaticQuoteSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticQuoteSubstitutionEnabled]; + textCheckerState.isAutomaticDashSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticDashSubstitutionEnabled]; + textCheckerState.isAutomaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled]; + textCheckerState.isAutomaticTextReplacementEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticTextReplacementEnabled]; + +#if !defined(BUILDING_ON_SNOW_LEOPARD) + if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) + textCheckerState.isAutomaticSpellingCorrectionEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled]; +#endif + + didInitializeState = true; +} + +const TextCheckerState& TextChecker::state() +{ + initializeState(); + return textCheckerState; +} + +bool TextChecker::isContinuousSpellCheckingAllowed() +{ + static bool allowContinuousSpellChecking = true; + static bool readAllowContinuousSpellCheckingDefault = false; + + if (!readAllowContinuousSpellCheckingDefault) { + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"NSAllowContinuousSpellChecking"]) + allowContinuousSpellChecking = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSAllowContinuousSpellChecking"]; + + readAllowContinuousSpellCheckingDefault = true; + } + + return allowContinuousSpellChecking; +} + +void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) +{ + if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled) + return; + + textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled]; + + // FIXME: preflight the spell checker. +} + +void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) +{ + if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled) + return; + + textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled]; + [[NSSpellChecker sharedSpellChecker] updatePanels]; + + // We call preflightSpellChecker() when turning continuous spell checking on, but we don't need to do that here + // because grammar checking only occurs on code paths that already preflight spell checking appropriately. +} + +void TextChecker::setAutomaticSpellingCorrectionEnabled(bool isAutomaticSpellingCorrectionEnabled) +{ + if (state().isAutomaticSpellingCorrectionEnabled == isAutomaticSpellingCorrectionEnabled) + return; + + textCheckerState.isAutomaticSpellingCorrectionEnabled = isAutomaticSpellingCorrectionEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled]; + + [[NSSpellChecker sharedSpellChecker] updatePanels]; +} + +void TextChecker::setAutomaticQuoteSubstitutionEnabled(bool isAutomaticQuoteSubstitutionEnabled) +{ + if (state().isAutomaticQuoteSubstitutionEnabled == isAutomaticQuoteSubstitutionEnabled) + return; + + textCheckerState.isAutomaticQuoteSubstitutionEnabled = isAutomaticQuoteSubstitutionEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled]; + + [[NSSpellChecker sharedSpellChecker] updatePanels]; +} + +void TextChecker::setAutomaticDashSubstitutionEnabled(bool isAutomaticDashSubstitutionEnabled) +{ + if (state().isAutomaticDashSubstitutionEnabled == isAutomaticDashSubstitutionEnabled) + return; + + textCheckerState.isAutomaticDashSubstitutionEnabled = isAutomaticDashSubstitutionEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled]; + + [[NSSpellChecker sharedSpellChecker] updatePanels]; +} + +void TextChecker::setAutomaticLinkDetectionEnabled(bool isAutomaticLinkDetectionEnabled) +{ + if (state().isAutomaticLinkDetectionEnabled == isAutomaticLinkDetectionEnabled) + return; + + textCheckerState.isAutomaticLinkDetectionEnabled = isAutomaticLinkDetectionEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled]; + + [[NSSpellChecker sharedSpellChecker] updatePanels]; +} + +void TextChecker::setAutomaticTextReplacementEnabled(bool isAutomaticTextReplacementEnabled) +{ + if (state().isAutomaticTextReplacementEnabled == isAutomaticTextReplacementEnabled) + return; + + textCheckerState.isAutomaticTextReplacementEnabled = isAutomaticTextReplacementEnabled; + [[NSUserDefaults standardUserDefaults] setBool:isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled]; + + [[NSSpellChecker sharedSpellChecker] updatePanels]; +} + +static bool smartInsertDeleteEnabled; + +bool TextChecker::isSmartInsertDeleteEnabled() +{ + static bool readSmartInsertDeleteEnabledDefault; + + if (!readSmartInsertDeleteEnabledDefault) { + smartInsertDeleteEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled]; + + readSmartInsertDeleteEnabledDefault = true; + } + + return smartInsertDeleteEnabled; +} + +void TextChecker::setSmartInsertDeleteEnabled(bool flag) +{ + if (flag == isSmartInsertDeleteEnabled()) + return; + + smartInsertDeleteEnabled = flag; + + [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebSmartInsertDeleteEnabled]; +} + +int64_t TextChecker::uniqueSpellDocumentTag() +{ + return [NSSpellChecker uniqueSpellDocumentTag]; +} + +void TextChecker::closeSpellDocumentWithTag(int64_t tag) +{ + [[NSSpellChecker sharedSpellChecker] closeSpellDocumentWithTag:tag]; +} + +Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +{ + Vector<TextCheckingResult> results; + + RetainPtr<NSString> textString(AdoptNS, [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]); + NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString .get() + range:NSMakeRange(0, length) + types:checkingTypes | NSTextCheckingTypeOrthography + options:nil + inSpellDocumentWithTag:spellDocumentTag + orthography:NULL + wordCount:NULL]; + for (NSTextCheckingResult *incomingResult in incomingResults) { + NSRange resultRange = [incomingResult range]; + NSTextCheckingType resultType = [incomingResult resultType]; + ASSERT(resultRange.location != NSNotFound); + ASSERT(resultRange.length > 0); + if (resultType == NSTextCheckingTypeSpelling && (checkingTypes & NSTextCheckingTypeSpelling)) { + TextCheckingResult result; + result.type = TextCheckingTypeSpelling; + result.location = resultRange.location; + result.length = resultRange.length; + results.append(result); + } else if (resultType == NSTextCheckingTypeGrammar && (checkingTypes & NSTextCheckingTypeGrammar)) { + TextCheckingResult result; + NSArray *details = [incomingResult grammarDetails]; + result.type = TextCheckingTypeGrammar; + result.location = resultRange.location; + result.length = resultRange.length; + for (NSDictionary *incomingDetail in details) { + ASSERT(incomingDetail); + GrammarDetail detail; + NSValue *detailRangeAsNSValue = [incomingDetail objectForKey:NSGrammarRange]; + ASSERT(detailRangeAsNSValue); + NSRange detailNSRange = [detailRangeAsNSValue rangeValue]; + ASSERT(detailNSRange.location != NSNotFound); + ASSERT(detailNSRange.length > 0); + detail.location = detailNSRange.location; + detail.length = detailNSRange.length; + detail.userDescription = [incomingDetail objectForKey:NSGrammarUserDescription]; + NSArray *guesses = [incomingDetail objectForKey:NSGrammarCorrections]; + for (NSString *guess in guesses) + detail.guesses.append(String(guess)); + result.details.append(detail); + } + results.append(result); + } else if (resultType == NSTextCheckingTypeLink && (checkingTypes & NSTextCheckingTypeLink)) { + TextCheckingResult result; + result.type = TextCheckingTypeLink; + result.location = resultRange.location; + result.length = resultRange.length; + result.replacement = [[incomingResult URL] absoluteString]; + results.append(result); + } else if (resultType == NSTextCheckingTypeQuote && (checkingTypes & NSTextCheckingTypeQuote)) { + TextCheckingResult result; + result.type = TextCheckingTypeQuote; + result.location = resultRange.location; + result.length = resultRange.length; + result.replacement = [incomingResult replacementString]; + results.append(result); + } else if (resultType == NSTextCheckingTypeDash && (checkingTypes & NSTextCheckingTypeDash)) { + TextCheckingResult result; + result.type = TextCheckingTypeDash; + result.location = resultRange.location; + result.length = resultRange.length; + result.replacement = [incomingResult replacementString]; + results.append(result); + } else if (resultType == NSTextCheckingTypeReplacement && (checkingTypes & NSTextCheckingTypeReplacement)) { + TextCheckingResult result; + result.type = TextCheckingTypeReplacement; + result.location = resultRange.location; + result.length = resultRange.length; + result.replacement = [incomingResult replacementString]; + results.append(result); + } else if (resultType == NSTextCheckingTypeCorrection && (checkingTypes & NSTextCheckingTypeCorrection)) { + TextCheckingResult result; + result.type = TextCheckingTypeCorrection; + result.location = resultRange.location; + result.length = resultRange.length; + result.replacement = [incomingResult replacementString]; + results.append(result); + } + } + + return results; +} + +void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + [[NSSpellChecker sharedSpellChecker] updateSpellingPanelWithMisspelledWord:misspelledWord]; +} + +void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) +{ +#if !defined(BUILDING_ON_SNOW_LEOPARD) + NSString* language = nil; + NSOrthography* orthography = nil; + NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; + if (context.length()) { + [checker checkString:context range:NSMakeRange(0, context.length()) types:NSTextCheckingTypeOrthography options:0 inSpellDocumentWithTag:spellDocumentTag orthography:&orthography wordCount:0]; + language = [checker languageForWordRange:NSMakeRange(0, context.length()) inString:context orthography:orthography]; + } + NSArray* stringsArray = [checker guessesForWordRange:NSMakeRange(0, word.length()) inString:word language:language inSpellDocumentWithTag:spellDocumentTag]; +#else + NSArray* stringsArray = [[NSSpellChecker sharedSpellChecker] guessesForWord:word]; +#endif + + for (NSString *guess in stringsArray) + guesses.append(guess); +} + +void TextChecker::learnWord(const String& word) +{ + [[NSSpellChecker sharedSpellChecker] learnWord:word]; +} + +void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) +{ + [[NSSpellChecker sharedSpellChecker] ignoreWord:word inSpellDocumentWithTag:spellDocumentTag]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm new file mode 100644 index 0000000..ce4c3e6 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContext.h" + +#include "WebKitSystemInterface.h" +#include "WebProcessCreationParameters.h" +#include <WebCore/FileSystem.h> +#include <sys/param.h> + +using namespace WebCore; + +NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache"; + +namespace WebKit { + +String WebContext::applicationCacheDirectory() +{ + NSString *appName = [[NSBundle mainBundle] bundleIdentifier]; + if (!appName) + appName = [[NSProcessInfo processInfo] processName]; + + ASSERT(appName); + + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString *cacheDir = [defaults objectForKey:WebKitLocalCacheDefaultsKey]; + + if (!cacheDir || ![cacheDir isKindOfClass:[NSString class]]) { +#ifdef BUILDING_ON_TIGER + cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; +#else + char cacheDirectory[MAXPATHLEN]; + size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN); + + if (cacheDirectoryLen) + cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1]; +#endif + } + + return [cacheDir stringByAppendingPathComponent:appName]; +} + + +void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters) +{ + // We want to use a PDF view in the UI process for PDF MIME types. + HashSet<String, CaseFoldingHash> mimeType = pdfAndPostScriptMIMETypes(); + parameters.mimeTypesWithCustomRepresentation.appendRange(mimeType.begin(), mimeType.end()); + + RetainPtr<CFStringRef> cachePath(AdoptCF, WKCopyFoundationCacheDirectory()); + if (!cachePath) + cachePath = reinterpret_cast<CFStringRef>(NSHomeDirectory()); + + NSURLCache *urlCache = [NSURLCache sharedURLCache]; + + parameters.nsURLCachePath = fileSystemRepresentation([(NSString *)cachePath.get() stringByStandardizingPath]); + parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity]; + parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity]; + +#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION) + mach_port_t renderServerPort = WKInitializeRenderServer(); + if (renderServerPort != MACH_PORT_NULL) + parameters.acceleratedCompositingPort = CoreIPC::MachPort(renderServerPort, MACH_MSG_TYPE_COPY_SEND); +#endif + + // FIXME: This should really be configurable; we shouldn't just blindly allow read access to the UI process bundle. + parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]); +} + +} // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h new file mode 100644 index 0000000..ee4fa3d --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h @@ -0,0 +1,69 @@ +/* + * 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 WebContextMenuProxyMac_h +#define WebContextMenuProxyMac_h + +#include "WebContextMenuProxy.h" +#include <wtf/RetainPtr.h> + +#ifdef __OBJC__ +@class NSPopUpButtonCell; +@class WKView; +#else +class NSPopUpButtonCell; +class WKView; +#endif + +namespace WebKit { + +class WebPageProxy; + +class WebContextMenuProxyMac : public WebContextMenuProxy { +public: + static PassRefPtr<WebContextMenuProxyMac> create(WKView* webView, WebPageProxy* page) + { + return adoptRef(new WebContextMenuProxyMac(webView, page)); + } + ~WebContextMenuProxyMac(); + + virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&); + virtual void hideContextMenu(); + + void contextMenuItemSelected(const WebContextMenuItemData&); + +private: + WebContextMenuProxyMac(WKView*, WebPageProxy*); + + void populate(const Vector<WebContextMenuItemData>&); + + RetainPtr<NSPopUpButtonCell> m_popup; + WKView* m_webView; + WebPageProxy* m_page; +}; + +} // namespace WebKit + +#endif // WebContextMenuProxyMac_h diff --git a/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm new file mode 100644 index 0000000..d76b997 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuProxyMac.h" + +#include "PageClientImpl.h" +#include "WebContextMenuItemData.h" +#include "WKView.h" + +#include <WebCore/IntRect.h> +#include <WebKitSystemInterface.h> + +using namespace WebCore; + +@interface WebUserDataWrapper : NSObject { + RefPtr<WebKit::APIObject> _webUserData; +} +- (id)initWithUserData:(WebKit::APIObject*)userData; +- (WebKit::APIObject*)userData; +@end + +@implementation WebUserDataWrapper + +- (id)initWithUserData:(WebKit::APIObject*)userData +{ + self = [super init]; + if (!self) + return nil; + + _webUserData = userData; + return self; +} + +- (WebKit::APIObject*)userData +{ + return _webUserData.get(); +} + +@end + +@interface WKMenuTarget : NSObject { + WebKit::WebContextMenuProxyMac* _menuProxy; +} ++ (WKMenuTarget*)sharedMenuTarget; +- (WebKit::WebContextMenuProxyMac*)menuProxy; +- (void)setMenuProxy:(WebKit::WebContextMenuProxyMac*)menuProxy; +- (void)forwardContextMenuAction:(id)sender; +@end + +@implementation WKMenuTarget + ++ (WKMenuTarget*)sharedMenuTarget +{ + static WKMenuTarget* target = [[WKMenuTarget alloc] init]; + return target; +} + +- (WebKit::WebContextMenuProxyMac*)menuProxy +{ + return _menuProxy; +} + +- (void)setMenuProxy:(WebKit::WebContextMenuProxyMac*)menuProxy +{ + _menuProxy = menuProxy; +} + +- (void)forwardContextMenuAction:(id)sender +{ + WebKit::WebContextMenuItemData item(ActionType, static_cast<ContextMenuAction>([sender tag]), [sender title], [sender isEnabled], [sender state] == NSOnState); + + if (id representedObject = [sender representedObject]) { + ASSERT([representedObject isKindOfClass:[WebUserDataWrapper class]]); + item.setUserData([static_cast<WebUserDataWrapper *>(representedObject) userData]); + } + + _menuProxy->contextMenuItemSelected(item); +} + +@end + +namespace WebKit { + +WebContextMenuProxyMac::WebContextMenuProxyMac(WKView* webView, WebPageProxy* page) + : m_webView(webView) + , m_page(page) +{ +} + +WebContextMenuProxyMac::~WebContextMenuProxyMac() +{ + if (m_popup) + [m_popup.get() setControlView:nil]; +} + +void WebContextMenuProxyMac::contextMenuItemSelected(const WebContextMenuItemData& item) +{ + m_page->contextMenuItemSelected(item); +} + +static void populateNSMenu(NSMenu* menu, const Vector<RetainPtr<NSMenuItem> >& menuItemVector) +{ + for (unsigned i = 0; i < menuItemVector.size(); ++i) { + NSInteger oldState = [menuItemVector[i].get() state]; + [menu addItem:menuItemVector[i].get()]; + [menuItemVector[i].get() setState:oldState]; + } +} + +static Vector<RetainPtr<NSMenuItem> > nsMenuItemVector(const Vector<WebContextMenuItemData>& items) +{ + Vector<RetainPtr<NSMenuItem> > result; + + unsigned size = items.size(); + result.reserveCapacity(size); + for (unsigned i = 0; i < size; i++) { + switch (items[i].type()) { + case ActionType: + case CheckableActionType: { + NSMenuItem* menuItem = [[NSMenuItem alloc] initWithTitle:nsStringFromWebCoreString(items[i].title()) action:@selector(forwardContextMenuAction:) keyEquivalent:@""]; + [menuItem setTag:items[i].action()]; + [menuItem setEnabled:items[i].enabled()]; + [menuItem setState:items[i].checked() ? NSOnState : NSOffState]; + + if (items[i].userData()) { + WebUserDataWrapper *wrapper = [[WebUserDataWrapper alloc] initWithUserData:items[i].userData()]; + [menuItem setRepresentedObject:wrapper]; + [wrapper release]; + } + + result.append(RetainPtr<NSMenuItem>(AdoptNS, menuItem)); + break; + } + case SeparatorType: + result.append([NSMenuItem separatorItem]); + break; + case SubmenuType: { + NSMenu* menu = [[NSMenu alloc] initWithTitle:nsStringFromWebCoreString(items[i].title())]; + [menu setAutoenablesItems:NO]; + populateNSMenu(menu, nsMenuItemVector(items[i].submenu())); + + NSMenuItem* menuItem = [[NSMenuItem alloc] initWithTitle:nsStringFromWebCoreString(items[i].title()) action:@selector(forwardContextMenuAction:) keyEquivalent:@""]; + [menuItem setEnabled:items[i].enabled()]; + [menuItem setSubmenu:menu]; + [menu release]; + + result.append(RetainPtr<NSMenuItem>(AdoptNS, menuItem)); + + break; + } + default: + ASSERT_NOT_REACHED(); + } + } + + WKMenuTarget* target = [WKMenuTarget sharedMenuTarget]; + for (unsigned i = 0; i < size; ++i) + [result[i].get() setTarget:target]; + + return result; +} + +void WebContextMenuProxyMac::populate(const Vector<WebContextMenuItemData>& items) +{ + if (m_popup) + [m_popup.get() removeAllItems]; + else { + m_popup.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]); + [m_popup.get() setUsesItemFromMenu:NO]; + [m_popup.get() setAutoenablesItems:NO]; + } + + NSMenu* menu = [m_popup.get() menu]; + populateNSMenu(menu, nsMenuItemVector(items)); +} + +void WebContextMenuProxyMac::showContextMenu(const IntPoint& menuLocation, const Vector<WebContextMenuItemData>& items) +{ + populate(items); + [[WKMenuTarget sharedMenuTarget] setMenuProxy:this]; + + NSRect menuRect = NSMakeRect(menuLocation.x(), menuLocation.y(), 0, 0); + + [m_popup.get() attachPopUpWithFrame:menuRect inView:m_webView]; + + NSMenu* menu = [m_popup.get() menu]; + + // These values were borrowed from AppKit to match their placement of the menu. + NSRect titleFrame = [m_popup.get() titleRectForBounds:menuRect]; + if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0) + titleFrame = menuRect; + float vertOffset = roundf((NSMaxY(menuRect) - NSMaxY(titleFrame)) + NSHeight(titleFrame)); + NSPoint location = NSMakePoint(NSMinX(menuRect), NSMaxY(menuRect) - vertOffset); + + RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:menuRect]); + [m_webView addSubview:dummyView.get()]; + location = [dummyView.get() convertPoint:location fromView:m_webView]; + + WKPopupMenu(menu, location, roundf(NSWidth(menuRect)), dummyView.get(), -1, nil); + + [m_popup.get() dismissPopUp]; + [dummyView.get() removeFromSuperview]; +} + +void WebContextMenuProxyMac::hideContextMenu() +{ + [m_popup.get() dismissPopUp]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm new file mode 100644 index 0000000..e129094 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#import "WKAPICast.h" +#import "WKView.h" +#import "WebPageProxy.h" +#import <WebKitSystemInterface.h> +#import <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace WebKit; + +// The height needed to match a typical NSToolbar. +static const CGFloat windowContentBorderThickness = 55; + +// WebInspectorProxyObjCAdapter is a helper ObjC object used as a delegate or notification observer +// for the sole purpose of getting back into the C++ code from an ObjC caller. + +@interface WebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> { + WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles +} + +- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy; + +@end + +@implementation WebInspectorProxyObjCAdapter + +- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy +{ + ASSERT_ARG(inspectorProxy, inspectorProxy); + + if (!(self = [super init])) + return nil; + + _inspectorProxy = inspectorProxy; // Not retained to prevent cycles + + return self; +} + +- (void)windowWillClose:(NSNotification *)notification +{ + _inspectorProxy->close(); +} + +@end + +namespace WebKit { + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + ASSERT(m_page); + ASSERT(!m_inspectorView); + + m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect contextRef:toAPI(page()->context()) pageGroupRef:toAPI(inspectorPageGroup())]); + ASSERT(m_inspectorView); + + return toImpl(m_inspectorView.get().pageRef); +} + +void WebInspectorProxy::platformOpen() +{ + ASSERT(!m_inspectorWindow); + + m_inspectorProxyObjCAdapter.adoptNS([[WebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]); + + // FIXME: support opening in docked mode here. + + NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTexturedBackgroundWindowMask); + NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; + [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; + [window setContentBorderThickness:windowContentBorderThickness forEdge:NSMaxYEdge]; + [window setDelegate:m_inspectorProxyObjCAdapter.get()]; + [window setMinSize:NSMakeSize(minimumWindowWidth, minimumWindowHeight)]; + [window setReleasedWhenClosed:NO]; + + // Center the window initially before setting the frame autosave name so that the window will be in a good + // position if there is no saved frame yet. + [window center]; + [window setFrameAutosaveName:@"Web Inspector 2"]; + + WKNSWindowMakeBottomCornersSquare(window); + + NSView *contentView = [window contentView]; + [m_inspectorView.get() setFrame:[contentView bounds]]; + [m_inspectorView.get() setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [contentView addSubview:m_inspectorView.get()]; + + [window makeKeyAndOrderFront:nil]; + + m_inspectorWindow.adoptNS(window); +} + +void WebInspectorProxy::platformClose() +{ + // FIXME: support closing in docked mode here. + + [m_inspectorWindow.get() setDelegate:nil]; + [m_inspectorWindow.get() orderOut:nil]; + + m_inspectorWindow = 0; + m_inspectorView = 0; + m_inspectorProxyObjCAdapter = 0; +} + +String WebInspectorProxy::inspectorPageURL() const +{ + NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"]; + ASSERT(path); + + return [[NSURL fileURLWithPath:path] absoluteString]; +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm new file mode 100644 index 0000000..36905fb --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageProxy.h" + +#include <WebCore/Language.h> +#include <wtf/text/StringConcatenate.h> + +@interface NSApplication (Details) +- (void)speakString:(NSString *)string; +@end + +using namespace WebCore; + +namespace WebKit { + +#if defined(__ppc__) || defined(__ppc64__) +#define PROCESSOR "PPC" +#elif defined(__i386__) || defined(__x86_64__) +#define PROCESSOR "Intel" +#else +#error Unknown architecture +#endif + +static inline int callGestalt(OSType selector) +{ + SInt32 value = 0; + Gestalt(selector, &value); + return value; +} + +// Uses underscores instead of dots because if "4." ever appears in a user agent string, old DHTML libraries treat it as Netscape 4. +static String macOSXVersionString() +{ + // Can't use -[NSProcessInfo operatingSystemVersionString] because it has too much stuff we don't want. + int major = callGestalt(gestaltSystemVersionMajor); + ASSERT(major); + + int minor = callGestalt(gestaltSystemVersionMinor); + int bugFix = callGestalt(gestaltSystemVersionBugFix); + if (bugFix) + return String::format("%d_%d_%d", major, minor, bugFix); + if (minor) + return String::format("%d_%d", major, minor); + return String::format("%d", major); +} + +static String userVisibleWebKitVersionString() +{ + // If the version is 4 digits long or longer, then the first digit represents + // the version of the OS. Our user agent string should not include this first digit, + // so strip it off and report the rest as the version. <rdar://problem/4997547> + NSString *fullVersion = [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; + NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; + if (nonDigitRange.location == NSNotFound && [fullVersion length] >= 4) + return [fullVersion substringFromIndex:1]; + if (nonDigitRange.location != NSNotFound && nonDigitRange.location >= 4) + return [fullVersion substringFromIndex:1]; + return fullVersion; +} + +String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) +{ + DEFINE_STATIC_LOCAL(String, osVersion, (macOSXVersionString())); + DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); + + // FIXME: We should upate the user agent if the default language changes. + String language = defaultLanguage(); + + if (applicationNameForUserAgent.isEmpty()) + return makeString("Mozilla/5.0 (Macintosh; U; " PROCESSOR " Mac OS X ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); + return makeString("Mozilla/5.0 (Macintosh; U; " PROCESSOR " Mac OS X ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); +} + +void WebPageProxy::getIsSpeaking(bool& isSpeaking) +{ + isSpeaking = [NSApp isSpeaking]; +} + +void WebPageProxy::speak(const String& string) +{ + NSString *convertedString = string; + [NSApp speakString:convertedString]; +} + +void WebPageProxy::stopSpeaking() +{ + [NSApp stopSpeaking:nil]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h new file mode 100644 index 0000000..85339d6 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h @@ -0,0 +1,66 @@ +/* + * 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 WebPopupMenuProxyMac_h +#define WebPopupMenuProxyMac_h + +#include "WebPopupMenuProxy.h" +#include <wtf/RetainPtr.h> + +#ifdef __OBJC__ +@class NSPopUpButtonCell; +@class WKView; +#else +class NSPopUpButtonCell; +class WKView; +#endif + +namespace WebKit { + +class WebPageProxy; + +class WebPopupMenuProxyMac : public WebPopupMenuProxy { +public: + static PassRefPtr<WebPopupMenuProxyMac> create(WKView* webView, WebPopupMenuProxy::Client* client) + { + return adoptRef(new WebPopupMenuProxyMac(webView, client)); + } + ~WebPopupMenuProxyMac(); + + virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void hidePopupMenu(); + +private: + WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client); + + void populate(const Vector<WebPopupItem>&); + + RetainPtr<NSPopUpButtonCell> m_popup; + WKView* m_webView; +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxyMac_h diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm new file mode 100644 index 0000000..481e8c5 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenuProxyMac.h" + +#include "PageClientImpl.h" +#include "PlatformPopupMenuData.h" +#include "WKView.h" +#include "WebPopupItem.h" +#include <WebKitSystemInterface.h> + +using namespace WebCore; + +namespace WebKit { + +WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView* webView, WebPopupMenuProxy::Client* client) + : WebPopupMenuProxy(client) + , m_webView(webView) +{ +} + +WebPopupMenuProxyMac::~WebPopupMenuProxyMac() +{ + if (m_popup) + [m_popup.get() setControlView:nil]; +} + +void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items) +{ + if (m_popup) + [m_popup.get() removeAllItems]; + else { + m_popup.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]); + [m_popup.get() setUsesItemFromMenu:NO]; + [m_popup.get() setAutoenablesItems:NO]; + } + + int size = items.size(); + + for (int i = 0; i < size; i++) { + 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]; + [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) +{ + populate(items); + + [m_popup.get() attachPopUpWithFrame:rect inView:m_webView]; + [m_popup.get() selectItemAtIndex:selectedIndex]; + + NSMenu* menu = [m_popup.get() menu]; + + // These values were borrowed from AppKit to match their placement of the menu. + const int popOverHorizontalAdjust = -10; + NSRect titleFrame = [m_popup.get() titleRectForBounds:rect]; + if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0) + titleFrame = rect; + float vertOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame)); + NSPoint location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - vertOffset); + + RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:rect]); + [m_webView addSubview:dummyView.get()]; + location = [dummyView.get() convertPoint:location fromView:m_webView]; + + WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, [NSFont menuFontOfSize:0]); + + [m_popup.get() dismissPopUp]; + [dummyView.get() removeFromSuperview]; + + m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]); +} + +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 new file mode 100644 index 0000000..b954bd2 --- /dev/null +++ b/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm @@ -0,0 +1,127 @@ +/* + * 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 + * 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 "WebPreferences.h" + +#include "PageClientImpl.h" +#include <wtf/text/StringConcatenate.h> + +namespace WebKit { + +static inline NSString* makeKey(const String& identifier, const String& baseKey) +{ + return nsStringFromWebCoreString(makeString(identifier, ".WebKit2", baseKey)); +} + +static void setStringValueIfInUserDefaults(const String& identifier, const String& key, WebPreferencesStore& store) +{ + id object = [[NSUserDefaults standardUserDefaults] objectForKey:makeKey(identifier, key)]; + if (!object) + return; + if (![object isKindOfClass:[NSString class]]) + return; + + store.setStringValueForKey(key, (NSString *)object); +} + +static void setBoolValueIfInUserDefaults(const String& identifier, const String& key, WebPreferencesStore& store) +{ + id object = [[NSUserDefaults standardUserDefaults] objectForKey:makeKey(identifier, key)]; + if (!object) + return; + if (![object respondsToSelector:@selector(boolValue)]) + return; + + store.setBoolValueForKey(key, [object boolValue]); +} + +static void setUInt32ValueIfInUserDefaults(const String& identifier, const String& key, WebPreferencesStore& store) +{ + id object = [[NSUserDefaults standardUserDefaults] objectForKey:makeKey(identifier, key)]; + if (!object) + return; + if (![object respondsToSelector:@selector(intValue)]) + return; + + store.setUInt32ValueForKey(key, [object intValue]); +} + +static void setDoubleValueIfInUserDefaults(const String& identifier, const String& key, WebPreferencesStore& store) +{ + id object = [[NSUserDefaults standardUserDefaults] objectForKey:makeKey(identifier, key)]; + if (!object) + return; + if (![object respondsToSelector:@selector(doubleValue)]) + return; + + store.setDoubleValueForKey(key, [object doubleValue]); +} + +void WebPreferences::platformInitializeStore() +{ + if (!m_identifier) + return; + +#define INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \ + set##TypeName##ValueIfInUserDefaults(m_identifier, WebPreferencesKey::KeyLower##Key(), m_store); + + FOR_EACH_WEBKIT_PREFERENCE(INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS) + +#undef INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS +} + +void WebPreferences::platformUpdateStringValueForKey(const String& key, const String& value) +{ + if (!m_identifier) + return; + + [[NSUserDefaults standardUserDefaults] setObject:nsStringFromWebCoreString(value) forKey:makeKey(m_identifier, key)]; +} + +void WebPreferences::platformUpdateBoolValueForKey(const String& key, bool value) +{ + if (!m_identifier) + return; + + [[NSUserDefaults standardUserDefaults] setBool:value forKey:makeKey(m_identifier, key)]; +} + +void WebPreferences::platformUpdateUInt32ValueForKey(const String& key, uint32_t value) +{ + if (!m_identifier) + return; + + [[NSUserDefaults standardUserDefaults] setInteger:value forKey:makeKey(m_identifier, key)]; +} + +void WebPreferences::platformUpdateDoubleValueForKey(const String& key, double value) +{ + if (!m_identifier) + return; + + [[NSUserDefaults standardUserDefaults] setDouble:value forKey:makeKey(m_identifier, key)]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp new file mode 100644 index 0000000..06ce7c6 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp @@ -0,0 +1,81 @@ +/* + * 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 "ChunkedUpdateDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "WebPageProxy.h" +#include "qgraphicswkview.h" +#include <QPainter> + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* ChunkedUpdateDrawingAreaProxy::page() +{ + return toImpl(m_webView->page()->pageRef()); +} + +void ChunkedUpdateDrawingAreaProxy::ensureBackingStore() +{ + if (!m_backingStoreImage.isNull()) + return; + + m_backingStoreImage = QImage(size().width(), size().height(), QImage::Format_RGB32); +} + +void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore() +{ + m_backingStoreImage = QImage(); +} + +bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, QPainter* painter) +{ + if (m_backingStoreImage.isNull()) + return false; + + painter->drawImage(QPoint(0, 0), m_backingStoreImage); + return true; +} + +void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) +{ + ensureBackingStore(); + + QImage image(updateChunk->createImage()); + const IntRect& updateChunkRect = updateChunk->rect(); + + QPainter painter(&m_backingStoreImage); + painter.drawImage(updateChunkRect.topLeft(), image); + + m_webView->update(QRect(updateChunkRect)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp new file mode 100644 index 0000000..9ab6297 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "TextChecker.h" + +#include "NotImplemented.h" +#include "TextCheckerState.h" + +using namespace WebCore; + +namespace WebKit { + +static TextCheckerState textCheckerState; + +const TextCheckerState& TextChecker::state() +{ + notImplemented(); + + return textCheckerState; +} + +bool TextChecker::isContinuousSpellCheckingAllowed() +{ + notImplemented(); + + return false; +} + +void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) +{ + notImplemented(); +} + +void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) +{ + notImplemented(); +} + +int64_t TextChecker::uniqueSpellDocumentTag() +{ + notImplemented(); + return 0; +} + +void TextChecker::closeSpellDocumentWithTag(int64_t) +{ + notImplemented(); +} + +Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +{ + notImplemented(); + return Vector<WebCore::TextCheckingResult>(); +} + +void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + notImplemented(); +} + +void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) +{ + notImplemented(); +} + +void TextChecker::learnWord(const String& word) +{ + notImplemented(); +} + +void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp new file mode 100644 index 0000000..59faa1e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp @@ -0,0 +1,71 @@ +/* + * 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 "TiledDrawingAreaProxy.h" + +#if ENABLE(TILED_BACKING_STORE) + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "WebPageProxy.h" + +#include "qgraphicswkview.h" + +using namespace WebCore; + +#define TILE_DEBUG_LOG + +namespace WebKit { + +void TiledDrawingAreaProxy::updateWebView(const Vector<IntRect>& paintedArea) +{ + if (!page() || !page()->isValid()) + return; + + unsigned size = paintedArea.size(); + for (unsigned n = 0; n < size; ++n) + m_webView->update(QRect(paintedArea[n])); +} + +IntRect TiledDrawingAreaProxy::webViewVisibleRect() +{ + return enclosingIntRect(FloatRect(m_webView->visibleRect())); +} + +WebPageProxy* TiledDrawingAreaProxy::page() +{ + return toImpl(m_webView->page()->pageRef()); +} + +void TiledDrawingAreaProxy::snapshotTaken(UpdateChunk& chunk) +{ + emit m_webView->snapshotTaken(chunk.createImage()); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp new file mode 100644 index 0000000..2b631ca --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp @@ -0,0 +1,160 @@ +/* + * 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 "TiledDrawingAreaTile.h" + +#if ENABLE(TILED_BACKING_STORE) + +#include "GraphicsContext.h" +#include "TiledDrawingAreaProxy.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" +#include "UpdateChunk.h" +#include <QApplication> +#include <QObject> +#include <QPainter> + +using namespace WebCore; + +namespace WebKit { + +TiledDrawingAreaTile::TiledDrawingAreaTile(TiledDrawingAreaProxy* proxy, const Coordinate& tileCoordinate) + : m_proxy(proxy) + , m_coordinate(tileCoordinate) + , m_rect(proxy->tileRectForCoordinate(tileCoordinate)) + , m_hasUpdatePending(false) + , m_dirtyRegion(m_rect) +{ + static int id = 0; + m_ID = ++id; +#ifdef TILE_DEBUG_LOG + qDebug() << "deleting tile id=" << m_ID; +#endif +} + +TiledDrawingAreaTile::~TiledDrawingAreaTile() +{ +#ifdef TILE_DEBUG_LOG + qDebug() << "deleting tile id=" << m_ID; +#endif +} + +bool TiledDrawingAreaTile::isDirty() const +{ + return !m_dirtyRegion.isEmpty(); +} + +bool TiledDrawingAreaTile::isReadyToPaint() const +{ + return !m_buffer.isNull(); +} + +bool TiledDrawingAreaTile::hasReadyBackBuffer() const +{ + return !m_backBuffer.isNull() && !m_hasUpdatePending; +} + +void TiledDrawingAreaTile::invalidate(const IntRect& dirtyRect) +{ + IntRect tileDirtyRect = intersection(dirtyRect, m_rect); + if (tileDirtyRect.isEmpty()) + return; + + m_dirtyRegion += tileDirtyRect; +} + +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())); +} + +void TiledDrawingAreaTile::swapBackBufferToFront() +{ + ASSERT(!m_backBuffer.isNull()); + + m_buffer = m_backBuffer; + m_backBuffer = QPixmap(); +} + +void TiledDrawingAreaTile::paint(GraphicsContext* context, const IntRect& rect) +{ + ASSERT(!m_buffer.isNull()); + + IntRect target = intersection(rect, m_rect); + IntRect source((target.x() - m_rect.x()), + (target.y() - m_rect.y()), + target.width(), + target.height()); + + context->platformContext()->drawPixmap(target, m_buffer, source); +} + +void TiledDrawingAreaTile::updateFromChunk(UpdateChunk* updateChunk, float) +{ + QImage image(updateChunk->createImage()); + const IntRect& updateChunkRect = updateChunk->rect(); + +#ifdef TILE_DEBUG_LOG + qDebug() << "tile updated id=" << ID() << " rect=" << QRect(updateChunkRect); +#endif + if (updateChunkRect.size() == m_proxy->tileSize()) { + // Make a deep copy of the image since it's in shared memory. + m_backBuffer = QPixmap::fromImage(image.copy()); + } else { + 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(); + painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image); + } + m_hasUpdatePending = false; +} + +void TiledDrawingAreaTile::updateBackBuffer() +{ + if (isReadyToPaint() && !isDirty()) + return; + + // FIXME: individual rects + IntRect dirtyRect = m_dirtyRegion.boundingRect(); + m_dirtyRegion = QRegion(); + +#ifdef TILE_DEBUG_LOG + qDebug() << "requesting tile update id=" << m_ID << " rect=" << QRect(dirtyRect) << " scale=" << m_proxy->contentsScale(); +#endif + if (!m_proxy->page()->process()->isValid()) + return; + m_proxy->requestTileUpdate(m_ID, dirtyRect); + + m_hasUpdatePending = true; +} + +} +#endif diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp new file mode 100644 index 0000000..566a22e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp @@ -0,0 +1,144 @@ +/* + * 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 "WebContextMenuProxyQt.h" + +#include <IntPoint.h> +#include <WebContextMenuItemData.h> +#include <qmenu.h> +#include <qwkpage.h> + +using namespace WebCore; + +namespace WebKit { + +static QWKPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAction action) +{ + switch (action) { + case WebCore::ContextMenuItemTagOpenLink: + return QWKPage::OpenLink; + case WebCore::ContextMenuItemTagOpenLinkInNewWindow: + return QWKPage::OpenLinkInNewWindow; + case WebCore::ContextMenuItemTagCopyLinkToClipboard: + return QWKPage::CopyLinkToClipboard; + case WebCore::ContextMenuItemTagOpenImageInNewWindow: + return QWKPage::OpenImageInNewWindow; + case WebCore::ContextMenuItemTagGoBack: + return QWKPage::Back; + case WebCore::ContextMenuItemTagGoForward: + return QWKPage::Forward; + case WebCore::ContextMenuItemTagStop: + return QWKPage::Stop; + case WebCore::ContextMenuItemTagReload: + return QWKPage::Reload; + case WebCore::ContextMenuItemTagCut: + return QWKPage::Cut; + case WebCore::ContextMenuItemTagCopy: + return QWKPage::Copy; + case WebCore::ContextMenuItemTagPaste: + return QWKPage::Paste; + case WebCore::ContextMenuItemTagSelectAll: + return QWKPage::SelectAll; + default: + break; + } + return QWKPage::NoWebAction; +} + +WebContextMenuProxyQt::WebContextMenuProxyQt(QWKPage* page) + : m_page(page) +{ +} + +PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QWKPage* page) +{ + return adoptRef(new WebContextMenuProxyQt(page)); +} + +void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items) +{ + if (QMenu* menu = createContextMenu(items)) { + menu->move(position); + emit m_page->showContextMenu(menu); + } +} + +void WebContextMenuProxyQt::hideContextMenu() +{ +} + +QMenu* WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) +{ + QMenu* menu = new QMenu; + for (int i = 0; i < items.size(); ++i) { + const WebContextMenuItemData& item = items.at(i); + switch (item.type()) { + case WebCore::CheckableActionType: /* fall through */ + case WebCore::ActionType: { + QWKPage::WebAction action = webActionForContextMenuAction(item.action()); + QAction* qtAction = m_page->action(action); + if (qtAction) { + qtAction->setEnabled(item.enabled()); + qtAction->setChecked(item.checked()); + qtAction->setCheckable(item.type() == WebCore::CheckableActionType); + + menu->addAction(qtAction); + } + break; + } + case WebCore::SeparatorType: + menu->addSeparator(); + break; + case WebCore::SubmenuType: + if (QMenu *subMenu = createContextMenu(item.submenu())) { + subMenu->setTitle(item.title()); + menu->addAction(subMenu->menuAction()); + } + + break; + } + } + + // Do not show sub-menus with just disabled actions. + if (menu->isEmpty()) { + delete menu; + return 0; + } + bool isAnyActionEnabled = false; + QList<QAction *> actions = menu->actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->isVisible()) + isAnyActionEnabled |= actions.at(i)->isEnabled(); + } + if (!isAnyActionEnabled) { + delete menu; + return 0; + } + + return menu; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h new file mode 100644 index 0000000..435204f --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#ifndef WebContextMenuProxyQt_h +#define WebContextMenuProxyQt_h + +#include "WebContextMenuProxy.h" + +class QMenu; +class QWKPage; +class WebContextMenuItemData; + +namespace WebKit { + +class WebContextMenuProxyQt : public WebContextMenuProxy { +public: + static PassRefPtr<WebContextMenuProxyQt> create(QWKPage*); + +private: + WebContextMenuProxyQt(QWKPage*); + + virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&); + virtual void hideContextMenu(); + + QMenu* createContextMenu(const Vector<WebContextMenuItemData>& items); + + QWKPage* const m_page; +}; + +} // namespace WebKit + +#endif // WebContextMenuProxyQt_h diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp new file mode 100644 index 0000000..5b2cd88 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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. + */ + +#include "WebContext.h" + +#include "ApplicationCacheStorage.h" +#include "WebProcessCreationParameters.h" + +namespace WebKit { + +String WebContext::applicationCacheDirectory() +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + return WebCore::cacheStorage().cacheDirectory(); +#else + return QString(); +#endif +} + +void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp new file mode 100644 index 0000000..c04bd99 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +namespace WebKit { + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + notImplemented(); + return 0; +} + +void WebInspectorProxy::platformOpen() +{ + notImplemented(); +} + +void WebInspectorProxy::platformClose() +{ + notImplemented(); +} + +String WebInspectorProxy::inspectorPageURL() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp new file mode 100644 index 0000000..baf765a --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageProxy.h" + +namespace WebKit { + +String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) +{ + // FIXME: This should not be hard coded. + return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-us) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4"; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp new file mode 100644 index 0000000..5e13499 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenuProxyQt.h" + +#include "PlatformPopupMenuData.h" +#include "WebPopupItem.h" + +using namespace WebCore; + +namespace WebKit { + +WebPopupMenuProxyQt::WebPopupMenuProxyQt() + : WebPopupMenuProxy(0) +{ +} + +WebPopupMenuProxyQt::~WebPopupMenuProxyQt() +{ +} + +void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +{ +} + +void WebPopupMenuProxyQt::hidePopupMenu() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h new file mode 100644 index 0000000..e6c7a1e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -0,0 +1,50 @@ +/* + * 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 WebPopupMenuProxyQt_h +#define WebPopupMenuProxyQt_h + +#include "WebPopupMenuProxy.h" + +namespace WebKit { + +class WebPopupMenuProxyQt : public WebPopupMenuProxy { +public: + static PassRefPtr<WebPopupMenuProxyQt> create() + { + return adoptRef(new WebPopupMenuProxyQt()); + } + ~WebPopupMenuProxyQt(); + + virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void hidePopupMenu(); + +private: + WebPopupMenuProxyQt(); +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxyQt_h diff --git a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp new file mode 100644 index 0000000..173cfd5 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPreferences.h" + +namespace WebKit { + +void WebPreferences::platformInitializeStore() +{ +} + +void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) +{ +} + +void WebPreferences::platformUpdateBoolValueForKey(const String&, bool) +{ +} + +void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t) +{ +} + +void WebPreferences::platformUpdateDoubleValueForKey(const String&, double) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp new file mode 100644 index 0000000..6a1ee36 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingAreaProxy.h" + +#include "UpdateChunk.h" +#include "WebProcessProxy.h" +#include "WebView.h" +#include <WebCore/BitmapInfo.h> + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* ChunkedUpdateDrawingAreaProxy::page() +{ + return m_webView->page(); +} + +void ChunkedUpdateDrawingAreaProxy::ensureBackingStore() +{ + if (m_backingStoreBitmap) + return; + + BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(size()); + + void* pixels = 0; + m_backingStoreBitmap.set(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0)); + + if (!m_backingStoreDC) { + // Create a DC for the backing store. + HDC screenDC = ::GetDC(0); + m_backingStoreDC.set(::CreateCompatibleDC(screenDC)); + ::ReleaseDC(0, screenDC); + } + + ::SelectObject(m_backingStoreDC.get(), m_backingStoreBitmap.get()); +} + +void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore() +{ + m_backingStoreBitmap.clear(); +} + +bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, HDC hdc) +{ + if (!m_backingStoreBitmap) + return false; + + // BitBlt from the backing-store to the passed in hdc. + ::BitBlt(hdc, rect.x(), rect.y(), rect.width(), rect.height(), m_backingStoreDC.get(), rect.x(), rect.y(), SRCCOPY); + return true; +} + +void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) +{ + ensureBackingStore(); + + OwnPtr<HDC> updateChunkBitmapDC(::CreateCompatibleDC(m_backingStoreDC.get())); + + // Create a bitmap. + BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(updateChunk->rect().size()); + + // Duplicate the update chunk handle. + HANDLE updateChunkHandle; + BOOL result = ::DuplicateHandle(m_webView->page()->process()->processIdentifier(), updateChunk->memory(), + ::GetCurrentProcess(), &updateChunkHandle, STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, false, DUPLICATE_CLOSE_SOURCE); + + void* pixels = 0; + OwnPtr<HBITMAP> hBitmap(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, updateChunkHandle, 0)); + ::SelectObject(updateChunkBitmapDC.get(), hBitmap.get()); + + // BitBlt from the UpdateChunk to the backing store. + ::BitBlt(m_backingStoreDC.get(), updateChunk->rect().x(), updateChunk->rect().y(), updateChunk->rect().width(), updateChunk->rect().height(), updateChunkBitmapDC.get(), 0, 0, SRCCOPY); + + // FIXME: We should not do this here. + ::CloseHandle(updateChunkHandle); + + // Invalidate the WebView's HWND. + RECT rect = updateChunk->rect(); + ::InvalidateRect(m_webView->window(), &rect, false); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp new file mode 100644 index 0000000..8259272 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerBackedDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "WebView.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* LayerBackedDrawingAreaProxy::page() +{ + return m_webView->page(); +} + +void LayerBackedDrawingAreaProxy::platformSetSize() +{ +} + +void LayerBackedDrawingAreaProxy::attachCompositingContext(uint32_t contextID) +{ + +} + +void LayerBackedDrawingAreaProxy::detachCompositingContext() +{ +} + +bool LayerBackedDrawingAreaProxy::paint(const IntRect&, PlatformDrawingContext) +{ + return false; +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp new file mode 100644 index 0000000..3c4b1eb --- /dev/null +++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "TextChecker.h" + +#include "NotImplemented.h" +#include "TextCheckerState.h" + +using namespace WebCore; + +namespace WebKit { + +static TextCheckerState textCheckerState; + +const TextCheckerState& TextChecker::state() +{ + notImplemented(); + + return textCheckerState; +} + +bool TextChecker::isContinuousSpellCheckingAllowed() +{ + notImplemented(); + + return false; +} + +void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) +{ + notImplemented(); +} + +void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) +{ + notImplemented(); +} + +int64_t TextChecker::uniqueSpellDocumentTag() +{ + notImplemented(); + return 0; +} + +void TextChecker::closeSpellDocumentWithTag(int64_t) +{ + notImplemented(); +} + +Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +{ + notImplemented(); + return Vector<WebCore::TextCheckingResult>(); +} + +void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + notImplemented(); +} + +void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) +{ + notImplemented(); +} + +void TextChecker::learnWord(const String& word) +{ + notImplemented(); +} + +void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp new file mode 100644 index 0000000..090598f --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuProxyWin.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +WebContextMenuProxyWin::WebContextMenuProxyWin(HWND parentWindow, WebPageProxy* page) + : m_window(parentWindow) + , m_page(page) + , m_menu(0) +{ +} + +void WebContextMenuProxyWin::populateMenu(HMENU menu, const Vector<WebContextMenuItemData>& items) +{ + for (size_t i = 0; i < items.size(); ++i) { + const WebContextMenuItemData& itemData = items[i]; + switch (itemData.type()) { + case ActionType: + case CheckableActionType: { + UINT flags = itemData.enabled() ? MF_ENABLED : MF_DISABLED; + if (itemData.checked()) + flags |= MF_CHECKED; + String title = itemData.title(); + ::AppendMenu(menu, flags, itemData.action(), title.charactersWithNullTermination()); + + m_actionMap.add(itemData.action(), itemData); + break; + } + case SeparatorType: + ::AppendMenu(menu, MF_SEPARATOR, 0, 0); + break; + case SubmenuType: { + HMENU subMenu = ::CreatePopupMenu(); + populateMenu(subMenu, itemData.submenu()); + String title = itemData.title(); + ::AppendMenu(menu, MF_POPUP, reinterpret_cast<UINT>(subMenu), title.charactersWithNullTermination()); + break; + } + default: + ASSERT_NOT_REACHED(); + } + } +} + +void WebContextMenuProxyWin::showContextMenu(const IntPoint& origin, const Vector<WebContextMenuItemData>& items) +{ + // Hide any context menu we have showing (this also destroys the menu). + hideContextMenu(); + + m_menu = ::CreatePopupMenu(); + populateMenu(m_menu, items); + + POINT point = POINT(origin); + if (!::ClientToScreen(m_window, &point)) + return; + + UINT flags = TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_VERPOSANIMATION | TPM_HORIZONTAL | TPM_LEFTALIGN | TPM_HORPOSANIMATION | TPM_RETURNCMD | TPM_NONOTIFY; + int selectedCommand = ::TrackPopupMenuEx(m_menu, flags, point.x, point.y, m_window, 0); + if (!selectedCommand) + return; + + m_page->contextMenuItemSelected(m_actionMap.get(selectedCommand)); +} + +void WebContextMenuProxyWin::hideContextMenu() +{ + if (m_menu) { + ::DestroyMenu(m_menu); + m_menu = 0; + } + + m_actionMap.clear(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.h new file mode 100644 index 0000000..a843b26 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.h @@ -0,0 +1,61 @@ +/* + * 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 WebContextMenuProxyWin_h +#define WebContextMenuProxyWin_h + +#include "WebContextMenuItemData.h" +#include "WebContextMenuProxy.h" +#include "WebPageProxy.h" +#include <wtf/HashMap.h> + +namespace WebKit { + +class WebContextMenuProxyWin : public WebContextMenuProxy { +public: + static PassRefPtr<WebContextMenuProxyWin> create(HWND parentWindow, WebPageProxy* page) + { + return adoptRef(new WebContextMenuProxyWin(parentWindow, page)); + } + +private: + WebContextMenuProxyWin(HWND parentWindow, WebPageProxy* page); + + virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&); + virtual void hideContextMenu(); + + void populateMenu(HMENU, const Vector<WebContextMenuItemData>&); + + HMENU m_menu; + HWND m_window; + WebPageProxy* m_page; + + // Creates a map from the context menu item's action to the context menu item itself. + HashMap<int, WebContextMenuItemData> m_actionMap; +}; + +} // namespace WebKit + +#endif // WebContextMenuProxyWin_h diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp new file mode 100644 index 0000000..83b586d --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContext.h" + +#include "WebProcessCreationParameters.h" +#include "WebProcessMessages.h" +#include <WebCore/FileSystem.h> + +using namespace WebCore; + +namespace WebKit { + +String WebContext::applicationCacheDirectory() +{ + return localUserSpecificStorageDirectory(); +} + +void WebContext::setShouldPaintNativeControls(bool b) +{ + m_shouldPaintNativeControls = b; + + if (!hasValidProcess()) + return; + m_process->send(Messages::WebProcess::SetShouldPaintNativeControls(m_shouldPaintNativeControls), 0); +} + +void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters) +{ + parameters.shouldPaintNativeControls = m_shouldPaintNativeControls; +} + +} // namespace WebKit + diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp new file mode 100644 index 0000000..7637429 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#include "WebPageProxy.h" +#include "WebView.h" +#include <WebCore/WebCoreInstanceHandle.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RetainPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +static const LPCWSTR kWebKit2InspectorWindowClassName = L"WebKit2InspectorWindowClass"; + +bool WebInspectorProxy::registerInspectorViewWindowClass() +{ + static bool haveRegisteredWindowClass = false; + if (haveRegisteredWindowClass) + return true; + haveRegisteredWindowClass = true; + + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_DBLCLKS; + wcex.lpfnWndProc = WebInspectorProxy::InspectorViewWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(WebInspectorProxy*); + wcex.hInstance = instanceHandle(); + wcex.hIcon = 0; + wcex.hCursor = ::LoadCursor(0, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = 0; + wcex.lpszClassName = kWebKit2InspectorWindowClassName; + wcex.hIconSm = 0; + + return !!::RegisterClassEx(&wcex); +} + +LRESULT CALLBACK WebInspectorProxy::InspectorViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); + + if (WebInspectorProxy* inspectorView = reinterpret_cast<WebInspectorProxy*>(longPtr)) + return inspectorView->wndProc(hWnd, message, wParam, lParam); + + if (message == WM_CREATE) { + LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); + + // Associate the WebInspectorProxy with the window. + ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); + return 0; + } + + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +LRESULT WebInspectorProxy::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult = 0; + bool handled = true; + + switch (message) { + case WM_SIZE: + lResult = onSizeEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_GETMINMAXINFO: + lResult = onMinMaxInfoEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_SETFOCUS: + lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled); + break; + case WM_CLOSE: + lResult = onCloseEvent(hWnd, message, wParam, lParam, handled); + break; + default: + handled = false; + break; + } + + if (!handled) + lResult = ::DefWindowProc(hWnd, message, wParam, lParam); + + return lResult; +} + +LRESULT WebInspectorProxy::onSizeEvent(HWND, UINT, WPARAM, LPARAM, bool&) +{ + RECT rect; + ::GetClientRect(m_inspectorWindow, &rect); + + ::SetWindowPos(m_inspectorView->window(), 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); + + return 0; +} + +LRESULT WebInspectorProxy::onSetFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool&) +{ + ::SetFocus(m_inspectorView->window()); + + return 0; +} + +LRESULT WebInspectorProxy::onMinMaxInfoEvent(HWND, UINT, WPARAM, LPARAM lParam, bool&) +{ + MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(lParam); + POINT size = {minimumWindowWidth, minimumWindowHeight}; + info->ptMinTrackSize = size; + + return 0; +} + +LRESULT WebInspectorProxy::onCloseEvent(HWND, UINT, WPARAM, LPARAM, bool&) +{ + ::ShowWindow(m_inspectorWindow, SW_HIDE); + close(); + + return 0; +} + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + ASSERT(!m_inspectorView); + ASSERT(!m_inspectorWindow); + + RECT emptyRect = { 0 }; + m_inspectorView = WebView::create(emptyRect, m_page->context(), inspectorPageGroup(), 0); + + return m_inspectorView->page(); +} + +void WebInspectorProxy::platformOpen() +{ + registerInspectorViewWindowClass(); + + m_inspectorWindow = ::CreateWindowEx(0, kWebKit2InspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + 0, 0, initialWindowWidth, initialWindowHeight, 0, 0, instanceHandle(), this); + ASSERT(::IsWindow(m_inspectorWindow)); + + m_inspectorView->setParentWindow(m_inspectorWindow); + ::ShowWindow(m_inspectorWindow, SW_SHOW); +} + +void WebInspectorProxy::platformClose() +{ + ASSERT(m_inspectorWindow); + ASSERT(m_inspectorView); + + ::DestroyWindow(m_inspectorWindow); + + m_inspectorWindow = 0; + m_inspectorView = 0; +} + +String WebInspectorProxy::inspectorPageURL() const +{ + RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector"))); + if (!htmlURLRef) + return String(); + + return String(CFURLGetString(htmlURLRef.get())); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp new file mode 100644 index 0000000..6b0efd1 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp @@ -0,0 +1,113 @@ +/* +* Copyright (C) 2010 Apple Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +* THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "WebPageProxy.h" + +#include <tchar.h> +#include <WebCore/Language.h> +#include <WebCore/WebCoreInstanceHandle.h> +#include <wtf/StdLibExtras.h> +#include <wtf/text/StringConcatenate.h> + +using namespace WebCore; + +namespace WebKit { + +static String windowsVersion() +{ + String osVersion; + OSVERSIONINFO versionInfo = { 0 }; + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + ::GetVersionEx(&versionInfo); + + if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + if (versionInfo.dwMajorVersion == 4) { + if (versionInfo.dwMinorVersion == 0) + osVersion = "Windows 95"; + else if (versionInfo.dwMinorVersion == 10) + osVersion = "Windows 98"; + else if (versionInfo.dwMinorVersion == 90) + osVersion = "Windows 98; Win 9x 4.90"; + } + } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) + osVersion = makeString("Windows NT ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion)); + + if (!osVersion.length()) + osVersion = makeString("Windows ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion)); + return osVersion; +} + +static String userVisibleWebKitVersionString() +{ + String versionStr = "420+"; + void* data = 0; + + struct LANGANDCODEPAGE { + WORD wLanguage; + WORD wCodePage; + } *lpTranslate; + + TCHAR path[MAX_PATH]; + ::GetModuleFileName(instanceHandle(), path, WTF_ARRAY_LENGTH(path)); + DWORD handle; + DWORD versionSize = ::GetFileVersionInfoSize(path, &handle); + if (!versionSize) + goto exit; + data = fastMalloc(versionSize); + if (!data) + goto exit; + if (!::GetFileVersionInfo(path, 0, versionSize, data)) + goto exit; + UINT cbTranslate; + if (!::VerQueryValue(data, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate)) + goto exit; + TCHAR key[256]; + _stprintf_s(key, WTF_ARRAY_LENGTH(key), TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), lpTranslate[0].wLanguage, lpTranslate[0].wCodePage); + LPCTSTR productVersion; + UINT productVersionLength; + if (!::VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&productVersion, &productVersionLength)) + goto exit; + versionStr = String(productVersion, productVersionLength - 1); + +exit: + if (data) + fastFree(data); + return versionStr; +} + +String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) +{ + DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion())); + DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString())); + + // FIXME: We should upate the user agent if the default language changes. + String language = defaultLanguage(); + + if (applicationNameForUserAgent.isEmpty()) + return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)"); + return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp new file mode 100644 index 0000000..64b9fb5 --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp @@ -0,0 +1,937 @@ +/* + * 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. + */ + +// 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 "WebPopupMenuProxyWin.h" + +#include "WebView.h" +#include <WebCore/WebCoreInstanceHandle.h> +#include <WebCore/ScrollbarTheme.h> +#include <WebCore/BitmapInfo.h> +#include <WebCore/PlatformMouseEvent.h> +#include <windowsx.h> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +static const LPCWSTR kWebKit2WebPopupMenuProxyWindowClassName = L"WebKit2WebPopupMenuProxyWindowClass"; + +static const int defaultAnimationDuration = 200; +static const int maxPopupHeight = 320; +static const int popupWindowBorderWidth = 1; +static const int separatorPadding = 4; +static const int separatorHeight = 1; + +// This is used from within our custom message pump when we want to send a +// message to the web view and not have our message stolen and sent to +// the popup window. +static const UINT WM_HOST_WINDOW_FIRST = WM_USER; +static const UINT WM_HOST_WINDOW_CHAR = WM_USER + WM_CHAR; +static const UINT WM_HOST_WINDOW_MOUSEMOVE = WM_USER + WM_MOUSEMOVE; + +static inline bool isASCIIPrintable(unsigned c) +{ + return c >= 0x20 && c <= 0x7E; +} + +static void translatePoint(LPARAM& lParam, HWND from, HWND to) +{ + POINT pt; + pt.x = static_cast<short>(GET_X_LPARAM(lParam)); + pt.y = static_cast<short>(GET_Y_LPARAM(lParam)); + ::MapWindowPoints(from, to, &pt, 1); + lParam = MAKELPARAM(pt.x, pt.y); +} + +LRESULT CALLBACK WebPopupMenuProxyWin::WebPopupMenuProxyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); + + if (WebPopupMenuProxyWin* popupMenuProxy = reinterpret_cast<WebPopupMenuProxyWin*>(longPtr)) + return popupMenuProxy->wndProc(hWnd, message, wParam, lParam); + + if (message == WM_CREATE) { + LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); + + // Associate the WebView with the window. + ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); + return 0; + } + + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +LRESULT WebPopupMenuProxyWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult = 0; + bool handled = true; + + switch (message) { + case WM_MOUSEACTIVATE: + lResult = onMouseActivate(hWnd, message, wParam, lParam, handled); + break; + case WM_SIZE: + lResult = onSize(hWnd, message, wParam, lParam, handled); + break; + case WM_KEYDOWN: + lResult = onKeyDown(hWnd, message, wParam, lParam, handled); + break; + case WM_CHAR: + lResult = onChar(hWnd, message, wParam, lParam, handled); + break; + case WM_MOUSEMOVE: + lResult = onMouseMove(hWnd, message, wParam, lParam, handled); + break; + case WM_LBUTTONDOWN: + lResult = onLButtonDown(hWnd, message, wParam, lParam, handled); + break; + case WM_LBUTTONUP: + lResult = onLButtonUp(hWnd, message, wParam, lParam, handled); + break; + case WM_MOUSEWHEEL: + lResult = onMouseWheel(hWnd, message, wParam, lParam, handled); + break; + case WM_PAINT: + lResult = onPaint(hWnd, message, wParam, lParam, handled); + break; + case WM_PRINTCLIENT: + lResult = onPrintClient(hWnd, message, wParam, lParam, handled); + break; + default: + handled = false; + break; + } + + if (!handled) + lResult = ::DefWindowProc(hWnd, message, wParam, lParam); + + return lResult; +} + +bool WebPopupMenuProxyWin::registerWindowClass() +{ + static bool haveRegisteredWindowClass = false; + if (haveRegisteredWindowClass) + return true; + haveRegisteredWindowClass = true; + + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_DROPSHADOW; + wcex.lpfnWndProc = WebPopupMenuProxyWin::WebPopupMenuProxyWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(WebPopupMenuProxyWin*); + wcex.hInstance = instanceHandle(); + wcex.hIcon = 0; + wcex.hCursor = ::LoadCursor(0, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = 0; + wcex.lpszClassName = kWebKit2WebPopupMenuProxyWindowClassName; + wcex.hIconSm = 0; + + return !!::RegisterClassEx(&wcex); +} + +WebPopupMenuProxyWin::WebPopupMenuProxyWin(WebView* webView, WebPopupMenuProxy::Client* client) + : WebPopupMenuProxy(client) + , m_webView(webView) + , m_newSelectedIndex(0) + , m_popup(0) + , m_DC(0) + , m_bmp(0) + , m_itemHeight(0) + , m_scrollOffset(0) + , m_wheelDelta(0) + , m_focusedIndex(0) + , m_wasClicked(false) + , m_scrollbarCapturingMouse(false) + , m_showPopup(false) +{ +} + +WebPopupMenuProxyWin::~WebPopupMenuProxyWin() +{ + if (m_bmp) + ::DeleteObject(m_bmp); + if (m_DC) + ::DeleteDC(m_DC); + if (m_popup) + ::DestroyWindow(m_popup); + if (m_scrollbar) + m_scrollbar->setParent(0); +} + +void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex) +{ + m_items = items; + m_data = data; + m_newSelectedIndex = selectedIndex; + + calculatePositionAndSize(rect); + if (clientRect().isEmpty()) + return; + + HWND hostWindow = m_webView->window(); + + if (!m_scrollbar && visibleItems() < m_items.size()) { + m_scrollbar = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, SmallScrollbar); + m_scrollbar->styleChanged(); + } + + if (!m_popup) { + registerWindowClass(); + + DWORD exStyle = WS_EX_LTRREADING; + + m_popup = ::CreateWindowEx(exStyle, kWebKit2WebPopupMenuProxyWindowClassName, TEXT("PopupMenu"), + WS_POPUP | WS_BORDER, + m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height(), + hostWindow, 0, instanceHandle(), this); + + if (!m_popup) + return; + } + + BOOL shouldAnimate = FALSE; + ::SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &shouldAnimate, 0); + + if (shouldAnimate) { + RECT viewRect = {0}; + ::GetWindowRect(hostWindow, &viewRect); + + if (!::IsRectEmpty(&viewRect)) { + // Popups should slide into view away from the <select> box + // NOTE: This may have to change for Vista + DWORD slideDirection = (m_windowRect.y() < viewRect.top + rect.location().y()) ? AW_VER_NEGATIVE : AW_VER_POSITIVE; + + ::AnimateWindow(m_popup, defaultAnimationDuration, AW_SLIDE | slideDirection); + } + } else + ::ShowWindow(m_popup, SW_SHOWNOACTIVATE); + + + int index = selectedIndex; + if (index >= 0) + setFocusedIndex(index); + + m_showPopup = true; + + // Protect the popup menu in case its owner is destroyed while we're running the message pump. + RefPtr<WebPopupMenuProxyWin> protect(this); + + ::SetCapture(hostWindow); + + MSG msg; + HWND activeWindow; + + while (::GetMessage(&msg, 0, 0, 0)) { + switch (msg.message) { + case WM_HOST_WINDOW_MOUSEMOVE: + case WM_HOST_WINDOW_CHAR: + if (msg.hwnd == m_popup) { + // This message should be sent to the host window. + msg.hwnd = hostWindow; + msg.message -= WM_HOST_WINDOW_FIRST; + } + break; + + // Steal mouse messages. + case WM_NCMOUSEMOVE: + case WM_NCLBUTTONDOWN: + case WM_NCLBUTTONUP: + case WM_NCLBUTTONDBLCLK: + case WM_NCRBUTTONDOWN: + case WM_NCRBUTTONUP: + case WM_NCRBUTTONDBLCLK: + case WM_NCMBUTTONDOWN: + case WM_NCMBUTTONUP: + case WM_NCMBUTTONDBLCLK: + case WM_MOUSEWHEEL: + msg.hwnd = m_popup; + break; + + // These mouse messages use client coordinates so we need to convert them. + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MBUTTONDBLCLK: { + // Translate the coordinate. + translatePoint(msg.lParam, msg.hwnd, m_popup); + msg.hwnd = m_popup; + break; + } + + // Steal all keyboard messages. + case WM_KEYDOWN: + case WM_KEYUP: + case WM_CHAR: + case WM_DEADCHAR: + case WM_SYSKEYUP: + case WM_SYSCHAR: + case WM_SYSDEADCHAR: + msg.hwnd = m_popup; + break; + } + + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + + if (!m_showPopup) + break; + activeWindow = ::GetActiveWindow(); + if (activeWindow != hostWindow && !::IsChild(activeWindow, hostWindow)) + break; + if (::GetCapture() != hostWindow) + break; + } + + if (::GetCapture() == hostWindow) + ::ReleaseCapture(); + + m_showPopup = false; + ::ShowWindow(m_popup, SW_HIDE); + + m_client->valueChangedForPopupMenu(this, m_newSelectedIndex); +} + +void WebPopupMenuProxyWin::hidePopupMenu() +{ + if (!m_showPopup) + return; + m_showPopup = false; + + ::ShowWindow(m_popup, SW_HIDE); + + // Post a WM_NULL message to wake up the message pump if necessary. + ::PostMessage(m_popup, WM_NULL, 0, 0); +} + +void WebPopupMenuProxyWin::calculatePositionAndSize(const IntRect& rect) +{ + // Convert the rect (which is in view cooridates) into screen coordinates. + IntRect rectInScreenCoords = rect; + POINT location(rectInScreenCoords .location()); + if (!::ClientToScreen(m_webView->window(), &location)) + return; + rectInScreenCoords.setLocation(location); + + int itemCount = m_items.size(); + m_itemHeight = m_data.m_itemHeight; + + int naturalHeight = m_itemHeight * itemCount; + int popupHeight = min(maxPopupHeight, naturalHeight); + + // The popup should show an integral number of items (i.e. no partial items should be visible) + popupHeight -= popupHeight % m_itemHeight; + + // Next determine its width + int popupWidth = m_data.m_popupWidth; + + if (naturalHeight > maxPopupHeight) { + // We need room for a scrollbar + popupWidth += ScrollbarTheme::nativeTheme()->scrollbarThickness(SmallScrollbar); + } + + popupHeight += 2 * popupWindowBorderWidth; + + // The popup should be at least as wide as the control on the page + popupWidth = max(rectInScreenCoords.width() - m_data.m_clientInsetLeft - m_data.m_clientInsetRight, popupWidth); + + // 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); + + // The popup needs to stay within the bounds of the screen and not overlap any toolbars + HMONITOR monitor = ::MonitorFromWindow(m_webView->window(), MONITOR_DEFAULTTOPRIMARY); + MONITORINFOEX monitorInfo; + monitorInfo.cbSize = sizeof(MONITORINFOEX); + ::GetMonitorInfo(monitor, &monitorInfo); + FloatRect screen = monitorInfo.rcWork; + + // Check that we don't go off the screen vertically + if (popupRect.bottom() > 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 + if ((rectInScreenCoords.y() + rectInScreenCoords.height() / 2) < (screen.height() / 2)) { + // Below is bigger + popupRect.setHeight(screen.height() - popupRect.y()); + } else { + // Above is bigger + popupRect.setY(0); + popupRect.setHeight(rectInScreenCoords.y()); + } + } else { + // The popup fits above, so reposition it + popupRect.setY(rectInScreenCoords.y() - popupRect.height()); + } + } + + // Check that we don't go off the screen horizontally + if (popupRect.x() < screen.x()) { + popupRect.setWidth(popupRect.width() - (screen.x() - popupRect.x())); + popupRect.setX(screen.x()); + } + + m_windowRect = popupRect; +} + +IntRect WebPopupMenuProxyWin::clientRect() const +{ + IntRect clientRect = m_windowRect; + clientRect.inflate(-popupWindowBorderWidth); + clientRect.setLocation(IntPoint(0, 0)); + return clientRect; +} + +void WebPopupMenuProxyWin::invalidateItem(int index) +{ + if (!m_popup) + return; + + IntRect damageRect(clientRect()); + damageRect.setY(m_itemHeight * (index - m_scrollOffset)); + damageRect.setHeight(m_itemHeight); + if (m_scrollbar) + damageRect.setWidth(damageRect.width() - m_scrollbar->frameRect().width()); + + RECT r = damageRect; + ::InvalidateRect(m_popup, &r, TRUE); +} + +// ScrollbarClient + +int WebPopupMenuProxyWin::scrollSize(ScrollbarOrientation orientation) const +{ + return ((orientation == VerticalScrollbar) && m_scrollbar) ? (m_scrollbar->totalSize() - m_scrollbar->visibleSize()) : 0; +} + +void WebPopupMenuProxyWin::setScrollOffsetFromAnimation(const IntPoint& offset) +{ + if (m_scrollbar) + m_scrollbar->setValue(offset.y(), Scrollbar::FromScrollAnimator); +} + +void WebPopupMenuProxyWin::valueChanged(Scrollbar* scrollBar) +{ + ASSERT(m_scrollbar); + + if (!m_popup) + return; + + int offset = scrollBar->value(); + + if (m_scrollOffset == offset) + return; + + int scrolledLines = m_scrollOffset - offset; + m_scrollOffset = offset; + + UINT flags = SW_INVALIDATE; + +#ifdef CAN_SET_SMOOTH_SCROLLING_DURATION + BOOL shouldSmoothScroll = FALSE; + ::SystemParametersInfo(SPI_GETLISTBOXSMOOTHSCROLLING, 0, &shouldSmoothScroll, 0); + if (shouldSmoothScroll) + flags |= MAKEWORD(SW_SMOOTHSCROLL, smoothScrollAnimationDuration); +#endif + + IntRect listRect = clientRect(); + if (m_scrollbar) + listRect.setWidth(listRect.width() - m_scrollbar->frameRect().width()); + RECT r = listRect; + ::ScrollWindowEx(m_popup, 0, scrolledLines * m_itemHeight, &r, 0, 0, 0, flags); + if (m_scrollbar) { + r = m_scrollbar->frameRect(); + ::InvalidateRect(m_popup, &r, TRUE); + } + ::UpdateWindow(m_popup); +} + +void WebPopupMenuProxyWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) +{ + IntRect scrollRect = rect; + scrollRect.move(scrollbar->x(), scrollbar->y()); + RECT r = scrollRect; + ::InvalidateRect(m_popup, &r, false); +} + +// Message pump messages. + +LRESULT WebPopupMenuProxyWin::onMouseActivate(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) +{ + handled = true; + return MA_NOACTIVATE; +} + +LRESULT WebPopupMenuProxyWin::onSize(HWND hWnd, UINT message, WPARAM, LPARAM lParam, bool& handled) +{ + handled = true; + if (!scrollbar()) + return 0; + + IntSize size(LOWORD(lParam), HIWORD(lParam)); + scrollbar()->setFrameRect(IntRect(size.width() - scrollbar()->width(), 0, scrollbar()->width(), size.height())); + + int visibleItems = this->visibleItems(); + scrollbar()->setEnabled(visibleItems < m_items.size()); + scrollbar()->setSteps(1, max(1, visibleItems - 1)); + scrollbar()->setProportion(visibleItems, m_items.size()); + return 0; +} + +LRESULT WebPopupMenuProxyWin::onKeyDown(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + handled = true; + + LRESULT lResult = 0; + switch (LOWORD(wParam)) { + case VK_DOWN: + case VK_RIGHT: + down(); + break; + case VK_UP: + case VK_LEFT: + up(); + break; + case VK_HOME: + focusFirst(); + break; + case VK_END: + focusLast(); + break; + case VK_PRIOR: + if (focusedIndex() != scrollOffset()) { + // Set the selection to the first visible item + int firstVisibleItem = scrollOffset(); + up(focusedIndex() - firstVisibleItem); + } else { + // The first visible item is selected, so move the selection back one page + up(visibleItems()); + } + break; + case VK_NEXT: { + int lastVisibleItem = scrollOffset() + visibleItems() - 1; + if (focusedIndex() != lastVisibleItem) { + // Set the selection to the last visible item + down(lastVisibleItem - focusedIndex()); + } else { + // The last visible item is selected, so move the selection forward one page + down(visibleItems()); + } + break; + } + case VK_TAB: + ::SendMessage(m_webView->window(), message, wParam, lParam); + hide(); + break; + case VK_ESCAPE: + hide(); + break; + default: + if (isASCIIPrintable(wParam)) { + // Send the keydown to the WebView so it can be used for type-to-select. + // Since we know that the virtual key is ASCII printable, it's OK to convert this to + // a WM_CHAR message. (We don't want to call TranslateMessage because that will post a + // WM_CHAR message that will be stolen and redirected to the popup HWND. + ::PostMessage(m_popup, WM_HOST_WINDOW_CHAR, wParam, lParam); + } else + lResult = 1; + break; + } + + return lResult; +} + +LRESULT WebPopupMenuProxyWin::onChar(HWND hWnd, UINT message, WPARAM wParam, LPARAM, bool& handled) +{ + handled = true; + + LRESULT lResult = 0; + int index; + switch (wParam) { + case 0x0D: // Enter/Return + hide(); + index = focusedIndex(); + ASSERT(index >= 0); + // FIXME: Do we need to send back the index right away? + m_newSelectedIndex = index; + break; + case 0x1B: // Escape + hide(); + break; + case 0x09: // TAB + case 0x08: // Backspace + case 0x0A: // Linefeed + default: // Character + lResult = 1; + break; + } + + return lResult; +} + +LRESULT WebPopupMenuProxyWin::onMouseMove(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + handled = true; + + IntPoint mousePoint(MAKEPOINTS(lParam)); + if (scrollbar()) { + IntRect scrollBarRect = scrollbar()->frameRect(); + if (scrollbarCapturingMouse() || scrollBarRect.contains(mousePoint)) { + // Put the point into coordinates relative to the scroll bar + mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y()); + PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y())); + scrollbar()->mouseMoved(event); + return 0; + } + } + + BOOL shouldHotTrack = FALSE; + ::SystemParametersInfo(SPI_GETHOTTRACKING, 0, &shouldHotTrack, 0); + + RECT bounds; + ::GetClientRect(m_popup, &bounds); + if (!::PtInRect(&bounds, mousePoint) && !(wParam & MK_LBUTTON)) { + // When the mouse is not inside the popup menu and the left button isn't down, just + // repost the message to the web view. + + // Translate the coordinate. + translatePoint(lParam, m_popup, m_webView->window()); + + ::PostMessage(m_popup, WM_HOST_WINDOW_MOUSEMOVE, wParam, lParam); + return 0; + } + + if ((shouldHotTrack || wParam & MK_LBUTTON) && ::PtInRect(&bounds, mousePoint)) + setFocusedIndex(listIndexAtPoint(mousePoint), true); + + return 0; +} + +LRESULT WebPopupMenuProxyWin::onLButtonDown(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + handled = true; + + IntPoint mousePoint(MAKEPOINTS(lParam)); + if (scrollbar()) { + IntRect scrollBarRect = scrollbar()->frameRect(); + if (scrollBarRect.contains(mousePoint)) { + // Put the point into coordinates relative to the scroll bar + mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y()); + PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y())); + scrollbar()->mouseDown(event); + setScrollbarCapturingMouse(true); + return 0; + } + } + + // If the mouse is inside the window, update the focused index. Otherwise, + // hide the popup. + RECT bounds; + ::GetClientRect(m_popup, &bounds); + if (::PtInRect(&bounds, mousePoint)) + setFocusedIndex(listIndexAtPoint(mousePoint), true); + else + hide(); + + return 0; +} + + +LRESULT WebPopupMenuProxyWin::onLButtonUp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + handled = true; + + IntPoint mousePoint(MAKEPOINTS(lParam)); + if (scrollbar()) { + IntRect scrollBarRect = scrollbar()->frameRect(); + if (scrollbarCapturingMouse() || scrollBarRect.contains(mousePoint)) { + setScrollbarCapturingMouse(false); + // Put the point into coordinates relative to the scroll bar + mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y()); + PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y())); + scrollbar()->mouseUp(); + // FIXME: This is a hack to work around Scrollbar not invalidating correctly when it doesn't have a parent widget + RECT r = scrollBarRect; + ::InvalidateRect(m_popup, &r, TRUE); + return 0; + } + } + // Only hide the popup if the mouse is inside the popup window. + RECT bounds; + ::GetClientRect(m_popup, &bounds); + if (::PtInRect(&bounds, mousePoint)) { + hide(); + int index = focusedIndex(); + if (index >= 0) { + // FIXME: Do we need to send back the index right away? + m_newSelectedIndex = index; + } + } + + return 0; +} + +LRESULT WebPopupMenuProxyWin::onMouseWheel(HWND hWnd, UINT message, WPARAM wParam, LPARAM, bool& handled) +{ + handled = true; + + if (!scrollbar()) + return 0; + + int i = 0; + for (incrementWheelDelta(GET_WHEEL_DELTA_WPARAM(wParam)); abs(wheelDelta()) >= WHEEL_DELTA; reduceWheelDelta(WHEEL_DELTA)) { + if (wheelDelta() > 0) + ++i; + else + --i; + } + scrollbar()->scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i)); + return 0; +} + +LRESULT WebPopupMenuProxyWin::onPaint(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) +{ + handled = true; + + PAINTSTRUCT paintStruct; + ::BeginPaint(m_popup, &paintStruct); + paint(paintStruct.rcPaint, paintStruct.hdc); + ::EndPaint(m_popup, &paintStruct); + + return 0; +} + +LRESULT WebPopupMenuProxyWin::onPrintClient(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled) +{ + handled = true; + + HDC hdc = reinterpret_cast<HDC>(wParam); + paint(clientRect(), hdc); + + return 0; +} + +bool WebPopupMenuProxyWin::down(unsigned lines) +{ + int size = m_items.size(); + + int lastSelectableIndex, selectedListIndex; + lastSelectableIndex = selectedListIndex = focusedIndex(); + for (int i = selectedListIndex + 1; i >= 0 && i < size; ++i) { + if (m_items[i].m_isEnabled) { + lastSelectableIndex = i; + if (i >= selectedListIndex + (int)lines) + break; + } + } + + return setFocusedIndex(lastSelectableIndex); +} + +bool WebPopupMenuProxyWin::up(unsigned lines) +{ + int size = m_items.size(); + + int lastSelectableIndex, selectedListIndex; + lastSelectableIndex = selectedListIndex = focusedIndex(); + for (int i = selectedListIndex - 1; i >= 0 && i < size; --i) { + if (m_items[i].m_isEnabled) { + lastSelectableIndex = i; + if (i <= selectedListIndex - (int)lines) + break; + } + } + + return setFocusedIndex(lastSelectableIndex); +} + +void WebPopupMenuProxyWin::paint(const IntRect& damageRect, HDC hdc) +{ + if (!m_popup) + return; + + if (!m_DC) { + m_DC = ::CreateCompatibleDC(::GetDC(m_popup)); + if (!m_DC) + return; + } + + if (m_bmp) { + bool keepBitmap = false; + BITMAP bitmap; + if (::GetObject(m_bmp, sizeof(bitmap), &bitmap)) + keepBitmap = bitmap.bmWidth == clientRect().width() && bitmap.bmHeight == clientRect().height(); + if (!keepBitmap) { + ::DeleteObject(m_bmp); + m_bmp = 0; + } + } + + if (!m_bmp) { + BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(clientRect().size()); + void* pixels = 0; + m_bmp = ::CreateDIBSection(m_DC, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); + if (!m_bmp) + return; + ::SelectObject(m_DC, m_bmp); + } + + GraphicsContext context(m_DC); + + IntRect translatedDamageRect = damageRect; + translatedDamageRect.move(IntSize(0, m_scrollOffset * m_itemHeight)); + m_data.m_notSelectedBackingStore->paint(context, damageRect.location(), translatedDamageRect); + + IntRect selectedIndexRectInBackingStore(0, focusedIndex() * m_itemHeight, m_data.m_selectedBackingStore->size().width(), m_itemHeight); + IntPoint selectedIndexDstPoint = selectedIndexRectInBackingStore.location(); + selectedIndexDstPoint.move(0, -m_scrollOffset * m_itemHeight); + + m_data.m_selectedBackingStore->paint(context, selectedIndexDstPoint, selectedIndexRectInBackingStore); + + if (m_scrollbar) + m_scrollbar->paint(&context, damageRect); + + HDC localDC = hdc ? hdc : ::GetDC(m_popup); + + ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY); + + if (!hdc) + ::ReleaseDC(m_popup, localDC); +} + +bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking) +{ + if (i < 0 || i >= m_items.size() || i == focusedIndex()) + return false; + + if (!m_items[i].m_isEnabled) + return false; + + invalidateItem(focusedIndex()); + invalidateItem(i); + + m_focusedIndex = i; + + if (!hotTracking) + m_client->setTextFromItemForPopupMenu(this, i); + + if (!scrollToRevealSelection()) + ::UpdateWindow(m_popup); + + return true; +} + +int WebPopupMenuProxyWin::visibleItems() const +{ + return clientRect().height() / m_itemHeight; +} + +int WebPopupMenuProxyWin::listIndexAtPoint(const IntPoint& point) const +{ + return m_scrollOffset + point.y() / m_itemHeight; +} + +int WebPopupMenuProxyWin::focusedIndex() const +{ + return m_focusedIndex; +} + +void WebPopupMenuProxyWin::focusFirst() +{ + int size = m_items.size(); + + for (int i = 0; i < size; ++i) { + if (m_items[i].m_isEnabled) { + setFocusedIndex(i); + break; + } + } +} + +void WebPopupMenuProxyWin::focusLast() +{ + int size = m_items.size(); + + for (int i = size - 1; i > 0; --i) { + if (m_items[i].m_isEnabled) { + setFocusedIndex(i); + break; + } + } +} + + +void WebPopupMenuProxyWin::incrementWheelDelta(int delta) +{ + m_wheelDelta += delta; +} + +void WebPopupMenuProxyWin::reduceWheelDelta(int delta) +{ + ASSERT(delta >= 0); + ASSERT(delta <= abs(m_wheelDelta)); + + if (m_wheelDelta > 0) + m_wheelDelta -= delta; + else if (m_wheelDelta < 0) + m_wheelDelta += delta; + else + return; +} + +bool WebPopupMenuProxyWin::scrollToRevealSelection() +{ + if (!m_scrollbar) + return false; + + int index = focusedIndex(); + + if (index < m_scrollOffset) { + m_scrollbar->setValue(index, Scrollbar::NotFromScrollAnimator); + return true; + } + + if (index >= m_scrollOffset + visibleItems()) { + m_scrollbar->setValue(index - visibleItems() + 1, Scrollbar::NotFromScrollAnimator); + return true; + } + + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h new file mode 100644 index 0000000..7a53c2c --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h @@ -0,0 +1,136 @@ +/* + * 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 WebPopupMenuProxyWin_h +#define WebPopupMenuProxyWin_h + +#include "PlatformPopupMenuData.h" +#include "WebPopupItem.h" +#include "WebPopupMenuProxy.h" +#include <WebCore/Scrollbar.h> +#include <WebCore/ScrollbarClient.h> + +typedef struct HWND__* HWND; +typedef struct HDC__* HDC; +typedef struct HBITMAP__* HBITMAP; + +namespace WebKit { + +class WebView; + +class WebPopupMenuProxyWin : public WebPopupMenuProxy, private WebCore::ScrollbarClient { +public: + static PassRefPtr<WebPopupMenuProxyWin> create(WebView* webView, WebPopupMenuProxy::Client* client) + { + return adoptRef(new WebPopupMenuProxyWin(webView, client)); + } + ~WebPopupMenuProxyWin(); + + virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void hidePopupMenu(); + + void hide() { hidePopupMenu(); } + +private: + WebPopupMenuProxyWin(WebView*, WebPopupMenuProxy::Client*); + + WebCore::Scrollbar* scrollbar() const { return m_scrollbar.get(); } + + // ScrollBarClient + virtual int scrollSize(WebCore::ScrollbarOrientation orientation) const; + virtual void setScrollOffsetFromAnimation(const WebCore::IntPoint&); + virtual void valueChanged(WebCore::Scrollbar*); + virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); + virtual bool isActive() const { return true; } + virtual bool scrollbarCornerPresent() const { return false; } + + static bool registerWindowClass(); + static LRESULT CALLBACK WebPopupMenuProxyWndProc(HWND, UINT, WPARAM, LPARAM); + LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + // Message pump messages. + LRESULT onMouseActivate(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onSize(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onKeyDown(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onChar(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onMouseMove(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onLButtonDown(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onLButtonUp(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onMouseWheel(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onPaint(HWND, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onPrintClient(HWND, UINT message, WPARAM, LPARAM, bool& handled); + + void calculatePositionAndSize(const WebCore::IntRect&); + WebCore::IntRect clientRect() const; + void invalidateItem(int index); + + int itemHeight() const { return m_itemHeight; } + const WebCore::IntRect& windowRect() const { return m_windowRect; } + int wheelDelta() const { return m_wheelDelta; } + void setWasClicked(bool b = true) { m_wasClicked = b; } + bool wasClicked() const { return m_wasClicked; } + void setScrollOffset(int offset) { m_scrollOffset = offset; } + int scrollOffset() const { return m_scrollOffset; } + bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } + void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } + + + bool up(unsigned lines = 1); + bool down(unsigned lines = 1); + + void paint(const WebCore::IntRect& damageRect, HDC = 0); + int visibleItems() const; + int listIndexAtPoint(const WebCore::IntPoint&) const; + bool setFocusedIndex(int index, bool hotTracking = false); + int focusedIndex() const; + void focusFirst(); + void focusLast(); + bool scrollToRevealSelection(); + void incrementWheelDelta(int delta); + void reduceWheelDelta(int delta); + + WebView* m_webView; + Vector<WebPopupItem> m_items; + PlatformPopupMenuData m_data; + int m_newSelectedIndex; + + RefPtr<WebCore::Scrollbar> m_scrollbar; + HWND m_popup; + HDC m_DC; + HBITMAP m_bmp; + WebCore::IntRect m_windowRect; + + int m_itemHeight; + int m_scrollOffset; + int m_wheelDelta; + int m_focusedIndex; + bool m_wasClicked; + bool m_scrollbarCapturingMouse; + bool m_showPopup; +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxyWin_h diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp new file mode 100644 index 0000000..4b3992c --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebView.cpp @@ -0,0 +1,1085 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebView.h" + +#include "ChunkedUpdateDrawingAreaProxy.h" +#include "FindIndicator.h" +#include "LayerBackedDrawingAreaProxy.h" +#include "Logging.h" +#include "RunLoop.h" +#include "NativeWebKeyboardEvent.h" +#include "WebContext.h" +#include "WebContextMenuProxyWin.h" +#include "WebEditCommandProxy.h" +#include "WebEventFactory.h" +#include "WebPageProxy.h" +#include "WebPopupMenuProxyWin.h" +#include <Commctrl.h> +#include <WebCore/Cursor.h> +#include <WebCore/FloatRect.h> +#include <WebCore/IntRect.h> +#include <WebCore/SoftLinking.h> +#include <WebCore/WebCoreInstanceHandle.h> +#include <WebCore/WindowMessageBroadcaster.h> +#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)) +}; + +using namespace WebCore; + +namespace WebKit { + +static const LPCWSTR kWebKit2WebViewWindowClassName = L"WebKit2WebViewWindowClass"; + +// Constants not available on all platforms. +const int WM_XP_THEMECHANGED = 0x031A; +const int WM_VISTA_MOUSEHWHEEL = 0x020E; + +static const int kMaxToolTipWidth = 250; + +enum { + UpdateActiveStateTimer = 1, +}; + +LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); + + if (WebView* webView = reinterpret_cast<WebView*>(longPtr)) + return webView->wndProc(hWnd, message, wParam, lParam); + + if (message == WM_CREATE) { + LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); + + // Associate the WebView with the window. + ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); + return 0; + } + + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult = 0; + 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; + } + + if (!handled) + lResult = ::DefWindowProc(hWnd, message, wParam, lParam); + + return lResult; +} + +bool WebView::registerWebViewWindowClass() +{ + static bool haveRegisteredWindowClass = false; + if (haveRegisteredWindowClass) + return true; + haveRegisteredWindowClass = true; + + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_DBLCLKS; + wcex.lpfnWndProc = WebView::WebViewWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(WebView*); + wcex.hInstance = instanceHandle(); + wcex.hIcon = 0; + wcex.hCursor = ::LoadCursor(0, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = 0; + wcex.lpszClassName = kWebKit2WebViewWindowClassName; + wcex.hIconSm = 0; + + return !!::RegisterClassEx(&wcex); +} + +WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow) + : m_topLevelParentWindow(0) + , m_toolTipWindow(0) + , m_lastCursorSet(0) + , m_webCoreCursor(0) + , m_overrideCursor(0) + , m_trackingMouseLeave(false) + , m_isInWindow(false) + , m_isVisible(false) + , m_wasActivatedByMouseEvent(false) + , m_isBeingDestroyed(false) + , m_inIMEComposition(0) +{ + registerWebViewWindowClass(); + + m_page = context->createWebPage(this, pageGroup); + + m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this); + ASSERT(::IsWindow(m_window)); + + m_page->initializeWebPage(); + + ::ShowWindow(m_window, SW_SHOW); + + // FIXME: Initializing the tooltip window here matches WebKit win, but seems like something + // we could do on demand to save resources. + initializeToolTipWindow(); + + // Initialize the top level parent window and register it with the WindowMessageBroadcaster. + windowAncestryDidChange(); +} + +WebView::~WebView() +{ + // Tooltip window needs to be explicitly destroyed since it isn't a WS_CHILD. + if (::IsWindow(m_toolTipWindow)) + ::DestroyWindow(m_toolTipWindow); +} + +void WebView::setParentWindow(HWND parentWindow) +{ + if (m_window) { + // If the host window hasn't changed, bail. + if (::GetParent(m_window) == parentWindow) + return; + if (parentWindow) + ::SetParent(m_window, parentWindow); + else if (!m_isBeingDestroyed) { + // Turn the WebView into a message-only window so it will no longer be a child of the + // old parent window and will be hidden from screen. We only do this when + // isBeingDestroyed() is false because doing this while handling WM_DESTROY can leave + // m_window in a weird state (see <http://webkit.org/b/29337>). + ::SetParent(m_window, HWND_MESSAGE); + } + } + + windowAncestryDidChange(); +} + +static HWND findTopLevelParentWindow(HWND window) +{ + if (!window) + return 0; + + HWND current = window; + for (HWND parent = GetParent(current); current; current = parent, parent = GetParent(parent)) { + if (!parent || !(GetWindowLongPtr(current, GWL_STYLE) & (WS_POPUP | WS_CHILD))) + return current; + } + ASSERT_NOT_REACHED(); + return 0; +} + +void WebView::windowAncestryDidChange() +{ + HWND newTopLevelParentWindow; + if (m_window) + newTopLevelParentWindow = findTopLevelParentWindow(m_window); + else { + // There's no point in tracking active state changes of our parent window if we don't have + // a window ourselves. + newTopLevelParentWindow = 0; + } + + if (newTopLevelParentWindow == m_topLevelParentWindow) + return; + + if (m_topLevelParentWindow) + WindowMessageBroadcaster::removeListener(m_topLevelParentWindow, this); + + m_topLevelParentWindow = newTopLevelParentWindow; + + if (m_topLevelParentWindow) + WindowMessageBroadcaster::addListener(m_topLevelParentWindow, this); + + updateActiveState(); +} + +LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(hWnd, message, wParam, lParam, m_wasActivatedByMouseEvent); + 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(); + } + + m_page->handleMouseEvent(mouseEvent); + + handled = true; + return 0; +} + +LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + WebWheelEvent wheelEvent = WebEventFactory::createWebWheelEvent(hWnd, message, wParam, lParam); + if (wheelEvent.controlKey()) { + // We do not want WebKit to handle Control + Wheel, this should be handled by the client application + // to zoom the page. + handled = false; + return 0; + } + + m_page->handleWheelEvent(wheelEvent); + + handled = true; + return 0; +} + +LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + m_page->handleKeyboardEvent(NativeWebKeyboardEvent(hWnd, message, wParam, lParam)); + + // We claim here to always have handled the event. If the event is not in fact handled, we will + // find out later in didNotHandleKeyEvent. + handled = true; + return 0; +} + +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)); + } + + ::EndPaint(m_window, &paintStruct); + + handled = true; + return 0; +} + +LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled) +{ + HDC hdc = reinterpret_cast<HDC>(wParam); + RECT winRect; + ::GetClientRect(hWnd, &winRect); + IntRect rect = winRect; + + m_page->drawingArea()->paint(rect, hdc); + + handled = true; + return 0; +} + +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)); + + handled = true; + return 0; +} + +LRESULT WebView::onWindowPositionChangedEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) +{ + if (reinterpret_cast<WINDOWPOS*>(lParam)->flags & SWP_SHOWWINDOW) + updateActiveStateSoon(); + + handled = false; + return 0; +} + +LRESULT WebView::onSetFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) +{ + m_page->viewStateDidChange(WebPageProxy::ViewIsFocused); + handled = true; + return 0; +} + +LRESULT WebView::onKillFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) +{ + m_page->viewStateDidChange(WebPageProxy::ViewIsFocused); + handled = true; + return 0; +} + +LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled) +{ + switch (wParam) { + case UpdateActiveStateTimer: + ::KillTimer(hWnd, UpdateActiveStateTimer); + updateActiveState(); + break; + } + + handled = true; + return 0; +} + +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? + if (!lParam) { + m_isVisible = wParam; + m_page->viewStateDidChange(WebPageProxy::ViewIsVisible); + + handled = true; + } + + return 0; +} + +LRESULT WebView::onSetCursor(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) +{ + if (!m_lastCursorSet) { + handled = false; + return 0; + } + + ::SetCursor(m_lastCursorSet); + return 0; +} + +void WebView::updateActiveState() +{ + m_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); +} + +void WebView::updateActiveStateSoon() +{ + // This function is called while processing the WM_NCACTIVATE message. + // While processing WM_NCACTIVATE when we are being deactivated, GetActiveWindow() will + // still return our window. If we were to call updateActiveState() in that case, we would + // wrongly think that we are still the active window. To work around this, we update our + // active state after a 0-delay timer fires, at which point GetActiveWindow() will return + // the newly-activated window. + + ::SetTimer(m_window, UpdateActiveStateTimer, 0, 0); +} + +static bool initCommonControls() +{ + static bool haveInitialized = false; + if (haveInitialized) + return true; + + INITCOMMONCONTROLSEX init; + init.dwSize = sizeof(init); + init.dwICC = ICC_TREEVIEW_CLASSES; + haveInitialized = !!::InitCommonControlsEx(&init); + return haveInitialized; +} + +void WebView::initializeToolTipWindow() +{ + if (!initCommonControls()) + return; + + m_toolTipWindow = ::CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, 0, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + m_window, 0, 0, 0); + if (!m_toolTipWindow) + return; + + TOOLINFO info = {0}; + info.cbSize = sizeof(info); + info.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + info.uId = reinterpret_cast<UINT_PTR>(m_window); + + ::SendMessage(m_toolTipWindow, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&info)); + ::SendMessage(m_toolTipWindow, TTM_SETMAXTIPWIDTH, 0, kMaxToolTipWidth); + ::SetWindowPos(m_toolTipWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); +} + +void WebView::startTrackingMouseLeave() +{ + if (m_trackingMouseLeave) + return; + m_trackingMouseLeave = true; + + TRACKMOUSEEVENT trackMouseEvent; + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE; + trackMouseEvent.hwndTrack = m_window; + + ::TrackMouseEvent(&trackMouseEvent); +} + +void WebView::stopTrackingMouseLeave() +{ + if (!m_trackingMouseLeave) + return; + m_trackingMouseLeave = false; + + TRACKMOUSEEVENT trackMouseEvent; + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE | TME_CANCEL; + trackMouseEvent.hwndTrack = m_window; + + ::TrackMouseEvent(&trackMouseEvent); +} + +void WebView::close() +{ + setParentWindow(0); + m_page->close(); +} + +// PageClient + +PassOwnPtr<DrawingAreaProxy> WebView::createDrawingAreaProxy() +{ + return ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); +} + +void WebView::setViewNeedsDisplay(const WebCore::IntRect& rect) +{ + RECT r = rect; + ::InvalidateRect(m_window, &r, false); +} + +void WebView::displayView() +{ + ::UpdateWindow(m_window); +} + +WebCore::IntSize WebView::viewSize() +{ + RECT clientRect; + GetClientRect(m_window, &clientRect); + + return IntRect(clientRect).size(); +} + +bool WebView::isViewWindowActive() +{ + HWND activeWindow = ::GetActiveWindow(); + return (activeWindow && m_topLevelParentWindow == findTopLevelParentWindow(activeWindow)); +} + +bool WebView::isViewFocused() +{ + return ::GetFocus() == m_window; +} + +bool WebView::isViewVisible() +{ + return m_isVisible; +} + +bool WebView::isViewInWindow() +{ + return m_isInWindow; +} + +void WebView::processDidCrash() +{ + updateNativeCursor(); + ::InvalidateRect(m_window, 0, TRUE); +} + +void WebView::didRelaunchProcess() +{ + updateNativeCursor(); + ::InvalidateRect(m_window, 0, TRUE); +} + +void WebView::takeFocus(bool) +{ +} + +void WebView::toolTipChanged(const String&, const String& newToolTip) +{ + if (!m_toolTipWindow) + return; + + if (!newToolTip.isEmpty()) { + // This is necessary because String::charactersWithNullTermination() is not const. + String toolTip = newToolTip; + + TOOLINFO info = {0}; + info.cbSize = sizeof(info); + info.uFlags = TTF_IDISHWND; + info.uId = reinterpret_cast<UINT_PTR>(m_window); + info.lpszText = const_cast<UChar*>(toolTip.charactersWithNullTermination()); + ::SendMessage(m_toolTipWindow, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info)); + } + + ::SendMessage(m_toolTipWindow, TTM_ACTIVATE, !newToolTip.isEmpty(), 0); +} + +HCURSOR WebView::cursorToShow() const +{ + if (!m_page->isValid()) + return 0; + + // We only show the override cursor if the default (arrow) cursor is showing. + static HCURSOR arrowCursor = ::LoadCursor(0, IDC_ARROW); + if (m_overrideCursor && m_webCoreCursor == arrowCursor) + return m_overrideCursor; + + return m_webCoreCursor; +} + +void WebView::updateNativeCursor() +{ + m_lastCursorSet = cursorToShow(); + if (!m_lastCursorSet) + return; + ::SetCursor(m_lastCursorSet); +} + +void WebView::setCursor(const WebCore::Cursor& cursor) +{ + if (!cursor.platformCursor()->nativeCursor()) + return; + m_webCoreCursor = cursor.platformCursor()->nativeCursor(); + updateNativeCursor(); +} + +void WebView::setOverrideCursor(HCURSOR overrideCursor) +{ + m_overrideCursor = overrideCursor; + updateNativeCursor(); +} + +void WebView::setInitialFocus(bool forward) +{ + m_page->setInitialFocus(forward); +} + +void WebView::setViewportArguments(const WebCore::ViewportArguments&) +{ +} + +void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) +{ +} + +void WebView::clearAllEditCommands() +{ +} + +void WebView::setEditCommandState(const String&, bool, int) +{ +} + +FloatRect WebView::convertToDeviceSpace(const FloatRect& rect) +{ + return rect; +} + +FloatRect WebView::convertToUserSpace(const FloatRect& rect) +{ + return rect; +} + +HIMC WebView::getIMMContext() +{ + return Ime::ImmGetContext(m_window); +} + +void WebView::prepareCandidateWindow(HIMC hInputContext) +{ + IntRect caret = m_page->firstRectForCharacterInSelectedRange(0); + CANDIDATEFORM form; + form.dwIndex = 0; + form.dwStyle = CFS_EXCLUDE; + form.ptCurrentPos.x = caret.x(); + form.ptCurrentPos.y = caret.bottom(); + form.rcArea.top = caret.y(); + form.rcArea.bottom = caret.bottom(); + form.rcArea.left = caret.x(); + form.rcArea.right = caret.right(); + Ime::ImmSetCandidateWindow(hInputContext, &form); +} + +void WebView::resetIME() +{ + HIMC hInputContext = getIMMContext(); + if (!hInputContext) + return; + Ime::ImmNotifyIME(hInputContext, NI_COMPOSITIONSTR, CPS_CANCEL, 0); + Ime::ImmReleaseContext(m_window, hInputContext); +} + +void WebView::setInputMethodState(bool enabled) +{ + Ime::ImmAssociateContextEx(m_window, 0, enabled ? IACE_DEFAULT : 0); +} + +void WebView::compositionSelectionChanged(bool hasChanged) +{ + if (m_page->selectionState().hasComposition && !hasChanged) + resetIME(); +} + +bool WebView::onIMEStartComposition() +{ + LOG(TextInput, "onIMEStartComposition"); + m_inIMEComposition++; + + HIMC hInputContext = getIMMContext(); + if (!hInputContext) + return false; + prepareCandidateWindow(hInputContext); + Ime::ImmReleaseContext(m_window, hInputContext); + return true; +} + +static bool getCompositionString(HIMC hInputContext, DWORD type, String& result) +{ + LONG compositionLength = Ime::ImmGetCompositionStringW(hInputContext, type, 0, 0); + if (compositionLength <= 0) + return false; + Vector<UChar> compositionBuffer(compositionLength / 2); + compositionLength = Ime::ImmGetCompositionStringW(hInputContext, type, compositionBuffer.data(), compositionLength); + result = String::adopt(compositionBuffer); + return true; +} + +static void compositionToUnderlines(const Vector<DWORD>& clauses, const Vector<BYTE>& attributes, Vector<CompositionUnderline>& underlines) +{ + if (clauses.isEmpty()) { + underlines.clear(); + return; + } + + size_t numBoundaries = clauses.size() - 1; + underlines.resize(numBoundaries); + for (unsigned i = 0; i < numBoundaries; ++i) { + underlines[i].startOffset = clauses[i]; + underlines[i].endOffset = clauses[i + 1]; + BYTE attribute = attributes[clauses[i]]; + underlines[i].thick = attribute == ATTR_TARGET_CONVERTED || attribute == ATTR_TARGET_NOTCONVERTED; + underlines[i].color = Color::black; + } +} + +#if !LOG_DISABLED +#define APPEND_ARGUMENT_NAME(name) \ + if (lparam & name) { \ + if (needsComma) \ + result += ", "; \ + result += #name; \ + needsComma = true; \ + } + +static String imeCompositionArgumentNames(LPARAM lparam) +{ + String result; + bool needsComma = false; + + APPEND_ARGUMENT_NAME(GCS_COMPATTR); + APPEND_ARGUMENT_NAME(GCS_COMPCLAUSE); + APPEND_ARGUMENT_NAME(GCS_COMPREADSTR); + APPEND_ARGUMENT_NAME(GCS_COMPREADATTR); + APPEND_ARGUMENT_NAME(GCS_COMPREADCLAUSE); + APPEND_ARGUMENT_NAME(GCS_COMPSTR); + APPEND_ARGUMENT_NAME(GCS_CURSORPOS); + APPEND_ARGUMENT_NAME(GCS_DELTASTART); + APPEND_ARGUMENT_NAME(GCS_RESULTCLAUSE); + APPEND_ARGUMENT_NAME(GCS_RESULTREADCLAUSE); + APPEND_ARGUMENT_NAME(GCS_RESULTREADSTR); + APPEND_ARGUMENT_NAME(GCS_RESULTSTR); + APPEND_ARGUMENT_NAME(CS_INSERTCHAR); + APPEND_ARGUMENT_NAME(CS_NOMOVECARET); + + return result; +} + +static String imeRequestName(WPARAM wparam) +{ + switch (wparam) { + case IMR_CANDIDATEWINDOW: + return "IMR_CANDIDATEWINDOW"; + case IMR_COMPOSITIONFONT: + return "IMR_COMPOSITIONFONT"; + case IMR_COMPOSITIONWINDOW: + return "IMR_COMPOSITIONWINDOW"; + case IMR_CONFIRMRECONVERTSTRING: + return "IMR_CONFIRMRECONVERTSTRING"; + case IMR_DOCUMENTFEED: + return "IMR_DOCUMENTFEED"; + case IMR_QUERYCHARPOSITION: + return "IMR_QUERYCHARPOSITION"; + case IMR_RECONVERTSTRING: + return "IMR_RECONVERTSTRING"; + default: + return "Unknown (" + String::number(wparam) + ")"; + } +} +#endif + +bool WebView::onIMEComposition(LPARAM lparam) +{ + LOG(TextInput, "onIMEComposition %s", imeCompositionArgumentNames(lparam).latin1().data()); + HIMC hInputContext = getIMMContext(); + if (!hInputContext) + return true; + + if (!m_page->selectionState().isContentEditable) + return true; + + prepareCandidateWindow(hInputContext); + + if (lparam & GCS_RESULTSTR || !lparam) { + String compositionString; + if (!getCompositionString(hInputContext, GCS_RESULTSTR, compositionString) && lparam) + return true; + + m_page->confirmComposition(compositionString); + return true; + } + + String compositionString; + if (!getCompositionString(hInputContext, GCS_COMPSTR, compositionString)) + return true; + + // Composition string attributes + int numAttributes = Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPATTR, 0, 0); + Vector<BYTE> attributes(numAttributes); + Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPATTR, attributes.data(), numAttributes); + + // Get clauses + int numBytes = Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPCLAUSE, 0, 0); + Vector<DWORD> clauses(numBytes / sizeof(DWORD)); + Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPCLAUSE, clauses.data(), numBytes); + + Vector<CompositionUnderline> underlines; + compositionToUnderlines(clauses, attributes, underlines); + + int cursorPosition = LOWORD(Ime::ImmGetCompositionStringW(hInputContext, GCS_CURSORPOS, 0, 0)); + + m_page->setComposition(compositionString, underlines, cursorPosition); + + return true; +} + +bool WebView::onIMEEndComposition() +{ + LOG(TextInput, "onIMEEndComposition"); + // If the composition hasn't been confirmed yet, it needs to be cancelled. + // This happens after deleting the last character from inline input hole. + if (m_page->selectionState().hasComposition) + m_page->confirmComposition(String()); + + if (m_inIMEComposition) + m_inIMEComposition--; + + return true; +} + +LRESULT WebView::onIMERequestCharPosition(IMECHARPOSITION* charPos) +{ + if (charPos->dwCharPos && !m_page->selectionState().hasComposition) + return 0; + IntRect caret = m_page->firstRectForCharacterInSelectedRange(charPos->dwCharPos); + charPos->pt.x = caret.x(); + charPos->pt.y = caret.y(); + ::ClientToScreen(m_window, &charPos->pt); + charPos->cLineHeight = caret.height(); + ::GetWindowRect(m_window, &charPos->rcDocument); + return true; +} + +LRESULT WebView::onIMERequestReconvertString(RECONVERTSTRING* reconvertString) +{ + String text = m_page->getSelectedText(); + unsigned totalSize = sizeof(RECONVERTSTRING) + text.length() * sizeof(UChar); + + if (!reconvertString) + return totalSize; + + if (totalSize > reconvertString->dwSize) + return 0; + reconvertString->dwCompStrLen = text.length(); + reconvertString->dwStrLen = text.length(); + reconvertString->dwTargetStrLen = text.length(); + reconvertString->dwStrOffset = sizeof(RECONVERTSTRING); + memcpy(reconvertString + 1, text.characters(), text.length() * sizeof(UChar)); + return totalSize; +} + +LRESULT WebView::onIMERequest(WPARAM request, LPARAM data) +{ + LOG(TextInput, "onIMERequest %s", imeRequestName(request).latin1().data()); + if (!m_page->selectionState().isContentEditable) + return 0; + + switch (request) { + case IMR_RECONVERTSTRING: + return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data)); + + case IMR_QUERYCHARPOSITION: + return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data)); + } + return 0; +} + +bool WebView::onIMESelect(WPARAM wparam, LPARAM lparam) +{ + UNUSED_PARAM(wparam); + UNUSED_PARAM(lparam); + LOG(TextInput, "onIMESelect locale %ld %s", lparam, wparam ? "select" : "deselect"); + return false; +} + +bool WebView::onIMESetContext(WPARAM wparam, LPARAM) +{ + LOG(TextInput, "onIMESetContext %s", wparam ? "active" : "inactive"); + return false; +} + +void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event) +{ + // 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); +} + +PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy* page) +{ + return WebPopupMenuProxyWin::create(this, page); +} + +PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy* page) +{ + return WebContextMenuProxyWin::create(m_window, page); +} + +void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) +{ + // FIXME: Implement. +} + +void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation) +{ +} + +void WebView::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) +{ +} + +double WebView::customRepresentationZoomFactor() +{ + return 1; +} + +void WebView::setCustomRepresentationZoomFactor(double) +{ +} + +void WebView::setIsInWindow(bool isInWindow) +{ + m_isInWindow = isInWindow; + m_page->viewStateDidChange(WebPageProxy::ViewIsInWindow); +} + +#if USE(ACCELERATED_COMPOSITING) + +void WebView::pageDidEnterAcceleratedCompositing() +{ + switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::LayerBacked); +} + +void WebView::pageDidLeaveAcceleratedCompositing() +{ + switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::ChunkedUpdate); +} + +void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type) +{ + 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; + } + + if (m_page->drawingArea()) + newDrawingArea->setSize(m_page->drawingArea()->size()); + + m_page->drawingArea()->detachCompositingContext(); + m_page->setDrawingArea(newDrawingArea.release()); +} + +#endif // USE(ACCELERATED_COMPOSITING) + +HWND WebView::nativeWindow() +{ + return m_window; +} + +// WebCore::WindowMessageListener + +void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM) +{ + switch (message) { + case WM_NCACTIVATE: + updateActiveStateSoon(); + break; + case WM_SETTINGCHANGE: + // systemParameterChanged(wParam); + break; + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h new file mode 100644 index 0000000..c80334e --- /dev/null +++ b/Source/WebKit2/UIProcess/win/WebView.h @@ -0,0 +1,170 @@ +/* + * 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 WebView_h +#define WebView_h + +#include "APIObject.h" +#include "PageClient.h" +#include "WebPageProxy.h" +#include <WebCore/WindowMessageListener.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class DrawingAreaProxy; + +class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener { +public: + static PassRefPtr<WebView> create(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND parentWindow) + { + return adoptRef(new WebView(rect, context, pageGroup, parentWindow)); + } + ~WebView(); + + HWND window() const { return m_window; } + void setParentWindow(HWND); + void windowAncestryDidChange(); + void setIsInWindow(bool); + void setOverrideCursor(HCURSOR overrideCursor); + void setInitialFocus(bool forward); + + WebPageProxy* page() const { return m_page.get(); } + +private: + WebView(RECT, WebContext*, WebPageGroup*, HWND parentWindow); + + virtual Type type() const { return TypeView; } + + static bool registerWebViewWindowClass(); + 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); + LRESULT onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onPrintClientEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onSizeEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onWindowPositionChangedEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onSetFocusEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + LRESULT onKillFocusEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); + 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); + bool onIMEStartComposition(); + bool onIMEComposition(LPARAM); + bool onIMEEndComposition(); + LRESULT onIMERequest(WPARAM, LPARAM); + bool onIMESelect(WPARAM, LPARAM); + bool onIMESetContext(WPARAM, LPARAM); + void resetIME(); + void setInputMethodState(bool); + HIMC getIMMContext(); + void prepareCandidateWindow(HIMC); + LRESULT onIMERequestCharPosition(IMECHARPOSITION*); + LRESULT onIMERequestReconvertString(RECONVERTSTRING*); + + void updateActiveState(); + void updateActiveStateSoon(); + + void initializeToolTipWindow(); + + void startTrackingMouseLeave(); + void stopTrackingMouseLeave(); + + void close(); + + HCURSOR cursorToShow() const; + void updateNativeCursor(); + + // PageClient + virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); + virtual void setViewNeedsDisplay(const WebCore::IntRect&); + virtual void displayView(); + + virtual WebCore::IntSize viewSize(); + virtual bool isViewWindowActive(); + virtual bool isViewFocused(); + virtual bool isViewVisible(); + virtual bool isViewInWindow(); + virtual void processDidCrash(); + virtual void didRelaunchProcess(); + virtual void takeFocus(bool direction); + virtual void toolTipChanged(const WTF::String&, const WTF::String&); + virtual void setCursor(const WebCore::Cursor&); + virtual void setViewportArguments(const WebCore::ViewportArguments&); + virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); + virtual void clearAllEditCommands(); + 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 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 pageDidEnterAcceleratedCompositing(); + virtual void pageDidLeaveAcceleratedCompositing(); + void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type); +#endif + + void didCommitLoadForMainFrame(bool useCustomRepresentation); + void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&); + virtual double customRepresentationZoomFactor(); + virtual void setCustomRepresentationZoomFactor(double); + + virtual HWND nativeWindow(); + + // WebCore::WindowMessageListener + virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM); + + HWND m_window; + HWND m_topLevelParentWindow; + HWND m_toolTipWindow; + + HCURSOR m_lastCursorSet; + HCURSOR m_webCoreCursor; + HCURSOR m_overrideCursor; + + bool m_isInWindow; + bool m_isVisible; + bool m_wasActivatedByMouseEvent; + bool m_trackingMouseLeave; + bool m_isBeingDestroyed; + + RefPtr<WebPageProxy> m_page; + + unsigned m_inIMEComposition; +}; + +} // namespace WebKit + +#endif // WebView_h diff --git a/Source/WebKit2/WebKit2.pri b/Source/WebKit2/WebKit2.pri new file mode 100644 index 0000000..da08ea8 --- /dev/null +++ b/Source/WebKit2/WebKit2.pri @@ -0,0 +1,48 @@ +# WebKit2 - Qt4 build info + +QT += network + +# Use a config-specific target to prevent parallel builds file clashes on Mac +mac: CONFIG(debug, debug|release): WEBKIT2_TARGET = webkit2d +else: WEBKIT2_TARGET = webkit2 + +# Output in WebKit2/<config> +CONFIG(debug, debug|release) : WEBKIT2_DESTDIR = debug +else: WEBKIT2_DESTDIR = release + +defineTest(_addWebKit2Lib_common) { + pathToWebKit2Output = $$ARGS/$$WEBKIT2_DESTDIR + + QMAKE_LIBDIR += $$pathToWebKit2Output + + POST_TARGETDEPS += $${pathToWebKit2Output}$${QMAKE_DIR_SEP}lib$${WEBKIT2_TARGET}.a + + # The following line is to prevent qmake from adding webkit2 to libQtWebKit's prl dependencies. + CONFIG -= explicitlib + + export(QMAKE_LIBDIR) + export(POST_TARGETDEPS) + export(CONFIG) + + return(true) +} + +defineTest(addWebKit2Lib) { + _addWebKit2Lib_common($$ARGS) + + LIBS += -l$$WEBKIT2_TARGET + export(LIBS) + + return(true) +} + +defineTest(addWebKit2LibWholeArchive) { + _addWebKit2Lib_common($$ARGS) + + # -whole-archive makes all objects, even if unreferenced, included in the linked target. + mac: LIBS += -Wl,-all_load -l$$WEBKIT2_TARGET + else: LIBS += -Wl,-whole-archive -l$$WEBKIT2_TARGET -Wl,-no-whole-archive + export(LIBS) + + return(true) +} diff --git a/Source/WebKit2/WebKit2.pro b/Source/WebKit2/WebKit2.pro new file mode 100644 index 0000000..f4e007b --- /dev/null +++ b/Source/WebKit2/WebKit2.pro @@ -0,0 +1,696 @@ +# WebKit2 - Qt4 build info + +CONFIG += building-libs +CONFIG += depend_includepath + +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. + +CONFIG(standalone_package) { + isEmpty(WEBKIT2_GENERATED_SOURCES_DIR):WEBKIT2_GENERATED_SOURCES_DIR = $$PWD/generated + isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/../../Source/WebCore/generated +} else { + isEmpty(WEBKIT2_GENERATED_SOURCES_DIR):WEBKIT2_GENERATED_SOURCES_DIR = generated + isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = ../../Source/WebCore/generated +} + +include($$PWD/../../WebKit.pri) +include($$PWD/../../common.pri) +include($$PWD/../../Source/WebCore/features.pri) +include(WebKit2.pri) + +TEMPLATE = lib +CONFIG += staticlib +TARGET = $$WEBKIT2_TARGET +DESTDIR = $$WEBKIT2_DESTDIR + +!CONFIG(release, debug|release) { + OBJECTS_DIR = obj/debug +} else { # Release + OBJECTS_DIR = obj/release + DEFINES += NDEBUG +} + +# Build both debug and release configurations +mac: CONFIG += build_all + +WEBKIT2_INCLUDEPATH = \ + $$PWD/../.. \ # FIXME: Remove this include once we move all the source to Source. + $$PWD/../../Source \ + +WEBKIT2_INCLUDEPATH = \ + $$PWD/../../Source/JavaScriptCore \ + $$PWD/../../Source/JavaScriptCore/assembler \ + $$PWD/../../Source/JavaScriptCore/bytecode \ + $$PWD/../../Source/JavaScriptCore/bytecompiler \ + $$PWD/../../Source/JavaScriptCore/debugger \ + $$PWD/../../Source/JavaScriptCore/interpreter \ + $$PWD/../../Source/JavaScriptCore/jit \ + $$PWD/../../Source/JavaScriptCore/parser \ + $$PWD/../../Source/JavaScriptCore/pcre \ + $$PWD/../../Source/JavaScriptCore/profiler \ + $$PWD/../../Source/JavaScriptCore/runtime \ + $$PWD/../../Source/JavaScriptCore/wtf \ + $$PWD/../../Source/JavaScriptCore/wtf/symbian \ + $$PWD/../../Source/JavaScriptCore/wtf/unicode \ + $$PWD/../../Source/JavaScriptCore/yarr \ + $$PWD/../../Source/JavaScriptCore/API \ + $$PWD/../../Source/JavaScriptCore/ForwardingHeaders \ + $$WEBKIT2_INCLUDEPATH + +WEBKIT2_INCLUDEPATH = \ + $$PWD/../../Source/WebCore \ + $$PWD/../../Source/WebCore/accessibility \ + $$PWD/../../Source/WebCore/bindings \ + $$PWD/../../Source/WebCore/bindings/generic \ + $$PWD/../../Source/WebCore/bindings/js \ + $$PWD/../../Source/WebCore/bridge \ + $$PWD/../../Source/WebCore/bridge/c \ + $$PWD/../../Source/WebCore/bridge/jsc \ + $$PWD/../../Source/WebCore/css \ + $$PWD/../../Source/WebCore/dom \ + $$PWD/../../Source/WebCore/dom/default \ + $$PWD/../../Source/WebCore/editing \ + $$PWD/../../Source/WebCore/history \ + $$PWD/../../Source/WebCore/html \ + $$PWD/../../Source/WebCore/html/canvas \ + $$PWD/../../Source/WebCore/inspector \ + $$PWD/../../Source/WebCore/loader \ + $$PWD/../../Source/WebCore/loader/appcache \ + $$PWD/../../Source/WebCore/loader/archive \ + $$PWD/../../Source/WebCore/loader/cache \ + $$PWD/../../Source/WebCore/loader/icon \ + $$PWD/../../Source/WebCore/mathml \ + $$PWD/../../Source/WebCore/notifications \ + $$PWD/../../Source/WebCore/page \ + $$PWD/../../Source/WebCore/page/animation \ + $$PWD/../../Source/WebCore/platform \ + $$PWD/../../Source/WebCore/platform/animation \ + $$PWD/../../Source/WebCore/platform/graphics \ + $$PWD/../../Source/WebCore/platform/graphics/filters \ + $$PWD/../../Source/WebCore/platform/graphics/transforms \ + $$PWD/../../Source/WebCore/platform/image-decoders \ + $$PWD/../../Source/WebCore/platform/mock \ + $$PWD/../../Source/WebCore/platform/network \ + $$PWD/../../Source/WebCore/platform/sql \ + $$PWD/../../Source/WebCore/platform/text \ + $$PWD/../../Source/WebCore/platform/text/transcoder \ + $$PWD/../../Source/WebCore/plugins \ + $$PWD/../../Source/WebCore/rendering \ + $$PWD/../../Source/WebCore/rendering/style \ + $$PWD/../../Source/WebCore/storage \ + $$PWD/../../Source/WebCore/svg \ + $$PWD/../../Source/WebCore/svg/animation \ + $$PWD/../../Source/WebCore/svg/graphics \ + $$PWD/../../Source/WebCore/svg/graphics/filters \ + $$PWD/../../Source/WebCore/svg/properties \ + $$PWD/../../Source/WebCore/websockets \ + $$PWD/../../Source/WebCore/wml \ + $$PWD/../../Source/WebCore/workers \ + $$PWD/../../Source/WebCore/xml \ + $$WEBKIT2_INCLUDEPATH + +WEBKIT2_INCLUDEPATH = \ + $$PWD/../../Source/WebCore/bridge/qt \ + $$PWD/../../Source/WebCore/page/qt \ + $$PWD/../../Source/WebCore/platform/graphics/qt \ + $$PWD/../../Source/WebCore/platform/network/qt \ + $$PWD/../../Source/WebCore/platform/qt \ + $$PWD/../../WebKit/qt/Api \ + $$PWD/../../WebKit/qt/WebCoreSupport \ + $$WEBKIT2_INCLUDEPATH + +WEBKIT2_INCLUDEPATH = \ + $$PWD \ + Platform \ + Platform/CoreIPC \ + Platform/qt \ + Shared \ + Shared/API/c \ + Shared/CoreIPCSupport \ + Shared/Plugins \ + Shared/Plugins/Netscape \ + Shared/qt \ + UIProcess \ + UIProcess/API/C \ + UIProcess/API/cpp \ + UIProcess/API/cpp/qt \ + UIProcess/API/qt \ + UIProcess/Authentication \ + UIProcess/Downloads \ + UIProcess/Launcher \ + UIProcess/Plugins \ + UIProcess/qt \ + WebProcess \ + WebProcess/Authentication \ + WebProcess/Downloads \ + WebProcess/Downloads/qt \ + WebProcess/Geolocation \ + WebProcess/InjectedBundle \ + WebProcess/InjectedBundle/DOM \ + WebProcess/InjectedBundle/API/c \ + WebProcess/Plugins \ + WebProcess/Plugins/Netscape \ + WebProcess/WebCoreSupport \ + WebProcess/WebCoreSupport/qt \ + WebProcess/WebPage \ + WebProcess/qt \ + $$WEBKIT2_INCLUDEPATH + +WEBKIT2_INCLUDEPATH += \ + $$OUTPUT_DIR/include \ + $$WC_GENERATED_SOURCES_DIR \ + $$WEBKIT2_GENERATED_SOURCES_DIR \ + $$WEBKIT2_INCLUDEPATH + +# On Symbian PREPEND_INCLUDEPATH is the best way to make sure that WebKit headers +# are included before platform headers. + +symbian { + PREPEND_INCLUDEPATH = $$WEBKIT2_INCLUDEPATH $$PREPEND_INCLUDEPATH +} else { + INCLUDEPATH = $$WEBKIT2_INCLUDEPATH $$INCLUDEPATH +} + +PREFIX_HEADER = $$PWD/../../Source/WebKit2/WebKit2Prefix.h +*-g++*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER" + +WEBKIT2_GENERATED_HEADERS = \ + $$WEBKIT2_GENERATED_SOURCES_DIR/AuthenticationManagerMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebContextMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebDatabaseManagerMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebDatabaseManagerProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebGeolocationManagerMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebGeolocationManagerProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebInspectorMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebInspectorProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebPageMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebPageProxyMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessConnectionMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessMessages.h \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessProxyMessages.h + +WEBKIT2_GENERATED_SOURCES = \ + $$WEBKIT2_GENERATED_SOURCES_DIR/AuthenticationManagerMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebContextMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebDatabaseManagerMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebDatabaseManagerProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebGeolocationManagerMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebGeolocationManagerProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebInspectorMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebInspectorProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebPageMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebPageProxyMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessConnectionMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessMessageReceiver.cpp \ + $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessProxyMessageReceiver.cpp + +HEADERS += \ + Platform/CoreIPC/ArgumentDecoder.h \ + Platform/CoreIPC/ArgumentEncoder.h \ + Platform/CoreIPC/Arguments.h \ + Platform/CoreIPC/Attachment.h \ + Platform/CoreIPC/BinarySemaphore.h \ + Platform/CoreIPC/Connection.h \ + Platform/CoreIPC/CoreIPCMessageKinds.h \ + Platform/CoreIPC/DataReference.h \ + Platform/CoreIPC/HandleMessage.h \ + Platform/CoreIPC/MessageID.h \ + Platform/CoreIPC/MessageSender.h \ + Platform/Logging.h \ + Platform/Module.h \ + Platform/PlatformProcessIdentifier.h \ + Platform/RunLoop.h \ + 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/WKImage.h \ + Shared/API/c/WKNumber.h \ + Shared/API/c/WKPageLoadTypes.h \ + Shared/API/c/WKSecurityOrigin.h \ + Shared/API/c/WKSerializedScriptValue.h \ + Shared/API/c/WKSharedAPICast.h \ + Shared/API/c/WKString.h \ + Shared/API/c/WKStringPrivate.h \ + Shared/API/c/WKType.h \ + Shared/API/c/WKURL.h \ + Shared/API/c/WKURLRequest.h \ + Shared/API/c/WKURLResponse.h \ + Shared/API/c/WKUserContentURLPattern.h \ + Shared/ShareableBitmap.h \ + Shared/CacheModel.h \ + Shared/ChildProcess.h \ + Shared/CoreIPCSupport/DrawingAreaMessageKinds.h \ + Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h \ + Shared/ImageOptions.h \ + Shared/ImmutableArray.h \ + Shared/ImmutableDictionary.h \ + Shared/MutableArray.h \ + Shared/MutableDictionary.h \ + Shared/NativeWebKeyboardEvent.h \ + Shared/NotImplemented.h \ + Shared/OriginAndDatabases.h \ + Shared/PlatformPopupMenuData.h \ + Shared/PrintInfo.h \ + Shared/SameDocumentNavigationType.h \ + Shared/SessionState.h \ + Shared/StringPairVector.h \ + Shared/UserMessageCoders.h \ + Shared/VisitedLinkTable.h \ + Shared/WebBackForwardListItem.h \ + Shared/WebCertificateInfo.h \ + Shared/WebContextMenuItem.h \ + Shared/WebContextMenuItemData.h \ + Shared/WebError.h \ + Shared/WebEvent.h \ + Shared/WebEventConversion.h \ + Shared/WebFindOptions.h \ + Shared/WebGeolocationPosition.h \ + Shared/WebImage.h \ + Shared/WebNavigationDataStore.h \ + Shared/WebNumber.h \ + Shared/WebOpenPanelParameters.h \ + Shared/WebPageCreationParameters.h \ + Shared/WebPageGroupData.h \ + Shared/WebPopupItem.h \ + Shared/WebPreferencesStore.h \ + Shared/WebProcessCreationParameters.h \ + Shared/WebURLRequest.h \ + 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 \ + UIProcess/API/C/WKAPICast.h \ + UIProcess/API/C/WKAuthenticationChallenge.h \ + UIProcess/API/C/WKAuthenticationDecisionListener.h \ + UIProcess/API/C/WKBackForwardList.h \ + UIProcess/API/C/WKBackForwardListItem.h \ + UIProcess/API/C/WKContext.h \ + UIProcess/API/C/WKContextPrivate.h \ + UIProcess/API/C/WKCredential.h \ + UIProcess/API/C/WKCredentialTypes.h \ + UIProcess/API/C/WKDatabaseManager.h \ + UIProcess/API/C/WKDownload.h \ + UIProcess/API/C/WKFrame.h \ + UIProcess/API/C/WKFramePolicyListener.h \ + UIProcess/API/C/WKGeolocationManager.h \ + UIProcess/API/C/WKGeolocationPermissionRequest.h \ + UIProcess/API/C/WKGeolocationPosition.h \ + UIProcess/API/C/WKInspector.h \ + UIProcess/API/C/WKOpenPanelParameters.h \ + UIProcess/API/C/WKOpenPanelResultListener.h \ + UIProcess/API/C/WKNavigationData.h \ + UIProcess/API/C/WKPage.h \ + UIProcess/API/C/WKPageGroup.h \ + UIProcess/API/C/WKPagePrivate.h \ + UIProcess/API/C/WKPreferences.h \ + UIProcess/API/C/WKPreferencesPrivate.h \ + UIProcess/API/C/WKProtectionSpace.h \ + UIProcess/API/C/WKProtectionSpaceTypes.h \ + UIProcess/API/C/WebKit2.h \ + UIProcess/API/C/qt/WKNativeEvent.h \ + UIProcess/API/cpp/WKRetainPtr.h \ + UIProcess/API/cpp/qt/WKStringQt.h \ + UIProcess/API/cpp/qt/WKURLQt.h \ + UIProcess/API/qt/ClientImpl.h \ + UIProcess/API/qt/qgraphicswkview.h \ + UIProcess/API/qt/qwkcontext.h \ + UIProcess/API/qt/qwkcontext_p.h \ + UIProcess/API/qt/qwkhistory.h \ + UIProcess/API/qt/qwkhistory_p.h \ + UIProcess/API/qt/qwkpage.h \ + UIProcess/API/qt/qwkpage_p.h \ + UIProcess/API/qt/qwkpreferences.h \ + UIProcess/Authentication/AuthenticationChallengeProxy.h \ + UIProcess/Authentication/AuthenticationDecisionListener.h \ + UIProcess/Authentication/WebCredential.h \ + UIProcess/Authentication/WebProtectionSpace.h \ + UIProcess/ChunkedUpdateDrawingAreaProxy.h \ + UIProcess/Downloads/DownloadProxy.h \ + UIProcess/DrawingAreaProxy.h \ + UIProcess/FindIndicator.h \ + UIProcess/GenericCallback.h \ + UIProcess/GeolocationPermissionRequestManagerProxy.h \ + UIProcess/GeolocationPermissionRequestProxy.h \ + UIProcess/Launcher/ProcessLauncher.h \ + UIProcess/Launcher/ThreadLauncher.h \ + UIProcess/PageClient.h \ + UIProcess/Plugins/PluginInfoStore.h \ + UIProcess/ProcessModel.h \ + UIProcess/ResponsivenessTimer.h \ + UIProcess/TextChecker.h \ + UIProcess/TiledDrawingAreaProxy.h \ + UIProcess/VisitedLinkProvider.h \ + UIProcess/WebContext.h \ + UIProcess/WebContextInjectedBundleClient.h \ + UIProcess/WebContextMenuProxy.h \ + UIProcess/WebContextUserMessageCoders.h \ + UIProcess/WebDatabaseManagerProxy.h \ + UIProcess/WebDatabaseManagerProxyClient.h \ + UIProcess/WebDownloadClient.h \ + UIProcess/WebEditCommandProxy.h \ + UIProcess/WebFindClient.h \ + UIProcess/WebFormClient.h \ + UIProcess/WebFormSubmissionListenerProxy.h \ + UIProcess/WebFrameListenerProxy.h \ + UIProcess/WebFramePolicyListenerProxy.h \ + UIProcess/WebFrameProxy.h \ + UIProcess/WebGeolocationManagerProxy.h \ + UIProcess/WebGeolocationProvider.h \ + UIProcess/WebHistoryClient.h \ + UIProcess/WebInspectorProxy.h \ + UIProcess/WebLoaderClient.h \ + UIProcess/WebNavigationData.h \ + UIProcess/WebPageContextMenuClient.h \ + UIProcess/WebOpenPanelResultListenerProxy.h \ + UIProcess/WebPageGroup.h \ + UIProcess/WebPageProxy.h \ + UIProcess/WebPolicyClient.h \ + UIProcess/WebPreferences.h \ + UIProcess/WebProcessManager.h \ + UIProcess/WebProcessProxy.h \ + UIProcess/WebResourceLoadClient.h \ + UIProcess/WebUIClient.h \ + UIProcess/qt/WebContextMenuProxyQt.h \ + UIProcess/qt/WebPopupMenuProxyQt.h \ + WebProcess/Authentication/AuthenticationManager.h \ + WebProcess/Downloads/Download.h \ + WebProcess/Downloads/DownloadManager.h \ + WebProcess/Geolocation/GeolocationPermissionRequestManager.h \ + WebProcess/Geolocation/WebGeolocationManager.h \ + WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \ + WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \ + WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \ + WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ + WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \ + WebProcess/InjectedBundle/API/c/WKBundlePage.h \ + WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h \ + WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h \ + WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h \ + WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h \ + WebProcess/InjectedBundle/InjectedBundle.h \ + WebProcess/InjectedBundle/InjectedBundleClient.h \ + WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ + WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \ + WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \ + WebProcess/InjectedBundle/InjectedBundleScriptWorld.h \ + WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h \ + WebProcess/Plugins/Netscape/JSNPMethod.h \ + WebProcess/Plugins/Netscape/JSNPObject.h \ + WebProcess/Plugins/Netscape/NPJSObject.h \ + WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h \ + WebProcess/Plugins/Netscape/NPRuntimeUtilities.h \ + WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp \ + WebProcess/Plugins/Netscape/NetscapePlugin.h \ + WebProcess/Plugins/Netscape/NetscapePluginStream.h \ + WebProcess/Plugins/Plugin.h \ + WebProcess/Plugins/PluginController.h \ + WebProcess/Plugins/PluginView.h \ + WebProcess/WebCoreSupport/WebChromeClient.h \ + WebProcess/WebCoreSupport/WebContextMenuClient.h \ + WebProcess/WebCoreSupport/WebDatabaseManager.h \ + WebProcess/WebCoreSupport/WebDragClient.h \ + WebProcess/WebCoreSupport/WebEditorClient.h \ + WebProcess/WebCoreSupport/WebErrors.h \ + WebProcess/WebCoreSupport/WebFrameLoaderClient.h \ + WebProcess/WebCoreSupport/WebGeolocationClient.h \ + WebProcess/WebCoreSupport/WebInspectorClient.h \ + WebProcess/WebCoreSupport/WebInspectorFrontendClient.h \ + WebProcess/WebCoreSupport/WebPlatformStrategies.h \ + WebProcess/WebCoreSupport/WebPopupMenu.h \ + WebProcess/WebCoreSupport/WebSearchPopupMenu.h \ + WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h \ + WebProcess/WebPage/ChunkedUpdateDrawingArea.h \ + WebProcess/WebPage/DrawingArea.h \ + WebProcess/WebPage/FindController.h \ + WebProcess/WebPage/PageOverlay.h \ + WebProcess/WebPage/WebContextMenu.h \ + WebProcess/WebPage/WebEditCommand.h \ + WebProcess/WebPage/WebFrame.h \ + WebProcess/WebPage/WebInspector.h \ + WebProcess/WebPage/WebOpenPanelResultListener.h \ + WebProcess/WebPage/WebPage.h \ + WebProcess/WebPage/WebPageGroupProxy.h \ + WebProcess/WebProcess.h \ + $$WEBKIT2_GENERATED_HEADERS + +SOURCES += \ + 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/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 \ + Platform/qt/WorkQueueQt.cpp \ + Shared/API/c/WKArray.cpp \ + Shared/API/c/WKCertificateInfo.cpp \ + Shared/API/c/WKContextMenuItem.cpp \ + Shared/API/c/WKImage.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/Plugins/Netscape/NetscapePluginModule.cpp \ + Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp \ + Shared/ShareableBitmap.cpp \ + Shared/ChildProcess.cpp \ + Shared/ImmutableArray.cpp \ + Shared/ImmutableDictionary.cpp \ + Shared/MutableArray.cpp \ + Shared/MutableDictionary.cpp \ + Shared/OriginAndDatabases.cpp \ + Shared/PlatformPopupMenuData.cpp \ + Shared/PrintInfo.cpp \ + Shared/SessionState.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/WebKeyboardEvent.cpp \ + Shared/WebImage.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/qt/ShareableBitmapQt.cpp \ + Shared/qt/CleanupHandler.cpp \ + Shared/qt/NativeWebKeyboardEventQt.cpp \ + Shared/qt/UpdateChunk.cpp \ + Shared/qt/WebCoreArgumentCodersQt.cpp \ + Shared/qt/WebEventFactoryQt.cpp \ + Shared/qt/WebURLRequestQt.cpp \ + Shared/qt/WebURLResponseQt.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/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/WKOpenPanelParameters.cpp \ + UIProcess/API/C/WKOpenPanelResultListener.cpp \ + UIProcess/API/C/WKNavigationData.cpp \ + UIProcess/API/C/WKPage.cpp \ + UIProcess/API/C/WKPageGroup.cpp \ + UIProcess/API/C/WKPreferences.cpp \ + UIProcess/API/C/WKProtectionSpace.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/qwkhistory.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/ChunkedUpdateDrawingAreaProxy.cpp \ + UIProcess/Downloads/DownloadProxy.cpp \ + UIProcess/DrawingAreaProxy.cpp \ + UIProcess/FindIndicator.cpp \ + UIProcess/GeolocationPermissionRequestManagerProxy.cpp \ + UIProcess/GeolocationPermissionRequestProxy.cpp \ + UIProcess/Launcher/ProcessLauncher.cpp \ + UIProcess/Launcher/ThreadLauncher.cpp \ + UIProcess/Launcher/qt/ProcessLauncherQt.cpp \ + UIProcess/Launcher/qt/ThreadLauncherQt.cpp \ + UIProcess/Plugins/PluginInfoStore.cpp \ + UIProcess/Plugins/qt/PluginInfoStoreQt.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/WebPageContextMenuClient.cpp \ + UIProcess/WebOpenPanelResultListenerProxy.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/qt/ChunkedUpdateDrawingAreaProxyQt.cpp \ + UIProcess/qt/TiledDrawingAreaProxyQt.cpp \ + UIProcess/qt/TiledDrawingAreaTileQt.cpp \ + UIProcess/qt/TextCheckerQt.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 \ + WebProcess/Authentication/AuthenticationManager.cpp \ + WebProcess/Downloads/Download.cpp \ + WebProcess/Downloads/DownloadManager.cpp \ + WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp \ + WebProcess/Geolocation/WebGeolocationManager.cpp \ + WebProcess/Downloads/qt/DownloadQt.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/WKBundleScriptWorld.cpp \ + 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/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/qt/InjectedBundleQt.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/qt/NetscapePluginQt.cpp \ + WebProcess/Plugins/Plugin.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/qt/WebContextMenuClientQt.cpp \ + WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp \ + WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp \ + WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp \ + WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp \ + WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \ + WebProcess/WebPage/DecoderAdapter.cpp \ + WebProcess/WebPage/DrawingArea.cpp \ + WebProcess/WebPage/EncoderAdapter.cpp \ + WebProcess/WebPage/FindController.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/qt/WebInspectorQt.cpp \ + WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp \ + WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp \ + WebProcess/WebPage/qt/WebPageQt.cpp \ + WebProcess/WebProcess.cpp \ + 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 new file mode 100644 index 0000000..20143f5 --- /dev/null +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -0,0 +1,3778 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXAggregateTarget section */ + 1A50DB38110A3C13000D3FE5 /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 1A50DB48110A3C27000D3FE5 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + 1A50DB70110A3D67000D3FE5 /* CopyFiles */, + ); + dependencies = ( + 1A50DB3C110A3C19000D3FE5 /* PBXTargetDependency */, + ); + name = All; + productName = WebKit2; + }; + C0CE72851247E66800BC0EC4 /* Derived Sources */ = { + isa = PBXAggregateTarget; + buildConfigurationList = C0CE72891247E68600BC0EC4 /* Build configuration list for PBXAggregateTarget "Derived Sources" */; + buildPhases = ( + C0CE72841247E66800BC0EC4 /* Generate Derived Sources */, + ); + dependencies = ( + ); + name = "Derived Sources"; + productName = "Derived Sources"; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 0F5265B311DD37680006D33C /* LayerBackedDrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */; }; + 0F5265B411DD37680006D33C /* LayerBackedDrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */; }; + 0F5265B611DD37700006D33C /* LayerBackedDrawingAreaMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */; }; + 0F5265B911DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5265B711DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp */; }; + 0F5265BA11DD377F0006D33C /* LayerBackedDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5265B811DD377F0006D33C /* LayerBackedDrawingAreaProxy.h */; }; + 0F5265BC11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */; }; + 0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB659221208B4DB0044816C /* DrawingAreaInfo.h */; }; + 1A043976124D034800FFBFB5 /* PluginProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043974124D034800FFBFB5 /* PluginProcess.h */; }; + 1A043977124D034800FFBFB5 /* PluginProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043975124D034800FFBFB5 /* PluginProcess.cpp */; }; + 1A043A09124D11A900FFBFB5 /* WebProcessConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043A07124D11A900FFBFB5 /* WebProcessConnection.h */; }; + 1A043A0A124D11A900FFBFB5 /* WebProcessConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043A08124D11A900FFBFB5 /* WebProcessConnection.cpp */; }; + 1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043B5B124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp */; }; + 1A043B5E124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043B5C124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h */; }; + 1A043CEB124FE38F00FFBFB5 /* PluginProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC6BD124BBD9B007EF4A5 /* PluginProcessMessageReceiver.cpp */; }; + 1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043DBF124FF87500FFBFB5 /* PluginProxy.h */; }; + 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */; }; + 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */; }; + 1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */; }; + 1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */; }; + 1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */; }; + 1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */; }; + 1A0EC75E124BC7B2007EF4A5 /* PluginProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC75C124BC7B2007EF4A5 /* PluginProcessProxy.h */; }; + 1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC75D124BC7B2007EF4A5 /* PluginProcessProxy.cpp */; }; + 1A0EC7FB124BD3B6007EF4A5 /* PluginProcessMain.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC7FA124BD3B6007EF4A5 /* PluginProcessMain.h */; }; + 1A0EC803124BD41E007EF4A5 /* PluginProcessMainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */; }; + 1A0EC906124C0AB8007EF4A5 /* PluginProcessConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC904124C0AB8007EF4A5 /* PluginProcessConnection.h */; }; + 1A0EC907124C0AB8007EF4A5 /* PluginProcessConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC905124C0AB8007EF4A5 /* PluginProcessConnection.cpp */; }; + 1A0EC90F124C0AF5007EF4A5 /* PluginProcessConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC90D124C0AF5007EF4A5 /* PluginProcessConnectionManager.h */; }; + 1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC90E124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp */; }; + 1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */; }; + 1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */; }; + 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 */; }; + 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 */; }; + 1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; }; + 1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */; }; + 1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */; }; + 1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */; }; + 1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */; }; + 1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24B5F011F531E800C38269 /* MachUtilities.cpp */; }; + 1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24B5F111F531E800C38269 /* MachUtilities.h */; }; + 1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; }; + 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; }; + 1A2C307112D555450063DAA2 /* ContextMenuState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2C306F12D555450063DAA2 /* ContextMenuState.h */; }; + 1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; }; + 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */; }; + 1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; }; + 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA283127A13BC0050E709 /* NPObjectProxy.h */; }; + 1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; }; + 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */; }; + 1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */; }; + 1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */; }; + 1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D8489127F6A49001EB962 /* NPIdentifierData.h */; }; + 1A2D848C127F6A49001EB962 /* NPIdentifierData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */; }; + 1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D84A1127F6AD1001EB962 /* NPVariantData.h */; }; + 1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */; }; + 1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */; }; + 1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */; }; + 1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */; }; + 1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */; }; + 1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */; }; + 1A2D956F12848564001EB962 /* ChildProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D956D12848564001EB962 /* ChildProcess.h */; }; + 1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D956E12848564001EB962 /* ChildProcess.cpp */; }; + 1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; }; + 1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; }; + 1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */; }; + 1A3DD202125E5A1F004515E6 /* WebFindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD201125E5A1F004515E6 /* WebFindClient.h */; }; + 1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD205125E5A2F004515E6 /* APIClient.h */; }; + 1A3E736111CC2659007BD539 /* WebPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */; }; + 1A3E736211CC2659007BD539 /* WebPlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */; }; + 1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A433F0C113C53DD00FACDE9 /* WebErrors.h */; }; + 1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */; }; + 1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */; }; + 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; }; + 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */; }; + 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */; }; + 1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9F3112B844E2008FE984 /* PluginQuirks.h */; }; + 1A50DB66110A3D57000D3FE5 /* WebProcess.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */; }; + 1A594ABA112A1FB6009DE7C7 /* WebUIClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A594AB8112A1FB6009DE7C7 /* WebUIClient.cpp */; }; + 1A594ABB112A1FB6009DE7C7 /* WebUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A594AB9112A1FB6009DE7C7 /* WebUIClient.h */; }; + 1A5E4DA412D3BD3D0099A2BB /* TextCheckerState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */; }; + 1A61614F127798B5003ACD86 /* DownloadManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A61614D127798B5003ACD86 /* DownloadManager.cpp */; }; + 1A616150127798B5003ACD86 /* DownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A61614E127798B5003ACD86 /* DownloadManager.h */; }; + 1A6161D41278981C003ACD86 /* Download.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6161D21278981C003ACD86 /* Download.h */; }; + 1A6161D51278981C003ACD86 /* Download.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6161D31278981C003ACD86 /* Download.cpp */; }; + 1A61639612789B2F003ACD86 /* DownloadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A61639512789B2F003ACD86 /* DownloadMac.mm */; }; + 1A6420E412DCE2FF00CAAE2C /* ShareableBitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */; }; + 1A6420E512DCE2FF00CAAE2C /* ShareableBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */; }; + 1A64218612DCF49200CAAE2C /* DrawingAreaProxyImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64218412DCF49200CAAE2C /* DrawingAreaProxyImpl.h */; }; + 1A64218712DCF49200CAAE2C /* DrawingAreaProxyImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64218512DCF49200CAAE2C /* DrawingAreaProxyImpl.cpp */; }; + 1A6421F612DCFBAB00CAAE2C /* DrawingAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6421F412DCFBAB00CAAE2C /* DrawingAreaImpl.h */; }; + 1A6421F712DCFBAB00CAAE2C /* DrawingAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6421F512DCFBAB00CAAE2C /* DrawingAreaImpl.cpp */; }; + 1A64228B12DD024700CAAE2C /* DrawingArea.messages.in in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A64228A12DD024700CAAE2C /* DrawingArea.messages.in */; }; + 1A64229912DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64229712DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp */; }; + 1A64229A12DD029200CAAE2C /* DrawingAreaMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64229812DD029200CAAE2C /* DrawingAreaMessages.h */; }; + 1A64230812DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64230612DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp */; }; + 1A64230912DD09EB00CAAE2C /* DrawingAreaProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */; }; + 1A64235212DD187C00CAAE2C /* Region.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64235012DD187C00CAAE2C /* Region.cpp */; }; + 1A64235312DD187C00CAAE2C /* Region.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64235112DD187C00CAAE2C /* Region.h */; }; + 1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */; }; + 1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */; }; + 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 */; }; + 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 */; }; + 1A6FA02011E1528700DB1371 /* WebProcessMain.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FA01F11E1528700DB1371 /* WebProcessMain.h */; }; + 1A6FA31111E3921E00DB1371 /* MainMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FA31011E3921E00DB1371 /* MainMac.cpp */; }; + 1A6FA31611E3923600DB1371 /* WebKitMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FA31511E3923600DB1371 /* WebKitMain.cpp */; }; + 1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */; }; + 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7AD11E64B6800DB1371 /* PluginView.h */; }; + 1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7D011E651E200DB1371 /* Plugin.cpp */; }; + 1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7D111E651E200DB1371 /* Plugin.h */; }; + 1A6FBA2A11E6862700DB1371 /* NetscapeBrowserFuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBA2811E6862700DB1371 /* NetscapeBrowserFuncs.h */; }; + 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */; }; + 1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */; }; + 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */; }; + 1A8EF4CB1252403700F7067F /* PluginControllerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8EF4C91252403700F7067F /* PluginControllerProxy.h */; }; + 1A8EF4CC1252403700F7067F /* PluginControllerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8EF4CA1252403700F7067F /* PluginControllerProxy.cpp */; }; + 1A8EF96E1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8EF96C1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp */; }; + 1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8EF96D1252AF6B00F7067F /* PluginControllerProxyMessages.h */; }; + 1A8EFA701252B84100F7067F /* PluginProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8EFA6E1252B84100F7067F /* PluginProxyMessageReceiver.cpp */; }; + 1A8EFA711252B84100F7067F /* PluginProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */; }; + 1A8EFDFA1253CAA200F7067F /* DataReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8EFDF91253CAA200F7067F /* DataReference.h */; }; + 1A8EFDFE1253CB6E00F7067F /* DataReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8EFDFD1253CB6E00F7067F /* DataReference.cpp */; }; + 1A90C1EE1264FD50003E44D4 /* WebFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */; }; + 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1F21264FD71003E44D4 /* FindController.h */; }; + 1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C1F31264FD71003E44D4 /* FindController.cpp */; }; + 1A90C23712650717003E44D4 /* PageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C23512650717003E44D4 /* PageOverlay.h */; }; + 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C23612650717003E44D4 /* PageOverlay.cpp */; }; + 1A910071126675C4001842F5 /* FindIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A91006F126675C3001842F5 /* FindIndicator.h */; }; + 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 */; }; + 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 */; }; + 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */; }; + 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; }; + 1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */; }; + 1AA41AB512C02EC4002BE67B /* SelectionState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA41AB412C02EC4002BE67B /* SelectionState.h */; }; + 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */; }; + 1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; + 1AA56F2911E92BC80061B882 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA56F2811E92BC80061B882 /* PluginController.h */; }; + 1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA5889011EE70400061B882 /* NetscapePluginStream.h */; }; + 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; }; + 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */; }; + 1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */; }; + 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; }; + 1AAF061412B01131008E49E2 /* PDFViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF061212B01131008E49E2 /* PDFViewController.h */; }; + 1AAF061512B01131008E49E2 /* PDFViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF061312B01131008E49E2 /* PDFViewController.mm */; }; + 1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */; }; + 1AAF0C4B12B16334008E49E2 /* ArgumentCodersCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */; }; + 1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */; }; + 1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */; }; + 1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */; }; + 1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D6181288B9D900CFD08C /* DownloadProxyMessages.h */; }; + 1AB7D72C1288CAAD00CFD08C /* WebDownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D72A1288CAAD00CFD08C /* WebDownloadClient.h */; }; + 1AB7D72D1288CAAD00CFD08C /* WebDownloadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D72B1288CAAD00CFD08C /* WebDownloadClient.cpp */; }; + 1AB7D78D1288CD9A00CFD08C /* WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D78B1288CD9A00CFD08C /* WKDownload.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1AB7D78E1288CD9A00CFD08C /* WKDownload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */; }; + 1AC25FC212A48F6000BD2671 /* PluginProcessShim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.cpp */; }; + 1AC25FDC12A4902700BD2671 /* PluginProcessShim.dylib in Copy Plug-in Process Shim */ = {isa = PBXBuildFile; fileRef = 1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */; }; + 1AC41AC71263C88300054E94 /* BinarySemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC41AC51263C88300054E94 /* BinarySemaphore.h */; }; + 1AC41AC81263C88300054E94 /* BinarySemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC41AC61263C88300054E94 /* BinarySemaphore.cpp */; }; + 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; }; + 1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; }; + 1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4976711FF658E0048B464 /* NPJSObject.cpp */; }; + 1AE4987811FF7FAA0048B464 /* JSNPObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4987611FF7FAA0048B464 /* JSNPObject.h */; }; + 1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */; }; + 1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */; }; + 1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */; }; + 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; + 1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; }; + 1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; }; + 1AEFCCBD11D02C5E008219D3 /* PluginInfoStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */; }; + 1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */; }; + 1AEFD2F711D1807B008219D3 /* ArgumentCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */; }; + 1C8E25A81270E3BB00BC7BD0 /* WebInspectorFrontendClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E256B1270DE3800BC7BD0 /* WebInspectorFrontendClient.cpp */; }; + 1C8E25A91270E3BC00BC7BD0 /* WebInspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E256A1270DE3800BC7BD0 /* WebInspectorFrontendClient.h */; }; + 1C8E28201275D15400BC7BD0 /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E281E1275D15400BC7BD0 /* WebInspector.h */; }; + 1C8E28211275D15400BC7BD0 /* WebInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E281F1275D15400BC7BD0 /* WebInspector.cpp */; }; + 1C8E28341275D73800BC7BD0 /* WebInspectorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E28321275D73800BC7BD0 /* WebInspectorProxy.h */; }; + 1C8E28351275D73800BC7BD0 /* WebInspectorProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E28331275D73800BC7BD0 /* WebInspectorProxy.cpp */; }; + 1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E293712761E5B00BC7BD0 /* WKInspector.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1C8E293A12761E5B00BC7BD0 /* WKInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */; }; + 1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */; }; + 1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */; }; + 1CA8B936127C774E00576C2B /* WebInspectorProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CA8B935127C774E00576C2B /* WebInspectorProxyMac.mm */; }; + 1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */; }; + 1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; }; + 1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */; }; + 29CD55AA128E294F00133C85 /* AccessibilityWebPageObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */; }; + 29CD55AB128E294F00133C85 /* AccessibilityWebPageObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */; }; + 37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */; }; + 510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; }; + 510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; }; + 512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935D51288D19400A4B695 /* WebContextMenuItem.cpp */; }; + 512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935D61288D19400A4B695 /* WebContextMenuItem.h */; }; + 512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */; }; + 512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */; }; + 512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F588712A8836600629530 /* AuthenticationManager.cpp */; }; + 512F588B12A8836600629530 /* AuthenticationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F588812A8836600629530 /* AuthenticationManager.h */; }; + 512F588C12A8836600629530 /* AuthenticationManager.messages.in in Resources */ = {isa = PBXBuildFile; fileRef = 512F588912A8836600629530 /* AuthenticationManager.messages.in */; }; + 512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */; }; + 512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */; }; + 512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */; }; + 512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589112A8838800629530 /* AuthenticationDecisionListener.h */; }; + 512F589A12A8838800629530 /* WebCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589212A8838800629530 /* WebCredential.cpp */; }; + 512F589B12A8838800629530 /* WebCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589312A8838800629530 /* WebCredential.h */; }; + 512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589412A8838800629530 /* WebProtectionSpace.cpp */; }; + 512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589512A8838800629530 /* WebProtectionSpace.h */; }; + 512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */; }; + 512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */; }; + 512F58F512A88A5400629530 /* WKAuthenticationChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */; }; + 512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 512F58F712A88A5400629530 /* WKAuthenticationDecisionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */; }; + 512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 512F58F912A88A5400629530 /* WKCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58F112A88A5400629530 /* WKCredential.cpp */; }; + 512F58FA12A88A5400629530 /* WKCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F212A88A5400629530 /* WKCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58F312A88A5400629530 /* WKProtectionSpace.cpp */; }; + 512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F412A88A5400629530 /* WKProtectionSpace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */; }; + 5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */; }; + 51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; }; + 516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; }; + 51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; }; + 51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; }; + 518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 518ACF1012B015F800B04B83 /* WKCredentialTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 518D2CAD12D5153B003BB93B /* WebBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */; }; + 518D2CAE12D5153B003BB93B /* WebBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */; }; + 518D2CCA12D51DFB003BB93B /* SessionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518D2CC812D51DFB003BB93B /* SessionState.cpp */; }; + 518D2CCB12D51DFB003BB93B /* SessionState.h in Headers */ = {isa = PBXBuildFile; fileRef = 518D2CC912D51DFB003BB93B /* SessionState.h */; }; + 51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; }; + 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A55600128C6D92009ABCEC /* WKContextMenuItemTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 51A7F2F3125BF820008AEB1D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A7F2F2125BF820008AEB1D /* Logging.h */; }; + 51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */; }; + 51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */; }; + 51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */; }; + 51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */; }; + 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 */; }; + 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 */; }; + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; + 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905620E812BC248B000799B6 /* WebMemorySampler.cpp */; }; + 909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 905620E912BC248B000799B6 /* WebMemorySampler.h */; }; + 909854EE12BC4E18000AD080 /* WebMemorySampler.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */; }; + 935EEB9B1277617C003322B8 /* WKBundleBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB981277616D003322B8 /* WKBundleBackForwardListItem.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935EEB951277616D003322B8 /* WKBundleBackForwardList.cpp */; }; + 935EEB9F127761AC003322B8 /* WKBundleBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB961277616D003322B8 /* WKBundleBackForwardList.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 935EEBA0127761AC003322B8 /* WKBundleBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935EEB971277616D003322B8 /* WKBundleBackForwardListItem.cpp */; }; + 935EEBA1127761CC003322B8 /* InjectedBundleBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935EEB8F1277615D003322B8 /* InjectedBundleBackForwardList.cpp */; }; + 935EEBA2127761D0003322B8 /* InjectedBundleBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB901277615D003322B8 /* InjectedBundleBackForwardList.h */; }; + 935EEBA3127761D3003322B8 /* InjectedBundleBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935EEB911277615D003322B8 /* InjectedBundleBackForwardListItem.cpp */; }; + 935EEBA4127761D6003322B8 /* InjectedBundleBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */; }; + 9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */; }; + 9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */; }; + 93FC67BD12D3CCF200A60610 /* DecoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */; }; + 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 */; }; + 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 */; }; + BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6210F4378D0058C15A /* WebContextMenuClient.h */; }; + BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6610F4378D0058C15A /* WebDragClient.h */; }; + BC032D7D10F4378D0058C15A /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6810F4378D0058C15A /* WebEditorClient.h */; }; + BC032D7F10F4378D0058C15A /* WebFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6A10F4378D0058C15A /* WebFrameLoaderClient.h */; }; + BC032D8210F4378D0058C15A /* WebInspectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6D10F4378D0058C15A /* WebInspectorClient.h */; }; + BC032D8D10F437A00058C15A /* WebFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D8910F437A00058C15A /* WebFrame.h */; }; + BC032D8F10F437A00058C15A /* WebPage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D8B10F437A00058C15A /* WebPage.h */; }; + BC032D9710F437AF0058C15A /* WebProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D9110F437AF0058C15A /* WebProcess.h */; }; + BC032DA510F437D10058C15A /* ArgumentDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC032D9D10F437D10058C15A /* ArgumentDecoder.cpp */; }; + BC032DA610F437D10058C15A /* ArgumentDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D9E10F437D10058C15A /* ArgumentDecoder.h */; }; + BC032DA710F437D10058C15A /* ArgumentEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC032D9F10F437D10058C15A /* ArgumentEncoder.cpp */; }; + BC032DA810F437D10058C15A /* ArgumentEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DA010F437D10058C15A /* ArgumentEncoder.h */; }; + BC032DA910F437D10058C15A /* Arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DA110F437D10058C15A /* Arguments.h */; }; + BC032DAA10F437D10058C15A /* Connection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC032DA210F437D10058C15A /* Connection.cpp */; }; + BC032DAB10F437D10058C15A /* Connection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DA310F437D10058C15A /* Connection.h */; }; + BC032DAC10F437D10058C15A /* MessageID.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DA410F437D10058C15A /* MessageID.h */; }; + BC032DB910F4380F0058C15A /* WebEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DAF10F4380F0058C15A /* WebEvent.h */; }; + BC032DBA10F4380F0058C15A /* WebEventConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC032DB010F4380F0058C15A /* WebEventConversion.cpp */; }; + BC032DBB10F4380F0058C15A /* WebEventConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DB110F4380F0058C15A /* WebEventConversion.h */; }; + BC032DD110F4389F0058C15A /* WebPageProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCB10F4389F0058C15A /* WebPageProxy.h */; }; + BC032DD310F4389F0058C15A /* WebProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCD10F4389F0058C15A /* WebProcessManager.h */; }; + BC032DD510F4389F0058C15A /* WebProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032DCF10F4389F0058C15A /* WebProcessProxy.h */; }; + BC06F42F12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */; }; + BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */; }; + BC06F43A12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */; }; + BC06F43B12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */; }; + BC06F44A12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */; }; + BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */; }; + BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC06F44F12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */; }; + BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E5FE312D697160012A72A /* WebGeolocationManager.h */; }; + BC0E5FE612D697160012A72A /* WebGeolocationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */; }; + BC0E606112D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E605F12D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp */; }; + BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E606012D6BA910012A72A /* WebGeolocationManagerMessages.h */; }; + BC0E607312D6BC200012A72A /* WebGeolocationPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */; }; + BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */; }; + BC0E618212D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E618012D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp */; }; + BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E618112D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h */; }; + BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0E619612D6CD120012A72A /* WKGeolocationPosition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC0E619912D6CD120012A72A /* WKGeolocationPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0E619712D6CD120012A72A /* WKGeolocationPosition.cpp */; }; + BC111A5A112F4FBB00337BAB /* WebChromeClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */; }; + BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A54112F4FBB00337BAB /* WebContextMenuClient.cpp */; }; + BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A56112F4FBB00337BAB /* WebDragClient.cpp */; }; + BC111A5E112F4FBB00337BAB /* WebEditorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */; }; + BC111A5F112F4FBB00337BAB /* WebFrameLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */; }; + BC111A60112F4FBB00337BAB /* WebInspectorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A59112F4FBB00337BAB /* WebInspectorClient.cpp */; }; + BC111ADD112F5B9300337BAB /* WebFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111ADC112F5B9300337BAB /* WebFrame.cpp */; }; + BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */; }; + BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111AE3112F5C2600337BAB /* WebProcess.cpp */; }; + BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */; }; + BC111B0E112F5E4F00337BAB /* WebFrameProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */; }; + BC111B0F112F5E4F00337BAB /* WebPageProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */; }; + BC111B10112F5E4F00337BAB /* WebProcessManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0C112F5E4F00337BAB /* WebProcessManager.cpp */; }; + BC111B11112F5E4F00337BAB /* WebProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */; }; + BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */; }; + BC111B50112F619200337BAB /* PageClientImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B4B112F619200337BAB /* PageClientImpl.h */; }; + BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B4C112F619200337BAB /* PageClientImpl.mm */; }; + BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B5B112F629800337BAB /* WebEventFactory.h */; }; + BC111B5E112F629800337BAB /* WebEventFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B5C112F629800337BAB /* WebEventFactory.mm */; }; + BC131BC911726C2800B69727 /* CoreIPCMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */; }; + BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14DF75120B5B7900826C0C /* InjectedBundleScriptWorld.h */; }; + BC14DF78120B5B7900826C0C /* InjectedBundleScriptWorld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14DF76120B5B7900826C0C /* InjectedBundleScriptWorld.cpp */; }; + BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */; }; + BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */; }; + BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */; }; + BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC177464118B9FF4007D9E9A /* WKPagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = BC17753E118BABF0007D9E9A /* GenericCallback.h */; }; + BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A7C571136E19C00FB7167 /* ProcessLauncher.h */; }; + BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1BE1DE12D54A410004A228 /* WebGeolocationClient.h */; }; + BC1BE1E112D54A410004A228 /* WebGeolocationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1BE1DF12D54A410004A228 /* WebGeolocationClient.cpp */; }; + BC1BE1F212D54DBD0004A228 /* WebGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1BE1F012D54DBD0004A228 /* WebGeolocationProvider.h */; }; + BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1BE1F112D54DBD0004A228 /* WebGeolocationProvider.cpp */; }; + BC1DD7B2114DC396005ADAF3 /* WebCoreArgumentCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */; }; + BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1DFE8D12B31CA8005DF730 /* WKOpenPanelResultListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC1DFEA412B31F87005DF730 /* WebOpenPanelResultListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1DFEA212B31F87005DF730 /* WebOpenPanelResultListenerProxy.h */; }; + BC204EE211C83E98008F3375 /* InjectedBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC204EE011C83E98008F3375 /* InjectedBundle.cpp */; }; + BC204EE311C83E98008F3375 /* InjectedBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC204EE111C83E98008F3375 /* InjectedBundle.h */; }; + BC204EE611C83EA9008F3375 /* InjectedBundleMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC204EE511C83EA9008F3375 /* InjectedBundleMac.cpp */; }; + BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC204EE911C83EC8008F3375 /* WKBundle.cpp */; }; + BC204EEF11C83EC8008F3375 /* WKBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC204EEA11C83EC8008F3375 /* WKBundle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC204EF011C83EC8008F3375 /* WKBundleAPICast.h in Headers */ = {isa = PBXBuildFile; fileRef = BC204EEB11C83EC8008F3375 /* WKBundleAPICast.h */; }; + BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */ = {isa = PBXBuildFile; fileRef = BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC20528111C94284008F3375 /* WKBundlePage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC20527F11C94284008F3375 /* WKBundlePage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC20528211C94284008F3375 /* WKBundlePage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC20528011C94284008F3375 /* WKBundlePage.cpp */; }; + BC2651F611825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC2651F511825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm */; }; + BC2652161182608100243E12 /* DrawingAreaProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2652121182608100243E12 /* DrawingAreaProxy.cpp */; }; + BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2652131182608100243E12 /* DrawingAreaProxy.h */; }; + BC2652181182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2652141182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp */; }; + BC2652191182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */; }; + BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */; }; + BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */; }; + BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E771141970C00A63B1E /* RunLoop.cpp */; }; + BC2E6E881141971500A63B1E /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E781141970C00A63B1E /* RunLoop.h */; }; + BC2E6E8C1141971500A63B1E /* WorkItem.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7C1141970C00A63B1E /* WorkItem.h */; }; + BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; }; + BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; }; + BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3065C312592F8900E71278 /* WebProcessMac.mm */; }; + BC3065FA1259344E00E71278 /* CacheModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3065F91259344E00E71278 /* CacheModel.h */; }; + BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */; }; + BC3066BF125A442100E71278 /* WebProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3066BD125A442100E71278 /* WebProcessMessages.h */; }; + BC306824125A6B9400E71278 /* WebProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */; }; + BC306825125A6B9400E71278 /* WebProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */; }; + BC33DD681238464600360F3F /* WebNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33DD671238464600360F3F /* WebNumber.h */; }; + BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */; }; + BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */; }; + BC4075F3124FF0270068F20A /* WKArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075D7124FF0270068F20A /* WKArray.cpp */; }; + BC4075F4124FF0270068F20A /* WKArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075D8124FF0270068F20A /* WKArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075F5124FF0270068F20A /* WKCertificateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075D9124FF0270068F20A /* WKCertificateInfo.cpp */; }; + BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075DA124FF0270068F20A /* WKCertificateInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075F7124FF0270068F20A /* WKData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075DB124FF0270068F20A /* WKData.cpp */; }; + BC4075F8124FF0270068F20A /* WKData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075DC124FF0270068F20A /* WKData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075F9124FF0270068F20A /* WKDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075DD124FF0270068F20A /* WKDictionary.cpp */; }; + BC4075FA124FF0270068F20A /* WKDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075DE124FF0270068F20A /* WKDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075FB124FF0270068F20A /* WKError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075DF124FF0270068F20A /* WKError.cpp */; }; + BC4075FC124FF0270068F20A /* WKError.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075E0124FF0270068F20A /* WKError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075FD124FF0270068F20A /* WKMutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075E1124FF0270068F20A /* WKMutableArray.cpp */; }; + BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075E2124FF0270068F20A /* WKMutableArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4075FF124FF0270068F20A /* WKMutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075E3124FF0270068F20A /* WKMutableDictionary.cpp */; }; + BC407600124FF0270068F20A /* WKMutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075E4124FF0270068F20A /* WKMutableDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407601124FF0270068F20A /* WKNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075E5124FF0270068F20A /* WKNumber.cpp */; }; + BC407602124FF0270068F20A /* WKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075E6124FF0270068F20A /* WKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407603124FF0270068F20A /* WKSerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075E7124FF0270068F20A /* WKSerializedScriptValue.cpp */; }; + BC407604124FF0270068F20A /* WKSerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075E8124FF0270068F20A /* WKSerializedScriptValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407605124FF0270068F20A /* WKString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075E9124FF0270068F20A /* WKString.cpp */; }; + BC407606124FF0270068F20A /* WKString.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075EA124FF0270068F20A /* WKString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407607124FF0270068F20A /* WKType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075EB124FF0270068F20A /* WKType.cpp */; }; + BC407608124FF0270068F20A /* WKType.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075EC124FF0270068F20A /* WKType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407609124FF0270068F20A /* WKURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075ED124FF0270068F20A /* WKURL.cpp */; }; + BC40760A124FF0270068F20A /* WKURL.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075EE124FF0270068F20A /* WKURL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC40760B124FF0270068F20A /* WKURLRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075EF124FF0270068F20A /* WKURLRequest.cpp */; }; + BC40760C124FF0270068F20A /* WKURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075F0124FF0270068F20A /* WKURLRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC40760D124FF0270068F20A /* WKURLResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4075F1124FF0270068F20A /* WKURLResponse.cpp */; }; + BC40760E124FF0270068F20A /* WKURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4075F2124FF0270068F20A /* WKURLResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407619124FF0370068F20A /* WKStringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC407611124FF0370068F20A /* WKStringCF.cpp */; }; + BC40761A124FF0370068F20A /* WKStringCF.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407612124FF0370068F20A /* WKStringCF.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC40761B124FF0370068F20A /* WKURLCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC407613124FF0370068F20A /* WKURLCF.cpp */; }; + BC40761C124FF0370068F20A /* WKURLCF.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407614124FF0370068F20A /* WKURLCF.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407627124FF0400068F20A /* WKCertificateInfoMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407621124FF0400068F20A /* WKCertificateInfoMac.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC407622124FF0400068F20A /* WKCertificateInfoMac.mm */; }; + BC407629124FF0400068F20A /* WKURLRequestNS.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407623124FF0400068F20A /* WKURLRequestNS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC40762A124FF0400068F20A /* WKURLRequestNS.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC407624124FF0400068F20A /* WKURLRequestNS.mm */; }; + BC40762B124FF0400068F20A /* WKURLResponseNS.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407625124FF0400068F20A /* WKURLResponseNS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC407626124FF0400068F20A /* WKURLResponseNS.mm */; }; + BC40783D1250FADD0068F20A /* WKEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC40783C1250FADD0068F20A /* WKEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC498618124D10E200D834E1 /* InjectedBundleHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */; }; + BC498619124D10E200D834E1 /* InjectedBundleHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */; }; + BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC498630124D18C100D834E1 /* WKBundleHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC49862E124D18C100D834E1 /* WKBundleHitTestResult.cpp */; }; + BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */; }; + BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */; }; + BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */; }; + BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC54CAC912D64291005C67B0 /* WebGeolocationManagerProxy.h */; }; + BC54CACC12D64291005C67B0 /* WebGeolocationManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC54CACA12D64291005C67B0 /* WebGeolocationManagerProxy.cpp */; }; + BC54CC1212D674EE005C67B0 /* WKGeolocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BC54CC1012D674EE005C67B0 /* WKGeolocationManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC54CC1312D674EE005C67B0 /* WKGeolocationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC54CC1112D674EE005C67B0 /* WKGeolocationManager.cpp */; }; + BC5744EF12638FB3006F0F12 /* WebPopupItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */; }; + BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5744EE12638FB3006F0F12 /* WebPopupItem.h */; }; + BC57450C1263B155006F0F12 /* WKBundleNodeHandlePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC574E611267D080006F0F12 /* WebPopupMenuProxy.h */; }; + BC5750971268F3C6006F0F12 /* WebPopupMenuProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */; }; + BC5750981268F3C6006F0F12 /* WebPopupMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */; }; + BC575613126E0138006F0F12 /* WebError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575612126E0138006F0F12 /* WebError.cpp */; }; + BC59534210FC04520098F82D /* WebLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC59534010FC04520098F82D /* WebLoaderClient.h */; }; + BC597075116591D000551FCA /* ProcessModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC597074116591D000551FCA /* ProcessModel.h */; }; + BC5F7BB41182376C0052C02C /* ChunkedUpdateDrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */; }; + BC5F7BB51182376C0052C02C /* ChunkedUpdateDrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */; }; + BC5F7BB9118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */; }; + BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */; }; + BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; }; + BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64696D11DBE603006455B0 /* ImmutableArray.cpp */; }; + BC64697011DBE603006455B0 /* ImmutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64696E11DBE603006455B0 /* ImmutableArray.h */; }; + BC646C1A11DD399F006455B0 /* WKBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */; }; + BC646C1B11DD399F006455B0 /* WKBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC646C1711DD399F006455B0 /* WKBackForwardList.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 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 */; }; + 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 */; }; + BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */; }; + BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B6204129A0A6700D174A4 /* WebPageGroup.h */; }; + BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */; }; + BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */; }; + BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */; }; + BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B625012A43C9600D174A4 /* WebPageGroupData.h */; }; + BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */; }; + BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B633512A45ABA00D174A4 /* WKPageGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 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 */; }; + 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 */; }; + BC857E8712B71EBB00EDEB2E /* WebPageProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */; }; + BC857F7E12B82CEE00EDEB2E /* WebOpenPanelResultListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1DFEA312B31F87005DF730 /* WebOpenPanelResultListenerProxy.cpp */; }; + BC857F8512B82D0B00EDEB2E /* WebOpenPanelResultListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857F8312B82D0B00EDEB2E /* WebOpenPanelResultListener.h */; }; + BC857F8612B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */; }; + BC857FB512B830E600EDEB2E /* WebOpenPanelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */; }; + BC857FB612B830E600EDEB2E /* WebOpenPanelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */; }; + BC857FE612B843D800EDEB2E /* WKOpenPanelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = BC857FE412B843D800EDEB2E /* WKOpenPanelParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC85806212B8505700EDEB2E /* WKOpenPanelResultListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1DFE8E12B31CA8005DF730 /* WKOpenPanelResultListener.cpp */; }; + BC85806312B8505700EDEB2E /* WKOpenPanelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC857FE512B843D800EDEB2E /* WKOpenPanelParameters.cpp */; }; + BC858A2012C0357B00EDEB2E /* WebResourceLoadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC858A1E12C0357B00EDEB2E /* WebResourceLoadClient.h */; }; + BC858A2112C0357B00EDEB2E /* WebResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC858A1F12C0357B00EDEB2E /* WebResourceLoadClient.cpp */; }; + BC8699B5116AADAA002A925B /* WKView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8699B2116AADAA002A925B /* WKView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC8699B6116AADAA002A925B /* WKView.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8699B3116AADAA002A925B /* WKView.mm */; }; + BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8699B4116AADAA002A925B /* WKViewInternal.h */; }; + BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */; }; + BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC87DFA91018101400564216 /* libicucore.dylib */; }; + BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8A501411765F5600757573 /* WKRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC9099801256A98200083756 /* WKStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90997F1256A98200083756 /* WKStringPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 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 */; }; + 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 */; }; + BC9E95D311449B0300870E71 /* UpdateChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E95D111449B0300870E71 /* UpdateChunk.h */; }; + BC9E95D411449B0300870E71 /* UpdateChunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9E95D211449B0300870E71 /* UpdateChunk.cpp */; }; + BC9E969A11457EDE00870E71 /* DrawingAreaProxyMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */; }; + BC9E969C11457F3F00870E71 /* DrawingAreaMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E969B11457F3F00870E71 /* DrawingAreaMessageKinds.h */; }; + BCA0EF7F12331E78007D3CFB /* WebEditCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA0EF7D12331E78007D3CFB /* WebEditCommand.h */; }; + 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 */; }; + 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 */; }; + BCA8C6B011E3C08700812FB7 /* InjectedBundlePageUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */; }; + BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */; }; + BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */; }; + BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8049D122F0D6B00103529 /* MutableArray.cpp */; }; + BCB0AD34122F285800B1341E /* MutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8049E122F0D6B00103529 /* MutableArray.h */; }; + BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0AEE7122F53E300B1341E /* MutableDictionary.h */; }; + BCB0AEEA122F53E300B1341E /* MutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */; }; + BCB0B0DC12305A2500B1341E /* WebContextUserMessageCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */; }; + BCB0B0DE12305A8C00B1341E /* InjectedBundleUserMessageCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0B0DD12305A8C00B1341E /* InjectedBundleUserMessageCoders.h */; }; + BCB0B0E012305AB100B1341E /* UserMessageCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */; }; + BCB28CC0120233D9007D99BC /* InjectedBundleMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB28CBF120233D9007D99BC /* InjectedBundleMessageKinds.h */; }; + BCB63478116BF10600603215 /* WebKit2.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB63477116BF10600603215 /* WebKit2.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCB7346E11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */; }; + BCB9E2431120DACA00A137E0 /* WebContext.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9E2411120DACA00A137E0 /* WebContext.h */; }; + BCB9E2441120DACA00A137E0 /* WebContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9E2421120DACA00A137E0 /* WebContext.cpp */; }; + BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9E2491120E15C00A137E0 /* WKContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCB9E24C1120E15C00A137E0 /* WKContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9E24A1120E15C00A137E0 /* WKContext.cpp */; }; + BCB9E76211232B9E00A137E0 /* WebLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9E76111232B9E00A137E0 /* WebLoaderClient.cpp */; }; + BCB9F6A01123A84B00A137E0 /* WebFramePolicyListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9F69E1123A84B00A137E0 /* WebFramePolicyListenerProxy.h */; }; + BCB9F6A11123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9F69F1123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp */; }; + BCB9F6A51123DD0D00A137E0 /* WKFramePolicyListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCB9F6A61123DD0D00A137E0 /* WKFramePolicyListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */; }; + BCB9F8AF1124E07700A137E0 /* WebPolicyClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB9F8AD1124E07700A137E0 /* WebPolicyClient.cpp */; }; + BCB9F8B01124E07700A137E0 /* WebPolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9F8AE1124E07700A137E0 /* WebPolicyClient.h */; }; + BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */; }; + BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */; }; + BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */; }; + BCBD3915125BB1A800D2C29F /* WebPageProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBD3913125BB1A800D2C29F /* WebPageProxyMessages.h */; }; + BCBD3C3B125BFA7A00D2C29F /* StringPairVector.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */; }; + BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */; }; + BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */; }; + BCC43AC7127B99DE00317F16 /* WebPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */; }; + BCC56F791159957D001CCAF9 /* MachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC56F771159957D001CCAF9 /* MachPort.h */; }; + BCC5715B115ADAEF001CCAF9 /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC57159115ADAEF001CCAF9 /* WebSystemInterface.h */; }; + BCC5715C115ADAEF001CCAF9 /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC5715A115ADAEF001CCAF9 /* WebSystemInterface.mm */; }; + BCC57162115ADB42001CCAF9 /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC57161115ADB42001CCAF9 /* NotImplemented.h */; }; + BCC8B374125FB69000DE46A4 /* WKGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8B373125FB69000DE46A4 /* WKGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC938E01180DE440085E5FE /* WKContextPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BCCB75C61203A1CE00222D1B /* WebContextMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */; }; + BCCF672D12C7EDF7008F9C35 /* OriginAndDatabases.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */; }; + BCCF673312C7F15C008F9C35 /* OriginAndDatabases.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */; }; + BCCF6ABC12C91EF9008F9C35 /* WebImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */; }; + BCCF6ABD12C91EF9008F9C35 /* WebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6ABB12C91EF9008F9C35 /* WebImage.h */; }; + BCCF6AC212C91F34008F9C35 /* WKImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC012C91F34008F9C35 /* WKImage.cpp */; }; + BCCF6AC312C91F34008F9C35 /* WKImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC112C91F34008F9C35 /* WKImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */; }; + BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC812C91F59008F9C35 /* WKImageCG.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */; }; + BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCD0042C110C1E27003B8A67 /* CoreServices.framework */; }; + BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD01397110FA420003B8A67 /* WKFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCD0139C110FA420003B8A67 /* WKFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD01398110FA420003B8A67 /* WKFrame.cpp */; }; + BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCD25F1811D6BDE100169B0E /* WKBundleFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD25F1611D6BDE100169B0E /* WKBundleFrame.cpp */; }; + BCD597D0112B56AC00EC8C23 /* WKPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597CE112B56AC00EC8C23 /* WKPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */; }; + BCD597D6112B56DC00EC8C23 /* WKPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597D4112B56DC00EC8C23 /* WKPage.cpp */; }; + BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597D5112B56DC00EC8C23 /* WKPage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCD597FF112B57BE00EC8C23 /* WebPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD597FD112B57BE00EC8C23 /* WebPreferences.h */; }; + BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD597FE112B57BE00EC8C23 /* WebPreferences.cpp */; }; + BCD598AC112B7FDF00EC8C23 /* WebPreferencesStore.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */; }; + BCD598AD112B7FDF00EC8C23 /* WebPreferencesStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD598AB112B7FDF00EC8C23 /* WebPreferencesStore.cpp */; }; + BCDB86C11200FB97007254BE /* WebURL.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDB86C01200FB97007254BE /* WebURL.h */; }; + BCDDB317124EBD130048D13C /* WKBase.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB316124EBD130048D13C /* WKBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */; }; + BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDDB32C124EC2E10048D13C /* WKAPICast.h */; }; + BCDE059B11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */; }; + BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */; }; + BCE2315D122C30CA00D5C35A /* WebURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE2315B122C30CA00D5C35A /* WebURLRequest.h */; }; + BCE2315E122C30CA00D5C35A /* WebURLRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */; }; + BCE231C2122C466E00D5C35A /* WebURLRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */; }; + BCE23263122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */; }; + BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */; }; + BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469501214E6CB000B98EB /* WebFormClient.h */; }; + BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */; }; + BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */; }; + BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */; }; + BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */; }; + BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */; }; + BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */; }; + BCEE7AD112817988009827DA /* WebProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */; }; + BCEE7D0D12846F69009827DA /* WebContextMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7D0B12846F69009827DA /* WebContextMessageReceiver.cpp */; }; + BCEE7D0E12846F69009827DA /* WebContextMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE7D0C12846F69009827DA /* WebContextMessages.h */; }; + BCEE7DC5128B645D009827DA /* InjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE7DC3128B645D009827DA /* InjectedBundleClient.h */; }; + BCEE7DC6128B645D009827DA /* InjectedBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7DC4128B645D009827DA /* InjectedBundleClient.cpp */; }; + BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE966A112FAF57006BCC24 /* Attachment.cpp */; }; + BCEE966D112FAF57006BCC24 /* Attachment.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE966B112FAF57006BCC24 /* Attachment.h */; }; + BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BCF50121123ED3B3005955AE /* ThreadLauncher.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF5011F123ED3B3005955AE /* ThreadLauncher.h */; }; + BCF50122123ED3B3005955AE /* ThreadLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF50120123ED3B3005955AE /* ThreadLauncher.cpp */; }; + BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF501B3123EF602005955AE /* ThreadLauncherMac.mm */; }; + BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF505E51243047B005955AE /* PlatformCertificateInfo.h */; }; + BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */; }; + BCF5068512431861005955AE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; }; + BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF50726124329AA005955AE /* WebCertificateInfo.h */; }; + BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */; }; + BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F851176CD6F00471A52 /* WebHistoryClient.h */; }; + BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F981176CED600471A52 /* WebNavigationDataStore.h */; }; + BCF69FA21176D01400471A52 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA01176D01400471A52 /* WebNavigationData.h */; }; + 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 */; }; + 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 */; }; + C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */; }; + C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */; }; + C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */; }; + C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */; }; + C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */; }; + C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06C6093124C14430001682F /* WebPageCreationParameters.cpp */; }; + C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C09AE5E8125257C20025825D /* WKNativeEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */; }; + C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; }; + C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; }; + C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA481209E45000A49D01 /* ModuleMac.mm */; }; + C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA451209E2BA00A49D01 /* Module.cpp */; }; + C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; }; + C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = C517388012DF8F4F00EE3F47 /* DragControllerAction.h */; }; + C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5237F5F12441CA300780472 /* WebEditorClientMac.mm */; }; + D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */; }; + 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 */; }; + 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 */; }; + E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CC1B8E12D7EADF00625838 /* PrintInfo.h */; }; + E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; }; + E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */; }; + E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */; }; + ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A22F1001289FCD90085E74F /* WKBundlePageOverlay.cpp */; }; + F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */; }; + F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */; }; + F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F62A765C12B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */; }; + F62A765D12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */; }; + F62A766112B1ABED0005F1B6 /* WKDatabaseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */; }; + F62A766212B1ABED0005F1B6 /* WKDatabaseManager.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F62A76B612B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */; }; + F62A76B712B1B25F0005F1B6 /* WebDatabaseManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */; }; + F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */; }; + F62A76B912B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */; }; + F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445512A885C8000612D8 /* WebSecurityOrigin.h */; }; + 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 */ + +/* Begin PBXContainerItemProxy section */ + 1A50DB26110A3BEF000D3FE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = WebKit2; + }; + 1A50DB3B110A3C19000D3FE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1A50DB1D110A3BDC000D3FE5; + remoteInfo = WebProcess; + }; + 1AC25FD712A48FD500BD2671 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1AC25FAF12A48EA700BD2671; + remoteInfo = PluginProcessShim; + }; + 37F7407812721F740093869B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C0CE72851247E66800BC0EC4; + remoteInfo = "Derived Sources"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 1A50DB70110A3D67000D3FE5 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = WebKit2.framework; + dstSubfolderSpec = 1; + files = ( + 1A50DB66110A3D57000D3FE5 /* WebProcess.app in CopyFiles */, + 1A64228B12DD024700CAAE2C /* DrawingArea.messages.in in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1AC25FDD12A4904500BD2671 /* Copy Plug-in Process Shim */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = WebProcess.app/Contents/MacOS; + dstSubfolderSpec = 16; + files = ( + 1AC25FDC12A4902700BD2671 /* PluginProcessShim.dylib in Copy Plug-in Process Shim */, + ); + name = "Copy Plug-in Process Shim"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerBackedDrawingArea.cpp; sourceTree = "<group>"; }; + 0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerBackedDrawingArea.h; sourceTree = "<group>"; }; + 0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerBackedDrawingAreaMac.mm; sourceTree = "<group>"; }; + 0F5265B711DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerBackedDrawingAreaProxy.cpp; sourceTree = "<group>"; }; + 0F5265B811DD377F0006D33C /* LayerBackedDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerBackedDrawingAreaProxy.h; sourceTree = "<group>"; }; + 0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerBackedDrawingAreaProxyMac.mm; sourceTree = "<group>"; }; + 0FB659221208B4DB0044816C /* DrawingAreaInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaInfo.h; sourceTree = "<group>"; }; + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; + 1A043974124D034800FFBFB5 /* PluginProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcess.h; sourceTree = "<group>"; }; + 1A043975124D034800FFBFB5 /* PluginProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcess.cpp; sourceTree = "<group>"; }; + 1A043A07124D11A900FFBFB5 /* WebProcessConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessConnection.h; sourceTree = "<group>"; }; + 1A043A08124D11A900FFBFB5 /* WebProcessConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessConnection.cpp; sourceTree = "<group>"; }; + 1A043B4C124D5E3600FFBFB5 /* PluginProcessProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProcessProxy.messages.in; sourceTree = "<group>"; }; + 1A043B5B124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A043B5C124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessProxyMessages.h; sourceTree = "<group>"; }; + 1A043DBF124FF87500FFBFB5 /* PluginProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProxy.h; sourceTree = "<group>"; }; + 1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProxy.cpp; sourceTree = "<group>"; }; + 1A043F5912514CF300FFBFB5 /* WebProcessConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcessConnection.messages.in; sourceTree = "<group>"; }; + 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessConnectionMessages.h; sourceTree = "<group>"; }; + 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessManager.h; sourceTree = "<group>"; }; + 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessManager.cpp; sourceTree = "<group>"; }; + 1A0EC6B1124BBD36007EF4A5 /* PluginProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProcess.messages.in; sourceTree = "<group>"; }; + 1A0EC6BD124BBD9B007EF4A5 /* PluginProcessMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessMessages.h; sourceTree = "<group>"; }; + 1A0EC75C124BC7B2007EF4A5 /* PluginProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessProxy.h; sourceTree = "<group>"; }; + 1A0EC75D124BC7B2007EF4A5 /* PluginProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessProxy.cpp; sourceTree = "<group>"; }; + 1A0EC7FA124BD3B6007EF4A5 /* PluginProcessMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessMain.h; sourceTree = "<group>"; }; + 1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessMainMac.mm; sourceTree = "<group>"; }; + 1A0EC904124C0AB8007EF4A5 /* PluginProcessConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnection.h; sourceTree = "<group>"; }; + 1A0EC905124C0AB8007EF4A5 /* PluginProcessConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnection.cpp; sourceTree = "<group>"; }; + 1A0EC90D124C0AF5007EF4A5 /* PluginProcessConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnectionManager.h; sourceTree = "<group>"; }; + 1A0EC90E124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnectionManager.cpp; sourceTree = "<group>"; }; + 1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkTable.cpp; sourceTree = "<group>"; }; + 1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkTable.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + 1A1FA283127A13BC0050E709 /* NPObjectProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPObjectProxy.h; sourceTree = "<group>"; }; + 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPObjectProxy.cpp; sourceTree = "<group>"; }; + 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPObjectMessageReceiver.h; sourceTree = "<group>"; }; + 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPObjectMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRuntimeObjectMap.h; sourceTree = "<group>"; }; + 1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectMap.cpp; sourceTree = "<group>"; }; + 1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeUtilities.cpp; sourceTree = "<group>"; }; + 1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRuntimeUtilities.h; sourceTree = "<group>"; }; + 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageOverlay.h; sourceTree = "<group>"; }; + 1A22F1001289FCD90085E74F /* WKBundlePageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageOverlay.cpp; sourceTree = "<group>"; }; + 1A24B5F011F531E800C38269 /* MachUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachUtilities.cpp; sourceTree = "<group>"; }; + 1A24B5F111F531E800C38269 /* MachUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachUtilities.h; sourceTree = "<group>"; }; + 1A24BED3120894D100FBB059 /* SharedMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedMemory.h; sourceTree = "<group>"; }; + 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryMac.cpp; sourceTree = "<group>"; }; + 1A2C306F12D555450063DAA2 /* ContextMenuState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuState.h; sourceTree = "<group>"; }; + 1A2D8411127F64E8001EB962 /* NPObjectMessageReceiver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NPObjectMessageReceiver.messages.in; sourceTree = "<group>"; }; + 1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPObjectMessageReceiverMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPObjectMessageReceiverMessages.h; sourceTree = "<group>"; }; + 1A2D8489127F6A49001EB962 /* NPIdentifierData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPIdentifierData.h; sourceTree = "<group>"; }; + 1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPIdentifierData.cpp; sourceTree = "<group>"; }; + 1A2D84A1127F6AD1001EB962 /* NPVariantData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPVariantData.h; sourceTree = "<group>"; }; + 1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPVariantData.cpp; sourceTree = "<group>"; }; + 1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessProxyMac.mm; sourceTree = "<group>"; }; + 1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessCreationParameters.h; sourceTree = "<group>"; }; + 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessCreationParameters.cpp; sourceTree = "<group>"; }; + 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginControllerProxyMac.mm; sourceTree = "<group>"; }; + 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProxyMac.mm; sourceTree = "<group>"; }; + 1A2D956D12848564001EB962 /* ChildProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcess.h; sourceTree = "<group>"; }; + 1A2D956E12848564001EB962 /* ChildProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcess.cpp; sourceTree = "<group>"; }; + 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; }; + 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; }; + 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindClient.cpp; sourceTree = "<group>"; }; + 1A3DD201125E5A1F004515E6 /* WebFindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFindClient.h; sourceTree = "<group>"; }; + 1A3DD205125E5A2F004515E6 /* APIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = "<group>"; }; + 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlatformStrategies.h; sourceTree = "<group>"; }; + 1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformStrategies.cpp; sourceTree = "<group>"; }; + 1A433F0C113C53DD00FACDE9 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; }; + 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextInputWindowController.h; sourceTree = "<group>"; }; + 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKTextInputWindowController.mm; sourceTree = "<group>"; }; + 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; }; + 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; }; + 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginModuleMac.mm; sourceTree = "<group>"; }; + 1A4A9F3112B844E2008FE984 /* PluginQuirks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginQuirks.h; sourceTree = "<group>"; }; + 1A4F976A100E7B6600637A18 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; }; + 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; }; + 1A4F976C100E7B6600637A18 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; }; + 1A4F976E100E7B6600637A18 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; }; + 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebProcess.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1A594AB8112A1FB6009DE7C7 /* WebUIClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUIClient.cpp; sourceTree = "<group>"; }; + 1A594AB9112A1FB6009DE7C7 /* WebUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUIClient.h; sourceTree = "<group>"; }; + 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerState.h; sourceTree = "<group>"; }; + 1A61614D127798B5003ACD86 /* DownloadManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadManager.cpp; sourceTree = "<group>"; }; + 1A61614E127798B5003ACD86 /* DownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadManager.h; sourceTree = "<group>"; }; + 1A6161D21278981C003ACD86 /* Download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Download.h; sourceTree = "<group>"; }; + 1A6161D31278981C003ACD86 /* Download.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Download.cpp; sourceTree = "<group>"; }; + 1A61639512789B2F003ACD86 /* DownloadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DownloadMac.mm; sourceTree = "<group>"; }; + 1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableBitmap.cpp; sourceTree = "<group>"; }; + 1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareableBitmap.h; sourceTree = "<group>"; }; + 1A64218412DCF49200CAAE2C /* DrawingAreaProxyImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyImpl.h; sourceTree = "<group>"; }; + 1A64218512DCF49200CAAE2C /* DrawingAreaProxyImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxyImpl.cpp; sourceTree = "<group>"; }; + 1A6421F412DCFBAB00CAAE2C /* DrawingAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaImpl.h; sourceTree = "<group>"; }; + 1A6421F512DCFBAB00CAAE2C /* DrawingAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaImpl.cpp; sourceTree = "<group>"; }; + 1A64228A12DD024700CAAE2C /* DrawingArea.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DrawingArea.messages.in; sourceTree = "<group>"; }; + 1A64229712DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A64229812DD029200CAAE2C /* DrawingAreaMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaMessages.h; sourceTree = "<group>"; }; + 1A6422FC12DD08FE00CAAE2C /* DrawingAreaProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DrawingAreaProxy.messages.in; sourceTree = "<group>"; }; + 1A64230612DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyMessages.h; sourceTree = "<group>"; }; + 1A64235012DD187C00CAAE2C /* Region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Region.cpp; sourceTree = "<group>"; }; + 1A64235112DD187C00CAAE2C /* Region.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Region.h; sourceTree = "<group>"; }; + 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateInfo.h; sourceTree = "<group>"; }; + 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateInfo.cpp; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + 1A6FA01F11E1528700DB1371 /* WebProcessMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessMain.h; sourceTree = "<group>"; }; + 1A6FA31011E3921E00DB1371 /* MainMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MainMac.cpp; path = mac/MainMac.cpp; sourceTree = "<group>"; }; + 1A6FA31511E3923600DB1371 /* WebKitMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitMain.cpp; sourceTree = "<group>"; }; + 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginView.cpp; sourceTree = "<group>"; }; + 1A6FB7AD11E64B6800DB1371 /* PluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginView.h; sourceTree = "<group>"; }; + 1A6FB7D011E651E200DB1371 /* Plugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Plugin.cpp; sourceTree = "<group>"; }; + 1A6FB7D111E651E200DB1371 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; }; + 1A6FBA2811E6862700DB1371 /* NetscapeBrowserFuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapeBrowserFuncs.h; sourceTree = "<group>"; }; + 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapeBrowserFuncs.cpp; sourceTree = "<group>"; }; + 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePlugin.h; sourceTree = "<group>"; }; + 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugin.cpp; sourceTree = "<group>"; }; + 1A8EF4C91252403700F7067F /* PluginControllerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginControllerProxy.h; sourceTree = "<group>"; }; + 1A8EF4CA1252403700F7067F /* PluginControllerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginControllerProxy.cpp; sourceTree = "<group>"; }; + 1A8EF9411252AE8400F7067F /* PluginControllerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginControllerProxy.messages.in; sourceTree = "<group>"; }; + 1A8EF96C1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginControllerProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A8EF96D1252AF6B00F7067F /* PluginControllerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginControllerProxyMessages.h; sourceTree = "<group>"; }; + 1A8EFA5B1252B7CE00F7067F /* PluginProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProxy.messages.in; sourceTree = "<group>"; }; + 1A8EFA6E1252B84100F7067F /* PluginProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProxyMessages.h; sourceTree = "<group>"; }; + 1A8EFDF91253CAA200F7067F /* DataReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataReference.h; sourceTree = "<group>"; }; + 1A8EFDFD1253CB6E00F7067F /* DataReference.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataReference.cpp; sourceTree = "<group>"; }; + 1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFindOptions.h; sourceTree = "<group>"; }; + 1A90C1F21264FD71003E44D4 /* FindController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindController.h; sourceTree = "<group>"; }; + 1A90C1F31264FD71003E44D4 /* FindController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindController.cpp; sourceTree = "<group>"; }; + 1A90C23512650717003E44D4 /* PageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageOverlay.h; sourceTree = "<group>"; }; + 1A90C23612650717003E44D4 /* PageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlay.cpp; sourceTree = "<group>"; }; + 1A91006F126675C3001842F5 /* FindIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicator.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; + 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGUtilities.h; sourceTree = "<group>"; }; + 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CGUtilities.cpp; sourceTree = "<group>"; }; + 1AA417C912C00CCA002BE67B /* TextChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecker.h; sourceTree = "<group>"; }; + 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextCheckerMac.mm; sourceTree = "<group>"; }; + 1AA41AB412C02EC4002BE67B /* SelectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionState.h; sourceTree = "<group>"; }; + 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessMac.mm; sourceTree = "<group>"; }; + 1AA56F2811E92BC80061B882 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; }; + 1AA5889011EE70400061B882 /* NetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginStream.h; sourceTree = "<group>"; }; + 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginStream.cpp; sourceTree = "<group>"; }; + 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxExtension.h; sourceTree = "<group>"; }; + 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SandboxExtensionMac.mm; sourceTree = "<group>"; }; + 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; + 1AAF061212B01131008E49E2 /* PDFViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFViewController.h; sourceTree = "<group>"; }; + 1AAF061312B01131008E49E2 /* PDFViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFViewController.mm; sourceTree = "<group>"; }; + 1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCodersCF.h; sourceTree = "<group>"; }; + 1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentCodersCF.cpp; sourceTree = "<group>"; }; + 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxy.h; sourceTree = "<group>"; }; + 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxy.cpp; sourceTree = "<group>"; }; + 1AB7D5E91288B8C000CFD08C /* DownloadProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DownloadProxy.messages.in; sourceTree = "<group>"; }; + 1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1AB7D6181288B9D900CFD08C /* DownloadProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxyMessages.h; sourceTree = "<group>"; }; + 1AB7D72A1288CAAD00CFD08C /* WebDownloadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDownloadClient.h; sourceTree = "<group>"; }; + 1AB7D72B1288CAAD00CFD08C /* WebDownloadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDownloadClient.cpp; sourceTree = "<group>"; }; + 1AB7D78B1288CD9A00CFD08C /* WKDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDownload.h; sourceTree = "<group>"; }; + 1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKDownload.cpp; sourceTree = "<group>"; }; + 1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessShim.h; sourceTree = "<group>"; }; + 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessShim.cpp; sourceTree = "<group>"; }; + 1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = PluginProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 1AC25FBB12A48EDA00BD2671 /* PluginProcessShim.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = PluginProcessShim.xcconfig; sourceTree = "<group>"; }; + 1AC41AC51263C88300054E94 /* BinarySemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinarySemaphore.h; sourceTree = "<group>"; }; + 1AC41AC61263C88300054E94 /* BinarySemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinarySemaphore.cpp; sourceTree = "<group>"; }; + 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; }; + 1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; }; + 1AE4976711FF658E0048B464 /* NPJSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObject.cpp; sourceTree = "<group>"; }; + 1AE4987611FF7FAA0048B464 /* JSNPObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNPObject.h; sourceTree = "<group>"; }; + 1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNPObject.cpp; sourceTree = "<group>"; }; + 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNPMethod.h; sourceTree = "<group>"; }; + 1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNPMethod.cpp; sourceTree = "<group>"; }; + 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginMac.mm; sourceTree = "<group>"; }; + 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; }; + 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; }; + 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginInfoStoreMac.mm; sourceTree = "<group>"; }; + 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCoder.h; sourceTree = "<group>"; }; + 1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCoders.h; sourceTree = "<group>"; }; + 1C77C1951288A872006A742F /* WebInspectorProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebInspectorProxy.messages.in; sourceTree = "<group>"; }; + 1C8E256A1270DE3800BC7BD0 /* WebInspectorFrontendClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorFrontendClient.h; sourceTree = "<group>"; }; + 1C8E256B1270DE3800BC7BD0 /* WebInspectorFrontendClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorFrontendClient.cpp; sourceTree = "<group>"; }; + 1C8E281E1275D15400BC7BD0 /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; + 1C8E281F1275D15400BC7BD0 /* WebInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspector.cpp; sourceTree = "<group>"; }; + 1C8E28321275D73800BC7BD0 /* WebInspectorProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorProxy.h; sourceTree = "<group>"; }; + 1C8E28331275D73800BC7BD0 /* WebInspectorProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorProxy.cpp; sourceTree = "<group>"; }; + 1C8E293712761E5B00BC7BD0 /* WKInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKInspector.h; sourceTree = "<group>"; }; + 1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKInspector.cpp; sourceTree = "<group>"; }; + 1C8E2A1C1277833F00BC7BD0 /* WebInspector.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebInspector.messages.in; sourceTree = "<group>"; }; + 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorMessageReceiver.cpp; sourceTree = "<group>"; }; + 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorMessages.h; sourceTree = "<group>"; }; + 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorMac.mm; sourceTree = "<group>"; }; + 1CA8B935127C774E00576C2B /* WebInspectorProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorProxyMac.mm; sourceTree = "<group>"; }; + 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorProxyMessages.h; sourceTree = "<group>"; }; + 29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityWebPageObject.h; sourceTree = "<group>"; }; + 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityWebPageObject.mm; sourceTree = "<group>"; }; + 32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; }; + 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; }; + 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClientMac.mm; sourceTree = "<group>"; }; + 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; }; + 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; }; + 512935D51288D19400A4B695 /* WebContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItem.cpp; sourceTree = "<group>"; }; + 512935D61288D19400A4B695 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; }; + 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageContextMenuClient.cpp; sourceTree = "<group>"; }; + 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; }; + 512F588712A8836600629530 /* AuthenticationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationManager.cpp; sourceTree = "<group>"; }; + 512F588812A8836600629530 /* AuthenticationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationManager.h; sourceTree = "<group>"; }; + 512F588912A8836600629530 /* AuthenticationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AuthenticationManager.messages.in; sourceTree = "<group>"; }; + 512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallengeProxy.cpp; sourceTree = "<group>"; }; + 512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeProxy.h; sourceTree = "<group>"; }; + 512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationDecisionListener.cpp; sourceTree = "<group>"; }; + 512F589112A8838800629530 /* AuthenticationDecisionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationDecisionListener.h; sourceTree = "<group>"; }; + 512F589212A8838800629530 /* WebCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCredential.cpp; sourceTree = "<group>"; }; + 512F589312A8838800629530 /* WebCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCredential.h; sourceTree = "<group>"; }; + 512F589412A8838800629530 /* WebProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProtectionSpace.cpp; sourceTree = "<group>"; }; + 512F589512A8838800629530 /* WebProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProtectionSpace.h; sourceTree = "<group>"; }; + 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationManagerMessageReceiver.cpp; sourceTree = "<group>"; }; + 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationManagerMessages.h; sourceTree = "<group>"; }; + 512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKAuthenticationChallenge.cpp; sourceTree = "<group>"; }; + 512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAuthenticationChallenge.h; sourceTree = "<group>"; }; + 512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKAuthenticationDecisionListener.cpp; sourceTree = "<group>"; }; + 512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAuthenticationDecisionListener.h; sourceTree = "<group>"; }; + 512F58F112A88A5400629530 /* WKCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKCredential.cpp; sourceTree = "<group>"; }; + 512F58F212A88A5400629530 /* WKCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCredential.h; sourceTree = "<group>"; }; + 512F58F312A88A5400629530 /* WKProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKProtectionSpace.cpp; sourceTree = "<group>"; }; + 512F58F412A88A5400629530 /* WKProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProtectionSpace.h; sourceTree = "<group>"; }; + 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageContextMenuClient.cpp; sourceTree = "<group>"; }; + 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageContextMenuClient.h; sourceTree = "<group>"; }; + 51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; }; + 516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; }; + 51871B59127CB89D00F76232 /* WebContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenu.cpp; sourceTree = "<group>"; }; + 51871B5A127CB89D00F76232 /* WebContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenu.h; sourceTree = "<group>"; }; + 518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProtectionSpaceTypes.h; sourceTree = "<group>"; }; + 518ACF1012B015F800B04B83 /* WKCredentialTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCredentialTypes.h; sourceTree = "<group>"; }; + 518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebBackForwardListItem.cpp; sourceTree = "<group>"; }; + 518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListItem.h; sourceTree = "<group>"; }; + 518D2CC812D51DFB003BB93B /* SessionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionState.cpp; sourceTree = "<group>"; }; + 518D2CC912D51DFB003BB93B /* SessionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionState.h; sourceTree = "<group>"; }; + 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = "<group>"; }; + 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = "<group>"; }; + 51A55600128C6D92009ABCEC /* WKContextMenuItemTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItemTypes.h; sourceTree = "<group>"; }; + 51A7F2F2125BF820008AEB1D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; }; + 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logging.cpp; sourceTree = "<group>"; }; + 51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuProxy.cpp; sourceTree = "<group>"; }; + 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxy.h; sourceTree = "<group>"; }; + 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxyMac.h; sourceTree = "<group>"; }; + 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuProxyMac.mm; sourceTree = "<group>"; }; + 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 8DC2EF5B0486A6940098B216 /* WebKit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebMemorySampler.mac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 905620E812BC248B000799B6 /* WebMemorySampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMemorySampler.cpp; sourceTree = "<group>"; }; + 905620E912BC248B000799B6 /* WebMemorySampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMemorySampler.h; sourceTree = "<group>"; }; + 935EEB8F1277615D003322B8 /* InjectedBundleBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBackForwardList.cpp; sourceTree = "<group>"; }; + 935EEB901277615D003322B8 /* InjectedBundleBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleBackForwardList.h; sourceTree = "<group>"; }; + 935EEB911277615D003322B8 /* InjectedBundleBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBackForwardListItem.cpp; sourceTree = "<group>"; }; + 935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleBackForwardListItem.h; sourceTree = "<group>"; }; + 935EEB951277616D003322B8 /* WKBundleBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleBackForwardList.cpp; sourceTree = "<group>"; }; + 935EEB961277616D003322B8 /* WKBundleBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleBackForwardList.h; sourceTree = "<group>"; }; + 935EEB971277616D003322B8 /* WKBundleBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleBackForwardListItem.cpp; sourceTree = "<group>"; }; + 935EEB981277616D003322B8 /* WKBundleBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleBackForwardListItem.h; sourceTree = "<group>"; }; + 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = "<group>"; }; + 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameNetworkingContext.mm; sourceTree = "<group>"; }; + 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecoderAdapter.cpp; sourceTree = "<group>"; }; + 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecoderAdapter.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC032D6210F4378D0058C15A /* WebContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuClient.h; sourceTree = "<group>"; }; + BC032D6610F4378D0058C15A /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; }; + BC032D6810F4378D0058C15A /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; }; + BC032D6A10F4378D0058C15A /* WebFrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameLoaderClient.h; sourceTree = "<group>"; }; + BC032D6D10F4378D0058C15A /* WebInspectorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorClient.h; sourceTree = "<group>"; }; + BC032D8910F437A00058C15A /* WebFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrame.h; sourceTree = "<group>"; }; + BC032D8B10F437A00058C15A /* WebPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPage.h; sourceTree = "<group>"; }; + BC032D9110F437AF0058C15A /* WebProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcess.h; sourceTree = "<group>"; }; + BC032D9D10F437D10058C15A /* ArgumentDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentDecoder.cpp; sourceTree = "<group>"; }; + BC032D9E10F437D10058C15A /* ArgumentDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentDecoder.h; sourceTree = "<group>"; }; + BC032D9F10F437D10058C15A /* ArgumentEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgumentEncoder.cpp; sourceTree = "<group>"; }; + BC032DA010F437D10058C15A /* ArgumentEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentEncoder.h; sourceTree = "<group>"; }; + BC032DA110F437D10058C15A /* Arguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Arguments.h; sourceTree = "<group>"; }; + BC032DA210F437D10058C15A /* Connection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Connection.cpp; sourceTree = "<group>"; }; + BC032DA310F437D10058C15A /* Connection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Connection.h; sourceTree = "<group>"; }; + BC032DA410F437D10058C15A /* MessageID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageID.h; sourceTree = "<group>"; }; + BC032DAF10F4380F0058C15A /* WebEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEvent.h; sourceTree = "<group>"; }; + BC032DB010F4380F0058C15A /* WebEventConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEventConversion.cpp; sourceTree = "<group>"; }; + BC032DB110F4380F0058C15A /* WebEventConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEventConversion.h; sourceTree = "<group>"; }; + BC032DCB10F4389F0058C15A /* WebPageProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageProxy.h; sourceTree = "<group>"; }; + BC032DCD10F4389F0058C15A /* WebProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessManager.h; sourceTree = "<group>"; }; + BC032DCF10F4389F0058C15A /* WebProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxy.h; sourceTree = "<group>"; }; + BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestManager.h; sourceTree = "<group>"; }; + BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestManager.cpp; sourceTree = "<group>"; }; + BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestProxy.h; sourceTree = "<group>"; }; + BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestProxy.cpp; sourceTree = "<group>"; }; + BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPermissionRequestManagerProxy.h; sourceTree = "<group>"; }; + BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPermissionRequestManagerProxy.cpp; sourceTree = "<group>"; }; + BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeolocationPermissionRequest.h; sourceTree = "<group>"; }; + BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeolocationPermissionRequest.cpp; sourceTree = "<group>"; }; + BC0E5FE312D697160012A72A /* WebGeolocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationManager.h; sourceTree = "<group>"; }; + BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationManager.cpp; sourceTree = "<group>"; }; + BC0E604812D6B6370012A72A /* WebGeolocationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGeolocationManager.messages.in; sourceTree = "<group>"; }; + BC0E605F12D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationManagerMessageReceiver.cpp; sourceTree = "<group>"; }; + BC0E606012D6BA910012A72A /* WebGeolocationManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationManagerMessages.h; sourceTree = "<group>"; }; + BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationPosition.h; sourceTree = "<group>"; }; + BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationPosition.cpp; sourceTree = "<group>"; }; + BC0E615212D6CAC80012A72A /* WebGeolocationManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGeolocationManagerProxy.messages.in; sourceTree = "<group>"; }; + BC0E618012D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + BC0E618112D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationManagerProxyMessages.h; sourceTree = "<group>"; }; + BC0E619612D6CD120012A72A /* WKGeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeolocationPosition.h; sourceTree = "<group>"; }; + BC0E619712D6CD120012A72A /* WKGeolocationPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeolocationPosition.cpp; sourceTree = "<group>"; }; + BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebChromeClient.cpp; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC111AE3112F5C2600337BAB /* WebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcess.cpp; sourceTree = "<group>"; }; + BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimer.cpp; sourceTree = "<group>"; }; + BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameProxy.cpp; sourceTree = "<group>"; }; + BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = WebPageProxy.cpp; sourceTree = "<group>"; }; + BC111B0C112F5E4F00337BAB /* WebProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessManager.cpp; sourceTree = "<group>"; }; + BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessProxy.cpp; sourceTree = "<group>"; }; + BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessLauncherMac.mm; sourceTree = "<group>"; }; + BC111B4B112F619200337BAB /* PageClientImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImpl.h; sourceTree = "<group>"; }; + BC111B4C112F619200337BAB /* PageClientImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImpl.mm; sourceTree = "<group>"; }; + BC111B5B112F629800337BAB /* WebEventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEventFactory.h; sourceTree = "<group>"; }; + BC111B5C112F629800337BAB /* WebEventFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEventFactory.mm; sourceTree = "<group>"; }; + BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreIPCMessageKinds.h; sourceTree = "<group>"; }; + BC14DF75120B5B7900826C0C /* InjectedBundleScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleScriptWorld.h; sourceTree = "<group>"; }; + BC14DF76120B5B7900826C0C /* InjectedBundleScriptWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleScriptWorld.cpp; sourceTree = "<group>"; }; + BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleScriptWorld.cpp; sourceTree = "<group>"; }; + BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleScriptWorld.h; sourceTree = "<group>"; }; + BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageFormClient.cpp; sourceTree = "<group>"; }; + BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageFormClient.h; sourceTree = "<group>"; }; + BC177464118B9FF4007D9E9A /* WKPagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPagePrivate.h; sourceTree = "<group>"; }; + BC17753E118BABF0007D9E9A /* GenericCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCallback.h; sourceTree = "<group>"; }; + BC1A7C571136E19C00FB7167 /* ProcessLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessLauncher.h; sourceTree = "<group>"; }; + BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePagePrivate.h; sourceTree = "<group>"; }; + BC1BE1DE12D54A410004A228 /* WebGeolocationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationClient.h; sourceTree = "<group>"; }; + BC1BE1DF12D54A410004A228 /* WebGeolocationClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationClient.cpp; sourceTree = "<group>"; }; + BC1BE1F012D54DBD0004A228 /* WebGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationProvider.h; sourceTree = "<group>"; }; + BC1BE1F112D54DBD0004A228 /* WebGeolocationProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationProvider.cpp; sourceTree = "<group>"; }; + BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreArgumentCoders.h; sourceTree = "<group>"; }; + BC1DFE8D12B31CA8005DF730 /* WKOpenPanelResultListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelResultListener.h; sourceTree = "<group>"; }; + BC1DFE8E12B31CA8005DF730 /* WKOpenPanelResultListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKOpenPanelResultListener.cpp; sourceTree = "<group>"; }; + BC1DFEA212B31F87005DF730 /* WebOpenPanelResultListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelResultListenerProxy.h; sourceTree = "<group>"; }; + BC1DFEA312B31F87005DF730 /* WebOpenPanelResultListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOpenPanelResultListenerProxy.cpp; sourceTree = "<group>"; }; + BC204EE011C83E98008F3375 /* InjectedBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundle.cpp; sourceTree = "<group>"; }; + BC204EE111C83E98008F3375 /* InjectedBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundle.h; sourceTree = "<group>"; }; + BC204EE511C83EA9008F3375 /* InjectedBundleMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMac.cpp; sourceTree = "<group>"; }; + BC204EE911C83EC8008F3375 /* WKBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundle.cpp; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC2652131182608100243E12 /* DrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxy.h; sourceTree = "<group>"; }; + BC2652141182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingAreaProxy.cpp; sourceTree = "<group>"; }; + BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChunkedUpdateDrawingAreaProxy.h; sourceTree = "<group>"; }; + BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SameDocumentNavigationType.h; sourceTree = "<group>"; }; + BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypes.h; sourceTree = "<group>"; }; + BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesCF.cpp; path = cf/WebPreferencesCF.cpp; sourceTree = "<group>"; }; + BC2E6E771141970C00A63B1E /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; }; + BC2E6E781141970C00A63B1E /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; }; + BC2E6E7C1141970C00A63B1E /* WorkItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkItem.h; sourceTree = "<group>"; }; + BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; + BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; + BC3065C312592F8900E71278 /* WebProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessMac.mm; sourceTree = "<group>"; }; + BC3065F91259344E00E71278 /* CacheModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheModel.h; sourceTree = "<group>"; }; + BC3066B9125A436300E71278 /* WebProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcess.messages.in; sourceTree = "<group>"; }; + BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessMessageReceiver.cpp; sourceTree = "<group>"; }; + BC3066BD125A442100E71278 /* WebProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessMessages.h; sourceTree = "<group>"; }; + BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessCreationParameters.h; sourceTree = "<group>"; }; + BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessCreationParameters.cpp; sourceTree = "<group>"; }; + BC33DD671238464600360F3F /* WebNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNumber.h; sourceTree = "<group>"; }; + BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleRangeHandle.h; sourceTree = "<group>"; }; + BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleRangeHandle.cpp; sourceTree = "<group>"; }; + BC4075D7124FF0270068F20A /* WKArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKArray.cpp; sourceTree = "<group>"; }; + BC4075D8124FF0270068F20A /* WKArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKArray.h; sourceTree = "<group>"; }; + BC4075D9124FF0270068F20A /* WKCertificateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKCertificateInfo.cpp; sourceTree = "<group>"; }; + BC4075DA124FF0270068F20A /* WKCertificateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCertificateInfo.h; sourceTree = "<group>"; }; + BC4075DB124FF0270068F20A /* WKData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKData.cpp; sourceTree = "<group>"; }; + BC4075DC124FF0270068F20A /* WKData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKData.h; sourceTree = "<group>"; }; + BC4075DD124FF0270068F20A /* WKDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKDictionary.cpp; sourceTree = "<group>"; }; + BC4075DE124FF0270068F20A /* WKDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDictionary.h; sourceTree = "<group>"; }; + BC4075DF124FF0270068F20A /* WKError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKError.cpp; sourceTree = "<group>"; }; + BC4075E0124FF0270068F20A /* WKError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKError.h; sourceTree = "<group>"; }; + BC4075E1124FF0270068F20A /* WKMutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMutableArray.cpp; sourceTree = "<group>"; }; + BC4075E2124FF0270068F20A /* WKMutableArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMutableArray.h; sourceTree = "<group>"; }; + BC4075E3124FF0270068F20A /* WKMutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMutableDictionary.cpp; sourceTree = "<group>"; }; + BC4075E4124FF0270068F20A /* WKMutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKMutableDictionary.h; sourceTree = "<group>"; }; + BC4075E5124FF0270068F20A /* WKNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNumber.cpp; sourceTree = "<group>"; }; + BC4075E6124FF0270068F20A /* WKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNumber.h; sourceTree = "<group>"; }; + BC4075E7124FF0270068F20A /* WKSerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKSerializedScriptValue.cpp; sourceTree = "<group>"; }; + BC4075E8124FF0270068F20A /* WKSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSerializedScriptValue.h; sourceTree = "<group>"; }; + BC4075E9124FF0270068F20A /* WKString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKString.cpp; sourceTree = "<group>"; }; + BC4075EA124FF0270068F20A /* WKString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKString.h; sourceTree = "<group>"; }; + BC4075EB124FF0270068F20A /* WKType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKType.cpp; sourceTree = "<group>"; }; + BC4075EC124FF0270068F20A /* WKType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKType.h; sourceTree = "<group>"; }; + BC4075ED124FF0270068F20A /* WKURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURL.cpp; sourceTree = "<group>"; }; + BC4075EE124FF0270068F20A /* WKURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURL.h; sourceTree = "<group>"; }; + BC4075EF124FF0270068F20A /* WKURLRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURLRequest.cpp; sourceTree = "<group>"; }; + BC4075F0124FF0270068F20A /* WKURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLRequest.h; sourceTree = "<group>"; }; + BC4075F1124FF0270068F20A /* WKURLResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURLResponse.cpp; sourceTree = "<group>"; }; + BC4075F2124FF0270068F20A /* WKURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLResponse.h; sourceTree = "<group>"; }; + BC407611124FF0370068F20A /* WKStringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKStringCF.cpp; sourceTree = "<group>"; }; + BC407612124FF0370068F20A /* WKStringCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStringCF.h; sourceTree = "<group>"; }; + BC407613124FF0370068F20A /* WKURLCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURLCF.cpp; sourceTree = "<group>"; }; + BC407614124FF0370068F20A /* WKURLCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLCF.h; sourceTree = "<group>"; }; + BC407621124FF0400068F20A /* WKCertificateInfoMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCertificateInfoMac.h; sourceTree = "<group>"; }; + BC407622124FF0400068F20A /* WKCertificateInfoMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKCertificateInfoMac.mm; sourceTree = "<group>"; }; + BC407623124FF0400068F20A /* WKURLRequestNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLRequestNS.h; sourceTree = "<group>"; }; + BC407624124FF0400068F20A /* WKURLRequestNS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKURLRequestNS.mm; sourceTree = "<group>"; }; + BC407625124FF0400068F20A /* WKURLResponseNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLResponseNS.h; sourceTree = "<group>"; }; + BC407626124FF0400068F20A /* WKURLResponseNS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKURLResponseNS.mm; sourceTree = "<group>"; }; + BC40783C1250FADD0068F20A /* WKEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKEvent.h; sourceTree = "<group>"; }; + BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResult.h; sourceTree = "<group>"; }; + BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleHitTestResult.cpp; sourceTree = "<group>"; }; + BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleHitTestResult.h; sourceTree = "<group>"; }; + BC49862E124D18C100D834E1 /* WKBundleHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleHitTestResult.cpp; sourceTree = "<group>"; }; + BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleNodeHandle.h; sourceTree = "<group>"; }; + BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleNodeHandle.cpp; sourceTree = "<group>"; }; + BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNodeHandle.h; sourceTree = "<group>"; }; + BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleNodeHandle.cpp; sourceTree = "<group>"; }; + BC54CAC912D64291005C67B0 /* WebGeolocationManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationManagerProxy.h; sourceTree = "<group>"; }; + BC54CACA12D64291005C67B0 /* WebGeolocationManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGeolocationManagerProxy.cpp; sourceTree = "<group>"; }; + BC54CC1012D674EE005C67B0 /* WKGeolocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeolocationManager.h; sourceTree = "<group>"; }; + BC54CC1112D674EE005C67B0 /* WKGeolocationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeolocationManager.cpp; sourceTree = "<group>"; }; + BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupItem.cpp; sourceTree = "<group>"; }; + BC5744EE12638FB3006F0F12 /* WebPopupItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupItem.h; sourceTree = "<group>"; }; + BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleNodeHandlePrivate.h; sourceTree = "<group>"; }; + BC574E611267D080006F0F12 /* WebPopupMenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenuProxy.h; sourceTree = "<group>"; }; + BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenuProxyMac.h; sourceTree = "<group>"; }; + BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPopupMenuProxyMac.mm; sourceTree = "<group>"; }; + BC575612126E0138006F0F12 /* WebError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebError.cpp; sourceTree = "<group>"; }; + BC59534010FC04520098F82D /* WebLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebLoaderClient.h; sourceTree = "<group>"; }; + BC597074116591D000551FCA /* ProcessModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessModel.h; sourceTree = "<group>"; }; + BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingArea.cpp; sourceTree = "<group>"; }; + BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChunkedUpdateDrawingArea.h; sourceTree = "<group>"; }; + BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingAreaMac.cpp; sourceTree = "<group>"; }; + BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleRangeHandle.h; sourceTree = "<group>"; }; + BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleRangeHandle.cpp; sourceTree = "<group>"; }; + BC64696D11DBE603006455B0 /* ImmutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableArray.cpp; sourceTree = "<group>"; }; + BC64696E11DBE603006455B0 /* ImmutableArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmutableArray.h; sourceTree = "<group>"; }; + BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBackForwardList.cpp; sourceTree = "<group>"; }; + BC646C1711DD399F006455B0 /* WKBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardList.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardList.h; sourceTree = "<group>"; }; + BC7B6204129A0A6700D174A4 /* WebPageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroup.h; sourceTree = "<group>"; }; + BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroup.cpp; sourceTree = "<group>"; }; + BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxy.h; sourceTree = "<group>"; }; + BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxy.cpp; sourceTree = "<group>"; }; + BC7B625012A43C9600D174A4 /* WebPageGroupData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupData.h; sourceTree = "<group>"; }; + BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupData.cpp; sourceTree = "<group>"; }; + BC7B633512A45ABA00D174A4 /* WKPageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageGroup.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageProxyMac.mm; sourceTree = "<group>"; }; + BC857F8312B82D0B00EDEB2E /* WebOpenPanelResultListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelResultListener.h; sourceTree = "<group>"; }; + BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOpenPanelResultListener.cpp; sourceTree = "<group>"; }; + BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelParameters.h; sourceTree = "<group>"; }; + BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOpenPanelParameters.cpp; sourceTree = "<group>"; }; + BC857FE412B843D800EDEB2E /* WKOpenPanelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParameters.h; sourceTree = "<group>"; }; + BC857FE512B843D800EDEB2E /* WKOpenPanelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKOpenPanelParameters.cpp; sourceTree = "<group>"; }; + BC858A1E12C0357B00EDEB2E /* WebResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadClient.h; sourceTree = "<group>"; }; + BC858A1F12C0357B00EDEB2E /* WebResourceLoadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadClient.cpp; sourceTree = "<group>"; }; + BC8699B2116AADAA002A925B /* WKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKView.h; sourceTree = "<group>"; }; + BC8699B3116AADAA002A925B /* WKView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKView.mm; sourceTree = "<group>"; }; + BC8699B4116AADAA002A925B /* WKViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKViewInternal.h; sourceTree = "<group>"; }; + BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformProcessIdentifier.h; sourceTree = "<group>"; }; + BC87DFA91018101400564216 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; }; + BC8A501011765AF700757573 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebProcess/Info.plist; sourceTree = "<group>"; }; + BC8A501411765F5600757573 /* WKRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRetainPtr.h; sourceTree = "<group>"; }; + BC90997F1256A98200083756 /* WKStringPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStringPrivate.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BC9E95D111449B0300870E71 /* UpdateChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateChunk.h; sourceTree = "<group>"; }; + BC9E95D211449B0300870E71 /* UpdateChunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateChunk.cpp; sourceTree = "<group>"; }; + BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyMessageKinds.h; sourceTree = "<group>"; }; + BC9E969B11457F3F00870E71 /* DrawingAreaMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaMessageKinds.h; sourceTree = "<group>"; }; + BCA0EF7D12331E78007D3CFB /* WebEditCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEditCommand.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageUIClient.h; sourceTree = "<group>"; }; + BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxyClient.h; sourceTree = "<group>"; }; + BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyClient.cpp; sourceTree = "<group>"; }; + BCB0AEE7122F53E300B1341E /* MutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableDictionary.h; sourceTree = "<group>"; }; + BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutableDictionary.cpp; sourceTree = "<group>"; }; + BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextUserMessageCoders.h; sourceTree = "<group>"; }; + BCB0B0DD12305A8C00B1341E /* InjectedBundleUserMessageCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleUserMessageCoders.h; sourceTree = "<group>"; }; + BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMessageCoders.h; sourceTree = "<group>"; }; + BCB28CBF120233D9007D99BC /* InjectedBundleMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleMessageKinds.h; sourceTree = "<group>"; }; + BCB63477116BF10600603215 /* WebKit2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2.h; sourceTree = "<group>"; }; + BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxyMessageKinds.h; sourceTree = "<group>"; }; + BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebKit2.xcconfig; sourceTree = "<group>"; }; + BCB9E2411120DACA00A137E0 /* WebContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContext.h; sourceTree = "<group>"; }; + BCB9E2421120DACA00A137E0 /* WebContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContext.cpp; sourceTree = "<group>"; }; + BCB9E2491120E15C00A137E0 /* WKContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContext.h; sourceTree = "<group>"; }; + BCB9E24A1120E15C00A137E0 /* WKContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContext.cpp; sourceTree = "<group>"; }; + BCB9E76111232B9E00A137E0 /* WebLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebLoaderClient.cpp; sourceTree = "<group>"; }; + BCB9F69E1123A84B00A137E0 /* WebFramePolicyListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePolicyListenerProxy.h; sourceTree = "<group>"; }; + BCB9F69F1123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFramePolicyListenerProxy.cpp; sourceTree = "<group>"; }; + BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFramePolicyListener.h; sourceTree = "<group>"; }; + BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFramePolicyListener.cpp; sourceTree = "<group>"; }; + BCB9F8AD1124E07700A137E0 /* WebPolicyClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPolicyClient.cpp; sourceTree = "<group>"; }; + BCB9F8AE1124E07700A137E0 /* WebPolicyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPolicyClient.h; sourceTree = "<group>"; }; + BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmutableDictionary.h; sourceTree = "<group>"; }; + BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImmutableDictionary.cpp; sourceTree = "<group>"; }; + BCBD38FA125BAB9A00D2C29F /* WebPageProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPageProxy.messages.in; sourceTree = "<group>"; }; + BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + BCBD3913125BB1A800D2C29F /* WebPageProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageProxyMessages.h; sourceTree = "<group>"; }; + BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringPairVector.h; sourceTree = "<group>"; }; + BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformPopupMenuData.cpp; sourceTree = "<group>"; }; + BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformPopupMenuData.h; sourceTree = "<group>"; }; + BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPopupMenuMac.mm; sourceTree = "<group>"; }; + BCC56F771159957D001CCAF9 /* MachPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachPort.h; sourceTree = "<group>"; }; + BCC57159115ADAEF001CCAF9 /* WebSystemInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSystemInterface.h; sourceTree = "<group>"; }; + BCC5715A115ADAEF001CCAF9 /* WebSystemInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSystemInterface.mm; sourceTree = "<group>"; }; + BCC57161115ADB42001CCAF9 /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; }; + BCC8049D122F0D6B00103529 /* MutableArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutableArray.cpp; sourceTree = "<group>"; }; + BCC8049E122F0D6B00103529 /* MutableArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableArray.h; sourceTree = "<group>"; }; + BCC8B373125FB69000DE46A4 /* WKGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGeometry.h; sourceTree = "<group>"; }; + BCC938E01180DE440085E5FE /* WKContextPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextPrivate.h; sourceTree = "<group>"; }; + BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMessageKinds.h; sourceTree = "<group>"; }; + BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginAndDatabases.h; sourceTree = "<group>"; }; + BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OriginAndDatabases.cpp; sourceTree = "<group>"; }; + BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebImage.cpp; sourceTree = "<group>"; }; + BCCF6ABB12C91EF9008F9C35 /* WebImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebImage.h; sourceTree = "<group>"; }; + BCCF6AC012C91F34008F9C35 /* WKImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKImage.cpp; sourceTree = "<group>"; }; + BCCF6AC112C91F34008F9C35 /* WKImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKImage.h; sourceTree = "<group>"; }; + BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKImageCG.cpp; sourceTree = "<group>"; }; + BCCF6AC812C91F59008F9C35 /* WKImageCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKImageCG.h; sourceTree = "<group>"; }; + BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageOptions.h; sourceTree = "<group>"; }; + BCD0042C110C1E27003B8A67 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; }; + BCD01397110FA420003B8A67 /* WKFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrame.h; sourceTree = "<group>"; }; + BCD01398110FA420003B8A67 /* WKFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFrame.cpp; sourceTree = "<group>"; }; + BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleFrame.h; sourceTree = "<group>"; }; + BCD25F1611D6BDE100169B0E /* WKBundleFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFrame.cpp; sourceTree = "<group>"; }; + BCD597CE112B56AC00EC8C23 /* WKPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferences.h; sourceTree = "<group>"; }; + BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPreferences.cpp; sourceTree = "<group>"; }; + BCD597D4112B56DC00EC8C23 /* WKPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPage.cpp; sourceTree = "<group>"; }; + BCD597D5112B56DC00EC8C23 /* WKPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPage.h; sourceTree = "<group>"; }; + BCD597FD112B57BE00EC8C23 /* WebPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferences.h; sourceTree = "<group>"; }; + BCD597FE112B57BE00EC8C23 /* WebPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPreferences.cpp; sourceTree = "<group>"; }; + BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesStore.h; sourceTree = "<group>"; }; + BCD598AB112B7FDF00EC8C23 /* WebPreferencesStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPreferencesStore.cpp; sourceTree = "<group>"; }; + BCDB86C01200FB97007254BE /* WebURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURL.h; sourceTree = "<group>"; }; + BCDDB316124EBD130048D13C /* WKBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBase.h; sourceTree = "<group>"; }; + BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSharedAPICast.h; sourceTree = "<group>"; }; + BCDDB32C124EC2E10048D13C /* WKAPICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAPICast.h; sourceTree = "<group>"; }; + BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextInjectedBundleClient.h; sourceTree = "<group>"; }; + BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextInjectedBundleClient.cpp; sourceTree = "<group>"; }; + BCE2315B122C30CA00D5C35A /* WebURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURLRequest.h; sourceTree = "<group>"; }; + BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLRequest.cpp; sourceTree = "<group>"; }; + BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebURLRequestMac.mm; sourceTree = "<group>"; }; + BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreArgumentCodersMac.mm; sourceTree = "<group>"; }; + BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormClient.cpp; sourceTree = "<group>"; }; + BCE469501214E6CB000B98EB /* WebFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormClient.h; sourceTree = "<group>"; }; + BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormSubmissionListenerProxy.cpp; sourceTree = "<group>"; }; + BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormSubmissionListenerProxy.h; sourceTree = "<group>"; }; + BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFormSubmissionListener.cpp; sourceTree = "<group>"; }; + BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFormSubmissionListener.h; sourceTree = "<group>"; }; + BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameListenerProxy.h; sourceTree = "<group>"; }; + BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameListenerProxy.cpp; sourceTree = "<group>"; }; + BCEE7AB312817095009827DA /* WebProcessProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcessProxy.messages.in; sourceTree = "<group>"; }; + BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxyMessages.h; sourceTree = "<group>"; }; + BCEE7D0912846AED009827DA /* WebContext.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebContext.messages.in; sourceTree = "<group>"; }; + BCEE7D0B12846F69009827DA /* WebContextMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMessageReceiver.cpp; sourceTree = "<group>"; }; + BCEE7D0C12846F69009827DA /* WebContextMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMessages.h; sourceTree = "<group>"; }; + BCEE7DC3128B645D009827DA /* InjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleClient.h; sourceTree = "<group>"; }; + BCEE7DC4128B645D009827DA /* InjectedBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleClient.cpp; sourceTree = "<group>"; }; + BCEE966A112FAF57006BCC24 /* Attachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Attachment.cpp; sourceTree = "<group>"; }; + BCEE966B112FAF57006BCC24 /* Attachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Attachment.h; sourceTree = "<group>"; }; + BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleFramePrivate.h; sourceTree = "<group>"; }; + BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePrivate.h; sourceTree = "<group>"; }; + BCF04C8C11FF9B7D00F86A58 /* APIObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIObject.h; sourceTree = "<group>"; }; + BCF04C8E11FF9F6E00F86A58 /* WebString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebString.h; sourceTree = "<group>"; }; + BCF5011F123ED3B3005955AE /* ThreadLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLauncher.h; sourceTree = "<group>"; }; + BCF50120123ED3B3005955AE /* ThreadLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadLauncher.cpp; sourceTree = "<group>"; }; + BCF501B3123EF602005955AE /* ThreadLauncherMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ThreadLauncherMac.mm; sourceTree = "<group>"; }; + BCF505E51243047B005955AE /* PlatformCertificateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCertificateInfo.h; sourceTree = "<group>"; }; + BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformCertificateInfo.mm; sourceTree = "<group>"; }; + BCF5068412431861005955AE /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; }; + BCF50726124329AA005955AE /* WebCertificateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCertificateInfo.h; sourceTree = "<group>"; }; + BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebHistoryClient.cpp; sourceTree = "<group>"; }; + BCF69F851176CD6F00471A52 /* WebHistoryClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryClient.h; sourceTree = "<group>"; }; + BCF69F981176CED600471A52 /* WebNavigationDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNavigationDataStore.h; sourceTree = "<group>"; }; + BCF69FA01176D01400471A52 /* WebNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNavigationData.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEvent.cpp; sourceTree = "<group>"; }; + C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMouseEvent.cpp; sourceTree = "<group>"; }; + C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebWheelEvent.cpp; sourceTree = "<group>"; }; + C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKeyboardEvent.cpp; sourceTree = "<group>"; }; + C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebTouchEvent.cpp; sourceTree = "<group>"; }; + C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformTouchPoint.cpp; sourceTree = "<group>"; }; + C06C6093124C14430001682F /* WebPageCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageCreationParameters.cpp; sourceTree = "<group>"; }; + C06C6094124C14430001682F /* WebPageCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageCreationParameters.h; sourceTree = "<group>"; }; + C08FDE87124A851C007645BD /* messages_unittest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = messages_unittest.py; sourceTree = "<group>"; }; + C09AE5E8125257C20025825D /* WKNativeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNativeEvent.h; sourceTree = "<group>"; }; + C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPage.messages.in; sourceTree = "<group>"; }; + C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageMessageReceiver.cpp; sourceTree = "<group>"; }; + C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageMessages.h; sourceTree = "<group>"; }; + C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleMessage.h; sourceTree = "<group>"; }; + C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DerivedSources.make; sourceTree = "<group>"; }; + C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-message-receiver.py"; sourceTree = "<group>"; }; + C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-messages-header.py"; sourceTree = "<group>"; }; + C0CE73391247F70E00BC0EC4 /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; }; + C0CE734612480B7D00BC0EC4 /* messages.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = messages.py; sourceTree = "<group>"; }; + C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; }; + C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; }; + C0E3AA481209E45000A49D01 /* ModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModuleMac.mm; sourceTree = "<group>"; }; + C517388012DF8F4F00EE3F47 /* DragControllerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragControllerAction.h; sourceTree = "<group>"; }; + C5237F5F12441CA300780472 /* WebEditorClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClientMac.mm; sourceTree = "<group>"; }; + D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupMenu.cpp; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageEditorClient.h; sourceTree = "<group>"; }; + E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageEditorClient.cpp; sourceTree = "<group>"; }; + F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentURLPattern.h; sourceTree = "<group>"; }; + F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserContentURLPattern.cpp; sourceTree = "<group>"; }; + F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentURLPattern.h; sourceTree = "<group>"; }; + F62A765712B1AB7D0005F1B6 /* WebDatabaseManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDatabaseManager.messages.in; sourceTree = "<group>"; }; + F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxy.cpp; sourceTree = "<group>"; }; + F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxy.h; sourceTree = "<group>"; }; + F62A765B12B1ABC30005F1B6 /* WebDatabaseManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDatabaseManagerProxy.messages.in; sourceTree = "<group>"; }; + F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKDatabaseManager.cpp; sourceTree = "<group>"; }; + F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDatabaseManager.h; sourceTree = "<group>"; }; + F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerMessageReceiver.cpp; sourceTree = "<group>"; }; + F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerMessages.h; sourceTree = "<group>"; }; + F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDatabaseManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; }; + F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerProxyMessages.h; sourceTree = "<group>"; }; + F634445512A885C8000612D8 /* WebSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOrigin.h; sourceTree = "<group>"; }; + 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 */ + +/* Begin PBXFrameworksBuildPhase section */ + 1AC25FAE12A48EA700BD2671 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */, + 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */, + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, + BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */, + BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */, + BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */, + 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */, + 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */, + BCF5068512431861005955AE /* Security.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* WebKit2.framework */, + 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */, + 1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */, + ); + name = Products; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 0867D691FE84028FC02AAC07 /* WebKit2 */ = { + isa = PBXGroup; + children = ( + C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */, + BC2E6E74114196F000A63B1E /* Platform */, + 1A0EC6B0124BBD36007EF4A5 /* PluginProcess */, + 1AADDF4B10D82AF000D3D63D /* Shared */, + BC032D5C10F436D50058C15A /* WebProcess */, + BC032DC310F438260058C15A /* UIProcess */, + 32C88DFF0371C24200C91783 /* Other Sources */, + C0CE729D1247E71D00BC0EC4 /* Derived Sources */, + C0CE73351247F70E00BC0EC4 /* Scripts */, + 089C1665FE841158C02AAC07 /* Resources */, + 1A4F9769100E7B6600637A18 /* Configurations */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = WebKit2; + sourceTree = "<group>"; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + BC8A500E11765AD400757573 /* WebKit2 */, + BC8A500F11765AE300757573 /* WebProcess */, + 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */, + 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */, + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, + BCD0042C110C1E27003B8A67 /* CoreServices.framework */, + 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */, + BC87DFA91018101400564216 /* libicucore.dylib */, + 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */, + 1AA1C79A100E7FC50078DEBC /* WebCore.framework */, + BCF5068412431861005955AE /* Security.framework */, + ); + name = "Linked Frameworks"; + sourceTree = "<group>"; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = "Other Frameworks"; + sourceTree = "<group>"; + }; + 1A0EC6B0124BBD36007EF4A5 /* PluginProcess */ = { + isa = PBXGroup; + children = ( + 1A0EC7FD124BD402007EF4A5 /* mac */, + 1A8EF4CA1252403700F7067F /* PluginControllerProxy.cpp */, + 1A8EF4C91252403700F7067F /* PluginControllerProxy.h */, + 1A8EF9411252AE8400F7067F /* PluginControllerProxy.messages.in */, + 1A043975124D034800FFBFB5 /* PluginProcess.cpp */, + 1A043974124D034800FFBFB5 /* PluginProcess.h */, + 1A0EC6B1124BBD36007EF4A5 /* PluginProcess.messages.in */, + 1A0EC7FA124BD3B6007EF4A5 /* PluginProcessMain.h */, + 1A043A08124D11A900FFBFB5 /* WebProcessConnection.cpp */, + 1A043A07124D11A900FFBFB5 /* WebProcessConnection.h */, + 1A043F5912514CF300FFBFB5 /* WebProcessConnection.messages.in */, + ); + path = PluginProcess; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 1A0EC7FD124BD402007EF4A5 /* mac */ = { + isa = PBXGroup; + children = ( + 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */, + 1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */, + 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */, + 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.cpp */, + 1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1A4A9C5212B816CF008FE984 /* Netscape */ = { + isa = PBXGroup; + children = ( + 1A4A9C9812B821C0008FE984 /* mac */, + 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */, + 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */, + ); + path = Netscape; + sourceTree = "<group>"; + }; + 1A4A9C9812B821C0008FE984 /* mac */ = { + isa = PBXGroup; + children = ( + 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1A4F9769100E7B6600637A18 /* Configurations */ = { + isa = PBXGroup; + children = ( + 1A4F976A100E7B6600637A18 /* Base.xcconfig */, + 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */, + 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */, + 1A4F976C100E7B6600637A18 /* FeatureDefines.xcconfig */, + 1AC25FBB12A48EDA00BD2671 /* PluginProcessShim.xcconfig */, + 1A4F976E100E7B6600637A18 /* Version.xcconfig */, + BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */, + 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */, + ); + path = Configurations; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 1A61614C127798B5003ACD86 /* Downloads */ = { + isa = PBXGroup; + children = ( + 1A61639412789B2F003ACD86 /* mac */, + 1A6161D31278981C003ACD86 /* Download.cpp */, + 1A6161D21278981C003ACD86 /* Download.h */, + 1A61614D127798B5003ACD86 /* DownloadManager.cpp */, + 1A61614E127798B5003ACD86 /* DownloadManager.h */, + ); + path = Downloads; + sourceTree = "<group>"; + }; + 1A61639412789B2F003ACD86 /* mac */ = { + isa = PBXGroup; + children = ( + 1A61639512789B2F003ACD86 /* DownloadMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1A6FA01C11E1526300DB1371 /* mac */ = { + isa = PBXGroup; + children = ( + 1A6FA01D11E1526300DB1371 /* WebProcessMainMac.mm */, + BC3065C312592F8900E71278 /* WebProcessMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1A6FB7AA11E64B4900DB1371 /* Plugins */ = { + isa = PBXGroup; + children = ( + 1A6FB90811E66FB100DB1371 /* Netscape */, + 1A6FB7D011E651E200DB1371 /* Plugin.cpp */, + 1A6FB7D111E651E200DB1371 /* Plugin.h */, + 1AA56F2811E92BC80061B882 /* PluginController.h */, + 1A0EC905124C0AB8007EF4A5 /* PluginProcessConnection.cpp */, + 1A0EC904124C0AB8007EF4A5 /* PluginProcessConnection.h */, + 1A0EC90E124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp */, + 1A0EC90D124C0AF5007EF4A5 /* PluginProcessConnectionManager.h */, + 1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */, + 1A043DBF124FF87500FFBFB5 /* PluginProxy.h */, + 1A8EFA5B1252B7CE00F7067F /* PluginProxy.messages.in */, + 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */, + 1A6FB7AD11E64B6800DB1371 /* PluginView.h */, + ); + path = Plugins; + sourceTree = "<group>"; + }; + 1A6FB90811E66FB100DB1371 /* Netscape */ = { + isa = PBXGroup; + children = ( + 1A6FBA0111E6812B00DB1371 /* mac */, + 1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */, + 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */, + 1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */, + 1AE4987611FF7FAA0048B464 /* JSNPObject.h */, + 1AE4976711FF658E0048B464 /* NPJSObject.cpp */, + 1AE4976611FF658E0048B464 /* NPJSObject.h */, + 1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */, + 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */, + 1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */, + 1A2162AF11F38971008AD0F5 /* NPRuntimeUtilities.h */, + 1A6FBA2911E6862700DB1371 /* NetscapeBrowserFuncs.cpp */, + 1A6FBA2811E6862700DB1371 /* NetscapeBrowserFuncs.h */, + 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */, + 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */, + 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */, + 1AA5889011EE70400061B882 /* NetscapePluginStream.h */, + ); + path = Netscape; + sourceTree = "<group>"; + }; + 1A6FBA0111E6812B00DB1371 /* mac */ = { + isa = PBXGroup; + children = ( + 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */, + 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1A7E814E1152D2240003695B /* mac */ = { + isa = PBXGroup; + children = ( + 1A24B5F011F531E800C38269 /* MachUtilities.cpp */, + 1A24B5F111F531E800C38269 /* MachUtilities.h */, + C0E3AA481209E45000A49D01 /* ModuleMac.mm */, + BC0092F5115837A300E0AE2A /* RunLoopMac.mm */, + 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */, + BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */, + ); + path = mac; + sourceTree = "<group>"; + }; + 1AA2E51A12E4C05600BC4966 /* cg */ = { + isa = PBXGroup; + children = ( + 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */, + 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */, + ); + path = cg; + sourceTree = "<group>"; + }; + 1AADDF4B10D82AF000D3D63D /* Shared */ = { + isa = PBXGroup; + children = ( + BCDDB314124EBCEF0048D13C /* API */, + 1AAF0C4712B16328008E49E2 /* cf */, + C01A25FF12662F2100C9ED55 /* cg */, + BC111B5F112F635E00337BAB /* CoreIPCSupport */, + BC111B5A112F628200337BAB /* mac */, + 1AAE058C1279DCD400852418 /* Plugins */, + 1A3DD205125E5A2F004515E6 /* APIClient.h */, + BCF04C8C11FF9B7D00F86A58 /* APIObject.h */, + BC3065F91259344E00E71278 /* CacheModel.h */, + 1A2D956E12848564001EB962 /* ChildProcess.cpp */, + 1A2D956D12848564001EB962 /* ChildProcess.h */, + 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */, + 1A2C306F12D555450063DAA2 /* ContextMenuState.h */, + C517388012DF8F4F00EE3F47 /* DragControllerAction.h */, + 0FB659221208B4DB0044816C /* DrawingAreaInfo.h */, + 762B7481120BBA0100819339 /* FontSmoothingLevel.h */, + BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */, + BC64696D11DBE603006455B0 /* ImmutableArray.cpp */, + BC64696E11DBE603006455B0 /* ImmutableArray.h */, + BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */, + BCBCB0CA1215E32100DE59CA /* ImmutableDictionary.h */, + BCC8049D122F0D6B00103529 /* MutableArray.cpp */, + BCC8049E122F0D6B00103529 /* MutableArray.h */, + BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */, + BCB0AEE7122F53E300B1341E /* MutableDictionary.h */, + C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */, + BCC57161115ADB42001CCAF9 /* NotImplemented.h */, + BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */, + BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */, + BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */, + BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */, + E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */, + E1CC1B8E12D7EADF00625838 /* PrintInfo.h */, + BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */, + 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */, + 1AA41AB412C02EC4002BE67B /* SelectionState.h */, + 518D2CC812D51DFB003BB93B /* SessionState.cpp */, + 518D2CC912D51DFB003BB93B /* SessionState.h */, + 1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */, + 1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */, + BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */, + 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */, + 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */, + BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */, + 1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */, + 1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */, + 518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */, + 518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */, + BCF50726124329AA005955AE /* WebCertificateInfo.h */, + 512935D51288D19400A4B695 /* WebContextMenuItem.cpp */, + 512935D61288D19400A4B695 /* WebContextMenuItem.h */, + 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */, + 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */, + BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */, + 51578B821209ECEF00A37C4A /* WebData.h */, + BC575612126E0138006F0F12 /* WebError.cpp */, + 516A4A5B120A2CCD00C05B7F /* WebError.h */, + C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */, + BC032DAF10F4380F0058C15A /* WebEvent.h */, + BC032DB010F4380F0058C15A /* WebEventConversion.cpp */, + BC032DB110F4380F0058C15A /* WebEventConversion.h */, + 1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */, + BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */, + BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */, + BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */, + BCCF6ABB12C91EF9008F9C35 /* WebImage.h */, + C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */, + 905620E812BC248B000799B6 /* WebMemorySampler.cpp */, + 905620E912BC248B000799B6 /* WebMemorySampler.h */, + C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */, + BCF69F981176CED600471A52 /* WebNavigationDataStore.h */, + BC33DD671238464600360F3F /* WebNumber.h */, + BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */, + BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */, + C06C6093124C14430001682F /* WebPageCreationParameters.cpp */, + C06C6094124C14430001682F /* WebPageCreationParameters.h */, + BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */, + BC7B625012A43C9600D174A4 /* WebPageGroupData.h */, + C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */, + BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */, + BC5744EE12638FB3006F0F12 /* WebPopupItem.h */, + BCD598AB112B7FDF00EC8C23 /* WebPreferencesStore.cpp */, + BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */, + BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */, + BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */, + F634445512A885C8000612D8 /* WebSecurityOrigin.h */, + A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */, + BCF04C8E11FF9F6E00F86A58 /* WebString.h */, + C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */, + BCDB86C01200FB97007254BE /* WebURL.h */, + BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */, + BCE2315B122C30CA00D5C35A /* WebURLRequest.h */, + BC90A1D1122DD55E00CC8C50 /* WebURLResponse.cpp */, + BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */, + F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */, + C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */, + 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */, + ); + path = Shared; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 1AAE058C1279DCD400852418 /* Plugins */ = { + isa = PBXGroup; + children = ( + 1A4A9C5212B816CF008FE984 /* Netscape */, + 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */, + 1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */, + 1A4A9F3112B844E2008FE984 /* PluginQuirks.h */, + 1A2D848A127F6A49001EB962 /* NPIdentifierData.cpp */, + 1A2D8489127F6A49001EB962 /* NPIdentifierData.h */, + 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */, + 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */, + 1A2D8411127F64E8001EB962 /* NPObjectMessageReceiver.messages.in */, + 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */, + 1A1FA283127A13BC0050E709 /* NPObjectProxy.h */, + 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */, + 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */, + 1A2D84A2127F6AD1001EB962 /* NPVariantData.cpp */, + 1A2D84A1127F6AD1001EB962 /* NPVariantData.h */, + ); + path = Plugins; + sourceTree = "<group>"; + }; + 1AAF0C4712B16328008E49E2 /* cf */ = { + isa = PBXGroup; + children = ( + 1AAF0C4912B16334008E49E2 /* ArgumentCodersCF.cpp */, + 1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */, + ); + path = cf; + sourceTree = "<group>"; + }; + 1AB5A1BA10E021D30040F6CF /* CoreIPC */ = { + isa = PBXGroup; + children = ( + BCC56F751159955E001CCAF9 /* mac */, + 1AEFD27811D16C81008219D3 /* ArgumentCoder.h */, + 1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */, + BC032D9D10F437D10058C15A /* ArgumentDecoder.cpp */, + BC032D9E10F437D10058C15A /* ArgumentDecoder.h */, + BC032D9F10F437D10058C15A /* ArgumentEncoder.cpp */, + BC032DA010F437D10058C15A /* ArgumentEncoder.h */, + BC032DA110F437D10058C15A /* Arguments.h */, + BCEE966A112FAF57006BCC24 /* Attachment.cpp */, + BCEE966B112FAF57006BCC24 /* Attachment.h */, + 1AC41AC61263C88300054E94 /* BinarySemaphore.cpp */, + 1AC41AC51263C88300054E94 /* BinarySemaphore.h */, + BC032DA210F437D10058C15A /* Connection.cpp */, + BC032DA310F437D10058C15A /* Connection.h */, + 1A8EFDFD1253CB6E00F7067F /* DataReference.cpp */, + 1A8EFDF91253CAA200F7067F /* DataReference.h */, + BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */, + C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */, + BC032DA410F437D10058C15A /* MessageID.h */, + 1A119A94127B796200A9ECB1 /* MessageSender.h */, + ); + path = CoreIPC; + sourceTree = "<group>"; + }; + 1AB7D4C71288AA9A00CFD08C /* Downloads */ = { + isa = PBXGroup; + children = ( + 1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */, + 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */, + 1AB7D5E91288B8C000CFD08C /* DownloadProxy.messages.in */, + ); + path = Downloads; + sourceTree = "<group>"; + }; + 1AEFCC0511D01F34008219D3 /* Plugins */ = { + isa = PBXGroup; + children = ( + 1AEFCC0D11D01F41008219D3 /* mac */, + 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */, + 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */, + 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */, + 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */, + 1A0EC75D124BC7B2007EF4A5 /* PluginProcessProxy.cpp */, + 1A0EC75C124BC7B2007EF4A5 /* PluginProcessProxy.h */, + 1A043B4C124D5E3600FFBFB5 /* PluginProcessProxy.messages.in */, + ); + path = Plugins; + sourceTree = "<group>"; + }; + 1AEFCC0D11D01F41008219D3 /* mac */ = { + isa = PBXGroup; + children = ( + 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */, + 1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + 32C88DFF0371C24200C91783 /* Other Sources */ = { + isa = PBXGroup; + children = ( + 1A6FA31011E3921E00DB1371 /* MainMac.cpp */, + 32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */, + ); + name = "Other Sources"; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + 512F588612A8834700629530 /* Authentication */ = { + isa = PBXGroup; + children = ( + 512F588712A8836600629530 /* AuthenticationManager.cpp */, + 512F588812A8836600629530 /* AuthenticationManager.h */, + 512F588912A8836600629530 /* AuthenticationManager.messages.in */, + ); + path = Authentication; + sourceTree = "<group>"; + }; + 512F588D12A8836F00629530 /* Authentication */ = { + isa = PBXGroup; + children = ( + 512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */, + 512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */, + 512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */, + 512F589112A8838800629530 /* AuthenticationDecisionListener.h */, + 512F589212A8838800629530 /* WebCredential.cpp */, + 512F589312A8838800629530 /* WebCredential.h */, + 512F589412A8838800629530 /* WebProtectionSpace.cpp */, + 512F589512A8838800629530 /* WebProtectionSpace.h */, + ); + path = Authentication; + sourceTree = "<group>"; + }; + 51B3004D12529CF5000B5CA0 /* cf */ = { + isa = PBXGroup; + children = ( + 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */, + 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */, + BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */, + ); + name = cf; + sourceTree = "<group>"; + }; + BC032D5C10F436D50058C15A /* WebProcess */ = { + isa = PBXGroup; + children = ( + 512F588612A8834700629530 /* Authentication */, + 1A61614C127798B5003ACD86 /* Downloads */, + BC0E5FCB12D696DD0012A72A /* Geolocation */, + BC204EDF11C83E72008F3375 /* InjectedBundle */, + 1A6FA01C11E1526300DB1371 /* mac */, + 1A6FB7AA11E64B4900DB1371 /* Plugins */, + BC032D5D10F437220058C15A /* WebCoreSupport */, + BC032D5E10F4372B0058C15A /* WebPage */, + 1A6FA31511E3923600DB1371 /* WebKitMain.cpp */, + BC111AE3112F5C2600337BAB /* WebProcess.cpp */, + BC032D9110F437AF0058C15A /* WebProcess.h */, + BC3066B9125A436300E71278 /* WebProcess.messages.in */, + 1A6FA01F11E1528700DB1371 /* WebProcessMain.h */, + ); + path = WebProcess; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + BC032D5D10F437220058C15A /* WebCoreSupport */ = { + isa = PBXGroup; + children = ( + BC111ADE112F5B9A00337BAB /* mac */, + BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */, + BC032D6010F4378D0058C15A /* WebChromeClient.h */, + BC111A54112F4FBB00337BAB /* WebContextMenuClient.cpp */, + BC032D6210F4378D0058C15A /* WebContextMenuClient.h */, + F6A25FDA12ADC6CC00DC40CC /* WebDatabaseManager.cpp */, + F6A25FDB12ADC6CC00DC40CC /* WebDatabaseManager.h */, + F62A765712B1AB7D0005F1B6 /* WebDatabaseManager.messages.in */, + BC111A56112F4FBB00337BAB /* WebDragClient.cpp */, + BC032D6610F4378D0058C15A /* WebDragClient.h */, + BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */, + BC032D6810F4378D0058C15A /* WebEditorClient.h */, + 1A433F0C113C53DD00FACDE9 /* WebErrors.h */, + BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */, + BC032D6A10F4378D0058C15A /* WebFrameLoaderClient.h */, + BC1BE1DF12D54A410004A228 /* WebGeolocationClient.cpp */, + BC1BE1DE12D54A410004A228 /* WebGeolocationClient.h */, + BC111A59112F4FBB00337BAB /* WebInspectorClient.cpp */, + BC032D6D10F4378D0058C15A /* WebInspectorClient.h */, + 1C8E256B1270DE3800BC7BD0 /* WebInspectorFrontendClient.cpp */, + 1C8E256A1270DE3800BC7BD0 /* WebInspectorFrontendClient.h */, + 1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */, + 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */, + D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */, + D3B9484311FF4B6500032B39 /* WebPopupMenu.h */, + D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */, + D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */, + ); + path = WebCoreSupport; + sourceTree = "<group>"; + }; + BC032D5E10F4372B0058C15A /* WebPage */ = { + isa = PBXGroup; + children = ( + BC963D6C113DD19500574BE2 /* mac */, + BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */, + BC5F7BB31182376C0052C02C /* ChunkedUpdateDrawingArea.h */, + 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */, + 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */, + BC8452A51162C80900CAB9B5 /* DrawingArea.cpp */, + BC8452A61162C80900CAB9B5 /* DrawingArea.h */, + 1A64228A12DD024700CAAE2C /* DrawingArea.messages.in */, + 1A6421F512DCFBAB00CAAE2C /* DrawingAreaImpl.cpp */, + 1A6421F412DCFBAB00CAAE2C /* DrawingAreaImpl.h */, + 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */, + 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */, + 1A90C1F31264FD71003E44D4 /* FindController.cpp */, + 1A90C1F21264FD71003E44D4 /* FindController.h */, + 0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */, + 0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */, + 1A90C23612650717003E44D4 /* PageOverlay.cpp */, + 1A90C23512650717003E44D4 /* PageOverlay.h */, + BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */, + BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */, + 51871B59127CB89D00F76232 /* WebContextMenu.cpp */, + 51871B5A127CB89D00F76232 /* WebContextMenu.h */, + BCA0EF7E12331E78007D3CFB /* WebEditCommand.cpp */, + BCA0EF7D12331E78007D3CFB /* WebEditCommand.h */, + BC111ADC112F5B9300337BAB /* WebFrame.cpp */, + BC032D8910F437A00058C15A /* WebFrame.h */, + 1C8E281F1275D15400BC7BD0 /* WebInspector.cpp */, + 1C8E281E1275D15400BC7BD0 /* WebInspector.h */, + 1C8E2A1C1277833F00BC7BD0 /* WebInspector.messages.in */, + BC857F8412B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp */, + BC857F8312B82D0B00EDEB2E /* WebOpenPanelResultListener.h */, + BC963D6A113DD19200574BE2 /* WebPage.cpp */, + BC032D8B10F437A00058C15A /* WebPage.h */, + C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */, + BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */, + BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */, + ); + path = WebPage; + sourceTree = "<group>"; + }; + BC032DC310F438260058C15A /* UIProcess */ = { + isa = PBXGroup; + children = ( + BC032DC410F4387C0058C15A /* API */, + 512F588D12A8836F00629530 /* Authentication */, + 51B3004D12529CF5000B5CA0 /* cf */, + 1AB7D4C71288AA9A00CFD08C /* Downloads */, + BC111B18112F5FB400337BAB /* Launcher */, + BCCF085C113F3B7500C650C5 /* mac */, + 1AEFCC0511D01F34008219D3 /* Plugins */, + 1A64256712DE42EC00CAAE2C /* BackingStore.cpp */, + 1A64256612DE42EC00CAAE2C /* BackingStore.h */, + BC2652141182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp */, + BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */, + BC2652121182608100243E12 /* DrawingAreaProxy.cpp */, + BC2652131182608100243E12 /* DrawingAreaProxy.h */, + 1A6422FC12DD08FE00CAAE2C /* DrawingAreaProxy.messages.in */, + 1A64218512DCF49200CAAE2C /* DrawingAreaProxyImpl.cpp */, + 1A64218412DCF49200CAAE2C /* DrawingAreaProxyImpl.h */, + 1A910070126675C4001842F5 /* FindIndicator.cpp */, + 1A91006F126675C3001842F5 /* FindIndicator.h */, + BC17753E118BABF0007D9E9A /* GenericCallback.h */, + BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */, + BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */, + BC06F43912DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp */, + BC06F43812DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h */, + 0F5265B711DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp */, + 0F5265B811DD377F0006D33C /* LayerBackedDrawingAreaProxy.h */, + BC6EDAA5111271C600E7678B /* PageClient.h */, + BC597074116591D000551FCA /* ProcessModel.h */, + BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */, + 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */, + 1AA417C912C00CCA002BE67B /* TextChecker.h */, + 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */, + 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */, + BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */, + BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */, + BCB9E2421120DACA00A137E0 /* WebContext.cpp */, + BCB9E2411120DACA00A137E0 /* WebContext.h */, + BCEE7D0912846AED009827DA /* WebContext.messages.in */, + BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */, + BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */, + 51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */, + 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */, + BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */, + F62A765912B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp */, + F62A765A12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h */, + F62A765B12B1ABC30005F1B6 /* WebDatabaseManagerProxy.messages.in */, + BCAC111E12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp */, + BCAC111D12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h */, + 1AB7D72B1288CAAD00CFD08C /* WebDownloadClient.cpp */, + 1AB7D72A1288CAAD00CFD08C /* WebDownloadClient.h */, + BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */, + BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */, + 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */, + 1A3DD201125E5A1F004515E6 /* WebFindClient.h */, + BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */, + BCE469501214E6CB000B98EB /* WebFormClient.h */, + BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */, + BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */, + BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */, + BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */, + BCB9F69F1123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp */, + BCB9F69E1123A84B00A137E0 /* WebFramePolicyListenerProxy.h */, + BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */, + BC9B389F10F538BE00443A15 /* WebFrameProxy.h */, + BC54CACA12D64291005C67B0 /* WebGeolocationManagerProxy.cpp */, + BC54CAC912D64291005C67B0 /* WebGeolocationManagerProxy.h */, + BC0E615212D6CAC80012A72A /* WebGeolocationManagerProxy.messages.in */, + BC1BE1F112D54DBD0004A228 /* WebGeolocationProvider.cpp */, + BC1BE1F012D54DBD0004A228 /* WebGeolocationProvider.h */, + BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */, + BCF69F851176CD6F00471A52 /* WebHistoryClient.h */, + 1C8E28331275D73800BC7BD0 /* WebInspectorProxy.cpp */, + 1C8E28321275D73800BC7BD0 /* WebInspectorProxy.h */, + 1C77C1951288A872006A742F /* WebInspectorProxy.messages.in */, + BCB9E76111232B9E00A137E0 /* WebLoaderClient.cpp */, + BC59534010FC04520098F82D /* WebLoaderClient.h */, + BCF69FA11176D01400471A52 /* WebNavigationData.cpp */, + BCF69FA01176D01400471A52 /* WebNavigationData.h */, + BC1DFEA312B31F87005DF730 /* WebOpenPanelResultListenerProxy.cpp */, + BC1DFEA212B31F87005DF730 /* WebOpenPanelResultListenerProxy.h */, + 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */, + 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */, + BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */, + BC7B6204129A0A6700D174A4 /* WebPageGroup.h */, + BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */, + BC032DCB10F4389F0058C15A /* WebPageProxy.h */, + BCBD38FA125BAB9A00D2C29F /* WebPageProxy.messages.in */, + BCB9F8AD1124E07700A137E0 /* WebPolicyClient.cpp */, + BCB9F8AE1124E07700A137E0 /* WebPolicyClient.h */, + BC574E611267D080006F0F12 /* WebPopupMenuProxy.h */, + BCD597FE112B57BE00EC8C23 /* WebPreferences.cpp */, + BCD597FD112B57BE00EC8C23 /* WebPreferences.h */, + BC111B0C112F5E4F00337BAB /* WebProcessManager.cpp */, + BC032DCD10F4389F0058C15A /* WebProcessManager.h */, + BC111B0D112F5E4F00337BAB /* WebProcessProxy.cpp */, + BC032DCF10F4389F0058C15A /* WebProcessProxy.h */, + BCEE7AB312817095009827DA /* WebProcessProxy.messages.in */, + BC858A1F12C0357B00EDEB2E /* WebResourceLoadClient.cpp */, + BC858A1E12C0357B00EDEB2E /* WebResourceLoadClient.h */, + 1A594AB8112A1FB6009DE7C7 /* WebUIClient.cpp */, + 1A594AB9112A1FB6009DE7C7 /* WebUIClient.h */, + ); + path = UIProcess; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + BC032DC410F4387C0058C15A /* API */ = { + isa = PBXGroup; + children = ( + BC0C376610F807660076D7CB /* C */, + BC8A501311765F4500757573 /* cpp */, + BC111B47112F616900337BAB /* mac */, + ); + path = API; + sourceTree = "<group>"; + }; + BC0C376610F807660076D7CB /* C */ = { + isa = PBXGroup; + children = ( + BCB63477116BF10600603215 /* WebKit2.h */, + BCDDB32C124EC2E10048D13C /* WKAPICast.h */, + 512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */, + 512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */, + 512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */, + 512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */, + BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */, + BC646C1711DD399F006455B0 /* WKBackForwardList.h */, + BC646C1811DD399F006455B0 /* WKBackForwardListItem.cpp */, + BC646C1911DD399F006455B0 /* WKBackForwardListItem.h */, + BCB9E24A1120E15C00A137E0 /* WKContext.cpp */, + BCB9E2491120E15C00A137E0 /* WKContext.h */, + BCC938E01180DE440085E5FE /* WKContextPrivate.h */, + 512F58F112A88A5400629530 /* WKCredential.cpp */, + 512F58F212A88A5400629530 /* WKCredential.h */, + 518ACF1012B015F800B04B83 /* WKCredentialTypes.h */, + F62A765F12B1ABED0005F1B6 /* WKDatabaseManager.cpp */, + F62A766012B1ABED0005F1B6 /* WKDatabaseManager.h */, + 1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */, + 1AB7D78B1288CD9A00CFD08C /* WKDownload.h */, + BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */, + BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */, + BCD01398110FA420003B8A67 /* WKFrame.cpp */, + BCD01397110FA420003B8A67 /* WKFrame.h */, + BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */, + BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */, + BC54CC1112D674EE005C67B0 /* WKGeolocationManager.cpp */, + BC54CC1012D674EE005C67B0 /* WKGeolocationManager.h */, + BC06F44D12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp */, + BC06F44C12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h */, + BC0E619712D6CD120012A72A /* WKGeolocationPosition.cpp */, + BC0E619612D6CD120012A72A /* WKGeolocationPosition.h */, + 1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */, + 1C8E293712761E5B00BC7BD0 /* WKInspector.h */, + C09AE5E8125257C20025825D /* WKNativeEvent.h */, + BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */, + BCF69FA71176D1CB00471A52 /* WKNavigationData.h */, + BC857FE512B843D800EDEB2E /* WKOpenPanelParameters.cpp */, + BC857FE412B843D800EDEB2E /* WKOpenPanelParameters.h */, + BC1DFE8E12B31CA8005DF730 /* WKOpenPanelResultListener.cpp */, + BC1DFE8D12B31CA8005DF730 /* WKOpenPanelResultListener.h */, + BCD597D4112B56DC00EC8C23 /* WKPage.cpp */, + BCD597D5112B56DC00EC8C23 /* WKPage.h */, + BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */, + BC7B633512A45ABA00D174A4 /* WKPageGroup.h */, + BC177464118B9FF4007D9E9A /* WKPagePrivate.h */, + BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */, + BCD597CE112B56AC00EC8C23 /* WKPreferences.h */, + 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */, + 512F58F312A88A5400629530 /* WKProtectionSpace.cpp */, + 512F58F412A88A5400629530 /* WKProtectionSpace.h */, + 518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */, + ); + path = C; + sourceTree = "<group>"; + }; + BC0E5FCB12D696DD0012A72A /* Geolocation */ = { + isa = PBXGroup; + children = ( + BC06F42E12DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp */, + BC06F42D12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h */, + BC0E5FE412D697160012A72A /* WebGeolocationManager.cpp */, + BC0E5FE312D697160012A72A /* WebGeolocationManager.h */, + BC0E604812D6B6370012A72A /* WebGeolocationManager.messages.in */, + ); + path = Geolocation; + sourceTree = "<group>"; + }; + BC111ADE112F5B9A00337BAB /* mac */ = { + isa = PBXGroup; + children = ( + 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */, + F6A25FD812ADC6BD00DC40CC /* WebDatabaseManagerMac.mm */, + C5237F5F12441CA300780472 /* WebEditorClientMac.mm */, + BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */, + 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */, + 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */, + BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */, + BCC57159115ADAEF001CCAF9 /* WebSystemInterface.h */, + BCC5715A115ADAEF001CCAF9 /* WebSystemInterface.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC111B18112F5FB400337BAB /* Launcher */ = { + isa = PBXGroup; + children = ( + BC111B19112F5FC500337BAB /* mac */, + 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */, + BC1A7C571136E19C00FB7167 /* ProcessLauncher.h */, + BCF50120123ED3B3005955AE /* ThreadLauncher.cpp */, + BCF5011F123ED3B3005955AE /* ThreadLauncher.h */, + ); + path = Launcher; + sourceTree = "<group>"; + }; + BC111B19112F5FC500337BAB /* mac */ = { + isa = PBXGroup; + children = ( + BC111B1B112F5FE600337BAB /* ProcessLauncherMac.mm */, + BCF501B3123EF602005955AE /* ThreadLauncherMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC111B47112F616900337BAB /* mac */ = { + isa = PBXGroup; + children = ( + 1A9101081268C8CA001842F5 /* FindIndicatorWindow.h */, + 1A9101091268C8CA001842F5 /* FindIndicatorWindow.mm */, + 1AAF061212B01131008E49E2 /* PDFViewController.h */, + 1AAF061312B01131008E49E2 /* PDFViewController.mm */, + BC111B4B112F619200337BAB /* PageClientImpl.h */, + BC111B4C112F619200337BAB /* PageClientImpl.mm */, + 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */, + 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */, + BC8699B2116AADAA002A925B /* WKView.h */, + BC8699B3116AADAA002A925B /* WKView.mm */, + BC8699B4116AADAA002A925B /* WKViewInternal.h */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC111B5A112F628200337BAB /* mac */ = { + isa = PBXGroup; + children = ( + 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */, + C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */, + BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */, + BCF505E51243047B005955AE /* PlatformCertificateInfo.h */, + E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */, + BC9E95D211449B0300870E71 /* UpdateChunk.cpp */, + BC9E95D111449B0300870E71 /* UpdateChunk.h */, + BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */, + BC111B5B112F629800337BAB /* WebEventFactory.h */, + BC111B5C112F629800337BAB /* WebEventFactory.mm */, + 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */, + BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */, + BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */, + 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC111B5F112F635E00337BAB /* CoreIPCSupport */ = { + isa = PBXGroup; + children = ( + BC9E969B11457F3F00870E71 /* DrawingAreaMessageKinds.h */, + BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */, + BCB28CBF120233D9007D99BC /* InjectedBundleMessageKinds.h */, + BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */, + BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */, + ); + path = CoreIPCSupport; + sourceTree = "<group>"; + }; + BC204EDF11C83E72008F3375 /* InjectedBundle */ = { + isa = PBXGroup; + children = ( + BC204EE711C83EAD008F3375 /* API */, + BC204EE411C83E9C008F3375 /* mac */, + BC4BEE96120A091700FBA0C7 /* DOM */, + BC204EE011C83E98008F3375 /* InjectedBundle.cpp */, + BC204EE111C83E98008F3375 /* InjectedBundle.h */, + BCEE7DC4128B645D009827DA /* InjectedBundleClient.cpp */, + BCEE7DC3128B645D009827DA /* InjectedBundleClient.h */, + 935EEB8F1277615D003322B8 /* InjectedBundleBackForwardList.cpp */, + 935EEB901277615D003322B8 /* InjectedBundleBackForwardList.h */, + 935EEB911277615D003322B8 /* InjectedBundleBackForwardListItem.cpp */, + 935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */, + BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */, + BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */, + 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */, + 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */, + E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */, + E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */, + BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */, + BC14E108120B905E00826C0C /* InjectedBundlePageFormClient.h */, + BCA8C6A611E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp */, + BCA8C6A711E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h */, + BCA8C6AD11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp */, + BCA8C6AE11E3C08700812FB7 /* InjectedBundlePageUIClient.h */, + BC14DF76120B5B7900826C0C /* InjectedBundleScriptWorld.cpp */, + BC14DF75120B5B7900826C0C /* InjectedBundleScriptWorld.h */, + BCB0B0DD12305A8C00B1341E /* InjectedBundleUserMessageCoders.h */, + ); + path = InjectedBundle; + sourceTree = "<group>"; + }; + BC204EE411C83E9C008F3375 /* mac */ = { + isa = PBXGroup; + children = ( + BC204EE511C83EA9008F3375 /* InjectedBundleMac.cpp */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC204EE711C83EAD008F3375 /* API */ = { + isa = PBXGroup; + children = ( + BC204EE811C83EB7008F3375 /* c */, + ); + path = API; + sourceTree = "<group>"; + }; + BC204EE811C83EB7008F3375 /* c */ = { + isa = PBXGroup; + children = ( + BC204EE911C83EC8008F3375 /* WKBundle.cpp */, + BC204EEA11C83EC8008F3375 /* WKBundle.h */, + BC204EEB11C83EC8008F3375 /* WKBundleAPICast.h */, + 935EEB951277616D003322B8 /* WKBundleBackForwardList.cpp */, + 935EEB961277616D003322B8 /* WKBundleBackForwardList.h */, + 935EEB971277616D003322B8 /* WKBundleBackForwardListItem.cpp */, + 935EEB981277616D003322B8 /* WKBundleBackForwardListItem.h */, + BCD25F1611D6BDE100169B0E /* WKBundleFrame.cpp */, + BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */, + BCF049E411FE20F600F86A58 /* WKBundleFramePrivate.h */, + BC49862E124D18C100D834E1 /* WKBundleHitTestResult.cpp */, + BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */, + BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */, + BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */, + BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */, + BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */, + BC20528011C94284008F3375 /* WKBundlePage.cpp */, + BC20527F11C94284008F3375 /* WKBundlePage.h */, + BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */, + BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */, + 1A22F1001289FCD90085E74F /* WKBundlePageOverlay.cpp */, + 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */, + BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */, + BCF049E511FE20F600F86A58 /* WKBundlePrivate.h */, + BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */, + BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */, + BC14DF9C120B635F00826C0C /* WKBundleScriptWorld.cpp */, + BC14DF9D120B635F00826C0C /* WKBundleScriptWorld.h */, + ); + path = c; + sourceTree = "<group>"; + }; + BC2E6E74114196F000A63B1E /* Platform */ = { + isa = PBXGroup; + children = ( + 1AA2E51A12E4C05600BC4966 /* cg */, + 1AB5A1BA10E021D30040F6CF /* CoreIPC */, + 1A7E814E1152D2240003695B /* mac */, + 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */, + 51A7F2F2125BF820008AEB1D /* Logging.h */, + C0E3AA451209E2BA00A49D01 /* Module.cpp */, + C0E3AA441209E2BA00A49D01 /* Module.h */, + BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */, + 1A64235012DD187C00CAAE2C /* Region.cpp */, + 1A64235112DD187C00CAAE2C /* Region.h */, + BC2E6E771141970C00A63B1E /* RunLoop.cpp */, + BC2E6E781141970C00A63B1E /* RunLoop.h */, + 1A24BED3120894D100FBB059 /* SharedMemory.h */, + BC2E6E7C1141970C00A63B1E /* WorkItem.h */, + BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */, + BC2E6E7E1141970C00A63B1E /* WorkQueue.h */, + ); + path = Platform; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + BC4075D5124FEFFA0068F20A /* cf */ = { + isa = PBXGroup; + children = ( + BC407611124FF0370068F20A /* WKStringCF.cpp */, + BC407612124FF0370068F20A /* WKStringCF.h */, + BC407613124FF0370068F20A /* WKURLCF.cpp */, + BC407614124FF0370068F20A /* WKURLCF.h */, + ); + path = cf; + sourceTree = "<group>"; + }; + BC4075D6124FF0000068F20A /* mac */ = { + isa = PBXGroup; + children = ( + BC407621124FF0400068F20A /* WKCertificateInfoMac.h */, + BC407622124FF0400068F20A /* WKCertificateInfoMac.mm */, + BC407623124FF0400068F20A /* WKURLRequestNS.h */, + BC407624124FF0400068F20A /* WKURLRequestNS.mm */, + BC407625124FF0400068F20A /* WKURLResponseNS.h */, + BC407626124FF0400068F20A /* WKURLResponseNS.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BC4BEE96120A091700FBA0C7 /* DOM */ = { + isa = PBXGroup; + children = ( + BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */, + BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */, + BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */, + BC33E0CF12408E8600360F3F /* InjectedBundleRangeHandle.h */, + ); + path = DOM; + sourceTree = "<group>"; + }; + BC8A500E11765AD400757573 /* WebKit2 */ = { + isa = PBXGroup; + children = ( + 8DC2EF5A0486A6940098B216 /* Info.plist */, + ); + name = WebKit2; + sourceTree = "<group>"; + }; + BC8A500F11765AE300757573 /* WebProcess */ = { + isa = PBXGroup; + children = ( + BC8A501011765AF700757573 /* Info.plist */, + ); + name = WebProcess; + sourceTree = "<group>"; + }; + BC8A501311765F4500757573 /* cpp */ = { + isa = PBXGroup; + children = ( + BC8A501411765F5600757573 /* WKRetainPtr.h */, + ); + path = cpp; + sourceTree = "<group>"; + }; + BC963D6C113DD19500574BE2 /* mac */ = { + isa = PBXGroup; + children = ( + 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */, + 29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */, + BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */, + 0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */, + 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */, + BC963D6D113DD1A500574BE2 /* WebPageMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BCC56F751159955E001CCAF9 /* mac */ = { + isa = PBXGroup; + children = ( + 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */, + BCC56F771159957D001CCAF9 /* MachPort.h */, + ); + path = mac; + sourceTree = "<group>"; + }; + BCCF085C113F3B7500C650C5 /* mac */ = { + isa = PBXGroup; + children = ( + 1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */, + BC2651F511825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm */, + 0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */, + 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */, + 1A1C648611F415B700553C19 /* WebContextMac.mm */, + 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */, + 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */, + 1CA8B935127C774E00576C2B /* WebInspectorProxyMac.mm */, + BC857E8512B71EBB00EDEB2E /* WebPageProxyMac.mm */, + BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */, + BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */, + BC84EB1712A7100C0083F2DA /* WebPreferencesMac.mm */, + ); + path = mac; + sourceTree = "<group>"; + }; + BCCF6AC412C91F3B008F9C35 /* cg */ = { + isa = PBXGroup; + children = ( + BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */, + BCCF6AC812C91F59008F9C35 /* WKImageCG.h */, + ); + path = cg; + sourceTree = "<group>"; + }; + BCDDB314124EBCEF0048D13C /* API */ = { + isa = PBXGroup; + children = ( + BCDDB315124EBCFE0048D13C /* C */, + ); + path = API; + sourceTree = "<group>"; + }; + BCDDB315124EBCFE0048D13C /* C */ = { + isa = PBXGroup; + children = ( + BC4075D5124FEFFA0068F20A /* cf */, + BCCF6AC412C91F3B008F9C35 /* cg */, + BC4075D6124FF0000068F20A /* mac */, + BC4075D7124FF0270068F20A /* WKArray.cpp */, + BC4075D8124FF0270068F20A /* WKArray.h */, + BCDDB316124EBD130048D13C /* WKBase.h */, + BC4075D9124FF0270068F20A /* WKCertificateInfo.cpp */, + BC4075DA124FF0270068F20A /* WKCertificateInfo.h */, + 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */, + 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */, + 51A55600128C6D92009ABCEC /* WKContextMenuItemTypes.h */, + BC4075DB124FF0270068F20A /* WKData.cpp */, + BC4075DC124FF0270068F20A /* WKData.h */, + BC4075DD124FF0270068F20A /* WKDictionary.cpp */, + BC4075DE124FF0270068F20A /* WKDictionary.h */, + BC4075DF124FF0270068F20A /* WKError.cpp */, + BC4075E0124FF0270068F20A /* WKError.h */, + BC40783C1250FADD0068F20A /* WKEvent.h */, + 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */, + BCC8B373125FB69000DE46A4 /* WKGeometry.h */, + BCCF6AC012C91F34008F9C35 /* WKImage.cpp */, + BCCF6AC112C91F34008F9C35 /* WKImage.h */, + BC4075E1124FF0270068F20A /* WKMutableArray.cpp */, + BC4075E2124FF0270068F20A /* WKMutableArray.h */, + BC4075E3124FF0270068F20A /* WKMutableDictionary.cpp */, + BC4075E4124FF0270068F20A /* WKMutableDictionary.h */, + BC4075E5124FF0270068F20A /* WKNumber.cpp */, + BC4075E6124FF0270068F20A /* WKNumber.h */, + BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */, + F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */, + F634445B12A885E9000612D8 /* WKSecurityOrigin.h */, + BC4075E7124FF0270068F20A /* WKSerializedScriptValue.cpp */, + BC4075E8124FF0270068F20A /* WKSerializedScriptValue.h */, + F67DD7B9125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h */, + BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */, + BC4075E9124FF0270068F20A /* WKString.cpp */, + BC4075EA124FF0270068F20A /* WKString.h */, + BC90997F1256A98200083756 /* WKStringPrivate.h */, + BC4075EB124FF0270068F20A /* WKType.cpp */, + BC4075EC124FF0270068F20A /* WKType.h */, + BC4075ED124FF0270068F20A /* WKURL.cpp */, + BC4075EE124FF0270068F20A /* WKURL.h */, + BC4075EF124FF0270068F20A /* WKURLRequest.cpp */, + BC4075F0124FF0270068F20A /* WKURLRequest.h */, + BC4075F1124FF0270068F20A /* WKURLResponse.cpp */, + BC4075F2124FF0270068F20A /* WKURLResponse.h */, + F6113E26126CE19B0057D0A7 /* WKUserContentURLPattern.cpp */, + F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */, + ); + name = C; + path = c; + sourceTree = "<group>"; + }; + C01A25FF12662F2100C9ED55 /* cg */ = { + isa = PBXGroup; + children = ( + C01A260012662F2100C9ED55 /* ShareableBitmapCG.cpp */, + ); + path = cg; + sourceTree = "<group>"; + }; + C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = { + isa = PBXGroup; + children = ( + 1A64230612DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp */, + 1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */, + 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */, + 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */, + 1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */, + 1AB7D6181288B9D900CFD08C /* DownloadProxyMessages.h */, + 1A64229712DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp */, + 1A64229812DD029200CAAE2C /* DrawingAreaMessages.h */, + 1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */, + 1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */, + 1A8EF96C1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp */, + 1A8EF96D1252AF6B00F7067F /* PluginControllerProxyMessages.h */, + 1A0EC6BD124BBD9B007EF4A5 /* PluginProcessMessageReceiver.cpp */, + 1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */, + 1A043B5B124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp */, + 1A043B5C124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h */, + 1A8EFA6E1252B84100F7067F /* PluginProxyMessageReceiver.cpp */, + 1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */, + BCEE7D0B12846F69009827DA /* WebContextMessageReceiver.cpp */, + BCEE7D0C12846F69009827DA /* WebContextMessages.h */, + F62A76B212B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp */, + F62A76B312B1B25F0005F1B6 /* WebDatabaseManagerMessages.h */, + F62A76B412B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp */, + F62A76B512B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h */, + BC0E605F12D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp */, + BC0E606012D6BA910012A72A /* WebGeolocationManagerMessages.h */, + BC0E618012D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp */, + BC0E618112D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h */, + 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */, + 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */, + 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */, + 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */, + C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */, + C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */, + BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */, + BCBD3913125BB1A800D2C29F /* WebPageProxyMessages.h */, + 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */, + 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */, + BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */, + BC3066BD125A442100E71278 /* WebProcessMessages.h */, + BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */, + BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */, + ); + name = "Derived Sources"; + path = DerivedSources/WebKit2; + sourceTree = BUILT_PRODUCTS_DIR; + tabWidth = 8; + usesTabs = 0; + }; + C0CE73351247F70E00BC0EC4 /* Scripts */ = { + isa = PBXGroup; + children = ( + C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */, + C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */, + C0CE73381247F70E00BC0EC4 /* webkit2 */, + ); + path = Scripts; + sourceTree = "<group>"; + tabWidth = 8; + usesTabs = 0; + }; + C0CE73381247F70E00BC0EC4 /* webkit2 */ = { + isa = PBXGroup; + children = ( + C0CE73391247F70E00BC0EC4 /* __init__.py */, + C0CE734612480B7D00BC0EC4 /* messages.py */, + C08FDE87124A851C007645BD /* messages_unittest.py */, + ); + path = webkit2; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 1AC25FAC12A48EA700BD2671 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */, + 1AEFD2F711D1807B008219D3 /* ArgumentCoders.h in Headers */, + BC032DA610F437D10058C15A /* ArgumentDecoder.h in Headers */, + BC032DA810F437D10058C15A /* ArgumentEncoder.h in Headers */, + BC032DA910F437D10058C15A /* Arguments.h in Headers */, + BCEE966D112FAF57006BCC24 /* Attachment.h in Headers */, + BC5F7BB51182376C0052C02C /* ChunkedUpdateDrawingArea.h in Headers */, + BC2652191182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h in Headers */, + 1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */, + BC032DAB10F437D10058C15A /* Connection.h in Headers */, + BC131BC911726C2800B69727 /* CoreIPCMessageKinds.h in Headers */, + BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */, + BC9E969C11457F3F00870E71 /* DrawingAreaMessageKinds.h in Headers */, + BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */, + BC9E969A11457EDE00870E71 /* DrawingAreaProxyMessageKinds.h in Headers */, + BC17753F118BABF0007D9E9A /* GenericCallback.h in Headers */, + BC64697011DBE603006455B0 /* ImmutableArray.h in Headers */, + BC204EE311C83E98008F3375 /* InjectedBundle.h in Headers */, + BCA8C6A911E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h in Headers */, + BCA8C6B011E3C08700812FB7 /* InjectedBundlePageUIClient.h in Headers */, + 0F5265B411DD37680006D33C /* LayerBackedDrawingArea.h in Headers */, + 0F5265BA11DD377F0006D33C /* LayerBackedDrawingAreaProxy.h in Headers */, + BCC56F791159957D001CCAF9 /* MachPort.h in Headers */, + BC032DAC10F437D10058C15A /* MessageID.h in Headers */, + 1A6FBA2A11E6862700DB1371 /* NetscapeBrowserFuncs.h in Headers */, + 1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */, + 1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */, + BCC57162115ADB42001CCAF9 /* NotImplemented.h in Headers */, + BC6EDAA6111271C600E7678B /* PageClient.h in Headers */, + BC111B50112F619200337BAB /* PageClientImpl.h in Headers */, + BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */, + 1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */, + 1AA56F2911E92BC80061B882 /* PluginController.h in Headers */, + 1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */, + 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */, + BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */, + BC597075116591D000551FCA /* ProcessModel.h in Headers */, + 1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */, + BC2E6E881141971500A63B1E /* RunLoop.h in Headers */, + BC9E95D311449B0300870E71 /* UpdateChunk.h in Headers */, + BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */, + BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */, + BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */, + BCB9E2431120DACA00A137E0 /* WebContext.h in Headers */, + BCDE059B11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h in Headers */, + BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */, + BC1DD7B2114DC396005ADAF3 /* WebCoreArgumentCoders.h in Headers */, + BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */, + BC032D7D10F4378D0058C15A /* WebEditorClient.h in Headers */, + 1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */, + BC032DB910F4380F0058C15A /* WebEvent.h in Headers */, + BC032DBB10F4380F0058C15A /* WebEventConversion.h in Headers */, + BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */, + BC032D8D10F437A00058C15A /* WebFrame.h in Headers */, + BC032D7F10F4378D0058C15A /* WebFrameLoaderClient.h in Headers */, + BCB9F6A01123A84B00A137E0 /* WebFramePolicyListenerProxy.h in Headers */, + BC9B38A110F538BE00443A15 /* WebFrameProxy.h in Headers */, + BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */, + BC032D8210F4378D0058C15A /* WebInspectorClient.h in Headers */, + BCB63478116BF10600603215 /* WebKit2.h in Headers */, + BC59534210FC04520098F82D /* WebLoaderClient.h in Headers */, + BCF69FA21176D01400471A52 /* WebNavigationData.h in Headers */, + BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */, + BC032D8F10F437A00058C15A /* WebPage.h in Headers */, + BC032DD110F4389F0058C15A /* WebPageProxy.h in Headers */, + 1A3E736111CC2659007BD539 /* WebPlatformStrategies.h in Headers */, + BCB9F8B01124E07700A137E0 /* WebPolicyClient.h in Headers */, + BCD597FF112B57BE00EC8C23 /* WebPreferences.h in Headers */, + BCD598AC112B7FDF00EC8C23 /* WebPreferencesStore.h in Headers */, + BC032D9710F437AF0058C15A /* WebProcess.h in Headers */, + 1A6FA02011E1528700DB1371 /* WebProcessMain.h in Headers */, + BC032DD310F4389F0058C15A /* WebProcessManager.h in Headers */, + BC032DD510F4389F0058C15A /* WebProcessProxy.h in Headers */, + BCB7346E11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h in Headers */, + BCC5715B115ADAEF001CCAF9 /* WebSystemInterface.h in Headers */, + 1A594ABB112A1FB6009DE7C7 /* WebUIClient.h in Headers */, + BC646C1B11DD399F006455B0 /* WKBackForwardList.h in Headers */, + BC646C1D11DD399F006455B0 /* WKBackForwardListItem.h in Headers */, + BC204EEF11C83EC8008F3375 /* WKBundle.h in Headers */, + BC204EF011C83EC8008F3375 /* WKBundleAPICast.h in Headers */, + BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */, + BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */, + BC20528111C94284008F3375 /* WKBundlePage.h in Headers */, + BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */, + BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */, + BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */, + BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */, + BCB9F6A51123DD0D00A137E0 /* WKFramePolicyListener.h in Headers */, + BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */, + BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */, + BC177465118B9FF4007D9E9A /* WKPagePrivate.h in Headers */, + BCD597D0112B56AC00EC8C23 /* WKPreferences.h in Headers */, + 762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */, + BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */, + F67DD7BA125E40D9007BDCB8 /* WKSerializedScriptValuePrivate.h in Headers */, + BC8699B5116AADAA002A925B /* WKView.h in Headers */, + BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */, + BC2E6E8C1141971500A63B1E /* WorkItem.h in Headers */, + BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */, + 1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */, + 1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */, + 1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */, + E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */, + BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */, + BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */, + 1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */, + 1AE4987811FF7FAA0048B464 /* JSNPObject.h in Headers */, + 1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */, + BCDB86C11200FB97007254BE /* WebURL.h in Headers */, + BCB28CC0120233D9007D99BC /* InjectedBundleMessageKinds.h in Headers */, + BCCB75C61203A1CE00222D1B /* WebContextMessageKinds.h in Headers */, + D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */, + D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */, + 0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */, + 51578B831209ECEF00A37C4A /* WebData.h in Headers */, + C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */, + 516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */, + 1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */, + 1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */, + 1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */, + BC4BEEAB120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.h in Headers */, + BC4BEFE1120A1A4C00FBA0C7 /* WKBundleNodeHandle.h in Headers */, + BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */, + BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */, + BC14E10A120B905E00826C0C /* InjectedBundlePageFormClient.h in Headers */, + BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */, + BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */, + BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */, + BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */, + BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */, + 9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */, + BCE2315D122C30CA00D5C35A /* WebURLRequest.h in Headers */, + BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */, + BCB0AD34122F285800B1341E /* MutableArray.h in Headers */, + BCB0AEE9122F53E300B1341E /* MutableDictionary.h in Headers */, + BCB0B0DC12305A2500B1341E /* WebContextUserMessageCoders.h in Headers */, + BCB0B0DE12305A8C00B1341E /* InjectedBundleUserMessageCoders.h in Headers */, + BCB0B0E012305AB100B1341E /* UserMessageCoders.h in Headers */, + BCA0EF7F12331E78007D3CFB /* WebEditCommand.h in Headers */, + BCA0EF9F12332642007D3CFB /* WebEditCommandProxy.h in Headers */, + BC33DD681238464600360F3F /* WebNumber.h in Headers */, + BCF50121123ED3B3005955AE /* ThreadLauncher.h in Headers */, + BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */, + BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */, + BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */, + BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */, + C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */, + C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */, + 1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */, + 1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */, + 1A0EC75E124BC7B2007EF4A5 /* PluginProcessProxy.h in Headers */, + 1A0EC7FB124BD3B6007EF4A5 /* PluginProcessMain.h in Headers */, + 1A0EC906124C0AB8007EF4A5 /* PluginProcessConnection.h in Headers */, + 1A0EC90F124C0AF5007EF4A5 /* PluginProcessConnectionManager.h in Headers */, + BC498618124D10E200D834E1 /* InjectedBundleHitTestResult.h in Headers */, + BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */, + 1A043976124D034800FFBFB5 /* PluginProcess.h in Headers */, + 1A043A09124D11A900FFBFB5 /* WebProcessConnection.h in Headers */, + 1A043B5E124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h in Headers */, + BCDDB317124EBD130048D13C /* WKBase.h in Headers */, + BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */, + BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */, + BC4075F4124FF0270068F20A /* WKArray.h in Headers */, + BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */, + BC4075F8124FF0270068F20A /* WKData.h in Headers */, + BC4075FA124FF0270068F20A /* WKDictionary.h in Headers */, + BC4075FC124FF0270068F20A /* WKError.h in Headers */, + BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */, + BC407600124FF0270068F20A /* WKMutableDictionary.h in Headers */, + BC407602124FF0270068F20A /* WKNumber.h in Headers */, + BC407604124FF0270068F20A /* WKSerializedScriptValue.h in Headers */, + BC407606124FF0270068F20A /* WKString.h in Headers */, + BC407608124FF0270068F20A /* WKType.h in Headers */, + BC40760A124FF0270068F20A /* WKURL.h in Headers */, + BC40760C124FF0270068F20A /* WKURLRequest.h in Headers */, + BC40760E124FF0270068F20A /* WKURLResponse.h in Headers */, + BC40761A124FF0370068F20A /* WKStringCF.h in Headers */, + BC40761C124FF0370068F20A /* WKURLCF.h in Headers */, + BC407627124FF0400068F20A /* WKCertificateInfoMac.h in Headers */, + BC407629124FF0400068F20A /* WKURLRequestNS.h in Headers */, + BC40762B124FF0400068F20A /* WKURLResponseNS.h in Headers */, + BC40783D1250FADD0068F20A /* WKEvent.h in Headers */, + 1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */, + 1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */, + 1A8EF4CB1252403700F7067F /* PluginControllerProxy.h in Headers */, + C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */, + 1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */, + 1A8EFA711252B84100F7067F /* PluginProxyMessages.h in Headers */, + 1A8EFDFA1253CAA200F7067F /* DataReference.h in Headers */, + BC9099801256A98200083756 /* WKStringPrivate.h in Headers */, + BC3065FA1259344E00E71278 /* CacheModel.h in Headers */, + BC3066BF125A442100E71278 /* WebProcessMessages.h in Headers */, + BC306824125A6B9400E71278 /* WebProcessCreationParameters.h in Headers */, + 51A7F2F3125BF820008AEB1D /* Logging.h in Headers */, + BCBD3915125BB1A800D2C29F /* WebPageProxyMessages.h in Headers */, + BCBD3C3B125BFA7A00D2C29F /* StringPairVector.h in Headers */, + 1A3DD202125E5A1F004515E6 /* WebFindClient.h in Headers */, + 1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */, + BCC8B374125FB69000DE46A4 /* WKGeometry.h in Headers */, + BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */, + BC57450C1263B155006F0F12 /* WKBundleNodeHandlePrivate.h in Headers */, + 1AC41AC71263C88300054E94 /* BinarySemaphore.h in Headers */, + 1A90C1EE1264FD50003E44D4 /* WebFindOptions.h in Headers */, + 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */, + 1A90C23712650717003E44D4 /* PageOverlay.h in Headers */, + BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */, + BC5750971268F3C6006F0F12 /* WebPopupMenuProxyMac.h in Headers */, + 1A910071126675C4001842F5 /* FindIndicator.h in Headers */, + 1A91010A1268C8CA001842F5 /* FindIndicatorWindow.h in Headers */, + F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */, + F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */, + 1C8E25A91270E3BC00BC7BD0 /* WebInspectorFrontendClient.h in Headers */, + 1C8E28201275D15400BC7BD0 /* WebInspector.h in Headers */, + 1C8E28341275D73800BC7BD0 /* WebInspectorProxy.h in Headers */, + 1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */, + 935EEB9B1277617C003322B8 /* WKBundleBackForwardListItem.h in Headers */, + 935EEB9F127761AC003322B8 /* WKBundleBackForwardList.h in Headers */, + 935EEBA2127761D0003322B8 /* InjectedBundleBackForwardList.h in Headers */, + 935EEBA4127761D6003322B8 /* InjectedBundleBackForwardListItem.h in Headers */, + 1A616150127798B5003ACD86 /* DownloadManager.h in Headers */, + 1A6161D41278981C003ACD86 /* Download.h in Headers */, + 51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */, + 51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */, + 1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */, + BCC43ABB127B95DC00317F16 /* PlatformPopupMenuData.h in Headers */, + 51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */, + 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */, + 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */, + 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */, + 1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */, + 1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */, + 1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */, + 1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */, + 1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */, + BCEE7AD112817988009827DA /* WebProcessProxyMessages.h in Headers */, + 1A2D956F12848564001EB962 /* ChildProcess.h in Headers */, + BCEE7D0E12846F69009827DA /* WebContextMessages.h in Headers */, + 510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */, + 1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */, + 1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */, + 512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */, + 512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */, + 1AB7D72C1288CAAD00CFD08C /* WebDownloadClient.h in Headers */, + 1AB7D78D1288CD9A00CFD08C /* WKDownload.h in Headers */, + 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */, + 51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */, + BCEE7DC5128B645D009827DA /* InjectedBundleClient.h in Headers */, + ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */, + 1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */, + 29CD55AA128E294F00133C85 /* AccessibilityWebPageObject.h in Headers */, + 5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */, + 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */, + BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */, + BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */, + BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */, + BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */, + BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */, + 37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */, + 512F588B12A8836600629530 /* AuthenticationManager.h in Headers */, + 512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */, + 512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */, + 512F589B12A8838800629530 /* WebCredential.h in Headers */, + 512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */, + 512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */, + 512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */, + 512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */, + 512F58FA12A88A5400629530 /* WKCredential.h in Headers */, + 512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */, + F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */, + F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */, + 518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */, + 518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */, + BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */, + BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */, + F6A25FDD12ADC6CC00DC40CC /* WebDatabaseManager.h in Headers */, + 1AAF061412B01131008E49E2 /* PDFViewController.h in Headers */, + 1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */, + F62A765D12B1ABC30005F1B6 /* WebDatabaseManagerProxy.h in Headers */, + F62A766212B1ABED0005F1B6 /* WKDatabaseManager.h in Headers */, + F62A76B712B1B25F0005F1B6 /* WebDatabaseManagerMessages.h in Headers */, + F62A76B912B1B25F0005F1B6 /* WebDatabaseManagerProxyMessages.h in Headers */, + BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */, + BC1DFEA412B31F87005DF730 /* WebOpenPanelResultListenerProxy.h in Headers */, + BC857F8512B82D0B00EDEB2E /* WebOpenPanelResultListener.h in Headers */, + BC857FB512B830E600EDEB2E /* WebOpenPanelParameters.h in Headers */, + BC857FE612B843D800EDEB2E /* WKOpenPanelParameters.h in Headers */, + 1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */, + 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */, + 1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */, + BC858A2012C0357B00EDEB2E /* WebResourceLoadClient.h in Headers */, + 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */, + 909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */, + 1AA41AB512C02EC4002BE67B /* SelectionState.h in Headers */, + BCCF672D12C7EDF7008F9C35 /* OriginAndDatabases.h in Headers */, + BCCF6ABD12C91EF9008F9C35 /* WebImage.h in Headers */, + BCCF6AC312C91F34008F9C35 /* WKImage.h in Headers */, + BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */, + BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */, + BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */, + 93FC67BE12D3CCF200A60610 /* DecoderAdapter.h in Headers */, + 93FC67C012D3CCF200A60610 /* EncoderAdapter.h in Headers */, + 1A5E4DA412D3BD3D0099A2BB /* TextCheckerState.h in Headers */, + 518D2CAE12D5153B003BB93B /* WebBackForwardListItem.h in Headers */, + BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */, + BC1BE1F212D54DBD0004A228 /* WebGeolocationProvider.h in Headers */, + 1A2C307112D555450063DAA2 /* ContextMenuState.h in Headers */, + 518D2CCB12D51DFB003BB93B /* SessionState.h in Headers */, + E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */, + BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */, + BC54CC1212D674EE005C67B0 /* WKGeolocationManager.h in Headers */, + BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */, + BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */, + BC0E607312D6BC200012A72A /* WebGeolocationPosition.h in Headers */, + BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */, + BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */, + BC06F42F12DBB9B6002D78DE /* GeolocationPermissionRequestManager.h in Headers */, + BC06F43A12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h in Headers */, + BC06F44A12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h in Headers */, + BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */, + 1A6420E512DCE2FF00CAAE2C /* ShareableBitmap.h in Headers */, + 1A64218612DCF49200CAAE2C /* DrawingAreaProxyImpl.h in Headers */, + 1A6421F612DCFBAB00CAAE2C /* DrawingAreaImpl.h in Headers */, + 1A64229A12DD029200CAAE2C /* DrawingAreaMessages.h in Headers */, + 1A64230912DD09EB00CAAE2C /* DrawingAreaProxyMessages.h in Headers */, + 1A64235312DD187C00CAAE2C /* Region.h in Headers */, + 1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */, + 1A64256812DE42EC00CAAE2C /* BackingStore.h in Headers */, + C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */, + 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 1A50DB1D110A3BDC000D3FE5 /* WebProcess */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1A50DB23110A3BDE000D3FE5 /* Build configuration list for PBXNativeTarget "WebProcess" */; + buildPhases = ( + 1A50DB1A110A3BDC000D3FE5 /* Resources */, + 1A50DB1B110A3BDC000D3FE5 /* Sources */, + 1AC25FDD12A4904500BD2671 /* Copy Plug-in Process Shim */, + ); + buildRules = ( + ); + dependencies = ( + 1AC25FD812A48FD500BD2671 /* PBXTargetDependency */, + 1A50DB27110A3BEF000D3FE5 /* PBXTargetDependency */, + ); + name = WebProcess; + productName = WebProcess; + productReference = 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */; + productType = "com.apple.product-type.application"; + }; + 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1AC25FBA12A48EB600BD2671 /* Build configuration list for PBXNativeTarget "PluginProcessShim" */; + buildPhases = ( + 1AC25FAC12A48EA700BD2671 /* Headers */, + 1AC25FAD12A48EA700BD2671 /* Sources */, + 1AC25FAE12A48EA700BD2671 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PluginProcessShim; + productName = PluginProcessShim; + productReference = 1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 8DC2EF4F0486A6940098B216 /* WebKit2 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "WebKit2" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 37F7407912721F740093869B /* PBXTargetDependency */, + ); + name = WebKit2; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = WebKit2; + productReference = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 0867D691FE84028FC02AAC07 /* WebKit2 */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1A50DB38110A3C13000D3FE5 /* All */, + 8DC2EF4F0486A6940098B216 /* WebKit2 */, + 1A50DB1D110A3BDC000D3FE5 /* WebProcess */, + C0CE72851247E66800BC0EC4 /* Derived Sources */, + 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1A50DB1A110A3BDC000D3FE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + 512F588C12A8836600629530 /* AuthenticationManager.messages.in in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + C0CE72841247E66800BC0EC4 /* Generate Derived Sources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Derived Sources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1A50DB1B110A3BDC000D3FE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A6FA31111E3921E00DB1371 /* MainMac.cpp in Sources */, + 1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */, + 1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */, + E18C92F512DB9E7A00CF2AEB /* PrintInfo.cpp in Sources */, + E18C92F612DB9E9400CF2AEB /* PrintInfoMac.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1AC25FAD12A48EA700BD2671 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AC25FC212A48F6000BD2671 /* PluginProcessShim.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BC032DA510F437D10058C15A /* ArgumentDecoder.cpp in Sources */, + BC032DA710F437D10058C15A /* ArgumentEncoder.cpp in Sources */, + BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */, + BC5F7BB41182376C0052C02C /* ChunkedUpdateDrawingArea.cpp in Sources */, + BC5F7BB9118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp in Sources */, + BC2652181182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp in Sources */, + BC2651F611825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm in Sources */, + 1A6F9FB711E1408500DB1371 /* CommandLineMac.cpp in Sources */, + BC032DAA10F437D10058C15A /* Connection.cpp in Sources */, + 1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */, + BC8452A71162C80900CAB9B5 /* DrawingArea.cpp in Sources */, + BC2652161182608100243E12 /* DrawingAreaProxy.cpp in Sources */, + BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */, + BC204EE211C83E98008F3375 /* InjectedBundle.cpp in Sources */, + BC204EE611C83EA9008F3375 /* InjectedBundleMac.cpp in Sources */, + BCA8C6A811E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.cpp in Sources */, + BCA8C6AF11E3C08700812FB7 /* InjectedBundlePageUIClient.cpp in Sources */, + 0F5265B311DD37680006D33C /* LayerBackedDrawingArea.cpp in Sources */, + 0F5265B611DD37700006D33C /* LayerBackedDrawingAreaMac.mm in Sources */, + 0F5265B911DD377F0006D33C /* LayerBackedDrawingAreaProxy.cpp in Sources */, + 0F5265BC11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm in Sources */, + 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */, + 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */, + 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */, + 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */, + BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */, + 1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */, + 1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */, + 1AEFCCBD11D02C5E008219D3 /* PluginInfoStoreMac.mm in Sources */, + 1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */, + 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */, + BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */, + BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */, + BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */, + BC0092F7115837A300E0AE2A /* RunLoopMac.mm in Sources */, + BC9E95D411449B0300870E71 /* UpdateChunk.cpp in Sources */, + BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */, + BC72B9FA11E6476B001EB4EA /* WebBackForwardListProxy.cpp in Sources */, + BC111A5A112F4FBB00337BAB /* WebChromeClient.cpp in Sources */, + BCB9E2441120DACA00A137E0 /* WebContext.cpp in Sources */, + BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */, + BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */, + BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */, + BC111A5E112F4FBB00337BAB /* WebEditorClient.cpp in Sources */, + BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */, + BC032DBA10F4380F0058C15A /* WebEventConversion.cpp in Sources */, + BC111B5E112F629800337BAB /* WebEventFactory.mm in Sources */, + BC111ADD112F5B9300337BAB /* WebFrame.cpp in Sources */, + BC111A5F112F4FBB00337BAB /* WebFrameLoaderClient.cpp in Sources */, + BCB9F6A11123A84B00A137E0 /* WebFramePolicyListenerProxy.cpp in Sources */, + BC111B0E112F5E4F00337BAB /* WebFrameProxy.cpp in Sources */, + BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */, + BC111A60112F4FBB00337BAB /* WebInspectorClient.cpp in Sources */, + 1A6FA31611E3923600DB1371 /* WebKitMain.cpp in Sources */, + BCB9E76211232B9E00A137E0 /* WebLoaderClient.cpp in Sources */, + BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */, + BC963D6B113DD19200574BE2 /* WebPage.cpp in Sources */, + BC963D6E113DD1A500574BE2 /* WebPageMac.mm in Sources */, + BC111B0F112F5E4F00337BAB /* WebPageProxy.cpp in Sources */, + 1A3E736211CC2659007BD539 /* WebPlatformStrategies.cpp in Sources */, + BCB9F8AF1124E07700A137E0 /* WebPolicyClient.cpp in Sources */, + BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */, + BCD598AD112B7FDF00EC8C23 /* WebPreferencesStore.cpp in Sources */, + BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */, + 1A6FA01E11E1526300DB1371 /* WebProcessMainMac.mm in Sources */, + BC111B10112F5E4F00337BAB /* WebProcessManager.cpp in Sources */, + BC111B11112F5E4F00337BAB /* WebProcessProxy.cpp in Sources */, + BCC5715C115ADAEF001CCAF9 /* WebSystemInterface.mm in Sources */, + 1A594ABA112A1FB6009DE7C7 /* WebUIClient.cpp in Sources */, + BC646C1A11DD399F006455B0 /* WKBackForwardList.cpp in Sources */, + BC646C1C11DD399F006455B0 /* WKBackForwardListItem.cpp in Sources */, + BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */, + BCD25F1811D6BDE100169B0E /* WKBundleFrame.cpp in Sources */, + BC20528211C94284008F3375 /* WKBundlePage.cpp in Sources */, + BCB9E24C1120E15C00A137E0 /* WKContext.cpp in Sources */, + BCD0139C110FA420003B8A67 /* WKFrame.cpp in Sources */, + BCB9F6A61123DD0D00A137E0 /* WKFramePolicyListener.cpp in Sources */, + BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */, + BCD597D6112B56DC00EC8C23 /* WKPage.cpp in Sources */, + BCD597D1112B56AC00EC8C23 /* WKPreferences.cpp in Sources */, + BC8699B6116AADAA002A925B /* WKView.mm in Sources */, + BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */, + BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */, + 1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */, + 1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */, + 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */, + 1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */, + E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */, + 1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */, + 1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */, + 1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */, + D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */, + D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */, + C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */, + C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */, + 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */, + 1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */, + 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */, + BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */, + BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */, + BC14DF78120B5B7900826C0C /* InjectedBundleScriptWorld.cpp in Sources */, + BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */, + BC14E109120B905E00826C0C /* InjectedBundlePageFormClient.cpp in Sources */, + BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */, + BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */, + BCE469591214EDF4000B98EB /* WKFormSubmissionListener.cpp in Sources */, + BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */, + BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */, + 9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */, + BCE2315E122C30CA00D5C35A /* WebURLRequest.cpp in Sources */, + BCE231C2122C466E00D5C35A /* WebURLRequestMac.mm in Sources */, + BCE23263122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm in Sources */, + BC90A1D3122DD55E00CC8C50 /* WebURLResponse.cpp in Sources */, + BC90A1D7122DD66A00CC8C50 /* WebURLResponseMac.mm in Sources */, + BCB0AD33122F285800B1341E /* MutableArray.cpp in Sources */, + BCB0AEEA122F53E300B1341E /* MutableDictionary.cpp in Sources */, + BCA0EF8012331E78007D3CFB /* WebEditCommand.cpp in Sources */, + BCA0EFA012332642007D3CFB /* WebEditCommandProxy.cpp in Sources */, + BCF50122123ED3B3005955AE /* ThreadLauncher.cpp in Sources */, + BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */, + C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */, + BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */, + BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */, + BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */, + C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */, + 1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */, + 1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */, + 1A0EC803124BD41E007EF4A5 /* PluginProcessMainMac.mm in Sources */, + 1A0EC907124C0AB8007EF4A5 /* PluginProcessConnection.cpp in Sources */, + 1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */, + BC498619124D10E200D834E1 /* InjectedBundleHitTestResult.cpp in Sources */, + BC498630124D18C100D834E1 /* WKBundleHitTestResult.cpp in Sources */, + 1A043977124D034800FFBFB5 /* PluginProcess.cpp in Sources */, + 1A043A0A124D11A900FFBFB5 /* WebProcessConnection.cpp in Sources */, + C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */, + 1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */, + BC4075F3124FF0270068F20A /* WKArray.cpp in Sources */, + BC4075F5124FF0270068F20A /* WKCertificateInfo.cpp in Sources */, + BC4075F7124FF0270068F20A /* WKData.cpp in Sources */, + BC4075F9124FF0270068F20A /* WKDictionary.cpp in Sources */, + BC4075FB124FF0270068F20A /* WKError.cpp in Sources */, + BC4075FD124FF0270068F20A /* WKMutableArray.cpp in Sources */, + BC4075FF124FF0270068F20A /* WKMutableDictionary.cpp in Sources */, + BC407601124FF0270068F20A /* WKNumber.cpp in Sources */, + BC407603124FF0270068F20A /* WKSerializedScriptValue.cpp in Sources */, + BC407605124FF0270068F20A /* WKString.cpp in Sources */, + BC407607124FF0270068F20A /* WKType.cpp in Sources */, + BC407609124FF0270068F20A /* WKURL.cpp in Sources */, + BC40760B124FF0270068F20A /* WKURLRequest.cpp in Sources */, + BC40760D124FF0270068F20A /* WKURLResponse.cpp in Sources */, + BC407619124FF0370068F20A /* WKStringCF.cpp in Sources */, + BC40761B124FF0370068F20A /* WKURLCF.cpp in Sources */, + BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */, + BC40762A124FF0400068F20A /* WKURLRequestNS.mm in Sources */, + BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */, + 1A043CEB124FE38F00FFBFB5 /* PluginProcessMessageReceiver.cpp in Sources */, + 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */, + 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */, + 1A8EF4CC1252403700F7067F /* PluginControllerProxy.cpp in Sources */, + C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */, + 51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */, + 51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */, + 1A8EF96E1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp in Sources */, + 1A8EFA701252B84100F7067F /* PluginProxyMessageReceiver.cpp in Sources */, + 1A8EFDFE1253CB6E00F7067F /* DataReference.cpp in Sources */, + BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */, + BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */, + BC306825125A6B9400E71278 /* WebProcessCreationParameters.cpp in Sources */, + 51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */, + BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */, + 1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */, + BC5744EF12638FB3006F0F12 /* WebPopupItem.cpp in Sources */, + 1AC41AC81263C88300054E94 /* BinarySemaphore.cpp in Sources */, + 1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */, + 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */, + C01A260112662F2100C9ED55 /* ShareableBitmapCG.cpp in Sources */, + BC5750981268F3C6006F0F12 /* WebPopupMenuProxyMac.mm in Sources */, + 1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */, + 1A91010B1268C8CA001842F5 /* FindIndicatorWindow.mm in Sources */, + F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */, + BC575613126E0138006F0F12 /* WebError.cpp in Sources */, + 1C8E25A81270E3BB00BC7BD0 /* WebInspectorFrontendClient.cpp in Sources */, + 1C8E28211275D15400BC7BD0 /* WebInspector.cpp in Sources */, + 1C8E28351275D73800BC7BD0 /* WebInspectorProxy.cpp in Sources */, + 1C8E293A12761E5B00BC7BD0 /* WKInspector.cpp in Sources */, + 935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */, + 935EEBA0127761AC003322B8 /* WKBundleBackForwardListItem.cpp in Sources */, + 935EEBA1127761CC003322B8 /* InjectedBundleBackForwardList.cpp in Sources */, + 935EEBA3127761D3003322B8 /* InjectedBundleBackForwardListItem.cpp in Sources */, + 1A61614F127798B5003ACD86 /* DownloadManager.cpp in Sources */, + 1A6161D51278981C003ACD86 /* Download.cpp in Sources */, + 1A61639612789B2F003ACD86 /* DownloadMac.mm in Sources */, + 51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */, + C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */, + C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */, + C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */, + C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */, + C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */, + C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */, + BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */, + BCC43AC7127B99DE00317F16 /* WebPopupMenuMac.mm in Sources */, + 51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */, + 51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */, + 1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */, + 1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */, + 1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */, + 1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */, + 1A2D848C127F6A49001EB962 /* NPIdentifierData.cpp in Sources */, + 1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */, + 1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */, + 1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */, + 1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */, + 1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */, + 1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */, + BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */, + 1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */, + BCEE7D0D12846F69009827DA /* WebContextMessageReceiver.cpp in Sources */, + 510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */, + 1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */, + 1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */, + 512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */, + 512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */, + 1AB7D72D1288CAAD00CFD08C /* WebDownloadClient.cpp in Sources */, + 1AB7D78E1288CD9A00CFD08C /* WKDownload.cpp in Sources */, + 51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */, + BCEE7DC6128B645D009827DA /* InjectedBundleClient.cpp in Sources */, + 1CA8B936127C774E00576C2B /* WebInspectorProxyMac.mm in Sources */, + 1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */, + 1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */, + EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */, + 29CD55AB128E294F00133C85 /* AccessibilityWebPageObject.mm in Sources */, + 5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */, + 1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */, + BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */, + BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */, + BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */, + BC7B633812A45ABA00D174A4 /* WKPageGroup.cpp in Sources */, + BC7B633E12A45D1200D174A4 /* WKBundlePageGroup.cpp in Sources */, + 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */, + BC84EB1812A7100C0083F2DA /* WebPreferencesMac.mm in Sources */, + BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */, + 512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */, + 512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */, + 512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */, + 512F589A12A8838800629530 /* WebCredential.cpp in Sources */, + 512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */, + 512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */, + 512F58F512A88A5400629530 /* WKAuthenticationChallenge.cpp in Sources */, + 512F58F712A88A5400629530 /* WKAuthenticationDecisionListener.cpp in Sources */, + 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 */, + 1AAF0C4B12B16334008E49E2 /* ArgumentCodersCF.cpp in Sources */, + F62A765C12B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp in Sources */, + F62A766112B1ABED0005F1B6 /* WKDatabaseManager.cpp in Sources */, + F62A76B612B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp in Sources */, + F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */, + BC857E8712B71EBB00EDEB2E /* WebPageProxyMac.mm in Sources */, + BC857F7E12B82CEE00EDEB2E /* WebOpenPanelResultListenerProxy.cpp in Sources */, + BC857F8612B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp in Sources */, + BC857FB612B830E600EDEB2E /* WebOpenPanelParameters.cpp in Sources */, + BC85806212B8505700EDEB2E /* WKOpenPanelResultListener.cpp in Sources */, + BC85806312B8505700EDEB2E /* WKOpenPanelParameters.cpp in Sources */, + 1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */, + 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */, + 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */, + BC858A2112C0357B00EDEB2E /* WebResourceLoadClient.cpp in Sources */, + 1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */, + 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */, + 909854EE12BC4E18000AD080 /* WebMemorySampler.mac.mm in Sources */, + BCCF673312C7F15C008F9C35 /* OriginAndDatabases.cpp in Sources */, + BCCF6ABC12C91EF9008F9C35 /* WebImage.cpp in Sources */, + BCCF6AC212C91F34008F9C35 /* WKImage.cpp in Sources */, + BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */, + BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */, + 93FC67BD12D3CCF200A60610 /* DecoderAdapter.cpp in Sources */, + 93FC67BF12D3CCF200A60610 /* EncoderAdapter.cpp in Sources */, + 518D2CAD12D5153B003BB93B /* WebBackForwardListItem.cpp in Sources */, + BC1BE1E112D54A410004A228 /* WebGeolocationClient.cpp in Sources */, + BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */, + 518D2CCA12D51DFB003BB93B /* SessionState.cpp in Sources */, + E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */, + E18C92F412DB9E7100CF2AEB /* PrintInfo.cpp in Sources */, + BC54CACC12D64291005C67B0 /* WebGeolocationManagerProxy.cpp in Sources */, + BC54CC1312D674EE005C67B0 /* WKGeolocationManager.cpp in Sources */, + BC0E5FE612D697160012A72A /* WebGeolocationManager.cpp in Sources */, + BC0E606112D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp in Sources */, + BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */, + BC0E618212D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp in Sources */, + BC0E619912D6CD120012A72A /* WKGeolocationPosition.cpp in Sources */, + BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */, + BC06F43B12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.cpp in Sources */, + BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */, + BC06F44F12DBDF3F002D78DE /* WKGeolocationPermissionRequest.cpp in Sources */, + 1A6420E412DCE2FF00CAAE2C /* ShareableBitmap.cpp in Sources */, + 1A64218712DCF49200CAAE2C /* DrawingAreaProxyImpl.cpp in Sources */, + 1A6421F712DCFBAB00CAAE2C /* DrawingAreaImpl.cpp in Sources */, + 1A64229912DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp in Sources */, + 1A64230812DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp in Sources */, + 1A64235212DD187C00CAAE2C /* Region.cpp in Sources */, + 1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */, + 1A64256912DE42EC00CAAE2C /* BackingStore.cpp in Sources */, + 1A64292D12DE5F9800CAAE2C /* BackingStoreMac.mm in Sources */, + 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1A50DB27110A3BEF000D3FE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* WebKit2 */; + targetProxy = 1A50DB26110A3BEF000D3FE5 /* PBXContainerItemProxy */; + }; + 1A50DB3C110A3C19000D3FE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1A50DB1D110A3BDC000D3FE5 /* WebProcess */; + targetProxy = 1A50DB3B110A3C19000D3FE5 /* PBXContainerItemProxy */; + }; + 1AC25FD812A48FD500BD2671 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1AC25FAF12A48EA700BD2671 /* PluginProcessShim */; + targetProxy = 1AC25FD712A48FD500BD2671 /* PBXContainerItemProxy */; + }; + 37F7407912721F740093869B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C0CE72851247E66800BC0EC4 /* Derived Sources */; + targetProxy = 37F7407812721F740093869B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1A50DB21110A3BDD000D3FE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 1A50DB22110A3BDD000D3FE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 1A50DB39110A3C13000D3FE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Debug; + }; + 1A50DB3A110A3C13000D3FE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Release; + }; + 1AC25FB112A48EA700BD2671 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AC25FBB12A48EDA00BD2671 /* PluginProcessShim.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 1AC25FB212A48EA700BD2671 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AC25FBB12A48EDA00BD2671 /* PluginProcessShim.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 1AC25FB312A48EA700BD2671 /* Production */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AC25FBB12A48EDA00BD2671 /* PluginProcessShim.xcconfig */; + buildSettings = { + }; + name = Production; + }; + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */; + buildSettings = { + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)", + ); + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */; + buildSettings = { + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)", + ); + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */; + buildSettings = { + DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)"; + GCC_OPTIMIZATION_LEVEL = "$(GCC_OPTIMIZATION_LEVEL_debug)"; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A4F976B100E7B6600637A18 /* DebugRelease.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 5D22D69B11A7534600BF30E5 /* Production */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A4F976A100E7B6600637A18 /* Base.xcconfig */; + buildSettings = { + }; + name = Production; + }; + 5D22D69C11A7534600BF30E5 /* Production */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Production; + }; + 5D22D69D11A7534600BF30E5 /* Production */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */; + buildSettings = { + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-lWebKitSystemInterface", + ); + }; + name = Production; + }; + 5D22D69E11A7534600BF30E5 /* Production */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */; + buildSettings = { + }; + name = Production; + }; + C0CE72861247E66800BC0EC4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = "Derived Sources"; + }; + name = Debug; + }; + C0CE72871247E66800BC0EC4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = "Derived Sources"; + ZERO_LINK = NO; + }; + name = Release; + }; + C0CE72881247E66800BC0EC4 /* Production */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "Derived Sources"; + }; + name = Production; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1A50DB23110A3BDE000D3FE5 /* Build configuration list for PBXNativeTarget "WebProcess" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A50DB21110A3BDD000D3FE5 /* Debug */, + 1A50DB22110A3BDD000D3FE5 /* Release */, + 5D22D69E11A7534600BF30E5 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; + 1A50DB48110A3C27000D3FE5 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A50DB39110A3C13000D3FE5 /* Debug */, + 1A50DB3A110A3C13000D3FE5 /* Release */, + 5D22D69C11A7534600BF30E5 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; + 1AC25FBA12A48EB600BD2671 /* Build configuration list for PBXNativeTarget "PluginProcessShim" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1AC25FB112A48EA700BD2671 /* Debug */, + 1AC25FB212A48EA700BD2671 /* Release */, + 1AC25FB312A48EA700BD2671 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "WebKit2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + 5D22D69D11A7534600BF30E5 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + 5D22D69B11A7534600BF30E5 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; + C0CE72891247E68600BC0EC4 /* Build configuration list for PBXAggregateTarget "Derived Sources" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C0CE72861247E66800BC0EC4 /* Debug */, + C0CE72871247E66800BC0EC4 /* Release */, + C0CE72881247E66800BC0EC4 /* Production */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Production; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/Source/WebKit2/WebKit2Prefix.cpp b/Source/WebKit2/WebKit2Prefix.cpp new file mode 100644 index 0000000..12b4a90 --- /dev/null +++ b/Source/WebKit2/WebKit2Prefix.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebKit2Prefix.h" diff --git a/Source/WebKit2/WebKit2Prefix.h b/Source/WebKit2/WebKit2Prefix.h new file mode 100644 index 0000000..19bee7f --- /dev/null +++ b/Source/WebKit2/WebKit2Prefix.h @@ -0,0 +1,121 @@ +/* + * 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 <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 + +#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> +#endif + +#endif /* defined(WIN32) || defined(_WIN32) */ + diff --git a/Source/WebKit2/WebProcess.pro b/Source/WebKit2/WebProcess.pro new file mode 100644 index 0000000..94f49cd --- /dev/null +++ b/Source/WebKit2/WebProcess.pro @@ -0,0 +1,37 @@ +TEMPLATE = app +TARGET = QtWebProcess + +SOURCES += \ + qt/MainQt.cpp + +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. +include(../../WebKit.pri) + +DESTDIR = $$OUTPUT_DIR/bin +!CONFIG(standalone_package): CONFIG -= app_bundle + +QT += network +macx:QT+=xml + +linux-* { + # From Creator's src/rpath.pri: + # Do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR + # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var. + QMAKE_RPATHDIR = \$\$ORIGIN/../lib $$QMAKE_RPATHDIR + MY_RPATH = $$join(QMAKE_RPATHDIR, ":") + + QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${MY_RPATH}\' + QMAKE_RPATHDIR = +} else { + QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +} + +symbian { + TARGET.UID3 = 0xA000E543 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} + +contains(QT_CONFIG, opengl) { + QT += opengl + DEFINES += QT_CONFIGURED_WITH_OPENGL +} diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp new file mode 100644 index 0000000..36757d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "AuthenticationManager.h" + +#include "MessageID.h" +#include "WebCoreArgumentCoders.h" +#include "WebFrame.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/AuthenticationChallenge.h> +#include <WebCore/AuthenticationClient.h> + +namespace WebKit { + +static uint64_t generateAuthenticationChallengeID() +{ + static uint64_t uniqueAuthenticationChallengeID = 1; + return uniqueAuthenticationChallengeID++; +} + +AuthenticationManager& AuthenticationManager::shared() +{ + static AuthenticationManager& manager = *new AuthenticationManager; + return manager; +} + +AuthenticationManager::AuthenticationManager() +{ +} + +void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceiveAuthenticationManagerMessage(connection, messageID, arguments); +} + +void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const WebCore::AuthenticationChallenge& authenticationChallenge) +{ + ASSERT(frame); + ASSERT(frame->page()); + + uint64_t id = generateAuthenticationChallengeID(); + m_challenges.set(id, authenticationChallenge); + + WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, id), frame->page()->pageID()); +} + +void AuthenticationManager::useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential& credential) +{ + WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + ASSERT(!challenge.isNull()); + WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) + return; + + coreClient->receivedCredential(challenge, credential); +} + +void AuthenticationManager::continueWithoutCredentialForChallenge(uint64_t challengeID) +{ + WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + ASSERT(!challenge.isNull()); + WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) + return; + + coreClient->receivedRequestToContinueWithoutCredential(challenge); +} + +void AuthenticationManager::cancelChallenge(uint64_t challengeID) +{ + WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + ASSERT(!challenge.isNull()); + WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) + return; + + coreClient->receivedCancellation(challenge); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h new file mode 100644 index 0000000..ce5ff1c --- /dev/null +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h @@ -0,0 +1,71 @@ +/* + * 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 AuthenticationManager_h +#define AuthenticationManager_h + +#include <wtf/HashMap.h> + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebCore { + class AuthenticationChallenge; + class Credential; +} + +namespace WebKit { + +class WebFrame; + +class AuthenticationManager { + WTF_MAKE_NONCOPYABLE(AuthenticationManager); + +public: + static AuthenticationManager& shared(); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&); + + void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&); + void continueWithoutCredentialForChallenge(uint64_t challengeID); + void cancelChallenge(uint64_t challengeID); + +private: + AuthenticationManager(); + + void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap; + AuthenticationChallengeMap m_challenges; +}; + +} // namespace WebKit + +#endif // AuthenticationManager_h diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in new file mode 100644 index 0000000..264cd55 --- /dev/null +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in @@ -0,0 +1,27 @@ +# 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. + +messages -> AuthenticationManager { + void UseCredentialForChallenge(uint64_t challengeID, WebCore::Credential credential); + void ContinueWithoutCredentialForChallenge(uint64_t challengeID); + void CancelChallenge(uint64_t challengeID); +} diff --git a/Source/WebKit2/WebProcess/Downloads/Download.cpp b/Source/WebKit2/WebProcess/Downloads/Download.cpp new file mode 100644 index 0000000..3cb5588 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/Download.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Download.h" + +#include "Connection.h" +#include "DataReference.h" +#include "DownloadProxyMessages.h" +#include "DownloadManager.h" +#include "SandboxExtension.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcess.h" + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<Download> Download::create(uint64_t downloadID, const ResourceRequest& request) +{ + return adoptPtr(new Download(downloadID, request)); +} + +Download::Download(uint64_t downloadID, const ResourceRequest& request) + : m_downloadID(downloadID) + , m_request(request) +{ + ASSERT(m_downloadID); +} + +Download::~Download() +{ + platformInvalidate(); +} + +CoreIPC::Connection* Download::connection() const +{ + return WebProcess::shared().connection(); +} + +void Download::didStart() +{ + send(Messages::DownloadProxy::DidStart(m_request)); +} + +void Download::didReceiveResponse(const ResourceResponse& response) +{ + send(Messages::DownloadProxy::DidReceiveResponse(response)); +} + +void Download::didReceiveData(uint64_t length) +{ + send(Messages::DownloadProxy::DidReceiveData(length)); +} + +bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType) +{ + bool result; + if (!sendSync(Messages::DownloadProxy::ShouldDecodeSourceDataOfMIMEType(mimeType), Messages::DownloadProxy::ShouldDecodeSourceDataOfMIMEType::Reply(result))) + return true; + + return result; +} + +String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite) +{ + String destination; + SandboxExtension::Handle sandboxExtensionHandle; + if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination, allowOverwrite, sandboxExtensionHandle))) + return String(); + + m_sandboxExtension = SandboxExtension::create(sandboxExtensionHandle); + if (m_sandboxExtension) + m_sandboxExtension->consume(); + + return destination; +} + +void Download::didCreateDestination(const String& path) +{ + send(Messages::DownloadProxy::DidCreateDestination(path)); +} + +void Download::didFinish() +{ + send(Messages::DownloadProxy::DidFinish()); + + if (m_sandboxExtension) + m_sandboxExtension->invalidate(); + DownloadManager::shared().downloadFinished(this); +} + +void Download::didFail(const ResourceError& error, const CoreIPC::DataReference& resumeData) +{ + send(Messages::DownloadProxy::DidFail(error, resumeData)); + + if (m_sandboxExtension) + m_sandboxExtension->invalidate(); + DownloadManager::shared().downloadFinished(this); +} + +void Download::didCancel(const CoreIPC::DataReference& resumeData) +{ + send(Messages::DownloadProxy::DidCancel(resumeData)); + + if (m_sandboxExtension) + m_sandboxExtension->invalidate(); + DownloadManager::shared().downloadFinished(this); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h new file mode 100644 index 0000000..2319ec7 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -0,0 +1,112 @@ +/* + * 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 Download_h +#define Download_h + +#include "MessageSender.h" +#include <WebCore/ResourceRequest.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class NSURLDownload; +@class WKDownloadAsDelegate; +#else +class NSURLDownload; +class WKDownloadAsDelegate; +#endif +#endif + +#if USE(CFNETWORK) +#include <CFNetwork/CFURLDownloadPriv.h> +#endif + +namespace CoreIPC { + class DataReference; +} + +namespace WebCore { + class ResourceError; + class ResourceHandle; + class ResourceResponse; +} + +namespace WebKit { + +class SandboxExtension; +class WebPage; + +class Download : public CoreIPC::MessageSender<Download> { + WTF_MAKE_NONCOPYABLE(Download); + +public: + static PassOwnPtr<Download> create(uint64_t downloadID, const WebCore::ResourceRequest&); + ~Download(); + + // Used by MessageSender. + CoreIPC::Connection* connection() const; + uint64_t destinationID() const { return downloadID(); } + + void start(WebPage* initiatingWebPage); + void startWithHandle(WebPage* initiatingPage, WebCore::ResourceHandle*, const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&); + void cancel(); + + uint64_t downloadID() const { return m_downloadID; } + + void didStart(); + void didReceiveResponse(const WebCore::ResourceResponse&); + void didReceiveData(uint64_t length); + bool shouldDecodeSourceDataOfMIMEType(const String& mimeType); + String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite); + void didCreateDestination(const String& path); + void didFinish(); + void didFail(const WebCore::ResourceError&, const CoreIPC::DataReference& resumeData); + void didCancel(const CoreIPC::DataReference& resumeData); + +private: + Download(uint64_t downloadID, const WebCore::ResourceRequest&); + + void platformInvalidate(); + + uint64_t m_downloadID; + WebCore::ResourceRequest m_request; + + RefPtr<SandboxExtension> m_sandboxExtension; + +#if PLATFORM(MAC) + RetainPtr<NSURLDownload> m_nsURLDownload; + RetainPtr<WKDownloadAsDelegate> m_delegate; +#endif +#if USE(CFNETWORK) + RetainPtr<CFURLDownloadRef> m_download; +#endif +}; + +} // namespace WebKit + +#endif // Download_h diff --git a/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp new file mode 100644 index 0000000..e65883a --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DownloadManager.h" + +#include "Download.h" +#include "WebProcess.h" +#include <wtf/StdLibExtras.h> + +using namespace WebCore; + +namespace WebKit { + +DownloadManager& DownloadManager::shared() +{ + DEFINE_STATIC_LOCAL(DownloadManager, downloadManager, ()); + return downloadManager; +} + +DownloadManager::DownloadManager() +{ +} + +void DownloadManager::startDownload(uint64_t downloadID, WebPage* initiatingPage, const ResourceRequest& request) +{ + OwnPtr<Download> download = Download::create(downloadID, request); + download->start(initiatingPage); + + ASSERT(!m_downloads.contains(downloadID)); + m_downloads.set(downloadID, download.leakPtr()); +} + +void DownloadManager::convertHandleToDownload(uint64_t downloadID, WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest& initialRequest, const ResourceResponse& response) +{ + OwnPtr<Download> download = Download::create(downloadID, request); + + download->startWithHandle(initiatingPage, handle, initialRequest, response); + ASSERT(!m_downloads.contains(downloadID)); + m_downloads.set(downloadID, download.leakPtr()); +} + +void DownloadManager::cancelDownload(uint64_t downloadID) +{ + Download* download = m_downloads.get(downloadID); + if (!download) + return; + + download->cancel(); +} + +void DownloadManager::downloadFinished(Download* download) +{ + ASSERT(m_downloads.contains(download->downloadID())); + m_downloads.remove(download->downloadID()); + + delete download; + + WebProcess::shared().shutdownIfPossible(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/DownloadManager.h b/Source/WebKit2/WebProcess/Downloads/DownloadManager.h new file mode 100644 index 0000000..1f27b86 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/DownloadManager.h @@ -0,0 +1,65 @@ +/* + * 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 DownloadManager_h +#define DownloadManager_h + +#include <wtf/HashMap.h> +#include <wtf/Noncopyable.h> + +namespace WebCore { + class ResourceHandle; + class ResourceRequest; + class ResourceResponse; +} + +namespace WebKit { + +class Download; +class WebPage; + +class DownloadManager { + WTF_MAKE_NONCOPYABLE(DownloadManager); + +public: + static DownloadManager& shared(); + + void startDownload(uint64_t downloadID, WebPage* initiatingPage, const WebCore::ResourceRequest&); + void convertHandleToDownload(uint64_t downloadID, WebPage* initiatingPage, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&); + + void cancelDownload(uint64_t downloadID); + + void downloadFinished(Download*); + bool isDownloading() const { return !m_downloads.isEmpty(); } + +private: + DownloadManager(); + + HashMap<uint64_t, Download*> m_downloads; +}; + +} // namespace WebKit + +#endif // DownloadManager_h diff --git a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp new file mode 100644 index 0000000..08c381f --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Download.h" + +#include "DataReference.h" +#include "NotImplemented.h" + +#pragma warning(push, 0) +#include <WebCore/LoaderRunLoopCF.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceHandle.h> +#include <WebCore/ResourceResponse.h> +#pragma warning(pop) + +using namespace WebCore; + +namespace WebKit { + +// CFURLDownload Callbacks ---------------------------------------------------------------- +static void didStartCallback(CFURLDownloadRef download, const void* clientInfo); +static CFURLRequestRef willSendRequestCallback(CFURLDownloadRef download, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void* clientInfo); +static void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef download, CFURLAuthChallengeRef challenge, const void* clientInfo); +static void didReceiveResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, const void* clientInfo); +static void willResumeWithResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, UInt64 startingByte, const void* clientInfo); +static void didReceiveDataCallback(CFURLDownloadRef download, CFIndex length, const void* clientInfo); +static Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef download, CFStringRef encodingType, const void* clientInfo); +static void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef download, CFStringRef objectName, const void* clientInfo); +static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef path, const void* clientInfo); +static void didFinishCallback(CFURLDownloadRef download, const void* clientInfo); +static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void* clientInfo); + +void Download::start(WebPage* initiatingWebPage) +{ + ASSERT(!m_download); + + CFURLRequestRef cfRequest = m_request.cfURLRequest(); + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client)); + + // FIXME: Allow this to be changed by the client. + CFURLDownloadSetDeletesUponFailure(m_download.get(), false); + + CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode); +} + +void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response) +{ + ASSERT(!m_download); + + CFURLConnectionRef connection = handle->connection(); + if (!connection) + return; + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + + m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, initialRequest.cfURLRequest(), response.cfURLResponse(), &client)); + + // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state" + // However, we should never hit that case + if (!m_download) + ASSERT_NOT_REACHED(); + + // The CFURLDownload either starts successfully and retains the CFURLConnection, + // or it fails to creating and we have a now-useless connection with a dangling ref. + // Either way, we need to release the connection to balance out ref counts + handle->releaseConnectionForDownload(); + CFRelease(connection); +} + +void Download::cancel() +{ + notImplemented(); +} + +void Download::platformInvalidate() +{ + m_download = nullptr; +} + +// CFURLDownload Callbacks ---------------------------------------------------------------- +static Download* downloadFromClientInfo(const void* clientInfo) +{ + return reinterpret_cast<Download*>(const_cast<void*>(clientInfo)); +} + +void didStartCallback(CFURLDownloadRef, const void* clientInfo) +{ + downloadFromClientInfo(clientInfo)->didStart(); +} + +CFURLRequestRef willSendRequestCallback(CFURLDownloadRef, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void* clientInfo) +{ + // CFNetwork requires us to return a retained request. + CFRetain(request); + return request; +} + +void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef, CFURLAuthChallengeRef challenge, const void* clientInfo) +{ + // FIXME: implement. + notImplemented(); +} + +void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, const void* clientInfo) +{ + downloadFromClientInfo(clientInfo)->didReceiveResponse(ResourceResponse(response)); +} + +void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void* clientInfo) +{ + // FIXME: implement. + notImplemented(); +} + +void didReceiveDataCallback(CFURLDownloadRef, CFIndex length, const void* clientInfo) +{ + downloadFromClientInfo(clientInfo)->didReceiveData(length); +} + +Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodingType, const void* clientInfo) +{ + return downloadFromClientInfo(clientInfo)->shouldDecodeSourceDataOfMIMEType(encodingType); +} + +void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef 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); +} + +void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef url, const void* clientInfo) +{ + RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyFileSystemPath(url, kCFURLWindowsPathStyle)); + String result(path.get()); + downloadFromClientInfo(clientInfo)->didCreateDestination(result); +} + +void didFinishCallback(CFURLDownloadRef, const void* clientInfo) +{ + downloadFromClientInfo(clientInfo)->didFinish(); +} + +void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void* clientInfo) +{ + CoreIPC::DataReference dataReference(0, 0); + downloadFromClientInfo(clientInfo)->didFail(ResourceError(error), dataReference); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp new file mode 100644 index 0000000..25ed351 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org> + * + * 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 "Download.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void Download::start(WebPage* initiatingWebPage) +{ + notImplemented(); +} + +void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle*, const ResourceRequest& initialRequest, const ResourceResponse&) +{ + notImplemented(); +} + +void Download::cancel() +{ + notImplemented(); +} + +void Download::platformInvalidate() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm new file mode 100644 index 0000000..6839020 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "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" + +@interface NSURLDownload (WebNSURLDownloadDetails) ++(id)_downloadWithLoadingConnection:(NSURLConnection *)connection + request:(NSURLRequest *)request + response:(NSURLResponse *)r + delegate:(id)delegate + proxy:(id)proxy; +- (void)_setOriginatingURL:(NSURL *)originatingURL; +@end + +@interface WKDownloadAsDelegate : NSObject <NSURLConnectionDelegate> { + WebKit::Download* _download; +} +- (id)initWithDownload:(WebKit::Download*)download; +- (void)invalidate; +@end + +using namespace WebCore; + +namespace WebKit { + +static KURL originatingURLFromBackForwardList(WebPage *webPage) +{ + if (!webPage) + return KURL(); + + Page* page = webPage->corePage(); + if (!page) + return KURL(); + + KURL originalURL; + int backCount = page->backForward()->backCount(); + for (int backIndex = 0; backIndex <= backCount; backIndex++) { + // FIXME: At one point we had code here to check a "was user gesture" flag. + // Do we need to restore that logic? + HistoryItem* historyItem = page->backForward()->itemAtIndex(-backIndex); + if (!historyItem) + continue; + + originalURL = historyItem->originalURL(); + if (!originalURL.isNull()) + return originalURL; + } + + return KURL(); +} + +static void setOriginalURLForDownload(WebPage *webPage, NSURLDownload *download, const ResourceRequest& initialRequest) +{ + KURL originalURL; + + // If there was no referrer, don't traverse the back/forward history + // since this download was initiated directly. <rdar://problem/5294691> + if (!initialRequest.httpReferrer().isNull()) { + // find the first item in the history that was originated by the user + originalURL = originatingURLFromBackForwardList(webPage); + } + + if (originalURL.isNull()) + originalURL = initialRequest.url(); + + NSURL *originalNSURL = originalURL; + + NSString *scheme = [originalNSURL scheme]; + NSString *host = [originalNSURL host]; + if (scheme && host && [scheme length] && [host length]) { + NSNumber *port = [originalNSURL port]; + if (port && [port intValue] < 0) + port = nil; + RetainPtr<NSString> hostOnlyURLString; + if (port) + hostOnlyURLString.adoptNS([[NSString alloc] initWithFormat:@"%@://%@:%d", scheme, host, [port intValue]]); + else + hostOnlyURLString.adoptNS([[NSString alloc] initWithFormat:@"%@://%@", scheme, host]); + + RetainPtr<NSURL> hostOnlyURL = [[NSURL alloc] initWithString:hostOnlyURLString.get()]; + + ASSERT([download respondsToSelector:@selector(_setOriginatingURL:)]); + [download _setOriginatingURL:hostOnlyURL.get()]; + } +} + +void Download::start(WebPage* initiatingPage) +{ + ASSERT(!m_nsURLDownload); + ASSERT(!m_delegate); + + m_delegate.adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]); + m_nsURLDownload.adoptNS([[NSURLDownload alloc] initWithRequest:m_request.nsURLRequest() delegate:m_delegate.get()]); + + // FIXME: Allow this to be changed by the client. + [m_nsURLDownload.get() setDeletesFileUponFailure:NO]; + + setOriginalURLForDownload(initiatingPage, m_nsURLDownload.get(), m_request); +} + +void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response) +{ + ASSERT(!m_nsURLDownload); + ASSERT(!m_delegate); + + id proxy = handle->releaseProxy(); + ASSERT(proxy); + + m_delegate.adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]); + m_nsURLDownload = [NSURLDownload _downloadWithLoadingConnection:handle->connection() + request:m_request.nsURLRequest() + response:response.nsURLResponse() + delegate:m_delegate.get() + proxy:proxy]; + + // FIXME: Allow this to be changed by the client. + [m_nsURLDownload.get() setDeletesFileUponFailure:NO]; + + setOriginalURLForDownload(initiatingPage, m_nsURLDownload.get(), initialRequest); +} + +void Download::cancel() +{ + [m_nsURLDownload.get() cancel]; + + RetainPtr<NSData> resumeData = [m_nsURLDownload.get() resumeData]; + didCancel(CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([resumeData.get() bytes]), [resumeData.get() length])); +} + +void Download::platformInvalidate() +{ + ASSERT(m_nsURLDownload); + ASSERT(m_delegate); + + [m_delegate.get() invalidate]; + m_delegate = nullptr; + m_nsURLDownload = nullptr; +} + +} // namespace WebKit + +@implementation WKDownloadAsDelegate + +- (id)initWithDownload:(WebKit::Download*)download +{ + self = [super init]; + if (!self) + return nil; + + _download = download; + return self; +} + +- (void)invalidate +{ + _download = 0; +} + +- (void)downloadDidBegin:(NSURLDownload *)download +{ + if (_download) + _download->didStart(); +} + +- (NSURLRequest *)download:(NSURLDownload *)download willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse +{ + return request; +} + +- (BOOL)download:(NSURLDownload *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace +{ + // FIXME: Implement. + notImplemented(); + return NO; +} + +- (void)download:(NSURLDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge +{ + // FIXME: Implement. + notImplemented(); +} + +- (void)download:(NSURLDownload *)download didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge +{ + // FIXME: Implement. + notImplemented(); +} + +- (BOOL)downloadShouldUseCredentialStorage:(NSURLDownload *)download +{ + // FIXME: Implement. + notImplemented(); + return YES; +} + +- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response +{ + if (_download) + _download->didReceiveResponse(response); +} + +- (void)download:(NSURLDownload *)download willResumeWithResponse:(NSURLResponse *)response fromByte:(long long)startingByte +{ + // FIXME: Implement. + notImplemented(); +} + +- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length +{ + if (_download) + _download->didReceiveData(length); +} + +- (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType +{ + if (_download) + return _download->shouldDecodeSourceDataOfMIMEType(encodingType); + + return YES; +} + +- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename +{ + String destination; + bool allowOverwrite; + if (_download) + destination = _download->decideDestinationWithSuggestedFilename(filename, allowOverwrite); + + if (!destination.isNull()) + [download setDestination:destination allowOverwrite:allowOverwrite]; +} + +- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path +{ + if (_download) + _download->didCreateDestination(path); +} + +- (void)downloadDidFinish:(NSURLDownload *)download +{ + if (_download) + _download->didFinish(); +} + +- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error +{ + if (!_download) + return; + + RetainPtr<NSData> resumeData = [download resumeData]; + CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>([resumeData.get() bytes]), [resumeData.get() length]); + + _download->didFail(error, dataReference); +} + +@end diff --git a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp new file mode 100644 index 0000000..34fd60e --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Download.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void Download::start(WebPage* initiatingWebPage) +{ + notImplemented(); +} + +void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle*, const ResourceRequest& initialRequest, const ResourceResponse&) +{ + notImplemented(); +} + +void Download::cancel() +{ + notImplemented(); +} + +void Download::platformInvalidate() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp new file mode 100644 index 0000000..3068d5e --- /dev/null +++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.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 "GeolocationPermissionRequestManager.h" + +#include "WebFrame.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include <WebCore/Frame.h> +#include <WebCore/Geolocation.h> +#include <WebCore/SecurityOrigin.h> + +using namespace WebCore; + +namespace WebKit { + +static uint64_t generateGeolocationID() +{ + static uint64_t uniqueGeolocationID = 1; + return uniqueGeolocationID++; +} + +GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage* page) + : m_page(page) +{ +} + +void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation* geolocation) +{ + uint64_t geolocationID = generateGeolocationID(); + + m_geolocationToIDMap.set(geolocation, geolocationID); + m_idToGeolocationMap.set(geolocationID, geolocation); + + + Frame* frame = geolocation->frame(); + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + SecurityOrigin* origin = frame->document()->securityOrigin(); + + m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), origin->databaseIdentifier())); +} + +void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation* geolocation) +{ + GeolocationToIDMap::iterator it = m_geolocationToIDMap.find(geolocation); + if (it == m_geolocationToIDMap.end()) + return; + + m_geolocationToIDMap.remove(it); + m_idToGeolocationMap.remove(it->second); +} + +void GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) +{ + IDToGeolocationMap::iterator it = m_idToGeolocationMap.find(geolocationID); + if (it == m_idToGeolocationMap.end()) + return; + + Geolocation* geolocation = it->second; + geolocation->setIsAllowed(allowed); + + m_idToGeolocationMap.remove(it); + m_geolocationToIDMap.remove(geolocation); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h new file mode 100644 index 0000000..5e37163 --- /dev/null +++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.h @@ -0,0 +1,60 @@ +/* + * 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 GeolocationPermissionRequestManager_h +#define GeolocationPermissionRequestManager_h + +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class Geolocation; +} + +namespace WebKit { + +class WebPage; + +class GeolocationPermissionRequestManager { +public: + explicit GeolocationPermissionRequestManager(WebPage*); + + void startRequestForGeolocation(WebCore::Geolocation*); + void cancelRequestForGeolocation(WebCore::Geolocation*); + + void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed); + +private: + typedef HashMap<uint64_t, WebCore::Geolocation*> IDToGeolocationMap; + typedef HashMap<WebCore::Geolocation*, uint64_t> GeolocationToIDMap; + IDToGeolocationMap m_idToGeolocationMap; + GeolocationToIDMap m_geolocationToIDMap; + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // GeolocationPermissionRequestManager_h diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp new file mode 100644 index 0000000..713ba71 --- /dev/null +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp @@ -0,0 +1,111 @@ +/* + * 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 "WebGeolocationManager.h" + +#include "WebGeolocationManagerProxyMessages.h" +#include "WebPage.h" +#include "WebProcess.h" + +#if ENABLE(CLIENT_BASED_GEOLOCATION) +#include <WebCore/Geolocation.h> +#include <WebCore/GeolocationController.h> +#include <WebCore/GeolocationError.h> +#include <WebCore/GeolocationPosition.h> +#include <WebCore/Page.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +WebGeolocationManager::WebGeolocationManager(WebProcess* process) + : m_process(process) +{ +} + +WebGeolocationManager::~WebGeolocationManager() +{ +} + +void WebGeolocationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceiveWebGeolocationManagerMessage(connection, messageID, arguments); +} + +void WebGeolocationManager::registerWebPage(WebPage* page) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + bool wasEmpty = m_pageSet.isEmpty(); + + m_pageSet.add(page); + + if (wasEmpty) + m_process->connection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0); +#endif +} + +void WebGeolocationManager::unregisterWebPage(WebPage* page) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + m_pageSet.remove(page); + + if (m_pageSet.isEmpty()) + m_process->connection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0); +#endif +} + +void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data& data) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + RefPtr<GeolocationPosition> position = GeolocationPosition::create(data.timestamp, data.latitude, data.longitude, data.accuracy); + + HashSet<WebPage*>::const_iterator it = m_pageSet.begin(); + HashSet<WebPage*>::const_iterator end = m_pageSet.end(); + for (; it != end; ++it) { + WebPage* page = *it; + if (page->corePage()) + page->corePage()->geolocationController()->positionChanged(position.get()); + } +#endif +} + +void WebGeolocationManager::didFailToDeterminePosition() +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + // FIXME: Add localized error string. + RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, /* Localized error string */ String("")); + + HashSet<WebPage*>::const_iterator it = m_pageSet.begin(); + HashSet<WebPage*>::const_iterator end = m_pageSet.end(); + for (; it != end; ++it) { + WebPage* page = *it; + if (page->corePage()) + page->corePage()->geolocationController()->errorOccurred(error.get()); + } +#endif +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h new file mode 100644 index 0000000..78fbd5a --- /dev/null +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.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 WebGeolocationManager_h +#define WebGeolocationManager_h + +#include "MessageID.h" +#include "WebGeolocationPosition.h" +#include <wtf/HashSet.h> +#include <wtf/HashMap.h> +#include <wtf/Noncopyable.h> + +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +} + +namespace WebCore { +class Geolocation; +} + +namespace WebKit { + +class WebProcess; +class WebPage; + +class WebGeolocationManager { + WTF_MAKE_NONCOPYABLE(WebGeolocationManager); +public: + explicit WebGeolocationManager(WebProcess*); + ~WebGeolocationManager(); + + void registerWebPage(WebPage*); + void unregisterWebPage(WebPage*); + + void requestPermission(WebCore::Geolocation*); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + // Implemented in generated WebGeolocationManagerMessageReceiver.cpp + void didReceiveWebGeolocationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + void didChangePosition(const WebGeolocationPosition::Data&); + void didFailToDeterminePosition(); + + WebProcess* m_process; + HashSet<WebPage*> m_pageSet; +}; + +} // namespace WebKit + +#endif // WebGeolocationManager_h diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in new file mode 100644 index 0000000..f2e9a9d --- /dev/null +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in @@ -0,0 +1,26 @@ +# 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. + +messages -> WebGeolocationManager { + DidChangePosition(WebKit::WebGeolocationPosition::Data position); + DidFailToDeterminePosition(); +} diff --git a/Source/WebKit2/WebProcess/Info.plist b/Source/WebKit2/WebProcess/Info.plist new file mode 100644 index 0000000..1564066 --- /dev/null +++ b/Source/WebKit2/WebProcess/Info.plist @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleGetInfoString</key> + <string>${BUNDLE_VERSION}, Copyright 2003-2011 Apple Inc.</string> + <key>CFBundleIdentifier</key> + <string>com.apple.${PRODUCT_NAME}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>${SHORT_VERSION_STRING}</string> + <key>CFBundleVersion</key> + <string>${BUNDLE_VERSION}</string> + <key>LSMinimumSystemVersion</key> + <string>${MACOSX_DEPLOYMENT_TARGET}</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>LSUIElement</key> + <true/> +</dict> +</plist> diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp new file mode 100644 index 0000000..5c4b6e9 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundle.h" +#include "WKBundlePrivate.h" + +#include "InjectedBundle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleGetTypeID() +{ + return toAPI(InjectedBundle::APIType); +} + +void WKBundleSetClient(WKBundleRef bundleRef, WKBundleClient * wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(bundleRef)->initializeClient(wkClient); +} + +void WKBundlePostMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) +{ + toImpl(bundleRef)->postMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); +} + +void WKBundlePostSynchronousMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnDataRef) +{ + RefPtr<APIObject> returnData; + toImpl(bundleRef)->postSynchronousMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef), returnData); + if (returnDataRef) + *returnDataRef = toAPI(returnData.release().leakRef()); +} + +void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundleRef, bool shouldTrackVisitedLinks) +{ + toImpl(bundleRef)->setShouldTrackVisitedLinks(shouldTrackVisitedLinks); +} + +void WKBundleRemoveAllVisitedLinks(WKBundleRef bundleRef) +{ + toImpl(bundleRef)->removeAllVisitedLinks(); +} + +void WKBundleActivateMacFontAscentHack(WKBundleRef bundleRef) +{ + toImpl(bundleRef)->activateMacFontAscentHack(); +} + +void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundleRef) +{ + toImpl(bundleRef)->garbageCollectJavaScriptObjects(); +} + +void WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(WKBundleRef bundleRef, bool waitUntilDone) +{ + toImpl(bundleRef)->garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(waitUntilDone); +} + +size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundleRef) +{ + return toImpl(bundleRef)->javaScriptObjectsCount(); +} + +void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef) +{ + toImpl(bundleRef)->addUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef)); +} + +void WKBundleAddUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserContentInjectedFrames injectedFramesRef) +{ + toImpl(bundleRef)->addUserStyleSheet(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserContentInjectedFrames(injectedFramesRef)); +} + +void WKBundleRemoveUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef) +{ + toImpl(bundleRef)->removeUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(urlRef)); +} + +void WKBundleRemoveUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef) +{ + toImpl(bundleRef)->removeUserStyleSheet(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(urlRef)); +} + +void WKBundleRemoveUserScripts(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef) +{ + toImpl(bundleRef)->removeUserScripts(toImpl(pageGroupRef), toImpl(scriptWorldRef)); +} + +void WKBundleRemoveUserStyleSheets(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef) +{ + toImpl(bundleRef)->removeUserStyleSheets(toImpl(pageGroupRef), toImpl(scriptWorldRef)); +} + +void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef) +{ + toImpl(bundleRef)->removeAllUserContent(toImpl(pageGroupRef)); +} + +void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) +{ + toImpl(bundleRef)->overrideXSSAuditorEnabledForTestRunner(toImpl(pageGroupRef), enabled); +} + +void WKBundleReportException(JSContextRef context, JSValueRef exception) +{ + InjectedBundle::reportException(context, exception); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h new file mode 100644 index 0000000..24c53b4 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h @@ -0,0 +1,65 @@ +/* + * 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 WKBundle_h +#define WKBundle_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Client +typedef void (*WKBundleDidCreatePageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); +typedef void (*WKBundleWillDestroyPageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); +typedef void (*WKBundleDidInitializePageGroupCallback)(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, const void* clientInfo); +typedef void (*WKBundleDidReceiveMessageCallback)(WKBundleRef bundle, WKStringRef name, WKTypeRef messageBody, const void* clientInfo); + +struct WKBundleClient { + int version; + const void * clientInfo; + WKBundleDidCreatePageCallback didCreatePage; + WKBundleWillDestroyPageCallback willDestroyPage; + WKBundleDidInitializePageGroupCallback didInitializePageGroup; + WKBundleDidReceiveMessageCallback didReceiveMessage; +}; +typedef struct WKBundleClient WKBundleClient; + +WK_EXPORT WKTypeID WKBundleGetTypeID(); + +WK_EXPORT void WKBundleSetClient(WKBundleRef bundle, WKBundleClient * client); + +WK_EXPORT void WKBundlePostMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody); +WK_EXPORT void WKBundlePostSynchronousMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData); + +WK_EXPORT void WKBundleReportException(JSContextRef, JSValueRef exception); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundle_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h new file mode 100644 index 0000000..47ac2d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -0,0 +1,128 @@ +/* + * 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 WKBundleAPICast_h +#define WKBundleAPICast_h + +#include "WKSharedAPICast.h" +#include "WKBundlePage.h" +#include "WKBundlePagePrivate.h" +#include "WKBundlePrivate.h" +#include <WebCore/EditorInsertAction.h> +#include <WebCore/TextAffinity.h> +#include <WebCore/UserContentTypes.h> +#include <WebCore/UserScriptTypes.h> + +namespace WebCore { + class CSSStyleDeclaration; +} + +namespace WebKit { + +class InjectedBundle; +class InjectedBundleBackForwardList; +class InjectedBundleBackForwardListItem; +class InjectedBundleHitTestResult; +class InjectedBundleNodeHandle; +class InjectedBundleRangeHandle; +class InjectedBundleScriptWorld; +class PageOverlay; +class WebFrame; +class WebPage; +class WebPageGroupProxy; + +WK_ADD_API_MAPPING(WKBundleBackForwardListItemRef, InjectedBundleBackForwardListItem) +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(WKBundleNodeHandleRef, InjectedBundleNodeHandle) +WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy) +WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay) +WK_ADD_API_MAPPING(WKBundlePageRef, WebPage) +WK_ADD_API_MAPPING(WKBundleRangeHandleRef, InjectedBundleRangeHandle) +WK_ADD_API_MAPPING(WKBundleRef, InjectedBundle) +WK_ADD_API_MAPPING(WKBundleScriptWorldRef, InjectedBundleScriptWorld) + +inline WKInsertActionType toAPI(WebCore::EditorInsertAction action) +{ + switch (action) { + case WebCore::EditorInsertActionTyped: + return kWKInsertActionTyped; + break; + case WebCore::EditorInsertActionPasted: + return kWKInsertActionPasted; + break; + case WebCore::EditorInsertActionDropped: + return kWKInsertActionDropped; + break; + } + ASSERT_NOT_REACHED(); + return kWKInsertActionTyped; +} + +inline WKAffinityType toAPI(WebCore::EAffinity affinity) +{ + switch (affinity) { + case WebCore::UPSTREAM: + return kWKAffinityUpstream; + break; + case WebCore::DOWNSTREAM: + return kWKAffinityDownstream; + break; + } + ASSERT_NOT_REACHED(); + return kWKAffinityUpstream; +} + +inline WebCore::UserScriptInjectionTime toUserScriptInjectionTime(WKUserScriptInjectionTime wkInjectedTime) +{ + switch (wkInjectedTime) { + case kWKInjectAtDocumentStart: + return WebCore::InjectAtDocumentStart; + case kWKInjectAtDocumentEnd: + return WebCore::InjectAtDocumentEnd; + } + + ASSERT_NOT_REACHED(); + return WebCore::InjectAtDocumentStart; +} + +inline WebCore::UserContentInjectedFrames toUserContentInjectedFrames(WKUserContentInjectedFrames wkInjectedFrames) +{ + switch (wkInjectedFrames) { + case kWKInjectInAllFrames: + return WebCore::InjectInAllFrames; + case kWKInjectInTopFrameOnly: + return WebCore::InjectInTopFrameOnly; + } + + ASSERT_NOT_REACHED(); + return WebCore::InjectInAllFrames; +} + +} // namespace WebKit + +#endif // WKBundleAPICast_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp new file mode 100644 index 0000000..288c676 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleBackForwardList.h" + +#include "InjectedBundleBackForwardList.h" +#include "InjectedBundleBackForwardListItem.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleBackForwardListGetTypeID() +{ + return toAPI(InjectedBundleBackForwardList::APIType); +} + +WKBundleBackForwardListItemRef WKBundleBackForwardListCopyItemAtIndex(WKBundleBackForwardListRef listRef, int index) +{ + return toAPI(toImpl(listRef)->itemAtIndex(index).leakRef()); +} + +unsigned WKBundleBackForwardListGetBackListCount(WKBundleBackForwardListRef listRef) +{ + return toImpl(listRef)->backListCount(); +} + +unsigned WKBundleBackForwardListGetForwardListCount(WKBundleBackForwardListRef listRef) +{ + return toImpl(listRef)->forwardListCount(); +} + +void WKBundleBackForwardListClear(WKBundleBackForwardListRef listRef) +{ + return toImpl(listRef)->clear(); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h new file mode 100644 index 0000000..7aa573a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h @@ -0,0 +1,48 @@ +/* + * 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 WKBundleBackForwardList_h +#define WKBundleBackForwardList_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleBackForwardListGetTypeID(); + +WK_EXPORT WKBundleBackForwardListItemRef WKBundleBackForwardListCopyItemAtIndex(WKBundleBackForwardListRef list, int index); + +WK_EXPORT unsigned WKBundleBackForwardListGetBackListCount(WKBundleBackForwardListRef list); +WK_EXPORT unsigned WKBundleBackForwardListGetForwardListCount(WKBundleBackForwardListRef list); + +WK_EXPORT void WKBundleBackForwardListClear(WKBundleBackForwardListRef list); + +#ifdef __cplusplus +} +#endif + +#endif // WKBundleBackForwardList_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp new file mode 100644 index 0000000..cde15c4 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleBackForwardListItem.h" + +#include "ImmutableArray.h" +#include "InjectedBundleBackForwardListItem.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleBackForwardListItemGetTypeID() +{ + return toAPI(InjectedBundleBackForwardListItem::APIType); +} + +bool WKBundleBackForwardListItemIsSame(WKBundleBackForwardListItemRef itemRef1, WKBundleBackForwardListItemRef itemRef2) +{ + return toImpl(itemRef1)->item() == toImpl(itemRef2)->item(); +} + +WKURLRef WKBundleBackForwardListItemCopyOriginalURL(WKBundleBackForwardListItemRef itemRef) +{ + return toCopiedURLAPI(toImpl(itemRef)->originalURL()); +} + +WKURLRef WKBundleBackForwardListItemCopyURL(WKBundleBackForwardListItemRef itemRef) +{ + return toCopiedURLAPI(toImpl(itemRef)->url()); +} + +WKStringRef WKBundleBackForwardListItemCopyTitle(WKBundleBackForwardListItemRef itemRef) +{ + return toCopiedAPI(toImpl(itemRef)->title()); +} + +WKStringRef WKBundleBackForwardListItemCopyTarget(WKBundleBackForwardListItemRef itemRef) +{ + return toCopiedAPI(toImpl(itemRef)->target()); +} + +bool WKBundleBackForwardListItemIsTargetItem(WKBundleBackForwardListItemRef itemRef) +{ + return toImpl(itemRef)->isTargetItem(); +} + +WKArrayRef WKBundleBackForwardListItemCopyChildren(WKBundleBackForwardListItemRef itemRef) +{ + return toAPI(toImpl(itemRef)->children().leakRef()); +} + diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h new file mode 100644 index 0000000..f256464 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h @@ -0,0 +1,52 @@ +/* + * 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 WKBundleBackForwardListItem_h +#define WKBundleBackForwardListItem_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleBackForwardListItemGetTypeID(); + +WK_EXPORT bool WKBundleBackForwardListItemIsSame(WKBundleBackForwardListItemRef item1, WKBundleBackForwardListItemRef item2); + +WK_EXPORT WKURLRef WKBundleBackForwardListItemCopyOriginalURL(WKBundleBackForwardListItemRef item); +WK_EXPORT WKURLRef WKBundleBackForwardListItemCopyURL(WKBundleBackForwardListItemRef item); +WK_EXPORT WKStringRef WKBundleBackForwardListItemCopyTitle(WKBundleBackForwardListItemRef item); + +WK_EXPORT WKStringRef WKBundleBackForwardListItemCopyTarget(WKBundleBackForwardListItemRef item); +WK_EXPORT bool WKBundleBackForwardListItemIsTargetItem(WKBundleBackForwardListItemRef item); + +WK_EXPORT WKArrayRef WKBundleBackForwardListItemCopyChildren(WKBundleBackForwardListItemRef item); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleBackForwardListItem_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp new file mode 100644 index 0000000..9410642 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleFrame.h" +#include "WKBundleFramePrivate.h" + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebFrame.h" +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKBundleFrameGetTypeID() +{ + return toAPI(WebFrame::APIType); +} + +bool WKBundleFrameIsMainFrame(WKBundleFrameRef frameRef) +{ + return toImpl(frameRef)->isMainFrame(); +} + +WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->url()); +} + +WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->provisionalURL()); +} + +WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->childFrames().releaseRef()); +} + +unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frameRef) +{ + return toImpl(frameRef)->numberOfActiveAnimations(); +} + +bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frameRef, WKStringRef name, WKStringRef elementID, double time) +{ + return toImpl(frameRef)->pauseAnimationOnElementWithId(toImpl(name)->string(), toImpl(elementID)->string(), time); +} + +void WKBundleFrameSuspendAnimations(WKBundleFrameRef frameRef) +{ + toImpl(frameRef)->suspendAnimations(); +} + +void WKBundleFrameResumeAnimations(WKBundleFrameRef frameRef) +{ + toImpl(frameRef)->resumeAnimations(); +} + +JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frameRef) +{ + return toImpl(frameRef)->jsContext(); +} + +JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frameRef, WKBundleScriptWorldRef worldRef) +{ + return toImpl(frameRef)->jsContextForWorld(toImpl(worldRef)); +} + +JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frameRef, WKBundleNodeHandleRef nodeHandleRef, WKBundleScriptWorldRef worldRef) +{ + return toImpl(frameRef)->jsWrapperForWorld(toImpl(nodeHandleRef), toImpl(worldRef)); +} + +JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frameRef, WKBundleRangeHandleRef rangeHandleRef, WKBundleScriptWorldRef worldRef) +{ + return toImpl(frameRef)->jsWrapperForWorld(toImpl(rangeHandleRef), toImpl(worldRef)); +} + +WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->name()); +} + +JSValueRef WKBundleFrameGetComputedStyleIncludingVisitedInfo(WKBundleFrameRef frameRef, JSObjectRef element) +{ + return toImpl(frameRef)->computedStyleIncludingVisitedInfo(element); +} + +WKStringRef WKBundleFrameCopyCounterValue(WKBundleFrameRef frameRef, JSObjectRef element) +{ + return toCopiedAPI(toImpl(frameRef)->counterValue(element)); +} + +WKStringRef WKBundleFrameCopyMarkerText(WKBundleFrameRef frameRef, JSObjectRef element) +{ + return toCopiedAPI(toImpl(frameRef)->markerText(element)); +} + +WKStringRef WKBundleFrameCopyInnerText(WKBundleFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->innerText()); +} + +unsigned WKBundleFrameGetPendingUnloadCount(WKBundleFrameRef frameRef) +{ + return toImpl(frameRef)->pendingUnloadCount(); +} + +WKBundlePageRef WKBundleFrameGetPage(WKBundleFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->page()); +} + +WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->layerTreeAsText()); +} + +bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef) +{ + return toImpl(frameRef)->allowsFollowingLink(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())); +} + +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; +} + +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); + + visibleContentBounds.size.width = bounds.width(); + visibleContentBounds.size.height = bounds.height(); + + return visibleContentBounds; +} + +WK_EXPORT 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()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h new file mode 100644 index 0000000..a6a20b2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h @@ -0,0 +1,64 @@ +/* + * 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 WKBundleFrame_h +#define WKBundleFrame_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleFrameGetTypeID(); + +WK_EXPORT bool WKBundleFrameIsMainFrame(WKBundleFrameRef frame); +WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame); + +WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame); +WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame); +WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame); + +WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame); +WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world); + +WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frame, WKBundleNodeHandleRef nodeHandle, WKBundleScriptWorldRef world); +WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frame, WKBundleRangeHandleRef rangeHandle, WKBundleScriptWorldRef world); + +WK_EXPORT WKBundlePageRef WKBundleFrameGetPage(WKBundleFrameRef frame); + +WK_EXPORT bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frame, WKURLRef url); + +WK_EXPORT WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frame); +WK_EXPORT WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frame); +WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frame); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleFrame_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h new file mode 100644 index 0000000..3f83a61 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h @@ -0,0 +1,55 @@ +/* + * 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 WKBundleFramePrivate_h +#define WKBundleFramePrivate_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKBundleFrameCopyInnerText(WKBundleFrameRef frame); +WK_EXPORT WKStringRef WKBundleFrameCopyCounterValue(WKBundleFrameRef frame, JSObjectRef element); +WK_EXPORT WKStringRef WKBundleFrameCopyMarkerText(WKBundleFrameRef frame, JSObjectRef element); +WK_EXPORT JSValueRef WKBundleFrameGetComputedStyleIncludingVisitedInfo(WKBundleFrameRef frame, JSObjectRef element); +WK_EXPORT unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frame); +WK_EXPORT bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frame, WKStringRef name, WKStringRef elementID, double time); +WK_EXPORT void WKBundleFrameSuspendAnimations(WKBundleFrameRef frame); +WK_EXPORT void WKBundleFrameResumeAnimations(WKBundleFrameRef frame); +WK_EXPORT unsigned WKBundleFrameGetPendingUnloadCount(WKBundleFrameRef frame); +WK_EXPORT WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frame); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleFramePrivate_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp new file mode 100644 index 0000000..7e74262 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleHitTestResult.h" + +#include "InjectedBundleHitTestResult.h" +#include "InjectedBundleNodeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleHitTestResultGetTypeID() +{ + return toAPI(InjectedBundleHitTestResult::APIType); +} + +WKBundleNodeHandleRef WKBundleHitTestResultGetNodeHandle(WKBundleHitTestResultRef hitTestResultRef) +{ + RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(hitTestResultRef)->nodeHandle(); + return toAPI(nodeHandle.get()); +} + +WKBundleFrameRef WKBundleHitTestResultGetFrame(WKBundleHitTestResultRef hitTestResultRef) +{ + return toAPI(toImpl(hitTestResultRef)->frame()); +} + +WKBundleFrameRef WKBundleHitTestResultGetTargetFrame(WKBundleHitTestResultRef hitTestResultRef) +{ + return toAPI(toImpl(hitTestResultRef)->targetFrame()); +} + +WKURLRef WKBundleHitTestResultCopyAbsoluteImageURL(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteImageURL()); +} + +WKURLRef WKBundleHitTestResultCopyAbsoluteLinkURL(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteLinkURL()); +} + +WKURLRef WKBundleHitTestResultCopyAbsoluteMediaURL(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedURLAPI(toImpl(hitTestResultRef)->absoluteMediaURL()); +} + +WKRect WKBundleHitTestResultGetImageRect(WKBundleHitTestResultRef hitTestResultRef) +{ + return toAPI(toImpl(hitTestResultRef)->imageRect()); +} + +bool WKBundleHitTestResultGetIsSelected(WKBundleHitTestResultRef hitTestResultRef) +{ + return toImpl(hitTestResultRef)->isSelected(); +} + +WKStringRef WKBundleHitTestResultCopyLinkLabel(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedAPI(toImpl(hitTestResultRef)->linkLabel()); +} + +WKStringRef WKBundleHitTestResultCopyLinkTitle(WKBundleHitTestResultRef hitTestResultRef) +{ + return toCopiedAPI(toImpl(hitTestResultRef)->linkTitle()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h new file mode 100644 index 0000000..19a6582 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h @@ -0,0 +1,57 @@ +/* + * 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 WKBundleHitTestResult_h +#define WKBundleHitTestResult_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleHitTestResultGetTypeID(); + +WK_EXPORT WKBundleNodeHandleRef WKBundleHitTestResultGetNodeHandle(WKBundleHitTestResultRef hitTestResult); + +WK_EXPORT WKBundleFrameRef WKBundleHitTestResultGetFrame(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKBundleFrameRef WKBundleHitTestResultGetTargetFrame(WKBundleHitTestResultRef hitTestResult); + +WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteImageURL(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteLinkURL(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteMediaURL(WKBundleHitTestResultRef hitTestResult); + +WK_EXPORT WKRect WKBundleHitTestResultGetImageRect(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT bool WKBundleHitTestResultGetIsSelected(WKBundleHitTestResultRef hitTestResult); + +WK_EXPORT WKStringRef WKBundleHitTestResultCopyLinkLabel(WKBundleHitTestResultRef hitTestResult); +WK_EXPORT WKStringRef WKBundleHitTestResultCopyLinkTitle(WKBundleHitTestResultRef hitTestResult); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleHitTestResult_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h new file mode 100644 index 0000000..f10b7b4 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h @@ -0,0 +1,42 @@ +/* + * 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 WKBundleInitialize_h +#define WKBundleInitialize_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// NOTE: Must be implemented by InjectedBundle's as a function named "WKBundleInitialize". +typedef void (*WKBundleInitializeFunctionPtr)(WKBundleRef, WKTypeRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleInitialize_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp new file mode 100644 index 0000000..86d913b --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleNodeHandle.h" +#include "WKBundleNodeHandlePrivate.h" + +#include "InjectedBundleNodeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebFrame.h" + +using namespace WebKit; + +WKTypeID WKBundleNodeHandleGetTypeID() +{ + return toAPI(InjectedBundleNodeHandle::APIType); +} + +WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef contextRef, JSObjectRef objectRef) +{ + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(contextRef, objectRef); + return toAPI(nodeHandle.release().releaseRef()); +} + +WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandleRef) +{ + return toAPI(toImpl(nodeHandleRef)->elementBounds()); +} + +void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandleRef, WKStringRef valueRef) +{ + toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef)); +} + +bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef) +{ + return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutofilled(); +} + +void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled) +{ + toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutofilled(filled); +} + +WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandleRef) +{ + RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(htmlTableCellElementHandleRef)->htmlTableCellElementCellAbove(); + return toAPI(nodeHandle.release().releaseRef()); +} + +WKBundleFrameRef WKBundleNodeHandleCopyDocumentFrame(WKBundleNodeHandleRef documentHandleRef) +{ + RefPtr<WebFrame> frame = toImpl(documentHandleRef)->documentFrame(); + return toAPI(frame.release().releaseRef()); +} + +WKBundleFrameRef WKBundleNodeHandleCopyHTMLFrameElementContentFrame(WKBundleNodeHandleRef htmlFrameElementHandleRef) +{ + RefPtr<WebFrame> frame = toImpl(htmlFrameElementHandleRef)->htmlFrameElementContentFrame(); + return toAPI(frame.release().releaseRef()); +} + +WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandleRef) +{ + RefPtr<WebFrame> frame = toImpl(htmlIFrameElementHandleRef)->htmlIFrameElementContentFrame(); + return toAPI(frame.release().releaseRef()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h new file mode 100644 index 0000000..3cdad17 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h @@ -0,0 +1,41 @@ +/* + * 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 WKBundleNodeHandle_h +#define WKBundleNodeHandle_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleNodeHandleGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleNodeHandle_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h new file mode 100644 index 0000000..854677b --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h @@ -0,0 +1,65 @@ +/* + * 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 WKBundleNodeHandlePrivate_h +#define WKBundleNodeHandlePrivate_h + +#include <JavaScriptCore/JavaScript.h> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef context, JSObjectRef object); + + +/* Additional DOM Operations */ + +WK_EXPORT WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandle); + +/* HTMLInputElement Specific Operations */ +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value); +WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle); +WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled); + +/* HTMLTableCellElement Specific Operations */ +WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandle); + +/* Document Specific Operations */ +WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyDocumentFrame(WKBundleNodeHandleRef documentHandle); + +/* HTMLFrameElement Specific Operations */ +WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLFrameElementContentFrame(WKBundleNodeHandleRef htmlFrameElementHandle); + +/* HTMLIFrameElement Specific Operations */ +WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandle); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleNodeHandlePrivate_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp new file mode 100644 index 0000000..9693b6a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundlePage.h" +#include "WKBundlePagePrivate.h" + +#include "InjectedBundleBackForwardList.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebImage.h" +#include "WebPage.h" +#include "WebURL.h" +#include "WebURLRequest.h" + +#include <WebCore/KURL.h> + +using namespace WebKit; + +WKTypeID WKBundlePageGetTypeID() +{ + return toAPI(WebPage::APIType); +} + +void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageContextMenuClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleContextMenuClient(wkClient); +} + +void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleEditorClient(wkClient); +} + +void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient); +} + +void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleLoaderClient(wkClient); +} + +void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeInjectedBundleUIClient(wkClient); +} + +WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef pageRef) +{ + return toAPI(toImpl(pageRef)->pageGroup()); +} + +WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef) +{ + return toAPI(toImpl(pageRef)->mainFrame()); +} + +void WKBundlePageStopLoading(WKBundlePageRef pageRef) +{ + toImpl(pageRef)->stopLoading(); +} + +void WKBundlePageSetDefersLoading(WKBundlePageRef pageRef, bool defersLoading) +{ + toImpl(pageRef)->setDefersLoading(defersLoading); +} + +WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->renderTreeExternalRepresentation()); +} + +void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument) +{ + toImpl(pageRef)->executeEditingCommand(toImpl(name)->string(), toImpl(argument)->string()); +} + +bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef pageRef, WKStringRef name) +{ + return toImpl(pageRef)->isEditingCommandEnabled(toImpl(name)->string()); +} + +void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef) +{ + toImpl(pageRef)->clearMainFrameName(); +} + +void WKBundlePageClose(WKBundlePageRef pageRef) +{ + toImpl(pageRef)->sendClose(); +} + +double WKBundlePageGetTextZoomFactor(WKBundlePageRef pageRef) +{ + return toImpl(pageRef)->textZoomFactor(); +} + +void WKBundlePageSetTextZoomFactor(WKBundlePageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setTextZoomFactor(zoomFactor); +} + +double WKBundlePageGetPageZoomFactor(WKBundlePageRef pageRef) +{ + return toImpl(pageRef)->pageZoomFactor(); +} + +void WKBundlePageSetPageZoomFactor(WKBundlePageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setPageZoomFactor(zoomFactor); +} + +WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef pageRef) +{ + return toAPI(toImpl(pageRef)->backForwardList()); +} + +void WKBundlePageInstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) +{ + toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef)); +} + +void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef) +{ + toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef)); +} + +bool WKBundlePageHasLocalDataForURL(WKBundlePageRef pageRef, WKURLRef urlRef) +{ + return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())); +} + +bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef) +{ + return WebPage::canHandleRequest(toImpl(requestRef)->resourceRequest()); +} + +bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindOptions findOptions) +{ + return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions)); +} + +WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options) +{ + RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInViewCoordinates(toIntRect(rect), toImageOptions(options)); + return toAPI(webImage.release().leakRef()); +} + +WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options) +{ + RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInDocumentCoordinates(toIntRect(rect), toImageOptions(options)); + return toAPI(webImage.release().leakRef()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h new file mode 100644 index 0000000..00db56f --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -0,0 +1,227 @@ +/* + * 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 WKBundlePage_h +#define WKBundlePage_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKEvent.h> +#include <WebKit2/WKFindOptions.h> +#include <WebKit2/WKImage.h> +#include <WebKit2/WKPageLoadTypes.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKInsertActionTyped = 0, + kWKInsertActionPasted = 1, + kWKInsertActionDropped = 2 +}; +typedef uint32_t WKInsertActionType; + +enum { + kWKAffinityUpstream, + kWKAffinityDownstream +}; +typedef uint32_t WKAffinityType; + +enum { + WKInputFieldActionTypeMoveUp, + WKInputFieldActionTypeMoveDown, + WKInputFieldActionTypeCancel, + WKInputFieldActionTypeInsertTab, + WKInputFieldActionTypeInsertBacktab, + WKInputFieldActionTypeInsertNewline, + WKInputFieldActionTypeInsertDelete +}; +typedef uint32_t WKInputFieldActionType; + +// Loader Client +typedef void (*WKBundlePageDidStartProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidCommitLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidDocumentFinishLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFinishLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFinishDocumentLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidSameDocumentNavigationForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFirstLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidRemoveFrameFromHierarchyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidDisplayInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +typedef void (*WKBundlePageDidRunInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo); +// FIXME: There are no WKPage equivilent of these functions yet. +typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo); +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; + const void * clientInfo; + WKBundlePageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKBundlePageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKBundlePageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKBundlePageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKBundlePageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKBundlePageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKBundlePageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKBundlePageDidFirstLayoutForFrame didFirstLayoutForFrame; + WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame didFirstVisuallyNonEmptyLayoutForFrame; + WKBundlePageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKBundlePageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKBundlePageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + + // FIXME: There are no WKPage equivilent of these functions yet. + WKBundlePageDidClearWindowObjectForFrameCallback didClearWindowObjectForFrame; + WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame; + WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame; + WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame; + WKBundlePageShouldLoadResourceForFrameCallback shouldLoadResourceForFrame; +}; +typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient; + +// 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); +typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo); +typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo); +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); + +struct WKBundlePageUIClient { + int version; + const void * clientInfo; + WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole; + WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText; + WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert; + WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm; + WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt; + WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKBundlePageDidScrollCallback pageDidScroll; +}; +typedef struct WKBundlePageUIClient WKBundlePageUIClient; + +// Editor client +typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo); +typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo); +typedef bool (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo); +typedef bool (*WKBundlePageShouldInsertTextCallback)(WKBundlePageRef page, WKStringRef string, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo); +typedef bool (*WKBundlePageShouldDeleteRangeCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo); +typedef bool (*WKBundlePageShouldChangeSelectedRange)(WKBundlePageRef page, WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo); +typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range, const void* clientInfo); +typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo); + +struct WKBundlePageEditorClient { + int version; + const void * clientInfo; + WKBundlePageShouldBeginEditingCallback shouldBeginEditing; + WKBundlePageShouldEndEditingCallback shouldEndEditing; + WKBundlePageShouldInsertNodeCallback shouldInsertNode; + WKBundlePageShouldInsertTextCallback shouldInsertText; + WKBundlePageShouldDeleteRangeCallback shouldDeleteRange; + WKBundlePageShouldChangeSelectedRange shouldChangeSelectedRange; + WKBundlePageShouldApplyStyle shouldApplyStyle; + WKBundlePageEditingNotification didBeginEditing; + WKBundlePageEditingNotification didEndEditing; + WKBundlePageEditingNotification didChange; + WKBundlePageEditingNotification didChangeSelection; +}; +typedef struct WKBundlePageEditorClient WKBundlePageEditorClient; + +// Form client +typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); +typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); +typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); +typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo); +typedef bool (*WKBundlePageShouldPerformActionInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKInputFieldActionType actionType, WKBundleFrameRef frame, const void* clientInfo); +typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo); + +struct WKBundlePageFormClient { + int version; + const void * clientInfo; + WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; + WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; + WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; + WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; + WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; + WKBundlePageWillSubmitFormCallback willSubmitForm; +}; +typedef struct WKBundlePageFormClient WKBundlePageFormClient; + +// ContextMenu client +typedef void (*WKBundlePageGetContextMenuFromDefaultContextMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo); + +struct WKBundlePageContextMenuClient { + int version; + const void * clientInfo; + WKBundlePageGetContextMenuFromDefaultContextMenuCallback getContextMenuFromDefaultMenu; +}; +typedef struct WKBundlePageContextMenuClient WKBundlePageContextMenuClient; + +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 WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client); + +WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); +WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page); + +WK_EXPORT WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef page); + +WK_EXPORT void WKBundlePageInstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); +WK_EXPORT void WKBundlePageUninstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); + +WK_EXPORT bool WKBundlePageHasLocalDataForURL(WKBundlePageRef page, WKURLRef url); +WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request); + +WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions); + +WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); +WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundlePage_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp new file mode 100644 index 0000000..47d4cf1 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundlePageGroup.h" + +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebPageGroupProxy.h" + +using namespace WebKit; + +WKTypeID WKBundlePageGroupGetTypeID() +{ + return toAPI(WebPageGroupProxy::APIType); +} + +WKStringRef WKBundlePageGroupCopyIdentifier(WKBundlePageGroupRef bundlePageGroup) +{ + return toCopiedAPI(toImpl(bundlePageGroup)->identifier()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h new file mode 100644 index 0000000..e0bf645 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h @@ -0,0 +1,43 @@ +/* + * 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 WKBundlePageGroup_h +#define WKBundlePageGroup_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundlePageGroupGetTypeID(); + +WK_EXPORT WKStringRef WKBundlePageGroupCopyIdentifier(WKBundlePageGroupRef bundlePageGroup); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundlePageGroup_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp new file mode 100644 index 0000000..48fcab4 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundlePageOverlay.h" + +#include "PageOverlay.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include <WebCore/GraphicsContext.h> +#include <wtf/PassOwnPtr.h> + +using namespace WebCore; +using namespace WebKit; + +class PageOverlayClientImpl : public PageOverlay::Client { +public: + static PassOwnPtr<PageOverlayClientImpl> create(WKBundlePageOverlayClient* client) + { + return adoptPtr(new PageOverlayClientImpl(client)); + } + +private: + explicit PageOverlayClientImpl(WKBundlePageOverlayClient* client) + : m_client() + { + if (client) + m_client = *client; + } + + // PageOverlay::Client. + virtual void pageOverlayDestroyed(PageOverlay*) + { + delete this; + } + + virtual void willMoveToWebPage(PageOverlay* pageOverlay, WebPage* page) + { + if (!m_client.willMoveToPage) + return; + + m_client.willMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.clientInfo); + } + + virtual void didMoveToWebPage(PageOverlay* pageOverlay, WebPage* page) + { + if (!m_client.didMoveToPage) + return; + + m_client.didMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.clientInfo); + } + + virtual void drawRect(PageOverlay* pageOverlay, GraphicsContext& graphicsContext, const IntRect& dirtyRect) + { + if (!m_client.drawRect) + return; + + m_client.drawRect(toAPI(pageOverlay), graphicsContext.platformContext(), toAPI(dirtyRect), m_client.clientInfo); + } + + virtual bool mouseEvent(PageOverlay* pageOverlay, const WebMouseEvent& event) + { + switch (event.type()) { + case WebEvent::MouseDown: { + if (!m_client.mouseDown) + return false; + + return m_client.mouseDown(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo); + } + case WebEvent::MouseUp: { + if (!m_client.mouseUp) + return false; + + return m_client.mouseUp(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo); + } + case WebEvent::MouseMove: { + if (event.button() == WebMouseEvent::NoButton) { + if (!m_client.mouseMoved) + return false; + + return m_client.mouseMoved(toAPI(pageOverlay), toAPI(event.position()), m_client.clientInfo); + } + + // This is a MouseMove event with a mouse button pressed. Call mouseDragged. + if (!m_client.mouseDragged) + return false; + + return m_client.mouseDragged(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo); + } + + default: + return false; + } + } + + WKBundlePageOverlayClient m_client; +}; + +WKTypeID WKBundlePageOverlayGetTypeID() +{ + return toAPI(PageOverlay::APIType); +} + +WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClient* wkClient) +{ + if (wkClient && wkClient->version) + return 0; + + OwnPtr<PageOverlayClientImpl> clientImpl = PageOverlayClientImpl::create(wkClient); + + return toAPI(PageOverlay::create(clientImpl.leakPtr()).leakRef()); +} + +void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlayRef, WKRect rect) +{ + toImpl(bundlePageOverlayRef)->setNeedsDisplay(enclosingIntRect(toFloatRect(rect))); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h new file mode 100644 index 0000000..3b4f950 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h @@ -0,0 +1,74 @@ +/* + * 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 WKBundlePageOverlay_h +#define WKBundlePageOverlay_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKEvent.h> +#include <WebKit2/WKGeometry.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Page overlay client. +typedef void (*WKBundlePageOverlayWillMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo); +typedef void (*WKBundlePageOverlayDidMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo); +typedef void (*WKBundlePageOverlayDrawRectCallback)(WKBundlePageOverlayRef pageOverlay, void* graphicsContext, WKRect dirtyRect, const void* clientInfo); +typedef bool (*WKBundlePageOverlayMouseDownCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); +typedef bool (*WKBundlePageOverlayMouseUpCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); +typedef bool (*WKBundlePageOverlayMouseMovedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, const void* clientInfo); +typedef bool (*WKBundlePageOverlayMouseDraggedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo); + +struct WKBundlePageOverlayClient { + int version; + const void * clientInfo; + WKBundlePageOverlayWillMoveToPageCallback willMoveToPage; + WKBundlePageOverlayDidMoveToPageCallback didMoveToPage; + WKBundlePageOverlayDrawRectCallback drawRect; + WKBundlePageOverlayMouseDownCallback mouseDown; + WKBundlePageOverlayMouseUpCallback mouseUp; + WKBundlePageOverlayMouseMovedCallback mouseMoved; + WKBundlePageOverlayMouseDraggedCallback mouseDragged; +}; +typedef struct WKBundlePageOverlayClient WKBundlePageOverlayClient; + +WK_EXPORT WKTypeID WKBundlePageOverlayGetTypeID(); + +WK_EXPORT WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClient* client); +WK_EXPORT void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlay, WKRect rect); + +#ifdef __cplusplus +} +#endif + +#endif // WKBundlePageOverlay_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h new file mode 100644 index 0000000..4bc8fed --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h @@ -0,0 +1,52 @@ +/* + * 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 WKBundlePagePrivate_h +#define WKBundlePagePrivate_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT void WKBundlePageStopLoading(WKBundlePageRef page); +WK_EXPORT void WKBundlePageSetDefersLoading(WKBundlePageRef page, bool defersLoading); +WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName); +WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page); +WK_EXPORT void WKBundlePageClose(WKBundlePageRef page); +WK_EXPORT WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef page); +WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument); + +WK_EXPORT double WKBundlePageGetTextZoomFactor(WKBundlePageRef page); +WK_EXPORT void WKBundlePageSetTextZoomFactor(WKBundlePageRef page, double zoomFactor); +WK_EXPORT double WKBundlePageGetPageZoomFactor(WKBundlePageRef page); +WK_EXPORT void WKBundlePageSetPageZoomFactor(WKBundlePageRef page, double zoomFactor); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundlePagePrivate_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h new file mode 100644 index 0000000..bb0bd9f --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -0,0 +1,73 @@ +/* + * 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 WKBundlePrivate_h +#define WKBundlePrivate_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks); +WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle); +WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle); +WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle); +WK_EXPORT void WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(WKBundleRef bundle, bool waitUntilDone); +WK_EXPORT size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundle); + +enum WKUserScriptInjectionTime { + kWKInjectAtDocumentStart, + kWKInjectAtDocumentEnd +}; +typedef enum WKUserScriptInjectionTime WKUserScriptInjectionTime; + +enum WKUserContentInjectedFrames { + kWKInjectInAllFrames, + kWKInjectInTopFrameOnly +}; +typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames; + +WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); +WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames); +WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url); +WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url); +WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld); +WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld); +WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup); + +// Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. +WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundlePrivate_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp new file mode 100644 index 0000000..78047af --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleRangeHandle.h" + +#include "InjectedBundleRangeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleRangeHandleGetTypeID() +{ + return toAPI(InjectedBundleRangeHandle::APIType); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h new file mode 100644 index 0000000..8d1d359 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleRangeHandle.h @@ -0,0 +1,41 @@ +/* + * 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 WKBundleRangeHandle_h +#define WKBundleRangeHandle_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleRangeHandleGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleRangeHandle_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp new file mode 100644 index 0000000..a7a4a8d --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WKBundleScriptWorld.h" + +#include "InjectedBundleScriptWorld.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" + +using namespace WebKit; + +WKTypeID WKBundleScriptWorldGetTypeID() +{ + return toAPI(InjectedBundleScriptWorld::APIType); +} + +WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld() +{ + RefPtr<InjectedBundleScriptWorld> world = InjectedBundleScriptWorld::create(); + return toAPI(world.release().releaseRef()); +} + +WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld() +{ + return toAPI(InjectedBundleScriptWorld::normalWorld()); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h new file mode 100644 index 0000000..0763efa --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h @@ -0,0 +1,44 @@ +/* + * 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 WKBundleScriptWorld_h +#define WKBundleScriptWorld_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleScriptWorldGetTypeID(); + +WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld(); +WK_EXPORT WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBundleScriptWorld_h */ diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp new file mode 100644 index 0000000..e9370c6 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleNodeHandle.h" + +#include "WebFrame.h" +#include "WebFrameLoaderClient.h" +#include <JavaScriptCore/APICast.h> +#include <WebCore/Document.h> +#include <WebCore/HTMLFrameElement.h> +#include <WebCore/HTMLIFrameElement.h> +#include <WebCore/Frame.h> +#include <WebCore/HTMLInputElement.h> +#include <WebCore/HTMLNames.h> +#include <WebCore/HTMLTableCellElement.h> +#include <WebCore/IntRect.h> +#include <WebCore/JSNode.h> +#include <WebCore/Node.h> +#include <wtf/HashMap.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; +using namespace HTMLNames; + +namespace WebKit { + +typedef HashMap<Node*, InjectedBundleNodeHandle*> DOMHandleCache; + +static DOMHandleCache& domHandleCache() +{ + DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ()); + return cache; +} + +PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object) +{ + Node* node = toNode(toJS(object)); + return getOrCreate(node); +} + +PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node) +{ + if (!node) + return 0; + + std::pair<DOMHandleCache::iterator, bool> result = domHandleCache().add(node, 0); + if (!result.second) + return PassRefPtr<InjectedBundleNodeHandle>(result.first->second); + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node); + result.first->second = nodeHandle.get(); + return nodeHandle.release(); +} + +PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node* node) +{ + return adoptRef(new InjectedBundleNodeHandle(node)); +} + +InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node* node) + : m_node(node) +{ +} + +InjectedBundleNodeHandle::~InjectedBundleNodeHandle() +{ + domHandleCache().remove(m_node.get()); +} + +Node* InjectedBundleNodeHandle::coreNode() const +{ + return m_node.get(); +} + +// Additional DOM Operations +// Note: These should only be operations that are not exposed to JavaScript. + +IntRect InjectedBundleNodeHandle::elementBounds() const +{ + if (!m_node->isElementNode()) + return IntRect(); + + return static_cast<Element*>(m_node.get())->boundsInWindowSpace(); +} + +void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value) +{ + if (!m_node->hasTagName(inputTag)) + return; + + static_cast<HTMLInputElement*>(m_node.get())->setValueForUser(value); +} + +bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const +{ + if (!m_node->hasTagName(inputTag)) + return false; + + return static_cast<HTMLInputElement*>(m_node.get())->isAutofilled(); +} + + +void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled) +{ + if (!m_node->hasTagName(inputTag)) + return; + + static_cast<HTMLInputElement*>(m_node.get())->setAutofilled(filled); +} + +PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove() +{ + if (!m_node->hasTagName(tdTag)) + return 0; + + return getOrCreate(static_cast<HTMLTableCellElement*>(m_node.get())->cellAbove()); +} + +PassRefPtr<WebFrame> InjectedBundleNodeHandle::documentFrame() +{ + if (!m_node->isDocumentNode()) + return 0; + + Frame* frame = static_cast<Document*>(m_node.get())->frame(); + if (!frame) + return 0; + + return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); +} + +PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlFrameElementContentFrame() +{ + if (!m_node->hasTagName(frameTag)) + return 0; + + Frame* frame = static_cast<HTMLFrameElement*>(m_node.get())->contentFrame(); + if (!frame) + return 0; + + return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); +} + +PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlIFrameElementContentFrame() +{ + if (!m_node->hasTagName(iframeTag)) + return 0; + + Frame* frame = static_cast<HTMLIFrameElement*>(m_node.get())->contentFrame(); + if (!frame) + return 0; + + return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h new file mode 100644 index 0000000..eff4600 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h @@ -0,0 +1,79 @@ +/* + * 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 InjectedBundleNodeHandle_h +#define InjectedBundleNodeHandle_h + +#include "APIObject.h" +#include <JavaScriptCore/JSBase.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class IntRect; + class Node; +} + +namespace WebKit { + +class InjectedBundleScriptWorld; +class WebFrame; + +class InjectedBundleNodeHandle : public APIObject { +public: + static const Type APIType = TypeBundleNodeHandle; + + static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(JSContextRef, JSObjectRef); + static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*); + + virtual ~InjectedBundleNodeHandle(); + + WebCore::Node* coreNode() const; + + // Additional DOM Operations + // Note: These should only be operations that are not exposed to JavaScript. + WebCore::IntRect elementBounds() const; + void setHTMLInputElementValueForUser(const String&); + bool isHTMLInputElementAutofilled() const; + void setHTMLInputElementAutofilled(bool); + PassRefPtr<InjectedBundleNodeHandle> htmlTableCellElementCellAbove(); + + PassRefPtr<WebFrame> documentFrame(); + PassRefPtr<WebFrame> htmlFrameElementContentFrame(); + PassRefPtr<WebFrame> htmlIFrameElementContentFrame(); + +private: + static PassRefPtr<InjectedBundleNodeHandle> create(WebCore::Node*); + InjectedBundleNodeHandle(WebCore::Node*); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::Node> m_node; +}; + +} // namespace WebKit + +#endif // InjectedBundleNodeHandle_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp new file mode 100644 index 0000000..9186637 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleRangeHandle.h" + +#include <WebCore/Range.h> +#include <wtf/HashMap.h> + +using namespace WebCore; + +namespace WebKit { + +typedef HashMap<Range*, InjectedBundleRangeHandle*> DOMHandleCache; + +static DOMHandleCache& domHandleCache() +{ + DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ()); + return cache; +} + +PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(Range* range) +{ + if (!range) + return 0; + + std::pair<DOMHandleCache::iterator, bool> result = domHandleCache().add(range, 0); + if (!result.second) + return PassRefPtr<InjectedBundleRangeHandle>(result.first->second); + + RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::create(range); + result.first->second = rangeHandle.get(); + return rangeHandle.release(); +} + +PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::create(Range* range) +{ + return adoptRef(new InjectedBundleRangeHandle(range)); +} + +InjectedBundleRangeHandle::InjectedBundleRangeHandle(Range* range) + : m_range(range) +{ +} + +InjectedBundleRangeHandle::~InjectedBundleRangeHandle() +{ + domHandleCache().remove(m_range.get()); +} + +Range* InjectedBundleRangeHandle::coreRange() const +{ + return m_range.get(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h new file mode 100644 index 0000000..4d6789a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h @@ -0,0 +1,62 @@ +/* + * 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 InjectedBundleRangeHandle_h +#define InjectedBundleRangeHandle_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class Range; +} + +namespace WebKit { + +class InjectedBundleScriptWorld; + +class InjectedBundleRangeHandle : public APIObject { +public: + static const Type APIType = TypeBundleRangeHandle; + + static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(WebCore::Range*); + + virtual ~InjectedBundleRangeHandle(); + + WebCore::Range* coreRange() const; + +private: + static PassRefPtr<InjectedBundleRangeHandle> create(WebCore::Range*); + InjectedBundleRangeHandle(WebCore::Range*); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::Range> m_range; +}; + +} // namespace WebKit + +#endif // InjectedBundleRangeHandle_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp new file mode 100644 index 0000000..c9f1a6d --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundle.h" + +#include "Arguments.h" +#include "ImmutableArray.h" +#include "InjectedBundleMessageKinds.h" +#include "InjectedBundleScriptWorld.h" +#include "InjectedBundleUserMessageCoders.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebContextMessageKinds.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPreferencesStore.h" +#include "WebProcess.h" +#include <JavaScriptCore/APICast.h> +#include <JavaScriptCore/JSLock.h> +#include <WebCore/GCController.h> +#include <WebCore/JSDOMWindow.h> +#include <WebCore/Page.h> +#include <WebCore/PageGroup.h> +#include <WebCore/Settings.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/PassOwnArrayPtr.h> + +using namespace WebCore; +using namespace JSC; + +namespace WebKit { + +InjectedBundle::InjectedBundle(const String& path) + : m_path(path) + , m_platformBundle(0) +{ + initializeClient(0); +} + +InjectedBundle::~InjectedBundle() +{ +} + +void InjectedBundle::initializeClient(WKBundleClient* client) +{ + m_client.initialize(client); +} + +void InjectedBundle::postMessage(const String& messageName, APIObject* messageBody) +{ + WebProcess::shared().connection()->send(WebContextLegacyMessage::PostMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody))); +} + +void InjectedBundle::postSynchronousMessage(const String& messageName, APIObject* messageBody, RefPtr<APIObject>& returnData) +{ + RefPtr<APIObject> returnDataTmp; + InjectedBundleUserMessageDecoder messageDecoder(returnDataTmp); + + bool succeeded = WebProcess::shared().connection()->sendSync(WebContextLegacyMessage::PostSynchronousMessage, 0, CoreIPC::In(messageName, InjectedBundleUserMessageEncoder(messageBody)), CoreIPC::Out(messageDecoder)); + + if (!succeeded) + return; + + returnData = returnDataTmp; +} + +void InjectedBundle::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks) +{ + PageGroup::setShouldTrackVisitedLinks(shouldTrackVisitedLinks); +} + +void InjectedBundle::removeAllVisitedLinks() +{ + PageGroup::removeAllVisitedLinks(); +} + +void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled) +{ + // Override the preference for all future pages. + WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(enabled); + + // Change the setting for existing ones. + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); + for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) + (*iter)->settings()->setXSSAuditorEnabled(enabled); +} + + +static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns) +{ + if (!patterns) + return 0; + + size_t size = patterns->size(); + if (!size) + return 0; + + Vector<String>* patternsVector = new Vector<String>; + patternsVector->reserveInitialCapacity(size); + for (size_t i = 0; i < size; ++i) { + WebString* entry = patterns->at<WebString>(i); + if (entry) + patternsVector->uncheckedAppend(entry->string()); + } + return patternsVector; +} + +void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames) +{ + // url is not from KURL::string(), i.e. it has not already been parsed by KURL, so we have to use the relative URL constructor for KURL instead of the ParsedURLStringTag version. + PageGroup::pageGroup(pageGroup->identifier())->addUserScriptToWorld(scriptWorld->coreWorld(), source, KURL(KURL(), url), toStringVector(whitelist), toStringVector(blacklist), injectionTime, injectedFrames); +} + +void InjectedBundle::addUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames injectedFrames) +{ + // url is not from KURL::string(), i.e. it has not already been parsed by KURL, so we have to use the relative URL constructor for KURL instead of the ParsedURLStringTag version. + PageGroup::pageGroup(pageGroup->identifier())->addUserStyleSheetToWorld(scriptWorld->coreWorld(), source, KURL(KURL(), url), toStringVector(whitelist), toStringVector(blacklist), injectedFrames); +} + +void InjectedBundle::removeUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url) +{ + // url is not from KURL::string(), i.e. it has not already been parsed by KURL, so we have to use the relative URL constructor for KURL instead of the ParsedURLStringTag version. + PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptFromWorld(scriptWorld->coreWorld(), KURL(KURL(), url)); +} + +void InjectedBundle::removeUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url) +{ + // url is not from KURL::string(), i.e. it has not already been parsed by KURL, so we have to use the relative URL constructor for KURL instead of the ParsedURLStringTag version. + PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetFromWorld(scriptWorld->coreWorld(), KURL(KURL(), url)); +} + +void InjectedBundle::removeUserScripts(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld) +{ + PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptsFromWorld(scriptWorld->coreWorld()); +} + +void InjectedBundle::removeUserStyleSheets(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld) +{ + PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetsFromWorld(scriptWorld->coreWorld()); +} + +void InjectedBundle::removeAllUserContent(WebPageGroupProxy* pageGroup) +{ + PageGroup::pageGroup(pageGroup->identifier())->removeAllUserContent(); +} + +void InjectedBundle::garbageCollectJavaScriptObjects() +{ + gcController().garbageCollectNow(); +} + +void InjectedBundle::garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(bool waitUntilDone) +{ + gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); +} + +size_t InjectedBundle::javaScriptObjectsCount() +{ + JSLock lock(SilenceAssertionsOnly); + return JSDOMWindow::commonJSGlobalData()->heap.objectCount(); +} + +void InjectedBundle::reportException(JSContextRef context, JSValueRef exception) +{ + if (!context || !exception) + return; + + JSLock lock(JSC::SilenceAssertionsOnly); + JSC::ExecState* execState = toJS(context); + + // Make sure the context has a DOMWindow global object, otherwise this context didn't originate from a Page. + if (!toJSDOMWindow(execState->lexicalGlobalObject())) + return; + + WebCore::reportException(execState, toJS(execState, exception)); +} + +void InjectedBundle::didCreatePage(WebPage* page) +{ + m_client.didCreatePage(this, page); +} + +void InjectedBundle::willDestroyPage(WebPage* page) +{ + m_client.willDestroyPage(this, page); +} + +void InjectedBundle::didInitializePageGroup(WebPageGroupProxy* pageGroup) +{ + m_client.didInitializePageGroup(this, pageGroup); +} + +void InjectedBundle::didReceiveMessage(const String& messageName, APIObject* messageBody) +{ + m_client.didReceiveMessage(this, messageName, messageBody); +} + +void InjectedBundle::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<InjectedBundleMessage::Kind>()) { + case InjectedBundleMessage::PostMessage: { + String messageName; + RefPtr<APIObject> messageBody; + InjectedBundleUserMessageDecoder messageDecoder(messageBody); + if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder))) + return; + + didReceiveMessage(messageName, messageBody.get()); + return; + } + } + + ASSERT_NOT_REACHED(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h new file mode 100644 index 0000000..cf844c9 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -0,0 +1,128 @@ +/* + * 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 InjectedBundle_h +#define InjectedBundle_h + +#include "APIObject.h" +#include "InjectedBundleClient.h" +#include "SandboxExtension.h" +#include "WKBundle.h" +#include <WebCore/UserContentTypes.h> +#include <WebCore/UserScriptTypes.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +#if PLATFORM(QT) +#include <QLibrary> +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebKit { + +#if PLATFORM(MAC) +typedef CFBundleRef PlatformBundle; +#elif PLATFORM(WIN) +typedef HMODULE PlatformBundle; +#elif PLATFORM(QT) +typedef QLibrary PlatformBundle; +#elif PLATFORM(GTK) +typedef void* PlatformBundle; +#endif + +class ImmutableArray; +class InjectedBundleScriptWorld; +class WebPage; +class WebPageGroupProxy; + +class InjectedBundle : public APIObject { +public: + static const Type APIType = TypeBundle; + + static PassRefPtr<InjectedBundle> create(const String& path) + { + return adoptRef(new InjectedBundle(path)); + } + ~InjectedBundle(); + + bool load(APIObject* initializationUserData); + void setSandboxExtension(PassRefPtr<SandboxExtension> sandboxExtension) { m_sandboxExtension = sandboxExtension; } + + // API + void initializeClient(WKBundleClient*); + void postMessage(const String&, APIObject*); + void postSynchronousMessage(const String&, APIObject*, RefPtr<APIObject>& returnData); + + // TestRunner only SPI + void setShouldTrackVisitedLinks(bool); + void removeAllVisitedLinks(); + void activateMacFontAscentHack(); + void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled); + + // UserContent API + void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames); + void addUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames); + void removeUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url); + void removeUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url); + void removeUserScripts(WebPageGroupProxy*, InjectedBundleScriptWorld*); + void removeUserStyleSheets(WebPageGroupProxy*, InjectedBundleScriptWorld*); + void removeAllUserContent(WebPageGroupProxy*); + + // Garbage collection API + void garbageCollectJavaScriptObjects(); + void garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(bool waitUntilDone); + size_t javaScriptObjectsCount(); + + // Callback hooks + void didCreatePage(WebPage*); + void willDestroyPage(WebPage*); + void didInitializePageGroup(WebPageGroupProxy*); + void didReceiveMessage(const String&, APIObject*); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + static void reportException(JSContextRef, JSValueRef exception); + +private: + InjectedBundle(const String&); + + virtual Type type() const { return APIType; } + + String m_path; + PlatformBundle m_platformBundle; // This is leaked right now, since we never unload the bundle/module. + + RefPtr<SandboxExtension> m_sandboxExtension; + + InjectedBundleClient m_client; +}; + +} // namespace WebKit + +#endif // InjectedBundle_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp new file mode 100644 index 0000000..9f50942 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleBackForwardList.h" + +#include "InjectedBundleBackForwardListItem.h" +#include "WebBackForwardListProxy.h" +#include "WebPage.h" +#include <WebCore/BackForwardController.h> +#include <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<InjectedBundleBackForwardListItem> InjectedBundleBackForwardList::itemAtIndex(int index) const +{ + if (!m_page) + return 0; + Page* page = m_page->corePage(); + if (!page) + return 0; + return InjectedBundleBackForwardListItem::create(page->backForward()->itemAtIndex(index)); +} + +int InjectedBundleBackForwardList::backListCount() const +{ + if (!m_page) + return 0; + Page* page = m_page->corePage(); + if (!page) + return 0; + return page->backForward()->backCount(); +} + +int InjectedBundleBackForwardList::forwardListCount() const +{ + if (!m_page) + return 0; + Page* page = m_page->corePage(); + if (!page) + return 0; + return page->backForward()->forwardCount(); +} + +void InjectedBundleBackForwardList::clear() +{ + if (!m_page) + return; + Page* page = m_page->corePage(); + if (!page) + return; + static_cast<WebBackForwardListProxy*>(page->backForward()->client())->clear(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h new file mode 100644 index 0000000..952bdb6 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h @@ -0,0 +1,65 @@ +/* + * 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 InjectedBundleBackForwardList_h +#define InjectedBundleBackForwardList_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebPage; + +class InjectedBundleBackForwardListItem; + +class InjectedBundleBackForwardList : public APIObject { +public: + static const Type APIType = TypeBundleBackForwardList; + + static PassRefPtr<InjectedBundleBackForwardList> create(WebPage* page) + { + return adoptRef(new InjectedBundleBackForwardList(page)); + } + + void detach() { m_page = 0; } + + void clear(); + + PassRefPtr<InjectedBundleBackForwardListItem> itemAtIndex(int) const; + int backListCount() const; + int forwardListCount() const; + +private: + InjectedBundleBackForwardList(WebPage* page) : m_page(page) { } + + virtual Type type() const { return APIType; } + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // InjectedBundleBackForwardList_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp new file mode 100644 index 0000000..222dfa3 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleBackForwardListItem.h" + +#include "ImmutableArray.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<ImmutableArray> InjectedBundleBackForwardListItem::children() const +{ + const HistoryItemVector& children = m_item->children(); + size_t size = children.size(); + Vector<RefPtr<APIObject> > vector(size); + for (size_t i = 0; i < size; ++i) + vector[i] = InjectedBundleBackForwardListItem::create(children[i]); + return ImmutableArray::adopt(vector); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h new file mode 100644 index 0000000..6cd9ec6 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h @@ -0,0 +1,69 @@ +/* + * 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 InjectedBundleBackForwardListItem_h +#define InjectedBundleBackForwardListItem_h + +#include "APIObject.h" +#include <WebCore/HistoryItem.h> + +namespace WebKit { + +class ImmutableArray; +class WebPageProxy; + +class InjectedBundleBackForwardListItem : public APIObject { +public: + static const Type APIType = TypeBundleBackForwardListItem; + + static PassRefPtr<InjectedBundleBackForwardListItem> create(PassRefPtr<WebCore::HistoryItem> item) + { + if (!item) + return 0; + return adoptRef(new InjectedBundleBackForwardListItem(item)); + } + + WebCore::HistoryItem* item() const { return m_item.get(); } + + const String& originalURL() const { return m_item->originalURLString(); } + const String& url() const { return m_item->urlString(); } + const String& title() const { return m_item->title(); } + + const String& target() const { return m_item->target(); } + bool isTargetItem() const { return m_item->isTargetItem(); } + + PassRefPtr<ImmutableArray> children() const; + +private: + InjectedBundleBackForwardListItem(PassRefPtr<WebCore::HistoryItem> item) : m_item(item) { } + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::HistoryItem> m_item; +}; + +} // namespace WebKit + +#endif // InjectedBundleBackForwardListItem_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp new file mode 100644 index 0000000..de572d0 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleClient.h" + +#include "WKBundleAPICast.h" + +namespace WebKit { + +void InjectedBundleClient::didCreatePage(InjectedBundle* bundle, WebPage* page) +{ + if (!m_client.didCreatePage) + return; + + m_client.didCreatePage(toAPI(bundle), toAPI(page), m_client.clientInfo); +} + +void InjectedBundleClient::willDestroyPage(InjectedBundle* bundle, WebPage* page) +{ + if (!m_client.willDestroyPage) + return; + + m_client.willDestroyPage(toAPI(bundle), toAPI(page), m_client.clientInfo); +} + +void InjectedBundleClient::didInitializePageGroup(InjectedBundle* bundle, WebPageGroupProxy* pageGroup) +{ + if (!m_client.didInitializePageGroup) + return; + + m_client.didInitializePageGroup(toAPI(bundle), toAPI(pageGroup), m_client.clientInfo); +} + +void InjectedBundleClient::didReceiveMessage(InjectedBundle* bundle, const String& messageName, APIObject* messageBody) +{ + if (!m_client.didReceiveMessage) + return; + + m_client.didReceiveMessage(toAPI(bundle), toAPI(messageName.impl()), toAPI(messageBody), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h new file mode 100644 index 0000000..36bb60a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h @@ -0,0 +1,51 @@ +/* + * 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 InjectedBundleClient_h +#define InjectedBundleClient_h + +#include "APIClient.h" +#include "WKBundle.h" +#include <wtf/Forward.h> + +namespace WebKit { + +class APIObject; +class InjectedBundle; +class WebPage; +class WebPageGroupProxy; + +class InjectedBundleClient : public APIClient<WKBundleClient> { +public: + void didCreatePage(InjectedBundle*, WebPage*); + void willDestroyPage(InjectedBundle*, WebPage*); + void didInitializePageGroup(InjectedBundle*, WebPageGroupProxy*); + void didReceiveMessage(InjectedBundle*, const String& messageName, APIObject* messageBody); +}; + +} // namespace WebKit + + +#endif // InjectedBundleClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp new file mode 100644 index 0000000..ab59226 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleHitTestResult.h" + +#include "InjectedBundleNodeHandle.h" +#include "WebFrame.h" +#include "WebFrameLoaderClient.h" +#include <WebCore/Document.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameLoader.h> +#include <WebCore/KURL.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const WebCore::HitTestResult& hitTestResult) +{ + return adoptRef(new InjectedBundleHitTestResult(hitTestResult)); +} + +PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() const +{ + return InjectedBundleNodeHandle::getOrCreate(m_hitTestResult.innerNonSharedNode()); +} + +WebFrame* InjectedBundleHitTestResult::frame() const +{ + Node* node = m_hitTestResult.innerNonSharedNode(); + if (!node) + return 0; + + Document* document = node->document(); + if (!document) + return 0; + + Frame* frame = document->frame(); + if (!frame) + return 0; + + return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); +} + +WebFrame* InjectedBundleHitTestResult::targetFrame() const +{ + Frame* frame = m_hitTestResult.targetFrame(); + if (!frame) + return 0; + + return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); +} + +String InjectedBundleHitTestResult::absoluteImageURL() const +{ + return m_hitTestResult.absoluteImageURL().string(); +} + +String InjectedBundleHitTestResult::absoluteLinkURL() const +{ + return m_hitTestResult.absoluteLinkURL().string(); +} + +String InjectedBundleHitTestResult::absoluteMediaURL() const +{ + return m_hitTestResult.absoluteMediaURL().string(); +} + +String InjectedBundleHitTestResult::linkLabel() const +{ + return m_hitTestResult.textContent(); +} + +String InjectedBundleHitTestResult::linkTitle() const +{ + return m_hitTestResult.titleDisplayString(); +} + +WebCore::IntRect InjectedBundleHitTestResult::imageRect() const +{ + return m_hitTestResult.imageRect(); +} + +bool InjectedBundleHitTestResult::isSelected() const +{ + return m_hitTestResult.isSelected(); +} + +} // WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h new file mode 100644 index 0000000..b09da1c --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h @@ -0,0 +1,76 @@ +/* + * 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 InjectedBundleHitTestResult_h +#define InjectedBundleHitTestResult_h + +#include "APIObject.h" +#include <WebCore/HitTestResult.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class InjectedBundleNodeHandle; +class WebFrame; + +class InjectedBundleHitTestResult : public APIObject { +public: + static const Type APIType = TypeBundleHitTestResult; + + static PassRefPtr<InjectedBundleHitTestResult> create(const WebCore::HitTestResult&); + + const WebCore::HitTestResult& coreHitTestResult() const { return m_hitTestResult; } + + PassRefPtr<InjectedBundleNodeHandle> nodeHandle() const; + WebFrame* frame() const; + WebFrame* targetFrame() const; + + String absoluteImageURL() const; + String absoluteLinkURL() const; + String absoluteMediaURL() const; + + String linkLabel() const; + String linkTitle() const; + + WebCore::IntRect imageRect() const; + + bool isSelected() const; + +private: + explicit InjectedBundleHitTestResult(const WebCore::HitTestResult& hitTestResult) + : m_hitTestResult(hitTestResult) + { + } + + virtual Type type() const { return APIType; } + + WebCore::HitTestResult m_hitTestResult; +}; + +} // namespace WebKit + +#endif // InjectedBundleHitTestResult_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp new file mode 100644 index 0000000..a2d16cb --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePageContextMenuClient.h" + +#include "ImmutableArray.h" +#include "InjectedBundleHitTestResult.h" +#include "Logging.h" +#include "MutableArray.h" +#include "WebContextMenuItem.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include <WebCore/ContextMenu.h> + +using namespace WebCore; + +namespace WebKit { + +bool InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems(WebPage* page, InjectedBundleHitTestResult* hitTestResult, const Vector<WebContextMenuItemData>& defaultMenu, Vector<WebContextMenuItemData>& newMenu, RefPtr<APIObject>& userData) +{ + if (!m_client.getContextMenuFromDefaultMenu) + return false; + + RefPtr<MutableArray> defaultMenuArray = MutableArray::create(); + defaultMenuArray->reserveCapacity(defaultMenu.size()); + for (unsigned i = 0; i < defaultMenu.size(); ++i) + defaultMenuArray->append(WebContextMenuItem::create(defaultMenu[i]).get()); + + WKArrayRef newMenuWK = 0; + WKTypeRef userDataToPass = 0; + m_client.getContextMenuFromDefaultMenu(toAPI(page), toAPI(hitTestResult), toAPI(defaultMenuArray.get()), &newMenuWK, &userDataToPass, m_client.clientInfo); + RefPtr<ImmutableArray> array = adoptRef(toImpl(newMenuWK)); + userData = adoptRef(toImpl(userDataToPass)); + + newMenu.clear(); + + if (!array || !array->size()) + return true; + + size_t size = array->size(); + for (size_t i = 0; i < size; ++i) { + WebContextMenuItem* item = array->at<WebContextMenuItem>(i); + if (!item) { + LOG(ContextMenu, "New menu entry at index %i is not a WebContextMenuItem", (int)i); + continue; + } + + newMenu.append(*item->data()); + } + + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h new file mode 100644 index 0000000..1d17a8a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h @@ -0,0 +1,51 @@ +/* + * 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 InjectedBundlePageContextMenuClient_h +#define InjectedBundlePageContextMenuClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include <wtf/Vector.h> + +namespace WebCore { + class ContextMenu; +} + +namespace WebKit { + +class APIObject; +class InjectedBundleHitTestResult; +class WebContextMenuItemData; +class WebPage; + +class InjectedBundlePageContextMenuClient : public APIClient<WKBundlePageContextMenuClient> { +public: + bool getCustomMenuFromDefaultItems(WebPage*, InjectedBundleHitTestResult*, const Vector<WebContextMenuItemData>& defaultMenu, Vector<WebContextMenuItemData>& newMenu, RefPtr<APIObject>& userData); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageEditorClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp new file mode 100644 index 0000000..40996c2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePageEditorClient.h" + +#include "InjectedBundleNodeHandle.h" +#include "InjectedBundleRangeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range) +{ + if (m_client.shouldBeginEditing) { + RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); + return m_client.shouldBeginEditing(toAPI(page), toAPI(rangeHandle.get()), m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage* page, Range* range) +{ + if (m_client.shouldEndEditing) { + RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); + return m_client.shouldEndEditing(toAPI(page), toAPI(rangeHandle.get()), m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage* page, Node* node, Range* rangeToReplace, EditorInsertAction action) +{ + if (m_client.shouldInsertNode) { + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(node); + RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace); + return m_client.shouldInsertNode(toAPI(page), toAPI(nodeHandle.get()), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldInsertText(WebPage* page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action) +{ + if (m_client.shouldInsertText) { + RefPtr<InjectedBundleRangeHandle> rangeToReplaceHandle = InjectedBundleRangeHandle::getOrCreate(rangeToReplace); + return m_client.shouldInsertText(toAPI(page), toAPI(text), toAPI(rangeToReplaceHandle.get()), toAPI(action), m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage* page, Range* range) +{ + if (m_client.shouldDeleteRange) { + RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); + return m_client.shouldDeleteRange(toAPI(page), toAPI(rangeHandle.get()), m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage* page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) +{ + if (m_client.shouldChangeSelectedRange) { + RefPtr<InjectedBundleRangeHandle> fromRangeHandle = InjectedBundleRangeHandle::getOrCreate(fromRange); + RefPtr<InjectedBundleRangeHandle> toRangeHandle = InjectedBundleRangeHandle::getOrCreate(toRange); + return m_client.shouldChangeSelectedRange(toAPI(page), toAPI(fromRangeHandle.get()), toAPI(toRangeHandle.get()), toAPI(affinity), stillSelecting, m_client.clientInfo); + } + return true; +} + +bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage* page, CSSStyleDeclaration* style, Range* range) +{ + if (m_client.shouldApplyStyle) { + RefPtr<InjectedBundleRangeHandle> rangeHandle = InjectedBundleRangeHandle::getOrCreate(range); + return m_client.shouldApplyStyle(toAPI(page), toAPI(style), toAPI(rangeHandle.get()), m_client.clientInfo); + } + return true; +} + +void InjectedBundlePageEditorClient::didBeginEditing(WebPage* page, StringImpl* notificationName) +{ + if (m_client.didBeginEditing) + m_client.didBeginEditing(toAPI(page), toAPI(notificationName), m_client.clientInfo); +} + +void InjectedBundlePageEditorClient::didEndEditing(WebPage* page, StringImpl* notificationName) +{ + if (m_client.didEndEditing) + m_client.didEndEditing(toAPI(page), toAPI(notificationName), m_client.clientInfo); +} + +void InjectedBundlePageEditorClient::didChange(WebPage* page, StringImpl* notificationName) +{ + if (m_client.didChange) + m_client.didChange(toAPI(page), toAPI(notificationName), m_client.clientInfo); +} + +void InjectedBundlePageEditorClient::didChangeSelection(WebPage* page, StringImpl* notificationName) +{ + if (m_client.didChangeSelection) + m_client.didChangeSelection(toAPI(page), toAPI(notificationName), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h new file mode 100644 index 0000000..c1a5aab --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h @@ -0,0 +1,63 @@ +/* + * 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 InjectedBundlePageEditorClient_h +#define InjectedBundlePageEditorClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include <WebCore/EditorInsertAction.h> +#include <WebCore/TextAffinity.h> +#include <wtf/Forward.h> + +namespace WebCore { + class CSSStyleDeclaration; + class Node; + class Range; +} + +namespace WebKit { + +class WebFrame; +class WebPage; + +class InjectedBundlePageEditorClient : public APIClient<WKBundlePageEditorClient> { +public: + bool shouldBeginEditing(WebPage*, WebCore::Range*); + bool shouldEndEditing(WebPage*, WebCore::Range*); + bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction); + bool shouldInsertText(WebPage*, StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction); + bool shouldDeleteRange(WebPage*, WebCore::Range*); + bool shouldChangeSelectedRange(WebPage*, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting); + bool shouldApplyStyle(WebPage*, WebCore::CSSStyleDeclaration*, WebCore::Range*); + void didBeginEditing(WebPage*, StringImpl* notificationName); + void didEndEditing(WebPage*, StringImpl* notificationName); + void didChange(WebPage*, StringImpl* notificationName); + void didChangeSelection(WebPage*, StringImpl* notificationName); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageEditorClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp new file mode 100644 index 0000000..4d210f2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePageFormClient.h" + +#include "ImmutableDictionary.h" +#include "InjectedBundleNodeHandle.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include <WebCore/HTMLFormElement.h> +#include <WebCore/HTMLInputElement.h> +#include <WebCore/HTMLTextAreaElement.h> + +using namespace WebCore; + +namespace WebKit { + +void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame) +{ + if (!m_client.textFieldDidBeginEditing) + return; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement); + m_client.textFieldDidBeginEditing(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageFormClient::textFieldDidEndEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame) +{ + if (!m_client.textFieldDidEndEditing) + return; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement); + m_client.textFieldDidEndEditing(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageFormClient::textDidChangeInTextField(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame) +{ + if (!m_client.textDidChangeInTextField) + return; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement); + m_client.textDidChangeInTextField(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageFormClient::textDidChangeInTextArea(WebPage* page, HTMLTextAreaElement* textAreaElement, WebFrame* frame) +{ + if (!m_client.textDidChangeInTextArea) + return; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(textAreaElement); + m_client.textDidChangeInTextArea(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), m_client.clientInfo); +} + +bool InjectedBundlePageFormClient::shouldPerformActionInTextField(WebPage* page, HTMLInputElement* inputElement, WKInputFieldActionType actionType, WebFrame* frame) +{ + if (!m_client.shouldPerformActionInTextField) + return false; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement); + return m_client.shouldPerformActionInTextField(toAPI(page), toAPI(nodeHandle.get()), actionType, toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageFormClient::willSubmitForm(WebPage* page, HTMLFormElement* formElement, WebFrame* frame, WebFrame* sourceFrame, const Vector<std::pair<String, String> >& values, RefPtr<APIObject>& userData) +{ + if (!m_client.willSubmitForm) + return; + + RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(formElement); + + ImmutableDictionary::MapType map; + for (size_t i = 0; i < values.size(); ++i) + map.set(values[i].first, WebString::create(values[i].second)); + RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map); + + WKTypeRef userDataToPass = 0; + m_client.willSubmitForm(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), toAPI(sourceFrame), toAPI(textFieldsMap.get()), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h new file mode 100644 index 0000000..23f4cb2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h @@ -0,0 +1,60 @@ +/* + * 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 InjectedBundlePageFormClient_h +#define InjectedBundlePageFormClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include <algorithm> +#include <wtf/Forward.h> +#include <wtf/Vector.h> + +namespace WebCore { + class HTMLFormElement; + class HTMLInputElement; + class HTMLTextAreaElement; +} + +namespace WebKit { + +class APIObject; +class ImmutableDictionary; +class WebFrame; +class WebPage; + +class InjectedBundlePageFormClient : public APIClient<WKBundlePageFormClient> { +public: + void textFieldDidBeginEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*); + void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*); + void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*); + void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*); + bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, WKInputFieldActionType, WebFrame*); + void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String> >&, RefPtr<APIObject>& userData); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageFormClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp new file mode 100644 index 0000000..23341c5 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePageLoaderClient.h" + +#include "InjectedBundleScriptWorld.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WebError.h" +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +void InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didStartProvisionalLoadForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didStartProvisionalLoadForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPage* page, WebFrame* frame, const ResourceError& error, RefPtr<APIObject>& userData) +{ + if (!m_client.didFailProvisionalLoadWithErrorForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didCommitLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didCommitLoadForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didCommitLoadForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFinishDocumentLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didFinishDocumentLoadForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFinishDocumentLoadForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFinishLoadForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didFinishLoadForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFinishLoadForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFailLoadWithErrorForFrame(WebPage* page, WebFrame* frame, const ResourceError& error, RefPtr<APIObject>& userData) +{ + if (!m_client.didFailLoadWithErrorForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFailLoadWithErrorForFrame(toAPI(page), toAPI(frame), toAPI(error), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame(WebPage* page, WebFrame* frame, SameDocumentNavigationType type, RefPtr<APIObject>& userData) +{ + if (!m_client.didSameDocumentNavigationForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didReceiveTitleForFrame(WebPage* page, const String& title, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didReceiveTitleForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didReceiveTitleForFrame(toAPI(page), toAPI(title.impl()), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didFirstLayoutForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy(WebPage* page , WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didRemoveFrameFromHierarchy) + return; + + WKTypeRef userDataToPass = 0; + m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didDisplayInsecureContentForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData) +{ + if (!m_client.didRunInsecureContentForFrame) + return; + + WKTypeRef userDataToPass = 0; + m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo); + 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) + return; + + m_client.didClearWindowObjectForFrame(toAPI(page), toAPI(frame), toAPI(InjectedBundleScriptWorld::getOrCreate(world).get()), m_client.clientInfo); +} + +void InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame(WebPage* page, WebFrame* frame) +{ + if (!m_client.didCancelClientRedirectForFrame) + return; + + m_client.didCancelClientRedirectForFrame(toAPI(page), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame(WebPage* page, WebFrame* frame, const String& url, double delay, double date) +{ + if (!m_client.willPerformClientRedirectForFrame) + return; + + m_client.willPerformClientRedirectForFrame(toAPI(page), toAPI(frame), toURLRef(url.impl()), delay, date, m_client.clientInfo); +} + +void InjectedBundlePageLoaderClient::didHandleOnloadEventsForFrame(WebPage* page, WebFrame* frame) +{ + if (!m_client.didHandleOnloadEventsForFrame) + return; + + m_client.didHandleOnloadEventsForFrame(toAPI(page), toAPI(frame), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h new file mode 100644 index 0000000..e983b48 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h @@ -0,0 +1,73 @@ +/* + * 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 InjectedBundlePageLoaderClient_h +#define InjectedBundlePageLoaderClient_h + +#include "APIClient.h" +#include "SameDocumentNavigationType.h" +#include "WKBundlePage.h" +#include <JavaScriptCore/JSBase.h> +#include <wtf/Forward.h> + +namespace WebCore { +class DOMWrapperWorld; +class ResourceError; +} + +namespace WebKit { + +class APIObject; +class WebPage; +class WebFrame; + +class InjectedBundlePageLoaderClient : public APIClient<WKBundlePageLoaderClient> { +public: + void didStartProvisionalLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didReceiveServerRedirectForProvisionalLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didFailProvisionalLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData); + void didCommitLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didFinishDocumentLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didFinishLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didFailLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData); + void didSameDocumentNavigationForFrame(WebPage*, WebFrame*, SameDocumentNavigationType, RefPtr<APIObject>& userData); + void didReceiveTitleForFrame(WebPage*, const String&, WebFrame*, RefPtr<APIObject>& userData); + void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + void didRemoveFrameFromHierarchy(WebPage*, WebFrame*, RefPtr<APIObject>& userData); + 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); + void didHandleOnloadEventsForFrame(WebPage*, WebFrame*); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageLoaderClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp new file mode 100644 index 0000000..56e4434 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundlePageUIClient.h" + +#include "InjectedBundleHitTestResult.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +void InjectedBundlePageUIClient::willAddMessageToConsole(WebPage* page, const String& message, int32_t lineNumber) +{ + if (m_client.willAddMessageToConsole) + m_client.willAddMessageToConsole(toAPI(page), toAPI(message.impl()), lineNumber, m_client.clientInfo); +} + +void InjectedBundlePageUIClient::willSetStatusbarText(WebPage* page, const String& statusbarText) +{ + if (m_client.willSetStatusbarText) + m_client.willSetStatusbarText(toAPI(page), toAPI(statusbarText.impl()), m_client.clientInfo); +} + +void InjectedBundlePageUIClient::willRunJavaScriptAlert(WebPage* page, const String& alertText, WebFrame* frame) +{ + if (m_client.willRunJavaScriptAlert) + m_client.willRunJavaScriptAlert(toAPI(page), toAPI(alertText.impl()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageUIClient::willRunJavaScriptConfirm(WebPage* page, const String& message, WebFrame* frame) +{ + if (m_client.willRunJavaScriptConfirm) + m_client.willRunJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageUIClient::willRunJavaScriptPrompt(WebPage* page, const String& message, const String& defaultValue, WebFrame* frame) +{ + if (m_client.willRunJavaScriptPrompt) + m_client.willRunJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.clientInfo); +} + +void InjectedBundlePageUIClient::mouseDidMoveOverElement(WebPage* page, const HitTestResult& coreHitTestResult, WebEvent::Modifiers modifiers, RefPtr<APIObject>& userData) +{ + if (!m_client.mouseDidMoveOverElement) + return; + + RefPtr<InjectedBundleHitTestResult> hitTestResult = InjectedBundleHitTestResult::create(coreHitTestResult); + + WKTypeRef userDataToPass = 0; + m_client.mouseDidMoveOverElement(toAPI(page), toAPI(hitTestResult.get()), toAPI(modifiers), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} + +void InjectedBundlePageUIClient::pageDidScroll(WebPage* page) +{ + if (m_client.pageDidScroll) + m_client.pageDidScroll(toAPI(page), m_client.clientInfo); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h new file mode 100644 index 0000000..93c19e9 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h @@ -0,0 +1,57 @@ +/* + * 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 InjectedBundlePageUIClient_h +#define InjectedBundlePageUIClient_h + +#include "APIClient.h" +#include "WKBundlePage.h" +#include "WebEvent.h" +#include <wtf/Forward.h> + +namespace WebCore { + class HitTestResult; +} + +namespace WebKit { + +class APIObject; +class WebFrame; +class WebPage; + +class InjectedBundlePageUIClient : public APIClient<WKBundlePageUIClient> { +public: + void willAddMessageToConsole(WebPage*, const String& message, int32_t lineNumber); + void willSetStatusbarText(WebPage*, const String&); + void willRunJavaScriptAlert(WebPage*, const String&, WebFrame*); + void willRunJavaScriptConfirm(WebPage*, const String&, WebFrame*); + void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*); + void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<APIObject>& userData); + void pageDidScroll(WebPage*); +}; + +} // namespace WebKit + +#endif // InjectedBundlePageUIClient_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp new file mode 100644 index 0000000..d764cf2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundleScriptWorld.h" + +#include <WebCore/DOMWrapperWorld.h> +#include <WebCore/ScriptController.h> +#include <wtf/HashMap.h> + +using namespace WebCore; + +namespace WebKit { + +typedef HashMap<DOMWrapperWorld*, InjectedBundleScriptWorld*> WorldMap; + +static WorldMap& allWorlds() +{ + DEFINE_STATIC_LOCAL(WorldMap, map, ()); + return map; +} + +PassRefPtr<InjectedBundleScriptWorld> InjectedBundleScriptWorld::create() +{ + return adoptRef(new InjectedBundleScriptWorld(ScriptController::createWorld())); +} + +PassRefPtr<InjectedBundleScriptWorld> InjectedBundleScriptWorld::getOrCreate(DOMWrapperWorld* world) +{ + if (world == mainThreadNormalWorld()) + return normalWorld(); + + if (InjectedBundleScriptWorld* existingWorld = allWorlds().get(world)) + return existingWorld; + + return adoptRef(new InjectedBundleScriptWorld(world)); +} + +InjectedBundleScriptWorld* InjectedBundleScriptWorld::normalWorld() +{ + static InjectedBundleScriptWorld* world = adoptRef(new InjectedBundleScriptWorld(mainThreadNormalWorld())).leakRef(); + return world; +} + +InjectedBundleScriptWorld::InjectedBundleScriptWorld(PassRefPtr<DOMWrapperWorld> world) + : m_world(world) +{ + ASSERT(!allWorlds().contains(m_world.get())); + allWorlds().add(m_world.get(), this); +} + +InjectedBundleScriptWorld::~InjectedBundleScriptWorld() +{ + ASSERT(allWorlds().contains(m_world.get())); + allWorlds().remove(m_world.get()); +} + +DOMWrapperWorld* InjectedBundleScriptWorld::coreWorld() const +{ + return m_world.get(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h new file mode 100644 index 0000000..00dd14a --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h @@ -0,0 +1,61 @@ +/* + * 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 InjectedBundleScriptWorld_h +#define InjectedBundleScriptWorld_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class DOMWrapperWorld; +} + +namespace WebKit { + +class InjectedBundleScriptWorld : public APIObject { +public: + static const Type APIType = TypeBundleScriptWorld; + + static PassRefPtr<InjectedBundleScriptWorld> create(); + static PassRefPtr<InjectedBundleScriptWorld> getOrCreate(WebCore::DOMWrapperWorld*); + static InjectedBundleScriptWorld* normalWorld(); + + virtual ~InjectedBundleScriptWorld(); + + WebCore::DOMWrapperWorld* coreWorld() const; + +private: + InjectedBundleScriptWorld(PassRefPtr<WebCore::DOMWrapperWorld>); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::DOMWrapperWorld> m_world; +}; + +} // namespace WebKit + +#endif // InjectedBundleScriptWorld_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h new file mode 100644 index 0000000..49d6696 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h @@ -0,0 +1,141 @@ +/* + * 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 InjectedBundleUserMessageCoders_h +#define InjectedBundleUserMessageCoders_h + +#include "UserMessageCoders.h" +#include "WebFrame.h" +#include "WebPage.h" +#include "WebPageGroupData.h" +#include "WebPageGroupProxy.h" +#include "WebProcess.h" + +namespace WebKit { + +// Adds +// - BundlePage -> Page +// - BundleFrame -> Frame +// - BundlePageGroup -> PageGroup + +class InjectedBundleUserMessageEncoder : public UserMessageEncoder<InjectedBundleUserMessageEncoder> { +public: + typedef UserMessageEncoder<InjectedBundleUserMessageEncoder> Base; + + InjectedBundleUserMessageEncoder(APIObject* root) + : Base(root) + { + } + + void encode(CoreIPC::ArgumentEncoder* encoder) const + { + APIObject::Type type = APIObject::TypeNull; + if (baseEncode(encoder, type)) + return; + + switch (type) { + case APIObject::TypeBundlePage: { + WebPage* page = static_cast<WebPage*>(m_root); + encoder->encode(page->pageID()); + break; + } + case APIObject::TypeBundleFrame: { + WebFrame* frame = static_cast<WebFrame*>(m_root); + encoder->encode(frame->frameID()); + break; + } + case APIObject::TypeBundlePageGroup: { + WebPageGroupProxy* pageGroup = static_cast<WebPageGroupProxy*>(m_root); + encoder->encode(pageGroup->pageGroupID()); + break; + } + default: + ASSERT_NOT_REACHED(); + break; + } + } +}; + +// Adds +// - Page -> BundlePage +// - Frame -> BundleFrame +// - PageGroup -> BundlePageGroup + +class InjectedBundleUserMessageDecoder : public UserMessageDecoder<InjectedBundleUserMessageDecoder> { +public: + typedef UserMessageDecoder<InjectedBundleUserMessageDecoder> Base; + + InjectedBundleUserMessageDecoder(RefPtr<APIObject>& root) + : Base(root) + { + } + + InjectedBundleUserMessageDecoder(InjectedBundleUserMessageDecoder&, RefPtr<APIObject>& root) + : Base(root) + { + } + + static bool decode(CoreIPC::ArgumentDecoder* decoder, InjectedBundleUserMessageDecoder& coder) + { + APIObject::Type type = APIObject::TypeNull; + if (!Base::baseDecode(decoder, coder, type)) + return false; + + if (coder.m_root || type == APIObject::TypeNull) + return true; + + switch (type) { + case APIObject::TypePage: { + uint64_t pageID; + if (!decoder->decode(pageID)) + return false; + coder.m_root = WebProcess::shared().webPage(pageID); + break; + } + case APIObject::TypeFrame: { + uint64_t frameID; + if (!decoder->decode(frameID)) + return false; + coder.m_root = WebProcess::shared().webFrame(frameID); + break; + } + case APIObject::TypePageGroup: { + WebPageGroupData pageGroupData; + if (!decoder->decode(pageGroupData)) + return false; + coder.m_root = WebProcess::shared().webPageGroup(pageGroupData); + break; + } + default: + return false; + } + + return true; + } +}; + +} // namespace WebKit + +#endif // InjectedBundleUserMessageCoders_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp new file mode 100644 index 0000000..f992af2 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundle.h" + +#include "NotImplemented.h" +#include "WKBundleAPICast.h" +#include "WKBundleInitialize.h" + +using namespace WebCore; + +namespace WebKit { + +bool InjectedBundle::load(APIObject*) +{ + return false; +} + +void InjectedBundle::activateMacFontAscentHack() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp new file mode 100644 index 0000000..f278ea9 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundle.h" + +#include "WKBundleAPICast.h" +#include "WKBundleInitialize.h" +#include <wtf/RetainPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +bool InjectedBundle::load(APIObject* initializationUserData) +{ + if (m_sandboxExtension) { + if (!m_sandboxExtension->consume()) { + fprintf(stderr, "InjectedBundle::load failed - Could not consume bundle sandbox extension for [%s].\n", m_path.utf8().data()); + return false; + } + + m_sandboxExtension = 0; + } + + RetainPtr<CFStringRef> injectedBundlePathStr(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(m_path.characters()), m_path.length())); + if (!injectedBundlePathStr) { + fprintf(stderr, "InjectedBundle::load failed - Could not create the path string.\n"); + return false; + } + + RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(0, injectedBundlePathStr.get(), kCFURLPOSIXPathStyle, false)); + if (!bundleURL) { + fprintf(stderr, "InjectedBundle::load failed - Could not create the url from the path string.\n"); + return false; + } + + m_platformBundle = CFBundleCreate(0, bundleURL.get()); + if (!m_platformBundle) { + fprintf(stderr, "InjectedBundle::load failed - Could not create the bundle.\n"); + return false; + } + + if (!CFBundleLoadExecutable(m_platformBundle)) { + fprintf(stderr, "InjectedBundle::load failed - Could not load the executable from the bundle.\n"); + return false; + } + + WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(CFBundleGetFunctionPointerForName(m_platformBundle, CFSTR("WKBundleInitialize"))); + if (!initializeFunction) { + fprintf(stderr, "InjectedBundle::load failed - Could not find the initialize function in the bundle executable.\n"); + return false; + } + + initializeFunction(toAPI(this), toAPI(initializationUserData)); + return true; +} + +void InjectedBundle::activateMacFontAscentHack() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp new file mode 100644 index 0000000..9d397e8 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/qt/InjectedBundleQt.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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. + */ + +#include "InjectedBundle.h" + +#include "WKBundleAPICast.h" +#include "WKBundleInitialize.h" + +using namespace WebCore; + +namespace WebKit { + +bool InjectedBundle::load(APIObject* initializationUserData) +{ + m_platformBundle.setFileName(static_cast<QString>(m_path)); + if (!m_platformBundle.load()) { + qWarning("Error loading the injected bundle: %s", qPrintable(m_platformBundle.errorString())); + return false; + } + + WKBundleInitializeFunctionPtr initializeFunction = + reinterpret_cast<WKBundleInitializeFunctionPtr>(m_platformBundle.resolve("WKBundleInitialize")); + + if (!initializeFunction) { + qWarning("Error resolving WKBundleInitialize: %s", qPrintable(m_platformBundle.errorString())); + return false; + } + + initializeFunction(toAPI(this), toAPI(initializationUserData)); + return true; +} + +void InjectedBundle::activateMacFontAscentHack() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp new file mode 100644 index 0000000..3fd3333 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "InjectedBundle.h" + +#include "WKBundleAPICast.h" +#include "WKBundleInitialize.h" +#include <WebCore/SimpleFontData.h> + +#include <windows.h> +#include <winbase.h> +#include <shlobj.h> +#include <shlwapi.h> + +using namespace WebCore; + +namespace WebKit { + +// FIXME: This should try and use <WebCore/FileSystem.h>. + +static String pathGetFileName(const String& path) +{ + return String(::PathFindFileName(String(path).charactersWithNullTermination())); +} + +static String directoryName(const String& path) +{ + String fileName = pathGetFileName(path); + String dirName = String(path); + dirName.truncate(dirName.length() - pathGetFileName(path).length()); + return dirName; +} + +bool InjectedBundle::load(APIObject* initializationUserData) +{ + WCHAR currentPath[MAX_PATH]; + if (!::GetCurrentDirectoryW(MAX_PATH, currentPath)) + return false; + + String directorBundleResidesIn = directoryName(m_path); + if (!::SetCurrentDirectoryW(directorBundleResidesIn.charactersWithNullTermination())) + return false; + + m_platformBundle = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); + if (!m_platformBundle) + return false; + + // Reset the current directory. + if (!::SetCurrentDirectoryW(currentPath)) { + return false; + } + + WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(::GetProcAddress(m_platformBundle, "WKBundleInitialize")); + if (!initializeFunction) + return false; + + initializeFunction(toAPI(this), toAPI(initializationUserData)); + return true; +} + +void InjectedBundle::activateMacFontAscentHack() +{ + SimpleFontData::setShouldApplyMacAscentHack(true); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp new file mode 100644 index 0000000..c094505 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "JSNPMethod.h" + +#include "JSNPObject.h" +#include "NotImplemented.h" +#include <JavaScriptCore/Error.h> +#include <JavaScriptCore/FunctionPrototype.h> +#include <JavaScriptCore/JSGlobalObject.h> +#include <WebCore/JSHTMLElement.h> +#include <WebCore/JSPluginElementFunctions.h> + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +const ClassInfo JSNPMethod::s_info = { "NPMethod", &InternalFunction::info, 0, 0 }; + +JSNPMethod::JSNPMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, NPIdentifier npIdentifier) + : InternalFunction(&exec->globalData(), globalObject, createStructure(globalObject->functionPrototype()), name) + , m_npIdentifier(npIdentifier) +{ +} + +static EncodedJSValue JSC_HOST_CALL callMethod(ExecState* exec) +{ + JSNPMethod* jsNPMethod = static_cast<JSNPMethod*>(exec->callee()); + + JSValue thisValue = exec->hostThisValue(); + + // Check if we're calling a method on the plug-in script object. + if (thisValue.inherits(&JSHTMLElement::s_info)) { + JSHTMLElement* element = static_cast<JSHTMLElement*>(asObject(thisValue)); + + // Try to get the script object from the element + if (JSObject* scriptObject = pluginScriptObject(exec, element)) + thisValue = scriptObject; + } + + if (thisValue.inherits(&JSNPObject::s_info)) { + JSNPObject* jsNPObject = static_cast<JSNPObject*>(asObject(thisValue)); + + return JSValue::encode(jsNPObject->callMethod(exec, jsNPMethod->npIdentifier())); + } + + return throwVMTypeError(exec); +} + +CallType JSNPMethod::getCallData(CallData& callData) +{ + callData.native.function = callMethod; + return CallTypeHost; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h new file mode 100644 index 0000000..9a8578c --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.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 JSNPMethod_h +#define JSNPMethod_h + +#include <JavaScriptCore/InternalFunction.h> + +typedef void* NPIdentifier; + +namespace WebKit { + +// A JSObject that wraps an NPMethod. +class JSNPMethod : public JSC::InternalFunction { +public: + JSNPMethod(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier); + + static const JSC::ClassInfo s_info; + + NPIdentifier npIdentifier() const { return m_npIdentifier; } + +private: + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + + virtual JSC::CallType getCallData(JSC::CallData&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + + NPIdentifier m_npIdentifier; +}; + + +} // namespace WebKit + +#endif // JSNPMethod_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp new file mode 100644 index 0000000..d7d626f --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp @@ -0,0 +1,412 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "JSNPObject.h" + +#include "JSNPMethod.h" +#include "NPJSObject.h" +#include "NPRuntimeObjectMap.h" +#include "NPRuntimeUtilities.h" +#include <JavaScriptCore/Error.h> +#include <JavaScriptCore/JSGlobalObject.h> +#include <JavaScriptCore/JSLock.h> +#include <JavaScriptCore/ObjectPrototype.h> +#include <WebCore/IdentifierRep.h> +#include <wtf/text/WTFString.h> + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +static NPIdentifier npIdentifierFromIdentifier(const Identifier& identifier) +{ + return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().utf8().data())); +} + +const ClassInfo JSNPObject::s_info = { "NPObject", 0, 0, 0 }; + +JSNPObject::JSNPObject(JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject) + : JSObjectWithGlobalObject(globalObject, createStructure(globalObject->objectPrototype())) + , m_objectMap(objectMap) + , m_npObject(npObject) +{ + // We should never have an NPJSObject inside a JSNPObject. + ASSERT(!NPJSObject::isNPJSObject(m_npObject)); + + retainNPObject(m_npObject); +} + +JSNPObject::~JSNPObject() +{ + if (!m_npObject) + return; + + m_objectMap->jsNPObjectDestroyed(this); + releaseNPObject(m_npObject); +} + +void JSNPObject::invalidate() +{ + ASSERT(m_npObject); + + releaseNPObject(m_npObject); + m_npObject = 0; +} + +JSValue JSNPObject::callMethod(ExecState* exec, NPIdentifier methodName) +{ + if (!m_npObject) + return throwInvalidAccessError(exec); + + size_t argumentCount = exec->argumentCount(); + Vector<NPVariant, 8> arguments(argumentCount); + + // Convert all arguments to NPVariants. + for (size_t i = 0; i < argumentCount; ++i) + m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]); + + // Calling NPClass::invoke will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(m_objectMap); + + bool returnValue; + NPVariant result; + VOID_TO_NPVARIANT(result); + + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + returnValue = m_npObject->_class->invoke(m_npObject, methodName, arguments.data(), argumentCount, &result); + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + } + + // Release all arguments; + for (size_t i = 0; i < argumentCount; ++i) + releaseNPVariantValue(&arguments[i]); + + if (!returnValue) + throwError(exec, createError(exec, "Error calling method on NPObject.")); + + JSValue propertyValue = m_objectMap->convertNPVariantToJSValue(exec, globalObject(), result); + releaseNPVariantValue(&result); + return propertyValue; +} + +JSC::JSValue JSNPObject::callObject(JSC::ExecState* exec) +{ + if (!m_npObject) + return throwInvalidAccessError(exec); + + size_t argumentCount = exec->argumentCount(); + Vector<NPVariant, 8> arguments(argumentCount); + + // Convert all arguments to NPVariants. + for (size_t i = 0; i < argumentCount; ++i) + m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]); + + // Calling NPClass::invokeDefault will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(m_objectMap); + + bool returnValue; + NPVariant result; + VOID_TO_NPVARIANT(result); + + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + returnValue = m_npObject->_class->invokeDefault(m_npObject, arguments.data(), argumentCount, &result); + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + } + + // Release all arguments; + for (size_t i = 0; i < argumentCount; ++i) + releaseNPVariantValue(&arguments[i]); + + if (!returnValue) + throwError(exec, createError(exec, "Error calling method on NPObject.")); + + JSValue propertyValue = m_objectMap->convertNPVariantToJSValue(exec, globalObject(), result); + releaseNPVariantValue(&result); + return propertyValue; +} + +JSValue JSNPObject::callConstructor(ExecState* exec) +{ + if (!m_npObject) + return throwInvalidAccessError(exec); + + size_t argumentCount = exec->argumentCount(); + Vector<NPVariant, 8> arguments(argumentCount); + + // Convert all arguments to NPVariants. + for (size_t i = 0; i < argumentCount; ++i) + m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]); + + // Calling NPClass::construct will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(m_objectMap); + + bool returnValue; + NPVariant result; + VOID_TO_NPVARIANT(result); + + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), argumentCount, &result); + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + } + + if (!returnValue) + throwError(exec, createError(exec, "Error calling method on NPObject.")); + + JSValue value = m_objectMap->convertNPVariantToJSValue(exec, globalObject(), result); + releaseNPVariantValue(&result); + return value; +} + +static EncodedJSValue JSC_HOST_CALL callNPJSObject(ExecState* exec) +{ + JSObject* object = exec->callee(); + ASSERT(object->inherits(&JSNPObject::s_info)); + + return JSValue::encode(static_cast<JSNPObject*>(object)->callObject(exec)); +} + +JSC::CallType JSNPObject::getCallData(JSC::CallData& callData) +{ + if (!m_npObject || !m_npObject->_class->invokeDefault) + return CallTypeNone; + + callData.native.function = callNPJSObject; + return CallTypeHost; +} + +static EncodedJSValue JSC_HOST_CALL constructWithConstructor(ExecState* exec) +{ + JSObject* constructor = exec->callee(); + ASSERT(constructor->inherits(&JSNPObject::s_info)); + + return JSValue::encode(static_cast<JSNPObject*>(constructor)->callConstructor(exec)); +} + +ConstructType JSNPObject::getConstructData(ConstructData& constructData) +{ + if (!m_npObject || !m_npObject->_class->construct) + return ConstructTypeNone; + + constructData.native.function = constructWithConstructor; + return ConstructTypeHost; +} + +bool JSNPObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + if (!m_npObject) { + throwInvalidAccessError(exec); + return false; + } + + NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); + + // First, check if the NPObject has a property with this name. + if (m_npObject->_class->hasProperty && m_npObject->_class->hasProperty(m_npObject, npIdentifier)) { + slot.setCustom(this, propertyGetter); + return true; + } + + // Second, check if the NPObject has a method with this name. + if (m_npObject->_class->hasMethod && m_npObject->_class->hasMethod(m_npObject, npIdentifier)) { + slot.setCustom(this, methodGetter); + return true; + } + + return false; +} + +bool JSNPObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + if (!m_npObject) { + throwInvalidAccessError(exec); + return false; + } + + NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); + + // First, check if the NPObject has a property with this name. + if (m_npObject->_class->hasProperty && m_npObject->_class->hasProperty(m_npObject, npIdentifier)) { + PropertySlot slot; + slot.setCustom(this, propertyGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete); + return true; + } + + // Second, check if the NPObject has a method with this name. + if (m_npObject->_class->hasMethod && m_npObject->_class->hasMethod(m_npObject, npIdentifier)) { + PropertySlot slot; + slot.setCustom(this, methodGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); + return true; + } + + return false; +} + +void JSNPObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&) +{ + if (!m_npObject) { + throwInvalidAccessError(exec); + return; + } + + NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); + + if (!m_npObject->_class->hasProperty || !m_npObject->_class->hasProperty(m_npObject, npIdentifier)) { + // FIXME: Should we throw an exception here? + return; + } + + if (!m_npObject->_class->setProperty) + return; + + NPVariant variant; + m_objectMap->convertJSValueToNPVariant(exec, value, variant); + + // Calling NPClass::setProperty will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(m_objectMap); + + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + m_npObject->_class->setProperty(m_npObject, npIdentifier, &variant); + + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + + // FIXME: Should we throw an exception if setProperty returns false? + } + + releaseNPVariantValue(&variant); +} + +void JSNPObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNameArray, EnumerationMode mode) +{ + if (!m_npObject) { + throwInvalidAccessError(exec); + return; + } + + if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(m_npObject->_class) || !m_npObject->_class->enumerate) + return; + + NPIdentifier* identifiers = 0; + uint32_t identifierCount = 0; + + // Calling NPClass::enumerate will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(m_objectMap); + + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + + // FIXME: Should we throw an exception if enumerate returns false? + if (!m_npObject->_class->enumerate(m_npObject, &identifiers, &identifierCount)) + return; + + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + } + + for (uint32_t i = 0; i < identifierCount; ++i) { + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifiers[i]); + + Identifier identifier; + if (identifierRep->isString()) { + const char* string = identifierRep->string(); + int length = strlen(string); + + identifier = Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl()); + } else + identifier = Identifier::from(exec, identifierRep->number()); + + propertyNameArray.add(identifier); + } + + npnMemFree(identifiers); +} + +JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName) +{ + JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase)); + + if (!thisObj->m_npObject) + return throwInvalidAccessError(exec); + + if (!thisObj->m_npObject->_class->getProperty) + return jsUndefined(); + + NPVariant result; + VOID_TO_NPVARIANT(result); + + // Calling NPClass::getProperty will call into plug-in code, and there's no telling what the plug-in can do. + // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until + // the call has finished. + NPRuntimeObjectMap::PluginProtector protector(thisObj->m_objectMap); + + bool returnValue; + { + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); + NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); + returnValue = thisObj->m_npObject->_class->getProperty(thisObj->m_npObject, npIdentifier, &result); + + NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); + } + + if (!returnValue) + return jsUndefined(); + + JSValue propertyValue = thisObj->m_objectMap->convertNPVariantToJSValue(exec, thisObj->globalObject(), result); + releaseNPVariantValue(&result); + return propertyValue; +} + +JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, const Identifier& methodName) +{ + JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase)); + + if (!thisObj->m_npObject) + return throwInvalidAccessError(exec); + + NPIdentifier npIdentifier = npIdentifierFromIdentifier(methodName); + return new (exec) JSNPMethod(exec, thisObj->globalObject(), methodName, npIdentifier); +} + +JSObject* JSNPObject::throwInvalidAccessError(ExecState* exec) +{ + return throwError(exec, createReferenceError(exec, "Trying to access object from destroyed plug-in.")); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h new file mode 100644 index 0000000..af1369a --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h @@ -0,0 +1,84 @@ +/* + * 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 JSNPObject_h +#define JSNPObject_h + +#include <JavaScriptCore/JSObjectWithGlobalObject.h> + +typedef void* NPIdentifier; +struct NPObject; + +namespace WebKit { + +class NPRuntimeObjectMap; + +// JSNPObject is a JSObject that wraps an NPObject. + +class JSNPObject : public JSC::JSObjectWithGlobalObject { +public: + JSNPObject(JSC::JSGlobalObject*, NPRuntimeObjectMap* objectMap, NPObject* npObject); + ~JSNPObject(); + + void invalidate(); + + JSC::JSValue callMethod(JSC::ExecState*, NPIdentifier methodName); + JSC::JSValue callObject(JSC::ExecState*); + JSC::JSValue callConstructor(JSC::ExecState*); + + static const JSC::ClassInfo s_info; + + NPObject* npObject() const { return m_npObject; } + +private: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSObject::StructureFlags; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } + + virtual JSC::CallType getCallData(JSC::CallData&); + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); + + virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties); + + static JSC::JSValue propertyGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + static JSC::JSValue methodGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + static JSC::JSObject* throwInvalidAccessError(JSC::ExecState*); + + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + + NPRuntimeObjectMap* m_objectMap; + NPObject* m_npObject; +}; + +} // namespace WebKit + +#endif // JSNPObject_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp new file mode 100644 index 0000000..45c1e6e --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp @@ -0,0 +1,383 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NPJSObject.h" + +#include "JSNPObject.h" +#include "NPRuntimeObjectMap.h" +#include "NPRuntimeUtilities.h" +#include "NotImplemented.h" +#include "PluginView.h" +#include <JavaScriptCore/JSLock.h> +#include <JavaScriptCore/JSObject.h> +#include <WebCore/Frame.h> +#include <WebCore/IdentifierRep.h> +#include <wtf/text/WTFString.h> + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +NPJSObject* NPJSObject::create(NPRuntimeObjectMap* objectMap, JSObject* jsObject) +{ + // We should never have a JSNPObject inside an NPJSObject. + ASSERT(!jsObject->inherits(&JSNPObject::s_info)); + + NPJSObject* npJSObject = toNPJSObject(createNPObject(0, npClass())); + npJSObject->initialize(objectMap, jsObject); + + return npJSObject; +} + +NPJSObject::NPJSObject() + : m_objectMap(0) +{ +} + +NPJSObject::~NPJSObject() +{ + m_objectMap->npJSObjectDestroyed(this); +} + +bool NPJSObject::isNPJSObject(NPObject* npObject) +{ + return npObject->_class == npClass(); +} + +void NPJSObject::initialize(NPRuntimeObjectMap* objectMap, JSObject* jsObject) +{ + ASSERT(!m_objectMap); + ASSERT(!m_jsObject); + + m_objectMap = objectMap; + m_jsObject = jsObject; +} + +static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* identifierRep) +{ + ASSERT(identifierRep->isString()); + + const char* string = identifierRep->string(); + int length = strlen(string); + + return Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl()); +} + +bool NPJSObject::hasMethod(NPIdentifier methodName) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName); + + if (!identifierRep->isString()) + return false; + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + JSValue value = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep)); + exec->clearException(); + + CallData callData; + return getCallData(value, callData) != CallTypeNone; +} + +bool NPJSObject::invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(methodName); + + if (!identifierRep->isString()) + return false; + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + JSValue function = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep)); + return invoke(exec, m_objectMap->globalObject(), function, arguments, argumentCount, result); +} + +bool NPJSObject::invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + JSValue function = m_jsObject; + return invoke(exec, m_objectMap->globalObject(), function, arguments, argumentCount, result); +} + +bool NPJSObject::hasProperty(NPIdentifier identifier) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier); + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + bool result; + if (identifierRep->isString()) + result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep)); + else + result = m_jsObject->hasProperty(exec, identifierRep->number()); + + exec->clearException(); + return result; +} + +bool NPJSObject::getProperty(NPIdentifier propertyName, NPVariant* result) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName); + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + JSValue jsResult; + if (identifierRep->isString()) + jsResult = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep)); + else + jsResult = m_jsObject->get(exec, identifierRep->number()); + + m_objectMap->convertJSValueToNPVariant(exec, jsResult, *result); + exec->clearException(); + return true; +} + +bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName); + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value); + if (identifierRep->isString()) { + PutPropertySlot slot; + m_jsObject->put(exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot); + } else + m_jsObject->put(exec, identifierRep->number(), jsValue); + exec->clearException(); + + return true; +} + +bool NPJSObject::removeProperty(NPIdentifier propertyName) +{ + IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName); + + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + if (identifierRep->isString()) { + Identifier identifier = identifierFromIdentifierRep(exec, identifierRep); + + if (!m_jsObject->hasProperty(exec, identifier)) { + exec->clearException(); + return false; + } + + m_jsObject->deleteProperty(exec, identifier); + } else { + if (!m_jsObject->hasProperty(exec, identifierRep->number())) { + exec->clearException(); + return false; + } + + m_jsObject->deleteProperty(exec, identifierRep->number()); + } + + exec->clearException(); + return true; +} + +bool NPJSObject::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount) +{ + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + PropertyNameArray propertyNames(exec); + m_jsObject->getPropertyNames(exec, propertyNames); + + NPIdentifier* nameIdentifiers = npnMemNewArray<NPIdentifier>(propertyNames.size()); + + for (size_t i = 0; i < propertyNames.size(); ++i) + nameIdentifiers[i] = static_cast<NPIdentifier>(IdentifierRep::get(propertyNames[i].ustring().utf8().data())); + + *identifiers = nameIdentifiers; + *identifierCount = propertyNames.size(); + + return true; +} + +bool NPJSObject::construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + ExecState* exec = m_objectMap->globalExec(); + if (!exec) + return false; + + JSLock lock(SilenceAssertionsOnly); + + ConstructData constructData; + ConstructType constructType = getConstructData(m_jsObject, constructData); + if (constructType == ConstructTypeNone) + return false; + + // Convert the passed in arguments. + MarkedArgumentBuffer argumentList; + for (uint32_t i = 0; i < argumentCount; ++i) + argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), arguments[i])); + + exec->globalData().timeoutChecker.start(); + JSValue value = JSC::construct(exec, m_jsObject, constructType, constructData, argumentList); + exec->globalData().timeoutChecker.stop(); + + // Convert and return the new object. + m_objectMap->convertJSValueToNPVariant(exec, value, *result); + exec->clearException(); + + return true; +} + +bool NPJSObject::invoke(ExecState* exec, JSGlobalObject* globalObject, JSValue function, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + CallData callData; + CallType callType = getCallData(function, callData); + if (callType == CallTypeNone) + return false; + + // Convert the passed in arguments. + MarkedArgumentBuffer argumentList; + for (uint32_t i = 0; i < argumentCount; ++i) + argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, globalObject, arguments[i])); + + exec->globalData().timeoutChecker.start(); + JSValue value = JSC::call(exec, function, callType, callData, m_jsObject, argumentList); + exec->globalData().timeoutChecker.stop(); + + // Convert and return the result of the function call. + m_objectMap->convertJSValueToNPVariant(exec, value, *result); + exec->clearException(); + + return true; +} + +NPClass* NPJSObject::npClass() +{ + static NPClass npClass = { + NP_CLASS_STRUCT_VERSION, + NP_Allocate, + NP_Deallocate, + 0, + NP_HasMethod, + NP_Invoke, + NP_InvokeDefault, + NP_HasProperty, + NP_GetProperty, + NP_SetProperty, + NP_RemoveProperty, + NP_Enumerate, + NP_Construct + }; + + return &npClass; +} + +NPObject* NPJSObject::NP_Allocate(NPP npp, NPClass*) +{ + ASSERT_UNUSED(npp, !npp); + + return new NPJSObject; +} + +void NPJSObject::NP_Deallocate(NPObject* npObject) +{ + NPJSObject* npJSObject = toNPJSObject(npObject); + delete npJSObject; +} + +bool NPJSObject::NP_HasMethod(NPObject* npObject, NPIdentifier methodName) +{ + return toNPJSObject(npObject)->hasMethod(methodName); +} + +bool NPJSObject::NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPJSObject(npObject)->invoke(methodName, arguments, argumentCount, result); +} + +bool NPJSObject::NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPJSObject(npObject)->invokeDefault(arguments, argumentCount, result); +} + +bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName) +{ + return toNPJSObject(npObject)->hasProperty(propertyName); +} + +bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result) +{ + return toNPJSObject(npObject)->getProperty(propertyName, result); +} + +bool NPJSObject::NP_SetProperty(NPObject* npObject, NPIdentifier propertyName, const NPVariant* value) +{ + return toNPJSObject(npObject)->setProperty(propertyName, value); +} + +bool NPJSObject::NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) +{ + return toNPJSObject(npObject)->removeProperty(propertyName); +} + +bool NPJSObject::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount) +{ + return toNPJSObject(npObject)->enumerate(identifiers, identifierCount); +} + +bool NPJSObject::NP_Construct(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + return toNPJSObject(npObject)->construct(arguments, argumentCount, result); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h new file mode 100644 index 0000000..6737bd4 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.h @@ -0,0 +1,94 @@ +/* + * 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 NPJSObject_h +#define NPJSObject_h + +#include <JavaScriptCore/Protect.h> +#include <WebCore/npruntime_internal.h> +#include <wtf/Noncopyable.h> + +namespace JSC { + class JSGlobalObject; + class JSObject; +} + +namespace WebKit { + +class NPRuntimeObjectMap; + +// NPJSObject is an NPObject that wraps a JSObject. +class NPJSObject : public NPObject, Noncopyable { +public: + static NPJSObject* create(NPRuntimeObjectMap* objectMap, JSC::JSObject* jsObject); + + JSC::JSObject* jsObject() const { return m_jsObject.get(); } + + static bool isNPJSObject(NPObject*); + + static NPJSObject* toNPJSObject(NPObject* npObject) + { + ASSERT(isNPJSObject(npObject)); + return static_cast<NPJSObject*>(npObject); + } + +private: + NPJSObject(); + ~NPJSObject(); + + void initialize(NPRuntimeObjectMap*, JSC::JSObject* jsObject); + + bool hasMethod(NPIdentifier methodName); + bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + bool invokeDefault(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + bool hasProperty(NPIdentifier propertyName); + bool getProperty(NPIdentifier propertyName, NPVariant* result); + bool setProperty(NPIdentifier propertyName, const NPVariant* value); + bool removeProperty(NPIdentifier propertyName); + bool enumerate(NPIdentifier** identifiers, uint32_t* identifierCount); + bool construct(const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + + bool invoke(JSC::ExecState*, JSC::JSGlobalObject*, JSC::JSValue function, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + + static NPClass* npClass(); + static NPObject* NP_Allocate(NPP, NPClass*); + static void NP_Deallocate(NPObject*); + static bool NP_HasMethod(NPObject*, NPIdentifier methodName); + static bool NP_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + static bool NP_InvokeDefault(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + static bool NP_HasProperty(NPObject*, NPIdentifier propertyName); + static bool NP_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* result); + static bool NP_SetProperty(NPObject*, NPIdentifier propertyName, const NPVariant* value); + static bool NP_RemoveProperty(NPObject*, NPIdentifier propertyName); + static bool NP_Enumerate(NPObject*, NPIdentifier** identifiers, uint32_t* identifierCount); + static bool NP_Construct(NPObject*, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); + + NPRuntimeObjectMap* m_objectMap; + JSC::ProtectedPtr<JSC::JSObject> m_jsObject; +}; + +} // namespace WebKit + +#endif // NPJSObject_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp new file mode 100644 index 0000000..4fa37c1 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -0,0 +1,277 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NPRuntimeObjectMap.h" + +#include "JSNPObject.h" +#include "NPJSObject.h" +#include "NPRuntimeUtilities.h" +#include "NotImplemented.h" +#include "PluginView.h" +#include <JavaScriptCore/Error.h> +#include <JavaScriptCore/JSLock.h> +#include <JavaScriptCore/SourceCode.h> +#include <WebCore/Frame.h> + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + + +NPRuntimeObjectMap::NPRuntimeObjectMap(PluginView* pluginView) + : m_pluginView(pluginView) +{ +} + +NPRuntimeObjectMap::PluginProtector::PluginProtector(NPRuntimeObjectMap* npRuntimeObjectMap) +{ + // If we're already in the plug-in view destructor, we shouldn't try to keep it alive. + if (!npRuntimeObjectMap->m_pluginView->isBeingDestroyed()) + m_pluginView = npRuntimeObjectMap->m_pluginView; +} + +NPRuntimeObjectMap::PluginProtector::~PluginProtector() +{ +} + +NPObject* NPRuntimeObjectMap::getOrCreateNPObject(JSObject* jsObject) +{ + // If this is a JSNPObject, we can just get its underlying NPObject. + if (jsObject->classInfo() == &JSNPObject::s_info) { + JSNPObject* jsNPObject = static_cast<JSNPObject*>(jsObject); + NPObject* npObject = jsNPObject->npObject(); + + retainNPObject(npObject); + return npObject; + } + + // First, check if we already know about this object. + if (NPJSObject* npJSObject = m_npJSObjects.get(jsObject)) { + retainNPObject(npJSObject); + return npJSObject; + } + + NPJSObject* npJSObject = NPJSObject::create(this, jsObject); + m_npJSObjects.set(jsObject, npJSObject); + + return npJSObject; +} + +void NPRuntimeObjectMap::npJSObjectDestroyed(NPJSObject* npJSObject) +{ + // Remove the object from the map. + ASSERT(m_npJSObjects.contains(npJSObject->jsObject())); + m_npJSObjects.remove(npJSObject->jsObject()); +} + +JSObject* NPRuntimeObjectMap::getOrCreateJSObject(JSGlobalObject* globalObject, NPObject* npObject) +{ + // If this is an NPJSObject, we can just get the JSObject that it's wrapping. + if (NPJSObject::isNPJSObject(npObject)) + return NPJSObject::toNPJSObject(npObject)->jsObject(); + + if (JSNPObject* jsNPObject = m_jsNPObjects.get(npObject)) + return jsNPObject; + + JSNPObject* jsNPObject = new (&globalObject->globalData()) JSNPObject(globalObject, this, npObject); + m_jsNPObjects.set(npObject, jsNPObject); + + return jsNPObject; +} + +void NPRuntimeObjectMap::jsNPObjectDestroyed(JSNPObject* jsNPObject) +{ + // Remove the object from the map. + ASSERT(m_jsNPObjects.contains(jsNPObject->npObject())); + m_jsNPObjects.remove(jsNPObject->npObject()); +} + +JSValue NPRuntimeObjectMap::convertNPVariantToJSValue(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const NPVariant& variant) +{ + switch (variant.type) { + case NPVariantType_Void: + return jsUndefined(); + + case NPVariantType_Null: + return jsNull(); + + case NPVariantType_Bool: + return jsBoolean(variant.value.boolValue); + + case NPVariantType_Int32: + return jsNumber(variant.value.intValue); + + case NPVariantType_Double: + return jsNumber(variant.value.doubleValue); + + case NPVariantType_String: + return jsString(exec, String::fromUTF8WithLatin1Fallback(variant.value.stringValue.UTF8Characters, + variant.value.stringValue.UTF8Length)); + case NPVariantType_Object: + return getOrCreateJSObject(globalObject, variant.value.objectValue); + } + + ASSERT_NOT_REACHED(); + return jsUndefined(); +} + +void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue value, NPVariant& variant) +{ + JSLock lock(SilenceAssertionsOnly); + + VOID_TO_NPVARIANT(variant); + + if (value.isNull()) { + NULL_TO_NPVARIANT(variant); + return; + } + + if (value.isUndefined()) { + VOID_TO_NPVARIANT(variant); + return; + } + + if (value.isBoolean()) { + BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), variant); + return; + } + + if (value.isNumber()) { + DOUBLE_TO_NPVARIANT(value.toNumber(exec), variant); + return; + } + + if (value.isString()) { + NPString npString = createNPString(value.toString(exec).utf8()); + STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, variant); + return; + } + + if (value.isObject()) { + NPObject* npObject = getOrCreateNPObject(asObject(value)); + OBJECT_TO_NPVARIANT(npObject, variant); + return; + } + + ASSERT_NOT_REACHED(); +} + +bool NPRuntimeObjectMap::evaluate(NPObject* npObject, const String&scriptString, NPVariant* result) +{ + ProtectedPtr<JSGlobalObject> globalObject = this->globalObject(); + if (!globalObject) + return false; + + ExecState* exec = globalObject->globalExec(); + + JSLock lock(SilenceAssertionsOnly); + JSValue thisValue = getOrCreateJSObject(globalObject, npObject); + + globalObject->globalData().timeoutChecker.start(); + Completion completion = JSC::evaluate(exec, globalObject->globalScopeChain(), makeSource(UString(scriptString.impl())), thisValue); + globalObject->globalData().timeoutChecker.stop(); + + ComplType completionType = completion.complType(); + + JSValue resultValue; + if (completionType == Normal) { + resultValue = completion.value(); + if (!resultValue) + resultValue = jsUndefined(); + } else + resultValue = jsUndefined(); + + exec->clearException(); + + convertJSValueToNPVariant(exec, resultValue, *result); + return true; +} + +void NPRuntimeObjectMap::invalidate() +{ + Vector<NPJSObject*> npJSObjects; + copyValuesToVector(m_npJSObjects, npJSObjects); + + // Deallocate all the object wrappers so we won't leak any JavaScript objects. + for (size_t i = 0; i < npJSObjects.size(); ++i) + deallocateNPObject(npJSObjects[i]); + + // We shouldn't have any NPJSObjects left now. + ASSERT(m_npJSObjects.isEmpty()); + + Vector<JSNPObject*> jsNPObjects; + copyValuesToVector(m_jsNPObjects, jsNPObjects); + + // Invalidate all the JSObjects that wrap NPObjects. + for (size_t i = 0; i < jsNPObjects.size(); ++i) + jsNPObjects[i]->invalidate(); + + m_jsNPObjects.clear(); +} + +JSGlobalObject* NPRuntimeObjectMap::globalObject() const +{ + Frame* frame = m_pluginView->frame(); + if (!frame) + return 0; + + return frame->script()->globalObject(pluginWorld()); +} + +ExecState* NPRuntimeObjectMap::globalExec() const +{ + JSGlobalObject* globalObject = this->globalObject(); + if (!globalObject) + return 0; + + return globalObject->globalExec(); +} + +static String& globalExceptionString() +{ + DEFINE_STATIC_LOCAL(String, exceptionString, ()); + return exceptionString; +} + +void NPRuntimeObjectMap::setGlobalException(const String& exceptionString) +{ + globalExceptionString() = exceptionString; +} + +void NPRuntimeObjectMap::moveGlobalExceptionToExecState(ExecState* exec) +{ + if (globalExceptionString().isNull()) + return; + + { + JSLock lock(SilenceAssertionsOnly); + throwError(exec, createError(exec, stringToUString(globalExceptionString()))); + } + + globalExceptionString() = String(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h new file mode 100644 index 0000000..a11c354 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h @@ -0,0 +1,94 @@ +/* + * 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 NPJSObjectWrapperMap_h +#define NPJSObjectWrapperMap_h + +#include <wtf/Forward.h> +#include <wtf/HashMap.h> + +struct NPObject; +typedef struct _NPVariant NPVariant; + +namespace JSC { + class ExecState; + class JSGlobalObject; + class JSObject; + class JSValue; +} + +namespace WebKit { + +class JSNPObject; +class NPJSObject; +class PluginView; + +// A per plug-in map of NPObjects that wrap JavaScript objects. +class NPRuntimeObjectMap { +public: + explicit NPRuntimeObjectMap(PluginView*); + + class PluginProtector { + public: + explicit PluginProtector(NPRuntimeObjectMap* npRuntimeObjectMap); + ~PluginProtector(); + + private: + RefPtr<PluginView> m_pluginView; + }; + + // Returns an NPObject that wraps the given JSObject object. If there is already an NPObject that wraps this JSObject, it will + // retain it and return it. + NPObject* getOrCreateNPObject(JSC::JSObject*); + void npJSObjectDestroyed(NPJSObject*); + + // Returns a JSObject object that wraps the given NPObject. + JSC::JSObject* getOrCreateJSObject(JSC::JSGlobalObject*, NPObject*); + void jsNPObjectDestroyed(JSNPObject*); + + void convertJSValueToNPVariant(JSC::ExecState*, JSC::JSValue, NPVariant&); + JSC::JSValue convertNPVariantToJSValue(JSC::ExecState*, JSC::JSGlobalObject*, const NPVariant&); + + bool evaluate(NPObject*, const String& scriptString, NPVariant* result); + + // Called when the plug-in is destroyed. Will invalidate all the NPObjects. + void invalidate(); + + JSC::JSGlobalObject* globalObject() const; + JSC::ExecState* globalExec() const; + + static void setGlobalException(const String& exceptionString); + static void moveGlobalExceptionToExecState(JSC::ExecState*); + +private: + PluginView* m_pluginView; + + HashMap<JSC::JSObject*, NPJSObject*> m_npJSObjects; + HashMap<NPObject*, JSNPObject*> m_jsNPObjects; +}; + +} // namespace WebKit + +#endif // NPJSObjectWrapperMap_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp new file mode 100644 index 0000000..20ff478 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NPRuntimeUtilities.h" + +#include <wtf/text/CString.h> + +namespace WebKit { + +void* npnMemAlloc(uint32_t size) +{ + // We could use fastMalloc here, but there might be plug-ins that mix NPN_MemAlloc/NPN_MemFree with malloc and free, + // so having them be equivalent seems like a good idea. + return malloc(size); +} + +void npnMemFree(void* ptr) +{ + // We could use fastFree here, but there might be plug-ins that mix NPN_MemAlloc/NPN_MemFree with malloc and free, + // so having them be equivalent seems like a good idea. + free(ptr); +} + +NPString createNPString(const CString& string) +{ + char* utf8Characters = npnMemNewArray<char>(string.length()); + memcpy(utf8Characters, string.data(), string.length()); + + NPString npString; + npString.UTF8Characters = utf8Characters; + npString.UTF8Length = string.length(); + + return npString; +} + +NPObject* createNPObject(NPP npp, NPClass* npClass) +{ + ASSERT(npClass); + + NPObject* npObject; + if (npClass->allocate) + npObject = npClass->allocate(npp, npClass); + else + npObject = npnMemNew<NPObject>(); + + npObject->_class = npClass; + npObject->referenceCount = 1; + + return npObject; +} + +void deallocateNPObject(NPObject* npObject) +{ + ASSERT(npObject); + if (!npObject) + return; + + if (npObject->_class->deallocate) + npObject->_class->deallocate(npObject); + else + npnMemFree(npObject); +} + +void retainNPObject(NPObject* npObject) +{ + ASSERT(npObject); + if (!npObject) + return; + + npObject->referenceCount++; +} + +void releaseNPObject(NPObject* npObject) +{ + ASSERT(npObject); + if (!npObject) + return; + + ASSERT(npObject->referenceCount >= 1); + npObject->referenceCount--; + if (!npObject->referenceCount) + deallocateNPObject(npObject); +} + +void releaseNPVariantValue(NPVariant* variant) +{ + ASSERT(variant); + + switch (variant->type) { + case NPVariantType_Void: + case NPVariantType_Null: + case NPVariantType_Bool: + case NPVariantType_Int32: + case NPVariantType_Double: + // Nothing to do. + break; + + case NPVariantType_String: + npnMemFree(const_cast<NPUTF8*>(variant->value.stringValue.UTF8Characters)); + variant->value.stringValue.UTF8Characters = 0; + variant->value.stringValue.UTF8Length = 0; + break; + case NPVariantType_Object: + releaseNPObject(variant->value.objectValue); + variant->value.objectValue = 0; + break; + } + + variant->type = NPVariantType_Void; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.h new file mode 100644 index 0000000..7309fd4 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeUtilities.h @@ -0,0 +1,62 @@ +/* + * 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 NPRuntimeUtilities_h +#define NPRuntimeUtilities_h + +#include <WebCore/npruntime_internal.h> +#include <wtf/Forward.h> + +struct NPClass; +struct NPObject; + +namespace WebKit { + +void* npnMemAlloc(uint32_t); +void npnMemFree(void*); + +template<typename T> T* npnMemNew() +{ + return static_cast<T*>(npnMemAlloc(sizeof(T))); +} + +template<typename T> T* npnMemNewArray(size_t count) +{ + return static_cast<T*>(npnMemAlloc(sizeof(T) * count)); +} + +NPString createNPString(const CString&); + +NPObject* createNPObject(NPP, NPClass*); +void deallocateNPObject(NPObject*); + +void retainNPObject(NPObject*); +void releaseNPObject(NPObject*); + +void releaseNPVariantValue(NPVariant*); + +} + +#endif // NPRuntimeUtilities_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp new file mode 100644 index 0000000..566d48d --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp @@ -0,0 +1,871 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapeBrowserFuncs.h" + +#include "NPRuntimeUtilities.h" +#include "NetscapePlugin.h" +#include "NotImplemented.h" +#include <WebCore/HTTPHeaderMap.h> +#include <WebCore/IdentifierRep.h> +#include <WebCore/SharedBuffer.h> +#include <utility> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +static bool startsWithBlankLine(const char* bytes, unsigned length) +{ + return length > 0 && bytes[0] == '\n'; +} + +static int locationAfterFirstBlankLine(const char* bytes, unsigned length) +{ + for (unsigned i = 0; i < length - 4; i++) { + // Support for Acrobat. It sends "\n\n". + if (bytes[i] == '\n' && bytes[i + 1] == '\n') + return i + 2; + + // Returns the position after 2 CRLF's or 1 CRLF if it is the first line. + if (bytes[i] == '\r' && bytes[i + 1] == '\n') { + i += 2; + if (i == 2) + return i; + + if (bytes[i] == '\n') { + // Support for Director. It sends "\r\n\n" (3880387). + return i + 1; + } + + if (bytes[i] == '\r' && bytes[i + 1] == '\n') { + // Support for Flash. It sends "\r\n\r\n" (3758113). + return i + 2; + } + } + } + + return -1; +} + +static const char* findEndOfLine(const char* bytes, unsigned length) +{ + // According to the HTTP specification EOL is defined as + // a CRLF pair. Unfortunately, some servers will use LF + // instead. Worse yet, some servers will use a combination + // of both (e.g. <header>CRLFLF<body>), so findEOL needs + // to be more forgiving. It will now accept CRLF, LF or + // CR. + // + // It returns 0 if EOLF is not found or it will return + // a pointer to the first terminating character. + for (unsigned i = 0; i < length; i++) { + if (bytes[i] == '\n') + return bytes + i; + if (bytes[i] == '\r') { + // Check to see if spanning buffer bounds + // (CRLF is across reads). If so, wait for + // next read. + if (i + 1 == length) + break; + + return bytes + i; + } + } + + return 0; +} + +static String capitalizeRFC822HeaderFieldName(const String& name) +{ + bool capitalizeCharacter = true; + String result; + + for (unsigned i = 0; i < name.length(); i++) { + UChar c; + + if (capitalizeCharacter && name[i] >= 'a' && name[i] <= 'z') + c = toASCIIUpper(name[i]); + else if (!capitalizeCharacter && name[i] >= 'A' && name[i] <= 'Z') + c = toASCIILower(name[i]); + else + c = name[i]; + + if (name[i] == '-') + capitalizeCharacter = true; + else + capitalizeCharacter = false; + + result.append(c); + } + + return result; +} + +static HTTPHeaderMap parseRFC822HeaderFields(const char* bytes, unsigned length) +{ + String lastHeaderKey; + HTTPHeaderMap headerFields; + + // Loop over lines until we're past the header, or we can't find any more end-of-lines + while (const char* endOfLine = findEndOfLine(bytes, length)) { + const char* line = bytes; + int lineLength = endOfLine - bytes; + + // Move bytes to the character after the terminator as returned by findEndOfLine. + bytes = endOfLine + 1; + if ((*endOfLine == '\r') && (*bytes == '\n')) + bytes++; // Safe since findEndOfLine won't return a spanning CRLF. + + length -= (bytes - line); + if (!lineLength) { + // Blank line; we're at the end of the header + break; + } + + if (*line == ' ' || *line == '\t') { + // Continuation of the previous header + if (lastHeaderKey.isNull()) { + // malformed header; ignore it and continue + continue; + } + + // Merge the continuation of the previous header + String currentValue = headerFields.get(lastHeaderKey); + String newValue(line, lineLength); + + headerFields.set(lastHeaderKey, currentValue + newValue); + } else { + // Brand new header + const char* colon = line; + while (*colon != ':' && colon != endOfLine) + colon++; + + if (colon == endOfLine) { + // malformed header; ignore it and continue + continue; + } + + lastHeaderKey = capitalizeRFC822HeaderFieldName(String(line, colon - line)); + String value; + + for (colon++; colon != endOfLine; colon++) { + if (*colon != ' ' && *colon != '\t') + break; + } + if (colon == endOfLine) + value = ""; + else + value = String(colon, endOfLine - colon); + + String oldValue = headerFields.get(lastHeaderKey); + if (!oldValue.isNull()) { + String tmp = oldValue; + tmp += ", "; + tmp += value; + value = tmp; + } + + headerFields.set(lastHeaderKey, value); + } + } + + return headerFields; +} + +static NPError parsePostBuffer(bool isFile, const char *buffer, uint32_t length, bool parseHeaders, HTTPHeaderMap& headerFields, Vector<uint8_t>& bodyData) +{ + RefPtr<SharedBuffer> fileContents; + const char* postBuffer = 0; + uint32_t postBufferSize = 0; + + if (isFile) { + fileContents = SharedBuffer::createWithContentsOfFile(String::fromUTF8(buffer)); + if (!fileContents) + return NPERR_FILE_NOT_FOUND; + + postBuffer = fileContents->data(); + postBufferSize = fileContents->size(); + + // FIXME: The NPAPI spec states that the file should be deleted here. + } else { + postBuffer = buffer; + postBufferSize = length; + } + + if (parseHeaders) { + if (startsWithBlankLine(postBuffer, postBufferSize)) { + postBuffer++; + postBufferSize--; + } else { + int location = locationAfterFirstBlankLine(postBuffer, postBufferSize); + if (location != -1) { + // If the blank line is somewhere in the middle of the buffer, everything before is the header + headerFields = parseRFC822HeaderFields(postBuffer, location); + unsigned dataLength = postBufferSize - location; + + // Sometimes plugins like to set Content-Length themselves when they post, + // but WebFoundation does not like that. So we will remove the header + // and instead truncate the data to the requested length. + String contentLength = headerFields.get("Content-Length"); + + if (!contentLength.isNull()) + dataLength = min(contentLength.toInt(), (int)dataLength); + headerFields.remove("Content-Length"); + + postBuffer += location; + postBufferSize = dataLength; + + } + } + } + + ASSERT(bodyData.isEmpty()); + bodyData.append(postBuffer, postBufferSize); + + return NPERR_NO_ERROR; +} + +static String makeURLString(const char* url) +{ + String urlString(url); + + // Strip return characters. + urlString.replace('\r', ""); + urlString.replace('\n', ""); + + return urlString; +} + +static NPError NPN_GetURL(NPP npp, const char* url, const char* target) +{ + if (!url) + return NPERR_GENERIC_ERROR; + + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->loadURL("GET", makeURLString(url), target, HTTPHeaderMap(), Vector<uint8_t>(), false, 0); + + return NPERR_GENERIC_ERROR; +} + +static NPError NPN_PostURL(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file) +{ + HTTPHeaderMap headerFields; + Vector<uint8_t> postData; + + // NPN_PostURL only allows headers if the post buffer points to a file. + bool parseHeaders = file; + + NPError error = parsePostBuffer(file, buf, len, parseHeaders, headerFields, postData); + if (error != NPERR_NO_ERROR) + return error; + + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, false, 0); + return NPERR_NO_ERROR; +} + +static NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) +{ + notImplemented(); + return NPERR_GENERIC_ERROR; +} + +static NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream) +{ + notImplemented(); + return NPERR_GENERIC_ERROR; +} + +static int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) +{ + notImplemented(); + return -1; +} + +static NPError NPN_DestroyStream(NPP npp, NPStream* stream, NPReason reason) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + return plugin->destroyStream(stream, reason); +} + +static void NPN_Status(NPP npp, const char* message) +{ + String statusbarText; + if (!message) + statusbarText = ""; + else + statusbarText = String::fromUTF8WithLatin1Fallback(message, strlen(message)); + + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->setStatusbarText(statusbarText); +} + +static const char* NPN_UserAgent(NPP npp) +{ + return NetscapePlugin::userAgent(npp); +} + +static void* NPN_MemAlloc(uint32_t size) +{ + return npnMemAlloc(size); +} + +static void NPN_MemFree(void* ptr) +{ + npnMemFree(ptr); +} + +static uint32_t NPN_MemFlush(uint32_t size) +{ + return 0; +} + +static void NPN_ReloadPlugins(NPBool reloadPages) +{ + notImplemented(); +} + +static JRIEnv* NPN_GetJavaEnv(void) +{ + notImplemented(); + return 0; +} + +static jref NPN_GetJavaPeer(NPP instance) +{ + notImplemented(); + return 0; +} + +static NPError NPN_GetURLNotify(NPP npp, const char* url, const char* target, void* notifyData) +{ + if (!url) + return NPERR_GENERIC_ERROR; + + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->loadURL("GET", makeURLString(url), target, HTTPHeaderMap(), Vector<uint8_t>(), true, notifyData); + + return NPERR_NO_ERROR; +} + +static NPError NPN_PostURLNotify(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData) +{ + HTTPHeaderMap headerFields; + Vector<uint8_t> postData; + NPError error = parsePostBuffer(file, buf, len, true, headerFields, postData); + if (error != NPERR_NO_ERROR) + return error; + + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, true, notifyData); + return NPERR_NO_ERROR; +} + +#if PLATFORM(MAC) +/* TRUE if the browser supports hardware compositing of Core Animation plug-ins */ +static const unsigned WKNVSupportsCompositingCoreAnimationPluginsBool = 74656; +#endif + +static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value) +{ + switch (variable) { + case NPNVWindowNPObject: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + NPObject* windowNPObject = plugin->windowScriptNPObject(); + *(NPObject**)value = windowNPObject; + break; + } + case NPNVPluginElementNPObject: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + NPObject* pluginElementNPObject = plugin->pluginElementNPObject(); + *(NPObject**)value = pluginElementNPObject; + break; + } + case NPNVprivateModeBool: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + *(NPBool*)value = plugin->isPrivateBrowsingEnabled(); + break; + } +#if PLATFORM(MAC) + case NPNVsupportsCoreGraphicsBool: + // Always claim to support the Core Graphics drawing model. + *(NPBool*)value = true; + break; + + case WKNVSupportsCompositingCoreAnimationPluginsBool: + case NPNVsupportsCoreAnimationBool: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + *(NPBool*)value = plugin->isAcceleratedCompositingEnabled(); + break; + } + case NPNVsupportsCocoaBool: + // Always claim to support the Cocoa event model. + *(NPBool*)value = true; + break; + +#ifndef NP_NO_QUICKDRAW + case NPNVsupportsQuickDrawBool: + // We don't support the QuickDraw drawing model. + *(NPBool*)value = false; + break; +#endif +#ifndef NP_NO_CARBON + case NPNVsupportsCarbonBool: + // FIXME: We should support the Carbon event model. + *(NPBool*)value = false; + break; +#endif +#elif PLATFORM(WIN) + case NPNVnetscapeWindow: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + *reinterpret_cast<HWND*>(value) = plugin->containingWindow(); + break; + } + case NPNVSupportsWindowless: + *(NPBool*)value = true; + break; +#endif + default: + notImplemented(); + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; +} + +static NPError NPN_SetValue(NPP npp, NPPVariable variable, void *value) +{ + switch (variable) { +#if PLATFORM(MAC) + case NPPVpluginDrawingModel: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + NPDrawingModel drawingModel = static_cast<NPDrawingModel>(reinterpret_cast<uintptr_t>(value)); + return plugin->setDrawingModel(drawingModel); + } + + case NPPVpluginEventModel: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + NPEventModel eventModel = static_cast<NPEventModel>(reinterpret_cast<uintptr_t>(value)); + return plugin->setEventModel(eventModel); + } +#endif + + case NPPVpluginWindowBool: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->setIsWindowed(value); + return NPERR_NO_ERROR; + } + + case NPPVpluginTransparentBool: + default: + notImplemented(); + return NPERR_GENERIC_ERROR; + } +} + +static void NPN_InvalidateRect(NPP npp, NPRect* invalidRect) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->invalidate(invalidRect); +} + +static void NPN_InvalidateRegion(NPP npp, NPRegion invalidRegion) +{ + // FIXME: We could at least figure out the bounding rectangle of the invalid region. + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->invalidate(0); +} + +static void NPN_ForceRedraw(NPP instance) +{ + notImplemented(); +} + +static NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) +{ + return static_cast<NPIdentifier>(IdentifierRep::get(name)); +} + +static void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers) +{ + ASSERT(names); + ASSERT(identifiers); + + if (!names || !identifiers) + return; + + for (int32_t i = 0; i < nameCount; ++i) + identifiers[i] = NPN_GetStringIdentifier(names[i]); +} + +static NPIdentifier NPN_GetIntIdentifier(int32_t intid) +{ + return static_cast<NPIdentifier>(IdentifierRep::get(intid)); +} + +static bool NPN_IdentifierIsString(NPIdentifier identifier) +{ + return static_cast<IdentifierRep*>(identifier)->isString(); +} + +static NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) +{ + const char* string = static_cast<IdentifierRep*>(identifier)->string(); + if (!string) + return 0; + + uint32_t stringLength = strlen(string); + char* utf8String = npnMemNewArray<char>(stringLength + 1); + memcpy(utf8String, string, stringLength); + utf8String[stringLength] = '\0'; + + return utf8String; +} + +static int32_t NPN_IntFromIdentifier(NPIdentifier identifier) +{ + return static_cast<IdentifierRep*>(identifier)->number(); +} + +static NPObject* NPN_CreateObject(NPP npp, NPClass *npClass) +{ + return createNPObject(npp, npClass); +} + +static NPObject *NPN_RetainObject(NPObject *npObject) +{ + retainNPObject(npObject); + return npObject; +} + +static void NPN_ReleaseObject(NPObject *npObject) +{ + releaseNPObject(npObject); +} + +static bool NPN_Invoke(NPP, NPObject *npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (npObject->_class->invoke) + return npObject->_class->invoke(npObject, methodName, arguments, argumentCount, result); + + return false; +} + +static bool NPN_InvokeDefault(NPP, NPObject *npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (npObject->_class->invokeDefault) + return npObject->_class->invokeDefault(npObject, arguments, argumentCount, result); + + return false; +} + +static bool NPN_Evaluate(NPP npp, NPObject *npObject, NPString *script, NPVariant* result) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + String scriptString = String::fromUTF8WithLatin1Fallback(script->UTF8Characters, script->UTF8Length); + + return plugin->evaluate(npObject, scriptString, result); +} + +static bool NPN_GetProperty(NPP, NPObject* npObject, NPIdentifier propertyName, NPVariant* result) +{ + if (npObject->_class->getProperty) + return npObject->_class->getProperty(npObject, propertyName, result); + + return false; +} + +static bool NPN_SetProperty(NPP, NPObject* npObject, NPIdentifier propertyName, const NPVariant* value) +{ + if (npObject->_class->setProperty) + return npObject->_class->setProperty(npObject, propertyName, value); + + return false; +} + +static bool NPN_RemoveProperty(NPP, NPObject* npObject, NPIdentifier propertyName) +{ + if (npObject->_class->removeProperty) + return npObject->_class->removeProperty(npObject, propertyName); + + return false; +} + +static bool NPN_HasProperty(NPP, NPObject* npObject, NPIdentifier propertyName) +{ + if (npObject->_class->hasProperty) + return npObject->_class->hasProperty(npObject, propertyName); + + return false; +} + +static bool NPN_HasMethod(NPP, NPObject* npObject, NPIdentifier methodName) +{ + if (npObject->_class->hasMethod) + return npObject->_class->hasMethod(npObject, methodName); + + return false; +} + +static void NPN_ReleaseVariantValue(NPVariant* variant) +{ + releaseNPVariantValue(variant); +} + +static void NPN_SetException(NPObject*, const NPUTF8* message) +{ + NetscapePlugin::setException(message); +} + +static void NPN_PushPopupsEnabledState(NPP npp, NPBool enabled) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->pushPopupsEnabledState(enabled); +} + +static void NPN_PopPopupsEnabledState(NPP npp) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + plugin->popPopupsEnabledState(); +} + +static bool NPN_Enumerate(NPP, NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount) +{ + if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) + return npObject->_class->enumerate(npObject, identifiers, identifierCount); + + return false; +} + +static void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void*), void* userData) +{ + notImplemented(); +} + +static bool NPN_Construct(NPP, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) +{ + if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->construct) + return npObject->_class->construct(npObject, arguments, argumentCount, result); + + return false; +} + +static NPError copyCString(const CString& string, char** value, uint32_t* len) +{ + ASSERT(!string.isNull()); + ASSERT(value); + ASSERT(len); + + *value = npnMemNewArray<char>(string.length()); + if (!*value) + return NPERR_GENERIC_ERROR; + + memcpy(*value, string.data(), string.length()); + *len = string.length(); + return NPERR_NO_ERROR; +} + +static NPError NPN_GetValueForURL(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32_t* len) +{ + if (!value || !len) + return NPERR_GENERIC_ERROR; + + switch (variable) { + case NPNURLVCookie: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + String cookies = plugin->cookiesForURL(makeURLString(url)); + if (cookies.isNull()) + return NPERR_GENERIC_ERROR; + + return copyCString(cookies.utf8(), value, len); + } + + case NPNURLVProxy: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + String proxies = plugin->proxiesForURL(makeURLString(url)); + if (proxies.isNull()) + return NPERR_GENERIC_ERROR; + + return copyCString(proxies.utf8(), value, len); + } + default: + notImplemented(); + return NPERR_GENERIC_ERROR; + } +} + +static NPError NPN_SetValueForURL(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32_t len) +{ + switch (variable) { + case NPNURLVCookie: { + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + plugin->setCookiesForURL(makeURLString(url), String(value, len)); + return NPERR_NO_ERROR; + } + + case NPNURLVProxy: + // Can't set the proxy for a URL. + return NPERR_GENERIC_ERROR; + + default: + notImplemented(); + return NPERR_GENERIC_ERROR; + } +} + +static NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme, + const char* realm, char** username, uint32_t* ulen, char** password, uint32_t* plen) +{ + notImplemented(); + return NPERR_GENERIC_ERROR; +} + +static uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)) +{ + notImplemented(); + return NPERR_GENERIC_ERROR; +} + +static void NPN_UnscheduleTimer(NPP instance, uint32_t timerID) +{ + notImplemented(); +} + +#if PLATFORM(MAC) +static NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu) +{ + notImplemented(); + return NPERR_GENERIC_ERROR; +} + +static NPBool NPN_ConvertPoint(NPP npp, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double* destX, double* destY, NPCoordinateSpace destSpace) +{ + RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); + + double destinationX; + double destinationY; + + bool returnValue = plugin->convertPoint(sourceX, sourceY, sourceSpace, destinationX, destinationY, destSpace); + + if (destX) + *destX = destinationX; + if (destY) + *destY = destinationY; + + return returnValue; +} +#endif + +static void initializeBrowserFuncs(NPNetscapeFuncs &netscapeFuncs) +{ + netscapeFuncs.size = sizeof(NPNetscapeFuncs); + netscapeFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; + + netscapeFuncs.geturl = NPN_GetURL; + netscapeFuncs.posturl = NPN_PostURL; + netscapeFuncs.requestread = NPN_RequestRead; + netscapeFuncs.newstream = NPN_NewStream; + netscapeFuncs.write = NPN_Write; + netscapeFuncs.destroystream = NPN_DestroyStream; + netscapeFuncs.status = NPN_Status; + netscapeFuncs.uagent = NPN_UserAgent; + netscapeFuncs.memalloc = NPN_MemAlloc; + netscapeFuncs.memfree = NPN_MemFree; + netscapeFuncs.memflush = NPN_MemFlush; + netscapeFuncs.reloadplugins = NPN_ReloadPlugins; + netscapeFuncs.getJavaEnv = NPN_GetJavaEnv; + netscapeFuncs.getJavaPeer = NPN_GetJavaPeer; + netscapeFuncs.geturlnotify = NPN_GetURLNotify; + netscapeFuncs.posturlnotify = NPN_PostURLNotify; + netscapeFuncs.getvalue = NPN_GetValue; + netscapeFuncs.setvalue = NPN_SetValue; + netscapeFuncs.invalidaterect = NPN_InvalidateRect; + netscapeFuncs.invalidateregion = NPN_InvalidateRegion; + netscapeFuncs.forceredraw = NPN_ForceRedraw; + + netscapeFuncs.getstringidentifier = NPN_GetStringIdentifier; + netscapeFuncs.getstringidentifiers = NPN_GetStringIdentifiers; + netscapeFuncs.getintidentifier = NPN_GetIntIdentifier; + netscapeFuncs.identifierisstring = NPN_IdentifierIsString; + netscapeFuncs.utf8fromidentifier = NPN_UTF8FromIdentifier; + netscapeFuncs.intfromidentifier = NPN_IntFromIdentifier; + netscapeFuncs.createobject = NPN_CreateObject; + netscapeFuncs.retainobject = NPN_RetainObject; + netscapeFuncs.releaseobject = NPN_ReleaseObject; + netscapeFuncs.invoke = NPN_Invoke; + netscapeFuncs.invokeDefault = NPN_InvokeDefault; + netscapeFuncs.evaluate = NPN_Evaluate; + netscapeFuncs.getproperty = NPN_GetProperty; + netscapeFuncs.setproperty = NPN_SetProperty; + netscapeFuncs.removeproperty = NPN_RemoveProperty; + netscapeFuncs.hasproperty = NPN_HasProperty; + netscapeFuncs.hasmethod = NPN_HasMethod; + netscapeFuncs.releasevariantvalue = NPN_ReleaseVariantValue; + netscapeFuncs.setexception = NPN_SetException; + netscapeFuncs.pushpopupsenabledstate = NPN_PushPopupsEnabledState; + netscapeFuncs.poppopupsenabledstate = NPN_PopPopupsEnabledState; + netscapeFuncs.enumerate = NPN_Enumerate; + netscapeFuncs.pluginthreadasynccall = NPN_PluginThreadAsyncCall; + netscapeFuncs.construct = NPN_Construct; + netscapeFuncs.getvalueforurl = NPN_GetValueForURL; + netscapeFuncs.setvalueforurl = NPN_SetValueForURL; + netscapeFuncs.getauthenticationinfo = NPN_GetAuthenticationInfo; + netscapeFuncs.scheduletimer = NPN_ScheduleTimer; + netscapeFuncs.unscheduletimer = NPN_UnscheduleTimer; +#if PLATFORM(MAC) + netscapeFuncs.popupcontextmenu = NPN_PopUpContextMenu; + netscapeFuncs.convertpoint = NPN_ConvertPoint; +#else + netscapeFuncs.popupcontextmenu = 0; + netscapeFuncs.convertpoint = 0; +#endif +} + +NPNetscapeFuncs* netscapeBrowserFuncs() +{ + static NPNetscapeFuncs netscapeFuncs; + static bool initialized = false; + + if (!initialized) { + initializeBrowserFuncs(netscapeFuncs); + initialized = true; + } + + return &netscapeFuncs; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h new file mode 100644 index 0000000..49a7f3a --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.h @@ -0,0 +1,38 @@ +/* + * 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 NetscapeBrowserFuncs_h +#define NetscapeBrowserFuncs_h + +#include <WebCore/npfunctions.h> + +namespace WebKit { + +NPNetscapeFuncs* netscapeBrowserFuncs(); + +} // namespace WebKit + + +#endif // NetscapeBrowserFuncs_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp new file mode 100644 index 0000000..0beade2 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -0,0 +1,678 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePlugin.h" + +#include "NPRuntimeObjectMap.h" +#include "NetscapePluginStream.h" +#include "PluginController.h" +#include <WebCore/GraphicsContext.h> +#include <WebCore/HTTPHeaderMap.h> +#include <WebCore/IntRect.h> +#include <WebCore/KURL.h> +#include <utility> +#include <wtf/text/CString.h> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +// The plug-in that we're currently calling NPP_New for. +static NetscapePlugin* currentNPPNewPlugin; + +PassRefPtr<NetscapePlugin> NetscapePlugin::create(PassRefPtr<NetscapePluginModule> pluginModule) +{ + if (!pluginModule) + return 0; + + return adoptRef(new NetscapePlugin(pluginModule)); +} + +NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule) + : m_pluginController(0) + , m_nextRequestID(0) + , m_pluginModule(pluginModule) + , m_npWindow() + , m_isStarted(false) +#if PLATFORM(MAC) + , m_isWindowed(false) +#else + , m_isWindowed(true) +#endif + , m_inNPPNew(false) + , m_loadManually(false) +#if PLATFORM(MAC) + , m_drawingModel(static_cast<NPDrawingModel>(-1)) + , m_eventModel(static_cast<NPEventModel>(-1)) + , m_pluginHasFocus(false) + , m_windowHasFocus(false) +#ifndef NP_NO_CARBON + , m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired) + , m_npCGContext() +#endif +#endif +{ + m_npp.ndata = this; + m_npp.pdata = 0; + + m_pluginModule->pluginCreated(); +} + +NetscapePlugin::~NetscapePlugin() +{ + ASSERT(!m_isStarted); + + m_pluginModule->pluginDestroyed(); +} + +PassRefPtr<NetscapePlugin> NetscapePlugin::fromNPP(NPP npp) +{ + if (npp) + return static_cast<NetscapePlugin*>(npp->ndata); + + // FIXME: Return the current NetscapePlugin here. + ASSERT_NOT_REACHED(); + return 0; +} + +void NetscapePlugin::invalidate(const NPRect* invalidRect) +{ + IntRect rect; + + if (!invalidRect) + rect = IntRect(0, 0, m_frameRect.width(), m_frameRect.height()); + else + rect = IntRect(invalidRect->left, invalidRect->top, + invalidRect->right - invalidRect->left, invalidRect->bottom - invalidRect->top); + + if (platformInvalidate(rect)) + return; + + m_pluginController->invalidate(rect); +} + +const char* NetscapePlugin::userAgent(NPP npp) +{ + if (npp) + return fromNPP(npp)->userAgent(); + + if (currentNPPNewPlugin) + return currentNPPNewPlugin->userAgent(); + + return 0; +} + +const char* NetscapePlugin::userAgent() +{ + if (m_userAgent.isNull()) { + m_userAgent = m_pluginController->userAgent().utf8(); + ASSERT(!m_userAgent.isNull()); + } + return m_userAgent.data(); +} + +void NetscapePlugin::loadURL(const String& method, const String& urlString, const String& target, const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, + bool sendNotification, void* notificationData) +{ + uint64_t requestID = ++m_nextRequestID; + + m_pluginController->loadURL(requestID, method, urlString, target, headerFields, httpBody, allowPopups()); + + if (target.isNull()) { + // The browser is going to send the data in a stream, create a plug-in stream. + RefPtr<NetscapePluginStream> pluginStream = NetscapePluginStream::create(this, requestID, sendNotification, notificationData); + ASSERT(!m_streams.contains(requestID)); + + m_streams.set(requestID, pluginStream.release()); + return; + } + + if (sendNotification) { + // Eventually we are going to get a frameDidFinishLoading or frameDidFail call for this request. + // Keep track of the notification data so we can call NPP_URLNotify. + ASSERT(!m_pendingURLNotifications.contains(requestID)); + m_pendingURLNotifications.set(requestID, make_pair(urlString, notificationData)); + } +} + +NPError NetscapePlugin::destroyStream(NPStream* stream, NPReason reason) +{ + NetscapePluginStream* pluginStream = 0; + + for (StreamsMap::const_iterator it = m_streams.begin(), end = m_streams.end(); it != end; ++it) { + if (it->second->npStream() == stream) { + pluginStream = it->second.get(); + break; + } + } + + if (!pluginStream) + return NPERR_INVALID_INSTANCE_ERROR; + + return pluginStream->destroy(reason); +} + +void NetscapePlugin::setIsWindowed(bool isWindowed) +{ + // Once the plugin has started, it's too late to change whether the plugin is windowed or not. + // (This is true in Firefox and Chrome, too.) Disallow setting m_isWindowed in that case to + // keep our internal state consistent. + if (m_isStarted) + return; + + m_isWindowed = isWindowed; +} + +void NetscapePlugin::setStatusbarText(const String& statusbarText) +{ + m_pluginController->setStatusbarText(statusbarText); +} + +void NetscapePlugin::setException(const String& exceptionString) +{ + // FIXME: If the plug-in is running in its own process, this needs to send a CoreIPC message instead of + // calling the runtime object map directly. + NPRuntimeObjectMap::setGlobalException(exceptionString); +} + +bool NetscapePlugin::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result) +{ + return m_pluginController->evaluate(npObject, scriptString, result, allowPopups()); +} + +bool NetscapePlugin::isPrivateBrowsingEnabled() +{ + return m_pluginController->isPrivateBrowsingEnabled(); +} + +NPObject* NetscapePlugin::windowScriptNPObject() +{ + return m_pluginController->windowScriptNPObject(); +} + +NPObject* NetscapePlugin::pluginElementNPObject() +{ + return m_pluginController->pluginElementNPObject(); +} + +void NetscapePlugin::cancelStreamLoad(NetscapePluginStream* pluginStream) +{ + if (pluginStream == m_manualStream) { + m_pluginController->cancelManualStreamLoad(); + return; + } + + // Ask the plug-in controller to cancel this stream load. + m_pluginController->cancelStreamLoad(pluginStream->streamID()); +} + +void NetscapePlugin::removePluginStream(NetscapePluginStream* pluginStream) +{ + if (pluginStream == m_manualStream) { + m_manualStream = 0; + return; + } + + ASSERT(m_streams.get(pluginStream->streamID()) == pluginStream); + m_streams.remove(pluginStream->streamID()); +} + +bool NetscapePlugin::isAcceleratedCompositingEnabled() +{ +#if USE(ACCELERATED_COMPOSITING) + return m_pluginController->isAcceleratedCompositingEnabled(); +#else + return false; +#endif +} + +void NetscapePlugin::pushPopupsEnabledState(bool state) +{ + m_popupEnabledStates.append(state); +} + +void NetscapePlugin::popPopupsEnabledState() +{ + ASSERT(!m_popupEnabledStates.isEmpty()); + + m_popupEnabledStates.removeLast(); +} + +String NetscapePlugin::proxiesForURL(const String& urlString) +{ + return m_pluginController->proxiesForURL(urlString); +} + +String NetscapePlugin::cookiesForURL(const String& urlString) +{ + return m_pluginController->cookiesForURL(urlString); +} + +void NetscapePlugin::setCookiesForURL(const String& urlString, const String& cookieString) +{ + m_pluginController->setCookiesForURL(urlString, cookieString); +} + +NPError NetscapePlugin::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* savedData) +{ + return m_pluginModule->pluginFuncs().newp(pluginType, &m_npp, mode, argc, argn, argv, savedData); +} + +NPError NetscapePlugin::NPP_Destroy(NPSavedData** savedData) +{ + return m_pluginModule->pluginFuncs().destroy(&m_npp, savedData); +} + +NPError NetscapePlugin::NPP_SetWindow(NPWindow* npWindow) +{ + return m_pluginModule->pluginFuncs().setwindow(&m_npp, npWindow); +} + +NPError NetscapePlugin::NPP_NewStream(NPMIMEType mimeType, NPStream* stream, NPBool seekable, uint16_t* streamType) +{ + return m_pluginModule->pluginFuncs().newstream(&m_npp, mimeType, stream, seekable, streamType); +} + +NPError NetscapePlugin::NPP_DestroyStream(NPStream* stream, NPReason reason) +{ + return m_pluginModule->pluginFuncs().destroystream(&m_npp, stream, reason); +} + +void NetscapePlugin::NPP_StreamAsFile(NPStream* stream, const char* filename) +{ + return m_pluginModule->pluginFuncs().asfile(&m_npp, stream, filename); +} + +int32_t NetscapePlugin::NPP_WriteReady(NPStream* stream) +{ + return m_pluginModule->pluginFuncs().writeready(&m_npp, stream); +} + +int32_t NetscapePlugin::NPP_Write(NPStream* stream, int32_t offset, int32_t len, void* buffer) +{ + return m_pluginModule->pluginFuncs().write(&m_npp, stream, offset, len, buffer); +} + +int16_t NetscapePlugin::NPP_HandleEvent(void* event) +{ + return m_pluginModule->pluginFuncs().event(&m_npp, event); +} + +void NetscapePlugin::NPP_URLNotify(const char* url, NPReason reason, void* notifyData) +{ + m_pluginModule->pluginFuncs().urlnotify(&m_npp, url, reason, notifyData); +} + +NPError NetscapePlugin::NPP_GetValue(NPPVariable variable, void *value) +{ + if (!m_pluginModule->pluginFuncs().getvalue) + return NPERR_GENERIC_ERROR; + + return m_pluginModule->pluginFuncs().getvalue(&m_npp, variable, value); +} + +NPError NetscapePlugin::NPP_SetValue(NPNVariable variable, void *value) +{ + if (!m_pluginModule->pluginFuncs().setvalue) + return NPERR_GENERIC_ERROR; + + return m_pluginModule->pluginFuncs().setvalue(&m_npp, variable, value); +} + +void NetscapePlugin::callSetWindow() +{ + m_npWindow.x = m_frameRect.x(); + m_npWindow.y = m_frameRect.y(); + m_npWindow.width = m_frameRect.width(); + 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(); + + NPP_SetWindow(&m_npWindow); +} + +bool NetscapePlugin::shouldLoadSrcURL() +{ + // Check if we should cancel the load + NPBool cancelSrcStream = false; + + if (NPP_GetValue(NPPVpluginCancelSrcStream, &cancelSrcStream) != NPERR_NO_ERROR) + return true; + + return !cancelSrcStream; +} + +NetscapePluginStream* NetscapePlugin::streamFromID(uint64_t streamID) +{ + return m_streams.get(streamID).get(); +} + +void NetscapePlugin::stopAllStreams() +{ + Vector<RefPtr<NetscapePluginStream> > streams; + copyValuesToVector(m_streams, streams); + + for (size_t i = 0; i < streams.size(); ++i) + streams[i]->stop(NPRES_USER_BREAK); +} + +bool NetscapePlugin::allowPopups() const +{ + if (m_pluginModule->pluginFuncs().version >= NPVERS_HAS_POPUPS_ENABLED_STATE) { + if (!m_popupEnabledStates.isEmpty()) + return m_popupEnabledStates.last(); + } + + // FIXME: Check if the current event is a user gesture. + // Really old versions of Flash required this for popups to work, but all newer versions + // support NPN_PushPopupEnabledState/NPN_PopPopupEnabledState. + return false; +} + +bool NetscapePlugin::initialize(PluginController* pluginController, const Parameters& parameters) +{ + ASSERT(!m_pluginController); + ASSERT(pluginController); + + m_pluginController = pluginController; + + uint16_t mode = parameters.loadManually ? NP_FULL : NP_EMBED; + + m_loadManually = parameters.loadManually; + + CString mimeTypeCString = parameters.mimeType.utf8(); + + ASSERT(parameters.names.size() == parameters.values.size()); + + Vector<CString> paramNames; + Vector<CString> paramValues; + for (size_t i = 0; i < parameters.names.size(); ++i) { + paramNames.append(parameters.names[i].utf8()); + paramValues.append(parameters.values[i].utf8()); + } + + // The strings that these pointers point to are kept alive by paramNames and paramValues. + Vector<const char*> names; + Vector<const char*> values; + for (size_t i = 0; i < paramNames.size(); ++i) { + names.append(paramNames[i].data()); + values.append(paramValues[i].data()); + } + + NetscapePlugin* previousNPPNewPlugin = currentNPPNewPlugin; + + m_inNPPNew = true; + currentNPPNewPlugin = this; + + NPError error = NPP_New(const_cast<char*>(mimeTypeCString.data()), mode, names.size(), + const_cast<char**>(names.data()), const_cast<char**>(values.data()), 0); + + m_inNPPNew = false; + currentNPPNewPlugin = previousNPPNewPlugin; + + if (error != NPERR_NO_ERROR) + return false; + + m_isStarted = true; + + // FIXME: This is not correct in all cases. + m_npWindow.type = NPWindowTypeDrawable; + + if (!platformPostInitialize()) { + destroy(); + return false; + } + + // Load the src URL if needed. + if (!parameters.loadManually && !parameters.url.isEmpty() && shouldLoadSrcURL()) + loadURL("GET", parameters.url.string(), String(), HTTPHeaderMap(), Vector<uint8_t>(), false, 0); + + return true; +} + +void NetscapePlugin::destroy() +{ + ASSERT(m_isStarted); + + // Stop all streams. + stopAllStreams(); + + NPP_Destroy(0); + + m_isStarted = false; + m_pluginController = 0; + + platformDestroy(); +} + +void NetscapePlugin::paint(GraphicsContext* context, const IntRect& dirtyRect) +{ + ASSERT(m_isStarted); + + platformPaint(context, dirtyRect); +} + +void NetscapePlugin::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect) +{ + ASSERT(m_isStarted); + + if (m_frameRect == frameRect && m_clipRect == clipRect) { + // Nothing to do. + return; + } + + m_frameRect = frameRect; + m_clipRect = clipRect; + + platformGeometryDidChange(); + callSetWindow(); +} + +void NetscapePlugin::frameDidFinishLoading(uint64_t requestID) +{ + ASSERT(m_isStarted); + + PendingURLNotifyMap::iterator it = m_pendingURLNotifications.find(requestID); + if (it == m_pendingURLNotifications.end()) + return; + + String url = it->second.first; + void* notificationData = it->second.second; + + m_pendingURLNotifications.remove(it); + + NPP_URLNotify(url.utf8().data(), NPRES_DONE, notificationData); +} + +void NetscapePlugin::frameDidFail(uint64_t requestID, bool wasCancelled) +{ + ASSERT(m_isStarted); + + PendingURLNotifyMap::iterator it = m_pendingURLNotifications.find(requestID); + if (it == m_pendingURLNotifications.end()) + return; + + String url = it->second.first; + void* notificationData = it->second.second; + + m_pendingURLNotifications.remove(it); + + NPP_URLNotify(url.utf8().data(), wasCancelled ? NPRES_USER_BREAK : NPRES_NETWORK_ERR, notificationData); +} + +void NetscapePlugin::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result) +{ + ASSERT(m_isStarted); + + if (NetscapePluginStream* pluginStream = streamFromID(requestID)) + pluginStream->sendJavaScriptStream(requestURLString, result); +} + +void NetscapePlugin::streamDidReceiveResponse(uint64_t streamID, const KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers) +{ + ASSERT(m_isStarted); + + if (NetscapePluginStream* pluginStream = streamFromID(streamID)) + pluginStream->didReceiveResponse(responseURL, streamLength, lastModifiedTime, mimeType, headers); +} + +void NetscapePlugin::streamDidReceiveData(uint64_t streamID, const char* bytes, int length) +{ + ASSERT(m_isStarted); + + if (NetscapePluginStream* pluginStream = streamFromID(streamID)) + pluginStream->didReceiveData(bytes, length); +} + +void NetscapePlugin::streamDidFinishLoading(uint64_t streamID) +{ + ASSERT(m_isStarted); + + if (NetscapePluginStream* pluginStream = streamFromID(streamID)) + pluginStream->didFinishLoading(); +} + +void NetscapePlugin::streamDidFail(uint64_t streamID, bool wasCancelled) +{ + ASSERT(m_isStarted); + + if (NetscapePluginStream* pluginStream = streamFromID(streamID)) + pluginStream->didFail(wasCancelled); +} + +void NetscapePlugin::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, + const String& mimeType, const String& headers) +{ + ASSERT(m_isStarted); + ASSERT(m_loadManually); + ASSERT(!m_manualStream); + + m_manualStream = NetscapePluginStream::create(this, 0, false, 0); + m_manualStream->didReceiveResponse(responseURL, streamLength, lastModifiedTime, mimeType, headers); +} + +void NetscapePlugin::manualStreamDidReceiveData(const char* bytes, int length) +{ + ASSERT(m_isStarted); + ASSERT(m_loadManually); + ASSERT(m_manualStream); + + m_manualStream->didReceiveData(bytes, length); +} + +void NetscapePlugin::manualStreamDidFinishLoading() +{ + ASSERT(m_isStarted); + ASSERT(m_loadManually); + ASSERT(m_manualStream); + + m_manualStream->didFinishLoading(); +} + +void NetscapePlugin::manualStreamDidFail(bool wasCancelled) +{ + ASSERT(m_isStarted); + ASSERT(m_loadManually); + ASSERT(m_manualStream); + + m_manualStream->didFail(wasCancelled); +} + +bool NetscapePlugin::handleMouseEvent(const WebMouseEvent& mouseEvent) +{ + ASSERT(m_isStarted); + + return platformHandleMouseEvent(mouseEvent); +} + +bool NetscapePlugin::handleWheelEvent(const WebWheelEvent& wheelEvent) +{ + ASSERT(m_isStarted); + + return platformHandleWheelEvent(wheelEvent); +} + +bool NetscapePlugin::handleMouseEnterEvent(const WebMouseEvent& mouseEvent) +{ + ASSERT(m_isStarted); + + return platformHandleMouseEnterEvent(mouseEvent); +} + +bool NetscapePlugin::handleMouseLeaveEvent(const WebMouseEvent& mouseEvent) +{ + ASSERT(m_isStarted); + + return platformHandleMouseLeaveEvent(mouseEvent); +} + +bool NetscapePlugin::handleKeyboardEvent(const WebKeyboardEvent& keyboardEvent) +{ + ASSERT(m_isStarted); + + return platformHandleKeyboardEvent(keyboardEvent); +} + +void NetscapePlugin::setFocus(bool hasFocus) +{ + ASSERT(m_isStarted); + + platformSetFocus(hasFocus); +} + +NPObject* NetscapePlugin::pluginScriptableNPObject() +{ + ASSERT(m_isStarted); + NPObject* scriptableNPObject = 0; + + if (NPP_GetValue(NPPVpluginScriptableNPObject, &scriptableNPObject) != NPERR_NO_ERROR) + return 0; + + return scriptableNPObject; +} + +void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled) +{ + ASSERT(m_isStarted); + + // From https://wiki.mozilla.org/Plugins:PrivateMode + // When the browser turns private mode on or off it will call NPP_SetValue for "NPNVprivateModeBool" + // (assigned enum value 18) with a pointer to an NPBool value on all applicable instances. + // Plugins should check the boolean value pointed to, not the pointer itself. + // The value will be true when private mode is on. + NPBool value = privateBrowsingEnabled; + NPP_SetValue(NPNVprivateModeBool, &value); +} + +PluginController* NetscapePlugin::controller() +{ + return m_pluginController; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h new file mode 100644 index 0000000..fb5d37e --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -0,0 +1,229 @@ +/* + * 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 NetscapePlugin_h +#define NetscapePlugin_h + +#include "NetscapePluginModule.h" +#include "Plugin.h" +#include "RunLoop.h" +#include <WebCore/GraphicsLayer.h> +#include <WebCore/IntRect.h> +#include <wtf/HashMap.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + class HTTPHeaderMap; +} + +namespace WebKit { + +class NetscapePluginStream; + +class NetscapePlugin : public Plugin { +public: + static PassRefPtr<NetscapePlugin> create(PassRefPtr<NetscapePluginModule> pluginModule); + virtual ~NetscapePlugin(); + + static PassRefPtr<NetscapePlugin> fromNPP(NPP); + +#if PLATFORM(MAC) + NPError setDrawingModel(NPDrawingModel); + NPError setEventModel(NPEventModel); + NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace); + +#ifndef NP_NO_CARBON + WindowRef windowRef() const; + bool isWindowActive() const { return m_windowHasFocus; } + + static NetscapePlugin* netscapePluginFromWindow(WindowRef); + static unsigned buttonState(); +#endif + +#elif PLATFORM(WIN) + HWND containingWindow() const; +#endif + + void invalidate(const NPRect*); + static const char* userAgent(NPP); + void loadURL(const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& headerFields, + const Vector<uint8_t>& httpBody, bool sendNotification, void* notificationData); + NPError destroyStream(NPStream*, NPReason); + void setIsWindowed(bool); + void setStatusbarText(const String&); + static void setException(const String&); + bool evaluate(NPObject*, const String&scriptString, NPVariant* result); + bool isPrivateBrowsingEnabled(); + + // These return retained objects. + NPObject* windowScriptNPObject(); + NPObject* pluginElementNPObject(); + + void cancelStreamLoad(NetscapePluginStream*); + void removePluginStream(NetscapePluginStream*); + + bool isAcceleratedCompositingEnabled(); + + void pushPopupsEnabledState(bool enabled); + void popPopupsEnabledState(); + + String proxiesForURL(const String& urlString); + String cookiesForURL(const String& urlString); + void setCookiesForURL(const String& urlString, const String& cookieString); + + // Member functions for calling into the plug-in. + NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData*); + NPError NPP_Destroy(NPSavedData**); + NPError NPP_SetWindow(NPWindow*); + NPError NPP_NewStream(NPMIMEType, NPStream*, NPBool seekable, uint16_t* stype); + NPError NPP_DestroyStream(NPStream*, NPReason); + void NPP_StreamAsFile(NPStream*, const char* filename); + int32_t NPP_WriteReady(NPStream*); + int32_t NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer); + int16_t NPP_HandleEvent(void* event); + void NPP_URLNotify(const char* url, NPReason, void* notifyData); + NPError NPP_GetValue(NPPVariable, void *value); + NPError NPP_SetValue(NPNVariable, void *value); + +private: + NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule); + + void callSetWindow(); + bool shouldLoadSrcURL(); + NetscapePluginStream* streamFromID(uint64_t streamID); + void stopAllStreams(); + bool allowPopups() const; + + const char* userAgent(); + + bool platformPostInitialize(); + void platformDestroy(); + bool platformInvalidate(const WebCore::IntRect&); + void platformGeometryDidChange(); + void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); + + bool platformHandleMouseEvent(const WebMouseEvent&); + bool platformHandleWheelEvent(const WebWheelEvent&); + bool platformHandleMouseEnterEvent(const WebMouseEvent&); + bool platformHandleMouseLeaveEvent(const WebMouseEvent&); + bool platformHandleKeyboardEvent(const WebKeyboardEvent&); + void platformSetFocus(bool); + + // Plugin + virtual bool initialize(PluginController*, const Parameters&); + virtual void destroy(); + virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); +#if PLATFORM(MAC) + virtual PlatformLayer* pluginLayer(); +#endif + virtual void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect); + virtual void frameDidFinishLoading(uint64_t requestID); + virtual void frameDidFail(uint64_t requestID, bool wasCancelled); + virtual void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result); + virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers); + virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length); + virtual void streamDidFinishLoading(uint64_t streamID); + virtual void streamDidFail(uint64_t streamID, bool wasCancelled); + virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers); + virtual void manualStreamDidReceiveData(const char* bytes, int length); + virtual void manualStreamDidFinishLoading(); + virtual void manualStreamDidFail(bool wasCancelled); + + virtual bool handleMouseEvent(const WebMouseEvent&); + virtual bool handleWheelEvent(const WebWheelEvent&); + virtual bool handleMouseEnterEvent(const WebMouseEvent&); + virtual bool handleMouseLeaveEvent(const WebMouseEvent&); + virtual bool handleKeyboardEvent(const WebKeyboardEvent&); + virtual void setFocus(bool); + virtual NPObject* pluginScriptableNPObject(); + +#if PLATFORM(MAC) + virtual void windowFocusChanged(bool); + virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates); + virtual void windowVisibilityChanged(bool); + + virtual uint64_t pluginComplexTextInputIdentifier() const; + virtual void sendComplexTextInput(const String& textInput); +#endif + + virtual void privateBrowsingStateChanged(bool); + + virtual PluginController* controller(); + + PluginController* m_pluginController; + uint64_t m_nextRequestID; + + typedef HashMap<uint64_t, std::pair<String, void*> > PendingURLNotifyMap; + PendingURLNotifyMap m_pendingURLNotifications; + + typedef HashMap<uint64_t, RefPtr<NetscapePluginStream> > StreamsMap; + StreamsMap m_streams; + + RefPtr<NetscapePluginModule> m_pluginModule; + NPP_t m_npp; + NPWindow m_npWindow; + + WebCore::IntRect m_frameRect; + WebCore::IntRect m_clipRect; + + CString m_userAgent; + + bool m_isStarted; + bool m_isWindowed; + bool m_inNPPNew; + bool m_loadManually; + RefPtr<NetscapePluginStream> m_manualStream; + Vector<bool, 8> m_popupEnabledStates; + +#if PLATFORM(MAC) + NPDrawingModel m_drawingModel; + NPEventModel m_eventModel; + RetainPtr<PlatformLayer> m_pluginLayer; + + bool m_pluginHasFocus; + bool m_windowHasFocus; + + WebCore::IntRect m_windowFrameInScreenCoordinates; + WebCore::IntRect m_viewFrameInWindowCoordinates; + +#ifndef NP_NO_CARBON + void nullEventTimerFired(); + + // FIXME: It's a bit wasteful to have one null event timer per plug-in. + // We should investigate having one per window. + RunLoop::Timer<NetscapePlugin> m_nullEventTimer; + NP_CGContext m_npCGContext; +#endif +#elif PLATFORM(WIN) + HWND m_window; +#endif +}; + +} // namespace WebKit + +#endif // NetscapePlugin_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp new file mode 100644 index 0000000..be60795 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePluginStream.h" + +#include "NetscapePlugin.h" +#include <utility> + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +NetscapePluginStream::NetscapePluginStream(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, bool sendNotification, void* notificationData) + : m_plugin(plugin) + , m_streamID(streamID) + , m_sendNotification(sendNotification) + , m_notificationData(notificationData) + , m_npStream() + , m_transferMode(NP_NORMAL) + , m_offset(0) + , m_fileHandle(invalidPlatformFileHandle) + , m_isStarted(false) +#if !ASSERT_DISABLED + , m_urlNotifyHasBeenCalled(false) +#endif + , m_deliveryDataTimer(RunLoop::main(), this, &NetscapePluginStream::deliverDataToPlugin) + , m_stopStreamWhenDoneDelivering(false) +{ +} + +NetscapePluginStream::~NetscapePluginStream() +{ + ASSERT(!m_isStarted); + ASSERT(!m_sendNotification || m_urlNotifyHasBeenCalled); + ASSERT(m_fileHandle == invalidPlatformFileHandle); +} + +void NetscapePluginStream::didReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers) +{ + // Starting the stream could cause the plug-in stream to go away so we keep a reference to it here. + RefPtr<NetscapePluginStream> protect(this); + + start(responseURL, streamLength, lastModifiedTime, mimeType, headers); +} + +void NetscapePluginStream::didReceiveData(const char* bytes, int length) +{ + // Delivering the data could cause the plug-in stream to go away so we keep a reference to it here. + RefPtr<NetscapePluginStream> protect(this); + + deliverData(bytes, length); +} + +void NetscapePluginStream::didFinishLoading() +{ + // Stopping the stream could cause the plug-in stream to go away so we keep a reference to it here. + RefPtr<NetscapePluginStream> protect(this); + + stop(NPRES_DONE); +} + +void NetscapePluginStream::didFail(bool wasCancelled) +{ + // Stopping the stream could cause the plug-in stream to go away so we keep a reference to it here. + RefPtr<NetscapePluginStream> protect(this); + + stop(wasCancelled ? NPRES_USER_BREAK : NPRES_NETWORK_ERR); +} + +void NetscapePluginStream::sendJavaScriptStream(const String& requestURLString, const String& result) +{ + // starting the stream or delivering the data to it might cause the plug-in stream to go away, so we keep + // a reference to it here. + RefPtr<NetscapePluginStream> protect(this); + + CString resultCString = requestURLString.utf8(); + if (resultCString.isNull()) { + // There was an error evaluating the JavaScript, call NPP_URLNotify if needed and then destroy the stream. + notifyAndDestroyStream(NPRES_NETWORK_ERR); + return; + } + + if (!start(requestURLString, resultCString.length(), 0, "text/plain", "")) + return; + + deliverData(resultCString.data(), resultCString.length()); + stop(NPRES_DONE); +} + +NPError NetscapePluginStream::destroy(NPReason reason) +{ + // It doesn't make sense to call NPN_DestroyStream on a stream that hasn't been started yet. + if (!m_isStarted) + return NPERR_GENERIC_ERROR; + + // It isn't really valid for a plug-in to call NPN_DestroyStream with NPRES_DONE. + // (At least not for browser initiated streams, and we don't support plug-in initiated streams). + if (reason == NPRES_DONE) + return NPERR_INVALID_PARAM; + + cancel(); + stop(reason); + return NPERR_NO_ERROR; +} + +static bool isSupportedTransferMode(uint16_t transferMode) +{ + switch (transferMode) { + case NP_ASFILEONLY: + case NP_ASFILE: + case NP_NORMAL: + return true; + // FIXME: We don't support seekable streams. + case NP_SEEK: + return false; + } + + ASSERT_NOT_REACHED(); + return false; +} + +bool NetscapePluginStream::start(const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers) +{ + m_responseURL = responseURLString.utf8(); + m_mimeType = mimeType.utf8(); + m_headers = headers.utf8(); + + m_npStream.ndata = this; + m_npStream.url = m_responseURL.data(); + m_npStream.end = streamLength; + m_npStream.lastmodified = lastModifiedTime; + m_npStream.notifyData = m_notificationData; + m_npStream.headers = m_headers.length() == 0 ? 0 : m_headers.data(); + + NPError error = m_plugin->NPP_NewStream(const_cast<char*>(m_mimeType.data()), &m_npStream, false, &m_transferMode); + if (error != NPERR_NO_ERROR) { + // We failed to start the stream, cancel the load and destroy it. + cancel(); + notifyAndDestroyStream(NPRES_NETWORK_ERR); + return false; + } + + // We successfully started the stream. + m_isStarted = true; + + if (!isSupportedTransferMode(m_transferMode)) { + // Cancel the load and stop the stream. + cancel(); + stop(NPRES_NETWORK_ERR); + return false; + } + + return true; +} + +void NetscapePluginStream::deliverData(const char* bytes, int length) +{ + ASSERT(m_isStarted); + + if (m_transferMode != NP_ASFILEONLY) { + if (!m_deliveryData) + m_deliveryData.set(new Vector<uint8_t>); + + m_deliveryData->reserveCapacity(m_deliveryData->size() + length); + m_deliveryData->append(bytes, length); + + deliverDataToPlugin(); + } + + if (m_transferMode == NP_ASFILE || m_transferMode == NP_ASFILEONLY) + deliverDataToFile(bytes, length); +} + +void NetscapePluginStream::deliverDataToPlugin() +{ + ASSERT(m_isStarted); + + int32_t numBytesToDeliver = m_deliveryData->size(); + int32_t numBytesDelivered = 0; + + while (numBytesDelivered < numBytesToDeliver) { + int32_t numBytesPluginCanHandle = m_plugin->NPP_WriteReady(&m_npStream); + + // NPP_WriteReady could call NPN_DestroyStream and destroy the stream. + if (!m_isStarted) + return; + + if (numBytesPluginCanHandle <= 0) { + // The plug-in can't handle more data, we'll send the rest later + m_deliveryDataTimer.startOneShot(0); + break; + } + + // Figure out how much data to send to the plug-in. + int32_t dataLength = min(numBytesPluginCanHandle, numBytesToDeliver - numBytesDelivered); + uint8_t* data = m_deliveryData->data() + numBytesDelivered; + + int32_t numBytesWritten = m_plugin->NPP_Write(&m_npStream, m_offset, dataLength, data); + if (numBytesWritten < 0) { + stop(NPRES_NETWORK_ERR); + return; + } + + // NPP_Write could call NPN_DestroyStream and destroy the stream. + if (!m_isStarted) + return; + + numBytesWritten = min(numBytesWritten, dataLength); + m_offset += numBytesWritten; + numBytesDelivered += numBytesWritten; + } + + // We didn't write anything. + if (!numBytesDelivered) + return; + + if (numBytesDelivered < numBytesToDeliver) { + // Remove the bytes that we actually delivered. + m_deliveryData->remove(0, numBytesDelivered); + } else { + m_deliveryData->clear(); + + if (m_stopStreamWhenDoneDelivering) + stop(NPRES_DONE); + } +} + +void NetscapePluginStream::deliverDataToFile(const char* bytes, int length) +{ + if (m_fileHandle == invalidPlatformFileHandle && m_filePath.isNull()) { + // Create a temporary file. + m_filePath = openTemporaryFile("WebKitPluginStream", m_fileHandle); + + // We failed to open the file, stop the stream. + if (m_fileHandle == invalidPlatformFileHandle) { + stop(NPRES_NETWORK_ERR); + return; + } + } + + if (!length) + return; + + int byteCount = writeToFile(m_fileHandle, bytes, length); + if (byteCount != length) { + // This happens only rarely, when we are out of disk space or have a disk I/O error. + closeFile(m_fileHandle); + + stop(NPRES_NETWORK_ERR); + } +} + +void NetscapePluginStream::stop(NPReason reason) +{ + // The stream was stopped before it got a chance to start. This can happen if a stream is cancelled by + // WebKit before it received a response. + if (!m_isStarted) + return; + + if (reason == NPRES_DONE && m_deliveryData && !m_deliveryData->isEmpty()) { + // There is still data left that the plug-in hasn't been able to consume yet. + ASSERT(m_deliveryDataTimer.isActive()); + + // Set m_stopStreamWhenDoneDelivering to true so that the next time the delivery timer fires + // and calls deliverDataToPlugin the stream will be closed if all the remaining data was + // successfully delivered. + m_stopStreamWhenDoneDelivering = true; + return; + } + + m_deliveryData = 0; + m_deliveryDataTimer.stop(); + + if (m_transferMode == NP_ASFILE || m_transferMode == NP_ASFILEONLY) { + if (reason == NPRES_DONE) { + // Ensure that the file is created. + deliverDataToFile(0, 0); + if (m_fileHandle != invalidPlatformFileHandle) + closeFile(m_fileHandle); + + ASSERT(!m_filePath.isNull()); + + m_plugin->NPP_StreamAsFile(&m_npStream, m_filePath.data()); + } else { + // Just close the file. + if (m_fileHandle != invalidPlatformFileHandle) + closeFile(m_fileHandle); + } + + // Delete the file after calling NPP_StreamAsFile(), instead of in the destructor. It should be OK + // to delete the file here -- NPP_StreamAsFile() is always called immediately before NPP_DestroyStream() + // (the stream destruction function), so there can be no expectation that a plugin will read the stream + // file asynchronously after NPP_StreamAsFile() is called. + deleteFile(String::fromUTF8(m_filePath.data())); + m_filePath = CString(); + + // NPP_StreamAsFile could call NPN_DestroyStream and destroy the stream. + if (!m_isStarted) + return; + } + + // Set m_isStarted to false before calling NPP_DestroyStream in case NPP_DestroyStream calls NPN_DestroyStream. + m_isStarted = false; + + m_plugin->NPP_DestroyStream(&m_npStream, reason); + + notifyAndDestroyStream(reason); +} + +void NetscapePluginStream::cancel() +{ + m_plugin->cancelStreamLoad(this); +} + +void NetscapePluginStream::notifyAndDestroyStream(NPReason reason) +{ + ASSERT(!m_isStarted); + ASSERT(!m_deliveryDataTimer.isActive()); + ASSERT(!m_urlNotifyHasBeenCalled); + + if (m_sendNotification) { + m_plugin->NPP_URLNotify(m_responseURL.data(), reason, m_notificationData); + +#if !ASSERT_DISABLED + m_urlNotifyHasBeenCalled = true; +#endif + } + + m_plugin->removePluginStream(this); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h new file mode 100644 index 0000000..7757001 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h @@ -0,0 +1,112 @@ +/* + * 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 NetscapePluginStream_h +#define NetscapePluginStream_h + +#include "RunLoop.h" +#include <WebCore/FileSystem.h> +#include <WebCore/npruntime_internal.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/text/CString.h> + +namespace WebCore { + class KURL; +} + +namespace WebKit { + +class NetscapePlugin; + +class NetscapePluginStream : public RefCounted<NetscapePluginStream> { +public: + static PassRefPtr<NetscapePluginStream> create(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, bool sendNotification, void* notificationData) + { + return adoptRef(new NetscapePluginStream(plugin, streamID, sendNotification, notificationData)); + } + ~NetscapePluginStream(); + + uint64_t streamID() const { return m_streamID; } + const NPStream* npStream() const { return &m_npStream; } + + void didReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers); + void didReceiveData(const char* bytes, int length); + void didFinishLoading(); + void didFail(bool wasCancelled); + + void sendJavaScriptStream(const String& requestURLString, const String& result); + + void stop(NPReason); + NPError destroy(NPReason); + +private: + NetscapePluginStream(PassRefPtr<NetscapePlugin>, uint64_t streamID, bool sendNotification, void* notificationData); + + bool start(const String& responseURLString, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers); + + void cancel(); + void notifyAndDestroyStream(NPReason); + + void deliverData(const char* bytes, int length); + void deliverDataToPlugin(); + void deliverDataToFile(const char* bytes, int length); + + RefPtr<NetscapePlugin> m_plugin; + uint64_t m_streamID; + + bool m_sendNotification; + void* m_notificationData; + + NPStream m_npStream; + uint16_t m_transferMode; + int32_t m_offset; + + CString m_filePath; + WebCore::PlatformFileHandle m_fileHandle; + + // Whether NPP_NewStream has successfully been called. + bool m_isStarted; + +#if !ASSERT_DISABLED + bool m_urlNotifyHasBeenCalled; +#endif + + CString m_responseURL; + CString m_mimeType; + CString m_headers; + + RunLoop::Timer<NetscapePluginStream> m_deliveryDataTimer; + OwnPtr< Vector<uint8_t> > m_deliveryData; + bool m_stopStreamWhenDoneDelivering; +}; + +} // namespace WebKit + +#endif // NetscapePluginStream_h diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp new file mode 100644 index 0000000..64239f3 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/gtk/NetscapePluginGtk.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePlugin.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +bool NetscapePlugin::platformPostInitialize() +{ + notImplemented(); + return true; +} + +void NetscapePlugin::platformDestroy() +{ + notImplemented(); +} + +bool NetscapePlugin::platformInvalidate(const IntRect&) +{ + notImplemented(); + return false; +} + +void NetscapePlugin::platformGeometryDidChange() +{ + notImplemented(); +} + +void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect) +{ + notImplemented(); +} + +NPEvent toNP(const WebMouseEvent& event) +{ + NPEvent npEvent = NPEvent(); + notImplemented(); + return npEvent; +} + +bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event) +{ + notImplemented(); + return true; +} + +bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) +{ + notImplemented(); + return false; +} + +void NetscapePlugin::platformSetFocus(bool) +{ + notImplemented(); +} + +bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event) +{ + notImplemented(); + return true; +} + +bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event) +{ + notImplemented(); + return true; +} + +bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent&) +{ + notImplemented(); + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm new file mode 100644 index 0000000..1240ed7 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm @@ -0,0 +1,903 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePlugin.h" + +#include "PluginController.h" +#include "WebEvent.h" +#include <WebCore/GraphicsContext.h> +#include <Carbon/Carbon.h> +#include <WebKitSystemInterface.h> + +using namespace WebCore; + +namespace WebKit { + +#ifndef NP_NO_CARBON +static const double nullEventIntervalActive = 0.02; +static const double nullEventIntervalNotActive = 0.25; + +static unsigned buttonStateFromLastMouseEvent; + +#endif + +NPError NetscapePlugin::setDrawingModel(NPDrawingModel drawingModel) +{ + // The drawing model can only be set from NPP_New. + if (!m_inNPPNew) + return NPERR_GENERIC_ERROR; + + switch (drawingModel) { +#ifndef NP_NO_QUICKDRAW + case NPDrawingModelQuickDraw: +#endif + case NPDrawingModelCoreGraphics: + case NPDrawingModelCoreAnimation: + m_drawingModel = drawingModel; + break; + + default: + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; +} + +NPError NetscapePlugin::setEventModel(NPEventModel eventModel) +{ + // The event model can only be set from NPP_New. + if (!m_inNPPNew) + return NPERR_GENERIC_ERROR; + + switch (eventModel) { +#ifndef NP_NO_CARBON + case NPEventModelCarbon: +#endif + case NPEventModelCocoa: + m_eventModel = eventModel; + break; + + default: + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; +} + +static double flipScreenYCoordinate(double y) +{ + return [[[NSScreen screens] objectAtIndex:0] frame].size.height - y; +} + +NPBool NetscapePlugin::convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace) +{ + if (sourceSpace == destSpace) { + destX = sourceX; + destY = sourceY; + return true; + } + + double sourceXInScreenSpace; + double sourceYInScreenSpace; + + FloatPoint sourceInScreenSpace; + switch (sourceSpace) { + case NPCoordinateSpacePlugin: + sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x() + m_viewFrameInWindowCoordinates.x() + m_npWindow.x; + sourceYInScreenSpace = m_windowFrameInScreenCoordinates.y() + m_viewFrameInWindowCoordinates.y() + m_viewFrameInWindowCoordinates.height() - (sourceY + m_npWindow.y); + break; + case NPCoordinateSpaceWindow: + sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x(); + sourceYInScreenSpace = sourceY + m_windowFrameInScreenCoordinates.y(); + break; + case NPCoordinateSpaceFlippedWindow: + sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x(); + sourceYInScreenSpace = m_windowFrameInScreenCoordinates.y() + m_windowFrameInScreenCoordinates.height() - sourceY; + break; + case NPCoordinateSpaceScreen: + sourceXInScreenSpace = sourceX; + sourceYInScreenSpace = sourceY; + break; + case NPCoordinateSpaceFlippedScreen: + sourceXInScreenSpace = sourceX; + sourceYInScreenSpace = flipScreenYCoordinate(sourceY); + default: + return false; + } + + // Now convert back. + switch (destSpace) { + case NPCoordinateSpacePlugin: + destX = sourceXInScreenSpace - (m_windowFrameInScreenCoordinates.x() + m_viewFrameInWindowCoordinates.x() + m_npWindow.x); + destY = m_windowFrameInScreenCoordinates.y() + m_viewFrameInWindowCoordinates.y() + m_viewFrameInWindowCoordinates.height() - (sourceYInScreenSpace + m_npWindow.y); + break; + case NPCoordinateSpaceWindow: + destX = sourceXInScreenSpace - m_windowFrameInScreenCoordinates.x(); + destY = sourceYInScreenSpace - m_windowFrameInScreenCoordinates.y(); + break; + case NPCoordinateSpaceFlippedWindow: + destX = sourceXInScreenSpace - m_windowFrameInScreenCoordinates.x(); + destY = sourceYInScreenSpace - m_windowFrameInScreenCoordinates.y(); + destY = m_windowFrameInScreenCoordinates.height() - destY; + break; + case NPCoordinateSpaceScreen: + destX = sourceXInScreenSpace; + destY = sourceYInScreenSpace; + break; + case NPCoordinateSpaceFlippedScreen: + destX = sourceXInScreenSpace; + destY = flipScreenYCoordinate(sourceYInScreenSpace); + break; + default: + return false; + } + + return true; +} + +#ifndef NP_NO_CARBON +typedef HashMap<WindowRef, NetscapePlugin*> WindowMap; + +static WindowMap& windowMap() +{ + DEFINE_STATIC_LOCAL(WindowMap, windowMap, ()); + + return windowMap; +} +#endif + +bool NetscapePlugin::platformPostInitialize() +{ + if (m_drawingModel == static_cast<NPDrawingModel>(-1)) { +#ifndef NP_NO_QUICKDRAW + // Default to QuickDraw if the plugin did not specify a drawing model. + m_drawingModel = NPDrawingModelQuickDraw; +#else + // QuickDraw is not available, so we can't default to it. Instead, default to CoreGraphics. + m_drawingModel = NPDrawingModelCoreGraphics; +#endif + } + + if (m_eventModel == static_cast<NPEventModel>(-1)) { + // If the plug-in did not specify a drawing model we default to Carbon when it is available. +#ifndef NP_NO_CARBON + m_eventModel = NPEventModelCarbon; +#else + m_eventModel = NPEventModelCocoa; +#endif // NP_NO_CARBON + } + +#if !defined(NP_NO_CARBON) && !defined(NP_NO_QUICKDRAW) + // The CA drawing model does not work with the Carbon event model. + if (m_drawingModel == NPDrawingModelCoreAnimation && m_eventModel == NPEventModelCarbon) + return false; + + // The Cocoa event model does not work with the QuickDraw drawing model. + if (m_eventModel == NPEventModelCocoa && m_drawingModel == NPDrawingModelQuickDraw) + return false; +#endif + +#ifndef NP_NO_QUICKDRAW + // Right now we don't support the QuickDraw drawing model at all + if (m_drawingModel == NPDrawingModelQuickDraw) + return false; +#endif + + if (m_drawingModel == NPDrawingModelCoreAnimation) { + void* value = 0; + // Get the Core Animation layer. + if (NPP_GetValue(NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) { + ASSERT(!m_pluginLayer); + m_pluginLayer = reinterpret_cast<CALayer *>(value); + } + } + +#ifndef NP_NO_CARBON + if (m_eventModel == NPEventModelCarbon) { + // Initialize the fake Carbon window. + ::Rect bounds = { 0, 0, 0, 0 }; + CreateNewWindow(kDocumentWindowClass, kWindowNoTitleBarAttribute, &bounds, reinterpret_cast<WindowRef*>(&m_npCGContext.window)); + ASSERT(m_npCGContext.window); + + // FIXME: Disable the backing store. + + m_npWindow.window = &m_npCGContext; + + ASSERT(!windowMap().contains(windowRef())); + windowMap().set(windowRef(), this); + + // Start the null event timer. + // FIXME: Throttle null events when the plug-in isn't visible on screen. + m_nullEventTimer.startRepeating(nullEventIntervalActive); + } +#endif + + return true; +} + +void NetscapePlugin::platformDestroy() +{ +#ifndef NP_NO_CARBON + if (m_eventModel == NPEventModelCarbon) { + if (WindowRef window = windowRef()) { + // Destroy the fake Carbon window. + DisposeWindow(window); + + ASSERT(windowMap().contains(window)); + windowMap().remove(window); + } + + // Stop the null event timer. + m_nullEventTimer.stop(); + } +#endif +} + +bool NetscapePlugin::platformInvalidate(const IntRect&) +{ + return false; +} + +void NetscapePlugin::platformGeometryDidChange() +{ +} + +static inline NPCocoaEvent initializeEvent(NPCocoaEventType type) +{ + NPCocoaEvent event; + + event.type = type; + event.version = 0; + + return event; +} + +#ifndef NP_NO_CARBON +NetscapePlugin* NetscapePlugin::netscapePluginFromWindow(WindowRef windowRef) +{ + return windowMap().get(windowRef); +} + +WindowRef NetscapePlugin::windowRef() const +{ + ASSERT(m_eventModel == NPEventModelCarbon); + + return reinterpret_cast<WindowRef>(m_npCGContext.window); +} + +unsigned NetscapePlugin::buttonState() +{ + return buttonStateFromLastMouseEvent; +} + +static inline EventRecord initializeEventRecord(EventKind eventKind) +{ + EventRecord eventRecord; + + eventRecord.what = eventKind; + eventRecord.message = 0; + eventRecord.when = TickCount(); + eventRecord.where = Point(); + eventRecord.modifiers = 0; + + return eventRecord; +} + +static bool anyMouseButtonIsDown(const WebEvent& event) +{ + if (event.type() == WebEvent::MouseDown) + return true; + + if (event.type() == WebEvent::MouseMove && static_cast<const WebMouseEvent&>(event).button() != WebMouseEvent::NoButton) + return true; + + return false; +} + +static bool rightMouseButtonIsDown(const WebEvent& event) +{ + if (event.type() == WebEvent::MouseDown && static_cast<const WebMouseEvent&>(event).button() == WebMouseEvent::RightButton) + return true; + + if (event.type() == WebEvent::MouseMove && static_cast<const WebMouseEvent&>(event).button() == WebMouseEvent::RightButton) + return true; + + return false; +} + +static EventModifiers modifiersForEvent(const WebEvent& event) +{ + EventModifiers modifiers = 0; + + // We only want to set the btnState if a mouse button is _not_ down. + if (!anyMouseButtonIsDown(event)) + modifiers |= btnState; + + if (event.metaKey()) + modifiers |= cmdKey; + + if (event.shiftKey()) + modifiers |= shiftKey; + + if (event.altKey()) + modifiers |= optionKey; + + // Set controlKey if the control key is down or the right mouse button is down. + if (event.controlKey() || rightMouseButtonIsDown(event)) + modifiers |= controlKey; + + return modifiers; +} + +#endif + +void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect) +{ + CGContextRef platformContext = context->platformContext(); + + // Translate the context so that the origin is at the top left corner of the plug-in view. + context->translate(m_frameRect.x(), m_frameRect.y()); + + switch (m_eventModel) { + case NPEventModelCocoa: { + // Don't send draw events when we're using the Core Animation drawing model. + if (m_drawingModel == NPDrawingModelCoreAnimation) + return; + + NPCocoaEvent event = initializeEvent(NPCocoaEventDrawRect); + + event.data.draw.context = platformContext; + event.data.draw.x = dirtyRect.x() - m_frameRect.x(); + event.data.draw.y = dirtyRect.y() - m_frameRect.y(); + event.data.draw.width = dirtyRect.width(); + event.data.draw.height = dirtyRect.height(); + + NPP_HandleEvent(&event); + break; + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + if (platformContext != m_npCGContext.context) { + m_npCGContext.context = platformContext; + callSetWindow(); + } + + EventRecord event = initializeEventRecord(updateEvt); + event.message = reinterpret_cast<unsigned long>(windowRef()); + + NPP_HandleEvent(&event); + break; + } +#endif + + default: + ASSERT_NOT_REACHED(); + } +} + +static uint32_t modifierFlags(const WebEvent& event) +{ + uint32_t modifiers = 0; + + if (event.shiftKey()) + modifiers |= NSShiftKeyMask; + if (event.controlKey()) + modifiers |= NSControlKeyMask; + if (event.altKey()) + modifiers |= NSAlternateKeyMask; + if (event.metaKey()) + modifiers |= NSCommandKeyMask; + + return modifiers; +} + +static int32_t buttonNumber(WebMouseEvent::Button button) +{ + switch (button) { + case WebMouseEvent::NoButton: + case WebMouseEvent::LeftButton: + return 0; + case WebMouseEvent::RightButton: + return 1; + case WebMouseEvent::MiddleButton: + return 2; + } + + ASSERT_NOT_REACHED(); + return -1; +} + +static void fillInCocoaEventFromMouseEvent(NPCocoaEvent& event, const WebMouseEvent& mouseEvent, const WebCore::IntPoint& pluginLocation) +{ + event.data.mouse.modifierFlags = modifierFlags(mouseEvent); + event.data.mouse.pluginX = mouseEvent.position().x() - pluginLocation.x(); + event.data.mouse.pluginY = mouseEvent.position().y() - pluginLocation.y(); + event.data.mouse.buttonNumber = buttonNumber(mouseEvent.button()); + event.data.mouse.clickCount = mouseEvent.clickCount(); + event.data.mouse.deltaX = mouseEvent.deltaX(); + event.data.mouse.deltaY = mouseEvent.deltaY(); + event.data.mouse.deltaZ = mouseEvent.deltaZ(); +} + +static NPCocoaEvent initializeMouseEvent(const WebMouseEvent& mouseEvent, const WebCore::IntPoint& pluginLocation) +{ + NPCocoaEventType eventType; + + switch (mouseEvent.type()) { + case WebEvent::MouseDown: + eventType = NPCocoaEventMouseDown; + break; + case WebEvent::MouseUp: + eventType = NPCocoaEventMouseUp; + break; + case WebEvent::MouseMove: + if (mouseEvent.button() == WebMouseEvent::NoButton) + eventType = NPCocoaEventMouseMoved; + else + eventType = NPCocoaEventMouseDragged; + break; + default: + ASSERT_NOT_REACHED(); + return NPCocoaEvent(); + } + + NPCocoaEvent event = initializeEvent(eventType); + fillInCocoaEventFromMouseEvent(event, mouseEvent, pluginLocation); + return event; +} + +bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent) +{ + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeMouseEvent(mouseEvent, m_frameRect.location()); + return NPP_HandleEvent(&event); + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + EventKind eventKind = nullEvent; + + switch (mouseEvent.type()) { + case WebEvent::MouseDown: + eventKind = mouseDown; + buttonStateFromLastMouseEvent |= (1 << buttonNumber(mouseEvent.button())); + break; + case WebEvent::MouseUp: + eventKind = mouseUp; + buttonStateFromLastMouseEvent &= ~(1 << buttonNumber(mouseEvent.button())); + break; + case WebEvent::MouseMove: + eventKind = nullEvent; + break; + default: + ASSERT_NOT_REACHED(); + } + + EventRecord event = initializeEventRecord(eventKind); + event.modifiers = modifiersForEvent(mouseEvent); + event.where.h = mouseEvent.globalPosition().x(); + event.where.v = mouseEvent.globalPosition().y(); + + return NPP_HandleEvent(&event); + } +#endif + + default: + ASSERT_NOT_REACHED(); + } + + return false; +} + +bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent& wheelEvent) +{ + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventScrollWheel); + + event.data.mouse.modifierFlags = modifierFlags(wheelEvent); + event.data.mouse.pluginX = wheelEvent.position().x() - m_frameRect.x(); + event.data.mouse.pluginY = wheelEvent.position().y() - m_frameRect.y(); + event.data.mouse.buttonNumber = 0; + event.data.mouse.clickCount = 0; + event.data.mouse.deltaX = wheelEvent.delta().width(); + event.data.mouse.deltaY = wheelEvent.delta().height(); + event.data.mouse.deltaZ = 0; + return NPP_HandleEvent(&event); + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: + // Carbon doesn't have wheel events. + break; +#endif + + default: + ASSERT_NOT_REACHED(); + } + + return false; +} + +bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& mouseEvent) +{ + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventMouseEntered); + + fillInCocoaEventFromMouseEvent(event, mouseEvent, m_frameRect.location()); + return NPP_HandleEvent(&event); + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + EventRecord eventRecord = initializeEventRecord(NPEventType_AdjustCursorEvent); + eventRecord.modifiers = modifiersForEvent(mouseEvent); + + return NPP_HandleEvent(&eventRecord); + } +#endif + + default: + ASSERT_NOT_REACHED(); + } + + return false; +} + +bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& mouseEvent) +{ + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventMouseExited); + + fillInCocoaEventFromMouseEvent(event, mouseEvent, m_frameRect.location()); + return NPP_HandleEvent(&event); + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + EventRecord eventRecord = initializeEventRecord(NPEventType_AdjustCursorEvent); + eventRecord.modifiers = modifiersForEvent(mouseEvent); + + return NPP_HandleEvent(&eventRecord); + } +#endif + + default: + ASSERT_NOT_REACHED(); + } + + return false; +} + +static unsigned modifierFlags(const WebKeyboardEvent& keyboardEvent) +{ + unsigned modifierFlags = 0; + + if (keyboardEvent.shiftKey()) + modifierFlags |= NSShiftKeyMask; + if (keyboardEvent.controlKey()) + modifierFlags |= NSControlKeyMask; + if (keyboardEvent.altKey()) + modifierFlags |= NSAlternateKeyMask; + if (keyboardEvent.metaKey()) + modifierFlags |= NSCommandKeyMask; + + return modifierFlags; +} + +static NPCocoaEvent initializeKeyboardEvent(const WebKeyboardEvent& keyboardEvent) +{ + NPCocoaEventType eventType; + + switch (keyboardEvent.type()) { + case WebEvent::KeyDown: + eventType = NPCocoaEventKeyDown; + break; + case WebEvent::KeyUp: + eventType = NPCocoaEventKeyUp; + break; + default: + ASSERT_NOT_REACHED(); + return NPCocoaEvent(); + } + + NPCocoaEvent event = initializeEvent(eventType); + event.data.key.modifierFlags = modifierFlags(keyboardEvent); + event.data.key.characters = reinterpret_cast<NPNSString*>(static_cast<NSString*>(keyboardEvent.text())); + event.data.key.charactersIgnoringModifiers = reinterpret_cast<NPNSString*>(static_cast<NSString*>(keyboardEvent.unmodifiedText())); + event.data.key.isARepeat = keyboardEvent.isAutoRepeat(); + event.data.key.keyCode = keyboardEvent.nativeVirtualKeyCode(); + + return event; +} + +bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent& keyboardEvent) +{ + bool handled = false; + + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeKeyboardEvent(keyboardEvent); + handled = NPP_HandleEvent(&event); + break; + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + EventKind eventKind = nullEvent; + + switch (keyboardEvent.type()) { + case WebEvent::KeyDown: + eventKind = keyboardEvent.isAutoRepeat() ? autoKey : keyDown; + break; + case WebEvent::KeyUp: + eventKind = keyUp; + break; + default: + ASSERT_NOT_REACHED(); + } + + EventRecord event = initializeEventRecord(eventKind); + event.modifiers = modifiersForEvent(keyboardEvent); + event.message = keyboardEvent.nativeVirtualKeyCode() << 8 | keyboardEvent.macCharCode(); + handled = NPP_HandleEvent(&event); + break; + } +#endif + + default: + ASSERT_NOT_REACHED(); + } + + // Most plug-ins simply return true for all keyboard events, even those that aren't handled. + // This leads to bugs such as <rdar://problem/8740926>. We work around this by returning false + // if the keyboard event has the command modifier pressed. + if (keyboardEvent.metaKey()) + return false; + + return handled; +} + +void NetscapePlugin::platformSetFocus(bool hasFocus) +{ + m_pluginHasFocus = hasFocus; + m_pluginController->setComplexTextInputEnabled(m_pluginHasFocus && m_windowHasFocus); + + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventFocusChanged); + + event.data.focus.hasFocus = hasFocus; + NPP_HandleEvent(&event); + break; + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + EventRecord event = initializeEventRecord(hasFocus ? NPEventType_GetFocusEvent : NPEventType_LoseFocusEvent); + + NPP_HandleEvent(&event); + break; + } +#endif + + default: + ASSERT_NOT_REACHED(); + } +} + +void NetscapePlugin::windowFocusChanged(bool hasFocus) +{ + m_windowHasFocus = hasFocus; + m_pluginController->setComplexTextInputEnabled(m_pluginHasFocus && m_windowHasFocus); + + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventWindowFocusChanged); + + event.data.focus.hasFocus = hasFocus; + NPP_HandleEvent(&event); + break; + } + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + HiliteWindow(windowRef(), hasFocus); + if (hasFocus) + SetUserFocusWindow(windowRef()); + + EventRecord event = initializeEventRecord(activateEvt); + event.message = reinterpret_cast<unsigned long>(windowRef()); + if (hasFocus) + event.modifiers |= activeFlag; + + NPP_HandleEvent(&event); + break; + } +#endif + + default: + ASSERT_NOT_REACHED(); + } +} + +#ifndef NP_NO_CARBON +static Rect computeFakeWindowBoundsRect(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates) +{ + // 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(); + + Rect bounds; + + bounds.top = flippedWindowFrameYCoordinate + flippedViewFrameYCoordinate; + bounds.left = windowFrameInScreenCoordinates.x(); + bounds.right = bounds.left + viewFrameInWindowCoordinates.width(); + bounds.bottom = bounds.top + viewFrameInWindowCoordinates.height(); + + return bounds; +} +#endif + +void NetscapePlugin::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates) +{ + m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates; + m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates; + + switch (m_eventModel) { + case NPEventModelCocoa: + // Nothing to do. + break; + +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + Rect bounds = computeFakeWindowBoundsRect(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates); + + ::SetWindowBounds(windowRef(), kWindowStructureRgn, &bounds); + break; + } +#endif + + default: + ASSERT_NOT_REACHED(); + } +} + +void NetscapePlugin::windowVisibilityChanged(bool) +{ + // FIXME: Implement. +} + +uint64_t NetscapePlugin::pluginComplexTextInputIdentifier() const +{ + // This is never called for NetscapePlugin. + ASSERT_NOT_REACHED(); + return 0; +} + + +#ifndef NP_NO_CARBON +static bool convertStringToKeyCodes(const String& string, ScriptCode scriptCode, Vector<UInt8>& keyCodes) +{ + // Create the mapping. + UnicodeMapping mapping; + + if (GetTextEncodingFromScriptInfo(scriptCode, kTextLanguageDontCare, kTextRegionDontCare, &mapping.otherEncoding) != noErr) + return false; + + mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault, kTextEncodingDefaultVariant, kTextEncodingDefaultFormat); + mapping.mappingVersion = kUnicodeUseLatestMapping; + + // Create the converter + UnicodeToTextInfo textInfo; + + if (CreateUnicodeToTextInfo(&mapping, &textInfo) != noErr) + return false; + + ByteCount inputLength = string.length() * sizeof(UniChar); + ByteCount inputRead; + ByteCount outputLength; + ByteCount maxOutputLength = string.length() * sizeof(UniChar); + + Vector<UInt8> outputData(maxOutputLength); + OSStatus status = ConvertFromUnicodeToText(textInfo, inputLength, string.characters(), kNilOptions, 0, 0, 0, 0, maxOutputLength, &inputRead, &outputLength, outputData.data()); + + DisposeUnicodeToTextInfo(&textInfo); + + if (status != noErr) + return false; + + outputData.swap(keyCodes); + return true; +} +#endif + +void NetscapePlugin::sendComplexTextInput(const String& textInput) +{ + switch (m_eventModel) { + case NPEventModelCocoa: { + NPCocoaEvent event = initializeEvent(NPCocoaEventTextInput); + event.data.text.text = reinterpret_cast<NPNSString*>(static_cast<NSString*>(textInput)); + NPP_HandleEvent(&event); + break; + } +#ifndef NP_NO_CARBON + case NPEventModelCarbon: { + ScriptCode scriptCode = WKGetScriptCodeFromCurrentKeyboardInputSource(); + Vector<UInt8> keyCodes; + + if (!convertStringToKeyCodes(textInput, scriptCode, keyCodes)) + return; + + // Set the script code as the keyboard script. Normally Carbon does this whenever the input source changes. + // However, this is only done for the process that has the keyboard focus. We cheat and do it here instead. + SetScriptManagerVariable(smKeyScript, scriptCode); + + EventRecord event = initializeEventRecord(keyDown); + event.modifiers = 0; + + for (size_t i = 0; i < keyCodes.size(); i++) { + event.message = keyCodes[i]; + NPP_HandleEvent(&event); + } + break; + } +#endif + default: + ASSERT_NOT_REACHED(); + } +} + +PlatformLayer* NetscapePlugin::pluginLayer() +{ + return static_cast<PlatformLayer*>(m_pluginLayer.get()); +} + +#ifndef NP_NO_CARBON +void NetscapePlugin::nullEventTimerFired() +{ + EventRecord event = initializeEventRecord(nullEvent); + + event.message = 0; + CGPoint mousePosition; + HIGetMousePosition(kHICoordSpaceScreenPixel, 0, &mousePosition); + event.where.h = mousePosition.x; + event.where.v = mousePosition.y; + + event.modifiers = GetCurrentKeyModifiers(); + if (!Button()) + event.modifiers |= btnState; + + NPP_HandleEvent(&event); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm new file mode 100644 index 0000000..6ecf7b9 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProxy.h" + +#include <WebKitSystemInterface.h> + +namespace WebKit { + +PlatformLayer* PluginProxy::pluginLayer() +{ + if (!m_pluginLayer && m_remoteLayerClientID) + m_pluginLayer = WKMakeRenderLayer(m_remoteLayerClientID); + + return m_pluginLayer.get(); +} + +bool PluginProxy::needsBackingStore() const +{ + return !m_remoteLayerClientID; +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp new file mode 100644 index 0000000..77efc01 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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. + */ + +#include "NetscapePlugin.h" + +#include "NotImplemented.h" +#include "WebEvent.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +bool NetscapePlugin::platformPostInitialize() +{ + notImplemented(); + return true; +} + +void NetscapePlugin::platformDestroy() +{ + notImplemented(); +} + +bool NetscapePlugin::platformInvalidate(const IntRect&) +{ + notImplemented(); + return false; +} + +void NetscapePlugin::platformGeometryDidChange() +{ + notImplemented(); +} + +void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect) +{ + notImplemented(); +} + +NPEvent toNP(const WebMouseEvent& event) +{ +#if OS(SYMBIAN) + NPEvent npEvent = QEvent(QEvent::None); +#else + NPEvent npEvent = NPEvent(); +#endif + + notImplemented(); + + return npEvent; +} + +bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) +{ + notImplemented(); + return false; +} + +void NetscapePlugin::platformSetFocus(bool) +{ + notImplemented(); +} + +bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent&) +{ + notImplemented(); + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp new file mode 100644 index 0000000..930f87b --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp @@ -0,0 +1,293 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "NetscapePlugin.h" + +#include "NotImplemented.h" +#include "PluginController.h" +#include "WebEvent.h" +#include <WebCore/GraphicsContext.h> +#include <WebCore/LocalWindowsContext.h> + +using namespace WebCore; + +extern "C" HINSTANCE gInstance; + +namespace WebKit { + +static LPCWSTR windowClassName = L"org.webkit.NetscapePluginWindow"; + +static void registerPluginView() +{ + static bool didRegister; + if (didRegister) + return; + didRegister = true; + + WNDCLASSW windowClass = {0}; + windowClass.style = CS_DBLCLKS; + windowClass.lpfnWndProc = ::DefWindowProcW; + windowClass.hInstance = gInstance; + windowClass.hCursor = ::LoadCursorW(0, IDC_ARROW); + windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1); + windowClass.lpszClassName = windowClassName; + + ::RegisterClassW(&windowClass); +} + +HWND NetscapePlugin::containingWindow() const +{ + return m_pluginController->nativeParentWindow(); +} + +bool NetscapePlugin::platformPostInitialize() +{ + if (!m_isWindowed) { + m_window = 0; + return true; + } + + registerPluginView(); + + m_window = ::CreateWindowExW(0, windowClassName, 0, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, containingWindow(), 0, 0, 0); + if (!m_window) + return false; + + // FIXME: Do we need to pass our window to setPlatformWidget? + // FIXME: WebCore::PluginView sets the window proc to DefWindowProcA here for Shockwave Director. + + m_npWindow.type = NPWindowTypeWindow; + m_npWindow.window = m_window; + + return true; +} + +void NetscapePlugin::platformDestroy() +{ + if (!m_isWindowed) { + ASSERT(!m_window); + return; + } + + if (!::IsWindow(m_window)) + return; + ::DestroyWindow(m_window); +} + +bool NetscapePlugin::platformInvalidate(const IntRect& invalidRect) +{ + if (!m_isWindowed) + return false; + + RECT rect = invalidRect; + ::InvalidateRect(m_window, &rect, FALSE); + return true; +} + +enum RedrawOrNot { DoNotRedraw, Redraw }; +static void setWindowRegion(HWND window, PassOwnPtr<HRGN> popRegion, RedrawOrNot redrawOrNot) +{ + OwnPtr<HRGN> region = popRegion; + + if (!::SetWindowRgn(window, region.get(), redrawOrNot == Redraw)) + return; + + // Windows owns the region now. + region.leakPtr(); +} + +void NetscapePlugin::platformGeometryDidChange() +{ + if (!m_isWindowed) + return; + + 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())); + setWindowRegion(m_window, clipRegion.release(), Redraw); + + // FIXME: We should only update the size here and let the UI process update our position so + // that we can keep our position in sync when scrolling, etc. + ::MoveWindow(m_window, m_frameRect.x(), m_frameRect.y(), m_frameRect.width(), m_frameRect.height(), TRUE); +} + +void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect) +{ + // FIXME: Call SetWindow here if we haven't called it yet (see r59904). + + if (m_isWindowed) { + // FIXME: Paint windowed plugins into context if context->shouldIncludeChildWindows() is true. + return; + } + + // FIXME: Support transparent plugins. + LocalWindowsContext windowsContext(context, dirtyRect, false); + + m_npWindow.type = NPWindowTypeDrawable; + m_npWindow.window = windowsContext.hdc(); + + WINDOWPOS windowpos = { 0, 0, 0, 0, 0, 0, 0 }; + + windowpos.x = m_frameRect.x(); + windowpos.y = m_frameRect.y(); + windowpos.cx = m_frameRect.width(); + windowpos.cy = m_frameRect.height(); + + NPEvent npEvent; + npEvent.event = WM_WINDOWPOSCHANGED; + npEvent.wParam = 0; + npEvent.lParam = reinterpret_cast<uintptr_t>(&windowpos); + + NPP_HandleEvent(&npEvent); + + callSetWindow(); + + RECT dirtyWinRect = dirtyRect; + + npEvent.event = WM_PAINT; + npEvent.wParam = reinterpret_cast<uintptr_t>(windowsContext.hdc()); + npEvent.lParam = reinterpret_cast<uintptr_t>(&dirtyWinRect); + + NPP_HandleEvent(&npEvent); +} + +NPEvent toNP(const WebMouseEvent& event) +{ + NPEvent npEvent; + + npEvent.wParam = 0; + if (event.controlKey()) + npEvent.wParam |= MK_CONTROL; + if (event.shiftKey()) + npEvent.wParam |= MK_SHIFT; + + npEvent.lParam = MAKELPARAM(event.position().x(), event.position().y()); + + switch (event.type()) { + case WebEvent::MouseMove: + npEvent.event = WM_MOUSEMOVE; + switch (event.button()) { + case WebMouseEvent::LeftButton: + npEvent.wParam |= MK_LBUTTON; + break; + case WebMouseEvent::MiddleButton: + npEvent.wParam |= MK_MBUTTON; + break; + case WebMouseEvent::RightButton: + npEvent.wParam |= MK_RBUTTON; + break; + case WebMouseEvent::NoButton: + break; + } + break; + case WebEvent::MouseDown: + switch (event.button()) { + case WebMouseEvent::LeftButton: + npEvent.event = WM_LBUTTONDOWN; + break; + case WebMouseEvent::MiddleButton: + npEvent.event = WM_MBUTTONDOWN; + break; + case WebMouseEvent::RightButton: + npEvent.event = WM_RBUTTONDOWN; + break; + case WebMouseEvent::NoButton: + ASSERT_NOT_REACHED(); + break; + } + break; + case WebEvent::MouseUp: + switch (event.button()) { + case WebMouseEvent::LeftButton: + npEvent.event = WM_LBUTTONUP; + break; + case WebMouseEvent::MiddleButton: + npEvent.event = WM_MBUTTONUP; + break; + case WebMouseEvent::RightButton: + npEvent.event = WM_RBUTTONUP; + break; + case WebMouseEvent::NoButton: + ASSERT_NOT_REACHED(); + break; + } + break; + default: + ASSERT_NOT_REACHED(); + break; + } + + return npEvent; +} + +bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) +{ + notImplemented(); + return false; +} + +void NetscapePlugin::platformSetFocus(bool) +{ + notImplemented(); +} + +bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event) +{ + if (m_isWindowed) + return false; + + NPEvent npEvent = toNP(event); + NPP_HandleEvent(&npEvent); + return true; +} + +bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent&) +{ + notImplemented(); + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.cpp b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp new file mode 100644 index 0000000..32ad92d --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Plugin.h" + +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +void Plugin::Parameters::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(url.string()); + encoder->encode(names); + encoder->encode(values); + encoder->encode(mimeType); + encoder->encode(loadManually); +} + +bool Plugin::Parameters::decode(CoreIPC::ArgumentDecoder* decoder, Parameters& parameters) +{ + String urlString; + if (!decoder->decode(urlString)) + return false; + // FIXME: We can't assume that the url passed in here is valid. + parameters.url = KURL(ParsedURLString, urlString); + + if (!decoder->decode(parameters.names)) + return false; + if (!decoder->decode(parameters.values)) + return false; + if (!decoder->decode(parameters.mimeType)) + return false; + if (!decoder->decode(parameters.loadManually)) + return false; + + if (parameters.names.size() != parameters.values.size()) { + decoder->markInvalid(); + return false; + } + + return true; +} + +Plugin::Plugin() +{ +} + +Plugin::~Plugin() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.h b/Source/WebKit2/WebProcess/Plugins/Plugin.h new file mode 100644 index 0000000..6f20159 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.h @@ -0,0 +1,174 @@ +/* + * 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 Plugin_h +#define Plugin_h + +#include <WebCore/GraphicsLayer.h> +#include <WebCore/KURL.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> + +struct NPObject; + +namespace CoreIPC { + class ArgumentEncoder; + class ArgumentDecoder; +} + +namespace WebCore { + class GraphicsContext; + class IntRect; +} + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebWheelEvent; + +class PluginController; + +class Plugin : public RefCounted<Plugin> { +public: + struct Parameters { + WebCore::KURL url; + Vector<String> names; + Vector<String> values; + String mimeType; + bool loadManually; + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Parameters&); + }; + + virtual ~Plugin(); + + // Initializes the plug-in. If the plug-in fails to initialize this should return false. + virtual bool initialize(PluginController*, const Parameters&) = 0; + + // Destroys the plug-in. + virtual void destroy() = 0; + + // Tells the plug-in to paint itself into the given graphics context. The passed-in context and + // dirty rect are in window coordinates. The context is saved/restored by the caller. + virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect) = 0; + +#if PLATFORM(MAC) + // If a plug-in is using the Core Animation drawing model, this returns its plug-in layer. + virtual PlatformLayer* pluginLayer() = 0; +#endif + + // Tells the plug-in that either the plug-ins frame rect or its clip rect has changed. Both rects are in window coordinates. + virtual void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect) = 0; + + // Tells the plug-in that a frame load request that the plug-in made by calling PluginController::loadURL has finished. + virtual void frameDidFinishLoading(uint64_t requestID) = 0; + + // Tells the plug-in that a frame load request that the plug-in made by calling PluginController::loadURL has failed. + virtual void frameDidFail(uint64_t requestID, bool wasCancelled) = 0; + + // Tells the plug-in that a request to evaluate JavaScript (using PluginController::loadURL) has been fulfilled and passes + // back the result. If evaluating the script failed, result will be null. + virtual void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result) = 0; + + // Tells the plug-in that a stream has received its HTTP response. + virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers) = 0; + + // Tells the plug-in that a stream did receive data. + virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length) = 0; + + // Tells the plug-in that a stream has finished loading. + virtual void streamDidFinishLoading(uint64_t streamID) = 0; + + // Tells the plug-in that a stream has failed to load, either because of network errors or because the load was cancelled. + virtual void streamDidFail(uint64_t streamID, bool wasCancelled) = 0; + + // Tells the plug-in that the manual stream has received its HTTP response. + virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, + uint32_t lastModifiedTime, const String& mimeType, const String& headers) = 0; + + // Tells the plug-in that the manual stream did receive data. + virtual void manualStreamDidReceiveData(const char* bytes, int length) = 0; + + // Tells the plug-in that a stream has finished loading. + virtual void manualStreamDidFinishLoading() = 0; + + // Tells the plug-in that a stream has failed to load, either because of network errors or because the load was cancelled. + virtual void manualStreamDidFail(bool wasCancelled) = 0; + + // Tells the plug-in to handle the passed in mouse event. The plug-in should return true if it processed the event. + virtual bool handleMouseEvent(const WebMouseEvent&) = 0; + + // Tells the plug-in to handle the passed in wheel event. The plug-in should return true if it processed the event. + virtual bool handleWheelEvent(const WebWheelEvent&) = 0; + + // Tells the plug-in to handle the passed in mouse over event. The plug-in should return true if it processed the event. + virtual bool handleMouseEnterEvent(const WebMouseEvent&) = 0; + + // Tells the plug-in to handle the passed in mouse leave event. The plug-in should return true if it processed the event. + virtual bool handleMouseLeaveEvent(const WebMouseEvent&) = 0; + + // Tells the plug-in to handle the passed in keyboard event. The plug-in should return true if it processed the event. + virtual bool handleKeyboardEvent(const WebKeyboardEvent&) = 0; + + // Tells the plug-in about focus changes. + virtual void setFocus(bool) = 0; + + // Get the NPObject that corresponds to the plug-in's scriptable object. Returns a retained object. + virtual NPObject* pluginScriptableNPObject() = 0; + +#if PLATFORM(MAC) + // Tells the plug-in about window focus changes. + virtual void windowFocusChanged(bool) = 0; + + // Tells the plug-in about window and plug-in frame changes. + virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates) = 0; + + // Tells the plug-in about window visibility changes. + virtual void windowVisibilityChanged(bool) = 0; + + // Get the per complex text input identifier. + virtual uint64_t pluginComplexTextInputIdentifier() const = 0; + + // Send the complex text input to the plug-in. + virtual void sendComplexTextInput(const String& textInput) = 0; +#endif + + // Called when the private browsing state for this plug-in changes. + virtual void privateBrowsingStateChanged(bool) = 0; + + // Returns the plug-in controller for this plug-in. + // FIXME: We could just have the controller be a member variable of Plugin. + virtual PluginController* controller() = 0; + +protected: + Plugin(); +}; + +} // namespace WebKit + +#endif // Plugin_h diff --git a/Source/WebKit2/WebProcess/Plugins/PluginController.h b/Source/WebKit2/WebProcess/Plugins/PluginController.h new file mode 100644 index 0000000..06cf2d7 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginController.h @@ -0,0 +1,114 @@ +/* + * 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 PluginController_h +#define PluginController_h + +#include <wtf/Forward.h> + +struct NPObject; +typedef struct _NPVariant NPVariant; + +namespace WebCore { + class HTTPHeaderMap; + class IntRect; + class KURL; +} + +namespace WebKit { + +class PluginController { +public: + // Tells the controller that the plug-in wants the given rect to be repainted. The rect is in the plug-in's coordinate system. + virtual void invalidate(const WebCore::IntRect&) = 0; + + // Returns the user agent string. + virtual String userAgent() = 0; + + // Loads the given URL and associates it with the request ID. + // + // If a target is specified, then the URL will be loaded in the window or frame that the target refers to. + // Once the URL finishes loading, Plugin::frameDidFinishLoading will be called with the given requestID. If the URL + // fails to load, Plugin::frameDidFailToLoad will be called. + // + // If the URL is a JavaScript URL, the JavaScript code will be evaluated and the result sent back using Plugin::didEvaluateJavaScript. + virtual void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, + const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups) = 0; + + /// Cancels the load of a stream that was requested by loadURL. + virtual void cancelStreamLoad(uint64_t streamID) = 0; + + // Cancels the load of the manual stream. + virtual void cancelManualStreamLoad() = 0; + + // Get the NPObject that corresponds to the window JavaScript object. Returns a retained object. + virtual NPObject* windowScriptNPObject() = 0; + + // Get the NPObject that corresponds to the plug-in's element. Returns a retained object. + virtual NPObject* pluginElementNPObject() = 0; + + // Evaluates the given script string in the context of the given NPObject. + virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups) = 0; + + // Set the statusbar text. + virtual void setStatusbarText(const String&) = 0; + +#if USE(ACCELERATED_COMPOSITING) + // Return whether accelerated compositing is enabled. + virtual bool isAcceleratedCompositingEnabled() = 0; +#endif + + // Tells the controller that the plug-in process has crashed. + virtual void pluginProcessCrashed() = 0; + +#if PLATFORM(WIN) + // The window to use as the parent of the plugin's window. + virtual HWND nativeParentWindow() = 0; +#endif + +#if PLATFORM(MAC) + // Tells the controller that complex text input be enabled or disabled for the plug-in. + virtual void setComplexTextInputEnabled(bool) = 0; +#endif + + // Returns the proxies for the given URL or null on failure. + virtual String proxiesForURL(const String&) = 0; + + // Returns the cookies for the given URL or null on failure. + virtual String cookiesForURL(const String&) = 0; + + // Sets the cookies for the given URL. + virtual void setCookiesForURL(const String& urlString, const String& cookieString) = 0; + + // Returns whether private browsing is enabled. + virtual bool isPrivateBrowsingEnabled() = 0; + +protected: + virtual ~PluginController() { } +}; + +} // namespace WebKit + +#endif // PluginController_h diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp new file mode 100644 index 0000000..7c09e56 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp @@ -0,0 +1,119 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessConnection.h" + +#include "NPRemoteObjectMap.h" +#include "PluginProcessConnectionManager.h" +#include "PluginProxy.h" +#include "WebProcess.h" + +namespace WebKit { + +PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier) + : m_pluginProcessConnectionManager(pluginProcessConnectionManager) + , m_pluginPath(pluginPath) +{ + m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop()); + m_npRemoteObjectMap = NPRemoteObjectMap::create(m_connection.get()); + + m_connection->open(); +} + +PluginProcessConnection::~PluginProcessConnection() +{ + ASSERT(!m_connection); + ASSERT(!m_npRemoteObjectMap); +} + +void PluginProcessConnection::addPluginProxy(PluginProxy* plugin) +{ + ASSERT(!m_plugins.contains(plugin->pluginInstanceID())); + m_plugins.set(plugin->pluginInstanceID(), plugin); +} + +void PluginProcessConnection::removePluginProxy(PluginProxy* plugin) +{ + ASSERT(m_plugins.contains(plugin->pluginInstanceID())); + m_plugins.remove(plugin->pluginInstanceID()); + + if (!m_plugins.isEmpty()) + return; + + // Invalidate our remote object map. + m_npRemoteObjectMap->invalidate(); + m_npRemoteObjectMap = 0; + + // We have no more plug-ins, invalidate the connection to the plug-in process. + ASSERT(m_connection); + m_connection->invalidate(); + m_connection = nullptr; + + // This will cause us to be deleted. + m_pluginProcessConnectionManager->removePluginProcessConnection(this); +} + +void PluginProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (arguments->destinationID()) { + if (PluginProxy* pluginProxy = m_plugins.get(arguments->destinationID())) + pluginProxy->didReceivePluginProxyMessage(connection, messageID, arguments); + return; + } + + ASSERT_NOT_REACHED(); +} + +CoreIPC::SyncReplyMode PluginProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + if (messageID.is<CoreIPC::MessageClassNPObjectMessageReceiver>()) + return m_npRemoteObjectMap->didReceiveSyncMessage(connection, messageID, arguments, reply); + + if (PluginProxy* pluginProxy = m_plugins.get(arguments->destinationID())) + return pluginProxy->didReceiveSyncPluginProxyMessage(connection, messageID, arguments, reply); + + ASSERT_NOT_REACHED(); + return CoreIPC::AutomaticReply; +} + +void PluginProcessConnection::didClose(CoreIPC::Connection*) +{ + // The plug-in process must have crashed. + for (HashMap<uint64_t, PluginProxy*>::const_iterator::Values it = m_plugins.begin().values(), end = m_plugins.end().values(); it != end; ++it) { + PluginProxy* pluginProxy = (*it); + + pluginProxy->pluginProcessCrashed(); + } +} + +void PluginProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +{ +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h new file mode 100644 index 0000000..76e2315 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h @@ -0,0 +1,86 @@ +/* + * 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 PluginProcessConnection_h +#define PluginProcessConnection_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include "Plugin.h" +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> + +// A CoreIPC connection to a plug-in process. + +namespace WebKit { + +class NPRemoteObjectMap; +class PluginProcessConnectionManager; +class PluginProxy; + +class PluginProcessConnection : public RefCounted<PluginProcessConnection>, CoreIPC::Connection::Client { +public: + static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier) + { + return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, connectionIdentifier)); + } + ~PluginProcessConnection(); + + const String& pluginPath() const { return m_pluginPath; } + + CoreIPC::Connection* connection() const { return m_connection.get(); } + + void addPluginProxy(PluginProxy*); + void removePluginProxy(PluginProxy*); + + NPRemoteObjectMap* npRemoteObjectMap() const { return m_npRemoteObjectMap.get(); } + +private: + PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier); + + // CoreIPC::Connection::Client + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + virtual CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + virtual void didClose(CoreIPC::Connection*); + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + PluginProcessConnectionManager* m_pluginProcessConnectionManager; + String m_pluginPath; + + // The connection from the web process to the plug-in process. + RefPtr<CoreIPC::Connection> m_connection; + + // The plug-ins. We use a weak reference to the plug-in proxies because the plug-in view holds the strong reference. + HashMap<uint64_t, PluginProxy*> m_plugins; + + RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap; +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessConnection_h diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp new file mode 100644 index 0000000..99848ef --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProcessConnectionManager.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "MachPort.h" +#include "PluginProcessConnection.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcess.h" +#include "WebProcessProxyMessageKinds.h" +#include <wtf/StdLibExtras.h> + +namespace WebKit { + +PluginProcessConnectionManager& PluginProcessConnectionManager::shared() +{ + DEFINE_STATIC_LOCAL(PluginProcessConnectionManager, pluginProcessConnectionManager, ()); + return pluginProcessConnectionManager; +} + +PluginProcessConnectionManager::PluginProcessConnectionManager() +{ +} + +PluginProcessConnectionManager::~PluginProcessConnectionManager() +{ +} + +PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath) +{ + for (size_t i = 0; i < m_pluginProcessConnections.size(); ++i) { + if (m_pluginProcessConnections[i]->pluginPath() == pluginPath) + return m_pluginProcessConnections[i].get(); + } + + CoreIPC::Connection::Identifier connectionIdentifier; + CoreIPC::MachPort connectionMachPort; + if (!WebProcess::shared().connection()->sendSync(WebProcessProxyLegacyMessage::GetPluginProcessConnection, 0, CoreIPC::In(pluginPath), CoreIPC::Out(connectionMachPort))) + return 0; + + connectionIdentifier = connectionMachPort.port(); + if (!connectionIdentifier) + return 0; + + RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, connectionIdentifier); + m_pluginProcessConnections.append(pluginProcessConnection); + + return pluginProcessConnection.get(); +} + +void PluginProcessConnectionManager::removePluginProcessConnection(PluginProcessConnection* pluginProcessConnection) +{ + size_t vectorIndex = m_pluginProcessConnections.find(pluginProcessConnection); + ASSERT(vectorIndex != notFound); + + m_pluginProcessConnections.remove(vectorIndex); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h new file mode 100644 index 0000000..d7ba853 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.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 PluginProcessConnectionManager_h +#define PluginProcessConnectionManager_h + +#if ENABLE(PLUGIN_PROCESS) + +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/Vector.h> + +// Manages plug-in process connections for the given web process. + +namespace WebKit { + +class PluginProcessConnection; + +class PluginProcessConnectionManager : Noncopyable { +public: + static PluginProcessConnectionManager& shared(); + + PluginProcessConnection* getPluginProcessConnection(const String& pluginPath); + void removePluginProcessConnection(PluginProcessConnection*); + +private: + PluginProcessConnectionManager(); + ~PluginProcessConnectionManager(); + + Vector<RefPtr<PluginProcessConnection> > m_pluginProcessConnections; +}; + +} + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProcessConnectionManager_h diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp new file mode 100644 index 0000000..f029cbf --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -0,0 +1,458 @@ +/* + * 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. + */ + +#if ENABLE(PLUGIN_PROCESS) + +#include "PluginProxy.h" + +#include "DataReference.h" +#include "NPRemoteObjectMap.h" +#include "NPRuntimeUtilities.h" +#include "NPVariantData.h" +#include "PluginController.h" +#include "PluginControllerProxyMessages.h" +#include "PluginProcessConnection.h" +#include "PluginProcessConnectionManager.h" +#include "ShareableBitmap.h" +#include "WebCoreArgumentCoders.h" +#include "WebEvent.h" +#include "WebProcessConnectionMessages.h" +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +static uint64_t generatePluginInstanceID() +{ + static uint64_t uniquePluginInstanceID; + return ++uniquePluginInstanceID; +} + +PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath) +{ + return adoptRef(new PluginProxy(pluginPath)); +} + +PluginProxy::PluginProxy(const String& pluginPath) + : m_pluginPath(pluginPath) + , m_pluginInstanceID(generatePluginInstanceID()) + , m_pluginController(0) + , m_pluginBackingStoreContainsValidData(false) + , m_isStarted(false) + , m_waitingForPaintInResponseToUpdate(false) + , m_remoteLayerClientID(0) +{ +} + +PluginProxy::~PluginProxy() +{ +} + +void PluginProxy::pluginProcessCrashed() +{ + if (m_pluginController) + m_pluginController->pluginProcessCrashed(); +} + +bool PluginProxy::initialize(PluginController* pluginController, const Parameters& parameters) +{ + ASSERT(!m_pluginController); + ASSERT(pluginController); + + m_pluginController = pluginController; + + ASSERT(!m_connection); + m_connection = PluginProcessConnectionManager::shared().getPluginProcessConnection(m_pluginPath); + + if (!m_connection) + return false; + + // Add the plug-in proxy before creating the plug-in; it needs to be in the map because CreatePlugin + // can call back out to the plug-in proxy. + m_connection->addPluginProxy(this); + + // Ask the plug-in process to create a plug-in. + bool result = false; + + uint32_t remoteLayerClientID = 0; + if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters, pluginController->userAgent(), pluginController->isPrivateBrowsingEnabled(), pluginController->isAcceleratedCompositingEnabled()), Messages::WebProcessConnection::CreatePlugin::Reply(result, remoteLayerClientID), 0) || !result) { + m_connection->removePluginProxy(this); + return false; + } + + m_remoteLayerClientID = remoteLayerClientID; + m_isStarted = true; + + return true; +} + +void PluginProxy::destroy() +{ + ASSERT(m_isStarted); + + m_connection->connection()->sendSync(Messages::WebProcessConnection::DestroyPlugin(m_pluginInstanceID), Messages::WebProcessConnection::DestroyPlugin::Reply(), 0); + + m_isStarted = false; + m_connection->removePluginProxy(this); +} + +void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRect) +{ + if (!needsBackingStore() || !m_backingStore) + return; + + if (!m_pluginBackingStoreContainsValidData) { + m_connection->connection()->sendSync(Messages::PluginControllerProxy::PaintEntirePlugin(), Messages::PluginControllerProxy::PaintEntirePlugin::Reply(), m_pluginInstanceID); + + // Blit the plug-in backing store into our own backing store. + OwnPtr<WebCore::GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext(); + + m_pluginBackingStore->paint(*graphicsContext, IntPoint(), IntRect(0, 0, m_frameRect.width(), m_frameRect.height())); + + m_pluginBackingStoreContainsValidData = true; + } + + IntRect dirtyRectInPluginCoordinates = dirtyRect; + dirtyRectInPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y()); + + m_backingStore->paint(*graphicsContext, dirtyRect.location(), dirtyRectInPluginCoordinates); + + if (m_waitingForPaintInResponseToUpdate) { + m_waitingForPaintInResponseToUpdate = false; + m_connection->connection()->send(Messages::PluginControllerProxy::DidUpdate(), m_pluginInstanceID); + return; + } +} + +void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect) +{ + ASSERT(m_isStarted); + + m_frameRect = frameRect; + + if (!needsBackingStore()) { + SharedMemory::Handle pluginBackingStoreHandle; + m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID); + return; + } + + bool didUpdateBackingStore = false; + if (!m_backingStore) { + m_backingStore = ShareableBitmap::create(frameRect.size()); + didUpdateBackingStore = true; + } else if (frameRect.size() != m_backingStore->size()) { + // The backing store already exists, just resize it. + if (!m_backingStore->resize(frameRect.size())) + return; + + didUpdateBackingStore = true; + } + + SharedMemory::Handle pluginBackingStoreHandle; + + if (didUpdateBackingStore) { + // Create a new plug-in backing store. + m_pluginBackingStore = ShareableBitmap::createShareable(frameRect.size()); + if (!m_pluginBackingStore) + return; + + // Create a handle to the plug-in backing store so we can send it over. + if (!m_pluginBackingStore->createHandle(pluginBackingStoreHandle)) { + m_pluginBackingStore.clear(); + return; + } + + m_pluginBackingStoreContainsValidData = false; + } + + m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID); +} + +void PluginProxy::frameDidFinishLoading(uint64_t requestID) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::FrameDidFinishLoading(requestID), m_pluginInstanceID); +} + +void PluginProxy::frameDidFail(uint64_t requestID, bool wasCancelled) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::FrameDidFail(requestID, wasCancelled), m_pluginInstanceID); +} + +void PluginProxy::didEvaluateJavaScript(uint64_t requestID, const WTF::String& requestURLString, const WTF::String& result) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::DidEvaluateJavaScript(requestID, requestURLString, result), m_pluginInstanceID); +} + +void PluginProxy::streamDidReceiveResponse(uint64_t streamID, const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidReceiveResponse(streamID, responseURL.string(), streamLength, lastModifiedTime, mimeType, headers), m_pluginInstanceID); +} + +void PluginProxy::streamDidReceiveData(uint64_t streamID, const char* bytes, int length) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidReceiveData(streamID, CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(bytes), length)), m_pluginInstanceID); +} + +void PluginProxy::streamDidFinishLoading(uint64_t streamID) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidFinishLoading(streamID), m_pluginInstanceID); +} + +void PluginProxy::streamDidFail(uint64_t streamID, bool wasCancelled) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidFail(streamID, wasCancelled), m_pluginInstanceID); +} + +void PluginProxy::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::ManualStreamDidReceiveResponse(responseURL.string(), streamLength, lastModifiedTime, mimeType, headers), m_pluginInstanceID); +} + +void PluginProxy::manualStreamDidReceiveData(const char* bytes, int length) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::ManualStreamDidReceiveData(CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(bytes), length)), m_pluginInstanceID); +} + +void PluginProxy::manualStreamDidFinishLoading() +{ + m_connection->connection()->send(Messages::PluginControllerProxy::ManualStreamDidFinishLoading(), m_pluginInstanceID); +} + +void PluginProxy::manualStreamDidFail(bool wasCancelled) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::ManualStreamDidFail(wasCancelled), m_pluginInstanceID); +} + +bool PluginProxy::handleMouseEvent(const WebMouseEvent& mouseEvent) +{ + bool handled = false; + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleMouseEvent(mouseEvent), Messages::PluginControllerProxy::HandleMouseEvent::Reply(handled), m_pluginInstanceID)) + return false; + + return handled; +} + +bool PluginProxy::handleWheelEvent(const WebWheelEvent& wheelEvent) +{ + bool handled = false; + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleWheelEvent(wheelEvent), Messages::PluginControllerProxy::HandleWheelEvent::Reply(handled), m_pluginInstanceID)) + return false; + + return handled; +} + +bool PluginProxy::handleMouseEnterEvent(const WebMouseEvent& mouseEnterEvent) +{ + bool handled = false; + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleMouseEnterEvent(mouseEnterEvent), Messages::PluginControllerProxy::HandleMouseEnterEvent::Reply(handled), m_pluginInstanceID)) + return false; + + return handled; +} + +bool PluginProxy::handleMouseLeaveEvent(const WebMouseEvent& mouseLeaveEvent) +{ + bool handled = false; + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleMouseLeaveEvent(mouseLeaveEvent), Messages::PluginControllerProxy::HandleMouseLeaveEvent::Reply(handled), m_pluginInstanceID)) + return false; + + return handled; +} + +bool PluginProxy::handleKeyboardEvent(const WebKeyboardEvent& keyboardEvent) +{ + bool handled = false; + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleKeyboardEvent(keyboardEvent), Messages::PluginControllerProxy::HandleKeyboardEvent::Reply(handled), m_pluginInstanceID)) + return false; + + return handled; +} + +void PluginProxy::setFocus(bool hasFocus) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::SetFocus(hasFocus), m_pluginInstanceID); +} + +NPObject* PluginProxy::pluginScriptableNPObject() +{ + uint64_t pluginScriptableNPObjectID = 0; + + if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::GetPluginScriptableNPObject(), Messages::PluginControllerProxy::GetPluginScriptableNPObject::Reply(pluginScriptableNPObjectID), m_pluginInstanceID)) + return 0; + + if (!pluginScriptableNPObjectID) + return 0; + + return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginScriptableNPObjectID); +} + +#if PLATFORM(MAC) +void PluginProxy::windowFocusChanged(bool hasFocus) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::WindowFocusChanged(hasFocus), m_pluginInstanceID); +} + +void PluginProxy::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates), m_pluginInstanceID); +} + +void PluginProxy::windowVisibilityChanged(bool isVisible) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::WindowVisibilityChanged(isVisible), m_pluginInstanceID); +} + +uint64_t PluginProxy::pluginComplexTextInputIdentifier() const +{ + return m_pluginInstanceID; +} + +void PluginProxy::sendComplexTextInput(const String& textInput) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::SendComplexTextInput(textInput), m_pluginInstanceID); +} + +#endif + +void PluginProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled) +{ + m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID); +} + +PluginController* PluginProxy::controller() +{ + return m_pluginController; +} + +void PluginProxy::loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups) +{ + m_pluginController->loadURL(requestID, method, urlString, target, headerFields, httpBody, allowPopups); +} + +void PluginProxy::proxiesForURL(const String& urlString, String& proxyString) +{ + proxyString = m_pluginController->proxiesForURL(urlString); +} + +void PluginProxy::cookiesForURL(const String& urlString, String& cookieString) +{ + cookieString = m_pluginController->cookiesForURL(urlString); +} + +void PluginProxy::setCookiesForURL(const String& urlString, const String& cookieString) +{ + m_pluginController->setCookiesForURL(urlString, cookieString); +} + +void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID) +{ + NPObject* windowScriptNPObject = m_pluginController->windowScriptNPObject(); + if (!windowScriptNPObject) { + windowScriptNPObjectID = 0; + return; + } + + windowScriptNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(windowScriptNPObject); + releaseNPObject(windowScriptNPObject); +} + +void PluginProxy::getPluginElementNPObject(uint64_t& pluginElementNPObjectID) +{ + NPObject* pluginElementNPObject = m_pluginController->pluginElementNPObject(); + if (!pluginElementNPObject) { + pluginElementNPObjectID = 0; + return; + } + + pluginElementNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(pluginElementNPObject); + releaseNPObject(pluginElementNPObject); +} + +void PluginProxy::evaluate(const NPVariantData& npObjectAsVariantData, const String& scriptString, bool allowPopups, bool& returnValue, NPVariantData& resultData) +{ + NPVariant npObjectAsVariant = m_connection->npRemoteObjectMap()->npVariantDataToNPVariant(npObjectAsVariantData); + ASSERT(NPVARIANT_IS_OBJECT(npObjectAsVariant)); + + NPVariant result; + returnValue = m_pluginController->evaluate(NPVARIANT_TO_OBJECT(npObjectAsVariant), scriptString, &result, allowPopups); + if (!returnValue) + return; + + // Convert the NPVariant to an NPVariantData. + resultData = m_connection->npRemoteObjectMap()->npVariantToNPVariantData(result); + + // And release the result. + releaseNPVariantValue(&result); + + releaseNPVariantValue(&npObjectAsVariant); +} + +void PluginProxy::cancelStreamLoad(uint64_t streamID) +{ + m_pluginController->cancelStreamLoad(streamID); +} + +void PluginProxy::cancelManualStreamLoad() +{ + m_pluginController->cancelManualStreamLoad(); +} + +void PluginProxy::setStatusbarText(const String& statusbarText) +{ + m_pluginController->setStatusbarText(statusbarText); +} + +#if PLATFORM(MAC) +void PluginProxy::setComplexTextInputEnabled(bool complexTextInputEnabled) +{ + m_pluginController->setComplexTextInputEnabled(complexTextInputEnabled); +} +#endif + +void PluginProxy::update(const IntRect& paintedRect) +{ + if (paintedRect == m_frameRect) + m_pluginBackingStoreContainsValidData = true; + + IntRect paintedRectPluginCoordinates = paintedRect; + paintedRectPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y()); + + if (m_backingStore) { + // Blit the plug-in backing store into our own backing store. + OwnPtr<GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext(); + + m_pluginBackingStore->paint(*graphicsContext, paintedRectPluginCoordinates.location(), + paintedRectPluginCoordinates); + } + + // Ask the controller to invalidate the rect for us. + m_waitingForPaintInResponseToUpdate = true; + m_pluginController->invalidate(paintedRectPluginCoordinates); +} + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h new file mode 100644 index 0000000..2c3b052 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -0,0 +1,161 @@ +/* + * 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 PluginProxy_h +#define PluginProxy_h + +#if ENABLE(PLUGIN_PROCESS) + +#include "Connection.h" +#include "Plugin.h" + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class CALayer; +#else +class CALayer; +#endif +#endif + +namespace WebCore { + class HTTPHeaderMap; +} + +namespace WebKit { + +class ShareableBitmap; +class NPVariantData; +class PluginProcessConnection; + +class PluginProxy : public Plugin { +public: + static PassRefPtr<PluginProxy> create(const String& pluginPath); + ~PluginProxy(); + + uint64_t pluginInstanceID() const { return m_pluginInstanceID; } + void pluginProcessCrashed(); + + void didReceivePluginProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments); + CoreIPC::SyncReplyMode didReceiveSyncPluginProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + +private: + explicit PluginProxy(const String& pluginPath); + + // Plugin + virtual bool initialize(PluginController*, const Parameters&); + virtual void destroy(); + virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); +#if PLATFORM(MAC) + virtual PlatformLayer* pluginLayer(); +#endif + virtual void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect); + virtual void frameDidFinishLoading(uint64_t requestID); + virtual void frameDidFail(uint64_t requestID, bool wasCancelled); + virtual void didEvaluateJavaScript(uint64_t requestID, const WTF::String& requestURLString, const WTF::String& result); + virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers); + virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length); + virtual void streamDidFinishLoading(uint64_t streamID); + virtual void streamDidFail(uint64_t streamID, bool wasCancelled); + virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers); + virtual void manualStreamDidReceiveData(const char* bytes, int length); + virtual void manualStreamDidFinishLoading(); + virtual void manualStreamDidFail(bool wasCancelled); + + virtual bool handleMouseEvent(const WebMouseEvent&); + virtual bool handleWheelEvent(const WebWheelEvent&); + virtual bool handleMouseEnterEvent(const WebMouseEvent&); + virtual bool handleMouseLeaveEvent(const WebMouseEvent&); + virtual bool handleKeyboardEvent(const WebKeyboardEvent&); + virtual void setFocus(bool); + virtual NPObject* pluginScriptableNPObject(); +#if PLATFORM(MAC) + virtual void windowFocusChanged(bool); + virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates); + virtual void windowVisibilityChanged(bool); + virtual uint64_t pluginComplexTextInputIdentifier() const; + virtual void sendComplexTextInput(const String& textInput); +#endif + + virtual void privateBrowsingStateChanged(bool); + + virtual PluginController* controller(); + + bool needsBackingStore() const; + + // Message handlers. + void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups); + void update(const WebCore::IntRect& paintedRect); + void proxiesForURL(const String& urlString, String& proxyString); + void cookiesForURL(const String& urlString, String& cookieString); + void setCookiesForURL(const String& urlString, const String& cookieString); + void getWindowScriptNPObject(uint64_t& windowScriptNPObjectID); + void getPluginElementNPObject(uint64_t& pluginElementNPObjectID); + void evaluate(const NPVariantData& npObjectAsVariantData, const String& scriptString, bool allowPopups, bool& returnValue, NPVariantData& resultData); + void cancelStreamLoad(uint64_t streamID); + void cancelManualStreamLoad(); + void setStatusbarText(const String& statusbarText); +#if PLATFORM(MAC) + void setComplexTextInputEnabled(bool); +#endif + + String m_pluginPath; + + RefPtr<PluginProcessConnection> m_connection; + uint64_t m_pluginInstanceID; + + PluginController* m_pluginController; + + // The plug-in rect in window coordinates. + WebCore::IntRect m_frameRect; + + // This is the backing store that we paint when we're told to paint. + RefPtr<ShareableBitmap> m_backingStore; + + // This is the shared memory backing store that the plug-in paints into. When the plug-in tells us + // that it's painted something in it, we'll blit from it to our own backing store. + RefPtr<ShareableBitmap> m_pluginBackingStore; + + // Whether all of the plug-in backing store contains valid data. + bool m_pluginBackingStoreContainsValidData; + + bool m_isStarted; + + // Whether we're called invalidate in response to an update call, and are now waiting for a paint call. + bool m_waitingForPaintInResponseToUpdate; + + // The client ID for the CA layer in the plug-in process. Will be 0 if the plug-in is not a CA plug-in. + uint32_t m_remoteLayerClientID; + +#if PLATFORM(MAC) + RetainPtr<CALayer> m_pluginLayer; +#endif +}; + +} // namespace WebKit + +#endif // ENABLE(PLUGIN_PROCESS) + +#endif // PluginProxy_h diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in b/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in new file mode 100644 index 0000000..81761ee --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in @@ -0,0 +1,65 @@ +# 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. + +#if ENABLE(PLUGIN_PROCESS) + +messages -> PluginProxy { + # Asks the web process to load a URL. + LoadURL(uint64_t requestID, WTF::String method, WTF::String urlString, WTF::String target, WebCore::HTTPHeaderMap headerFields, Vector<uint8_t> httpBody, bool allowPopups); + + # Called when the plug-in has painted into its backing store. + Update(WebCore::IntRect paintedRect) + + # Returns a PAC style string with proxies for the given URL. + ProxiesForURL(WTF::String urlString) -> (WTF::String proxiesString) + + # Returns the cookies for the given URL. + CookiesForURL(WTF::String urlString) -> (WTF::String cookieString) + + # Sets the cookies for the given URL. + SetCookiesForURL(WTF::String urlString, WTF::String cookieString) + + # Gets a reference to the window NPObject. + GetWindowScriptNPObject() -> (uint64_t windowScriptNPObjectID) + + # Gets a reference to the plug-in element NPObject. + GetPluginElementNPObject() -> (uint64_t pluginElementNPObjectID) + + # Evaluates the given JavaScript string. + Evaluate(WebKit::NPVariantData npObjectAsVariantData, WTF::String scriptString, bool allowPopups) -> (bool returnValue, WebKit::NPVariantData resultData) + + # Cancels the given stream load. + CancelStreamLoad(uint64_t streamID) + + # Cancel the manual stream load. + CancelManualStreamLoad() + + # Set the status bar text. + SetStatusbarText(WTF::String statusbarText) + +#if PLATFORM(MAC) + # Change whether complext text input is enabled for this plug-in. + SetComplexTextInputEnabled(bool complexTextInputEnabled) +#endif +} + +#endif diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp new file mode 100644 index 0000000..00271c1 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -0,0 +1,1013 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginView.h" + +#include "NPRuntimeUtilities.h" +#include "Plugin.h" +#include "WebEvent.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include <WebCore/Chrome.h> +#include <WebCore/CookieJar.h> +#include <WebCore/DocumentLoader.h> +#include <WebCore/Event.h> +#include <WebCore/FocusController.h> +#include <WebCore/FrameLoadRequest.h> +#include <WebCore/FrameLoaderClient.h> +#include <WebCore/FrameView.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/HTMLPlugInElement.h> +#include <WebCore/HostWindow.h> +#include <WebCore/NetscapePlugInStreamLoader.h> +#include <WebCore/NetworkingContext.h> +#include <WebCore/ProxyServer.h> +#include <WebCore/RenderEmbeddedObject.h> +#include <WebCore/RenderLayer.h> +#include <WebCore/ResourceLoadScheduler.h> +#include <WebCore/ScrollView.h> +#include <WebCore/Settings.h> + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +class PluginView::URLRequest : public RefCounted<URLRequest> { +public: + static PassRefPtr<PluginView::URLRequest> create(uint64_t requestID, const FrameLoadRequest& request, bool allowPopups) + { + return adoptRef(new URLRequest(requestID, request, allowPopups)); + } + + uint64_t requestID() const { return m_requestID; } + const String& target() const { return m_request.frameName(); } + const ResourceRequest & request() const { return m_request.resourceRequest(); } + bool allowPopups() const { return m_allowPopups; } + +private: + URLRequest(uint64_t requestID, const FrameLoadRequest& request, bool allowPopups) + : m_requestID(requestID) + , m_request(request) + , m_allowPopups(allowPopups) + { + } + + uint64_t m_requestID; + FrameLoadRequest m_request; + bool m_allowPopups; +}; + +class PluginView::Stream : public RefCounted<PluginView::Stream>, NetscapePlugInStreamLoaderClient { +public: + static PassRefPtr<Stream> create(PluginView* pluginView, uint64_t streamID, const ResourceRequest& request) + { + return adoptRef(new Stream(pluginView, streamID, request)); + } + ~Stream(); + + void start(); + void cancel(); + + uint64_t streamID() const { return m_streamID; } + +private: + Stream(PluginView* pluginView, uint64_t streamID, const ResourceRequest& request) + : m_pluginView(pluginView) + , m_streamID(streamID) + , m_request(request) + , m_streamWasCancelled(false) + { + } + + // NetscapePluginStreamLoaderClient + virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&); + virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int); + virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&); + virtual void didFinishLoading(NetscapePlugInStreamLoader*); + + PluginView* m_pluginView; + uint64_t m_streamID; + const ResourceRequest m_request; + + // True if the stream was explicitly cancelled by calling cancel(). + // (As opposed to being cancelled by the user hitting the stop button for example. + bool m_streamWasCancelled; + + RefPtr<NetscapePlugInStreamLoader> m_loader; +}; + +PluginView::Stream::~Stream() +{ + ASSERT(!m_pluginView); +} + +void PluginView::Stream::start() +{ + ASSERT(!m_loader); + + Frame* frame = m_pluginView->m_pluginElement->document()->frame(); + ASSERT(frame); + + m_loader = resourceLoadScheduler()->schedulePluginStreamLoad(frame, this, m_request); +} + +void PluginView::Stream::cancel() +{ + ASSERT(m_loader); + + m_streamWasCancelled = true; + m_loader->cancel(m_loader->cancelledError()); + m_loader = 0; +} + +static String buildHTTPHeaders(const ResourceResponse& response, long long& expectedContentLength) +{ + if (!response.isHTTP()) + return String(); + + Vector<UChar> stringBuilder; + String separator(": "); + + String statusLine = String::format("HTTP %d ", response.httpStatusCode()); + stringBuilder.append(statusLine.characters(), statusLine.length()); + stringBuilder.append(response.httpStatusText().characters(), response.httpStatusText().length()); + stringBuilder.append('\n'); + + HTTPHeaderMap::const_iterator end = response.httpHeaderFields().end(); + for (HTTPHeaderMap::const_iterator it = response.httpHeaderFields().begin(); it != end; ++it) { + stringBuilder.append(it->first.characters(), it->first.length()); + stringBuilder.append(separator.characters(), separator.length()); + stringBuilder.append(it->second.characters(), it->second.length()); + stringBuilder.append('\n'); + } + + String headers = String::adopt(stringBuilder); + + // If the content is encoded (most likely compressed), then don't send its length to the plugin, + // which is only interested in the decoded length, not yet known at the moment. + // <rdar://problem/4470599> tracks a request for -[NSURLResponse expectedContentLength] to incorporate this logic. + String contentEncoding = response.httpHeaderField("Content-Encoding"); + if (!contentEncoding.isNull() && contentEncoding != "identity") + expectedContentLength = -1; + + return headers; +} + +void PluginView::Stream::didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse& response) +{ + // Compute the stream related data from the resource response. + const KURL& responseURL = response.url(); + const String& mimeType = response.mimeType(); + long long expectedContentLength = response.expectedContentLength(); + + String headers = buildHTTPHeaders(response, expectedContentLength); + + uint32_t streamLength = 0; + if (expectedContentLength > 0) + streamLength = expectedContentLength; + + m_pluginView->m_plugin->streamDidReceiveResponse(m_streamID, responseURL, streamLength, response.lastModifiedDate(), mimeType, headers); +} + +void PluginView::Stream::didReceiveData(NetscapePlugInStreamLoader*, const char* bytes, int length) +{ + m_pluginView->m_plugin->streamDidReceiveData(m_streamID, bytes, length); +} + +void PluginView::Stream::didFail(NetscapePlugInStreamLoader*, const ResourceError& error) +{ + // Calling streamDidFail could cause us to be deleted, so we hold on to a reference here. + RefPtr<Stream> protect(this); + + // We only want to call streamDidFail if the stream was not explicitly cancelled by the plug-in. + if (!m_streamWasCancelled) + m_pluginView->m_plugin->streamDidFail(m_streamID, error.isCancellation()); + + m_pluginView->removeStream(this); + m_pluginView = 0; +} + +void PluginView::Stream::didFinishLoading(NetscapePlugInStreamLoader*) +{ + // Calling streamDidFinishLoading could cause us to be deleted, so we hold on to a reference here. + RefPtr<Stream> protectStream(this); + + // Protect the plug-in while we're calling into it. + NPRuntimeObjectMap::PluginProtector pluginProtector(&m_pluginView->m_npRuntimeObjectMap); + m_pluginView->m_plugin->streamDidFinishLoading(m_streamID); + + m_pluginView->removeStream(this); + m_pluginView = 0; +} + +static inline WebPage* webPage(HTMLPlugInElement* pluginElement) +{ + Frame* frame = pluginElement->document()->frame(); + ASSERT(frame); + + WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->page(); + ASSERT(webPage); + + return webPage; +} + +PassRefPtr<PluginView> PluginView::create(PassRefPtr<HTMLPlugInElement> pluginElement, PassRefPtr<Plugin> plugin, const Plugin::Parameters& parameters) +{ + return adoptRef(new PluginView(pluginElement, plugin, parameters)); +} + +PluginView::PluginView(PassRefPtr<HTMLPlugInElement> pluginElement, PassRefPtr<Plugin> plugin, const Plugin::Parameters& parameters) + : PluginViewBase(0) + , m_pluginElement(pluginElement) + , m_plugin(plugin) + , m_webPage(webPage(m_pluginElement.get())) + , m_parameters(parameters) + , m_isInitialized(false) + , m_isWaitingUntilMediaCanStart(false) + , m_isBeingDestroyed(false) + , m_pendingURLRequestsTimer(RunLoop::main(), this, &PluginView::pendingURLRequestsTimerFired) + , m_npRuntimeObjectMap(this) + , m_manualStreamState(StreamStateInitial) +{ +#if PLATFORM(MAC) + m_webPage->addPluginView(this); +#endif +} + +PluginView::~PluginView() +{ +#if PLATFORM(MAC) + m_webPage->removePluginView(this); +#endif + + ASSERT(!m_isBeingDestroyed); + + if (m_isWaitingUntilMediaCanStart) + m_pluginElement->document()->removeMediaCanStartListener(this); + + // Cancel all pending frame loads. + FrameLoadMap::iterator end = m_pendingFrameLoads.end(); + for (FrameLoadMap::iterator it = m_pendingFrameLoads.begin(), end = m_pendingFrameLoads.end(); it != end; ++it) + it->first->setLoadListener(0); + + if (m_plugin && m_isInitialized) { + m_isBeingDestroyed = true; + m_plugin->destroy(); + m_isBeingDestroyed = false; + } + + // Invalidate the object map. + m_npRuntimeObjectMap.invalidate(); + + // Cancel all streams. + cancelAllStreams(); +} + +Frame* PluginView::frame() +{ + return m_pluginElement->document()->frame(); +} + +void PluginView::manualLoadDidReceiveResponse(const ResourceResponse& response) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_plugin) + return; + + if (!m_isInitialized) { + ASSERT(m_manualStreamState == StreamStateInitial); + m_manualStreamState = StreamStateHasReceivedResponse; + m_manualStreamResponse = response; + return; + } + + // Compute the stream related data from the resource response. + const KURL& responseURL = response.url(); + const String& mimeType = response.mimeType(); + long long expectedContentLength = response.expectedContentLength(); + + String headers = buildHTTPHeaders(response, expectedContentLength); + + uint32_t streamLength = 0; + if (expectedContentLength > 0) + streamLength = expectedContentLength; + + m_plugin->manualStreamDidReceiveResponse(responseURL, streamLength, response.lastModifiedDate(), mimeType, headers); +} + +void PluginView::manualLoadDidReceiveData(const char* bytes, int length) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_plugin) + return; + + if (!m_isInitialized) { + ASSERT(m_manualStreamState == StreamStateHasReceivedResponse); + if (!m_manualStreamData) + m_manualStreamData = SharedBuffer::create(); + + m_manualStreamData->append(bytes, length); + return; + } + + m_plugin->manualStreamDidReceiveData(bytes, length); +} + +void PluginView::manualLoadDidFinishLoading() +{ + // The plug-in can be null here if it failed to initialize. + if (!m_plugin) + return; + + if (!m_isInitialized) { + ASSERT(m_manualStreamState == StreamStateHasReceivedResponse); + m_manualStreamState = StreamStateFinished; + return; + } + + m_plugin->manualStreamDidFinishLoading(); +} + +void PluginView::manualLoadDidFail(const ResourceError& error) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_plugin) + return; + + if (!m_isInitialized) { + m_manualStreamState = StreamStateFinished; + m_manualStreamError = error; + m_manualStreamData = nullptr; + return; + } + + m_plugin->manualStreamDidFail(error.isCancellation()); +} + +#if PLATFORM(MAC) +void PluginView::setWindowIsVisible(bool windowIsVisible) +{ + if (!m_plugin) + return; + + // FIXME: Implement. +} + +void PluginView::setWindowIsFocused(bool windowIsFocused) +{ + if (!m_isInitialized || !m_plugin) + return; + + m_plugin->windowFocusChanged(windowIsFocused); +} + +void PluginView::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates) +{ + if (!m_isInitialized || !m_plugin) + return; + + m_plugin->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates); +} + +bool PluginView::sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput) +{ + if (!m_plugin) + return false; + + if (m_plugin->pluginComplexTextInputIdentifier() != pluginComplexTextInputIdentifier) + return false; + + m_plugin->sendComplexTextInput(textInput); + return true; +} + +#endif + +void PluginView::initializePlugin() +{ + if (m_isInitialized) + return; + + if (!m_plugin) { + // We've already tried and failed to initialize the plug-in. + return; + } + + if (Frame* frame = m_pluginElement->document()->frame()) { + if (Page* page = frame->page()) { + + // We shouldn't initialize the plug-in right now, add a listener. + if (!page->canStartMedia()) { + if (m_isWaitingUntilMediaCanStart) + return; + + m_isWaitingUntilMediaCanStart = true; + m_pluginElement->document()->addMediaCanStartListener(this); + return; + } + } + } + + if (!m_plugin->initialize(this, m_parameters)) { + // We failed to initialize the plug-in. + m_plugin = 0; + + return; + } + + m_isInitialized = true; + + viewGeometryDidChange(); + + redeliverManualStream(); + +#if PLATFORM(MAC) + if (m_plugin->pluginLayer()) { + if (frame()) { + frame()->view()->enterCompositingMode(); + m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange); + } + } + + windowAndViewFramesChanged(m_webPage->windowFrameInScreenCoordinates(), m_webPage->viewFrameInWindowCoordinates()); + setWindowIsVisible(m_webPage->windowIsVisible()); + setWindowIsFocused(m_webPage->windowIsFocused()); +#endif +} + +#if PLATFORM(MAC) +PlatformLayer* PluginView::platformLayer() const +{ + // The plug-in can be null here if it failed to initialize. + if (!m_isInitialized || !m_plugin) + return 0; + + return m_plugin->pluginLayer(); +} +#endif + +JSObject* PluginView::scriptObject(JSGlobalObject* globalObject) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_isInitialized || !m_plugin) + return 0; + + NPObject* scriptableNPObject = m_plugin->pluginScriptableNPObject(); + if (!scriptableNPObject) + return 0; + + JSObject* jsObject = m_npRuntimeObjectMap.getOrCreateJSObject(globalObject, scriptableNPObject); + releaseNPObject(scriptableNPObject); + + return jsObject; +} + +void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) +{ + // The plug-in can be null here if it failed to initialize. + if (!m_isInitialized || !m_plugin) + return; + + m_plugin->privateBrowsingStateChanged(privateBrowsingEnabled); +} + +void PluginView::setFrameRect(const WebCore::IntRect& rect) +{ + Widget::setFrameRect(rect); + viewGeometryDidChange(); +} + +void PluginView::paint(GraphicsContext* context, const IntRect& dirtyRect) +{ + if (context->paintingDisabled() || !m_plugin || !m_isInitialized) + return; + + IntRect dirtyRectInWindowCoordinates = parent()->contentsToWindow(dirtyRect); + + IntRect paintRectInWindowCoordinates = intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates()); + if (paintRectInWindowCoordinates.isEmpty()) + return; + + // context is in document coordinates. Translate it to window coordinates. + IntPoint documentOriginInWindowCoordinates = parent()->contentsToWindow(IntPoint()); + context->save(); + context->translate(-documentOriginInWindowCoordinates.x(), -documentOriginInWindowCoordinates.y()); + + m_plugin->paint(context, paintRectInWindowCoordinates); + + context->restore(); +} + +void PluginView::frameRectsChanged() +{ + Widget::frameRectsChanged(); + viewGeometryDidChange(); +} + +void PluginView::setParent(ScrollView* scrollView) +{ + Widget::setParent(scrollView); + + if (scrollView) + initializePlugin(); +} + +void PluginView::handleEvent(Event* event) +{ + if (!m_isInitialized || !m_plugin) + return; + + const WebEvent* currentEvent = WebPage::currentEvent(); + if (!currentEvent) + return; + + bool didHandleEvent = false; + + if ((event->type() == eventNames().mousemoveEvent && currentEvent->type() == WebEvent::MouseMove) + || (event->type() == eventNames().mousedownEvent && currentEvent->type() == WebEvent::MouseDown) + || (event->type() == eventNames().mouseupEvent && currentEvent->type() == WebEvent::MouseUp)) { + // We have a mouse event. + if (currentEvent->type() == WebEvent::MouseDown) + focusPluginElement(); + + didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent)); + } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) { + // We have a wheel event. + didHandleEvent = m_plugin->handleWheelEvent(static_cast<const WebWheelEvent&>(*currentEvent)); + } else if (event->type() == eventNames().mouseoverEvent && currentEvent->type() == WebEvent::MouseMove) { + // We have a mouse enter event. + didHandleEvent = m_plugin->handleMouseEnterEvent(static_cast<const WebMouseEvent&>(*currentEvent)); + } else if (event->type() == eventNames().mouseoutEvent && currentEvent->type() == WebEvent::MouseMove) { + // We have a mouse leave event. + didHandleEvent = m_plugin->handleMouseLeaveEvent(static_cast<const WebMouseEvent&>(*currentEvent)); + } else if ((event->type() == eventNames().keydownEvent && currentEvent->type() == WebEvent::KeyDown) + || (event->type() == eventNames().keyupEvent && currentEvent->type() == WebEvent::KeyUp)) { + // We have a keyboard event. + didHandleEvent = m_plugin->handleKeyboardEvent(static_cast<const WebKeyboardEvent&>(*currentEvent)); + } + + if (didHandleEvent) + event->setDefaultHandled(); +} + +void PluginView::viewGeometryDidChange() +{ + if (!m_isInitialized || !m_plugin || !parent()) + return; + + // Get the frame rect in window coordinates. + IntRect frameRectInWindowCoordinates = parent()->contentsToWindow(frameRect()); + + m_plugin->geometryDidChange(frameRectInWindowCoordinates, clipRectInWindowCoordinates()); +} + +IntRect PluginView::clipRectInWindowCoordinates() const +{ + ASSERT(parent()); + + // Get the frame rect in window coordinates. + IntRect frameRectInWindowCoordinates = parent()->contentsToWindow(frameRect()); + + // Get the window clip rect for the enclosing layer (in window coordinates). + RenderLayer* layer = m_pluginElement->renderer()->enclosingLayer(); + FrameView* parentView = m_pluginElement->document()->frame()->view(); + IntRect windowClipRect = parentView->windowClipRectForLayer(layer, true); + + // Intersect the two rects to get the view clip rect in window coordinates. + return intersection(frameRectInWindowCoordinates, windowClipRect); +} + +void PluginView::focusPluginElement() +{ + ASSERT(frame()); + + if (Page* page = frame()->page()) + page->focusController()->setFocusedFrame(frame()); + frame()->document()->setFocusedNode(m_pluginElement); +} + +void PluginView::pendingURLRequestsTimerFired() +{ + ASSERT(!m_pendingURLRequests.isEmpty()); + + RefPtr<URLRequest> urlRequest = m_pendingURLRequests.takeFirst(); + + // If there are more requests to perform, reschedule the timer. + if (!m_pendingURLRequests.isEmpty()) + m_pendingURLRequestsTimer.startOneShot(0); + + performURLRequest(urlRequest.get()); +} + +void PluginView::performURLRequest(URLRequest* request) +{ + // First, check if this is a javascript: url. + if (protocolIsJavaScript(request->request().url())) { + performJavaScriptURLRequest(request); + return; + } + + if (!request->target().isNull()) { + performFrameLoadURLRequest(request); + return; + } + + // This request is to load a URL and create a stream. + RefPtr<Stream> stream = PluginView::Stream::create(this, request->requestID(), request->request()); + addStream(stream.get()); + stream->start(); +} + +void PluginView::performFrameLoadURLRequest(URLRequest* request) +{ + ASSERT(!request->target().isNull()); + + Frame* frame = m_pluginElement->document()->frame(); + if (!frame) + return; + + if (!m_pluginElement->document()->securityOrigin()->canDisplay(request->request().url())) { + // We can't load the request, send back a reply to the plug-in. + m_plugin->frameDidFail(request->requestID(), false); + return; + } + + // First, try to find a target frame. + Frame* targetFrame = frame->loader()->findFrameForNavigation(request->target()); + if (!targetFrame) { + // We did not find a target frame. Ask our frame to load the page. This may or may not create a popup window. + frame->loader()->load(request->request(), request->target(), false); + + // FIXME: We don't know whether the window was successfully created here so we just assume that it worked. + // It's better than not telling the plug-in anything. + m_plugin->frameDidFinishLoading(request->requestID()); + return; + } + + // Now ask the frame to load the request. + targetFrame->loader()->load(request->request(), false); + + WebFrame* targetWebFrame = static_cast<WebFrameLoaderClient*>(targetFrame->loader()->client())->webFrame(); + if (WebFrame::LoadListener* loadListener = targetWebFrame->loadListener()) { + // Check if another plug-in view or even this view is waiting for the frame to load. + // If it is, tell it that the load was cancelled because it will be anyway. + loadListener->didFailLoad(targetWebFrame, true); + } + + m_pendingFrameLoads.set(targetWebFrame, request); + targetWebFrame->setLoadListener(this); +} + +void PluginView::performJavaScriptURLRequest(URLRequest* request) +{ + ASSERT(protocolIsJavaScript(request->request().url())); + + RefPtr<Frame> frame = m_pluginElement->document()->frame(); + if (!frame) + return; + + String jsString = decodeURLEscapeSequences(request->request().url().string().substring(sizeof("javascript:") - 1)); + + if (!request->target().isNull()) { + // For security reasons, only allow JS requests to be made on the frame that contains the plug-in. + if (frame->tree()->find(request->target()) != frame) { + // Let the plug-in know that its frame load failed. + m_plugin->frameDidFail(request->requestID(), false); + return; + } + } + + // Evaluate the JavaScript code. Note that running JavaScript here could cause the plug-in to be destroyed, so we + // grab references to the plug-in here. + RefPtr<Plugin> plugin = m_plugin; + + bool oldAllowPopups = frame->script()->allowPopupsFromPlugin(); + frame->script()->setAllowPopupsFromPlugin(request->allowPopups()); + + ScriptValue result = m_pluginElement->document()->frame()->script()->executeScript(jsString); + + frame->script()->setAllowPopupsFromPlugin(oldAllowPopups); + + // Check if evaluating the JavaScript destroyed the plug-in. + if (!plugin->controller()) + return; + + ScriptState* scriptState = m_pluginElement->document()->frame()->script()->globalObject(pluginWorld())->globalExec(); + String resultString; + result.getString(scriptState, resultString); + + if (!request->target().isNull()) { + // Just send back whether the frame load succeeded or not. + if (resultString.isNull()) + m_plugin->frameDidFail(request->requestID(), false); + else + m_plugin->frameDidFinishLoading(request->requestID()); + return; + } + + // Send the result back to the plug-in. + plugin->didEvaluateJavaScript(request->requestID(), decodeURLEscapeSequences(request->request().url()), resultString); +} + +void PluginView::addStream(Stream* stream) +{ + ASSERT(!m_streams.contains(stream->streamID())); + m_streams.set(stream->streamID(), stream); +} + +void PluginView::removeStream(Stream* stream) +{ + ASSERT(m_streams.get(stream->streamID()) == stream); + + m_streams.remove(stream->streamID()); +} + +void PluginView::cancelAllStreams() +{ + Vector<RefPtr<Stream> > streams; + copyValuesToVector(m_streams, streams); + + for (size_t i = 0; i < streams.size(); ++i) + streams[i]->cancel(); + + // Cancelling a stream removes it from the m_streams map, so if we cancel all streams the map should be empty. + ASSERT(m_streams.isEmpty()); +} + +void PluginView::redeliverManualStream() +{ + if (m_manualStreamState == StreamStateInitial) { + // Nothing to do. + return; + } + + if (m_manualStreamState == StreamStateFailed) { + manualLoadDidFail(m_manualStreamError); + return; + } + + // Deliver the response. + manualLoadDidReceiveResponse(m_manualStreamResponse); + + // Deliver the data. + if (m_manualStreamData) { + const char* data; + unsigned position = 0; + + while (unsigned length = m_manualStreamData->getSomeData(data, position)) { + manualLoadDidReceiveData(data, length); + position += length; + } + + m_manualStreamData = nullptr; + } + + if (m_manualStreamState == StreamStateFinished) + manualLoadDidFinishLoading(); +} + +void PluginView::invalidateRect(const IntRect& dirtyRect) +{ + if (!parent() || !m_plugin || !m_isInitialized) + return; + + IntRect dirtyRectInWindowCoordinates = convertToContainingWindow(dirtyRect); + + parent()->hostWindow()->invalidateContentsAndWindow(intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates()), false); +} + +void PluginView::setFocus(bool hasFocus) +{ + Widget::setFocus(hasFocus); + + if (!m_isInitialized || !m_plugin) + return; + + m_plugin->setFocus(hasFocus); +} + +void PluginView::mediaCanStart() +{ + ASSERT(m_isWaitingUntilMediaCanStart); + m_isWaitingUntilMediaCanStart = false; + + initializePlugin(); +} + +void PluginView::invalidate(const IntRect& dirtyRect) +{ + invalidateRect(dirtyRect); +} + +String PluginView::userAgent() +{ + Frame* frame = m_pluginElement->document()->frame(); + if (!frame) + return String(); + + return frame->loader()->client()->userAgent(KURL()); +} + +void PluginView::loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, + const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups) +{ + FrameLoadRequest frameLoadRequest(m_pluginElement->document()->securityOrigin()); + frameLoadRequest.resourceRequest().setHTTPMethod(method); + frameLoadRequest.resourceRequest().setURL(m_pluginElement->document()->completeURL(urlString)); + frameLoadRequest.resourceRequest().addHTTPHeaderFields(headerFields); + frameLoadRequest.resourceRequest().setHTTPBody(FormData::create(httpBody.data(), httpBody.size())); + frameLoadRequest.setFrameName(target); + + m_pendingURLRequests.append(URLRequest::create(requestID, frameLoadRequest, allowPopups)); + m_pendingURLRequestsTimer.startOneShot(0); +} + +void PluginView::cancelStreamLoad(uint64_t streamID) +{ + // Keep a reference to the stream. Stream::cancel might remove the stream from the map, and thus + // releasing its last reference. + RefPtr<Stream> stream = m_streams.get(streamID).get(); + if (!stream) + return; + + // Cancelling the stream here will remove it from the map. + stream->cancel(); + ASSERT(!m_streams.contains(streamID)); +} + +void PluginView::cancelManualStreamLoad() +{ + if (!frame()) + return; + + DocumentLoader* documentLoader = frame()->loader()->activeDocumentLoader(); + ASSERT(documentLoader); + + if (documentLoader->isLoadingMainResource()) + documentLoader->cancelMainResourceLoad(frame()->loader()->cancelledError(m_parameters.url)); +} + +NPObject* PluginView::windowScriptNPObject() +{ + if (!frame()) + return 0; + + // FIXME: Handle JavaScript being disabled. + ASSERT(frame()->script()->canExecuteScripts(NotAboutToExecuteScript)); + + return m_npRuntimeObjectMap.getOrCreateNPObject(frame()->script()->windowShell(pluginWorld())->window()); +} + +NPObject* PluginView::pluginElementNPObject() +{ + if (!frame()) + return 0; + + // FIXME: Handle JavaScript being disabled. + JSObject* object = frame()->script()->jsObjectForPluginElement(m_pluginElement.get()); + ASSERT(object); + + return m_npRuntimeObjectMap.getOrCreateNPObject(object); +} + +bool PluginView::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result, bool allowPopups) +{ + if (!frame()) + return false; + + bool oldAllowPopups = frame()->script()->allowPopupsFromPlugin(); + frame()->script()->setAllowPopupsFromPlugin(allowPopups); + + bool returnValue = m_npRuntimeObjectMap.evaluate(npObject, scriptString, result); + + frame()->script()->setAllowPopupsFromPlugin(oldAllowPopups); + + return returnValue; +} + +void PluginView::setStatusbarText(const String& statusbarText) +{ + if (!frame()) + return; + + Page* page = frame()->page(); + if (!page) + return; + + page->chrome()->setStatusbarText(frame(), statusbarText); +} + +bool PluginView::isAcceleratedCompositingEnabled() +{ + if (!frame()) + return false; + + Settings* settings = frame()->settings(); + if (!settings) + return false; + + return settings->acceleratedCompositingEnabled(); +} + +void PluginView::pluginProcessCrashed() +{ + if (!m_pluginElement->renderer()) + return; + + // FIXME: The renderer could also be a RenderApplet, we should handle that. + if (!m_pluginElement->renderer()->isEmbeddedObject()) + return; + + RenderEmbeddedObject* renderer = toRenderEmbeddedObject(m_pluginElement->renderer()); + renderer->setShowsCrashedPluginIndicator(); + + invalidateRect(frameRect()); +} + +#if PLATFORM(WIN) +HWND PluginView::nativeParentWindow() +{ + return m_webPage->nativeWindow(); +} +#endif + +#if PLATFORM(MAC) +void PluginView::setComplexTextInputEnabled(bool complexTextInputEnabled) +{ + m_webPage->send(Messages::WebPageProxy::SetComplexTextInputEnabled(m_plugin->pluginComplexTextInputIdentifier(), complexTextInputEnabled)); +} +#endif + +String PluginView::proxiesForURL(const String& urlString) +{ + const FrameLoader* frameLoader = frame() ? frame()->loader() : 0; + const NetworkingContext* context = frameLoader ? frameLoader->networkingContext() : 0; + Vector<ProxyServer> proxyServers = proxyServersForURL(KURL(KURL(), urlString), context); + return toString(proxyServers); +} + +String PluginView::cookiesForURL(const String& urlString) +{ + return cookies(m_pluginElement->document(), KURL(KURL(), urlString)); +} + +void PluginView::setCookiesForURL(const String& urlString, const String& cookieString) +{ + setCookies(m_pluginElement->document(), KURL(KURL(), urlString), cookieString); +} + +bool PluginView::isPrivateBrowsingEnabled() +{ + // If we can't get the real setting, we'll assume that private browsing is enabled. + if (!frame()) + return true; + + Settings* settings = frame()->settings(); + if (!settings) + return true; + + return settings->privateBrowsingEnabled(); +} + +void PluginView::didFinishLoad(WebFrame* webFrame) +{ + RefPtr<URLRequest> request = m_pendingFrameLoads.take(webFrame); + ASSERT(request); + webFrame->setLoadListener(0); + + m_plugin->frameDidFinishLoading(request->requestID()); +} + +void PluginView::didFailLoad(WebFrame* webFrame, bool wasCancelled) +{ + RefPtr<URLRequest> request = m_pendingFrameLoads.take(webFrame); + ASSERT(request); + webFrame->setLoadListener(0); + + m_plugin->frameDidFail(request->requestID(), wasCancelled); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h new file mode 100644 index 0000000..07511d7 --- /dev/null +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h @@ -0,0 +1,185 @@ +/* + * 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 PluginView_h +#define PluginView_h + +#include "NPRuntimeObjectMap.h" +#include "Plugin.h" +#include "PluginController.h" +#include "RunLoop.h" +#include "WebFrame.h" + +#include <WebCore/MediaCanStartListener.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceResponse.h> +#include <WebCore/PluginViewBase.h> +#include <wtf/Deque.h> + +// FIXME: Eventually this should move to WebCore. + +namespace WebCore { + class Frame; + class HTMLPlugInElement; +} + +namespace WebKit { + +class PluginView : public WebCore::PluginViewBase, WebCore::MediaCanStartListener, PluginController, WebFrame::LoadListener { +public: + static PassRefPtr<PluginView> create(PassRefPtr<WebCore::HTMLPlugInElement>, PassRefPtr<Plugin>, const Plugin::Parameters&); + + WebCore::Frame* frame(); + + bool isBeingDestroyed() const { return m_isBeingDestroyed; } + + void manualLoadDidReceiveResponse(const WebCore::ResourceResponse&); + void manualLoadDidReceiveData(const char* bytes, int length); + void manualLoadDidFinishLoading(); + void manualLoadDidFail(const WebCore::ResourceError&); + +#if PLATFORM(MAC) + void setWindowIsVisible(bool); + void setWindowIsFocused(bool); + void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates); + bool sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput); +#endif + +private: + PluginView(PassRefPtr<WebCore::HTMLPlugInElement>, PassRefPtr<Plugin>, const Plugin::Parameters& parameters); + virtual ~PluginView(); + + void initializePlugin(); + void destroyPlugin(); + + void viewGeometryDidChange(); + WebCore::IntRect clipRectInWindowCoordinates() const; + void focusPluginElement(); + + void pendingURLRequestsTimerFired(); + class URLRequest; + void performURLRequest(URLRequest*); + + // Perform a URL request where the frame target is not null. + void performFrameLoadURLRequest(URLRequest*); + + // Perform a URL request where the URL protocol is "javascript:". + void performJavaScriptURLRequest(URLRequest*); + + class Stream; + void addStream(Stream*); + void removeStream(Stream*); + void cancelAllStreams(); + + void redeliverManualStream(); + + // WebCore::PluginViewBase +#if PLATFORM(MAC) + virtual PlatformLayer* platformLayer() const; +#endif + virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*); + virtual void privateBrowsingStateChanged(bool); + + // WebCore::Widget + virtual void setFrameRect(const WebCore::IntRect&); + virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); + virtual void invalidateRect(const WebCore::IntRect&); + virtual void setFocus(bool); + virtual void frameRectsChanged(); + virtual void setParent(WebCore::ScrollView*); + virtual void handleEvent(WebCore::Event*); + + // WebCore::MediaCanStartListener + virtual void mediaCanStart(); + + // PluginController + virtual void invalidate(const WebCore::IntRect&); + virtual String userAgent(); + virtual void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, + const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups); + virtual void cancelStreamLoad(uint64_t streamID); + virtual void cancelManualStreamLoad(); + virtual NPObject* windowScriptNPObject(); + virtual NPObject* pluginElementNPObject(); + virtual bool evaluate(NPObject*, const String&scriptString, NPVariant* result, bool allowPopups); + virtual void setStatusbarText(const String&); + virtual bool isAcceleratedCompositingEnabled(); + virtual void pluginProcessCrashed(); +#if PLATFORM(WIN) + virtual HWND nativeParentWindow(); +#endif +#if PLATFORM(MAC) + virtual void setComplexTextInputEnabled(bool); +#endif + virtual String proxiesForURL(const String&); + virtual String cookiesForURL(const String&); + virtual void setCookiesForURL(const String& urlString, const String& cookieString); + virtual bool isPrivateBrowsingEnabled(); + + // WebFrame::LoadListener + virtual void didFinishLoad(WebFrame*); + virtual void didFailLoad(WebFrame*, bool wasCancelled); + + RefPtr<WebCore::HTMLPlugInElement> m_pluginElement; + RefPtr<Plugin> m_plugin; + WebPage* m_webPage; + Plugin::Parameters m_parameters; + + bool m_isInitialized; + bool m_isWaitingUntilMediaCanStart; + bool m_isBeingDestroyed; + + // Pending URLRequests that the plug-in has made. + Deque<RefPtr<URLRequest> > m_pendingURLRequests; + RunLoop::Timer<PluginView> m_pendingURLRequestsTimer; + + // Pending frame loads that the plug-in has made. + typedef HashMap<RefPtr<WebFrame>, RefPtr<URLRequest> > FrameLoadMap; + FrameLoadMap m_pendingFrameLoads; + + // Streams that the plug-in has requested to load. + HashMap<uint64_t, RefPtr<Stream> > m_streams; + + // A map of all related NPObjects for this plug-in view. + NPRuntimeObjectMap m_npRuntimeObjectMap; + + // The manual stream state. This is used so we can deliver a manual stream to a plug-in + // when it is initialized. + enum ManualStreamState { + StreamStateInitial, + StreamStateHasReceivedResponse, + StreamStateFinished, + StreamStateFailed + }; + ManualStreamState m_manualStreamState; + + WebCore::ResourceResponse m_manualStreamResponse; + WebCore::ResourceError m_manualStreamError; + RefPtr<WebCore::SharedBuffer> m_manualStreamData; +}; + +} // namespace WebKit + +#endif // PluginView_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp new file mode 100644 index 0000000..ffca3fa --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -0,0 +1,686 @@ +/* + * 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 "WebChromeClient.h" + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +#include "DrawingArea.h" +#include "InjectedBundleUserMessageCoders.h" +#include "WebContextMenu.h" +#include "WebCoreArgumentCoders.h" +#include "WebFrame.h" +#include "WebFrameLoaderClient.h" +#include "WebOpenPanelParameters.h" +#include "WebOpenPanelResultListener.h" +#include "WebPage.h" +#include "WebPageCreationParameters.h" +#include "WebPageProxyMessages.h" +#include "WebPopupMenu.h" +#include "WebPreferencesStore.h" +#include "WebProcess.h" +#include "WebProcessProxyMessageKinds.h" +#include "WebSearchPopupMenu.h" +#include <WebCore/DatabaseTracker.h> +#include <WebCore/FileChooser.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameLoader.h> +#include <WebCore/HTMLNames.h> +#include <WebCore/HTMLPlugInImageElement.h> +#include <WebCore/Page.h> +#include <WebCore/SecurityOrigin.h> + +using namespace WebCore; +using namespace HTMLNames; + +namespace WebKit { + +static double area(WebFrame* frame) +{ + IntSize size = frame->size(); + return static_cast<double>(size.height()) * size.width(); +} + + +static WebFrame* findLargestFrameInFrameSet(WebPage* page) +{ + WebFrame* mainFrame = page->mainFrame(); + if (!mainFrame->isFrameSet()) + return 0; + + WebFrame* largestSoFar = 0; + + RefPtr<ImmutableArray> frameChildren = mainFrame->childFrames(); + size_t count = frameChildren->size(); + for (size_t i = 0; i < count; ++i) { + WebFrame* childFrame = frameChildren->at<WebFrame>(i); + if (!largestSoFar || area(childFrame) > area(largestSoFar)) + largestSoFar = childFrame; + } + + return largestSoFar; +} + +void WebChromeClient::chromeDestroyed() +{ + delete this; +} + +void WebChromeClient::setWindowRect(const FloatRect& windowFrame) +{ + m_page->send(Messages::WebPageProxy::SetWindowFrame(windowFrame)); +} + +FloatRect WebChromeClient::windowRect() +{ + FloatRect newWindowFrame; + + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetWindowFrame(), Messages::WebPageProxy::GetWindowFrame::Reply(newWindowFrame), m_page->pageID())) + return FloatRect(); + + return newWindowFrame; +} + +FloatRect WebChromeClient::pageRect() +{ + return FloatRect(FloatPoint(), m_page->size()); +} + +float WebChromeClient::scaleFactor() +{ + notImplemented(); + return 1.0; +} + +void WebChromeClient::focus() +{ + notImplemented(); +} + +void WebChromeClient::unfocus() +{ + notImplemented(); +} + +bool WebChromeClient::canTakeFocus(FocusDirection) +{ + notImplemented(); + return true; +} + +void WebChromeClient::takeFocus(FocusDirection direction) +{ + m_page->send(Messages::WebPageProxy::TakeFocus(direction == FocusDirectionForward ? true : false)); +} + +void WebChromeClient::focusedNodeChanged(Node*) +{ + notImplemented(); +} + +void WebChromeClient::focusedFrameChanged(Frame* frame) +{ + WebFrame* webFrame = frame ? static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame() : 0; + + WebProcess::shared().connection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID()); +} + +Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction) +{ + uint32_t modifiers = modifiersForNavigationAction(navigationAction); + int32_t mouseButton = mouseButtonForNavigationAction(navigationAction); + + uint64_t newPageID = 0; + WebPageCreationParameters parameters; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CreateNewPage(windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID())) + return 0; + + if (!newPageID) + return 0; + + WebProcess::shared().createWebPage(newPageID, parameters); + return WebProcess::shared().webPage(newPageID)->corePage(); +} + +void WebChromeClient::show() +{ + m_page->show(); +} + +bool WebChromeClient::canRunModal() +{ + notImplemented(); + return false; +} + +void WebChromeClient::runModal() +{ + notImplemented(); +} + +void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible) +{ + m_page->send(Messages::WebPageProxy::SetToolbarsAreVisible(toolbarsAreVisible)); +} + +bool WebChromeClient::toolbarsVisible() +{ + bool toolbarsAreVisible = true; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetToolbarsAreVisible(), Messages::WebPageProxy::GetToolbarsAreVisible::Reply(toolbarsAreVisible), m_page->pageID())) + return true; + + return toolbarsAreVisible; +} + +void WebChromeClient::setStatusbarVisible(bool statusBarIsVisible) +{ + m_page->send(Messages::WebPageProxy::SetStatusBarIsVisible(statusBarIsVisible)); +} + +bool WebChromeClient::statusbarVisible() +{ + bool statusBarIsVisible = true; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetStatusBarIsVisible(), Messages::WebPageProxy::GetStatusBarIsVisible::Reply(statusBarIsVisible), m_page->pageID())) + return true; + + return statusBarIsVisible; +} + +void WebChromeClient::setScrollbarsVisible(bool) +{ + notImplemented(); +} + +bool WebChromeClient::scrollbarsVisible() +{ + notImplemented(); + return true; +} + +void WebChromeClient::setMenubarVisible(bool menuBarVisible) +{ + m_page->send(Messages::WebPageProxy::SetMenuBarIsVisible(menuBarVisible)); +} + +bool WebChromeClient::menubarVisible() +{ + bool menuBarIsVisible = true; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetMenuBarIsVisible(), Messages::WebPageProxy::GetMenuBarIsVisible::Reply(menuBarIsVisible), m_page->pageID())) + return true; + + return menuBarIsVisible; +} + +void WebChromeClient::setResizable(bool resizable) +{ + m_page->send(Messages::WebPageProxy::SetIsResizable(resizable)); +} + +void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) +{ + // Notify the bundle client. + m_page->injectedBundleUIClient().willAddMessageToConsole(m_page, message, lineNumber); + + notImplemented(); +} + +bool WebChromeClient::canRunBeforeUnloadConfirmPanel() +{ + bool canRun = false; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel(), Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel::Reply(canRun), m_page->pageID())) + return false; + + return canRun; +} + +bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) +{ + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + + bool shouldClose = false; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page->pageID())) + return false; + + return shouldClose; +} + +void WebChromeClient::closeWindowSoon() +{ + // FIXME: This code assumes that the client will respond to a close page + // message by actually closing the page. Safari does this, but there is + // no guarantee that other applications will, which will leave this page + // half detached. This approach is an inherent limitation making parts of + // a close execute synchronously as part of window.close, but other parts + // later on. + + m_page->corePage()->setGroupName(String()); + + if (WebFrame* frame = m_page->mainFrame()) { + if (Frame* coreFrame = frame->coreFrame()) + coreFrame->loader()->stopForUserCancel(); + } + + m_page->sendClose(); +} + +void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText) +{ + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + + // Notify the bundle client. + m_page->injectedBundleUIClient().willRunJavaScriptAlert(m_page, alertText, webFrame); + + WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page->pageID()); +} + +bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message) +{ + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + + // Notify the bundle client. + m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame); + + bool result = false; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page->pageID())) + return false; + + return result; +} + +bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) +{ + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + + // Notify the bundle client. + m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame); + + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page->pageID())) + return false; + + return !result.isNull(); +} + +void WebChromeClient::setStatusbarText(const String& statusbarText) +{ + // Notify the bundle client. + m_page->injectedBundleUIClient().willSetStatusbarText(m_page, statusbarText); + + m_page->send(Messages::WebPageProxy::SetStatusText(statusbarText)); +} + +bool WebChromeClient::shouldInterruptJavaScript() +{ + notImplemented(); + return false; +} + +bool WebChromeClient::tabsToLinks() const +{ + return m_page->tabsToLinks(); +} + +IntRect WebChromeClient::windowResizerRect() const +{ + return m_page->windowResizerRect(); +} + +void WebChromeClient::invalidateWindow(const IntRect&, bool) +{ + // Do nothing here, there's no concept of invalidating the window in the web process. +} + +void WebChromeClient::invalidateContentsAndWindow(const IntRect& rect, bool) +{ + m_page->drawingArea()->setNeedsDisplay(rect); +} + +void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool) +{ + m_page->pageDidScroll(); + m_page->drawingArea()->setNeedsDisplay(rect); +} + +void WebChromeClient::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect&) +{ + m_page->pageDidScroll(); + m_page->drawingArea()->scroll(scrollRect, scrollDelta); +} + +#if ENABLE(TILED_BACKING_STORE) +void WebChromeClient::delegatedScrollRequested(const IntSize& scrollDelta) +{ + m_page->pageDidRequestScroll(scrollDelta); +} +#endif + +IntPoint WebChromeClient::screenToWindow(const IntPoint&) const +{ + notImplemented(); + return IntPoint(); +} + +IntRect WebChromeClient::windowToScreen(const IntRect&) const +{ + notImplemented(); + return IntRect(); +} + +PlatformPageClient WebChromeClient::platformPageClient() const +{ + notImplemented(); + return 0; +} + +void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const +{ +#if PLATFORM(QT) +#if ENABLE(TILED_BACKING_STORE) + if (frame->page()->mainFrame() == frame) + m_page->resizeToContentsIfNeeded(); +#endif + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + + if (!m_page->mainFrame() || m_page->mainFrame() != webFrame) + return; + + m_page->send(Messages::WebPageProxy::DidChangeContentsSize(size)); +#endif + + 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()); + } +} + +void WebChromeClient::scrollRectIntoView(const IntRect&, const ScrollView*) const +{ + notImplemented(); +} + +bool WebChromeClient::shouldMissingPluginMessageBeButton() const +{ + // FIXME: <rdar://problem/8794397> We should only return true when there is a + // missingPluginButtonClicked callback defined on the Page UI client. + return true; +} + +void WebChromeClient::missingPluginButtonClicked(Element* element) const +{ + ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag)); + + HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element); + + m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url())); +} + +void WebChromeClient::scrollbarsModeDidChange() const +{ + notImplemented(); +} + +void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& hitTestResult, unsigned modifierFlags) +{ + RefPtr<APIObject> userData; + + // Notify the bundle client. + m_page->injectedBundleUIClient().mouseDidMoveOverElement(m_page, hitTestResult, static_cast<WebEvent::Modifiers>(modifierFlags), userData); + + // Notify the UIProcess. + m_page->send(Messages::WebPageProxy::MouseDidMoveOverElement(modifierFlags, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebChromeClient::setToolTip(const String& toolTip, TextDirection) +{ + // Only send a tool tip to the WebProcess if it has changed since the last time this function was called. + + if (toolTip == m_cachedToolTip) + return; + m_cachedToolTip = toolTip; + + m_page->send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip)); +} + +void WebChromeClient::print(Frame*) +{ + notImplemented(); +} + +#if ENABLE(DATABASE) +void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName) +{ + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + SecurityOrigin* origin = frame->document()->securityOrigin(); + + DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin); + uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin); + uint64_t newQuota = 0; + WebProcess::shared().connection()->sendSync( + Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, details.currentUsage(), details.expectedUsage()), + Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID()); + + DatabaseTracker::tracker().setQuota(origin, newQuota); +} +#endif + + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +void WebChromeClient::reachedMaxAppCacheSize(int64_t) +{ + notImplemented(); +} + +void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*) +{ + notImplemented(); +} +#endif + +#if ENABLE(DASHBOARD_SUPPORT) +void WebChromeClient::dashboardRegionsChanged() +{ + notImplemented(); +} +#endif + +void WebChromeClient::populateVisitedLinks() +{ +} + +FloatRect WebChromeClient::customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect) +{ + notImplemented(); + return FloatRect(); +} + +void WebChromeClient::paintCustomHighlight(Node*, const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, + bool behindText, bool entireLine) +{ + notImplemented(); +} + +bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename) +{ + notImplemented(); + return false; +} + +String WebChromeClient::generateReplacementFile(const String& path) +{ + notImplemented(); + return String(); +} + +bool WebChromeClient::paintCustomScrollbar(GraphicsContext*, const FloatRect&, ScrollbarControlSize, + ScrollbarControlState, ScrollbarPart pressedPart, bool vertical, + float value, float proportion, ScrollbarControlPartMask) +{ + notImplemented(); + return false; +} + +bool WebChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&) +{ + notImplemented(); + return false; +} + +void WebChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*) +{ + notImplemented(); +} + +void WebChromeClient::cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) +{ + notImplemented(); +} + +void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser) +{ + if (m_page->activeOpenPanelResultListener()) + return; + + RefPtr<FileChooser> fileChooser = prpFileChooser; + + m_page->setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser.get())); + + WebOpenPanelParameters::Data parameters; + parameters.allowMultipleFiles = fileChooser->allowsMultipleFiles(); +#if ENABLE(DIRECTORY_UPLOAD) + parameters.allowsDirectoryUpload = fileChooser->allowsDirectoryUpload(); +#else + parameters.allowsDirectoryUpload = false; +#endif + parameters.acceptTypes = fileChooser->acceptTypes(); + parameters.filenames = fileChooser->filenames(); + + m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), parameters)); +} + +void WebChromeClient::chooseIconForFiles(const Vector<String>&, FileChooser*) +{ + notImplemented(); +} + +void WebChromeClient::setCursor(const WebCore::Cursor& cursor) +{ +#if USE(LAZY_NATIVE_CURSOR) + m_page->send(Messages::WebPageProxy::SetCursor(cursor)); +#endif +} + +void WebChromeClient::formStateDidChange(const Node*) +{ + notImplemented(); +} + +void WebChromeClient::formDidFocus(const Node*) +{ + notImplemented(); +} + +void WebChromeClient::formDidBlur(const Node*) +{ + notImplemented(); +} + +bool WebChromeClient::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const +{ + return WebPopupMenu::create(m_page, client); +} + +PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const +{ + return WebSearchPopupMenu::create(m_page, client); +} + +#if ENABLE(CONTEXT_MENUS) +void WebChromeClient::showContextMenu() +{ + m_page->contextMenu()->show(); +} +#endif + +PassOwnPtr<HTMLParserQuirks> WebChromeClient::createHTMLParserQuirks() +{ + notImplemented(); + return 0; +} + +#if USE(ACCELERATED_COMPOSITING) +void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer) +{ + if (layer) + m_page->enterAcceleratedCompositingMode(layer); + else + m_page->exitAcceleratedCompositingMode(); +} + +void WebChromeClient::setNeedsOneShotDrawingSynchronization() +{ + notImplemented(); +} + +void WebChromeClient::scheduleCompositingLayerSync() +{ + if (m_page->drawingArea()) + m_page->drawingArea()->scheduleCompositingLayerSync(); +} + +#endif + +#if ENABLE(NOTIFICATIONS) +WebCore::NotificationPresenter* WebChromeClient::notificationPresenter() const +{ + return 0; +} +#endif + +#if ENABLE(TOUCH_EVENTS) +void WebChromeClient::needTouchEvents(bool) +{ +} +#endif + +#if PLATFORM(WIN) +void WebChromeClient::setLastSetCursorToCurrentCursor() +{ +} +#endif + +void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& args) const +{ + m_page->send(Messages::WebPageProxy::DidChangeViewportData(args)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h new file mode 100644 index 0000000..44c3658 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -0,0 +1,212 @@ +/* + * 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. + */ + +#ifndef WebChromeClient_h +#define WebChromeClient_h + +#include <WebCore/ChromeClient.h> +#include <WebCore/ViewportArguments.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +class WebFrame; +class WebPage; + +class WebChromeClient : public WebCore::ChromeClient { +public: + WebChromeClient(WebPage* page) + : m_page(page) + { + } + + WebPage* page() const { return m_page; } +private: + virtual void chromeDestroyed(); + + virtual void setWindowRect(const WebCore::FloatRect&); + virtual WebCore::FloatRect windowRect(); + + virtual WebCore::FloatRect pageRect(); + + virtual float scaleFactor(); + + virtual void focus(); + virtual void unfocus(); + + virtual bool canTakeFocus(WebCore::FocusDirection); + virtual void takeFocus(WebCore::FocusDirection); + + virtual void focusedNodeChanged(WebCore::Node*); + virtual void focusedFrameChanged(WebCore::Frame*); + + // The Frame pointer provides the ChromeClient with context about which + // Frame wants to create the new Page. Also, the newly created window + // should not be shown to the user until the ChromeClient of the newly + // created Page has its show method called. + virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&); + virtual void show(); + + virtual bool canRunModal(); + virtual void runModal(); + + virtual void setToolbarsVisible(bool); + virtual bool toolbarsVisible(); + + virtual void setStatusbarVisible(bool); + virtual bool statusbarVisible(); + + virtual void setScrollbarsVisible(bool); + virtual bool scrollbarsVisible(); + + virtual void setMenubarVisible(bool); + virtual bool menubarVisible(); + + virtual void setResizable(bool); + + virtual void addMessageToConsole(WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID); + + virtual bool canRunBeforeUnloadConfirmPanel(); + virtual bool runBeforeUnloadConfirmPanel(const String& message, WebCore::Frame* frame); + + virtual void closeWindowSoon(); + + virtual void runJavaScriptAlert(WebCore::Frame*, const String&); + virtual bool runJavaScriptConfirm(WebCore::Frame*, const String&); + virtual bool runJavaScriptPrompt(WebCore::Frame*, const String& message, const String& defaultValue, String& result); + virtual void setStatusbarText(const String&); + virtual bool shouldInterruptJavaScript(); + virtual bool tabsToLinks() const; + + virtual WebCore::IntRect windowResizerRect() const; + + // Methods used by HostWindow. + virtual void invalidateWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); + virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); + virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect); +#if ENABLE(TILED_BACKING_STORE) + virtual void delegatedScrollRequested(const WebCore::IntSize& scrollDelta); +#endif + virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; + virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; + virtual PlatformPageClient platformPageClient() const; + virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; + virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const; // Currently only Mac has a non empty implementation. + // End methods used by HostWindow. + + virtual bool shouldMissingPluginMessageBeButton() const; + virtual void missingPluginButtonClicked(WebCore::Element*) const; + + virtual void scrollbarsModeDidChange() const; + virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); + + virtual void setToolTip(const String&, WebCore::TextDirection); + + virtual void print(WebCore::Frame*); + +#if ENABLE(DATABASE) + virtual void exceededDatabaseQuota(WebCore::Frame*, const String& databaseName); +#endif + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); +#endif + +#if ENABLE(DASHBOARD_SUPPORT) + virtual void dashboardRegionsChanged(); +#endif + + virtual void populateVisitedLinks(); + + virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& lineRect); + virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect, + bool behindText, bool entireLine); + + virtual bool shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename); + virtual String generateReplacementFile(const String& path); + + virtual bool paintCustomScrollbar(WebCore::GraphicsContext*, const WebCore::FloatRect&, WebCore::ScrollbarControlSize, + WebCore::ScrollbarControlState, WebCore::ScrollbarPart pressedPart, bool vertical, + float value, float proportion, WebCore::ScrollbarControlPartMask); + virtual bool paintCustomScrollCorner(WebCore::GraphicsContext*, const WebCore::FloatRect&); + + // 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 PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + +#if ENABLE(CONTEXT_MENUS) + virtual void showContextMenu(); +#endif + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*); + virtual void setNeedsOneShotDrawingSynchronization(); + virtual void scheduleCompositingLayerSync(); +#endif + +#if ENABLE(NOTIFICATIONS) + virtual WebCore::NotificationPresenter* notificationPresenter() const; +#endif + +#if ENABLE(TOUCH_EVENTS) + virtual void needTouchEvents(bool); +#endif + +#if PLATFORM(WIN) + virtual void setLastSetCursorToCurrentCursor(); +#endif + + virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const; + + String m_cachedToolTip; + mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebChromeClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp new file mode 100644 index 0000000..42b60a5 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuClient.h" + +#include "WebContextMenuItemData.h" +#include "WebPage.h" +#include <WebCore/ContextMenu.h> +#include <WebCore/Frame.h> +#include <WebCore/Page.h> +#include <WebCore/UserGestureIndicator.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::contextMenuDestroyed() +{ + delete this; +} + +#if USE(CROSS_PLATFORM_CONTEXT_MENUS) +PassOwnPtr<ContextMenu> WebContextMenuClient::customizeMenu(PassOwnPtr<ContextMenu> menu) +{ + // WebKit2 ignores this client callback and does context menu customization when it is told to show the menu. + return menu; +} +#else +PlatformMenuDescription WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu) +{ + // WebKit2 ignores this client callback and does context menu customization when it is told to show the menu. + return menu->platformDescription(); +} +#endif + +void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) +{ + notImplemented(); +} + +void WebContextMenuClient::downloadURL(const KURL& url) +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +void WebContextMenuClient::searchWithGoogle(const Frame* frame) +{ + String searchString = frame->editor()->selectedText(); + searchString.stripWhiteSpace(); + String encoded = encodeWithURLEscapeSequences(searchString); + encoded.replace("%20", "+"); + + String url("http://www.google.com/search?q="); + url.append(encoded); + url.append("&ie=UTF-8&oe=UTF-8"); + + if (Page* page = frame->page()) { + UserGestureIndicator indicator(DefinitelyProcessingUserGesture); + page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, SendReferrer); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h new file mode 100644 index 0000000..0545a7d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h @@ -0,0 +1,68 @@ +/* + * 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 WebContextMenuClient_h +#define WebContextMenuClient_h + +#include <WebCore/ContextMenuClient.h> + +namespace WebKit { + +class WebPage; + +class WebContextMenuClient : public WebCore::ContextMenuClient { +public: + WebContextMenuClient(WebPage* page) + : m_page(page) + { + } + +private: + virtual void contextMenuDestroyed(); + +#if USE(CROSS_PLATFORM_CONTEXT_MENUS) + virtual PassOwnPtr<WebCore::ContextMenu> customizeMenu(PassOwnPtr<WebCore::ContextMenu>); +#else + virtual WebCore::PlatformMenuDescription getCustomMenuFromDefaultItems(WebCore::ContextMenu*); +#endif + virtual void contextMenuItemSelected(WebCore::ContextMenuItem*, const WebCore::ContextMenu*); + + virtual void downloadURL(const WebCore::KURL& url); + virtual void searchWithGoogle(const WebCore::Frame*); + virtual void lookUpInDictionary(WebCore::Frame*); + virtual bool isSpeaking(); + virtual void speak(const String&); + virtual void stopSpeaking(); + +#if PLATFORM(MAC) + virtual void searchWithSpotlight(); +#endif + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebContextMenuClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp new file mode 100644 index 0000000..cc61b04 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManager.h" + +#include "Connection.h" +#include "MessageID.h" +#include "OriginAndDatabases.h" +#include "WebCoreArgumentCoders.h" +#include "WebDatabaseManagerProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/DatabaseDetails.h> +#include <WebCore/DatabaseTracker.h> +#include <WebCore/SecurityOrigin.h> + +using namespace WebCore; + +namespace WebKit { + +WebDatabaseManager& WebDatabaseManager::shared() +{ + static WebDatabaseManager& shared = *new WebDatabaseManager; + return shared; +} + +WebDatabaseManager::WebDatabaseManager() +{ + DatabaseTracker::initializeTracker(databaseDirectory()); + DatabaseTracker::tracker().setClient(this); +} + +WebDatabaseManager::~WebDatabaseManager() +{ +} + +void WebDatabaseManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + didReceiveWebDatabaseManagerMessage(connection, messageID, arguments); +} + +void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const +{ + // FIXME: This could be made more efficient by adding a function to DatabaseTracker + // to get both the origins and the Vector of DatabaseDetails for each origin in one + // shot. That would avoid taking the numerous locks this requires. + + Vector<RefPtr<SecurityOrigin> > origins; + DatabaseTracker::tracker().origins(origins); + + Vector<OriginAndDatabases> originAndDatabasesVector; + originAndDatabasesVector.reserveInitialCapacity(origins.size()); + + for (size_t i = 0; i < origins.size(); ++i) { + OriginAndDatabases originAndDatabases; + + Vector<String> nameVector; + if (!DatabaseTracker::tracker().databaseNamesForOrigin(origins[i].get(), nameVector)) + continue; + + Vector<DatabaseDetails> detailsVector; + detailsVector.reserveInitialCapacity(nameVector.size()); + for (size_t j = 0; j < nameVector.size(); j++) { + DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(nameVector[j], origins[i].get()); + if (details.name().isNull()) + continue; + + detailsVector.append(details); + } + + if (detailsVector.isEmpty()) + continue; + + originAndDatabases.originIdentifier = origins[i]->databaseIdentifier(); + originAndDatabases.originQuota = DatabaseTracker::tracker().quotaForOrigin(origins[i].get()); + originAndDatabases.originUsage = DatabaseTracker::tracker().usageForOrigin(origins[i].get()); + originAndDatabases.databases.swap(detailsVector); + originAndDatabasesVector.append(originAndDatabases); + } + + WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidGetDatabasesByOrigin(originAndDatabasesVector, callbackID), 0); +} + +void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const +{ + Vector<RefPtr<SecurityOrigin> > origins; + DatabaseTracker::tracker().origins(origins); + + size_t numOrigins = origins.size(); + + Vector<String> identifiers(numOrigins); + for (size_t i = 0; i < numOrigins; ++i) + identifiers[i] = origins[i]->databaseIdentifier(); + WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidGetDatabaseOrigins(identifiers, callbackID), 0); +} + +void WebDatabaseManager::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const +{ + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); + if (!origin) + return; + + DatabaseTracker::tracker().deleteDatabase(origin.get(), databaseIdentifier); +} + +void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const +{ + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); + if (!origin) + return; + + DatabaseTracker::tracker().deleteOrigin(origin.get()); +} + +void WebDatabaseManager::deleteAllDatabases() const +{ + DatabaseTracker::tracker().deleteAllDatabases(); +} + +void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const +{ + // If the quota is set to a value lower than the current usage, that quota will + // "stick" but no data will be purged to meet the new quota. This will simply + // prevent new data from being added to databases in that origin. + + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); + if (!origin) + return; + + DatabaseTracker::tracker().setQuota(origin.get(), quota); +} + +void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin) +{ + // NOTE: This may be called on a non-main thread. + WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidModifyOrigin(origin->databaseIdentifier()), 0); +} + +void WebDatabaseManager::dispatchDidModifyDatabase(WebCore::SecurityOrigin* origin, const String& databaseIdentifier) +{ + // NOTE: This may be called on a non-main thread. + WebProcess::shared().connection()->send(Messages::WebDatabaseManagerProxy::DidModifyDatabase(origin->databaseIdentifier(), databaseIdentifier), 0); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h new file mode 100644 index 0000000..4701645 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h @@ -0,0 +1,72 @@ +/* + * 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 WebDatabaseManager_h +#define WebDatabaseManager_h + +#include "Arguments.h" +#include <WebCore/DatabaseTrackerClient.h> +#include <wtf/Noncopyable.h> +#include <wtf/text/WTFString.h> + +namespace CoreIPC { +class ArgumentDecoder; +class Connection; +class MessageID; +} + +namespace WebKit { + +class WebDatabaseManager : public WebCore::DatabaseTrackerClient { + WTF_MAKE_NONCOPYABLE(WebDatabaseManager); +public: + static WebDatabaseManager& shared(); + + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + WebDatabaseManager(); + virtual ~WebDatabaseManager(); + + // Implemented in generated WebDatabaseManagerMessageReceiver.cpp + void didReceiveWebDatabaseManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + void getDatabasesByOrigin(uint64_t callbackID) const; + void getDatabaseOrigins(uint64_t callbackID) const; + void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const; + void deleteDatabasesForOrigin(const String& originIdentifier) const; + void deleteAllDatabases() const; + void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const; + + // WebCore::DatabaseTrackerClient + virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); + virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier); + + String databaseDirectory() const; +}; + +} // namespace WebKit + +#endif // WebDatabaseManager_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in new file mode 100644 index 0000000..e928ef6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in @@ -0,0 +1,30 @@ +# 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. + +messages -> WebDatabaseManager { + void GetDatabasesByOrigin(uint64_t callbackID) + void GetDatabaseOrigins(uint64_t callbackID) + void DeleteDatabaseWithNameForOrigin(WTF::String databaseIdentifier, WTF::String originIdentifier) + void DeleteDatabasesForOrigin(WTF::String originIdentifier) + void DeleteAllDatabases() + void SetQuotaForOrigin(WTF::String originIdentifier, uint64_t quota) +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp new file mode 100644 index 0000000..d11017f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDragClient.h" + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void WebDragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*) +{ +} + +void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) +{ +} + +DragDestinationAction WebDragClient::actionMaskForDrag(DragData*) +{ + return DragDestinationActionAny; +} + +DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& windowPoint) +{ + return DragSourceActionAny; +} + +void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) +{ +} + +DragImageRef WebDragClient::createDragImageForLink(KURL&, const String&, Frame*) +{ + notImplemented(); + return 0; +} + +void WebDragClient::dragControllerDestroyed() +{ + delete this; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h new file mode 100644 index 0000000..ce123c8 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h @@ -0,0 +1,58 @@ +/* + * 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 WebDragClient_h +#define WebDragClient_h + +#include <WebCore/DragClient.h> + +namespace WebKit { + +class WebPage; + +class WebDragClient : public WebCore::DragClient { +public: + WebDragClient(WebPage* page) + : m_page(page) + { + } + +private: + virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*); + virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*); + virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*); + 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*); + + virtual void dragControllerDestroyed(); + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebDragClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp new file mode 100644 index 0000000..e3db967 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -0,0 +1,438 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEditorClient.h" + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +#include "SelectionState.h" +#include "WebFrameLoaderClient.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/ArchiveResource.h> +#include <WebCore/DocumentFragment.h> +#include <WebCore/EditCommand.h> +#include <WebCore/FocusController.h> +#include <WebCore/Frame.h> +#include <WebCore/HTMLInputElement.h> +#include <WebCore/HTMLNames.h> +#include <WebCore/HTMLTextAreaElement.h> +#include <WebCore/KeyboardEvent.h> +#include <WebCore/Page.h> +#include <WebCore/UserTypingGestureIndicator.h> + +using namespace WebCore; +using namespace HTMLNames; + +namespace WebKit { + +void WebEditorClient::pageDestroyed() +{ + delete this; +} + +bool WebEditorClient::shouldDeleteRange(Range* range) +{ + bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(m_page, range); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*) +{ + notImplemented(); + return false; +} + +bool WebEditorClient::smartInsertDeleteEnabled() +{ + // FIXME: Why isn't this Mac specific like toggleSmartInsertDeleteEnabled? +#if PLATFORM(MAC) + return m_page->isSmartInsertDeleteEnabled(); +#else + return true; +#endif +} + +bool WebEditorClient::isSelectTrailingWhitespaceEnabled() +{ + notImplemented(); + return false; +} + +bool WebEditorClient::isContinuousSpellCheckingEnabled() +{ + return WebProcess::shared().textCheckerState().isContinuousSpellCheckingEnabled; +} + +void WebEditorClient::toggleContinuousSpellChecking() +{ + notImplemented(); +} + +bool WebEditorClient::isGrammarCheckingEnabled() +{ + return WebProcess::shared().textCheckerState().isGrammarCheckingEnabled; +} + +void WebEditorClient::toggleGrammarChecking() +{ + notImplemented(); +} + +int WebEditorClient::spellCheckerDocumentTag() +{ + notImplemented(); + return false; +} + + +bool WebEditorClient::isEditable() +{ + notImplemented(); + return false; +} + + +bool WebEditorClient::shouldBeginEditing(Range* range) +{ + bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(m_page, range); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldEndEditing(Range* range) +{ + bool result = m_page->injectedBundleEditorClient().shouldEndEditing(m_page, range); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action) +{ + bool result = m_page->injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action) +{ + bool result = m_page->injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) +{ + bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range) +{ + bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, style, range); + notImplemented(); + return result; +} + +bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*) +{ + notImplemented(); + return true; +} + +void WebEditorClient::didBeginEditing() +{ + // FIXME: What good is a notification name, if it's always the same? + static const String WebViewDidBeginEditingNotification = "WebViewDidBeginEditingNotification"; + m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.impl()); + notImplemented(); +} + +void WebEditorClient::respondToChangedContents() +{ + static const String WebViewDidChangeNotification = "WebViewDidChangeNotification"; + m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.impl()); + notImplemented(); +} + +void WebEditorClient::respondToChangedSelection() +{ + static const String WebViewDidChangeSelectionNotification = "WebViewDidChangeSelectionNotification"; + m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl()); + Frame* frame = m_page->corePage()->focusController()->focusedFrame(); + if (!frame) + return; + + SelectionState selectionState; + selectionState.isNone = frame->selection()->isNone(); + selectionState.isContentEditable = frame->selection()->isContentEditable(); + selectionState.isInPasswordField = frame->selection()->isInPasswordField(); + selectionState.hasComposition = frame->editor()->hasComposition(); + + WebPage::getLocationAndLengthFromRange(frame->selection()->toNormalizedRange().get(), selectionState.selectedRangeStart, selectionState.selectedRangeLength); + + m_page->send(Messages::WebPageProxy::SelectionStateChanged(selectionState)); + +#if PLATFORM(WIN) + // FIXME: This should also go into the selection state. + if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange()) + return; + + unsigned start; + unsigned end; + m_page->send(Messages::WebPageProxy::DidChangeCompositionSelection(frame->editor()->getCompositionSelection(start, end))); +#endif +} + +void WebEditorClient::didEndEditing() +{ + static const String WebViewDidEndEditingNotification = "WebViewDidEndEditingNotification"; + m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.impl()); + notImplemented(); +} + +void WebEditorClient::didWriteSelectionToPasteboard() +{ + notImplemented(); +} + +void WebEditorClient::didSetSelectionTypesForPasteboard() +{ + notImplemented(); +} + +void WebEditorClient::registerCommandForUndo(PassRefPtr<EditCommand> command) +{ + // FIXME: Add assertion that the command being reapplied is the same command that is + // being passed to us. + if (m_page->isInRedo()) + return; + + RefPtr<WebEditCommand> webCommand = WebEditCommand::create(command); + m_page->addWebEditCommand(webCommand->commandID(), webCommand.get()); + uint32_t editAction = static_cast<uint32_t>(webCommand->command()->editingAction()); + + m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(webCommand->commandID(), editAction)); +} + +void WebEditorClient::registerCommandForRedo(PassRefPtr<EditCommand>) +{ +} + +void WebEditorClient::clearUndoRedoOperations() +{ + m_page->send(Messages::WebPageProxy::ClearAllEditCommands()); +} + +bool WebEditorClient::canUndo() const +{ + notImplemented(); + return false; +} + +bool WebEditorClient::canRedo() const +{ + notImplemented(); + return false; +} + +void WebEditorClient::undo() +{ + notImplemented(); +} + +void WebEditorClient::redo() +{ + notImplemented(); +} + +#if !PLATFORM(MAC) +void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) +{ + if (m_page->handleEditingKeyboardEvent(event)) + event->setDefaultHandled(); +} + +void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*) +{ + notImplemented(); +} +#endif + +void WebEditorClient::textFieldDidBeginEditing(Element* element) +{ + if (!element->hasTagName(inputTag)) + return; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); +} + +void WebEditorClient::textFieldDidEndEditing(Element* element) +{ + if (!element->hasTagName(inputTag)) + return; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); +} + +void WebEditorClient::textDidChangeInTextField(Element* element) +{ + if (!element->hasTagName(inputTag)) + return; + + if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element) + return; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, static_cast<HTMLInputElement*>(element), webFrame); +} + +void WebEditorClient::textDidChangeInTextArea(Element* element) +{ + if (!element->hasTagName(textareaTag)) + return; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, static_cast<HTMLTextAreaElement*>(element), webFrame); +} + +static bool getActionTypeForKeyEvent(KeyboardEvent* event, WKInputFieldActionType& type) +{ + String key = event->keyIdentifier(); + if (key == "Up") + type = WKInputFieldActionTypeMoveUp; + else if (key == "Down") + type = WKInputFieldActionTypeMoveDown; + else if (key == "U+001B") + type = WKInputFieldActionTypeCancel; + else if (key == "U+0009") { + if (event->shiftKey()) + type = WKInputFieldActionTypeInsertBacktab; + else + type = WKInputFieldActionTypeInsertTab; + } else if (key == "Enter") + type = WKInputFieldActionTypeInsertNewline; + else + return false; + + return true; +} + +bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event) +{ + if (!element->hasTagName(inputTag)) + return false; + + WKInputFieldActionType actionType = static_cast<WKInputFieldActionType>(0); + if (!getActionTypeForKeyEvent(event, actionType)) + return false; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), actionType, webFrame); +} + +void WebEditorClient::textWillBeDeletedInTextField(Element* element) +{ + if (!element->hasTagName(inputTag)) + return; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); + m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), WKInputFieldActionTypeInsertDelete, webFrame); +} + +void WebEditorClient::ignoreWordInSpellDocument(const String& word) +{ + m_page->send(Messages::WebPageProxy::IgnoreWord(word)); +} + +void WebEditorClient::learnWord(const String& word) +{ + m_page->send(Messages::WebPageProxy::LearnWord(word)); +} + +void WebEditorClient::checkSpellingOfString(const UChar*, int, int*, int*) +{ + notImplemented(); +} + +String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&) +{ + notImplemented(); + return String(); +} + +void WebEditorClient::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) +{ + notImplemented(); +} + +void WebEditorClient::updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) +{ + notImplemented(); +} + +void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + m_page->send(Messages::WebPageProxy::UpdateSpellingUIWithMisspelledWord(misspelledWord)); +} + +void WebEditorClient::showSpellingUI(bool) +{ + notImplemented(); +} + +bool WebEditorClient::spellingUIIsShowing() +{ + notImplemented(); + return false; +} + +void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) +{ + m_page->sendSync(Messages::WebPageProxy::GetGuessesForWord(word, context), Messages::WebPageProxy::GetGuessesForWord::Reply(guesses)); +} + +void WebEditorClient::willSetInputMethodState() +{ + notImplemented(); +} + +void WebEditorClient::setInputMethodState(bool) +{ + notImplemented(); +} + +void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h new file mode 100644 index 0000000..40bd8c6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -0,0 +1,149 @@ +/* + * 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 WebEditorClient_h +#define WebEditorClient_h + +#include <WebCore/EditorClient.h> + +namespace WebKit { + +class WebPage; + +class WebEditorClient : public WebCore::EditorClient { +public: + WebEditorClient(WebPage* page) + : m_page(page) + { + } + +private: + virtual void pageDestroyed(); + + virtual bool shouldDeleteRange(WebCore::Range*); + virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*); + virtual bool smartInsertDeleteEnabled(); + virtual bool isSelectTrailingWhitespaceEnabled(); + virtual bool isContinuousSpellCheckingEnabled(); + virtual void toggleContinuousSpellChecking(); + virtual bool isGrammarCheckingEnabled(); + virtual void toggleGrammarChecking(); + virtual int spellCheckerDocumentTag(); + + virtual bool isEditable(); + + virtual bool shouldBeginEditing(WebCore::Range*); + virtual bool shouldEndEditing(WebCore::Range*); + virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction); + virtual bool shouldInsertText(const String&, WebCore::Range*, WebCore::EditorInsertAction); + virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting); + + virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*); + virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*); + + virtual void didBeginEditing(); + virtual void respondToChangedContents(); + virtual void respondToChangedSelection(); + virtual void didEndEditing(); + virtual void didWriteSelectionToPasteboard(); + virtual void didSetSelectionTypesForPasteboard(); + + virtual void registerCommandForUndo(PassRefPtr<WebCore::EditCommand>); + virtual void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>); + virtual void clearUndoRedoOperations(); + + virtual bool canUndo() const; + virtual bool canRedo() const; + + virtual void undo(); + virtual void redo(); + + virtual void handleKeyboardEvent(WebCore::KeyboardEvent*); + virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*); + + virtual void textFieldDidBeginEditing(WebCore::Element*); + virtual void textFieldDidEndEditing(WebCore::Element*); + virtual void textDidChangeInTextField(WebCore::Element*); + virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*); + virtual void textWillBeDeletedInTextField(WebCore::Element*); + virtual void textDidChangeInTextArea(WebCore::Element*); + +#if PLATFORM(MAC) + virtual NSString *userVisibleString(NSURL *); + virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource> >&); + virtual void setInsertionPasteboard(NSPasteboard *); + virtual NSURL* canonicalizeURL(NSURL*); + virtual NSURL* canonicalizeURLString(NSString*); +#ifdef BUILDING_ON_TIGER + virtual NSArray *pasteboardTypesForSelection(WebCore::Frame*); +#endif +#endif + +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + virtual void uppercaseWord(); + virtual void lowercaseWord(); + virtual void capitalizeWord(); + virtual void showSubstitutionsPanel(bool show); + virtual bool substitutionsPanelIsShowing(); + virtual void toggleSmartInsertDelete(); + virtual bool isAutomaticQuoteSubstitutionEnabled(); + virtual void toggleAutomaticQuoteSubstitution(); + virtual bool isAutomaticLinkDetectionEnabled(); + virtual void toggleAutomaticLinkDetection(); + virtual bool isAutomaticDashSubstitutionEnabled(); + virtual void toggleAutomaticDashSubstitution(); + virtual bool isAutomaticTextReplacementEnabled(); + virtual void toggleAutomaticTextReplacement(); + virtual bool isAutomaticSpellingCorrectionEnabled(); + virtual void toggleAutomaticSpellingCorrection(); +#endif + + virtual void ignoreWordInSpellDocument(const String&); + virtual void learnWord(const String&); + virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); + virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); + virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results); +#endif + virtual void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail& detail); + virtual void updateSpellingUIWithMisspelledWord(const String&); + virtual void showSpellingUI(bool show); + virtual bool spellingUIIsShowing(); + virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); + virtual void willSetInputMethodState(); + virtual void setInputMethodState(bool enabled); + virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&); +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings, WebCore::Editor*); + virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel); + virtual bool isShowingCorrectionPanel(); +#endif + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebEditorClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h new file mode 100644 index 0000000..ed43c57 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h @@ -0,0 +1,45 @@ +/* + * 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 WebErrors_h +#define WebErrors_h + +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +namespace WebKit { + +WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); +WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); +WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); +WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); +WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); +WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); +WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); + +} // namespace WebKit + +#endif // WebErrors_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp new file mode 100644 index 0000000..49ce240 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -0,0 +1,1300 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFrameLoaderClient.h" + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +#include "AuthenticationManager.h" +#include "DataReference.h" +#include "InjectedBundleUserMessageCoders.h" +#include "PlatformCertificateInfo.h" +#include "PluginView.h" +#include "StringPairVector.h" +#include "WebContextMessages.h" +#include "WebCoreArgumentCoders.h" +#include "WebErrors.h" +#include "WebEvent.h" +#include "WebFrame.h" +#include "WebFrameNetworkingContext.h" +#include "WebNavigationDataStore.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include "WebProcessProxyMessageKinds.h" +#include "WebProcessProxyMessages.h" +#include <JavaScriptCore/APICast.h> +#include <JavaScriptCore/JSObject.h> +#include <WebCore/Chrome.h> +#include <WebCore/DOMWrapperWorld.h> +#include <WebCore/DocumentLoader.h> +#include <WebCore/FormState.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameLoadRequest.h> +#include <WebCore/FrameView.h> +#include <WebCore/HTMLAppletElement.h> +#include <WebCore/HTMLFormElement.h> +#include <WebCore/MIMETypeRegistry.h> +#include <WebCore/MouseEvent.h> +#include <WebCore/Page.h> +#include <WebCore/PluginData.h> +#include <WebCore/ProgressTracker.h> +#include <WebCore/ResourceError.h> +#include <WebCore/UIEventWithKeyState.h> +#include <WebCore/Widget.h> +#include <WebCore/WindowFeatures.h> + +using namespace WebCore; + +namespace WebKit { + +WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* frame) + : m_frame(frame) + , m_hasSentResponseToPluginView(false) + , m_frameHasCustomRepresentation(false) +{ +} + +WebFrameLoaderClient::~WebFrameLoaderClient() +{ +} + +void WebFrameLoaderClient::frameLoaderDestroyed() +{ + m_frame->invalidate(); + + // Balances explicit ref() in WebFrame::createMainFrame and WebFrame::createSubframe. + m_frame->deref(); +} + +bool WebFrameLoaderClient::hasHTMLView() const +{ + return !m_frameHasCustomRepresentation; +} + +bool WebFrameLoaderClient::hasWebView() const +{ + return m_frame->page(); +} + +void WebFrameLoaderClient::makeRepresentation(DocumentLoader*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::forceLayout() +{ + notImplemented(); +} + +void WebFrameLoaderClient::forceLayoutForNonHTML() +{ + notImplemented(); +} + +void WebFrameLoaderClient::setCopiesOnScroll() +{ + notImplemented(); +} + +void WebFrameLoaderClient::detachedFromParent2() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didRemoveFrameFromHierarchy(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidRemoveFrameFromHierarchy(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); + +} + +void WebFrameLoaderClient::detachedFromParent3() +{ + notImplemented(); +} + +void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest& request) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::DidInitiateLoadForResource(m_frame->frameID(), identifier, request)); +} + +void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + if (!webPage->injectedBundleLoaderClient().shouldLoadResourceForFrame(webPage, m_frame, request.url().string())) { + request = ResourceRequest(); + // FIXME: We should probably send a message saying we cancelled the request for the resource. + return; + } + + webPage->send(Messages::WebPageProxy::DidSendRequestForResource(m_frame->frameID(), identifier, request, redirectResponse)); +} + +bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier) +{ + return true; +} + +void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge) +{ + // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet. + // Once we do, we might need to make sure authentication fits with our solution. + + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + AuthenticationManager::shared().didReceiveAuthenticationChallenge(m_frame, challenge); +} + +void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) +{ + notImplemented(); +} + +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) +bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace) +{ + // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet. + // Once we do, we might need to make sure authentication fits with our solution. + + WebPage* webPage = m_frame->page(); + if (!webPage) + return false; + + bool canAuthenticate; + if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate))) + return false; + + return canAuthenticate; +} +#endif + +void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::DidReceiveResponseForResource(m_frame->frameID(), identifier, response)); +} + +void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::DidReceiveContentLengthForResource(m_frame->frameID(), identifier, lengthReceived)); +} + +void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::DidFinishLoadForResource(m_frame->frameID(), identifier)); +} + +void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& error) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::DidFailLoadForResource(m_frame->frameID(), identifier, error)); +} + +bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) +{ + notImplemented(); + return false; +} + +void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const String&) +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidHandleOnloadEvents() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didHandleOnloadEventsForFrame(webPage, m_frame); +} + +void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader()->provisionalDocumentLoader(); + const String& url = provisionalLoader->url().string(); + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didReceiveServerRedirectForProvisionalLoadForFrame(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), url, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidCancelClientRedirect() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didCancelClientRedirectForFrame(webPage, m_frame); +} + +void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url, double interval, double fireDate) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().willPerformClientRedirectForFrame(webPage, m_frame, url.string(), interval, fireDate); +} + +void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + 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()))); +} + +void WebFrameLoaderClient::dispatchDidPushStateWithinPage() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + 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()))); +} + +void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + 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()))); +} + +void WebFrameLoaderClient::dispatchDidPopStateWithinPage() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + 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()))); +} + +void WebFrameLoaderClient::dispatchWillClose() +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidReceiveIcon() +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + webPage->findController().hideFindUI(); + + DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader()->provisionalDocumentLoader(); + const String& url = provisionalLoader->url().string(); + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(webPage, m_frame, userData); + + bool loadingSubstituteDataForUnreachableURL = !provisionalLoader->unreachableURL().isNull(); + + webPage->sandboxExtensionTracker().didStartProvisionalLoad(m_frame); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, loadingSubstituteDataForUnreachableURL, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, title, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidChangeIcons() +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidCommitLoad() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response(); + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didCommitLoadForFrame(webPage, m_frame, userData); + + 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()))); +} + +void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFailProvisionalLoadWithErrorForFrame(webPage, m_frame, error, userData); + + webPage->sandboxExtensionTracker().didFailProvisionalLoad(m_frame); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get()))); + + // If we have a load listener, notify it. + if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) + loadListener->didFailLoad(m_frame, error.isCancellation()); +} + +void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFailLoadWithErrorForFrame(webPage, m_frame, error, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get()))); + + // If we have a load listener, notify it. + if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) + loadListener->didFailLoad(m_frame, error.isCancellation()); +} + +void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFinishDocumentLoadForFrame(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFinishDocumentLoadForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidFinishLoad() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFinishLoadForFrame(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); + + // If we have a load listener, notify it. + if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) + loadListener->didFinishLoad(m_frame); +} + +void WebFrameLoaderClient::dispatchDidFirstLayout() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + // Notify the bundle client. + webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData); + + // Notify the UIProcess. + webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); +} + +Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return 0; + + // Just call through to the chrome client. + Page* newPage = webPage->corePage()->chrome()->createWindow(m_frame->coreFrame(), FrameLoadRequest(m_frame->coreFrame()->document()->securityOrigin()), WindowFeatures(), navigationAction); + if (!newPage) + return 0; + + return newPage->mainFrame(); +} + +void WebFrameLoaderClient::dispatchShow() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + 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. + + 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))) + return; + + // We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback. + if (receivedPolicyAction) + 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) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + uint64_t listenerID = m_frame->setUpPolicyListener(function); + + // 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); + + webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID)); +} + +void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<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); + + // FIXME: Pass more than just the navigation action type. + 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); + + webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), navigationType, modifiers, mouseButton, url, listenerID)); +} + +void WebFrameLoaderClient::cancelPolicyCheck() +{ + m_frame->invalidatePolicyListener(); +} + +void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&) +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> prpFormState) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + // FIXME: Pass more of the form state. + RefPtr<FormState> formState = prpFormState; + + HTMLFormElement* form = formState->form(); + WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame(); + const Vector<std::pair<String, String> >& values = formState->textFieldValues(); + + RefPtr<APIObject> userData; + webPage->injectedBundleFormClient().willSubmitForm(webPage, form, m_frame, sourceFrame, values, userData); + + + uint64_t listenerID = m_frame->setUpPolicyListener(function); + StringPairVector valuesVector(values); + + webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), valuesVector, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::revertToProvisionalState(DocumentLoader*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) +{ + if (!m_pluginView) + return; + + m_pluginView->manualLoadDidFail(error); + m_pluginView = 0; + m_hasSentResponseToPluginView = false; +} + +void WebFrameLoaderClient::willChangeEstimatedProgress() +{ + notImplemented(); +} + +void WebFrameLoaderClient::didChangeEstimatedProgress() +{ + notImplemented(); +} + +void WebFrameLoaderClient::postProgressStartedNotification() +{ + if (WebPage* webPage = m_frame->page()) + webPage->send(Messages::WebPageProxy::DidStartProgress()); +} + +void WebFrameLoaderClient::postProgressEstimateChangedNotification() +{ + if (WebPage* webPage = m_frame->page()) { + double progress = webPage->corePage()->progress()->estimatedProgress(); + webPage->send(Messages::WebPageProxy::DidChangeProgress(progress)); + + } +} + +void WebFrameLoaderClient::postProgressFinishedNotification() +{ + if (WebPage* webPage = m_frame->page()) + webPage->send(Messages::WebPageProxy::DidFinishProgress()); +} + +void WebFrameLoaderClient::setMainFrameDocumentReady(bool) +{ + notImplemented(); +} + +void WebFrameLoaderClient::startDownload(const ResourceRequest& request) +{ + m_frame->startDownload(request); +} + +void WebFrameLoaderClient::willChangeTitle(DocumentLoader*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::didChangeTitle(DocumentLoader*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) +{ + // If we're loading a custom representation, we don't want to hand off the data to WebCore. + if (m_frameHasCustomRepresentation) + return; + + if (!m_pluginView) + loader->commitData(data, length); + + // If the document is a stand-alone media document, now is the right time to cancel the WebKit load. + // FIXME: This code should be shared across all ports. <http://webkit.org/b/48762>. + if (m_frame->coreFrame()->document()->isMediaDocument()) + loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response())); + + // Calling commitData did not create the plug-in view. + if (!m_pluginView) + return; + + if (!m_hasSentResponseToPluginView) { + m_pluginView->manualLoadDidReceiveResponse(loader->response()); + // manualLoadDidReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in + // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // to null + if (!m_pluginView) + return; + m_hasSentResponseToPluginView = true; + } + m_pluginView->manualLoadDidReceiveData(data, length); +} + +void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) +{ + if (!m_pluginView) { + committedLoad(loader, 0, 0); + + if (m_frameHasCustomRepresentation) { + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData(); + CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0); + + webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(dataReference)); + } + + return; + } + + m_pluginView->manualLoadDidFinishLoading(); + m_pluginView = 0; + m_hasSentResponseToPluginView = false; +} + +void WebFrameLoaderClient::updateGlobalHistory() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader(); + + WebNavigationDataStore data; + data.url = loader->urlForHistory().string(); + data.title = loader->title(); + + WebProcess::shared().connection()->send(Messages::WebContext::DidNavigateWithNavigationData(webPage->pageID(), data, m_frame->frameID()), 0); +} + +void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader(); + ASSERT(loader->unreachableURL().isEmpty()); + + // Client redirect + if (!loader->clientRedirectSourceForHistory().isNull()) { + WebProcess::shared().connection()->send(Messages::WebContext::DidPerformClientRedirect(webPage->pageID(), + loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_frame->frameID()), 0); + } + + // Server redirect + if (!loader->serverRedirectSourceForHistory().isNull()) { + WebProcess::shared().connection()->send(Messages::WebContext::DidPerformServerRedirect(webPage->pageID(), + loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_frame->frameID()), 0); + } +} + +bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const +{ + notImplemented(); + return true; +} + +void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const +{ + notImplemented(); +} + +void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const +{ + notImplemented(); +} + +void WebFrameLoaderClient::didDisplayInsecureContent() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + webPage->injectedBundleLoaderClient().didDisplayInsecureContentForFrame(webPage, m_frame, userData); + + webPage->send(Messages::WebPageProxy::DidDisplayInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + RefPtr<APIObject> userData; + + webPage->injectedBundleLoaderClient().didRunInsecureContentForFrame(webPage, m_frame, userData); + + webPage->send(Messages::WebPageProxy::DidRunInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); +} + +ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request) +{ + return WebKit::cancelledError(request); +} + +ResourceError WebFrameLoaderClient::blockedError(const ResourceRequest& request) +{ + return WebKit::blockedError(request); +} + +ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest& request) +{ + return WebKit::cannotShowURLError(request); +} + +ResourceError WebFrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request) +{ + return WebKit::interruptForPolicyChangeError(request); +} + +ResourceError WebFrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response) +{ + return WebKit::cannotShowMIMETypeError(response); +} + +ResourceError WebFrameLoaderClient::fileDoesNotExistError(const ResourceResponse& response) +{ + return WebKit::fileDoesNotExistError(response); +} + +ResourceError WebFrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse& response) +{ + return WebKit::pluginWillHandleLoadError(response); +} + +bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error) +{ + DEFINE_STATIC_LOCAL(const ResourceError, cancelledError, (this->cancelledError(ResourceRequest()))); + DEFINE_STATIC_LOCAL(const ResourceError, pluginWillHandleLoadError, (this->pluginWillHandleLoadError(ResourceResponse()))); + + if (error.errorCode() == cancelledError.errorCode() && error.domain() == cancelledError.domain()) + return false; + + if (error.errorCode() == pluginWillHandleLoadError.errorCode() && error.domain() == pluginWillHandleLoadError.domain()) + return false; + + return true; +} + +bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest&) const +{ + notImplemented(); + return true; +} + +bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const +{ + notImplemented(); + return true; +} + +bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + return true; +} + +bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return false; +} + +String WebFrameLoaderClient::generatedMIMETypeForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return String(); +} + +void WebFrameLoaderClient::frameLoadCompleted() +{ + notImplemented(); +} + +void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::restoreViewState() +{ + notImplemented(); +} + +void WebFrameLoaderClient::provisionalLoadStarted() +{ + notImplemented(); +} + +void WebFrameLoaderClient::didFinishLoad() +{ + // If we have a load listener, notify it. + if (WebFrame::LoadListener* loadListener = m_frame->loadListener()) + loadListener->didFinishLoad(m_frame); +} + +void WebFrameLoaderClient::prepareForDataSourceReplacement() +{ + notImplemented(); +} + +PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& data) +{ + return DocumentLoader::create(request, data); +} + +void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + WebProcess::shared().connection()->send(Messages::WebContext::DidUpdateHistoryTitle(webPage->pageID(), + title, url.string(), m_frame->frameID()), 0); +} + +String WebFrameLoaderClient::userAgent(const KURL&) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return String(); + + return webPage->userAgent(); +} + +void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*) +{ +} + +void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*) +{ +} + +void WebFrameLoaderClient::transitionToCommittedForNewPage() +{ + WebPage* webPage = m_frame->page(); + Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white; + + bool isMainFrame = webPage->mainFrame() == m_frame; + +#if ENABLE(TILED_BACKING_STORE) + IntSize currentVisibleContentSize = m_frame->coreFrame()->view() ? m_frame->coreFrame()->view()->actualVisibleContentRect().size() : IntSize(); + m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, webPage->resizesToContentsLayoutSize(), isMainFrame && webPage->resizesToContentsEnabled()); + + if (isMainFrame && webPage->resizesToContentsEnabled()) { + m_frame->coreFrame()->view()->setDelegatesScrolling(true); + m_frame->coreFrame()->view()->setPaintsEntireContents(true); + } + + // The HistoryController will update the scroll position later if needed. + m_frame->coreFrame()->view()->setActualVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize)); +#else + const String& mimeType = m_frame->coreFrame()->loader()->documentLoader()->response().mimeType(); + m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForMIMEType(mimeType); + + m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, IntSize(), false); +#endif + + m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground()); +} + +void WebFrameLoaderClient::didSaveToPageCache() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + if (m_frame->isMainFrame()) + return; + + webPage->send(Messages::WebPageProxy::DidSaveFrameToPageCache(m_frame->frameID())); +} + +void WebFrameLoaderClient::didRestoreFromPageCache() +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + if (m_frame->isMainFrame()) + return; + + WebFrame* parentFrame = static_cast<WebFrameLoaderClient*>(m_frame->coreFrame()->tree()->parent()->loader()->client())->webFrame(); + webPage->send(Messages::WebPageProxy::DidRestoreFrameFromPageCache(m_frame->frameID(), parentFrame->frameID())); +} + +void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool value) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->send(Messages::WebPageProxy::FrameDidBecomeFrameSet(m_frame->frameID(), value)); +} + +bool WebFrameLoaderClient::canCachePage() const +{ + // We cannot cache frames that have custom representations because they are + // rendered in the UIProcess. + return !m_frameHasCustomRepresentation; +} + +void WebFrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest& initialRequest, const ResourceResponse& response) +{ + m_frame->convertHandleToDownload(handle, request, initialRequest, response); +} + +PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) +{ + WebPage* webPage = m_frame->page(); + + RefPtr<WebFrame> subframe = WebFrame::createSubframe(webPage, name, ownerElement); + + Frame* coreSubframe = subframe->coreFrame(); + + // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. + m_frame->coreFrame()->loader()->loadURLIntoChildFrame(url, referrer, coreSubframe); + + // The frame's onload handler may have removed it from the document. + if (!coreSubframe->tree()->parent()) + return 0; + + return coreSubframe; +} + +void WebFrameLoaderClient::didTransferChildFrameToNewDocument(Page*) +{ + notImplemented(); +} + +void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*) +{ + notImplemented(); +} + +PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement* pluginElement, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) +{ + ASSERT(paramNames.size() == paramValues.size()); + + WebPage* webPage = m_frame->page(); + ASSERT(webPage); + + Plugin::Parameters parameters; + parameters.url = url; + parameters.names = paramNames; + parameters.values = paramValues; + parameters.mimeType = mimeType; + parameters.loadManually = loadManually; + + // <rdar://problem/8440903>: AppleConnect has a bug where it does not + // understand the parameter names specified in the <object> element that + // embeds its plug-in. This hack works around the issue by converting the + // parameter names to lowercase before passing them to the plug-in. + // FIXME: This workaround should be dependent on site-specific quirks being + // enabled. This requires adding this setting to WebKit2's WebPreferences + // implementation. See <https://bugs.webkit.org/show_bug.cgi?id=46076>. + if (equalIgnoringCase(mimeType, "application/x-snkp")) { + for (size_t i = 0; i < paramNames.size(); ++i) + parameters.names[i] = paramNames[i].lower(); + } + + RefPtr<Plugin> plugin = webPage->createPlugin(parameters); + if (!plugin) + return 0; + + return PluginView::create(pluginElement, plugin.release(), parameters); +} + +void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) +{ + ASSERT(!m_pluginView); + ASSERT(pluginWidget); + + m_pluginView = static_cast<PluginView*>(pluginWidget); +} + +PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) +{ + return createPlugin(pluginSize, appletElement, KURL(), paramNames, paramValues, "application/x-java-applet", false); +} + +ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeTypeIn) +{ + // FIXME: This should be merged with WebCore::FrameLoader::defaultObjectContentType when the plugin code + // is consolidated. + + String mimeType = mimeTypeIn; + if (mimeType.isEmpty()) + mimeType = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1)); + + if (mimeType.isEmpty()) + return ObjectContentFrame; + + if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) + return WebCore::ObjectContentImage; + + if (WebPage* webPage = m_frame->page()) { + if (PluginData* pluginData = webPage->corePage()->pluginData()) { + if (pluginData->supportsMimeType(mimeType)) + return ObjectContentNetscapePlugin; + } + } + + if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) + return ObjectContentFrame; + + return ObjectContentNone; +} + +String WebFrameLoaderClient::overrideMediaType() const +{ + notImplemented(); + return String(); +} + +void WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) +{ + WebPage* webPage = m_frame->page(); + if (!webPage) + return; + + webPage->injectedBundleLoaderClient().didClearWindowObjectForFrame(webPage, m_frame, world); +} + +void WebFrameLoaderClient::documentElementAvailable() +{ + notImplemented(); +} + +void WebFrameLoaderClient::didPerformFirstNavigation() const +{ + notImplemented(); +} + +void WebFrameLoaderClient::registerForIconNotification(bool listen) +{ + notImplemented(); +} + +#if PLATFORM(MAC) + +RemoteAXObjectRef WebFrameLoaderClient::accessibilityRemoteObject() +{ + return m_frame->page()->accessibilityRemoteObject(); +} + +#if ENABLE(MAC_JAVA_BRIDGE) +jobject WebFrameLoaderClient::javaApplet(NSView*) { return 0; } +#endif +NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const +{ + return response; +} + +#endif +#if USE(CFNETWORK) +bool WebFrameLoaderClient::shouldCacheResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, const unsigned char* data, unsigned long long length) +{ + return true; +} + +#endif + +bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) const +{ + notImplemented(); + return false; +} + +PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext() +{ + return WebFrameNetworkingContext::create(m_frame->coreFrame()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h new file mode 100644 index 0000000..29c8bdd --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -0,0 +1,230 @@ +/* + * 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 WebFrameLoaderClient_h +#define WebFrameLoaderClient_h + +#include <WebCore/FrameLoaderClient.h> + +namespace WebKit { + +class PluginView; +class WebFrame; + +class WebFrameLoaderClient : public WebCore::FrameLoaderClient { +public: + WebFrameLoaderClient(WebFrame*); + ~WebFrameLoaderClient(); + + WebFrame* webFrame() const { return m_frame; } + + bool frameHasCustomRepresentation() const { return m_frameHasCustomRepresentation; } + +private: + virtual void frameLoaderDestroyed(); + + virtual bool hasHTMLView() const; + virtual bool hasWebView() const; + + virtual void makeRepresentation(WebCore::DocumentLoader*); + virtual void forceLayout(); + virtual void forceLayoutForNonHTML(); + + virtual void setCopiesOnScroll(); + + virtual void detachedFromParent2(); + virtual void detachedFromParent3(); + + virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); + + virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); + virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); + virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); + virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); +#if USE(PROTECTION_SPACE_AUTH_CALLBACK) + virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&); +#endif + virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); + virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); + virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); + virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); + virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WTF::String&); + + virtual void dispatchDidHandleOnloadEvents(); + virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); + virtual void dispatchDidCancelClientRedirect(); + virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate); + virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); + virtual void dispatchWillClose(); + virtual void dispatchDidReceiveIcon(); + virtual void dispatchDidStartProvisionalLoad(); + virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidChangeIcons(); + virtual void dispatchDidCommitLoad(); + virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); + virtual void dispatchDidFailLoad(const WebCore::ResourceError&); + virtual void dispatchDidFinishDocumentLoad(); + virtual void dispatchDidFinishLoad(); + virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + + virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); + virtual void dispatchShow(); + + virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const String& MIMEType, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, const String& frameName); + virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>); + virtual void cancelPolicyCheck(); + + virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + + virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) { } + virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>); + + virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); + virtual void revertToProvisionalState(WebCore::DocumentLoader*); + virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); + + // Maybe these should go into a ProgressTrackerClient some day + virtual void willChangeEstimatedProgress(); + virtual void didChangeEstimatedProgress(); + virtual void postProgressStartedNotification(); + virtual void postProgressEstimateChangedNotification(); + virtual void postProgressFinishedNotification(); + + virtual void setMainFrameDocumentReady(bool); + + virtual void startDownload(const WebCore::ResourceRequest&); + + virtual void willChangeTitle(WebCore::DocumentLoader*); + virtual void didChangeTitle(WebCore::DocumentLoader*); + + virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); + virtual void finishedLoading(WebCore::DocumentLoader*); + + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryRedirectLinks(); + + virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; + + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(WebCore::SecurityOrigin*); + + virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); + virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); + virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); + + virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); + virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); + virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); + + virtual bool shouldFallBack(const WebCore::ResourceError&); + + virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; + virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; + virtual bool representationExistsForURLScheme(const String& URLScheme) const; + virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; + + virtual void frameLoadCompleted(); + virtual void saveViewStateToItem(WebCore::HistoryItem*); + virtual void restoreViewState(); + virtual void provisionalLoadStarted(); + virtual void didFinishLoad(); + virtual void prepareForDataSourceReplacement(); + + virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); + virtual void setTitle(const String& title, const WebCore::KURL&); + + virtual String userAgent(const WebCore::KURL&); + + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedForNewPage(); + + virtual void didSaveToPageCache(); + virtual void didRestoreFromPageCache(); + + virtual void dispatchDidBecomeFrameset(bool); + + virtual bool canCachePage() const; + virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + + virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const String& name, WebCore::HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual void didTransferChildFrameToNewDocument(WebCore::Page*); + virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); + + virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually); + virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); + + virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); + + virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const String& mimeType); + virtual String overrideMediaType() const; + + virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); + + virtual void documentElementAvailable(); + virtual void didPerformFirstNavigation() const; // "Navigation" here means a transition from one page to another that ends up in the back/forward list. + + virtual void registerForIconNotification(bool listen = true); + +#if PLATFORM(MAC) + virtual RemoteAXObjectRef accessibilityRemoteObject(); + +#if ENABLE(MAC_JAVA_BRIDGE) + virtual jobject javaApplet(NSView*); +#endif + virtual NSCachedURLResponse* willCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const; +#endif +#if USE(CFNETWORK) + virtual bool shouldCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&, const unsigned char* data, unsigned long long length); +#endif + + virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const; + + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + + WebFrame* m_frame; + RefPtr<PluginView> m_pluginView; + bool m_hasSentResponseToPluginView; + 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 new file mode 100644 index 0000000..8701022 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp @@ -0,0 +1,82 @@ +/* + * 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 "WebGeolocationClient.h" + +#if ENABLE(CLIENT_BASED_GEOLOCATION) + +#include "WebGeolocationManager.h" +#include "WebPage.h" +#include "WebProcess.h" +#include <WebCore/Geolocation.h> +#include <WebCore/GeolocationPosition.h> + +using namespace WebCore; + +namespace WebKit { + +WebGeolocationClient::~WebGeolocationClient() +{ +} + +void WebGeolocationClient::geolocationDestroyed() +{ + WebProcess::shared().geolocationManager().unregisterWebPage(m_page); + delete this; +} + +void WebGeolocationClient::startUpdating() +{ + WebProcess::shared().geolocationManager().registerWebPage(m_page); +} + +void WebGeolocationClient::stopUpdating() +{ + WebProcess::shared().geolocationManager().unregisterWebPage(m_page); +} + +void WebGeolocationClient::setEnableHighAccuracy(bool) +{ +} + +GeolocationPosition* WebGeolocationClient::lastPosition() +{ + // FIXME: Implement this. + return 0; +} + +void WebGeolocationClient::requestPermission(Geolocation* geolocation) +{ + m_page->geolocationPermissionRequestManager().startRequestForGeolocation(geolocation); +} + +void WebGeolocationClient::cancelPermissionRequest(Geolocation* geolocation) +{ + m_page->geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation); +} + +} // namespace WebKit + +#endif // ENABLE(CLIENT_BASED_GEOLOCATION) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h new file mode 100644 index 0000000..e72124d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h @@ -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. + */ + +#ifndef WebGeolocationClient_h +#define WebGeolocationClient_h + +#if ENABLE(CLIENT_BASED_GEOLOCATION) + +#include <WebCore/GeolocationClient.h> + +namespace WebKit { + +class WebPage; + +class WebGeolocationClient : public WebCore::GeolocationClient { +public: + WebGeolocationClient(WebPage* page) + : m_page(page) + { + } + + virtual ~WebGeolocationClient(); + +private: + virtual void geolocationDestroyed(); + + virtual void startUpdating(); + virtual void stopUpdating(); + virtual void setEnableHighAccuracy(bool); + + virtual WebCore::GeolocationPosition* lastPosition(); + + virtual void requestPermission(WebCore::Geolocation*); + virtual void cancelPermissionRequest(WebCore::Geolocation*); + + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // ENABLE(CLIENT_BASED_GEOLOCATION) + +#endif // WebGeolocationClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp new file mode 100644 index 0000000..ddd1fa8 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorClient.h" + +#if ENABLE(INSPECTOR) + +#include "WebInspectorFrontendClient.h" +#include "WebInspector.h" +#include "WebPage.h" +#include <WebCore/InspectorController.h> +#include <WebCore/Page.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void WebInspectorClient::inspectorDestroyed() +{ + delete this; +} + +void WebInspectorClient::openInspectorFrontend(InspectorController*) +{ + WebPage* inspectorPage = m_page->inspector()->createInspectorPage(); + ASSERT(inspectorPage); + if (!inspectorPage) + return; + + inspectorPage->corePage()->inspectorController()->setInspectorFrontendClient(adoptPtr(new WebInspectorFrontendClient(m_page, inspectorPage))); +} + +void WebInspectorClient::highlight(Node*) +{ + notImplemented(); +} + +void WebInspectorClient::hideHighlight() +{ + notImplemented(); +} + +void WebInspectorClient::populateSetting(const String& key, String*) +{ + notImplemented(); +} + +void WebInspectorClient::storeSetting(const String&, const String&) +{ + notImplemented(); +} + +bool WebInspectorClient::sendMessageToFrontend(const String& message) +{ + WebInspector* inspector = m_page->inspector(); + if (!inspector) + return false; + WebPage* inspectorPage = inspector->inspectorPage(); + if (!inspectorPage) + return false; + return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h new file mode 100644 index 0000000..7a12206 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h @@ -0,0 +1,64 @@ +/* + * 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 WebInspectorClient_h +#define WebInspectorClient_h + +#if ENABLE(INSPECTOR) + +#include <WebCore/InspectorClient.h> + +namespace WebKit { + +class WebPage; + +class WebInspectorClient : public WebCore::InspectorClient { +public: + WebInspectorClient(WebPage* page) + : m_page(page) + { + } + +private: + virtual void inspectorDestroyed(); + + virtual void openInspectorFrontend(WebCore::InspectorController*); + + virtual void highlight(WebCore::Node*); + virtual void hideHighlight(); + + virtual void populateSetting(const String& key, String* value); + virtual void storeSetting(const String& key, const String& value); + + virtual bool sendMessageToFrontend(const String&); + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) + +#endif // WebInspectorClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp new file mode 100644 index 0000000..28d3b3d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspectorFrontendClient.h" + +#if ENABLE(INSPECTOR) + +#include "WebInspector.h" +#include "WebPage.h" +#include <WebCore/Page.h> +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage) + : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage()) + , m_page(page) +{ +} + +void WebInspectorFrontendClient::frontendLoaded() +{ + InspectorFrontendClientLocal::frontendLoaded(); + + m_page->inspector()->didLoadInspectorPage(); +} + +String WebInspectorFrontendClient::localizedStringsURL() +{ + return m_page->inspector()->localizedStringsURL(); +} + +String WebInspectorFrontendClient::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void WebInspectorFrontendClient::bringToFront() +{ + notImplemented(); +} + +void WebInspectorFrontendClient::closeWindow() +{ + m_page->inspector()->didClose(); +} + +void WebInspectorFrontendClient::disconnectFromBackend() +{ + m_page->inspector()->didClose(); +} + +void WebInspectorFrontendClient::attachWindow() +{ + notImplemented(); +} + +void WebInspectorFrontendClient::detachWindow() +{ + notImplemented(); +} + +void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) +{ + notImplemented(); +} + +void WebInspectorFrontendClient::inspectedURLChanged(const String&) +{ + notImplemented(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h new file mode 100644 index 0000000..48b4de9 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h @@ -0,0 +1,64 @@ +/* + * 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 WebInspectorFrontendClient_h +#define WebInspectorFrontendClient_h + +#if ENABLE(INSPECTOR) + +#include <WebCore/InspectorFrontendClientLocal.h> + +namespace WebKit { + +class WebPage; + +class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal { +public: + WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage); + +private: + virtual void frontendLoaded(); + + virtual String localizedStringsURL(); + virtual String hiddenPanels(); + + virtual void bringToFront(); + virtual void closeWindow(); + virtual void disconnectFromBackend(); + + virtual void attachWindow(); + virtual void detachWindow(); + virtual void setAttachedWindowHeight(unsigned); + + virtual void inspectedURLChanged(const String&); + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) + +#endif // WebInspectorFrontendClient_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp new file mode 100644 index 0000000..4567f35 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -0,0 +1,908 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPlatformStrategies.h" + +#if USE(PLATFORM_STRATEGIES) + +#include "NotImplemented.h" +#include "PluginInfoStore.h" +#include "WebContextMessages.h" +#include "WebCoreArgumentCoders.h" +#include "WebProcess.h" +#include <WebCore/Page.h> +#include <WebCore/PageGroup.h> +#include <wtf/MathExtras.h> +#include <wtf/text/CString.h> + +#if PLATFORM(CF) +#include <wtf/RetainPtr.h> +#endif + +// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized +#define UI_STRING(string, description) String::fromUTF8(string, strlen(string)) +#define UI_STRING_KEY(string, key, description) String::fromUTF8(string, strlen(string)) + +using namespace WebCore; + +namespace WebKit { + +// We can't use String::format for two reasons: +// 1) It doesn't handle non-ASCII characters in the format string. +// 2) It doesn't handle the %2$d syntax. +// Note that because |format| is used as the second parameter to va_start, it cannot be a reference +// type according to section 18.7/3 of the C++ N1905 standard. +static String formatLocalizedString(String format, ...) +{ +#if PLATFORM(CF) + va_list arguments; + va_start(arguments, format); + RetainPtr<CFStringRef> formatCFString(AdoptCF, format.createCFString()); + RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormatAndArguments(0, 0, formatCFString.get(), arguments)); + va_end(arguments); + return result.get(); +#else + notImplemented(); + return format; +#endif +} + +void WebPlatformStrategies::initialize() +{ + DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ()); + setPlatformStrategies(&platformStrategies); +} + +WebPlatformStrategies::WebPlatformStrategies() + : m_pluginCacheIsPopulated(false) + , m_shouldRefreshPlugins(false) +{ +} + +// PluginStrategy + +PluginStrategy* WebPlatformStrategies::createPluginStrategy() +{ + return this; +} + +LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() +{ + return this; +} + +VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() +{ + return this; +} + +// PluginStrategy + +void WebPlatformStrategies::populatePluginCache() +{ + if (m_pluginCacheIsPopulated) + return; + + ASSERT(m_cachedPlugins.isEmpty()); + + Vector<PluginInfo> plugins; + + // FIXME: Should we do something in case of error here? + WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPlugins(m_shouldRefreshPlugins), + Messages::WebContext::GetPlugins::Reply(plugins), 0); + + m_cachedPlugins.swap(plugins); + + m_shouldRefreshPlugins = false; + m_pluginCacheIsPopulated = true; +} + +void WebPlatformStrategies::refreshPlugins() +{ + m_cachedPlugins.clear(); + m_pluginCacheIsPopulated = false; + m_shouldRefreshPlugins = true; + + populatePluginCache(); +} + +void WebPlatformStrategies::getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>& plugins) +{ + populatePluginCache(); + plugins = m_cachedPlugins; +} + +// LocalizationStrategy + +String WebPlatformStrategies::inputElementAltText() +{ + return UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value"); +} + +String WebPlatformStrategies::resetButtonDefaultLabel() +{ + return UI_STRING("Reset", "default label for Reset buttons in forms on web pages"); +} + +String WebPlatformStrategies::searchableIndexIntroduction() +{ + return UI_STRING("This is a searchable index. Enter search keywords: ", + "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); +} + +String WebPlatformStrategies::submitButtonDefaultLabel() +{ + return UI_STRING("Submit", "default label for Submit buttons in forms on web pages"); +} + +String WebPlatformStrategies::fileButtonChooseFileLabel() +{ + return UI_STRING("Choose File", "title for file button used in HTML forms"); +} + +String WebPlatformStrategies::fileButtonNoFileSelectedLabel() +{ + return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected"); +} + +#if PLATFORM(MAC) +String WebPlatformStrategies::copyImageUnknownFileLabel() +{ + return UI_STRING("unknown", "Unknown filename"); +} +#endif + +#if ENABLE(CONTEXT_MENUS) + +String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow() +{ + return UI_STRING("Open Link in New Window", "Open in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk() +{ + return UI_STRING("Download Linked File", "Download Linked File context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard() +{ + return UI_STRING("Copy Link", "Copy Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow() +{ + return UI_STRING("Open Image in New Window", "Open Image in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk() +{ + return UI_STRING("Download Image", "Download Image context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() +{ + return UI_STRING("Copy Image", "Copy Image context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow() +{ + return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow() +{ + return UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard() +{ + return UI_STRING("Copy Video Address", "Copy Video Address Location context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard() +{ + return UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagToggleMediaControls() +{ + return UI_STRING("Controls", "Media Controls context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop() +{ + return UI_STRING("Loop", "Media Loop context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen() +{ + return UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaPlay() +{ + return UI_STRING("Play", "Media Play context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaPause() +{ + return UI_STRING("Pause", "Media Pause context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaMute() +{ + return UI_STRING("Mute", "Media Mute context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow() +{ + return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopy() +{ + return UI_STRING("Copy", "Copy context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoBack() +{ + return UI_STRING("Back", "Back context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoForward() +{ + return UI_STRING("Forward", "Forward context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStop() +{ + return UI_STRING("Stop", "Stop context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagReload() +{ + return UI_STRING("Reload", "Reload context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCut() +{ + return UI_STRING("Cut", "Cut context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagPaste() +{ + return UI_STRING("Paste", "Paste context menu item"); +} + +#if PLATFORM(GTK) + +String WebPlatformStrategies::contextMenuItemTagDelete() +{ + notImplemented(); + return "Delete"; +} + +String WebPlatformStrategies::contextMenuItemTagInputMethods() +{ + notImplemented(); + return "Input Methods"; +} + +String WebPlatformStrategies::contextMenuItemTagUnicode() +{ + notImplemented(); + return "Unicode"; +} + +#endif + +#if PLATFORM(GTK) || PLATFORM(QT) + +String WebPlatformStrategies::contextMenuItemTagSelectAll() +{ + notImplemented(); + return "Select All"; +} + +#endif + +String WebPlatformStrategies::contextMenuItemTagNoGuessesFound() +{ + return UI_STRING("No Guesses Found", "No Guesses Found context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreSpelling() +{ + return UI_STRING("Ignore Spelling", "Ignore Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLearnSpelling() +{ + return UI_STRING("Learn Spelling", "Learn Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSearchWeb() +{ + return UI_STRING("Search in Google", "Search in Google context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary() +{ + return UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenLink() +{ + return UI_STRING("Open Link", "Open Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreGrammar() +{ + return UI_STRING("Ignore Grammar", "Ignore Grammar context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSpellingMenu() +{ + return UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowSpellingPanel(bool show) +{ + if (show) + return UI_STRING("Show Spelling and Grammar", "menu item title"); + return UI_STRING("Hide Spelling and Grammar", "menu item title"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpelling() +{ + return UI_STRING("Check Document Now", "Check spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping() +{ + return UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling() +{ + return UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagFontMenu() +{ + return UI_STRING("Font", "Font context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagBold() +{ + return UI_STRING("Bold", "Bold context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagItalic() +{ + return UI_STRING("Italic", "Italic context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagUnderline() +{ + return UI_STRING("Underline", "Underline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOutline() +{ + return UI_STRING("Outline", "Outline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu() +{ + return UI_STRING("Paragraph Direction", "Paragraph direction context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTextDirectionMenu() +{ + return UI_STRING("Selection Direction", "Selection direction context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDefaultDirection() +{ + return UI_STRING("Default", "Default writing direction context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLeftToRight() +{ + return UI_STRING("Left to Right", "Left to Right context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagRightToLeft() +{ + return UI_STRING("Right to Left", "Right to Left context menu item"); +} + +#if PLATFORM(MAC) + +String WebPlatformStrategies::contextMenuItemTagSearchInSpotlight() +{ + return UI_STRING("Search in Spotlight", "Search in Spotlight context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowFonts() +{ + return UI_STRING("Show Fonts", "Show fonts context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStyles() +{ + return UI_STRING("Styles...", "Styles context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowColors() +{ + return UI_STRING("Show Colors", "Show colors context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSpeechMenu() +{ + return UI_STRING("Speech", "Speech context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStartSpeaking() +{ + return UI_STRING("Start Speaking", "Start speaking context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStopSpeaking() +{ + return UI_STRING("Stop Speaking", "Stop speaking context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCorrectSpellingAutomatically() +{ + return UI_STRING("Correct Spelling Automatically", "Correct Spelling Automatically context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSubstitutionsMenu() +{ + return UI_STRING("Substitutions", "Substitutions context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowSubstitutions(bool show) +{ + if (show) + return UI_STRING("Show Substitutions", "menu item title"); + return UI_STRING("Hide Substitutions", "menu item title"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartCopyPaste() +{ + return UI_STRING("Smart Copy/Paste", "Smart Copy/Paste context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartQuotes() +{ + return UI_STRING("Smart Quotes", "Smart Quotes context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartDashes() +{ + return UI_STRING("Smart Dashes", "Smart Dashes context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSmartLinks() +{ + return UI_STRING("Smart Links", "Smart Links context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTextReplacement() +{ + return UI_STRING("Text Replacement", "Text Replacement context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTransformationsMenu() +{ + return UI_STRING("Transformations", "Transformations context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMakeUpperCase() +{ + return UI_STRING("Make Upper Case", "Make Upper Case context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagMakeLowerCase() +{ + return UI_STRING("Make Lower Case", "Make Lower Case context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCapitalize() +{ + return UI_STRING("Capitalize", "Capitalize context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagChangeBack(const String& replacedString) +{ + notImplemented(); + return replacedString; +} + +#endif + +String WebPlatformStrategies::contextMenuItemTagInspectElement() +{ + return UI_STRING("Inspect Element", "Inspect Element context menu item"); +} + +#endif // ENABLE(CONTEXT_MENUS) + +String WebPlatformStrategies::searchMenuNoRecentSearchesText() +{ + return UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed"); +} + +String WebPlatformStrategies::searchMenuRecentSearchesText() +{ + return UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title"); +} + +String WebPlatformStrategies::searchMenuClearRecentSearchesText() +{ + return UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents"); +} + +String WebPlatformStrategies::AXWebAreaText() +{ + return UI_STRING("HTML content", "accessibility role description for web area"); +} + +String WebPlatformStrategies::AXLinkText() +{ + return UI_STRING("link", "accessibility role description for link"); +} + +String WebPlatformStrategies::AXListMarkerText() +{ + return UI_STRING("list marker", "accessibility role description for list marker"); +} + +String WebPlatformStrategies::AXImageMapText() +{ + return UI_STRING("image map", "accessibility role description for image map"); +} + +String WebPlatformStrategies::AXHeadingText() +{ + return UI_STRING("heading", "accessibility role description for headings"); +} + +String WebPlatformStrategies::AXDefinitionListTermText() +{ + return UI_STRING("term", "term word of a definition"); +} + +String WebPlatformStrategies::AXDefinitionListDefinitionText() +{ + return UI_STRING("definition", "definition phrase"); +} + +#if PLATFORM(MAC) +String WebPlatformStrategies::AXARIAContentGroupText(const String& ariaType) +{ + if (ariaType == "ARIAApplicationAlert") + return UI_STRING("alert", "An ARIA accessibility group that acts as an alert."); + if (ariaType == "ARIAApplicationAlertDialog") + return UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog."); + if (ariaType == "ARIAApplicationDialog") + return UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog."); + if (ariaType == "ARIAApplicationLog") + return UI_STRING("log", "An ARIA accessibility group that acts as a console log."); + if (ariaType == "ARIAApplicationMarquee") + return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee."); + if (ariaType == "ARIAApplicationStatus") + return UI_STRING("application status", "An ARIA accessibility group that acts as a status update."); + if (ariaType == "ARIAApplicationTimer") + return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer."); + if (ariaType == "ARIADocument") + return UI_STRING("document", "An ARIA accessibility group that acts as a document."); + if (ariaType == "ARIADocumentArticle") + return UI_STRING("article", "An ARIA accessibility group that acts as an article."); + if (ariaType == "ARIADocumentNote") + return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document."); + if (ariaType == "ARIADocumentRegion") + return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document."); + if (ariaType == "ARIALandmarkApplication") + return UI_STRING("application", "An ARIA accessibility group that acts as an application."); + if (ariaType == "ARIALandmarkBanner") + return UI_STRING("banner", "An ARIA accessibility group that acts as a banner."); + if (ariaType == "ARIALandmarkComplementary") + return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information."); + if (ariaType == "ARIALandmarkContentInfo") + return UI_STRING("content", "An ARIA accessibility group that contains content."); + if (ariaType == "ARIALandmarkMain") + return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website."); + if (ariaType == "ARIALandmarkNavigation") + return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website."); + if (ariaType == "ARIALandmarkSearch") + return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website."); + if (ariaType == "ARIAUserInterfaceTooltip") + return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip."); + if (ariaType == "ARIATabPanel") + return UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab."); + if (ariaType == "ARIADocumentMath") + return UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols."); + return String(); +} +#endif + +String WebPlatformStrategies::AXButtonActionVerb() +{ + return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility"); +} + +String WebPlatformStrategies::AXRadioButtonActionVerb() +{ + return UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXTextFieldActionVerb() +{ + return UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility"); +} + +String WebPlatformStrategies::AXCheckedCheckBoxActionVerb() +{ + return UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXUncheckedCheckBoxActionVerb() +{ + return UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::AXMenuListActionVerb() +{ + notImplemented(); + return "select"; +} + +String WebPlatformStrategies::AXMenuListPopupActionVerb() +{ + notImplemented(); + return "select"; +} + +String WebPlatformStrategies::AXLinkActionVerb() +{ + return UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility"); +} + +String WebPlatformStrategies::missingPluginText() +{ + return UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing"); +} + +String WebPlatformStrategies::crashedPluginText() +{ + return UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed"); +} + +String WebPlatformStrategies::multipleFileUploadText(unsigned numberOfFiles) +{ + return formatLocalizedString(UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles); +} + +String WebPlatformStrategies::unknownFileSizeText() +{ + return UI_STRING("Unknown", "Unknown filesize FTP directory listing item"); +} + +#if PLATFORM(WIN) + +String WebPlatformStrategies::uploadFileText() +{ + notImplemented(); + return "upload"; +} + +String WebPlatformStrategies::allFilesText() +{ + notImplemented(); + return "all files"; +} + +#endif + +String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size) +{ + // FIXME: It would be nice to have the filename inside the format string, but it's not easy to do that in a way that works with non-ASCII characters in the filename. + return filename + formatLocalizedString(UI_STRING(" %d×%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()); +} + +String WebPlatformStrategies::mediaElementLoadingStateText() +{ + return UI_STRING("Loading...", "Media controller status message when the media is loading"); +} + +String WebPlatformStrategies::mediaElementLiveBroadcastStateText() +{ + return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast"); +} + +String WebPlatformStrategies::localizedMediaControlElementString(const String& name) +{ + if (name == "AudioElement") + return UI_STRING("audio element controller", "accessibility role description for audio element controller"); + if (name == "VideoElement") + return UI_STRING("video element controller", "accessibility role description for video element controller"); + if (name == "MuteButton") + return UI_STRING("mute", "accessibility role description for mute button"); + if (name == "UnMuteButton") + return UI_STRING("unmute", "accessibility role description for turn mute off button"); + if (name == "PlayButton") + return UI_STRING("play", "accessibility role description for play button"); + if (name == "PauseButton") + return UI_STRING("pause", "accessibility role description for pause button"); + if (name == "Slider") + return UI_STRING("movie time", "accessibility role description for timeline slider"); + if (name == "SliderThumb") + return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb"); + if (name == "RewindButton") + return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button"); + if (name == "ReturnToRealtimeButton") + return UI_STRING("return to realtime", "accessibility role description for return to real time button"); + if (name == "CurrentTimeDisplay") + return UI_STRING("elapsed time", "accessibility role description for elapsed time display"); + if (name == "TimeRemainingDisplay") + return UI_STRING("remaining time", "accessibility role description for time remaining display"); + if (name == "StatusDisplay") + return UI_STRING("status", "accessibility role description for movie status"); + if (name == "FullscreenButton") + return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button"); + if (name == "SeekForwardButton") + return UI_STRING("fast forward", "accessibility role description for fast forward button"); + if (name == "SeekBackButton") + return UI_STRING("fast reverse", "accessibility role description for fast reverse button"); + if (name == "ShowClosedCaptionsButton") + return UI_STRING("show closed captions", "accessibility role description for show closed captions button"); + if (name == "HideClosedCaptionsButton") + return UI_STRING("hide closed captions", "accessibility role description for hide closed captions button"); + + // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy. + if (name == "ControlsPanel") + return String(); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name) +{ + if (name == "AudioElement") + return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller"); + if (name == "VideoElement") + return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller"); + if (name == "MuteButton") + return UI_STRING("mute audio tracks", "accessibility help text for mute button"); + if (name == "UnMuteButton") + return UI_STRING("unmute audio tracks", "accessibility help text for un mute button"); + if (name == "PlayButton") + return UI_STRING("begin playback", "accessibility help text for play button"); + if (name == "PauseButton") + return UI_STRING("pause playback", "accessibility help text for pause button"); + if (name == "Slider") + return UI_STRING("movie time scrubber", "accessibility help text for timeline slider"); + if (name == "SliderThumb") + return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb"); + if (name == "RewindButton") + return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"); + if (name == "ReturnToRealtimeButton") + return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"); + if (name == "CurrentTimeDisplay") + return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display"); + if (name == "TimeRemainingDisplay") + return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display"); + if (name == "StatusDisplay") + return UI_STRING("current movie status", "accessibility help text for movie status display"); + if (name == "SeekBackButton") + return UI_STRING("seek quickly back", "accessibility help text for fast rewind button"); + if (name == "SeekForwardButton") + return UI_STRING("seek quickly forward", "accessibility help text for fast forward button"); + if (name == "FullscreenButton") + return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); + if (name == "ShowClosedCaptionsButton") + return UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button"); + if (name == "HideClosedCaptionsButton") + return UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button"); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebPlatformStrategies::localizedMediaTimeDescription(float time) +{ + if (!isfinite(time)) + return UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value"); + + int seconds = static_cast<int>(fabsf(time)); + int days = seconds / (60 * 60 * 24); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + + if (days) + return formatLocalizedString(UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds); + if (hours) + return formatLocalizedString(UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds); + if (minutes) + return formatLocalizedString(UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds); + return formatLocalizedString(UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds); +} + +String WebPlatformStrategies::validationMessageValueMissingText() +{ + return UI_STRING("value missing", "Validation message for required form control elements that have no value"); +} + +String WebPlatformStrategies::validationMessageTypeMismatchText() +{ + return UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type"); +} + +String WebPlatformStrategies::validationMessagePatternMismatchText() +{ + return UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); +} + +String WebPlatformStrategies::validationMessageTooLongText() +{ + return UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length"); +} + +String WebPlatformStrategies::validationMessageRangeUnderflowText() +{ + return UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum"); +} + +String WebPlatformStrategies::validationMessageRangeOverflowText() +{ + return UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum"); +} + +String WebPlatformStrategies::validationMessageStepMismatchText() +{ + return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); +} + +// VisitedLinkStrategy +bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash linkHash) +{ + return WebProcess::shared().isLinkVisited(linkHash); +} + +void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash linkHash) +{ + WebProcess::shared().addVisitedLink(linkHash); +} + +} // namespace WebKit + +#endif // USE(PLATFORM_STRATEGIES) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h new file mode 100644 index 0000000..b584f8d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -0,0 +1,201 @@ +/* + * 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 WebPlatformStrategies_h +#define WebPlatformStrategies_h + +#if USE(PLATFORM_STRATEGIES) + +#include <WebCore/PlatformStrategies.h> +#include <WebCore/PluginStrategy.h> +#include <WebCore/LocalizationStrategy.h> +#include <WebCore/VisitedLinkStrategy.h> + +namespace WebKit { + +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { +public: + static void initialize(); + +private: + WebPlatformStrategies(); + + // WebCore::PlatformStrategies + virtual WebCore::PluginStrategy* createPluginStrategy(); + virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); + virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); + + // WebCore::PluginStrategy + virtual void refreshPlugins(); + virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&); + + // WebCore::LocalizationStrategy + virtual String inputElementAltText(); + virtual String resetButtonDefaultLabel(); + virtual String searchableIndexIntroduction(); + virtual String submitButtonDefaultLabel(); + virtual String fileButtonChooseFileLabel(); + virtual String fileButtonNoFileSelectedLabel(); +#if PLATFORM(MAC) + virtual String copyImageUnknownFileLabel(); +#endif +#if ENABLE(CONTEXT_MENUS) + virtual String contextMenuItemTagOpenLinkInNewWindow(); + virtual String contextMenuItemTagDownloadLinkToDisk(); + virtual String contextMenuItemTagCopyLinkToClipboard(); + virtual String contextMenuItemTagOpenImageInNewWindow(); + virtual String contextMenuItemTagDownloadImageToDisk(); + virtual String contextMenuItemTagCopyImageToClipboard(); + virtual String contextMenuItemTagOpenFrameInNewWindow(); + virtual String contextMenuItemTagCopy(); + virtual String contextMenuItemTagGoBack(); + virtual String contextMenuItemTagGoForward(); + virtual String contextMenuItemTagStop(); + virtual String contextMenuItemTagReload(); + virtual String contextMenuItemTagCut(); + virtual String contextMenuItemTagPaste(); +#if PLATFORM(GTK) + virtual String contextMenuItemTagDelete(); + virtual String contextMenuItemTagInputMethods(); + virtual String contextMenuItemTagUnicode(); +#endif +#if PLATFORM(GTK) || PLATFORM(QT) + virtual String contextMenuItemTagSelectAll(); +#endif + virtual String contextMenuItemTagNoGuessesFound(); + virtual String contextMenuItemTagIgnoreSpelling(); + virtual String contextMenuItemTagLearnSpelling(); + virtual String contextMenuItemTagSearchWeb(); + virtual String contextMenuItemTagLookUpInDictionary(); + virtual String contextMenuItemTagOpenLink(); + virtual String contextMenuItemTagIgnoreGrammar(); + virtual String contextMenuItemTagSpellingMenu(); + virtual String contextMenuItemTagShowSpellingPanel(bool show); + virtual String contextMenuItemTagCheckSpelling(); + virtual String contextMenuItemTagCheckSpellingWhileTyping(); + virtual String contextMenuItemTagCheckGrammarWithSpelling(); + virtual String contextMenuItemTagFontMenu(); + virtual String contextMenuItemTagBold(); + virtual String contextMenuItemTagItalic(); + virtual String contextMenuItemTagUnderline(); + virtual String contextMenuItemTagOutline(); + virtual String contextMenuItemTagWritingDirectionMenu(); + virtual String contextMenuItemTagTextDirectionMenu(); + virtual String contextMenuItemTagDefaultDirection(); + virtual String contextMenuItemTagLeftToRight(); + virtual String contextMenuItemTagRightToLeft(); +#if PLATFORM(MAC) + virtual String contextMenuItemTagSearchInSpotlight(); + virtual String contextMenuItemTagShowFonts(); + virtual String contextMenuItemTagStyles(); + virtual String contextMenuItemTagShowColors(); + virtual String contextMenuItemTagSpeechMenu(); + virtual String contextMenuItemTagStartSpeaking(); + virtual String contextMenuItemTagStopSpeaking(); + virtual String contextMenuItemTagCorrectSpellingAutomatically(); + virtual String contextMenuItemTagSubstitutionsMenu(); + virtual String contextMenuItemTagShowSubstitutions(bool show); + virtual String contextMenuItemTagSmartCopyPaste(); + virtual String contextMenuItemTagSmartQuotes(); + virtual String contextMenuItemTagSmartDashes(); + virtual String contextMenuItemTagSmartLinks(); + virtual String contextMenuItemTagTextReplacement(); + virtual String contextMenuItemTagTransformationsMenu(); + virtual String contextMenuItemTagMakeUpperCase(); + virtual String contextMenuItemTagMakeLowerCase(); + virtual String contextMenuItemTagCapitalize(); + virtual String contextMenuItemTagChangeBack(const String& replacedString); +#endif + virtual String contextMenuItemTagInspectElement(); + virtual String contextMenuItemTagOpenVideoInNewWindow(); + virtual String contextMenuItemTagOpenAudioInNewWindow(); + virtual String contextMenuItemTagCopyVideoLinkToClipboard(); + virtual String contextMenuItemTagCopyAudioLinkToClipboard(); + virtual String contextMenuItemTagToggleMediaControls(); + virtual String contextMenuItemTagToggleMediaLoop(); + virtual String contextMenuItemTagEnterVideoFullscreen(); + virtual String contextMenuItemTagMediaPlay(); + virtual String contextMenuItemTagMediaPause(); + virtual String contextMenuItemTagMediaMute(); +#endif // ENABLE(CONTEXT_MENUS) + virtual String searchMenuNoRecentSearchesText(); + virtual String searchMenuRecentSearchesText(); + virtual String searchMenuClearRecentSearchesText(); + virtual String AXWebAreaText(); + virtual String AXLinkText(); + virtual String AXListMarkerText(); + virtual String AXImageMapText(); + virtual String AXHeadingText(); + virtual String AXDefinitionListTermText(); + virtual String AXDefinitionListDefinitionText(); +#if PLATFORM(MAC) + virtual String AXARIAContentGroupText(const String& ariaType); +#endif + virtual String AXButtonActionVerb(); + virtual String AXRadioButtonActionVerb(); + virtual String AXTextFieldActionVerb(); + virtual String AXCheckedCheckBoxActionVerb(); + virtual String AXUncheckedCheckBoxActionVerb(); + virtual String AXMenuListActionVerb(); + virtual String AXMenuListPopupActionVerb(); + virtual String AXLinkActionVerb(); + virtual String missingPluginText(); + virtual String crashedPluginText(); + virtual String multipleFileUploadText(unsigned numberOfFiles); + virtual String unknownFileSizeText(); +#if PLATFORM(WIN) + virtual String uploadFileText(); + virtual String allFilesText(); +#endif + virtual String imageTitle(const String& filename, const WebCore::IntSize& size); + virtual String mediaElementLoadingStateText(); + virtual String mediaElementLiveBroadcastStateText(); + virtual String localizedMediaControlElementString(const String&); + virtual String localizedMediaControlElementHelpText(const String&); + virtual String localizedMediaTimeDescription(float); + virtual String validationMessageValueMissingText(); + virtual String validationMessageTypeMismatchText(); + virtual String validationMessagePatternMismatchText(); + virtual String validationMessageTooLongText(); + virtual String validationMessageRangeUnderflowText(); + virtual String validationMessageRangeOverflowText(); + virtual String validationMessageStepMismatchText(); + + void populatePluginCache(); + + bool m_pluginCacheIsPopulated; + bool m_shouldRefreshPlugins; + Vector<WebCore::PluginInfo> m_cachedPlugins; + + // WebCore::VisitedLinkStrategy + virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); + virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); +}; + +} // namespace WebKit + +#endif // USE(PLATFORM_STRATEGIES) + +#endif // WebPlatformStrategies_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp new file mode 100644 index 0000000..ea0ad2d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "WebPopupMenu.h" + +#include "PlatformPopupMenuData.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/FrameView.h> +#include <WebCore/PopupMenuClient.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebPopupMenu> WebPopupMenu::create(WebPage* page, PopupMenuClient* client) +{ + return adoptRef(new WebPopupMenu(page, client)); +} + +WebPopupMenu::WebPopupMenu(WebPage* page, PopupMenuClient* client) + : m_popupClient(client) + , m_page(page) +{ +} + +WebPopupMenu::~WebPopupMenu() +{ +} + +void WebPopupMenu::disconnectClient() +{ + m_popupClient = 0; +} + +void WebPopupMenu::didChangeSelectedIndex(int newIndex) +{ + if (!m_popupClient) + return; + + m_popupClient->popupDidHide(); + if (newIndex >= 0) + m_popupClient->valueChanged(newIndex); +} + +void WebPopupMenu::setTextForIndex(int index) +{ + if (!m_popupClient) + return; + + m_popupClient->setTextFromItem(index); +} + +Vector<WebPopupItem> WebPopupMenu::populateItems() +{ + size_t size = m_popupClient->listSize(); + + Vector<WebPopupItem> items; + items.reserveInitialCapacity(size); + + for (size_t i = 0; i < size; ++i) { + if (m_popupClient->itemIsSeparator(i)) + items.append(WebPopupItem(WebPopupItem::Seperator)); + else { + // 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))); + } + } + + return items; +} + +void WebPopupMenu::show(const IntRect& rect, FrameView* view, int index) +{ + // FIXME: We should probably inform the client to also close the menu. + Vector<WebPopupItem> items = populateItems(); + + if (items.isEmpty() || !m_page) { + m_popupClient->popupDidHide(); + return; + } + + m_page->setActivePopupMenu(this); + + // Move to page coordinates + IntRect pageCoordinates(view->contentsToWindow(rect.location()), rect.size()); + + PlatformPopupMenuData platformData; + setUpPlatformData(pageCoordinates, platformData); + + WebProcess::shared().connection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, items, index, platformData), m_page->pageID()); +} + +void WebPopupMenu::hide() +{ + if (!m_page || !m_popupClient) + return; + + WebProcess::shared().connection()->send(Messages::WebPageProxy::HidePopupMenu(), m_page->pageID()); + m_page->setActivePopupMenu(0); +} + +void WebPopupMenu::updateFromElement() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h new file mode 100644 index 0000000..3083c94 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WebPopupMenu_h +#define WebPopupMenu_h + +#include "WebPopupItem.h" +#include <WebCore/PopupMenu.h> +#include <wtf/Forward.h> +#include <wtf/OwnPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { +class PopupMenuClient; +} + +namespace WebKit { + +class WebPage; +struct PlatformPopupMenuData; +struct WebPopupItem; + +class WebPopupMenu : public WebCore::PopupMenu { +public: + static PassRefPtr<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*); + ~WebPopupMenu(); + + void disconnectFromPage() { m_page = 0; } + void didChangeSelectedIndex(int newIndex); + void setTextForIndex(int newIndex); + + virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + WebPopupMenu(WebPage*, WebCore::PopupMenuClient*); + + Vector<WebPopupItem> populateItems(); + void setUpPlatformData(const WebCore::IntRect& pageCoordinates, PlatformPopupMenuData&); + + WebCore::PopupMenuClient* m_popupClient; + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebPopupMenu_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp new file mode 100644 index 0000000..acec5f2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + + +#include "WebSearchPopupMenu.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebSearchPopupMenu> WebSearchPopupMenu::create(WebPage* page, PopupMenuClient* client) +{ + return adoptRef(new WebSearchPopupMenu(page, client)); +} + +WebSearchPopupMenu::WebSearchPopupMenu(WebPage* page, PopupMenuClient* client) + : m_popup(WebPopupMenu::create(page, client)) +{ +} + +PopupMenu* WebSearchPopupMenu::popupMenu() +{ + return m_popup.get(); +} + +void WebSearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +{ +} + +void WebSearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +{ +} + +bool WebSearchPopupMenu::enabled() +{ + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h new file mode 100644 index 0000000..0221571 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WebSearchPopupMenu_h +#define WebSearchPopupMenu_h + +#include "WebPopupMenu.h" +#include <WebCore/SearchPopupMenu.h> + +namespace WebKit { + +class WebSearchPopupMenu : public WebCore::SearchPopupMenu { +public: + static PassRefPtr<WebSearchPopupMenu> create(WebPage*, WebCore::PopupMenuClient*); + + virtual WebCore::PopupMenu* popupMenu(); + virtual void saveRecentSearches(const WTF::AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const WTF::AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + WebSearchPopupMenu(WebPage*, WebCore::PopupMenuClient*); + + RefPtr<WebPopupMenu> m_popup; +}; + +} + +#endif // WebSearchPopupMenu_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp new file mode 100644 index 0000000..db9500a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuClient.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +bool WebContextMenuClient::isSpeaking() +{ + notImplemented(); + return false; +} + +void WebContextMenuClient::speak(const String&) +{ + notImplemented(); +} + +void WebContextMenuClient::stopSpeaking() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp new file mode 100644 index 0000000..b3c1289 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDatabaseManagerGtk.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManager.h" + +#include "NotImplemented.h" + +namespace WebKit { + +String WebDatabaseManager::databaseDirectory() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h new file mode 100644 index 0000000..1a2d611 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameNetworkingContext.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#ifndef WebFrameNetworkingContext_h +#define WebFrameNetworkingContext_h + +#include <WebCore/FrameNetworkingContext.h> + +class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame*) + { + return 0; + } + +private: + WebFrameNetworkingContext(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } + + virtual WTF::String userAgent() const; + virtual WTF::String referrer() const; + + WTF::String m_userAgent; +}; + +#endif // WebFrameNetworkingContext_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp new file mode 100644 index 0000000..6cda476 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenu.h" + +#include "NotImplemented.h" +#include "PlatformPopupMenuData.h" + +using namespace WebCore; + +namespace WebKit { + +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm new file mode 100644 index 0000000..32d08b2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuClient.h" + +#include "NotImplemented.h" +#include "WebPage.h" +#include <WebCore/Frame.h> +#include <WebCore/Page.h> +#include <wtf/text/WTFString.h> + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::lookUpInDictionary(Frame*) +{ + // FIXME: <rdar://problem/8750610> - Implement + notImplemented(); +} + +bool WebContextMenuClient::isSpeaking() +{ + return m_page->isSpeaking(); +} + +void WebContextMenuClient::speak(const String& string) +{ + m_page->speak(string); +} + +void WebContextMenuClient::stopSpeaking() +{ + m_page->stopSpeaking(); +} + +void WebContextMenuClient::searchWithSpotlight() +{ + // FIXME: Why do we need to search all the frames like this? + // Isn't there any function in WebCore that can do this? + // If not, can we find a place in WebCore to put this? + + Frame* mainFrame = m_page->corePage()->mainFrame(); + + Frame* selectionFrame = mainFrame; + for (; selectionFrame; selectionFrame = selectionFrame->tree()->traverseNext(mainFrame)) { + if (selectionFrame->selection()->isRange()) + break; + } + if (!selectionFrame) + selectionFrame = mainFrame; + + String selectedString = selectionFrame->displayStringModifiedByEncoding(selectionFrame->editor()->selectedText()); + + if (selectedString.isEmpty()) + return; + + NSString *convertedSelectedString = selectedString; + + [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:convertedSelectedString]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm new file mode 100644 index 0000000..d4eb3ac --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDatabaseManagerMac.mm @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManager.h" + +namespace WebKit { + +NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; + +String WebDatabaseManager::databaseDirectory() const +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; + if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) + databasesDirectory = @"~/Library/WebKit/Databases"; + + return [databasesDirectory stringByStandardizingPath]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm new file mode 100644 index 0000000..ce33890 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2006, 2010, 2011 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "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> +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#import <AppKit/NSTextChecker.h> +#endif + +using namespace WebCore; + +@interface NSAttributedString (WebNSAttributedStringDetails) +- (DOMDocumentFragment*)_documentFromRange:(NSRange)range document:(DOMDocument*)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources; +@end + +@interface WebResource (WebResourceInternal) +- (WebCore::ArchiveResource*)_coreResource; +@end + +namespace WebKit { + +void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event) +{ + if (m_page->interceptEditingKeyboardEvent(event, false)) + event->setDefaultHandled(); +} + +void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) +{ + if (m_page->interceptEditingKeyboardEvent(event, true)) + event->setDefaultHandled(); +} + +NSString *WebEditorClient::userVisibleString(NSURL *url) +{ + return [url _web_userVisibleString]; +} + +NSURL *WebEditorClient::canonicalizeURL(NSURL *url) +{ + return [url _webkit_canonicalize]; +} + +NSURL *WebEditorClient::canonicalizeURLString(NSString *URLString) +{ + NSURL *URL = nil; + if ([URLString _webkit_looksLikeAbsoluteURL]) + URL = [[NSURL _web_URLWithUserTypedString:URLString] _webkit_canonicalize]; + return URL; +} + +static NSArray *createExcludedElementsForAttributedStringConversion() +{ + NSArray *elements = [[NSArray alloc] initWithObjects: + // Omit style since we want style to be inline so the fragment can be easily inserted. + @"style", + // Omit xml so the result is not XHTML. + @"xml", + // Omit tags that will get stripped when converted to a fragment anyway. + @"doctype", @"html", @"head", @"body", + // Omit deprecated tags. + @"applet", @"basefont", @"center", @"dir", @"font", @"isindex", @"menu", @"s", @"strike", @"u", + // Omit object so no file attachments are part of the fragment. + @"object", nil]; + CFRetain(elements); + return elements; +} + +DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource> >& resources) +{ + static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion(); + + NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: excludedElements, + NSExcludedElementsDocumentAttribute, nil, @"WebResourceHandler", nil]; + + NSArray *subResources; + DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length]) + document:kit(m_page->mainFrame()->coreFrame()->document()) + documentAttributes:dictionary + subresources:&subResources]; + for (WebResource* resource in subResources) + resources.append([resource _coreResource]); + + [dictionary release]; + return core(fragment); +} + +void WebEditorClient::setInsertionPasteboard(NSPasteboard *) +{ + // This is used only by Mail, no need to implement it now. + notImplemented(); +} + +#ifdef BUILDING_ON_TIGER +NSArray *WebEditorClient::pasteboardTypesForSelection(Frame*) +{ + notImplemented(); + return nil; +} +#endif + +static void changeWordCase(WebPage* page, SEL selector) +{ + Frame* frame = page->corePage()->focusController()->focusedOrMainFrame(); + if (!frame->editor()->canEdit()) + return; + + frame->editor()->command("selectWord").execute(); + + NSString *selectedString = frame->displayStringModifiedByEncoding(frame->editor()->selectedText()); + page->replaceSelectionWithText(frame, [selectedString performSelector:selector]); +} + +void WebEditorClient::uppercaseWord() +{ + changeWordCase(m_page, @selector(uppercaseString)); +} + +void WebEditorClient::lowercaseWord() +{ + changeWordCase(m_page, @selector(lowercaseString)); +} + +void WebEditorClient::capitalizeWord() +{ + changeWordCase(m_page, @selector(capitalizedString)); +} + +void WebEditorClient::showSubstitutionsPanel(bool) +{ + notImplemented(); +} + +bool WebEditorClient::substitutionsPanelIsShowing() +{ + notImplemented(); + return false; +} + +void WebEditorClient::toggleSmartInsertDelete() +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled() +{ + return WebProcess::shared().textCheckerState().isAutomaticQuoteSubstitutionEnabled; +} + +void WebEditorClient::toggleAutomaticQuoteSubstitution() +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +bool WebEditorClient::isAutomaticLinkDetectionEnabled() +{ + return WebProcess::shared().textCheckerState().isAutomaticLinkDetectionEnabled; +} + +void WebEditorClient::toggleAutomaticLinkDetection() +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +bool WebEditorClient::isAutomaticDashSubstitutionEnabled() +{ + return WebProcess::shared().textCheckerState().isAutomaticDashSubstitutionEnabled; +} + +void WebEditorClient::toggleAutomaticDashSubstitution() +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +bool WebEditorClient::isAutomaticTextReplacementEnabled() +{ + return WebProcess::shared().textCheckerState().isAutomaticTextReplacementEnabled; +} + +void WebEditorClient::toggleAutomaticTextReplacement() +{ + // This is handled in the UI process. + ASSERT_NOT_REACHED(); +} + +bool WebEditorClient::isAutomaticSpellingCorrectionEnabled() +{ + return WebProcess::shared().textCheckerState().isAutomaticSpellingCorrectionEnabled; +} + +void WebEditorClient::toggleAutomaticSpellingCorrection() +{ + notImplemented(); +} + +void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) +{ + // FIXME: It would be nice if we wouldn't have to copy the text here. + m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(String(text, length), checkingTypes), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results)); +} + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType type, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, const Vector<String>& alternativeReplacementStrings, WebCore::Editor*) +{ + notImplemented(); +} + +void WebEditorClient::dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) +{ + notImplemented(); +} + +bool WebEditorClient::isShowingCorrectionPanel() +{ + notImplemented(); + return false; +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm new file mode 100644 index 0000000..549d7ee --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebErrors.h" + +#include "WKError.h" +#include "WebError.h" +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> +#include <pthread.h> + +using namespace WebCore; +using namespace WebKit; + +// FIXME: We probably don't need to use NSErrors here. + +static NSString * const WebKitErrorMIMETypeKey = @"WebKitErrorMIMETypeKey"; +static NSString * const WebKitErrorPlugInNameKey = @"WebKitErrorPlugInNameKey"; +static NSString * const WebKitErrorPlugInPageURLStringKey = @"WebKitErrorPlugInPageURLStringKey"; + +// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized +#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str] + +// Policy errors +#define WebKitErrorDescriptionCannotShowMIMEType UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description") +#define WebKitErrorDescriptionCannotShowURL UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description") +#define WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description") +#define WebKitErrorDescriptionCannotUseRestrictedPort UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description") + +// Plug-in and java errors +#define WebKitErrorDescriptionCannotFindPlugin UI_STRING("The plug-in can’t be found", "WebKitErrorCannotFindPlugin description") +#define WebKitErrorDescriptionCannotLoadPlugin UI_STRING("The plug-in can’t be loaded", "WebKitErrorCannotLoadPlugin description") +#define WebKitErrorDescriptionJavaUnavailable UI_STRING("Java is unavailable", "WebKitErrorJavaUnavailable description") +#define WebKitErrorDescriptionPlugInCancelledConnection UI_STRING("Plug-in cancelled", "WebKitErrorPlugInCancelledConnection description") +#define WebKitErrorDescriptionPlugInWillHandleLoad UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description") + +static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT; +static void registerErrors(void); + +@interface NSError (WebKitExtras) ++ (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL; +@end + +@implementation NSError (WebKitExtras) + +static NSMutableDictionary *descriptions = nil; + ++ (void)_registerWebKitErrors +{ + pthread_once(®isterErrorsControl, registerErrors); +} + +-(id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL +{ + NSDictionary *descriptionsDict; + NSString *localizedDesc; + NSDictionary *dict; + // insert a localized string here for those folks not savvy to our category methods + descriptionsDict = [descriptions objectForKey:domain]; + localizedDesc = descriptionsDict ? [descriptionsDict objectForKey:[NSNumber numberWithInt:code]] : nil; + dict = [NSDictionary dictionaryWithObjectsAndKeys: + URL, @"NSErrorFailingURLKey", + [URL absoluteString], @"NSErrorFailingURLStringKey", + localizedDesc, NSLocalizedDescriptionKey, + nil]; + return [self initWithDomain:domain code:code userInfo:dict]; +} + ++(id)_webkit_errorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL +{ + return [[[self alloc] _webkit_initWithDomain:domain code:code URL:URL] autorelease]; +} + ++ (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL +{ + [self _registerWebKitErrors]; + return [self _webkit_errorWithDomain:domain code:code URL:URL]; +} + ++ (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URLString +{ + return [self _webKitErrorWithDomain:WebError::webKitErrorDomain() code:code URL:[NSURL URLWithString:URLString]]; +} + ++ (void)_webkit_addErrorsWithCodesAndDescriptions:(NSDictionary *)dictionary inDomain:(NSString *)domain +{ + if (!descriptions) + descriptions = [[NSMutableDictionary alloc] init]; + + [descriptions setObject:dictionary forKey:domain]; +} + +static void registerErrors() +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: + // Policy errors + WebKitErrorDescriptionCannotShowMIMEType, [NSNumber numberWithInt: kWKErrorCodeCannotShowMIMEType], + WebKitErrorDescriptionCannotShowURL, [NSNumber numberWithInt: kWKErrorCodeCannotShowURL], + WebKitErrorDescriptionFrameLoadInterruptedByPolicyChange, [NSNumber numberWithInt: kWKErrorCodeFrameLoadInterruptedByPolicyChange], + WebKitErrorDescriptionCannotUseRestrictedPort, [NSNumber numberWithInt: kWKErrorCodeCannotUseRestrictedPort], + + // Plug-in and java errors + WebKitErrorDescriptionCannotFindPlugin, [NSNumber numberWithInt: kWKErrorCodeCannotFindPlugIn], + WebKitErrorDescriptionCannotLoadPlugin, [NSNumber numberWithInt: kWKErrorCodeCannotLoadPlugIn], + WebKitErrorDescriptionJavaUnavailable, [NSNumber numberWithInt: kWKErrorCodeJavaUnavailable], + WebKitErrorDescriptionPlugInCancelledConnection, [NSNumber numberWithInt: kWKErrorCodePlugInCancelledConnection], + WebKitErrorDescriptionPlugInWillHandleLoad, [NSNumber numberWithInt: kWKErrorCodePlugInWillHandleLoad], + nil]; + + [NSError _webkit_addErrorsWithCodesAndDescriptions:dict inDomain:WebError::webKitErrorDomain()]; + + [pool drain]; +} + +@end + +namespace WebKit { + +ResourceError cancelledError(const ResourceRequest& request) +{ + return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()]; +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return [NSError _webKitErrorWithDomain:WebError::webKitErrorDomain() code:kWKErrorCodeCannotUseRestrictedPort URL:request.url()]; +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return [NSError _webKitErrorWithDomain:WebError::webKitErrorDomain() code:kWKErrorCodeCannotShowURL URL:request.url()]; +} + +ResourceError interruptForPolicyChangeError(const ResourceRequest& request) +{ + return [NSError _webKitErrorWithDomain:WebError::webKitErrorDomain() code:kWKErrorCodeFrameLoadInterruptedByPolicyChange URL:request.url()]; +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:kWKErrorCodeCannotShowMIMEType URL:response.url()]; +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist URL:response.url()]; +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return [NSError _webKitErrorWithDomain:WebError::webKitErrorDomain() code:kWKErrorCodePlugInWillHandleLoad URL:response.url()]; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h new file mode 100644 index 0000000..994d285 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebFrameNetworkingContext_h +#define WebFrameNetworkingContext_h + +#import <WebCore/FrameNetworkingContext.h> + +namespace WebKit { + +class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame) + { + return adoptRef(new WebFrameNetworkingContext(frame)); + } + +private: + WebFrameNetworkingContext(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } + + virtual bool needsSiteSpecificQuirks() const; + virtual bool localFileContentSniffingEnabled() const; + virtual WebCore::SchedulePairHashSet* scheduledRunLoopPairs() const; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const; +}; + +} + +#endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm new file mode 100644 index 0000000..570d351 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm @@ -0,0 +1,50 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#import "WebFrameNetworkingContext.h" + +#import <WebCore/Page.h> +#import <WebCore/ResourceError.h> +#import <WebCore/Settings.h> + +using namespace WebCore; + +namespace WebKit { + +bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const +{ + return frame() && frame()->settings() && frame()->settings()->needsSiteSpecificQuirks(); +} + +bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const +{ + return frame() && frame()->settings() && frame()->settings()->localFileContentSniffingEnabled(); +} + +SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const +{ + return frame() && frame()->page() ? frame()->page()->scheduledRunLoopPairs() : 0; +} + +ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const +{ + return frame()->loader()->blockedError(request); +} + +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm new file mode 100644 index 0000000..4d3d167 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenu.h" + +#include "PlatformPopupMenuData.h" + +using namespace WebCore; + +namespace WebKit { + +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.h b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.h new file mode 100644 index 0000000..da0c2dd --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.h @@ -0,0 +1,31 @@ +/* + * 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 WebSystemInterface_h +#define WebSystemInterface_h + +void InitWebCoreSystemInterface(void); + +#endif /* WebSystemInterface_h */ diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm new file mode 100644 index 0000000..90b9a64 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebSystemInterface.h" + +#import <WebCore/WebCoreSystemInterface.h> +#import <WebKitSystemInterface.h> + +#define INIT(function) wk##function = WK##function + +void InitWebCoreSystemInterface(void) +{ + static dispatch_once_t initOnce; + + dispatch_once(&initOnce, ^{ + INIT(AdvanceDefaultButtonPulseAnimation); + INIT(CopyCFLocalizationPreferredName); + INIT(CGContextGetShouldSmoothFonts); + INIT(CopyCONNECTProxyResponse); + INIT(CopyNSURLResponseStatusLine); + INIT(CreateCTLineWithUniCharProvider); + INIT(CreateCustomCFReadStream); + INIT(CreateNSURLConnectionDelegateProxy); + INIT(DrawBezeledTextArea); + INIT(DrawBezeledTextFieldCell); + INIT(DrawCapsLockIndicator); + INIT(DrawFocusRing); + INIT(DrawMediaSliderTrack); + INIT(DrawMediaUIPart); + INIT(DrawTextFieldCellFocusRing); + INIT(GetExtensionsForMIMEType); + INIT(GetFontInLanguageForCharacter); + INIT(GetFontInLanguageForRange); + INIT(GetGlyphTransformedAdvances); + INIT(GetGlyphsForCharacters); + INIT(GetMIMETypeForExtension); + INIT(GetNSURLResponseLastModifiedDate); + INIT(GetPreferredExtensionForMIMEType); + INIT(GetUserToBaseCTM); + INIT(GetWheelEventDeltas); + INIT(HitTestMediaUIPart); + INIT(InitializeMaximumHTTPConnectionCountPerHost); + INIT(IsLatchingWheelEvent); + INIT(MeasureMediaUIPart); + INIT(MediaControllerThemeAvailable); + INIT(PopupMenu); + INIT(QTIncludeOnlyModernMediaFileTypes); + INIT(QTMovieDataRate); + INIT(QTMovieDisableComponent); + INIT(QTMovieGetType); + INIT(QTMovieHasClosedCaptions); + INIT(QTMovieMaxTimeLoaded); + INIT(QTMovieMaxTimeLoadedChangeNotification); + INIT(QTMovieMaxTimeSeekable); + INIT(QTMovieSelectPreferredAlternates); + INIT(QTMovieSetShowClosedCaptions); + INIT(QTMovieViewSetDrawSynchronously); + INIT(SetCGFontRenderingMode); + INIT(SetCONNECTProxyAuthorizationForStream); + INIT(SetCONNECTProxyForStream); + INIT(SetCookieStoragePrivateBrowsingEnabled); + INIT(SetDragImage); + INIT(SetNSURLConnectionDefersCallbacks); + INIT(SetNSURLRequestShouldContentSniff); + INIT(SetPatternBaseCTM); + INIT(SetPatternPhaseInUserSpace); + INIT(SetUpFontCache); + INIT(SignalCFReadStreamEnd); + INIT(SignalCFReadStreamError); + INIT(SignalCFReadStreamHasBytes); + +#if !defined(BUILDING_ON_SNOW_LEOPARD) + INIT(CreateCTTypesetterWithUniCharProviderAndOptions); +#else + INIT(GetHyphenationLocationBeforeIndex); +#endif + }); +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp new file mode 100644 index 0000000..abfb70a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebContextMenuClientQt.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuClient.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +bool WebContextMenuClient::isSpeaking() +{ + notImplemented(); + return false; +} + +void WebContextMenuClient::speak(const String&) +{ + notImplemented(); +} + +void WebContextMenuClient::stopSpeaking() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp new file mode 100644 index 0000000..11f929c --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebDatabaseManagerQt.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManager.h" + +namespace WebKit { + +String WebDatabaseManager::databaseDirectory() const +{ + // FIXME: Implement. + return ""; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp new file mode 100644 index 0000000..cee6842 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp @@ -0,0 +1,95 @@ +/* + * 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 "WebErrors.h" + +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +#include <QCoreApplication> +#include <QNetworkReply> + +using namespace WebCore; + +namespace WebKit { + +// copied from WebKit/Misc/WebKitErrors[Private].h +enum { + WebKitErrorCannotShowMIMEType = 100, + WebKitErrorCannotShowURL = 101, + WebKitErrorFrameLoadInterruptedByPolicyChange = 102, + WebKitErrorCannotUseRestrictedPort = 103, + WebKitErrorCannotFindPlugIn = 200, + WebKitErrorCannotLoadPlugIn = 201, + WebKitErrorJavaUnavailable = 202, + WebKitErrorPluginWillHandleLoad = 203 +}; + +ResourceError cancelledError(const ResourceRequest& request) +{ + ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), + QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); + error.setIsCancellation(true); + return error; +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError("WebKit", WebKitErrorCannotUseRestrictedPort, request.url().prettyURL(), + QCoreApplication::translate("QWebFrame", "Request blocked", 0, QCoreApplication::UnicodeUTF8)); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError("WebKit", WebKitErrorCannotShowURL, request.url().string(), + QCoreApplication::translate("QWebFrame", "Cannot show URL", 0, QCoreApplication::UnicodeUTF8)); +} + +ResourceError interruptForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError("WebKit", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), + QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0, QCoreApplication::UnicodeUTF8)); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), + QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(), + QCoreApplication::translate("QWebFrame", "File does not exist", 0, QCoreApplication::UnicodeUTF8)); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError("WebKit", WebKitErrorPluginWillHandleLoad, response.url().string(), + QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0, QCoreApplication::UnicodeUTF8)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp new file mode 100644 index 0000000..55552e1 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp @@ -0,0 +1,51 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#include "WebFrameNetworkingContext.h" + +#include "WebProcess.h" +#include <QNetworkAccessManager> +#include <QObject> + +namespace WebCore { + +WebFrameNetworkingContext::WebFrameNetworkingContext(Frame* frame) + : FrameNetworkingContext(frame) + , m_originatingObject(0) +{ +} + +PassRefPtr<WebFrameNetworkingContext> WebFrameNetworkingContext::create(Frame* frame) +{ + return adoptRef(new WebFrameNetworkingContext(frame)); +} + +QObject* WebFrameNetworkingContext::originatingObject() const +{ + return m_originatingObject; +} + +QNetworkAccessManager* WebFrameNetworkingContext::networkAccessManager() const +{ + return WebKit::WebProcess::shared().networkAccessManager(); +} + +} diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h new file mode 100644 index 0000000..9c87785 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebFrameNetworkingContext_h +#define WebFrameNetworkingContext_h + +#include <WebCore/FrameNetworkingContext.h> + +namespace WebCore { + +class WebFrameNetworkingContext : public FrameNetworkingContext { +public: + static PassRefPtr<WebFrameNetworkingContext> create(Frame*); + +private: + WebFrameNetworkingContext(Frame*); + + virtual QObject* originatingObject() const; + virtual QNetworkAccessManager* networkAccessManager() const; + + QObject* m_originatingObject; +}; + +} + +#endif // WebFrameNetworkingContext_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp new file mode 100644 index 0000000..4d3d167 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenu.h" + +#include "PlatformPopupMenuData.h" + +using namespace WebCore; + +namespace WebKit { + +void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp new file mode 100644 index 0000000..c16a4d6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebContextMenuClient.h" +#include <WebCore/NotImplemented.h> + +using namespace WebCore; + +namespace WebKit { + +void WebContextMenuClient::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +bool WebContextMenuClient::isSpeaking() +{ + notImplemented(); + return false; +} + +void WebContextMenuClient::speak(const String&) +{ + notImplemented(); +} + +void WebContextMenuClient::stopSpeaking() +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp new file mode 100644 index 0000000..b6d15fd --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebDatabaseManagerWin.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebDatabaseManager.h" + +#include <WebCore/FileSystem.h> + +using namespace WebCore; + +namespace WebKit { + +String WebDatabaseManager::databaseDirectory() const +{ + return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases"); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp new file mode 100644 index 0000000..b29b461 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebErrorsWin.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebErrors.h" + +#include "WKError.h" +#include "WebError.h" +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +#if USE(CFNETWORK) +#include <CFNetwork/CFNetworkErrors.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +ResourceError cancelledError(const ResourceRequest& request) +{ +#if USE(CFNETWORK) + return ResourceError(kCFErrorDomainCFNetwork, kCFURLErrorCancelled, request.url().string(), String()); +#else + return ResourceError(); // FIXME +#endif +} + +ResourceError blockedError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), String()); +} + +ResourceError cannotShowURLError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), String()); +} + +ResourceError interruptForPolicyChangeError(const ResourceRequest& request) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), String()); +} + +ResourceError cannotShowMIMETypeError(const ResourceResponse& response) +{ + return ResourceError(); +} + +ResourceError fileDoesNotExistError(const ResourceResponse& response) +{ + return ResourceError(); +} + +ResourceError pluginWillHandleLoadError(const ResourceResponse& response) +{ + return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), String()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp new file mode 100644 index 0000000..6b20c1f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp @@ -0,0 +1,20 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +// Checking this file in empty to get the build system work out of the way. +// Will put the code in here later. diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h new file mode 100644 index 0000000..016dcce --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebFrameNetworkingContext_h +#define WebFrameNetworkingContext_h + +#include <WebCore/FrameNetworkingContext.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> + +class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame) + { + return adoptRef(new WebFrameNetworkingContext(frame)); + } + +private: + WebFrameNetworkingContext(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } + + virtual WTF::String userAgent() const; + virtual WTF::String referrer() const; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const; + + WTF::String m_userAgent; +}; + +#endif // WebFrameNetworkingContext_h diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp new file mode 100644 index 0000000..9c23133 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPopupMenu.h" + +#include "PlatformPopupMenuData.h" +#include <WebCore/Font.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/TextRun.h> +#include <WebCore/PopupMenuClient.h> +#include <WebCore/PopupMenuStyle.h> +#include <WebCore/RenderTheme.h> + +using namespace WebCore; + +namespace WebKit { + +static const int separatorPadding = 4; +static const int separatorHeight = 1; +static const int popupWindowBorderWidth = 1; + +void WebPopupMenu::setUpPlatformData(const WebCore::IntRect& pageCoordinates, PlatformPopupMenuData& data) +{ + int itemCount = m_popupClient->listSize(); + + data.m_clientPaddingLeft = m_popupClient->clientPaddingLeft(); + 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; + + int popupWidth = 0; + for (size_t i = 0; i < itemCount; ++i) { + String text = m_popupClient->itemText(i); + if (text.isEmpty()) + continue; + + Font itemFont = m_popupClient->menuStyle().font(); + if (m_popupClient->itemIsLabel(i)) { + FontDescription d = itemFont.fontDescription(); + d.setWeight(d.bolderWeight()); + itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); + itemFont.update(m_popupClient->fontSelector()); + } + + popupWidth = std::max(popupWidth, itemFont.width(TextRun(text.characters(), text.length()))); + } + + // FIXME: popupWidth should probably take into account monitor constraints as is done with WebPopupMenuProxyWin::calculatePositionAndSize. + + popupWidth += max(0, data.m_clientPaddingRight - data.m_clientInsetRight) + max(0, data.m_clientPaddingLeft - data.m_clientInsetLeft); + popupWidth += 2 * popupWindowBorderWidth; + data.m_popupWidth = popupWidth; + + // The backing stores should be drawn at least as wide as the control on the page to match the width of the popup window we'll create. + int backingStoreWidth = max(pageCoordinates.width() - m_popupClient->clientInsetLeft() - m_popupClient->clientInsetRight(), popupWidth); + + data.m_backingStoreSize = IntSize(backingStoreWidth, (itemCount * data.m_itemHeight)); + data.m_notSelectedBackingStore = ShareableBitmap::createShareable(data.m_backingStoreSize); + data.m_selectedBackingStore = ShareableBitmap::createShareable(data.m_backingStoreSize); + + OwnPtr<GraphicsContext> notSelectedBackingStoreContext = data.m_notSelectedBackingStore->createGraphicsContext(); + OwnPtr<GraphicsContext> selectedBackingStoreContext = data.m_selectedBackingStore->createGraphicsContext(); + + Color activeOptionBackgroundColor = RenderTheme::defaultTheme()->activeListBoxSelectionBackgroundColor(); + Color activeOptionTextColor = RenderTheme::defaultTheme()->activeListBoxSelectionForegroundColor(); + + for (int y = 0; y < data.m_backingStoreSize.height(); y += data.m_itemHeight) { + int index = y / data.m_itemHeight; + + PopupMenuStyle itemStyle = m_popupClient->itemStyle(index); + + Color optionBackgroundColor = itemStyle.backgroundColor(); + Color optionTextColor = itemStyle.foregroundColor(); + + IntRect itemRect(0, y, backingStoreWidth, data.m_itemHeight); + + // Draw the background for this menu item + if (itemStyle.isVisible()) { + notSelectedBackingStoreContext->fillRect(itemRect, optionBackgroundColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->fillRect(itemRect, activeOptionBackgroundColor, ColorSpaceDeviceRGB); + } + + if (m_popupClient->itemIsSeparator(index)) { + IntRect separatorRect(itemRect.x() + separatorPadding, itemRect.y() + (itemRect.height() - separatorHeight) / 2, itemRect.width() - 2 * separatorPadding, separatorHeight); + + notSelectedBackingStoreContext->fillRect(separatorRect, optionTextColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->fillRect(separatorRect, activeOptionTextColor, ColorSpaceDeviceRGB); + continue; + } + + String itemText = m_popupClient->itemText(index); + + unsigned length = itemText.length(); + const UChar* string = itemText.characters(); + TextRun textRun(string, length, false, 0, 0, itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft); + + notSelectedBackingStoreContext->setFillColor(optionTextColor, ColorSpaceDeviceRGB); + selectedBackingStoreContext->setFillColor(activeOptionTextColor, ColorSpaceDeviceRGB); + + Font itemFont = m_popupClient->menuStyle().font(); + if (m_popupClient->itemIsLabel(index)) { + FontDescription d = itemFont.fontDescription(); + d.setWeight(d.bolderWeight()); + itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); + itemFont.update(m_popupClient->fontSelector()); + } + + // Draw the item text + if (itemStyle.isVisible()) { + 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; + + notSelectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); + selectedBackingStoreContext->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); + } + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebKitMain.cpp b/Source/WebKit2/WebProcess/WebKitMain.cpp new file mode 100644 index 0000000..53084a6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebKitMain.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "CommandLine.h" + +#include "PluginProcessMain.h" +#include "ProcessLauncher.h" +#include "WebProcessMain.h" +#include <wtf/text/CString.h> + +#if PLATFORM(MAC) +#include <objc/objc-auto.h> +#endif + +using namespace WebKit; + +static int WebKitMain(const CommandLine& commandLine) +{ + ProcessLauncher::ProcessType processType; + if (!ProcessLauncher::getProcessTypeFromString(commandLine["type"].utf8().data(), processType)) + return EXIT_FAILURE; + + switch (processType) { + case ProcessLauncher::WebProcess: + return WebProcessMain(commandLine); + case ProcessLauncher::PluginProcess: +#if ENABLE(PLUGIN_PROCESS) + return PluginProcessMain(commandLine); +#else + break; +#endif + } + + return EXIT_FAILURE; +} + +#if PLATFORM(MAC) + +extern "C" WK_EXPORT int WebKitMain(int argc, char** argv); + +int WebKitMain(int argc, char** argv) +{ + ASSERT(!objc_collectingEnabled()); + + CommandLine commandLine; + if (!commandLine.parse(argc, argv)) + return EXIT_FAILURE; + + return WebKitMain(commandLine); +} + +#elif PLATFORM(WIN) + +#ifndef DEBUG_ALL +#define PROCESS_NAME L"WebKit2WebKitProcess.exe" +#else +#define PROCESS_NAME L"WebKit2WebProcess_debug.exe" +#endif + +static void enableDataExecutionPrevention() +{ + // Enable Data Execution prevention at runtime rather than via /NXCOMPAT + // http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx + + const DWORD enableDEP = 0x00000001; + + HMODULE hMod = ::GetModuleHandleW(L"Kernel32.dll"); + if (!hMod) + return; + + typedef BOOL (WINAPI *PSETDEP)(DWORD); + + PSETDEP procSet = reinterpret_cast<PSETDEP>(::GetProcAddress(hMod, "SetProcessDEPPolicy")); + if (!procSet) + return; + + // Enable Data Execution Prevention, but allow ATL thunks (for compatibility with the version of ATL that ships with the Platform SDK). + procSet(enableDEP); +} + +static void enableTerminationOnHeapCorruption() +{ + // Enable termination on heap corruption on OSes that support it (Vista and XPSP3). + // http://msdn.microsoft.com/en-us/library/aa366705(VS.85).aspx + + const HEAP_INFORMATION_CLASS heapEnableTerminationOnCorruption = static_cast<HEAP_INFORMATION_CLASS>(1); + + HMODULE hMod = ::GetModuleHandleW(L"kernel32.dll"); + if (!hMod) + return; + + typedef BOOL (WINAPI*HSI)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T); + HSI heapSetInformation = reinterpret_cast<HSI>(::GetProcAddress(hMod, "HeapSetInformation")); + if (!heapSetInformation) + return; + + heapSetInformation(0, heapEnableTerminationOnCorruption, 0, 0); +} + +static void disableUserModeCallbackExceptionFilter() +{ + const DWORD PROCESS_CALLBACK_FILTER_ENABLED = 0x1; + typedef BOOL (NTAPI *getProcessUserModeExceptionPolicyPtr)(LPDWORD lpFlags); + typedef BOOL (NTAPI *setProcessUserModeExceptionPolicyPtr)(DWORD dwFlags); + + HMODULE lib = LoadLibrary(TEXT("kernel32.dll")); + ASSERT(lib); + + getProcessUserModeExceptionPolicyPtr getPolicyPtr = (getProcessUserModeExceptionPolicyPtr)GetProcAddress(lib, "GetProcessUserModeExceptionPolicy"); + setProcessUserModeExceptionPolicyPtr setPolicyPtr = (setProcessUserModeExceptionPolicyPtr)GetProcAddress(lib, "SetProcessUserModeExceptionPolicy"); + + DWORD dwFlags; + if (!getPolicyPtr || !setPolicyPtr || !getPolicyPtr(&dwFlags)) { + FreeLibrary(lib); + return; + } + + // If this flag isn't cleared, exceptions that are thrown when running in a 64-bit version of + // Windows are ignored, possibly leaving Safari in an inconsistent state that could cause an + // unrelated exception to be thrown. + // http://support.microsoft.com/kb/976038 + // http://blog.paulbetts.org/index.php/2010/07/20/the-case-of-the-disappearing-onload-exception-user-mode-callback-exceptions-in-x64/ + setPolicyPtr(dwFlags & ~PROCESS_CALLBACK_FILTER_ENABLED); + + FreeLibrary(lib); +} + +extern "C" __declspec(dllexport) +int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow) +{ +#ifndef NDEBUG + // Show an alert when Ctrl-Alt-Shift is held down during launch to give the user time to attach a + // debugger. This is useful for debugging problems that happen early in the web process's lifetime. + const unsigned short highBitMaskShort = 0x8000; + if (getenv("WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH") || (::GetKeyState(VK_CONTROL) & highBitMaskShort) && (::GetKeyState(VK_MENU) & highBitMaskShort) && (::GetKeyState(VK_SHIFT) & highBitMaskShort)) + ::MessageBoxW(0, L"You can now attach a debugger to " PROCESS_NAME L". You can use\nthe same debugger for WebKit2WebProcessand the UI process, if desired.\nClick OK when you are ready for WebKit2WebProcess to continue.", L"WebKit2WebProcess has launched", MB_OK | MB_ICONINFORMATION); +#endif + + enableDataExecutionPrevention(); + + enableTerminationOnHeapCorruption(); + + disableUserModeCallbackExceptionFilter(); + + CommandLine commandLine; + if (!commandLine.parse(lpstrCmdLine)) + return EXIT_FAILURE; + + return WebKitMain(commandLine); +} + +#endif diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp new file mode 100644 index 0000000..513621c --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingArea.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "UpdateChunk.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebProcess.h" + +using namespace WebCore; + +namespace WebKit { + +ChunkedUpdateDrawingArea::ChunkedUpdateDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage) + : DrawingArea(DrawingAreaInfo::ChunkedUpdate, identifier, webPage) + , m_isWaitingForUpdate(false) + , m_paintingIsSuspended(false) + , m_displayTimer(WebProcess::shared().runLoop(), this, &ChunkedUpdateDrawingArea::display) +{ +} + +ChunkedUpdateDrawingArea::~ChunkedUpdateDrawingArea() +{ +} + +void ChunkedUpdateDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) +{ + // FIXME: Do something much smarter. + setNeedsDisplay(scrollRect); +} + +void ChunkedUpdateDrawingArea::setNeedsDisplay(const IntRect& rect) +{ + // FIXME: Collect a set of rects/region instead of just the union + // of all rects. + m_dirtyRect.unite(rect); + scheduleDisplay(); +} + +void ChunkedUpdateDrawingArea::display() +{ + ASSERT(!m_isWaitingForUpdate); + + if (m_paintingIsSuspended) + return; + + if (m_dirtyRect.isEmpty()) + return; + + // Laying out the page can cause the drawing area to change so we keep an extra reference. + RefPtr<ChunkedUpdateDrawingArea> protect(this); + + // Layout if necessary. + m_webPage->layoutIfNeeded(); + + if (m_webPage->drawingArea() != this) + return; + + IntRect dirtyRect = m_dirtyRect; + m_dirtyRect = IntRect(); + + // Create a new UpdateChunk and paint into it. + UpdateChunk updateChunk(dirtyRect); + paintIntoUpdateChunk(&updateChunk); + + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Update, m_webPage->pageID(), CoreIPC::In(updateChunk)); + + m_isWaitingForUpdate = true; + m_displayTimer.stop(); +} + +void ChunkedUpdateDrawingArea::scheduleDisplay() +{ + if (m_paintingIsSuspended) + return; + + if (m_isWaitingForUpdate) + return; + + if (m_dirtyRect.isEmpty()) + return; + + if (m_displayTimer.isActive()) + return; + + m_displayTimer.startOneShot(0); +} + +void ChunkedUpdateDrawingArea::setSize(const IntSize& viewSize) +{ + ASSERT_ARG(viewSize, !viewSize.isEmpty()); + + // We don't want to wait for an update until we display. + m_isWaitingForUpdate = false; + + // Laying out the page can cause the drawing area to change so we keep an extra reference. + RefPtr<ChunkedUpdateDrawingArea> protect(this); + + m_webPage->setSize(viewSize); + m_webPage->layoutIfNeeded(); + + if (m_webPage->drawingArea() != this) + return; + + if (m_paintingIsSuspended) { + ASSERT(!m_displayTimer.isActive()); + + // Painting is suspended, just send back an empty update chunk. + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(UpdateChunk())); + return; + } + + // Create a new UpdateChunk and paint into it. + UpdateChunk updateChunk(IntRect(0, 0, viewSize.width(), viewSize.height())); + paintIntoUpdateChunk(&updateChunk); + + m_displayTimer.stop(); + + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk)); +} + +void ChunkedUpdateDrawingArea::suspendPainting() +{ + ASSERT(!m_paintingIsSuspended); + + m_paintingIsSuspended = true; + m_displayTimer.stop(); +} + +void ChunkedUpdateDrawingArea::resumePainting(bool forceRepaint) +{ + ASSERT(m_paintingIsSuspended); + + m_paintingIsSuspended = false; + + if (forceRepaint) { + // Just set the dirty rect to the entire page size. + m_dirtyRect = IntRect(IntPoint(0, 0), m_webPage->size()); + } + + // Schedule a display. + scheduleDisplay(); +} + +void ChunkedUpdateDrawingArea::didUpdate() +{ + m_isWaitingForUpdate = false; + + // Display if needed. + display(); +} + +void ChunkedUpdateDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + DrawingAreaInfo::Identifier targetIdentifier; + if (!arguments->decode(CoreIPC::Out(targetIdentifier))) + return; + + // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it. + if (targetIdentifier != info().identifier) + return; + + switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) { + case DrawingAreaLegacyMessage::SetSize: { + IntSize size; + if (!arguments->decode(CoreIPC::Out(size))) + return; + + setSize(size); + break; + } + + case DrawingAreaLegacyMessage::SuspendPainting: + suspendPainting(); + break; + + case DrawingAreaLegacyMessage::ResumePainting: { + bool forceRepaint; + if (!arguments->decode(CoreIPC::Out(forceRepaint))) + return; + + resumePainting(forceRepaint); + break; + } + case DrawingAreaLegacyMessage::DidUpdate: + didUpdate(); + break; + + default: + ASSERT_NOT_REACHED(); + break; + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h new file mode 100644 index 0000000..ac4b424 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h @@ -0,0 +1,76 @@ +/* + * 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 ChunkedUpdateDrawingArea_h +#define ChunkedUpdateDrawingArea_h + +#include "DrawingArea.h" +#include "RunLoop.h" +#include <WebCore/IntPoint.h> + +namespace WebKit { + +class UpdateChunk; + +class ChunkedUpdateDrawingArea : public DrawingArea { +public: + ChunkedUpdateDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage*); + virtual ~ChunkedUpdateDrawingArea(); + + virtual void setNeedsDisplay(const WebCore::IntRect&); + virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); + virtual void display(); + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext() { } + virtual void detachCompositingContext() { } + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) { } + virtual void scheduleCompositingLayerSync() { } + virtual void syncCompositingLayers() { } +#endif + + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + void scheduleDisplay(); + + // CoreIPC message handlers. + void setSize(const WebCore::IntSize& viewSize); + void suspendPainting(); + void resumePainting(bool forceRepaint); + void didUpdate(); + + // Platform overrides + void paintIntoUpdateChunk(UpdateChunk*); + + WebCore::IntRect m_dirtyRect; + bool m_isWaitingForUpdate; + bool m_paintingIsSuspended; + RunLoop::Timer<ChunkedUpdateDrawingArea> m_displayTimer; +}; + +} // namespace WebKit + +#endif // ChunkedUpdateDrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp new file mode 100644 index 0000000..e5de52f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp @@ -0,0 +1,82 @@ +/* + * 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 "DecoderAdapter.h" + +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +DecoderAdapter::DecoderAdapter(const uint8_t* buffer, size_t bufferSize) + : m_decoder(buffer, bufferSize) +{ +} + +bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes) +{ + return m_decoder.decodeBytes(bytes); +} + +bool DecoderAdapter::decodeBool(bool& value) +{ + return m_decoder.decodeBool(value); +} + +bool DecoderAdapter::decodeUInt32(uint32_t& value) +{ + return m_decoder.decodeUInt32(value); +} + +bool DecoderAdapter::decodeUInt64(uint64_t& value) +{ + return m_decoder.decodeUInt64(value); +} + +bool DecoderAdapter::decodeInt32(int32_t& value) +{ + return m_decoder.decodeInt32(value); +} + +bool DecoderAdapter::decodeInt64(int64_t& value) +{ + return m_decoder.decodeInt64(value); +} + +bool DecoderAdapter::decodeFloat(float& value) +{ + return m_decoder.decodeFloat(value); +} + +bool DecoderAdapter::decodeDouble(double& value) +{ + return m_decoder.decodeDouble(value); +} + +bool DecoderAdapter::decodeString(String& value) +{ + return m_decoder.decode(value); +} + +} diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h new file mode 100644 index 0000000..bd34ea8 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.h @@ -0,0 +1,55 @@ +/* + * 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 DecoderAdapter_h +#define DecoderAdapter_h + +#include "ArgumentDecoder.h" +#include <wtf/Decoder.h> +#include <wtf/Forward.h> + +namespace WebKit { + +class DecoderAdapter : public Decoder { +public: + DecoderAdapter(const uint8_t* buffer, size_t bufferSize); + +private: + virtual bool decodeBytes(Vector<uint8_t>&); + virtual bool decodeBool(bool&); + virtual bool decodeUInt32(uint32_t&); + virtual bool decodeUInt64(uint64_t&); + virtual bool decodeInt32(int32_t&); + virtual bool decodeInt64(int64_t&); + virtual bool decodeFloat(float&); + virtual bool decodeDouble(double&); + virtual bool decodeString(String&); + + CoreIPC::ArgumentDecoder m_decoder; +}; + +} // namespace WebKit + +#endif // DecoderAdapter_h diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp new file mode 100644 index 0000000..3b76aaf --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DrawingArea.h" + +// Subclasses +#include "ChunkedUpdateDrawingArea.h" + +#ifdef __APPLE__ +#include "DrawingAreaImpl.h" +#endif + +#if USE(ACCELERATED_COMPOSITING) +#include "LayerBackedDrawingArea.h" +#endif + +#if ENABLE(TILED_BACKING_STORE) +#include "TiledDrawingArea.h" +#endif + +namespace WebKit { + +PassRefPtr<DrawingArea> DrawingArea::create(DrawingAreaInfo::Type type, DrawingAreaInfo::Identifier identifier, WebPage* webPage) +{ + switch (type) { + case DrawingAreaInfo::None: + ASSERT_NOT_REACHED(); + break; + + case DrawingAreaInfo::Impl: +#ifdef __APPLE__ + return DrawingAreaImpl::create(identifier, webPage); +#else + return 0; +#endif + case DrawingAreaInfo::ChunkedUpdate: + return adoptRef(new ChunkedUpdateDrawingArea(identifier, webPage)); + +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + case DrawingAreaInfo::LayerBacked: + return adoptRef(new LayerBackedDrawingArea(identifier, webPage)); +#endif +#if ENABLE(TILED_BACKING_STORE) + case DrawingAreaInfo::Tiled: + return adoptRef(new TiledDrawingArea(identifier, webPage)); +#endif + } + + return 0; +} + +DrawingArea::DrawingArea(DrawingAreaInfo::Type type, DrawingAreaInfo::Identifier identifier, WebPage* webPage) + : m_info(type, identifier) + , m_webPage(webPage) +{ +} + +DrawingArea::~DrawingArea() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h new file mode 100644 index 0000000..75f0b00 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -0,0 +1,88 @@ +/* + * 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 DrawingArea_h +#define DrawingArea_h + +#include "DrawingAreaInfo.h" +#include <WebCore/IntRect.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { +#if USE(ACCELERATED_COMPOSITING) + class GraphicsLayer; +#endif +} + +namespace WebKit { + +class WebPage; + +class DrawingArea : public RefCounted<DrawingArea> { +public: + // FIXME: It might make sense to move this create function into a factory style class. + static PassRefPtr<DrawingArea> create(DrawingAreaInfo::Type, DrawingAreaInfo::Identifier, WebPage*); + virtual ~DrawingArea(); + +#ifdef __APPLE__ + 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& scrollDelta) = 0; + + virtual void pageBackgroundTransparencyChanged() { } + + virtual void onPageClose() { } + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext() = 0; + virtual void detachCompositingContext() = 0; + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0; + virtual void scheduleCompositingLayerSync() = 0; + virtual void syncCompositingLayers() = 0; +#endif + + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0; + + const DrawingAreaInfo& info() const { return m_info; } + +protected: + DrawingArea(DrawingAreaInfo::Type, DrawingAreaInfo::Identifier, WebPage*); + + DrawingAreaInfo m_info; + WebPage* m_webPage; + +private: + // CoreIPC message handlers. + // FIXME: These should be pure virtual. + virtual void setSize(const WebCore::IntSize&) { } + virtual void didUpdate() { } +}; + +} // namespace WebKit + +#endif // DrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in new file mode 100644 index 0000000..6c628fb --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in @@ -0,0 +1,26 @@ +# 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 +# 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. + +messages -> DrawingArea { + SetSize(WebCore::IntSize size) + DidUpdate() +} diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp new file mode 100644 index 0000000..ab4655a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp @@ -0,0 +1,247 @@ +/* + * 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 "DrawingAreaImpl.h" + +#include "DrawingAreaProxyMessages.h" +#include "ShareableBitmap.h" +#include "UpdateInfo.h" +#include "WebPage.h" +#include "WebProcess.h" +#include <WebCore/GraphicsContext.h> + +#ifndef __APPLE__ +#error "This drawing area is not ready for use by other ports yet." +#endif + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<DrawingAreaImpl> DrawingAreaImpl::create(DrawingAreaInfo::Identifier identifier, WebPage* webPage) +{ + return adoptRef(new DrawingAreaImpl(identifier, webPage)); +} + +DrawingAreaImpl::~DrawingAreaImpl() +{ +} + +DrawingAreaImpl::DrawingAreaImpl(DrawingAreaInfo::Identifier identifier, WebPage* webPage) + : DrawingArea(DrawingAreaInfo::Impl, identifier, webPage) + , m_isWaitingForDidUpdate(false) + , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display) +{ +} + +void DrawingAreaImpl::setNeedsDisplay(const IntRect& rect) +{ + if (rect.isEmpty()) + return; + + m_dirtyRegion.unite(rect); + scheduleDisplay(); +} + +void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) +{ + if (!m_scrollRect.isEmpty() && scrollRect != m_scrollRect) { + unsigned scrollArea = scrollRect.width() * scrollRect.height(); + unsigned currentScrollArea = m_scrollRect.width() * m_scrollRect.height(); + + if (currentScrollArea >= scrollArea) { + // The rect being scrolled is at least as large as the rect we'd like to scroll. + // Go ahead and just invalidate the scroll rect. + setNeedsDisplay(scrollRect); + return; + } + + // Just repaint the entire current scroll rect, we'll scroll the new rect instead. + setNeedsDisplay(m_scrollRect); + m_scrollRect = IntRect(); + m_scrollDelta = IntSize(); + } + + // Get the part of the dirty region that is in the scroll rect. + Region dirtyRegionInScrollRect = intersect(scrollRect, m_dirtyRegion); + if (!dirtyRegionInScrollRect.isEmpty()) { + // There are parts of the dirty region that are inside the scroll rect. + // We need to subtract them from the region, move them and re-add them. + m_dirtyRegion.subtract(scrollRect); + + // Move the dirty parts. + Region movedDirtyRegionInScrollRect = intersect(translate(dirtyRegionInScrollRect, scrollDelta), scrollRect); + + // And add them back. + m_dirtyRegion.unite(movedDirtyRegionInScrollRect); + } + + // Compute the scroll repaint region. + Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollDelta)); + + m_dirtyRegion.unite(scrollRepaintRegion); + + m_scrollRect = scrollRect; + m_scrollDelta += scrollDelta; +} + +void DrawingAreaImpl::attachCompositingContext() +{ +} + +void DrawingAreaImpl::detachCompositingContext() +{ +} + +void DrawingAreaImpl::setRootCompositingLayer(WebCore::GraphicsLayer*) +{ +} + +void DrawingAreaImpl::scheduleCompositingLayerSync() +{ +} + +void DrawingAreaImpl::syncCompositingLayers() +{ +} + +void DrawingAreaImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) +{ +} + +void DrawingAreaImpl::setSize(const IntSize& size) +{ + // Set this to false since we're about to call display(). + m_isWaitingForDidUpdate = false; + + m_webPage->setSize(size); + m_webPage->layoutIfNeeded(); + + // FIXME: Repaint. + + m_webPage->send(Messages::DrawingAreaProxy::DidSetSize()); +} + +void DrawingAreaImpl::didUpdate() +{ + m_isWaitingForDidUpdate = false; + + // Display if needed. + display(); +} + +void DrawingAreaImpl::scheduleDisplay() +{ + if (m_isWaitingForDidUpdate) + return; + + if (m_dirtyRegion.isEmpty()) + return; + + if (m_displayTimer.isActive()) + return; + + m_displayTimer.startOneShot(0); +} + +void DrawingAreaImpl::display() +{ + if (m_dirtyRegion.isEmpty()) + return; + + UpdateInfo updateInfo; + display(updateInfo); + + m_webPage->send(Messages::DrawingAreaProxy::Update(updateInfo)); + m_isWaitingForDidUpdate = true; +} + +static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect>& rects) +{ + const size_t rectThreshold = 10; + const float wastedSpaceThreshold = 0.75f; + + if (rects.size() <= 1 || rects.size() > rectThreshold) + return true; + + // Attempt to guess whether or not we should use the region bounds rect or the individual rects. + // We do this by computing the percentage of "wasted space" in the bounds. If that wasted space + // is too large, then we will do individual rect painting instead. + unsigned boundsArea = bounds.width() * bounds.height(); + unsigned rectsArea = 0; + for (size_t i = 0; i < rects.size(); ++i) + rectsArea += rects[i].width() * rects[i].height(); + + float wastedSpace = 1 - (rectsArea / boundsArea); + + return wastedSpace <= wastedSpaceThreshold; +} + +void DrawingAreaImpl::display(UpdateInfo& updateInfo) +{ + // FIXME: It would be better if we could avoid painting altogether when there is a custom representation. + if (m_webPage->mainFrameHasCustomRepresentation()) + return; + + IntRect bounds = m_dirtyRegion.bounds(); + Vector<IntRect> rects = m_dirtyRegion.rects(); + + if (shouldPaintBoundsRect(bounds, rects)) { + rects.clear(); + rects.append(bounds); + } + + updateInfo.scrollRect = m_scrollRect; + updateInfo.scrollDelta = m_scrollDelta; + + m_dirtyRegion = Region(); + m_scrollRect = IntRect(); + m_scrollDelta = IntSize(); + + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size()); + if (!bitmap->createHandle(updateInfo.bitmapHandle)) + return; + + OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext(); + + m_webPage->layoutIfNeeded(); + + updateInfo.viewSize = m_webPage->size(); + updateInfo.updateRectBounds = bounds; + + graphicsContext->translate(-bounds.x(), -bounds.y()); + + for (size_t i = 0; i < rects.size(); ++i) { + m_webPage->drawRect(*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(); +} + + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h new file mode 100644 index 0000000..1f1b2e2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h @@ -0,0 +1,76 @@ +/* + * 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 DrawingAreaImpl_h +#define DrawingAreaImpl_h + +#include "DrawingArea.h" +#include "Region.h" +#include "RunLoop.h" + +namespace WebKit { + +struct UpdateInfo; + +class DrawingAreaImpl : public DrawingArea { +public: + static PassRefPtr<DrawingAreaImpl> create(DrawingAreaInfo::Identifier, WebPage*); + virtual ~DrawingAreaImpl(); + +private: + DrawingAreaImpl(DrawingAreaInfo::Identifier, WebPage*); + + // DrawingArea + virtual void setNeedsDisplay(const WebCore::IntRect&); + virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); + virtual void attachCompositingContext(); + virtual void detachCompositingContext(); + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*); + virtual void scheduleCompositingLayerSync(); + virtual void syncCompositingLayers(); + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + // CoreIPC message handlers. + virtual void setSize(const WebCore::IntSize&); + virtual void didUpdate(); + + void scheduleDisplay(); + void display(); + void display(UpdateInfo&); + + Region m_dirtyRegion; + WebCore::IntRect m_scrollRect; + WebCore::IntSize m_scrollDelta; + + // 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; + + RunLoop::Timer<DrawingAreaImpl> m_displayTimer; +}; + +} // namespace WebKit + +#endif // DrawingAreaImpl_h diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp new file mode 100644 index 0000000..00edcce --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.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 "EncoderAdapter.h" + +#include "DataReference.h" +#include "WebCoreArgumentCoders.h" + +namespace WebKit { + +EncoderAdapter::EncoderAdapter() + : m_encoder(CoreIPC::ArgumentEncoder::create(0)) +{ +} + +CoreIPC::DataReference EncoderAdapter::data() const +{ + return CoreIPC::DataReference(m_encoder->buffer(), m_encoder->bufferSize()); +} + +void EncoderAdapter::encodeBytes(const uint8_t* bytes, size_t size) +{ + m_encoder->encodeBytes(bytes, size); +} + +void EncoderAdapter::encodeBool(bool value) +{ + m_encoder->encodeBool(value); +} + +void EncoderAdapter::encodeUInt32(uint32_t value) +{ + m_encoder->encodeUInt32(value); +} + +void EncoderAdapter::encodeUInt64(uint64_t value) +{ + m_encoder->encodeUInt64(value); +} + +void EncoderAdapter::encodeInt32(int32_t value) +{ + m_encoder->encodeInt32(value); +} + +void EncoderAdapter::encodeInt64(int64_t value) +{ + m_encoder->encodeInt64(value); +} + +void EncoderAdapter::encodeFloat(float value) +{ + m_encoder->encodeFloat(value); +} + +void EncoderAdapter::encodeDouble(double value) +{ + m_encoder->encodeDouble(value); +} + +void EncoderAdapter::encodeString(const String& value) +{ + m_encoder->encode(value); +} + +} diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h new file mode 100644 index 0000000..ae88a98 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.h @@ -0,0 +1,62 @@ +/* + * 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 EncoderAdapter_h +#define EncoderAdapter_h + +#include <wtf/Encoder.h> +#include <wtf/Forward.h> +#include <wtf/OwnPtr.h> + +namespace CoreIPC { + class ArgumentEncoder; + class DataReference; +} + +namespace WebKit { + +class EncoderAdapter : public Encoder { +public: + EncoderAdapter(); + + CoreIPC::DataReference data() const; + +private: + virtual void encodeBytes(const uint8_t*, size_t); + virtual void encodeBool(bool); + virtual void encodeUInt32(uint32_t); + virtual void encodeUInt64(uint64_t); + virtual void encodeInt32(int32_t); + virtual void encodeInt64(int64_t); + virtual void encodeFloat(float); + virtual void encodeDouble(double); + virtual void encodeString(const String&); + + OwnPtr<CoreIPC::ArgumentEncoder> m_encoder; +}; + +} // namespace WebKit + +#endif // EncoderAdapter_h diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp new file mode 100644 index 0000000..9b8669d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "FindController.h" + +#include "ShareableBitmap.h" +#include "WKPage.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/DocumentMarkerController.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +static WebCore::FindOptions core(FindOptions options) +{ + return (options & FindOptionsCaseInsensitive ? CaseInsensitive : 0) + | (options & FindOptionsAtWordStarts ? AtWordStarts : 0) + | (options & FindOptionsTreatMedialCapitalAsWordStart ? TreatMedialCapitalAsWordStart : 0) + | (options & FindOptionsBackwards ? Backwards : 0) + | (options & FindOptionsWrapAround ? WrapAround : 0); +} + +FindController::FindController(WebPage* webPage) + : m_webPage(webPage) + , m_findPageOverlay(0) + , m_isShowingFindIndicator(false) +{ +} + +FindController::~FindController() +{ +} + +void FindController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) +{ + unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount); + m_webPage->corePage()->unmarkAllTextMatches(); + + m_webPage->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount)); +} + +static Frame* frameWithSelection(Page* page) +{ + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (frame->selection()->isRange()) + return frame; + } + + return 0; +} + +void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount) +{ + m_webPage->corePage()->unmarkAllTextMatches(); + + bool found = m_webPage->corePage()->findString(string, core(options)); + + Frame* selectedFrame = frameWithSelection(m_webPage->corePage()); + + bool shouldShowOverlay = false; + + if (!found) { + // Clear the selection. + if (selectedFrame) + selectedFrame->selection()->clear(); + + hideFindIndicator(); + + m_webPage->send(Messages::WebPageProxy::DidFailToFindString(string)); + } else { + shouldShowOverlay = options & FindOptionsShowOverlay; + + if (shouldShowOverlay) { + unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount + 1); + + // Check if we have more matches than allowed. + if (matchCount > maxMatchCount) { + shouldShowOverlay = false; + matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); + } + + m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount)); + } + + if (!(options & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) { + // Either we shouldn't show the find indicator, or we couldn't update it. + hideFindIndicator(); + } + } + + if (!shouldShowOverlay) { + if (m_findPageOverlay) { + // Get rid of the overlay. + m_webPage->uninstallPageOverlay(m_findPageOverlay); + } + + ASSERT(!m_findPageOverlay); + return; + } + + if (!m_findPageOverlay) { + RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this); + m_findPageOverlay = findPageOverlay.get(); + m_webPage->installPageOverlay(findPageOverlay.release()); + } else { + // The page overlay needs to be repainted. + m_findPageOverlay->setNeedsDisplay(); + } +} + +void FindController::hideFindUI() +{ + if (m_findPageOverlay) + m_webPage->uninstallPageOverlay(m_findPageOverlay); + + hideFindIndicator(); +} + +bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay) +{ + if (!selectedFrame) + return false; + + // We want the selection rect in window coordinates. + IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection()->bounds())); + + 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()); + OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext(); + + graphicsContext->translate(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y()); + selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers); + selectedFrame->document()->updateLayout(); + + graphicsContext->clip(selectionRectInWindowCoordinates); + selectedFrame->view()->paint(graphicsContext.get(), selectionRectInWindowCoordinates); + selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal); + + SharedMemory::Handle handle; + if (!findIndicatorTextBackingStore->createHandle(handle)) + return false; + + // We want the text rects in selection rect coordinates. + Vector<FloatRect> textRectsInSelectionRectCoordinates; + + for (size_t i = 0; i < textRects.size(); ++i) { + IntRect textRectInSelectionRectCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(textRects[i])); + textRectInSelectionRectCoordinates.move(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y()); + + textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates); + } + + m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle, !isShowingOverlay)); + m_isShowingFindIndicator = true; + + return true; +} + +void FindController::hideFindIndicator() +{ + if (!m_isShowingFindIndicator) + return; + + SharedMemory::Handle handle; + m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle, false)); + m_isShowingFindIndicator = false; +} + +Vector<IntRect> FindController::rectsForTextMatches() +{ + Vector<IntRect> rects; + + for (Frame* frame = m_webPage->corePage()->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + Document* document = frame->document(); + if (!document) + continue; + + IntRect visibleRect = frame->view()->visibleContentRect(); + Vector<IntRect> frameRects = document->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch); + IntPoint frameOffset(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); + frameOffset = frame->view()->convertToContainingWindow(frameOffset); + + for (Vector<IntRect>::iterator it = frameRects.begin(), end = frameRects.end(); it != end; ++it) { + it->intersect(visibleRect); + it->move(frameOffset.x(), frameOffset.y()); + rects.append(*it); + } + } + + return rects; +} + +void FindController::pageOverlayDestroyed(PageOverlay*) +{ +} + +void FindController::willMoveToWebPage(PageOverlay*, WebPage* webPage) +{ + if (webPage) + return; + + // The page overlay is moving away from the web page, reset it. + ASSERT(m_findPageOverlay); + m_findPageOverlay = 0; +} + +void FindController::didMoveToWebPage(PageOverlay*, WebPage*) +{ +} + +static const float shadowOffsetX = 0.0; +static const float shadowOffsetY = 1.0; +static const float shadowBlurRadius = 2.0; +static const float whiteFrameThickness = 1.0; + +static const int overlayBackgroundRed = 25; +static const int overlayBackgroundGreen = 25; +static const int overlayBackgroundBlue = 25; +static const int overlayBackgroundAlpha = 63; + +static Color overlayBackgroundColor() +{ + return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha); +} + +void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect) +{ + Vector<IntRect> rects = rectsForTextMatches(); + ASSERT(!rects.isEmpty()); + + // Draw the background. + graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB); + + graphicsContext.save(); + graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, Color::black, ColorSpaceSRGB); + + graphicsContext.setFillColor(Color::white, ColorSpaceSRGB); + + // Draw white frames around the holes. + for (size_t i = 0; i < rects.size(); ++i) { + IntRect whiteFrameRect = rects[i]; + whiteFrameRect.inflate(1); + + graphicsContext.fillRect(whiteFrameRect); + } + + graphicsContext.restore(); + + graphicsContext.setFillColor(Color::transparent, ColorSpaceSRGB); + + // Clear out the holes. + for (size_t i = 0; i < rects.size(); ++i) + graphicsContext.fillRect(rects[i]); +} + +bool FindController::mouseEvent(PageOverlay* pageOverlay, const WebMouseEvent& mouseEvent) +{ + // If we get a mouse down event inside the page overlay we should hide the find UI. + if (mouseEvent.type() == WebEvent::MouseDown) { + // Dismiss the overlay. + hideFindUI(); + } + + return false; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.h b/Source/WebKit2/WebProcess/WebPage/FindController.h new file mode 100644 index 0000000..110a7a4 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/FindController.h @@ -0,0 +1,79 @@ +/* + * 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 FindController_h +#define FindController_h + +#include "PageOverlay.h" +#include "WebFindOptions.h" +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/Vector.h> + +namespace WebCore { + class Frame; + class IntRect; +} + +namespace WebKit { + +class WebPage; + +class FindController : private PageOverlay::Client { + WTF_MAKE_NONCOPYABLE(FindController); + +public: + explicit FindController(WebPage*); + virtual ~FindController(); + + void findString(const String&, FindOptions, unsigned maxMatchCount); + void hideFindUI(); + void countStringMatches(const String&, FindOptions, unsigned maxMatchCount); + + void hideFindIndicator(); + +private: + // PageOverlay::Client. + virtual void pageOverlayDestroyed(PageOverlay*); + virtual void willMoveToWebPage(PageOverlay*, WebPage*); + virtual void didMoveToWebPage(PageOverlay*, WebPage*); + virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&); + virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); + + Vector<WebCore::IntRect> rectsForTextMatches(); + bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay); + +private: + WebPage* m_webPage; + PageOverlay* m_findPageOverlay; + + // Whether the UI process is showing the find indicator. Note that this can be true even if + // the find indicator isn't showing, but it will never be false when it is showing. + bool m_isShowingFindIndicator; +}; + +} // namespace WebKit + +#endif // FindController_h diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp new file mode 100644 index 0000000..8a81cca --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp @@ -0,0 +1,230 @@ +/* + * 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. + */ + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerBackedDrawingArea.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebProcess.h" +#include <WebCore/GraphicsLayer.h> + +using namespace WebCore; + +namespace WebKit { + +LayerBackedDrawingArea::LayerBackedDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage) + : DrawingArea(DrawingAreaInfo::LayerBacked, identifier, webPage) + , m_syncTimer(WebProcess::shared().runLoop(), this, &LayerBackedDrawingArea::syncCompositingLayers) + , m_attached(false) + , m_shouldPaint(true) +{ + m_backingLayer = GraphicsLayer::create(this); + m_backingLayer->setDrawsContent(true); + m_backingLayer->setContentsOpaque(webPage->drawsBackground() && !webPage->drawsTransparentBackground()); + +#ifndef NDEBUG + m_backingLayer->setName("DrawingArea backing layer"); +#endif + m_backingLayer->setSize(webPage->size()); + platformInit(); +} + +LayerBackedDrawingArea::~LayerBackedDrawingArea() +{ + platformClear(); +} + +void LayerBackedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) +{ + // FIXME: Do something much smarter. + setNeedsDisplay(scrollRect); +} + +void LayerBackedDrawingArea::setNeedsDisplay(const IntRect& rect) +{ + m_backingLayer->setNeedsDisplayInRect(rect); + scheduleCompositingLayerSync(); +} + +void LayerBackedDrawingArea::display() +{ + // Laying out the page can cause the drawing area to change so we keep an extra reference. + RefPtr<LayerBackedDrawingArea> protect(this); + + // Layout if necessary. + m_webPage->layoutIfNeeded(); + + if (m_webPage->drawingArea() != this) + return; +} + +void LayerBackedDrawingArea::pageBackgroundTransparencyChanged() +{ + m_backingLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground()); +} + +void LayerBackedDrawingArea::scheduleDisplay() +{ +} + +void LayerBackedDrawingArea::setSize(const IntSize& viewSize) +{ + ASSERT(m_shouldPaint); + ASSERT_ARG(viewSize, !viewSize.isEmpty()); + + m_backingLayer->setSize(viewSize); + scheduleCompositingLayerSync(); + + // Laying out the page can cause the drawing area to change so we keep an extra reference. + RefPtr<LayerBackedDrawingArea> protect(this); + + m_webPage->setSize(viewSize); + m_webPage->layoutIfNeeded(); + + if (m_webPage->drawingArea() != this) + return; + + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); +} + +void LayerBackedDrawingArea::suspendPainting() +{ + ASSERT(m_shouldPaint); + + m_shouldPaint = false; +} + +void LayerBackedDrawingArea::resumePainting() +{ + ASSERT(!m_shouldPaint); + + m_shouldPaint = true; + + // Display if needed. + display(); +} + +void LayerBackedDrawingArea::didUpdate() +{ + // Display if needed. + display(); +} + +void LayerBackedDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + DrawingAreaInfo::Identifier targetIdentifier; + if (!arguments->decode(CoreIPC::Out(targetIdentifier))) + return; + + // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it. + if (targetIdentifier != info().identifier) + return; + + switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) { + case DrawingAreaLegacyMessage::SetSize: { + IntSize size; + if (!arguments->decode(CoreIPC::Out(size))) + return; + + setSize(size); + break; + } + + case DrawingAreaLegacyMessage::SuspendPainting: + suspendPainting(); + break; + + case DrawingAreaLegacyMessage::ResumePainting: + resumePainting(); + break; + + case DrawingAreaLegacyMessage::DidUpdate: + didUpdate(); + break; + + default: + ASSERT_NOT_REACHED(); + break; + } +} + +// GraphicsLayerClient methods +void LayerBackedDrawingArea::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& inClip) +{ + m_webPage->drawRect(graphicsContext, inClip); +} + +bool LayerBackedDrawingArea::showDebugBorders() const +{ + // FIXME: get from settings; + return false; +} + +bool LayerBackedDrawingArea::showRepaintCounter() const +{ + // FIXME: get from settings; + return false; +} + +#if !PLATFORM(MAC) && !PLATFORM(WIN) +void LayerBackedDrawingArea::attachCompositingContext(GraphicsLayer*) +{ +} + +void LayerBackedDrawingArea::detachCompositingContext() +{ +} + +#if !PLATFORM(MAC) +void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer*) +{ +} +#endif + +void LayerBackedDrawingArea::scheduleCompositingLayerSync() +{ +} + +void LayerBackedDrawingArea::syncCompositingLayers() +{ +} + +void LayerBackedDrawingArea::platformInit() +{ +} + +void LayerBackedDrawingArea::platformClear() +{ +} +#endif + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h new file mode 100644 index 0000000..1b49de2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayerBackedDrawingArea_h +#define LayerBackedDrawingArea_h + +#if USE(ACCELERATED_COMPOSITING) + +#include "DrawingArea.h" +#include "RunLoop.h" +#include <WebCore/IntPoint.h> +#include <WebCore/GraphicsLayerClient.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class CALayer; +#else +class CALayer; +#endif +typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef; +#endif + +namespace WebCore { + class GraphicsContext; + class GraphicsLayer; +} + +namespace WebKit { + +class LayerBackedDrawingArea : public DrawingArea, private WebCore::GraphicsLayerClient { +public: + LayerBackedDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage*); + virtual ~LayerBackedDrawingArea(); + + virtual void setNeedsDisplay(const WebCore::IntRect&); + virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); + virtual void display(); + + virtual void pageBackgroundTransparencyChanged(); + + virtual void attachCompositingContext(); + virtual void detachCompositingContext(); + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*); + virtual void scheduleCompositingLayerSync(); + virtual void syncCompositingLayers(); + + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double /*time*/) { } + virtual void notifySyncRequired(const WebCore::GraphicsLayer*) { } +public: + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); +private: + virtual bool showDebugBorders() const; + virtual bool showRepaintCounter() const; + +#if PLATFORM(MAC) + virtual void onPageClose(); +#endif + + void scheduleDisplay(); + + // CoreIPC message handlers. + void setSize(const WebCore::IntSize& viewSize); + void suspendPainting(); + void resumePainting(); + void didUpdate(); + + void platformInit(); + void platformClear(); + +#if PLATFORM(MAC) + void setUpUpdateLayoutRunLoopObserver(); + void scheduleUpdateLayoutRunLoopObserver(); + void removeUpdateLayoutRunLoopObserver(); + + static void updateLayoutRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*); + void updateLayoutRunLoopObserverFired(); +#endif + + RunLoop::Timer<LayerBackedDrawingArea> m_syncTimer; + + OwnPtr<WebCore::GraphicsLayer> m_backingLayer; +#if PLATFORM(MAC) +#if HAVE(HOSTED_CORE_ANIMATION) + RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerRef; +#endif + RetainPtr<CFRunLoopObserverRef> m_updateLayoutRunLoopObserver; +#endif + + bool m_attached; + bool m_shouldPaint; +}; + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // LayerBackedDrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp new file mode 100644 index 0000000..091f460 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PageOverlay.h" + +#include "WebPage.h" +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> +#include <WebCore/GraphicsContext.h> +#include <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<PageOverlay> PageOverlay::create(Client* client) +{ + return adoptRef(new PageOverlay(client)); +} + +PageOverlay::PageOverlay(Client* client) + : m_client(client) + , m_webPage(0) +{ +} + +PageOverlay::~PageOverlay() +{ +} + +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(); + + return IntRect(0, 0, width, height); +} + +void PageOverlay::setPage(WebPage* webPage) +{ + m_client->willMoveToWebPage(this, webPage); + m_webPage = webPage; + m_client->didMoveToWebPage(this, webPage); +} + +void PageOverlay::setNeedsDisplay(const WebCore::IntRect& dirtyRect) +{ + if (m_webPage) + m_webPage->drawingArea()->setNeedsDisplay(dirtyRect); +} + +void PageOverlay::setNeedsDisplay() +{ + setNeedsDisplay(bounds()); +} + +void PageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect) +{ + // If the dirty rect is outside the bounds, ignore it. + IntRect paintRect = intersection(dirtyRect, bounds()); + if (paintRect.isEmpty()) + return; + + graphicsContext.save(); + graphicsContext.beginTransparencyLayer(1); + graphicsContext.setCompositeOperation(CompositeCopy); + + m_client->drawRect(this, graphicsContext, paintRect); + + graphicsContext.endTransparencyLayer(); + graphicsContext.restore(); +} + +bool PageOverlay::mouseEvent(const WebMouseEvent& mouseEvent) +{ + // Ignore events outside the bounds. + if (!bounds().contains(mouseEvent.position())) + return false; + + return m_client->mouseEvent(this, mouseEvent); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.h b/Source/WebKit2/WebProcess/WebPage/PageOverlay.h new file mode 100644 index 0000000..6f1f70f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.h @@ -0,0 +1,86 @@ +/* + * 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 PageOverlay_h +#define PageOverlay_h + +#include "APIObject.h" +#include <wtf/PassRefPtr.h> + +namespace WebCore { + class GraphicsContext; + class IntRect; +} + +namespace WebKit { + +class WebMouseEvent; +class WebPage; + +class PageOverlay : public APIObject { +public: + class Client { + protected: + virtual ~Client() { } + + public: + virtual void pageOverlayDestroyed(PageOverlay*) = 0; + virtual void willMoveToWebPage(PageOverlay*, WebPage*) = 0; + virtual void didMoveToWebPage(PageOverlay*, WebPage*) = 0; + virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0; + virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&) = 0; + }; + + static const Type APIType = TypeBundlePageOverlay; + + static PassRefPtr<PageOverlay> create(Client*); + virtual ~PageOverlay(); + + void setPage(WebPage*); + void setNeedsDisplay(const WebCore::IntRect& dirtyRect); + void setNeedsDisplay(); + + void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); + bool mouseEvent(const WebMouseEvent&); + +protected: + explicit PageOverlay(Client*); + + WebPage* webPage() const { return m_webPage; } + +private: + // APIObject + virtual Type type() const { return APIType; } + + WebCore::IntRect bounds() const; + + Client* m_client; + + WebPage* m_webPage; +}; + +} // namespace WebKit + +#endif // PageOverlay_h diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp new file mode 100644 index 0000000..74aa4b2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp @@ -0,0 +1,235 @@ +/* + * 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. + */ + +#if ENABLE(TILED_BACKING_STORE) + +#include "TiledDrawingArea.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "MessageID.h" +#include "UpdateChunk.h" +#include "WebCore/Frame.h" +#include "WebCore/FrameView.h" +#include "WebCoreArgumentCoders.h" +#include "WebFrame.h" +#include "WebPage.h" +#include "WebProcess.h" + +using namespace WebCore; + +namespace WebKit { + +TiledDrawingArea::TiledDrawingArea(DrawingAreaInfo::Identifier identifier, WebPage* webPage) + : DrawingArea(DrawingAreaInfo::Tiled, identifier, webPage) + , m_isWaitingForUpdate(false) + , m_shouldPaint(true) + , m_displayTimer(WebProcess::shared().runLoop(), this, &TiledDrawingArea::display) + , m_tileUpdateTimer(WebProcess::shared().runLoop(), this, &TiledDrawingArea::tileUpdateTimerFired) +{ +} + +TiledDrawingArea::~TiledDrawingArea() +{ +} + +void TiledDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) +{ + // FIXME: Do something much smarter. + setNeedsDisplay(scrollRect); +} + +void TiledDrawingArea::setNeedsDisplay(const IntRect& rect) +{ + // FIXME: Collect a set of rects/region instead of just the union of all rects. + m_dirtyRect.unite(rect); + scheduleDisplay(); +} + +void TiledDrawingArea::display() +{ + if (!m_shouldPaint) + return; + + if (m_dirtyRect.isEmpty()) + return; + + m_webPage->layoutIfNeeded(); + + IntRect dirtyRect = m_dirtyRect; + m_dirtyRect = IntRect(); + + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::Invalidate, m_webPage->pageID(), CoreIPC::In(dirtyRect)); + + m_displayTimer.stop(); +} + +void TiledDrawingArea::scheduleDisplay() +{ + if (!m_shouldPaint) + return; + + if (m_displayTimer.isActive()) + return; + + m_displayTimer.startOneShot(0); +} + +void TiledDrawingArea::setSize(const IntSize& viewSize) +{ + ASSERT(m_shouldPaint); + ASSERT_ARG(viewSize, !viewSize.isEmpty()); + + m_webPage->setSize(viewSize); + + scheduleDisplay(); + + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(viewSize)); +} + +void TiledDrawingArea::suspendPainting() +{ + ASSERT(m_shouldPaint); + + m_shouldPaint = false; + m_displayTimer.stop(); +} + +void TiledDrawingArea::resumePainting() +{ + ASSERT(!m_shouldPaint); + + m_shouldPaint = true; + + // Display if needed. + display(); +} + +void TiledDrawingArea::didUpdate() +{ + // Display if needed. + display(); +} + +void TiledDrawingArea::updateTile(int tileID, const IntRect& dirtyRect, float scale) +{ + m_webPage->layoutIfNeeded(); + + UpdateChunk updateChunk(dirtyRect); + paintIntoUpdateChunk(&updateChunk, scale); + + unsigned pendingUpdateCount = m_pendingUpdates.size(); + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount)); +} + +void TiledDrawingArea::tileUpdateTimerFired() +{ + ASSERT(!m_pendingUpdates.isEmpty()); + + UpdateMap::iterator it = m_pendingUpdates.begin(); + TileUpdate update = it->second; + m_pendingUpdates.remove(it); + + updateTile(update.tileID, update.dirtyRect, update.scale); + + if (m_pendingUpdates.isEmpty()) + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); + else + m_tileUpdateTimer.startOneShot(0.001); +} + +void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) { + case DrawingAreaLegacyMessage::SetSize: { + IntSize size; + if (!arguments->decode(CoreIPC::Out(size))) + return; + + setSize(size); + break; + } + case DrawingAreaLegacyMessage::SuspendPainting: + suspendPainting(); + break; + case DrawingAreaLegacyMessage::ResumePainting: + resumePainting(); + break; + case DrawingAreaLegacyMessage::CancelTileUpdate: { + int tileID; + if (!arguments->decode(CoreIPC::Out(tileID))) + return; + UpdateMap::iterator it = m_pendingUpdates.find(tileID); + if (it != m_pendingUpdates.end()) { + m_pendingUpdates.remove(it); + if (m_pendingUpdates.isEmpty()) { + WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); + m_tileUpdateTimer.stop(); + } + } + break; + } + case DrawingAreaLegacyMessage::RequestTileUpdate: { + TileUpdate update; + if (!arguments->decode(CoreIPC::Out(update.tileID, update.dirtyRect, update.scale))) + return; + UpdateMap::iterator it = m_pendingUpdates.find(update.tileID); + if (it != m_pendingUpdates.end()) + it->second.dirtyRect.unite(update.dirtyRect); + else { + m_pendingUpdates.add(update.tileID, update); + if (!m_tileUpdateTimer.isActive()) + m_tileUpdateTimer.startOneShot(0); + } + break; + } + case DrawingAreaLegacyMessage::TakeSnapshot: { + IntSize targetSize; + IntRect contentsRect; + + if (!arguments->decode(CoreIPC::Out(targetSize, contentsRect))) + return; + + m_webPage->layoutIfNeeded(); + + contentsRect.intersect(IntRect(IntPoint::zero(), m_webPage->mainFrame()->coreFrame()->view()->contentsSize())); + + float targetScale = float(targetSize.width()) / contentsRect.width(); + + 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)); + break; + } + default: + ASSERT_NOT_REACHED(); + break; + } +} + +} // namespace WebKit + +#endif // TILED_BACKING_STORE diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h new file mode 100644 index 0000000..7b682ca --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h @@ -0,0 +1,94 @@ +/* + * 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. + */ + +#ifndef TiledDrawingArea_h +#define TiledDrawingArea_h + +#if ENABLE(TILED_BACKING_STORE) + +#include "DrawingArea.h" +#include "RunLoop.h" +#include <WebCore/IntPoint.h> +#include <WebCore/IntRect.h> +#include <wtf/Vector.h> + +namespace WebKit { + +class UpdateChunk; + +class TiledDrawingArea : public DrawingArea { +public: + TiledDrawingArea(DrawingAreaInfo::Identifier, WebPage*); + virtual ~TiledDrawingArea(); + + virtual void setNeedsDisplay(const WebCore::IntRect&); + virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); + virtual void display(); + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachCompositingContext() { } + virtual void detachCompositingContext() { } + virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) { } + virtual void scheduleCompositingLayerSync() { } + virtual void syncCompositingLayers() { } +#endif + + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + void scheduleDisplay(); + + // CoreIPC message handlers. + void setSize(const WebCore::IntSize& viewSize); + void suspendPainting(); + void resumePainting(); + void didUpdate(); + void updateTile(int tileID, const WebCore::IntRect& dirtyRect, float scale); + + // Platform overrides + void paintIntoUpdateChunk(UpdateChunk*, float scale); + + void tileUpdateTimerFired(); + + WebCore::IntRect m_dirtyRect; + bool m_isWaitingForUpdate; + bool m_shouldPaint; + RunLoop::Timer<TiledDrawingArea> m_displayTimer; + + struct TileUpdate { + int tileID; + WebCore::IntRect dirtyRect; + float scale; + }; + typedef HashMap<int, TileUpdate> UpdateMap; + UpdateMap m_pendingUpdates; + RunLoop::Timer<TiledDrawingArea> m_tileUpdateTimer; +}; + +} // namespace WebKit + +#endif // TILED_BACKING_STORE + +#endif // TiledDrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp new file mode 100644 index 0000000..21f4fba --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp @@ -0,0 +1,224 @@ +/* + * 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 + * 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 "WebBackForwardListProxy.h" + +#include "DataReference.h" +#include "EncoderAdapter.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include "WebProcessProxyMessages.h" +#include <WebCore/HistoryItem.h> +#include <wtf/HashMap.h> + +using namespace WebCore; + +namespace WebKit { + +static const unsigned DefaultCapacity = 100; +static const unsigned NoCurrentItemIndex = UINT_MAX; + +// FIXME <rdar://problem/8819268>: This leaks all HistoryItems that go into these maps. +// We need to clear up the life time of these objects. + +typedef HashMap<uint64_t, RefPtr<HistoryItem> > IDToHistoryItemMap; +typedef HashMap<RefPtr<HistoryItem>, uint64_t> HistoryItemToIDMap; + +static IDToHistoryItemMap& idToHistoryItemMap() +{ + static IDToHistoryItemMap map; + return map; +} + +static HistoryItemToIDMap& historyItemToIDMap() +{ + static HistoryItemToIDMap map; + return map; +} + +static uint64_t uniqueHistoryItemID = 1; + +static uint64_t generateHistoryItemID() +{ + // These IDs exist in the WebProcess for items created by the WebProcess. + // The IDs generated here need to never collide with the IDs created in WebBackForwardList in the UIProcess. + // We accomplish this by starting from 3, and only ever using odd ids. + uniqueHistoryItemID += 2; + return uniqueHistoryItemID; +} + +void WebBackForwardListProxy::setHighestItemIDFromUIProcess(uint64_t itemID) +{ + if (itemID <= uniqueHistoryItemID) + return; + + if (itemID % 2) + uniqueHistoryItemID = itemID; + else + uniqueHistoryItemID = itemID + 1; +} + +static void updateBackForwardItem(uint64_t itemID, HistoryItem* item) +{ + EncoderAdapter encoder; + item->encodeBackForwardTree(encoder); + + WebProcess::shared().connection()->send(Messages::WebProcessProxy::AddBackForwardItem(itemID, + item->originalURLString(), item->urlString(), item->title(), encoder.data()), 0); +} + +void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem> prpItem) +{ + RefPtr<HistoryItem> item = prpItem; + + // This item/itemID pair should not already exist in our maps. + ASSERT(!historyItemToIDMap().contains(item.get())); + ASSERT(!idToHistoryItemMap().contains(itemID)); + + historyItemToIDMap().set(item, itemID); + idToHistoryItemMap().set(itemID, item); +} + +static void WK2NotifyHistoryItemChanged(HistoryItem* item) +{ + uint64_t itemID = historyItemToIDMap().get(item); + if (!itemID) + return; + + updateBackForwardItem(itemID, item); +} + +HistoryItem* WebBackForwardListProxy::itemForID(uint64_t itemID) +{ + return idToHistoryItemMap().get(itemID).get(); +} + +void WebBackForwardListProxy::removeItem(uint64_t itemID) +{ + IDToHistoryItemMap::iterator it = idToHistoryItemMap().find(itemID); + if (it == idToHistoryItemMap().end()) + return; + historyItemToIDMap().remove(it->second); + idToHistoryItemMap().remove(it); +} + +WebBackForwardListProxy::WebBackForwardListProxy(WebPage* page) + : m_page(page) +{ + WebCore::notifyHistoryItemChanged = WK2NotifyHistoryItemChanged; +} + +void WebBackForwardListProxy::addItem(PassRefPtr<HistoryItem> prpItem) +{ + RefPtr<HistoryItem> item = prpItem; + + ASSERT(!historyItemToIDMap().contains(item)); + + if (!m_page) + return; + + uint64_t itemID = generateHistoryItemID(); + + ASSERT(!idToHistoryItemMap().contains(itemID)); + + historyItemToIDMap().set(item, itemID); + idToHistoryItemMap().set(itemID, item); + + updateBackForwardItem(itemID, item.get()); + m_page->send(Messages::WebPageProxy::BackForwardAddItem(itemID)); +} + +void WebBackForwardListProxy::goToItem(HistoryItem* item) +{ + if (!m_page) + return; + + m_page->send(Messages::WebPageProxy::BackForwardGoToItem(historyItemToIDMap().get(item))); +} + +HistoryItem* WebBackForwardListProxy::itemAtIndex(int itemIndex) +{ + if (!m_page) + return 0; + + uint64_t itemID = 0; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::BackForwardItemAtIndex(itemIndex), Messages::WebPageProxy::BackForwardItemAtIndex::Reply(itemID), m_page->pageID())) + return 0; + + if (!itemID) + return 0; + + return idToHistoryItemMap().get(itemID).get(); +} + +int WebBackForwardListProxy::backListCount() +{ + if (!m_page) + return 0; + + int backListCount = 0; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::BackForwardBackListCount(), Messages::WebPageProxy::BackForwardBackListCount::Reply(backListCount), m_page->pageID())) + return 0; + + return backListCount; +} + +int WebBackForwardListProxy::forwardListCount() +{ + if (!m_page) + return 0; + + int forwardListCount = 0; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::BackForwardForwardListCount(), Messages::WebPageProxy::BackForwardForwardListCount::Reply(forwardListCount), m_page->pageID())) + return 0; + + return forwardListCount; +} + +void WebBackForwardListProxy::close() +{ + m_page = 0; +} + +bool WebBackForwardListProxy::isActive() +{ + // FIXME: Should check the the list is enabled and has non-zero capacity. + return true; +} + +void WebBackForwardListProxy::clear() +{ + m_page->send(Messages::WebPageProxy::BackForwardClear()); +} + +#if ENABLE(WML) +void WebBackForwardListProxy::clearWMLPageHistory() +{ +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h new file mode 100644 index 0000000..be28739 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h @@ -0,0 +1,72 @@ +/* + * 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 + * 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 WebBackForwardListProxy_h +#define WebBackForwardListProxy_h + +#include <WebCore/BackForwardList.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebPage; + +class WebBackForwardListProxy : public WebCore::BackForwardList { +public: + static PassRefPtr<WebBackForwardListProxy> create(WebPage* page) { return adoptRef(new WebBackForwardListProxy(page)); } + + static WebCore::HistoryItem* itemForID(uint64_t); + static void removeItem(uint64_t itemID); + + static void addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem>); + static void setHighestItemIDFromUIProcess(uint64_t itemID); + + void clear(); + +private: + WebBackForwardListProxy(WebPage*); + + virtual void addItem(PassRefPtr<WebCore::HistoryItem>); + + virtual void goToItem(WebCore::HistoryItem*); + + virtual WebCore::HistoryItem* itemAtIndex(int); + virtual int backListCount(); + virtual int forwardListCount(); + + virtual bool isActive(); + + virtual void close(); + +#if ENABLE(WML) + void clearWMLPageHistory(); +#endif + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebBackForwardListProxy_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp new file mode 100644 index 0000000..b496128 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "WebContextMenu.h" + +#include "ContextMenuState.h" +#include "InjectedBundleHitTestResult.h" +#include "InjectedBundleUserMessageCoders.h" +#include "WebCoreArgumentCoders.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <WebCore/ContextMenu.h> +#include <WebCore/ContextMenuController.h> +#include <WebCore/FrameView.h> +#include <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +WebContextMenu::WebContextMenu(WebPage* page) + : m_page(page) +{ +} + +WebContextMenu::~WebContextMenu() +{ +} + +void WebContextMenu::show() +{ + ContextMenuController* controller = m_page->corePage()->contextMenuController(); + if (!controller) + return; + ContextMenu* menu = controller->contextMenu(); + if (!menu) + return; + Node* node = controller->hitTestResult().innerNonSharedNode(); + if (!node) + return; + Frame* frame = node->document()->frame(); + if (!frame) + return; + FrameView* view = frame->view(); + if (!view) + return; + + // Give the bundle client a chance to process the menu. +#if USE(CROSS_PLATFORM_CONTEXT_MENUS) + const Vector<ContextMenuItem>& coreItems = menu->items(); +#else + Vector<ContextMenuItem> coreItems = contextMenuItemVector(menu->platformDescription()); +#endif + Vector<WebContextMenuItemData> proposedMenu = kitItems(coreItems, menu); + Vector<WebContextMenuItemData> newMenu; + RefPtr<APIObject> userData; + RefPtr<InjectedBundleHitTestResult> hitTestResult = InjectedBundleHitTestResult::create(controller->hitTestResult()); + if (m_page->injectedBundleContextMenuClient().getCustomMenuFromDefaultItems(m_page, hitTestResult.get(), proposedMenu, newMenu, userData)) + proposedMenu = newMenu; + + ContextMenuState contextMenuState; + contextMenuState.absoluteImageURLString = controller->hitTestResult().absoluteImageURL().string(); + contextMenuState.absoluteLinkURLString = controller->hitTestResult().absoluteLinkURL().string(); + + // Notify the UIProcess. + m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().point()), contextMenuState, proposedMenu, InjectedBundleUserMessageEncoder(userData.get()))); +} + +void WebContextMenu::itemSelected(const WebContextMenuItemData& item) +{ + ContextMenuItem coreItem(ActionType, static_cast<ContextMenuAction>(item.action()), item.title()); + m_page->corePage()->contextMenuController()->contextMenuItemSelected(&coreItem); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h new file mode 100644 index 0000000..3d9291a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebContextMenu.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WebContextMenu_h +#define WebContextMenu_h + +#include "WebContextMenuItemData.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebPage; + +class WebContextMenu : public RefCounted<WebContextMenu> { +public: + static PassRefPtr<WebContextMenu> create(WebPage* page) + { + return adoptRef(new WebContextMenu(page)); + } + + ~WebContextMenu(); + + void show(); + void itemSelected(const WebContextMenuItemData&); + +private: + WebContextMenu(WebPage*); + + WebPage* m_page; +}; + +} // namespace WebKit + +#endif // WebPopupMenu_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp new file mode 100644 index 0000000..198cb6d --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebEditCommand.h" + +namespace WebKit { + +static uint64_t generateCommandID() +{ + static uint64_t uniqueCommandID = 1; + return uniqueCommandID++; +} + +PassRefPtr<WebEditCommand> WebEditCommand::create(PassRefPtr<WebCore::EditCommand> command) +{ + return adoptRef(new WebEditCommand(command, generateCommandID())); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebEditCommand.h b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.h new file mode 100644 index 0000000..b6844a2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebEditCommand.h @@ -0,0 +1,55 @@ +/* + * 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 WebEditCommand_h +#define WebEditCommand_h + +#include <WebCore/EditCommand.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class WebEditCommand : public RefCounted<WebEditCommand> { +public: + static PassRefPtr<WebEditCommand> create(PassRefPtr<WebCore::EditCommand>); + + WebCore::EditCommand* command() const { return m_command.get(); } + uint64_t commandID() const { return m_commandID; } + +private: + WebEditCommand(PassRefPtr<WebCore::EditCommand> command, uint64_t commandID) + : m_command(command) + , m_commandID(commandID) + { + } + + RefPtr<WebCore::EditCommand> m_command; + uint64_t m_commandID; +}; + +} // namespace WebKit + +#endif // WebEditCommand_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp new file mode 100644 index 0000000..c5f117e --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp @@ -0,0 +1,517 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebFrame.h" + +#include "DownloadManager.h" +#include "InjectedBundleNodeHandle.h" +#include "InjectedBundleRangeHandle.h" +#include "InjectedBundleScriptWorld.h" +#include "WebChromeClient.h" +#include "WebPage.h" +#include "WebPageProxyMessages.h" +#include "WebProcess.h" +#include <JavaScriptCore/APICast.h> +#include <JavaScriptCore/JSLock.h> +#include <JavaScriptCore/JSValueRef.h> +#include <WebCore/AnimationController.h> +#include <WebCore/CSSComputedStyleDeclaration.h> +#include <WebCore/Chrome.h> +#include <WebCore/DocumentLoader.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> +#include <WebCore/HTMLFrameOwnerElement.h> +#include <WebCore/JSCSSStyleDeclaration.h> +#include <WebCore/JSElement.h> +#include <WebCore/JSRange.h> +#include <WebCore/Page.h> +#include <WebCore/RenderTreeAsText.h> +#include <WebCore/TextIterator.h> +#include <WebCore/TextResourceDecoder.h> +#include <wtf/text/StringBuilder.h> + +#ifndef NDEBUG +#include <wtf/RefCountedLeakCounter.h> +#endif + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +#ifndef NDEBUG +static WTF::RefCountedLeakCounter webFrameCounter("WebFrame"); +#endif + +static uint64_t generateFrameID() +{ + static uint64_t uniqueFrameID = 1; + return uniqueFrameID++; +} + +static uint64_t generateListenerID() +{ + static uint64_t uniqueListenerID = 1; + return uniqueListenerID++; +} + +PassRefPtr<WebFrame> WebFrame::createMainFrame(WebPage* page) +{ + RefPtr<WebFrame> frame = create(); + + page->send(Messages::WebPageProxy::DidCreateMainFrame(frame->frameID())); + + frame->init(page, String(), 0); + + return frame.release(); +} + +PassRefPtr<WebFrame> WebFrame::createSubframe(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement) +{ + RefPtr<WebFrame> frame = create(); + + WebFrame* parentFrame = static_cast<WebFrameLoaderClient*>(ownerElement->document()->frame()->loader()->client())->webFrame(); + page->send(Messages::WebPageProxy::DidCreateSubframe(frame->frameID(), parentFrame->frameID())); + + frame->init(page, frameName, ownerElement); + + return frame.release(); +} + +PassRefPtr<WebFrame> WebFrame::create() +{ + RefPtr<WebFrame> frame = adoptRef(new WebFrame); + + // Add explict ref() that will be balanced in WebFrameLoaderClient::frameLoaderDestroyed(). + frame->ref(); + + return frame.release(); +} + +WebFrame::WebFrame() + : m_coreFrame(0) + , m_policyListenerID(0) + , m_policyFunction(0) + , m_policyDownloadID(0) + , m_frameLoaderClient(this) + , m_loadListener(0) + , m_frameID(generateFrameID()) +{ + WebProcess::shared().addWebFrame(m_frameID, this); + +#ifndef NDEBUG + webFrameCounter.increment(); +#endif +} + +WebFrame::~WebFrame() +{ + ASSERT(!m_coreFrame); + +#ifndef NDEBUG + webFrameCounter.decrement(); +#endif +} + +void WebFrame::init(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement) +{ + RefPtr<Frame> frame = Frame::create(page->corePage(), ownerElement, &m_frameLoaderClient); + m_coreFrame = frame.get(); + + frame->tree()->setName(frameName); + + if (ownerElement) { + ASSERT(ownerElement->document()->frame()); + ownerElement->document()->frame()->tree()->appendChild(frame); + } + + frame->init(); +} + +WebPage* WebFrame::page() const +{ + if (!m_coreFrame) + return 0; + + if (WebCore::Page* page = m_coreFrame->page()) + return static_cast<WebChromeClient*>(page->chrome()->client())->page(); + + return 0; +} + +void WebFrame::invalidate() +{ + WebProcess::shared().removeWebFrame(m_frameID); + m_coreFrame = 0; +} + +uint64_t WebFrame::setUpPolicyListener(WebCore::FramePolicyFunction policyFunction) +{ + // FIXME: <rdar://5634381> We need to support multiple active policy listeners. + + invalidatePolicyListener(); + + m_policyListenerID = generateListenerID(); + m_policyFunction = policyFunction; + return m_policyListenerID; +} + +void WebFrame::invalidatePolicyListener() +{ + if (!m_policyListenerID) + return; + + m_policyDownloadID = 0; + m_policyListenerID = 0; + m_policyFunction = 0; +} + +void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t downloadID) +{ + if (!m_coreFrame) + return; + + if (!m_policyListenerID) + return; + + if (listenerID != m_policyListenerID) + return; + + ASSERT(m_policyFunction); + + FramePolicyFunction function = m_policyFunction; + + invalidatePolicyListener(); + + m_policyDownloadID = downloadID; + + (m_coreFrame->loader()->policyChecker()->*function)(action); +} + +void WebFrame::startDownload(const WebCore::ResourceRequest& request) +{ + ASSERT(m_policyDownloadID); + + DownloadManager::shared().startDownload(m_policyDownloadID, page(), request); + + m_policyDownloadID = 0; +} + +void WebFrame::convertHandleToDownload(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest& initialRequest, const ResourceResponse& response) +{ + ASSERT(m_policyDownloadID); + + DownloadManager::shared().convertHandleToDownload(m_policyDownloadID, page(), handle, request, initialRequest, response); + m_policyDownloadID = 0; +} + +String WebFrame::source() const +{ + if (!m_coreFrame) + return String(); + Document* document = m_coreFrame->document(); + if (!document) + return String(); + TextResourceDecoder* decoder = document->decoder(); + if (!decoder) + return String(); + DocumentLoader* documentLoader = m_coreFrame->loader()->activeDocumentLoader(); + if (!documentLoader) + return String(); + RefPtr<SharedBuffer> mainResourceData = documentLoader->mainResourceData(); + if (!mainResourceData) + return String(); + return decoder->encoding().decode(mainResourceData->data(), mainResourceData->size()); +} + +String WebFrame::contentsAsString() const +{ + if (!m_coreFrame) + return String(); + + if (isFrameSet()) { + StringBuilder builder; + for (Frame* child = m_coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { + if (!builder.isEmpty()) + builder.append(' '); + builder.append(static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame()->contentsAsString()); + } + // FIXME: It may make sense to use toStringPreserveCapacity() here. + return builder.toString(); + } + + Document* document = m_coreFrame->document(); + if (!document) + return String(); + + RefPtr<Element> documentElement = document->documentElement(); + if (!documentElement) + return String(); + + RefPtr<Range> range = document->createRange(); + + ExceptionCode ec = 0; + range->selectNode(documentElement.get(), ec); + if (ec) + return String(); + + return plainText(range.get()); +} + +String WebFrame::selectionAsString() const +{ + if (!m_coreFrame) + return String(); + + return m_coreFrame->displayStringModifiedByEncoding(m_coreFrame->editor()->selectedText()); +} + +IntSize WebFrame::size() const +{ + if (!m_coreFrame) + return IntSize(); + + FrameView* frameView = m_coreFrame->view(); + if (!frameView) + return IntSize(); + + return frameView->contentsSize(); +} + +bool WebFrame::isFrameSet() const +{ + if (!m_coreFrame) + return false; + + Document* document = m_coreFrame->document(); + if (!document) + return false; + return document->isFrameSet(); +} + +bool WebFrame::isMainFrame() const +{ + if (WebPage* p = page()) + return p->mainFrame() == this; + + return false; +} + +String WebFrame::name() const +{ + if (!m_coreFrame) + return String(); + + return m_coreFrame->tree()->uniqueName(); +} + +String WebFrame::url() const +{ + if (!m_coreFrame) + return String(); + + return m_coreFrame->loader()->url().string(); +} + +String WebFrame::innerText() const +{ + if (!m_coreFrame) + return String(); + + if (!m_coreFrame->document()->documentElement()) + return String(); + + return m_coreFrame->document()->documentElement()->innerText(); +} + +PassRefPtr<ImmutableArray> WebFrame::childFrames() +{ + if (!m_coreFrame) + return ImmutableArray::create(); + + size_t size = m_coreFrame->tree()->childCount(); + if (!size) + return ImmutableArray::create(); + + Vector<RefPtr<APIObject> > vector; + vector.reserveInitialCapacity(size); + + for (Frame* child = m_coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame(); + vector.uncheckedAppend(webFrame); + } + + return ImmutableArray::adopt(vector); +} + +unsigned WebFrame::numberOfActiveAnimations() const +{ + if (!m_coreFrame) + return 0; + + AnimationController* controller = m_coreFrame->animation(); + if (!controller) + return 0; + + return controller->numberOfActiveAnimations(); +} + +bool WebFrame::pauseAnimationOnElementWithId(const String& animationName, const String& elementID, double time) +{ + if (!m_coreFrame) + return false; + + AnimationController* controller = m_coreFrame->animation(); + if (!controller) + return false; + + if (!m_coreFrame->document()) + return false; + + Node* coreNode = m_coreFrame->document()->getElementById(elementID); + if (!coreNode || !coreNode->renderer()) + return false; + + return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time); +} + +void WebFrame::suspendAnimations() +{ + if (!m_coreFrame) + return; + + AnimationController* controller = m_coreFrame->animation(); + if (!controller) + return; + + controller->suspendAnimations(); +} + +void WebFrame::resumeAnimations() +{ + if (!m_coreFrame) + return; + + AnimationController* controller = m_coreFrame->animation(); + if (!controller) + return; + + controller->resumeAnimations(); +} + +String WebFrame::layerTreeAsText() const +{ + if (!m_coreFrame) + return ""; + + return m_coreFrame->layerTreeAsText(); +} + +unsigned WebFrame::pendingUnloadCount() const +{ + if (!m_coreFrame) + return 0; + + return m_coreFrame->domWindow()->pendingUnloadEventListeners(); +} + +bool WebFrame::allowsFollowingLink(const WebCore::KURL& url) const +{ + if (!m_coreFrame) + return true; + + return m_coreFrame->document()->securityOrigin()->canDisplay(url); +} + +JSGlobalContextRef WebFrame::jsContext() +{ + return toGlobalRef(m_coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); +} + +JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world) +{ + return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec()); +} + +JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleNodeHandle* nodeHandle, InjectedBundleScriptWorld* world) +{ + JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld()); + ExecState* exec = globalObject->globalExec(); + + JSLock lock(SilenceAssertionsOnly); + return toRef(exec, toJS(exec, globalObject, nodeHandle->coreNode())); +} + +JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleRangeHandle* rangeHandle, InjectedBundleScriptWorld* world) +{ + JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld()); + ExecState* exec = globalObject->globalExec(); + + JSLock lock(SilenceAssertionsOnly); + return toRef(exec, toJS(exec, globalObject, rangeHandle->coreRange())); +} + +JSValueRef WebFrame::computedStyleIncludingVisitedInfo(JSObjectRef element) +{ + if (!m_coreFrame) + return 0; + + JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(mainThreadNormalWorld()); + ExecState* exec = globalObject->globalExec(); + + if (!toJS(element)->inherits(&JSElement::s_info)) + return JSValueMakeUndefined(toRef(exec)); + + RefPtr<CSSComputedStyleDeclaration> style = computedStyle(static_cast<JSElement*>(toJS(element))->impl(), true); + + JSLock lock(SilenceAssertionsOnly); + return toRef(exec, toJS(exec, globalObject, style.get())); +} + +String WebFrame::counterValue(JSObjectRef element) +{ + if (!toJS(element)->inherits(&JSElement::s_info)) + return String(); + + return counterValueForElement(static_cast<JSElement*>(toJS(element))->impl()); +} + +String WebFrame::markerText(JSObjectRef element) +{ + if (!toJS(element)->inherits(&JSElement::s_info)) + return String(); + + return markerTextForListItem(static_cast<JSElement*>(toJS(element))->impl()); +} + +String WebFrame::provisionalURL() const +{ + if (!m_coreFrame) + return String(); + + return m_coreFrame->loader()->provisionalDocumentLoader()->url().string(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h new file mode 100644 index 0000000..3ded6f6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h @@ -0,0 +1,144 @@ +/* + * 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 WebFrame_h +#define WebFrame_h + +#include "APIObject.h" +#include "ImmutableArray.h" +#include "WebFrameLoaderClient.h" +#include <JavaScriptCore/JSBase.h> +#include <WebCore/FrameLoaderClient.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/PolicyChecker.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + class Frame; + class HTMLFrameOwnerElement; + class KURL; +} + +namespace WebKit { + +class InjectedBundleNodeHandle; +class InjectedBundleRangeHandle; +class InjectedBundleScriptWorld; +class WebPage; + +class WebFrame : public APIObject { +public: + static const Type APIType = TypeBundleFrame; + + static PassRefPtr<WebFrame> createMainFrame(WebPage*); + static PassRefPtr<WebFrame> createSubframe(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*); + ~WebFrame(); + + // Called when the FrameLoaderClient (and therefore the WebCore::Frame) is being torn down. + void invalidate(); + + WebPage* page() const; + WebCore::Frame* coreFrame() const { return m_coreFrame; } + + uint64_t frameID() const { return m_frameID; } + + uint64_t setUpPolicyListener(WebCore::FramePolicyFunction); + void invalidatePolicyListener(); + void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t downloadID); + + void startDownload(const WebCore::ResourceRequest&); + void convertHandleToDownload(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&); + + String source() const; + String contentsAsString() const; + String selectionAsString() const; + + WebCore::IntSize size() const; + + // WKBundleFrame API and SPI functions + bool isMainFrame() const; + String name() const; + String url() const; + String innerText() const; + bool isFrameSet() const; + PassRefPtr<ImmutableArray> childFrames(); + JSValueRef computedStyleIncludingVisitedInfo(JSObjectRef element); + JSGlobalContextRef jsContext(); + JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*); + + JSValueRef jsWrapperForWorld(InjectedBundleNodeHandle*, InjectedBundleScriptWorld*); + JSValueRef jsWrapperForWorld(InjectedBundleRangeHandle*, InjectedBundleScriptWorld*); + + static String counterValue(JSObjectRef element); + static String markerText(JSObjectRef element); + + unsigned numberOfActiveAnimations() const; + bool pauseAnimationOnElementWithId(const String& animationName, const String& elementID, double time); + void suspendAnimations(); + void resumeAnimations(); + String layerTreeAsText() const; + + unsigned pendingUnloadCount() const; + + bool allowsFollowingLink(const WebCore::KURL&) const; + + String provisionalURL() const; + + // Simple listener class used by plug-ins to know when frames finish or fail loading. + class LoadListener { + public: + virtual ~LoadListener() { } + + virtual void didFinishLoad(WebFrame*) = 0; + virtual void didFailLoad(WebFrame*, bool wasCancelled) = 0; + }; + void setLoadListener(LoadListener* loadListener) { m_loadListener = loadListener; } + LoadListener* loadListener() const { return m_loadListener; } + +private: + static PassRefPtr<WebFrame> create(); + WebFrame(); + + void init(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*); + + virtual Type type() const { return APIType; } + + WebCore::Frame* m_coreFrame; + + uint64_t m_policyListenerID; + WebCore::FramePolicyFunction m_policyFunction; + uint64_t m_policyDownloadID; + + WebFrameLoaderClient m_frameLoaderClient; + LoadListener* m_loadListener; + + uint64_t m_frameID; +}; + +} // namespace WebKit + +#endif // WebFrame_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp new file mode 100644 index 0000000..559b8b6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspector.h" + +#if ENABLE(INSPECTOR) + +#include "WebInspectorProxyMessages.h" +#include "WebPage.h" +#include "WebPageCreationParameters.h" +#include "WebProcess.h" +#include <WebCore/InspectorController.h> +#include <WebCore/Page.h> + +using namespace WebCore; + +namespace WebKit { + +WebInspector::WebInspector(WebPage* page) + : m_page(page) + , m_inspectorPage(0) +{ +} + +// Called from WebInspectorClient +WebPage* WebInspector::createInspectorPage() +{ + if (!m_page) + return 0; + + uint64_t inspectorPageID = 0; + WebPageCreationParameters parameters; + + if (!WebProcess::shared().connection()->sendSync(Messages::WebInspectorProxy::CreateInspectorPage(), + Messages::WebInspectorProxy::CreateInspectorPage::Reply(inspectorPageID, parameters), + m_page->pageID(), CoreIPC::Connection::NoTimeout)) { + return 0; + } + + if (!inspectorPageID) + return 0; + + WebProcess::shared().createWebPage(inspectorPageID, parameters); + m_inspectorPage = WebProcess::shared().webPage(inspectorPageID); + ASSERT(m_inspectorPage); + + return m_inspectorPage; +} + +// Called from WebInspectorFrontendClient +void WebInspector::didLoadInspectorPage() +{ + WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(), m_page->pageID()); +} + +void WebInspector::didClose() +{ + WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID()); +} + +// Called by WebInspector messages +void WebInspector::show() +{ + m_page->corePage()->inspectorController()->show(); +} + +void WebInspector::close() +{ + m_page->corePage()->inspectorController()->close(); +} + +void WebInspector::showConsole() +{ + m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel); +} + +void WebInspector::startJavaScriptDebugging() +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + m_page->corePage()->inspectorController()->showAndEnableDebugger(); +#endif +} + +void WebInspector::stopJavaScriptDebugging() +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + m_page->corePage()->inspectorController()->disableDebugger(); +#endif +} + +void WebInspector::startJavaScriptProfiling() +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + m_page->corePage()->inspectorController()->startUserInitiatedProfiling(); +#endif +} + +void WebInspector::stopJavaScriptProfiling() +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + m_page->corePage()->inspectorController()->stopUserInitiatedProfiling(); + m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel); +#endif +} + +void WebInspector::startPageProfiling() +{ + m_page->corePage()->inspectorController()->startTimelineProfiler(); +} + +void WebInspector::stopPageProfiling() +{ + m_page->corePage()->inspectorController()->stopTimelineProfiler(); + // FIXME: show the Timeline panel. +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h new file mode 100644 index 0000000..21a7529 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h @@ -0,0 +1,89 @@ +/* + * 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 WebInspector_h +#define WebInspector_h + +#if ENABLE(INSPECTOR) + +#include "Connection.h" +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> + +namespace WebKit { + +class WebPage; +struct WebPageCreationParameters; + +class WebInspector { + WTF_MAKE_NONCOPYABLE(WebInspector); + +public: + explicit WebInspector(WebPage*); + + WebPage* page() const { return m_page; } + WebPage* inspectorPage() const { return m_inspectorPage; } + + // Implemented in generated WebInspectorMessageReceiver.cpp + void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + +private: + friend class WebInspectorClient; + friend class WebInspectorFrontendClient; + + // Called from WebInspectorClient + WebPage* createInspectorPage(); + + // Called from WebInspectorFrontendClient + void didLoadInspectorPage(); + void didClose(); + + // Implemented in platform WebInspector file + String localizedStringsURL() const; + + // Called by WebInspector messages + void show(); + void close(); + + void showConsole(); + + void startJavaScriptDebugging(); + void stopJavaScriptDebugging(); + + void startJavaScriptProfiling(); + void stopJavaScriptProfiling(); + + void startPageProfiling(); + void stopPageProfiling(); + + WebPage* m_page; + WebPage* m_inspectorPage; +}; + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) + +#endif // WebInspector_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in b/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in new file mode 100644 index 0000000..dc184b6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in @@ -0,0 +1,37 @@ +# 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. + +#if ENABLE(INSPECTOR) + +messages -> WebInspector { + Show() + Close() + ShowConsole() + StartJavaScriptDebugging() + StopJavaScriptDebugging() + StartJavaScriptProfiling() + StopJavaScriptProfiling() + StartPageProfiling() + StopPageProfiling() +} + +#endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp new file mode 100644 index 0000000..d42e313 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebOpenPanelResultListener.h" + +namespace WebKit { + +PassRefPtr<WebOpenPanelResultListener> WebOpenPanelResultListener::create(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser) +{ + return adoptRef(new WebOpenPanelResultListener(page, fileChooser)); +} + +WebOpenPanelResultListener::WebOpenPanelResultListener(WebPage* page, PassRefPtr<WebCore::FileChooser> fileChooser) + : m_page(page) + , m_fileChooser(fileChooser) +{ +} + +WebOpenPanelResultListener::~WebOpenPanelResultListener() +{ +} + +void WebOpenPanelResultListener::didChooseFiles(const Vector<String>& files) +{ + m_fileChooser->chooseFiles(files); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h new file mode 100644 index 0000000..073d66a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebOpenPanelResultListener.h @@ -0,0 +1,54 @@ +/* + * 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 WebOpenPanelResultListener_h +#define WebOpenPanelResultListener_h + +#include <wtf/RefCounted.h> +#include <WebCore/FileChooser.h> + +namespace WebKit { + +class WebPage; + +class WebOpenPanelResultListener : public RefCounted<WebOpenPanelResultListener> { +public: + static PassRefPtr<WebOpenPanelResultListener> create(WebPage*, PassRefPtr<WebCore::FileChooser>); + ~WebOpenPanelResultListener(); + + void disconnectFromPage() { m_page = 0; } + void didChooseFiles(const Vector<String>&); + +private: + WebOpenPanelResultListener(WebPage*, PassRefPtr<WebCore::FileChooser>); + + WebPage* m_page; + RefPtr<WebCore::FileChooser> m_fileChooser; +}; + +} // namespace WebKit + + +#endif // WebOpenPanelResultListener_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp new file mode 100644 index 0000000..2259387 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -0,0 +1,1757 @@ +/* + * 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 + * 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 "WebPage.h" + +#include "Arguments.h" +#include "DataReference.h" +#include "DecoderAdapter.h" +#include "DrawingArea.h" +#include "InjectedBundle.h" +#include "InjectedBundleBackForwardList.h" +#include "MessageID.h" +#include "NetscapePlugin.h" +#include "PageOverlay.h" +#include "PluginProxy.h" +#include "PluginView.h" +#include "PrintInfo.h" +#include "SessionState.h" +#include "ShareableBitmap.h" +#include "WebBackForwardList.h" +#include "WebBackForwardListItem.h" +#include "WebBackForwardListProxy.h" +#include "WebChromeClient.h" +#include "WebContextMenu.h" +#include "WebContextMenuClient.h" +#include "WebContextMessages.h" +#include "WebCoreArgumentCoders.h" +#include "WebDragClient.h" +#include "WebEditorClient.h" +#include "WebEvent.h" +#include "WebEventConversion.h" +#include "WebFrame.h" +#include "WebGeolocationClient.h" +#include "WebImage.h" +#include "WebInspector.h" +#include "WebInspectorClient.h" +#include "WebOpenPanelResultListener.h" +#include "WebPageCreationParameters.h" +#include "WebPageGroupProxy.h" +#include "WebPageProxyMessages.h" +#include "WebPopupMenu.h" +#include "WebPreferencesStore.h" +#include "WebProcess.h" +#include "WebProcessProxyMessageKinds.h" +#include "WebProcessProxyMessages.h" +#include <WebCore/AbstractDatabase.h> +#include <WebCore/ArchiveResource.h> +#include <WebCore/Chrome.h> +#include <WebCore/ContextMenuController.h> +#include <WebCore/DocumentFragment.h> +#include <WebCore/DocumentLoader.h> +#include <WebCore/DocumentMarkerController.h> +#include <WebCore/DragController.h> +#include <WebCore/DragData.h> +#include <WebCore/EventHandler.h> +#include <WebCore/FocusController.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/FrameView.h> +#include <WebCore/HistoryItem.h> +#include <WebCore/KeyboardEvent.h> +#include <WebCore/Page.h> +#include <WebCore/PlatformKeyboardEvent.h> +#include <WebCore/PrintContext.h> +#include <WebCore/RenderTreeAsText.h> +#include <WebCore/RenderLayer.h> +#include <WebCore/RenderView.h> +#include <WebCore/ReplaceSelectionCommand.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/Settings.h> +#include <WebCore/SharedBuffer.h> +#include <WebCore/SubstituteData.h> +#include <WebCore/TextIterator.h> +#include <WebCore/markup.h> +#include <runtime/JSLock.h> +#include <runtime/JSValue.h> + +#if PLATFORM(MAC) || PLATFORM(WIN) +#include <WebCore/LegacyWebArchive.h> +#endif + +#if ENABLE(PLUGIN_PROCESS) +// FIXME: This is currently Mac-specific! +#include "MachPort.h" +#endif + +#if PLATFORM(QT) +#include "HitTestResult.h" +#endif + +#ifndef NDEBUG +#include <wtf/RefCountedLeakCounter.h> +#endif + +using namespace JSC; +using namespace WebCore; + +namespace WebKit { + +#ifndef NDEBUG +static WTF::RefCountedLeakCounter webPageCounter("WebPage"); +#endif + +PassRefPtr<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParameters& parameters) +{ + RefPtr<WebPage> page = adoptRef(new WebPage(pageID, parameters)); + + if (page->pageGroup()->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle()) + WebProcess::shared().injectedBundle()->didCreatePage(page.get()); + + return page.release(); +} + +WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) + : m_viewSize(parameters.viewSize) + , m_drawsBackground(true) + , m_drawsTransparentBackground(false) + , m_isInRedo(false) + , m_isClosed(false) + , m_tabToLinks(false) +#if PLATFORM(MAC) + , m_windowIsVisible(false) + , m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled) +#elif PLATFORM(WIN) + , m_nativeWindow(parameters.nativeWindow) +#endif + , m_findController(this) + , m_geolocationPermissionRequestManager(this) + , m_pageID(pageID) +{ + ASSERT(m_pageID); + + Page::PageClients pageClients; + pageClients.chromeClient = new WebChromeClient(this); + pageClients.contextMenuClient = new WebContextMenuClient(this); + pageClients.editorClient = new WebEditorClient(this); + pageClients.dragClient = new WebDragClient(this); + pageClients.backForwardClient = WebBackForwardListProxy::create(this); +#if ENABLE(CLIENT_BASED_GEOLOCATION) + pageClients.geolocationClient = new WebGeolocationClient(this); +#endif +#if ENABLE(INSPECTOR) + pageClients.inspectorClient = new WebInspectorClient(this); +#endif + m_page = adoptPtr(new Page(pageClients)); + + // Qt does not yet call setIsInWindow. Until it does, just leave + // this line out so plug-ins and video will work. Eventually all platforms + // should call setIsInWindow and this comment and #if should be removed, + // leaving behind the setCanStartMedia call. +#if !PLATFORM(QT) + m_page->setCanStartMedia(false); +#endif + + updatePreferences(parameters.store); + + m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData); + m_page->setGroupName(m_pageGroup->identifier()); + + platformInitialize(); + Settings::setMinDOMTimerInterval(0.004); + + m_drawingArea = DrawingArea::create(parameters.drawingAreaInfo.type, parameters.drawingAreaInfo.identifier, this); + m_mainFrame = WebFrame::createMainFrame(this); + + setDrawsBackground(parameters.drawsBackground); + setDrawsTransparentBackground(parameters.drawsTransparentBackground); + + setActive(parameters.isActive); + setFocused(parameters.isFocused); + setIsInWindow(parameters.isInWindow); + + m_userAgent = parameters.userAgent; + + WebBackForwardListProxy::setHighestItemIDFromUIProcess(parameters.highestUsedBackForwardItemID); + + if (!parameters.sessionState.isEmpty()) + restoreSession(parameters.sessionState); + +#ifndef NDEBUG + webPageCounter.increment(); +#endif +} + +WebPage::~WebPage() +{ + if (m_backForwardList) + m_backForwardList->detach(); + + ASSERT(!m_page); + + m_sandboxExtensionTracker.invalidate(); + +#if PLATFORM(MAC) + ASSERT(m_pluginViews.isEmpty()); +#endif + +#ifndef NDEBUG + webPageCounter.decrement(); +#endif +} + +void WebPage::dummy(bool&) +{ +} + +CoreIPC::Connection* WebPage::connection() const +{ + return WebProcess::shared().connection(); +} + +void WebPage::initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClient* client) +{ + m_contextMenuClient.initialize(client); +} + +void WebPage::initializeInjectedBundleEditorClient(WKBundlePageEditorClient* client) +{ + m_editorClient.initialize(client); +} + +void WebPage::initializeInjectedBundleFormClient(WKBundlePageFormClient* client) +{ + m_formClient.initialize(client); +} + +void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* client) +{ + m_loaderClient.initialize(client); +} + +void WebPage::initializeInjectedBundleUIClient(WKBundlePageUIClient* client) +{ + m_uiClient.initialize(client); +} + +PassRefPtr<Plugin> WebPage::createPlugin(const Plugin::Parameters& parameters) +{ + String pluginPath; + + if (!WebProcess::shared().connection()->sendSync( + Messages::WebContext::GetPluginPath(parameters.mimeType, parameters.url.string()), + Messages::WebContext::GetPluginPath::Reply(pluginPath), 0)) { + return 0; + } + + if (pluginPath.isNull()) + return 0; + +#if ENABLE(PLUGIN_PROCESS) + return PluginProxy::create(pluginPath); +#else + return NetscapePlugin::create(NetscapePluginModule::getOrCreate(pluginPath)); +#endif +} + +String WebPage::renderTreeExternalRepresentation() const +{ + return externalRepresentation(m_mainFrame->coreFrame(), RenderAsTextBehaviorNormal); +} + +void WebPage::executeEditingCommand(const String& commandName, const String& argument) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return; + frame->editor()->command(commandName).execute(argument); +} + +bool WebPage::isEditingCommandEnabled(const String& commandName) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return false; + + Editor::Command command = frame->editor()->command(commandName); + return command.isSupported() && command.isEnabled(); +} + +void WebPage::clearMainFrameName() +{ + mainFrame()->coreFrame()->tree()->clearName(); +} + +#if USE(ACCELERATED_COMPOSITING) +void WebPage::changeAcceleratedCompositingMode(WebCore::GraphicsLayer* layer) +{ + if (m_isClosed) + return; + + bool compositing = layer; + + // Tell the UI process that accelerated compositing changed. It may respond by changing + // drawing area types. + DrawingAreaInfo newDrawingAreaInfo; + + if (!sendSync(Messages::WebPageProxy::DidChangeAcceleratedCompositing(compositing), Messages::WebPageProxy::DidChangeAcceleratedCompositing::Reply(newDrawingAreaInfo))) + return; + + if (newDrawingAreaInfo.type != drawingArea()->info().type) { + m_drawingArea = 0; + if (newDrawingAreaInfo.type != DrawingAreaInfo::None) { + m_drawingArea = DrawingArea::create(newDrawingAreaInfo.type, newDrawingAreaInfo.identifier, this); + m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); + } + } +} + +void WebPage::enterAcceleratedCompositingMode(GraphicsLayer* layer) +{ + changeAcceleratedCompositingMode(layer); + m_drawingArea->setRootCompositingLayer(layer); +} + +void WebPage::exitAcceleratedCompositingMode() +{ + changeAcceleratedCompositingMode(0); +} +#endif + +void WebPage::close() +{ + if (m_isClosed) + return; + + m_isClosed = true; + + if (pageGroup()->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle()) + WebProcess::shared().injectedBundle()->willDestroyPage(this); + +#if ENABLE(INSPECTOR) + m_inspector = 0; +#endif + + if (m_activePopupMenu) { + m_activePopupMenu->disconnectFromPage(); + m_activePopupMenu = 0; + } + + if (m_activeOpenPanelResultListener) { + m_activeOpenPanelResultListener->disconnectFromPage(); + m_activeOpenPanelResultListener = 0; + } + + m_sandboxExtensionTracker.invalidate(); + + m_printContext = nullptr; + + m_mainFrame->coreFrame()->loader()->detachFromParent(); + m_page.clear(); + + m_drawingArea->onPageClose(); + m_drawingArea.clear(); + + WebProcess::shared().removeWebPage(m_pageID); +} + +void WebPage::tryClose() +{ + if (!m_mainFrame->coreFrame()->loader()->shouldClose()) + return; + + sendClose(); +} + +void WebPage::sendClose() +{ + send(Messages::WebPageProxy::ClosePage()); +} + +void WebPage::loadURL(const String& url, const SandboxExtension::Handle& sandboxExtensionHandle) +{ + loadURLRequest(ResourceRequest(KURL(KURL(), url)), sandboxExtensionHandle); +} + +void WebPage::loadURLRequest(const ResourceRequest& request, const SandboxExtension::Handle& sandboxExtensionHandle) +{ + m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle); + m_mainFrame->coreFrame()->loader()->load(request, false); +} + +void WebPage::loadData(PassRefPtr<SharedBuffer> sharedBuffer, const String& MIMEType, const String& encodingName, const KURL& baseURL, const KURL& unreachableURL) +{ + ResourceRequest request(baseURL); + SubstituteData substituteData(sharedBuffer, MIMEType, encodingName, unreachableURL); + m_mainFrame->coreFrame()->loader()->load(request, substituteData, false); +} + +void WebPage::loadHTMLString(const String& htmlString, const String& baseURLString) +{ + RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar)); + KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(), baseURLString); + loadData(sharedBuffer, "text/html", "utf-16", baseURL, KURL()); +} + +void WebPage::loadAlternateHTMLString(const String& htmlString, const String& baseURLString, const String& unreachableURLString) +{ + RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar)); + KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(), baseURLString); + KURL unreachableURL = unreachableURLString.isEmpty() ? KURL() : KURL(KURL(), unreachableURLString) ; + loadData(sharedBuffer, "text/html", "utf-16", baseURL, unreachableURL); +} + +void WebPage::loadPlainTextString(const String& string) +{ + RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(string.characters()), string.length() * sizeof(UChar)); + loadData(sharedBuffer, "text/plain", "utf-16", blankURL(), KURL()); +} + +void WebPage::stopLoading() +{ + m_mainFrame->coreFrame()->loader()->stopForUserCancel(); +} + +void WebPage::setDefersLoading(bool defersLoading) +{ + m_page->setDefersLoading(defersLoading); +} + +void WebPage::reload(bool reloadFromOrigin) +{ + m_mainFrame->coreFrame()->loader()->reload(reloadFromOrigin); +} + +void WebPage::goForward(uint64_t backForwardItemID) +{ + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); + m_page->goToItem(item, FrameLoadTypeForward); +} + +void WebPage::goBack(uint64_t backForwardItemID) +{ + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); + m_page->goToItem(item, FrameLoadTypeBack); +} + +void WebPage::goToBackForwardItem(uint64_t backForwardItemID) +{ + HistoryItem* item = WebBackForwardListProxy::itemForID(backForwardItemID); + m_page->goToItem(item, FrameLoadTypeIndexedBackForward); +} + +void WebPage::layoutIfNeeded() +{ + if (m_mainFrame->coreFrame()->view()) + m_mainFrame->coreFrame()->view()->updateLayoutAndStyleIfNeededRecursive(); +} + +void WebPage::setSize(const WebCore::IntSize& viewSize) +{ +#if ENABLE(TILED_BACKING_STORE) + // If we are resizing to content ignore external attempts. + if (!m_resizesToContentsLayoutSize.isEmpty()) + return; +#endif + + if (m_viewSize == viewSize) + return; + + Frame* frame = m_page->mainFrame(); + + frame->view()->resize(viewSize); + frame->view()->setNeedsLayout(); + m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), viewSize)); + + m_viewSize = viewSize; +} + +#if ENABLE(TILED_BACKING_STORE) +void WebPage::setActualVisibleContentRect(const IntRect& rect) +{ + Frame* frame = m_page->mainFrame(); + + frame->view()->setActualVisibleContentRect(rect); +} + +void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSize) +{ + if (m_resizesToContentsLayoutSize == targetLayoutSize) + return; + + m_resizesToContentsLayoutSize = targetLayoutSize; + + Frame* frame = m_page->mainFrame(); + if (m_resizesToContentsLayoutSize.isEmpty()) { + frame->view()->setDelegatesScrolling(false); + frame->view()->setUseFixedLayout(false); + frame->view()->setPaintsEntireContents(false); + } else { + frame->view()->setDelegatesScrolling(true); + frame->view()->setUseFixedLayout(true); + frame->view()->setPaintsEntireContents(true); + frame->view()->setFixedLayoutSize(m_resizesToContentsLayoutSize); + } + frame->view()->forceLayout(); +} + +void WebPage::resizeToContentsIfNeeded() +{ + if (m_resizesToContentsLayoutSize.isEmpty()) + return; + + Frame* frame = m_page->mainFrame(); + + IntSize contentSize = frame->view()->contentsSize(); + if (contentSize == m_viewSize) + return; + + m_viewSize = contentSize; + frame->view()->resize(m_viewSize); + frame->view()->setNeedsLayout(); +} +#endif + +void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect) +{ + graphicsContext.save(); + graphicsContext.clip(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(); + } +} + +double WebPage::textZoomFactor() const +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return 1; + return frame->textZoomFactor(); +} + +void WebPage::setTextZoomFactor(double zoomFactor) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + frame->setTextZoomFactor(static_cast<float>(zoomFactor)); +} + +double WebPage::pageZoomFactor() const +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return 1; + return frame->pageZoomFactor(); +} + +void WebPage::setPageZoomFactor(double zoomFactor) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + frame->setPageZoomFactor(static_cast<float>(zoomFactor)); +} + +void WebPage::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor)); +} + +void WebPage::scaleWebView(double scale, const IntPoint& origin) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + frame->scalePage(scale, origin); +} + +double WebPage::viewScaleFactor() const +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return 1; + return frame->pageScaleFactor(); +} + +void WebPage::setUseFixedLayout(bool fixed) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + + FrameView* view = frame->view(); + if (!view) + return; + + view->setUseFixedLayout(fixed); + if (!fixed) + view->setFixedLayoutSize(IntSize()); +} + +void WebPage::setFixedLayoutSize(const IntSize& size) +{ + Frame* frame = m_mainFrame->coreFrame(); + if (!frame) + return; + + FrameView* view = frame->view(); + if (!view) + return; + + view->setFixedLayoutSize(size); + view->forceLayout(); +} + +void WebPage::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay) +{ + if (m_pageOverlay) + pageOverlay->setPage(0); + + m_pageOverlay = pageOverlay; + m_pageOverlay->setPage(this); + m_pageOverlay->setNeedsDisplay(); +} + +void WebPage::uninstallPageOverlay(PageOverlay* pageOverlay) +{ + if (pageOverlay != m_pageOverlay) + return; + + m_pageOverlay->setPage(0); + m_pageOverlay = nullptr; + m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); +} + +PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, ImageOptions options) +{ + FrameView* frameView = m_mainFrame->coreFrame()->view(); + if (!frameView) + return 0; + + frameView->updateLayoutAndStyleIfNeededRecursive(); + + PaintBehavior oldBehavior = frameView->paintBehavior(); + frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers); + + RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options); + OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); + + graphicsContext->save(); + graphicsContext->translate(-rect.x(), -rect.y()); + frameView->paint(graphicsContext.get(), rect); + graphicsContext->restore(); + + frameView->setPaintBehavior(oldBehavior); + + return snapshot.release(); +} + +PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options) +{ + FrameView* frameView = m_mainFrame->coreFrame()->view(); + if (!frameView) + return 0; + + frameView->updateLayoutAndStyleIfNeededRecursive(); + + PaintBehavior oldBehavior = frameView->paintBehavior(); + frameView->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers); + + RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options); + OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); + + graphicsContext->save(); + graphicsContext->translate(-rect.x(), -rect.y()); + frameView->paintContents(graphicsContext.get(), rect); + graphicsContext->restore(); + + frameView->setPaintBehavior(oldBehavior); + + return snapshot.release(); +} + +void WebPage::pageDidScroll() +{ + // Hide the find indicator. + m_findController.hideFindIndicator(); + + m_uiClient.pageDidScroll(this); + + send(Messages::WebPageProxy::PageDidScroll()); +} + +#if ENABLE(TILED_BACKING_STORE) +void WebPage::pageDidRequestScroll(const IntSize& delta) +{ + send(Messages::WebPageProxy::PageDidRequestScroll(delta)); +} +#endif + +WebContextMenu* WebPage::contextMenu() +{ + if (!m_contextMenu) + m_contextMenu = WebContextMenu::create(this); + return m_contextMenu.get(); +} + +void WebPage::getLocationAndLengthFromRange(Range* range, uint64_t& location, uint64_t& length) +{ + location = notFound; + length = 0; + + if (!range || !range->startContainer()) + return; + + Element* selectionRoot = range->ownerDocument()->frame()->selection()->rootEditableElement(); + Element* scope = selectionRoot ? selectionRoot : range->ownerDocument()->documentElement(); + + // Mouse events may cause TSM to attempt to create an NSRange for a portion of the view + // that is not inside the current editable region. These checks ensure we don't produce + // potentially invalid data when responding to such requests. + if (range->startContainer() != scope && !range->startContainer()->isDescendantOf(scope)) + return; + if (range->endContainer() != scope && !range->endContainer()->isDescendantOf(scope)) + return; + + RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); + ASSERT(testRange->startContainer() == scope); + location = TextIterator::rangeLength(testRange.get()); + + ExceptionCode ec; + testRange->setEnd(range->endContainer(), range->endOffset(), ec); + ASSERT(testRange->startContainer() == scope); + length = TextIterator::rangeLength(testRange.get()) - location; +} + +// Events + +static const WebEvent* g_currentEvent = 0; + +// FIXME: WebPage::currentEvent is used by the plug-in code to avoid having to convert from DOM events back to +// WebEvents. When we get the event handling sorted out, this should go away and the Widgets should get the correct +// platform events passed to the event handler code. +const WebEvent* WebPage::currentEvent() +{ + return g_currentEvent; +} + +class CurrentEvent { +public: + explicit CurrentEvent(const WebEvent& event) + : m_previousCurrentEvent(g_currentEvent) + { + g_currentEvent = &event; + } + + ~CurrentEvent() + { + g_currentEvent = m_previousCurrentEvent; + } + +private: + const WebEvent* m_previousCurrentEvent; +}; + +static bool isContextClick(const PlatformMouseEvent& event) +{ + if (event.button() == WebCore::RightButton) + return true; + +#if PLATFORM(MAC) + // FIXME: this really should be about OSX-style UI, not about the Mac port + if (event.button() == WebCore::LeftButton && event.ctrlKey()) + return true; +#endif + + return false; +} + +static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page) +{ + Frame* frame = page->mainFrame(); + if (!frame->view()) + return false; + + PlatformMouseEvent platformMouseEvent = platform(mouseEvent); + + switch (platformMouseEvent.eventType()) { + case WebCore::MouseEventPressed: + { + if (isContextClick(platformMouseEvent)) + page->contextMenuController()->clearContextMenu(); + + bool handled = frame->eventHandler()->handleMousePressEvent(platformMouseEvent); + + if (isContextClick(platformMouseEvent)) { + handled = frame->eventHandler()->sendContextMenuEvent(platformMouseEvent); + if (handled) + page->chrome()->showContextMenu(); + } + + return handled; + } + case WebCore::MouseEventReleased: + return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent); + case WebCore::MouseEventMoved: + return frame->eventHandler()->mouseMoved(platformMouseEvent); + + default: + ASSERT_NOT_REACHED(); + return false; + } +} + +void WebPage::mouseEvent(const WebMouseEvent& mouseEvent) +{ + bool handled = false; + + if (m_pageOverlay) { + // Let the page overlay handle the event. + handled = m_pageOverlay->mouseEvent(mouseEvent); + } + + if (!handled) { + CurrentEvent currentEvent(mouseEvent); + + handled = handleMouseEvent(mouseEvent, m_page.get()); + } + + send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), handled)); +} + +static bool handleWheelEvent(const WebWheelEvent& wheelEvent, Page* page) +{ + Frame* frame = page->mainFrame(); + if (!frame->view()) + return false; + + PlatformWheelEvent platformWheelEvent = platform(wheelEvent); + return frame->eventHandler()->handleWheelEvent(platformWheelEvent); +} + +void WebPage::wheelEvent(const WebWheelEvent& wheelEvent) +{ + CurrentEvent currentEvent(wheelEvent); + + bool handled = handleWheelEvent(wheelEvent, m_page.get()); + send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(wheelEvent.type()), handled)); +} + +static bool handleKeyEvent(const WebKeyboardEvent& keyboardEvent, Page* page) +{ + if (!page->mainFrame()->view()) + return false; + + if (keyboardEvent.type() == WebEvent::Char && keyboardEvent.isSystemKey()) + return page->focusController()->focusedOrMainFrame()->eventHandler()->handleAccessKey(platform(keyboardEvent)); + return page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(platform(keyboardEvent)); +} + +void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) +{ + CurrentEvent currentEvent(keyboardEvent); + + bool handled = handleKeyEvent(keyboardEvent, m_page.get()); + if (!handled) + handled = performDefaultBehaviorForKeyEvent(keyboardEvent); + + send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled)); +} + +void WebPage::validateMenuItem(const String& commandName) +{ + bool isEnabled = false; + int32_t state = 0; + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (frame) { + Editor::Command command = frame->editor()->command(commandName); + state = command.state(); + isEnabled = command.isSupported() && command.isEnabled(); + } + + send(Messages::WebPageProxy::DidValidateMenuItem(commandName, isEnabled, state)); +} + +void WebPage::executeEditCommand(const String& commandName) +{ + executeEditingCommand(commandName, String()); +} + +uint64_t WebPage::restoreSession(const SessionState& sessionState) +{ + const BackForwardListItemVector& list = sessionState.list(); + size_t size = list.size(); + uint64_t currentItemID = 0; + for (size_t i = 0; i < size; ++i) { + WebBackForwardListItem* webItem = list[i].get(); + DecoderAdapter decoder(webItem->backForwardData().data(), webItem->backForwardData().size()); + + RefPtr<HistoryItem> item = HistoryItem::decodeBackForwardTree(webItem->url(), webItem->title(), webItem->originalURL(), decoder); + if (!item) { + LOG_ERROR("Failed to decode a HistoryItem from session state data."); + return 0; + } + + if (i == sessionState.currentIndex()) + currentItemID = webItem->itemID(); + + WebBackForwardListProxy::addItemFromUIProcess(list[i]->itemID(), item.release()); + } + ASSERT(currentItemID); + return currentItemID; +} + +void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState) +{ + if (uint64_t currentItemID = restoreSession(sessionState)) + goToBackForwardItem(currentItemID); +} + +#if ENABLE(TOUCH_EVENTS) +static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page) +{ + Frame* frame = page->mainFrame(); + if (!frame->view()) + return false; + + return frame->eventHandler()->handleTouchEvent(platform(touchEvent)); +} + +void WebPage::touchEvent(const WebTouchEvent& touchEvent) +{ + CurrentEvent currentEvent(touchEvent); + + bool handled = handleTouchEvent(touchEvent, m_page.get()); + + send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(touchEvent.type()), handled)); +} +#endif + +void WebPage::setActive(bool isActive) +{ + m_page->focusController()->setActive(isActive); + +#if PLATFORM(MAC) + // Tell all our plug-in views that the window focus changed. + for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) + (*it)->setWindowIsFocused(isActive); +#endif +} + +void WebPage::setDrawsBackground(bool drawsBackground) +{ + if (m_drawsBackground == drawsBackground) + return; + + m_drawsBackground = drawsBackground; + + for (Frame* coreFrame = m_mainFrame->coreFrame(); coreFrame; coreFrame = coreFrame->tree()->traverseNext()) { + if (FrameView* view = coreFrame->view()) + view->setTransparent(!drawsBackground); + } + + m_drawingArea->pageBackgroundTransparencyChanged(); + m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); +} + +void WebPage::setDrawsTransparentBackground(bool drawsTransparentBackground) +{ + if (m_drawsTransparentBackground == drawsTransparentBackground) + return; + + m_drawsTransparentBackground = drawsTransparentBackground; + + Color backgroundColor = drawsTransparentBackground ? Color::transparent : Color::white; + for (Frame* coreFrame = m_mainFrame->coreFrame(); coreFrame; coreFrame = coreFrame->tree()->traverseNext()) { + if (FrameView* view = coreFrame->view()) + view->setBaseBackgroundColor(backgroundColor); + } + + m_drawingArea->pageBackgroundTransparencyChanged(); + m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize)); +} + +void WebPage::setFocused(bool isFocused) +{ + m_page->focusController()->setFocused(isFocused); +} + +void WebPage::setInitialFocus(bool forward) +{ + if (!m_page || !m_page->focusController()) + return; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + frame->document()->setFocusedNode(0); + m_page->focusController()->setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0); +} + +void WebPage::setWindowResizerSize(const IntSize& windowResizerSize) +{ + if (m_windowResizerSize == windowResizerSize) + return; + + m_windowResizerSize = windowResizerSize; + + for (Frame* coreFrame = m_mainFrame->coreFrame(); coreFrame; coreFrame = coreFrame->tree()->traverseNext()) { + FrameView* view = coreFrame->view(); + if (view) + view->windowResizerRectChanged(); + } +} + +void WebPage::setIsInWindow(bool isInWindow) +{ + if (!isInWindow) { + m_page->setCanStartMedia(false); + m_page->willMoveOffscreen(); + } else { + m_page->setCanStartMedia(true); + m_page->didMoveOnscreen(); + } +} + +void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID) +{ + WebFrame* frame = WebProcess::shared().webFrame(frameID); + if (!frame) + return; + frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID); +} + +void WebPage::show() +{ + send(Messages::WebPageProxy::ShowPage()); +} + +void WebPage::setUserAgent(const String& userAgent) +{ + m_userAgent = userAgent; +} + +IntRect WebPage::windowResizerRect() const +{ + if (m_windowResizerSize.isEmpty()) + return IntRect(); + + IntSize frameViewSize; + if (Frame* coreFrame = m_mainFrame->coreFrame()) { + if (FrameView* view = coreFrame->view()) + frameViewSize = view->size(); + } + + return IntRect(frameViewSize.width() - m_windowResizerSize.width(), frameViewSize.height() - m_windowResizerSize.height(), + m_windowResizerSize.width(), m_windowResizerSize.height()); +} + +void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID) +{ + // NOTE: We need to be careful when running scripts that the objects we depend on don't + // disappear during script execution. + + JSLock lock(SilenceAssertionsOnly); + JSValue resultValue = m_mainFrame->coreFrame()->script()->executeScript(script, true).jsValue(); + String resultString; + if (resultValue) + resultString = ustringToString(resultValue.toString(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec())); + + send(Messages::WebPageProxy::StringCallback(resultString, callbackID)); +} + +void WebPage::getContentsAsString(uint64_t callbackID) +{ + String resultString = m_mainFrame->contentsAsString(); + send(Messages::WebPageProxy::StringCallback(resultString, callbackID)); +} + +void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID) +{ + String resultString = renderTreeExternalRepresentation(); + send(Messages::WebPageProxy::StringCallback(resultString, callbackID)); +} + +void WebPage::getSelectionOrContentsAsString(uint64_t callbackID) +{ + String resultString = m_mainFrame->selectionAsString(); + if (resultString.isEmpty()) + resultString = m_mainFrame->contentsAsString(); + send(Messages::WebPageProxy::StringCallback(resultString, callbackID)); +} + +void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID) +{ + String resultString; + if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) + resultString = frame->source(); + + send(Messages::WebPageProxy::StringCallback(resultString, callbackID)); +} + +void WebPage::getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID) +{ + CoreIPC::DataReference dataReference; + + RefPtr<SharedBuffer> buffer; + if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) { + if (DocumentLoader* loader = frame->coreFrame()->loader()->documentLoader()) { + if ((buffer = loader->mainResourceData())) + dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size()); + } + } + + send(Messages::WebPageProxy::DataCallback(dataReference, callbackID)); +} + +void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID) +{ + CoreIPC::DataReference dataReference; + +#if PLATFORM(MAC) || PLATFORM(WIN) + RetainPtr<CFDataRef> data; + if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) { + if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(frame->coreFrame())) { + if ((data = archive->rawDataRepresentation())) + dataReference = CoreIPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get())); + } + } +#endif + + send(Messages::WebPageProxy::DataCallback(dataReference, callbackID)); +} + +void WebPage::preferencesDidChange(const WebPreferencesStore& store) +{ + WebPreferencesStore::removeTestRunnerOverrides(); + updatePreferences(store); +} + +void WebPage::updatePreferences(const WebPreferencesStore& store) +{ + Settings* settings = m_page->settings(); + + m_tabToLinks = store.getBoolValueForKey(WebPreferencesKey::tabsToLinksKey()); + + // FIXME: This should be generated from macro expansion for all preferences, + // but we currently don't match the naming of WebCore exactly so we are + // handrolling the boolean and integer preferences until that is fixed. + +#define INITIALIZE_SETTINGS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) settings->set##KeyUpper(store.get##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key())); + + FOR_EACH_WEBKIT_STRING_PREFERENCE(INITIALIZE_SETTINGS) + +#undef INITIALIZE_SETTINGS + + settings->setJavaScriptEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptEnabledKey())); + settings->setLoadsImagesAutomatically(store.getBoolValueForKey(WebPreferencesKey::loadsImagesAutomaticallyKey())); + settings->setPluginsEnabled(store.getBoolValueForKey(WebPreferencesKey::pluginsEnabledKey())); + settings->setJavaEnabled(store.getBoolValueForKey(WebPreferencesKey::javaEnabledKey())); + settings->setOfflineWebApplicationCacheEnabled(store.getBoolValueForKey(WebPreferencesKey::offlineWebApplicationCacheEnabledKey())); + settings->setLocalStorageEnabled(store.getBoolValueForKey(WebPreferencesKey::localStorageEnabledKey())); + settings->setXSSAuditorEnabled(store.getBoolValueForKey(WebPreferencesKey::xssAuditorEnabledKey())); + settings->setFrameFlatteningEnabled(store.getBoolValueForKey(WebPreferencesKey::frameFlatteningEnabledKey())); + settings->setPrivateBrowsingEnabled(store.getBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey())); + settings->setDeveloperExtrasEnabled(store.getBoolValueForKey(WebPreferencesKey::developerExtrasEnabledKey())); + settings->setTextAreasAreResizable(store.getBoolValueForKey(WebPreferencesKey::textAreasAreResizableKey())); + settings->setNeedsSiteSpecificQuirks(store.getBoolValueForKey(WebPreferencesKey::needsSiteSpecificQuirksKey())); + settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey())); + settings->setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey())); + settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey())); + settings->setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey())); + 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->setShouldPrintBackgrounds(store.getBoolValueForKey(WebPreferencesKey::shouldPrintBackgroundsKey())); + + settings->setMinimumFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumFontSizeKey())); + settings->setMinimumLogicalFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey())); + settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey())); + settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey())); + +#if PLATFORM(WIN) + // Temporarily turn off accelerated compositing until we have a good solution for rendering it. + settings->setAcceleratedCompositingEnabled(false); +#else + settings->setAcceleratedCompositingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedCompositingEnabledKey())); +#endif + settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey())); + settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey())); + +#if ENABLE(DATABASE) + AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey())); +#endif + + platformPreferencesDidChange(store); +} + +#if ENABLE(INSPECTOR) +WebInspector* WebPage::inspector() +{ + if (m_isClosed) + return 0; + if (!m_inspector) + m_inspector = adoptPtr(new WebInspector(this)); + return m_inspector.get(); +} +#endif + +#if !PLATFORM(MAC) +bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt) +{ + Node* node = evt->target()->toNode(); + ASSERT(node); + Frame* frame = node->document()->frame(); + ASSERT(frame); + + const PlatformKeyboardEvent* keyEvent = evt->keyEvent(); + if (!keyEvent) + return false; + + Editor::Command command = frame->editor()->command(interpretKeyEvent(evt)); + + if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) { + // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated, + // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated + // (e.g. Tab that inserts a Tab character, or Enter). + return !command.isTextInsertion() && command.execute(evt); + } + + if (command.execute(evt)) + return true; + + // Don't insert null or control characters as they can result in unexpected behaviour + if (evt->charCode() < ' ') + return false; + + return frame->editor()->insertText(evt->keyEvent()->text(), evt); +} +#endif + +void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags) +{ + if (!m_page) { + send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone)); + return; + } + + DragData dragData(dragStorageName, 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(); + } +} + +WebEditCommand* WebPage::webEditCommand(uint64_t commandID) +{ + return m_editCommandMap.get(commandID).get(); +} + +void WebPage::addWebEditCommand(uint64_t commandID, WebEditCommand* command) +{ + m_editCommandMap.set(commandID, command); +} + +void WebPage::removeWebEditCommand(uint64_t commandID) +{ + m_editCommandMap.remove(commandID); +} + +void WebPage::unapplyEditCommand(uint64_t commandID) +{ + WebEditCommand* command = webEditCommand(commandID); + if (!command) + return; + + command->command()->unapply(); +} + +void WebPage::reapplyEditCommand(uint64_t commandID) +{ + WebEditCommand* command = webEditCommand(commandID); + if (!command) + return; + + m_isInRedo = true; + command->command()->reapply(); + m_isInRedo = false; +} + +void WebPage::didRemoveEditCommand(uint64_t commandID) +{ + removeWebEditCommand(commandID); +} + +void WebPage::setActivePopupMenu(WebPopupMenu* menu) +{ + m_activePopupMenu = menu; +} + +void WebPage::setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener> openPanelResultListener) +{ + m_activeOpenPanelResultListener = openPanelResultListener; +} + +bool WebPage::findStringFromInjectedBundle(const String& target, FindOptions options) +{ + return m_page->findString(target, options); +} + +void WebPage::findString(const String& string, uint32_t options, uint32_t maxMatchCount) +{ + m_findController.findString(string, static_cast<FindOptions>(options), maxMatchCount); +} + +void WebPage::hideFindUI() +{ + m_findController.hideFindUI(); +} + +void WebPage::countStringMatches(const String& string, uint32_t options, uint32_t maxMatchCount) +{ + m_findController.countStringMatches(string, static_cast<FindOptions>(options), maxMatchCount); +} + +void WebPage::didChangeSelectedIndexForActivePopupMenu(int32_t newIndex) +{ + if (!m_activePopupMenu) + return; + + m_activePopupMenu->didChangeSelectedIndex(newIndex); + m_activePopupMenu = 0; +} + +void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files) +{ + if (!m_activeOpenPanelResultListener) + return; + + m_activeOpenPanelResultListener->didChooseFiles(files); + m_activeOpenPanelResultListener = 0; +} + +void WebPage::didCancelForOpenPanel() +{ + m_activeOpenPanelResultListener = 0; +} + +void WebPage::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) +{ + m_geolocationPermissionRequestManager.didReceiveGeolocationPermissionDecision(geolocationID, allowed); +} + +void WebPage::advanceToNextMisspelling(bool startBeforeSelection) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + frame->editor()->advanceToNextMisspelling(startBeforeSelection); +} + +void WebPage::changeSpellingToWord(const String& word) +{ + replaceSelectionWithText(m_page->focusController()->focusedOrMainFrame(), word); +} + +void WebPage::unmarkAllMisspellings() +{ + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (Document* document = frame->document()) + document->markers()->removeMarkers(DocumentMarker::Spelling); + } +} + +void WebPage::unmarkAllBadGrammar() +{ + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (Document* document = frame->document()) + document->markers()->removeMarkers(DocumentMarker::Grammar); + } +} + +#if PLATFORM(MAC) +void WebPage::uppercaseWord() +{ + m_page->focusController()->focusedOrMainFrame()->editor()->uppercaseWord(); +} + +void WebPage::lowercaseWord() +{ + m_page->focusController()->focusedOrMainFrame()->editor()->lowercaseWord(); +} + +void WebPage::capitalizeWord() +{ + m_page->focusController()->focusedOrMainFrame()->editor()->capitalizeWord(); +} +#endif + +void WebPage::setTextForActivePopupMenu(int32_t index) +{ + if (!m_activePopupMenu) + return; + + m_activePopupMenu->setTextForIndex(index); +} + +void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& item) +{ + ASSERT(m_contextMenu); + m_contextMenu->itemSelected(item); + m_contextMenu = 0; +} + +void WebPage::replaceSelectionWithText(Frame* frame, const String& text) +{ + if (frame->selection()->isNone()) + return; + + RefPtr<DocumentFragment> textFragment = createFragmentFromText(frame->selection()->toNormalizedRange().get(), text); + applyCommand(ReplaceSelectionCommand::create(frame->document(), textFragment.release(), true, false, true)); + frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); +} + +bool WebPage::mainFrameHasCustomRepresentation() const +{ + return static_cast<WebFrameLoaderClient*>(mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation(); +} + +#if PLATFORM(MAC) + +void WebPage::addPluginView(PluginView* pluginView) +{ + ASSERT(!m_pluginViews.contains(pluginView)); + + m_pluginViews.add(pluginView); +} + +void WebPage::removePluginView(PluginView* pluginView) +{ + ASSERT(m_pluginViews.contains(pluginView)); + + m_pluginViews.remove(pluginView); +} + +void WebPage::setWindowIsVisible(bool windowIsVisible) +{ + m_windowIsVisible = windowIsVisible; + + // Tell all our plug-in views that the window visibility changed. + for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) + (*it)->setWindowIsVisible(windowIsVisible); +} + +void WebPage::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates) +{ + m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates; + m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates; + m_accessibilityPosition = accessibilityViewCoordinates; + + // Tell all our plug-in views that the window and view frames have changed. + for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) + (*it)->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates); +} + +bool WebPage::windowIsFocused() const +{ + return m_page->focusController()->isActive(); +} + +#endif + +void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (messageID.is<CoreIPC::MessageClassDrawingAreaLegacy>()) { + if (m_drawingArea) + m_drawingArea->didReceiveMessage(connection, messageID, arguments); + return; + } + +#ifdef __APPLE__ + if (messageID.is<CoreIPC::MessageClassDrawingArea>()) { + if (m_drawingArea) + m_drawingArea->didReceiveDrawingAreaMessage(connection, messageID, arguments); + return; + } +#endif + +#if ENABLE(INSPECTOR) + if (messageID.is<CoreIPC::MessageClassWebInspector>()) { + if (WebInspector* inspector = this->inspector()) + inspector->didReceiveWebInspectorMessage(connection, messageID, arguments); + return; + } +#endif + + didReceiveWebPageMessage(connection, messageID, arguments); +} + +CoreIPC::SyncReplyMode WebPage::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + return didReceiveSyncWebPageMessage(connection, messageID, arguments, reply); +} + +InjectedBundleBackForwardList* WebPage::backForwardList() +{ + if (!m_backForwardList) + m_backForwardList = InjectedBundleBackForwardList::create(this); + return m_backForwardList.get(); +} + +#if PLATFORM(QT) +void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point) +{ + const int minimumZoomTargetWidth = 100; + + Frame* mainframe = m_mainFrame->coreFrame(); + HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), /*allowShadowContent*/ false, /*ignoreClipping*/ true); + + Node* node = result.innerNode(); + while (node && node->getRect().width() < minimumZoomTargetWidth) + node = node->parentNode(); + + IntRect zoomableArea; + if (node) + zoomableArea = node->getRect(); + send(Messages::WebPageProxy::DidFindZoomableArea(zoomableArea)); +} +#endif + +WebPage::SandboxExtensionTracker::~SandboxExtensionTracker() +{ + invalidate(); +} + +void WebPage::SandboxExtensionTracker::invalidate() +{ + if (m_pendingProvisionalSandboxExtension) { + m_pendingProvisionalSandboxExtension->invalidate(); + m_pendingProvisionalSandboxExtension = 0; + } + + if (m_provisionalSandboxExtension) { + m_provisionalSandboxExtension->invalidate(); + m_provisionalSandboxExtension = 0; + } + + if (m_committedSandboxExtension) { + m_committedSandboxExtension->invalidate(); + m_committedSandboxExtension = 0; + } +} + +void WebPage::SandboxExtensionTracker::beginLoad(WebFrame* frame, const SandboxExtension::Handle& handle) +{ + ASSERT(frame->isMainFrame()); + + ASSERT(!m_pendingProvisionalSandboxExtension); + m_pendingProvisionalSandboxExtension = SandboxExtension::create(handle); +} + +void WebPage::SandboxExtensionTracker::didStartProvisionalLoad(WebFrame* frame) +{ + if (!frame->isMainFrame()) + return; + + ASSERT(!m_provisionalSandboxExtension); + + m_provisionalSandboxExtension = m_pendingProvisionalSandboxExtension.release(); + if (!m_provisionalSandboxExtension) + return; + + m_provisionalSandboxExtension->consume(); +} + +void WebPage::SandboxExtensionTracker::didCommitProvisionalLoad(WebFrame* frame) +{ + if (!frame->isMainFrame()) + return; + + ASSERT(!m_pendingProvisionalSandboxExtension); + + // The provisional load has been committed. Invalidate the currently committed sandbox + // extension and make the provisional sandbox extension the committed sandbox extension. + if (m_committedSandboxExtension) + m_committedSandboxExtension->invalidate(); + + m_committedSandboxExtension = m_provisionalSandboxExtension.release(); +} + +void WebPage::SandboxExtensionTracker::didFailProvisionalLoad(WebFrame* frame) +{ + if (!frame->isMainFrame()) + return; + + ASSERT(!m_pendingProvisionalSandboxExtension); + if (!m_provisionalSandboxExtension) + return; + + m_provisionalSandboxExtension->invalidate(); + m_provisionalSandboxExtension = 0; +} + +bool WebPage::hasLocalDataForURL(const KURL& url) +{ + if (url.isLocalFile()) + return true; + + FrameLoader* frameLoader = m_page->mainFrame()->loader(); + DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0; + if (documentLoader && documentLoader->subresource(url)) + return true; + + return platformHasLocalDataForURL(url); +} + +void WebPage::setCustomTextEncodingName(const String& encoding) +{ + m_page->mainFrame()->loader()->reloadWithOverrideEncoding(encoding); +} + +void WebPage::didRemoveBackForwardItem(uint64_t itemID) +{ + WebBackForwardListProxy::removeItem(itemID); +} + +#if PLATFORM(MAC) + +bool WebPage::isSpeaking() +{ + bool result; + return sendSync(Messages::WebPageProxy::GetIsSpeaking(), Messages::WebPageProxy::GetIsSpeaking::Reply(result)) && result; +} + +void WebPage::speak(const String& string) +{ + send(Messages::WebPageProxy::Speak(string)); +} + +void WebPage::stopSpeaking() +{ + send(Messages::WebPageProxy::StopSpeaking()); +} + +#endif + +void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo) +{ + WebFrame* frame = WebProcess::shared().webFrame(frameID); + if (!frame) + return; + + Frame* coreFrame = frame->coreFrame(); + if (!coreFrame) + return; + + if (!m_printContext) + m_printContext = adoptPtr(new PrintContext(coreFrame)); + + m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight); +} + +void WebPage::endPrinting() +{ + m_printContext = nullptr; +} + +void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, Vector<IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting) +{ + beginPrinting(frameID, printInfo); + + 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); + + resultTotalScaleFactorForPrinting = m_printContext->computeAutomaticScaleFactor(printInfo.availablePaperWidth) * printInfo.pageSetupScaleFactor; + resultPageRects = m_printContext->pageRects(); + + // 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)); +} + +#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) +{ + WebFrame* frame = WebProcess::shared().webFrame(frameID); + if (!frame) + return; + + Frame* coreFrame = frame->coreFrame(); + if (!coreFrame) + return; + + ASSERT(coreFrame->document()->printing()); + + RetainPtr<CFMutableDataRef> pdfPageData(AdoptCF, CFDataCreateMutable(0, 0)); + + // FIXME: Use CGDataConsumerCreate with callbacks to avoid copying the data. + RetainPtr<CGDataConsumerRef> pdfDataConsumer(AdoptCF, CGDataConsumerCreateWithCFData(pdfPageData.get())); + + 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); + + GraphicsContext ctx(context.get()); + m_printContext->spoolRect(ctx, rect); + + CGPDFContextEndPage(context.get()); + CGPDFContextClose(context.get()); + + pdfData.resize(CFDataGetLength(pdfPageData.get())); + CFDataGetBytes(pdfPageData.get(), CFRangeMake(0, pdfData.size()), pdfData.data()); +} +#endif + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h new file mode 100644 index 0000000..7649ab6 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -0,0 +1,499 @@ +/* + * 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 + * 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 WebPage_h +#define WebPage_h + +#include "APIObject.h" +#include "DrawingArea.h" +#include "FindController.h" +#include "GeolocationPermissionRequestManager.h" +#include "ImageOptions.h" +#include "InjectedBundlePageContextMenuClient.h" +#include "InjectedBundlePageEditorClient.h" +#include "InjectedBundlePageFormClient.h" +#include "InjectedBundlePageLoaderClient.h" +#include "InjectedBundlePageUIClient.h" +#include "MessageSender.h" +#include "Plugin.h" +#include "SandboxExtension.h" +#include "WebEditCommand.h" +#include <WebCore/Editor.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/IntRect.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +#if ENABLE(TOUCH_EVENTS) +#include <WebCore/PlatformTouchEvent.h> +#endif + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#ifdef __OBJC__ +@class AccessibilityWebPageObject; +#else +class AccessibilityWebPageObject; +#endif +#endif + +namespace CoreIPC { + class ArgumentDecoder; + class Connection; + class MessageID; +} + +namespace WebCore { + class GraphicsContext; + class KeyboardEvent; + class Page; + class PrintContext; + class ResourceRequest; + class SharedBuffer; +} + +namespace WebKit { + +class DrawingArea; +class InjectedBundleBackForwardList; +class PageOverlay; +class PluginView; +class SessionState; +class WebContextMenu; +class WebContextMenuItemData; +class WebEvent; +class WebFrame; +class WebImage; +class WebInspector; +class WebKeyboardEvent; +class WebMouseEvent; +class WebOpenPanelResultListener; +class WebPageGroupProxy; +class WebPopupMenu; +class WebWheelEvent; +struct PrintInfo; +struct WebPageCreationParameters; +struct WebPreferencesStore; + +#if ENABLE(TOUCH_EVENTS) +class WebTouchEvent; +#endif + +class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> { +public: + static const Type APIType = TypeBundlePage; + + static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&); + virtual ~WebPage(); + + // Used by MessageSender. + CoreIPC::Connection* connection() const; + uint64_t destinationID() const { return pageID(); } + + void close(); + + WebCore::Page* corePage() const { return m_page.get(); } + uint64_t pageID() const { return m_pageID; } + + void setSize(const WebCore::IntSize&); + const WebCore::IntSize& size() const { return m_viewSize; } + + InjectedBundleBackForwardList* backForwardList(); + DrawingArea* drawingArea() const { return m_drawingArea.get(); } + + WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); } + +#if ENABLE(INSPECTOR) + WebInspector* inspector(); +#endif + + // -- Called by the DrawingArea. + // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial? + void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&); + void layoutIfNeeded(); + + // -- Called from WebCore clients. +#if !PLATFORM(MAC) + bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*); +#endif + void show(); + String userAgent() const { return m_userAgent; } + WebCore::IntRect windowResizerRect() const; + bool tabsToLinks() const { return m_tabToLinks; } + + WebEditCommand* webEditCommand(uint64_t); + void addWebEditCommand(uint64_t, WebEditCommand*); + void removeWebEditCommand(uint64_t); + bool isInRedo() const { return m_isInRedo; } + + void setActivePopupMenu(WebPopupMenu*); + + WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); } + void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>); + + // -- Called from WebProcess. + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + // -- InjectedBundle methods + void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClient*); + void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*); + void initializeInjectedBundleFormClient(WKBundlePageFormClient*); + void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*); + void initializeInjectedBundleUIClient(WKBundlePageUIClient*); + + InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; } + InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; } + InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; } + InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; } + InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; } + + bool findStringFromInjectedBundle(const String&, FindOptions); + + WebFrame* mainFrame() const { return m_mainFrame.get(); } + PassRefPtr<Plugin> createPlugin(const Plugin::Parameters&); + + String renderTreeExternalRepresentation() const; + void executeEditingCommand(const String& commandName, const String& argument); + bool isEditingCommandEnabled(const String& commandName); + void clearMainFrameName(); + void sendClose(); + + double textZoomFactor() const; + void setTextZoomFactor(double); + double pageZoomFactor() const; + void setPageZoomFactor(double); + void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor); + + void scaleWebView(double scale, const WebCore::IntPoint& origin); + double viewScaleFactor() const; + + void setUseFixedLayout(bool); + void setFixedLayoutSize(const WebCore::IntSize&); + + bool drawsBackground() const { return m_drawsBackground; } + bool drawsTransparentBackground() const { return m_drawsTransparentBackground; } + + void stopLoading(); + void setDefersLoading(bool deferLoading); + +#if USE(ACCELERATED_COMPOSITING) + void changeAcceleratedCompositingMode(WebCore::GraphicsLayer*); + void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*); + void exitAcceleratedCompositingMode(); +#endif + +#if PLATFORM(MAC) + void addPluginView(PluginView*); + void removePluginView(PluginView*); + + bool windowIsVisible() const { return m_windowIsVisible; } + const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; } + const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; } + bool windowIsFocused() const; + bool interceptEditingKeyboardEvent(WebCore::KeyboardEvent*, bool); +#elif PLATFORM(WIN) + HWND nativeWindow() const { return m_nativeWindow; } +#endif + + void installPageOverlay(PassRefPtr<PageOverlay>); + void uninstallPageOverlay(PageOverlay*); + + PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions); + PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions); + + static const WebEvent* currentEvent(); + + FindController& findController() { return m_findController; } + GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; } + + void pageDidScroll(); +#if ENABLE(TILED_BACKING_STORE) + void pageDidRequestScroll(const WebCore::IntSize& delta); + void setActualVisibleContentRect(const WebCore::IntRect&); + + bool resizesToContentsEnabled() const { return !m_resizesToContentsLayoutSize.isEmpty(); } + WebCore::IntSize resizesToContentsLayoutSize() const { return m_resizesToContentsLayoutSize; } + void setResizesToContentsUsingLayoutSize(const WebCore::IntSize& targetLayoutSize); + void resizeToContentsIfNeeded(); +#endif + + WebContextMenu* contextMenu(); + + bool hasLocalDataForURL(const WebCore::KURL&); + + static bool canHandleRequest(const WebCore::ResourceRequest&); + + class SandboxExtensionTracker { + public: + ~SandboxExtensionTracker(); + + void invalidate(); + + void beginLoad(WebFrame*, const SandboxExtension::Handle& handle); + void didStartProvisionalLoad(WebFrame*); + void didCommitProvisionalLoad(WebFrame*); + void didFailProvisionalLoad(WebFrame*); + private: + RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension; + RefPtr<SandboxExtension> m_provisionalSandboxExtension; + RefPtr<SandboxExtension> m_committedSandboxExtension; + }; + + SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; } + + static void getLocationAndLengthFromRange(WebCore::Range*, uint64_t& location, uint64_t& length); + +#if PLATFORM(MAC) + void sendAccessibilityPresenterToken(const CoreIPC::DataReference&); + AccessibilityWebPageObject* accessibilityRemoteObject(); + WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; } + + void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput); + + void getMarkedRange(uint64_t& location, uint64_t& length); + void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result); + void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect); +#elif PLATFORM(WIN) + void confirmComposition(const String& compositionString); + void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition); + void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect); + void getSelectedText(WTF::String&); +#endif + + // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require + // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed. + void dummy(bool&); + +#if PLATFORM(MAC) + bool isSpeaking(); + void speak(const String&); + void stopSpeaking(); + + bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } +#endif + + void replaceSelectionWithText(WebCore::Frame*, const String&); + void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags); + + void beginPrinting(uint64_t frameID, const PrintInfo&); + void endPrinting(); + void computePagesForPrinting(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects, double& resultTotalScaleFactorForPrinting); +#if PLATFORM(MAC) + void drawRectToPDF(uint64_t frameID, const WebCore::IntRect&, Vector<uint8_t>& pdfData); +#endif + + bool mainFrameHasCustomRepresentation() const; + +private: + WebPage(uint64_t pageID, const WebPageCreationParameters&); + + virtual Type type() const { return APIType; } + + void platformInitialize(); + + void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + + static const char* interpretKeyEvent(const WebCore::KeyboardEvent*); + bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&); + + String sourceForFrame(WebFrame*); + + void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL); + + bool platformHasLocalDataForURL(const WebCore::KURL&); + + // Actions + void tryClose(); + void loadURL(const String&, const SandboxExtension::Handle& sandboxExtensionHandle); + void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle& sandboxExtensionHandle); + 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 setActive(bool); + void setFocused(bool); + void setInitialFocus(bool); + void setWindowResizerSize(const WebCore::IntSize&); + void setIsInWindow(bool); + void mouseEvent(const WebMouseEvent&); + void wheelEvent(const WebWheelEvent&); + void keyEvent(const WebKeyboardEvent&); + void validateMenuItem(const String&); + void executeEditCommand(const String&); +#if ENABLE(TOUCH_EVENTS) + void touchEvent(const WebTouchEvent&); +#endif + + uint64_t restoreSession(const SessionState&); + void restoreSessionAndNavigateToCurrentItem(const SessionState&); + + void didRemoveBackForwardItem(uint64_t); + + void setDrawsBackground(bool); + void setDrawsTransparentBackground(bool); + + void getContentsAsString(uint64_t callbackID); + void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID); + void getRenderTreeExternalRepresentation(uint64_t callbackID); + void getSelectionOrContentsAsString(uint64_t callbackID); + void getSourceForFrame(uint64_t frameID, uint64_t callbackID); + void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID); + void runJavaScriptInMainFrame(const String&, uint64_t callbackID); + + void preferencesDidChange(const WebPreferencesStore&); + void platformPreferencesDidChange(const WebPreferencesStore&); + void updatePreferences(const WebPreferencesStore&); + + void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID); + void setUserAgent(const String&); + void setCustomTextEncodingName(const String&); + +#if PLATFORM(MAC) + void setWindowIsVisible(bool windowIsVisible); + void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates); +#endif + + void unapplyEditCommand(uint64_t commandID); + void reapplyEditCommand(uint64_t commandID); + void didRemoveEditCommand(uint64_t commandID); + + void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount); + void hideFindUI(); + void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount); + +#if PLATFORM(QT) + void findZoomableAreaForPoint(const WebCore::IntPoint&); +#endif + + void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex); + void setTextForActivePopupMenu(int32_t index); + + void didChooseFilesForOpenPanel(const Vector<String>&); + void didCancelForOpenPanel(); + + void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed); + + void advanceToNextMisspelling(bool startBeforeSelection); + void changeSpellingToWord(const String& word); + void unmarkAllMisspellings(); + void unmarkAllBadGrammar(); +#if PLATFORM(MAC) + void uppercaseWord(); + void lowercaseWord(); + void capitalizeWord(); + + void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; } +#endif + +#if ENABLE(CONTEXT_MENUS) + void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&); +#endif + + OwnPtr<WebCore::Page> m_page; + RefPtr<WebFrame> m_mainFrame; + RefPtr<InjectedBundleBackForwardList> m_backForwardList; + + RefPtr<WebPageGroupProxy> m_pageGroup; + + String m_userAgent; + + WebCore::IntSize m_viewSize; + RefPtr<DrawingArea> m_drawingArea; + + bool m_drawsBackground; + bool m_drawsTransparentBackground; + + bool m_isInRedo; + bool m_isClosed; + + bool m_tabToLinks; + +#if PLATFORM(MAC) + // Whether the containing window is visible or not. + bool m_windowIsVisible; + + // Whether smart insert/delete is enabled or not. + bool m_isSmartInsertDeleteEnabled; + + // The frame of the containing window in screen coordinates. + WebCore::IntRect m_windowFrameInScreenCoordinates; + + // The frame of the view in window coordinates. + WebCore::IntRect m_viewFrameInWindowCoordinates; + + // The accessibility position of the view. + WebCore::IntPoint m_accessibilityPosition; + + // All plug-in views on this web page. + HashSet<PluginView*> m_pluginViews; + + RetainPtr<AccessibilityWebPageObject> m_mockAccessibilityElement; +#elif PLATFORM(WIN) + // Our view's window (in the UI process). + HWND m_nativeWindow; +#endif + + HashMap<uint64_t, RefPtr<WebEditCommand> > m_editCommandMap; + + WebCore::IntSize m_windowResizerSize; + + InjectedBundlePageContextMenuClient m_contextMenuClient; + InjectedBundlePageEditorClient m_editorClient; + InjectedBundlePageFormClient m_formClient; + InjectedBundlePageLoaderClient m_loaderClient; + InjectedBundlePageUIClient m_uiClient; + +#if ENABLE(TILED_BACKING_STORE) + WebCore::IntSize m_resizesToContentsLayoutSize; +#endif + + FindController m_findController; + RefPtr<PageOverlay> m_pageOverlay; + +#if ENABLE(INSPECTOR) + OwnPtr<WebInspector> m_inspector; +#endif + RefPtr<WebPopupMenu> m_activePopupMenu; + RefPtr<WebContextMenu> m_contextMenu; + RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener; + GeolocationPermissionRequestManager m_geolocationPermissionRequestManager; + + OwnPtr<WebCore::PrintContext> m_printContext; + + SandboxExtensionTracker m_sandboxExtensionTracker; + uint64_t m_pageID; +}; + +} // namespace WebKit + +#endif // WebPage_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in new file mode 100644 index 0000000..bd6bf1a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -0,0 +1,163 @@ +# 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. + +messages -> WebPage { + SetActive(bool active) + SetFocused(bool focused) + SetInitialFocus(bool forward) + SetIsInWindow(bool isInWindow) + + SetDrawsBackground(bool drawsBackground) + SetDrawsTransparentBackground(bool drawsTransparentBackground) + + KeyEvent(WebKit::WebKeyboardEvent event) + MouseEvent(WebKit::WebMouseEvent event) + WheelEvent(WebKit::WebWheelEvent event) +#if ENABLE(TOUCH_EVENTS) + TouchEvent(WebKit::WebTouchEvent event) +#endif + + GoBack(uint64_t backForwardItemID) + GoForward(uint64_t backForwardItemID) + GoToBackForwardItem(uint64_t backForwardItemID) + LoadHTMLString(WTF::String htmlString, WTF::String baseURL) + LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL); + LoadPlainTextString(WTF::String string) + LoadURL(WTF::String url, WebKit::SandboxExtension::Handle sandboxExtensionHandle) + LoadURLRequest(WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle) + Reload(bool reloadFromOrigin) + StopLoading() + + RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state) + + DidRemoveBackForwardItem(uint64_t backForwardItemID) + + DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID) + + # Callbacks. + GetContentsAsString(uint64_t callbackID) + GetMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID) + GetRenderTreeExternalRepresentation(uint64_t callbackID) + GetSelectionOrContentsAsString(uint64_t callbackID) + GetSourceForFrame(uint64_t frameID, uint64_t callbackID) + GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID) + RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID) + + PreferencesDidChange(WebKit::WebPreferencesStore store) + + SetUserAgent(WTF::String userAgent) + SetCustomTextEncodingName(WTF::String encodingName) + +#if ENABLE(TILED_BACKING_STORE) + SetActualVisibleContentRect(WebCore::IntRect rect) + SetResizesToContentsUsingLayoutSize(WebCore::IntSize size) +#endif + + Close() + TryClose() + + ValidateMenuItem(WTF::String name) + ExecuteEditCommand(WTF::String name) + + DidRemoveEditCommand(uint64_t commandID) + ReapplyEditCommand(uint64_t commandID) + UnapplyEditCommand(uint64_t commandID) + + SetPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor) + SetPageZoomFactor(double zoomFactor) + SetTextZoomFactor(double zoomFactor) + + ScaleWebView(double scale, WebCore::IntPoint origin) + + SetUseFixedLayout(bool fixed) + SetFixedLayoutSize(WebCore::IntSize size) + + # Find. + FindString(WTF::String string, uint32_t findOptions, unsigned maxMatchCount) + HideFindUI() + CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount) + + # Drag and drop. + PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags) + + # Popup menu. + DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex); + SetTextForActivePopupMenu(int32_t index); + + # Context menu. + DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItemData menuItem); + + # Open panel. + DidChooseFilesForOpenPanel(Vector<WTF::String> fileURLs) + DidCancelForOpenPanel() + + # Spelling and grammar. + AdvanceToNextMisspelling(bool startBeforeSelection) + ChangeSpellingToWord(WTF::String word) + UnmarkAllMisspellings() + UnmarkAllBadGrammar() +#if PLATFORM(MAC) + UppercaseWord(); + LowercaseWord(); + CapitalizeWord(); + + SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled); +#endif + + # Geolocation + DidReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) + + SetWindowResizerSize(WebCore::IntSize intersectsView) + + # Printing. + BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo); + EndPrinting(); + ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo) -> (Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting) +#if PLATFORM(MAC) + DrawRectToPDF(uint64_t frameID, WebCore::IntRect rect) -> (Vector<uint8_t> pdfData) +#endif + + // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require + // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed. + Dummy() -> (bool dummyReturn) + +#if PLATFORM(MAC) + # Complex text input support for plug-ins. + SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput) + + SetWindowIsVisible(bool windowIsVisible) + WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates, WebCore::IntPoint accessibilityViewCoordinates) + 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) +#endif +#if PLATFORM(WIN) + ConfirmComposition(WTF::String compositionString) + SetComposition(WTF::String compositionString, WTF::Vector<WebCore::CompositionUnderline> underlines, uint64_t cursorPosition) + FirstRectForCharacterInSelectedRange(uint64_t characterPosition) -> (WebCore::IntRect resultRect) + GetSelectedText() -> (WTF::String text) +#endif +#if PLATFORM(QT) + FindZoomableAreaForPoint(WebCore::IntPoint point) +#endif +} diff --git a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp new file mode 100644 index 0000000..67109ec --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPageGroupProxy.h" + +#include "WebProcess.h" +#include "InjectedBundle.h" + +namespace WebKit { + +PassRefPtr<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data) +{ + RefPtr<WebPageGroupProxy> pageGroup = adoptRef(new WebPageGroupProxy(data)); + + if (pageGroup->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle()) + WebProcess::shared().injectedBundle()->didInitializePageGroup(pageGroup.get()); + + return pageGroup.release(); +} + +WebPageGroupProxy::~WebPageGroupProxy() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h new file mode 100644 index 0000000..55cf629 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.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 WebPageGroupProxy_h +#define WebPageGroupProxy_h + +#include "APIObject.h" +#include "WebPageGroupData.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebPageGroupProxy : public APIObject { +public: + static const Type APIType = TypeBundlePageGroup; + + static PassRefPtr<WebPageGroupProxy> create(const WebPageGroupData&); + virtual ~WebPageGroupProxy(); + + const String& identifier() const { return m_data.identifer; } + uint64_t pageGroupID() const { return m_data.pageGroupID; } + bool isVisibleToInjectedBundle() const { return m_data.visibleToInjectedBundle; } + +private: + WebPageGroupProxy(const WebPageGroupData& data) + : m_data(data) + { + } + + virtual Type type() const { return APIType; } + + WebPageGroupData m_data; +}; + +} // namespace WebKit + +#endif // WebPageGroupProxy_h diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp new file mode 100644 index 0000000..4697f62 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspector.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +namespace WebKit { + +String WebInspector::localizedStringsURL() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h new file mode 100644 index 0000000..3b331b9 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h @@ -0,0 +1,47 @@ +/* + * 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 AccessibilityWebPageObject_h +#define AccessibilityWebPageObject_h + +namespace WebKit { +class WebPage; +} + +@interface AccessibilityWebPageObject : NSObject { + WebKit::WebPage* m_page; + + id m_parent; + NSArray* m_attributeNames; + NSMutableArray* m_accessibilityChildren; +} + +- (void)setWebPage:(WebKit::WebPage*)page; + +- (void)setRemoteParent:(id)parent; + +@end + +#endif // AccessibilityWebPageObject_h diff --git a/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm new file mode 100644 index 0000000..fa4aa1a --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm @@ -0,0 +1,190 @@ +/* + * 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 "AccessibilityWebPageObject.h" + +#import "WebFrame.h" +#import "WebPage.h" +#import <WebCore/AXObjectCache.h> +#import <WebCore/Frame.h> +#import <WebCore/FrameView.h> +#import <WebCore/ScrollView.h> +#import <WebCore/Scrollbar.h> + +using namespace WebCore; +using namespace WebKit; + +@implementation AccessibilityWebPageObject + +- (id)accessibilityRootObjectWrapper +{ + WebCore::Page* page = m_page->corePage(); + if (!page) + return nil; + + WebCore::Frame* core = page->mainFrame(); + if (!core || !core->document()) + return nil; + + AccessibilityObject* root = core->document()->axObjectCache()->rootObject(); + if (!root) + return nil; + + return root->wrapper(); +} + +- (void)setWebPage:(WebPage*)page +{ + m_page = page; +} + +- (void)setRemoteParent:(id)parent +{ + if (parent != m_parent) { + [m_parent release]; + m_parent = [parent retain]; + } +} + +- (void)dealloc +{ + [m_accessibilityChildren release]; + [m_attributeNames release]; + [m_parent release]; + [super dealloc]; +} + +- (BOOL)accessibilityIsIgnored +{ + return NO; +} + +- (NSArray *)accessibilityAttributeNames +{ + if (!m_attributeNames) + m_attributeNames = [[NSArray alloc] initWithObjects: + NSAccessibilityRoleAttribute, NSAccessibilityRoleDescriptionAttribute, NSAccessibilityFocusedAttribute, + NSAccessibilityParentAttribute, NSAccessibilityWindowAttribute, NSAccessibilityTopLevelUIElementAttribute, + NSAccessibilityPositionAttribute, NSAccessibilitySizeAttribute, NSAccessibilityChildrenAttribute, nil]; + + return m_attributeNames; +} + +- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute +{ + return NO; +} + +- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute +{ + return; +} + +- (NSArray *)accessibilityActionNames +{ + return [NSArray array]; +} + +- (NSArray *)accessibilityChildren +{ + id wrapper = [self accessibilityRootObjectWrapper]; + if (!wrapper) + return [NSArray array]; + + return [NSArray arrayWithObject:wrapper]; +} + +- (id)accessibilityAttributeValue:(NSString *)attribute +{ + if (!WebCore::AXObjectCache::accessibilityEnabled()) + WebCore::AXObjectCache::enableAccessibility(); + + if ([attribute isEqualToString:NSAccessibilityParentAttribute]) + return m_parent; + if ([attribute isEqualToString:NSAccessibilityWindowAttribute]) + return [m_parent accessibilityAttributeValue:NSAccessibilityWindowAttribute]; + if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute]) + return [m_parent accessibilityAttributeValue:NSAccessibilityTopLevelUIElementAttribute]; + if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) + return NSAccessibilityGroupRole; + if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) + return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil); + if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) + return [NSNumber numberWithBool:NO]; + + if (!m_page) + return nil; + + if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) { + WebCore::IntPoint point = m_page->accessibilityPosition(); + return [NSValue valueWithPoint:NSMakePoint(point.x(), point.y())]; + } + if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) { + const IntSize& s = m_page->size(); + return [NSValue valueWithSize:NSMakeSize(s.width(), s.height())]; + } + if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) + return [self accessibilityChildren]; + + return [super accessibilityAttributeValue:attribute]; +} + +- (BOOL)accessibilityShouldUseUniqueId +{ + return YES; +} + +- (id)accessibilityHitTest:(NSPoint)point +{ + // Hit-test point comes in as bottom-screen coordinates. Needs to be normalized to the frame of the web page. + NSPoint remotePosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue]; + NSSize remoteSize = [[self accessibilityAttributeValue:NSAccessibilitySizeAttribute] sizeValue]; + + // Get the y position of the WKView (we have to screen-flip and go from bottom left to top left). + CGFloat screenHeight = [[[NSScreen screens] objectAtIndex:0] frame].size.height; + remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height; + + point.y = screenHeight - point.y; + + // Re-center point into the web page's frame. + point.y -= remotePosition.y; + point.x -= remotePosition.x; + + WebCore::FrameView* fv = m_page->mainFrame()->coreFrame()->view(); + if (fv) { + point.y += fv->scrollPosition().y(); + point.x += fv->scrollPosition().x(); + } + + return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point]; +} + +- (id)accessibilityFocusedUIElement +{ + return NSAccessibilityUnignoredDescendant(self); +} + + +@end diff --git a/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp new file mode 100644 index 0000000..6bcecfd --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingArea.h" + +#include "UpdateChunk.h" +#include "WebFrame.h" +#include "WebPage.h" +#include "WebFrameLoaderClient.h" +#include <WebCore/Frame.h> +#include <WebCore/GraphicsContext.h> +#include <wtf/RetainPtr.h> + +using namespace WebCore; + +namespace WebKit { + +void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk) +{ + // FIXME: It would be better if we could avoid painting altogether when there is a custom representation. + if (m_webPage->mainFrameHasCustomRepresentation()) + return; + + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(updateChunk->data(), updateChunk->rect().width(), updateChunk->rect().height(), 8, updateChunk->rect().width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host)); + + // WebCore expects a flipped coordinate system. + CGContextTranslateCTM(bitmapContext.get(), 0.0, updateChunk->rect().height()); + CGContextScaleCTM(bitmapContext.get(), 1.0, -1.0); + + // Now paint into the backing store. + GraphicsContext graphicsContext(bitmapContext.get()); + graphicsContext.translate(-updateChunk->rect().x(), -updateChunk->rect().y()); + + m_webPage->drawRect(graphicsContext, updateChunk->rect()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm new file mode 100644 index 0000000..f8b7e71 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm @@ -0,0 +1,185 @@ +/* + * 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. + */ + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerBackedDrawingArea.h" + +#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> + +using namespace WebCore; + +namespace WebKit { + +void LayerBackedDrawingArea::platformInit() +{ + setUpUpdateLayoutRunLoopObserver(); + + [m_backingLayer->platformLayer() setGeometryFlipped:YES]; +#if HAVE(HOSTED_CORE_ANIMATION) + attachCompositingContext(); +#endif + + scheduleCompositingLayerSync(); +} + +void LayerBackedDrawingArea::platformClear() +{ + if (!m_attached) + return; + + if (m_updateLayoutRunLoopObserver) { + CFRunLoopObserverInvalidate(m_updateLayoutRunLoopObserver.get()); + m_updateLayoutRunLoopObserver = 0; + } + +#if HAVE(HOSTED_CORE_ANIMATION) + WKCARemoteLayerClientInvalidate(m_remoteLayerRef.get()); + m_remoteLayerRef = nullptr; +#endif + + m_attached = false; +} + +void LayerBackedDrawingArea::attachCompositingContext() +{ + if (m_attached) + return; + + m_attached = true; + +#if HAVE(HOSTED_CORE_ANIMATION) + mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort(); + m_remoteLayerRef = WKCARemoteLayerClientMakeWithServerPort(serverPort); + WKCARemoteLayerClientSetLayer(m_remoteLayerRef.get(), m_backingLayer->platformLayer()); + + uint32_t contextID = WKCARemoteLayerClientGetClientId(m_remoteLayerRef.get()); + WebProcess::shared().connection()->sendSync(DrawingAreaProxyLegacyMessage::AttachCompositingContext, m_webPage->pageID(), CoreIPC::In(contextID), CoreIPC::Out()); +#endif +} + +void LayerBackedDrawingArea::detachCompositingContext() +{ + m_backingLayer->removeAllChildren(); + + scheduleCompositingLayerSync(); +} + +void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer* layer) +{ + m_backingLayer->removeAllChildren(); + if (layer) + m_backingLayer->addChild(layer); + + scheduleCompositingLayerSync(); +} + +void LayerBackedDrawingArea::scheduleCompositingLayerSync() +{ +// if (m_syncTimer.isActive()) +// return; +// +// m_syncTimer.startOneShot(0); + + scheduleUpdateLayoutRunLoopObserver(); +} + +void LayerBackedDrawingArea::syncCompositingLayers() +{ + m_backingLayer->syncCompositingStateForThisLayerOnly(); + + bool didSync = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateRecursive(); + if (!didSync) { + + } +} + +void LayerBackedDrawingArea::setUpUpdateLayoutRunLoopObserver() +{ + if (m_updateLayoutRunLoopObserver) + return; + + // Run before Core Animations commit observer, which has order 2000000. + const CFIndex runLoopOrder = 2000000 - 1; + CFRunLoopObserverContext context = { 0, this, 0, 0, 0 }; + m_updateLayoutRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, + kCFRunLoopBeforeWaiting | kCFRunLoopExit, true /* repeats */, + runLoopOrder, updateLayoutRunLoopObserverCallback, &context)); +} + +void LayerBackedDrawingArea::scheduleUpdateLayoutRunLoopObserver() +{ + CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent(); + CFRunLoopWakeUp(currentRunLoop); + + if (CFRunLoopContainsObserver(currentRunLoop, m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes)) + return; + + CFRunLoopAddObserver(currentRunLoop, m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes); +} + +void LayerBackedDrawingArea::removeUpdateLayoutRunLoopObserver() +{ + // FIXME: cache the run loop ref? + CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), m_updateLayoutRunLoopObserver.get(), kCFRunLoopCommonModes); +} + +void LayerBackedDrawingArea::updateLayoutRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* info) +{ + // Keep the drawing area alive while running the callback, since that does layout, + // which might replace this drawing area with one of another type. + RefPtr<LayerBackedDrawingArea> drawingArea = reinterpret_cast<LayerBackedDrawingArea*>(info); + drawingArea->updateLayoutRunLoopObserverFired(); +} + +void LayerBackedDrawingArea::updateLayoutRunLoopObserverFired() +{ + // Laying out the page can cause the drawing area to change so we keep an extra reference. + RefPtr<LayerBackedDrawingArea> protect(this); + + m_webPage->layoutIfNeeded(); + + if (m_webPage->drawingArea() != this) + return; + + if (m_attached) + syncCompositingLayers(); +} + +void LayerBackedDrawingArea::onPageClose() +{ + platformClear(); +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm new file mode 100644 index 0000000..83909be --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebInspector.h" + +#import <wtf/text/WTFString.h> + +namespace WebKit { + +String WebInspector::localizedStringsURL() const +{ + NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"localizedStrings" ofType:@"js"]; + if (path) + return [[NSURL fileURLWithPath:path] absoluteString]; + return String(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm new file mode 100644 index 0000000..f3211f2 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm @@ -0,0 +1,369 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "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> + +using namespace WebCore; + +namespace WebKit { + +void WebPage::platformInitialize() +{ + m_page->addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes)); + +#if !defined(BUILDING_ON_SNOW_LEOPARD) + AccessibilityWebPageObject* mockAccessibilityElement = [[[AccessibilityWebPageObject alloc] init] autorelease]; + + // Get the pid for the starting process. + pid_t pid = WebProcess::shared().presenterApplicationPid(); + WKAXInitializeElementWithPresenterPid(mockAccessibilityElement, pid); + [mockAccessibilityElement setWebPage:this]; + + // 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)); + m_mockAccessibilityElement = mockAccessibilityElement; +#endif +} + +void WebPage::platformPreferencesDidChange(const WebPreferencesStore&) +{ +} + +// FIXME: need to add support for input methods + +bool WebPage::interceptEditingKeyboardEvent(KeyboardEvent* evt, bool shouldSaveCommand) +{ + Node* node = evt->target()->toNode(); + ASSERT(node); + Frame* frame = node->document()->frame(); + ASSERT(frame); + + const PlatformKeyboardEvent* keyEvent = evt->keyEvent(); + if (!keyEvent) + return false; + const Vector<KeypressCommand>& commands = evt->keypressCommands(); + bool hasKeypressCommand = !commands.isEmpty(); + + bool eventWasHandled = false; + + if (shouldSaveCommand || !hasKeypressCommand) { + Vector<KeypressCommand> commandsList; + Vector<CompositionUnderline> underlines; + unsigned start; + unsigned end; + if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::InterpretKeyEvent(keyEvent->type()), + Messages::WebPageProxy::InterpretKeyEvent::Reply(commandsList, start, end, underlines), + m_pageID, CoreIPC::Connection::NoTimeout)) + return false; + if (commandsList.isEmpty()) + return eventWasHandled; + + if (commandsList[0].commandName == "setMarkedText") { + frame->editor()->setComposition(commandsList[0].text, underlines, start, end); + eventWasHandled = true; + } else if (commandsList[0].commandName == "insertText" && frame->editor()->hasComposition()) { + frame->editor()->confirmComposition(commandsList[0].text); + eventWasHandled = true; + } else if (commandsList[0].commandName == "unmarkText") { + frame->editor()->confirmComposition(); + eventWasHandled = true; + } else { + for (size_t i = 0; i < commandsList.size(); i++) + evt->keypressCommands().append(commandsList[i]); + } + } else { + size_t size = commands.size(); + // Are there commands that would just cause text insertion if executed via Editor? + // WebKit doesn't have enough information about mode to decide how they should be treated, so we leave it upon WebCore + // to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated + // (e.g. Tab that inserts a Tab character, or Enter). + bool haveTextInsertionCommands = false; + for (size_t i = 0; i < size; ++i) { + if (frame->editor()->command(commands[i].commandName).isTextInsertion()) + haveTextInsertionCommands = true; + } + if (!haveTextInsertionCommands || keyEvent->type() == PlatformKeyboardEvent::Char) { + for (size_t i = 0; i < size; ++i) { + if (commands[i].commandName == "insertText") { + // Don't insert null or control characters as they can result in unexpected behaviour + if (evt->charCode() < ' ') + return false; + eventWasHandled = frame->editor()->insertText(commands[i].text, evt); + } else + if (frame->editor()->command(commands[i].commandName).isSupported()) + eventWasHandled = frame->editor()->command(commands[i].commandName).execute(evt); + } + } + } + return eventWasHandled; +} + +void WebPage::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput) +{ + for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) { + if ((*it)->sendComplexTextInput(pluginComplexTextInputIdentifier, textInput)) + break; + } +} + +void WebPage::getMarkedRange(uint64_t& location, uint64_t& length) +{ + location = NSNotFound; + length = 0; + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return; + + getLocationAndLengthFromRange(frame->editor()->compositionRange().get(), location, length); +} + +static Range *characterRangeAtPoint(Frame* frame, const IntPoint point) +{ + VisiblePosition position = frame->visiblePositionForPoint(point); + if (position.isNull()) + return NULL; + + VisiblePosition previous = position.previous(); + if (previous.isNotNull()) { + Range *previousCharacterRange = makeRange(previous, position).get(); + NSRect rect = frame->editor()->firstRectForRange(previousCharacterRange); + if (NSPointInRect(point, rect)) + return previousCharacterRange; + } + + VisiblePosition next = position.next(); + if (next.isNotNull()) { + Range *nextCharacterRange = makeRange(position, next).get(); + NSRect rect = frame->editor()->firstRectForRange(nextCharacterRange); + if (NSPointInRect(point, rect)) + return nextCharacterRange; + } + + return NULL; +} + +void WebPage::characterIndexForPoint(IntPoint point, uint64_t& index) +{ + index = NSNotFound; + Frame* frame = m_page->mainFrame(); + if (!frame) + return; + + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false); + frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame(); + + Range *range = characterRangeAtPoint(frame, result.point()); + if (!range) + return; + + uint64_t length; + getLocationAndLengthFromRange(range, index, length); +} + +static PassRefPtr<Range> convertToRange(Frame* frame, NSRange nsrange) +{ + if (nsrange.location > INT_MAX) + return 0; + if (nsrange.length > INT_MAX || nsrange.location + nsrange.length > INT_MAX) + nsrange.length = INT_MAX - nsrange.location; + + // our critical assumption is that we are only called by input methods that + // concentrate on a given area containing the selection + // We have to do this because of text fields and textareas. The DOM for those is not + // directly in the document DOM, so serialization is problematic. Our solution is + // to use the root editable element of the selection start as the positional base. + // That fits with AppKit's idea of an input context. + Element* selectionRoot = frame->selection()->rootEditableElement(); + Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement(); + return TextIterator::rangeFromLocationAndLength(scope, nsrange.location, nsrange.length); +} + +void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + resultRect.setLocation(IntPoint(0, 0)); + resultRect.setSize(IntSize(0, 0)); + + RefPtr<Range> range = convertToRange(frame, NSMakeRange(location, length)); + if (range) { + ASSERT(range->startContainer()); + ASSERT(range->endContainer()); + } + + IntRect rect = frame->editor()->firstRectForRange(range.get()); + resultRect = frame->view()->contentsToWindow(rect); +} + +static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity); +} + +static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity); +} + +bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent) +{ + if (keyboardEvent.type() != WebEvent::KeyDown) + return false; + + // FIXME: This should be in WebCore. + + switch (keyboardEvent.windowsVirtualKeyCode()) { + case VK_BACK: + if (keyboardEvent.shiftKey()) + m_page->goForward(); + else + m_page->goBack(); + break; + case VK_SPACE: + if (keyboardEvent.shiftKey()) + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); + else + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); + break; + case VK_PRIOR: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); + break; + case VK_NEXT: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); + break; + case VK_HOME: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByDocument); + break; + case VK_END: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByDocument); + break; + case VK_UP: + if (keyboardEvent.shiftKey()) + return false; + if (keyboardEvent.metaKey()) { + scroll(m_page.get(), ScrollUp, ScrollByDocument); + scroll(m_page.get(), ScrollLeft, ScrollByDocument); + } else if (keyboardEvent.altKey() || keyboardEvent.controlKey()) + scroll(m_page.get(), ScrollUp, ScrollByPage); + else + scroll(m_page.get(), ScrollUp, ScrollByLine); + break; + case VK_DOWN: + if (keyboardEvent.shiftKey()) + return false; + if (keyboardEvent.metaKey()) { + scroll(m_page.get(), ScrollDown, ScrollByDocument); + scroll(m_page.get(), ScrollLeft, ScrollByDocument); + } else if (keyboardEvent.altKey() || keyboardEvent.controlKey()) + scroll(m_page.get(), ScrollDown, ScrollByPage); + else + scroll(m_page.get(), ScrollDown, ScrollByLine); + break; + case VK_LEFT: + if (keyboardEvent.shiftKey()) + return false; + if (keyboardEvent.metaKey()) + m_page->goBack(); + else { + if (keyboardEvent.altKey() | keyboardEvent.controlKey()) + scroll(m_page.get(), ScrollLeft, ScrollByPage); + else + scroll(m_page.get(), ScrollLeft, ScrollByLine); + } + break; + case VK_RIGHT: + if (keyboardEvent.shiftKey()) + return false; + if (keyboardEvent.metaKey()) + m_page->goForward(); + else { + if (keyboardEvent.altKey() || keyboardEvent.controlKey()) + scroll(m_page.get(), ScrollRight, ScrollByPage); + else + scroll(m_page.get(), ScrollRight, ScrollByLine); + } + break; + default: + return false; + } + + return true; +} + +void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data) +{ +#if !defined(BUILDING_ON_SNOW_LEOPARD) + NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()]; + [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)]; +#endif +} + +AccessibilityWebPageObject* WebPage::accessibilityRemoteObject() +{ + return m_mockAccessibilityElement.get(); +} + +bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url) +{ + NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url]; + [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"]; + NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request]; + [request release]; + + return cachedResponse; +} + +bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) +{ + if ([NSURLConnection canHandleRequest:request.nsURLRequest()]) + return YES; + + // FIXME: Return true if this scheme is any one WebKit2 knows how to handle. + return request.url().protocolIs("applewebdata"); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp new file mode 100644 index 0000000..25ed3e7 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp @@ -0,0 +1,50 @@ +/* + * 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 "ChunkedUpdateDrawingArea.h" + +#include "UpdateChunk.h" +#include "WebPage.h" +#include <QImage> +#include <QPainter> +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk) +{ + QImage image(updateChunk->createImage()); + QPainter painter(&image); + // Now paint into the backing store. + GraphicsContext graphicsContext(&painter); + graphicsContext.translate(-updateChunk->rect().x(), -updateChunk->rect().y()); + + m_webPage->drawRect(graphicsContext, updateChunk->rect()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp new file mode 100644 index 0000000..b7ad782 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#if ENABLE(TILED_BACKING_STORE) + +#include "TiledDrawingArea.h" + +#include "UpdateChunk.h" +#include "WebPage.h" +#include <WebCore/GraphicsContext.h> + +#include <QImage> +#include <QPainter> + +using namespace WebCore; + +namespace WebKit { + +void TiledDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk, float scale) +{ + IntRect tileRect = updateChunk->rect(); + QImage image(updateChunk->createImage()); + QPainter painter(&image); + // Now paint into the backing store. + GraphicsContext graphicsContext(&painter); + graphicsContext.translate(-tileRect.x(), -tileRect.y()); + graphicsContext.scale(FloatSize(scale, scale)); + IntRect contentRect = enclosingIntRect(FloatRect(tileRect.x() / scale, + tileRect.y() / scale, + tileRect.width() / scale, + tileRect.height() / scale)); + m_webPage->drawRect(graphicsContext, contentRect); +} + +} // namespace WebKit + +#endif // TILED_BACKING_STORE diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp new file mode 100644 index 0000000..99aa1eb --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspector.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +namespace WebKit { + +String WebInspector::localizedStringsURL() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp new file mode 100644 index 0000000..fe1a89c --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -0,0 +1,279 @@ +/* + * 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 "WebPage.h" + +#include "WebEvent.h" +#include <WebCore/FocusController.h> +#include <WebCore/Frame.h> +#include <WebCore/KeyboardEvent.h> +#include <WebCore/Page.h> +#include <WebCore/PlatformKeyboardEvent.h> +#include <WebCore/Settings.h> + +#ifndef VK_UNKNOWN +#define VK_UNKNOWN 0 +#define VK_BACK 0x08 +#define VK_TAB 0x09 +#define VK_CLEAR 0x0C +#define VK_RETURN 0x0D +#define VK_SHIFT 0x10 +#define VK_CONTROL 0x11 // CTRL key +#define VK_MENU 0x12 // ALT key +#define VK_PAUSE 0x13 // PAUSE key +#define VK_CAPITAL 0x14 // CAPS LOCK key +#define VK_KANA 0x15 // Input Method Editor (IME) Kana mode +#define VK_HANGUL 0x15 // IME Hangul mode +#define VK_JUNJA 0x17 // IME Junja mode +#define VK_FINAL 0x18 // IME final mode +#define VK_HANJA 0x19 // IME Hanja mode +#define VK_KANJI 0x19 // IME Kanji mode +#define VK_ESCAPE 0x1B // ESC key +#define VK_CONVERT 0x1C // IME convert +#define VK_NONCONVERT 0x1D // IME nonconvert +#define VK_ACCEPT 0x1E // IME accept +#define VK_MODECHANGE 0x1F // IME mode change request +#define VK_SPACE 0x20 // SPACE key +#define VK_PRIOR 0x21 // PAGE UP key +#define VK_NEXT 0x22 // PAGE DOWN key +#define VK_END 0x23 // END key +#define VK_HOME 0x24 // HOME key +#define VK_LEFT 0x25 // LEFT ARROW key +#define VK_UP 0x26 // UP ARROW key +#define VK_RIGHT 0x27 // RIGHT ARROW key +#define VK_DOWN 0x28 // DOWN ARROW key +#define VK_SELECT 0x29 // SELECT key +#define VK_PRINT 0x2A // PRINT key +#define VK_EXECUTE 0x2B // EXECUTE key +#define VK_SNAPSHOT 0x2C // PRINT SCREEN key +#define VK_INSERT 0x2D // INS key +#define VK_DELETE 0x2E // DEL key +#define VK_HELP 0x2F // HELP key +// Windows 2000/XP: For any country/region, the '.' key +#define VK_OEM_PERIOD 0xBE +#endif + +using namespace WebCore; + +namespace WebKit { + +void WebPage::platformInitialize() +{ +} + +void WebPage::platformPreferencesDidChange(const WebPreferencesStore&) +{ +} + +static const unsigned CtrlKey = 1 << 0; +static const unsigned AltKey = 1 << 1; +static const unsigned ShiftKey = 1 << 2; + +struct KeyDownEntry { + unsigned virtualKey; + unsigned modifiers; + const char* name; +}; + +struct KeyPressEntry { + unsigned charCode; + unsigned modifiers; + const char* name; +}; + +static const KeyDownEntry keyDownEntries[] = { + { VK_LEFT, 0, "MoveLeft" }, + { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" }, + { VK_LEFT, CtrlKey, "MoveWordLeft" }, + { VK_LEFT, CtrlKey | ShiftKey, "MoveWordLeftAndModifySelection" }, + { VK_RIGHT, 0, "MoveRight" }, + { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" }, + { VK_RIGHT, CtrlKey, "MoveWordRight" }, + { VK_RIGHT, CtrlKey | ShiftKey, "MoveWordRightAndModifySelection" }, + { VK_UP, 0, "MoveUp" }, + { VK_UP, ShiftKey, "MoveUpAndModifySelection" }, + { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" }, + { VK_DOWN, 0, "MoveDown" }, + { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" }, + { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" }, + { VK_PRIOR, 0, "MovePageUp" }, + { VK_NEXT, 0, "MovePageDown" }, + { VK_HOME, 0, "MoveToBeginningOfLine" }, + { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, + { VK_HOME, CtrlKey, "MoveToBeginningOfDocument" }, + { VK_HOME, CtrlKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" }, + + { VK_END, 0, "MoveToEndOfLine" }, + { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" }, + { VK_END, CtrlKey, "MoveToEndOfDocument" }, + { VK_END, CtrlKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" }, + + { VK_BACK, 0, "DeleteBackward" }, + { VK_BACK, ShiftKey, "DeleteBackward" }, + { VK_DELETE, 0, "DeleteForward" }, + { VK_BACK, CtrlKey, "DeleteWordBackward" }, + { VK_DELETE, CtrlKey, "DeleteWordForward" }, + + { 'B', CtrlKey, "ToggleBold" }, + { 'I', CtrlKey, "ToggleItalic" }, + + { VK_ESCAPE, 0, "Cancel" }, + { VK_OEM_PERIOD, CtrlKey, "Cancel" }, + { VK_TAB, 0, "InsertTab" }, + { VK_TAB, ShiftKey, "InsertBacktab" }, + { VK_RETURN, 0, "InsertNewline" }, + { VK_RETURN, CtrlKey, "InsertNewline" }, + { VK_RETURN, AltKey, "InsertNewline" }, + { VK_RETURN, ShiftKey, "InsertNewline" }, + { VK_RETURN, AltKey | ShiftKey, "InsertNewline" }, + + // It's not quite clear whether clipboard shortcuts and Undo/Redo should be handled + // in the application or in WebKit. We chose WebKit. + { 'C', CtrlKey, "Copy" }, + { 'V', CtrlKey, "Paste" }, + { 'X', CtrlKey, "Cut" }, + { 'A', CtrlKey, "SelectAll" }, + { VK_INSERT, CtrlKey, "Copy" }, + { VK_DELETE, ShiftKey, "Cut" }, + { VK_INSERT, ShiftKey, "Paste" }, + { 'Z', CtrlKey, "Undo" }, + { 'Z', CtrlKey | ShiftKey, "Redo" }, +}; + +static const KeyPressEntry keyPressEntries[] = { + { '\t', 0, "InsertTab" }, + { '\t', ShiftKey, "InsertBacktab" }, + { '\r', 0, "InsertNewline" }, + { '\r', CtrlKey, "InsertNewline" }, + { '\r', AltKey, "InsertNewline" }, + { '\r', ShiftKey, "InsertNewline" }, + { '\r', AltKey | ShiftKey, "InsertNewline" }, +}; + +const char* WebPage::interpretKeyEvent(const KeyboardEvent* evt) +{ + ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); + + static HashMap<int, const char*>* keyDownCommandsMap = 0; + static HashMap<int, const char*>* keyPressCommandsMap = 0; + + if (!keyDownCommandsMap) { + keyDownCommandsMap = new HashMap<int, const char*>; + keyPressCommandsMap = new HashMap<int, const char*>; + + for (unsigned i = 0; i < (sizeof(keyDownEntries) / sizeof(keyDownEntries[0])); i++) + keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name); + + for (unsigned i = 0; i < (sizeof(keyPressEntries) / sizeof(keyPressEntries[0])); i++) + keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name); + } + + unsigned modifiers = 0; + if (evt->shiftKey()) + modifiers |= ShiftKey; + if (evt->altKey()) + modifiers |= AltKey; + if (evt->ctrlKey()) + modifiers |= CtrlKey; + + if (evt->type() == eventNames().keydownEvent) { + int mapKey = modifiers << 16 | evt->keyEvent()->windowsVirtualKeyCode(); + return mapKey ? keyDownCommandsMap->get(mapKey) : 0; + } + + int mapKey = modifiers << 16 | evt->charCode(); + return mapKey ? keyPressCommandsMap->get(mapKey) : 0; +} + +static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity); +} + +static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity); +} + +bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent) +{ + if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown) + return false; + + switch (keyboardEvent.windowsVirtualKeyCode()) { + case VK_BACK: + if (keyboardEvent.shiftKey()) + m_page->goForward(); + else + m_page->goBack(); + break; + case VK_SPACE: + logicalScroll(m_page.get(), keyboardEvent.shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward, ScrollByPage); + break; + case VK_LEFT: + scroll(m_page.get(), ScrollLeft, ScrollByLine); + break; + case VK_RIGHT: + scroll(m_page.get(), ScrollRight, ScrollByLine); + break; + case VK_UP: + scroll(m_page.get(), ScrollUp, ScrollByLine); + break; + case VK_DOWN: + scroll(m_page.get(), ScrollDown, ScrollByLine); + break; + case VK_HOME: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByDocument); + break; + case VK_END: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByDocument); + break; + case VK_PRIOR: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); + break; + case VK_NEXT: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); + break; + default: + return false; + } + + return true; +} + +bool WebPage::platformHasLocalDataForURL(const WebCore::KURL&) +{ + // FIXME: Implement + return false; +} + +bool WebPage::canHandleRequest(const WebCore::ResourceRequest&) +{ + // FIXME: Implement + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp new file mode 100644 index 0000000..aa1f975 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/win/ChunkedUpdateDrawingAreaWin.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ChunkedUpdateDrawingArea.h" + +#include "UpdateChunk.h" +#include "WebPage.h" +#include <WebCore/BitmapInfo.h> +#include <WebCore/GraphicsContext.h> + +using namespace WebCore; + +namespace WebKit { + +void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk) +{ + OwnPtr<HDC> hdc(::CreateCompatibleDC(0)); + + void* bits; + BitmapInfo bmp = BitmapInfo::createBottomUp(updateChunk->rect().size()); + OwnPtr<HBITMAP> hbmp(::CreateDIBSection(0, &bmp, DIB_RGB_COLORS, &bits, updateChunk->memory(), 0)); + + HBITMAP hbmpOld = static_cast<HBITMAP>(::SelectObject(hdc.get(), hbmp.get())); + + GraphicsContext gc(hdc.get()); + gc.save(); + + // FIXME: Is this white fill needed? + RECT rect = updateChunk->rect(); + ::FillRect(hdc.get(), &rect, (HBRUSH)::GetStockObject(WHITE_BRUSH)); + gc.translate(-updateChunk->rect().x(), -updateChunk->rect().y()); + + m_webPage->drawRect(gc, updateChunk->rect()); + + gc.restore(); + + // Re-select the old HBITMAP + ::SelectObject(hdc.get(), hbmpOld); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp new file mode 100644 index 0000000..c07e1f5 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#if USE(ACCELERATED_COMPOSITING) + +#include "LayerBackedDrawingArea.h" + +#include "DrawingAreaProxyMessageKinds.h" +#include "WebPage.h" +#include "WebProcess.h" +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> +#include <WebCore/GraphicsLayer.h> +#include <WebCore/Page.h> +#include <WebCore/WKCACFLayerRenderer.h> +#include <WebCore/WebCoreInstanceHandle.h> + +using namespace WebCore; + +namespace WebKit { + +void LayerBackedDrawingArea::platformInit() +{ +} + +void LayerBackedDrawingArea::platformClear() +{ +} + +void LayerBackedDrawingArea::attachCompositingContext() +{ +} + +void LayerBackedDrawingArea::detachCompositingContext() +{ +} + +void LayerBackedDrawingArea::setRootCompositingLayer(WebCore::GraphicsLayer* layer) +{ +} + +void LayerBackedDrawingArea::scheduleCompositingLayerSync() +{ +} + +void LayerBackedDrawingArea::syncCompositingLayers() +{ +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp new file mode 100644 index 0000000..4c30b8b --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/win/WebInspectorWin.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebInspector.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/RetainPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +String WebInspector::localizedStringsURL() const +{ + RetainPtr<CFURLRef> localizedStringsURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("localizedStrings"), CFSTR("js"), 0)); + if (!localizedStringsURLRef) + return String(); + + return String(CFURLGetString(localizedStringsURLRef.get())); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp new file mode 100644 index 0000000..d41972c --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebPage.h" + +#include "FontSmoothingLevel.h" +#include "WebEvent.h" +#include "WebPreferencesStore.h" +#include <WebCore/FocusController.h> +#include <WebCore/FontRenderingMode.h> +#include <WebCore/Frame.h> +#include <WebCore/FrameView.h> +#include <WebCore/KeyboardEvent.h> +#include <WebCore/Page.h> +#include <WebCore/PlatformKeyboardEvent.h> +#include <WebCore/Settings.h> +#if PLATFORM(CG) +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif +#include <WinUser.h> + +#if USE(CFNETWORK) +#include <CFNetwork/CFURLCachePriv.h> +#include <CFNetwork/CFURLProtocolPriv.h> +#include <CFNetwork/CFURLRequestPriv.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +void WebPage::platformInitialize() +{ + m_page->settings()->setFontRenderingMode(AlternateRenderingMode); +} + +void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store) +{ + FontSmoothingLevel fontSmoothingLevel = static_cast<FontSmoothingLevel>(store.getUInt32ValueForKey(WebPreferencesKey::fontSmoothingLevelKey())); + +#if PLATFORM(CG) + FontSmoothingLevel adjustedLevel = fontSmoothingLevel; + if (adjustedLevel == FontSmoothingLevelWindows) + adjustedLevel = FontSmoothingLevelMedium; + wkSetFontSmoothingLevel(adjustedLevel); +#endif + + m_page->settings()->setFontRenderingMode(fontSmoothingLevel == FontSmoothingLevelWindows ? AlternateRenderingMode : NormalRenderingMode); +} + +static const unsigned CtrlKey = 1 << 0; +static const unsigned AltKey = 1 << 1; +static const unsigned ShiftKey = 1 << 2; + +struct KeyDownEntry { + unsigned virtualKey; + unsigned modifiers; + const char* name; +}; + +struct KeyPressEntry { + unsigned charCode; + unsigned modifiers; + const char* name; +}; + +static const KeyDownEntry keyDownEntries[] = { + { VK_LEFT, 0, "MoveLeft" }, + { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" }, + { VK_LEFT, CtrlKey, "MoveWordLeft" }, + { VK_LEFT, CtrlKey | ShiftKey, "MoveWordLeftAndModifySelection" }, + { VK_RIGHT, 0, "MoveRight" }, + { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" }, + { VK_RIGHT, CtrlKey, "MoveWordRight" }, + { VK_RIGHT, CtrlKey | ShiftKey, "MoveWordRightAndModifySelection" }, + { VK_UP, 0, "MoveUp" }, + { VK_UP, ShiftKey, "MoveUpAndModifySelection" }, + { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" }, + { VK_DOWN, 0, "MoveDown" }, + { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" }, + { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" }, + { VK_PRIOR, 0, "MovePageUp" }, + { VK_NEXT, 0, "MovePageDown" }, + { VK_HOME, 0, "MoveToBeginningOfLine" }, + { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" }, + { VK_HOME, CtrlKey, "MoveToBeginningOfDocument" }, + { VK_HOME, CtrlKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" }, + + { VK_END, 0, "MoveToEndOfLine" }, + { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" }, + { VK_END, CtrlKey, "MoveToEndOfDocument" }, + { VK_END, CtrlKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" }, + + { VK_BACK, 0, "DeleteBackward" }, + { VK_BACK, ShiftKey, "DeleteBackward" }, + { VK_DELETE, 0, "DeleteForward" }, + { VK_BACK, CtrlKey, "DeleteWordBackward" }, + { VK_DELETE, CtrlKey, "DeleteWordForward" }, + + { 'B', CtrlKey, "ToggleBold" }, + { 'I', CtrlKey, "ToggleItalic" }, + + { VK_ESCAPE, 0, "Cancel" }, + { VK_OEM_PERIOD, CtrlKey, "Cancel" }, + { VK_TAB, 0, "InsertTab" }, + { VK_TAB, ShiftKey, "InsertBacktab" }, + { VK_RETURN, 0, "InsertNewline" }, + { VK_RETURN, CtrlKey, "InsertNewline" }, + { VK_RETURN, AltKey, "InsertNewline" }, + { VK_RETURN, ShiftKey, "InsertNewline" }, + { VK_RETURN, AltKey | ShiftKey, "InsertNewline" }, + + // It's not quite clear whether clipboard shortcuts and Undo/Redo should be handled + // in the application or in WebKit. We chose WebKit. + { 'C', CtrlKey, "Copy" }, + { 'V', CtrlKey, "Paste" }, + { 'X', CtrlKey, "Cut" }, + { 'A', CtrlKey, "SelectAll" }, + { VK_INSERT, CtrlKey, "Copy" }, + { VK_DELETE, ShiftKey, "Cut" }, + { VK_INSERT, ShiftKey, "Paste" }, + { 'Z', CtrlKey, "Undo" }, + { 'Z', CtrlKey | ShiftKey, "Redo" }, +}; + +static const KeyPressEntry keyPressEntries[] = { + { '\t', 0, "InsertTab" }, + { '\t', ShiftKey, "InsertBacktab" }, + { '\r', 0, "InsertNewline" }, + { '\r', CtrlKey, "InsertNewline" }, + { '\r', AltKey, "InsertNewline" }, + { '\r', ShiftKey, "InsertNewline" }, + { '\r', AltKey | ShiftKey, "InsertNewline" }, +}; + +const char* WebPage::interpretKeyEvent(const KeyboardEvent* evt) +{ + ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); + + static HashMap<int, const char*>* keyDownCommandsMap = 0; + static HashMap<int, const char*>* keyPressCommandsMap = 0; + + if (!keyDownCommandsMap) { + keyDownCommandsMap = new HashMap<int, const char*>; + keyPressCommandsMap = new HashMap<int, const char*>; + + for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); ++i) + keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name); + + for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); ++i) + keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name); + } + + unsigned modifiers = 0; + if (evt->shiftKey()) + modifiers |= ShiftKey; + if (evt->altKey()) + modifiers |= AltKey; + if (evt->ctrlKey()) + modifiers |= CtrlKey; + + if (evt->type() == eventNames().keydownEvent) { + int mapKey = modifiers << 16 | evt->keyCode(); + return mapKey ? keyDownCommandsMap->get(mapKey) : 0; + } + + int mapKey = modifiers << 16 | evt->charCode(); + return mapKey ? keyPressCommandsMap->get(mapKey) : 0; +} + +static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->scrollRecursively(direction, granularity); +} + +static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity) +{ + page->focusController()->focusedOrMainFrame()->eventHandler()->logicalScrollRecursively(direction, granularity); +} + +bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent) +{ + if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown) + return false; + + switch (keyboardEvent.windowsVirtualKeyCode()) { + case VK_BACK: + if (keyboardEvent.shiftKey()) + m_page->goForward(); + else + m_page->goBack(); + break; + case VK_LEFT: + scroll(m_page.get(), ScrollLeft, ScrollByLine); + break; + case VK_RIGHT: + scroll(m_page.get(), ScrollRight, ScrollByLine); + break; + case VK_UP: + scroll(m_page.get(), ScrollUp, ScrollByLine); + break; + case VK_DOWN: + scroll(m_page.get(), ScrollDown, ScrollByLine); + break; + case VK_HOME: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByDocument); + break; + case VK_END: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByDocument); + break; + case VK_PRIOR: + logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); + break; + case VK_NEXT: + logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); + break; + default: + return false; + } + + return true; +} + +bool WebPage::platformHasLocalDataForURL(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> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get())); + return response; +#else + return false; +#endif +} + +bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) +{ +#if USE(CFNETWORK) + // FIXME: Are there other requests we need to be able to handle? WebKit1's WebView.cpp has a FIXME here as well. + return CFURLProtocolCanHandleRequest(request.cfURLRequest()); +#else + return true; +#endif +} + +void WebPage::confirmComposition(const String& compositionString) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return; + frame->editor()->confirmComposition(compositionString); +} + +void WebPage::setComposition(const String& compositionString, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return; + frame->editor()->setComposition(compositionString, underlines, cursorPosition, 0); +} + +void WebPage::firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + IntRect rect; + if (RefPtr<Range> range = frame->editor()->hasComposition() ? frame->editor()->compositionRange() : frame->selection()->selection().toNormalizedRange()) { + ExceptionCode ec = 0; + RefPtr<Range> tempRange = range->cloneRange(ec); + tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + characterPosition, ec); + rect = frame->editor()->firstRectForRange(tempRange.get()); + } + resultRect = frame->view()->contentsToWindow(rect); +} + +void WebPage::getSelectedText(String& text) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange(); + text = selectedRange->text(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp new file mode 100644 index 0000000..47f4125 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -0,0 +1,659 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcess.h" + +#include "AuthenticationManager.h" +#include "DownloadManager.h" +#include "InjectedBundle.h" +#include "InjectedBundleMessageKinds.h" +#include "InjectedBundleUserMessageCoders.h" +#include "RunLoop.h" +#include "SandboxExtension.h" +#include "WebContextMessages.h" +#include "WebCoreArgumentCoders.h" +#include "WebDatabaseManager.h" +#include "WebFrame.h" +#include "WebGeolocationManagerMessages.h" +#include "WebMemorySampler.h" +#include "WebPage.h" +#include "WebPageCreationParameters.h" +#include "WebPlatformStrategies.h" +#include "WebPreferencesStore.h" +#include "WebProcessCreationParameters.h" +#include "WebProcessMessages.h" +#include "WebProcessProxyMessages.h" +#include <WebCore/ApplicationCacheStorage.h> +#include <WebCore/CrossOriginPreflightResultCache.h> +#include <WebCore/Font.h> +#include <WebCore/Language.h> +#include <WebCore/Page.h> +#include <WebCore/PageGroup.h> +#include <WebCore/SchemeRegistry.h> +#include <WebCore/SecurityOrigin.h> +#include <WebCore/Settings.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RandomNumber.h> + +#ifndef NDEBUG +#include <WebCore/MemoryCache.h> +#include <WebCore/GCController.h> +#endif + +#if !OS(WINDOWS) +#include <unistd.h> +#endif + +using namespace WebCore; + +namespace WebKit { + +#if OS(WINDOWS) +static void sleep(unsigned seconds) +{ + ::Sleep(seconds * 1000); +} +#endif + +static void* randomCrashThread(void*) +{ + // This delay was chosen semi-arbitrarily. We want the crash to happen somewhat quickly to + // enable useful stress testing, but not so quickly that the web process will always crash soon + // after launch. + static const unsigned maximumRandomCrashDelay = 180; + + sleep(randomNumber() * maximumRandomCrashDelay); + CRASH(); + return 0; +} + +static void startRandomCrashThreadIfRequested() +{ + if (!getenv("WEBKIT2_CRASH_WEB_PROCESS_RANDOMLY")) + return; + createThread(randomCrashThread, 0, "WebKit2: Random Crash Thread"); +} + +WebProcess& WebProcess::shared() +{ + static WebProcess& process = *new WebProcess; + return process; +} + +WebProcess::WebProcess() + : m_inDidClose(false) + , m_hasSetCacheModel(false) + , m_cacheModel(CacheModelDocumentViewer) +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + , m_compositingRenderServerPort(MACH_PORT_NULL) +#endif +#if PLATFORM(QT) + , m_networkAccessManager(0) +#endif + , m_textCheckerState() + , m_geolocationManager(this) +{ +#if USE(PLATFORM_STRATEGIES) + // 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) +{ + ASSERT(!m_connection); + + m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop); + m_connection->open(); + + m_runLoop = runLoop; + + startRandomCrashThreadIfRequested(); +} + +void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder* arguments) +{ + ASSERT(m_pageMap.isEmpty()); + + platformInitializeWebProcess(parameters, arguments); + + RefPtr<APIObject> injectedBundleInitializationUserData; + InjectedBundleUserMessageDecoder messageDecoder(injectedBundleInitializationUserData); + if (!arguments->decode(messageDecoder)) + return; + + if (!parameters.injectedBundlePath.isEmpty()) { + m_injectedBundle = InjectedBundle::create(parameters.injectedBundlePath); + m_injectedBundle->setSandboxExtension(SandboxExtension::create(parameters.injectedBundlePathExtensionHandle)); + + if (!m_injectedBundle->load(injectedBundleInitializationUserData.get())) { + // Don't keep around the InjectedBundle reference if the load fails. + m_injectedBundle.clear(); + } + } + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + if (!parameters.applicationCacheDirectory.isEmpty()) + cacheStorage().setCacheDirectory(parameters.applicationCacheDirectory); +#endif + + setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks); + setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); + + if (!parameters.languageCode.isEmpty()) + overrideDefaultLanguage(parameters.languageCode); + + m_textCheckerState = parameters.textCheckerState; + + for (size_t i = 0; i < parameters.urlSchemesRegistererdAsEmptyDocument.size(); ++i) + registerURLSchemeAsEmptyDocument(parameters.urlSchemesRegistererdAsEmptyDocument[i]); + + for (size_t i = 0; i < parameters.urlSchemesRegisteredAsSecure.size(); ++i) + registerURLSchemeAsSecure(parameters.urlSchemesRegisteredAsSecure[i]); + + for (size_t i = 0; i < parameters.urlSchemesForWhichDomainRelaxationIsForbidden.size(); ++i) + setDomainRelaxationForbiddenForURLScheme(parameters.urlSchemesForWhichDomainRelaxationIsForbidden[i]); + + for (size_t i = 0; i < parameters.mimeTypesWithCustomRepresentation.size(); ++i) + m_mimeTypesWithCustomRepresentations.add(parameters.mimeTypesWithCustomRepresentation[i]); + + if (parameters.clearResourceCaches) + clearResourceCaches(); + if (parameters.clearApplicationCache) + clearApplicationCache(); + +#if PLATFORM(MAC) + m_presenterApplicationPid = parameters.presenterApplicationPid; +#endif + + if (parameters.shouldAlwaysUseComplexTextCodePath) + setAlwaysUsesComplexTextCodePath(true); +} + +void WebProcess::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks) +{ + PageGroup::setShouldTrackVisitedLinks(shouldTrackVisitedLinks); +} + +void WebProcess::registerURLSchemeAsEmptyDocument(const String& urlScheme) +{ + SchemeRegistry::registerURLSchemeAsEmptyDocument(urlScheme); +} + +void WebProcess::registerURLSchemeAsSecure(const String& urlScheme) const +{ + SchemeRegistry::registerURLSchemeAsSecure(urlScheme); +} + +void WebProcess::setDomainRelaxationForbiddenForURLScheme(const String& urlScheme) const +{ + SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(true, urlScheme); +} + +void WebProcess::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText) +{ + Font::setCodePath(alwaysUseComplexText ? Font::Complex : Font::Auto); +} + +void WebProcess::languageChanged(const String& language) const +{ + overrideDefaultLanguage(language); +} + +void WebProcess::setVisitedLinkTable(const SharedMemory::Handle& handle) +{ + RefPtr<SharedMemory> sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); + if (!sharedMemory) + return; + + m_visitedLinkTable.setSharedMemory(sharedMemory.release()); +} + +PageGroup* WebProcess::sharedPageGroup() +{ + return PageGroup::pageGroup("WebKit2Group"); +} + +void WebProcess::visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes) +{ + for (size_t i = 0; i < linkHashes.size(); ++i) + Page::visitedStateChanged(sharedPageGroup(), linkHashes[i]); +} + +void WebProcess::allVisitedLinkStateChanged() +{ + Page::allVisitedStateChanged(sharedPageGroup()); +} + +bool WebProcess::isLinkVisited(LinkHash linkHash) const +{ + return m_visitedLinkTable.isLinkVisited(linkHash); +} + +void WebProcess::addVisitedLink(WebCore::LinkHash linkHash) +{ + if (isLinkVisited(linkHash)) + return; + m_connection->send(Messages::WebContext::AddVisitedLinkHash(linkHash), 0); +} + +void WebProcess::setCacheModel(uint32_t cm) +{ + CacheModel cacheModel = static_cast<CacheModel>(cm); + + if (!m_hasSetCacheModel || cacheModel != m_cacheModel) { + m_hasSetCacheModel = true; + m_cacheModel = cacheModel; + platformSetCacheModel(cacheModel); + } +} + +void WebProcess::calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize, + unsigned& cacheTotalCapacity, unsigned& cacheMinDeadCapacity, unsigned& cacheMaxDeadCapacity, double& deadDecodedDataDeletionInterval, + unsigned& pageCacheCapacity, unsigned long& urlCacheMemoryCapacity, unsigned long& urlCacheDiskCapacity) +{ + switch (cacheModel) { + case CacheModelDocumentViewer: { + // Page cache capacity (in pages) + pageCacheCapacity = 0; + + // Object cache capacities (in bytes) + if (memorySize >= 2048) + cacheTotalCapacity = 96 * 1024 * 1024; + else if (memorySize >= 1536) + cacheTotalCapacity = 64 * 1024 * 1024; + else if (memorySize >= 1024) + cacheTotalCapacity = 32 * 1024 * 1024; + else if (memorySize >= 512) + cacheTotalCapacity = 16 * 1024 * 1024; + + cacheMinDeadCapacity = 0; + cacheMaxDeadCapacity = 0; + + // Foundation memory cache capacity (in bytes) + urlCacheMemoryCapacity = 0; + + // Foundation disk cache capacity (in bytes) + urlCacheDiskCapacity = 0; + + break; + } + case CacheModelDocumentBrowser: { + // Page cache capacity (in pages) + if (memorySize >= 1024) + pageCacheCapacity = 3; + else if (memorySize >= 512) + pageCacheCapacity = 2; + else if (memorySize >= 256) + pageCacheCapacity = 1; + else + pageCacheCapacity = 0; + + // Object cache capacities (in bytes) + if (memorySize >= 2048) + cacheTotalCapacity = 96 * 1024 * 1024; + else if (memorySize >= 1536) + cacheTotalCapacity = 64 * 1024 * 1024; + else if (memorySize >= 1024) + cacheTotalCapacity = 32 * 1024 * 1024; + else if (memorySize >= 512) + cacheTotalCapacity = 16 * 1024 * 1024; + + cacheMinDeadCapacity = cacheTotalCapacity / 8; + cacheMaxDeadCapacity = cacheTotalCapacity / 4; + + // Foundation memory cache capacity (in bytes) + if (memorySize >= 2048) + urlCacheMemoryCapacity = 4 * 1024 * 1024; + else if (memorySize >= 1024) + urlCacheMemoryCapacity = 2 * 1024 * 1024; + else if (memorySize >= 512) + urlCacheMemoryCapacity = 1 * 1024 * 1024; + else + urlCacheMemoryCapacity = 512 * 1024; + + // Foundation disk cache capacity (in bytes) + if (diskFreeSize >= 16384) + urlCacheDiskCapacity = 50 * 1024 * 1024; + else if (diskFreeSize >= 8192) + urlCacheDiskCapacity = 40 * 1024 * 1024; + else if (diskFreeSize >= 4096) + urlCacheDiskCapacity = 30 * 1024 * 1024; + else + urlCacheDiskCapacity = 20 * 1024 * 1024; + + break; + } + case CacheModelPrimaryWebBrowser: { + // Page cache capacity (in pages) + // (Research indicates that value / page drops substantially after 3 pages.) + if (memorySize >= 2048) + pageCacheCapacity = 5; + else if (memorySize >= 1024) + pageCacheCapacity = 4; + else if (memorySize >= 512) + pageCacheCapacity = 3; + else if (memorySize >= 256) + pageCacheCapacity = 2; + else + pageCacheCapacity = 1; + + // Object cache capacities (in bytes) + // (Testing indicates that value / MB depends heavily on content and + // browsing pattern. Even growth above 128MB can have substantial + // value / MB for some content / browsing patterns.) + if (memorySize >= 2048) + cacheTotalCapacity = 128 * 1024 * 1024; + else if (memorySize >= 1536) + cacheTotalCapacity = 96 * 1024 * 1024; + else if (memorySize >= 1024) + cacheTotalCapacity = 64 * 1024 * 1024; + else if (memorySize >= 512) + cacheTotalCapacity = 32 * 1024 * 1024; + + cacheMinDeadCapacity = cacheTotalCapacity / 4; + cacheMaxDeadCapacity = cacheTotalCapacity / 2; + + // This code is here to avoid a PLT regression. We can remove it if we + // can prove that the overall system gain would justify the regression. + cacheMaxDeadCapacity = std::max(24u, cacheMaxDeadCapacity); + + deadDecodedDataDeletionInterval = 60; + + // Foundation memory cache capacity (in bytes) + // (These values are small because WebCore does most caching itself.) + if (memorySize >= 1024) + urlCacheMemoryCapacity = 4 * 1024 * 1024; + else if (memorySize >= 512) + urlCacheMemoryCapacity = 2 * 1024 * 1024; + else if (memorySize >= 256) + urlCacheMemoryCapacity = 1 * 1024 * 1024; + else + urlCacheMemoryCapacity = 512 * 1024; + + // Foundation disk cache capacity (in bytes) + if (diskFreeSize >= 16384) + urlCacheDiskCapacity = 175 * 1024 * 1024; + else if (diskFreeSize >= 8192) + urlCacheDiskCapacity = 150 * 1024 * 1024; + else if (diskFreeSize >= 4096) + urlCacheDiskCapacity = 125 * 1024 * 1024; + else if (diskFreeSize >= 2048) + urlCacheDiskCapacity = 100 * 1024 * 1024; + else if (diskFreeSize >= 1024) + urlCacheDiskCapacity = 75 * 1024 * 1024; + else + urlCacheDiskCapacity = 50 * 1024 * 1024; + + break; + } + default: + ASSERT_NOT_REACHED(); + }; +} + +WebPage* WebProcess::webPage(uint64_t pageID) const +{ + return m_pageMap.get(pageID).get(); +} + +void WebProcess::createWebPage(uint64_t pageID, const WebPageCreationParameters& parameters) +{ + // It is necessary to check for page existence here since during a window.open() (or targeted + // link) the WebPage gets created both in the synchronous handler and through the normal way. + std::pair<HashMap<uint64_t, RefPtr<WebPage> >::iterator, bool> result = m_pageMap.add(pageID, 0); + if (result.second) { + ASSERT(!result.first->second); + result.first->second = WebPage::create(pageID, parameters); + } + + ASSERT(result.first->second); +} + +void WebProcess::removeWebPage(uint64_t pageID) +{ + m_pageMap.remove(pageID); + + shutdownIfPossible(); +} + +bool WebProcess::isSeparateProcess() const +{ + // If we're running on the main run loop, we assume that we're in a separate process. + return m_runLoop == RunLoop::main(); +} + +void WebProcess::shutdownIfPossible() +{ + if (!m_pageMap.isEmpty()) + return; + + if (m_inDidClose) + return; + + if (DownloadManager::shared().isDownloading()) + return; + + // Keep running forever if we're running in the same process. + if (!isSeparateProcess()) + return; + + // Actually shut down the process. + +#ifndef NDEBUG + gcController().garbageCollectNow(); + memoryCache()->setDisabled(true); +#endif + + // Invalidate our connection. + m_connection->invalidate(); + m_connection = nullptr; + + platformShutdown(); + + m_runLoop->stop(); +} + +CoreIPC::SyncReplyMode WebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) +{ + uint64_t pageID = arguments->destinationID(); + if (!pageID) + return CoreIPC::AutomaticReply; + + WebPage* page = webPage(pageID); + if (!page) + return CoreIPC::AutomaticReply; + + page->didReceiveSyncMessage(connection, messageID, arguments, reply); + return CoreIPC::AutomaticReply; +} + +void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) +{ + if (messageID.is<CoreIPC::MessageClassWebProcess>()) { + didReceiveWebProcessMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassAuthenticationManager>()) { + AuthenticationManager::shared().didReceiveMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebDatabaseManager>()) { + WebDatabaseManager::shared().didReceiveMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassWebGeolocationManager>()) { + m_geolocationManager.didReceiveMessage(connection, messageID, arguments); + return; + } + + if (messageID.is<CoreIPC::MessageClassInjectedBundle>()) { + if (!m_injectedBundle) + return; + m_injectedBundle->didReceiveMessage(connection, messageID, arguments); + return; + } + + uint64_t pageID = arguments->destinationID(); + if (!pageID) + return; + + WebPage* page = webPage(pageID); + if (!page) + return; + + page->didReceiveMessage(connection, messageID, arguments); +} + +void WebProcess::didClose(CoreIPC::Connection*) +{ + // When running in the same process the connection will never be closed. + ASSERT(isSeparateProcess()); + +#ifndef NDEBUG + m_inDidClose = true; + + // Close all the live pages. + Vector<RefPtr<WebPage> > pages; + copyValuesToVector(m_pageMap, pages); + for (size_t i = 0; i < pages.size(); ++i) + pages[i]->close(); + pages.clear(); + + gcController().garbageCollectNow(); + memoryCache()->setDisabled(true); +#endif + + // The UI process closed this connection, shut down. + m_runLoop->stop(); +} + +void WebProcess::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID) +{ + // We received an invalid message, but since this is from the UI process (which we trust), + // we'll let it slide. +} + +WebFrame* WebProcess::webFrame(uint64_t frameID) const +{ + return m_frameMap.get(frameID); +} + +void WebProcess::addWebFrame(uint64_t frameID, WebFrame* frame) +{ + m_frameMap.set(frameID, frame); +} + +void WebProcess::removeWebFrame(uint64_t frameID) +{ + m_frameMap.remove(frameID); + + // We can end up here after our connection has closed when WebCore's frame life-support timer + // fires when the application is shutting down. There's no need (and no way) to update the UI + // process in this case. + if (!m_connection) + return; + + m_connection->send(Messages::WebProcessProxy::DidDestroyFrame(frameID), 0); +} + +WebPageGroupProxy* WebProcess::webPageGroup(uint64_t pageGroupID) +{ + return m_pageGroupMap.get(pageGroupID).get(); +} + +WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData& pageGroupData) +{ + std::pair<HashMap<uint64_t, RefPtr<WebPageGroupProxy> >::iterator, bool> result = m_pageGroupMap.add(pageGroupData.pageGroupID, 0); + if (result.second) { + ASSERT(!result.first->second); + result.first->second = WebPageGroupProxy::create(pageGroupData); + } + + return result.first->second.get(); +} + +void WebProcess::clearResourceCaches() +{ + platformClearResourceCaches(); + + // Toggling the cache model like this forces the cache to evict all its in-memory resources. + // FIXME: We need a better way to do this. + CacheModel cacheModel = m_cacheModel; + setCacheModel(CacheModelDocumentViewer); + setCacheModel(cacheModel); + + // Empty the cross-origin preflight cache. + CrossOriginPreflightResultCache::shared().empty(); +} + +void WebProcess::clearApplicationCache() +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + // Empty the application cache. + cacheStorage().empty(); +#endif +} + +void WebProcess::downloadRequest(uint64_t downloadID, uint64_t initiatingPageID, const ResourceRequest& request) +{ + WebPage* initiatingPage = initiatingPageID ? webPage(initiatingPageID) : 0; + + DownloadManager::shared().startDownload(downloadID, initiatingPage, request); +} + +void WebProcess::cancelDownload(uint64_t downloadID) +{ + DownloadManager::shared().cancelDownload(downloadID); +} + +void WebProcess::startMemorySampler(const SandboxExtension::Handle& sampleLogFileHandle, const String& sampleLogFilePath, const double interval) +{ +#if ENABLE(MEMORY_SAMPLER) + WebMemorySampler::shared()->start(sampleLogFileHandle, sampleLogFilePath, interval); +#endif +} + +void WebProcess::stopMemorySampler() +{ +#if ENABLE(MEMORY_SAMPLER) + WebMemorySampler::shared()->stop(); +#endif +} + +void WebProcess::setTextCheckerState(const TextCheckerState& textCheckerState) +{ + m_textCheckerState = textCheckerState; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h new file mode 100644 index 0000000..e82cf15 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -0,0 +1,199 @@ +/* + * 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 WebProcess_h +#define WebProcess_h + +#include "CacheModel.h" +#include "ChildProcess.h" +#include "DrawingArea.h" +#include "SandboxExtension.h" +#include "SharedMemory.h" +#include "TextCheckerState.h" +#include "VisitedLinkTable.h" +#include "WebGeolocationManager.h" +#include "WebPageGroupProxy.h" +#include <WebCore/LinkHash.h> +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> + +#if PLATFORM(MAC) +#include "MachPort.h" +#endif + +#if PLATFORM(QT) +class QNetworkAccessManager; +#endif + +namespace WebCore { + class IntSize; + class PageGroup; + class ResourceRequest; +} + +namespace WebKit { + +class InjectedBundle; +class WebFrame; +class WebPage; +struct WebPageCreationParameters; +struct WebPageGroupData; +struct WebPreferencesStore; +struct WebProcessCreationParameters; + +class WebProcess : ChildProcess { +public: + static WebProcess& shared(); + + void initialize(CoreIPC::Connection::Identifier, RunLoop* runLoop); + + CoreIPC::Connection* connection() const { return m_connection.get(); } + RunLoop* runLoop() const { return m_runLoop; } + + WebPage* webPage(uint64_t pageID) const; + void createWebPage(uint64_t pageID, const WebPageCreationParameters&); + void removeWebPage(uint64_t pageID); + + InjectedBundle* injectedBundle() const { return m_injectedBundle.get(); } + + bool isSeparateProcess() const; + +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + mach_port_t compositingRenderServerPort() const { return m_compositingRenderServerPort; } +#endif + + void addVisitedLink(WebCore::LinkHash); + bool isLinkVisited(WebCore::LinkHash) const; + + WebFrame* webFrame(uint64_t) const; + void addWebFrame(uint64_t, WebFrame*); + void removeWebFrame(uint64_t); + + WebPageGroupProxy* webPageGroup(uint64_t pageGroupID); + WebPageGroupProxy* webPageGroup(const WebPageGroupData&); + static WebCore::PageGroup* sharedPageGroup(); +#if PLATFORM(MAC) + pid_t presenterApplicationPid() const { return m_presenterApplicationPid; } +#endif + +#if PLATFORM(QT) + QNetworkAccessManager* networkAccessManager() { return m_networkAccessManager; } +#endif + + // Will shut down the web process if there are no live pages or downloads. + void shutdownIfPossible(); + + bool shouldUseCustomRepresentationForMIMEType(const String& mimeType) const { return m_mimeTypesWithCustomRepresentations.contains(mimeType); } + + // Text Checking + const TextCheckerState& textCheckerState() const { return m_textCheckerState; } + + // Geolocation + WebGeolocationManager& geolocationManager() { return m_geolocationManager; } + +private: + WebProcess(); + + void initializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*); + void platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*); + void platformShutdown(); + void setShouldTrackVisitedLinks(bool); + void registerURLSchemeAsEmptyDocument(const String&); + void registerURLSchemeAsSecure(const String&) const; + void setDomainRelaxationForbiddenForURLScheme(const String&) const; + void setAlwaysUsesComplexTextCodePath(bool); + void languageChanged(const String&) const; +#if PLATFORM(WIN) + void setShouldPaintNativeControls(bool); +#endif + + void setVisitedLinkTable(const SharedMemory::Handle&); + void visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHashes); + void allVisitedLinkStateChanged(); + + void setCacheModel(uint32_t); + void platformSetCacheModel(CacheModel); + static void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize, + unsigned& cacheTotalCapacity, unsigned& cacheMinDeadCapacity, unsigned& cacheMaxDeadCapacity, double& deadDecodedDataDeletionInterval, + unsigned& pageCacheCapacity, unsigned long& urlCacheMemoryCapacity, unsigned long& urlCacheDiskCapacity); + void clearResourceCaches(); + void platformClearResourceCaches(); + void clearApplicationCache(); + + void startMemorySampler(const SandboxExtension::Handle&, const String&, const double); + void stopMemorySampler(); + + void downloadRequest(uint64_t downloadID, uint64_t initiatingPageID, const WebCore::ResourceRequest&); + void cancelDownload(uint64_t downloadID); + + void setTextCheckerState(const TextCheckerState&); + + // CoreIPC::Connection::Client + void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + CoreIPC::SyncReplyMode didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); + void didClose(CoreIPC::Connection*); + void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); + + // Implemented in generated WebProcessMessageReceiver.cpp + void didReceiveWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); + + RefPtr<CoreIPC::Connection> m_connection; + HashMap<uint64_t, RefPtr<WebPage> > m_pageMap; + HashMap<uint64_t, RefPtr<WebPageGroupProxy> > m_pageGroupMap; + RefPtr<InjectedBundle> m_injectedBundle; + + bool m_inDidClose; + + RunLoop* m_runLoop; + + // FIXME: The visited link table should not be per process. + VisitedLinkTable m_visitedLinkTable; + + bool m_hasSetCacheModel; + CacheModel m_cacheModel; + +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC) + mach_port_t m_compositingRenderServerPort; +#endif +#if PLATFORM(MAC) + pid_t m_presenterApplicationPid; +#endif + +#if PLATFORM(QT) + QNetworkAccessManager* m_networkAccessManager; +#endif + + HashMap<uint64_t, WebFrame*> m_frameMap; + + HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomRepresentations; + + TextCheckerState m_textCheckerState; + WebGeolocationManager m_geolocationManager; +}; + +} // namespace WebKit + +#endif // WebProcess_h diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in new file mode 100644 index 0000000..2ea9237 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebProcess.messages.in @@ -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. + +messages -> WebProcess { + # Initialize the WebProcess. + InitializeWebProcess(WebKit::WebProcessCreationParameters processCreationParameters, WebKit::WebContextUserMessageEncoder initializationUserData) + + # Create a new page. + CreateWebPage(uint64_t newPageID, WebKit::WebPageCreationParameters pageCreationParameters) + + # Visited link tracking. + SetVisitedLinkTable(WebKit::SharedMemory::Handle handle) + VisitedLinkStateChanged(Vector<WebCore::LinkHash> linkHashes) + AllVisitedLinkStateChanged() + + # Global preferences. + SetShouldTrackVisitedLinks(bool shouldTrackVisitedLinks) + SetCacheModel(uint32_t cacheModel) + RegisterURLSchemeAsEmptyDocument(WTF::String scheme) + RegisterURLSchemeAsSecure(WTF::String scheme) + SetDomainRelaxationForbiddenForURLScheme(WTF::String scheme) + SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText) + LanguageChanged(WTF::String language) +#if PLATFORM(WIN) + SetShouldPaintNativeControls(bool shouldPaintNativeControls) +#endif + + ClearResourceCaches(); + ClearApplicationCache(); + + void StartMemorySampler(WebKit::SandboxExtension::Handle sampleLogFileHandle, WTF::String sampleLogFilePath, double interval); + void StopMemorySampler(); + + # Downloads. This should really be in a Download.messages.in, but it seemed unnecessary to create a new file just for + # two messages. + void DownloadRequest(uint64_t downloadID, uint64_t initiatingPageID, WebCore::ResourceRequest request) + CancelDownload(uint64_t downloadID) + + SetTextCheckerState(WebKit::TextCheckerState textCheckerState) +} diff --git a/Source/WebKit2/WebProcess/WebProcessMain.h b/Source/WebKit2/WebProcess/WebProcessMain.h new file mode 100644 index 0000000..a287d63 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebProcessMain.h @@ -0,0 +1,39 @@ +/* + * 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 WebProcessMain_h +#define WebProcessMain_h + +#include "WKBase.h" + +namespace WebKit { + +class CommandLine; + +int WebProcessMain(const CommandLine&); + +} // namespace WebKit + +#endif // WebProcessMain_h diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb new file mode 100644 index 0000000..2123c95 --- /dev/null +++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb @@ -0,0 +1,129 @@ +(version 1) +(deny default (with partial-symbolication)) +(allow ipc-posix-shm system-audit system-socket file-read-metadata) + +(import "system.sb") + +;; 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) +) + +(allow file-write* + ;; 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\.")) +) + +;; Darwin temporary files and caches, if present +(if (positive? (string-length (param "DARWIN_USER_CACHE_DIR"))) + (allow file* (subpath (param "DARWIN_USER_CACHE_DIR")))) +(if (positive? (string-length (param "DARWIN_USER_TEMP_DIR"))) + (allow file* (subpath (param "DARWIN_USER_TEMP_DIR")))) + +;; The NSURLCache directory. +(if (positive? (string-length (param "NSURL_CACHE_DIR"))) + (allow file* (subpath (param "NSURL_CACHE_DIR")))) + +;; The bundle resource path of the UI process. +(if (positive? (string-length (param "UI_PROCESS_BUNDLE_RESOURCE_DIR"))) + (allow file-read* (subpath (param "UI_PROCESS_BUNDLE_RESOURCE_DIR")))) + +;; FIXME: overly permissive since we can't pre-enumerate the client +;; classes for graphics cards +(allow iokit-open + ;;(iokit-user-client-class "IOHIDParamUserClient") + ;;(iokit-user-client-class "RootDomainUserClient") +) + +;; Various services required by AppKit and other frameworks +(allow mach-lookup + (global-name "com.apple.CoreServices.coreservicesd") + (global-name "com.apple.DiskArbitration.diskarbitrationd") + (global-name "com.apple.FileCoordination") + (global-name "com.apple.FontObjectsServer") + (global-name "com.apple.FontServer") + (global-name "com.apple.SecurityServer") + (global-name "com.apple.SystemConfiguration.configd") + (global-name "com.apple.audio.VDCAssistant") + (global-name "com.apple.audio.audiohald") + (global-name "com.apple.audio.coreaudiod") + (global-name "com.apple.cookied") + (global-name "com.apple.cvmsServ") + (global-name "com.apple.distributed_notifications.2") + (global-name "com.apple.dock.server") + (global-name "com.apple.ocspd") + (global-name "com.apple.pasteboard.1") + (global-name "com.apple.window_proxies") + (global-name "com.apple.windowserver.active") + (global-name-regex #"^com\.apple\.WebKit\.WebProcess-") + (global-name-regex #"^com\.apple\.qtkitserver\.") +) + +;; FIXME: These rules are required until <rdar://problem/8448410> is addressed. See <rdar://problem/8349882> for discussion. +(allow network-outbound) +(deny network-outbound (regex "")) +(deny network-outbound (local ip)) +(allow network-outbound + ;; Local mDNSResponder for DNS, arbitrary outbound TCP + (literal "/private/var/run/mDNSResponder") + (remote tcp) +) + +;; 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")) + (literal "/Library/Preferences/edu.mit.Kerberos") +) + +(allow mach-lookup + (global-name "org.h5l.kcm") + (global-name "com.apple.tsm.uiserver") + (global-name-regex #"^com\.apple\.ist") +) + +(allow network-outbound (remote ip)) + +;; These rules are required while QTKitServer is being launched directly via posix_spawn (<rdar://problem/6912494>). +(allow process-fork) +(allow process-exec (literal "/System/Library/Frameworks/QTKit.framework/Versions/A/Resources/QTKitServer") (with no-sandbox)) + +;; FIXME: Investigate these. +(allow appleevent-send (appleevent-destination "com.apple.WebProcess")) +(allow mach-lookup (global-name-regex #"^EPPC-")) diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp new file mode 100644 index 0000000..4c26c08 --- /dev/null +++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2011 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 MOTOROLA 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 MOTOROLA 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 "WebProcess.h" + +#include "NotImplemented.h" +#include "WebProcessCreationParameters.h" + +namespace WebKit { + +void WebProcess::platformSetCacheModel(CacheModel) +{ + notImplemented(); +} + +void WebProcess::platformClearResourceCaches() +{ + notImplemented(); +} + +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*) +{ + notImplemented(); +} + +void WebProcess::platformShutdown() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp new file mode 100644 index 0000000..dcac73f --- /dev/null +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcessMainGtk.h" + +#include "WKBase.h" +#include <WebCore/ResourceHandle.h> +#include <WebKit2/RunLoop.h> +#include <WebKit2/WebProcess.h> +#include <gtk/gtk.h> +#include <runtime/InitializeThreading.h> +#include <unistd.h> +#include <wtf/Threading.h> + +namespace WebKit { + +WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]) +{ + ASSERT(argc == 2); + +#ifndef NDEBUG + if (g_getenv("WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH")) + sleep(30); +#endif + + gtk_init(&argc, &argv); + g_type_init(); + + JSC::initializeThreading(); + WTF::initializeMainThread(); + + RunLoop::initializeMainRunLoop(); + WebCore::ResourceHandle::defaultSession(); + + int socket = atoi(argv[1]); + WebProcess::shared().initialize(socket, RunLoop::main()); + RunLoop::run(); + + return 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h new file mode 100644 index 0000000..828af83 --- /dev/null +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#ifndef WebProcessMainGtk_h +#define WebProcessMainGtk_h + +#include <WebKit2/WKBase.h> + +namespace WebKit { + +#ifdef __cplusplus +extern "C" { +WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]); +} // extern "C" +#endif // __cplusplus + +} // namespace WebKit + +#endif // WebProcessMain_h diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm new file mode 100644 index 0000000..c899fcb --- /dev/null +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "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> + +#if ENABLE(WEB_PROCESS_SANDBOX) +#include <sandbox.h> +#include <stdlib.h> +#include <sysexits.h> +#endif + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +static uint64_t memorySize() +{ + static host_basic_info_data_t hostInfo; + + static dispatch_once_t once; + dispatch_once(&once, ^() { + mach_port_t host = mach_host_self(); + mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; + kern_return_t r = host_info(host, HOST_BASIC_INFO, (host_info_t)&hostInfo, &count); + mach_port_deallocate(mach_task_self(), host); + + if (r != KERN_SUCCESS) + LOG_ERROR("%s : host_info(%d) : %s.\n", __FUNCTION__, r, mach_error_string(r)); + }); + + return hostInfo.max_mem; +} + +static uint64_t volumeFreeSize(NSString *path) +{ + NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error:NULL]; + return [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue]; +} + +void WebProcess::platformSetCacheModel(CacheModel cacheModel) +{ + RetainPtr<NSString> nsurlCacheDirectory(AdoptNS, (NSString *)WKCopyFoundationCacheDirectory()); + if (!nsurlCacheDirectory) + nsurlCacheDirectory.adoptNS(NSHomeDirectory()); + + // As a fudge factor, use 1000 instead of 1024, in case the reported byte + // count doesn't align exactly to a megabyte boundary. + uint64_t memSize = memorySize() / 1024 / 1000; + uint64_t diskFreeSize = volumeFreeSize(nsurlCacheDirectory.get()) / 1024 / 1000; + + unsigned cacheTotalCapacity = 0; + unsigned cacheMinDeadCapacity = 0; + unsigned cacheMaxDeadCapacity = 0; + double deadDecodedDataDeletionInterval = 0; + unsigned pageCacheCapacity = 0; + unsigned long urlCacheMemoryCapacity = 0; + unsigned long urlCacheDiskCapacity = 0; + + calculateCacheSizes(cacheModel, memSize, diskFreeSize, + cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, + pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity); + + + memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); + memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); + pageCache()->setCapacity(pageCacheCapacity); + + NSURLCache *nsurlCache = [NSURLCache sharedURLCache]; + [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity]; + [nsurlCache setDiskCapacity:max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn. +} + +void WebProcess::platformClearResourceCaches() +{ + [[NSURLCache sharedURLCache] removeAllCachedResponses]; +} + +static void initializeSandbox(const WebProcessCreationParameters& parameters) +{ +#if ENABLE(WEB_PROCESS_SANDBOX) + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisableSandbox"]) { + fprintf(stderr, "Bypassing sandbox due to DisableSandbox user default.\n"); + return; + } + + 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); + exit(EX_NOPERM); + } +#endif +} + +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder*) +{ + initializeSandbox(parameters); + + if (!parameters.nsURLCachePath.isNull()) { + NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity; + NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity; + + NSString *nsCachePath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:parameters.nsURLCachePath.data() length:parameters.nsURLCachePath.length()]; + RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:nsCachePath]); + [NSURLCache setSharedURLCache:parentProcessURLCache.get()]; + } + + m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); +} + +void WebProcess::platformShutdown() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm new file mode 100644 index 0000000..5cefb59 --- /dev/null +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebProcessMain.h" + +#import "CommandLine.h" +#import "RunLoop.h" +#import "WebProcess.h" +#import "WebSystemInterface.h" +#import <WebKit2/WKView.h> +#import <WebKitSystemInterface.h> +#import <objc/objc-auto.h> +#import <runtime/InitializeThreading.h> +#import <servers/bootstrap.h> +#import <signal.h> +#import <stdio.h> +#import <sysexits.h> +#import <unistd.h> +#import <wtf/RetainPtr.h> +#import <wtf/Threading.h> +#import <wtf/text/CString.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); + +#define SHOW_CRASH_REPORTER 1 + +using namespace WebCore; + +namespace WebKit { + +int WebProcessMain(const CommandLine& commandLine) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + String serviceName = commandLine["servicename"]; + if (serviceName.isEmpty()) + return EXIT_FAILURE; + + // Get the server port. + mach_port_t serverPort; + kern_return_t kr = bootstrap_look_up2(bootstrap_port, serviceName.utf8().data(), &serverPort, 0, 0); + if (kr) { + printf("bootstrap_look_up2 result: %x", kr); + return 2; + } + +#if !SHOW_CRASH_REPORTER + // Installs signal handlers that exit on a crash so that CrashReporter does not show up. + signal(SIGILL, _exit); + signal(SIGFPE, _exit); + signal(SIGBUS, _exit); + signal(SIGSEGV, _exit); +#endif + + InitWebCoreSystemInterface(); + JSC::initializeThreading(); + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + + // Set the visible application name. + String parentProcessName = commandLine["parentprocessname"]; + if (!parentProcessName.isNull()) { + // FIXME: Localization! + NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName]; + WKSetVisibleApplicationName((CFStringRef)applicationName); + } + + // Create the connection. + WebProcess::shared().initialize(serverPort, RunLoop::main()); + + [pool drain]; + + // Initialize AppKit. + [NSApplication sharedApplication]; + +#if !defined(BUILDING_ON_SNOW_LEOPARD) + WKAXRegisterRemoteApp(); +#endif + + RunLoop::run(); + + // FIXME: Do more cleanup here. + + return 0; +} + +} // namespace WebKit + diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp new file mode 100644 index 0000000..bd4e370 --- /dev/null +++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp @@ -0,0 +1,173 @@ +/* + * 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 "RunLoop.h" +#include <runtime/InitializeThreading.h> +#include "WebProcess.h" +#include <wtf/Threading.h> + +#include <QApplication> +#include <QList> +#include <QNetworkProxyFactory> +#include <QString> +#include <QStringList> +#include <QUrl> +#include <QtGlobal> + +#if USE(MEEGOTOUCH) +#include <MComponentData> +#endif + +#ifndef NDEBUG +#if !OS(WINDOWS) +#include <unistd.h> +#endif +#endif + +#if !defined(QWEBKIT_EXPORT) +#if defined(QT_SHARED) +#define QWEBKIT_EXPORT Q_DECL_EXPORT +#else +#define QWEBKIT_EXPORT +#endif +#endif +#ifndef NDEBUG +#include <QDebug> +#endif + +using namespace WebCore; + +namespace WebKit { +#ifndef NDEBUG +#if OS(WINDOWS) +static void sleep(unsigned seconds) +{ + ::Sleep(seconds * 1000); +} +#endif +#endif + +class EnvHttpProxyFactory : public QNetworkProxyFactory +{ +public: + EnvHttpProxyFactory() { } + + bool initializeFromEnvironment(); + + QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery& query = QNetworkProxyQuery()); + +private: + QList<QNetworkProxy> m_httpProxy; + QList<QNetworkProxy> m_httpsProxy; +}; + +bool EnvHttpProxyFactory::initializeFromEnvironment() +{ + bool wasSetByEnvironment = false; + + QUrl proxyUrl = QUrl::fromUserInput(qgetenv("http_proxy")); + if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { + int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; + m_httpProxy << QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort); + wasSetByEnvironment = true; + } else + m_httpProxy << QNetworkProxy::NoProxy; + + proxyUrl = QUrl::fromUserInput(qgetenv("https_proxy")); + if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { + int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; + m_httpsProxy << QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort); + wasSetByEnvironment = true; + } else + m_httpsProxy << QNetworkProxy::NoProxy; + + return wasSetByEnvironment; +} + +QList<QNetworkProxy> EnvHttpProxyFactory::queryProxy(const QNetworkProxyQuery& query) +{ + QString protocol = query.protocolTag().toLower(); + if (protocol == QLatin1String("http")) + return m_httpProxy; + else if (protocol == QLatin1String("https")) + return m_httpsProxy; + + QList<QNetworkProxy> proxies; + proxies << QNetworkProxy::NoProxy; + return proxies; +} + +static void initializeProxy() +{ + QList<QNetworkProxy> proxylist = QNetworkProxyFactory::systemProxyForQuery(); + if (proxylist.count() == 1) { + QNetworkProxy proxy = proxylist.first(); + if (proxy == QNetworkProxy::NoProxy || proxy == QNetworkProxy::DefaultProxy) { + EnvHttpProxyFactory* proxyFactory = new EnvHttpProxyFactory(); + if (proxyFactory->initializeFromEnvironment()) { + QNetworkProxyFactory::setApplicationProxyFactory(proxyFactory); + return; + } + } + } + QNetworkProxyFactory::setUseSystemConfiguration(true); +} + +QWEBKIT_EXPORT int WebProcessMainQt(int argc, char** argv) +{ + QApplication::setGraphicsSystem("raster"); + QApplication* app = new QApplication(argc, argv); +#ifndef NDEBUG + if (!qgetenv("WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH").isEmpty()) { + qDebug() << "Waiting 3 seconds for debugger"; + sleep(3); + } +#endif + +#if USE(MEEGOTOUCH) + new MComponentData(argc, argv); +#endif + + initializeProxy(); + + srandom(time(0)); + + JSC::initializeThreading(); + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + + // Create the connection. + QString identifier(app->arguments().size() > 1 ? app->arguments().at(1) : ""); + WebKit::WebProcess::shared().initialize(identifier, RunLoop::main()); + + RunLoop::run(); + + // FIXME: Do more cleanup here. + + return 0; +} + +} diff --git a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp new file mode 100644 index 0000000..53a51d3 --- /dev/null +++ b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcess.h" + +#include "WebProcessCreationParameters.h" +#include <WebCore/RuntimeEnabledFeatures.h> +#include <QNetworkAccessManager> + +namespace WebKit { + +void WebProcess::platformSetCacheModel(CacheModel) +{ + // FIXME: Implement. +} + +void WebProcess::platformClearResourceCaches() +{ +} + +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder* arguments) +{ + m_networkAccessManager = new QNetworkAccessManager; + + // Disable runtime enabled features that have no WebKit2 implementation yet. +#if ENABLE(DEVICE_ORIENTATION) + WebCore::RuntimeEnabledFeatures::setDeviceMotionEnabled(false); + WebCore::RuntimeEnabledFeatures::setDeviceOrientationEnabled(false); +#endif +#if ENABLE(SPEECH_INPUT) + WebCore::RuntimeEnabledFeatures::setSpeechInputEnabled(false); +#endif +} + +void WebProcess::platformShutdown() +{ + delete m_networkAccessManager; + m_networkAccessManager = 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp new file mode 100644 index 0000000..944d8ff --- /dev/null +++ b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcessMain.h" + +#include "CommandLine.h" +#include "RunLoop.h" +#include "WebProcess.h" +#include <WebCore/SoftLinking.h> +#include <runtime/InitializeThreading.h> +#include <wtf/Threading.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebKit { + +#if USE(SAFARI_THEME) +#ifdef DEBUG_ALL +SOFT_LINK_DEBUG_LIBRARY(SafariTheme) +#else +SOFT_LINK_LIBRARY(SafariTheme) +#endif + +SOFT_LINK(SafariTheme, STInitialize, void, APIENTRY, (), ()) + +static void initializeSafariTheme() +{ + static bool didInitializeSafariTheme; + if (!didInitializeSafariTheme) { + if (SafariThemeLibrary()) + STInitialize(); + didInitializeSafariTheme = true; + } +} +#endif // USE(SAFARI_THEME) + +int WebProcessMain(const CommandLine& commandLine) +{ + ::OleInitialize(0); + +#if USE(SAFARI_THEME) + initializeSafariTheme(); +#endif + + JSC::initializeThreading(); + WTF::initializeMainThread(); + RunLoop::initializeMainRunLoop(); + + const String& identifierString = commandLine["clientIdentifier"]; + + // FIXME: Should we return an error code here? + HANDLE clientIdentifier = reinterpret_cast<HANDLE>(identifierString.toUInt64Strict()); + if (!clientIdentifier) + return 0; + + WebProcess::shared().initialize(clientIdentifier, RunLoop::main()); + RunLoop::run(); + + return 0; +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp new file mode 100644 index 0000000..7f53cd3 --- /dev/null +++ b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcess.h" + +#include "WebProcessCreationParameters.h" +#include <WebCore/FileSystem.h> +#include <WebCore/MemoryCache.h> +#include <WebCore/PageCache.h> +#include <WebCore/Settings.h> +#include <wtf/text/WTFString.h> + +#if USE(CFNETWORK) +#include <CFNetwork/CFURLCachePriv.h> +#include <CFNetwork/CFURLProtocolPriv.h> +#include <WebCore/CookieStorageCFNet.h> +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#include <wtf/RetainPtr.h> +#endif + +using namespace WebCore; +using namespace std; + +namespace WebKit { + +static uint64_t memorySize() +{ + MEMORYSTATUSEX statex; + statex.dwLength = sizeof(statex); + GlobalMemoryStatusEx(&statex); + return statex.ullTotalPhys; +} + +static uint64_t volumeFreeSize(CFStringRef cfstringPath) +{ + WTF::String path(cfstringPath); + ULARGE_INTEGER freeBytesToCaller; + BOOL result = GetDiskFreeSpaceExW((LPCWSTR)path.charactersWithNullTermination(), &freeBytesToCaller, 0, 0); + if (!result) + return 0; + return freeBytesToCaller.QuadPart; +} + +void WebProcess::platformSetCacheModel(CacheModel cacheModel) +{ +#if USE(CFNETWORK) + RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory()); + if (!cfurlCacheDirectory) + cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString()); + + // As a fudge factor, use 1000 instead of 1024, in case the reported byte + // count doesn't align exactly to a megabyte boundary. + uint64_t memSize = memorySize() / 1024 / 1000; + uint64_t diskFreeSize = volumeFreeSize(cfurlCacheDirectory.get()) / 1024 / 1000; + + unsigned cacheTotalCapacity = 0; + unsigned cacheMinDeadCapacity = 0; + unsigned cacheMaxDeadCapacity = 0; + double deadDecodedDataDeletionInterval = 0; + unsigned pageCacheCapacity = 0; + unsigned long urlCacheMemoryCapacity = 0; + unsigned long urlCacheDiskCapacity = 0; + + calculateCacheSizes(cacheModel, memSize, diskFreeSize, + cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, + pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity); + + memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); + memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); + pageCache()->setCapacity(pageCacheCapacity); + + RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache()); + CFURLCacheSetMemoryCapacity(cfurlCache.get(), urlCacheMemoryCapacity); + CFURLCacheSetDiskCapacity(cfurlCache.get(), max<unsigned long>(urlCacheDiskCapacity, CFURLCacheDiskCapacity(cfurlCache.get()))); // Don't shrink a big disk cache, since that would cause churn. +#endif +} + +void WebProcess::platformClearResourceCaches() +{ +#if USE(CFNETWORK) + CFURLCacheRemoveAllCachedResponses(RetainPtr<CFURLCacheRef>(AdoptCF, CFURLCacheCopySharedURLCache()).get()); +#endif +} + +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder*) +{ + setShouldPaintNativeControls(parameters.shouldPaintNativeControls); +} + +void WebProcess::platformShutdown() +{ +} + +void WebProcess::setShouldPaintNativeControls(bool shouldPaintNativeControls) +{ +#if USE(SAFARI_THEME) + Settings::setShouldPaintNativeControls(shouldPaintNativeControls); +#endif +} + +} // namespace WebKit diff --git a/Source/WebKit2/gtk/MainGtk.cpp b/Source/WebKit2/gtk/MainGtk.cpp new file mode 100644 index 0000000..16f8990 --- /dev/null +++ b/Source/WebKit2/gtk/MainGtk.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "WebProcessMainGtk.h" + +int main(int argc, char** argv) +{ + return WebKit::WebProcessMainGtk(argc, argv); +} diff --git a/Source/WebKit2/gtk/webkit2.pc.in b/Source/WebKit2/gtk/webkit2.pc.in new file mode 100644 index 0000000..6eeee80 --- /dev/null +++ b/Source/WebKit2/gtk/webkit2.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: WebKit2 +Description: Web content engine for GTK+ +Version: @VERSION@ +Requires: glib-2.0 gtk+-@GTK_API_VERSION@ libsoup-2.4 +Libs: -L${libdir} -lwebkit2gtk-@WEBKITGTK_API_VERSION@ +Cflags: -I${includedir}/webkit2-@WEBKITGTK_API_VERSION@ diff --git a/Source/WebKit2/mac/MainMac.cpp b/Source/WebKit2/mac/MainMac.cpp new file mode 100644 index 0000000..0bba8af --- /dev/null +++ b/Source/WebKit2/mac/MainMac.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <dlfcn.h> + +static void closeUnusedFileDescriptors() +{ + int numFDs = getdtablesize(); + + // Close all file descriptors except stdin, stdout and stderr. + for (int fd = 3; fd < numFDs; ++fd) + close(fd); +} + +int main(int argc, char** argv) +{ + closeUnusedFileDescriptors(); + + if (argc < 2) + return EXIT_FAILURE; + + static void* frameworkLibrary = dlopen(argv[1], RTLD_NOW); + if (!frameworkLibrary) { + fprintf(stderr, "Unable to load WebKit2.framework: %s\n", dlerror()); + return EXIT_FAILURE; + } + + typedef int (*WebKitMainFunction)(int argc, char** argv); + WebKitMainFunction webKitMain = reinterpret_cast<WebKitMainFunction>(dlsym(frameworkLibrary, "WebKitMain")); + if (!webKitMain) { + fprintf(stderr, "Unable to find entry point in WebKit2.framework: %s\n", dlerror()); + return EXIT_FAILURE; + } + + return webKitMain(argc, argv); +} diff --git a/Source/WebKit2/qt/MainQt.cpp b/Source/WebKit2/qt/MainQt.cpp new file mode 100644 index 0000000..d42ef05 --- /dev/null +++ b/Source/WebKit2/qt/MainQt.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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. + */ + +#include <QtGlobal> + +#if !defined(QWEBKIT_EXPORT) +#if defined(QT_SHARED) +#define QWEBKIT_EXPORT Q_DECL_EXPORT +#else +#define QWEBKIT_EXPORT +#endif +#endif + +namespace WebKit { +QWEBKIT_EXPORT int WebProcessMainQt(int argc, char** argv); +} + +// The framework entry point. +// We call our platform specific entry point directly rather than WebKitMain because it makes little sense +// to reimplement the handling of command line arguments from QApplication. +int main(int argc, char** argv) +{ + return WebKit::WebProcessMainQt(argc, argv); +} diff --git a/Source/WebKit2/version.plist b/Source/WebKit2/version.plist new file mode 100644 index 0000000..c9c8853 --- /dev/null +++ b/Source/WebKit2/version.plist @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-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>BuildVersion</key> + <string>2</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>ProjectName</key> + <string>DevToolsWizardTemplates</string> + <key>SourceVersion</key> + <string>15920000</string> +</dict> +</plist> diff --git a/Source/WebKit2/win/MainWin.cpp b/Source/WebKit2/win/MainWin.cpp new file mode 100644 index 0000000..7aea3f2 --- /dev/null +++ b/Source/WebKit2/win/MainWin.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <windows.h> + +#if defined _M_IX86 +#define PROCESSORARCHITECTURE "x86" +#elif defined _M_IA64 +#define PROCESSORARCHITECTURE "ia64" +#elif defined _M_X64 +#define PROCESSORARCHITECTURE "amd64" +#else +#define PROCESSORARCHITECTURE "*" +#endif + +#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); +} diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def new file mode 100644 index 0000000..37c5dfc --- /dev/null +++ b/Source/WebKit2/win/WebKit2.def @@ -0,0 +1,134 @@ +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + RunAsLocalServer PRIVATE + LocalServerDidDie PRIVATE + setUseOpenSourceWebKit + shutDownWebKit + progIDForClass + WebLocalizedStringUTF8 + WebLocalizedLPCTSTRUTF8 + WebDrawText + FontMetrics + TextFloatWidth + CenterTruncateStringToWidth + RightTruncateStringToWidth + WebKitSetShouldUseFontSmoothing + WebKitShouldUseFontSmoothing + WebKitCreateInstance + + ; These functions are deprecated + WebLocalizedString + WebLocalizedLPCTSTR + SetWebLocalizedStringMainBundle + + ; Deprecated re-exports from JavaScriptCore + JSCheckScriptSyntax + JSClassCreate + JSClassRelease + JSClassRetain + JSContextGetGlobalObject + JSContextGetGroup + JSContextGroupCreate + JSContextGroupRelease + JSContextGroupRetain + JSEvaluateScript + JSGarbageCollect + JSGlobalContextCreate + JSGlobalContextCreateInGroup + JSGlobalContextRelease + JSGlobalContextRetain + JSObjectCallAsConstructor + JSObjectCallAsFunction + JSObjectCopyPropertyNames + JSObjectDeleteProperty + JSObjectGetPrivate + JSObjectGetProperty + JSObjectGetPropertyAtIndex + JSObjectGetPrototype + JSObjectHasProperty + JSObjectIsConstructor + JSObjectIsFunction + JSObjectMake + JSObjectMakeArray + JSObjectMakeConstructor + JSObjectMakeDate + JSObjectMakeError + JSObjectMakeFunction + JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp + JSObjectSetPrivate + JSObjectSetProperty + JSObjectSetPropertyAtIndex + JSObjectSetPrototype + JSPropertyNameAccumulatorAddName + JSPropertyNameArrayGetCount + JSPropertyNameArrayGetNameAtIndex + JSPropertyNameArrayRelease + JSPropertyNameArrayRetain + JSStringCopyBSTR + JSStringCopyCFString + JSStringCreateWithBSTR + JSStringCreateWithCFString + JSStringCreateWithCharacters + JSStringCreateWithUTF8CString + JSStringGetCharactersPtr + JSStringGetLength + JSStringGetMaximumUTF8CStringSize + JSStringGetUTF8CString + JSStringIsEqual + JSStringIsEqualToUTF8CString + JSStringRelease + JSStringRetain + JSValueGetType + JSValueIsBoolean + JSValueIsEqual + JSValueIsInstanceOfConstructor + JSValueIsNull + JSValueIsNumber + JSValueIsObject + JSValueIsObjectOfClass + JSValueIsStrictEqual + JSValueIsString + JSValueIsUndefined + JSValueMakeBoolean + JSValueMakeNull + JSValueMakeNumber + JSValueMakeString + JSValueMakeUndefined + JSValueProtect + JSValueToBoolean + JSValueToNumber + JSValueToObject + JSValueToStringCopy + JSValueUnprotect + ?fastMalloc@WTF@@YAPAXI@Z + ?fastZeroedMalloc@WTF@@YAPAXI@Z + ?fastFree@WTF@@YAXPAX@Z + ?fastCalloc@WTF@@YAPAXII@Z + ??0Mutex@WTF@@QAE@XZ + ??0ThreadCondition@WTF@@QAE@XZ + ??1Mutex@WTF@@QAE@XZ + ??1ThreadCondition@WTF@@QAE@XZ + ?broadcast@ThreadCondition@WTF@@QAEXXZ + ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z + ?currentThread@WTF@@YAIXZ + ?detachThread@WTF@@YAXI@Z + ?initializeMainThread@WTF@@YAXXZ + ?initializeThreading@WTF@@YAXXZ + ?isMainThread@WTF@@YA_NXZ + ?lock@Mutex@WTF@@QAEXXZ + ?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?signal@ThreadCondition@WTF@@QAEXXZ + ?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z + ?tlsKeyCount@WTF@@YAAAJXZ + ?tlsKeys@WTF@@YAPAKXZ + ?tryLock@Mutex@WTF@@QAE_NXZ + ?unlock@Mutex@WTF@@QAEXXZ + ?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z + ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0@Z diff --git a/Source/WebKit2/win/WebKit2.make b/Source/WebKit2/win/WebKit2.make new file mode 100755 index 0000000..7d1ea35 --- /dev/null +++ b/Source/WebKit2/win/WebKit2.make @@ -0,0 +1,21 @@ +!IF "$(BUILDSTYLE)"=="DEBUG" +BUILDSTYLE=Debug_All +!ELSE +BUILDSTYLE=Release_LTCG +!ENDIF + +install: + set WebKitLibrariesDir=$(SRCROOT)\AppleInternal + set WebKitOutputDir=$(OBJROOT) + set ConfigurationBuildDir=$(OBJROOT)\$(BUILDSTYLE) + set WebKitVSPropsRedirectionDir=$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\ + 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 + -mkdir "$(DSTROOT)\AppleInternal\Sources\WebKit2" + xcopy "$(ConfigurationBuildDir)\obj\WebKit\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\WebKit2" /e/v/i/h/y diff --git a/Source/WebKit2/win/WebKit2.rc b/Source/WebKit2/win/WebKit2.rc new file mode 100644 index 0000000..7a5176a --- /dev/null +++ b/Source/WebKit2/win/WebKit2.rc @@ -0,0 +1,80 @@ +// Microsoft Visual C++ generated resource script. +// +#include "autoversion.h" +#include "resource.h" +#include "winresrc.h" + +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ + PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "WebKit Dynamic Link Library" + VALUE "FileVersion", __VERSION_TEXT__ + VALUE "CompanyName", "Apple Inc." + VALUE "InternalName", "WebKit" + VALUE "LegalCopyright", "Copyright Apple Inc. 2003-" __COPYRIGHT_YEAR_END_TEXT__ + VALUE "OriginalFilename", "WebKit.dll" + VALUE "ProductName", "WebKit" + VALUE "ProductVersion", __BUILD_NUMBER_SHORT__ + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// PNG +// + +IDR_RESIZE_CORNER PNG "textAreaResizeCorner.png" +IDR_MISSING_IMAGE PNG "missingImage.png" +IDR_NULL_PLUGIN PNG "nullplugin.png" +IDR_DELETE_BUTTON PNG "deleteButton.png" +IDR_DELETE_BUTTON_PRESSED PNG "deleteButtonPressed.png" +IDR_ZOOM_IN_CURSOR PNG "zoomInCursor.png" +IDR_ZOOM_OUT_CURSOR PNG "zoomOutCursor.png" +IDR_VERTICAL_TEXT_CURSOR PNG "verticalTextCursor.png" +IDR_PAN_SCROLL_ICON PNG "panIcon.png" +IDR_PAN_SOUTH_CURSOR PNG "panSouthCursor.png" +IDR_PAN_NORTH_CURSOR PNG "panNorthCursor.png" +IDR_PAN_EAST_CURSOR PNG "panEastCursor.png" +IDR_PAN_WEST_CURSOR PNG "panWestCursor.png" +IDR_PAN_SOUTH_EAST_CURSOR PNG "panSouthEastCursor.png" +IDR_PAN_SOUTH_WEST_CURSOR PNG "panSouthWestCursor.png" +IDR_PAN_NORTH_EAST_CURSOR PNG "panNorthEastCursor.png" +IDR_PAN_NORTH_WEST_CURSOR PNG "panNorthWestCursor.png" +IDR_SEARCH_CANCEL PNG "searchCancel.png" +IDR_SEARCH_CANCEL_PRESSED PNG "searchCancelPressed.png" +IDR_SEARCH_MAGNIFIER PNG "searchMagnifier.png" +IDR_SEARCH_MAGNIFIER_RESULTS PNG "searchMagnifierResults.png" +IDR_FS_VIDEO_AUDIO_VOLUME_HIGH PNG "fsVideoAudioVolumeHigh.png" +IDR_FS_VIDEO_AUDIO_VOLUME_LOW PNG "fsVideoAudioVolumeLow.png" +IDR_FS_VIDEO_EXIT_FULLSCREEN PNG "fsVideoExitFullscreen.png" +IDR_FS_VIDEO_PAUSE PNG "fsVideoPause.png" +IDR_FS_VIDEO_PLAY PNG "fsVideoPlay.png" diff --git a/Source/WebKit2/win/WebKit2.submit.sln b/Source/WebKit2/win/WebKit2.submit.sln new file mode 100755 index 0000000..4c0089b --- /dev/null +++ b/Source/WebKit2/win/WebKit2.submit.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit", "WebKit2.vcproj", "{2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}" + ProjectSection(ProjectDependencies) = postProject + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB} = {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit2Generated", "WebKit2Generated.vcproj", "{2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit2WebProcess", "WebKit2WebProcess.vcproj", "{AAE88FEF-509E-4D49-870B-7357922C276F}" + ProjectSection(ProjectDependencies) = postProject + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD} = {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_All|Win32 = Debug_All|Win32 + Debug|Win32 = Debug|Win32 + Release_LTCG|Win32 = Release_LTCG|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Debug_All|Win32.Build.0 = Debug_All|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Debug|Win32.ActiveCfg = Debug|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Debug|Win32.Build.0 = Debug|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Release|Win32.ActiveCfg = Release|Win32 + {2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}.Release|Win32.Build.0 = Release|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Debug_All|Win32.Build.0 = Debug_All|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Debug|Win32.ActiveCfg = Debug|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Debug|Win32.Build.0 = Debug|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Release|Win32.ActiveCfg = Release|Win32 + {2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}.Release|Win32.Build.0 = Release|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Debug_All|Win32.ActiveCfg = Debug_All|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Debug_All|Win32.Build.0 = Debug_All|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Debug|Win32.ActiveCfg = Debug|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Debug|Win32.Build.0 = Debug|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Release|Win32.ActiveCfg = Release|Win32 + {AAE88FEF-509E-4D49-870B-7357922C276F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Source/WebKit2/win/WebKit2.vcproj b/Source/WebKit2/win/WebKit2.vcproj new file mode 100755 index 0000000..0742c6e --- /dev/null +++ b/Source/WebKit2/win/WebKit2.vcproj @@ -0,0 +1,3283 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="WebKit" + ProjectGUID="{2E51ABE8-76CB-485B-A66C-46AEF4DF8ACD}" + RootNamespace="WebKit2" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WebKit2Common.vsprops;.\WebKit2DirectX.vsprops;.\WebKit2Apple.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKit2Common.vsprops;.\WebKit2DirectX.vsprops;.\WebKit2Apple.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_Cairo_CFLite|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\WebKit2Common.vsprops;.\WebKit2CFLite.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + VerboseOutput="false" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_Cairo_CFLite|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\WebKit2Common.vsprops;.\WebKit2CFLite.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_All|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\WebKit2Common.vsprops;.\WebKit2DirectX.vsprops;.\WebKit2Apple.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_LTCG|Win32" + ConfigurationType="2" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKit2Common.vsprops;.\WebKit2DirectX.vsprops;.\WebKit2Apple.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Shared" + > + <File + RelativePath="..\Shared\APIClient.h" + > + </File> + <File + RelativePath="..\Shared\APIObject.h" + > + </File> + <File + RelativePath="..\Shared\ShareableBitmap.cpp" + > + </File> + <File + RelativePath="..\Shared\ShareableBitmap.h" + > + </File> + <File + RelativePath="..\Shared\CacheModel.h" + > + </File> + <File + RelativePath="..\Shared\ChildProcess.cpp" + > + </File> + <File + RelativePath="..\Shared\ChildProcess.h" + > + </File> + <File + RelativePath="..\Shared\CommandLine.h" + > + </File> + <File + RelativePath="..\Shared\ContextMenuState.h" + > + </File> + <File + RelativePath="..\Shared\DrawingAreaInfo.h" + > + </File> + <File + RelativePath="..\Shared\FontSmoothingLevel.h" + > + </File> + <File + RelativePath="..\Shared\ImmutableArray.cpp" + > + </File> + <File + RelativePath="..\Shared\ImmutableArray.h" + > + </File> + <File + RelativePath="..\Shared\ImmutableDictionary.cpp" + > + </File> + <File + RelativePath="..\Shared\ImmutableDictionary.h" + > + </File> + <File + RelativePath="..\Shared\MutableArray.cpp" + > + </File> + <File + RelativePath="..\Shared\MutableArray.h" + > + </File> + <File + RelativePath="..\Shared\MutableDictionary.cpp" + > + </File> + <File + RelativePath="..\Shared\MutableDictionary.h" + > + </File> + <File + RelativePath="..\Shared\NativeWebKeyboardEvent.h" + > + </File> + <File + RelativePath="..\Shared\NotImplemented.h" + > + </File> + <File + RelativePath="..\Shared\OriginAndDatabases.cpp" + > + </File> + <File + RelativePath="..\Shared\OriginAndDatabases.h" + > + </File> + <File + RelativePath="..\Shared\PlatformPopupMenuData.cpp" + > + </File> + <File + RelativePath="..\Shared\PlatformPopupMenuData.h" + > + </File> + <File + RelativePath="..\Shared\PrintInfo.cpp" + > + </File> + <File + RelativePath="..\Shared\PrintInfo.h" + > + </File> + <File + RelativePath="..\Shared\SameDocumentNavigationType.h" + > + </File> + <File + RelativePath="..\Shared\SelectionState.h" + > + </File> + <File + RelativePath="..\Shared\SessionState.cpp" + > + </File> + <File + RelativePath="..\Shared\SessionState.h" + > + </File> + <File + RelativePath="..\Shared\StringPairVector.h" + > + </File> + <File + RelativePath="..\Shared\TextCheckerState.h" + > + </File> + <File + RelativePath="..\Shared\UserMessageCoders.h" + > + </File> + <File + RelativePath="..\Shared\VisitedLinkTable.cpp" + > + </File> + <File + RelativePath="..\Shared\VisitedLinkTable.h" + > + </File> + <File + RelativePath="..\Shared\WebBackForwardListItem.cpp" + > + </File> + <File + RelativePath="..\Shared\WebBackForwardListItem.h" + > + </File> + <File + RelativePath="..\Shared\WebCertificateInfo.h" + > + </File> + <File + RelativePath="..\Shared\WebContextMenuItem.cpp" + > + </File> + <File + RelativePath="..\Shared\WebContextMenuItem.h" + > + </File> + <File + RelativePath="..\Shared\WebContextMenuItemData.cpp" + > + </File> + <File + RelativePath="..\Shared\WebContextMenuItemData.h" + > + </File> + <File + RelativePath="..\Shared\WebCoreArgumentCoders.h" + > + </File> + <File + RelativePath="..\Shared\WebData.h" + > + </File> + <File + RelativePath="..\Shared\WebError.cpp" + > + </File> + <File + RelativePath="..\Shared\WebError.h" + > + </File> + <File + RelativePath="..\Shared\WebEvent.cpp" + > + </File> + <File + RelativePath="..\Shared\WebEvent.h" + > + </File> + <File + RelativePath="..\Shared\WebEventConversion.cpp" + > + </File> + <File + RelativePath="..\Shared\WebEventConversion.h" + > + </File> + <File + RelativePath="..\Shared\WebFindOptions.h" + > + </File> + <File + RelativePath="..\Shared\WebGeolocationPosition.cpp" + > + </File> + <File + RelativePath="..\Shared\WebGeolocationPosition.h" + > + </File> + <File + RelativePath="..\Shared\WebImage.cpp" + > + </File> + <File + RelativePath="..\Shared\WebImage.h" + > + </File> + <File + RelativePath="..\Shared\WebKeyboardEvent.cpp" + > + </File> + <File + RelativePath="..\Shared\WebMouseEvent.cpp" + > + </File> + <File + RelativePath="..\Shared\WebNavigationDataStore.h" + > + </File> + <File + RelativePath="..\Shared\WebNumber.h" + > + </File> + <File + RelativePath="..\Shared\WebOpenPanelParameters.cpp" + > + </File> + <File + RelativePath="..\Shared\WebOpenPanelParameters.h" + > + </File> + <File + RelativePath="..\Shared\WebPageCreationParameters.cpp" + > + </File> + <File + RelativePath="..\Shared\WebPageCreationParameters.h" + > + </File> + <File + RelativePath="..\Shared\WebPageGroupData.cpp" + > + </File> + <File + RelativePath="..\Shared\WebPageGroupData.h" + > + </File> + <File + RelativePath="..\Shared\WebPlatformTouchPoint.cpp" + > + </File> + <File + RelativePath="..\Shared\WebPopupItem.cpp" + > + </File> + <File + RelativePath="..\Shared\WebPopupItem.h" + > + </File> + <File + RelativePath="..\Shared\WebPreferencesStore.cpp" + > + </File> + <File + RelativePath="..\Shared\WebPreferencesStore.h" + > + </File> + <File + RelativePath="..\Shared\WebProcessCreationParameters.cpp" + > + </File> + <File + RelativePath="..\Shared\WebProcessCreationParameters.h" + > + </File> + <File + RelativePath="..\Shared\WebSecurityOrigin.h" + > + </File> + <File + RelativePath="..\Shared\WebSerializedScriptValue.h" + > + </File> + <File + RelativePath="..\Shared\WebString.h" + > + </File> + <File + RelativePath="..\Shared\WebTouchEvent.cpp" + > + </File> + <File + RelativePath="..\Shared\WebURL.h" + > + </File> + <File + RelativePath="..\Shared\WebURLRequest.cpp" + > + </File> + <File + RelativePath="..\Shared\WebURLRequest.h" + > + </File> + <File + RelativePath="..\Shared\WebURLResponse.cpp" + > + </File> + <File + RelativePath="..\Shared\WebURLResponse.h" + > + </File> + <File + RelativePath="..\Shared\WebUserContentURLPattern.h" + > + </File> + <File + RelativePath="..\Shared\WebWheelEvent.cpp" + > + </File> + <Filter + Name="API" + > + <File + RelativePath="..\Shared\API\c\WKArray.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKArray.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKBase.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKCertificateInfo.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKCertificateInfo.h" + > + </File> + <File + RelativePath="..\Shared\API\c\win\WKCertificateInfoWin.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\win\WKCertificateInfoWin.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKContextMenuItem.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKContextMenuItem.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKContextMenuItemTypes.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKData.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKData.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKDictionary.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKDictionary.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKError.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKError.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKEvent.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKFindOptions.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKGeometry.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKImage.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKImage.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKMutableArray.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKMutableArray.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKMutableDictionary.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKMutableDictionary.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKNumber.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKNumber.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKPageLoadTypes.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSecurityOrigin.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSecurityOrigin.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSerializedScriptValue.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSerializedScriptValue.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSerializedScriptValuePrivate.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKSharedAPICast.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKString.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKString.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKStringPrivate.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKType.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKType.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURL.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURL.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURLRequest.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURLRequest.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURLResponse.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKURLResponse.h" + > + </File> + <File + RelativePath="..\Shared\API\c\WKUserContentURLPattern.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\WKUserContentURLPattern.h" + > + </File> + <Filter + Name="cf" + > + <File + RelativePath="..\Shared\API\c\cf\WKStringCF.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\cf\WKStringCF.h" + > + </File> + <File + RelativePath="..\Shared\API\c\cf\WKURLCF.cpp" + > + </File> + <File + RelativePath="..\Shared\API\c\cf\WKURLCF.h" + > + </File> + <File + RelativePath="..\Shared\API\c\cf\WKURLRequestCF.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\cf\WKURLRequestCF.h" + > + </File> + <File + RelativePath="..\Shared\API\c\cf\WKURLResponseCF.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\cf\WKURLResponseCF.h" + > + </File> + </Filter> + <Filter + Name="cg" + > + <File + RelativePath="..\Shared\API\c\cg\WKImageCG.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\WKImageCG.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="CoreIPCSupport" + > + <File + RelativePath="..\Shared\CoreIPCSupport\DrawingAreaMessageKinds.h" + > + </File> + <File + RelativePath="..\Shared\CoreIPCSupport\DrawingAreaProxyMessageKinds.h" + > + </File> + <File + RelativePath="..\Shared\CoreIPCSupport\InjectedBundleMessageKinds.h" + > + </File> + <File + RelativePath="..\Shared\CoreIPCSupport\WebContextMessageKinds.h" + > + </File> + <File + RelativePath="..\Shared\CoreIPCSupport\WebPageProxyMessageKinds.h" + > + </File> + <File + RelativePath="..\Shared\CoreIPCSupport\WebProcessProxyMessageKinds.h" + > + </File> + </Filter> + <Filter + Name="cf" + > + <File + RelativePath="..\Shared\cf\ArgumentCodersCF.cpp" + > + </File> + <File + RelativePath="..\Shared\cf\ArgumentCodersCF.h" + > + </File> + </Filter> + <Filter + Name="win" + > + <File + RelativePath="..\Shared\win\CommandLineWin.cpp" + > + </File> + <File + RelativePath="..\Shared\win\NativeWebKeyboardEventWin.cpp" + > + </File> + <File + RelativePath="..\Shared\win\PlatformCertificateInfo.cpp" + > + </File> + <File + RelativePath="..\Shared\win\PlatformCertificateInfo.h" + > + </File> + <File + RelativePath="..\Shared\win\UpdateChunk.cpp" + > + </File> + <File + RelativePath="..\Shared\win\UpdateChunk.h" + > + </File> + <File + RelativePath="..\Shared\win\WebCoreArgumentCodersWin.cpp" + > + </File> + <File + RelativePath="..\Shared\win\WebEventFactory.cpp" + > + </File> + <File + RelativePath="..\Shared\win\WebEventFactory.h" + > + </File> + <File + RelativePath="..\Shared\win\WebURLRequestWin.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\win\WebURLResponseWin.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> + </Filter> + <Filter + Name="cg" + > + <File + RelativePath="..\Shared\cg\ShareableBitmapCG.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> + </Filter> + <Filter + Name="cairo" + > + <File + RelativePath="..\Shared\cairo\ShareableBitmapCairo.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Plugins" + > + <Filter + Name="Netscape" + > + <File + RelativePath="..\Shared\Plugins\Netscape\NetscapePluginModule.cpp" + > + </File> + <File + RelativePath="..\Shared\Plugins\Netscape\NetscapePluginModule.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\Shared\Plugins\Netscape\win\NetscapePluginModuleWin.cpp" + > + </File> + </Filter> + </Filter> + </Filter> + </Filter> + <Filter + Name="WebProcess" + > + <File + RelativePath="..\WebProcess\WebKitMain.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebProcess.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebProcess.h" + > + </File> + <File + RelativePath="..\WebProcess\WebProcess.messages.in" + > + </File> + <File + RelativePath="..\WebProcess\WebProcessMain.h" + > + </File> + <Filter + Name="Authentication" + > + <File + RelativePath="..\WebProcess\Authentication\AuthenticationManager.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Authentication\AuthenticationManager.h" + > + </File> + <File + RelativePath="..\WebProcess\Authentication\AuthenticationManager.messages.in" + > + </File> + </Filter> + <Filter + Name="Geolocation" + > + <File + RelativePath="..\WebProcess\Geolocation\GeolocationPermissionRequestManager.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Geolocation\GeolocationPermissionRequestManager.h" + > + </File> + <File + RelativePath="..\WebProcess\Geolocation\WebGeolocationManager.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Geolocation\WebGeolocationManager.h" + > + </File> + <File + RelativePath="..\WebProcess\Geolocation\WebGeolocationManager.messages.in" + > + </File> + </Filter> + <Filter + Name="WebCoreSupport" + > + <File + RelativePath="..\WebProcess\WebCoreSupport\WebChromeClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebChromeClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebContextMenuClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebContextMenuClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebDatabaseManager.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebDatabaseManager.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebDatabaseManager.messages.in" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebDragClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebDragClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebEditorClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebEditorClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebErrors.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebFrameLoaderClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebFrameLoaderClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebGeolocationClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebGeolocationClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebInspectorClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebInspectorClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebInspectorFrontendClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebInspectorFrontendClient.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebPlatformStrategies.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebPlatformStrategies.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebPopupMenu.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebPopupMenu.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebSearchPopupMenu.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\WebSearchPopupMenu.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebContextMenuClientWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebDatabaseManagerWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebErrorsWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebFrameNetworkingContext.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebFrameNetworkingContext.h" + > + </File> + <File + RelativePath="..\WebProcess\WebCoreSupport\win\WebPopupMenuWin.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="WebPage" + > + <File + RelativePath="..\WebProcess\WebPage\ChunkedUpdateDrawingArea.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\ChunkedUpdateDrawingArea.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\DecoderAdapter.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\DecoderAdapter.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\DrawingArea.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\DrawingArea.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\EncoderAdapter.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\EncoderAdapter.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\FindController.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\FindController.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\LayerBackedDrawingArea.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\LayerBackedDrawingArea.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\PageOverlay.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\PageOverlay.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebBackForwardListProxy.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebBackForwardListProxy.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebContextMenu.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebContextMenu.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebEditCommand.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebEditCommand.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebFrame.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebFrame.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebInspector.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebInspector.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebInspector.messages.in" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebOpenPanelResultListener.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebOpenPanelResultListener.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebPage.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebPage.h" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebPage.messages.in" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebPageGroupProxy.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\WebPageGroupProxy.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\WebPage\win\ChunkedUpdateDrawingAreaWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\win\LayerBackedDrawingAreaWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\win\WebInspectorWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\WebPage\win\WebPageWin.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\win\WebProcessMainWin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\win\WebProcessWin.cpp" + > + </File> + </Filter> + <Filter + Name="Downloads" + > + <File + RelativePath="..\WebProcess\Downloads\Download.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Downloads\Download.h" + > + </File> + <File + RelativePath="..\WebProcess\Downloads\DownloadManager.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Downloads\DownloadManager.h" + > + </File> + <Filter + Name="cf" + > + <File + RelativePath="..\WebProcess\Downloads\cf\DownloadCFNet.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> + </Filter> + <Filter + Name="curl" + > + <File + RelativePath="..\WebProcess\Downloads\curl\DownloadCurl.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + </Filter> + </Filter> + <Filter + Name="InjectedBundle" + > + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundle.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleBackForwardList.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleBackForwardList.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleBackForwardListItem.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleBackForwardListItem.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleHitTestResult.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleHitTestResult.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageContextMenuClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageContextMenuClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageEditorClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageEditorClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageFormClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageFormClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageLoaderClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageLoaderClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageUIClient.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundlePageUIClient.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleScriptWorld.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleScriptWorld.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\InjectedBundleUserMessageCoders.h" + > + </File> + <Filter + Name="API" + > + <Filter + Name="c" + > + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundle.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleAPICast.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardList.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardList.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardListItem.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleBackForwardListItem.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleFrame.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleFrame.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleInitialize.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandlePrivate.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePage.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="DOM" + > + <File + RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleNodeHandle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleNodeHandle.h" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleRangeHandle.cpp" + > + </File> + <File + RelativePath="..\WebProcess\InjectedBundle\DOM\InjectedBundleRangeHandle.h" + > + </File> + </Filter> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\InjectedBundle\win\InjectedBundleWin.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="Plugins" + > + <File + RelativePath="..\WebProcess\Plugins\Plugin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Plugin.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\PluginController.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\PluginView.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\PluginView.h" + > + </File> + <Filter + Name="Netscape" + > + <File + RelativePath="..\WebProcess\Plugins\Netscape\JSNPMethod.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\JSNPMethod.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\JSNPObject.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\JSNPObject.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapeBrowserFuncs.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapeBrowserFuncs.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapePlugin.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapePlugin.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapePluginStream.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NetscapePluginStream.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPJSObject.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPJSObject.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPRuntimeObjectMap.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPRuntimeObjectMap.h" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPRuntimeUtilities.cpp" + > + </File> + <File + RelativePath="..\WebProcess\Plugins\Netscape\NPRuntimeUtilities.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\WebProcess\Plugins\Netscape\win\NetscapePluginWin.cpp" + > + </File> + </Filter> + </Filter> + </Filter> + </Filter> + <Filter + Name="UIProcess" + > + <File + RelativePath="..\UIProcess\ChunkedUpdateDrawingAreaProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\ChunkedUpdateDrawingAreaProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\DrawingAreaProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\DrawingAreaProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\FindIndicator.cpp" + > + </File> + <File + RelativePath="..\UIProcess\FindIndicator.h" + > + </File> + <File + RelativePath="..\UIProcess\GenericCallback.h" + > + </File> + <File + RelativePath="..\UIProcess\GeolocationPermissionRequestManagerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\GeolocationPermissionRequestManagerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\GeolocationPermissionRequestProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\GeolocationPermissionRequestProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\LayerBackedDrawingAreaProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\LayerBackedDrawingAreaProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\PageClient.h" + > + </File> + <File + RelativePath="..\UIProcess\ProcessModel.h" + > + </File> + <File + RelativePath="..\UIProcess\ResponsivenessTimer.cpp" + > + </File> + <File + RelativePath="..\UIProcess\ResponsivenessTimer.h" + > + </File> + <File + RelativePath="..\UIProcess\TextChecker.h" + > + </File> + <File + RelativePath="..\UIProcess\VisitedLinkProvider.cpp" + > + </File> + <File + RelativePath="..\UIProcess\VisitedLinkProvider.h" + > + </File> + <File + RelativePath="..\UIProcess\WebBackForwardList.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebBackForwardList.h" + > + </File> + <File + RelativePath="..\UIProcess\WebContext.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebContext.h" + > + </File> + <File + RelativePath="..\UIProcess\WebContext.messages.in" + > + </File> + <File + RelativePath="..\UIProcess\WebContextInjectedBundleClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebContextInjectedBundleClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebContextMenuProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebContextMenuProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebContextUserMessageCoders.h" + > + </File> + <File + RelativePath="..\UIProcess\WebDatabaseManagerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebDatabaseManagerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebDatabaseManagerProxy.messages.in" + > + </File> + <File + RelativePath="..\UIProcess\WebDatabaseManagerProxyClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebDatabaseManagerProxyClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebDownloadClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebDownloadClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebEditCommandProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebEditCommandProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFindClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFindClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFormClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFormClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFormSubmissionListenerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFormSubmissionListenerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFrameListenerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFrameListenerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFramePolicyListenerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFramePolicyListenerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebFrameProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebFrameProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebGeolocationManagerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebGeolocationManagerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebGeolocationManagerProxy.messages.in" + > + </File> + <File + RelativePath="..\UIProcess\WebGeolocationProvider.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebGeolocationProvider.h" + > + </File> + <File + RelativePath="..\UIProcess\WebHistoryClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebHistoryClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebInspectorProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebInspectorProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebLoaderClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebLoaderClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebNavigationData.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebNavigationData.h" + > + </File> + <File + RelativePath="..\UIProcess\WebOpenPanelResultListenerProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebOpenPanelResultListenerProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebPageContextMenuClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebPageContextMenuClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebPageGroup.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebPageGroup.h" + > + </File> + <File + RelativePath="..\UIProcess\WebPageProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebPageProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebPageProxy.messages.in" + > + </File> + <File + RelativePath="..\UIProcess\WebPolicyClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebPolicyClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebPreferences.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebPreferences.h" + > + </File> + <File + RelativePath="..\UIProcess\WebProcessManager.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebProcessManager.h" + > + </File> + <File + RelativePath="..\UIProcess\WebProcessProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebProcessProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\WebProcessProxy.messages.in" + > + </File> + <File + RelativePath="..\UIProcess\WebResourceLoadClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebResourceLoadClient.h" + > + </File> + <File + RelativePath="..\UIProcess\WebUIClient.cpp" + > + </File> + <File + RelativePath="..\UIProcess\WebUIClient.h" + > + </File> + <Filter + Name="API" + > + <Filter + Name="C" + > + <File + RelativePath="..\UIProcess\API\C\WebKit2.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKAPICast.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKAuthenticationChallenge.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKAuthenticationChallenge.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKAuthenticationDecisionListener.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKAuthenticationDecisionListener.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKBackForwardList.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKBackForwardList.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKBackForwardListItem.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKBackForwardListItem.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKContext.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKContext.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKContextPrivate.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKContextPrivateWin.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKContextWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKCredential.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKCredential.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKCredentialTypes.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKDatabaseManager.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKDatabaseManager.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKDownload.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKDownload.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFormSubmissionListener.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFormSubmissionListener.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFrame.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFrame.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFramePolicyListener.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKFramePolicyListener.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationManager.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationManager.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationPermissionRequest.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationPermissionRequest.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationPosition.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKGeolocationPosition.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKInspector.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKInspector.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKNativeEvent.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKNavigationData.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKNavigationData.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKOpenPanelParameters.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKOpenPanelParameters.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKOpenPanelResultListener.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKOpenPanelResultListener.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPage.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPage.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPageGroup.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPageGroup.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPagePrivate.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPreferences.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPreferences.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKPreferencesPrivate.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKProtectionSpace.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKProtectionSpace.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\WKProtectionSpaceTypes.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\UIProcess\API\C\win\WKAPICastWin.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKBaseWin.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKView.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKView.h" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKViewPrivate.cpp" + > + </File> + <File + RelativePath="..\UIProcess\API\C\win\WKViewPrivate.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="cpp" + > + <File + RelativePath="..\UIProcess\API\cpp\WKRetainPtr.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Authentication" + > + <File + RelativePath="..\UIProcess\Authentication\AuthenticationChallengeProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\AuthenticationChallengeProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\AuthenticationDecisionListener.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\AuthenticationDecisionListener.h" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\WebCredential.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\WebCredential.h" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\WebProtectionSpace.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Authentication\WebProtectionSpace.h" + > + </File> + </Filter> + <Filter + Name="cf" + > + <File + RelativePath="..\UIProcess\cf\WebBackForwardListCF.cpp" + > + </File> + <File + RelativePath="..\UIProcess\cf\WebPageProxyCF.cpp" + > + </File> + <File + RelativePath="..\UIProcess\cf\WebPreferencesCF.cpp" + > + </File> + </Filter> + <Filter + Name="Downloads" + > + <File + RelativePath="..\UIProcess\Downloads\DownloadProxy.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Downloads\DownloadProxy.h" + > + </File> + <File + RelativePath="..\UIProcess\Downloads\DownloadProxy.messages.in" + > + </File> + </Filter> + <Filter + Name="Launcher" + > + <File + RelativePath="..\UIProcess\Launcher\ProcessLauncher.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Launcher\ProcessLauncher.h" + > + </File> + <File + RelativePath="..\UIProcess\Launcher\ThreadLauncher.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Launcher\ThreadLauncher.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\UIProcess\Launcher\win\ProcessLauncherWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Launcher\win\ThreadLauncherWin.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="win" + > + <File + RelativePath="..\UIProcess\win\ChunkedUpdateDrawingAreaProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\LayerBackedDrawingAreaProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\TextCheckerWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebContextMenuProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebContextMenuProxyWin.h" + > + </File> + <File + RelativePath="..\UIProcess\win\WebContextWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebInspectorProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebPageProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebPopupMenuProxyWin.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebPopupMenuProxyWin.h" + > + </File> + <File + RelativePath="..\UIProcess\win\WebView.cpp" + > + </File> + <File + RelativePath="..\UIProcess\win\WebView.h" + > + </File> + </Filter> + <Filter + Name="Plugins" + > + <File + RelativePath="..\UIProcess\Plugins\PluginInfoStore.cpp" + > + </File> + <File + RelativePath="..\UIProcess\Plugins\PluginInfoStore.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\UIProcess\Plugins\win\PluginInfoStoreWin.cpp" + > + </File> + </Filter> + </Filter> + </Filter> + <Filter + Name="Platform" + > + <File + RelativePath="..\Platform\Logging.cpp" + > + </File> + <File + RelativePath="..\Platform\Logging.h" + > + </File> + <File + RelativePath="..\Platform\Module.cpp" + > + </File> + <File + RelativePath="..\Platform\Module.h" + > + </File> + <File + RelativePath="..\Platform\PlatformProcessIdentifier.h" + > + </File> + <File + RelativePath="..\Platform\RunLoop.cpp" + > + </File> + <File + RelativePath="..\Platform\RunLoop.h" + > + </File> + <File + RelativePath="..\Platform\SharedMemory.h" + > + </File> + <File + RelativePath="..\Platform\WorkItem.h" + > + </File> + <File + RelativePath="..\Platform\WorkQueue.cpp" + > + </File> + <File + RelativePath="..\Platform\WorkQueue.h" + > + </File> + <Filter + Name="cg" + > + <File + RelativePath="..\Platform\cg\CGUtilities.cpp" + > + </File> + <File + RelativePath="..\Platform\cg\CGUtilities.h" + > + </File> + </Filter> + <Filter + Name="win" + > + <File + RelativePath="..\Platform\win\ModuleWin.cpp" + > + </File> + <File + RelativePath="..\Platform\win\RunLoopWin.cpp" + > + </File> + <File + RelativePath="..\Platform\win\SharedMemoryWin.cpp" + > + </File> + <File + RelativePath="..\Platform\win\WorkQueueWin.cpp" + > + </File> + </Filter> + <Filter + Name="CoreIPC" + > + <File + RelativePath="..\Platform\CoreIPC\ArgumentCoder.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\ArgumentCoders.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\ArgumentDecoder.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\ArgumentDecoder.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\ArgumentEncoder.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\ArgumentEncoder.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\Arguments.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\Attachment.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\Attachment.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\BinarySemaphore.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\BinarySemaphore.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\Connection.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\Connection.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\CoreIPCMessageKinds.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\DataReference.cpp" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\DataReference.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\HandleMessage.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\MessageID.h" + > + </File> + <File + RelativePath="..\Platform\CoreIPC\MessageSender.h" + > + </File> + <Filter + Name="win" + > + <File + RelativePath="..\Platform\CoreIPC\win\ConnectionWin.cpp" + > + </File> + </Filter> + </Filter> + </Filter> + <Filter + Name="Resources" + > + <File + RelativePath=".\deleteButton.png" + > + </File> + <File + RelativePath=".\deleteButtonPressed.png" + > + </File> + <File + RelativePath=".\fsVideoAudioVolumeHigh.png" + > + </File> + <File + RelativePath=".\fsVideoAudioVolumeLow.png" + > + </File> + <File + RelativePath=".\fsVideoExitFullscreen.png" + > + </File> + <File + RelativePath=".\fsVideoPause.png" + > + </File> + <File + RelativePath=".\fsVideoPlay.png" + > + </File> + <File + RelativePath=".\missingImage.png" + > + </File> + <File + RelativePath=".\nullplugin.png" + > + </File> + <File + RelativePath=".\panEastCursor.png" + > + </File> + <File + RelativePath=".\panIcon.png" + > + </File> + <File + RelativePath=".\panNorthCursor.png" + > + </File> + <File + RelativePath=".\panNorthEastCursor.png" + > + </File> + <File + RelativePath=".\panNorthWestCursor.png" + > + </File> + <File + RelativePath=".\panSouthCursor.png" + > + </File> + <File + RelativePath=".\panSouthEastCursor.png" + > + </File> + <File + RelativePath=".\panSouthWestCursor.png" + > + </File> + <File + RelativePath=".\panWestCursor.png" + > + </File> + <File + RelativePath=".\searchCancel.png" + > + </File> + <File + RelativePath=".\searchCancelPressed.png" + > + </File> + <File + RelativePath=".\searchMagnifier.png" + > + </File> + <File + RelativePath=".\searchMagnifierResults.png" + > + </File> + <File + RelativePath=".\textAreaResizeCorner.png" + > + </File> + <File + RelativePath=".\verticalTextCursor.png" + > + </File> + <File + RelativePath=".\WebKit2.rc" + > + </File> + <File + RelativePath=".\zoomInCursor.png" + > + </File> + <File + RelativePath=".\zoomOutCursor.png" + > + </File> + </Filter> + <Filter + Name="Derived Sources" + > + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\AuthenticationManagerMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\AuthenticationManagerMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DownloadProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DownloadProxyMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebContextMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebContextMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebDatabaseManagerProxyMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebGeolocationManagerMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebGeolocationManagerMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebGeolocationManagerProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebGeolocationManagerProxyMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebInspectorMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebInspectorMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebInspectorProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebInspectorProxyMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebPageMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebPageMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebPageProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebPageProxyMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebProcessMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebProcessMessages.h" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebProcessProxyMessageReceiver.cpp" + > + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\WebProcessProxyMessages.h" + > + </File> + </Filter> + <Filter + Name="Scripts" + > + <File + RelativePath="..\Scripts\generate-message-receiver.py" + > + </File> + <File + RelativePath="..\Scripts\generate-messages-header.py" + > + </File> + <Filter + Name="webkit2" + > + <File + RelativePath="..\Scripts\webkit2\__init__.py" + > + </File> + <File + RelativePath="..\Scripts\webkit2\messages.py" + > + </File> + <File + RelativePath="..\Scripts\webkit2\messages_unittest.py" + > + </File> + </Filter> + </Filter> + <File + RelativePath=".\WebKit2.def" + > + </File> + <File + RelativePath="..\WebKit2Prefix.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="WebKit2Prefix.h" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\WebKit2Prefix.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Source/WebKit2/win/WebKit2Apple.vsprops b/Source/WebKit2/win/WebKit2Apple.vsprops new file mode 100644 index 0000000..4cec313 --- /dev/null +++ b/Source/WebKit2/win/WebKit2Apple.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2Apple" + > + <Tool + Name="VCLinkerTool" + AdditionalDependencies="CFNetwork$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib QTMovieWin$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib" + ModuleDefinitionFile="WebKit2.def" + DelayLoadDLLs="QTMovieWin$(WebKitConfigSuffix).dll" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def new file mode 100644 index 0000000..848a646 --- /dev/null +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -0,0 +1,127 @@ +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + RunAsLocalServer PRIVATE + LocalServerDidDie PRIVATE + setUseOpenSourceWebKit + shutDownWebKit + progIDForClass + WebLocalizedStringUTF8 + WebLocalizedLPCTSTRUTF8 + WebKitCreateInstance + + ; These functions are deprecated + WebLocalizedString + WebLocalizedLPCTSTR + SetWebLocalizedStringMainBundle + + ; Deprecated re-exports from JavaScriptCore + JSCheckScriptSyntax + JSClassCreate + JSClassRelease + JSClassRetain + JSContextGetGlobalObject + JSContextGetGroup + JSContextGroupCreate + JSContextGroupRelease + JSContextGroupRetain + JSEvaluateScript + JSGarbageCollect + JSGlobalContextCreate + JSGlobalContextCreateInGroup + JSGlobalContextRelease + JSGlobalContextRetain + JSObjectCallAsConstructor + JSObjectCallAsFunction + JSObjectCopyPropertyNames + JSObjectDeleteProperty + JSObjectGetPrivate + JSObjectGetProperty + JSObjectGetPropertyAtIndex + JSObjectGetPrototype + JSObjectHasProperty + JSObjectIsConstructor + JSObjectIsFunction + JSObjectMake + JSObjectMakeArray + JSObjectMakeConstructor + JSObjectMakeDate + JSObjectMakeError + JSObjectMakeFunction + JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp + JSObjectSetPrivate + JSObjectSetProperty + JSObjectSetPropertyAtIndex + JSObjectSetPrototype + JSPropertyNameAccumulatorAddName + JSPropertyNameArrayGetCount + JSPropertyNameArrayGetNameAtIndex + JSPropertyNameArrayRelease + JSPropertyNameArrayRetain + JSStringCopyBSTR + JSStringCopyCFString + JSStringCreateWithBSTR + JSStringCreateWithCFString + JSStringCreateWithCharacters + JSStringCreateWithUTF8CString + JSStringGetCharactersPtr + JSStringGetLength + JSStringGetMaximumUTF8CStringSize + JSStringGetUTF8CString + JSStringIsEqual + JSStringIsEqualToUTF8CString + JSStringRelease + JSStringRetain + JSValueGetType + JSValueIsBoolean + JSValueIsEqual + JSValueIsInstanceOfConstructor + JSValueIsNull + JSValueIsNumber + JSValueIsObject + JSValueIsObjectOfClass + JSValueIsStrictEqual + JSValueIsString + JSValueIsUndefined + JSValueMakeBoolean + JSValueMakeNull + JSValueMakeNumber + JSValueMakeString + JSValueMakeUndefined + JSValueProtect + JSValueToBoolean + JSValueToNumber + JSValueToObject + JSValueToStringCopy + JSValueUnprotect + ?fastMalloc@WTF@@YAPAXI@Z + ?fastZeroedMalloc@WTF@@YAPAXI@Z + ?fastFree@WTF@@YAXPAX@Z + ?fastCalloc@WTF@@YAPAXII@Z + ??0Mutex@WTF@@QAE@XZ + ??0ThreadCondition@WTF@@QAE@XZ + ??1Mutex@WTF@@QAE@XZ + ??1ThreadCondition@WTF@@QAE@XZ + ?broadcast@ThreadCondition@WTF@@QAEXXZ + ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z + ?currentThread@WTF@@YAIXZ + ?detachThread@WTF@@YAXI@Z + ?initializeMainThread@WTF@@YAXXZ + ?initializeThreading@WTF@@YAXXZ + ?isMainThread@WTF@@YA_NXZ + ?lock@Mutex@WTF@@QAEXXZ + ?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?signal@ThreadCondition@WTF@@QAEXXZ + ?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z + ?tlsKeyCount@WTF@@YAAAJXZ + ?tlsKeys@WTF@@YAPAKXZ + ?tryLock@Mutex@WTF@@QAE_NXZ + ?unlock@Mutex@WTF@@QAEXXZ + ?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z + ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.vsprops b/Source/WebKit2/win/WebKit2CFLite.vsprops new file mode 100644 index 0000000..bb62286 --- /dev/null +++ b/Source/WebKit2/win/WebKit2CFLite.vsprops @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2CFLite" + > + <Tool + Name="VCLinkerTool" + AdditionalDependencies="CFLite$(LibraryConfigSuffix).lib" + ModuleDefinitionFile="WebKit2CFLite.def" + AdditionalLibraryDirectories="" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2Common.vsprops b/Source/WebKit2/win/WebKit2Common.vsprops new file mode 100755 index 0000000..ab53421 --- /dev/null +++ b/Source/WebKit2/win/WebKit2Common.vsprops @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2Common" + > + <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"" + PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;BUILDING_WEBKIT" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="WebKit2Prefix.h" + DisableSpecificWarnings="4819" + ForcedIncludeFiles="WebKit2Prefix.h;ICUVersion.h" + /> + <Tool + Name="VCLinkerTool" + 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" + /> + <Tool + Name="VCResourceCompilerTool" + AdditionalIncludeDirectories="$(ConfigurationBuildDir)\obj\WebKit2\" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2DirectX.vsprops b/Source/WebKit2/win/WebKit2DirectX.vsprops new file mode 100644 index 0000000..1d38708 --- /dev/null +++ b/Source/WebKit2/win/WebKit2DirectX.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2DirectX" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(DXSDK_DIR)\Include"" + /> + <Tool + Name="VCLinkerTool" + AdditionalLibraryDirectories="$(DXSDK_DIR)\Lib\x86" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2Generated.make b/Source/WebKit2/win/WebKit2Generated.make new file mode 100644 index 0000000..9460ab5 --- /dev/null +++ b/Source/WebKit2/win/WebKit2Generated.make @@ -0,0 +1,90 @@ +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" + +clean: + -del "$(CONFIGURATIONBUILDDIR)\buildfailed" + -del /s /q "$(CONFIGURATIONBUILDDIR)\include\WebKit2" diff --git a/Source/WebKit2/win/WebKit2Generated.vcproj b/Source/WebKit2/win/WebKit2Generated.vcproj new file mode 100755 index 0000000..555c24a --- /dev/null +++ b/Source/WebKit2/win/WebKit2Generated.vcproj @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2Generated" + ProjectGUID="{2EDAD637-CBA8-4E55-97ED-7D2BBC336FDB}" + RootNamespace="WebKit2Generated" + Keyword="MakeFileProj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + <Configuration + Name="Debug_All|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + <Configuration + Name="Release_LTCG|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + <Configuration + Name="Release_Cairo_CFLite|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + <Configuration + Name="Debug_Cairo_CFLite|Win32" + ConfigurationType="0" + InheritedPropertySheets=".\WebKit2GeneratedCommon.vsprops" + > + <Tool + Name="VCNMakeTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\build-generated-files.sh" + > + </File> + <File + RelativePath="..\DerivedSources.make" + > + </File> + <File + RelativePath=".\WebKit2Generated.make" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Source/WebKit2/win/WebKit2GeneratedCommon.vsprops b/Source/WebKit2/win/WebKit2GeneratedCommon.vsprops new file mode 100644 index 0000000..f57f11b --- /dev/null +++ b/Source/WebKit2/win/WebKit2GeneratedCommon.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2GeneratedCommon" + OutputDirectory="$(ConfigurationBuildDir)\lib" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
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"

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
nmake /nologo -f WebKit2Generated.make

if exist "$(ConfigurationBuildDir)\buildfailed" del "$(ConfigurationBuildDir)\buildfailed"
" + ReBuildCommandLine="echo XX$(ProjectName)XX > "$(ConfigurationBuildDir)\buildfailed"

%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
nmake /nologo -f WebKit2Generated.make clean
nmake -f WebKit2Generated.make

if exist "$(ConfigurationBuildDir)\buildfailed" del "$(ConfigurationBuildDir)\buildfailed"
" + CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
nmake /nologo -f WebKit2Generated.make clean

if exist "$(ConfigurationBuildDir)\buildfailed" del "$(ConfigurationBuildDir)\buildfailed"
" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2WebProcess.rc b/Source/WebKit2/win/WebKit2WebProcess.rc new file mode 100644 index 0000000..8e8e4b7 --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcess.rc @@ -0,0 +1,47 @@ +// Microsoft Visual C++ generated resource script. +// +#include "autoversion.h" +#include "winresrc.h" + +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ + PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "WebKit2WebProcess" + VALUE "FileVersion", __VERSION_TEXT__ + VALUE "CompanyName", "Apple Inc." + VALUE "InternalName", "WebKit2WebProcess" + VALUE "LegalCopyright", "Copyright Apple Inc. 2003-" __COPYRIGHT_YEAR_END_TEXT__ + VALUE "OriginalFilename", "WebKit2WebProcess.exe" + VALUE "ProductName", "WebKit2" + VALUE "ProductVersion", __BUILD_NUMBER_SHORT__ + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Source/WebKit2/win/WebKit2WebProcess.vcproj b/Source/WebKit2/win/WebKit2WebProcess.vcproj new file mode 100755 index 0000000..a65ce04 --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcess.vcproj @@ -0,0 +1,411 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2WebProcess" + ProjectGUID="{AAE88FEF-509E-4D49-870B-7357922C276F}" + RootNamespace="WebKit2WebProcess" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_All|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_Cairo_CFLite|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_LTCG|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_Cairo_CFLite|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WebKit2WebProcessCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\MainWin.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <File + RelativePath=".\WebKit2WebProcess.rc" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops b/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops new file mode 100644 index 0000000..4a79706 --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcessCommon.vsprops @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WebKit2WebProcessCommon" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ProjectDir)\..\WebProcess\win"" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="WebKit$(WebKitDLLConfigSuffix).lib" + /> +</VisualStudioPropertySheet> diff --git a/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd b/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd new file mode 100644 index 0000000..26707ca --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcessPostBuild.cmd @@ -0,0 +1 @@ +if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd b/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd new file mode 100644 index 0000000..21af383 --- /dev/null +++ b/Source/WebKit2/win/WebKit2WebProcessPreBuild.cmd @@ -0,0 +1,8 @@ +%SystemDrive%\cygwin\bin\which.exe bash +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" + +bash "%WEBKITLIBRARIESDIR%\tools\scripts\auto-version.sh" "%INTDIR%" diff --git a/Source/WebKit2/win/WebKitPostBuild.cmd b/Source/WebKit2/win/WebKitPostBuild.cmd new file mode 100644 index 0000000..26707ca --- /dev/null +++ b/Source/WebKit2/win/WebKitPostBuild.cmd @@ -0,0 +1 @@ +if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed" diff --git a/Source/WebKit2/win/WebKitPreBuild.cmd b/Source/WebKit2/win/WebKitPreBuild.cmd new file mode 100644 index 0000000..b6f0bd4 --- /dev/null +++ b/Source/WebKit2/win/WebKitPreBuild.cmd @@ -0,0 +1,16 @@ +%SystemDrive%\cygwin\bin\which.exe bash +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" + +touch "%CONFIGURATIONBUILDDIR%\tmp.cpp" +cl /analyze /nologo /c "%CONFIGURATIONBUILDDIR%\tmp.cpp" /Fo"%INTDIR%\tmp.obj" 2>&1 | findstr D9040 +if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false") +if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="") + +mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\include\JavaScriptCore" +xcopy /y /d "%WEBKITLIBRARIESDIR%\include\JavaScriptCore\*" "%CONFIGURATIONBUILDDIR%\include\JavaScriptCore" + +bash "%WEBKITLIBRARIESDIR%\tools\scripts\auto-version.sh" "%INTDIR%" diff --git a/Source/WebKit2/win/WebKitPreLink.cmd b/Source/WebKit2/win/WebKitPreLink.cmd new file mode 100644 index 0000000..8523026 --- /dev/null +++ b/Source/WebKit2/win/WebKitPreLink.cmd @@ -0,0 +1,9 @@ +mkdir 2>NUL "%INTDIR%\lib" + +if exist "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" +if exist "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" + +if exist "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib" +if exist "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib" + +cmd /c diff --git a/Source/WebKit2/win/build-generated-files.sh b/Source/WebKit2/win/build-generated-files.sh new file mode 100644 index 0000000..fd8b59e --- /dev/null +++ b/Source/WebKit2/win/build-generated-files.sh @@ -0,0 +1,34 @@ +# 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. + +# Calls to `cygpath -ms` below are needed to remove spaces from paths, which +# confuse GNU make. See <http://webkit.org/b/8173>. + +WebKitOutputDir=$(cygpath -u "$(cygpath -ms "${1}")") +DerivedSources="${WebKitOutputDir}/obj/WebKit/DerivedSources" + +export WebKit2=$(cygpath -u "$(cygpath -ms "$(realpath ..)")") + +mkdir -p "${DerivedSources}" +cd "${DerivedSources}" + +make -f "${WebKit2}/DerivedSources.make" diff --git a/Source/WebKit2/win/deleteButton.png b/Source/WebKit2/win/deleteButton.png Binary files differnew file mode 100644 index 0000000..8f1b881 --- /dev/null +++ b/Source/WebKit2/win/deleteButton.png diff --git a/Source/WebKit2/win/deleteButtonPressed.png b/Source/WebKit2/win/deleteButtonPressed.png Binary files differnew file mode 100644 index 0000000..77d31ca --- /dev/null +++ b/Source/WebKit2/win/deleteButtonPressed.png diff --git a/Source/WebKit2/win/fsVideoAudioVolumeHigh.png b/Source/WebKit2/win/fsVideoAudioVolumeHigh.png Binary files differnew file mode 100755 index 0000000..d04df37 --- /dev/null +++ b/Source/WebKit2/win/fsVideoAudioVolumeHigh.png diff --git a/Source/WebKit2/win/fsVideoAudioVolumeLow.png b/Source/WebKit2/win/fsVideoAudioVolumeLow.png Binary files differnew file mode 100755 index 0000000..e824a21 --- /dev/null +++ b/Source/WebKit2/win/fsVideoAudioVolumeLow.png diff --git a/Source/WebKit2/win/fsVideoExitFullscreen.png b/Source/WebKit2/win/fsVideoExitFullscreen.png Binary files differnew file mode 100755 index 0000000..01ce692 --- /dev/null +++ b/Source/WebKit2/win/fsVideoExitFullscreen.png diff --git a/Source/WebKit2/win/fsVideoPause.png b/Source/WebKit2/win/fsVideoPause.png Binary files differnew file mode 100755 index 0000000..b98fb36 --- /dev/null +++ b/Source/WebKit2/win/fsVideoPause.png diff --git a/Source/WebKit2/win/fsVideoPlay.png b/Source/WebKit2/win/fsVideoPlay.png Binary files differnew file mode 100755 index 0000000..035aeb2 --- /dev/null +++ b/Source/WebKit2/win/fsVideoPlay.png diff --git a/Source/WebKit2/win/missingImage.png b/Source/WebKit2/win/missingImage.png Binary files differnew file mode 100644 index 0000000..f49a98d --- /dev/null +++ b/Source/WebKit2/win/missingImage.png diff --git a/Source/WebKit2/win/nullplugin.png b/Source/WebKit2/win/nullplugin.png Binary files differnew file mode 100644 index 0000000..a4195f6 --- /dev/null +++ b/Source/WebKit2/win/nullplugin.png diff --git a/Source/WebKit2/win/panEastCursor.png b/Source/WebKit2/win/panEastCursor.png Binary files differnew file mode 100644 index 0000000..9c1592e --- /dev/null +++ b/Source/WebKit2/win/panEastCursor.png diff --git a/Source/WebKit2/win/panIcon.png b/Source/WebKit2/win/panIcon.png Binary files differnew file mode 100644 index 0000000..4ca8d70 --- /dev/null +++ b/Source/WebKit2/win/panIcon.png diff --git a/Source/WebKit2/win/panNorthCursor.png b/Source/WebKit2/win/panNorthCursor.png Binary files differnew file mode 100644 index 0000000..0d020db --- /dev/null +++ b/Source/WebKit2/win/panNorthCursor.png diff --git a/Source/WebKit2/win/panNorthEastCursor.png b/Source/WebKit2/win/panNorthEastCursor.png Binary files differnew file mode 100644 index 0000000..0e89639 --- /dev/null +++ b/Source/WebKit2/win/panNorthEastCursor.png diff --git a/Source/WebKit2/win/panNorthWestCursor.png b/Source/WebKit2/win/panNorthWestCursor.png Binary files differnew file mode 100644 index 0000000..6723f61 --- /dev/null +++ b/Source/WebKit2/win/panNorthWestCursor.png diff --git a/Source/WebKit2/win/panSouthCursor.png b/Source/WebKit2/win/panSouthCursor.png Binary files differnew file mode 100644 index 0000000..60cf722 --- /dev/null +++ b/Source/WebKit2/win/panSouthCursor.png diff --git a/Source/WebKit2/win/panSouthEastCursor.png b/Source/WebKit2/win/panSouthEastCursor.png Binary files differnew file mode 100644 index 0000000..415aa63 --- /dev/null +++ b/Source/WebKit2/win/panSouthEastCursor.png diff --git a/Source/WebKit2/win/panSouthWestCursor.png b/Source/WebKit2/win/panSouthWestCursor.png Binary files differnew file mode 100644 index 0000000..8dc5cdc --- /dev/null +++ b/Source/WebKit2/win/panSouthWestCursor.png diff --git a/Source/WebKit2/win/panWestCursor.png b/Source/WebKit2/win/panWestCursor.png Binary files differnew file mode 100644 index 0000000..544439a --- /dev/null +++ b/Source/WebKit2/win/panWestCursor.png diff --git a/Source/WebKit2/win/resource.h b/Source/WebKit2/win/resource.h new file mode 100644 index 0000000..b999de6 --- /dev/null +++ b/Source/WebKit2/win/resource.h @@ -0,0 +1,44 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WebKit.rc +// +#define IDR_WEBKIT 1 +#define IDR_RESIZE_CORNER 2 +#define IDR_MISSING_IMAGE 3 +#define IDR_URL_ICON 4 +#define IDR_NULL_PLUGIN 5 +#define IDR_ZOOM_IN_CURSOR 6 +#define IDR_ZOOM_OUT_CURSOR 7 +#define IDR_VERTICAL_TEXT_CURSOR 8 +#define IDR_PAN_SCROLL_ICON 9 +#define IDR_PAN_SOUTH_CURSOR 10 +#define IDR_PAN_NORTH_CURSOR 11 +#define IDR_PAN_EAST_CURSOR 12 +#define IDR_PAN_WEST_CURSOR 13 +#define IDR_PAN_SOUTH_EAST_CURSOR 14 +#define IDR_PAN_SOUTH_WEST_CURSOR 15 +#define IDR_PAN_NORTH_EAST_CURSOR 16 +#define IDR_PAN_NORTH_WEST_CURSOR 17 +#define IDR_SEARCH_CANCEL 18 +#define IDR_SEARCH_CANCEL_PRESSED 19 +#define IDR_SEARCH_MAGNIFIER 20 +#define IDR_SEARCH_MAGNIFIER_RESULTS 21 +#define IDR_FS_VIDEO_AUDIO_VOLUME_HIGH 22 +#define IDR_FS_VIDEO_AUDIO_VOLUME_LOW 23 +#define IDR_FS_VIDEO_EXIT_FULLSCREEN 24 +#define IDR_FS_VIDEO_PAUSE 25 +#define IDR_FS_VIDEO_PLAY 26 +#define IDC_STATIC -1 + +#define BUILD_NUMBER 1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 22 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Source/WebKit2/win/searchCancel.png b/Source/WebKit2/win/searchCancel.png Binary files differnew file mode 100644 index 0000000..49f3f47 --- /dev/null +++ b/Source/WebKit2/win/searchCancel.png diff --git a/Source/WebKit2/win/searchCancelPressed.png b/Source/WebKit2/win/searchCancelPressed.png Binary files differnew file mode 100644 index 0000000..b699d81 --- /dev/null +++ b/Source/WebKit2/win/searchCancelPressed.png diff --git a/Source/WebKit2/win/searchMagnifier.png b/Source/WebKit2/win/searchMagnifier.png Binary files differnew file mode 100644 index 0000000..f9b8cae --- /dev/null +++ b/Source/WebKit2/win/searchMagnifier.png diff --git a/Source/WebKit2/win/searchMagnifierResults.png b/Source/WebKit2/win/searchMagnifierResults.png Binary files differnew file mode 100644 index 0000000..9aa1b36 --- /dev/null +++ b/Source/WebKit2/win/searchMagnifierResults.png diff --git a/Source/WebKit2/win/textAreaResizeCorner.png b/Source/WebKit2/win/textAreaResizeCorner.png Binary files differnew file mode 100644 index 0000000..023615e --- /dev/null +++ b/Source/WebKit2/win/textAreaResizeCorner.png diff --git a/Source/WebKit2/win/verticalTextCursor.png b/Source/WebKit2/win/verticalTextCursor.png Binary files differnew file mode 100644 index 0000000..0f2877c --- /dev/null +++ b/Source/WebKit2/win/verticalTextCursor.png diff --git a/Source/WebKit2/win/zoomInCursor.png b/Source/WebKit2/win/zoomInCursor.png Binary files differnew file mode 100644 index 0000000..feec9bc --- /dev/null +++ b/Source/WebKit2/win/zoomInCursor.png diff --git a/Source/WebKit2/win/zoomOutCursor.png b/Source/WebKit2/win/zoomOutCursor.png Binary files differnew file mode 100644 index 0000000..f4a954e --- /dev/null +++ b/Source/WebKit2/win/zoomOutCursor.png |