diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
commit | 5ef7c8a6a70875d4430752d146bdcb069605d71d (patch) | |
tree | f6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit2 | |
parent | decad929f578d8db641febc8740649ca6c574638 (diff) | |
download | qtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz |
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit2')
150 files changed, 4205 insertions, 1100 deletions
diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 06440b234..c43dd4ac8 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -56,6 +56,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/bridge/jsc" "${WEBCORE_DIR}/css" "${WEBCORE_DIR}/dom" + "${WEBCORE_DIR}/dom/default" "${WEBCORE_DIR}/editing" "${WEBCORE_DIR}/history" "${WEBCORE_DIR}/html" @@ -380,6 +381,7 @@ SET(WebKit2_SOURCES WebProcess/InjectedBundle/InjectedBundleClient.cpp WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp + WebProcess/InjectedBundle/InjectedBundleIntent.cpp WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp @@ -400,6 +402,7 @@ SET(WebKit2_SOURCES WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp + WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp @@ -464,6 +467,7 @@ SET(WebKit2_SOURCES WebProcess/WebPage/EventDispatcher.cpp WebProcess/WebPage/FindController.cpp + WebProcess/WebPage/AreaAllocator.cpp WebProcess/WebPage/LayerTreeHost.cpp WebProcess/WebPage/PageOverlay.cpp WebProcess/WebPage/TapHighlightController.cpp diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 3994b5c36..1ed41a373 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,1294 @@ +2012-08-21 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed build fix for newer Qt 5: QT += qmltest does not imply QT += testlib anymore, but + the code here needs QSignalSpy from QTestLib + + * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro: + * UIProcess/API/qt/tests/qmltests/WebView.pro: + +2012-08-18 John Sullivan <sullivan@apple.com> + + <https://bugs.webkit.org/show_bug.cgi?id=94486> + <rdar://problem/12128557> + REGRESSION (r121482, Lion-only): Closing a popover containing a WKView can crash + + Reviewed by Darin Adler. + + * UIProcess/API/mac/WKView.mm: + (-[WKView viewWillMoveToWindow:]): + Avoid calling the code added in 121482 that ensures that the undo stack is cleaned up + before the WKView is moved from one window to another when the WKView is being moved + out of a popover window. This avoids a bug in OS X 10.7 that was fixed in 10.8. + While this technically reopens a potentially crashing code path that 121482 closed, + it only reopens it for WKViews that are used for text editing and that are removed + from an NSPopover at some time earlier than tear-down of the NSPopover. + +2012-08-20 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Custom tap-highlight-color renders fully opaque + https://bugs.webkit.org/show_bug.cgi?id=94468 + + Reviewed by Kenneth Rohde Christiansen. + + Draw tap-highlight-color at 50% transparency, to better match how + existing WebKit browsers act on custom tap-highlight colors. + + * WebProcess/WebPage/TapHighlightController.cpp: + (WebKit::TapHighlightController::drawRect): + +2012-08-20 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Replace webkit_web_view_replace_content with webkit_web_view_load_alternate_html + https://bugs.webkit.org/show_bug.cgi?id=94471 + + Reviewed by Martin Robinson. + + In WebKit1 there's code to prevent that load signals are emitted + when loading internal custom error pages. We added + webkit_web_view_replace_content() with the same idea, but it has + ended up being problematic, because it allows to add any HTML + content (in WebKit1 we assumed internal error pages never failed + and always loaded) and it's impossible to know when the load has + finished. It also required a lot of logic to handle + replace_content as an especial case, in order to hide the fact + that it loads content. This patch renames + webkit_web_view_replace_content() as + webkit_web_view_load_alternate_html() and emit load events + normally. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (_WebKitWebViewPrivate): + (webkitWebViewLoadChanged): + (webkitWebViewLoadFailed): + (webkitWebViewSetEstimatedLoadProgress): + (webkitWebViewResourceLoadStarted): + (webkitWebViewGetLoadingWebResource): + (webkitWebViewRemoveLoadingWebResource): + (webkitWebViewResourceLoadFinished): + (webkit_web_view_load_alternate_html): + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: + * UIProcess/API/gtk/tests/TestLoaderClient.cpp: + (testLoadAlternateHTML): + (beforeAll): + * UIProcess/API/gtk/tests/TestResources.cpp: + (beforeAll): + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (beforeAll): + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (WebViewTest::loadAlternateHTML): + * UIProcess/API/gtk/tests/WebViewTest.h: + +2012-08-20 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Add unit tests for WKEinaSharedString + https://bugs.webkit.org/show_bug.cgi?id=94104 + + Reviewed by Kenneth Rohde Christiansen. + + Added unit tests for WKEinaSharedString class. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp: Added. + (checkString): + (TEST_F): + +2012-08-20 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to set preferred languages to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=90878 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebContext.cpp: + (webkit_web_context_set_preferred_languages): Public API to set a + list of preferred languages sorted from most desirable to least + desirable. + * UIProcess/API/gtk/WebKitWebContext.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp: + (testWebContextLanguages): + (serverCallback): + (beforeAll): + (afterAll): + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (resourceGetDataCallback): + (WebViewTest::mainResourceData): Moved from TestWebKitWebContext + to make it available to all WebViewTests. + * UIProcess/API/gtk/tests/WebViewTest.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::userPreferredLanguagesChanged): Notify our + observer that the languages have been overriden. + * WebProcess/gtk/WebProcessGtk.cpp: + (WebKit::buildAcceptLanguages): Helper function to build the + accept languages as specified in RFC 2616. + (WebKit::setSoupSessionAcceptLanguage): Set the accept-language + property of the default SoupSession. + (WebKit::languageChanged): Update the preferred languages in + SoupSession. + (WebKit::WebProcess::platformInitializeWebProcess): Add an + observer to be notified when the list of preferred languages is + updated. + (WebKit::WebProcess::platformTerminate): Remove the observer added + in platformInitializeWebProcess(). + +2012-08-19 Dan Bernstein <mitz@apple.com> + + WebPageProxy::setCursor does not check that the view is still in an active window + https://bugs.webkit.org/show_bug.cgi?id=94427 + + Reviewed by Alexey Proskuryakov. + + The Web process may ask to change the cursor when the view is in an active window, but + if by the time the UI process receives the message, the view is no longer in a window or the + window is not active , then the cursor should not change. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::setCursor): Added a check that the view is in an active window before + allowing the page to change the cursor. + +2012-08-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125972. + http://trac.webkit.org/changeset/125972 + https://bugs.webkit.org/show_bug.cgi?id=94431 + + Breaks AppleMac builds (Requested by pfeldman on #webkit). + + * UIProcess/API/gtk/WebKitWebContext.cpp: + * UIProcess/API/gtk/WebKitWebContext.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: + * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp: + (beforeAll): + (afterAll): + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (WebViewTest::WebViewTest): + * UIProcess/API/gtk/tests/WebViewTest.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::userPreferredLanguagesChanged): + * WebProcess/gtk/WebProcessGtk.cpp: + (WebKit::WebProcess::platformInitializeWebProcess): + (WebKit::WebProcess::platformTerminate): + +2012-08-19 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add API unit tests for Web Intents + https://bugs.webkit.org/show_bug.cgi?id=90454 + + Reviewed by Kenneth Rohde Christiansen. + + Add unit testing for Web intent requests, + including the "intent,request,new" signal on + the Ewk_View and the Ewk_Intent API. + + * UIProcess/API/efl/ewk_view.h: Fix documentation for argument type of "intent,request,new" signal. + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: + (EWK2UnitTest::EWK2UnitTestBase::mouseClick): Add utility method to simulate a click at given + coordinates. This is needed for testing functionality that requires a user gesture. + (EWK2UnitTest): + * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: + (EWK2UnitTestBase): + * UIProcess/API/efl/tests/resources/intent-request.html: Added. + * UIProcess/API/efl/tests/test_ewk2_intents.cpp: + (stringSortCb): + (onIntentReceived): + (TEST_F): + +2012-08-18 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to set preferred languages to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=90878 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebContext.cpp: + (webkit_web_context_set_preferred_languages): Public API to set a + list of preferred languages sorted from most desirable to least + desirable. + * UIProcess/API/gtk/WebKitWebContext.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp: + (testWebContextLanguages): + (serverCallback): + (beforeAll): + (afterAll): + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (resourceGetDataCallback): + (WebViewTest::mainResourceData): Moved from TestWebKitWebContext + to make it available to all WebViewTests. + * UIProcess/API/gtk/tests/WebViewTest.h: + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::userPreferredLanguagesChanged): Notify our + observer that the languages have been overriden. + * WebProcess/gtk/WebProcessGtk.cpp: + (WebKit::buildAcceptLanguages): Helper function to build the + accept languages as specified in RFC 2616. + (WebKit::setSoupSessionAcceptLanguage): Set the accept-language + property of the default SoupSession. + (WebKit::languageChanged): Update the preferred languages in + SoupSession. + (WebKit::WebProcess::platformInitializeWebProcess): Add an + observer to be notified when the list of preferred languages is + updated. + (WebKit::WebProcess::platformTerminate): Remove the observer added + in platformInitializeWebProcess(). + +2012-08-18 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] ewk_back_forward_list_item properties should be in sync with WebProcessProxy::m_backForwardListItemMap + https://bugs.webkit.org/show_bug.cgi?id=94248 + + Reviewed by Kenneth Rohde Christiansen. + + Currently ewk_back_forward_list_item properties are initialized from + WKBackForwardListItemRef once in the constructor and then just stored. + This is erroneous approach as back forward items can be initialized within + several iterations, meaning several ipc calls to UI process and several updates + of WebProcessProxy::m_backForwardListItemMap where the items are stored. + Hence the values of ewk_back_forward_list_item properties should be updated + with the corresponding WKBackForwardListItem function invokes every time + they are called. + + * UIProcess/API/efl/ewk_back_forward_list_item.cpp: + (_Ewk_Back_Forward_List_Item): Data members have to be mutable as assigned being const pointers. + (_Ewk_Back_Forward_List_Item::_Ewk_Back_Forward_List_Item): + (ewk_back_forward_list_item_uri_get): + (ewk_back_forward_list_item_title_get): + (ewk_back_forward_list_item_original_uri_get): + +2012-08-17 Enrica Casucci <enrica@apple.com> + + Adding back the first statement of WebProcessMain accidentally + removed in r125358. + + Reviewed by Sam Weinig. + + * WebProcess/mac/WebProcessMainMac.mm: Adding back the stripping + of DYLD_INSERT_LIBRARIES. + +2012-08-17 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] REGRESSION(r125923): Breaks EFL build + https://bugs.webkit.org/show_bug.cgi?id=94376 + + Reviewed by Alexey Proskuryakov. + + Fix EFL build break after r125923. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveIntentForFrame): + +2012-08-17 Alexey Proskuryakov <ap@apple.com> + + Access m_process directly in WebPageProxy.cpp + https://bugs.webkit.org/show_bug.cgi?id=94363 + + Reviewed by John Sullivan. + + Consistency fix - we don't use accessors when we don't have to, and there is a mix in this file. + + * UIProcess/WebPageProxy.cpp: + +2012-08-17 Claudio Saavedra <csaavedra@igalia.com> + + [GTK] Add WK2 API to get suggested filename for URI responses + https://bugs.webkit.org/show_bug.cgi?id=92967 + + Reviewed by Carlos Garcia Campos. + + Webcore has API to get the suggested filename for a response, add + a property and getter for it in WebKitURIResponse. + + * UIProcess/API/gtk/WebKitURIResponse.cpp: + (_WebKitURIResponsePrivate): Add a CString holding the value. + (webkitURIResponseGetProperty): Add the gobject bits for the + property. + (webkit_uri_response_class_init): Install the property. + (webkit_uri_response_get_suggested_filename): New getter. + * UIProcess/API/gtk/WebKitURIResponse.h: Declare the public + method. + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add the new API + symbols. + * UIProcess/API/gtk/tests/TestResources.cpp: + (testWebResourceSuggestedFilename): Test the new API. + (serverCallback): Add the the content-disposition header + in one case, in order to test it. + (beforeAll): Add the new test. + +2012-08-17 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][wk2] Add unit tests for back-forward list API + https://bugs.webkit.org/show_bug.cgi?id=92617 + + Reviewed by Kenneth Rohde Christiansen. + + Added unit tests covering the existing EFL WK2 back-forward list API. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/resources/default_test_page.html: + * UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp: Added. + (serverCallbackNavigation): + (checkItem): + (urlFromTitle): + (TEST_F): + +2012-08-17 Jeff Miller <jeffm@apple.com> + + UserMessageEncoder::baseEncode() should ASSERT when attempting to encode a non-shareable image + https://bugs.webkit.org/show_bug.cgi?id=94245 + + Reviewed by Alexey Proskuryakov. + + It's a programming error if a client attempts to encode an image that has an + allocated bitmap, but isn't shareable, so we should assert in this case. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + Assert if we're trying to encode valid non-shareable image. + +2012-08-17 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] [WK2] Add unit tests for vibration_client_callbacks_set API + https://bugs.webkit.org/show_bug.cgi?id=93890 + + Reviewed by Kenneth Rohde Christiansen. + + This patch covers unit testing of the Vibration API as delivered. + + * UIProcess/API/efl/tests/test_ewk2_context.cpp: + (VibrationCbData): + (vibrateCallback): + (cancelVibrationCallback): + (loadVibrationHTMLString): + (TEST_F): + +2012-08-17 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Rename WebKitWebView print-requested signal to print + https://bugs.webkit.org/show_bug.cgi?id=94306 + + Reviewed by Martin Robinson. + + WebKitWebView::print-requested is inconsistent with the rest of + the API. It's a true_handled signal that allows users to implement + their own print dialog, or block printing, or rely on + defaults. The signal should be WebKitWebView::print like other + signals (create, close, decide_policy, etc.) + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkit_web_view_class_init): + (webkitWebViewPrintFrame): + * UIProcess/API/gtk/WebKitWebView.h: + (_WebKitWebViewClass): + * UIProcess/API/gtk/tests/TestPrinting.cpp: + (webViewPrintCallback): + (testWebViewPrint): + (beforeAll): + +2012-08-17 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [EFL] [WK2] Free Eina Strbuf with eina_strbuf_free() instead of eina_strbuf_string_free() + https://bugs.webkit.org/show_bug.cgi?id=94312 + + Reviewed by Kenneth Rohde Christiansen. + + eina_strbuf_string_free() frees the contents of a string buffer but not the + buffer, so eina_strbuf_free() must be used to free the buffer. + + Contents of the buffer has already been take care by stealing it with + eina_strbuf_string_steal(), so no reason to call eina_strbuf_string_free(). + + * UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp: + (serverCallback): + +2012-08-17 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Getting unnecessary EINA_SAFETY_ON_NULL_RETURN_VAL warnings while page navigation + https://bugs.webkit.org/show_bug.cgi?id=94308 + + Reviewed by Kenneth Rohde Christiansen. + + The reason is that loadClient.didChangeBackForwardList callback is invoked with zero + arguments which is valid case while page back-forward navigation and means basically + that the back-froward list has changed but items were not added or deleted. + + * UIProcess/API/efl/ewk_back_forward_list.cpp: + (ewk_back_forward_list_changed): + +2012-08-16 Lauro Neto <lauro.neto@openbossa.org> + + [Qt] Failure to build with --no-inspector + https://bugs.webkit.org/show_bug.cgi?id=94148 + + Reviewed by Noam Rosenthal. + + Add guards around usage of inspector functions. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewExperimental::remoteInspectorUrl): + +2012-08-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Remove an unused variable + + Reviewed by Simon Hausmann. + + * UIProcess/API/qt/qquickwebpage.cpp: + (QQuickWebPagePrivate::QQuickWebPagePrivate): + * UIProcess/API/qt/qquickwebpage_p_p.h: + (QQuickWebPagePrivate): + +2012-08-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt][WK2] Change the default cache model to enable the page cache + https://bugs.webkit.org/show_bug.cgi?id=94221 + + Reviewed by Simon Hausmann. + + The default CacheModelDocumentViewer disables the memory back-forward page cache. + As uses of applications using QQuickWebView might vary, I'm setting the default to + CacheModelDocumentBrowser. + We should eventually expose this in the API to allow serious Web browsers setting it + to CacheModelPrimaryWebBrowser or to CacheModelDocumentViewer for application tight + on memory with limited page navigations. + + * UIProcess/qt/QtWebContext.cpp: + (WebKit::QtWebContext::defaultContext): + +2012-08-15 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Make sure that we don't prematurely force the first layout during loading. + https://bugs.webkit.org/show_bug.cgi?id=94106 + + Reviewed by Kenneth Rohde Christiansen. + + This would have the nasty effect that the frame loader would report the first layout + before loadCommitted was reported. This would resume the rendering engine prematurely, + showing blank content and reporting an empty contents size. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setFixedLayoutSize): + +2012-08-16 Marcelo Lira <marcelo.lira@openbossa.org> + + [Qt] Input method hints are not being set. + https://bugs.webkit.org/show_bug.cgi?id=92386 + + Reviewed by Kenneth Rohde Christiansen. + + Input method hints for an editable element must be obtained from a proper + HTML element. If the editable element is a complex one, it will have elements + in the Shadow DOM, and it's one of those that will be returned as the root + editable element. This works for editable DIVs, but not for INPUT elements. + Using Element::shadowHost() on the root editable element will provide the + needed HTML element, and for further clarity a method that does this was added + to FrameSelection. + + Added an API test to the Qt port regarding the correct setting + of input method hints information on INPUT HTML tags. + + * UIProcess/API/qt/tests/html/inputmethod.html: + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView): + (tst_QQuickWebView::inputMethodHints): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::editorState): + +2012-08-16 Zeno Albisser <zeno@webkit.org> + + Make GraphicsSurface double buffered by default. + https://bugs.webkit.org/show_bug.cgi?id=93252 + + Create only a single GraphicsSurface per canvas + on both supported platforms Mac/Linux. + The GraphicsSurface on Mac internally uses two IOSurface + to provide a front and a back buffer. + The GLX implementation of GraphicsSurface uses + an XWindow which already provides a front and a back buffer. + + Reviewed by Noam Rosenthal. + + * Shared/ShareableSurface.h: + (Handle): + Change the type of GraphicsSurface token to uint64_t. + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: + (WebKit::LayerTreeCoordinatorProxy::syncCanvas): + Add a parameter that denotes the current front buffer of the + GraphicsSurface. + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: + (LayerTreeCoordinatorProxy): + * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in: + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::syncCanvas): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + (LayerTreeRenderer): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: + (WebCore::CoordinatedGraphicsLayer::syncCanvas): + * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: + (CoordinatedGraphicsLayerClient): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::syncCanvas): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + +2012-08-16 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Remove FontQt4, HAVE_QRAWFONT flag and the related dead code + https://bugs.webkit.org/show_bug.cgi?id=93960 + + Reviewed by Simon Hausmann. + + Following the removal of Qt 4 support from trunk in r124879. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::getWebCoreStatistics): + +2012-08-16 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Add unit tests for Web intent registration + https://bugs.webkit.org/show_bug.cgi?id=94133 + + Reviewed by Kenneth Rohde Christiansen. + + Add unit tests for Web Intent service registration. + This tests the "intent,service,register" signaling + on the Ewk_View as well as Ewk_Intent_Service. + + * PlatformEfl.cmake: + * UIProcess/API/efl/tests/resources/intent-service.html: Added. + * UIProcess/API/efl/tests/test_ewk2_intents.cpp: Added. + (onIntentServiceRegistration): + (TEST_F): + +2012-08-16 Marja Hölttä <marja@chromium.org> + + FormController, WebHistoryItem: Enable reading selected file names from document state + https://bugs.webkit.org/show_bug.cgi?id=91231 + + Reviewed by Jochen Eisinger. + + This change enables Chromium to set up file permissions properly when + the session restore feature restores a page with selected files. + + * win/WebKit2.def: Exported FormController::getReferencedFilePaths and HistoryController::saveDocumentAndScrollState. + +2012-08-15 Ryosuke Niwa <rniwa@webkit.org> + + Update manual tests and comments to refer to TestRunner instead of LayoutTestController + https://bugs.webkit.org/show_bug.cgi?id=94168 + + Reviewed by Kent Tamura. + + * Shared/WebPreferencesStore.cpp: + (WebKit::WebPreferencesStore::getBoolValueForKey): + +2012-08-15 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> + + [css3-text] Add CSS3 Text decoration compile flag + https://bugs.webkit.org/show_bug.cgi?id=93863 + + Reviewed by Julien Chaffraix. + + This patch handles the compile flag implementation, which will come disabled by + default, thus not exposing the CSS3 text decoration features to the web, unless + when explicitly enabling it with "--css3-text-decoration" build parameter. + + * Configurations/FeatureDefines.xcconfig: + +2012-08-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125687. + http://trac.webkit.org/changeset/125687 + https://bugs.webkit.org/show_bug.cgi?id=94147 + + It broke the whole world (Requested by Ossy_night on #webkit). + + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): + +2012-08-15 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=93693 + [WK2] REGRESSION(125091): pixel results don't sow scrollbars + anymore + + Reviewed by Sam Weinig. + + This is a regression from http://trac.webkit.org/changeset/125091 + in which I failed to noticed that + WKBundlePageCreateSnapshotInViewCoordinates() did actually do + something different than + WKBundlePageCreateSnapshotInDocumentCoordinates(). Specifically, + it used ScrollView::paint() to paint instead of + FrameView::paintContents(). So this patch restores that + functionality by adding a value to SnapshotOptions indicating + whether the snapshot should be taken in ViewCoordinates + (otherwise it defaults to DocumentCoordinates). + + * Shared/API/c/WKImage.h: + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toSnapshotOptions): + * Shared/ImageOptions.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::scaledSnapshotWithOptions): + + Even though we plan to deprecate this API, it should keep doing + the right thing until it's gone. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCreateSnapshotInViewCoordinates): + +2012-08-15 Brady Eidson <beidson@apple.com> + + Removing a plug-in element from a page opened in a background tab in Safari crashes + <rdar://problem/12057991> and https://bugs.webkit.org/show_bug.cgi?id=93913 + + Reviewed by Beth Dakin. + + This only happens in WebKit2 with asynchronous plug-in initialization enabled. + + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::destroy): Null-check m_connection, as it might not have been created yet. + + * win/WebKit2.def: Export Page::setCanStartMedia for InternalSettings/DRT use. + +2012-08-14 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Geoffrey Garen. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Passing ExecState to toBoolean call. + +2012-08-15 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][WK2] Refactoring: start using WKEinaSharedString in ewk_ classes + https://bugs.webkit.org/show_bug.cgi?id=93964 + + Reviewed by Kenneth Rohde Christiansen. + + Started using WKEinaSharedString where it is advisable. + + * UIProcess/API/cpp/efl/WKEinaSharedString.cpp: + (WKEinaSharedString::operator==): + * UIProcess/API/cpp/efl/WKEinaSharedString.h: + * UIProcess/API/efl/ewk_download_job.cpp: + (_Ewk_Download_Job): + (_Ewk_Download_Job::_Ewk_Download_Job): + (_Ewk_Download_Job::~_Ewk_Download_Job): + (ewk_download_job_destination_set): + (ewk_download_job_suggested_filename_set): + * UIProcess/API/efl/ewk_intent.cpp: + (_Ewk_Intent): + (_Ewk_Intent::_Ewk_Intent): + (_Ewk_Intent::~_Ewk_Intent): + (ewk_intent_action_get): + (ewk_intent_type_get): + (ewk_intent_service_get): + * UIProcess/API/efl/ewk_intent_service.cpp: + (_Ewk_Intent_Service): + (_Ewk_Intent_Service::_Ewk_Intent_Service): + (_Ewk_Intent_Service::~_Ewk_Intent_Service): + (ewk_intent_service_action_get): + (ewk_intent_service_type_get): + (ewk_intent_service_href_get): + (ewk_intent_service_title_get): + (ewk_intent_service_disposition_get): + * UIProcess/API/efl/ewk_navigation_policy_decision.cpp: + (_Ewk_Navigation_Policy_Decision): + (_Ewk_Navigation_Policy_Decision::_Ewk_Navigation_Policy_Decision): + (_Ewk_Navigation_Policy_Decision::~_Ewk_Navigation_Policy_Decision): + * UIProcess/API/efl/ewk_url_request.cpp: + (_Ewk_Url_Request): + (_Ewk_Url_Request::_Ewk_Url_Request): + (_Ewk_Url_Request::~_Ewk_Url_Request): + (ewk_url_request_url_get): + (ewk_request_cookies_first_party_get): + (ewk_url_request_http_method_get): + * UIProcess/API/efl/ewk_url_response.cpp: + (_Ewk_Url_Response): + (_Ewk_Url_Response::_Ewk_Url_Response): + (_Ewk_Url_Response::~_Ewk_Url_Response): + (ewk_url_response_url_get): + (ewk_url_response_mime_type_get): + * UIProcess/API/efl/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::_Ewk_View_Private_Data): + (_Ewk_View_Private_Data::~_Ewk_View_Private_Data): + (ewk_view_uri_update): + (ewk_view_title_get): + (ewk_view_theme_set): + (ewk_view_setting_encoding_custom_get): + (ewk_view_setting_encoding_custom_set): + * UIProcess/API/efl/ewk_web_error.cpp: + (_Ewk_Web_Error): + (_Ewk_Web_Error::_Ewk_Web_Error): + (_Ewk_Web_Error::~_Ewk_Web_Error): + (ewk_web_error_url_get): + (ewk_web_error_description_get): + * UIProcess/API/efl/ewk_web_resource.cpp: + (_Ewk_Web_Resource): + (_Ewk_Web_Resource::_Ewk_Web_Resource): + (_Ewk_Web_Resource::~_Ewk_Web_Resource): + +2012-08-15 Christophe Dumez <christophe.dumez@intel.com> + + [WK2] Add support for Web Intents MessagePorts + https://bugs.webkit.org/show_bug.cgi?id=89072 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for WebIntents MessagePorts in WebKit2. + MessagePorts can be passed with a Web Intent in + order to open a direct communication channel + between the Web application and the intent service. + + This functionality is already supported by WebKit 1. + + This patch introduces a new InjectedBundleIntent + class which wraps a WebCore::Intent. This way + information regarding the MessagePorts in a Web + Intent is kept when using an injected bundle. + + For the UIProcess, WebIntentData now carries + identifiers for the MessagePorts which can go over + IPC. Those identifiers map to actual MessagePorts + stored in the Web process. This way, when the UI + delivers an intent to a frame, we can get back the + corresponding MessagePorts from the Web process + before delivering the intent to the DOMWindow. + + This functionality is already tested by: + + - webintents/web-intents-invoke-port.html + - webintents/web-intents-obj-constructor.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Shared/API/c/WKBase.h: + * Shared/APIObject.h: + * Shared/IntentData.cpp: Add MessagePort identifiers. + (WebKit::IntentData::IntentData): + (WebKit::IntentData::encode): + (WebKit::IntentData::decode): + * Shared/IntentData.h: + (IntentData): + * Target.pri: + * UIProcess/API/C/WKIntentData.cpp: Rename WKIntentDataCopyExtra() to + WKIntentDataCopyExtraValue() for clarity. + (WKIntentDataCopyExtraValue): + * UIProcess/API/C/WKIntentData.h: Remove WKIntentDataCreate() function now + that WTR uses WKBundleIntentCreate() instead. + * UIProcess/API/efl/ewk_intent.cpp: + (ewk_intent_extra_get): Use WKIntentDataCopyExtraValue() instead of + WKIntentDataCopyExtra() since it was renamed. + * UIProcess/WebIntentData.cpp: + (WebKit::WebIntentData::WebIntentData): + (WebKit::WebIntentData::~WebIntentData): Remove MessagePorts from WebProcess upon + WebIntentData destruction. + (WebKit): + (WebKit::WebIntentData::extras): + * UIProcess/WebIntentData.h: + (WebKit): + (WebKit::WebIntentData::create): + (WebIntentData): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveIntentForFrame): + * UIProcess/WebProcessProxy.cpp: + (WebKit): + (WebKit::WebProcessProxy::removeMessagePortChannel): + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: + (WebKit): + * WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp: Copied from Source/WebKit2/UIProcess/API/C/WKIntentData.cpp. + (WKBundleIntentGetTypeID): + (WKBundleIntentCreate): + (WKBundleIntentCopyAction): + (WKBundleIntentCopyType): + (WKBundleIntentCopyService): + (WKBundleIntentCopySuggestions): + (WKBundleIntentCopyExtraValue): + (WKBundleIntentCopyExtras): + (WKBundleIntentMessagePortCount): + * WebProcess/InjectedBundle/API/c/WKBundleIntent.h: Copied from Source/WebKit2/UIProcess/API/C/WKIntentData.h. + * WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp: + (WKBundleIntentRequestCopyIntent): + * WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h: + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageDeliverIntentToFrame): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundleIntent.cpp: Copied from Source/WebKit2/UIProcess/WebIntentData.cpp. + (WebKit): + (WebKit::InjectedBundleIntent::create): + (WebKit::InjectedBundleIntent::InjectedBundleIntent): + (WebKit::InjectedBundleIntent::action): + (WebKit::InjectedBundleIntent::payloadType): + (WebKit::InjectedBundleIntent::service): + (WebKit::InjectedBundleIntent::data): + (WebKit::InjectedBundleIntent::extra): + (WebKit::InjectedBundleIntent::extras): + (WebKit::InjectedBundleIntent::suggestions): + * WebProcess/InjectedBundle/InjectedBundleIntent.h: Copied from Source/WebKit2/UIProcess/WebIntentData.h. + (WebKit): + (InjectedBundleIntent): + (WebKit::InjectedBundleIntent::coreIntent): + (WebKit::InjectedBundleIntent::type): + * WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp: + (WebKit::InjectedBundleIntentRequest::intent): + * WebProcess/InjectedBundle/InjectedBundleIntentRequest.h: + (WebKit): + (InjectedBundleIntentRequest): + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::deliverIntent): + (WebKit): + * WebProcess/WebPage/WebFrame.h: + (WebCore): + (WebFrame): + * WebProcess/WebPage/WebPage.cpp: + (WebKit): + (WebKit::WebPage::deliverCoreIntentToFrame): + * WebProcess/WebPage/WebPage.h: + (WebCore): + (WebPage): + * WebProcess/WebProcess.cpp: Store MessagePorts in WebProcess and keep mapping with + their identifiers. + (WebKit): + (WebKit::WebProcess::addMessagePortChannel): + (WebKit::WebProcess::messagePortChannel): + (WebKit::WebProcess::removeMessagePortChannel): + * WebProcess/WebProcess.h: + (WebCore): + (WebProcess): + * WebProcess/WebProcess.messages.in: + +2012-08-14 Adam Barth <abarth@webkit.org> + + Delete Frame::domWindow() and Frame::existingDOMWindow() + https://bugs.webkit.org/show_bug.cgi?id=93990 + + Reviewed by Eric Seidel. + + * WebProcess/WebPage/WebFrame.cpp: + (WebKit::WebFrame::deliverIntent): + (WebKit::WebFrame::pendingUnloadCount): + +2012-08-14 Lauro Neto <lauro.neto@openbossa.org> + + Convert signals/slots to Q_* macros. + + [Qt] Use Q_SLOTS and Q_SIGNALS instead of slots and signals + https://bugs.webkit.org/show_bug.cgi?id=93996 + + Reviewed by Kenneth Rohde Christiansen. + + Change usage of keyword-conflicting 'signals' and 'slots' for + Q_SIGNALS and Q_SLOTS macro. + + * UIProcess/API/qt/qwebkittest_p.h: + * UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp: + (tst_InspectorServer): + * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp: + (tst_publicapi): + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView): + * UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp: + (WebView): + (tst_qrawwebview): + * UIProcess/API/qt/tests/util.cpp: + (LoadSpy): + * UIProcess/API/qt/tests/util.h: + (LoadStartedCatcher): + * UIProcess/InspectorServer/qt/WebSocketServerQt.h: + (QtTcpServerHandler): + * UIProcess/qt/QtDialogRunner.cpp: + (DialogContextBase): + (DialogContextObject): + (BaseAuthenticationContextObject): + (CertificateVerificationDialogContextObject): + (FilePickerContextObject): + (DatabaseQuotaDialogContextObject): + * UIProcess/qt/QtDialogRunner.h: + (QtDialogRunner): + * UIProcess/qt/QtWebPageEventHandler.h: + (QtWebPageEventHandler): + * WebProcess/Downloads/qt/QtFileDownloader.h: + +2012-08-14 Alexey Proskuryakov <ap@apple.com> + + [WK2] Track multiple Web Processes per context + https://bugs.webkit.org/show_bug.cgi?id=93915 + + Reviewed by Sam Weinig. + + * UIProcess/Downloads/DownloadProxy.cpp: + (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): Downloads don't work + yet, added a FIXME. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::deprecatedSharedProcess): Renamed from process(), added an + assertion that this is only used in single proces mode. + (WebKit::WebContext::textCheckerStateChanged): Abstract out access to web processes. + (WebKit::WebContext::ensureSharedWebProcess): Renamed ensureWebProcess() for clarity. + (WebKit::WebContext::createNewWebProcess): Extracted code for creating a process + from ensureWebProcess(). + (WebKit::WebContext::warmInitialProcess): Create the process more explicitly. + (WebKit::WebContext::enableProcessTermination): Iterate over all processes. + (WebKit::WebContext::shouldTerminate): Updated assertion. + (WebKit::WebContext::processDidFinishLaunching): Changed to use process argument + instead of m_process. + (WebKit::WebContext::disconnectProcess): Updated code forto use m_processes. + (WebKit::WebContext::createWebPage): Handle both process policies (initial support + for multi-process). + (WebKit::WebContext::relaunchProcessIfNecessary): Added cases for both policies. + (WebKit::WebContext::download): Ditto. + (WebKit::WebContext::postMessageToInjectedBundle): Ditto. + (WebKit::WebContext::didReceiveSyncMessage): Fixed whitespace. + (WebKit::WebContext::getWebCoreStatistics): Added cases for both policies. + + * UIProcess/WebContext.h: + (WebKit::WebContext::sendToAllProcesses): + (WebKit::WebContext::sendToAllProcessesRelaunchingThemIfNecessary): + Send to all processes. Changed return type to void, since no caller checked it. + + * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createWebPage): Removed + an assertion that assumed one process per context. + + * UIProcess/WebTextChecker.cpp: (WebKit::updateStateForAllWebProcesses): Updated + to use a WebContext method. + +2012-08-14 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + WebKitTestRunner needs layoutTestController.dumpResourceLoadCallbacks + https://bugs.webkit.org/show_bug.cgi?id=42332 + + Reviewed by Kenneth Rohde Christiansen. + + Added new getters to WKURL, WKURLRequest, WKURLResponse so that it is possible + to dump information necessary for the tests passing. + + * Shared/API/c/WKURL.cpp: + (WKURLCopyPath): + * Shared/API/c/WKURL.h: + * Shared/API/c/WKURLRequest.cpp: + (WKURLRequestCopyFirstPartyForCookies): + (WKURLRequestCopyHTTPMethod): + * Shared/API/c/WKURLRequest.h: + * Shared/API/c/WKURLResponse.cpp: + (WKURLResponseHTTPStatusCode): + * Shared/API/c/WKURLResponse.h: + * Shared/WebURL.h: + (WebKit::WebURL::path): + (WebURL): + +2012-08-14 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] UpdateAtlas is wasting memory + https://bugs.webkit.org/show_bug.cgi?id=93606 + + Reviewed by Jocelyn Turcotte. + + Imported and QAreaAllocator from Qt3D and ported it to WebCore style, + and use this new area allocator to replace old one from UpdateAtlas. + + * CMakeLists.txt: + * Target.pri: + * WebProcess/WebPage/AreaAllocator.cpp: Added. + (WebKit::AreaAllocator::AreaAllocator): + (WebKit::AreaAllocator::~AreaAllocator): + (WebKit::AreaAllocator::expand): + (WebKit::AreaAllocator::expandBy): + (WebKit::AreaAllocator::release): + (WebKit::AreaAllocator::overhead): + (WebKit::AreaAllocator::roundAllocation): + (WebKit::GeneralAreaAllocator::GeneralAreaAllocator): + (WebKit::GeneralAreaAllocator::~GeneralAreaAllocator): + (WebKit::GeneralAreaAllocator::freeNode): + (WebKit::GeneralAreaAllocator::expand): + (WebKit::fitsWithin): + (WebKit::GeneralAreaAllocator::allocate): + (WebKit::GeneralAreaAllocator::allocateFromNode): + (WebKit::GeneralAreaAllocator::splitNode): + (WebKit::GeneralAreaAllocator::updateLargestFree): + (WebKit::GeneralAreaAllocator::release): + (WebKit::GeneralAreaAllocator::overhead): + * WebProcess/WebPage/AreaAllocator.h: Added. + (WebCore::nextPowerOfTwo): + (AreaAllocator): + (WebKit::AreaAllocator::size): + (WebKit::AreaAllocator::minimumAllocation): + (WebKit::AreaAllocator::setMinimumAllocation): + (WebKit::AreaAllocator::margin): + (WebKit::AreaAllocator::setMargin): + (GeneralAreaAllocator): + (Node): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: + (WebKit::LayerTreeCoordinator::renderNextFrame): + (WebKit::LayerTreeCoordinator::beginContentUpdate): + * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: + (LayerTreeCoordinator): + * WebProcess/WebPage/UpdateAtlas.cpp: + (WebKit::UpdateAtlas::UpdateAtlas): + (WebKit::UpdateAtlas::buildLayoutIfNeeded): + (WebKit::UpdateAtlas::didSwapBuffers): + (WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer): + * WebProcess/WebPage/UpdateAtlas.h: + (UpdateAtlas): + +2012-08-14 Sergio Villar Senin <svillar@igalia.com> + + [GTK] REGRESSION (r122428) WebKit2APITests/TestWebKitFindController fails "next" test + https://bugs.webkit.org/show_bug.cgi?id=91083 + + Reviewed by Carlos Garcia Campos. + + After r122428 search_next()/search_prev() should return just 1 match + if the text is found. + + * UIProcess/API/gtk/tests/TestWebKitFindController.cpp: + (testFindControllerNext): + (testFindControllerPrevious): + +2012-08-13 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Implement smart separators for context menu in WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=90449 + + Reviewed by Martin Robinson. + + Don't add to the context menu separators that are at the very + beginning or end of the menu. Once the context menu is shown, + monitor menu items visibility to hide or show separators to make + sure they never appear in the context menu unless they are between + two visible items. + + * UIProcess/API/gtk/tests/TestContextMenu.cpp: + (testContextMenuSmartSeparators): + (beforeAll): + * UIProcess/gtk/WebContextMenuProxyGtk.cpp: + (WebKit::contextMenuItemVisibilityChanged): + (WebKit): + (WebKit::WebContextMenuProxyGtk::append): + (WebKit::WebContextMenuProxyGtk::populate): + +2012-08-14 Kihong Kwon <kihong.kwon@samsung.com> + + [WK2] Add getter for capture attribute of input element + https://bugs.webkit.org/show_bug.cgi?id=93710 + + Reviewed by Antonio Gomes. + + Add getter for capture attribute to WKOpenPanelParameters to support HTML Media Capture. + + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + * Shared/WebOpenPanelParameters.cpp: + (WebKit): + (WebKit::WebOpenPanelParameters::capture): + * Shared/WebOpenPanelParameters.h: + (WebOpenPanelParameters): + * UIProcess/API/C/WKOpenPanelParameters.cpp: + (WKOpenPanelParametersCopyCapture): + * UIProcess/API/C/WKOpenPanelParameters.h: + +2012-08-13 Tom Sepez <tsepez@chromium.org> + + [chromium] release FrameLoaderClientImpl::m_pluginWidget refptr upon Plugin Document detach. + https://bugs.webkit.org/show_bug.cgi?id=93283 + + Reviewed by Eric Seidel. + + Chromium has a refptr that needs to be NULLed at this point. + + Change the client redirectDataToPlugin method(s) to expect the possibility of + a NULL argument, keeping existing behaviour otherwise. + + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::redirectDataToPlugin): + +2012-08-13 Raphael Kubo da Costa <rakuco@webkit.org> + + [EFL] Unreviewed bot fix after r125467. + + * PlatformEfl.cmake: Make the WK2 tests link against glib, gobject + and gio as well. + +2012-08-13 Raphael Kubo da Costa <rakuco@webkit.org> + + [EFL] Unreviewed attempt at fixing the bots after r125467. + + * PlatformEfl.cmake: Link against GIO and GObject due to the usage + of libsoup. + +2012-08-11 Raphael Kubo da Costa <rakuco@webkit.org> + + [CMake] Rewrite FindLibSoup2.cmake. + https://bugs.webkit.org/show_bug.cgi?id=93191 + + Reviewed by Rob Buis. + + * PlatformEfl.cmake: Use LIBSOUP_FOO instead of LIBSOUP24_FOO, and + do not use LIBSOUP24_LDFLAGS, as it is not needed anymore. + +2012-08-13 Alexey Proskuryakov <ap@apple.com> + + [WK2] Move a remaining per-process message from WebContext to WebProcessProxy + https://bugs.webkit.org/show_bug.cgi?id=93883 + + More Windows build fixing. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::dummy): + +2012-08-13 Alexey Proskuryakov <ap@apple.com> + + [WK2] Move a remaining per-process message from WebContext to WebProcessProxy + https://bugs.webkit.org/show_bug.cgi?id=93883 + + More Windows build fix + + * UIProcess/WebContext.cpp: + (WebKit::WebPage::dummy): + * UIProcess/WebContext.h: (WebContext): + * UIProcess/WebContext.messages.in: + Add a dummy sync message - the same workaround is already used in WebPage. + +2012-08-13 Brady Eidson <beidson@apple.com> + + With asynchronous plug-in initialization, WebProcess and PluginProcess can deadlock + <rdar://problem/12062125> and https://bugs.webkit.org/show_bug.cgi?id=93894 + + Reviewed by Alexey Proskuryakov. + + A few things were in play here: + - The WebProcess thought the plug-in was done initializing but it wasn't. + - The sync message out from the PluginProcess was not being handled by the WebProcess. + + Expose the ability for the PluginProcess to act as if it is handling a sync message and needs messages dispatched: + * Platform/CoreIPC/Connection.h: + (CoreIPC::Connection::incrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount): + (CoreIPC::Connection::decrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount): + + * PluginProcess/PluginControllerProxy.cpp: + (WebKit::PluginControllerProxy::PluginControllerProxy): + (WebKit::PluginControllerProxy::setInitializationReply): Save the delayed reply for synchronous initialization. + (WebKit::PluginControllerProxy::takeInitializationReply): Give back the delayed reply for initialization completion. + (WebKit::PluginControllerProxy::initialize): + * PluginProcess/PluginControllerProxy.h: + (WebKit::PluginControllerProxy::isInitializing): Accessor so WebProcessConnection knows whether or not to store the + delayed reply for later. + + * PluginProcess/WebProcessConnection.messages.in: Make the synchronous form of "CreatePlugin" have a delayed reply. + * PluginProcess/WebProcessConnection.cpp: + (WebKit::WebProcessConnection::createPlugin): Store away the delayed reply message so it can be responded to after + asynchronous initialization completes. + (WebKit::WebProcessConnection::createPluginAsynchronously): If there is a stored away delayed reply message, respond to + it instead of sending the asynchronously reply. + * PluginProcess/WebProcessConnection.h: + (WebProcessConnection): + +2012-08-13 Alexey Proskuryakov <ap@apple.com> + + [WK2] Move a remaining per-process message from WebContext to WebProcessProxy + https://bugs.webkit.org/show_bug.cgi?id=93883 + + Windows build fix. + + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::getSitesWithPluginData): + (WebKit::WebProcess::clearPluginSiteData): + Use WebProcessProxy for the message here, too. + +2012-08-13 Alexey Proskuryakov <ap@apple.com> + + [WK2] Move a remaining per-process message from WebContext to WebProcessProxy + https://bugs.webkit.org/show_bug.cgi?id=93883 + + Reviewed by Sam Weinig. + + There was one plug-in message renaming. Moving it, and also other plug-in messages + for consistency. + + * UIProcess/WebContext.cpp: + (WebKit): Got rid of the last MESSAGE_CHECK in this file. + (WebKit::WebContext::WebContext): Moved m_pluginWorkQueue to a singleton. + We don't need more than one queue (all it does is read plug-in info), and if we + needed, it would have been per-process, not per-context. + (WebKit::WebContext::~WebContext): No more work queue. + (WebKit::WebContext::processDidFinishLaunching): Ditto. + + * UIProcess/WebContext.h: No longer needs to be a QueueClient. + + * UIProcess/WebContext.messages.in: + * UIProcess/WebProcessProxy.messages.in: + Moved plug-in related messages. + + * UIProcess/WebProcessProxy.cpp: + (WebKit::pluginWorkQueue): Moved from WebContext to a singleton. + (WebKit::WebProcessProxy::sendDidGetPlugins): Moved from WebContext. + (WebKit::WebProcessProxy::handleGetPlugins): Ditto. + (WebKit::WebProcessProxy::getPlugins): Ditto. + (WebKit::WebProcessProxy::getPluginPath): Ditto. + (WebKit::WebProcessProxy::getPluginProcessConnection): Ditto. + (WebKit::WebProcessProxy::didGetSitesWithPluginData): Ditto. + (WebKit::WebProcessProxy::didClearPluginSiteData): Ditto. + + * UIProcess/WebProcessProxy.h: Process proxy needs to be thread safe ref counted + now, since it sends messages to itself on a work queue and back. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::populatePluginCache): Updated for new receiver. + + * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): Ditto. + + * WebProcess/WebProcess.cpp: (WebKit::canPluginHandleResponse): Ditto. + +2012-08-13 Raphael Kubo da Costa <rakuco@webkit.org> + + [CMake] Remove glib-related Find modules and write single new one instead. + https://bugs.webkit.org/show_bug.cgi?id=93786 + + Reviewed by Rob Buis. + + * PlatformEfl.cmake: Use GLIB_* instead of Glib_*. + +2012-08-13 Christophe Dumez <christophe.dumez@intel.com> + + [SOUP][WK2] Missing LocalTerminationDisabler in WebCookieManager::setCookiePersistentStorage() + https://bugs.webkit.org/show_bug.cgi?id=93837 + + Reviewed by Carlos Garcia Campos. + + Add missing WebCore::LocalTerminationDisabler in + WebCookieManager::setCookiePersistentStorage() to + temporarily disable process termination. + + * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: + (WebKit::WebCookieManager::setCookiePersistentStorage): + +2012-08-12 Nuno Lopes <nlopes@apple.com> + + Fix build with recent clang. + https://bugs.webkit.org/show_bug.cgi?id=90701 + + Reviewed by Eric Seidel. + + * Shared/CommandLine.h: + (CommandLine): + * WebProcess/Notifications/NotificationPermissionRequestManager.cpp: + (WebKit::NotificationPermissionRequestManager::NotificationPermissionRequestManager): + * WebProcess/Notifications/NotificationPermissionRequestManager.h: + (NotificationPermissionRequestManager): + 2012-08-11 Sam Weinig <sam@webkit.org> Fix the build. diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 1da0cc82f..16ce00e8a 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -48,6 +48,7 @@ ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; +ENABLE_CSS3_TEXT_DECORATION = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; @@ -139,4 +140,4 @@ ENABLE_WIDGET_REGION_macosx = ENABLE_WIDGET_REGION; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS3_TEXT_DECORATION) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WIDGET_REGION) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index d737bc774..d417b5f45 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -961,6 +961,8 @@ webkit2_sources += \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h \ Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ @@ -995,6 +997,8 @@ webkit2_sources += \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.cpp \ + Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h \ Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h index ddf591f32..b8410a900 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.h +++ b/Source/WebKit2/Platform/CoreIPC/Connection.h @@ -207,6 +207,9 @@ public: void wakeUpRunLoop(); + void incrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount() { ++m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount; } + void decrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount() { --m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount; } + private: template<typename T> class Message { public: diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index d5ed5420f..d4b08f8be 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -5,7 +5,6 @@ LIST(APPEND WebKit2_LINK_FLAGS ${EFLDEPS_LDFLAGS} ${EFREET_LDFLAGS} ${EVAS_LDFLAGS} - ${LIBSOUP24_LDFLAGS} ) LIST(APPEND WebKit2_SOURCES @@ -142,8 +141,8 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} - ${Glib_INCLUDE_DIRS} - ${LIBSOUP24_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} + ${LIBSOUP_INCLUDE_DIRS} ${WTF_DIR} ) @@ -160,8 +159,10 @@ LIST(APPEND WebKit2_LIBRARIES ${PNG_LIBRARY} ${JPEG_LIBRARY} ${CMAKE_DL_LIBS} - ${Glib_LIBRARIES} - ${LIBSOUP24_LIBRARIES} + ${GLIB_LIBRARIES} + ${GLIB_GIO_LIBRARIES} + ${GLIB_GOBJECT_LIBRARIES} + ${LIBSOUP_LIBRARIES} ) LIST (APPEND WebProcess_SOURCES @@ -227,14 +228,17 @@ SET(EWK2UnitTests_LIBRARIES ${ECORE_LIBRARIES} ${ECORE_EVAS_LIBRARIES} ${EVAS_LIBRARIES} - ${LIBSOUP24_LIBRARIES} + ${GLIB_LIBRARIES} + ${GLIB_GIO_LIBRARIES} + ${GLIB_GOBJECT_LIBRARIES} + ${LIBSOUP_LIBRARIES} gtest ) IF (ENABLE_GLIB_SUPPORT) LIST(APPEND EWK2UnitTests_LIBRARIES - ${Glib_LIBRARIES} - ${Gthread_LIBRARIES} + ${GLIB_LIBRARIES} + ${GLIB_GTHREAD_LIBRARIES} ) ENDIF() @@ -261,9 +265,12 @@ TARGET_LINK_LIBRARIES(ewk2UnitTestUtils ${EWK2UnitTests_LIBRARIES}) # The "ewk" on the test name needs to be suffixed with "2", otherwise it # will clash with tests from the WebKit 1 test suite. SET(EWK2UnitTests_BINARIES + test_ewk2_back_forward_list test_ewk2_context test_ewk2_cookie_manager test_ewk2_download_job + test_ewk2_eina_shared_string + test_ewk2_intents test_ewk2_view ) diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp index ab60f941c..2ad41daa5 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -43,6 +43,7 @@ #include <WebCore/GraphicsContext.h> #include <WebCore/IdentifierRep.h> #include <WebCore/NotImplemented.h> +#include <wtf/TemporaryChange.h> #include <wtf/text/WTFString.h> #if PLATFORM(MAC) @@ -66,6 +67,7 @@ PluginControllerProxy::PluginControllerProxy(WebProcessConnection* connection, c #if USE(ACCELERATED_COMPOSITING) , m_isAcceleratedCompositingEnabled(creationParameters.isAcceleratedCompositingEnabled) #endif + , m_isInitializing(false) , m_paintTimer(RunLoop::main(), this, &PluginControllerProxy::paint) , m_pluginDestructionProtectCount(0) , m_pluginDestroyTimer(RunLoop::main(), this, &PluginControllerProxy::destroy) @@ -91,9 +93,22 @@ PluginControllerProxy::~PluginControllerProxy() releaseNPObject(m_pluginElementNPObject); } +void PluginControllerProxy::setInitializationReply(PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply) +{ + ASSERT(!m_initializationReply); + m_initializationReply = reply; +} + +PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> PluginControllerProxy::takeInitializationReply() +{ + return m_initializationReply.release(); +} + bool PluginControllerProxy::initialize(const PluginCreationParameters& creationParameters) { ASSERT(!m_plugin); + + TemporaryChange<bool> initializing(m_isInitializing, true); m_plugin = NetscapePlugin::create(PluginProcess::shared().netscapePluginModule()); if (!m_plugin) { diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h index 46da1a4bf..a9d35a663 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.h +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h @@ -33,6 +33,7 @@ #include "PluginController.h" #include "PluginControllerProxyMessages.h" #include "ShareableBitmap.h" +#include "WebProcessConnectionMessages.h" #include <WebCore/RunLoop.h> #include <wtf/Noncopyable.h> @@ -70,6 +71,11 @@ public: PluginController* asPluginController() { return this; } + bool isInitializing() const { return m_isInitializing; } + + void setInitializationReply(PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply>); + PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> takeInitializationReply(); + private: PluginControllerProxy(WebProcessConnection*, const PluginCreationParameters&); @@ -159,6 +165,9 @@ private: String m_userAgent; bool m_isPrivateBrowsingEnabled; bool m_isAcceleratedCompositingEnabled; + bool m_isInitializing; + + RefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> m_initializationReply; RefPtr<Plugin> m_plugin; diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp index 1621ca0c8..1d95df1ed 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp @@ -263,17 +263,23 @@ void WebProcessConnection::createPluginInternal(const PluginCreationParameters& #endif } -void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID) +void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply) { PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(creationParameters.pluginInstanceID); - // The plug-in we're being asked to create synchronously might already exist if we just finished creating it asynchronously. - // In that case we need to not create it again (but also need to return the correct information about its creation). + // The controller proxy for the plug-in we're being asked to create synchronously might already exist if it was requested asynchronously before. if (pluginControllerProxy) { - result = true; - wantsWheelEvents = pluginControllerProxy->wantsWheelEvents(); + // It might still be in the middle of initialization in which case we have to let that initialization complete and respond to this message later. + if (pluginControllerProxy->isInitializing()) { + pluginControllerProxy->setInitializationReply(reply); + return; + } + + // If its initialization is complete then we need to respond to this message with the correct information about its creation. #if PLATFORM(MAC) - remoteLayerClientID = pluginControllerProxy->remoteLayerClientID(); + reply->send(true, pluginControllerProxy->wantsWheelEvents(), pluginControllerProxy->remoteLayerClientID()); +#else + reply->send(true, pluginControllerProxy->wantsWheelEvents(), 0); #endif return; } @@ -283,7 +289,12 @@ void WebProcessConnection::createPlugin(const PluginCreationParameters& creation if (creationParameters.asynchronousCreationIncomplete) m_asynchronousInstanceIDsToIgnore.add(creationParameters.pluginInstanceID); + bool result = false; + bool wantsWheelEvents = false; + uint32_t remoteLayerClientID = 0; createPluginInternal(creationParameters, result, wantsWheelEvents, remoteLayerClientID); + + reply->send(result, wantsWheelEvents, remoteLayerClientID); } void WebProcessConnection::createPluginAsynchronously(const PluginCreationParameters& creationParameters) @@ -297,16 +308,33 @@ void WebProcessConnection::createPluginAsynchronously(const PluginCreationParame // This version of CreatePlugin is only used by plug-ins that are known to behave when started asynchronously. bool result = false; - uint32_t remoteLayerClientID = 0; bool wantsWheelEvents = false; + uint32_t remoteLayerClientID = 0; if (creationParameters.artificialPluginInitializationDelayEnabled) { unsigned artificialPluginInitializationDelay = 5; sleep(artificialPluginInitializationDelay); } + // Since plug-in creation can often message to the WebProcess synchronously (with NPP_Evaluate for example) + // we need to make sure that the web process will handle the plug-in process's synchronous messages, + // even if the web process is waiting on a synchronous reply itself. + // Normally the plug-in process doesn't give its synchronous messages the special flag to allow for that. + // We can force it to do so by incrementing the "DispatchMessageMarkedDispatchWhenWaitingForSyncReply" count. + m_connection->incrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount(); createPluginInternal(creationParameters, result, wantsWheelEvents, remoteLayerClientID); + m_connection->decrementDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount(); + + // If someone asked for this plug-in synchronously while it was in the middle of being created then we need perform the + // synchronous reply instead of sending the asynchronous reply. + PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(creationParameters.pluginInstanceID); + ASSERT(pluginControllerProxy); + if (RefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> delayedSyncReply = pluginControllerProxy->takeInitializationReply()) { + delayedSyncReply->send(result, wantsWheelEvents, remoteLayerClientID); + return; + } + // Otherwise, send the asynchronous results now. if (!result) { m_connection->sendSync(Messages::PluginProxy::DidFailToCreatePlugin(), Messages::PluginProxy::DidFailToCreatePlugin::Reply(), creationParameters.pluginInstanceID); return; diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.h b/Source/WebKit2/PluginProcess/WebProcessConnection.h index 53ca1e40e..ce98e1036 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.h +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "Plugin.h" +#include "WebProcessConnectionMessages.h" #include <wtf/HashSet.h> #include <wtf/RefCounted.h> @@ -70,7 +71,7 @@ private: // Message handlers. void didReceiveWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); - void createPlugin(const PluginCreationParameters&, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID); + void createPlugin(const PluginCreationParameters&, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply>); void createPluginAsynchronously(const PluginCreationParameters&); void destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete); diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in b/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in index f1a83594f..effb97966 100644 --- a/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in +++ b/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in @@ -24,7 +24,7 @@ messages -> WebProcessConnection { # Creates a plug-in instance using the given creation parameters. - CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool result, bool wantsWheelEvents, uint32_t remoteLayerClientID) + CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool creationResult, bool wantsWheelEvents, uint32_t remoteLayerClientID) Delayed # Creates a plug-in instance asynchronously using the given creation parameters. CreatePluginAsynchronously(WebKit::PluginCreationParameters pluginCreationParameters) diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index 6854ecc27..a6a8bd66f 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -135,6 +135,7 @@ typedef const struct OpaqueWKBundleDOMWindowExtension* WKBundleDOMWindowExtensio typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef; typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef; typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef; +typedef const struct OpaqueWKBundleIntent* WKBundleIntentRef; typedef const struct OpaqueWKBundleIntentRequest* WKBundleIntentRequestRef; typedef const struct OpaqueWKBundleNavigationAction* WKBundleNavigationActionRef; typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef; diff --git a/Source/WebKit2/Shared/API/c/WKImage.h b/Source/WebKit2/Shared/API/c/WKImage.h index 8dec00a9d..1f23b134a 100644 --- a/Source/WebKit2/Shared/API/c/WKImage.h +++ b/Source/WebKit2/Shared/API/c/WKImage.h @@ -40,7 +40,8 @@ typedef uint32_t WKImageOptions; enum { kWKSnapshotOptionsShareable = 1 << 0, - kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1 + kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1, + kWKSnapshotOptionsInViewCoordinates = 1 << 2 }; typedef uint32_t WKSnapshotOptions; diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index cc605d1f8..8a73a01fa 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -776,6 +776,8 @@ inline SnapshotOptions toSnapshotOptions(WKSnapshotOptions wkSnapshotOptions) snapshotOptions |= SnapshotOptionsShareable; if (wkSnapshotOptions & kWKSnapshotOptionsExcludeSelectionHighlighting) snapshotOptions |= SnapshotOptionsExcludeSelectionHighlighting; + if (wkSnapshotOptions & kWKSnapshotOptionsInViewCoordinates) + snapshotOptions |= SnapshotOptionsInViewCoordinates; return snapshotOptions; } diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp index 99cde89ef..2268413a0 100644 --- a/Source/WebKit2/Shared/API/c/WKURL.cpp +++ b/Source/WebKit2/Shared/API/c/WKURL.cpp @@ -60,6 +60,11 @@ WKStringRef WKURLCopyScheme(WKURLRef url) return toCopiedAPI(toImpl(url)->protocol()); } +WK_EXPORT WKStringRef WKURLCopyPath(WKURLRef url) +{ + return toCopiedAPI(toImpl(url)->path()); +} + WKStringRef WKURLCopyLastPathComponent(WKURLRef url) { return toCopiedAPI(toImpl(url)->lastPathComponent()); diff --git a/Source/WebKit2/Shared/API/c/WKURL.h b/Source/WebKit2/Shared/API/c/WKURL.h index 2cda6c192..4e9867246 100644 --- a/Source/WebKit2/Shared/API/c/WKURL.h +++ b/Source/WebKit2/Shared/API/c/WKURL.h @@ -39,6 +39,7 @@ WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string); WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url); WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url); WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url); +WK_EXPORT WKStringRef WKURLCopyPath(WKURLRef url); WK_EXPORT WKStringRef WKURLCopyLastPathComponent(WKURLRef url); WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b); diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp index 776367b75..114c74190 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp @@ -48,6 +48,16 @@ WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef) return toCopiedURLAPI(toImpl(requestRef)->url()); } +WKURLRef WKURLRequestCopyFirstPartyForCookies(WKURLRequestRef requestRef) +{ + return toCopiedURLAPI(toImpl(requestRef)->resourceRequest().firstPartyForCookies()); +} + +WKStringRef WKURLRequestCopyHTTPMethod(WKURLRequestRef requestRef) +{ + return toCopiedAPI(toImpl(requestRef)->resourceRequest().httpMethod()); +} + void WKURLRequestSetDefaultTimeoutInterval(double timeoutInterval) { WebURLRequest::setDefaultTimeoutInterval(timeoutInterval); diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.h b/Source/WebKit2/Shared/API/c/WKURLRequest.h index a53ce1635..85df3d389 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.h +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.h @@ -38,6 +38,10 @@ WK_EXPORT WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef); WK_EXPORT WKURLRef WKURLRequestCopyURL(WKURLRequestRef); +WK_EXPORT WKURLRef WKURLRequestCopyFirstPartyForCookies(WKURLRequestRef); + +WK_EXPORT WKStringRef WKURLRequestCopyHTTPMethod(WKURLRequestRef); + WK_EXPORT void WKURLRequestSetDefaultTimeoutInterval(double); #ifdef __cplusplus diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp index cefd07d31..2d25f282a 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp @@ -46,3 +46,8 @@ WKStringRef WKURLResponseCopyMIMEType(WKURLResponseRef responseRef) { return toCopiedAPI(toImpl(responseRef)->resourceResponse().mimeType()); } + +int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef responseRef) +{ + return toImpl(responseRef)->resourceResponse().httpStatusCode(); +} diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.h b/Source/WebKit2/Shared/API/c/WKURLResponse.h index 8988dff08..d4c269340 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.h +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.h @@ -38,6 +38,8 @@ WK_EXPORT WKURLRef WKURLResponseCopyURL(WKURLResponseRef); WK_EXPORT WKStringRef WKURLResponseCopyMIMEType(WKURLResponseRef); +WK_EXPORT int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h index 8e4d29342..708effe5d 100644 --- a/Source/WebKit2/Shared/APIObject.h +++ b/Source/WebKit2/Shared/APIObject.h @@ -117,6 +117,7 @@ public: TypeBundleFrame, TypeBundleHitTestResult, TypeBundleInspector, + TypeBundleIntent, TypeBundleIntentRequest, TypeBundleNavigationAction, TypeBundleNodeHandle, diff --git a/Source/WebKit2/Shared/CommandLine.h b/Source/WebKit2/Shared/CommandLine.h index f70601ce2..2d7951067 100644 --- a/Source/WebKit2/Shared/CommandLine.h +++ b/Source/WebKit2/Shared/CommandLine.h @@ -48,8 +48,6 @@ public: } private: - bool m_parsedSuccessfully; - HashMap<String, String> m_args; }; diff --git a/Source/WebKit2/Shared/ImageOptions.h b/Source/WebKit2/Shared/ImageOptions.h index 534cd2332..304ecf86b 100644 --- a/Source/WebKit2/Shared/ImageOptions.h +++ b/Source/WebKit2/Shared/ImageOptions.h @@ -34,7 +34,8 @@ enum ImageOptions { enum { SnapshotOptionsShareable = 1 << 0, - SnapshotOptionsExcludeSelectionHighlighting = 1 << 1 + SnapshotOptionsExcludeSelectionHighlighting = 1 << 1, + SnapshotOptionsInViewCoordinates = 1 << 2 }; typedef uint32_t SnapshotOptions; diff --git a/Source/WebKit2/Shared/IntentData.cpp b/Source/WebKit2/Shared/IntentData.cpp index 4995b2ef5..41078747c 100644 --- a/Source/WebKit2/Shared/IntentData.cpp +++ b/Source/WebKit2/Shared/IntentData.cpp @@ -31,7 +31,10 @@ #include "APIObject.h" #include "DataReference.h" #include "WebCoreArgumentCoders.h" +#include "WebProcess.h" #include <WebCore/Intent.h> +#include <WebCore/MessagePortChannel.h> +#include <WebCore/PlatformMessagePortChannel.h> using namespace WebCore; @@ -45,6 +48,12 @@ IntentData::IntentData(Intent* coreIntent) , extras(coreIntent->extras()) , suggestions(coreIntent->suggestions()) { + MessagePortChannelArray* coreMessagePorts = coreIntent->messagePorts(); + if (coreMessagePorts) { + size_t numMessagePorts = coreMessagePorts->size(); + for (size_t i = 0; i < numMessagePorts; ++i) + messagePorts.append(WebProcess::shared().addMessagePortChannel((*coreMessagePorts)[i]->channel())); + } } void IntentData::encode(CoreIPC::ArgumentEncoder* encoder) const @@ -55,6 +64,7 @@ void IntentData::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(CoreIPC::DataReference(data)); encoder->encode(extras); encoder->encode(suggestions); + encoder->encode(messagePorts); } bool IntentData::decode(CoreIPC::ArgumentDecoder* decoder, IntentData& intentData) @@ -73,6 +83,8 @@ bool IntentData::decode(CoreIPC::ArgumentDecoder* decoder, IntentData& intentDat return false; if (!decoder->decode(intentData.suggestions)) return false; + if (!decoder->decode(intentData.messagePorts)) + return false; return true; } diff --git a/Source/WebKit2/Shared/IntentData.h b/Source/WebKit2/Shared/IntentData.h index 96e2d9f99..e8435c284 100644 --- a/Source/WebKit2/Shared/IntentData.h +++ b/Source/WebKit2/Shared/IntentData.h @@ -29,7 +29,8 @@ #if ENABLE(WEB_INTENTS) #include "APIObject.h" -#include "GenericCallback.h" +#include <WebCore/KURL.h> +#include <wtf/HashMap.h> #include <wtf/text/WTFString.h> namespace CoreIPC { @@ -56,6 +57,7 @@ struct IntentData { Vector<uint8_t> data; HashMap<String, String> extras; Vector<WebCore::KURL> suggestions; + Vector<uint64_t> messagePorts; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/ShareableSurface.h b/Source/WebKit2/Shared/ShareableSurface.h index fb74b61be..6cd7369a1 100644 --- a/Source/WebKit2/Shared/ShareableSurface.h +++ b/Source/WebKit2/Shared/ShareableSurface.h @@ -62,7 +62,7 @@ public: friend class ShareableSurface; mutable ShareableBitmap::Handle m_bitmapHandle; #if USE(GRAPHICS_SURFACE) - uint32_t m_graphicsSurfaceToken; + uint64_t m_graphicsSurfaceToken; #endif WebCore::IntSize m_size; ShareableBitmap::Flags m_flags; diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h index 85ed57b57..ee4ab64ff 100644 --- a/Source/WebKit2/Shared/UserMessageCoders.h +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -186,6 +186,7 @@ public: WebImage* image = static_cast<WebImage*>(m_root); ShareableBitmap::Handle handle; + ASSERT(!image->bitmap() || image->bitmap()->isBackedBySharedMemory()); if (!image->bitmap() || !image->bitmap()->isBackedBySharedMemory() || !image->bitmap()->createHandle(handle)) { // Initial false indicates no allocated bitmap or is not shareable. encoder->encode(false); diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 7d40bc866..cbf624926 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -555,6 +555,9 @@ void ArgumentCoder<FileChooserSettings>::encode(ArgumentEncoder* encoder, const #endif encoder->encode(settings.acceptMIMETypes); encoder->encode(settings.selectedFiles); +#if ENABLE(MEDIA_CAPTURE) + encoder->encode(settings.capture); +#endif } bool ArgumentCoder<FileChooserSettings>::decode(ArgumentDecoder* decoder, FileChooserSettings& settings) @@ -569,6 +572,10 @@ bool ArgumentCoder<FileChooserSettings>::decode(ArgumentDecoder* decoder, FileCh return false; if (!decoder->decode(settings.selectedFiles)) return false; +#if ENABLE(MEDIA_CAPTURE) + if (!decoder->decode(settings.capture)) + return false; +#endif return true; } diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp index f6722bba0..772504066 100644 --- a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 Samsung Electronics. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,4 +61,12 @@ PassRefPtr<ImmutableArray> WebOpenPanelParameters::acceptMIMETypes() const return ImmutableArray::adopt(vector); } +#if ENABLE(MEDIA_CAPTURE) +String WebOpenPanelParameters::capture() const +{ + return m_settings.capture; +} +#endif + + } // namespace WebCore diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.h b/Source/WebKit2/Shared/WebOpenPanelParameters.h index eca44e1e3..ab12c0fc1 100644 --- a/Source/WebKit2/Shared/WebOpenPanelParameters.h +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 Samsung Electronics. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +46,9 @@ public: bool allowMultipleFiles() const { return m_settings.allowsMultipleFiles; } PassRefPtr<ImmutableArray> acceptMIMETypes() const; Vector<String> selectedFileNames() const { return m_settings.selectedFiles; } +#if ENABLE(MEDIA_CAPTURE) + String capture() const; +#endif private: explicit WebOpenPanelParameters(const WebCore::FileChooserSettings&); diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp index 8668bec0c..89734bf0e 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.cpp +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -184,7 +184,7 @@ bool WebPreferencesStore::setBoolValueForKey(const String& key, bool value) bool WebPreferencesStore::getBoolValueForKey(const String& key) const { - // FIXME: Extend overriding to other key types used from LayoutTestController. + // FIXME: Extend overriding to other key types used from TestRunner. BoolOverridesMap::const_iterator it = boolTestRunnerOverridesMap().find(key); if (it != boolTestRunnerOverridesMap().end()) return it->second; diff --git a/Source/WebKit2/Shared/WebURL.h b/Source/WebKit2/Shared/WebURL.h index f0cce8d02..b2961277b 100644 --- a/Source/WebKit2/Shared/WebURL.h +++ b/Source/WebKit2/Shared/WebURL.h @@ -63,6 +63,12 @@ public: return m_parsedURL->isValid() ? m_parsedURL->protocol() : String(); } + String path() const + { + parseURLIfNecessary(); + return m_parsedURL->isValid() ? m_parsedURL->path() : String(); + } + String lastPathComponent() const { parseURLIfNecessary(); diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 5ffc8ccb3..37336505f 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -279,6 +279,7 @@ HEADERS += \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \ WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \ + WebProcess/InjectedBundle/API/c/WKBundleIntent.h \ WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h \ WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.h \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \ @@ -292,6 +293,7 @@ HEADERS += \ WebProcess/InjectedBundle/InjectedBundleClient.h \ WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.h \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \ + WebProcess/InjectedBundle/InjectedBundleIntent.h \ WebProcess/InjectedBundle/InjectedBundleIntentRequest.h \ WebProcess/InjectedBundle/InjectedBundleNavigationAction.h \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \ @@ -341,6 +343,7 @@ HEADERS += \ WebProcess/WebCoreSupport/WebSearchPopupMenu.h \ WebProcess/WebCoreSupport/WebVibrationClient.h \ WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h \ + WebProcess/WebPage/AreaAllocator.h \ WebProcess/WebPage/DrawingArea.h \ WebProcess/WebPage/DrawingAreaImpl.h \ WebProcess/WebPage/EventDispatcher.h \ @@ -630,6 +633,7 @@ SOURCES += \ WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp \ WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \ WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \ + WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp \ WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp \ WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp \ WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \ @@ -645,6 +649,7 @@ SOURCES += \ WebProcess/InjectedBundle/InjectedBundleClient.cpp \ WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp \ WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \ + WebProcess/InjectedBundle/InjectedBundleIntent.cpp \ WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp \ WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp \ WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \ @@ -702,6 +707,7 @@ SOURCES += \ WebProcess/WebCoreSupport/qt/WebDragClientQt.cpp \ WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp \ WebProcess/WebCoreSupport/qt/WebPopupMenuQt.cpp \ + WebProcess/WebPage/AreaAllocator.cpp \ WebProcess/WebPage/DecoderAdapter.cpp \ WebProcess/WebPage/DrawingArea.cpp \ WebProcess/WebPage/DrawingAreaImpl.cpp \ diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp index 7a92db54c..92e61871c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp @@ -31,6 +31,7 @@ #include "WKAPICast.h" #include "WKDictionary.h" #include "WKString.h" +#include "WebSerializedScriptValue.h" #if ENABLE(WEB_INTENTS) #include "WebIntentData.h" @@ -47,27 +48,6 @@ WKTypeID WKIntentDataGetTypeID() #endif } -WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionaryRef) -{ -#if ENABLE(WEB_INTENTS) - IntentData intentData; - WKStringRef action = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("action"))); - ASSERT(action); - intentData.action = toImpl(action)->string(); - WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("type"))); - ASSERT(type); - intentData.type = toImpl(type)->string(); - WKSerializedScriptValueRef data = static_cast<WKSerializedScriptValueRef>(WKDictionaryGetItemForKey(initDictionaryRef, WKStringCreateWithUTF8CString("data"))); - if (data) - intentData.data = toImpl(data)->dataReference().vector(); - - RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData); - return toAPI(webIntentData.release().leakRef()); -#else - return 0; -#endif -} - WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef) { #if ENABLE(WEB_INTENTS) @@ -104,7 +84,7 @@ WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef) #endif } -WKStringRef WKIntentDataCopyExtra(WKIntentDataRef intentRef, WKStringRef key) +WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key) { #if ENABLE(WEB_INTENTS) return toCopiedAPI(toImpl(intentRef)->extra(toWTFString(key))); diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.h b/Source/WebKit2/UIProcess/API/C/WKIntentData.h index 1f809ec8d..caf1b459f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.h +++ b/Source/WebKit2/UIProcess/API/C/WKIntentData.h @@ -34,13 +34,11 @@ extern "C" { WK_EXPORT WKTypeID WKIntentDataGetTypeID(); -WK_EXPORT WKIntentDataRef WKIntentDataCreate(WKDictionaryRef initDictionary); - WK_EXPORT WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef); WK_EXPORT WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef); WK_EXPORT WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef); WK_EXPORT WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef); -WK_EXPORT WKStringRef WKIntentDataCopyExtra(WKIntentDataRef intentRef, WKStringRef key); +WK_EXPORT WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key); WK_EXPORT WKDictionaryRef WKIntentDataCopyExtras(WKIntentDataRef intentRef); #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp index c6f7a661c..6a7c53e8f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 Samsung Electronics. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,3 +47,12 @@ WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef p { return toAPI(toImpl(parametersRef)->acceptMIMETypes().leakRef()); } + +WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parametersRef) +{ +#if ENABLE(MEDIA_CAPTURE) + return toCopiedAPI(toImpl(parametersRef)->capture()); +#else + return 0; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h index 64577bad9..ddcaae265 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 Samsung Electronics. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,6 +43,8 @@ WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParameters WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parameters); +WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp index d2681203c..ea43df167 100644 --- a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp +++ b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.cpp @@ -100,3 +100,8 @@ WKEinaSharedString& WKEinaSharedString::operator=(const char* str) eina_stringshare_replace(&m_string, str); return *this; } + +bool WKEinaSharedString::operator==(const char* str) const +{ + return (!str || !m_string) ? (str == m_string) : !strcmp(m_string, str); +} diff --git a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h index 83f661418..68d76f4ea 100644 --- a/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h +++ b/Source/WebKit2/UIProcess/API/cpp/efl/WKEinaSharedString.h @@ -52,6 +52,9 @@ public: ALWAYS_INLINE bool operator==(const WKEinaSharedString& other) const { return this->m_string == other.m_string; } ALWAYS_INLINE bool operator!=(const WKEinaSharedString& other) const { return !(*this == other); } + bool operator==(const char* str) const; + ALWAYS_INLINE bool operator!=(const char* str) const { return !(*this == str); } + ALWAYS_INLINE operator const char* () const { return m_string; } ALWAYS_INLINE bool isNull() const { return !m_string; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp index 5b8e2d7ea..acf8d5645 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp @@ -128,7 +128,8 @@ unsigned ewk_back_forward_list_count(Ewk_Back_Forward_List* list) */ void ewk_back_forward_list_changed(Ewk_Back_Forward_List* list, WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems) { - addItemToWrapperCache(list, wkAddedItem); // Puts new item to the cache. + if (wkAddedItem) // Checking also here to avoid EINA_SAFETY_ON_NULL_RETURN_VAL warnings. + addItemToWrapperCache(list, wkAddedItem); // Puts new item to the cache. const size_t removedItemsSize = wkRemovedItems ? WKArrayGetSize(wkRemovedItems) : 0; for (size_t i = 0; i < removedItemsSize; ++i) { diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp index a8586b23d..871187d2a 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.cpp @@ -39,16 +39,13 @@ using namespace WebKit; struct _Ewk_Back_Forward_List_Item { unsigned int __ref; /**< the reference count of the object */ WKRetainPtr<WKBackForwardListItemRef> wkItem; - WKEinaSharedString uri; - WKEinaSharedString title; - WKEinaSharedString originalUri; + mutable WKEinaSharedString uri; + mutable WKEinaSharedString title; + mutable WKEinaSharedString originalUri; _Ewk_Back_Forward_List_Item(WKBackForwardListItemRef itemRef) : __ref(1) , wkItem(itemRef) - , uri(AdoptWK, WKBackForwardListItemCopyURL(itemRef)) - , title(AdoptWK, WKBackForwardListItemCopyTitle(itemRef)) - , originalUri(AdoptWK, WKBackForwardListItemCopyOriginalURL(itemRef)) { } ~_Ewk_Back_Forward_List_Item() @@ -57,6 +54,17 @@ struct _Ewk_Back_Forward_List_Item { } }; +#define EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem_, ...) \ + if (!(item)) { \ + EINA_LOG_CRIT("item is NULL."); \ + return __VA_ARGS__; \ + } \ + if (!(item)->wkItem) { \ + EINA_LOG_CRIT("item->wkItem is NULL."); \ + return __VA_ARGS__; \ + } \ + WKBackForwardListItemRef wkItem_ = (item)->wkItem.get() + void ewk_back_forward_list_item_ref(Ewk_Back_Forward_List_Item* item) { EINA_SAFETY_ON_NULL_RETURN(item); @@ -75,21 +83,27 @@ void ewk_back_forward_list_item_unref(Ewk_Back_Forward_List_Item* item) const char* ewk_back_forward_list_item_uri_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0); + + item->uri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyURL(wkItem)); return item->uri; } const char* ewk_back_forward_list_item_title_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0); + + item->title = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyTitle(wkItem)); return item->title; } const char* ewk_back_forward_list_item_original_uri_get(const Ewk_Back_Forward_List_Item* item) { - EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0); + EWK_BACK_FORWARD_LIST_ITEM_WK_GET_OR_RETURN(item, wkItem, 0); + + item->originalUri = WKEinaSharedString(AdoptWK, WKBackForwardListItemCopyOriginalURL(wkItem)); return item->originalUri; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp index c41681071..a27abc40d 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.cpp @@ -28,6 +28,7 @@ #include "DownloadProxy.h" #include "WKAPICast.h" +#include "WKEinaSharedString.h" #include "WKRetainPtr.h" #include "WebURLRequest.h" #include "ewk_download_job_private.h" @@ -50,8 +51,8 @@ struct _Ewk_Download_Job { double startTime; double endTime; uint64_t downloaded; /**< length already downloaded */ - const char* destination; - const char* suggestedFilename; + WKEinaSharedString destination; + WKEinaSharedString suggestedFilename; _Ewk_Download_Job(DownloadProxy* download, Evas_Object* ewkView) : __ref(1) @@ -63,8 +64,6 @@ struct _Ewk_Download_Job { , startTime(-1) , endTime(-1) , downloaded(0) - , destination(0) - , suggestedFilename(0) { } ~_Ewk_Download_Job() @@ -74,8 +73,6 @@ struct _Ewk_Download_Job { ewk_url_request_unref(request); if (response) ewk_url_response_unref(response); - eina_stringshare_del(destination); - eina_stringshare_del(suggestedFilename); } }; @@ -159,7 +156,7 @@ Eina_Bool ewk_download_job_destination_set(Ewk_Download_Job* download, const cha EINA_SAFETY_ON_NULL_RETURN_VAL(download, false); EINA_SAFETY_ON_NULL_RETURN_VAL(destination, false); - eina_stringshare_replace(&download->destination, destination); + download->destination = destination; return true; } @@ -236,7 +233,7 @@ void ewk_download_job_suggested_filename_set(Ewk_Download_Job* download, const c { EINA_SAFETY_ON_NULL_RETURN(download); - eina_stringshare_replace(&download->suggestedFilename, suggestedFilename); + download->suggestedFilename = suggestedFilename; } /** diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp index 856179346..ed5950311 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp @@ -29,6 +29,7 @@ #include "WKAPICast.h" #include "WKArray.h" #include "WKDictionary.h" +#include "WKEinaSharedString.h" #include "WKIntentData.h" #include "WKRetainPtr.h" #include "WKString.h" @@ -47,26 +48,23 @@ struct _Ewk_Intent { #if ENABLE(WEB_INTENTS) WKRetainPtr<WKIntentDataRef> wkIntent; #endif - const char* action; - const char* type; - const char* service; + WKEinaSharedString action; + WKEinaSharedString type; + WKEinaSharedString service; _Ewk_Intent(WKIntentDataRef intentRef) : __ref(1) #if ENABLE(WEB_INTENTS) , wkIntent(intentRef) + , action(AdoptWK, WKIntentDataCopyAction(intentRef)) + , type(AdoptWK, WKIntentDataCopyType(intentRef)) + , service(AdoptWK, WKIntentDataCopyService(intentRef)) #endif - , action(0) - , type(0) - , service(0) { } ~_Ewk_Intent() { ASSERT(!__ref); - eina_stringshare_del(action); - eina_stringshare_del(type); - eina_stringshare_del(service); } }; @@ -103,47 +101,23 @@ void ewk_intent_unref(Ewk_Intent* intent) const char* ewk_intent_action_get(const Ewk_Intent* intent) { -#if ENABLE(WEB_INTENTS) - EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0); - - WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(wkIntent)); - Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent); - eina_stringshare_replace(&ewkIntent->action, toImpl(wkAction.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0); return intent->action; -#else - return 0; -#endif } const char* ewk_intent_type_get(const Ewk_Intent* intent) { -#if ENABLE(WEB_INTENTS) - EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0); - - WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(wkIntent)); - Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent); - eina_stringshare_replace(&ewkIntent->type, toImpl(wkType.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0); return intent->type; -#else - return 0; -#endif } const char* ewk_intent_service_get(const Ewk_Intent* intent) { -#if ENABLE(WEB_INTENTS) - EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0); - - WKRetainPtr<WKURLRef> wkService(AdoptWK, WKIntentDataCopyService(wkIntent)); - Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent); - eina_stringshare_replace(&ewkIntent->service, toImpl(wkService.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0); return intent->service; -#else - return 0; -#endif } Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent) @@ -171,7 +145,7 @@ const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0); WKRetainPtr<WKStringRef> keyRef = adoptWK(WKStringCreateWithUTF8CString(key)); - WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtra(wkIntent, keyRef.get())); + WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtraValue(wkIntent, keyRef.get())); String value = toImpl(wkValue.get())->string(); if (value.isEmpty()) return 0; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp index 18422b757..19215724b 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp @@ -28,6 +28,7 @@ #include "IntentServiceInfo.h" #include "WKAPICast.h" +#include "WKEinaSharedString.h" #include "WKIntentServiceInfo.h" #include "WKRetainPtr.h" #include "WKURL.h" @@ -42,49 +43,30 @@ using namespace WebKit; */ struct _Ewk_Intent_Service { unsigned int __ref; /**< the reference count of the object */ -#if ENABLE(WEB_INTENTS_TAG) - WKRetainPtr<WKIntentServiceInfoRef> wkService; -#endif - const char* action; - const char* type; - const char* href; - const char* title; - const char* disposition; + + WKEinaSharedString action; + WKEinaSharedString type; + WKEinaSharedString href; + WKEinaSharedString title; + WKEinaSharedString disposition; _Ewk_Intent_Service(WKIntentServiceInfoRef serviceRef) : __ref(1) #if ENABLE(WEB_INTENTS_TAG) - , wkService(serviceRef) + , action(AdoptWK, WKIntentServiceInfoCopyAction(serviceRef)) + , type(AdoptWK, WKIntentServiceInfoCopyType(serviceRef)) + , href(AdoptWK, WKIntentServiceInfoCopyHref(serviceRef)) + , title(AdoptWK, WKIntentServiceInfoCopyTitle(serviceRef)) + , disposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceRef)) #endif - , action(0) - , type(0) - , href(0) - , title(0) - , disposition(0) { } ~_Ewk_Intent_Service() { ASSERT(!__ref); - eina_stringshare_del(action); - eina_stringshare_del(type); - eina_stringshare_del(href); - eina_stringshare_del(title); - eina_stringshare_del(disposition); } }; -#define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \ - if (!(service)) { \ - EINA_LOG_CRIT("service is NULL."); \ - return __VA_ARGS__; \ - } \ - if (!(service)->wkService) { \ - EINA_LOG_CRIT("service->wkService is NULL."); \ - return __VA_ARGS__; \ - } \ - WKIntentServiceInfoRef wkService_ = (service)->wkService.get() - void ewk_intent_service_ref(Ewk_Intent_Service* service) { #if ENABLE(WEB_INTENTS_TAG) @@ -107,77 +89,37 @@ void ewk_intent_service_unref(Ewk_Intent_Service* service) const char* ewk_intent_service_action_get(const Ewk_Intent_Service* service) { -#if ENABLE(WEB_INTENTS_TAG) - EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0); - - WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(wkService)); - Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service); - eina_stringshare_replace(&ewkIntentService->action, toImpl(wkAction.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0); return service->action; -#else - return 0; -#endif } const char* ewk_intent_service_type_get(const Ewk_Intent_Service* service) { -#if ENABLE(WEB_INTENTS_TAG) - EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0); - - WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(wkService)); - Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service); - eina_stringshare_replace(&ewkIntentService->type, toImpl(wkType.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0); return service->type; -#else - return 0; -#endif } const char* ewk_intent_service_href_get(const Ewk_Intent_Service* service) { -#if ENABLE(WEB_INTENTS_TAG) - EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0); - - WKRetainPtr<WKURLRef> wkHref(AdoptWK, WKIntentServiceInfoCopyHref(wkService)); - Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service); - eina_stringshare_replace(&ewkIntentService->href, toImpl(wkHref.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0); return service->href; -#else - return 0; -#endif } const char* ewk_intent_service_title_get(const Ewk_Intent_Service* service) { -#if ENABLE(WEB_INTENTS_TAG) - EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0); - - WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(wkService)); - Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service); - eina_stringshare_replace(&ewkIntentService->title, toImpl(wkTitle.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0); return service->title; -#else - return 0; -#endif } const char* ewk_intent_service_disposition_get(const Ewk_Intent_Service* service) { -#if ENABLE(WEB_INTENTS_TAG) - EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0); - - WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(wkService)); - Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service); - eina_stringshare_replace(&ewkIntentService->disposition, toImpl(wkDisposition.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(service, 0); return service->disposition; -#else - return 0; -#endif } #if ENABLE(WEB_INTENTS_TAG) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp index ae725d74a..190810962 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.cpp @@ -27,6 +27,7 @@ #include "ewk_navigation_policy_decision.h" #include "WKAPICast.h" +#include "WKEinaSharedString.h" #include "WKFramePolicyListener.h" #include "WKRetainPtr.h" #include "ewk_navigation_policy_decision_private.h" @@ -47,7 +48,7 @@ struct _Ewk_Navigation_Policy_Decision { Event_Mouse_Button mouseButton; Event_Modifier_Keys modifiers; Ewk_Url_Request* request; - const char* frameName; + WKEinaSharedString frameName; _Ewk_Navigation_Policy_Decision(WKFramePolicyListenerRef _listener, Ewk_Navigation_Type _navigationType, Event_Mouse_Button _mouseButton, Event_Modifier_Keys _modifiers, Ewk_Url_Request* _request, const char* _frameName) : __ref(1) @@ -57,7 +58,7 @@ struct _Ewk_Navigation_Policy_Decision { , mouseButton(_mouseButton) , modifiers(_modifiers) , request(_request) - , frameName(eina_stringshare_add(_frameName)) + , frameName(_frameName) { } ~_Ewk_Navigation_Policy_Decision() @@ -69,7 +70,6 @@ struct _Ewk_Navigation_Policy_Decision { WKFramePolicyListenerUse(listener.get()); ewk_url_request_unref(request); - eina_stringshare_del(frameName); } }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp index f209952fe..5816b2feb 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp @@ -27,7 +27,7 @@ #include "ewk_url_request.h" #include "WKAPICast.h" -#include "WKRetainPtr.h" +#include "WKEinaSharedString.h" #include "WKURL.h" #include "WKURLRequest.h" #include "WebURLRequest.h" @@ -42,40 +42,24 @@ using namespace WebKit; */ struct _Ewk_Url_Request { unsigned int __ref; /**< the reference count of the object */ - WKRetainPtr<WKURLRequestRef> wkRequest; - const char* url; - const char* first_party; - const char* http_method; + WKEinaSharedString url; + WKEinaSharedString first_party; + WKEinaSharedString http_method; _Ewk_Url_Request(WKURLRequestRef requestRef) : __ref(1) - , wkRequest(requestRef) - , url(0) - , first_party(0) - , http_method(0) + , url(AdoptWK, WKURLRequestCopyURL(requestRef)) + , first_party(AdoptWK, WKURLRequestCopyFirstPartyForCookies(requestRef)) + , http_method(AdoptWK, WKURLRequestCopyHTTPMethod(requestRef)) { } ~_Ewk_Url_Request() { ASSERT(!__ref); - eina_stringshare_del(url); - eina_stringshare_del(first_party); - eina_stringshare_del(http_method); } }; -#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \ - if (!(request)) { \ - EINA_LOG_CRIT("request is NULL."); \ - return __VA_ARGS__; \ - } \ - if (!(request)->wkRequest) { \ - EINA_LOG_CRIT("request->wkRequest is NULL."); \ - return __VA_ARGS__; \ - } \ - WKURLRequestRef wkRequest_ = (request)->wkRequest.get() - void ewk_url_request_ref(Ewk_Url_Request* request) { EINA_SAFETY_ON_NULL_RETURN(request); @@ -94,31 +78,21 @@ void ewk_url_request_unref(Ewk_Url_Request* request) const char* ewk_url_request_url_get(const Ewk_Url_Request* request) { - EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0); - - WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest)); - Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request); - eina_stringshare_replace(&ewkRequest->url, toImpl(wkUrl.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); return request->url; } const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request) { - EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0); - - Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request); - eina_stringshare_replace(&ewkRequest->first_party, toImpl(wkRequest)->resourceRequest().firstPartyForCookies().string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); return request->first_party; } const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request) { - EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0); - - Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request); - eina_stringshare_replace(&ewkRequest->http_method, toImpl(wkRequest)->resourceRequest().httpMethod().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(request, 0); return request->http_method; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp index 8f9f5366a..8d0a8ee30 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.cpp @@ -26,9 +26,14 @@ #include "config.h" #include "ewk_url_response.h" +#include "WKAPICast.h" +#include "WKEinaSharedString.h" +#include "WKURLResponse.h" #include "ewk_url_response_private.h" #include <wtf/text/CString.h> +using namespace WebKit; + /** * \struct _Ewk_Url_Response * @brief Contains the URL response data. @@ -37,21 +42,19 @@ struct _Ewk_Url_Response { unsigned int __ref; /**< the reference count of the object */ WebCore::ResourceResponse coreResponse; - const char* url; - const char* mimeType; + WKEinaSharedString url; + WKEinaSharedString mimeType; _Ewk_Url_Response(const WebCore::ResourceResponse& _coreResponse) : __ref(1) , coreResponse(_coreResponse) - , url(0) - , mimeType(0) + , url(AdoptWK, WKURLResponseCopyURL(toAPI(coreResponse))) + , mimeType(AdoptWK, WKURLResponseCopyMIMEType(toAPI(coreResponse))) { } ~_Ewk_Url_Response() { ASSERT(!__ref); - eina_stringshare_del(url); - eina_stringshare_del(mimeType); } }; @@ -75,9 +78,6 @@ const char* ewk_url_response_url_get(const Ewk_Url_Response* response) { EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); - Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); - eina_stringshare_replace(&ewkResponse->url, response->coreResponse.url().string().utf8().data()); - return response->url; } @@ -92,9 +92,6 @@ const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response) { EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); - Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); - eina_stringshare_replace(&ewkResponse->mimeType, response->coreResponse.mimeType().utf8().data()); - return response->mimeType; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 7d8b1ce05..ce7f7b454 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -26,6 +26,7 @@ #include "NativeWebWheelEvent.h" #include "PageClientImpl.h" #include "WKAPICast.h" +#include "WKEinaSharedString.h" #include "WKFindOptions.h" #include "WKRetainPtr.h" #include "WKString.h" @@ -73,11 +74,11 @@ struct _Ewk_View_Private_Data { OwnPtr<EflViewportHandler> viewportHandler; #endif - const char* uri; - const char* title; - const char* theme; - const char* customEncoding; - const char* cursorGroup; + WKEinaSharedString uri; + WKEinaSharedString title; + WKEinaSharedString theme; + WKEinaSharedString customEncoding; + WKEinaSharedString cursorGroup; Evas_Object* cursorObject; LoadingResourcesMap loadingResourcesMap; Ewk_Back_Forward_List* backForwardList; @@ -93,12 +94,7 @@ struct _Ewk_View_Private_Data { #endif _Ewk_View_Private_Data() - : uri(0) - , title(0) - , theme(0) - , customEncoding(0) - , cursorGroup(0) - , cursorObject(0) + : cursorObject(0) , backForwardList(0) #ifdef HAVE_ECORE_X , isUsingEcoreX(false) @@ -112,10 +108,6 @@ struct _Ewk_View_Private_Data { ~_Ewk_View_Private_Data() { - eina_stringshare_del(uri); - eina_stringshare_del(title); - eina_stringshare_del(theme); - eina_stringshare_del(customEncoding); _ewk_view_priv_loading_resources_clear(loadingResourcesMap); if (cursorObject) @@ -771,10 +763,12 @@ void ewk_view_uri_update(Evas_Object* ewkView) if (activeURL.isEmpty()) return; - if (!eina_stringshare_replace(&priv->uri, activeURL.utf8().data())) + if (priv->uri == activeURL.utf8().data()) return; - evas_object_smart_callback_call(ewkView, "uri,changed", static_cast<void*>(const_cast<char*>(priv->uri))); + priv->uri = activeURL.utf8().data(); + const char* callbackArgument = static_cast<const char*>(priv->uri); + evas_object_smart_callback_call(ewkView, "uri,changed", const_cast<char*>(callbackArgument)); } Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri) @@ -933,7 +927,7 @@ const char* ewk_view_title_get(const Evas_Object* ewkView) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); CString title = priv->pageClient->page()->pageTitle().utf8(); - eina_stringshare_replace(&priv->title, title.data()); + priv->title = title.data(); return priv->title; } @@ -1032,10 +1026,10 @@ void ewk_view_theme_set(Evas_Object* ewkView, const char* path) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - if (!eina_stringshare_replace(&priv->theme, path)) - return; - - priv->pageClient->page()->setThemePath(path); + if (priv->theme != path) { + priv->theme = path; + priv->pageClient->page()->setThemePath(path); + } } const char* ewk_view_theme_get(const Evas_Object* ewkView) @@ -1381,7 +1375,7 @@ const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView) if (customEncoding.isEmpty()) return 0; - eina_stringshare_replace(&priv->customEncoding, customEncoding.utf8().data()); + priv->customEncoding = customEncoding.utf8().data(); return priv->customEncoding; } @@ -1391,8 +1385,8 @@ Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - if (eina_stringshare_replace(&priv->customEncoding, encoding)) - priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String()); + priv->customEncoding = encoding; + priv->pageClient->page()->setCustomTextEncodingName(encoding ? encoding : String()); return true; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index 423f9e143..6064cf855 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -42,7 +42,7 @@ * when done to continue with the form submission. If the last reference is removed on a * #Ewk_Form_Submission_Request and the form has not been submitted yet, * ewk_form_submission_request_submit() will be called automatically. - * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request. + * - "intent,request,new", Ewk_Intent*: reports new Web intent request. * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration. * - "load,error", const Ewk_Web_Error*: reports main frame load failed. * - "load,finished", void: reports load finished. diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp index e6e3eb891..70380bdd2 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp @@ -27,6 +27,7 @@ #include "ewk_web_error.h" #include "ErrorsEfl.h" +#include "WKEinaSharedString.h" #include "WKString.h" #include "WKURL.h" #include "ewk_web_error_private.h" @@ -41,19 +42,17 @@ using namespace WebKit; struct _Ewk_Web_Error { WKRetainPtr<WKErrorRef> wkError; - const char* url; - const char* description; + WKEinaSharedString url; + WKEinaSharedString description; _Ewk_Web_Error(WKErrorRef errorRef) : wkError(errorRef) - , url(0) - , description(0) + , url(AdoptWK, WKErrorCopyFailingURL(errorRef)) + , description(AdoptWK, WKErrorCopyLocalizedDescription(errorRef)) { } ~_Ewk_Web_Error() { - eina_stringshare_del(url); - eina_stringshare_del(description); } }; @@ -97,11 +96,7 @@ Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error) const char* ewk_web_error_url_get(const Ewk_Web_Error* error) { - EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0); - - WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKErrorCopyFailingURL(wkError)); - Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error); - eina_stringshare_replace(&ewkError->url, toImpl(wkUrl.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); return error->url; } @@ -115,11 +110,7 @@ int ewk_web_error_code_get(const Ewk_Web_Error* error) const char* ewk_web_error_description_get(const Ewk_Web_Error* error) { - EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0); - - WKRetainPtr<WKStringRef> wkDescription(AdoptWK, WKErrorCopyLocalizedDescription(wkError)); - Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error); - eina_stringshare_replace(&ewkError->description, toImpl(wkDescription.get())->string().utf8().data()); + EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0); return error->description; } diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp index e0d728a9e..355592df4 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp @@ -26,24 +26,24 @@ #include "config.h" #include "ewk_web_resource.h" +#include "WKEinaSharedString.h" #include "ewk_web_resource_private.h" #include <wtf/text/CString.h> struct _Ewk_Web_Resource { unsigned int __ref; /**< the reference count of the object */ - const char* url; + WKEinaSharedString url; bool isMainResource; - _Ewk_Web_Resource(const char* _url, bool _isMainResource) + _Ewk_Web_Resource(const char* url, bool isMainResource) : __ref(1) - , url(eina_stringshare_add(_url)) - , isMainResource(_isMainResource) + , url(url) + , isMainResource(isMainResource) { } ~_Ewk_Web_Resource() { ASSERT(!__ref); - eina_stringshare_del(url); } }; diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp index 4069e25fa..39bc5a4db 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp @@ -112,4 +112,12 @@ void EWK2UnitTestBase::waitUntilTitleChangedTo(const char* expectedTitle) evas_object_smart_callback_del(m_webView, "title,changed", onTitleChanged); } +void EWK2UnitTestBase::mouseClick(int x, int y) +{ + Evas* evas = evas_object_evas_get(m_webView); + evas_event_feed_mouse_move(evas, x, y, 0, 0); + evas_event_feed_mouse_down(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0); + evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0); +} + } // namespace EWK2UnitTest diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h index 64b9bce60..29d55bee4 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h +++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h @@ -38,6 +38,7 @@ protected: void loadUrlSync(const char* url); void waitUntilTitleChangedTo(const char* expectedTitle); + void mouseClick(int x, int y); private: Evas_Object* m_webView; diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html index edd81e732..5d1e00856 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/default_test_page.html @@ -1,4 +1,5 @@ <HTML> +<title>Default Testing Web Page</title> <BODY> <H2 align="center">EFL Unit Tests</H2> <H2 align="center">Default Testing Web Page</H2> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html new file mode 100644 index 000000000..7b06cbec9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-request.html @@ -0,0 +1,29 @@ +<html> +<head> +<title>Web intent request test</title> +<script type="text/javascript"> +var clickCount = 0; + +function buttonClicked() { + if (clickCount == 0) { + var testIntent = new WebKitIntent( + {"action": "action1", + "type": "mime/type1", + "service": "http://service1.com/", + "extras": {"key1": "value1", "key2": "value2"}}); + navigator.webkitStartActivity(testIntent); + } else if (clickCount == 1) { + var testIntent = new WebKitIntent( + {"action": "action2", + "type": "mime/type2", + "suggestions": ["http://service1.com/", "http://service2.com/"]}); + navigator.webkitStartActivity(testIntent); + } + clickCount++; +} +</script> +</head> +<body> +<input type="button" id="button" value="Start Web Intent" onmouseup="buttonClicked()" style="position: absolute; top: 0px; left: 0px;"/> +</body> +</html> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html new file mode 100644 index 000000000..1d9fa2a33 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html @@ -0,0 +1,9 @@ +<html> +<head> +<title>Web Intent service registration test</title> +</head> + <body> + <intent action="action" type="type" title="Title" href="http://example.com/service" disposition="inline"></intent> + Registered Intent Service. + </body> +</html> diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp new file mode 100644 index 000000000..af10981ec --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" +#include "WKEinaSharedString.h" +#include <EWebKit2.h> +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +using namespace EWK2UnitTest; +using namespace WTF; + +extern EWK2UnitTestEnvironment* environment; + +static const char title1[] = "Page1"; +static const char title2[] = "Page2"; + +static void serverCallbackNavigation(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + + Eina_Strbuf* body = eina_strbuf_new(); + eina_strbuf_append_printf(body, "<html><title>%s</title><body>%s</body></html>", path + 1, path + 1); + const size_t bodyLength = eina_strbuf_length_get(body); + soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(body), bodyLength); + eina_strbuf_free(body); + + soup_message_body_complete(message->response_body); +} + +static inline void checkItem(Ewk_Back_Forward_List_Item* item, const char* title, const char* uri, const char* originalURI) +{ + ASSERT_TRUE(item); + EXPECT_STREQ(uri, ewk_back_forward_list_item_uri_get(item)); + EXPECT_STREQ(title, ewk_back_forward_list_item_title_get(item)); + EXPECT_STREQ(originalURI, ewk_back_forward_list_item_original_uri_get(item)); +} + +static inline WKEinaSharedString urlFromTitle(EWK2UnitTestServer* httpServer, const char* title) +{ + Eina_Strbuf* path = eina_strbuf_new(); + eina_strbuf_append_printf(path, "/%s", title); + WKEinaSharedString res = httpServer->getURIForPath(eina_strbuf_string_get(path)).data(); + eina_strbuf_free(path); + + return res; +} + +TEST_F(EWK2UnitTestBase, ewk_back_forward_list_current_item_get) +{ + const char* url = environment->defaultTestPageUrl(); + loadUrlSync(url); + Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); + ASSERT_TRUE(backForwardList); + + Ewk_Back_Forward_List_Item* currentItem = ewk_back_forward_list_current_item_get(backForwardList); + checkItem(currentItem, ewk_view_title_get(webView()), url, url); + + Ewk_Back_Forward_List_Item* anotherCurrentItem = ewk_back_forward_list_current_item_get(backForwardList); + ASSERT_EQ(currentItem, anotherCurrentItem); +} + +TEST_F(EWK2UnitTestBase, ewk_back_forward_list_previous_item_get) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallbackNavigation); + + WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1); + loadUrlSync(url1); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); + + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); + + Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); + ASSERT_TRUE(backForwardList); + + Ewk_Back_Forward_List_Item* previousItem = ewk_back_forward_list_previous_item_get(backForwardList); + checkItem(previousItem, title1, url1, url1); + + Ewk_Back_Forward_List_Item* anotherPreviousItem = ewk_back_forward_list_previous_item_get(backForwardList); + ASSERT_EQ(previousItem, anotherPreviousItem); +} + +TEST_F(EWK2UnitTestBase, ewk_back_forward_list_next_item_get) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallbackNavigation); + + loadUrlSync(urlFromTitle(httpServer.get(), title1)); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); + + WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2); + loadUrlSync(url2); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); + + // Go back to Page1. + ewk_view_back(webView()); + waitUntilTitleChangedTo(title1); + + Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); + ASSERT_TRUE(backForwardList); + + Ewk_Back_Forward_List_Item* nextItem = ewk_back_forward_list_next_item_get(backForwardList); + checkItem(nextItem, title2, url2, url2); + + Ewk_Back_Forward_List_Item* anotherNextItem = ewk_back_forward_list_next_item_get(backForwardList); + ASSERT_EQ(nextItem, anotherNextItem); +} + +TEST_F(EWK2UnitTestBase, ewk_back_forward_list_item_at_index_get) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallbackNavigation); + + WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1); + loadUrlSync(url1); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); + + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); + + Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); + ASSERT_TRUE(backForwardList); + + Ewk_Back_Forward_List_Item* previousItem = ewk_back_forward_list_item_at_index_get(backForwardList, -1); + checkItem(previousItem, title1, url1, url1); + + Ewk_Back_Forward_List_Item* anotherPreviousItem = ewk_back_forward_list_item_at_index_get(backForwardList, -1); + ASSERT_EQ(previousItem, anotherPreviousItem); + + Ewk_Back_Forward_List_Item* nonExistingItem = ewk_back_forward_list_item_at_index_get(backForwardList, 10); + ASSERT_FALSE(nonExistingItem); +} + +TEST_F(EWK2UnitTestBase, ewk_back_forward_list_count) +{ + OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer); + httpServer->run(serverCallbackNavigation); + + loadUrlSync(urlFromTitle(httpServer.get(), title1)); + ASSERT_STREQ(ewk_view_title_get(webView()), title1); + + loadUrlSync(urlFromTitle(httpServer.get(), title2)); + ASSERT_STREQ(ewk_view_title_get(webView()), title2); + + Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView()); + ASSERT_TRUE(backForwardList); + + EXPECT_EQ(ewk_back_forward_list_count(backForwardList), 2); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp index 034f87140..a5e8157da 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp @@ -28,6 +28,7 @@ #include "UnitTestUtils/EWK2UnitTestBase.h" #include "UnitTestUtils/EWK2UnitTestEnvironment.h" #include <EWebKit2.h> +#include <Ecore.h> #include <gtest/gtest.h> using namespace EWK2UnitTest; @@ -67,3 +68,83 @@ TEST_F(EWK2UnitTestBase, ewk_context_uri_scheme_register) loadUrlSync("fooscheme:MyPath"); ASSERT_STREQ(ewk_view_title_get(webView()), "Foo"); } + +struct VibrationCbData { + bool didReceiveVibrateCallback; // Whether the vibration event received. + bool didReceiveCancelVibrationCallback; // Whether the cancel vibration event received. + unsigned vibrateCalledCount; // Vibrate callbacks count. + uint64_t expectedVibrationTime; // Expected vibration time. +}; + +static void vibrateCallback(uint64_t vibrationTime, void* userData) +{ + VibrationCbData* data = static_cast<VibrationCbData*>(userData); + if (vibrationTime == data->expectedVibrationTime) + data->didReceiveVibrateCallback = true; + data->vibrateCalledCount++; +} + +static void cancelVibrationCallback(void* userData) +{ + VibrationCbData* data = static_cast<VibrationCbData*>(userData); + data->didReceiveCancelVibrationCallback = true; +} + +static void loadVibrationHTMLString(Evas_Object* webView, const char* vibrationPattern, bool waitForVibrationEvent, VibrationCbData* data) +{ + const char* content = + "<html><head><script type='text/javascript'>function vibrate() { navigator.vibrate(%s);" + " document.title = \"Loaded\"; }</script></head><body onload='vibrate()'></body></html>"; + + data->didReceiveVibrateCallback = false; + data->didReceiveCancelVibrationCallback = false; + data->vibrateCalledCount = 0; + Eina_Strbuf* buffer = eina_strbuf_new(); + eina_strbuf_append_printf(buffer, content, vibrationPattern); + ewk_view_html_string_load(webView, eina_strbuf_string_get(buffer), 0, 0); + eina_strbuf_free(buffer); + + if (!waitForVibrationEvent) + return; + + while (!data->didReceiveVibrateCallback && !data->didReceiveCancelVibrationCallback) + ecore_main_loop_iterate(); +} + +TEST_F(EWK2UnitTestBase, ewk_context_vibration_client_callbacks_set) +{ + VibrationCbData data = { false, false, 0, 5000 }; + ewk_context_vibration_client_callbacks_set(ewk_context_default_get(), vibrateCallback, cancelVibrationCallback, &data); + + // Vibrate for 5 seconds. + loadVibrationHTMLString(webView(), "5000", true, &data); + ASSERT_TRUE(data.didReceiveVibrateCallback); + + // Cancel any existing vibrations. + loadVibrationHTMLString(webView(), "0", true, &data); + ASSERT_TRUE(data.didReceiveCancelVibrationCallback); + + // This case the pattern will cause the device to vibrate for 200 ms, be still for 100 ms, and then vibrate for 5000 ms. + loadVibrationHTMLString(webView(), "[200, 100, 5000]", true, &data); + ASSERT_EQ(data.vibrateCalledCount, 2); + ASSERT_TRUE(data.didReceiveVibrateCallback); + + // Cancel outstanding vibration pattern. + loadVibrationHTMLString(webView(), "[0]", true, &data); + ASSERT_TRUE(data.didReceiveCancelVibrationCallback); + + // Stop listening for vibration events, by calling the function with null for the callbacks. + ewk_context_vibration_client_callbacks_set(ewk_context_default_get(), 0, 0, &data); + + // Make sure we don't receive vibration event. + loadVibrationHTMLString(webView(), "[5000]", false, &data); + waitUntilTitleChangedTo("Loaded"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded"); + ASSERT_FALSE(data.didReceiveVibrateCallback); + + // Make sure we don't receive cancel vibration event. + loadVibrationHTMLString(webView(), "0", false, &data); + waitUntilTitleChangedTo("Loaded"); + ASSERT_STREQ(ewk_view_title_get(webView()), "Loaded"); + ASSERT_FALSE(data.didReceiveCancelVibrationCallback); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp index 7dbd496bd..10be26cb5 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp @@ -57,7 +57,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* eina_strbuf_append_printf(buffer, INDEX_HTML_STRING, soup_server_get_port(server)); soup_message_headers_replace(message->response_headers, "Set-Cookie", "foo=bar; Max-Age=60"); soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, eina_strbuf_string_steal(buffer), eina_strbuf_length_get(buffer)); - eina_strbuf_string_free(buffer); + eina_strbuf_free(buffer); } else if (!strcmp(path, "/image.png")) soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60"); else diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp new file mode 100644 index 000000000..7f62e0b1e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "WKEinaSharedString.h" +#include <EWebKit2.h> +#include <Ecore.h> +#include <WebKit2/WKString.h> +#include <WebKit2/WKURL.h> +#include <gtest/gtest.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +// Use macro here instead of global variables in order not to have always the same pointers. +#define testString "I'm test string!" +#define anotherTestString "I'm another test string!" +#define testUrl "file:///path/somewhere" + +static inline void checkString(const WKEinaSharedString& string, const char* pattern) +{ + ASSERT_EQ(string.isNull(), pattern ? false : true); + ASSERT_EQ(string.length(), pattern ? strlen(pattern) : 0); // Compare length. + ASSERT_EQ(string, pattern); // Compare values. Check '==' operator with WKEinaSharedString and plain string. + ASSERT_STREQ(string, pattern); // Compare values. Check 'const char*' operator. +} + +TEST_F(EWK2UnitTestBase, constructEmpty) +{ + WKEinaSharedString emptyString; + checkString(emptyString, 0); +} + +TEST_F(EWK2UnitTestBase, constructFromPlainString) +{ + WKEinaSharedString emptyString(testString); + checkString(emptyString, testString); +} + +TEST_F(EWK2UnitTestBase, constructFromWKString) +{ + WKEinaSharedString string(AdoptWK, WKStringCreateWithUTF8CString(testString)); + checkString(string, testString); +} + +TEST_F(EWK2UnitTestBase, constructFromWKURL) +{ + WKEinaSharedString string(AdoptWK, WKURLCreateWithUTF8CString(testUrl)); + checkString(string, testUrl); +} + +TEST_F(EWK2UnitTestBase, costructCopy) +{ + WKEinaSharedString string(testString); + WKEinaSharedString copyString(string); + checkString(string, testString); + checkString(copyString, testString); + ASSERT_EQ(string, copyString); // Check '==' operator with two instances of WKEinaSharedString. +} + +TEST_F(EWK2UnitTestBase, comparisonOperators) +{ + WKEinaSharedString string(testString); + WKEinaSharedString sameString(testString); + WKEinaSharedString anotherString(anotherTestString); + + ASSERT_EQ(string, sameString); // Check '==' operator with two instances of WKEinaSharedString. + ASSERT_NE(string, anotherString); // Check '!=' operator with two instances of WKEinaSharedString. + + const char* explicitlySharedString = eina_stringshare_add(testString); + ASSERT_EQ(static_cast<const char*>(string), explicitlySharedString); // Compare pointers. + ASSERT_STREQ(string, explicitlySharedString); // Compare values. + eina_stringshare_del(explicitlySharedString); + + ASSERT_EQ(string, string); // Self-comparison. +} + +TEST_F(EWK2UnitTestBase, assignmentOperators) +{ + WKEinaSharedString string; + + string = testString; + checkString(string, testString); + + WKEinaSharedString anotherString(anotherTestString); + string = anotherString; + checkString(string, anotherTestString); + ASSERT_EQ(string, anotherString); + + string = string; // Check that self-assignment does not break WKEinaSharedString internal data. + checkString(string, anotherTestString); +} diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp new file mode 100644 index 000000000..fdf7fdf23 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 "UnitTestUtils/EWK2UnitTestBase.h" +#include "UnitTestUtils/EWK2UnitTestEnvironment.h" +#include "UnitTestUtils/EWK2UnitTestServer.h" +#include <EWebKit2.h> +#include <Ecore.h> + +using namespace EWK2UnitTest; + +extern EWK2UnitTestEnvironment* environment; + +static void onIntentServiceRegistration(void* userData, Evas_Object*, void* eventInfo) +{ + bool* intentRegistered = static_cast<bool*>(userData); + ASSERT_FALSE(*intentRegistered); + *intentRegistered = true; + + Ewk_Intent_Service* service = static_cast<Ewk_Intent_Service*>(eventInfo); + ASSERT_TRUE(service); + EXPECT_STREQ(ewk_intent_service_action_get(service), "action"); + EXPECT_STREQ(ewk_intent_service_type_get(service), "type"); + EXPECT_STREQ(ewk_intent_service_title_get(service), "Title"); + EXPECT_STREQ(ewk_intent_service_href_get(service), "http://example.com/service"); + EXPECT_STREQ(ewk_intent_service_disposition_get(service), "inline"); +} + +TEST_F(EWK2UnitTestBase, ewk_intent_service_registration) +{ + bool intentRegistered = false; + evas_object_smart_callback_add(webView(), "intent,service,register", onIntentServiceRegistration, &intentRegistered); + loadUrlSync(environment->urlForResource("intent-service.html").data()); + evas_object_smart_callback_del(webView(), "intent,service,register", onIntentServiceRegistration); + ASSERT_TRUE(intentRegistered); +} + +int stringSortCb(const void* d1, const void* d2) +{ + return strcmp(static_cast<const char*>(d1), static_cast<const char*>(d2)); +} + +static void onIntentReceived(void* userData, Evas_Object*, void* eventInfo) +{ + unsigned* intentReceivedCount = static_cast<unsigned*>(userData); + ASSERT_GE(*intentReceivedCount, 0); + ASSERT_LE(*intentReceivedCount, 1); + ++(*intentReceivedCount); + + Ewk_Intent* intent = static_cast<Ewk_Intent*>(eventInfo); + ASSERT_TRUE(intent); + + if (*intentReceivedCount == 1) { + // First intent. + EXPECT_STREQ(ewk_intent_action_get(intent), "action1"); + EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type1"); + EXPECT_STREQ(ewk_intent_service_get(intent), "http://service1.com/"); + EXPECT_STREQ(ewk_intent_extra_get(intent, "key1"), "value1"); + EXPECT_STREQ(ewk_intent_extra_get(intent, "key2"), "value2"); + } else { + // Second intent. + EXPECT_STREQ(ewk_intent_action_get(intent), "action2"); + EXPECT_STREQ(ewk_intent_type_get(intent), "mime/type2"); + Eina_List* suggestions = ewk_intent_suggestions_get(intent); + ASSERT_TRUE(suggestions); + ASSERT_EQ(eina_list_count(suggestions), 2); + // We need to sort the suggestions since Intent is using a HashSet internally. + suggestions = eina_list_sort(suggestions, 2, stringSortCb); + EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 0)), "http://service1.com/"); + EXPECT_STREQ(static_cast<const char*>(eina_list_nth(suggestions, 1)), "http://service2.com/"); + } +} + +TEST_F(EWK2UnitTestBase, ewk_intent_request) +{ + unsigned intentReceivedCount = 0; + evas_object_smart_callback_add(webView(), "intent,request,new", onIntentReceived, &intentReceivedCount); + loadUrlSync(environment->urlForResource("intent-request.html").data()); + + // A user gesture is required for the intent to start. + mouseClick(5, 5); + while (intentReceivedCount != 1) + ecore_main_loop_iterate(); + ASSERT_EQ(intentReceivedCount, 1); + + // Generate a second intent request. + mouseClick(5, 5); + while (intentReceivedCount != 2) + ecore_main_loop_iterate(); + ASSERT_EQ(intentReceivedCount, 2); + evas_object_smart_callback_del(webView(), "intent,request,new", onIntentReceived); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp index 43ec3338d..29811fc6a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp @@ -33,7 +33,8 @@ enum { PROP_URI, PROP_STATUS_CODE, PROP_CONTENT_LENGTH, - PROP_MIME_TYPE + PROP_MIME_TYPE, + PROP_SUGGESTED_FILENAME }; using namespace WebKit; @@ -45,6 +46,7 @@ struct _WebKitURIResponsePrivate { WebCore::ResourceResponse resourceResponse; CString uri; CString mimeType; + CString suggestedFilename; }; static void webkitURIResponseFinalize(GObject* object) @@ -70,6 +72,9 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue* case PROP_MIME_TYPE: g_value_set_string(value, webkit_uri_response_get_mime_type(response)); break; + case PROP_SUGGESTED_FILENAME: + g_value_set_string(value, webkit_uri_response_get_suggested_filename(response)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); } @@ -133,6 +138,19 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass 0, WEBKIT_PARAM_READABLE)); + /** + * WebKitURIResponse:suggested-filename: + * + * The suggested filename for the URI response. + */ + g_object_class_install_property(objectClass, + PROP_SUGGESTED_FILENAME, + g_param_spec_string("suggested-filename", + _("Suggested Filename"), + _("The suggested filename for the URI response"), + 0, + WEBKIT_PARAM_READABLE)); + g_type_class_add_private(responseClass, sizeof(WebKitURIResponsePrivate)); } @@ -230,6 +248,28 @@ gboolean webkit_uri_response_get_https_status(WebKitURIResponse* response, GTlsC return !!response->priv->resourceResponse.soupMessageCertificate(); } +/** + * webkit_uri_response_get_suggested_filename: + * @response: a #WebKitURIResponse + * + * Get the suggested filename for @response, as specified by + * the 'Content-Disposition' HTTP header, or %NULL if it's not + * present. + * + * Returns: (transfer none): the suggested filename or %NULL if + * the 'Content-Disposition' HTTP header is not present. + */ +const gchar* webkit_uri_response_get_suggested_filename(WebKitURIResponse* response) +{ + g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0); + + if (response->priv->resourceResponse.suggestedFilename().isEmpty()) + return 0; + + response->priv->suggestedFilename = response->priv->resourceResponse.suggestedFilename().utf8(); + return response->priv->suggestedFilename.data(); +} + WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse) { WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL)); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h index 19705921a..d90cf4132 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h @@ -53,24 +53,26 @@ struct _WebKitURIResponseClass { }; WEBKIT_API GType -webkit_uri_response_get_type (void); +webkit_uri_response_get_type (void); WEBKIT_API const gchar * -webkit_uri_response_get_uri (WebKitURIResponse *response); +webkit_uri_response_get_uri (WebKitURIResponse *response); WEBKIT_API guint -webkit_uri_response_get_status_code (WebKitURIResponse *response); +webkit_uri_response_get_status_code (WebKitURIResponse *response); WEBKIT_API guint64 -webkit_uri_response_get_content_length (WebKitURIResponse *response); +webkit_uri_response_get_content_length (WebKitURIResponse *response); WEBKIT_API const gchar * -webkit_uri_response_get_mime_type (WebKitURIResponse *response); +webkit_uri_response_get_mime_type (WebKitURIResponse *response); WEBKIT_API gboolean -webkit_uri_response_get_https_status (WebKitURIResponse *response, - GTlsCertificate **certificate, - GTlsCertificateFlags *errors); +webkit_uri_response_get_https_status (WebKitURIResponse *response, + GTlsCertificate **certificate, + GTlsCertificateFlags *errors); +WEBKIT_API const gchar * +webkit_uri_response_get_suggested_filename (WebKitURIResponse *response); G_END_DECLS diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index fe9df9f75..620c9a876 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -32,6 +32,7 @@ #include "WebKitURISchemeRequestPrivate.h" #include "WebKitWebContextPrivate.h" #include <WebCore/FileSystem.h> +#include <WebCore/Language.h> #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> #include <wtf/gobject/GOwnPtr.h> @@ -518,6 +519,31 @@ void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context, #endif } +/** + * webkit_web_context_set_preferred_languages: + * @context: a #WebKitWebContext + * @languages: (element-type utf8): a #GList of language identifiers + * + * Set the list of preferred languages, sorted from most desirable + * to least desirable. The list will be used to build the "Accept-Language" + * header that will be included in the network requests started by + * the #WebKitWebContext. + */ +void webkit_web_context_set_preferred_languages(WebKitWebContext* context, GList* languageList) +{ + g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); + + if (!languageList) + return; + + Vector<String> languages; + for (GList* iter = languageList; iter; iter = g_list_next(iter)) + languages.append(String::fromUTF8(static_cast<char*>(iter->data)).lower().replace("_", "-")); + + WebCore::overrideUserPreferredLanguages(languages); + WebCore::languageDidChange(); +} + WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload) { GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h index 0d32ba5bb..5af7f2414 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h @@ -146,6 +146,10 @@ WEBKIT_API void webkit_web_context_set_spell_checking_languages (WebKitWebContext *context, const gchar *languages); +WEBKIT_API void +webkit_web_context_set_preferred_languages (WebKitWebContext *context, + GList *languages); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 80e5fff23..ee86d448a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -79,7 +79,7 @@ enum { MOUSE_TARGET_CHANGED, - PRINT_REQUESTED, + PRINT, RESOURCE_LOAD_STARTED, @@ -106,13 +106,6 @@ enum { PROP_ZOOM_LEVEL }; -typedef enum { - NotReplacingContent, - WillReplaceContent, - ReplacingContent, - DidReplaceContent -} ReplaceContentStatus; - typedef HashMap<uint64_t, GRefPtr<WebKitWebResource> > LoadingResourcesMap; typedef HashMap<String, GRefPtr<WebKitWebResource> > ResourcesMap; @@ -122,7 +115,6 @@ struct _WebKitWebViewPrivate { CString customTextEncoding; double estimatedLoadProgress; CString activeURI; - ReplaceContentStatus replaceContentStatus; bool waitingForMainResource; gulong mainResourceResponseHandlerID; @@ -159,7 +151,7 @@ static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, c return FALSE; GOwnPtr<char> htmlString(g_strdup_printf("<html><body>%s</body></html>", error->message)); - webkit_web_view_replace_content(webView, htmlString.get(), failingURI, 0); + webkit_web_view_load_alternate_html(webView, htmlString.get(), failingURI, 0); return TRUE; } @@ -882,7 +874,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_TYPE_HIT_TEST_RESULT, G_TYPE_UINT); /** - * WebKitWebView::print-requested: + * WebKitWebView::print: * @web_view: the #WebKitWebView on which the signal is emitted * @print_operation: the #WebKitPrintOperation that will handle the print request * @@ -899,11 +891,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * Returns: %TRUE to stop other handlers from being invoked for the event. * %FALSE to propagate the event further. */ - signals[PRINT_REQUESTED] = - g_signal_new("print-requested", + signals[PRINT] = + g_signal_new("print", G_TYPE_FROM_CLASS(webViewClass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(WebKitWebViewClass, print_requested), + G_STRUCT_OFFSET(WebKitWebViewClass, print), g_signal_accumulator_true_handled, 0, webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, @@ -1107,25 +1099,6 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_TYPE_FORM_SUBMISSION_REQUEST); } -static bool updateReplaceContentStatus(WebKitWebView* webView, WebKitLoadEvent loadEvent) -{ - if (webView->priv->replaceContentStatus == ReplacingContent) { - if (loadEvent == WEBKIT_LOAD_FINISHED) - webView->priv->replaceContentStatus = DidReplaceContent; - return true; - } - - if (loadEvent == WEBKIT_LOAD_STARTED) { - if (webView->priv->replaceContentStatus == WillReplaceContent) { - webView->priv->replaceContentStatus = ReplacingContent; - return true; - } - webView->priv->replaceContentStatus = NotReplacingContent; - } - - return false; -} - static void setCertificateToMainResource(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; @@ -1169,21 +1142,16 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) webView->priv->waitingForMainResource = false; } else if (loadEvent == WEBKIT_LOAD_COMMITTED) { webView->priv->subresourcesMap.clear(); - if (webView->priv->replaceContentStatus != ReplacingContent) { - if (!webView->priv->mainResource) { - // When a page is loaded from the history cache, the main resource load callbacks - // are called when the main frame load is finished. We want to make sure there's a - // main resource available when load has been committed, so we delay the emission of - // load-changed signal until main resource object has been created. - webView->priv->waitingForMainResource = true; - } else - setCertificateToMainResource(webView); - } + if (!webView->priv->mainResource) { + // When a page is loaded from the history cache, the main resource load callbacks + // are called when the main frame load is finished. We want to make sure there's a + // main resource available when load has been committed, so we delay the emission of + // load-changed signal until main resource object has been created. + webView->priv->waitingForMainResource = true; + } else + setCertificateToMainResource(webView); } - if (updateReplaceContentStatus(webView, loadEvent)) - return; - if (webView->priv->waitingForMainResource) webView->priv->lastDelayedEvent = loadEvent; else @@ -1192,9 +1160,6 @@ void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent) void webkitWebViewLoadFailed(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError *error) { - if (webView->priv->replaceContentStatus == ReplacingContent) - return; - gboolean returnValue; g_signal_emit(webView, signals[LOAD_FAILED], 0, loadEvent, failingURI, error, &returnValue); g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED); @@ -1212,9 +1177,6 @@ void webkitWebViewSetTitle(WebKitWebView* webView, const CString& title) void webkitWebViewSetEstimatedLoadProgress(WebKitWebView* webView, double estimatedLoadProgress) { - if (webView->priv->replaceContentStatus != NotReplacingContent) - return; - if (webView->priv->estimatedLoadProgress == estimatedLoadProgress) return; @@ -1321,7 +1283,7 @@ void webkitWebViewPrintFrame(WebKitWebView* webView, WKFrameRef wkFrame) { GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView)); gboolean returnValue; - g_signal_emit(webView, signals[PRINT_REQUESTED], 0, printOperation.get(), &returnValue); + g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue); if (returnValue) return; @@ -1349,16 +1311,8 @@ static void waitForMainResourceResponseIfWaitingForResource(WebKitWebView* webVi g_signal_connect(priv->mainResource.get(), "notify::response", G_CALLBACK(mainResourceResponseChangedCallback), webView); } -static inline bool webkitWebViewIsReplacingContentOrDidReplaceContent(WebKitWebView* webView) -{ - return (webView->priv->replaceContentStatus == ReplacingContent || webView->priv->replaceContentStatus == DidReplaceContent); -} - void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame, uint64_t resourceIdentifier, WebKitURIRequest* request, bool isMainResource) { - if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView)) - return; - WebKitWebViewPrivate* priv = webView->priv; WebKitWebResource* resource = webkitWebResourceCreate(wkFrame, request, isMainResource); if (WKFrameIsMainFrame(wkFrame) && (isMainResource || !priv->mainResource)) { @@ -1371,9 +1325,6 @@ void webkitWebViewResourceLoadStarted(WebKitWebView* webView, WKFrameRef wkFrame WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier) { - if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView)) - return 0; - GRefPtr<WebKitWebResource> resource = webView->priv->loadingResourcesMap.get(resourceIdentifier); ASSERT(resource.get()); return resource.get(); @@ -1381,9 +1332,6 @@ WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView* webView, ui void webkitWebViewRemoveLoadingWebResource(WebKitWebView* webView, uint64_t resourceIdentifier) { - if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView)) - return; - WebKitWebViewPrivate* priv = webView->priv; ASSERT(priv->loadingResourcesMap.contains(resourceIdentifier)); priv->loadingResourcesMap.remove(resourceIdentifier); @@ -1391,9 +1339,6 @@ void webkitWebViewRemoveLoadingWebResource(WebKitWebView* webView, uint64_t reso WebKitWebResource* webkitWebViewResourceLoadFinished(WebKitWebView* webView, uint64_t resourceIdentifier) { - if (webkitWebViewIsReplacingContentOrDidReplaceContent(webView)) - return 0; - WebKitWebViewPrivate* priv = webView->priv; WebKitWebResource* resource = webkitWebViewGetLoadingWebResource(webView, resourceIdentifier); if (resource != priv->mainResource) @@ -1597,6 +1542,33 @@ void webkit_web_view_load_html(WebKitWebView* webView, const gchar* content, con } /** + * webkit_web_view_load_alternate_html: + * @web_view: a #WebKitWebView + * @content: the new content to display as the main page of the @web_view + * @content_uri: the URI for the alternate page content + * @base_uri: (allow-none): the base URI for relative locations or %NULL + * + * Load the given @content string for the URI @content_uri. + * This allows clients to display page-loading errors in the #WebKitWebView itself. + * When this method is called from #WebKitWebView::load-failed signal to show an + * error page, the the back-forward list is maintained appropriately. + * For everything else this method works the same way as webkit_web_view_load_html(). + */ +void webkit_web_view_load_alternate_html(WebKitWebView* webView, const gchar* content, const gchar* contentURI, const gchar* baseURI) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + g_return_if_fail(content); + g_return_if_fail(contentURI); + + WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(content)); + WKRetainPtr<WKURLRef> contentURL(AdoptWK, WKURLCreateWithUTF8CString(contentURI)); + WKRetainPtr<WKURLRef> baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0; + WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); + WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), contentURL.get()); + webkitWebViewUpdateURI(webView); +} + +/** * webkit_web_view_load_plain_text: * @web_view: a #WebKitWebView * @plain_text: The plain text to load @@ -1637,36 +1609,6 @@ void webkit_web_view_load_request(WebKitWebView* webView, WebKitURIRequest* requ } /** - * webkit_web_view_replace_content: - * @web_view: a #WebKitWebView - * @content: the new content to display as the main page of the @web_view - * @content_uri: the URI for the page content - * @base_uri: (allow-none): the base URI for relative locations or %NULL - * - * Replace the content of @web_view with @content using @content_uri as page URI. - * This allows clients to display page-loading errors in the #WebKitWebView itself. - * This is typically called from #WebKitWebView::load-failed signal. The URI passed in - * @base_uri has to be an absolute URI. The mime type of the document will be "text/html". - * Signals #WebKitWebView::load-changed and #WebKitWebView::load-failed are not emitted - * when replacing content of a #WebKitWebView using this method. - */ -void webkit_web_view_replace_content(WebKitWebView* webView, const gchar* content, const gchar* contentURI, const gchar* baseURI) -{ - g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - g_return_if_fail(content); - g_return_if_fail(contentURI); - - webView->priv->replaceContentStatus = WillReplaceContent; - - WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(content)); - WKRetainPtr<WKURLRef> contentURL(AdoptWK, WKURLCreateWithUTF8CString(contentURI)); - WKRetainPtr<WKURLRef> baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0; - WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); - WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), contentURL.get()); - webkitWebViewUpdateURI(webView); -} - -/** * webkit_web_view_get_title: * @web_view: a #WebKitWebView * @@ -1815,6 +1757,10 @@ gboolean webkit_web_view_can_go_forward(WebKitWebView* webView) * the requested URI is "about:blank". * </para></listitem> * <listitem><para> + * If the load operation was started by webkit_web_view_load_alternate_html(), + * the requested URI is content URI provided. + * </para></listitem> + * <listitem><para> * If the load operation was started by webkit_web_view_go_back() or * webkit_web_view_go_forward(), the requested URI is the original URI * of the previous/next item in the #WebKitBackForwardList of @web_view. @@ -1838,10 +1784,6 @@ gboolean webkit_web_view_can_go_forward(WebKitWebView* webView) * one and it will not change unless a new load operation is started * or a navigation action within the same page is performed. * </para></listitem> - * <listitem><para> - * When the page content is replaced using webkit_web_view_replace_content(), - * the active URI is the content_uri provided. - * </para></listitem> * </orderedlist> * * You can monitor the active URI by connecting to the notify::uri diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 6ebd17f04..540014ac4 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -162,7 +162,7 @@ struct _WebKitWebViewClass { void (* mouse_target_changed) (WebKitWebView *web_view, WebKitHitTestResult *hit_test_result, guint modifiers); - gboolean (* print_requested) (WebKitWebView *web_view, + gboolean (* print) (WebKitWebView *web_view, WebKitPrintOperation *print_operation); void (* resource_load_started) (WebKitWebView *web_view, WebKitWebResource *resource, @@ -210,7 +210,11 @@ WEBKIT_API void webkit_web_view_load_html (WebKitWebView *web_view, const gchar *content, const gchar *base_uri); - +WEBKIT_API void +webkit_web_view_load_alternate_html (WebKitWebView *web_view, + const gchar *content, + const gchar *content_uri, + const gchar *base_uri); WEBKIT_API void webkit_web_view_load_plain_text (WebKitWebView *web_view, const gchar *plain_text); @@ -222,12 +226,6 @@ webkit_web_view_load_request (WebKitWebView *w WEBKIT_API void webkit_web_view_stop_loading (WebKitWebView *web_view); -WEBKIT_API void -webkit_web_view_replace_content (WebKitWebView *web_view, - const gchar *content, - const gchar *content_uri, - const gchar *base_uri); - WEBKIT_API const gchar * webkit_web_view_get_title (WebKitWebView *web_view); diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 92da1ebe5..596498c83 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -37,6 +37,7 @@ webkit_web_context_get_spell_checking_enabled webkit_web_context_set_spell_checking_enabled webkit_web_context_get_spell_checking_languages webkit_web_context_set_spell_checking_languages +webkit_web_context_set_preferred_languages <SUBSECTION URI Scheme> WebKitURISchemeRequestCallback @@ -75,9 +76,9 @@ webkit_web_view_new_with_context webkit_web_view_get_context webkit_web_view_load_uri webkit_web_view_load_html +webkit_web_view_load_alternate_html webkit_web_view_load_plain_text webkit_web_view_load_request -webkit_web_view_replace_content webkit_web_view_can_go_back webkit_web_view_go_back webkit_web_view_can_go_forward @@ -325,6 +326,7 @@ webkit_uri_response_get_status_code webkit_uri_response_get_content_length webkit_uri_response_get_mime_type webkit_uri_response_get_https_status +webkit_uri_response_get_suggested_filename <SUBSECTION Standard> WebKitURIResponseClass diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp index 876685712..eff59862b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp @@ -74,6 +74,24 @@ public: quitMainLoop(); } + GtkMenu* getPopupMenu() + { + GOwnPtr<GList> toplevels(gtk_window_list_toplevels()); + for (GList* iter = toplevels.get(); iter; iter = g_list_next(iter)) { + if (!GTK_IS_WINDOW(iter->data)) + continue; + + GtkWidget* child = gtk_bin_get_child(GTK_BIN(iter->data)); + if (!GTK_IS_MENU(child)) + continue; + + if (gtk_menu_get_attach_widget(GTK_MENU(child)) == GTK_WIDGET(m_webView)) + return GTK_MENU(child); + } + g_assert_not_reached(); + return 0; + } + bool shouldShowInputMethodsMenu() { GtkSettings* settings = gtk_widget_get_settings(GTK_WIDGET(m_webView)); @@ -391,24 +409,6 @@ public: return false; } - GtkMenu* getPopupMenu() - { - GOwnPtr<GList> toplevels(gtk_window_list_toplevels()); - for (GList* iter = toplevels.get(); iter; iter = g_list_next(iter)) { - if (!GTK_IS_WINDOW(iter->data)) - continue; - - GtkWidget* child = gtk_bin_get_child(GTK_BIN(iter->data)); - if (!GTK_IS_MENU(child)) - continue; - - if (gtk_menu_get_attach_widget(GTK_MENU(child)) == GTK_WIDGET(m_webView)) - return GTK_MENU(child); - } - g_assert_not_reached(); - return 0; - } - GtkMenuItem* getMenuItem(GtkMenu* menu, const gchar* itemLabel) { GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu))); @@ -721,6 +721,115 @@ static void testContextMenuDismissed(ContextMenuDismissedTest* test, gconstpoint g_assert(test->m_dismissed); } +class ContextMenuSmartSeparatorsTest: public ContextMenuTest { +public: + MAKE_GLIB_TEST_FIXTURE(ContextMenuSmartSeparatorsTest); + + bool contextMenu(WebKitContextMenu* contextMenu, GdkEvent*, WebKitHitTestResult*) + { + webkit_context_menu_remove_all(contextMenu); + + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_GO_BACK)); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD)); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_COPY)); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT)); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); + + quitMainLoop(); + + return false; + } + + GtkMenu* showContextMenuAndGetGtkMenu() + { + showContextMenuAndWaitUntilFinished(); + return getPopupMenu(); + } +}; + +static void testContextMenuSmartSeparators(ContextMenuSmartSeparatorsTest* test, gconstpointer) +{ + test->showInWindowAndWaitUntilMapped(); + + test->loadHtml("<html><body>WebKitGTK+ Context menu tests</body></html>", "file:///"); + test->waitUntilLoadFinished(); + + GtkMenu* menu = test->showContextMenuAndGetGtkMenu(); + g_assert(menu); + + // Leading and trailing separators are not added to the context menu. + GOwnPtr<GList> menuItems(gtk_container_get_children(GTK_CONTAINER(menu))); + g_assert_cmpuint(g_list_length(menuItems.get()), ==, 6); + GtkWidget* item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + + // Hiding a menu item between two separators hides the following separator. + GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(g_list_nth_data(menuItems.get(), 3))); + gtk_action_set_visible(action, FALSE); + menuItems.set(gtk_container_get_children(GTK_CONTAINER(menu))); + g_assert_cmpuint(g_list_length(menuItems.get()), ==, 6); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + gtk_action_set_visible(action, TRUE); + + // Showing an action between two separators shows the hidden separator. + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + + // Trailing separators are hidden too. + action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(g_list_nth_data(menuItems.get(), 5))); + gtk_action_set_visible(action, FALSE); + menuItems.set(gtk_container_get_children(GTK_CONTAINER(menu))); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 0)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 1)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 2)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 3)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 4)); + g_assert(GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item)); + item = GTK_WIDGET(g_list_nth_data(menuItems.get(), 5)); + g_assert(!GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_widget_get_visible(item)); +} + void beforeAll() { ContextMenuDefaultTest::add("WebKitWebView", "default-menu", testContextMenuDefaultMenu); @@ -729,6 +838,7 @@ void beforeAll() ContextMenuDisabledTest::add("WebKitWebView", "disable-menu", testContextMenuDisableMenu); ContextMenuSubmenuTest::add("WebKitWebView", "submenu", testContextMenuSubMenu); ContextMenuDismissedTest::add("WebKitWebView", "menu-dismissed", testContextMenuDismissed); + ContextMenuSmartSeparatorsTest::add("WebKitWebView", "smart-separators", testContextMenuSmartSeparators); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp index 59eed7658..dabf072e3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp @@ -70,6 +70,13 @@ static void testLoadHtml(LoadTrackingTest* test, gconstpointer) assertNormalLoadHappened(test->m_loadEvents); } +static void testLoadAlternateHTML(LoadTrackingTest* test, gconstpointer) +{ + test->loadAlternateHTML("<html><body>Alternate page</body></html>", "http://error-page.foo/", 0); + test->waitUntilLoadFinished(); + assertNormalLoadHappened(test->m_loadEvents); +} + static void testLoadPlainText(LoadTrackingTest* test, gconstpointer) { test->loadPlainText("Hello WebKit-GTK+"); @@ -262,6 +269,7 @@ void beforeAll() LoadTrackingTest::add("WebKitWebView", "loading-status", testLoadingStatus); LoadTrackingTest::add("WebKitWebView", "loading-error", testLoadingError); LoadTrackingTest::add("WebKitWebView", "load-html", testLoadHtml); + LoadTrackingTest::add("WebKitWebView", "load-alternate-html", testLoadAlternateHTML); LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText); LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest); LoadStopTrackingTest::add("WebKitWebView", "stop-loading", testLoadCancelled); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp index 150c31bd3..123831f76 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestPrinting.cpp @@ -49,7 +49,7 @@ static void testPrintOperationPrintSettings(WebViewTest* test, gconstpointer) g_assert(webkit_print_operation_get_page_setup(printOperation.get()) == pageSetup.get()); } -static gboolean webViewPrintRequestedCallback(WebKitWebView* webView, WebKitPrintOperation* printOperation, WebViewTest* test) +static gboolean webViewPrintCallback(WebKitWebView* webView, WebKitPrintOperation* printOperation, WebViewTest* test) { g_assert(webView == test->m_webView); @@ -64,9 +64,9 @@ static gboolean webViewPrintRequestedCallback(WebKitWebView* webView, WebKitPrin return TRUE; } -static void testWebViewPrintRequested(WebViewTest* test, gconstpointer) +static void testWebViewPrint(WebViewTest* test, gconstpointer) { - g_signal_connect(test->m_webView, "print-requested", G_CALLBACK(webViewPrintRequestedCallback), test); + g_signal_connect(test->m_webView, "print", G_CALLBACK(webViewPrintCallback), test); test->loadHtml("<html><body onLoad=\"print();\">WebKitGTK+ printing test</body></html>", 0); g_main_loop_run(test->m_mainLoop); } @@ -196,7 +196,7 @@ void beforeAll() g_assert(kTempDirectory); WebViewTest::add("WebKitPrintOperation", "printing-settings", testPrintOperationPrintSettings); - WebViewTest::add("WebKitWebView", "print-requested", testWebViewPrintRequested); + WebViewTest::add("WebKitWebView", "print", testWebViewPrint); #ifdef HAVE_GTK_UNIX_PRINTING PrintTest::add("WebKitPrintOperation", "print", testPrintOperationPrint); PrintTest::add("WebKitPrintOperation", "print-errors", testPrintOperationErrors); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index dc7a518dd..7e2e5de61 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -397,6 +397,17 @@ static void testWebResourceMimeType(SingleResourceLoadTest* test, gconstpointer) g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/css"); } +static void testWebResourceSuggestedFilename(SingleResourceLoadTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/javascript.html").data()); + WebKitURIResponse* response = test->waitUntilResourceLoadFinishedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_suggested_filename(response), ==, "JavaScript.js"); + + test->loadURI(kServer->getURIForPath("/image.html").data()); + response = test->waitUntilResourceLoadFinishedAndReturnURIResponse(); + g_assert(!webkit_uri_response_get_suggested_filename(response)); +} + class ResourceURITrackingTest: public SingleResourceLoadTest { public: MAKE_GLIB_TEST_FIXTURE(ResourceURITrackingTest); @@ -494,32 +505,6 @@ static void testWebResourceGetData(ResourcesTest* test, gconstpointer) test->checkResourceData(WEBKIT_WEB_RESOURCE(item->data)); } -static void replacedContentResourceLoadStartedCallback() -{ - g_assert_not_reached(); -} - -static void testWebViewResourcesReplacedContent(ResourcesTest* test, gconstpointer) -{ - test->loadURI(kServer->getURIForPath("/").data()); - // FIXME: this should be 4 instead of 3, but we don't get the css image resource - // due to bug https://bugs.webkit.org/show_bug.cgi?id=78510. - test->waitUntilResourcesLoaded(3); - - static const char* replacedHtml = - "<html><head>" - " <title>Content Replaced</title>" - " <link rel='stylesheet' href='data:text/css,body { margin: 0px; padding: 0px; }' type='text/css'>" - " <script language='javascript' src='data:application/javascript,function foo () { var a = 1; }'></script>" - "</head><body onload='document.title=\"Loaded\"'>WebKitGTK+ resources on replaced content test</body></html>"; - g_signal_connect(test->m_webView, "resource-load-started", G_CALLBACK(replacedContentResourceLoadStartedCallback), test); - test->replaceContent(replacedHtml, "http://error-page.foo", 0); - test->waitUntilTitleChangedTo("Loaded"); - - g_assert(!webkit_web_view_get_main_resource(test->m_webView)); - g_assert(!webkit_web_view_get_subresources(test->m_webView)); -} - static void testWebViewResourcesHistoryCache(SingleResourceLoadTest* test, gconstpointer) { test->loadURI(kServer->getURIForPath("/").data()); @@ -588,6 +573,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* } else if (g_str_equal(path, "/javascript.js")) { soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kJavascript, strlen(kJavascript)); soup_message_headers_append(message->response_headers, "Content-Type", "text/javascript"); + soup_message_headers_append(message->response_headers, "Content-Disposition", "filename=JavaScript.js"); } else if (g_str_equal(path, "/blank.ico")) { GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL)); char* contents; @@ -620,9 +606,9 @@ void beforeAll() SingleResourceLoadTest::add("WebKitWebResource", "loading", testWebResourceLoading); SingleResourceLoadTest::add("WebKitWebResource", "response", testWebResourceResponse); SingleResourceLoadTest::add("WebKitWebResource", "mime-type", testWebResourceMimeType); + SingleResourceLoadTest::add("WebKitWebResource", "suggested-filename", testWebResourceSuggestedFilename); ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI); ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); - ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent); SingleResourceLoadTest::add("WebKitWebView", "history-cache", testWebViewResourcesHistoryCache); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp index a185db8a7..a2af7bd8d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp @@ -165,14 +165,14 @@ static void testFindControllerNext(FindControllerTest* test, gconstpointer) test->waitUntilFindFinished(); g_assert(test->m_textFound); - g_assert(test->m_matchCount == 2); + g_assert(test->m_matchCount == 1); g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS)); webkit_find_controller_search_next(test->m_findController.get()); test->waitUntilFindFinished(); g_assert(!test->m_textFound); - g_assert(test->m_matchCount == 2); + g_assert(test->m_matchCount == 1); g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS)); } @@ -191,14 +191,14 @@ static void testFindControllerPrevious(FindControllerTest* test, gconstpointer) test->waitUntilFindFinished(); g_assert(test->m_textFound); - g_assert(test->m_matchCount == 2); + g_assert(test->m_matchCount == 1); g_assert(!(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS)); webkit_find_controller_search_previous(test->m_findController.get()); test->waitUntilFindFinished(); g_assert(test->m_textFound); - g_assert(test->m_matchCount == 2); + g_assert(test->m_matchCount == 1); g_assert(webkit_find_controller_get_options(test->m_findController.get()) & WEBKIT_FIND_OPTIONS_BACKWARDS); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp index 1b172dfee..cde0bc34a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "LoadTrackingTest.h" +#include "WebKitTestServer.h" #include <gtk/gtk.h> #include <webkit2/webkit2.h> #include <wtf/HashMap.h> @@ -27,6 +28,8 @@ #include <wtf/gobject/GRefPtr.h> #include <wtf/text/StringHash.h> +static WebKitTestServer* kServer; + static void testWebContextDefault(Test* test, gconstpointer) { // Check there's a single instance of the default web context. @@ -165,35 +168,6 @@ public: webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this); } - static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData) - { - size_t dataSize; - GOwnPtr<GError> error; - unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr()); - g_assert(data); - - URISchemeTest* test = static_cast<URISchemeTest*>(userData); - test->m_resourceData.set(reinterpret_cast<char*>(data)); - test->m_resourceDataSize = dataSize; - g_main_loop_quit(test->m_mainLoop); - } - - const char* mainResourceData(size_t& mainResourceDataSize) - { - m_resourceDataSize = 0; - m_resourceData.clear(); - WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView); - g_assert(resource); - - webkit_web_resource_get_data(resource, 0, resourceGetDataCallback, this); - g_main_loop_run(m_mainLoop); - - mainResourceDataSize = m_resourceDataSize; - return m_resourceData.get(); - } - - GOwnPtr<char> m_resourceData; - size_t m_resourceDataSize; GRefPtr<WebKitURISchemeRequest> m_uriSchemeRequest; HashMap<String, URISchemeHandler> m_handlersMap; }; @@ -266,14 +240,57 @@ static void testWebContextSpellChecker(Test* test, gconstpointer) g_assert(webkit_web_context_get_spell_checking_enabled(webContext)); } +static void testWebContextLanguages(WebViewTest* test, gconstpointer) +{ + static const char* expectedDefaultLanguage = "en"; + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + size_t mainResourceDataSize = 0; + const char* mainResourceData = test->mainResourceData(mainResourceDataSize); + g_assert_cmpuint(mainResourceDataSize, ==, strlen(expectedDefaultLanguage)); + g_assert(!strncmp(mainResourceData, expectedDefaultLanguage, mainResourceDataSize)); + + GList* languages = g_list_prepend(0, const_cast<gpointer>(static_cast<const void*>("dE"))); + languages = g_list_prepend(languages, const_cast<gpointer>(static_cast<const void*>("ES_es"))); + languages = g_list_prepend(languages, const_cast<gpointer>(static_cast<const void*>("en"))); + webkit_web_context_set_preferred_languages(webkit_web_context_get_default(), languages); + g_list_free(languages); + + static const char* expectedLanguages = "en, es-es;q=0.90, de;q=0.80"; + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + mainResourceDataSize = 0; + mainResourceData = test->mainResourceData(mainResourceDataSize); + g_assert_cmpuint(mainResourceDataSize, ==, strlen(expectedLanguages)); + g_assert(!strncmp(mainResourceData, expectedLanguages, mainResourceDataSize)); +} + +static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + const char* acceptLanguage = soup_message_headers_get_one(message->request_headers, "Accept-Language"); + soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, acceptLanguage, strlen(acceptLanguage)); + soup_message_body_complete(message->response_body); +} + void beforeAll() { + kServer = new WebKitTestServer(); + kServer->run(serverCallback); + Test::add("WebKitWebContext", "default-context", testWebContextDefault); PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins); URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme); Test::add("WebKitWebContext", "spell-checker", testWebContextSpellChecker); + WebViewTest::add("WebKitWebContext", "languages", testWebContextLanguages); } void afterAll() { + delete kServer; } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index 22796bf73..cc67c5d63 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -74,24 +74,6 @@ static void testWebViewSettings(WebViewTest* test, gconstpointer) g_assert(webkit_settings_get_enable_javascript(settings)); } -static void replaceContentLoadCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) -{ - // There might be an event from a previous load, - // but never a WEBKIT_LOAD_STARTED after webkit_web_view_replace_content(). - g_assert_cmpint(loadEvent, !=, WEBKIT_LOAD_STARTED); -} - -static void testWebViewReplaceContent(WebViewTest* test, gconstpointer) -{ - test->loadHtml("<html><head><title>Replace Content Test</title></head><body>Content to replace</body></html>", 0); - test->waitUntilTitleChangedTo("Replace Content Test"); - - g_signal_connect(test->m_webView, "load-changed", G_CALLBACK(replaceContentLoadCallback), test); - test->replaceContent("<html><body onload='document.title=\"Content Replaced\"'>New Content</body></html>", - "http://foo.com/bar", 0); - test->waitUntilTitleChangedTo("Content Replaced"); -} - static const char* kAlertDialogMessage = "WebKitGTK+ alert dialog message"; static const char* kConfirmDialogMessage = "WebKitGTK+ confirm dialog message"; static const char* kPromptDialogMessage = "WebKitGTK+ prompt dialog message"; @@ -1048,7 +1030,6 @@ void beforeAll() WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext); WebViewTest::add("WebKitWebView", "custom-charset", testWebViewCustomCharset); WebViewTest::add("WebKitWebView", "settings", testWebViewSettings); - WebViewTest::add("WebKitWebView", "replace-content", testWebViewReplaceContent); UIClientTest::add("WebKitWebView", "create-ready-close", testWebViewCreateReadyClose); ModalDialogsTest::add("WebKitWebView", "allow-modal-dialogs", testWebViewAllowModalDialogs); ModalDialogsTest::add("WebKitWebView", "disallow-modal-dialogs", testWebViewDisallowModalDialogs); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp index 321b6a37a..a8d20f88c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp @@ -29,6 +29,7 @@ WebViewTest::WebViewTest() , m_mainLoop(g_main_loop_new(0, TRUE)) , m_parentWindow(0) , m_javascriptResult(0) + , m_resourceDataSize(0) { assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_webView)); } @@ -70,10 +71,10 @@ void WebViewTest::loadRequest(WebKitURIRequest* request) webkit_web_view_load_request(m_webView, request); } -void WebViewTest::replaceContent(const char* html, const char* contentURI, const char* baseURI) +void WebViewTest::loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI) { m_activeURI = contentURI; - webkit_web_view_replace_content(m_webView, html, contentURI, baseURI); + webkit_web_view_load_alternate_html(m_webView, html, contentURI, baseURI); } void WebViewTest::goBack() @@ -197,6 +198,33 @@ void WebViewTest::resizeView(int width, int height) gtk_widget_size_allocate(GTK_WIDGET(m_webView), &allocation); } +static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData) +{ + size_t dataSize; + GOwnPtr<GError> error; + unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr()); + g_assert(data); + + WebViewTest* test = static_cast<WebViewTest*>(userData); + test->m_resourceData.set(reinterpret_cast<char*>(data)); + test->m_resourceDataSize = dataSize; + g_main_loop_quit(test->m_mainLoop); +} + +const char* WebViewTest::mainResourceData(size_t& mainResourceDataSize) +{ + m_resourceDataSize = 0; + m_resourceData.clear(); + WebKitWebResource* resource = webkit_web_view_get_main_resource(m_webView); + g_assert(resource); + + webkit_web_resource_get_data(resource, 0, resourceGetDataCallback, this); + g_main_loop_run(m_mainLoop); + + mainResourceDataSize = m_resourceDataSize; + return m_resourceData.get(); +} + void WebViewTest::mouseMoveTo(int x, int y, unsigned int mouseModifiers) { g_assert(m_parentWindow); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h index 8e469f142..25209caa3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h @@ -35,7 +35,7 @@ public: virtual void loadHtml(const char* html, const char* baseURI); virtual void loadPlainText(const char* plainText); virtual void loadRequest(WebKitURIRequest*); - void replaceContent(const char* html, const char* contentURI, const char* baseURI); + void loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI); void goBack(); void goForward(); void goToBackForwardListItem(WebKitBackForwardListItem*); @@ -48,6 +48,7 @@ public: void waitUntilTitleChanged(); void showInWindowAndWaitUntilMapped(GtkWindowType = GTK_WINDOW_POPUP); void resizeView(int width, int height); + const char* mainResourceData(size_t& mainResourceDataSize); void mouseMoveTo(int x, int y, unsigned int mouseModifiers = 0); void clickMouseButton(int x, int y, unsigned int button = 1, unsigned int mouseModifiers = 0); @@ -69,6 +70,8 @@ public: CString m_expectedTitle; WebKitJavascriptResult* m_javascriptResult; GError** m_javascriptError; + GOwnPtr<char> m_resourceData; + size_t m_resourceDataSize; private: void doMouseButtonEvent(GdkEventType, int, int, unsigned int, unsigned int); diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index a11ef65d0..eb6b819c5 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -1895,8 +1895,17 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl NSWindow *currentWindow = [self window]; if (window == currentWindow) return; - - _data->_pageClient->viewWillMoveToAnotherWindow(); + +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 + // Avoid calling the code added in 121482 that ensures that the undo stack is cleaned up + // before the WKView is moved from one window to another when the WKView is being moved + // out of a popover window. This avoids a bug in OS X 10.7 that was fixed in 10.8. + // While this technically reopens a potentially crashing code path that 121482 closed, + // it only reopens it for WKViews that are used for text editing and that are removed + // from an NSPopover at some time earlier than tear-down of the NSPopover. + if (![currentWindow isKindOfClass:NSClassFromString(@"_NSPopoverWindow")]) +#endif + _data->_pageClient->viewWillMoveToAnotherWindow(); [self removeWindowObservers]; [self addWindowObserversForWindow:window]; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index 7911f167c..db51b85dd 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -55,7 +55,6 @@ QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* view , viewportItem(viewportItem) , webPageProxy(0) , paintingIsInitialized(false) - , m_paintNode(0) , contentsScale(1) { } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h index ba0e42eda..ad1c6ad3f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h @@ -47,7 +47,6 @@ public: QQuickWebView* const viewportItem; WebKit::WebPageProxy* webPageProxy; bool paintingIsInitialized; - QSGNode* m_paintNode; QSizeF contentsSize; qreal contentsScale; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 6ca413f66..921586d1b 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -33,8 +33,10 @@ #include "QtWebPageLoadClient.h" #include "QtWebPagePolicyClient.h" #include "WebBackForwardList.h" +#if ENABLE(INSPECTOR_SERVER) #include "WebInspectorProxy.h" #include "WebInspectorServer.h" +#endif #if ENABLE(FULLSCREEN_API) #include "WebFullScreenManagerProxy.h" #endif @@ -1331,7 +1333,11 @@ void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts) QUrl QQuickWebViewExperimental::remoteInspectorUrl() const { +#if ENABLE(INSPECTOR_SERVER) return QUrl(WebInspectorServer::shared().inspectorUrlForPageID(d_ptr->webPageProxy->inspector()->remoteInspectionPageID())); +#else + return QUrl(); +#endif } QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index) diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h index c0d3e1187..3754f169a 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h @@ -47,13 +47,13 @@ class QWEBKIT_EXPORT QWebKitTest : public QObject { Q_PROPERTY(QVariant minimumScale READ minimumScale NOTIFY viewportChanged) Q_PROPERTY(QVariant layoutSize READ layoutSize NOTIFY viewportChanged) -signals: +Q_SIGNALS: void contentsSizeChanged(); void contentsScaleChanged(); void contentsScaleCommitted(); void viewportChanged(); -public slots: +public Q_SLOTS: bool touchTap(QObject* item, qreal x, qreal y, int delay = -1); bool touchDoubleTap(QObject* item, qreal x, qreal y, int delay = -1); bool wheelEvent(QObject* item, qreal x, qreal y, int delta, Qt::Orientation orient = Qt::Vertical); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html b/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html index f3ca937d2..dc9140f9d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html +++ b/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html @@ -5,5 +5,7 @@ <body> <h1>Basic page</h1> <input id="inputField" /> +<input id="emailInputField" type="email" /> +<div id="editableDiv" contenteditable></div> </body> </html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp index 3d2a95a6c..2ad673a4b 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp @@ -38,7 +38,7 @@ class tst_InspectorServer : public QObject { public: tst_InspectorServer(); -private slots: +private Q_SLOTS: void init(); void cleanup(); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp index 12e0ab903..d0ea1beb8 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp @@ -31,7 +31,7 @@ class tst_publicapi : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void publicAPI(); }; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro index 11733ce48..3fd3d4583 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -6,7 +6,6 @@ OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() QT += webkit-private CONFIG += warn_on testcase -QT -= testlib QT += qmltest DEFINES += DISABLE_FLICKABLE_VIEWPORT=1 diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index fd940d43d..b340235e4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -6,7 +6,6 @@ OBJECTS_DIR = obj_WebView/$$activeBuildConfig() QT += webkit-private CONFIG += warn_on testcase -QT -= testlib QT += qmltest # Test the QML files under WebView in the source repository. diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp index d347e158a..5b98ae7b7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp @@ -31,7 +31,7 @@ class tst_QQuickWebView : public QObject { public: tst_QQuickWebView(); -private slots: +private Q_SLOTS: void init(); void cleanup(); @@ -58,6 +58,7 @@ private slots: void transparentWebViews(); void inputMethod(); + void inputMethodHints(); void basicRenderingSanity(); private: @@ -410,6 +411,33 @@ void tst_QQuickWebView::inputMethod() QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); } +void tst_QQuickWebView::inputMethodHints() +{ + QQuickWebView* view = webView(); + + view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/inputmethod.html"))); + QVERIFY(waitForLoadSucceeded(view)); + + // Setting focus on an input element results in an element in its shadow tree becoming the focus node. + // Input hints should not be set from this shadow tree node but from the input element itself. + runJavaScript("document.getElementById('emailInputField').focus();"); + QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); + QInputMethodQueryEvent query(Qt::ImHints); + QGuiApplication::sendEvent(view, &query); + Qt::InputMethodHints hints(query.value(Qt::ImHints).toUInt() & Qt::ImhExclusiveInputMask); + QCOMPARE(hints, Qt::ImhEmailCharactersOnly); + + // The focus of an editable DIV is given directly to it, so no shadow root element + // is necessary. This tests the WebPage::editorState() method ability to get the + // right element without breaking. + runJavaScript("document.getElementById('editableDiv').focus();"); + QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); + query = QInputMethodQueryEvent(Qt::ImHints); + QGuiApplication::sendEvent(view, &query); + hints = Qt::InputMethodHints(query.value(Qt::ImHints).toUInt()); + QCOMPARE(hints, Qt::ImhNone); +} + void tst_QQuickWebView::scrollRequest() { webView()->setSize(QSizeF(300, 400)); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp index b322bacd4..93d669cee 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp @@ -123,7 +123,7 @@ public: static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded(); } -signals: +Q_SIGNALS: void loaded(); private: @@ -154,7 +154,7 @@ public: , m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString()) { } -private slots: +private Q_SLOTS: void paint() { run(&tst_qrawwebview::doPaint, m_resourceDir + "/qwkview_paint.png"); } void noBackground1() { run(&tst_qrawwebview::doNoBackground1, m_resourceDir + "/qwkview_noBackground1.png"); } void noBackground2() { run(&tst_qrawwebview::doNoBackground2, m_resourceDir + "/qwkview_noBackground1.png"); } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp index cdd1f9961..6c91de717 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp @@ -65,10 +65,10 @@ public: { connect(webView, SIGNAL(loadingChanged(QWebLoadRequest*)), SLOT(onLoadingChanged(QWebLoadRequest*))); } -signals: +Q_SIGNALS: void loadSucceeded(); void loadFailed(); -private slots: +private Q_SLOTS: void onLoadingChanged(QWebLoadRequest* loadRequest) { if (loadRequest->status() == QQuickWebView::LoadSucceededStatus) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/Source/WebKit2/UIProcess/API/qt/tests/util.h index 907ddb05f..ebb162cc4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.h +++ b/Source/WebKit2/UIProcess/API/qt/tests/util.h @@ -40,9 +40,9 @@ class LoadStartedCatcher : public QObject { Q_OBJECT public: LoadStartedCatcher(QQuickWebView* webView); -public slots: +public Q_SLOTS: void onLoadingChanged(QWebLoadRequest* loadRequest); -signals: +Q_SIGNALS: void finished(); private: QQuickWebView* m_webView; diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp index ef972f3e3..6b0de7f25 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp @@ -174,9 +174,9 @@ void LayerTreeCoordinatorProxy::didChangeScrollPosition(const IntPoint& position dispatchUpdate(bind(&LayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position)); } -void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, uint32_t graphicsSurfaceToken) +void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) { - dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, graphicsSurfaceToken)); + dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, canvasSize, graphicsSurfaceToken, frontBuffer)); } void LayerTreeCoordinatorProxy::purgeBackingStores() diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h index f603cd0fc..ed71dfe94 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h @@ -73,7 +73,7 @@ public: void updateViewport(); void renderNextFrame(); void didChangeScrollPosition(const WebCore::IntPoint& position); - void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken); + void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer); void purgeBackingStores(); LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); } void setLayerAnimatedOpacity(uint32_t, float); diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in index d2438f1f1..23869233c 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in @@ -33,7 +33,7 @@ messages -> LayerTreeCoordinatorProxy { DestroyDirectlyCompositedImage(int64_t key) DidRenderFrame() DidChangeScrollPosition(WebCore::IntPoint position) - SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint32_t graphicsSurfaceToken) + SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) SetLayerAnimatedOpacity(uint32_t id, float opacity) SetLayerAnimatedTransform(uint32_t id, WebCore::TransformationMatrix transform) } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index ed0be3c29..481b9f74b 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -191,7 +191,7 @@ void LayerTreeRenderer::didChangeScrollPosition(const IntPoint& position) m_pendingRenderedContentsScrollPosition = position; } -void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken) +void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) { if (canvasSize.isEmpty() || !m_textureMapper) return; @@ -208,7 +208,7 @@ void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvas } else canvasBackingStore = it->second; - canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize); + canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize, frontBuffer); layer->setContentsToMedia(canvasBackingStore.get()); #endif } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 6403b5d2d..5706a4ccd 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -68,7 +68,7 @@ public: void setContentsSize(const WebCore::FloatSize&); void setVisibleContentsRect(const WebCore::FloatRect&); void didChangeScrollPosition(const WebCore::IntPoint& position); - void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken); + void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer); void detach(); void appendUpdate(const Function<void()>&); diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp index 26a521f39..2ba13e03c 100644 --- a/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp +++ b/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp @@ -98,7 +98,8 @@ void DownloadProxy::didReceiveAuthenticationChallenge(const AuthenticationChalle if (!m_webContext) return; - RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->process()); + // FIXME (Multi-WebProcess): Get rid of deprecatedSharedProcess. + RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess()); m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext, this, authenticationChallengeProxy.get()); } diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h index d565977d9..4b49767c3 100644 --- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h +++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebSocketServerQt.h @@ -41,7 +41,7 @@ public: bool listen(const String& bindAddress, unsigned short port); void close(); -private slots: +private Q_SLOTS: void handleNewConnection(); private: diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index c80aad42b..e024f175e 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -62,10 +62,6 @@ #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> -#if PLATFORM(MAC) -#include "BuiltInPDFView.h" -#endif - #if ENABLE(BATTERY_STATUS) #include "WebBatteryManagerProxy.h" #endif @@ -86,8 +82,6 @@ #include <wtf/RefCountedLeakCounter.h> #endif -#define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection()) - using namespace WebCore; namespace WebKit { @@ -153,7 +147,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa , m_initialHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyAlways) #endif , m_processTerminationEnabled(true) - , m_pluginWorkQueue("com.apple.CoreIPC.PluginQueue") { #if !LOG_DISABLED WebKit::initializeLogChannelsIfNecessary(); @@ -174,11 +167,6 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa WebContext::~WebContext() { - m_pluginWorkQueue.invalidate(); - - if (m_process && m_process->isValid()) - m_process->connection()->removeQueueClient(this); - ASSERT(contexts().find(this) != notFound); contexts().remove(contexts().find(this)); @@ -266,7 +254,15 @@ void WebContext::initializeDownloadClient(const WKContextDownloadClient* client) { m_downloadClient.initialize(client); } - + +WebProcessProxy* WebContext::deprecatedSharedProcess() +{ + ASSERT(m_processModel == ProcessModelSharedSecondaryProcess); + if (m_processes.isEmpty()) + return 0; + return m_processes[0].get(); +} + void WebContext::languageChanged(void* context) { static_cast<WebContext*>(context)->languageChanged(); @@ -282,12 +278,20 @@ void WebContext::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled) sendToAllProcesses(Messages::WebProcess::FullKeyboardAccessModeChanged(fullKeyboardAccessEnabled)); } -void WebContext::ensureWebProcess() +void WebContext::textCheckerStateChanged() { - if (m_process) - return; + sendToAllProcesses(Messages::WebProcess::SetTextCheckerState(TextChecker::state())); +} + +void WebContext::ensureSharedWebProcess() +{ + if (m_processes.isEmpty()) + m_processes.append(createNewWebProcess()); +} - m_process = WebProcessProxy::create(this); +PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess() +{ + RefPtr<WebProcessProxy> process = WebProcessProxy::create(this); WebProcessCreationParameters parameters; @@ -332,31 +336,37 @@ void WebContext::ensureWebProcess() RefPtr<APIObject> injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this); if (!injectedBundleInitializationUserData) injectedBundleInitializationUserData = m_injectedBundleInitializationUserData; - m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0); + process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0); for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) { pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i]; - m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get()))); + process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get()))); } + // FIXME (Multi-WebProcess): What does this mean in the brave new world? m_pendingMessagesToPostToInjectedBundle.clear(); + + return process.release(); } void WebContext::warmInitialProcess() { - ensureWebProcess(); + ASSERT(m_processes.isEmpty()); + m_processes.append(createNewWebProcess()); } void WebContext::enableProcessTermination() { m_processTerminationEnabled = true; - if (shouldTerminate(m_process.get())) - m_process->terminate(); + Vector<RefPtr<WebProcessProxy> > processes = m_processes; + for (size_t i = 0; i < processes.size(); ++i) { + if (shouldTerminate(processes[i].get())) + processes[i]->terminate(); + } } bool WebContext::shouldTerminate(WebProcessProxy* process) { - // FIXME: Once we support multiple processes per context, this assertion won't hold. - ASSERT(process == m_process); + ASSERT(m_processes.contains(process)); if (!m_processTerminationEnabled) return false; @@ -386,13 +396,10 @@ bool WebContext::shouldTerminate(WebProcessProxy* process) void WebContext::processDidFinishLaunching(WebProcessProxy* process) { - // FIXME: Once we support multiple processes per context, this assertion won't hold. - ASSERT_UNUSED(process, process == m_process); + ASSERT(m_processes.contains(process)); m_visitedLinkProvider.processDidFinishLaunching(); - m_process->connection()->addQueueClient(this); - // 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) { @@ -401,7 +408,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process) String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now)); sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle); - m_process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0); + process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0); } m_connectionClient.didCreateConnection(this, process->webConnection()); @@ -409,8 +416,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process) void WebContext::disconnectProcess(WebProcessProxy* process) { - // FIXME: Once we support multiple processes per context, this assertion won't hold. - ASSERT_UNUSED(process, process == m_process); + ASSERT(m_processes.contains(process)); m_visitedLinkProvider.processDidClose(); @@ -452,53 +458,74 @@ void WebContext::disconnectProcess(WebProcessProxy* process) #endif // This can cause the web context to be destroyed. - m_process = 0; + m_processes.remove(m_processes.find(process)); } PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient* pageClient, WebPageGroup* pageGroup) { - ensureWebProcess(); + RefPtr<WebProcessProxy> process; + if (m_processModel == ProcessModelSharedSecondaryProcess) { + ensureSharedWebProcess(); + process = m_processes[0]; + } else { + // FIXME (Multi-WebProcess): Add logic for sharing a process. + process = createNewWebProcess(); + m_processes.append(process); + } if (!pageGroup) pageGroup = m_defaultPageGroup.get(); - return m_process->createWebPage(pageClient, this, pageGroup); + return process->createWebPage(pageClient, this, pageGroup); } WebProcessProxy* WebContext::relaunchProcessIfNecessary() { - ensureWebProcess(); - - ASSERT(m_process); - return m_process.get(); + if (m_processModel == ProcessModelSharedSecondaryProcess) { + ensureSharedWebProcess(); + return m_processes[0].get(); + } else { + // FIXME (Multi-WebProcess): What should this do in this model? + return 0; + } } DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest& request) { - ensureWebProcess(); + if (m_processModel == ProcessModelSharedSecondaryProcess) { + ensureSharedWebProcess(); - DownloadProxy* download = createDownloadProxy(); - uint64_t initiatingPageID = initiatingPage ? initiatingPage->pageID() : 0; + DownloadProxy* download = createDownloadProxy(); + uint64_t initiatingPageID = initiatingPage ? initiatingPage->pageID() : 0; #if PLATFORM(QT) - ASSERT(initiatingPage); // Our design does not suppport downloads without a WebPage. - initiatingPage->handleDownloadRequest(download); + ASSERT(initiatingPage); // Our design does not suppport downloads without a WebPage. + initiatingPage->handleDownloadRequest(download); #endif - process()->send(Messages::WebProcess::DownloadRequest(download->downloadID(), initiatingPageID, request), 0); - return download; + m_processes[0]->send(Messages::WebProcess::DownloadRequest(download->downloadID(), initiatingPageID, request), 0); + return download; + + } else { + // FIXME: (Multi-WebProcess): Implement. + return 0; + } } void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { - if (!m_process || !m_process->canSendMessage()) { - m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); - return; - } + if (m_processModel == ProcessModelSharedSecondaryProcess) { + if (m_processes.isEmpty() || !m_processes[0]->canSendMessage()) { + m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); + return; + } - // FIXME: We should consider returning false from this function if the messageBody cannot - // be encoded. - m_process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); + // FIXME: We should consider returning false from this function if the messageBody cannot + // be encoded. + m_processes[0]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); + } else { + // FIXME (Multi-WebProcess): Implement. + } } // InjectedBundle client @@ -588,74 +615,6 @@ void WebContext::addVisitedLinkHash(LinkHash linkHash) m_visitedLinkProvider.addVisitedLink(linkHash); } -void WebContext::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos) -{ - ASSERT(isMainThread()); - - OwnPtr<Vector<PluginInfo> > plugins(pluginInfos); - -#if PLATFORM(MAC) - // Add built-in PDF last, so that it's not used when a real plug-in is installed. - // NOTE: This has to be done on the main thread as it calls localizedString(). - if (!omitPDFSupport()) - plugins->append(BuiltInPDFView::pluginInfo()); -#endif - - process()->send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0); -} - -void WebContext::handleGetPlugins(uint64_t requestID, bool refresh) -{ - if (refresh) - m_pluginInfoStore.refresh(); - - OwnPtr<Vector<PluginInfo> > pluginInfos = adoptPtr(new Vector<PluginInfo>); - - Vector<PluginModuleInfo> plugins = m_pluginInfoStore.plugins(); - for (size_t i = 0; i < plugins.size(); ++i) - pluginInfos->append(plugins[i].info); - - // NOTE: We have to pass the PluginInfo vector to the secondary thread via a pointer as otherwise - // we'd end up with a deref() race on all the WTF::Strings it contains. - RunLoop::main()->dispatch(bind(&WebContext::sendDidGetPlugins, this, requestID, pluginInfos.release())); -} - -void WebContext::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh) -{ - m_pluginWorkQueue.dispatch(bind(&WebContext::handleGetPlugins, this, requestID, refresh)); -} - -void WebContext::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked) -{ - MESSAGE_CHECK_URL(urlString); - - String newMimeType = mimeType.lower(); - - blocked = false; - PluginModuleInfo plugin = pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString)); - if (!plugin.path) - return; - - if (pluginInfoStore().shouldBlockPlugin(plugin)) { - blocked = true; - return; - } - - pluginPath = plugin.path; -} - -#if !ENABLE(PLUGIN_PROCESS) -void WebContext::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID) -{ - m_pluginSiteDataManager->didGetSitesWithData(sites, callbackID); -} - -void WebContext::didClearPluginSiteData(uint64_t callbackID) -{ - m_pluginSiteDataManager->didClearSiteData(callbackID); -} -#endif - DownloadProxy* WebContext::createDownloadProxy() { RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this); @@ -802,7 +761,7 @@ void WebContext::didReceiveSyncMessage(WebProcessProxy* process, CoreIPC::Messag downloadProxy->didReceiveSyncDownloadProxyMessage(process->connection(), messageID, arguments, reply); return; } - + if (messageID.is<CoreIPC::MessageClassWebIconDatabase>()) { m_iconDatabase->didReceiveSyncMessage(process->connection(), messageID, arguments, reply); return; @@ -921,14 +880,20 @@ bool WebContext::httpPipeliningEnabled() const void WebContext::getWebCoreStatistics(PassRefPtr<DictionaryCallback> callback) { - if (!m_process) { + if (m_processModel == ProcessModelSharedSecondaryProcess) { + if (m_processes.isEmpty()) { + callback->invalidate(); + return; + } + + uint64_t callbackID = callback->callbackID(); + m_dictionaryCallbacks.set(callbackID, callback.get()); + m_processes[0]->send(Messages::WebProcess::GetWebCoreStatistics(callbackID), 0); + + } else { + // FIXME (Multi-WebProcess): Implement. callback->invalidate(); - return; } - - uint64_t callbackID = callback->callbackID(); - m_dictionaryCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebProcess::GetWebCoreStatistics(callbackID), 0); } static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<String, uint64_t>& map) @@ -941,6 +906,12 @@ static PassRefPtr<MutableDictionary> createDictionaryFromHashMap(const HashMap<S return result; } +#if !PLATFORM(MAC) +void WebContext::dummy(bool&) +{ +} +#endif + void WebContext::didGetWebCoreStatistics(const StatisticsData& statisticsData, uint64_t callbackID) { RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID); @@ -972,12 +943,4 @@ void WebContext::setJavaScriptGarbageCollectorTimerEnabled(bool flag) sendToAllProcesses(Messages::WebProcess::SetJavaScriptGarbageCollectorTimerEnabled(flag)); } -void WebContext::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage) -{ - if (messageID.is<CoreIPC::MessageClassWebContext>()) { - didReceiveWebContextMessageOnConnectionWorkQueue(connection, messageID, arguments, didHandleMessage); - return; - } -} - } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index aef8af977..a011461f4 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -75,7 +75,7 @@ struct WebProcessCreationParameters; typedef GenericCallback<WKDictionaryRef> DictionaryCallback; -class WebContext : public APIObject, private CoreIPC::Connection::QueueClient { +class WebContext : public APIObject { public: static const Type APIType = TypeContext; @@ -90,10 +90,12 @@ public: void initializeDownloadClient(const WKContextDownloadClient*); ProcessModel processModel() const { return m_processModel; } - WebProcessProxy* process() const { return m_process.get(); } - template<typename U> bool sendToAllProcesses(const U& message); - template<typename U> bool sendToAllProcessesRelaunchingThemIfNecessary(const U& message); + // FIXME (Multi-WebProcess): Remove. No code should assume that there is a shared process. + WebProcessProxy* deprecatedSharedProcess(); + + template<typename U> void sendToAllProcesses(const U& message); + template<typename U> void sendToAllProcessesRelaunchingThemIfNecessary(const U& message); void processDidFinishLaunching(WebProcessProxy*); @@ -198,7 +200,8 @@ public: String iconDatabasePath() const; void setLocalStorageDirectory(const String& dir) { m_overrideLocalStorageDirectory = dir; } - void ensureWebProcess(); + void ensureSharedWebProcess(); + PassRefPtr<WebProcessProxy> createNewWebProcess(); void warmInitialProcess(); bool shouldTerminate(WebProcessProxy*); @@ -220,6 +223,8 @@ public: void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled); + void textCheckerStateChanged(); + private: WebContext(ProcessModel, const String& injectedBundlePath); @@ -228,14 +233,6 @@ private: void platformInitializeWebProcess(WebProcessCreationParameters&); void platformInvalidateContext(); - // Plugins - void getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh); - void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked); -#if !ENABLE(PLUGIN_PROCESS) - void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); - void didClearPluginSiteData(uint64_t callbackID); -#endif - #if PLATFORM(MAC) void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes); void getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames); @@ -253,14 +250,17 @@ private: void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size); #endif +#if !PLATFORM(MAC) + // 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&); +#endif + void didGetWebCoreStatistics(const StatisticsData&, uint64_t callbackID); // Implemented in generated WebContextMessageReceiver.cpp void didReceiveWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didReceiveSyncWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&); - void didReceiveWebContextMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage); - - virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, bool& didHandleMessage) OVERRIDE; static void languageChanged(void* context); void languageChanged(); @@ -273,13 +273,9 @@ private: String localStorageDirectory() const; String platformDefaultLocalStorageDirectory() const; - void handleGetPlugins(uint64_t requestID, bool refresh); - void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); - ProcessModel m_processModel; - // FIXME: In the future, this should be one or more WebProcessProxies. - RefPtr<WebProcessProxy> m_process; + Vector<RefPtr<WebProcessProxy> > m_processes; RefPtr<WebPageGroup> m_defaultPageGroup; @@ -352,23 +348,22 @@ private: bool m_processTerminationEnabled; HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks; - - WorkQueue m_pluginWorkQueue; }; -template<typename U> inline bool WebContext::sendToAllProcesses(const U& message) +template<typename U> inline void WebContext::sendToAllProcesses(const U& message) { - if (!m_process || !m_process->canSendMessage()) - return false; - - return m_process->send(message, 0); + size_t processCount = m_processes.size(); + for (size_t i = 0; i < processCount; ++i) { + WebProcessProxy* process = m_processes[i].get(); + if (process->canSendMessage()) + process->send(message, 0); + } } -template<typename U> bool WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message) +template<typename U> void WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message) { relaunchProcessIfNecessary(); - - return m_process->send(message, 0); + sendToAllProcesses(message); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebContext.messages.in b/Source/WebKit2/UIProcess/WebContext.messages.in index 64f598cef..2664a5f4f 100644 --- a/Source/WebKit2/UIProcess/WebContext.messages.in +++ b/Source/WebKit2/UIProcess/WebContext.messages.in @@ -24,15 +24,6 @@ messages -> WebContext { # Visited link provider messages. AddVisitedLinkHash(uint64_t linkHash) - - # Plugin messages. - GetPlugins(uint64_t requestID, bool refresh) DispatchOnConnectionQueue - GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked) - -#if !ENABLE(PLUGIN_PROCESS) - void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) - void DidClearPluginSiteData(uint64_t callbackID) -#endif DidGetWebCoreStatistics(WebKit::StatisticsData statisticsData, uint64_t callbackID) @@ -54,4 +45,10 @@ messages -> WebContext { SetPasteboardStringForType(WTF::String pasteboardName, WTF::String pasteboardType, WTF::String string) SetPasteboardBufferForType(WTF::String pasteboardName, WTF::String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) #endif + +#if !PLATFORM(MAC) + // 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) +#endif } diff --git a/Source/WebKit2/UIProcess/WebIntentData.cpp b/Source/WebKit2/UIProcess/WebIntentData.cpp index 96128dbe2..632aa3b75 100644 --- a/Source/WebKit2/UIProcess/WebIntentData.cpp +++ b/Source/WebKit2/UIProcess/WebIntentData.cpp @@ -30,16 +30,29 @@ #include "ImmutableArray.h" #include "ImmutableDictionary.h" +#include "WebProcessProxy.h" +#include "WebSerializedScriptValue.h" #include "WebString.h" #include "WebURL.h" namespace WebKit { -WebIntentData::WebIntentData(const IntentData& store) +WebIntentData::WebIntentData(const IntentData& store, WebProcessProxy* process) : m_store(store) + , m_process(process) { } +WebIntentData::~WebIntentData() +{ + // Remove MessagePortChannels from WebProcess. + if (m_process) { + size_t numMessagePorts = m_store.messagePorts.size(); + for (size_t i = 0; i < numMessagePorts; ++i) + m_process->removeMessagePortChannel(m_store.messagePorts[i]); + } +} + PassRefPtr<WebSerializedScriptValue> WebIntentData::data() const { Vector<uint8_t> dataCopy = m_store.data; @@ -66,6 +79,7 @@ PassRefPtr<ImmutableDictionary> WebIntentData::extras() const HashMap<String, String>::const_iterator end = m_store.extras.end(); for (HashMap<String, String>::const_iterator it = m_store.extras.begin(); it != end; ++it) wkExtras.set(it->first, WebString::create(it->second)); + return ImmutableDictionary::adopt(wkExtras); } diff --git a/Source/WebKit2/UIProcess/WebIntentData.h b/Source/WebKit2/UIProcess/WebIntentData.h index decf4ae4f..9d59f90ce 100644 --- a/Source/WebKit2/UIProcess/WebIntentData.h +++ b/Source/WebKit2/UIProcess/WebIntentData.h @@ -30,21 +30,26 @@ #include "APIObject.h" #include "IntentData.h" -#include "WebSerializedScriptValue.h" +#include <WebCore/KURL.h> #include <wtf/PassRefPtr.h> namespace WebKit { +class ImmutableArray; +class ImmutableDictionary; +class WebProcessProxy; +class WebSerializedScriptValue; + class WebIntentData : public APIObject { public: static const Type APIType = TypeIntentData; - static PassRefPtr<WebIntentData> create(const IntentData& store) + static PassRefPtr<WebIntentData> create(const IntentData& store, WebProcessProxy* process) { - return adoptRef(new WebIntentData(store)); + return adoptRef(new WebIntentData(store, process)); } - virtual ~WebIntentData() { } + virtual ~WebIntentData(); const String& action() const { return m_store.action; } const String& payloadType() const { return m_store.type; } @@ -57,11 +62,12 @@ public: const IntentData& store() const { return m_store; } private: - WebIntentData(const IntentData&); + WebIntentData(const IntentData&, WebProcessProxy*); virtual Type type() const { return APIType; } IntentData m_store; + WebProcessProxy* m_process; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 9c4df8eea..8d5cc32df 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -281,7 +281,7 @@ void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient) if (!loadClient) return; - process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID); + m_process->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID); } void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient) @@ -306,7 +306,7 @@ void WebPageProxy::initializeUIClient(const WKPageUIClient* client) m_uiClient.initialize(client); - process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID); + m_process->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID); setCanRunModal(m_uiClient.canRunModal()); } @@ -329,7 +329,7 @@ void WebPageProxy::reattachToWebProcess() m_isValid = true; m_process = m_process->context()->relaunchProcessIfNecessary(); - process()->addExistingWebPage(this, m_pageID); + m_process->addExistingWebPage(this, m_pageID); initializeWebPage(); @@ -347,8 +347,8 @@ void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item) if (!item) return; - process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::initializeWebPage() @@ -357,7 +357,7 @@ void WebPageProxy::initializeWebPage() BackForwardListItemVector items = m_backForwardList->entries(); for (size_t i = 0; i < items.size(); ++i) - process()->registerNewWebBackForwardListItem(items[i].get()); + m_process->registerNewWebBackForwardListItem(items[i].get()); m_drawingArea = m_pageClient->createDrawingAreaProxy(); ASSERT(m_drawingArea); @@ -367,10 +367,10 @@ void WebPageProxy::initializeWebPage() inspector()->enableRemoteInspection(); #endif - process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0); + m_process->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0); #if ENABLE(PAGE_VISIBILITY_API) - process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID); + m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID); #endif } @@ -384,7 +384,7 @@ void WebPageProxy::close() m_backForwardList->pageClosed(); m_pageClient->pageClosed(); - process()->disconnectFramesFromPage(this); + m_process->disconnectFramesFromPage(this); m_mainFrame = 0; #if ENABLE(INSPECTOR) @@ -455,8 +455,8 @@ void WebPageProxy::close() m_drawingArea = nullptr; - process()->send(Messages::WebPage::Close(), m_pageID); - process()->removeWebPage(m_pageID); + m_process->send(Messages::WebPage::Close(), m_pageID); + m_process->removeWebPage(m_pageID); } bool WebPageProxy::tryClose() @@ -464,8 +464,8 @@ bool WebPageProxy::tryClose() if (!isValid()) return true; - process()->send(Messages::WebPage::TryClose(), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::TryClose(), m_pageID); + m_process->responsivenessTimer()->start(); return false; } @@ -494,9 +494,9 @@ void WebPageProxy::loadURL(const String& url) SandboxExtension::Handle sandboxExtensionHandle; bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle); if (createdExtension) - process()->willAcquireUniversalFileReadSandboxExtension(); - process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID); - process()->responsivenessTimer()->start(); + m_process->willAcquireUniversalFileReadSandboxExtension(); + m_process->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest) @@ -509,9 +509,9 @@ void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest) SandboxExtension::Handle sandboxExtensionHandle; bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle); if (createdExtension) - process()->willAcquireUniversalFileReadSandboxExtension(); - process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID); - process()->responsivenessTimer()->start(); + m_process->willAcquireUniversalFileReadSandboxExtension(); + m_process->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL) @@ -519,9 +519,9 @@ void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseUR if (!isValid()) reattachToWebProcess(); - process()->assumeReadAccessToBaseURL(baseURL); - process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID); - process()->responsivenessTimer()->start(); + m_process->assumeReadAccessToBaseURL(baseURL); + m_process->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL) @@ -532,9 +532,9 @@ void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const Strin if (m_mainFrame) m_mainFrame->setUnreachableURL(unreachableURL); - process()->assumeReadAccessToBaseURL(baseURL); - process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID); - process()->responsivenessTimer()->start(); + m_process->assumeReadAccessToBaseURL(baseURL); + m_process->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::loadPlainTextString(const String& string) @@ -542,8 +542,8 @@ void WebPageProxy::loadPlainTextString(const String& string) if (!isValid()) reattachToWebProcess(); - process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::LoadPlainTextString(string), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData) @@ -551,8 +551,8 @@ void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData) if (!isValid()) reattachToWebProcess(); - process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::stopLoading() @@ -560,8 +560,8 @@ void WebPageProxy::stopLoading() if (!isValid()) return; - process()->send(Messages::WebPage::StopLoading(), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::StopLoading(), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::reload(bool reloadFromOrigin) @@ -575,7 +575,7 @@ void WebPageProxy::reload(bool reloadFromOrigin) // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle); if (createdExtension) - process()->willAcquireUniversalFileReadSandboxExtension(); + m_process->willAcquireUniversalFileReadSandboxExtension(); } if (!isValid()) { @@ -583,8 +583,8 @@ void WebPageProxy::reload(bool reloadFromOrigin) return; } - process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::goForward() @@ -603,8 +603,8 @@ void WebPageProxy::goForward() return; } - process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID); + m_process->responsivenessTimer()->start(); } bool WebPageProxy::canGoForward() const @@ -628,8 +628,8 @@ void WebPageProxy::goBack() return; } - process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID); + m_process->responsivenessTimer()->start(); } bool WebPageProxy::canGoBack() const @@ -646,8 +646,8 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item) setPendingAPIRequestURL(item->url()); - process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); - process()->responsivenessTimer()->start(); + m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID); + m_process->responsivenessTimer()->start(); } void WebPageProxy::tryRestoreScrollPosition() @@ -655,7 +655,7 @@ void WebPageProxy::tryRestoreScrollPosition() if (!isValid()) return; - process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID); + m_process->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID); } void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed) @@ -665,7 +665,7 @@ void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vecto void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem) { - WebBackForwardListItem* item = process()->webBackForwardItem(itemID); + WebBackForwardListItem* item = m_process->webBackForwardItem(itemID); shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item); } @@ -676,7 +676,7 @@ void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::Argumen if (!arguments->decode(messageDecoder)) return; - if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID)) + if (WebBackForwardListItem* item = m_process->webBackForwardItem(itemID)) m_loaderClient.willGoToBackForwardListItem(this, item, userData.get()); } @@ -748,7 +748,7 @@ void WebPageProxy::setDrawsBackground(bool drawsBackground) m_drawsBackground = drawsBackground; if (isValid()) - process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID); + m_process->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID); } void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground) @@ -759,21 +759,21 @@ void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground m_drawsTransparentBackground = drawsTransparentBackground; if (isValid()) - process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID); + m_process->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID); } void WebPageProxy::viewWillStartLiveResize() { if (!isValid()) return; - process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID); + m_process->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID); } void WebPageProxy::viewWillEndLiveResize() { if (!isValid()) return; - process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID); + m_process->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID); } void WebPageProxy::setViewNeedsDisplay(const IntRect& rect) @@ -797,10 +797,10 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) return; if (flags & ViewIsFocused) - process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID); + m_process->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID); if (flags & ViewWindowIsActive) - process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID); + m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID); if (flags & ViewIsVisible) { bool isVisible = m_pageClient->isViewVisible(); @@ -812,7 +812,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) // If we've started the responsiveness timer as part of telling the web process to update the backing store // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we // stop the unresponsiveness timer here. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); } } } @@ -821,7 +821,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) bool isInWindow = m_pageClient->isViewInWindow(); if (m_isInWindow != isInWindow) { m_isInWindow = isInWindow; - process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID); + m_process->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID); } if (isInWindow) { @@ -841,7 +841,7 @@ void WebPageProxy::viewStateDidChange(ViewStateFlags flags) if (visibilityState != m_visibilityState) { m_visibilityState = visibilityState; - process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID); + m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID); } #endif @@ -857,21 +857,21 @@ void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, cons { if (!isValid()) return; - process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID); + m_process->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID); } void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize) { if (!isValid()) return; - process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID); + m_process->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID); } void WebPageProxy::clearSelection() { if (!isValid()) return; - process()->send(Messages::WebPage::ClearSelection(), m_pageID); + m_process->send(Messages::WebPage::ClearSelection(), m_pageID); } void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback) @@ -883,7 +883,7 @@ void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<Validat uint64_t callbackID = callback->callbackID(); m_validateCommandCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID); + m_process->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID); } void WebPageProxy::setMaintainsInactiveSelection(bool newValue) @@ -900,7 +900,7 @@ void WebPageProxy::executeEditCommand(const String& commandName) if (commandName == ignoreSpellingCommandName) ++m_pendingLearnOrIgnoreWordMessageCount; - process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID); + m_process->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID); } #if USE(TILED_BACKING_STORE) @@ -909,7 +909,7 @@ void WebPageProxy::setViewportSize(const IntSize& size) if (!isValid()) return; - process()->send(Messages::WebPage::SetViewportSize(size), m_pageID); + m_process->send(Messages::WebPage::SetViewportSize(size), m_pageID); } #endif @@ -946,12 +946,12 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag return; #if PLATFORM(WIN) // FIXME: We should pass the drag data map only on DragEnter. - process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), + m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID); #elif PLATFORM(QT) || PLATFORM(GTK) - process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID); + m_process->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID); #else - process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID); + m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID); #endif } @@ -978,7 +978,7 @@ void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& glo { if (!isValid()) return; - process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID); + m_process->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID); } #endif // ENABLE(DRAG_SUPPORT) @@ -989,7 +989,7 @@ void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event) // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction. if (event.type() != WebEvent::MouseMove) - process()->responsivenessTimer()->start(); + m_process->responsivenessTimer()->start(); else { if (m_processingMouseMoveEvent) { m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event)); @@ -1008,10 +1008,10 @@ void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event) if (m_shouldSendEventsSynchronously) { bool handled = false; - process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID); + m_process->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID); didReceiveEvent(event.type(), handled); } else - process()->send(Messages::WebPage::MouseEvent(event), m_pageID); + m_process->send(Messages::WebPage::MouseEvent(event), m_pageID); } #if MERGE_WHEEL_EVENTS @@ -1111,16 +1111,16 @@ void WebPageProxy::processNextQueuedWheelEvent() void WebPageProxy::sendWheelEvent(const WebWheelEvent& event) { - process()->responsivenessTimer()->start(); + m_process->responsivenessTimer()->start(); if (m_shouldSendEventsSynchronously) { bool handled = false; - process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID); + m_process->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID); didReceiveEvent(event.type(), handled); return; } - process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0); + m_process->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0); } void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) @@ -1132,13 +1132,13 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) m_keyEventQueue.append(event); - process()->responsivenessTimer()->start(); + m_process->responsivenessTimer()->start(); if (m_shouldSendEventsSynchronously) { bool handled = false; - process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID); + m_process->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID); didReceiveEvent(event.type(), handled); } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler. - process()->send(Messages::WebPage::KeyEvent(event), m_pageID); + m_process->send(Messages::WebPage::KeyEvent(event), m_pageID); } #if ENABLE(GESTURE_EVENTS) @@ -1149,8 +1149,8 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event) m_gestureEventQueue.append(event); - process()->responsivenessTimer()->start(); - process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0); + m_process->responsivenessTimer()->start(); + m_process->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0); } #endif @@ -1158,7 +1158,7 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event) #if PLATFORM(QT) void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea) { - process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID); + m_process->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID); } #endif @@ -1172,13 +1172,13 @@ void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) // we do not send any of the events to the page even if is has listeners. if (m_needTouchEvents && !m_isPageSuspended) { m_touchEventQueue.append(event); - process()->responsivenessTimer()->start(); + m_process->responsivenessTimer()->start(); if (m_shouldSendEventsSynchronously) { bool handled = false; - process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID); + m_process->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID); didReceiveEvent(event.type(), handled); } else - process()->send(Messages::WebPage::TouchEvent(event), m_pageID); + m_process->send(Messages::WebPage::TouchEvent(event), m_pageID); } else { if (m_touchEventQueue.isEmpty()) { bool isEventHandled = false; @@ -1198,7 +1198,7 @@ void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granula if (!isValid()) return; - process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID); + m_process->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID); } void WebPageProxy::centerSelectionInVisibleArea() @@ -1206,7 +1206,7 @@ void WebPageProxy::centerSelectionInVisibleArea() if (!isValid()) return; - process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID); + m_process->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID); } void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID) @@ -1246,7 +1246,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr return; } - process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID); + m_process->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID); } String WebPageProxy::pageTitle() const @@ -1267,7 +1267,7 @@ void WebPageProxy::setUserAgent(const String& userAgent) if (!isValid()) return; - process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID); + m_process->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID); } void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName) @@ -1304,7 +1304,7 @@ void WebPageProxy::resumeActiveDOMObjectsAndAnimations() m_isPageSuspended = false; - process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID); + m_process->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID); } void WebPageProxy::suspendActiveDOMObjectsAndAnimations() @@ -1314,7 +1314,7 @@ void WebPageProxy::suspendActiveDOMObjectsAndAnimations() m_isPageSuspended = true; - process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID); + m_process->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID); } bool WebPageProxy::supportsTextEncoding() const @@ -1330,7 +1330,7 @@ void WebPageProxy::setCustomTextEncodingName(const String& encodingName) if (!isValid()) return; - process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID); + m_process->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID); } void WebPageProxy::terminateProcess() @@ -1340,7 +1340,7 @@ void WebPageProxy::terminateProcess() if (!m_isValid) return; - process()->terminate(); + m_process->terminate(); } #if !USE(CF) || defined(BUILDING_QT__) @@ -1380,7 +1380,7 @@ void WebPageProxy::setTextZoomFactor(double zoomFactor) return; m_textZoomFactor = zoomFactor; - process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); + m_process->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); } double WebPageProxy::pageZoomFactor() const @@ -1402,7 +1402,7 @@ void WebPageProxy::setPageZoomFactor(double zoomFactor) return; m_pageZoomFactor = zoomFactor; - process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); + m_process->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); } void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor) @@ -1420,7 +1420,7 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ m_pageZoomFactor = pageZoomFactor; m_textZoomFactor = textZoomFactor; - process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); + m_process->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); } void WebPageProxy::scalePage(double scale, const IntPoint& origin) @@ -1428,7 +1428,7 @@ void WebPageProxy::scalePage(double scale, const IntPoint& origin) if (!isValid()) return; - process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID); + m_process->send(Messages::WebPage::ScalePage(scale, origin), m_pageID); } void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor) @@ -1447,7 +1447,7 @@ void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID) if (!isValid()) return; - process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID); + m_process->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID); } float WebPageProxy::deviceScaleFactor() const @@ -1486,7 +1486,7 @@ void WebPageProxy::setUseFixedLayout(bool fixed) m_useFixedLayout = fixed; if (!fixed) m_fixedLayoutSize = IntSize(); - process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID); + m_process->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID); } void WebPageProxy::setFixedLayoutSize(const IntSize& size) @@ -1498,7 +1498,7 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size) return; m_fixedLayoutSize = size; - process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); + m_process->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); } void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode) @@ -1510,7 +1510,7 @@ void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode) if (!isValid()) return; - process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID); + m_process->send(Messages::WebPage::SetPaginationMode(mode), m_pageID); } void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns) @@ -1522,7 +1522,7 @@ void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns) if (!isValid()) return; - process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID); + m_process->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID); } void WebPageProxy::setPageLength(double pageLength) @@ -1534,7 +1534,7 @@ void WebPageProxy::setPageLength(double pageLength) if (!isValid()) return; - process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID); + m_process->send(Messages::WebPage::SetPageLength(pageLength), m_pageID); } void WebPageProxy::setGapBetweenPages(double gap) @@ -1546,7 +1546,7 @@ void WebPageProxy::setGapBetweenPages(double gap) if (!isValid()) return; - process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID); + m_process->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID); } void WebPageProxy::pageScaleFactorDidChange(double scaleFactor) @@ -1563,7 +1563,7 @@ void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsE return; m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled; - process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID); + m_process->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID); } void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount) @@ -1571,12 +1571,12 @@ void WebPageProxy::findString(const String& string, FindOptions options, unsigne if (m_mainFrameHasCustomRepresentation) m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount); else - process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID); + m_process->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID); } void WebPageProxy::hideFindUI() { - process()->send(Messages::WebPage::HideFindUI(), m_pageID); + m_process->send(Messages::WebPage::HideFindUI(), m_pageID); } void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) @@ -1589,7 +1589,7 @@ void WebPageProxy::countStringMatches(const String& string, FindOptions options, if (!isValid()) return; - process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID); + m_process->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID); } void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback) @@ -1602,7 +1602,7 @@ void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<Scr uint64_t callbackID = callback->callbackID(); m_scriptValueCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID); + m_process->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID); } void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback) @@ -1615,7 +1615,7 @@ void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback uint64_t callbackID = callback->callbackID(); m_stringCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID); + m_process->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID); } void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback) @@ -1629,7 +1629,7 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCall uint64_t callbackID = callback->callbackID(); m_loadDependentStringCallbackIDs.add(callbackID); m_stringCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID); + m_process->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID); } #if ENABLE(WEB_INTENTS) @@ -1638,7 +1638,7 @@ void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* web if (!isValid()) return; - process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID); + m_process->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID); } #endif @@ -1653,7 +1653,7 @@ void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback) uint64_t callbackID = callback->callbackID(); m_loadDependentStringCallbackIDs.add(callbackID); m_stringCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID); + m_process->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID); } #if ENABLE(MHTML) @@ -1667,7 +1667,7 @@ void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID); + m_process->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID); } #endif @@ -1681,7 +1681,7 @@ void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prp uint64_t callbackID = callback->callbackID(); m_stringCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID); + m_process->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID); } void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback) @@ -1694,7 +1694,7 @@ void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<D uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID); + m_process->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID); } void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback) @@ -1707,7 +1707,7 @@ void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resour uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID); + m_process->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID); } void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback) @@ -1720,7 +1720,7 @@ void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCal uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID); + m_process->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID); } void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback) @@ -1734,7 +1734,7 @@ void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback) uint64_t callbackID = callback->callbackID(); m_voidCallbacks.set(callbackID, callback.get()); m_drawingArea->waitForBackingStoreUpdateOnNextPaint(); - process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID); + m_process->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID); } void WebPageProxy::preferencesDidChange() @@ -1752,7 +1752,7 @@ void WebPageProxy::preferencesDidChange() // even if nothing changed in UI process, so that overrides get removed. // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox. - process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) @@ -1811,28 +1811,28 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP void WebPageProxy::didCreateMainFrame(uint64_t frameID) { MESSAGE_CHECK(!m_mainFrame); - MESSAGE_CHECK(process()->canCreateFrame(frameID)); + MESSAGE_CHECK(m_process->canCreateFrame(frameID)); m_mainFrame = WebFrameProxy::create(this, frameID); // Add the frame to the process wide map. - process()->frameCreated(frameID, m_mainFrame.get()); + m_process->frameCreated(frameID, m_mainFrame.get()); } void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID) { MESSAGE_CHECK(m_mainFrame); - WebFrameProxy* parentFrame = process()->webFrame(parentFrameID); + WebFrameProxy* parentFrame = m_process->webFrame(parentFrameID); MESSAGE_CHECK(parentFrame); MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get())); - MESSAGE_CHECK(process()->canCreateFrame(frameID)); + MESSAGE_CHECK(m_process->canCreateFrame(frameID)); RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID); // Add the frame to the process wide map. - process()->frameCreated(frameID, subFrame.get()); + m_process->frameCreated(frameID, subFrame.get()); // Insert the frame into the frame hierarchy. parentFrame->appendChild(subFrame.get()); @@ -1847,7 +1847,7 @@ void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID) { MESSAGE_CHECK(m_mainFrame); - WebFrameProxy* subframe = process()->webFrame(frameID); + WebFrameProxy* subframe = m_process->webFrame(frameID); MESSAGE_CHECK(subframe); if (isDisconnectedFrame(subframe)) @@ -1862,12 +1862,12 @@ void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t paren { MESSAGE_CHECK(m_mainFrame); - WebFrameProxy* subframe = process()->webFrame(frameID); + WebFrameProxy* subframe = m_process->webFrame(frameID); MESSAGE_CHECK(subframe); MESSAGE_CHECK(!subframe->parentFrame()); MESSAGE_CHECK(subframe->page() == m_mainFrame->page()); - WebFrameProxy* parentFrame = process()->webFrame(parentFrameID); + WebFrameProxy* parentFrame = m_process->webFrame(parentFrameID); MESSAGE_CHECK(parentFrame); MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get())); @@ -1917,7 +1917,7 @@ void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentS if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo); @@ -1934,7 +1934,7 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(url); @@ -1951,7 +1951,7 @@ void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t f if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(url); @@ -1967,7 +1967,7 @@ void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const Resour if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); frame->didFailProvisionalLoad(); @@ -1995,7 +1995,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); #if PLATFORM(MAC) @@ -2035,7 +2035,7 @@ void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::Argu if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get()); @@ -2048,7 +2048,7 @@ void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDeco if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); frame->didFinishLoad(); @@ -2063,7 +2063,7 @@ void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& er if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); clearLoadDependentCallbacks(); @@ -2080,7 +2080,7 @@ void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(url); @@ -2097,7 +2097,7 @@ void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); frame->didChangeTitle(title); @@ -2112,7 +2112,7 @@ void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDec if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get()); @@ -2125,7 +2125,7 @@ void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, Core if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get()); @@ -2148,7 +2148,7 @@ void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::Argume if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); frame->didRemoveFromHierarchy(); @@ -2163,7 +2163,7 @@ void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC:: if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get()); @@ -2176,7 +2176,7 @@ void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::Argu if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get()); @@ -2189,7 +2189,7 @@ void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecod if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didDetectXSSForFrame(this, frame, userData.get()); @@ -2203,17 +2203,17 @@ void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); - RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData); + RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData, m_process.get()); m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get()); } #endif void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); frame->setIsFrameSet(value); @@ -2232,7 +2232,7 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op if (request.url() != pendingAPIRequestURL()) clearPendingAPIRequestURL(); - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(request.url()); @@ -2267,7 +2267,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(request.url()); @@ -2287,7 +2287,7 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceRespo if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(request.url()); MESSAGE_CHECK_URL(response.url()); @@ -2319,7 +2319,7 @@ void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_policyClient.unableToImplementPolicy(this, frame, error, userData.get()); @@ -2334,10 +2334,10 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons if (!arguments->decode(messageDecoder)) return; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); - WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID); + WebFrameProxy* sourceFrame = m_process->webFrame(sourceFrameID); MESSAGE_CHECK(sourceFrame); RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID); @@ -2349,7 +2349,7 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(request.url()); @@ -2358,7 +2358,7 @@ void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourc void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(request.url()); @@ -2367,7 +2367,7 @@ void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resource void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK_URL(response.url()); @@ -2376,7 +2376,7 @@ void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t reso void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength); @@ -2384,7 +2384,7 @@ void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier); @@ -2392,7 +2392,7 @@ void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceI void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error); @@ -2418,7 +2418,7 @@ void WebPageProxy::showPage() void WebPageProxy::closePage(bool stopResponsivenessTimer) { if (stopResponsivenessTimer) - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); m_pageClient->clearAllEditCommands(); m_uiClient.close(this); @@ -2426,33 +2426,33 @@ void WebPageProxy::closePage(bool stopResponsivenessTimer) void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); m_uiClient.runJavaScriptAlert(this, message, frame); } void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); 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); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame); } @@ -2460,7 +2460,7 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, void WebPageProxy::shouldInterruptJavaScript(bool& result) { // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); result = m_uiClient.shouldInterruptJavaScript(this); } @@ -2568,11 +2568,11 @@ void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result) void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame); } @@ -2604,14 +2604,14 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& set m_openPanelResultListener = 0; } - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings); m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this); // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get())) didCancelForOpenPanel(); @@ -2622,7 +2622,7 @@ void WebPageProxy::printFrame(uint64_t frameID) ASSERT(!m_isPerformingDOMPrintOperation); m_isPerformingDOMPrintOperation = true; - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_uiClient.printFrame(this, frame); @@ -2646,7 +2646,7 @@ void WebPageProxy::setMediaVolume(float volume) if (!isValid()) return; - process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID); + m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID); } #if PLATFORM(QT) @@ -2660,7 +2660,7 @@ void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize if (!isValid()) return; - process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); + m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID); } void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents) @@ -2732,7 +2732,7 @@ void WebPageProxy::didChooseColor(const WebCore::Color& color) if (!isValid()) return; - process()->send(Messages::WebPage::DidChooseColor(color), m_pageID); + m_process->send(Messages::WebPage::DidChooseColor(color), m_pageID); } void WebPageProxy::didEndColorChooser() @@ -2745,7 +2745,7 @@ void WebPageProxy::didEndColorChooser() m_colorChooser->invalidate(); m_colorChooser = nullptr; - process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID); + m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID); } #endif @@ -2782,18 +2782,18 @@ WebFullScreenManagerProxy* WebPageProxy::fullScreenManager() void WebPageProxy::backForwardAddItem(uint64_t itemID) { - m_backForwardList->addItem(process()->webBackForwardItem(itemID)); + m_backForwardList->addItem(m_process->webBackForwardItem(itemID)); } void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle) { - WebBackForwardListItem* item = process()->webBackForwardItem(itemID); + WebBackForwardListItem* item = m_process->webBackForwardItem(itemID); if (!item) return; bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle); if (createdExtension) - process()->willAcquireUniversalFileReadSandboxExtension(); + m_process->willAcquireUniversalFileReadSandboxExtension(); m_backForwardList->goToItem(item); } @@ -2874,12 +2874,12 @@ void WebPageProxy::didFailToFindString(const String& string) void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) { - process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID); + m_process->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID); } void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) { - process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID); + m_process->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID); } NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent() @@ -2890,7 +2890,7 @@ NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent() #if PLATFORM(GTK) void WebPageProxy::failedToShowPopupMenu() { - process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID); + m_process->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID); } #endif @@ -2905,7 +2905,7 @@ void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, co m_activePopupMenu = m_pageClient->createPopupMenuProxy(this); // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu; @@ -2934,7 +2934,7 @@ void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTes internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments); // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again. - process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID); + m_process->send(Messages::WebPage::ContextMenuHidden(), m_pageID); } void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments) @@ -2954,7 +2954,7 @@ void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const W m_activeContextMenu = m_pageClient->createContextMenuProxy(this); // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); // Give the PageContextMenuClient one last swipe at changing the menu. Vector<WebContextMenuItemData> items; @@ -2981,27 +2981,27 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item) } if (item.action() == ContextMenuItemTagSmartQuotes) { TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagSmartDashes) { TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagSmartLinks) { TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagTextReplacement) { TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) { TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagShowSubstitutions) { @@ -3019,12 +3019,12 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item) } if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) { TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) { TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled); - process()->updateTextCheckerState(); + m_process->updateTextCheckerState(); return; } if (item.action() == ContextMenuItemTagShowSpellingPanel) { @@ -3036,7 +3036,7 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item) if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling) ++m_pendingLearnOrIgnoreWordMessageCount; - process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID); + m_process->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID); } #endif // ENABLE(CONTEXT_MENUS) @@ -3051,11 +3051,11 @@ void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) for (size_t i = 0; i < fileURLs.size(); ++i) { SandboxExtension::Handle sandboxExtensionHandle; SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle); - process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID); + m_process->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID); } #endif - process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); + m_process->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); m_openPanelResultListener->invalidate(); m_openPanelResultListener = 0; @@ -3066,7 +3066,7 @@ void WebPageProxy::didCancelForOpenPanel() if (!isValid()) return; - process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID); + m_process->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID); m_openPanelResultListener->invalidate(); m_openPanelResultListener = 0; @@ -3074,7 +3074,7 @@ void WebPageProxy::didCancelForOpenPanel() void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const { - process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID); + m_process->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID); } void WebPageProxy::changeSpellingToWord(const String& word) const @@ -3082,7 +3082,7 @@ void WebPageProxy::changeSpellingToWord(const String& word) const if (word.isEmpty()) return; - process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID); + m_process->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID); } void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo) @@ -3101,7 +3101,7 @@ void WebPageProxy::removeEditCommand(WebEditCommandProxy* command) if (!isValid()) return; - process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID); + m_process->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID); } bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command) @@ -3196,7 +3196,10 @@ void WebPageProxy::setToolTip(const String& toolTip) void WebPageProxy::setCursor(const WebCore::Cursor& cursor) { - m_pageClient->setCursor(cursor); + // The Web process may have asked to change the cursor when the view was in an active window, but + // if it is no longer in a window or the window is not active, then the cursor should not change. + if (m_pageClient->isViewWindowActive()) + m_pageClient->setCursor(cursor); } void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) @@ -3231,7 +3234,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) case WebEvent::TouchEnd: case WebEvent::TouchCancel: #endif - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); break; } @@ -3289,7 +3292,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) m_keyEventQueue.removeFirst(); if (!m_keyEventQueue.isEmpty()) - process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID); + m_process->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID); m_pageClient->doneWithKeyEvent(event, handled); if (handled) @@ -3325,7 +3328,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) void WebPageProxy::stopResponsivenessTimer() { - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); } void WebPageProxy::voidCallback(uint64_t callbackID) @@ -3422,7 +3425,7 @@ void WebPageProxy::focusedFrameChanged(uint64_t frameID) return; } - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_focusedFrame = frame; @@ -3435,7 +3438,7 @@ void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID) return; } - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); m_frameSetLargestFrame = frame; @@ -3648,7 +3651,7 @@ void WebPageProxy::backForwardClear() void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace); @@ -3658,17 +3661,17 @@ void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); - RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process()); + RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process.get()); 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 currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, uint64_t& newQuota) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier); @@ -3678,7 +3681,7 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier) { - WebFrameProxy* frame = process()->webFrame(frameID); + WebFrameProxy* frame = m_process->webFrame(frameID); MESSAGE_CHECK(frame); // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier(). @@ -3737,13 +3740,13 @@ void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect) void WebPageProxy::runModal() { // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer. - process()->responsivenessTimer()->stop(); + m_process->responsivenessTimer()->stop(); // Our Connection's run loop might have more messages waiting to be handled after this RunModal message. // To make sure they are handled inside of the the nested modal run loop we must first signal the Connection's // run loop so we're guaranteed that it has a chance to wake up. // See http://webkit.org/b/89590 for more discussion. - process()->connection()->wakeUpRunLoop(); + m_process->connection()->wakeUpRunLoop(); m_uiClient.runModal(this); } @@ -3812,7 +3815,7 @@ void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& sug void WebPageProxy::backForwardRemovedItem(uint64_t itemID) { - process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID); + m_process->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID); } void WebPageProxy::setCanRunModal(bool canRunModal) @@ -3824,7 +3827,7 @@ void WebPageProxy::setCanRunModal(bool canRunModal) // already qualifies for running modal child web pages, otherwise // there's no other possibility than not allowing it. m_canRunModal = m_uiClient.canRunModal() && canRunModal; - process()->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID); + m_process->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID); } bool WebPageProxy::canRunModal() @@ -3838,7 +3841,7 @@ void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInf return; m_isInPrintingMode = true; - process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } void WebPageProxy::endPrinting() @@ -3847,7 +3850,7 @@ void WebPageProxy::endPrinting() return; m_isInPrintingMode = false; - process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback) @@ -3861,7 +3864,7 @@ void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo uint64_t callbackID = callback->callbackID(); m_computedPagesCallbacks.set(callbackID, callback.get()); m_isInPrintingMode = true; - process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } #if PLATFORM(MAC) || PLATFORM(WIN) @@ -3875,7 +3878,7 @@ void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInf uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback) @@ -3888,7 +3891,7 @@ void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printIn uint64_t callbackID = callback->callbackID(); m_dataCallbacks.set(callbackID, callback.get()); - process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } #elif PLATFORM(GTK) void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback) @@ -3902,7 +3905,7 @@ void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& p uint64_t callbackID = callback->callbackID(); m_printFinishedCallbacks.set(callbackID, callback.get()); m_isInPrintingMode = true; - process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); + m_process->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0); } #endif @@ -3917,7 +3920,7 @@ void WebPageProxy::updateBackingStoreDiscardableState() bool isDiscardable; - if (!process()->responsivenessTimer()->isResponsive()) + if (!m_process->responsivenessTimer()->isResponsive()) isDiscardable = false; else isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible(); @@ -3942,7 +3945,7 @@ void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilena void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event) { - process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0); + m_process->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0); } #if PLATFORM(MAC) @@ -3978,7 +3981,7 @@ void WebPageProxy::handleAlternativeTextUIResult(const String& result) { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (!isClosed()) - process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0); + m_process->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0); #endif } diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index d90355c4e..22a2b7f2c 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -36,13 +36,19 @@ #include "WebNavigationDataStore.h" #include "WebNotificationManagerProxy.h" #include "WebPageProxy.h" +#include "WebPluginSiteDataManager.h" #include "WebProcessMessages.h" #include "WebProcessProxyMessages.h" #include <WebCore/KURL.h> #include <stdio.h> +#include <wtf/MainThread.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> +#if PLATFORM(MAC) +#include "BuiltInPDFView.h" +#endif + using namespace WebCore; using namespace std; @@ -63,6 +69,12 @@ static uint64_t generatePageID() return uniquePageID++; } +static WorkQueue& pluginWorkQueue() +{ + DEFINE_STATIC_LOCAL(WorkQueue, queue, ("com.apple.CoreIPC.PluginQueue")); + return queue; +} + PassRefPtr<WebProcessProxy> WebProcessProxy::create(PassRefPtr<WebContext> context) { return adoptRef(new WebProcessProxy(context)); @@ -171,8 +183,6 @@ WebPageProxy* WebProcessProxy::webPage(uint64_t pageID) const PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup) { - ASSERT(context->process() == this); - uint64_t pageID = generatePageID(); RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID); m_pageMap.set(pageID, webPage.get()); @@ -189,6 +199,16 @@ void WebProcessProxy::removeWebPage(uint64_t pageID) m_pageMap.remove(pageID); } +#if ENABLE(WEB_INTENTS) +void WebProcessProxy::removeMessagePortChannel(uint64_t channelID) +{ + if (!isValid()) + return; + + send(Messages::WebProcess::RemoveMessagePortChannel(channelID), /* destinationID */ 0); +} +#endif + WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const { return m_backForwardListItemMap.get(itemID).get(); @@ -282,16 +302,86 @@ void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& original result.iterator->second->setBackForwardData(backForwardData.data(), backForwardData.size()); } +void WebProcessProxy::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos) +{ + ASSERT(isMainThread()); + + OwnPtr<Vector<PluginInfo> > plugins(pluginInfos); + +#if PLATFORM(MAC) + // Add built-in PDF last, so that it's not used when a real plug-in is installed. + // NOTE: This has to be done on the main thread as it calls localizedString(). + if (!m_context->omitPDFSupport()) + plugins->append(BuiltInPDFView::pluginInfo()); +#endif + + send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0); +} + +void WebProcessProxy::handleGetPlugins(uint64_t requestID, bool refresh) +{ + if (refresh) + m_context->pluginInfoStore().refresh(); + + OwnPtr<Vector<PluginInfo> > pluginInfos = adoptPtr(new Vector<PluginInfo>); + + Vector<PluginModuleInfo> plugins = m_context->pluginInfoStore().plugins(); + for (size_t i = 0; i < plugins.size(); ++i) + pluginInfos->append(plugins[i].info); + + // NOTE: We have to pass the PluginInfo vector to the secondary thread via a pointer as otherwise + // we'd end up with a deref() race on all the WTF::Strings it contains. + RunLoop::main()->dispatch(bind(&WebProcessProxy::sendDidGetPlugins, this, requestID, pluginInfos.release())); +} + +void WebProcessProxy::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh) +{ + pluginWorkQueue().dispatch(bind(&WebProcessProxy::handleGetPlugins, this, requestID, refresh)); +} + +void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked) +{ + MESSAGE_CHECK_URL(urlString); + + String newMimeType = mimeType.lower(); + + blocked = false; + PluginModuleInfo plugin = m_context->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString)); + if (!plugin.path) + return; + + if (m_context->pluginInfoStore().shouldBlockPlugin(plugin)) { + blocked = true; + return; + } + + pluginPath = plugin.path; +} + #if ENABLE(PLUGIN_PROCESS) + void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { - PluginProcessManager::shared().getPluginProcessConnection(context()->pluginInfoStore(), pluginPath, reply); + PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply); } void WebProcessProxy::pluginSyncMessageSendTimedOut(const String& pluginPath) { PluginProcessManager::shared().pluginSyncMessageSendTimedOut(pluginPath); } + +#else + +void WebProcessProxy::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID) +{ + m_context->pluginSiteDataManager()->didGetSitesWithData(sites, callbackID); +} + +void WebProcessProxy::didClearPluginSiteData(uint64_t callbackID) +{ + m_context->pluginSiteDataManager()->didClearSiteData(callbackID); +} + #endif void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 09d861a0e..2dc204f89 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -55,7 +55,7 @@ class WebContext; class WebPageGroup; struct WebNavigationDataStore; -class WebProcessProxy : public RefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, CoreIPC::Connection::QueueClient { +class WebProcessProxy : public ThreadSafeRefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, CoreIPC::Connection::QueueClient { public: typedef HashMap<uint64_t, RefPtr<WebFrameProxy> > WebFrameProxyMap; typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap; @@ -85,6 +85,10 @@ public: void addExistingWebPage(WebPageProxy*, uint64_t pageID); void removeWebPage(uint64_t pageID); +#if ENABLE(WEB_INTENTS) + void removeMessagePortChannel(uint64_t channelID); +#endif + WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const; ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; } @@ -132,10 +136,20 @@ private: void shouldTerminate(bool& shouldTerminate); + // Plugins + void getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh); + void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath, bool& blocked); #if ENABLE(PLUGIN_PROCESS) void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); void pluginSyncMessageSendTimedOut(const String& pluginPath); +#else + void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); + void didClearPluginSiteData(uint64_t callbackID); #endif + + void handleGetPlugins(uint64_t requestID, bool refresh); + void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); + #if USE(SECURITY_FRAMEWORK) void secItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecItemRequestData&); void secKeychainItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecKeychainItemRequestData&); diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index 84805df32..2c3d58b93 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -33,10 +33,17 @@ messages -> WebProcessProxy { ShouldTerminate() -> (bool shouldTerminate) + # Plugin messages. + GetPlugins(uint64_t requestID, bool refresh) DispatchOnConnectionQueue + GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, bool blocked) #if ENABLE(PLUGIN_PROCESS) GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed PluginSyncMessageSendTimedOut(WTF::String pluginPath) #endif +#if !ENABLE(PLUGIN_PROCESS) + void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) + void DidClearPluginSiteData(uint64_t callbackID) +#endif #if USE(SECURITY_FRAMEWORK) SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) DispatchOnConnectionQueue diff --git a/Source/WebKit2/UIProcess/WebTextChecker.cpp b/Source/WebKit2/UIProcess/WebTextChecker.cpp index 276184419..f4a65526a 100644 --- a/Source/WebKit2/UIProcess/WebTextChecker.cpp +++ b/Source/WebKit2/UIProcess/WebTextChecker.cpp @@ -48,27 +48,23 @@ void WebTextChecker::setClient(const WKTextCheckerClient* client) m_client.initialize(client); } -static void updateStateForAllWebProcesses() +static void updateStateForAllContexts() { const Vector<WebContext*>& contexts = WebContext::allContexts(); - for (size_t i = 0; i < contexts.size(); ++i) { - WebProcessProxy* webProcess = contexts[i]->process(); - if (!webProcess) - continue; - webProcess->updateTextCheckerState(); - } + for (size_t i = 0; i < contexts.size(); ++i) + contexts[i]->textCheckerStateChanged(); } void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled) { TextChecker::continuousSpellCheckingEnabledStateChanged(enabled); - updateStateForAllWebProcesses(); + updateStateForAllContexts(); } void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled) { TextChecker::grammarCheckingEnabledStateChanged(enabled); - updateStateForAllWebProcesses(); + updateStateForAllContexts(); } void WebTextChecker::checkSpelling(const WebPageProxy* page, bool startBeforeSelection) diff --git a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp index 236ffca05..ed2b4df8f 100644 --- a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp @@ -53,22 +53,78 @@ static void contextMenuItemActivatedCallback(GtkAction* action, WebPageProxy* pa page->contextMenuItemSelected(item); } +static void contextMenuItemVisibilityChanged(GtkAction* action, GParamSpec*, WebContextMenuProxyGtk* contextMenuProxy) +{ + GtkMenu* menu = contextMenuProxy->gtkMenu(); + if (!menu) + return; + + GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu))); + bool previousVisibleItemIsNotASeparator = false; + GtkWidget* lastItemVisibleSeparator = 0; + for (GList* iter = items.get(); iter; iter = g_list_next(iter)) { + GtkWidget* widget = GTK_WIDGET(iter->data); + + if (GTK_IS_SEPARATOR_MENU_ITEM(widget)) { + if (previousVisibleItemIsNotASeparator) { + gtk_widget_show(widget); + lastItemVisibleSeparator = widget; + previousVisibleItemIsNotASeparator = false; + } else + gtk_widget_hide(widget); + } else if (gtk_widget_get_visible(widget)) { + lastItemVisibleSeparator = 0; + previousVisibleItemIsNotASeparator = true; + } + } + + if (lastItemVisibleSeparator) + gtk_widget_hide(lastItemVisibleSeparator); +} + void WebContextMenuProxyGtk::append(ContextMenuItem& menuItem) { GtkAction* action = menuItem.gtkAction(); - - if (action && (menuItem.type() == ActionType || menuItem.type() == CheckableActionType)) { - g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(menuItem.action())); - g_signal_connect(action, "activate", G_CALLBACK(contextMenuItemActivatedCallback), m_page); + if (action) { + switch (menuItem.type()) { + case ActionType: + case CheckableActionType: + g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(menuItem.action())); + g_signal_connect(action, "activate", G_CALLBACK(contextMenuItemActivatedCallback), m_page); + // Fall through. + case SubmenuType: + g_signal_connect(action, "notify::visible", G_CALLBACK(contextMenuItemVisibilityChanged), this); + break; + case SeparatorType: + break; + } } m_menu.appendItem(menuItem); } +// Populate the context menu ensuring that: +// - There aren't separators next to each other. +// - There aren't separators at the beginning of the menu. +// - There aren't separators at the end of the menu. void WebContextMenuProxyGtk::populate(Vector<ContextMenuItem>& items) { - for (size_t i = 0; i < items.size(); i++) - append(items.at(i)); + bool previousIsSeparator = false; + bool isEmpty = true; + for (size_t i = 0; i < items.size(); i++) { + ContextMenuItem& menuItem = items.at(i); + if (menuItem.type() == SeparatorType) { + previousIsSeparator = true; + continue; + } + + if (previousIsSeparator && !isEmpty) + append(items.at(i - 1)); + previousIsSeparator = false; + + append(menuItem); + isEmpty = false; + } } void WebContextMenuProxyGtk::populate(const Vector<WebContextMenuItemData>& items) diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp index 638715fb1..0dd547102 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp @@ -57,7 +57,7 @@ public: { } -public slots: +public Q_SLOTS: // Allows clients to call dismiss() directly, while also // being able to hook up signals to automatically also // dismiss the dialog since it's a slot. @@ -68,7 +68,7 @@ public slots: emit dismissed(); } -signals: +Q_SIGNALS: void dismissed(); private: @@ -95,11 +95,11 @@ public: QString message() const { return m_message; } QString defaultValue() const { return m_defaultValue; } -public slots: +public Q_SLOTS: void accept(const QString& result = QString()) { emit accepted(result); } void reject() { emit rejected(); } -signals: +Q_SIGNALS: void accepted(const QString& result); void rejected(); @@ -126,11 +126,11 @@ public: QString hostname() const { return m_hostname; } QString prefilledUsername() const { return m_prefilledUsername; } -public slots: +public Q_SLOTS: void accept(const QString& username, const QString& password) { emit accepted(username, password); } void reject() { emit rejected(); } -signals: +Q_SIGNALS: void accepted(const QString& username, const QString& password); void rejected(); @@ -188,11 +188,11 @@ public: QString hostname() const { return m_hostname; } -public slots: +public Q_SLOTS: void accept() { emit accepted(); } void reject() { emit rejected(); } -signals: +Q_SIGNALS: void accepted(); void rejected(); @@ -218,7 +218,7 @@ public: QStringList fileList() const { return m_fileList; } bool allowMultipleFiles() const { return m_allowMultiple;} -public slots: +public Q_SLOTS: void reject() { emit rejected();} void accept(const QVariant& path) { @@ -235,7 +235,7 @@ public slots: emit fileSelected(filesPath); } -signals: +Q_SIGNALS: void rejected(); void fileSelected(const QStringList&); @@ -283,11 +283,11 @@ public: quint64 expectedUsage() const { return m_expectedUsage; } QtWebSecurityOrigin* securityOrigin() { return &m_securityOrigin; } -public slots: +public Q_SLOTS: void accept(quint64 size) { emit accepted(size); } void reject() { emit rejected(); } -signals: +Q_SIGNALS: void accepted(quint64 size); void rejected(); diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h index c04043d34..b70044076 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h @@ -65,7 +65,7 @@ public: QStringList filePaths() const { return m_filepaths; } -public slots: +public Q_SLOTS: void onAccepted(const QString& result = QString()); void onAuthenticationAccepted(const QString& username, const QString& password); void onFileSelected(const QStringList& filePaths); diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp index 50fa17f66..f8d384cc2 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp @@ -116,6 +116,9 @@ PassRefPtr<QtWebContext> QtWebContext::defaultContext() return PassRefPtr<QtWebContext>(s_defaultContext); RefPtr<WebContext> context = WebContext::create(String()); + // A good all-around default. + context->setCacheModel(CacheModelDocumentBrowser); + RefPtr<QtWebContext> defaultContext = QtWebContext::create(context.get()); s_defaultContext = defaultContext.get(); // Make sure that this doesn't get called in WebKitTestRunner (defaultContext isn't used there). diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 4cc9f3372..446db753d 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -104,7 +104,7 @@ protected: QQuickWebPage* m_webPage; QQuickWebView* m_webView; -private slots: +private Q_SLOTS: void inputPanelVisibleChanged(); private: diff --git a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp index 9b3fbaf16..982c774f8 100644 --- a/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp +++ b/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp @@ -27,6 +27,7 @@ #include "WebCookieManager.h" #include "WebKitSoupCookieJarSqlite.h" +#include "WebProcess.h" #include <WebCore/CookieJarSoup.h> #include <WebCore/ResourceHandle.h> #include <libsoup/soup.h> @@ -83,6 +84,8 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy() void WebCookieManager::setCookiePersistentStorage(const String& storagePath, uint32_t storageType) { + WebProcess::LocalTerminationDisabler terminationDisabler(WebProcess::shared()); + GRefPtr<SoupCookieJar> jar; switch (storageType) { case SoupCookiePersistentStorageText: diff --git a/Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.h b/Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.h index 0ae0fd84a..f688063af 100644 --- a/Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.h +++ b/Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.h @@ -58,7 +58,7 @@ public: DownloadErrorNetworkFailure }; -private slots: +private Q_SLOTS: void onReadyRead(); void onFinished(); void onError(QNetworkReply::NetworkError); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index 3355d086d..018ef7970 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -46,6 +46,7 @@ class InjectedBundleBackForwardList; class InjectedBundleBackForwardListItem; class InjectedBundleDOMWindowExtension; class InjectedBundleHitTestResult; +class InjectedBundleIntent; class InjectedBundleIntentRequest; class InjectedBundleNavigationAction; class InjectedBundleNodeHandle; @@ -64,6 +65,7 @@ WK_ADD_API_MAPPING(WKBundleDOMWindowExtensionRef, InjectedBundleDOMWindowExtensi WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame) WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult) WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector) +WK_ADD_API_MAPPING(WKBundleIntentRef, InjectedBundleIntent) WK_ADD_API_MAPPING(WKBundleIntentRequestRef, InjectedBundleIntentRequest) WK_ADD_API_MAPPING(WKBundleNavigationActionRef, InjectedBundleNavigationAction) WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp new file mode 100644 index 000000000..561a514eb --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 "WKBundleIntent.h" + +#if ENABLE(WEB_INTENTS) +#include "ImmutableArray.h" +#include "ImmutableDictionary.h" +#include "InjectedBundleIntent.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" +#include "WKDictionary.h" +#include "WKString.h" +#include "WebSerializedScriptValue.h" + +using namespace WebCore; +using namespace WebKit; +#endif + +WKTypeID WKBundleIntentGetTypeID() +{ +#if ENABLE(WEB_INTENTS) + return toAPI(InjectedBundleIntent::APIType); +#else + return 0; +#endif +} + +WKBundleIntentRef WKBundleIntentCreate(WKDictionaryRef dictionaryRef) +{ +#if ENABLE(WEB_INTENTS) + WKStringRef action = static_cast<WKStringRef>(WKDictionaryGetItemForKey(dictionaryRef, WKStringCreateWithUTF8CString("action"))); + ASSERT(action); + WKStringRef type = static_cast<WKStringRef>(WKDictionaryGetItemForKey(dictionaryRef, WKStringCreateWithUTF8CString("type"))); + ASSERT(type); + WKSerializedScriptValueRef data = static_cast<WKSerializedScriptValueRef>(WKDictionaryGetItemForKey(dictionaryRef, WKStringCreateWithUTF8CString("data"))); + MessagePortArray dummyPorts; + ExceptionCode ec; + + RefPtr<Intent> coreIntent = Intent::create(toImpl(action)->string(), toImpl(type)->string(), data ? static_cast<SerializedScriptValue*>(toImpl(data)->internalRepresentation()) : 0, dummyPorts, ec); + + return toAPI(InjectedBundleIntent::create(coreIntent.get()).leakRef()); +#else + return 0; +#endif +} + +WKStringRef WKBundleIntentCopyAction(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + return toCopiedAPI(toImpl(intentRef)->action()); +#else + return 0; +#endif +} + +WKStringRef WKBundleIntentCopyType(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + return toCopiedAPI(toImpl(intentRef)->payloadType()); +#else + return 0; +#endif +} + +WKURLRef WKBundleIntentCopyService(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + return toCopiedURLAPI(toImpl(intentRef)->service()); +#else + return 0; +#endif +} + +WKArrayRef WKBundleIntentCopySuggestions(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + return toAPI(toImpl(intentRef)->suggestions().leakRef()); +#else + return 0; +#endif +} + +WKStringRef WKBundleIntentCopyExtraValue(WKBundleIntentRef intentRef, WKStringRef key) +{ +#if ENABLE(WEB_INTENTS) + return toCopiedAPI(toImpl(intentRef)->extra(toWTFString(key))); +#else + return 0; +#endif +} + +WKDictionaryRef WKBundleIntentCopyExtras(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + return toAPI(toImpl(intentRef)->extras().leakRef()); +#else + return 0; +#endif +} + +size_t WKBundleIntentMessagePortCount(WKBundleIntentRef intentRef) +{ +#if ENABLE(WEB_INTENTS) + MessagePortChannelArray* messagePorts = toImpl(intentRef)->coreIntent()->messagePorts(); + + return messagePorts ? messagePorts->size() : 0; +#else + return 0; +#endif +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.h new file mode 100644 index 000000000..503fe0284 --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBundleIntent_h +#define WKBundleIntent_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBundleIntentGetTypeID(); + +WK_EXPORT WKBundleIntentRef WKBundleIntentCreate(WKDictionaryRef dictionaryRef); + +WK_EXPORT WKStringRef WKBundleIntentCopyAction(WKBundleIntentRef intentRef); +WK_EXPORT WKStringRef WKBundleIntentCopyType(WKBundleIntentRef intentRef); +WK_EXPORT WKURLRef WKBundleIntentCopyService(WKBundleIntentRef intentRef); +WK_EXPORT WKArrayRef WKBundleIntentCopySuggestions(WKBundleIntentRef intentRef); +WK_EXPORT WKStringRef WKBundleIntentCopyExtraValue(WKBundleIntentRef intentRef, WKStringRef key); +WK_EXPORT WKDictionaryRef WKBundleIntentCopyExtras(WKBundleIntentRef intentRef); +WK_EXPORT size_t WKBundleIntentMessagePortCount(WKBundleIntentRef intentRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKBundleIntent_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp index 81c95c6c5..a4772ea56 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.cpp @@ -27,10 +27,10 @@ #include "WKBundleIntentRequest.h" #if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntent.h" #include "InjectedBundleIntentRequest.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" -#include "WebIntentData.h" using namespace WebKit; #endif @@ -44,11 +44,11 @@ WKTypeID WKBundleIntentRequestGetTypeID() #endif } -WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef requestRef) +WKBundleIntentRef WKBundleIntentRequestCopyIntent(WKBundleIntentRequestRef requestRef) { #if ENABLE(WEB_INTENTS) - RefPtr<WebIntentData> webIntentData = toImpl(requestRef)->intent(); - return toAPI(webIntentData.release().leakRef()); + RefPtr<InjectedBundleIntent> webIntent = toImpl(requestRef)->intent(); + return toAPI(webIntent.release().leakRef()); #else return 0; #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h index b18136d13..105afa4f9 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntentRequest.h @@ -34,7 +34,7 @@ extern "C" { WK_EXPORT WKTypeID WKBundleIntentRequestGetTypeID(); -WK_EXPORT WKIntentDataRef WKBundleIntentRequestCopyIntentData(WKBundleIntentRequestRef request); +WK_EXPORT WKBundleIntentRef WKBundleIntentRequestCopyIntent(WKBundleIntentRequestRef request); WK_EXPORT void WKBundleIntentRequestPostResult(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); WK_EXPORT void WKBundleIntentRequestPostFailure(WKBundleIntentRequestRef request, WKSerializedScriptValueRef serializedData); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 1f43a1220..91d0ad865 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -47,7 +47,7 @@ #include <WebCore/Page.h> #if ENABLE(WEB_INTENTS) -#include "WebIntentData.h" +#include "InjectedBundleIntent.h" #endif using namespace WebKit; @@ -295,7 +295,9 @@ WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef pageRef, WKRect WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options) { - RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptionsFromImageOptions(options)); + SnapshotOptions snapshotOptions = snapshotOptionsFromImageOptions(options); + snapshotOptions |= SnapshotOptionsInViewCoordinates; + RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptions); return toAPI(webImage.release().leakRef()); } @@ -316,10 +318,10 @@ double WKBundlePageGetBackingScaleFactor(WKBundlePageRef pageRef) return toImpl(pageRef)->deviceScaleFactor(); } -void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKIntentDataRef intentRef) +void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKBundleIntentRef intentRef) { #if ENABLE(WEB_INTENTS) - toImpl(pageRef)->deliverIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->store()); + toImpl(pageRef)->deliverCoreIntentToFrame(toImpl(frameRef)->frameID(), toImpl(intentRef)->coreIntent()); #endif } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 28eee5c73..8bc7670cf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -410,7 +410,7 @@ WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBun WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page); -WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent); +WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRef intent); #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.cpp new file mode 100644 index 000000000..92de61c6c --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 "InjectedBundleIntent.h" + +#if ENABLE(WEB_INTENTS) + +#include "ImmutableArray.h" +#include "ImmutableDictionary.h" +#include "WebSerializedScriptValue.h" +#include "WebString.h" +#include "WebURL.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<InjectedBundleIntent> InjectedBundleIntent::create(WebCore::Intent* intent) +{ + return adoptRef(new InjectedBundleIntent(intent)); +} + +InjectedBundleIntent::InjectedBundleIntent(WebCore::Intent* intent) + : m_intent(intent) +{ +} + +String InjectedBundleIntent::action() const +{ + return m_intent->action(); +} + +String InjectedBundleIntent::payloadType() const +{ + return m_intent->type(); +} + +WebCore::KURL InjectedBundleIntent::service() const +{ + return m_intent->service(); +} + +PassRefPtr<WebSerializedScriptValue> InjectedBundleIntent::data() const +{ + return WebSerializedScriptValue::create(m_intent->data()); +} + +String InjectedBundleIntent::extra(const String& key) const +{ + return m_intent->extras().get(key); +} + +PassRefPtr<ImmutableDictionary> InjectedBundleIntent::extras() const +{ + const HashMap<String, String>& extras = m_intent->extras(); + ImmutableDictionary::MapType wkExtras; + HashMap<String, String>::const_iterator end = extras.end(); + for (HashMap<String, String>::const_iterator it = extras.begin(); it != end; ++it) + wkExtras.set(it->first, WebString::create(it->second)); + + return ImmutableDictionary::adopt(wkExtras); +} + +PassRefPtr<ImmutableArray> InjectedBundleIntent::suggestions() const +{ + const Vector<KURL>& suggestions = m_intent->suggestions(); + const size_t numSuggestions = suggestions.size(); + Vector<RefPtr<APIObject> > wkSuggestions(numSuggestions); + for (unsigned i = 0; i < numSuggestions; ++i) + wkSuggestions[i] = WebURL::create(suggestions[i]); + + return ImmutableArray::adopt(wkSuggestions); +} + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.h new file mode 100644 index 000000000..5d3f06c7b --- /dev/null +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntent.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedBundleIntent_h +#define InjectedBundleIntent_h + +#if ENABLE(WEB_INTENTS) + +#include "APIObject.h" +#include <WebCore/Intent.h> +#include <WebCore/KURL.h> +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebKit { + +class ImmutableArray; +class ImmutableDictionary; +class WebSerializedScriptValue; + +class InjectedBundleIntent : public APIObject { +public: + static const Type APIType = TypeBundleIntent; + + static PassRefPtr<InjectedBundleIntent> create(WebCore::Intent*); + + String action() const; + String payloadType() const; + WebCore::KURL service() const; + PassRefPtr<WebSerializedScriptValue> data() const; + String extra(const String& key) const; + PassRefPtr<ImmutableDictionary> extras() const; + PassRefPtr<ImmutableArray> suggestions() const; + + WebCore::Intent* coreIntent() const { return m_intent.get(); } + +private: + explicit InjectedBundleIntent(WebCore::Intent*); + + virtual Type type() const { return APIType; } + + RefPtr<WebCore::Intent> m_intent; +}; + +} // namespace WebKit + +#endif // ENABLE(WEB_INTENTS) + +#endif // InjectedBundleIntent_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp index 5ccb19cad..eac0b83bd 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.cpp @@ -27,6 +27,7 @@ #include "InjectedBundleIntentRequest.h" #if ENABLE(WEB_INTENTS) +#include "InjectedBundleIntent.h" #include <WebCore/IntentRequest.h> #include <WebSerializedScriptValue.h> @@ -54,9 +55,9 @@ void InjectedBundleIntentRequest::postFailure(WebSerializedScriptValue* data) m_intentRequest->postFailure(static_cast<SerializedScriptValue*>(data->internalRepresentation())); } -PassRefPtr<WebIntentData> InjectedBundleIntentRequest::intent() const +PassRefPtr<InjectedBundleIntent> InjectedBundleIntentRequest::intent() const { - return WebIntentData::create(IntentData(m_intentRequest->intent())); + return InjectedBundleIntent::create(m_intentRequest->intent()); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h index b5870d9a2..33a31922f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleIntentRequest.h @@ -29,7 +29,6 @@ #if ENABLE(WEB_INTENTS) #include "APIObject.h" -#include "WebIntentData.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -40,6 +39,7 @@ class IntentRequest; namespace WebKit { +class InjectedBundleIntent; class WebSerializedScriptValue; class InjectedBundleIntentRequest : public APIObject { @@ -51,7 +51,7 @@ public: void postResult(WebSerializedScriptValue*); void postFailure(WebSerializedScriptValue*); - PassRefPtr<WebIntentData> intent() const; + PassRefPtr<InjectedBundleIntent> intent() const; private: explicit InjectedBundleIntentRequest(WebCore::IntentRequest*); diff --git a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp index 4edfe5a4e..6d89fc0c9 100644 --- a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp +++ b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp @@ -55,8 +55,11 @@ PassRefPtr<NotificationPermissionRequestManager> NotificationPermissionRequestMa } NotificationPermissionRequestManager::NotificationPermissionRequestManager(WebPage* page) +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) : m_page(page) +#endif { + (void)page; } #if ENABLE(NOTIFICATIONS) diff --git a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h index 3b3799ae3..138a184cb 100644 --- a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h +++ b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h @@ -72,7 +72,9 @@ private: HashMap<RefPtr<WebCore::SecurityOrigin>, uint64_t> m_originToIDMap; HashMap<uint64_t, RefPtr<WebCore::SecurityOrigin> > m_idToOriginMap; +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebPage* m_page; +#endif }; inline bool isRequestIDValid(uint64_t id) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index 17db25708..e380eef94 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -199,10 +199,12 @@ void PluginProxy::didFailToCreatePluginInternal() void PluginProxy::destroy() { - m_connection->connection()->sendSync(Messages::WebProcessConnection::DestroyPlugin(m_pluginInstanceID, m_waitingOnAsynchronousInitialization), Messages::WebProcessConnection::DestroyPlugin::Reply(), 0); - m_isStarted = false; + if (!m_connection) + return; + + m_connection->connection()->sendSync(Messages::WebProcessConnection::DestroyPlugin(m_pluginInstanceID, m_waitingOnAsynchronousInitialization), Messages::WebProcessConnection::DestroyPlugin::Reply(), 0); m_connection->removePluginProxy(this); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index ceccd6af1..a3c0cc14a 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -1356,9 +1356,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugIn void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) { - ASSERT(!m_pluginView); - ASSERT(pluginWidget); - m_pluginView = static_cast<PluginView*>(pluginWidget); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index c14798c6d..5d250ea59 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -34,6 +34,7 @@ #include "WebCookieManager.h" #include "WebCoreArgumentCoders.h" #include "WebProcess.h" +#include "WebProcessProxyMessages.h" #include <WebCore/Color.h> #include <WebCore/KURL.h> #include <WebCore/Page.h> @@ -130,7 +131,7 @@ void WebPlatformStrategies::populatePluginCache() // FIXME: Should we do something in case of error here? uint64_t requestID = generateRequestID(); - WebProcess::shared().connection()->send(Messages::WebContext::GetPlugins(requestID, m_shouldRefreshPlugins), 0); + WebProcess::shared().connection()->send(Messages::WebProcessProxy::GetPlugins(requestID, m_shouldRefreshPlugins), 0); m_cachedPlugins = *responseMap().waitForResponse(requestID); diff --git a/Source/WebKit2/WebProcess/WebPage/AreaAllocator.cpp b/Source/WebKit2/WebProcess/WebPage/AreaAllocator.cpp new file mode 100644 index 000000000..602efeb5f --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/AreaAllocator.cpp @@ -0,0 +1,331 @@ +/* + * Copyright (C) 2012 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 Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "config.h" + +#include "AreaAllocator.h" + +namespace WebKit { + +AreaAllocator::AreaAllocator(const WebCore::IntSize& size) + : m_size(size) + , m_minAlloc(1, 1) + , m_margin(0, 0) +{ +} + +AreaAllocator::~AreaAllocator() +{ +} + +void AreaAllocator::expand(const WebCore::IntSize& size) +{ + m_size = m_size.expandedTo(size); +} + +void AreaAllocator::expandBy(const WebCore::IntSize& size) +{ + m_size += size; +} + +void AreaAllocator::release(const WebCore::IntRect&) +{ +} + +int AreaAllocator::overhead() const +{ + return 0; +} + +WebCore::IntSize AreaAllocator::roundAllocation(const WebCore::IntSize& size) const +{ + int width = size.width() + m_margin.width(); + int height = size.height() + m_margin.height(); + int extra = width % m_minAlloc.width(); + if (extra) + width += m_minAlloc.width() - extra; + extra = height % m_minAlloc.height(); + if (extra) + height += m_minAlloc.height() - extra; + + return WebCore::IntSize(width, height); +} + +GeneralAreaAllocator::GeneralAreaAllocator(const WebCore::IntSize& size) + : AreaAllocator(WebCore::nextPowerOfTwo(size)) +{ + m_root = new Node(); + m_root->rect = WebCore::IntRect(0, 0, m_size.width(), m_size.height()); + m_root->largestFree = m_size; + m_root->parent = 0; + m_root->left = 0; + m_root->right = 0; + m_nodeCount = 1; + setMinimumAllocation(WebCore::IntSize(8, 8)); +} + +GeneralAreaAllocator::~GeneralAreaAllocator() +{ + freeNode(m_root); +} + +void GeneralAreaAllocator::freeNode(Node* node) +{ + if (node) { + freeNode(node->left); + freeNode(node->right); + } + delete node; +} + +void GeneralAreaAllocator::expand(const WebCore::IntSize& size) +{ + AreaAllocator::expand(WebCore::nextPowerOfTwo(size)); + + if (m_root->rect.size() == m_size) + return; // No change. + + if (!m_root->left && m_root->largestFree.width() > 0) { + // No allocations have occurred, so just adjust the root size. + m_root->rect = WebCore::IntRect(0, 0, m_size.width(), m_size.height()); + m_root->largestFree = m_size; + return; + } + + // Add extra nodes above the current root to expand the tree. + Node* oldRoot = m_root; + Split split; + if (m_size.width() >= m_size.height()) + split = SplitOnX; + else + split = SplitOnY; + + while (m_root->rect.size() != m_size) { + if (m_root->rect.width() == m_size.width()) + split = SplitOnY; + else if (m_root->rect.height() == m_size.height()) + split = SplitOnX; + Node* parent = new Node(); + Node* right = new Node(); + m_nodeCount += 2; + m_root->parent = parent; + parent->parent = 0; + parent->left = m_root; + parent->right = right; + parent->largestFree = m_root->rect.size(); + right->parent = parent; + right->left = 0; + right->right = 0; + right->largestFree = m_root->rect.size(); + if (split == SplitOnX) { + parent->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y(), + m_root->rect.width() * 2, m_root->rect.height()); + right->rect = WebCore::IntRect(m_root->rect.x() + m_root->rect.width(), m_root->rect.y(), + m_root->rect.width(), m_root->rect.height()); + } else { + parent->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y(), + m_root->rect.width(), m_root->rect.height() * 2); + right->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y() + m_root->rect.width(), + m_root->rect.width(), m_root->rect.height()); + } + split = (split == SplitOnX ? SplitOnY : SplitOnX); + m_root = parent; + } + updateLargestFree(oldRoot); +} + +static inline bool fitsWithin(const WebCore::IntSize& size1, const WebCore::IntSize& size2) +{ + return size1.width() <= size2.width() && size1.height() <= size2.height(); +} + +WebCore::IntRect GeneralAreaAllocator::allocate(const WebCore::IntSize& size) +{ + WebCore::IntSize rounded = roundAllocation(size); + rounded = WebCore::nextPowerOfTwo(rounded); + if (rounded.width() <= 0 || rounded.width() > m_size.width() + || rounded.height() <= 0 || rounded.height() > m_size.height()) + return WebCore::IntRect(); + + WebCore::IntPoint point = allocateFromNode(rounded, m_root); + if (point.x() >= 0) + return WebCore::IntRect(point, size); + return WebCore::IntRect(); +} + +WebCore::IntPoint GeneralAreaAllocator::allocateFromNode(const WebCore::IntSize& size, Node* node) +{ + // Find the best node to insert into, which should be + // a node with the least amount of unused space that is + // big enough to contain the requested size. + while (node) { + // Go down a level and determine if the left or right + // sub-tree contains the best chance of allocation. + Node* left = node->left; + Node* right = node->right; + if (left && fitsWithin(size, left->largestFree)) { + if (right && fitsWithin(size, right->largestFree)) { + if (left->largestFree.width() < right->largestFree.width() + || left->largestFree.height() < right->largestFree.height()) { + // The largestFree values may be a little oversized, + // so try the left sub-tree and then the right sub-tree. + WebCore::IntPoint point = allocateFromNode(size, left); + if (point.x() >= 0) + return point; + return allocateFromNode(size, right); + } + node = right; + } else + node = left; + } else if (right && fitsWithin(size, right->largestFree)) + node = right; + else if (left || right) { + // Neither sub-node has enough space to allocate from. + return WebCore::IntPoint(-1, -1); + } else if (fitsWithin(size, node->largestFree)) { + // Do we need to split this node into smaller pieces? + Split split; + if (fitsWithin(WebCore::IntSize(size.width() * 2, size.height() * 2), node->largestFree)) { + // Split in either direction: choose the inverse of + // the parent node's split direction to try to balance + // out the wasted space as further subdivisions happen. + if (node->parent + && node->parent->left->rect.x() == node->parent->right->rect.x()) + split = SplitOnX; + else if (node->parent) + split = SplitOnY; + else if (node->rect.width() >= node->rect.height()) + split = SplitOnX; + else + split = SplitOnY; + } else if (fitsWithin(WebCore::IntSize(size.width() * 2, size.height()), node->largestFree)) { + // Split along the X direction. + split = SplitOnX; + } else if (fitsWithin(WebCore::IntSize(size.width(), size.height() * 2), node->largestFree)) { + // Split along the Y direction. + split = SplitOnY; + } else { + // Cannot split further - allocate this node. + node->largestFree = WebCore::IntSize(0, 0); + updateLargestFree(node); + return node->rect.location(); + } + + // Split the node, then go around again using the left sub-tree. + node = splitNode(node, split); + } else { + // Cannot possibly fit into this node. + break; + } + } + return WebCore::IntPoint(-1, -1); +} + +GeneralAreaAllocator::Node* GeneralAreaAllocator::splitNode + (Node* node, Split split) +{ + Node* left = new Node(); + Node* right = new Node(); + m_nodeCount += 2; + left->parent = node; + left->left = 0; + left->right = 0; + right->parent = node; + right->left = 0; + right->right = 0; + node->left = left; + node->right = right; + + if (split == SplitOnX) { + left->rect = WebCore::IntRect(node->rect.x(), node->rect.y(), + node->rect.width() / 2, node->rect.height()); + right->rect = WebCore::IntRect(left->rect.maxX(), node->rect.y(), + node->rect.width() / 2, node->rect.height()); + } else { + left->rect = WebCore::IntRect(node->rect.x(), node->rect.y(), + node->rect.width(), node->rect.height() / 2); + right->rect = WebCore::IntRect(node->rect.x(), left->rect.maxY(), + node->rect.width(), node->rect.height() / 2); + } + + left->largestFree = left->rect.size(); + right->largestFree = right->rect.size(); + node->largestFree = right->largestFree; + return left; +} + +void GeneralAreaAllocator::updateLargestFree(Node* node) +{ + while ((node = node->parent)) { + node->largestFree = WebCore::IntSize( + std::max(node->left->largestFree.width(), node->right->largestFree.width()), + std::max(node->left->largestFree.height(), node->right->largestFree.height()) + ); + } +} + +void GeneralAreaAllocator::release(const WebCore::IntRect& rect) +{ + // Locate the node that contains the allocated region. + Node* node = m_root; + WebCore::IntPoint point = rect.location(); + while (node) { + if (node->left && node->left->rect.contains(point)) + node = node->left; + else if (node->right && node->right->rect.contains(point)) + node = node->right; + else if (node->rect.contains(point)) + break; + else + return; // Point is completely outside the tree. + } + if (!node) + return; + + // Mark the node as free and then work upwards through the tree + // recombining and deleting nodes until we reach a sibling + // that is still allocated. + node->largestFree = node->rect.size(); + while (node->parent) { + if (node->parent->left == node) { + if (node->parent->right->largestFree != node->parent->right->rect.size()) + break; + } else { + if (node->parent->left->largestFree != node->parent->left->rect.size()) + break; + } + node = node->parent; + freeNode(node->left); + freeNode(node->right); + m_nodeCount -= 2; + node->left = 0; + node->right = 0; + node->largestFree = node->rect.size(); + } + + // Make the rest of our ancestors have the correct "largest free size". + updateLargestFree(node); +} + +int GeneralAreaAllocator::overhead() const +{ + return m_nodeCount * sizeof(Node); +} + +} // namespace diff --git a/Source/WebKit2/WebProcess/WebPage/AreaAllocator.h b/Source/WebKit2/WebProcess/WebPage/AreaAllocator.h new file mode 100644 index 000000000..ae88716c8 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/AreaAllocator.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2012 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 Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef AreaAllocator_h +#define AreaAllocator_h + +#include <IntPoint.h> +#include <IntRect.h> +#include <IntSize.h> + +namespace WebCore { +inline int nextPowerOfTwo(int number) +{ + // This is a fast trick to get nextPowerOfTwo for an integer. + --number; + number |= number >> 1; + number |= number >> 2; + number |= number >> 4; + number |= number >> 8; + number |= number >> 16; + number++; + return number; +} + +inline IntSize nextPowerOfTwo(const IntSize& size) +{ + return IntSize(nextPowerOfTwo(size.width()), nextPowerOfTwo(size.height())); +} +} // namespace WebCore + +namespace WebKit { + +class AreaAllocator { +public: + AreaAllocator(const WebCore::IntSize&); + virtual ~AreaAllocator(); + + WebCore::IntSize size() const { return m_size; } + + WebCore::IntSize minimumAllocation() const { return m_minAlloc; } + void setMinimumAllocation(const WebCore::IntSize& size) { m_minAlloc = size; } + + WebCore::IntSize margin() const { return m_margin; } + void setMargin(const WebCore::IntSize &margin) { m_margin = margin; } + + virtual void expand(const WebCore::IntSize&); + void expandBy(const WebCore::IntSize&); + + virtual WebCore::IntRect allocate(const WebCore::IntSize&) = 0; + virtual void release(const WebCore::IntRect&); + + virtual int overhead() const; + +protected: + WebCore::IntSize m_size; + WebCore::IntSize m_minAlloc; + WebCore::IntSize m_margin; + + WebCore::IntSize roundAllocation(const WebCore::IntSize&) const; +}; + +class GeneralAreaAllocator : public AreaAllocator { +public: + GeneralAreaAllocator(const WebCore::IntSize&); + virtual ~GeneralAreaAllocator(); + + void expand(const WebCore::IntSize&); + WebCore::IntRect allocate(const WebCore::IntSize&); + void release(const WebCore::IntRect&); + int overhead() const; + +private: + enum Split { SplitOnX, SplitOnY }; + + struct Node { + WebCore::IntRect rect; + WebCore::IntSize largestFree; + Node* parent; + Node* left; + Node* right; + }; + + Node* m_root; + int m_nodeCount; + + static void freeNode(Node*); + WebCore::IntPoint allocateFromNode(const WebCore::IntSize&, Node*); + Node* splitNode(Node*, Split); + static void updateLargestFree(Node*); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp index 26a7ddb29..141d2e603 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp @@ -529,8 +529,10 @@ void CoordinatedGraphicsLayer::syncCanvas() return; #if USE(GRAPHICS_SURFACE) - uint32_t graphicsSurfaceToken = m_canvasPlatformLayer->copyToGraphicsSurface(); - m_CoordinatedGraphicsLayerClient->syncCanvas(m_id, IntSize(size().width(), size().height()), graphicsSurfaceToken); + uint32_t frontBuffer = m_canvasPlatformLayer->copyToGraphicsSurface(); + uint64_t token = m_canvasPlatformLayer->graphicsSurfaceToken(); + + m_CoordinatedGraphicsLayerClient->syncCanvas(m_id, IntSize(size().width(), size().height()), token, frontBuffer); #endif m_canvasNeedsDisplay = false; } diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h index 25ccd9454..f4ea2fb92 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h @@ -62,7 +62,7 @@ public: virtual void syncLayerFilters(WebLayerID, const WebCore::FilterOperations&) = 0; #endif #if PLATFORM(QT) - virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken) = 0; + virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) = 0; #endif virtual void setLayerAnimatedOpacity(WebLayerID, float) = 0; diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp index 7095c438b..a3a572907 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp @@ -298,10 +298,10 @@ void LayerTreeCoordinator::syncLayerChildren(WebLayerID id, const Vector<WebLaye m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerChildren(id, children)); } -void LayerTreeCoordinator::syncCanvas(WebLayerID id, const IntSize& canvasSize, uint32_t graphicsSurfaceToken) +void LayerTreeCoordinator::syncCanvas(WebLayerID id, const IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) { m_shouldSyncFrame = true; - m_webPage->send(Messages::LayerTreeCoordinatorProxy::SyncCanvas(id, canvasSize, graphicsSurfaceToken)); + m_webPage->send(Messages::LayerTreeCoordinatorProxy::SyncCanvas(id, canvasSize, graphicsSurfaceToken, frontBuffer)); } #if ENABLE(CSS_FILTERS) @@ -601,7 +601,7 @@ void LayerTreeCoordinator::renderNextFrame() m_waitingForUIProcess = false; scheduleLayerFlush(); for (int i = 0; i < m_updateAtlases.size(); ++i) - m_updateAtlases[i].didSwapBuffers(); + m_updateAtlases[i]->didSwapBuffers(); } bool LayerTreeCoordinator::layerTreeTileUpdatesAllowed() const @@ -623,18 +623,18 @@ PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(co { OwnPtr<WebCore::GraphicsContext> graphicsContext; for (int i = 0; i < m_updateAtlases.size(); ++i) { - UpdateAtlas& atlas = m_updateAtlases[i]; - if (atlas.flags() == flags) { + UpdateAtlas* atlas = m_updateAtlases[i].get(); + if (atlas->flags() == flags) { // This will return null if there is no available buffer space. - graphicsContext = atlas.beginPaintingOnAvailableBuffer(handle, size, offset); + graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset); if (graphicsContext) return graphicsContext.release(); } } - static const int ScratchBufferDimension = 2000; - m_updateAtlases.append(UpdateAtlas(ScratchBufferDimension, flags)); - return m_updateAtlases.last().beginPaintingOnAvailableBuffer(handle, size, offset); + static const int ScratchBufferDimension = 1024; // Should be a power of two. + m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags))); + return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h index 3fd59d218..c8ef54a68 100644 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h @@ -85,7 +85,7 @@ public: #if ENABLE(CSS_FILTERS) virtual void syncLayerFilters(WebLayerID, const WebCore::FilterOperations&); #endif - virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken) OVERRIDE; + virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer) OVERRIDE; virtual void attachLayer(WebCore::CoordinatedGraphicsLayer*); virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*); virtual void syncFixedLayers(); @@ -123,7 +123,7 @@ private: HashSet<WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; HashMap<int64_t, int> m_directlyCompositedImageRefCounts; - Vector<UpdateAtlas> m_updateAtlases; + Vector<OwnPtr<UpdateAtlas> > m_updateAtlases; bool m_notifyAfterScheduledLayerFlush; bool m_isValid; diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp index 82af01d73..60b9c9744 100644 --- a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp +++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp @@ -105,9 +105,9 @@ void TapHighlightController::drawRect(PageOverlay* pageOverlay, GraphicsContext& { GraphicsContextStateSaver stateSaver(context); if (m_webPage->drawingArea()->pageOverlayShouldApplyFadeWhenPainting()) - context.setFillColor(highlightColor(m_color, pageOverlay->fractionFadedIn()), ColorSpaceSRGB); + context.setFillColor(highlightColor(m_color, pageOverlay->fractionFadedIn() * 0.5f), ColorSpaceSRGB); else - context.setFillColor(m_color, ColorSpaceSRGB); + context.setFillColor(highlightColor(m_color, 0.5f), ColorSpaceSRGB); context.fillPath(m_path); } } diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp index 58869f399..10a35d885 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp @@ -25,6 +25,7 @@ #include "GraphicsContext.h" #include "IntRect.h" #include <wtf/MathExtras.h> + using namespace WebCore; namespace WebKit { @@ -32,112 +33,48 @@ namespace WebKit { UpdateAtlas::UpdateAtlas(int dimension, ShareableBitmap::Flags flags) : m_flags(flags) { - m_surface = ShareableSurface::create(IntSize(dimension, dimension), flags, ShareableSurface::SupportsGraphicsSurface); -} - -static int nextPowerOfTwo(int number) -{ - // This is a fast trick to get nextPowerOfTwo for an integer. - --number; - number |= number >> 1; - number |= number >> 2; - number |= number >> 4; - number |= number >> 8; - number |= number >> 16; - number++; - return number; + IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); + m_surface = ShareableSurface::create(size, flags, ShareableSurface::SupportsGraphicsSurface); } void UpdateAtlas::buildLayoutIfNeeded() { - if (!m_layout.isEmpty()) - return; - - static const int MinTileSize = 32; - static const int MaxTileSize = 512; - - // Divide our square to square power-of-two boxes. - for (int cursor = 0; cursor < size().width(); ) { - int remainder = size().width() - cursor; - int dimension = std::min(remainder, std::min(MaxTileSize, std::max(MinTileSize, nextPowerOfTwo(remainder / 2)))); - cursor += dimension; - m_layout.append(dimension); + if (!m_areaAllocator) { + m_areaAllocator = adoptPtr(new GeneralAreaAllocator(size())); + m_areaAllocator->setMinimumAllocation(IntSize(32, 32)); } - - m_bufferStates.resize(m_layout.size() * m_layout.size()); - for (int i = 0; i < m_bufferStates.size(); ++i) - m_bufferStates[i] = Available; -} - -int UpdateAtlas::findAvailableIndex(const WebCore::IntSize& size) -{ - int dimension = m_layout.size(); - int stride = dimension; - int requiredDimension = std::max(size.width(), size.height()); - - // Begin from the smallest buffer, until we reach the smallest available buffer that's big enough to contain our rect. - for (int i = m_bufferStates.size() - 1; i >= 0; i -= (dimension + 1), --stride) { - // Need a bigger buffer. - if (m_layout[i / dimension] < requiredDimension) - continue; - - // Check all buffers of current size, to find an available one. - for (int offset = 0; offset < stride; ++offset) { - int index = i - offset; - if (m_bufferStates[index] == Available) - return index; - } - } - - return -1; } void UpdateAtlas::didSwapBuffers() { + m_areaAllocator.clear(); buildLayoutIfNeeded(); - for (int i = 0; i < m_bufferStates.size(); ++i) - m_bufferStates[i] = Available; } PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(ShareableSurface::Handle& handle, const WebCore::IntSize& size, IntPoint& offset) { buildLayoutIfNeeded(); - int index = findAvailableIndex(size); + IntRect rect = m_areaAllocator->allocate(size); // No available buffer was found, returning null. - if (index < 0) + if (rect.isEmpty()) return PassOwnPtr<GraphicsContext>(); if (!m_surface->createHandle(handle)) return PassOwnPtr<WebCore::GraphicsContext>(); // FIXME: Use tri-state buffers, to allow faster updates. - m_bufferStates[index] = Taken; - offset = offsetForIndex(index); - IntRect rect(IntPoint::zero(), size); - OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(IntRect(offset, size)); + offset = rect.location(); + OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(rect); if (flags() & ShareableBitmap::SupportsAlpha) { graphicsContext->setCompositeOperation(CompositeCopy); - graphicsContext->fillRect(rect, Color::transparent, ColorSpaceDeviceRGB); + graphicsContext->fillRect(IntRect(IntPoint::zero(), size), Color::transparent, ColorSpaceDeviceRGB); graphicsContext->setCompositeOperation(CompositeSourceOver); } return graphicsContext.release(); } -IntPoint UpdateAtlas::offsetForIndex(int index) const -{ - IntPoint coord(index % m_layout.size(), index / m_layout.size()); - int x = 0; - int y = 0; - for (int i = 0; i < coord.x(); ++i) - x += m_layout[i]; - for (int i = 0; i < coord.y(); ++i) - y += m_layout[i]; - - return IntPoint(x, y); -} - } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h index 7d2223769..774ccfdd3 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h @@ -20,17 +20,20 @@ #ifndef UpdateAtlas_h #define UpdateAtlas_h +#include "AreaAllocator.h" +#include "IntSize.h" #include "ShareableSurface.h" #if USE(COORDINATED_GRAPHICS) namespace WebCore { class GraphicsContext; -class IntRect; +class IntPoint; } namespace WebKit { class UpdateAtlas { + WTF_MAKE_NONCOPYABLE(UpdateAtlas); public: UpdateAtlas(int dimension, ShareableBitmap::Flags); @@ -43,17 +46,9 @@ public: private: void buildLayoutIfNeeded(); - WebCore::IntPoint offsetForIndex(int) const; - int findAvailableIndex(const WebCore::IntSize&); private: - enum State { - Available, - Taken - }; - - Vector<State> m_bufferStates; - Vector<int> m_layout; + OwnPtr<GeneralAreaAllocator> m_areaAllocator; ShareableBitmap::Flags m_flags; RefPtr<ShareableSurface> m_surface; }; diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp index f36fc0238..fd6f4c8d2 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp @@ -63,6 +63,8 @@ #include "IntentData.h" #include <WebCore/DOMWindowIntents.h> #include <WebCore/DeliveredIntent.h> +#include <WebCore/Intent.h> +#include <WebCore/PlatformMessagePortChannel.h> #endif #if PLATFORM(MAC) || PLATFORM(WIN) @@ -246,12 +248,38 @@ void WebFrame::convertHandleToDownload(ResourceHandle* handle, const ResourceReq void WebFrame::deliverIntent(const IntentData& intentData) { OwnPtr<DeliveredIntentClient> dummyClient; - OwnPtr<MessagePortArray> dummyPorts; Vector<uint8_t> dataCopy = intentData.data; + + OwnPtr<WebCore::MessagePortChannelArray> channels; + if (!intentData.messagePorts.isEmpty()) { + channels = adoptPtr(new WebCore::MessagePortChannelArray(intentData.messagePorts.size())); + for (size_t i = 0; i < intentData.messagePorts.size(); ++i) + (*channels)[i] = MessagePortChannel::create(WebProcess::shared().messagePortChannel(intentData.messagePorts.at(i))); + } + OwnPtr<WebCore::MessagePortArray> messagePorts = WebCore::MessagePort::entanglePorts(*m_coreFrame->document()->domWindow()->scriptExecutionContext(), channels.release()); + RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_coreFrame, dummyClient.release(), intentData.action, intentData.type, - SerializedScriptValue::adopt(dataCopy), dummyPorts.release(), + SerializedScriptValue::adopt(dataCopy), messagePorts.release(), intentData.extras); - WebCore::DOMWindowIntents::from(m_coreFrame->domWindow())->deliver(deliveredIntent.release()); + WebCore::DOMWindowIntents::from(m_coreFrame->document()->domWindow())->deliver(deliveredIntent.release()); +} + +void WebFrame::deliverIntent(WebCore::Intent* intent) +{ + OwnPtr<DeliveredIntentClient> dummyClient; + + OwnPtr<WebCore::MessagePortChannelArray> channels; + WebCore::MessagePortChannelArray* origChannels = intent->messagePorts(); + if (origChannels && origChannels->size()) { + channels = adoptPtr(new WebCore::MessagePortChannelArray(origChannels->size())); + for (size_t i = 0; i < origChannels->size(); ++i) + (*channels)[i] = origChannels->at(i).release(); + } + OwnPtr<WebCore::MessagePortArray> messagePorts = WebCore::MessagePort::entanglePorts(*m_coreFrame->document()->domWindow()->scriptExecutionContext(), channels.release()); + + RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_coreFrame, dummyClient.release(), intent->action(), intent->type(), + intent->data(), messagePorts.release(), intent->extras()); + WebCore::DOMWindowIntents::from(m_coreFrame->document()->domWindow())->deliver(deliveredIntent.release()); } #endif @@ -493,7 +521,7 @@ unsigned WebFrame::pendingUnloadCount() const if (!m_coreFrame) return 0; - return m_coreFrame->domWindow()->pendingUnloadEventListeners(); + return m_coreFrame->document()->domWindow()->pendingUnloadEventListeners(); } bool WebFrame::allowsFollowingLink(const WebCore::KURL& url) const diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h index bd6c038ee..eea09b74a 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h @@ -42,6 +42,9 @@ namespace WebCore { class Frame; class HTMLFrameOwnerElement; +#if ENABLE(WEB_INTENTS) + class Intent; +#endif class KURL; } @@ -81,6 +84,7 @@ public: #if ENABLE(WEB_INTENTS) void deliverIntent(const IntentData&); + void deliverIntent(WebCore::Intent*); #endif String source() const; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 59617dfd3..947a06a43 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -140,6 +140,7 @@ #if ENABLE(WEB_INTENTS) #include "IntentData.h" +#include <WebCore/Intent.h> #endif #if ENABLE(VIBRATION) @@ -432,8 +433,8 @@ PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* plu bool blocked; if (!WebProcess::shared().connection()->sendSync( - Messages::WebContext::GetPluginPath(parameters.mimeType, parameters.url.string()), - Messages::WebContext::GetPluginPath::Reply(pluginPath, blocked), 0)) { + Messages::WebProcessProxy::GetPluginPath(parameters.mimeType, parameters.url.string()), + Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0)) { return 0; } @@ -484,7 +485,7 @@ EditorState WebPage::editorState() const size_t location = 0; size_t length = 0; - Element* selectionRoot = frame->selection()->rootEditableElement(); + Element* selectionRoot = frame->selection()->rootEditableElementRespectingShadowTree(); Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement(); if (!scope) @@ -1114,7 +1115,9 @@ void WebPage::setFixedLayoutSize(const IntSize& size) return; view->setFixedLayoutSize(size); - view->forceLayout(); + // Do not force it until the first layout, this would then become our first layout prematurely. + if (view->didFirstLayout()) + view->forceLayout(); } void WebPage::setPaginationMode(uint32_t mode) @@ -1224,7 +1227,11 @@ PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, dou if (options & SnapshotOptionsExcludeSelectionHighlighting) shouldPaintSelection = FrameView::ExcludeSelection; - frameView->paintContentsForSnapshot(graphicsContext.get(), rect, shouldPaintSelection); + FrameView::CoordinateSpaceForSnapshot coordinateSpace = FrameView::DocumentCoordinates; + if (options & SnapshotOptionsInViewCoordinates) + coordinateSpace = FrameView::ViewCoordinates; + + frameView->paintContentsForSnapshot(graphicsContext.get(), rect, shouldPaintSelection, coordinateSpace); return snapshot.release(); } @@ -1959,6 +1966,12 @@ void WebPage::deliverIntentToFrame(uint64_t frameID, const IntentData& intentDat frame->deliverIntent(intentData); } + +void WebPage::deliverCoreIntentToFrame(uint64_t frameID, Intent* coreIntent) +{ + if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) + frame->deliverIntent(coreIntent); +} #endif void WebPage::preferencesDidChange(const WebPreferencesStore& store) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index bbfabd04a..ec5af0e96 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -106,6 +106,9 @@ namespace WebCore { class Frame; class FrameView; class HTMLPlugInElement; +#if ENABLE(WEB_INTENTS) + class Intent; +#endif class KeyboardEvent; class Page; class PrintContext; @@ -476,7 +479,7 @@ public: #endif #if ENABLE(WEB_INTENTS) - void deliverIntentToFrame(uint64_t frameID, const IntentData&); + void deliverCoreIntentToFrame(uint64_t frameID, WebCore::Intent*); #endif void replaceSelectionWithText(WebCore::Frame*, const String&); @@ -641,6 +644,10 @@ private: void contextMenuHidden() { m_isShowingContextMenu = false; } #endif +#if ENABLE(WEB_INTENTS) + void deliverIntentToFrame(uint64_t frameID, const IntentData&); +#endif + static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity); static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity); diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 6eb8ab7ee..1490ff3ca 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -80,6 +80,10 @@ #include <wtf/PassRefPtr.h> #include <wtf/RandomNumber.h> +#if ENABLE(WEB_INTENTS) +#include <WebCore/PlatformMessagePortChannel.h> +#endif + #if ENABLE(NETWORK_INFO) #include "WebNetworkInfoManagerMessages.h" #endif @@ -311,6 +315,7 @@ void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing) void WebProcess::userPreferredLanguagesChanged(const Vector<String>& languages) const { overrideUserPreferredLanguages(languages); + languageDidChange(); } void WebProcess::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled) @@ -791,12 +796,32 @@ WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData& pageGroupDat return result.iterator->second.get(); } +#if ENABLE(WEB_INTENTS) +uint64_t WebProcess::addMessagePortChannel(PassRefPtr<PlatformMessagePortChannel> messagePortChannel) +{ + static uint64_t channelID = 0; + m_messagePortChannels.add(++channelID, messagePortChannel); + + return channelID; +} + +PlatformMessagePortChannel* WebProcess::messagePortChannel(uint64_t channelID) +{ + return m_messagePortChannels.get(channelID).get(); +} + +void WebProcess::removeMessagePortChannel(uint64_t channelID) +{ + m_messagePortChannels.remove(channelID); +} +#endif + static bool canPluginHandleResponse(const ResourceResponse& response) { String pluginPath; bool blocked; - if (!WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebContext::GetPluginPath::Reply(pluginPath, blocked), 0)) + if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebProcessProxy::GetPluginPath::Reply(pluginPath, blocked), 0)) return false; return !blocked && !pluginPath.isEmpty(); @@ -855,7 +880,7 @@ void WebProcess::getSitesWithPluginData(const Vector<String>& pluginPaths, uint6 Vector<String> sites; copyToVector(sitesSet, sites); - connection()->send(Messages::WebContext::DidGetSitesWithPluginData(sites, callbackID), 0); + connection()->send(Messages::WebProcessProxy::DidGetSitesWithPluginData(sites, callbackID), 0); } void WebProcess::clearPluginSiteData(const Vector<String>& pluginPaths, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID) @@ -879,7 +904,7 @@ void WebProcess::clearPluginSiteData(const Vector<String>& pluginPaths, const Ve } #endif - connection()->send(Messages::WebContext::DidClearPluginSiteData(callbackID), 0); + connection()->send(Messages::WebProcessProxy::DidClearPluginSiteData(callbackID), 0); } #endif @@ -981,9 +1006,7 @@ void WebProcess::getWebCoreStatistics(uint64_t callbackID) data.statisticsNumbers.set("CachedFontDataInactiveCount", fontCache()->inactiveFontDataCount()); // Gather glyph page statistics. -#if !(PLATFORM(QT) && !HAVE(QRAWFONT)) // Qt doesn't use the glyph page tree currently. See: bug 63467. data.statisticsNumbers.set("GlyphPageCount", GlyphPageTreeNode::treeGlyphPageCount()); -#endif // Get WebCore memory cache statistics getWebCoreMemoryCacheStatistics(data.webCoreCacheStatistics); diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index 0d005a4b7..d3df1b778 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -78,6 +78,9 @@ QT_END_NAMESPACE namespace WebCore { class IntSize; class PageGroup; +#if ENABLE(WEB_INTENTS) + class PlatformMessagePortChannel; +#endif class ResourceRequest; class ResourceResponse; } @@ -112,7 +115,13 @@ public: void createWebPage(uint64_t pageID, const WebPageCreationParameters&); void removeWebPage(uint64_t pageID); WebPage* focusedWebPage() const; - + +#if ENABLE(WEB_INTENTS) + uint64_t addMessagePortChannel(PassRefPtr<WebCore::PlatformMessagePortChannel>); + WebCore::PlatformMessagePortChannel* messagePortChannel(uint64_t); + void removeMessagePortChannel(uint64_t); +#endif + InjectedBundle* injectedBundle() const { return m_injectedBundle.get(); } bool isSeparateProcess() const; @@ -300,6 +309,10 @@ private: HashMap<uint64_t, WebFrame*> m_frameMap; +#if ENABLE(WEB_INTENTS) + HashMap<uint64_t, RefPtr<WebCore::PlatformMessagePortChannel> > m_messagePortChannels; +#endif + HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomRepresentations; TextCheckerState m_textCheckerState; diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in index 0f83d5bc1..22716cea5 100644 --- a/Source/WebKit2/WebProcess/WebProcess.messages.in +++ b/Source/WebKit2/WebProcess/WebProcess.messages.in @@ -27,6 +27,10 @@ messages -> WebProcess { # Create a new page. CreateWebPage(uint64_t newPageID, WebKit::WebPageCreationParameters pageCreationParameters) +#if ENABLE(WEB_INTENTS) + RemoveMessagePortChannel(uint64_t channelID); +#endif + # Visited link tracking. SetVisitedLinkTable(WebKit::SharedMemory::Handle handle) VisitedLinkStateChanged(Vector<WebCore::LinkHash> linkHashes) diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp index d8d0167f3..24ca203a7 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp @@ -31,6 +31,7 @@ #include "WebProcessCreationParameters.h" #include <WebCore/FileSystem.h> +#include <WebCore/Language.h> #include <WebCore/MemoryCache.h> #include <WebCore/NotImplemented.h> #include <WebCore/PageCache.h> @@ -38,6 +39,8 @@ #include <libsoup/soup-cache.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> #if !OS(WINDOWS) #include <unistd.h> @@ -113,9 +116,62 @@ void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE))); } -void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*) +// This function is based on Epiphany code in ephy-embed-prefs.c. +static CString buildAcceptLanguages(Vector<String> languages) { - notImplemented(); + // Ignore "C" locale. + size_t position = languages.find("c"); + if (position != notFound) + languages.remove(position); + + // Fallback to "en" if the list is empty. + if (languages.isEmpty()) + return "en"; + + // Calculate deltas for the quality values. + int delta; + if (languages.size() < 10) + delta = 10; + else if (languages.size() < 20) + delta = 5; + else + delta = 1; + + // Set quality values for each language. + StringBuilder builder; + for (size_t i = 0; i < languages.size(); ++i) { + if (i) + builder.append(", "); + + builder.append(languages[i]); + + int quality = 100 - i * delta; + if (quality > 0 && quality < 100) { + char buffer[8]; + g_ascii_formatd(buffer, 8, "%.2f", quality / 100.0); + builder.append(String::format(";q=%s", buffer)); + } + } + + return builder.toString().utf8(); +} + +static void setSoupSessionAcceptLanguage(Vector<String> languages) +{ + g_object_set(WebCore::ResourceHandle::defaultSession(), "accept-language", buildAcceptLanguages(languages).data(), NULL); +} + +static void languageChanged(void*) +{ + setSoupSessionAcceptLanguage(WebCore::userPreferredLanguages()); +} + +void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder*) +{ + if (!parameters.languages.isEmpty()) + setSoupSessionAcceptLanguage(parameters.languages); + + WebCore::addLanguageChangeObserver(this, languageChanged); } void WebProcess::platformTerminate() @@ -124,6 +180,8 @@ void WebProcess::platformTerminate() SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); soup_cache_flush(cache); soup_cache_dump(cache); + + WebCore::removeLanguageChangeObserver(this); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm index 7e926ad3a..35a85a780 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -110,6 +110,10 @@ int WebProcessMainXPC(xpc_connection_t xpcConnection, mach_port_t serverPort) int WebProcessMain(const CommandLine& commandLine) { + // Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by + // the WebProcess don't try to insert the shim and crash. + EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib"); + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; String serviceName = commandLine["servicename"]; diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index dea36ed90..12c1f3033 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -181,6 +181,7 @@ EXPORTS ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z ?getHighlight@InspectorController@WebCore@@QBEXPAUHighlight@2@@Z ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z + ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B ?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@CAPAVInstrumentingAgents@2@PAVPage@2@@Z ?isActiveInsertionPoint@WebCore@@YA_NPBVNode@1@@Z @@ -207,9 +208,11 @@ EXPORTS ?removedLastRef@Node@WebCore@@AAEXXZ ?reverseFind@StringImpl@WTF@@QAEI_WI@Z ?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA + ?saveDocumentAndScrollState@HistoryController@WebCore@@QAEXXZ ?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ ?scriptNameToCode@WebCore@@YA?AW4UScriptCode@@ABVString@WTF@@@Z ?scrollElementToRect@FrameView@WebCore@@QAEXPAVElement@2@ABVIntRect@2@@Z + ?setCanStartMedia@Page@WebCore@@QAEX_N@Z ?setCursiveFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z ?setDeviceScaleFactor@Page@WebCore@@QAEXM@Z ?setDocumentState@HistoryItem@WebCore@@QAEXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z |