diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
commit | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch) | |
tree | c88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebKit2 | |
parent | be01689f43cf6882cf670d33df49ead1f570c53a (diff) | |
download | qtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz |
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage
of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebKit2')
91 files changed, 2293 insertions, 1066 deletions
diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 9fe432aa7..3c1571067 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -41,6 +41,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBKIT2_DIR}/WebProcess/WebCoreSupport" "${WEBKIT2_DIR}/WebProcess/WebPage" "${WEBCORE_DIR}" + "${WEBCORE_DIR}/Modules/intents" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings/js" "${WEBCORE_DIR}/bindings" @@ -51,6 +52,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/editing" "${WEBCORE_DIR}/history" "${WEBCORE_DIR}/html" + "${WEBCORE_DIR}/html/track" "${WEBCORE_DIR}/inspector" "${WEBCORE_DIR}/loader" "${WEBCORE_DIR}/loader/icon" @@ -492,6 +494,16 @@ SET(WebKit2_MESSAGES_IN_FILES WebProcess/WebPage/WebPage.messages.in ) +SET(WebProcess_NAME bin/WebProcess) + +SET(WebProcess_LIBRARIES + ${JavaScriptCore_LIBRARY_NAME} + ${WebCore_LIBRARY_NAME} + ${WebKit2_LIBRARY_NAME} +) + +WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() + # Create JavaScript C++ code given an IDL input FOREACH (_file ${WebKit2_MESSAGES_IN_FILES}) GET_FILENAME_COMPONENT (_name ${_file} NAME_WE) @@ -510,19 +522,6 @@ SET(WebKit2_LIBRARIES ${WebCore_LIBRARY_NAME} ) -SET(WebProcess_NAME ../bin/WebProcess) -SET(WebProcess_SOURCES "") - -SET(WebProcess_LIBRARIES - ${JavaScriptCore_LIBRARY_NAME} - ${WebCore_LIBRARY_NAME} - ${WebKit2_LIBRARY_NAME} -) - -SET(ForwardingHeaders_NAME ) -SET(ForwardingNetworkHeaders_NAME ) -WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() - ADD_DEFINITIONS(-DBUILDING_WEBKIT) INCLUDE_DIRECTORIES(${WebKit2_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebKit2_LIBRARY_NAME} ${WebKit2_LIBRARY_TYPE} ${WebKit2_SOURCES}) @@ -537,6 +536,7 @@ SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES LINK_INTERFACE_LIBRARIE ADD_EXECUTABLE(${WebProcess_NAME} ${WebProcess_SOURCES}) TARGET_LINK_LIBRARIES(${WebProcess_NAME} ${WebProcess_LIBRARIES}) SET_TARGET_PROPERTIES(${WebProcess_NAME} PROPERTIES FOLDER "WebKit") +SET_TARGET_PROPERTIES(${WebProcess_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") SET_TARGET_PROPERTIES(${WebKit2_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) IF (WebKit2_LINK_FLAGS) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 9c8efa89e..2dd830c1c 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,822 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Reviewed by Ryosuke Niwa. + + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::requestCheckingOfString): + * WebProcess/WebCoreSupport/WebEditorClient.h: + +2012-05-31 Andy Estes <aestes@apple.com> + + [WebKit2] Remove nested #if conditions from messages.in files + https://bugs.webkit.org/show_bug.cgi?id=88039 + + Reviewed by Filip Pizlo. + + The code generator that processes messages.in files can't handle nested + #if conditions. Sadly I added said conditions in r117700 but failed to + verify the generated result. Un-nest the conditions I added. + + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebPage/WebPage.messages.in: + +2012-05-31 Andy Estes <aestes@apple.com> + + Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC) + https://bugs.webkit.org/show_bug.cgi?id=87933 + + Reviewed by Dan Bernstein. + + * WebProcess/WebCoreSupport/WebEditorClient.h: + * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_download_get_request to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=87957 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitDownload.cpp: + (webkit_download_get_request): Return the WebKitURIRequest + representing the request that originated the download. + * UIProcess/API/gtk/WebKitDownload.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol. + * UIProcess/API/gtk/tests/TestDownloads.cpp: + (testDownloadLocalFile): + (testDownloadRemoteFile): + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [SOUP] WebProcess crashes when a download is started from an existing ResourceHandle + https://bugs.webkit.org/show_bug.cgi?id=87953 + + Reviewed by Martin Robinson. + + The output stream to write the downloaded data is created in the + didReceiveResponse callback of the download client. When a + download is created for an existing ResourceHandle (this happens + for example when policy decision is download), the response has + already been received. In this case we should make sure that the + download client is notified about the response, so that when data + actually arrives the output stream has already been created. + + * WebProcess/Downloads/soup/DownloadSoup.cpp: + (WebKit::Download::startWithHandle): + +2012-05-31 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix webkit_web_view_can_execute_editing_command() API doc + https://bugs.webkit.org/show_bug.cgi?id=87930 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: + +2012-05-31 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5) + https://bugs.webkit.org/show_bug.cgi?id=87955 + + Reviewed by Simon Hausmann. + + * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp: + +2012-05-31 Zalan Bujtas <zbujtas@gmail.com> + + [Qt][WK2] Add missing ViewportUpdateDeferrer guarding to setPageItemRectVisible() calls. + https://bugs.webkit.org/show_bug.cgi?id=87936 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::viewportAttributesChanged): + (WebKit::QtViewportInteractionEngine::pageContentsSizeChanged): + +2012-05-31 Keunsoon Lee <keunsoon.lee@samsung.com> + + [EFL][WK2] Add WKURLRequestEfl and WKURLResponseEfl + https://bugs.webkit.org/show_bug.cgi?id=70231 + + Reviewed by Chang Shu. + + These codes can be used for WKPageDecidePolicyForResponseCallback on page policy callbacks. + The callback conveys WKURLResponseRef and WKURLRequestRef as parameter. + + By the way, EFL browser needs content type from response to decide correct policy. + Another information, cookie, is necessary with similar reason. + But, there is no way to obtain such information on WebKit2 main stream, except for WKURLRequestCopyURL(). + + So, EFL port created those files to extract necessary information from WKURLResponseRef and WKURLRequestRef, + and not to desturb WebKit2 main stream. + + * Shared/API/c/efl/WKURLRequestEfl.cpp: Added. + (WKURLRequestEflCopyCookies): extracting cookie information from WKURLRequestRef. + * Shared/API/c/efl/WKURLRequestEfl.h: Added. + * Shared/API/c/efl/WKURLResponseEfl.cpp: Added. + (WKURLResponseEflCopyContentType): extracting content type (i.e. MIME type) from WKURLResponseRef. + * Shared/API/c/efl/WKURLResponseEfl.h: Added. + * Shared/efl/WebCoreArgumentCodersEfl.cpp: Added. + (CoreIPC): + (CoreIPC::::encode): + (CoreIPC::::decode): + * Shared/efl/WebURLRequestEfl.cpp: Added. + (WebKit): + (WebKit::WebURLRequestEfl::WebURLRequestEfl): + (WebKit::WebURLRequestEfl::cookies): obtaining cookie information from ResourceRequest. + * Shared/efl/WebURLRequestEfl.h: Added. + (WebKit): + (WebURLRequestEfl): + (WebKit::WebURLRequestEfl::create): + * Shared/efl/WebURLResponseEfl.cpp: Added. + (WebKit): + (WebKit::WebURLResponseEfl::WebURLResponseEfl): + (WebKit::WebURLResponseEfl::contentType): obtaining content type (i.e. MIME type) from ResourceResponse. + * Shared/efl/WebURLResponseEfl.h: Added. + (WebKit): + (WebURLResponseEfl): + (WebKit::WebURLResponseEfl::create): + +2012-05-31 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL][WK2] Rename ewk_private.h to ewk_view_private.h + https://bugs.webkit.org/show_bug.cgi?id=87923 + + Reviewed by Kenneth Rohde Christiansen. + + EFL WK1 decided to divide up ewk_private.h into each file's XXX_private.h file in order to maintain + internal functions more easily. EFL WK2 needs to adjust this as well. + + * UIProcess/API/efl/PageClientImpl.cpp: + * UIProcess/API/efl/ewk_view_private.h: Renamed from Source/WebKit2/UIProcess/API/efl/ewk_private.h. + (WebCore): + * UIProcess/cairo/BackingStoreCairo.cpp: + +2012-05-31 Andy Estes <aestes@apple.com> + + Move the specification of framework and library linking out of WebKit2.xcodeproj and into WebKit2.xcconfig + https://bugs.webkit.org/show_bug.cgi?id=87932 + + Reviewed by Dan Bernstein. + + Doing this makes it easier to vary linking based on SDK or other factors. + + * Configurations/WebKit2.xcconfig: Create FRAMEWORK_AND_LIBRARY_LDFLAGS, + which specifies the same list of frameworks and libraries that were + previously in WebKit2's 'Link Binary With Libraries' build phase, and + append it to $(OTHER_LDFLAGS). + * WebKit2.xcodeproj/project.pbxproj: Remove all frameworks and + libraries from the 'Link Binary With Libraries' build phase. + +2012-05-30 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Memory leak in webkitWebViewBaseStartDrag + https://bugs.webkit.org/show_bug.cgi?id=87756 + + Reviewed by Carlos Garcia Campos. + + Fixed memory leaks in drag and drop by using adoptRef instead + of just getting new references. + + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (webkitWebViewBaseStartDrag): + +2012-05-30 Luiz Agostini <luiz.agostini@nokia.com> + + [Qt] handled touchmove events should not cancel tap gesture recognition + https://bugs.webkit.org/show_bug.cgi?id=87808 + + Reviewed by Kenneth Rohde Christiansen. + + Tap gesture recognition should not be canceled if a touchmove event is handled + by the web process. + + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::doneWithTouchEvent): + +2012-05-30 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK][WK2] Errors in documentation about webkit_web_view_run_javascript() + https://bugs.webkit.org/show_bug.cgi?id=87866 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: Fix errors. + +2012-05-30 Andy Estes <aestes@apple.com> + + WebProcessMainMac.mm doesn't need to import WKView.h. + + Rubber-stamped by Anders Carlsson. + + * WebProcess/mac/WebProcessMainMac.mm: + +2012-05-30 Marcelo Lira <marcelo.lira@openbossa.org> + + WebKit2: Implement layoutTestController.setPluginsEnabled() in WebKitTestRunner. + https://bugs.webkit.org/show_bug.cgi?id=58593 + + Adds the ability to change the pluginsEnabled flag in WebCore::Settings + to WebKitTestRunner's LayoutTestController. The flag is modified via the + public C API of the WebProcess. + + Reviewed by Darin Adler. + + * WebProcess/InjectedBundle/API/c/WKBundle.cpp: + (WKBundleSetPluginsEnabled): + * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::setPluginsEnabled): Calls the setPluginsEnabled + method for the WebCore::Settings of each WebCore::Page in the current + page group. + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + +2012-05-30 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + HashTable.h has using directives for std::pair and std::make_pair + https://bugs.webkit.org/show_bug.cgi?id=29919 + + Reviewed by Darin Adler. + + Change code to use std::pair and std::make_pair. + + * UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm: + (WebKit::DynamicLinkerEnvironmentExtractor::processEnvironmentVariable): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::postMessageToInjectedBundle): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed: Fix wrongly typed Qt slot. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Move ViewportAttribute related methods to the interaction engine. + https://bugs.webkit.org/show_bug.cgi?id=87855 + + Reviewed by Simon Hausmann. + + Move the logic of didChange{ViewportProperties|ContentsSize} to the + interaction engine and update our testing object. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate): + (QQuickWebViewFlickablePrivate::didChangeViewportProperties): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/qwebkittest.cpp: + (QWebKitTest::contentsScale): + (QWebKitTest::devicePixelRatio): + (QWebKitTest::initialScale): + (QWebKitTest::minimumScale): + (QWebKitTest::maximumScale): + (QWebKitTest::isScalable): + (QWebKitTest::layoutSize): + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::viewportAttributesChanged): + (WebKit): + (WebKit::QtViewportInteractionEngine::pageContentsSizeChanged): + * UIProcess/qt/QtViewportInteractionEngine.h: + (QtViewportInteractionEngine): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Do renames in ViewportInteractionEngine as agreed upon + https://bugs.webkit.org/show_bug.cgi?id=87845 + + Reviewed by Simon Hausmann. + + Mostly moving methods around and renaming them to be more + consistent and avoid terminology clashes. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewFlickablePrivate::didChangeViewportProperties): + (QQuickWebViewFlickablePrivate::pageDidRequestScroll): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::boundPosition): + (WebKit): + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + (WebKit::QtViewportInteractionEngine::setPageItemRectVisible): + (WebKit::QtViewportInteractionEngine::animatePageItemRectVisible): + (WebKit::QtViewportInteractionEngine::flickMoveStarted): + (WebKit::QtViewportInteractionEngine::flickMoveEnded): + (WebKit::QtViewportInteractionEngine::pageItemPositionChanged): + (WebKit::QtViewportInteractionEngine::pageContentPositionRequest): + (WebKit::QtViewportInteractionEngine::scaleAnimationValueChanged): + (WebKit::QtViewportInteractionEngine::computePosRangeForPageItemAtScale): + (WebKit::QtViewportInteractionEngine::focusEditableArea): + (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded): + (WebKit::QtViewportInteractionEngine::nearestValidBounds): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::pinchGestureEnded): + (WebKit::QtViewportInteractionEngine::pageItemSizeChanged): + * UIProcess/qt/QtViewportInteractionEngine.h: + (WebKit::QtViewportInteractionEngine::setDevicePixelRatio): + (QtViewportInteractionEngine): + +2012-05-30 Mariusz Grzegorczyk <mariusz.g@samsung.com>, Ryuan Choi <ryuan.choi@samsung.com> + + [EFL][WK2] Fix WebKit2-EFL build + https://bugs.webkit.org/show_bug.cgi?id=83693 + + Reviewed by Carlos Garcia Campos. + + * CMakeLists.txt: Move IDL generator codes to generate port specific *.messages.in. + * PlatformEfl.cmake: Add soup related files after r115411 and includes to fix build break. + * UIProcess/API/efl/PageClientImpl.cpp: Fix build break with ENABLE_TOUCH_EVENTS. + (WebKit): + (WebKit::PageClientImpl::doneWithTouchEvent): + * UIProcess/API/efl/PageClientImpl.h: + (PageClientImpl): + * WebProcess/WebCoreSupport/WebChromeClient.cpp: Fix build break with ENABLE_INPUT_TYPE_COLOR and ENABLE_REGISTER_PROTOCOL_HANDLER. + (WebKit): + (WebKit::WebChromeClient::createColorChooser): + * WebProcess/WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Fix build break with ENABLE_WEB_INTENTS + (WebKit): + (WebKit::WebFrameLoaderClient::dispatchIntent): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + (WebCore): + (WebFrameLoaderClient): + * WebProcess/WebProcess.cpp: Guard PLATFORM_STRATEGIES codes. + (WebKit::WebProcess::didGetPlugins): + * WebProcess/soup/WebSoupRequestManager.cpp: Try to share with EFL port. + (WebKit::WebSoupRequestManager::didHandleURIRequest): + +2012-05-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Variable renaming as preparation of further refactoring. + + Rubberstamped by Simon Hausmann. + + Change m_viewport to m_viewportItem and m_content to m_pageItem. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine): + (WebKit::QtViewportInteractionEngine::setItemRectVisible): + (WebKit::QtViewportInteractionEngine::animateItemRectVisible): + (WebKit::QtViewportInteractionEngine::flickableMoveStarted): + (WebKit::QtViewportInteractionEngine::flickableMoveEnded): + (WebKit::QtViewportInteractionEngine::flickableMovingPositionUpdate): + (WebKit::QtViewportInteractionEngine::scaleAnimationStateChanged): + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + (WebKit::QtViewportInteractionEngine::computePosRangeForItemAtScale): + (WebKit::QtViewportInteractionEngine::focusEditableArea): + (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded): + (WebKit::QtViewportInteractionEngine::nearestValidBounds): + (WebKit::QtViewportInteractionEngine::reset): + (WebKit::QtViewportInteractionEngine::setCSSScale): + (WebKit::QtViewportInteractionEngine::currentCSSScale): + (WebKit::QtViewportInteractionEngine::scrollAnimationActive): + (WebKit::QtViewportInteractionEngine::panGestureActive): + (WebKit::QtViewportInteractionEngine::panGestureStarted): + (WebKit::QtViewportInteractionEngine::panGestureRequestUpdate): + (WebKit::QtViewportInteractionEngine::panGestureEnded): + (WebKit::QtViewportInteractionEngine::panGestureCancelled): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::pinchGestureStarted): + (WebKit::QtViewportInteractionEngine::pinchGestureRequestUpdate): + (WebKit::QtViewportInteractionEngine::scaleContent): + * UIProcess/qt/QtViewportInteractionEngine.h: + (QtViewportInteractionEngine): + +2012-05-30 Zalan Bujtas <zbujtas@gmail.com> + + [Qt][WK2] Do not use anonymous variables for ViewportUpdateDeferrer. + https://bugs.webkit.org/show_bug.cgi?id=87831 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + (WebKit::QtViewportInteractionEngine::itemSizeChanged): + +2012-05-30 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix WebKit2GTK+ API tests in the bots. + + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewCanShowMIMEType): Remove the check for multimedia and + plugins MIME types since they depend on the configuration and they + are not available in the bots. + +2012-05-29 Jer Noble <jer.noble@apple.com> + + Noticeable delay taking an HTML5 trailer fullscreen. + https://bugs.webkit.org/show_bug.cgi?id=87794 + + Reviewed by Darin Adler. + + Work around a not-entirely understood delay when using the results of a CGWindowListCreateImage() + call as the contents of a placeholder view. The backing of the resulting CGImageRef resides on + the WindowServer, and drawing that image requires synchronous calls to the WindowServer process. + By copying the image data, up front, into our own process, we can avoid those synchronous calls + later and avoid the delay-causing drawing behavior. + + * UIProcess/mac/WKFullScreenWindowController.mm: + (CGImageDeepCopy): Added a helper function which copies the image data into a new CGImage. + (-[WKFullScreenWindowController enterFullScreen:]): Use the above. + +2012-05-29 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> + + [GTK] [WK2] Reproducible crash in performDragControllerAction + https://bugs.webkit.org/show_bug.cgi?id=87744 + + Reviewed by Martin Robinson. + + Fix a crash by using deref() instead of delete to dereference and + release the platformData of DragData. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::performDragControllerAction): + +2012-05-29 Simon Pena <spena@igalia.com> + + [GTK] Missing field initializers for WKPageLoaderClient and WKPageUIClient + https://bugs.webkit.org/show_bug.cgi?id=87745 + + Reviewed by Carlos Garcia Campos. + + Add missing initializers for WKPageLoaderClient and + WKPageUIClient, for callbacks WKPagePluginDidFailCallback and + WKPageUnavailablePluginButtonClickedCallback, introduced in + revision r116716. + + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (attachLoaderClientToView): Initialize WKPagePluginDidFailCallback + * UIProcess/API/gtk/WebKitUIClient.cpp: + (attachUIClientToView): Initialize callback + WKPageUnavailablePluginButtonClickedCallback + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Policy decision headers are not included in the main webkit2.h header + https://bugs.webkit.org/show_bug.cgi?id=87753 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/webkit2.h: Include + WebKitNavigationPolicyDecision.h and WebKitResponsePolicyDecision.h. + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_web_view_can_show_mime_type() to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=85998 + + Reviewed by Martin Robinson. + + And use it in the default handler of WebKitWebView::decide-policy + signal to decide whether to use or ignore a response policy + decision depending on whether the mime type of the response can be + displayed in the WebView or not. + + * UIProcess/API/gtk/WebKitURIResponse.cpp: + (webkitURIResponseGetProperty): Add getter for mime-type property. + (webkit_uri_response_class_init): Add mime-type property. + (webkit_uri_response_get_mime_type): Return the mime type of the + response. + * UIProcess/API/gtk/WebKitURIResponse.h: + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewDecidePolicy): In case of response policy decisions, + use the URI response to decide what to do: download if the + response is an attachment, use if the mime type is supported by + the web view or ignore otherwise. + (webkit_web_view_can_show_mime_type): Returns whether the given + mime type can be displayed in the WebView or not. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/TestResources.cpp: + (testWebResourceResponse): + (testWebResourceMimeType): + (serverCallback): + (beforeAll): + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewCanShowMIMEType): + (beforeAll): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt] Move tests from DesktopBehavior which can be made to work + https://bugs.webkit.org/show_bug.cgi?id=87736 + + Rubberstamped by Simon Hausmann. + + Move and modify the following tests to WebView/ and make them + use touch events. + + * UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml. + * UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml. + +2012-05-29 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Sync up favicon-implementation with WebView url changes in r118158 + + https://bugs.webkit.org/show_bug.cgi?id=87133 + + We now base64-encode the page url in the image-provider url, so that any + normalization done by QUrl will not mess up the page-url. The logic of + creating and parsing the provider-url has been moved into the image + provider, to keep it in one place. + + We were also releasing icons (even ones we hadn't retained), which we can't + do since we don't know when the icon url is no longer in use. + + Reviewed-by Simon Hausmann. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): + (QQuickWebViewPrivate::loadProgressDidChange): + (QQuickWebViewPrivate::_q_onUrlChanged): + (QQuickWebViewPrivate::_q_onIconChangedForPageURL): + (QQuickWebViewPrivate::updateIcon): + (QQuickWebView::icon): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/qwebiconimageprovider.cpp: + (QWebIconImageProvider::iconURLForPageURLInContext): + (QWebIconImageProvider::requestImage): + * UIProcess/API/qt/qwebiconimageprovider_p.h: + (WebKit): + * UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml: + * UIProcess/qt/QtWebIconDatabaseClient.cpp: + (WebKit::QtWebIconDatabaseClient::didChangeIconForPageURL): + (WebKit::QtWebIconDatabaseClient::iconForPageURL): + (WebKit): + (WebKit::QtWebIconDatabaseClient::iconImageForPageURL): + * UIProcess/qt/QtWebIconDatabaseClient.h: + (QtWebIconDatabaseClient): + +2012-05-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Qt][WK2] Fix failing qmltests::FitToView::test_basic() + https://bugs.webkit.org/show_bug.cgi?id=87236 + + Reviewed by Simon Hausmann. + + The fix is a combination of things. First of all some events + were emitted at the wrong times or when nothing had changed. + + We also initialized the view saying it was suspended which is + not correct. + + Another bug was that the touch tap, didn't result in marking + the view as having user interaction. This was recently fixed + in r118493. + + * UIProcess/API/qt/qquickwebpage.cpp: + (QQuickWebPage::setContentsScale): + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate): + + Make sure pageIsSuspended is initialized to false. + + (QQuickWebViewFlickablePrivate::_q_onInformVisibleContentChange): + + Early bail out if there is no change. + + Inform contentScaleCommitted if the scale changed since last time. + + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + + Make sure to commit the right signals, ie. *Changed and not *Committed. + + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qwebkittest.cpp: + (touchPoint): + (QWebKitTest::sendTouchEvent): + (QWebKitTest::touchTap): + (QWebKitTest::touchDoubleTap): + + Add proper touch emulation for the testing system. Call directly + to our WebKit API (avoid Qt event loop) to ensure all events gets + delivered. + + * UIProcess/API/qt/qwebkittest_p.h: + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::setItemRectVisible): + + Assert that a ViewportUpdateDeferrer is always used when calling + this method. + + (WebKit::QtViewportInteractionEngine::animateItemRectVisible): + + Remove work around now we have the proper fix in place. + + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + + Do not send the informVisibleContentChange manually, use the + ViewportUpdateDeferrer instead. + + (WebKit::QtViewportInteractionEngine::cancelScrollAnimation): + + Add missing ViewportUpdateDeferrer. + + (WebKit::QtViewportInteractionEngine::pinchGestureStarted): + + No reason to emit informVisibleContentChange before pinch + start, as it is always done on end (due to the ViewportUpdateDeferrer). + + (WebKit::QtViewportInteractionEngine::itemSizeChanged): + + Add missing ViewportUpdateDeferrer. + +2012-05-29 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] [WK2] Allow user to inject JS scripts when the page loads + https://bugs.webkit.org/show_bug.cgi?id=85827 + + Reviewed by Simon Hausmann. + + Create a new experimental property to list URLs of JS scripts that should be + loaded when a page is loaded. These scripts will run in the normal JS environment + of the page. + + The supported URL schemes are file:/// and qrc:///. The scripts are read from the + UI process and transfered to the Web process. + + Together with the experimental messaging API this provides a way for the + application to manipulate the DOM (by injecting a script that does the + manipulation and communicating with it via postMessage). This covers some of the + use cases of QWebElement in our WK1 API. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + (readUserScript): + (QQuickWebViewPrivate::updateUserScripts): + (QQuickWebViewExperimental::userScripts): + (QQuickWebViewExperimental::setUserScripts): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/append-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/common/big-user-script.js: Added. + * UIProcess/API/qt/tests/qmltests/common/change-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/resources.qrc: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::setUserScripts): + (WebKit): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::setUserScripts): + (WebKit): + +2012-05-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118752. + http://trac.webkit.org/changeset/118752 + https://bugs.webkit.org/show_bug.cgi?id=87731 + + incomplete patch (Requested by cmarcelo on #webkit). + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + +2012-05-21 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] [WK2] Allow user to inject JS scripts when the page loads + https://bugs.webkit.org/show_bug.cgi?id=85827 + + Reviewed by Simon Hausmann. + + Create a new experimental property to list URLs of JS scripts that should be + loaded when a page is loaded. These scripts will run in the normal JS environment + of the page. + + The supported URL schemes are file:/// and qrc:///. The scripts are read from the + UI process and transfered to the Web process. + + Together with the experimental messaging API this provides a way for the + application to manipulate the DOM (by injecting a script that does the + manipulation and communicating with it via postMessage). This covers some of the + use cases of QWebElement in our WK1 API. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didRelaunchProcess): + (readUserScript): + (QQuickWebViewPrivate::updateUserScripts): + (QQuickWebViewExperimental::userScripts): + (QQuickWebViewExperimental::setUserScripts): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml: Added. + * UIProcess/API/qt/tests/qmltests/common/append-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/common/big-user-script.js: Added. + * UIProcess/API/qt/tests/qmltests/common/change-document-title.js: Added. + * UIProcess/API/qt/tests/qmltests/resources.qrc: Added. + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::setUserScripts): + (WebKit): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + * WebProcess/WebPage/qt/WebPageQt.cpp: + (WebKit::WebPage::setUserScripts): + (WebKit): + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add return value information to WebKitWebView::load-failed signal documentation + https://bugs.webkit.org/show_bug.cgi?id=87704 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkit_web_view_class_init): + +2012-05-29 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add WebKitWebInspector.h to the list of WebKit2 GTK public headers + https://bugs.webkit.org/show_bug.cgi?id=87703 + + Reviewed by Martin Robinson. + + * GNUmakefile.list.am: Add WebKitWebInspector.h to webkit2gtk_h_api. + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed unneeded setJavaScriptProfilingEnabled function from WTR after its + move to windows.internals.settings. + + * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp: + * WebProcess/InjectedBundle/API/c/WKBundleInspector.h: + * WebProcess/WebPage/WebInspector.cpp: + (WebKit::WebInspector::setJavaScriptProfilingEnabled): + * win/WebKit2.def: + +2012-05-28 No'am Rosenthal <noam.rosenthal@nokia.com> + + Remove unused argument coders for animation + https://bugs.webkit.org/show_bug.cgi?id=87435 + + Reviewed by Sam Weinig. + + Left the used argument coders only, behind a proper USE(UI_SIDE_COMPOSITING) flag. + + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC): + * Shared/WebCoreArgumentCoders.h: + +2012-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move allowRoundingHacks to Internals interface + https://bugs.webkit.org/show_bug.cgi?id=87328 + + Reviewed by Hajime Morita. + + * win/WebKit2.def: Add setAllowsRoundingHacks() to symbol filter. + 2012-05-26 Geoffrey Garen <ggaren@apple.com> WebKit should be lazy-finalization-safe (esp. the DOM) v2 diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index fc1a6952f..76440b0a6 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -39,6 +39,7 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; +ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_VARIABLES = ; ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); @@ -126,4 +127,4 @@ ENABLE_WEB_TIMING = ; 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_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(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_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(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_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_VARIABLES) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FONT_BOOSTING) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(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_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(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_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig index 14b5d2516..752b3c5b7 100644 --- a/Source/WebKit2/Configurations/WebKit2.xcconfig +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -29,8 +29,10 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR); DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR); +FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore; + OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)) $(OTHER_LDFLAGS); -OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)) $(FRAMEWORK_AND_LIBRARY_LDFLAGS); OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index 35d22fad0..b1eea2473 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -109,6 +109,7 @@ webkit2gtk_h_api += \ $(WebKit2)/UIProcess/API/gtk/WebKitURIRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitWebInspector.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebResource.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \ diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 6b768d373..bc6e96638 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -24,6 +24,9 @@ LIST(APPEND WebKit2_SOURCES Shared/efl/WebEventFactory.cpp Shared/efl/WebCoreArgumentCodersEfl.cpp + UIProcess/API/C/soup/WKContextSoup.cpp + UIProcess/API/C/soup/WKSoupRequestManager.cpp + UIProcess/API/efl/PageClientImpl.cpp UIProcess/API/efl/ewk_view.cpp @@ -36,11 +39,13 @@ LIST(APPEND WebKit2_SOURCES UIProcess/efl/WebPageProxyEfl.cpp UIProcess/efl/WebPreferencesEfl.cpp + UIProcess/soup/WebSoupRequestManagerClient.cpp + UIProcess/soup/WebSoupRequestManagerProxy.cpp + UIProcess/Launcher/efl/ProcessLauncherEfl.cpp UIProcess/Launcher/efl/ThreadLauncherEfl.cpp - UIProcess/Plugins/efl/PluginInfoStoreEfl.cpp - UIProcess/Plugins/efl/PluginProcessProxyEfl.cpp + UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp WebProcess/Cookies/soup/WebCookieManagerSoup.cpp @@ -59,18 +64,32 @@ LIST(APPEND WebKit2_SOURCES WebProcess/WebPage/efl/WebInspectorEfl.cpp WebProcess/WebPage/efl/WebPageEfl.cpp + + WebProcess/soup/WebSoupRequestManager.cpp + WebProcess/soup/WebKitSoupRequestGeneric.cpp + WebProcess/soup/WebKitSoupRequestInputStream.cpp +) + +LIST(APPEND WebKit2_MESSAGES_IN_FILES + UIProcess/soup/WebSoupRequestManagerProxy.messages.in + WebProcess/soup/WebSoupRequestManager.messages.in ) LIST(APPEND WebKit2_INCLUDE_DIRECTORIES - "${JAVASCRIPTCORE_DIR}/wtf/gobject" + "${JAVASCRIPTCORE_DIR}/llint" "${WEBCORE_DIR}/platform/efl" "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBCORE_DIR}/platform/network/soup" + "${WEBCORE_DIR}/svg/graphics" "${WEBKIT2_DIR}/Shared/efl" - "${WEBKIT2_DIR}/UIProcess/API/efl/" + "${WEBKIT2_DIR}/UIProcess/API/C/soup" + "${WEBKIT2_DIR}/UIProcess/API/efl" + "${WEBKIT2_DIR}/UIProcess/soup" "${WEBKIT2_DIR}/WebProcess/Downloads/efl" "${WEBKIT2_DIR}/WebProcess/efl" + "${WEBKIT2_DIR}/WebProcess/soup" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" + "${WTF_DIR}/wtf/gobject" ${CAIRO_INCLUDE_DIRS} ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} @@ -81,6 +100,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES ${SQLITE_INCLUDE_DIRS} ${Glib_INCLUDE_DIRS} ${LIBSOUP24_INCLUDE_DIRS} + ${WTF_DIR} ) LIST(APPEND WebKit2_LIBRARIES diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp new file mode 100755 index 000000000..9a3e9fcc5 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WKURLRequestEfl.h" + +#include "WKAPICast.h" +#include "WebURLRequestEfl.h" + +using namespace WebKit; + +WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef requestRef) +{ + RefPtr<WebURLRequestEfl> requestEfl = WebURLRequestEfl::create(toImpl(requestRef)); + return toCopiedAPI(requestEfl->cookies()); +} diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h new file mode 100755 index 000000000..62688dd54 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLRequestEfl.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WKURLRequestEfl_h +#define WKURLRequestEfl_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKURLRequestEflCopyCookies(WKURLRequestRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLRequestEfl_h */ diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp new file mode 100755 index 000000000..abe01d77b --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WKURLResponseEfl.h" + +#include "WKAPICast.h" +#include "WebURLResponseEfl.h" + +using namespace WebKit; + +WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef responseRef) +{ + RefPtr<WebURLResponseEfl> responseEfl = WebURLResponseEfl::create(toImpl(responseRef)); + return toCopiedAPI(responseEfl->contentType()); +} diff --git a/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h new file mode 100755 index 000000000..bae655c64 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/efl/WKURLResponseEfl.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WKURLResponseEfl_h +#define WKURLResponseEfl_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKStringRef WKURLResponseEflCopyContentType(WKURLResponseRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKURLResponseEfl_h */ diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 804568c2d..3cb57b013 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -45,25 +45,15 @@ #include <WebCore/WindowFeatures.h> #include <wtf/text/StringHash.h> -#if PLATFORM(QT) +#if USE(UI_SIDE_COMPOSITING) #include <WebCore/Animation.h> #include <WebCore/FloatPoint3D.h> -#include <WebCore/IdentityTransformOperation.h> -#include <WebCore/Matrix3DTransformOperation.h> -#include <WebCore/MatrixTransformOperation.h> -#include <WebCore/PerspectiveTransformOperation.h> -#include <WebCore/RotateTransformOperation.h> -#include <WebCore/ScaleTransformOperation.h> -#include <WebCore/SkewTransformOperation.h> -#include <WebCore/TimingFunction.h> -#include <WebCore/TransformOperation.h> -#include <WebCore/TransformOperations.h> -#include <WebCore/TranslateTransformOperation.h> -#endif +#include <WebCore/TransformationMatrix.h> -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) #include <WebCore/FilterOperations.h> #endif +#endif using namespace WebCore; using namespace WebKit; @@ -642,8 +632,7 @@ bool ArgumentCoder<KURL>::decode(ArgumentDecoder* decoder, KURL& result) return true; } -#if PLATFORM(QT) - +#if USE(UI_SIDE_COMPOSITING) void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder* encoder, const FloatPoint3D& floatPoint3D) { SimpleArgumentCoder<FloatPoint3D>::encode(encoder, floatPoint3D); @@ -654,7 +643,6 @@ bool ArgumentCoder<FloatPoint3D>::decode(ArgumentDecoder* decoder, FloatPoint3D& return SimpleArgumentCoder<FloatPoint3D>::decode(decoder, floatPoint3D); } - void ArgumentCoder<Length>::encode(ArgumentEncoder* encoder, const Length& length) { SimpleArgumentCoder<Length>::encode(encoder, length); @@ -675,577 +663,7 @@ bool ArgumentCoder<TransformationMatrix>::decode(ArgumentDecoder* decoder, Trans return SimpleArgumentCoder<TransformationMatrix>::decode(decoder, transformationMatrix); } - -void ArgumentCoder<RefPtr<MatrixTransformOperation> >::encode(ArgumentEncoder* encoder, const MatrixTransformOperation* operation) -{ - ArgumentCoder<WebCore::TransformationMatrix>::encode(encoder, operation->matrix()); -} - -bool ArgumentCoder<RefPtr<MatrixTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<MatrixTransformOperation>& operation) -{ - TransformationMatrix matrix; - if (!ArgumentCoder<WebCore::TransformationMatrix>::decode(decoder, matrix)) - return false; - - operation = MatrixTransformOperation::create(matrix); - return true; -} - -void ArgumentCoder<RefPtr<Matrix3DTransformOperation> >::encode(ArgumentEncoder* encoder, const Matrix3DTransformOperation* operation) -{ - ArgumentCoder<TransformationMatrix>::encode(encoder, operation->matrix()); -} - -bool ArgumentCoder<RefPtr<Matrix3DTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<Matrix3DTransformOperation>& operation) -{ - - TransformationMatrix matrix; - if (!ArgumentCoder<WebCore::TransformationMatrix>::decode(decoder, matrix)) - return false; - - operation = Matrix3DTransformOperation::create(matrix); - return true; -} - -void ArgumentCoder<RefPtr<PerspectiveTransformOperation> >::encode(ArgumentEncoder* encoder, const PerspectiveTransformOperation* operation) -{ - ArgumentCoder<Length>::encode(encoder, operation->perspective()); -} - -bool ArgumentCoder<RefPtr<PerspectiveTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<PerspectiveTransformOperation>& operation) -{ - Length perspective; - if (!ArgumentCoder<Length>::decode(decoder, perspective)) - return false; - - operation = PerspectiveTransformOperation::create(perspective); - return true; -} - -void ArgumentCoder<RefPtr<RotateTransformOperation> >::encode(ArgumentEncoder* encoder, const RotateTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->x()); - encoder->encode(operation->y()); - encoder->encode(operation->z()); - encoder->encode(operation->angle()); -} - -bool ArgumentCoder<RefPtr<RotateTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<RotateTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double x; - double y; - double z; - double angle; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(x)) - return false; - if (!decoder->decode(y)) - return false; - if (!decoder->decode(z)) - return false; - if (!decoder->decode(angle)) - return false; - - operation = RotateTransformOperation::create(x, y, z, angle, operationType); - return true; -} - - -void ArgumentCoder<RefPtr<ScaleTransformOperation> >::encode(ArgumentEncoder* encoder, const ScaleTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->x()); - encoder->encode(operation->y()); - encoder->encode(operation->z()); -} - -bool ArgumentCoder<RefPtr<ScaleTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<ScaleTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double x; - double y; - double z; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(x)) - return false; - if (!decoder->decode(y)) - return false; - if (!decoder->decode(z)) - return false; - - operation = ScaleTransformOperation::create(x, y, z, operationType); - return true; -} - -void ArgumentCoder<RefPtr<SkewTransformOperation> >::encode(ArgumentEncoder* encoder, const SkewTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - encoder->encode(operation->angleX()); - encoder->encode(operation->angleY()); -} - -bool ArgumentCoder<RefPtr<SkewTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<SkewTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - double angleX; - double angleY; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!decoder->decode(angleX)) - return false; - if (!decoder->decode(angleY)) - return false; - - operation = SkewTransformOperation::create(angleX, angleY, operationType); - return true; -} - -void ArgumentCoder<RefPtr<TranslateTransformOperation> >::encode(ArgumentEncoder* encoder, const TranslateTransformOperation* operation) -{ - const TransformOperation* transformOperation = operation; - encoder->encodeEnum(transformOperation->getOperationType()); - ArgumentCoder<Length>::encode(encoder, operation->x()); - ArgumentCoder<Length>::encode(encoder, operation->y()); - ArgumentCoder<Length>::encode(encoder, operation->z()); -} - -bool ArgumentCoder<RefPtr<TranslateTransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<TranslateTransformOperation>& operation) -{ - TransformOperation::OperationType operationType; - Length x; - Length y; - Length z; - - if (!decoder->decodeEnum(operationType)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, x)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, y)) - return false; - if (!ArgumentCoder<Length>::decode(decoder, z)) - return false; - - operation = TranslateTransformOperation::create(x, y, z, operationType); - return true; -} - -void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const RefPtr<TimingFunction>& function) -{ - encode(encoder, function.get()); -} - -void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const WebCore::TimingFunction* function) -{ - if (!function) { - encoder->encodeEnum(WebCore::TimingFunction::LinearFunction); - return; - } - - encoder->encodeEnum(function->type()); - switch (function->type()) { - case TimingFunction::LinearFunction: - break; - case TimingFunction::CubicBezierFunction: { - const WebCore::CubicBezierTimingFunction* cubicFunction = static_cast<const WebCore::CubicBezierTimingFunction*>(function); - encoder->encodeDouble(cubicFunction->x1()); - encoder->encodeDouble(cubicFunction->y1()); - encoder->encodeDouble(cubicFunction->x2()); - encoder->encodeDouble(cubicFunction->y2()); - break; - } - case TimingFunction::StepsFunction: { - const WebCore::StepsTimingFunction* stepsFunction = static_cast<const WebCore::StepsTimingFunction*>(function); - encoder->encodeInt32(stepsFunction->numberOfSteps()); - encoder->encodeBool(stepsFunction->stepAtStart()); - break; - } - } -} - -bool ArgumentCoder<RefPtr<TimingFunction> >::decode(ArgumentDecoder* decoder, RefPtr<TimingFunction>& function) -{ - TimingFunction::TimingFunctionType type; - if (!decoder->decodeEnum(type)) - return false; - - switch (type) { - case TimingFunction::LinearFunction: - function = LinearTimingFunction::create(); - return true; - - case TimingFunction::CubicBezierFunction: { - double x1, y1, x2, y2; - if (!decoder->decodeDouble(x1)) - return false; - if (!decoder->decodeDouble(y1)) - return false; - if (!decoder->decodeDouble(x2)) - return false; - if (!decoder->decodeDouble(y2)) - return false; - function = CubicBezierTimingFunction::create(x1, y1, x2, y2); - return true; - } - - case TimingFunction::StepsFunction: { - int numSteps; - bool stepAtStart; - if (!decoder->decodeInt32(numSteps)) - return false; - if (!decoder->decodeBool(stepAtStart)) - return false; - - function = StepsTimingFunction::create(numSteps, stepAtStart); - return true; - } - - } - - return false; -} - -template<typename T> -void encodeOperation(ArgumentEncoder* encoder, const RefPtr<TransformOperation>& operation) -{ - ArgumentCoder<RefPtr<T> >::encode(encoder, static_cast<const T*>(operation.get())); -} - -void ArgumentCoder<RefPtr<TransformOperation> >::encode(ArgumentEncoder* encoder, const RefPtr<TransformOperation>& operation) -{ - // We don't want to encode null-references. - ASSERT(operation); - - encoder->encodeEnum(operation->getOperationType()); - switch (operation->getOperationType()) { - case TransformOperation::SCALE: - case TransformOperation::SCALE_X: - case TransformOperation::SCALE_Y: - case TransformOperation::SCALE_Z: - case TransformOperation::SCALE_3D: - encodeOperation<ScaleTransformOperation>(encoder, operation); - return; - - case TransformOperation::TRANSLATE: - case TransformOperation::TRANSLATE_X: - case TransformOperation::TRANSLATE_Y: - case TransformOperation::TRANSLATE_Z: - case TransformOperation::TRANSLATE_3D: - encodeOperation<TranslateTransformOperation>(encoder, operation); - return; - - case TransformOperation::ROTATE: - case TransformOperation::ROTATE_X: - case TransformOperation::ROTATE_Y: - case TransformOperation::ROTATE_3D: - encodeOperation<RotateTransformOperation>(encoder, operation); - return; - - case TransformOperation::SKEW: - case TransformOperation::SKEW_X: - case TransformOperation::SKEW_Y: - encodeOperation<SkewTransformOperation>(encoder, operation); - return; - - case TransformOperation::MATRIX: - encodeOperation<MatrixTransformOperation>(encoder, operation); - return; - - case TransformOperation::MATRIX_3D: - encodeOperation<Matrix3DTransformOperation>(encoder, operation); - return; - - case TransformOperation::PERSPECTIVE: - encodeOperation<PerspectiveTransformOperation>(encoder, operation); - return; - - case TransformOperation::IDENTITY: - case TransformOperation::NONE: - return; - } -} - -template<typename T> -bool decodeOperation(ArgumentDecoder* decoder, RefPtr<TransformOperation>& operation) -{ - RefPtr<T> newOperation; - if (!decoder->decode(newOperation)) - return false; - - operation = newOperation; - return true; -} - -bool ArgumentCoder<RefPtr<TransformOperation> >::decode(ArgumentDecoder* decoder, RefPtr<TransformOperation>& operation) -{ - TransformOperation::OperationType type; - if (!decoder->decodeEnum(type)) - return false; - - switch (type) { - case TransformOperation::SCALE: - case TransformOperation::SCALE_X: - case TransformOperation::SCALE_Y: - case TransformOperation::SCALE_Z: - case TransformOperation::SCALE_3D: - return decodeOperation<ScaleTransformOperation>(decoder, operation); - - case TransformOperation::TRANSLATE: - case TransformOperation::TRANSLATE_X: - case TransformOperation::TRANSLATE_Y: - case TransformOperation::TRANSLATE_Z: - case TransformOperation::TRANSLATE_3D: - return decodeOperation<TranslateTransformOperation>(decoder, operation); - - case TransformOperation::ROTATE: - case TransformOperation::ROTATE_X: - case TransformOperation::ROTATE_Y: - case TransformOperation::ROTATE_3D: - return decodeOperation<RotateTransformOperation>(decoder, operation); - - case TransformOperation::SKEW: - case TransformOperation::SKEW_X: - case TransformOperation::SKEW_Y: - return decodeOperation<SkewTransformOperation>(decoder, operation); - - case TransformOperation::MATRIX: - return decodeOperation<MatrixTransformOperation>(decoder, operation); - - case TransformOperation::MATRIX_3D: - return decodeOperation<Matrix3DTransformOperation>(decoder, operation); - - case TransformOperation::PERSPECTIVE: - return decodeOperation<PerspectiveTransformOperation>(decoder, operation); - - case TransformOperation::IDENTITY: - case TransformOperation::NONE: - operation = IdentityTransformOperation::create(); - return true; - } - - return false; -} - -void ArgumentCoder<TransformOperations>::encode(ArgumentEncoder* encoder, const TransformOperations& operations) -{ - Vector<RefPtr<TransformOperation> > operationsVector = operations.operations(); - int size = operationsVector.size(); - encoder->encodeInt32(size); - for (int i = 0; i < size; ++i) - ArgumentCoder<RefPtr<TransformOperation> >::encode(encoder, operationsVector[i]); -} - -bool ArgumentCoder<TransformOperations>::decode(ArgumentDecoder* decoder, TransformOperations& operations) -{ - int size; - if (!decoder->decodeInt32(size)) - return false; - - Vector<RefPtr<TransformOperation> >& operationVector = operations.operations(); - operationVector.clear(); - operationVector.resize(size); - for (int i = 0; i < size; ++i) { - RefPtr<TransformOperation> operation; - if (!ArgumentCoder<RefPtr<TransformOperation> >::decode(decoder, operation)) - return false; - operationVector[i] = operation; - } - - return true; -} - -template<typename T> -static void encodeBoolAndValue(ArgumentEncoder* encoder, bool isSet, const T& value) -{ - encoder->encodeBool(isSet); - if (isSet) - encoder->encode(value); -} - -template<typename T> -static void encodeBoolAndEnumValue(ArgumentEncoder* encoder, bool isSet, T value) -{ - encoder->encodeBool(isSet); - if (isSet) - encoder->encodeEnum(value); -} - -void ArgumentCoder<RefPtr<Animation> >::encode(ArgumentEncoder* encoder, const RefPtr<Animation>& animation) -{ - encodeBoolAndValue(encoder, animation->isDelaySet(), animation->delay()); - encodeBoolAndEnumValue(encoder, animation->isDirectionSet(), animation->direction()); - encodeBoolAndValue(encoder, animation->isDurationSet(), animation->duration()); - encodeBoolAndValue(encoder, animation->isFillModeSet(), animation->fillMode()); - encodeBoolAndValue(encoder, animation->isIterationCountSet(), animation->iterationCount()); - encodeBoolAndValue(encoder, animation->isNameSet(), animation->name()); - encodeBoolAndEnumValue(encoder, animation->isPlayStateSet(), animation->playState()); - encodeBoolAndValue(encoder, animation->isPropertySet(), static_cast<int>(animation->property())); - encodeBoolAndValue<RefPtr<TimingFunction> >(encoder, animation->isTimingFunctionSet(), animation->timingFunction()); - encoder->encodeBool(animation->isNoneAnimation()); -} - - -template<typename T> -static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, T& value) -{ - if (!decoder->decodeBool(isSet)) - return false; - if (!isSet) - return true; - - return decoder->decode(value); -} - -template<typename T> -static bool decodeBoolAndEnumValue(ArgumentDecoder* decoder, bool& isSet, T& value) -{ - if (!decoder->decodeBool(isSet)) - return false; - if (!isSet) - return true; - - return decoder->decodeEnum(value); -} - -bool ArgumentCoder<RefPtr<Animation> >::decode(ArgumentDecoder* decoder, RefPtr<Animation>& animation) -{ - bool isDelaySet, isDirectionSet, isDurationSet, isFillModeSet, isIterationCountSet, isNameSet, isPlayStateSet, isPropertySet, isTimingFunctionSet; - int property, iterationCount, fillMode; - double duration; - RefPtr<TimingFunction> timingFunction; - String name; - - double delay; - if (!decodeBoolAndValue(decoder, isDelaySet, delay)) - return false; - - Animation::AnimationDirection direction = Animation::AnimationDirectionNormal; - if (!decodeBoolAndEnumValue(decoder, isDirectionSet, direction)) - return false; - if (!decodeBoolAndValue(decoder, isDurationSet, duration)) - return false; - if (!decodeBoolAndValue(decoder, isFillModeSet, fillMode)) - return false; - if (!decodeBoolAndValue(decoder, isIterationCountSet, iterationCount)) - return false; - if (!decodeBoolAndValue(decoder, isNameSet, name)) - return false; - - EAnimPlayState playState = AnimPlayStatePlaying; - if (!decodeBoolAndEnumValue(decoder, isPlayStateSet, playState)) - return false; - if (!decodeBoolAndValue(decoder, isPropertySet, property)) - return false; - if (!decodeBoolAndValue<RefPtr<TimingFunction> >(decoder, isTimingFunctionSet, timingFunction)) - return false; - - animation = Animation::create(); - animation->clearAll(); - - if (isDelaySet) - animation->setDelay(delay); - if (isDirectionSet) - animation->setDirection(direction); - if (isDurationSet) - animation->setDuration(duration); - if (isFillModeSet) - animation->setFillMode(fillMode); - if (isIterationCountSet) - animation->setIterationCount(iterationCount); - if (isNameSet) - animation->setName(name); - if (isPlayStateSet) - animation->setPlayState(playState); - if (isPropertySet) - animation->setProperty(static_cast<CSSPropertyID>(property)); - if (isTimingFunctionSet) - animation->setTimingFunction(timingFunction); - - return true; -} - -#if USE(ACCELERATED_COMPOSITING) - -void ArgumentCoder<KeyframeValueList>::encode(ArgumentEncoder* encoder, const WebCore::KeyframeValueList& keyframes) -{ - encoder->encodeUInt32(keyframes.size()); - encoder->encodeInt32(keyframes.property()); - for (size_t i = 0; i < keyframes.size(); ++i) { - const WebCore::AnimationValue* value = keyframes.at(i); - encoder->encodeFloat(value->keyTime()); - ArgumentCoder<RefPtr<WebCore::TimingFunction> >::encode(encoder, value->timingFunction()); - switch (keyframes.property()) { - case WebCore::AnimatedPropertyOpacity: { - const WebCore::FloatAnimationValue* floatValue = static_cast<const WebCore::FloatAnimationValue*>(value); - encoder->encodeFloat(floatValue->value()); - break; - } - case WebCore::AnimatedPropertyWebkitTransform: { - const WebCore::TransformAnimationValue* transformValue = static_cast<const WebCore::TransformAnimationValue*>(value); - ArgumentCoder<WebCore::TransformOperations>::encode(encoder, *transformValue->value()); - break; - } - default: - break; - } - } -} - -bool ArgumentCoder<KeyframeValueList>::decode(ArgumentDecoder* decoder, WebCore::KeyframeValueList& keyframes) -{ - uint32_t size; - int32_t property; - if (!decoder->decodeUInt32(size)) - return false; - if (!decoder->decodeInt32(property)) - return false; - - keyframes = WebCore::KeyframeValueList(WebCore::AnimatedPropertyID(property)); - - for (size_t i = 0; i < size; ++i) { - float keyTime; - - RefPtr<WebCore::TimingFunction> timingFunction; - if (!decoder->decodeFloat(keyTime)) - return false; - if (!ArgumentCoder<RefPtr<WebCore::TimingFunction> >::decode(decoder, timingFunction)) - return false; - - switch (property) { - case WebCore::AnimatedPropertyOpacity: { - float value; - if (!decoder->decodeFloat(value)) - return false; - keyframes.insert(new WebCore::FloatAnimationValue(keyTime, value, timingFunction)); - break; - } - case WebCore::AnimatedPropertyWebkitTransform: { - WebCore::TransformOperations value; - if (!ArgumentCoder<WebCore::TransformOperations>::decode(decoder, value)) - return false; - keyframes.insert(new WebCore::TransformAnimationValue(keyTime, &value, timingFunction)); - break; - } - default: - break; - } - } - - return true; -} - -#endif - -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) void ArgumentCoder<WebCore::FilterOperations>::encode(ArgumentEncoder* encoder, const WebCore::FilterOperations& filters) { encoder->encodeUInt32(filters.size()); diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index d02f5fc17..2697408ed 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -234,7 +234,7 @@ template<> struct ArgumentCoder<WebCore::KURL> { static bool decode(ArgumentDecoder*, WebCore::KURL&); }; -#if PLATFORM(QT) +#if USE(UI_SIDE_COMPOSITING) template<> struct ArgumentCoder<WebCore::FloatPoint3D> { static void encode(ArgumentEncoder*, const WebCore::FloatPoint3D&); static bool decode(ArgumentDecoder*, WebCore::FloatPoint3D&); @@ -250,77 +250,15 @@ template<> struct ArgumentCoder<WebCore::TransformationMatrix> { static bool decode(ArgumentDecoder*, WebCore::TransformationMatrix&); }; -template<> struct ArgumentCoder<RefPtr<WebCore::MatrixTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::MatrixTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::MatrixTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::Matrix3DTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::Matrix3DTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::Matrix3DTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::PerspectiveTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::PerspectiveTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::PerspectiveTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::RotateTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::RotateTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::RotateTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::ScaleTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::ScaleTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::ScaleTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::SkewTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::SkewTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::SkewTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TranslateTransformOperation> > { - static void encode(ArgumentEncoder*, const WebCore::TranslateTransformOperation*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TranslateTransformOperation>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TimingFunction> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::TimingFunction>&); - static void encode(ArgumentEncoder*, const WebCore::TimingFunction*); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TimingFunction>&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::TransformOperation> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::TransformOperation>&); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::TransformOperation>&); -}; - -template<> struct ArgumentCoder<WebCore::TransformOperations> { - static void encode(ArgumentEncoder*, const WebCore::TransformOperations&); - static bool decode(ArgumentDecoder*, WebCore::TransformOperations&); -}; - -template<> struct ArgumentCoder<RefPtr<WebCore::Animation> > { - static void encode(ArgumentEncoder*, const RefPtr<WebCore::Animation>&); - static bool decode(ArgumentDecoder*, RefPtr<WebCore::Animation>&); -}; -#endif - -#if USE(UI_SIDE_COMPOSITING) && ENABLE(CSS_FILTERS) +#if ENABLE(CSS_FILTERS) template<> struct ArgumentCoder<WebCore::FilterOperations> { static void encode(ArgumentEncoder*, const WebCore::FilterOperations&); static bool decode(ArgumentDecoder*, WebCore::FilterOperations&); }; #endif - -#if USE(ACCELERATED_COMPOSITING) -template<> struct ArgumentCoder<WebCore::KeyframeValueList> { - static void encode(ArgumentEncoder*, const WebCore::KeyframeValueList& keyframes); - static bool decode(ArgumentDecoder*, WebCore::KeyframeValueList& keyframes); -}; #endif + } // namespace CoreIPC #endif // WebCoreArgumentCoders_h diff --git a/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp b/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp new file mode 100755 index 000000000..a964883bb --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebCoreArgumentCodersEfl.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebCoreArgumentCoders.h" + +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> + +using namespace WebCore; + +namespace CoreIPC { + +void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest) +{ + encoder->encode(resourceRequest.url().string()); + encoder->encode(resourceRequest.httpHeaderField("Cookie")); +} + +bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) +{ + ResourceRequest request; + + String url; + if (!decoder->decode(url)) + return false; + request.setURL(KURL(KURL(), url)); + + String cookie; + if (!decoder->decode(cookie)) + return false; + request.setHTTPHeaderField("Cookie", cookie); + + resourceRequest = request; + return true; +} + + +void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse) +{ + encoder->encode(resourceResponse.mimeType()); +} + +bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) +{ + ResourceResponse response; + + String mimeType; + if (!decoder->decode(mimeType)) + return false; + response.setMimeType(mimeType); + + resourceResponse = response; + return true; +} + + +void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) +{ + encoder->encode(resourceError.domain()); + encoder->encode(resourceError.errorCode()); + encoder->encode(resourceError.failingURL()); + encoder->encode(resourceError.localizedDescription()); +} + +bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder* decoder, ResourceError& resourceError) +{ + String domain; + if (!decoder->decode(domain)) + return false; + + int errorCode; + if (!decoder->decode(errorCode)) + return false; + + String failingURL; + if (!decoder->decode(failingURL)) + return false; + + String localizedDescription; + if (!decoder->decode(localizedDescription)) + return false; + + resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); + return true; +} + +} // namespace CoreIPC diff --git a/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp b/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp new file mode 100755 index 000000000..2a498c441 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLRequestEfl.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebURLRequestEfl.h" + +using namespace WebCore; + +namespace WebKit { + +WebURLRequestEfl::WebURLRequestEfl(const WebURLRequest* request) + : m_request(request) +{ +} + +const String WebURLRequestEfl::cookies() const +{ + if (!m_request) + return String(); + + return m_request->resourceRequest().httpHeaderField("Cookie"); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebURLRequestEfl.h b/Source/WebKit2/Shared/efl/WebURLRequestEfl.h new file mode 100755 index 000000000..8057db28f --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLRequestEfl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebURLRequestEfl_h +#define WebURLRequestEfl_h + +#include "WebURLRequest.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebURLRequestEfl : public RefCounted<WebURLRequestEfl> { +public: + static PassRefPtr<WebURLRequestEfl> create(const WebURLRequest* request) + { + return adoptRef(new WebURLRequestEfl(request)); + } + + const String cookies() const; + +private: + explicit WebURLRequestEfl(const WebURLRequest*); + + const WebURLRequest* m_request; +}; + +} // namespace WebKit + +#endif // WebURLRequestEfl_h diff --git a/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp b/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp new file mode 100755 index 000000000..55128a420 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLResponseEfl.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebURLResponseEfl.h" + +namespace WebKit { + +WebURLResponseEfl::WebURLResponseEfl(const WebURLResponse* response) + : m_response(response) +{ +} + +const String& WebURLResponseEfl::contentType() const +{ + if (!m_response) + return String(); + + return m_response->resourceResponse().mimeType(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/efl/WebURLResponseEfl.h b/Source/WebKit2/Shared/efl/WebURLResponseEfl.h new file mode 100755 index 000000000..1193a8023 --- /dev/null +++ b/Source/WebKit2/Shared/efl/WebURLResponseEfl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebURLResponseEfl_h +#define WebURLResponseEfl_h + +#include "WebURLResponse.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> + +namespace WebKit { + +class WebURLResponseEfl : public RefCounted<WebURLResponseEfl> { +public: + static PassRefPtr<WebURLResponseEfl> create(const WebURLResponse* response) + { + return adoptRef(new WebURLResponseEfl(response)); + } + + const String& contentType() const; + +private: + explicit WebURLResponseEfl(const WebURLResponse*); + + const WebURLResponse* m_response; +}; + +} // namespace WebKit + +#endif // WebURLResponseEfl_h diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index c7e5f029c..567548f5d 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -32,7 +32,7 @@ #include "WebContext.h" #include "WebContextMenuProxy.h" #include "WebPageProxy.h" -#include "ewk_private.h" +#include "ewk_view_private.h" using namespace WebCore; @@ -186,6 +186,13 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) notImplemented(); } +#if ENABLE(TOUCH_EVENTS) +void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) +{ + notImplemented(); +} +#endif + PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy*) { notImplemented(); diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 0858fc33d..a4dcd93e3 100644 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -77,6 +77,9 @@ private: virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool); +#if ENABLE(TOUCH_EVENTS) + virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); +#endif virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index d331d996f..e776725cc 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -18,8 +18,8 @@ * */ -#ifndef ewk_private_h -#define ewk_private_h +#ifndef ewk_view_private_h +#define ewk_view_private_h #include <Evas.h> @@ -31,4 +31,4 @@ class IntSize; void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect); void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size); -#endif // ewk_private_h +#endif // ewk_view_private_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index 018f08d3d..61d316f6c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -20,8 +20,10 @@ #include "config.h" #include "WebKitDownload.h" +#include "DownloadProxy.h" #include "WebKitDownloadPrivate.h" #include "WebKitMarshal.h" +#include "WebKitURIRequestPrivate.h" #include "WebKitURIResponsePrivate.h" #include <WebCore/ErrorsGtk.h> #include <WebCore/ResourceResponse.h> @@ -53,6 +55,7 @@ enum { struct _WebKitDownloadPrivate { WKRetainPtr<WKDownloadRef> wkDownload; + GRefPtr<WebKitURIRequest> request; GRefPtr<WebKitURIResponse> response; CString destinationURI; guint64 currentSize; @@ -360,6 +363,25 @@ void webkitDownloadDestinationCreated(WebKitDownload* download, const CString& d } /** + * webkit_download_get_request: + * @download: a #WebKitDownload + * + * Retrieves the #WebKitURIRequest object that backs the download + * process. + * + * Returns: (transfer none): the #WebKitURIRequest of @download + */ +WebKitURIRequest* webkit_download_get_request(WebKitDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0); + + WebKitDownloadPrivate* priv = download->priv; + if (!priv->request) + priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(priv->wkDownload.get())->request())); + return download->priv->request.get(); +} + +/** * webkit_download_get_destination: * @download: a #WebKitDownload * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h index b6c51fea5..b4a2d3bab 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h @@ -26,6 +26,7 @@ #include <glib-object.h> #include <webkit2/WebKitDefines.h> +#include <webkit2/WebKitURIRequest.h> #include <webkit2/WebKitURIResponse.h> G_BEGIN_DECLS @@ -57,6 +58,9 @@ struct _WebKitDownloadClass { WEBKIT_API GType webkit_download_get_type (void); +WEBKIT_API WebKitURIRequest * +webkit_download_get_request (WebKitDownload *download); + WEBKIT_API const gchar * webkit_download_get_destination (WebKitDownload *download); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index 9476255c8..158c7fc42 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -147,7 +147,8 @@ void attachLoaderClientToView(WebKitWebView* webView) 0, // didDetectXSSForFrame 0, // didFirstVisuallyNonEmptyLayoutForFrame 0, // willGoToBackForwardListItem - 0 // interactionOccurredWhileProcessUnresponsive + 0, // interactionOccurredWhileProcessUnresponsive + 0, // pluginDidFail }; WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); WKPageSetPageLoaderClient(wkPage, &wkLoaderClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp index 9f78c9cbf..2548d7b72 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp @@ -191,6 +191,7 @@ void attachUIClientToView(WebKitWebView* webView) createNewPage, mouseDidMoveOverElement, 0, // decidePolicyForNotificationPermissionRequest + 0, // unavailablePluginButtonClicked }; WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); WKPageSetPageUIClient(wkPage, &wkUIClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp index 174bf12f8..93f83c2de 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp @@ -30,7 +30,8 @@ enum { PROP_URI, PROP_STATUS_CODE, - PROP_CONTENT_LENGTH + PROP_CONTENT_LENGTH, + PROP_MIME_TYPE }; using namespace WebCore; @@ -40,6 +41,7 @@ G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT) struct _WebKitURIResponsePrivate { WebCore::ResourceResponse resourceResponse; CString uri; + CString mimeType; }; static void webkitURIResponseFinalize(GObject* object) @@ -62,6 +64,9 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue* case PROP_CONTENT_LENGTH: g_value_set_uint64(value, webkit_uri_response_get_content_length(response)); break; + case PROP_MIME_TYPE: + g_value_set_string(value, webkit_uri_response_get_mime_type(response)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); } @@ -112,6 +117,19 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass 0, G_MAXUINT64, 0, WEBKIT_PARAM_READABLE)); + /** + * WebKitURIResponse:mime-type: + * + * The MIME type of the response. + */ + g_object_class_install_property(objectClass, + PROP_MIME_TYPE, + g_param_spec_string("mime-type", + _("MIME Type"), + _("The MIME type of the response"), + 0, + WEBKIT_PARAM_READABLE)); + g_type_class_add_private(responseClass, sizeof(WebKitURIResponsePrivate)); } @@ -170,6 +188,20 @@ guint64 webkit_uri_response_get_content_length(WebKitURIResponse* response) return response->priv->resourceResponse.expectedContentLength(); } +/** + * webkit_uri_response_get_mime_type: + * @response: a #WebKitURIResponse + * + * Returns: the MIME type of the #WebKitURIResponse + */ +const gchar* webkit_uri_response_get_mime_type(WebKitURIResponse* response) +{ + g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0); + + response->priv->mimeType = response->priv->resourceResponse.mimeType().utf8(); + return response->priv->mimeType.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 cfbe4d819..0cc6c8959 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h @@ -64,6 +64,9 @@ webkit_uri_response_get_status_code (WebKitURIResponse *response); WEBKIT_API guint64 webkit_uri_response_get_content_length (WebKitURIResponse *response); +WEBKIT_API const gchar * +webkit_uri_response_get_mime_type (WebKitURIResponse *response); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 77ef6c1de..938f95fd1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -33,9 +33,11 @@ #include "WebKitPrintOperationPrivate.h" #include "WebKitPrivate.h" #include "WebKitResourceLoadClient.h" +#include "WebKitResponsePolicyDecision.h" #include "WebKitScriptDialogPrivate.h" #include "WebKitSettingsPrivate.h" #include "WebKitUIClient.h" +#include "WebKitURIResponsePrivate.h" #include "WebKitWebContextPrivate.h" #include "WebKitWebInspectorPrivate.h" #include "WebKitWebResourcePrivate.h" @@ -190,9 +192,25 @@ static gboolean webkitWebViewScriptDialog(WebKitWebView* webView, WebKitScriptDi return TRUE; } -static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* decision, WebKitPolicyDecisionType) +static gboolean webkitWebViewDecidePolicy(WebKitWebView* webView, WebKitPolicyDecision* decision, WebKitPolicyDecisionType decisionType) { - webkit_policy_decision_use(decision); + if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { + webkit_policy_decision_use(decision); + return TRUE; + } + + WebKitURIResponse* response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); + const ResourceResponse resourceResponse = webkitURIResponseGetResourceResponse(response); + if (resourceResponse.isAttachment()) { + webkit_policy_decision_download(decision); + return TRUE; + } + + if (webkit_web_view_can_show_mime_type(webView, webkit_uri_response_get_mime_type(response))) + webkit_policy_decision_use(decision); + else + webkit_policy_decision_ignore(decision); + return TRUE; } @@ -509,6 +527,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * * By default, if the signal is not handled, a stock error page will be displayed. * You need to handle the signal if you want to provide your own error page. + * + * Returns: %TRUE to stop other handlers from being invoked for the event. + * %FALSE to propagate the event further. */ signals[LOAD_FAILED] = g_signal_new("load-failed", @@ -1754,7 +1775,7 @@ void webkit_web_view_can_execute_editing_command(WebKitWebView* webView, const c * * Finish an asynchronous operation started with webkit_web_view_can_execute_editing_command(). * - * Returns: %TRUE if a selection can be cut or %FALSE otherwise + * Returns: %TRUE if the editing command can be executed or %FALSE otherwise */ gboolean webkit_web_view_can_execute_editing_command_finish(WebKitWebView* webView, GAsyncResult* result, GError** error) { @@ -1918,13 +1939,13 @@ void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script, * context = webkit_javascript_result_get_global_context (js_result); * value = webkit_javascript_result_get_value (js_result); * if (JSValueIsString (context, value)) { - * JSStringRef *js_str_value; - * gchar *str_value; - * gsize str_length; + * JSStringRef js_str_value; + * gchar *str_value; + * gsize str_length; * - * js_str_value = JSValueToStringCopy (context, value, NULL)); + * js_str_value = JSValueToStringCopy (context, value, NULL); * str_length = JSStringGetMaximumUTF8CStringSize (js_str_value); - * str_value = (gchar *)g_malloc (str_length)); + * str_value = (gchar *)g_malloc (str_length); * JSStringGetUTF8CString (js_str_value, str_value, str_length); * JSStringRelease (js_str_value); * g_print ("Script result: %s\n", str_value); @@ -1942,7 +1963,7 @@ void webkit_web_view_run_javascript(WebKitWebView* webView, const gchar* script, * gchar *script; * * script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id); - * webkit_web_view_run_javascript (web_view, script, web_view_javascript_finished, NULL); + * webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL); * g_free (script); * } * </programlisting></informalexample> @@ -2023,3 +2044,21 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) return webView->priv->inspector.get(); } + +/** + * webkit_web_view_can_show_mime_type: + * @web_view: a #WebKitWebView + * @mime_type: a MIME type + * + * Whether or not a MIME type can be displayed in @web_view. + * + * Returns: %TRUE if the MIME type @mime_type can be displayed or %FALSE otherwise + */ +gboolean webkit_web_view_can_show_mime_type(WebKitWebView* webView, const char* mimeType) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + g_return_val_if_fail(mimeType, FALSE); + + WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); + return page->canShowMIMEType(String::fromUTF8(mimeType)); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 7f9fb9e36..716fbbd08 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -306,6 +306,10 @@ webkit_web_view_get_subresources (WebKitWebView *w WEBKIT_API WebKitWebInspector * webkit_web_view_get_inspector (WebKitWebView *web_view); +WEBKIT_API gboolean +webkit_web_view_can_show_mime_type (WebKitWebView *web_view, + const gchar *mime_type); + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index 4faa75fb0..f8308aa14 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -675,8 +675,8 @@ void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData& { WebKitWebViewBasePrivate* priv = webViewBase->priv; - RefPtr<DataObjectGtk> dataObject(dragData.platformData()); - GRefPtr<GtkTargetList> targetList(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); + RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData()); + GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get())); GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(webViewBase), targetList.get(), diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 4251cc4a6..6dde0866d 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -95,6 +95,7 @@ webkit_web_view_get_inspector webkit_web_view_get_javascript_global_context webkit_web_view_run_javascript webkit_web_view_run_javascript_finish +webkit_web_view_can_show_mime_type <SUBSECTION WebKitJavascriptResult> WebKitJavascriptResult @@ -302,6 +303,7 @@ WebKitURIResponse webkit_uri_response_get_uri webkit_uri_response_get_status_code webkit_uri_response_get_content_length +webkit_uri_response_get_mime_type <SUBSECTION Standard> WebKitURIResponseClass @@ -346,6 +348,7 @@ webkit_window_properties_get_type <SECTION> <FILE>WebKitDownload</FILE> WebKitDownload +webkit_download_get_request webkit_download_get_destination webkit_download_set_destination webkit_download_get_response diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp index a119e4477..acec9ece1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp @@ -88,6 +88,7 @@ public: static void downloadStartedCallback(WebKitWebContext* context, WebKitDownload* download, DownloadTest* test) { + g_assert(webkit_download_get_request(download)); test->started(download); g_signal_connect(download, "notify::response", G_CALLBACK(receivedResponseCallback), test); g_signal_connect(download, "created-destination", G_CALLBACK(createdDestinationCallback), test); @@ -191,6 +192,10 @@ static void testDownloadLocalFile(DownloadTest* test, gconstpointer) g_assert_cmpint(events[3], ==, DownloadTest::ReceivedData); g_assert_cmpint(events[4], ==, DownloadTest::Finished); + WebKitURIRequest* request = webkit_download_get_request(download.get()); + g_assert(request); + g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, sourceURI.get()); + g_assert_cmpint(test->m_downloadSize, ==, g_file_info_get_size(sourceInfo.get())); g_assert(webkit_download_get_destination(download.get())); g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1); @@ -328,6 +333,11 @@ static void testDownloadRemoteFile(DownloadTest* test, gconstpointer) g_assert_cmpint(events[4], ==, DownloadTest::Finished); events.clear(); + WebKitURIRequest* request = webkit_download_get_request(download.get()); + g_assert(request); + CString requestURI = kServer->getURIForPath("/test.pdf"); + g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, requestURI.data()); + g_assert(webkit_download_get_destination(download.get())); g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1); test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp index 39841756d..7de95e0f0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp @@ -300,13 +300,11 @@ public: g_main_loop_run(m_mainLoop); } - int waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse() + WebKitURIResponse* waitUntilResourceLoadFinsihedAndReturnURIResponse() { waitUntilResourceLoadFinsihed(); g_assert(m_resource); - WebKitURIResponse* response = webkit_web_resource_get_response(m_resource.get()); - g_assert(response); - return webkit_uri_response_get_status_code(response); + return webkit_web_resource_get_response(m_resource.get()); } GRefPtr<WebKitWebResource> m_resource; @@ -355,33 +353,48 @@ static void testWebResourceResponse(SingleResourceLoadTest* test, gconstpointer) { // No cached resource: First load. test->loadURI(kServer->getURIForPath("/javascript.html").data()); - gint statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + WebKitURIResponse* response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // No cached resource: Second load. test->loadURI(kServer->getURIForPath("/javascript.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // No cached resource: Reload. webkit_web_view_reload(test->m_webView); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: First load. test->loadURI(kServer->getURIForPath("/image.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: Second load. test->loadURI(kServer->getURIForPath("/image.html").data()); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_OK); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_OK); // Cached resource: Reload. webkit_web_view_reload(test->m_webView); - statusCode = test->waitUntilResourceLoadFinsihedAndReturnHTTPStatusResponse(); - g_assert_cmpint(statusCode, ==, SOUP_STATUS_NOT_MODIFIED); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpint(webkit_uri_response_get_status_code(response), ==, SOUP_STATUS_NOT_MODIFIED); +} + +static void testWebResourceMimeType(SingleResourceLoadTest* test, gconstpointer) +{ + test->loadURI(kServer->getURIForPath("/javascript.html").data()); + WebKitURIResponse* response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/javascript"); + + test->loadURI(kServer->getURIForPath("/image.html").data()); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "image/vnd.microsoft.icon"); + + test->loadURI(kServer->getURIForPath("/redirected-css.html").data()); + response = test->waitUntilResourceLoadFinsihedAndReturnURIResponse(); + g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/css"); } class ResourceURITrackingTest: public SingleResourceLoadTest { @@ -555,6 +568,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* addCacheHTTPHeadersToResponse(message); } 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"); } else if (g_str_equal(path, "/blank.ico")) { GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL)); char* contents; @@ -569,6 +583,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* " padding: 0px;" "}"; soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, simpleCSS, strlen(simpleCSS)); + soup_message_headers_append(message->response_headers, "Content-Type", "text/css"); } else if (g_str_equal(path, "/redirected.css")) { soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY); soup_message_headers_append(message->response_headers, "Location", "/simple-style.css"); @@ -585,6 +600,7 @@ void beforeAll() ResourcesTest::add("WebKitWebView", "resources", testWebViewResources); SingleResourceLoadTest::add("WebKitWebResource", "loading", testWebResourceLoading); SingleResourceLoadTest::add("WebKitWebResource", "response", testWebResourceResponse); + SingleResourceLoadTest::add("WebKitWebResource", "mime-type", testWebResourceMimeType); ResourceURITrackingTest::add("WebKitWebResource", "active-uri", testWebResourceActiveURI); ResourcesTest::add("WebKitWebResource", "get-data", testWebResourceGetData); ResourcesTest::add("WebKitWebView", "replaced-content", testWebViewResourcesReplacedContent); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index e4c60bebc..6ede533d4 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -706,6 +706,20 @@ static void testWebViewFullScreen(FullScreenClientTest* test, gconstpointer) g_assert_cmpint(test->m_event, ==, FullScreenClientTest::Leave); } +static void testWebViewCanShowMIMEType(WebViewTest* test, gconstpointer) +{ + // Supported MIME types. + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "text/html")); + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "text/plain")); + g_assert(webkit_web_view_can_show_mime_type(test->m_webView, "image/jpeg")); + + // Unsupported MIME types. + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "text/vcard")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/pdf")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/zip")); + g_assert(!webkit_web_view_can_show_mime_type(test->m_webView, "application/octet-stream")); +} + void beforeAll() { WebViewTest::add("WebKitWebView", "default-context", testWebViewDefaultContext); @@ -720,6 +734,7 @@ void beforeAll() WebViewTest::add("WebKitWebView", "run-javascript", testWebViewRunJavaScript); FileChooserTest::add("WebKitWebView", "file-chooser-request", testWebViewFileChooserRequest); FullScreenClientTest::add("WebKitWebView", "fullscreen", testWebViewFullScreen); + WebViewTest::add("WebKitWebView", "can-show-mime-type", testWebViewCanShowMIMEType); } void afterAll() diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index b58210a80..cc5c349e2 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -36,9 +36,11 @@ #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> #include <webkit2/WebKitMimeInfo.h> +#include <webkit2/WebKitNavigationPolicyDecision.h> #include <webkit2/WebKitPermissionRequest.h> #include <webkit2/WebKitPlugin.h> #include <webkit2/WebKitPrintOperation.h> +#include <webkit2/WebKitResponsePolicyDecision.h> #include <webkit2/WebKitScriptDialog.h> #include <webkit2/WebKitSettings.h> #include <webkit2/WebKitURIRequest.h> diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index 178e2dade..e0d6012d2 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -124,7 +124,7 @@ void QQuickWebPage::setContentsScale(qreal scale) ASSERT(scale > 0); d->contentsScale = scale; d->updateSize(); - emit d->viewportItem->experimental()->test()->contentsScaleCommitted(); + emit d->viewportItem->experimental()->test()->contentsScaleChanged(); } qreal QQuickWebPage::contentsScale() const diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 9d77171cc..5b43e337d 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -44,6 +44,7 @@ #include "qquickwebpage_p_p.h" #include "qquickwebview_p_p.h" #include "qwebdownloaditem_p_p.h" +#include "qwebiconimageprovider_p.h" #include "qwebkittest_p.h" #include "qwebloadrequest_p.h" #include "qwebnavigationhistory_p.h" @@ -54,13 +55,16 @@ #include <JavaScriptCore/JSBase.h> #include <JavaScriptCore/JSRetainPtr.h> #include <QDateTime> +#include <QtCore/QFile> #include <QtQml/QJSValue> +#include <QtQuick/QQuickView> #include <WKOpenPanelResultListener.h> #include <WKSerializedScriptValue.h> #include <WebCore/IntPoint.h> #include <WebCore/IntRect.h> #include <wtf/Assertions.h> #include <wtf/MainThread.h> +#include <wtf/Vector.h> #include <wtf/text/WTFString.h> using namespace WebCore; @@ -303,7 +307,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(toAPI(webPageProxy.get()))); QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); - QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QUrl, QUrl)), q_ptr, SLOT(_q_onIconChangedForPageURL(QUrl, QUrl))); + QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QString)), q_ptr, SLOT(_q_onIconChangedForPageURL(QString))); // Any page setting should preferrable be set before creating the page. webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); @@ -373,9 +377,6 @@ void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress) { Q_Q(QQuickWebView); - if (!loadProgress) - setIcon(QUrl()); - m_loadProgress = loadProgress; emit q->loadProgressChanged(); @@ -418,16 +419,6 @@ void QQuickWebViewPrivate::setNeedsDisplay() q->page()->update(); } -void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL) -{ - Q_Q(QQuickWebView); - - if (q->url() != pageURL) - return; - - setIcon(iconURL); -} - void QQuickWebViewPrivate::processDidCrash() { Q_Q(QQuickWebView); @@ -452,6 +443,7 @@ void QQuickWebViewPrivate::didRelaunchProcess() webPageProxy->drawingArea()->setSize(viewSize(), IntSize()); updateViewportSize(); + updateUserScripts(); } PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy() @@ -480,8 +472,38 @@ void QQuickWebViewPrivate::_q_onVisibleChanged() void QQuickWebViewPrivate::_q_onUrlChanged() { + updateIcon(); +} + +void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QString& pageUrl) +{ + if (pageUrl != QString(m_currentUrl)) + return; + + updateIcon(); +} + +/* Called either when the url changes, or when the icon for the current page changes */ +void QQuickWebViewPrivate::updateIcon() +{ Q_Q(QQuickWebView); - context->iconDatabase()->requestIconForPageURL(q->url()); + + QQuickView* view = qobject_cast<QQuickView*>(q->canvas()); + if (!view) + return; + + QWebIconImageProvider* provider = static_cast<QWebIconImageProvider*>( + view->engine()->imageProvider(QWebIconImageProvider::identifier())); + if (!provider) + return; + + WTF::String iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get()); + + if (iconUrl == m_iconUrl) + return; + + m_iconUrl = iconUrl; + emit q->iconChanged(); } void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem) @@ -641,31 +663,6 @@ void QQuickWebViewPrivate::addAttachedPropertyTo(QObject* object) attached->setView(q); } -void QQuickWebViewPrivate::setIcon(const QUrl& iconURL) -{ - Q_Q(QQuickWebView); - if (m_iconURL == iconURL) - return; - - if (!webPageProxy->mainFrame()) - return; - - String oldPageURL = QUrl::fromPercentEncoding(m_iconURL.encodedFragment()); - String newPageURL = webPageProxy->mainFrame()->url(); - - if (oldPageURL != newPageURL) { - QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); - if (!oldPageURL.isEmpty()) - iconDatabase->releaseIconForPageURL(oldPageURL); - - if (!newPageURL.isEmpty()) - iconDatabase->retainIconForPageURL(newPageURL); - } - - m_iconURL = iconURL; - emit q->iconChanged(); -} - bool QQuickWebViewPrivate::navigatorQtObjectEnabled() const { return m_navigatorQtObjectEnabled; @@ -679,6 +676,52 @@ void QQuickWebViewPrivate::setNavigatorQtObjectEnabled(bool enabled) context->setNavigatorQtObjectEnabled(webPageProxy.get(), enabled); } +static QString readUserScript(const QUrl& url) +{ + QString path; + if (url.isLocalFile()) + path = url.toLocalFile(); + else if (url.scheme() == QLatin1String("qrc")) + path = QStringLiteral(":") + url.path(); + else { + qWarning("QQuickWebView: Couldn't open '%s' as user script because only file:/// and qrc:/// URLs are supported.", qPrintable(url.toString())); + return QString(); + } + + QFile file(path); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qWarning("QQuickWebView: Couldn't open '%s' as user script due to error '%s'.", qPrintable(url.toString()), qPrintable(file.errorString())); + return QString(); + } + + QString contents = QString::fromUtf8(file.readAll()); + if (contents.isEmpty()) + qWarning("QQuickWebView: Ignoring '%s' as user script because file is empty.", qPrintable(url.toString())); + + return contents; +} + +void QQuickWebViewPrivate::updateUserScripts() +{ + Vector<String> scripts; + scripts.reserveCapacity(userScripts.size()); + + for (unsigned i = 0; i < userScripts.size(); ++i) { + const QUrl& url = userScripts.at(i); + if (!url.isValid()) { + qWarning("QQuickWebView: Couldn't open '%s' as user script because URL is invalid.", qPrintable(url.toString())); + continue; + } + + QString contents = readUserScript(url); + if (contents.isEmpty()) + continue; + scripts.append(String(contents)); + } + + webPageProxy->setUserScripts(scripts); +} + QPointF QQuickWebViewPrivate::contentPos() const { Q_Q(const QQuickWebView); @@ -727,12 +770,6 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) { - // Default values for the Legacy view. - attributes.devicePixelRatio = 1; - attributes.initialScale = 1; - attributes.minimumScale = 1; - attributes.maximumScale = 1; - attributes.userScalable = 0; } void QQuickWebViewLegacyPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) @@ -782,7 +819,8 @@ void QQuickWebViewLegacyPrivate::setZoomFactor(qreal factor) QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) - , pageIsSuspended(true) + , pageIsSuspended(false) + , lastCommittedScale(-1) { // Disable mouse events on the flickable web view so we do not // select text during pan gestures on platforms which send both @@ -823,30 +861,7 @@ void QQuickWebViewFlickablePrivate::onComponentComplete() void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& newAttributes) { - Q_Q(QQuickWebView); - - // FIXME: Revise these when implementing fit-to-width. - WebCore::ViewportAttributes attr = newAttributes; - WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr); - - // FIXME: Resetting here can reset more than needed. For instance it will end deferrers. - // This needs to be revised at some point. - interactionEngine->reset(); - - interactionEngine->setContentToDevicePixelRatio(attr.devicePixelRatio); - - interactionEngine->setAllowsUserScaling(!!attr.userScalable); - interactionEngine->setCSSScaleBounds(attr.minimumScale, attr.maximumScale); - - if (!interactionEngine->hadUserInteraction() && !pageIsSuspended) - interactionEngine->setCSSScale(attr.initialScale); - - this->attributes = attr; - emit q->experimental()->test()->viewportChanged(); - - // If the web app successively changes the viewport on purpose - // it wants to be in control and we should disable animations. - interactionEngine->setItemRectVisible(interactionEngine->nearestValidBounds()); + interactionEngine->viewportAttributesChanged(newAttributes); } void QQuickWebViewFlickablePrivate::updateViewportSize() @@ -876,14 +891,19 @@ void QQuickWebViewFlickablePrivate::_q_onInformVisibleContentChange(const QPoint if (!drawingArea) return; - const QRect visibleRect(visibleContentsRect()); + QRectF accurateVisibleRect(q->boundingRect()); + accurateVisibleRect.translate(contentPos()); + + if (accurateVisibleRect == drawingArea->contentsRect()) + return; + float scale = pageView->contentsScale(); - emit q->experimental()->test()->contentsScaleChanged(); + if (scale != lastCommittedScale) + emit q->experimental()->test()->contentsScaleCommitted(); + lastCommittedScale = scale; - QRectF accurateVisibleRect(q->boundingRect()); - accurateVisibleRect.translate(contentPos()); - drawingArea->setVisibleContentsRect(visibleRect, scale, trajectoryVector, FloatPoint(accurateVisibleRect.x(), accurateVisibleRect.y())); + drawingArea->setVisibleContentsRect(QRect(visibleContentsRect()), scale, trajectoryVector, FloatPoint(accurateVisibleRect.x(), accurateVisibleRect.y())); // Ensure that updatePaintNode is always called before painting. pageView->update(); @@ -908,38 +928,17 @@ void QQuickWebViewFlickablePrivate::_q_resume() void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) { - interactionEngine->pagePositionRequest(pos); + interactionEngine->pageContentPositionRequest(pos); } void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) { Q_Q(QQuickWebView); - QSize viewportSize = q->boundingRect().size().toSize(); pageView->setContentsSize(newSize); // emits contentsSizeChanged() - - float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(attributes, viewportSize, newSize); - - bool scaleCommitNotified = false; - - if (!qFuzzyCompare(minimumScale, attributes.minimumScale)) { - interactionEngine->setCSSScaleBounds(minimumScale, attributes.maximumScale); - emit q->experimental()->test()->viewportChanged(); - - if (!interactionEngine->hadUserInteraction() && !pageIsSuspended) { - // Emits contentsScaleCommitted(); - scaleCommitNotified = true; - interactionEngine->setCSSScale(minimumScale); - } - } - - // Emit for testing purposes, so that it can be verified that - // we didn't do scale adjustment. - if (!scaleCommitNotified) - emit q->experimental()->test()->contentsScaleCommitted(); + interactionEngine->pageContentsSizeChanged(newSize, q->boundingRect().size().toSize()); } - /*! \qmlsignal WebView::onNavigationRequested(WebNavigationRequest request) @@ -1296,6 +1295,22 @@ void QQuickWebViewExperimental::evaluateJavaScript(const QString& script, const d_ptr->webPageProxy.get()->runJavaScriptInMainFrame(script, ScriptValueCallback::create(closure, javaScriptCallback)); } +QList<QUrl> QQuickWebViewExperimental::userScripts() const +{ + Q_D(const QQuickWebView); + return d->userScripts; +} + +void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts) +{ + Q_D(QQuickWebView); + if (d->userScripts == userScripts) + return; + d->userScripts = userScripts; + d->updateUserScripts(); + emit userScriptsChanged(); +} + QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index) { const QObjectList children = property->object->children(); @@ -1494,7 +1509,7 @@ void QQuickWebView::emitUrlChangeIfNeeded() QUrl QQuickWebView::icon() const { Q_D(const QQuickWebView); - return d->m_iconURL; + return QUrl(d->m_iconUrl); } /*! diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index f33c6e654..cf469fb1e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -212,11 +212,12 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged()); Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged()); Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*)); - Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QUrl&, const QUrl&)); + Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QString&)); // Hides QObject::d_ptr allowing us to use the convenience macros. QScopedPointer<QQuickWebViewPrivate> d_ptr; QQuickWebViewExperimental* m_experimental; + friend class QWebKitTest; friend class WebKit::QtViewportInteractionEngine; friend class WebKit::QtWebPageLoadClient; friend class WebKit::QtWebPagePolicyClient; @@ -268,6 +269,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject { Q_PROPERTY(QQmlListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates) Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged) Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged) + Q_PROPERTY(QList<QUrl> userScripts READ userScripts WRITE setUserScripts NOTIFY userScriptsChanged) Q_ENUMS(NavigationRequestActionExperimental) public: @@ -300,6 +302,8 @@ public: void setUserAgent(const QString& userAgent); double devicePixelRatio() const; void setDevicePixelRatio(double); + QList<QUrl> userScripts() const; + void setUserScripts(const QList<QUrl>& userScripts); QWebKitTest* test(); @@ -353,6 +357,7 @@ Q_SIGNALS: void devicePixelRatioChanged(); void enterFullScreenRequested(); void exitFullScreenRequested(); + void userScriptsChanged(); private: QQuickWebView* q_ptr; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 572a7f226..69afc2d54 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -103,7 +103,7 @@ public: void _q_onVisibleChanged(); void _q_onUrlChanged(); void _q_onReceivedResponseFromDownload(QWebDownloadItem*); - void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString); + void _q_onIconChangedForPageURL(const QString&); void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtWebPageUIClient::FileChooserType); quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage); @@ -118,12 +118,12 @@ public: void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; } void setTransparentBackground(bool); void addAttachedPropertyTo(QObject*); - void setIcon(const QUrl&); bool navigatorQtObjectEnabled() const; bool renderToOffscreenBuffer() const { return m_renderToOffscreenBuffer; } bool transparentBackground() const; void setNavigatorQtObjectEnabled(bool); + void updateUserScripts(); QPointF contentPos() const; void setContentPos(const QPointF&); @@ -132,6 +132,8 @@ public: void setDialogActive(bool active) { m_dialogActive = active; } + void updateIcon(); + // PageClient. WebCore::IntSize viewSize() const; void didReceiveMessageFromNavigatorQtObject(const String& message); @@ -190,14 +192,14 @@ protected: QQmlComponent* filePicker; QQmlComponent* databaseQuotaDialog; - WebCore::ViewportAttributes attributes; + QList<QUrl> userScripts; bool m_useDefaultContentItemSize; bool m_navigatorQtObjectEnabled; bool m_renderToOffscreenBuffer; bool m_dialogActive; bool m_allowAnyHTTPSCertificateForLocalHost; - QUrl m_iconURL; + WTF::String m_iconUrl; int m_loadProgress; WTF::String m_currentUrl; }; @@ -239,6 +241,7 @@ public: private: QScopedPointer<WebKit::QtViewportInteractionEngine> interactionEngine; bool pageIsSuspended; + float lastCommittedScale; }; #endif // qquickwebview_p_p_h diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp index 71342a1e3..63dce28d0 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp @@ -24,6 +24,7 @@ #include "QtWebIconDatabaseClient.h" #include <QtCore/QUrl> #include <QtGui/QImage> +#include <wtf/text/StringHash.h> #include <wtf/text/WTFString.h> using namespace WebKit; @@ -37,24 +38,52 @@ QWebIconImageProvider::~QWebIconImageProvider() { } -QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) +WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String &pageURL, QtWebContext* context) { - QString decodedIconUrl = id; - decodedIconUrl.remove(0, decodedIconUrl.indexOf('#') + 1); - String pageURL = QString::fromUtf8(QUrl(decodedIconUrl).toEncoded()); + QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); + WTF::String iconURL = iconDatabase->iconForPageURL(pageURL); + + if (iconURL.isEmpty()) + return String(); + + QUrl url; + url.setScheme(QStringLiteral("image")); + url.setHost(QWebIconImageProvider::identifier()); + + QString path; + path.append(QLatin1Char('/')); + path.append(QString::number(context->contextID())); + path.append(QLatin1Char('/')); + path.append(QString::number(WTF::StringHash::hash(iconURL))); + url.setPath(path); + + // FIXME: Use QUrl::DecodedMode when landed in Qt + url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64())); + + // FIXME: We can't know when the icon url is no longer in use, + // so we never release these icons. At some point we might want + // to introduce expiry of icons to elevate this issue. + iconDatabase->retainIconForPageURL(pageURL); + return url.toString(QUrl::FullyEncoded); +} + +QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) +{ // The string identifier has the leading image://webicon/ already stripped, so we just // need to truncate from the first slash to get the context id. - QString contextIDAsString = id; - contextIDAsString.truncate(contextIDAsString.indexOf(QLatin1Char('/'))); + QString contextIDString = id.left(id.indexOf(QLatin1Char('/'))); bool ok = false; - uint64_t contextId = contextIDAsString.toUInt(&ok); + uint64_t contextId = contextIDString.toUInt(&ok); if (!ok) return QImage(); + QtWebContext* context = QtWebContext::contextByID(contextId); if (!context) return QImage(); + QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1())); + QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); QImage icon = requestedSize.isValid() ? iconDatabase->iconImageForPageURL(pageURL, requestedSize) : iconDatabase->iconImageForPageURL(pageURL); ASSERT(!icon.isNull()); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h index a54008a2c..7efe21a14 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h @@ -21,13 +21,23 @@ #define qwebiconimageprovider_p_h #include "qwebkitglobal.h" +#include <QString> #include <QtQuick/QQuickImageProvider> +#include <wtf/text/WTFString.h> + +namespace WebKit { + class QtWebContext; +} class QWEBKIT_EXPORT QWebIconImageProvider : public QQuickImageProvider { public: QWebIconImageProvider(); ~QWebIconImageProvider(); - QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); + + static QString identifier() { return QStringLiteral("webicon"); } + + WTF::String iconURLForPageURLInContext(const WTF::String& pageURL, WebKit::QtWebContext* context); + virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); }; #endif diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp index 529df01eb..e0a441c0e 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp @@ -22,9 +22,10 @@ #include "qwebkittest_p.h" #include "QtViewportInteractionEngine.h" -#include "QtWebPageEventHandler.h" -#include "qquickwebview_p.h" #include "qquickwebview_p_p.h" +#include "qwindowsysteminterface_qpa.h" +#include <QMutableListIterator> +#include <QTouchEvent> using namespace WebKit; @@ -43,41 +44,71 @@ static QTouchEvent::TouchPoint touchPoint(qreal x, qreal y) QPointF localPos(x, y); QTouchEvent::TouchPoint point; + point.setId(1); point.setLastPos(localPos); QRectF touchRect(0, 0, 40, 40); touchRect.moveCenter(localPos); point.setRect(touchRect); + point.setPressure(1); return point; } +bool QWebKitTest::sendTouchEvent(QQuickWebView* window, QEvent::Type type, const QList<QTouchEvent::TouchPoint>& points, ulong timestamp) +{ + ASSERT(window); + + static QTouchDevice* device = 0; + if (!device) { + device = new QTouchDevice; + device->setType(QTouchDevice::TouchScreen); + QWindowSystemInterface::registerTouchDevice(device); + } + + Qt::TouchPointStates touchPointStates = 0; + foreach (const QTouchEvent::TouchPoint& touchPoint, points) + touchPointStates |= touchPoint.state(); + + QTouchEvent event(type, device, Qt::NoModifier, touchPointStates, points); + event.setTimestamp(timestamp); + event.setAccepted(false); + + window->touchEvent(&event); + + return event.isAccepted(); +} + bool QWebKitTest::touchTap(QObject* item, qreal x, qreal y, int delay) { - if (!qobject_cast<QQuickWebView*>(item)) { - // FIXME: We only support the actual web view for now. - qWarning("Touch event \"DoubleTap\" not accepted by receiving item"); + QQuickWebView* window = qobject_cast<QQuickWebView*>(item); + + if (!window) { + qWarning("Touch event \"TouchBegin\" not accepted by receiving item"); return false; } // FIXME: implement delay using QTest::qWait() or similar. Q_UNUSED(delay); - m_webViewPrivate->pageView->eventHandler()->handleSingleTapEvent(touchPoint(x, y)); + + QList<QTouchEvent::TouchPoint> points; + points.append(touchPoint(x, y)); + + points[0].setState(Qt::TouchPointPressed); + sendTouchEvent(window, QEvent::TouchBegin, points, QDateTime::currentMSecsSinceEpoch()); + + points[0].setState(Qt::TouchPointReleased); + sendTouchEvent(window, QEvent::TouchEnd, points, QDateTime::currentMSecsSinceEpoch()); return true; } bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay) { - if (!qobject_cast<QQuickWebView*>(item)) { - // FIXME: We only support the actual web view for now. - qWarning("Touch event \"DoubleTap\" not accepted by receiving item"); + if (!touchTap(item, x, y, delay)) return false; - } - - // FIXME: implement delay using QTest::qWait() or similar. - Q_UNUSED(delay); - m_webViewPrivate->pageView->eventHandler()->handleDoubleTapEvent(touchPoint(x, y)); + if (!touchTap(item, x, y, delay)) + return false; return true; } @@ -89,44 +120,49 @@ QSize QWebKitTest::contentsSize() const QVariant QWebKitTest::contentsScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->currentCSSScale(); - - return m_webViewPrivate->attributes.initialScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->currentCSSScale(); + return QVariant(); } QVariant QWebKitTest::devicePixelRatio() const { - return m_webViewPrivate->attributes.devicePixelRatio; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_devicePixelRatio; + return QVariant(); } QVariant QWebKitTest::initialScale() const { - return m_webViewPrivate->attributes.initialScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_rawAttributes.initialScale; + return QVariant(); } QVariant QWebKitTest::minimumScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->m_minimumScale; - - return m_webViewPrivate->attributes.minimumScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_minimumScale; + return QVariant(); } QVariant QWebKitTest::maximumScale() const { - if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) - return interactionEngine->m_maximumScale; - - return m_webViewPrivate->attributes.maximumScale; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return viewport->m_maximumScale; + return QVariant(); } QVariant QWebKitTest::isScalable() const { - return !!m_webViewPrivate->attributes.userScalable; + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return !!viewport->m_rawAttributes.userScalable; + return QVariant(); } QVariant QWebKitTest::layoutSize() const { - return QSizeF(m_webViewPrivate->attributes.layoutSize); + if (QtViewportInteractionEngine* viewport = m_webViewPrivate->viewportInteractionEngine()) + return QSizeF(viewport->m_rawAttributes.layoutSize); + return QVariant(); } diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h index 613486409..982398d3a 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h @@ -22,6 +22,7 @@ #define qwebkittest_p_h #include "qwebkitglobal.h" +#include "qquickwebview_p.h" #include <QtCore/QObject> #include <QtCore/QPointer> @@ -60,6 +61,8 @@ public: QWebKitTest(QQuickWebViewPrivate* webviewPrivate, QObject* parent = 0); virtual ~QWebKitTest(); + bool sendTouchEvent(QQuickWebView* window, QEvent::Type type, const QList<QTouchEvent::TouchPoint>& points, ulong timestamp); + QSize contentsSize() const; QVariant contentsScale() const; 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 6c0cb4b62..0e3b33cf7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp @@ -17,6 +17,8 @@ Boston, MA 02110-1301, USA. */ +#include "config.h" + #include <QMetaEnum> #include <QMetaMethod> #include <QMetaObject> @@ -142,7 +144,7 @@ static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringL { if (method.access() != QMetaMethod::Private) { const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void"; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#if HAVE(QT5) *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName)); #else *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName); diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 5cc6f35f5..fd940d43d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -16,3 +16,5 @@ DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" OTHER_FILES += \ WebView/* \ common/* + +RESOURCES = resources.qrc diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml index 8210040e8..f6ed4b261 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml @@ -20,6 +20,7 @@ TestWebView { TestCase { id: test name: "WebViewLoadFavIcon" + when: windowShown function init() { if (webView.icon != '') { @@ -36,7 +37,6 @@ TestWebView { var url = Qt.resolvedUrl("../common/favicon.html") webView.url = url verify(webView.waitForLoadSucceeded()) - expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133") compare(spy.count, 1) compare(favicon.width, 48) compare(favicon.height, 48) @@ -47,7 +47,6 @@ TestWebView { var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!") webView.url = url verify(webView.waitForLoadSucceeded()) - expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133") compare(spy.count, 1) compare(favicon.width, 16) compare(favicon.height, 16) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml index d3d7786a3..78ea6f94f 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Moved to Desktop tests because we want to have mouseClick() to open the <select> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -59,7 +57,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml index 1b3ab6314..9f16bb8b6 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml @@ -45,7 +45,7 @@ Item { } TestCase { - name: "DesktopWebViewMessaging" + name: "WebViewMessaging" property url testUrl: Qt.resolvedUrl("../common/messaging.html") function init() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml index f43f65672..73ea70845 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_multiFileUpload.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Added to Desktop tests because we want to have mouseClick() to open the <input> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -46,7 +44,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml index 7ca9efa38..be1409b7f 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml @@ -4,8 +4,6 @@ import QtWebKit 3.0 import QtWebKit.experimental 1.0 import "../common" -// FIXME: Added to Desktop tests because we want to have mouseClick() to open the <input> tag. We can move it back -// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. TestWebView { id: webView @@ -51,7 +49,7 @@ TestWebView { } function openItemSelector() { - mouseClick(webView, 15, 15, Qt.LeftButton) + webView.experimental.test.touchTap(webView, 15, 15) } function test_accept() { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml new file mode 100644 index 000000000..3d15aca05 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml @@ -0,0 +1,113 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import "../common" + +Item { + TestWebView { + id: webView + width: 400 + height: 300 + } + + TestWebView { + id: webViewWithConditionalUserScripts + width: 400 + height: 300 + + onNavigationRequested: { + var urlString = request.url.toString(); + if (urlString.indexOf("test1.html") !== -1) + experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; + else if (urlString.indexOf("test2.html") !== -1) + experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; + else + experimental.userScripts = []; + } + } + + TestCase { + name: "WebViewUserScripts" + + function init() { + webView.url = ""; + webView.experimental.userScripts = []; + } + + function test_oneScript() { + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1"); + + webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; + compare(webView.title, "Test page 1"); + + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + + webView.url = Qt.resolvedUrl("../common/test2.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + + webView.experimental.userScripts = []; + compare(webView.title, "New title"); + + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page with huge link area"); + } + + function test_twoScripts() { + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1"); + + webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js"), Qt.resolvedUrl("../common/append-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title with appendix"); + + // Make sure we can remove scripts from the preload list. + webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "Test page 1 with appendix"); + + // Make sure the scripts are loaded in order. + webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js"), Qt.resolvedUrl("../common/change-document-title.js")]; + webView.reload(); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + } + + function test_setUserScriptsConditionally() { + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test1.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "New title"); + + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test2.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "Test page with huge link area with appendix"); + + webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test3.html"); + webViewWithConditionalUserScripts.waitForLoadSucceeded(); + compare(webViewWithConditionalUserScripts.title, "Test page 3"); + } + + function test_bigScript() { + webView.experimental.userScripts = [Qt.resolvedUrl("../common/big-user-script.js")]; + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "Big user script changed title"); + } + + function test_fromResourceFile() { + webView.experimental.userScripts = ["qrc:///common/change-document-title.js"]; + webView.url = Qt.resolvedUrl("../common/test1.html"); + webView.waitForLoadSucceeded(); + compare(webView.title, "New title"); + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js new file mode 100644 index 000000000..fb4a2a6f2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js @@ -0,0 +1 @@ +document.title += " with appendix"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js new file mode 100644 index 000000000..e6e3d2b44 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js @@ -0,0 +1,110 @@ +// Used to make sure serialization of user scripts between UI process and Web process can handle files bigger +// than the maximum message size defined in ConnectionXXX classes. + +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////////////////////////////////// + +document.title = "Big user script changed title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js new file mode 100644 index 000000000..bdae45c21 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js @@ -0,0 +1 @@ +document.title = "New title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc new file mode 100644 index 000000000..1696aaac1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>common/change-document-title.js</file> + </qresource> +</RCC> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 358a2328c..2704efe4a 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -11,6 +11,7 @@ SOURCES += ../util.cpp \ INCLUDEPATH += $$PWD QT += testlib qml quick quick-private webkit +WEBKIT += wtf # For platform macros DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \ QWP_PATH=\\\"$${ROOT_BUILD_DIR}/bin\\\" diff --git a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm index 70dccc58a..bfc270c69 100644 --- a/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm +++ b/Source/WebKit2/UIProcess/Launcher/mac/DynamicLinkerEnvironmentExtractor.mm @@ -88,7 +88,7 @@ void DynamicLinkerEnvironmentExtractor::processEnvironmentVariable(const char* e return; CString value(equalsLocation + 1); - m_extractedVariables.append(make_pair(name.latin1(), value)); + m_extractedVariables.append(std::make_pair(name.latin1(), value)); } size_t DynamicLinkerEnvironmentExtractor::processLoadCommand(const void* data, size_t length, bool shouldByteSwap) diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index d2f18070e..742aea62c 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -451,7 +451,7 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { if (!m_process || !m_process->canSendMessage()) { - m_pendingMessagesToPostToInjectedBundle.append(make_pair(messageName, messageBody)); + m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); return; } diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 72d469590..95e6c1339 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -336,6 +336,7 @@ public: void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password); void certificateVerificationRequest(const String& hostname, bool& ignoreErrors); void proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password); + void setUserScripts(const Vector<String>&); #endif // PLATFORM(QT). #if PLATFORM(QT) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 8541cfb7c..de60a7166 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -232,17 +232,17 @@ messages -> WebPageProxy { # Drag and drop messages #if ENABLE(DRAG_SUPPORT) DidPerformDragControllerAction(WebCore::DragSession dragSession) -#if PLATFORM(MAC) +#endif +#if PLATFORM(MAC) && ENABLE(DRAG_SUPPORT) SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag) SetPromisedData(WTF::String pasteboardName, WebKit::SharedMemory::Handle imageHandle, uint64_t imageSize, WTF::String filename, WTF::String extension, WTF::String title, WTF::String url, WTF::String visibleURL, WebKit::SharedMemory::Handle archiveHandle, uint64_t archiveSize) #endif -#if PLATFORM(WIN) +#if PLATFORM(WIN) && ENABLE(DRAG_SUPPORT) StartDragDrop(WebCore::IntPoint imagePoint, WebCore::IntPoint dragPoint, uint64_t okEffect, HashMap<UINT,Vector<String> > dataMap, uint64_t fileSize, String pathname, WebKit::SharedMemory::Handle fileContentHandle, WebCore::IntSize dragImageSize, WebKit::SharedMemory::Handle dragImage, bool linkDrag) #endif -#if PLATFORM(QT) || PLATFORM(GTK) +#if (PLATFORM(QT) || PLATFORM(GTK)) && ENABLE(DRAG_SUPPORT) StartDrag(WebCore::DragData dragData, WebKit::ShareableBitmap::Handle dragImage) #endif -#endif #if PLATFORM(MAC) # Dictionary support. diff --git a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp index fec82b773..ae0fd3669 100644 --- a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp +++ b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp @@ -34,7 +34,7 @@ #include <cairo/cairo.h> #if PLATFORM(EFL) -#include "ewk_private.h" +#include "ewk_view_private.h" #endif using namespace WebCore; diff --git a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm index 649176215..68e2cd314 100644 --- a/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm +++ b/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm @@ -183,6 +183,28 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1; #pragma mark - #pragma mark Exposed Interface +static RetainPtr<CGDataProviderRef> createImageProviderWithCopiedData(CGDataProviderRef sourceProvider) +{ + RetainPtr<CFDataRef> data = adoptCF(CGDataProviderCopyData(sourceProvider)); + return adoptCF(CGDataProviderCreateWithCFData(data.get())); +} + +static RetainPtr<CGImageRef> createImageWithCopiedData(CGImageRef sourceImage) +{ + size_t width = CGImageGetWidth(sourceImage); + size_t height = CGImageGetHeight(sourceImage); + size_t bitsPerComponent = CGImageGetBitsPerComponent(sourceImage); + size_t bitsPerPixel = CGImageGetBitsPerPixel(sourceImage); + size_t bytesPerRow = CGImageGetBytesPerRow(sourceImage); + CGColorSpaceRef colorSpace = CGImageGetColorSpace(sourceImage); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(sourceImage); + RetainPtr<CGDataProviderRef> provider = createImageProviderWithCopiedData(CGImageGetDataProvider(sourceImage)); + bool shouldInterpolate = CGImageGetShouldInterpolate(sourceImage); + CGColorRenderingIntent intent = CGImageGetRenderingIntent(sourceImage); + + return adoptCF(CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, bitmapInfo, provider.get(), 0, shouldInterpolate, intent)); +} + - (void)enterFullScreen:(NSScreen *)screen { if (_isFullScreen) @@ -204,6 +226,11 @@ static const NSTimeInterval DefaultWatchdogTimerInterval = 1; CGWindowID windowID = [[_webView window] windowNumber]; RetainPtr<CGImageRef> webViewContents(AdoptCF, CGWindowListCreateImage(NSRectToCGRect(webViewFrame), kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageShouldBeOpaque)); + // Using the returned CGImage directly would result in calls to the WindowServer every time + // the image was painted. Instead, copy the image data into our own process to eliminate that + // future overhead. + webViewContents = createImageWithCopiedData(webViewContents.get()); + // Screen updates to be re-enabled in beganEnterFullScreenWithInitialFrame:finalFrame: NSDisableScreenUpdates(); [[self window] setAutodisplay:NO]; diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp index d3d5efef2..45c6499da 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp @@ -24,6 +24,7 @@ #include "qquickwebpage_p.h" #include "qquickwebview_p.h" +#include "qwebkittest_p.h" #include <QPointF> #include <QTransform> #include <QWheelEvent> @@ -113,6 +114,12 @@ inline qreal QtViewportInteractionEngine::itemCoordFromCSS(qreal value) const return value * m_devicePixelRatio; } +static inline QPointF boundPosition(const QPointF minPosition, const QPointF& position, const QPointF& maxPosition) +{ + return QPointF(qBound(minPosition.x(), position.x(), maxPosition.x()), + qBound(minPosition.y(), position.y(), maxPosition.y())); +} + inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect) const { QRectF itemRect; @@ -125,9 +132,9 @@ inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect return itemRect; } -QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewport, QQuickWebPage* content) - : m_viewport(viewport) - , m_content(content) +QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewportItem, QQuickWebPage* pageItem) + : m_viewportItem(viewportItem) + , m_pageItem(pageItem) , m_suspendCount(0) , m_hasSuspendedContent(false) , m_hadUserInteraction(false) @@ -137,10 +144,10 @@ QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewport { reset(); - connect(m_content, SIGNAL(widthChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection); - connect(m_content, SIGNAL(heightChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection); - connect(m_viewport, SIGNAL(movementStarted()), SLOT(flickableMoveStarted()), Qt::DirectConnection); - connect(m_viewport, SIGNAL(movementEnded()), SLOT(flickableMoveEnded()), Qt::DirectConnection); + connect(m_pageItem, SIGNAL(widthChanged()), SLOT(pageItemSizeChanged()), Qt::DirectConnection); + connect(m_pageItem, SIGNAL(heightChanged()), SLOT(pageItemSizeChanged()), Qt::DirectConnection); + connect(m_viewportItem, SIGNAL(movementStarted()), SLOT(flickMoveStarted()), Qt::DirectConnection); + connect(m_viewportItem, SIGNAL(movementEnded()), SLOT(flickMoveEnded()), Qt::DirectConnection); connect(m_scaleAnimation, SIGNAL(valueChanged(QVariant)), SLOT(scaleAnimationValueChanged(QVariant)), Qt::DirectConnection); @@ -168,20 +175,74 @@ qreal QtViewportInteractionEngine::outerBoundedCSSScale(qreal cssScale) const return innerBoundedCSSScale(cssScale); } -void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect) +void QtViewportInteractionEngine::viewportAttributesChanged(const WebCore::ViewportAttributes& newAttributes) { + m_rawAttributes = newAttributes; + WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); + + // FIXME: Resetting here can reset more than needed. For instance it will end deferrers. + // This needs to be revised at some point. + reset(); + + + // FIXME: Should get directly from the webPageProxy. + setDevicePixelRatio(m_rawAttributes.devicePixelRatio); + + setAllowsUserScaling(!!m_rawAttributes.userScalable); + setCSSScaleBounds(m_rawAttributes.minimumScale, m_rawAttributes.maximumScale); + + if (!m_hadUserInteraction && !m_hasSuspendedContent) { + // Emits contentsScaleChanged(); + setCSSScale(m_rawAttributes.initialScale); + } + + emit m_viewportItem->experimental()->test()->viewportChanged(); + + // If the web app successively changes the viewport on purpose + // it wants to be in control and we should disable animations. + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); +} + +void QtViewportInteractionEngine::pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize) +{ + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, viewportSize, newSize); + + if (!qFuzzyCompare(minimumScale, m_rawAttributes.minimumScale)) { + setCSSScaleBounds(minimumScale, m_rawAttributes.maximumScale); + emit m_viewportItem->experimental()->test()->viewportChanged(); + + if (!m_hadUserInteraction && !m_hasSuspendedContent) { + // Emits contentsScaleChanged(); + setCSSScale(minimumScale); + } + } + + // Emit for testing purposes, so that it can be verified that + // we didn't do scale adjustment. + emit m_viewportItem->experimental()->test()->contentsScaleCommitted(); + + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); +} + +void QtViewportInteractionEngine::setPageItemRectVisible(const QRectF& itemRect) +{ + ASSERT_WITH_MESSAGE(m_suspendCount, + "setPageItemRectVisible has to be guarded using a ViewportUpdateDeferrer."); + if (itemRect.isEmpty()) return; - qreal itemScale = m_viewport->width() / itemRect.width(); + qreal itemScale = m_viewportItem->width() / itemRect.width(); - m_content->setContentsScale(itemScale); + m_pageItem->setContentsScale(itemScale); // To animate the position together with the scale we multiply the position with the current scale // and add it to the page position (displacement on the flickable contentItem because of additional items). - QPointF newPosition(m_content->pos() + (itemRect.topLeft() * itemScale)); + QPointF newPosition(m_pageItem->pos() + (itemRect.topLeft() * itemScale)); - m_viewport->setContentPos(newPosition); + m_viewportItem->setContentPos(newPosition); } // Ease out overshoot of 1.25 combined with ease in correction of 0.25. Both quadratic to have physical motion. @@ -190,7 +251,7 @@ static qreal physicalOvershoot(qreal t) return (-t * (t - 2)) * 1.25 - (t * t) * 0.25; } -void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect) +void QtViewportInteractionEngine::animatePageItemRectVisible(const QRectF& itemRect) { ASSERT(m_scaleAnimation->state() == QAbstractAnimation::Stopped); @@ -198,64 +259,74 @@ void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect) if (scrollAnimationActive()) return; - QRectF currentItemRectVisible = m_viewport->mapRectToWebContent(m_viewport->boundingRect()); - if (itemRect == currentItemRectVisible) + QRectF currentPageItemRectVisible = m_viewportItem->mapRectToWebContent(m_viewportItem->boundingRect()); + if (itemRect == currentPageItemRectVisible) return; - // FIXME: Investigate why that animation doesn't run when we are unfocused. - if (!m_viewport->isVisible() || !m_viewport->hasFocus()) { - // Apply the end result immediately when we are non-visible. - setItemRectVisible(itemRect); - return; - } - QEasingCurve easingCurve; easingCurve.setCustomType(physicalOvershoot); m_scaleAnimation->setDuration(kScaleAnimationDurationMillis); m_scaleAnimation->setEasingCurve(easingCurve); - m_scaleAnimation->setStartValue(currentItemRectVisible); + m_scaleAnimation->setStartValue(currentPageItemRectVisible); m_scaleAnimation->setEndValue(itemRect); m_scaleAnimation->start(); } -void QtViewportInteractionEngine::flickableMoveStarted() +void QtViewportInteractionEngine::flickMoveStarted() { - Q_ASSERT(m_viewport->isMoving()); + Q_ASSERT(m_viewportItem->isMoving()); m_scrollUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); - m_lastScrollPosition = m_viewport->contentPos(); - connect(m_viewport, SIGNAL(contentXChanged()), SLOT(flickableMovingPositionUpdate())); - connect(m_viewport, SIGNAL(contentYChanged()), SLOT(flickableMovingPositionUpdate())); + m_lastScrollPosition = m_viewportItem->contentPos(); + connect(m_viewportItem, SIGNAL(contentXChanged()), SLOT(pageItemPositionChanged())); + connect(m_viewportItem, SIGNAL(contentYChanged()), SLOT(pageItemPositionChanged())); } -void QtViewportInteractionEngine::flickableMoveEnded() +void QtViewportInteractionEngine::flickMoveEnded() { - Q_ASSERT(!m_viewport->isMoving()); + Q_ASSERT(!m_viewportItem->isMoving()); // This method is called on the end of the pan or pan kinetic animation. m_scrollUpdateDeferrer.clear(); m_lastScrollPosition = QPointF(); - disconnect(m_viewport, SIGNAL(contentXChanged()), this, SLOT(flickableMovingPositionUpdate())); - disconnect(m_viewport, SIGNAL(contentYChanged()), this, SLOT(flickableMovingPositionUpdate())); + disconnect(m_viewportItem, SIGNAL(contentXChanged()), this, SLOT(pageItemPositionChanged())); + disconnect(m_viewportItem, SIGNAL(contentYChanged()), this, SLOT(pageItemPositionChanged())); } -void QtViewportInteractionEngine::flickableMovingPositionUpdate() +void QtViewportInteractionEngine::pageItemPositionChanged() { - QPointF newPosition = m_viewport->contentPos(); + QPointF newPosition = m_viewportItem->contentPos(); emit informVisibleContentChange(m_lastScrollPosition - newPosition); m_lastScrollPosition = newPosition; } +void QtViewportInteractionEngine::pageContentPositionRequest(const QPoint& cssPosition) +{ + // Ignore the request if suspended. Can only happen due to delay in event delivery. + if (m_suspendCount) + return; + + qreal endItemScale = m_pageItem->contentsScale(); // Stay at same scale. + + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); + QPointF endPosition = boundPosition(endPosRange.topLeft(), cssPosition * endItemScale, endPosRange.bottomRight()); + + QRectF endVisibleContentRect(endPosition / endItemScale, m_viewportItem->boundingRect().size() / endItemScale); + + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(endVisibleContentRect); +} + void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/) { switch (newState) { case QAbstractAnimation::Running: - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); ASSERT(!m_animationUpdateDeferrer); m_animationUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); break; @@ -267,29 +338,9 @@ void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation: } } -static inline QPointF boundPosition(const QPointF minPosition, const QPointF& position, const QPointF& maxPosition) -{ - return QPointF(qBound(minPosition.x(), position.x(), maxPosition.x()), - qBound(minPosition.y(), position.y(), maxPosition.y())); -} - -void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition) +void QtViewportInteractionEngine::scaleAnimationValueChanged(QVariant value) { - // Ignore the request if suspended. Can only happen due to delay in event delivery. - if (m_suspendCount) - return; - - qreal endItemScale = m_content->contentsScale(); // Stay at same scale. - - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); - QPointF endPosition = boundPosition(endPosRange.topLeft(), pagePosition * endItemScale, endPosRange.bottomRight()); - - QRectF endVisibleContentRect(endPosition / endItemScale, m_viewport->boundingRect().size() / endItemScale); - - setItemRectVisible(endVisibleContentRect); - - // Make sure that tiles all around the viewport will be requested. - emit informVisibleContentChange(QPointF()); + setPageItemRectVisible(value.toRectF()); } void QtViewportInteractionEngine::touchBegin() @@ -306,10 +357,10 @@ void QtViewportInteractionEngine::touchEnd() m_touchUpdateDeferrer.clear(); } -QRectF QtViewportInteractionEngine::computePosRangeForItemAtScale(qreal itemScale) const +QRectF QtViewportInteractionEngine::computePosRangeForPageItemAtScale(qreal itemScale) const { - const QSizeF contentItemSize = m_content->contentsSize() * itemScale; - const QSizeF viewportItemSize = m_viewport->boundingRect().size(); + const QSizeF contentItemSize = m_pageItem->contentsSize() * itemScale; + const QSizeF viewportItemSize = m_viewportItem->boundingRect().size(); const qreal horizontalRange = contentItemSize.width() - viewportItemSize.width(); const qreal verticalRange = contentItemSize.height() - viewportItemSize.height(); @@ -325,7 +376,7 @@ void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, con QRectF endArea = itemRectFromCSS(targetArea); qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(2.0)); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); qreal x; const qreal borderOffset = 10; @@ -345,13 +396,13 @@ void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, con const QPointF viewportHotspot = QPointF(x, /* FIXME: visibleCenter */ viewportRect.center().y()); QPointF endPosition = hotspot * endItemScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); - animateItemRectVisible(endVisibleContentRect); + animatePageItemRectVisible(endVisibleContentRect); } void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea) @@ -368,12 +419,12 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi const int margin = 10; // We want at least a little bit of margin. QRectF endArea = itemRectFromCSS(targetArea.adjusted(-margin, -margin, margin, margin)); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); qreal targetCSSScale = viewportRect.size().width() / endArea.size().width(); qreal endCSSScale = innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5))); qreal endItemScale = itemScaleFromCSS(endCSSScale); - qreal currentScale = m_content->contentsScale(); + qreal currentScale = m_pageItem->contentsScale(); // We want to end up with the target area filling the whole width of the viewport (if possible), // and centralized vertically where the user requested zoom. Thus our hotspot is the center of @@ -383,7 +434,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi QPointF endPosition = hotspot * endCSSScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); @@ -396,7 +447,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi // Use fuzzy compare with a fixed error to be able to deal with largish differences due to pixel rounding. if (fuzzyCompare(endItemScale, currentScale, 0.01)) { // If moving the viewport would expose more of the targetRect and move at least 40 pixels, update position but do not scale out. - QRectF currentContentRect(m_viewport->contentPos() / currentScale, viewportRect.size() / currentScale); + QRectF currentContentRect(m_viewportItem->contentPos() / currentScale, viewportRect.size() / currentScale); QRectF targetIntersection = endVisibleContentRect.intersected(targetArea); if (!currentContentRect.contains(targetIntersection) && (qAbs(endVisibleContentRect.top() - currentContentRect.top()) >= 40 || qAbs(endVisibleContentRect.left() - currentContentRect.left()) >= 40)) zoomAction = NoZoom; @@ -410,7 +461,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi switch (zoomAction) { case ZoomIn: - m_scaleStack.append(ScaleStackItem(currentScale, m_viewport->contentPos().x())); + m_scaleStack.append(ScaleStackItem(currentScale, m_viewportItem->contentPos().x())); m_zoomOutScale = endItemScale; break; case ZoomBack: { @@ -420,7 +471,7 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi // Recalculate endPosition and bound it according to new scale. endPosition.setY(hotspot.y() * endCSSScale - viewportHotspot.y()); endPosition.setX(lastScale.xPosition); - endPosRange = computePosRangeForItemAtScale(endItemScale); + endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); endVisibleContentRect = QRectF(endPosition / endItemScale, viewportRect.size() / endItemScale); break; @@ -435,19 +486,19 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi break; } - animateItemRectVisible(endVisibleContentRect); + animatePageItemRectVisible(endVisibleContentRect); } QRectF QtViewportInteractionEngine::nearestValidBounds() const { qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(currentCSSScale())); - const QRectF viewportRect = m_viewport->boundingRect(); + const QRectF viewportRect = m_viewportItem->boundingRect(); QPointF viewportHotspot = viewportRect.center(); - QPointF endPosition = m_viewport->mapToWebContent(viewportHotspot) * endItemScale - viewportHotspot; + QPointF endPosition = m_viewportItem->mapToWebContent(viewportHotspot) * endItemScale - viewportHotspot; - QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); + QRectF endPosRange = computePosRangeForPageItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); @@ -468,7 +519,7 @@ void QtViewportInteractionEngine::reset() m_pinchStartScale = -1; m_zoomOutScale = 0.0; - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); m_scaleAnimation->stop(); m_scaleUpdateDeferrer.clear(); m_scrollUpdateDeferrer.clear(); @@ -486,22 +537,22 @@ void QtViewportInteractionEngine::setCSSScale(qreal scale) ViewportUpdateDeferrer guard(this); qreal newScale = innerBoundedCSSScale(scale); - m_content->setContentsScale(itemScaleFromCSS(newScale)); + m_pageItem->setContentsScale(itemScaleFromCSS(newScale)); } qreal QtViewportInteractionEngine::currentCSSScale() const { - return cssScaleFromItem(m_content->contentsScale()); + return cssScaleFromItem(m_pageItem->contentsScale()); } bool QtViewportInteractionEngine::scrollAnimationActive() const { - return m_viewport->isFlicking(); + return m_viewportItem->isFlicking(); } bool QtViewportInteractionEngine::panGestureActive() const { - return m_viewport->isDragging(); + return m_viewportItem->isDragging(); } void QtViewportInteractionEngine::panGestureStarted(const QPointF& position, qint64 eventTimestampMillis) @@ -509,19 +560,19 @@ void QtViewportInteractionEngine::panGestureStarted(const QPointF& position, qin // This can only happen as a result of a user interaction. ASSERT(m_hadUserInteraction); - m_viewport->handleFlickableMousePress(position, eventTimestampMillis); + m_viewportItem->handleFlickableMousePress(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } void QtViewportInteractionEngine::panGestureRequestUpdate(const QPointF& position, qint64 eventTimestampMillis) { - m_viewport->handleFlickableMouseMove(position, eventTimestampMillis); + m_viewportItem->handleFlickableMouseMove(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } void QtViewportInteractionEngine::panGestureEnded(const QPointF& position, qint64 eventTimestampMillis) { - m_viewport->handleFlickableMouseRelease(position, eventTimestampMillis); + m_viewportItem->handleFlickableMouseRelease(position, eventTimestampMillis); m_lastPinchCenterInViewportCoordinates = position; } @@ -534,7 +585,7 @@ void QtViewportInteractionEngine::panGestureCancelled() // back inside valid bounds. // When the pinch gesture ends, the content is positioned and scaled // back to valid boundaries. - m_viewport->cancelFlick(); + m_viewportItem->cancelFlick(); } bool QtViewportInteractionEngine::scaleAnimationActive() const @@ -552,8 +603,9 @@ void QtViewportInteractionEngine::cancelScrollAnimation() // pan gesture, the animation is stopped and the content is // immediately positioned back to valid boundaries. - m_viewport->cancelFlick(); - setItemRectVisible(nearestValidBounds()); + m_viewportItem->cancelFlick(); + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); } void QtViewportInteractionEngine::interruptScaleAnimation() @@ -581,10 +633,7 @@ void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenter m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent)); m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; - m_pinchStartScale = m_content->contentsScale(); - - // Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end. - emit informVisibleContentChange(QPointF()); + m_pinchStartScale = m_pageItem->contentsScale(); } void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInViewportCoordinates, qreal totalScaleFactor) @@ -601,12 +650,12 @@ void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinch // Allow zooming out beyond mimimum scale on pages that do not explicitly disallow it. const qreal targetCSSScale = outerBoundedCSSScale(cssScale); - scaleContent(m_viewport->mapToWebContent(pinchCenterInViewportCoordinates), targetCSSScale); + scaleContent(m_viewportItem->mapToWebContent(pinchCenterInViewportCoordinates), targetCSSScale); const QPointF positionDiff = pinchCenterInViewportCoordinates - m_lastPinchCenterInViewportCoordinates; m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; - m_viewport->setContentPos(m_viewport->contentPos() - positionDiff); + m_viewportItem->setContentPos(m_viewportItem->contentPos() - positionDiff); } void QtViewportInteractionEngine::pinchGestureEnded() @@ -618,7 +667,7 @@ void QtViewportInteractionEngine::pinchGestureEnded() m_pinchStartScale = -1; - animateItemRectVisible(nearestValidBounds()); + animatePageItemRectVisible(nearestValidBounds()); m_scaleUpdateDeferrer.clear(); // Clear after starting potential animation, which takes over deferring. } @@ -634,21 +683,22 @@ void QtViewportInteractionEngine::pinchGestureCancelled() * * FIXME: This is currently called twice if you concurrently change width and height. */ -void QtViewportInteractionEngine::itemSizeChanged() +void QtViewportInteractionEngine::pageItemSizeChanged() { if (m_suspendCount) return; - setItemRectVisible(nearestValidBounds()); + ViewportUpdateDeferrer guard(this); + setPageItemRectVisible(nearestValidBounds()); } void QtViewportInteractionEngine::scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale) { - QPointF oldPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); - m_content->setContentsScale(itemScaleFromCSS(cssScale)); - QPointF newPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); + QPointF oldPinchCenterOnViewport = m_viewportItem->mapFromWebContent(centerInCSSCoordinates); + m_pageItem->setContentsScale(itemScaleFromCSS(cssScale)); + QPointF newPinchCenterOnViewport = m_viewportItem->mapFromWebContent(centerInCSSCoordinates); - m_viewport->setContentPos(m_viewport->contentPos() + (newPinchCenterOnViewport - oldPinchCenterOnViewport)); + m_viewportItem->setContentPos(m_viewportItem->contentPos() + (newPinchCenterOnViewport - oldPinchCenterOnViewport)); } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h index ba540d548..b7595e569 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h @@ -26,6 +26,7 @@ #include <QtCore/QRectF> #include <QtCore/QVariant> #include <QtCore/QVariantAnimation> +#include <WebCore/ViewportArguments.h> #include <wtf/OwnPtr.h> QT_BEGIN_NAMESPACE @@ -58,14 +59,15 @@ public: qreal currentCSSScale() const; void setAllowsUserScaling(bool allow) { m_allowsUserScaling = allow; } - void setContentToDevicePixelRatio(qreal ratio) {m_devicePixelRatio = ratio; } + void setDevicePixelRatio(qreal ratio) { m_devicePixelRatio = ratio; } - void setItemRectVisible(const QRectF&); - void animateItemRectVisible(const QRectF&); + void setPageItemRectVisible(const QRectF&); + void animatePageItemRectVisible(const QRectF&); QRectF nearestValidBounds() const; - void pagePositionRequest(const QPoint& pos); + void pageContentPositionRequest(const QPoint& pos); + void touchBegin(); void touchEnd(); @@ -73,11 +75,9 @@ public: void cancelScrollAnimation(); bool panGestureActive() const; - void panGestureStarted(const QPointF& position, qint64 eventTimestampMillis); void panGestureRequestUpdate(const QPointF& position, qint64 eventTimestampMillis); void panGestureEnded(const QPointF& position, qint64 eventTimestampMillis); - void panGestureCancelled(); bool scaleAnimationActive() const; @@ -92,32 +92,32 @@ public: void zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea); void focusEditableArea(const QRectF& caretArea, const QRectF& targetArea); + void viewportAttributesChanged(const WebCore::ViewportAttributes&); + void pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize); + Q_SIGNALS: void contentSuspendRequested(); void contentResumeRequested(); void informVisibleContentChange(const QPointF& trajectory = QPointF()); - void visibleContentRectAndScaleChanged(); - private Q_SLOTS: // Respond to changes of content that are not driven by us, like the page resizing itself. - void itemSizeChanged(); - - void flickableMovingPositionUpdate(); + void pageItemSizeChanged(); + void pageItemPositionChanged(); void scaleAnimationStateChanged(QAbstractAnimation::State, QAbstractAnimation::State); - void scaleAnimationValueChanged(QVariant value) { setItemRectVisible(value.toRectF()); } + void scaleAnimationValueChanged(QVariant value); - void flickableMoveStarted(); // Called when panning starts. - void flickableMoveEnded(); // Called when panning (+ kinetic animation) ends. + void flickMoveStarted(); // Called when panning starts. + void flickMoveEnded(); // Called when panning (+ kinetic animation) ends. private: friend class ViewportUpdateDeferrer; friend class ::QWebKitTest; - QQuickWebView* const m_viewport; - QQuickWebPage* const m_content; + QQuickWebView* const m_viewportItem; + QQuickWebPage* const m_pageItem; qreal cssScaleFromItem(qreal) const; qreal itemScaleFromCSS(qreal) const; @@ -127,6 +127,11 @@ private: qreal innerBoundedCSSScale(qreal) const; qreal outerBoundedCSSScale(qreal) const; + QRectF computePosRangeForPageItemAtScale(qreal itemScale) const; + void scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale); + + WebCore::ViewportAttributes m_rawAttributes; + bool m_allowsUserScaling; qreal m_minimumScale; qreal m_maximumScale; @@ -134,12 +139,9 @@ private: QSize m_layoutSize; - QRectF computePosRangeForItemAtScale(qreal itemScale) const; - - void scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale); - int m_suspendCount; bool m_hasSuspendedContent; + OwnPtr<ViewportUpdateDeferrer> m_scaleUpdateDeferrer; OwnPtr<ViewportUpdateDeferrer> m_scrollUpdateDeferrer; OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer; diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp index c769c8b03..5132c7939 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp @@ -62,13 +62,29 @@ QtWebIconDatabaseClient::~QtWebIconDatabaseClient() WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0); } -void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo) +void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo) { - QUrl qUrl = WKURLCopyQUrl(pageURL); - toQtWebIconDatabaseClient(clientInfo)->requestIconForPageURL(qUrl); + emit toQtWebIconDatabaseClient(clientInfo)->iconChangedForPageURL(toImpl(pageURL)->string()); } -QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const QSize& iconSize) +WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL) +{ + String iconURL; + m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); + + if (iconURL.isEmpty()) + return String(); + + // Verify that the image data is actually available before reporting back + // a url, since clients assume that the url can be used directly. + WebCore::Image* iconImage = m_iconDatabase->imageForPageURL(pageURL); + if (!iconImage || iconImage->isNull()) + return String(); + + return iconURL; +} + +QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize) { MutexLocker locker(m_imageLock); @@ -84,33 +100,6 @@ QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const return nativeImage->toImage(); } -unsigned QtWebIconDatabaseClient::iconURLHashForPageURL(const String& pageURL) -{ - String iconURL; - m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); - return StringHash::hash(iconURL); -} - -void QtWebIconDatabaseClient::requestIconForPageURL(const QUrl& pageURL) -{ - String pageURLString = WebCore::KURL(pageURL).string(); - if (iconImageForPageURL(pageURLString).isNull()) - return; - - unsigned iconID = iconURLHashForPageURL(pageURLString); - QUrl url; - url.setScheme(QStringLiteral("image")); - url.setHost(QStringLiteral("webicon")); - QString path; - path.append(QLatin1Char('/')); - path.append(QString::number(m_contextId)); - path.append(QLatin1Char('/')); - path.append(QString::number(iconID)); - url.setPath(path); - url.setEncodedFragment(pageURL.toEncoded()); - emit iconChangedForPageURL(pageURL, url); -} - void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL) { m_iconDatabase->retainIconForPageURL(pageURL); diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h index 933ad9abe..65e86e18c 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h +++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h @@ -49,18 +49,16 @@ public: QtWebIconDatabaseClient(QtWebContext*); ~QtWebIconDatabaseClient(); + WTF::String iconForPageURL(const WTF::String& pageURL); QImage iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize = QSize(32, 32)); + void retainIconForPageURL(const WTF::String&); void releaseIconForPageURL(const WTF::String&); -public Q_SLOTS: - void requestIconForPageURL(const QUrl&); - public: - Q_SIGNAL void iconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL); + Q_SIGNAL void iconChangedForPageURL(const QString& pageURL); private: - unsigned iconURLHashForPageURL(const WTF::String&); static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo); uint64_t m_contextId; RefPtr<WebKit::WebIconDatabase> m_iconDatabase; diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index c1ebaac14..bbdc3a63b 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -436,7 +436,10 @@ void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, return; if (wasEventHandled || event.type() == WebEvent::TouchCancel) { - resetGestureRecognizers(); + m_panGestureRecognizer.cancel(); + m_pinchGestureRecognizer.cancel(); + if (event.type() != WebEvent::TouchMove) + m_tapGestureRecognizer.cancel(); return; } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index ae3c4aab6..5cafad59c 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -102,6 +102,11 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply) } } +void WebPageProxy::setUserScripts(const Vector<String>& scripts) +{ + process()->send(Messages::WebPage::SetUserScripts(scripts), m_pageID); +} + #if PLUGIN_ARCHITECTURE(X11) void WebPageProxy::createPluginContainer(uint64_t& windowID) { diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj index a8d66839f..81196140e 100644 --- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj +++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj @@ -68,7 +68,6 @@ 1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A17977E137EE82C00F97D45 /* PluginCreationParameters.h */; }; 1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; }; 1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A186EE912EF7618008E5F37 /* LayerTreeHost.cpp */; }; - 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; }; 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; }; 1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */; }; 1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */; }; @@ -178,8 +177,6 @@ 1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */; }; 1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A92DC1212F8BAB90017AF65 /* LayerTreeContextMac.mm */; }; 1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9FBA8C13FF04E600DEED67 /* PluginComplexTextInputState.h */; }; - 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; - 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; }; 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */; }; 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; }; @@ -196,7 +193,6 @@ 1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; }; 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */; }; 1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAB4AA91296F1540023952F /* SandboxExtensionMac.mm */; }; - 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; }; 1AAF061412B01131008E49E2 /* PDFViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF061212B01131008E49E2 /* PDFViewController.h */; }; 1AAF061512B01131008E49E2 /* PDFViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAF061312B01131008E49E2 /* PDFViewController.mm */; }; 1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAF0C4812B16334008E49E2 /* ArgumentCodersCF.h */; }; @@ -452,7 +448,6 @@ 7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 7801C096142290C400FAF9AF /* WebHitTestResult.h */; }; 8CFECE941490F140002AAA32 /* EditorState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CFECE931490F140002AAA32 /* EditorState.cpp */; }; 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905620E812BC248B000799B6 /* WebMemorySampler.cpp */; }; 909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 905620E912BC248B000799B6 /* WebMemorySampler.h */; }; 909854EE12BC4E18000AD080 /* WebMemorySampler.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 905620E512BC2476000799B6 /* WebMemorySampler.mac.mm */; }; @@ -651,7 +646,6 @@ BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */; }; BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60C5771240A546008C5E29 /* WKBundleRangeHandle.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC60C5781240A546008C5E29 /* WKBundleRangeHandle.cpp */; }; - BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; }; BC64696F11DBE603006455B0 /* ImmutableArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64696D11DBE603006455B0 /* ImmutableArray.cpp */; }; BC64697011DBE603006455B0 /* ImmutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64696E11DBE603006455B0 /* ImmutableArray.h */; }; BC646C1A11DD399F006455B0 /* WKBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */; }; @@ -697,7 +691,6 @@ BC8699B6116AADAA002A925B /* WKView.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8699B3116AADAA002A925B /* WKView.mm */; }; BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8699B4116AADAA002A925B /* WKViewInternal.h */; }; BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */; }; - BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC87DFA91018101400564216 /* libicucore.dylib */; }; BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8A501411765F5600757573 /* WKRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC9099801256A98200083756 /* WKStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90997F1256A98200083756 /* WKStringPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */; }; @@ -778,7 +771,6 @@ BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */; }; BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC812C91F59008F9C35 /* WKImageCG.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */; }; - BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCD0042C110C1E27003B8A67 /* CoreServices.framework */; }; BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD01397110FA420003B8A67 /* WKFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCD0139C110FA420003B8A67 /* WKFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD01398110FA420003B8A67 /* WKFrame.cpp */; }; BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD25F1511D6BDE100169B0E /* WKBundleFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -837,7 +829,6 @@ BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF501B3123EF602005955AE /* ThreadLauncherMac.mm */; }; BCF505E71243047B005955AE /* PlatformCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF505E51243047B005955AE /* PlatformCertificateInfo.h */; }; BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */; }; - BCF5068512431861005955AE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; }; BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF50726124329AA005955AE /* WebCertificateInfo.h */; }; BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */; }; BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F851176CD6F00471A52 /* WebHistoryClient.h */; }; @@ -884,7 +875,6 @@ CD73BA53131B645B00EEDED2 /* WebFullScreenManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD73BA37131A29FE00EEDED2 /* WebFullScreenManager.cpp */; }; CDCA85C8132ABA4E00E961DF /* WKFullScreenWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */; }; CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */; }; - CDCA85D5132AC2B300E961DF /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDCA85D4132AC2B300E961DF /* IOKit.framework */; }; CDCA85EE132AD70100E961DF /* WebFullScreenManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85DE132AD05300E961DF /* WebFullScreenManagerProxyMac.mm */; }; CEDA12E2152CD1AE00D9E08D /* WebAlternativeTextClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEDA12DF152CCAE800D9E08D /* WebAlternativeTextClient.cpp */; }; CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */; }; @@ -2029,16 +2019,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */, - 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */, - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */, - CDCA85D5132AC2B300E961DF /* IOKit.framework in Frameworks */, - BC617EE8104CB34700FB3FE1 /* JavaScriptCore.framework in Frameworks */, - BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */, - 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */, - BCF5068512431861005955AE /* Security.framework in Frameworks */, - 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp index 2d96feeb7..5c96eba48 100644 --- a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp +++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp @@ -30,6 +30,7 @@ #include "DataReference.h" #include <WebCore/ErrorsGtk.h> #include <WebCore/NotImplemented.h> +#include <WebCore/ResourceHandleInternal.h> #include <gio/gio.h> #include <glib/gi18n-lib.h> #include <wtf/gobject/GOwnPtr.h> @@ -147,6 +148,10 @@ void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* resource resourceHandle->setClient(m_downloadClient.get()); m_resourceHandle = resourceHandle; didStart(); + // If the handle already got a response, make sure the download client is notified. + ResourceHandleInternal* handleInternal = m_resourceHandle->getInternal(); + if (!handleInternal->m_response.isNull()) + m_downloadClient->didReceiveResponse(m_resourceHandle.get(), handleInternal->m_response); } void Download::cancel() diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 2653417bb..bbb6adbaf 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -146,6 +146,11 @@ void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundleRef, WKBundlePageGroupR toImpl(bundleRef)->setFrameFlatteningEnabled(toImpl(pageGroupRef), enabled); } +void WKBundleSetPluginsEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) +{ + toImpl(bundleRef)->setPluginsEnabled(toImpl(pageGroupRef), enabled); +} + void WKBundleSetGeolocationPermission(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) { toImpl(bundleRef)->setGeoLocationPermission(toImpl(pageGroupRef), enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp index a699eabaa..ae69a5394 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp @@ -55,11 +55,6 @@ void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, l return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string()); } -void WKBundleInspectorSetJavaScriptProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) -{ - toImpl(inspectorRef)->setJavaScriptProfilingEnabled(enabled); -} - void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) { if (enabled) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h index 593d90aa5..e32fdf25e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h @@ -44,7 +44,6 @@ WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector); WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector); WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script); -WK_EXPORT void WKBundleInspectorSetJavaScriptProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled); #ifdef __cplusplus diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index 5c47618c7..ccda367f6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -69,6 +69,7 @@ WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, W WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); +WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 5db3de7f2..c6e9a60b5 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -196,6 +196,13 @@ void InjectedBundle::setFrameFlatteningEnabled(WebPageGroupProxy* pageGroup, boo (*iter)->settings()->setFrameFlatteningEnabled(enabled); } +void InjectedBundle::setPluginsEnabled(WebPageGroupProxy* pageGroup, bool enabled) +{ + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); + for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) + (*iter)->settings()->setPluginsEnabled(enabled); +} + void InjectedBundle::setGeoLocationPermission(WebPageGroupProxy* pageGroup, bool enabled) { #if ENABLE(GEOLOCATION) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index 66111ffbb..5ba1a2f27 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -108,6 +108,7 @@ public: void setAllowUniversalAccessFromFileURLs(WebPageGroupProxy*, bool); void setAllowFileAccessFromFileURLs(WebPageGroupProxy*, bool); void setFrameFlatteningEnabled(WebPageGroupProxy*, bool); + void setPluginsEnabled(WebPageGroupProxy*, bool); void setGeoLocationPermission(WebPageGroupProxy*, bool); void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool); void setPrivateBrowsingEnabled(WebPageGroupProxy*, bool); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 4b78c5a29..c06f11b36 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -45,6 +45,7 @@ #include "WebProcess.h" #include "WebSearchPopupMenu.h" #include <WebCore/AXObjectCache.h> +#include <WebCore/ColorChooser.h> #include <WebCore/DatabaseTracker.h> #include <WebCore/FileChooser.h> #include <WebCore/FileIconLoader.h> @@ -595,6 +596,14 @@ bool WebChromeClient::paintCustomOverhangArea(GraphicsContext* context, const In return true; } +#if ENABLE(INPUT_TYPE_COLOR) +PassOwnPtr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserClient*, const Color&) +{ + notImplemented(); + return nullptr; +} +#endif + void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser) { if (m_page->activeOpenPanelResultListener()) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h index 59e7688cc..18e04db80 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h @@ -153,6 +153,10 @@ private: virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; +#if ENABLE(INPUT_TYPE_COLOR) + virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE; +#endif + virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>) OVERRIDE; virtual void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader*) OVERRIDE; @@ -212,6 +216,10 @@ private: virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE; virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { } +#if ENABLE(REGISTER_PROTOCOL_HANDLER) + virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) OVERRIDE { } +#endif + String m_cachedToolTip; mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; mutable bool m_cachedMainFrameHasHorizontalScrollbar; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index b17240d5e..03d599d91 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -457,7 +457,7 @@ void WebEditorClient::setInputMethodState(bool) notImplemented(); } -void WebEditorClient::requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) +void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) { notImplemented(); } diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index 6693ca257..4b930daf5 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -100,10 +100,12 @@ private: virtual NSURL* canonicalizeURLString(NSString*) OVERRIDE; #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) virtual void uppercaseWord() OVERRIDE; virtual void lowercaseWord() OVERRIDE; virtual void capitalizeWord() OVERRIDE; +#endif +#if USE(AUTOMATIC_TEXT_REPLACEMENT) virtual void showSubstitutionsPanel(bool show) OVERRIDE; virtual bool substitutionsPanelIsShowing() OVERRIDE; virtual void toggleSmartInsertDelete() OVERRIDE; @@ -143,7 +145,7 @@ private: virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) OVERRIDE; virtual void willSetInputMethodState() OVERRIDE; virtual void setInputMethodState(bool enabled) OVERRIDE; - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&) OVERRIDE; + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE; #if PLATFORM(GTK) virtual bool shouldShowUnicodeMenu() OVERRIDE; #endif diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index b01f3febf..3f3c06fc7 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -73,6 +73,10 @@ #include <WebCore/Widget.h> #include <WebCore/WindowFeatures.h> +#if ENABLE(WEB_INTENTS) +#include <WebCore/IntentRequest.h> +#endif + using namespace WebCore; namespace WebKit { @@ -1515,6 +1519,13 @@ bool WebFrameLoaderClient::shouldCacheResponse(DocumentLoader*, unsigned long id } #endif // PLATFORM(WIN) && USE(CFNETWORK) +#if ENABLE(WEB_INTENTS) +void WebFrameLoaderClient::dispatchIntent(PassRefPtr<IntentRequest>) +{ + notImplemented(); +} +#endif + bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) const { notImplemented(); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index af5d6df0a..a2726cc37 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -28,6 +28,12 @@ #include <WebCore/FrameLoaderClient.h> +namespace WebCore { +#if ENABLE(WEB_INTENTS) +class IntentRequest; +#endif +} + namespace WebKit { class PluginView; @@ -215,7 +221,11 @@ private: // FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>. virtual bool shouldCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&, const unsigned char* data, unsigned long long length) OVERRIDE; #endif - + +#if ENABLE(WEB_INTENTS) + virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; +#endif + virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const OVERRIDE; virtual void didChangeScrollOffset() OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm index 651d0dd8f..10f520de4 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm @@ -160,6 +160,7 @@ void WebEditorClient::capitalizeWord() changeWordCase(m_page, @selector(capitalizedString)); } +#if USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::showSubstitutionsPanel(bool) { notImplemented(); @@ -231,6 +232,7 @@ void WebEditorClient::toggleAutomaticSpellingCorrection() { notImplemented(); } +#endif // USE(AUTOMATIC_TEXT_REPLACEMENT) void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp index 87573f9ea..68d3b0c41 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp @@ -195,10 +195,8 @@ void WebInspector::setJavaScriptProfilingEnabled(bool enabled) m_page->corePage()->inspectorController()->show(); if (!m_frontendClient) return; - if (enabled) - m_page->corePage()->inspectorController()->enableProfiler(); - else - m_page->corePage()->inspectorController()->disableProfiler(); + + m_page->corePage()->inspectorController()->setProfilerEnabled(enabled); #endif } diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index a07b675f9..6f1827cc1 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -2146,10 +2146,11 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra send(Messages::WebPageProxy::DidPerformDragControllerAction(WebCore::DragSession())); #if PLATFORM(QT) QMimeData* data = const_cast<QMimeData*>(dragData.platformData()); + delete data; #elif PLATFORM(GTK) DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData()); + data->deref(); #endif - delete data; return; } @@ -2177,10 +2178,11 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra // DragData does not delete its platformData so we need to do that here. #if PLATFORM(QT) QMimeData* data = const_cast<QMimeData*>(dragData.platformData()); + delete data; #elif PLATFORM(GTK) DataObjectGtk* data = const_cast<DataObjectGtk*>(dragData.platformData()); + data->deref(); #endif - delete data; } #else diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 4b2b76c8c..3b7e6e64f 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -523,6 +523,7 @@ public: void registerApplicationScheme(const String& scheme); void applicationSchemeReply(const QtNetworkReplyData&); void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*); + void setUserScripts(const Vector<String>&); #endif void wheelEvent(const WebWheelEvent&); #if ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 4bab8ac42..f14fcb6c9 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -40,6 +40,7 @@ messages -> WebPage { #if ENABLE(TOUCH_EVENTS) TouchEvent(WebKit::WebTouchEvent event) TouchEventSyncForTesting(WebKit::WebTouchEvent event) -> (bool handled) +#endif #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT) HighlightPotentialActivation(WebCore::IntPoint point, WebCore::IntSize area) #endif @@ -68,6 +69,7 @@ messages -> WebPage { #if PLATFORM(QT) ApplicationSchemeReply(WebKit::QtNetworkReplyData reply) RegisterApplicationScheme(WTF::String scheme) + SetUserScripts(WTF::Vector<WTF::String> script) #endif StopLoadingFrame(uint64_t frameID) @@ -140,17 +142,17 @@ messages -> WebPage { HideFindUI() CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount) -#if ENABLE(DRAG_SUPPORT) # Drag and drop. -#if PLATFORM(WIN) +#if PLATFORM(WIN) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags) #endif -#if PLATFORM(QT) || PLATFORM(GTK) +#if (PLATFORM(QT) || PLATFORM(GTK)) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::DragData dragData) #endif -#if !PLATFORM(WIN) && !PLATFORM(QT) && !PLATFORM(GTK) +#if !PLATFORM(WIN) && !PLATFORM(QT) && !PLATFORM(GTK) && ENABLE(DRAG_SUPPORT) PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::SandboxExtension::HandleArray sandboxExtensionsForUpload) #endif +#if ENABLE(DRAG_SUPPORT) DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 40071982b..2e90a7360 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -32,10 +32,12 @@ #include "WebEvent.h" #include "WebPageProxyMessages.h" #include "WebProcess.h" +#include <WebCore/DOMWrapperWorld.h> #include <WebCore/FocusController.h> #include <WebCore/Frame.h> #include <WebCore/KeyboardEvent.h> #include <WebCore/Page.h> +#include <WebCore/PageGroup.h> #include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/Range.h> #include <WebCore/Settings.h> @@ -411,4 +413,13 @@ void WebPage::applicationSchemeReply(const QtNetworkReplyData& replyData) networkReply->finalize(); } +void WebPage::setUserScripts(const Vector<String>& scripts) +{ + // This works because we keep an unique page group for each Page. + PageGroup* pageGroup = PageGroup::pageGroup(this->pageGroup()->identifier()); + pageGroup->removeUserScriptsFromWorld(mainThreadNormalWorld()); + for (unsigned i = 0; i < scripts.size(); ++i) + pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 15cb28e80..2b0382dba 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -1044,8 +1044,10 @@ void WebProcess::setTextCheckerState(const TextCheckerState& textCheckerState) void WebProcess::didGetPlugins(CoreIPC::Connection*, uint64_t requestID, const Vector<WebCore::PluginInfo>& plugins) { +#if USE(PLATFORM_STRATEGIES) // Pass this to WebPlatformStrategies.cpp. handleDidGetPlugins(requestID, plugins); +#endif } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm index 63e7ba5d1..48ac2f338 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm @@ -32,7 +32,6 @@ #import "WebProcess.h" #import "WebSystemInterface.h" #import <WebCore/RunLoop.h> -#import <WebKit2/WKView.h> #import <WebKitSystemInterface.h> #import <mach/mach_error.h> #import <objc/objc-auto.h> diff --git a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp index 1e10baaf1..22b09fd30 100644 --- a/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp +++ b/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp @@ -22,11 +22,11 @@ #include "DataReference.h" #include "MessageID.h" +#include "WebErrors.h" #include "WebKitSoupRequestGeneric.h" #include "WebKitSoupRequestInputStream.h" #include "WebProcess.h" #include "WebSoupRequestManagerProxyMessages.h" -#include <WebCore/ErrorsGtk.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> #include <libsoup/soup-requester.h> @@ -99,7 +99,7 @@ void WebSoupRequestManager::didHandleURIRequest(const CoreIPC::DataReference& re } else { GOwnPtr<char> uriString(soup_uri_to_string(soup_request_get_uri(SOUP_REQUEST(request.get())), FALSE)); WebCore::ResourceRequest resourceRequest(String::fromUTF8(uriString.get())); - WebCore::ResourceError resourceError(WebCore::cannotShowURLError(resourceRequest)); + WebCore::ResourceError resourceError(cannotShowURLError(resourceRequest)); g_simple_async_result_set_error(result.get(), g_quark_from_string(resourceError.domain().utf8().data()), resourceError.errorCode(), "%s", resourceError.localizedDescription().utf8().data()); } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index dc7b4cb6d..bb02686dd 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -255,3 +255,6 @@ EXPORTS ?isPageBoxVisible@Document@WebCore@@QAE_NH@Z ?suspendAnimations@AnimationController@WebCore@@QAEXXZ ?resumeAnimations@AnimationController@WebCore@@QAEXXZ + ?setAllowsRoundingHacks@TextRun@WebCore@@SAX_N@Z + ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ + ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z |