diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-30 16:58:06 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-30 17:03:09 +0100 |
commit | 32ea33253afbbdefd2680aa95ab5f57455272ae7 (patch) | |
tree | 2389569585b666c310fbb36d3fb8e6ab94462967 /Source/WebKit2 | |
parent | 41c25f231cbca1babc445187283524cc6c751c71 (diff) | |
download | qtwebkit-32ea33253afbbdefd2680aa95ab5f57455272ae7.tar.gz |
Imported WebKit commit 6a4a1d32e1d779548c726c4826cba9d69eb87601 (http://svn.webkit.org/repository/webkit/trunk@136242)
Final import for the Qt 5.x series that implements the QtWebKit / QtWebKitWidgets split
Extra fixes will be cherry-picked.
Change-Id: I844f1ebb99c6d6b75db31d6538c2acd628e79681
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2')
95 files changed, 1639 insertions, 168 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index b80559488..cc9771486 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,592 @@ +2012-11-30 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets + https://bugs.webkit.org/show_bug.cgi?id=99314 + + Reviewed by Tor Arne Vestbø. + + This big change separates QtWebKit into QtWebKit and QtWebKitWidgets as + shared libraries. + + It's a big refactoring that mostly involves moving WebCore dependent + code into QtWebKit and accessing it through exported QWebFrameAdapter + and QWebPageAdapter classes. + + + * UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro: + * UIProcess/API/qt/tests/publicapi/publicapi.pro: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro: + * UIProcess/API/qt/tests/qmltests/WebView.pro: + * UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro: + * UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro: + * UIProcess/API/qt/tests/tests.pri: + +2012-11-30 Joone Hur <joone.hur@intel.com> + + [EFL]Drawing artifacts while resizing the view + https://bugs.webkit.org/show_bug.cgi?id=101288 + + Reviewed by Kenneth Rohde Christiansen. + + An Evas GL surface is recreated when the window is resized, but the update of the surface is + asynchronously done, which gives Evas a chance of painting the empty surface on the screen. + As a result, the flickering problem happens while resizing the view. + So this patch allows to create an Evas GL surface synchronously with the update of the surface. + + * UIProcess/API/efl/EwkViewImpl.cpp: + (EwkViewImpl::EwkViewImpl): Set m_pendingSurfaceResize to false. + (EwkViewImpl::displayTimerFired): Create an Evas GL surface. + * UIProcess/API/efl/EwkViewImpl.h: + (EwkViewImpl::setNeedsSurfaceResize): Added. + (EwkViewImpl): + * UIProcess/API/efl/ewk_view.cpp: + (_ewk_view_smart_calculate): Set m_pendingSurfaceResize to true. + +2012-11-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] TiledBackingStore: Frame view re-layouts with wrong Fixed Visible Content Rect. + https://bugs.webkit.org/show_bug.cgi?id=103428 + + Reviewed by Kenneth Rohde Christiansen. + + Set now appropriate fixed visible content rect before layout when viewport + attributes change. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::syncVisibleContents): + (WebKit::PageViewportController::didChangeViewportAttributes): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::sendViewportAttributesChanged): + +2012-11-30 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL] Gardening after r136031 and r136142 + https://bugs.webkit.org/show_bug.cgi?id=103734 + + Unreviewed, API test EWK2UnitTestBase.ewk_view_setting_encoding_custom + is asserting after r136031. So, disabling the test until bug 103732 is + fixed. + + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (TEST_F): + +2012-11-30 Zeno Albisser <zeno@webkit.org> + + [Qt] Enable WebGL by default. + https://bugs.webkit.org/show_bug.cgi?id=103731 + + Reviewed by Simon Hausmann. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): + +2012-11-30 Mihai Maerean <mmaerean@adobe.com> + + [CSSRegions] when WebKit uses V8, there should be a single variable to store if the CSS Regions feature is enabled + https://bugs.webkit.org/show_bug.cgi?id=101192 + + Reviewed by Hajime Morita. + + Removed the CSS Regions flag in Settings and switched to using the new flag I have added in RuntimeEnabledFeatures. + + Tests: No new tests because there is no functional change. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): + (WebKit::InjectedBundle::setCSSRegionsEnabled): + (WebKit): + * WebProcess/InjectedBundle/InjectedBundle.h: + (InjectedBundle): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2012-11-29 Tim Horton <timothy_horton@apple.com> + + PDFPlugin: Only plain text can be copied out of PDFs + https://bugs.webkit.org/show_bug.cgi?id=103591 + <rdar://problem/12555161> + + Reviewed by Alexey Proskuryakov. + + Don't write zero-length data to the pasteboard, just skip the item. + + As mentioned in the comment, we don't expect this to come up, and would like to know if it does, + so we assert that it doesn't happen in debug builds. + + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (WebKit::PDFPlugin::writeItemsToPasteboard): + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb + https://bugs.webkit.org/show_bug.cgi?id=103476 + + Reviewed by Alejandro G. Castro. + + Create the RedirectedXCompositeWindow with an argument specifying that it + should never have a GLContext backing it. + + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): + +2012-11-29 Rafael Weinstein <rafaelw@chromium.org> + + [HTMLTemplateElement] Add feature flag + https://bugs.webkit.org/show_bug.cgi?id=103694 + + Reviewed by Adam Barth. + + This flag will guard the implementation of the HTMLTemplateElement. + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-11-29 Alexey Proskuryakov <ap@apple.com> + + [WK2] Forward cookie jar calls to NetworkProcess + https://bugs.webkit.org/show_bug.cgi?id=103457 + + Reviewed by Darin Adler. + + * NetworkProcess/NetworkConnectionToWebProcess.messages.in: + Added messages to maniputate CookieJar in network process. + + * NetworkProcess/NetworkConnectionToWebProcess.h: + * NetworkProcess/NetworkConnectionToWebProcess.cpp: Removed unnecessary WebCore:: prefixes, + this file has a using direcive. + (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): + (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): + (WebKit::NetworkConnectionToWebProcess::cookiesEnabled): + (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): + (WebKit::NetworkConnectionToWebProcess::getRawCookies): + (WebKit::NetworkConnectionToWebProcess::deleteCookie): + (WebKit::NetworkConnectionToWebProcess::getHostnamesWithCookies): + (WebKit::NetworkConnectionToWebProcess::deleteCookiesForHostname): + (WebKit::NetworkConnectionToWebProcess::deleteAllCookies): + Added implementations that use PlatformCookieJar in the network process. + + * Scripts/webkit2/messages.py: (struct_or_class): + * Shared/WebCoreArgumentCoders.h: + * Shared/WebCoreArgumentCoders.cpp: + (CoreIPC::::encode): + (CoreIPC::::decode): + Added support for Cookie. + + * WebProcess/WebCoreSupport/WebPlatformStrategies.h: + * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: + (WebKit::WebPlatformStrategies::cookiesForDOM): + (WebKit::WebPlatformStrategies::setCookiesFromDOM): + (WebKit::WebPlatformStrategies::cookiesEnabled): + (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): + (WebKit::WebPlatformStrategies::getRawCookies): + (WebKit::WebPlatformStrategies::deleteCookie): + (WebKit::WebPlatformStrategies::getHostnamesWithCookies): + (WebKit::WebPlatformStrategies::deleteCookiesForHostname): + (WebKit::WebPlatformStrategies::deleteAllCookies): + When using the network process, forward cookie calls to it. + +2012-11-29 Kiran Muppala <cmuppala@apple.com> + + Instantiate snapshot plugins in a PluginProcess with muted audio + https://bugs.webkit.org/show_bug.cgi?id=101536 + + Reviewed by Anders Carlsson. + + Plugins created for generation of a snapshot should be instantiated in a separate process with + muted audio so that any sound generated during the snapshot process is not audible to the user. + + * Configurations/WebKit2.xcconfig: Add CoreAudio to the list of linked frameworks. + * PluginProcess/PluginProcess.h: Add PluginProcess::Type enum with values for regular and + snapshot process types. Provide DefaultHash and IsInteger template specializations for the enum + so that PluginProcessConnectionManager can store it in a HashMap. + * PluginProcess/mac/PluginProcessMac.mm: + (WebKit::muteAudio): + (WebKit::PluginProcess::platformInitialize): Mute audio if the process creation parameters indicate + that the plugin process type is snapshot process. + * Shared/Plugins/PluginProcessCreationParameters.cpp: + (WebKit::PluginProcessCreationParameters::encode): + (WebKit::PluginProcessCreationParameters::decode): + * Shared/Plugins/PluginProcessCreationParameters.h: Add processType process creation parameter. + * UIProcess/Plugins/PluginProcessManager.cpp: + (WebKit::PluginProcessManager::getPluginProcessConnection): Add process type parameter. + (WebKit::PluginProcessManager::getSitesWithData): Forward message to regular plugin process only. + (WebKit::PluginProcessManager::clearSiteData): Forward message to regular plugin process only. + (WebKit::PluginProcessManager::pluginProcessWithPath): Add process type parameter. + (WebKit::PluginProcessManager::getOrCreatePluginProcess): Ditto. + * UIProcess/Plugins/PluginProcessManager.h: + * UIProcess/Plugins/PluginProcessProxy.cpp: + (WebKit::PluginProcessProxy::create): Add process type parameter. + (WebKit::PluginProcessProxy::PluginProcessProxy): Ditto. + (WebKit::PluginProcessProxy::didClose): Include process type with the plugin process crashed message. + (WebKit::PluginProcessProxy::didFinishLaunching): Set process type process creation parameter. + * UIProcess/Plugins/PluginProcessProxy.h: + (WebKit::PluginProcessProxy::processType): + * UIProcess/WebProcessProxy.cpp: + (WebKit::WebProcessProxy::getPluginProcessConnection): Pass along process type parameter to + PluginProcessManager. + * UIProcess/WebProcessProxy.h: + (WebProcessProxy): + * UIProcess/WebProcessProxy.messages.in: Add process type parameter to GetPluginProcessConnection message. + * WebProcess/Plugins/PluginProcessConnection.cpp: + (WebKit::PluginProcessConnection::PluginProcessConnection): Add process type parameter. + * WebProcess/Plugins/PluginProcessConnection.h: + (WebKit::PluginProcessConnection::create): Ditto. + (WebKit::PluginProcessConnection::processType): Ditto. + * WebProcess/Plugins/PluginProcessConnectionManager.cpp: + (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Add process type parameter. + (WebKit::PluginProcessConnectionManager::removePluginProcessConnection): Use process type in addition to + plugin path to find the connection to remove. + (WebKit::PluginProcessConnectionManager::pluginProcessCrashed): Add process type parameter. + * WebProcess/Plugins/PluginProcessConnectionManager.h: + * WebProcess/Plugins/PluginProxy.cpp: + (WebKit::PluginProxy::create): Ditto. + (WebKit::PluginProxy::PluginProxy): Ditto. + (WebKit::PluginProxy::initialize): Add process type parameter in call to + PluginProcessConnectionManager::getPluginProcessConnection. + * WebProcess/Plugins/PluginProxy.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::createPlugin): Determine process type based on display state of plugin element and + pass it to PluginProxy::create. + * WebProcess/WebProcess.cpp: + (WebKit::WebProcess::pluginProcessCrashed): Pass along process type parameter to + PluginProcessConnectionManager. + * WebProcess/WebProcess.h: + * WebProcess/WebProcess.messages.in: Add process type parameter to PluginProcessCrashed message. + +2012-11-29 Anders Carlsson <andersca@apple.com> + + Initialize m_xpcConnection to null if the identifier doesn't have an XPC connection + https://bugs.webkit.org/show_bug.cgi?id=103689 + + Reviewed by Darin Adler. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformInitialize): + +2012-11-29 Christophe Dumez <christophe.dumez@intel.com> + + [CoordinatedGraphics] Use OwnPtr for LayerMap's layers in LayerTreeRenderer + https://bugs.webkit.org/show_bug.cgi?id=103650 + + Reviewed by Noam Rosenthal. + + We currently store raw pointers to WebCore::GraphicsLayer in the LayerMap + meaning that we need to delete them manually. This patch leverages smart + pointers and stores layers as OwnPtr in the LayerMap so that the layers + are owned by the HashMap and we don't have to handle memory manually. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::adjustPositionForFixedLayers): + (WebKit::LayerTreeRenderer::setLayerChildren): + (WebKit::LayerTreeRenderer::deleteLayer): + (WebKit::LayerTreeRenderer::ensureLayer): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + +2012-11-29 Anders Carlsson <andersca@apple.com> + + Add a minimumLayoutWidth WKView property + https://bugs.webkit.org/show_bug.cgi?id=103660 + <rdar://problem/11791729> + + Reviewed by Beth Dakin. + + When minimumLayoutWidth is set to a positive value, the WKView will update its intrinsic content size given the layout width. + + * UIProcess/API/mac/PageClientImpl.h: + * UIProcess/API/mac/PageClientImpl.mm: + (WebKit::PageClientImpl::intrinsicContentSizeDidChange): + Call the WKView. + + * UIProcess/API/mac/WKView.mm: + (-[WKView intrinsicContentSize]): + Override the intrinsicContentSize getter. + + (-[WKView _setIntrinsicContentSize:]): + Update the intrinsic content size and mark it as invalid. + + (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): + By default, the WKView should have no intrinsic size. + + (-[WKView minimumLayoutWidth]): + (-[WKView setMinimumLayoutWidth:]): + Call through to the WebPageProxy object. + + * UIProcess/API/mac/WKViewPrivate.h: + Add the SPI here. + + * UIProcess/DrawingAreaProxy.h: + (WebKit::DrawingAreaProxy::minimumLayoutWidthDidChange): + (WebKit::DrawingAreaProxy::didUpdateGeometry): + (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): + Add empty stubs. + + * UIProcess/DrawingAreaProxy.messages.in: + Update the DidUpdateGeometry signature and add IntrinsicContentSizeDidChange. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + Initialize the minimum layout width. + + (WebKit::WebPageProxy::setMinimumLayoutWidth): + Update the minimum layout width and call the drawing area proxy. + + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::minimumLayoutWidth): + Add getter. + + * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: + (TiledCoreAnimationDrawingAreaProxy): + * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: + (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutWidthDidChange): + Update the geometry if needed. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry): + Update the intrinsic content size. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): + Call through to WebPageProxy::intrinsicContentSizeDidChange. + + (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): + Pass along the minimum layout width. + + * UIProcess/mac/WebPageProxyMac.mm: + (WebKit::WebPageProxy::intrinsicContentSizeDidChange): + Call through to the page client. + + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::contentsSizeChanged): + Call DrawingArea::mainFrameContentSizeChanged. + + * WebProcess/WebPage/DrawingArea.h: + (WebKit::DrawingArea::mainFrameContentSizeChanged): + Add empty stub. + + (WebKit::DrawingArea::updateGeometry): + Update signature. + + * WebProcess/WebPage/DrawingArea.messages.in: + Add minimumLayoutWidth to UpdateGeometry. + + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged): + If the content size change is not coming from updateGeometry, send an InstrinsicContentSizeDidChange message. + + (WebKit::TiledCoreAnimationDrawingArea::updateGeometry): + If m_minimumLayoutWidth is positive, do an initial layout pass to figure out the height of the page and then do another + layout with the viewport set to that height. + +2012-11-29 Anders Carlsson <andersca@apple.com> + + CoreIPC::Connection should retain its xpc_connection_t + https://bugs.webkit.org/show_bug.cgi?id=103671 + <rdar://problem/12717331> + + Reviewed by Beth Dakin. + + * Platform/CoreIPC/mac/ConnectionMac.cpp: + (CoreIPC::Connection::platformInitialize): + Retain the xpc_connection_t object here to balance the xpc_object_release in platformInvalidate. + +2012-11-29 Brent Fulgham <bfulgham@webkit.org> + + [Windows, WinCairo] Unreviewed build fix. Build was failing + because the export definition file included a debug-only + symbol. It's not needed and shouldn't be included for export. + + * win/WebKit2.def: Don't require notSolidColor to be exported. + * win/WebKit2CFLite.def: Ditto. + +2012-11-29 Tim Horton <timothy_horton@apple.com> + + PDFPlugin: Only plain text can be copied out of PDFs + https://bugs.webkit.org/show_bug.cgi?id=103591 + <rdar://problem/12555161> + + Reviewed by Alexey Proskuryakov. + + Enable rich data to be copied from PDFKit to the pasteboard. + + * WebProcess/Plugins/PDF/PDFPlugin.h: + (PDFPlugin): Add writeItemsToPasteboard. + * WebProcess/Plugins/PDF/PDFPlugin.mm: + (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): Move implementation to PDFPlugin. + (WebKit::PDFPlugin::writeItemsToPasteboard): Don't round-trip through WebCore for pasteboard operations, + use WebContext directly. This provides a simple way to hand over a buffer for complex pasteboard types + (RTF, HTML, etc.). Use this interface for arbitrary non-plain-text pasteboard data that PDFKit hands us. + +2012-11-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WebKit2] Embed the HTTP authentication dialog into the WebView + https://bugs.webkit.org/show_bug.cgi?id=103277 + + Reviewed by Carlos Garcia Campos. + + Embed the WebKit2 HTTP authentication dialog into the WebView. Add the dialog as a child + of the WebKitWebViewBase container (like the web inspector). + + We do not yet properly handle pages that require authentication for more than one resource. + As that is an uncommon situation, it will be handled in another patch. + + * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp: + (WebKit::drawSignal): We have to override the draw signal of the dialog to draw + a GtkWindow background on the widget. This is required because the widget doesn't + have a real GtkWindow to draw its background. + (WebKit::loadChangedSignal): When a new load starts in the WebView destroy the dialog. This + is so that the dialog doesn't stick around when the user chooses to navigate away from the + page requiring authentication. + (WebKit::WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog): Create an eventbox + and frame to hold the dialog contents. Also append the 'background' widget class to the + event box, so that it can draw a GtkWindow background in the draw signal handler. + (WebKit::WebKit2GtkAuthenticationDialog::~WebKit2GtkAuthenticationDialog): Disconnect the + load status changed signal handler. + (WebKit::WebKit2GtkAuthenticationDialog::show): When it's time to show the dialog, add it to + WebKitWebViewBase. + * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h: Add some new methods for handling the + embedded dialog. + * UIProcess/API/gtk/WebKitLoaderClient.cpp: + (didReceiveAuthenticationChallengeInFrame): Collapse the creation of the dialog into one line. + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate): Add the dialog as a property of the private structure. + (webkitWebViewChildIsInternalWidget): Added this helper used for determining when a child widget + is "internal" (ie the web inspector or the authentication dialog). + (webkitWebViewBaseContainerAdd): Only add non-internal widgets to the children map. + (webkitWebViewBaseAddAuthenticationDialog): Added. + (webkitWebViewBaseAddWebInspector): Added this more-foolproof method of adding a web inspector + to the WebView. This also aligns it with the way the authentication dialog is added. + (webkitWebViewBaseContainerRemove): When removing the authentication dialog, zero out the + field in the private structure. + (webkitWebViewBaseContainerForall): Add support for the authentication dialog here too. + (webkitWebViewBaseChildMoveResize): Don't pass on move_resize events to internal children. + (webkit_web_view_base_init): Zero out the authentication dialog member on init. + (webkitWebViewBaseDraw): If the authentication dialog is active, draw a shadow over web content. + (resizeWebKitWebViewBaseFromAllocation): Make the authentication dialog centered in the view. + (webkitWebViewBaseKeyPressEvent): Pass on key events to the authentication dialog if active. + (webkitWebViewBaseButtonPressEvent): If the authentication dialog is active don't pass button events + to web content. + (webkitWebViewBaseButtonReleaseEvent): Ditto. + (webkitWebViewBaseScrollEvent): Ditto. + (webkitWebViewBaseMotionNotifyEvent): Ditto. + (webkitWebViewBaseFocus): Pass on focus events to the authentication dialog so that tabbing between + elements in the dialog works correctly. + (webkit_web_view_base_class_init): Hook up the focus event. + * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add new methods for adding the authentication dialog + and the web inspector. + * UIProcess/gtk/WebInspectorProxyGtk.cpp: + (WebKit::WebInspectorProxy::createInspectorWindow): Use the new method for adding the web inspector. + +2012-11-29 Andrei Bucur <abucur@adobe.com> + + Fix the build after r136095 + https://bugs.webkit.org/show_bug.cgi?id=103629 + + Unreviewed. + + Add a static_cast to fix the build. + + * Shared/mac/ObjCObjectGraphCoders.mm: + (WebKit::ObjCObjectGraphEncoder::baseEncode): + +2012-11-29 Christophe Dumez <christophe.dumez@intel.com> + + [CoordinatedGraphics] Have LayerTreeRenderer::ensureLayer() return the layer + https://bugs.webkit.org/show_bug.cgi?id=103645 + + Reviewed by Noam Rosenthal. + + The current LayerTreeRenderer code keep calling ensureLayer() and then + LayerMap::find() to retrieve the layer. Since ensureLayer() already has + a pointer to the layer, we can simply have the function return it. + This is slightly more efficient and it makes the code a bit simpler. + + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp: + (WebKit::LayerTreeRenderer::setLayerChildren): + (WebKit::LayerTreeRenderer::setLayerFilters): + (WebKit::LayerTreeRenderer::setLayerState): + (WebKit::LayerTreeRenderer::ensureLayer): + * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h: + +2012-11-29 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] TiledBackingStore: User events are sent to web page before it is shown + https://bugs.webkit.org/show_bug.cgi?id=101753 + + Reviewed by Jocelyn Turcotte. + + User events are suppressed on WEB process side while drawing area is frozen. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::mouseEvent): + (WebKit::WebPage::wheelEvent): + (WebKit::WebPage::keyEvent): + (WebKit::WebPage::gestureEvent): + (WebKit::WebPage::touchEvent): + (WebKit::WebPage::sendIfEventCannotBeHandled): + (WebKit): + (WebKit::WebPage::didCompletePageTransition): + * WebProcess/WebPage/WebPage.h: + (WebPage): + +2012-11-29 Allan Sandfeld Jensen <allan.jensen@digia.com> + + Possible to resize out of bounds + https://bugs.webkit.org/show_bug.cgi?id=103521 + + Reviewed by Jocelyn Turcotte. + + Enforce the viewportBounds after resize, and ensure a user fitted page remains + fit on viewport resize, but not on content growth. + + * UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml: Added. + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::didChangeContentsSize): + (WebKit::PageViewportController::didChangeViewportAttributes): + (WebKit::PageViewportController::updateMinimumScaleToFit): + * UIProcess/PageViewportController.h: + (PageViewportController): + +2012-11-29 Michael Brüning <michael.bruning@digia.com> + + [Qt][WK2] Commit the preedit string in the input method when focus is about to be moved. + https://bugs.webkit.org/show_bug.cgi?id=97774 + + Reviewed by Kenneth Rohde Christiansen. + + Implements the handler for willSetInputMethodState in WebKit2 in Qt. + This is needed to tell the input method instance in Qt to commit its + preedit content when the focus has moved to another node to prevent a + bug where the old preedit string was kept as the preedit string and + the editor moved focus back to the old node when continuing to enter + text via the input method. + + This behavior is analog to the behavior of the QtQuick text input + elements. + + * UIProcess/API/qt/raw/qrawwebview.cpp: + (QRawWebViewPrivate::handleWillSetInputMethodState): + * UIProcess/API/qt/raw/qrawwebview_p_p.h: + (QRawWebViewPrivate): + * UIProcess/PageClient.h: + (PageClient): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + * UIProcess/qt/QtPageClient.cpp: + (WebKit::QtPageClient::handleWillSetInputMethodState): + (WebKit): + * UIProcess/qt/QtPageClient.h: + (QtPageClient): + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::handleWillSetInputMethodState): + (WebKit): + * UIProcess/qt/QtWebPageEventHandler.h: + (QtWebPageEventHandler): + * UIProcess/qt/WebPageProxyQt.cpp: + (WebKit::WebPageProxy::willSetInputMethodState): + (WebKit): + * WebProcess/WebCoreSupport/WebEditorClient.cpp: + (WebKit::WebEditorClient::willSetInputMethodState): + 2012-11-28 Jocelyn Turcotte <jocelyn.turcotte@digia.com> [Qt] The WebView should be flickable only using touch events diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index b0d2dab41..1b0396831 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -143,6 +143,7 @@ ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEMPLATE_ELEMENT = ; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index c70f4a618..469856d5f 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 20; +MINOR_VERSION = 21; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig index 3e4588c62..d88eb18c3 100644 --- a/Source/WebKit2/Configurations/WebKit2.xcconfig +++ b/Source/WebKit2/Configurations/WebKit2.xcconfig @@ -29,7 +29,7 @@ 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; +FRAMEWORK_AND_LIBRARY_LDFLAGS = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework JavaScriptCore -licucore -framework QuartzCore -framework Security -framework WebCore -framework CoreAudio; OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(PLATFORM_NAME)) $(OTHER_LDFLAGS); OTHER_LDFLAGS_macosx = $(FRAMEWORK_AND_LIBRARY_LDFLAGS); diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp index 50ce734f4..f07165107 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp @@ -29,6 +29,8 @@ #include "ConnectionStack.h" #include "NetworkProcess.h" #include "NetworkResourceLoader.h" +#include "RemoteNetworkingContext.h" +#include <WebCore/PlatformCookieJar.h> #include <WebCore/ResourceLoaderOptions.h> #include <WebCore/ResourceRequest.h> #include <WebCore/RunLoop.h> @@ -122,7 +124,7 @@ void NetworkConnectionToWebProcess::scheduleResourceLoad(const NetworkResourceLo resourceLoadIdentifier = NetworkProcess::shared().networkResourceLoadScheduler().scheduleResourceLoad(loadParameters, this); } -void NetworkConnectionToWebProcess::addLoadInProgress(const WebCore::KURL& url, ResourceLoadIdentifier& identifier) +void NetworkConnectionToWebProcess::addLoadInProgress(const KURL& url, ResourceLoadIdentifier& identifier) { identifier = NetworkProcess::shared().networkResourceLoadScheduler().addLoadInProgress(url); } @@ -152,6 +154,62 @@ void NetworkConnectionToWebProcess::setSerialLoadingEnabled(bool enabled) m_serialLoadingEnabled = enabled; } +void NetworkConnectionToWebProcess::cookiesForDOM(const KURL& firstParty, const KURL& url, String& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookiesForDOM(RemoteNetworkingContext::create(false, false).get(), firstParty, url); +} + +void NetworkConnectionToWebProcess::setCookiesFromDOM(const KURL& firstParty, const KURL& url, const String& cookieString) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::setCookiesFromDOM(RemoteNetworkingContext::create(false, false).get(), firstParty, url, cookieString); +} + +void NetworkConnectionToWebProcess::cookiesEnabled(const KURL& firstParty, const KURL& url, bool& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookiesEnabled(RemoteNetworkingContext::create(false, false).get(), firstParty, url); +} + +void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(const KURL& firstParty, const KURL& url, String& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + result = WebCore::cookieRequestHeaderFieldValue(0, firstParty, url); +} + +void NetworkConnectionToWebProcess::getRawCookies(const KURL& firstParty, const KURL& url, Vector<Cookie>& result) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::getRawCookies(RemoteNetworkingContext::create(false, false).get(), firstParty, url, result); +} + +void NetworkConnectionToWebProcess::deleteCookie(const KURL& url, const String& cookieName) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteCookie(RemoteNetworkingContext::create(false, false).get(), url, cookieName); +} + +void NetworkConnectionToWebProcess::getHostnamesWithCookies(Vector<String>& hostnames) +{ + // FIXME (NetworkProcess): Use a correct storage session. + HashSet<String> hostnamesSet; + WebCore::getHostnamesWithCookies(RemoteNetworkingContext::create(false, false).get(), hostnamesSet); + WTF::copyToVector(hostnamesSet, hostnames); +} + +void NetworkConnectionToWebProcess::deleteCookiesForHostname(const String& hostname) +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteCookiesForHostname(RemoteNetworkingContext::create(false, false).get(), hostname); +} + +void NetworkConnectionToWebProcess::deleteAllCookies() +{ + // FIXME (NetworkProcess): Use a correct storage session. + WebCore::deleteAllCookies(RemoteNetworkingContext::create(false, false).get()); +} + } // namespace WebKit #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h index 179bc2ddf..042a7dd00 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h @@ -82,7 +82,16 @@ private: void suspendPendingRequests(); void resumePendingRequests(); void setSerialLoadingEnabled(bool); - + void cookiesForDOM(const WebCore::KURL& firstParty, const WebCore::KURL&, String& result); + void setCookiesFromDOM(const WebCore::KURL& firstParty, const WebCore::KURL&, const String&); + void cookiesEnabled(const WebCore::KURL& firstParty, const WebCore::KURL&, bool& result); + void cookieRequestHeaderFieldValue(const WebCore::KURL& firstParty, const WebCore::KURL&, String& result); + void getRawCookies(const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&); + void deleteCookie(const WebCore::KURL&, const String& cookieName); + void getHostnamesWithCookies(Vector<String>& hostnames); + void deleteCookiesForHostname(const String& hostname); + void deleteAllCookies(); + RefPtr<CoreIPC::Connection> m_connection; HashSet<NetworkConnectionToWebProcessObserver*> m_observers; diff --git a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in index 8c13e3cdf..d6c5f65b8 100644 --- a/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in +++ b/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in @@ -38,6 +38,16 @@ messages -> NetworkConnectionToWebProcess { ResumePendingRequests() -> () SetSerialLoadingEnabled(bool enabled) -> () + + CookiesForDOM(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::String result) + SetCookiesFromDOM(WebCore::KURL firstParty, WebCore::KURL url, WTF::String cookieString) + CookiesEnabled(WebCore::KURL firstParty, WebCore::KURL url) -> (bool enabled) + CookieRequestHeaderFieldValue(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::String result) + GetRawCookies(WebCore::KURL firstParty, WebCore::KURL url) -> (WTF::Vector<WebCore::Cookie> cookies) + DeleteCookie(WebCore::KURL url, WTF::String cookieName) + GetHostnamesWithCookies() -> (WTF::Vector<WTF::String> hostnames) + DeleteCookiesForHostname(WTF::String hostname) + DeleteAllCookies() } #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp index 17d8ecbc8..950f20dd0 100644 --- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp +++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp @@ -93,6 +93,10 @@ void Connection::platformInitialize(Identifier identifier) #if HAVE(XPC) m_xpcConnection = identifier.xpcConnection; + // FIXME: Instead of explicitly retaining the connection here, Identifier::xpcConnection + // should just be a smart pointer. + if (m_xpcConnection) + xpc_retain(m_xpcConnection); #endif } diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h index d60c94b92..b4323ed17 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.h +++ b/Source/WebKit2/PluginProcess/PluginProcess.h @@ -45,6 +45,13 @@ struct PluginProcessCreationParameters; class PluginProcess : ChildProcess { WTF_MAKE_NONCOPYABLE(PluginProcess); public: + + enum Type { + // Start with value one since default HashTraits<> disallows zero as key. + TypeRegularProcess = 1, + TypeSnapshotProcess + }; + static PluginProcess& shared(); void initialize(CoreIPC::Connection::Identifier, WebCore::RunLoop*); @@ -115,6 +122,13 @@ private: } // namespace WebKit +namespace WTF { + +template<> struct DefaultHash<WebKit::PluginProcess::Type> { typedef DefaultHash<uint32_t>::Hash Hash; }; +template<> struct IsInteger<WebKit::PluginProcess::Type> { static const bool value = true; }; + +} // namespace WTF + #endif // ENABLE(PLUGIN_PROCESS) #endif // PluginProcess_h diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm index 671f20d6d..b7c52e613 100644 --- a/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm +++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm @@ -33,6 +33,7 @@ #import "PluginProcessShim.h" #import "PluginProcessProxyMessages.h" #import "PluginProcessCreationParameters.h" +#import <CoreAudio/AudioHardware.h> #import <WebCore/LocalizedStrings.h> #import <WebKitSystemInterface.h> #import <dlfcn.h> @@ -304,6 +305,14 @@ static void initializeSandbox(const String& pluginPath, const String& sandboxPro } #endif +static void muteAudio(void) +{ + AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; + UInt32 propertyData = 0; + OSStatus result = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, 0, sizeof(UInt32), &propertyData); + ASSERT_UNUSED(result, result == noErr); +} + void PluginProcess::platformInitialize(const PluginProcessCreationParameters& parameters) { m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); @@ -319,6 +328,9 @@ void PluginProcess::platformInitialize(const PluginProcessCreationParameters& pa #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 initializeSandbox(m_pluginPath, parameters.sandboxProfileDirectoryPath); #endif + + if (parameters.processType == TypeSnapshotProcess) + muteAudio(); } } // namespace WebKit diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py index 69a9e352e..0c9b94116 100644 --- a/Source/WebKit2/Scripts/webkit2/messages.py +++ b/Source/WebKit2/Scripts/webkit2/messages.py @@ -164,6 +164,7 @@ def struct_or_class(namespace, type): 'WebCore::Animation', 'WebCore::EditorCommandsForKeyEvent', 'WebCore::CompositionUnderline', + 'WebCore::Cookie', 'WebCore::DragSession', 'WebCore::FloatPoint3D', 'WebCore::FileChooserSettings', diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index f53c26e6b..f5e5101ea 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -40,6 +40,7 @@ PluginProcessCreationParameters::PluginProcessCreationParameters() void PluginProcessCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const { encoder << pluginPath; + encoder.encodeEnum(processType); encoder << supportsAsynchronousPluginInitialization; encoder << minimumLifetime; encoder << terminationTimeout; @@ -55,6 +56,8 @@ bool PluginProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, { if (!decoder->decode(result.pluginPath)) return false; + if (!decoder->decodeEnum(result.processType)) + return false; if (!decoder->decode(result.supportsAsynchronousPluginInitialization)) return false; if (!decoder->decode(result.minimumLifetime)) diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h index a414212be..1b3f9ff27 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h @@ -28,6 +28,7 @@ #if ENABLE(PLUGIN_PROCESS) +#include "PluginProcess.h" #include <wtf/text/WTFString.h> #if PLATFORM(MAC) @@ -48,6 +49,7 @@ struct PluginProcessCreationParameters { static bool decode(CoreIPC::ArgumentDecoder*, PluginProcessCreationParameters&); String pluginPath; + PluginProcess::Type processType; bool supportsAsynchronousPluginInitialization; double minimumLifetime; diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp index 516b68b9b..12f387e5d 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp @@ -28,6 +28,7 @@ #include "ShareableBitmap.h" #include <WebCore/AuthenticationChallenge.h> +#include <WebCore/Cookie.h> #include <WebCore/Credential.h> #include <WebCore/Cursor.h> #include <WebCore/DatabaseDetails.h> @@ -686,6 +687,42 @@ bool ArgumentCoder<CompositionUnderline>::decode(ArgumentDecoder* decoder, Compo return true; } + +void ArgumentCoder<Cookie>::encode(ArgumentEncoder& encoder, const Cookie& cookie) +{ + encoder << cookie.name; + encoder << cookie.value; + encoder << cookie.domain; + encoder << cookie.path; + encoder << cookie.expires; + encoder << cookie.httpOnly; + encoder << cookie.secure; + encoder << cookie.session; +} + +bool ArgumentCoder<Cookie>::decode(ArgumentDecoder* decoder, Cookie& cookie) +{ + if (!decoder->decode(cookie.name)) + return false; + if (!decoder->decode(cookie.value)) + return false; + if (!decoder->decode(cookie.domain)) + return false; + if (!decoder->decode(cookie.path)) + return false; + if (!decoder->decode(cookie.expires)) + return false; + if (!decoder->decode(cookie.httpOnly)) + return false; + if (!decoder->decode(cookie.secure)) + return false; + if (!decoder->decode(cookie.session)) + return false; + + return true; +} + + #if ENABLE(SQL_DATABASE) void ArgumentCoder<DatabaseDetails>::encode(ArgumentEncoder& encoder, const DatabaseDetails& details) { diff --git a/Source/WebKit2/Shared/WebCoreArgumentCoders.h b/Source/WebKit2/Shared/WebCoreArgumentCoders.h index e25314758..75b4acc59 100644 --- a/Source/WebKit2/Shared/WebCoreArgumentCoders.h +++ b/Source/WebKit2/Shared/WebCoreArgumentCoders.h @@ -52,6 +52,7 @@ namespace WebCore { class UserStyleSheet; class UserScript; struct CompositionUnderline; + struct Cookie; struct DictationAlternative; struct DragSession; struct FileChooserSettings; @@ -207,6 +208,11 @@ template<> struct ArgumentCoder<WebCore::CompositionUnderline> { static bool decode(ArgumentDecoder*, WebCore::CompositionUnderline&); }; +template<> struct ArgumentCoder<WebCore::Cookie> { + static void encode(ArgumentEncoder&, const WebCore::Cookie&); + static bool decode(ArgumentDecoder*, WebCore::Cookie&); +}; + template<> struct ArgumentCoder<WebCore::DatabaseDetails> { static void encode(ArgumentEncoder&, const WebCore::DatabaseDetails&); static bool decode(ArgumentDecoder*, WebCore::DatabaseDetails&); diff --git a/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm b/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm index d19e981a5..d30e7e1a1 100644 --- a/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm +++ b/Source/WebKit2/Shared/mac/ObjCObjectGraphCoders.mm @@ -94,7 +94,7 @@ public: type = typeFromObject(m_root); if (type == UnknownType) { - [NSException raise:NSInvalidArgumentException format:@"Can not encode objects of class type '%@'", NSStringFromClass([m_root class])]; + [NSException raise:NSInvalidArgumentException format:@"Can not encode objects of class type '%@'", static_cast<NSString *>(NSStringFromClass([m_root class]))]; } encoder << static_cast<uint32_t>(type); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp index 50e4cb205..2f2629ce0 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp @@ -114,6 +114,9 @@ const Evas_Object* EwkViewImpl::viewFromPageViewMap(const WKPageRef page) EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, PassRefPtr<WebPageGroup> pageGroup, ViewBehavior behavior) : m_view(view) , m_context(context) +#if USE(ACCELERATED_COMPOSITING) + , m_pendingSurfaceResize(false) +#endif , m_pageClient(behavior == DefaultBehavior ? PageClientDefaultImpl::create(this) : PageClientLegacyImpl::create(this)) , m_pageProxy(m_context->webContext()->createWebPage(m_pageClient.get(), pageGroup.get())) , m_pageLoadClient(PageLoadClientEfl::create(this)) @@ -361,7 +364,12 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*) #if USE(COORDINATED_GRAPHICS) Ewk_View_Smart_Data* sd = smartData(); - evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); + if (m_pendingSurfaceResize) { + // Create a GL surface here so that Evas has no chance of painting to an empty GL surface. + createGLSurface(IntSize(sd->view.w, sd->view.h)); + m_pendingSurfaceResize = false; + } else + evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); // We are supposed to clip to the actual viewport, nothing less. IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h index cb1875672..bb93fedb1 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h @@ -161,6 +161,7 @@ public: bool createGLSurface(const WebCore::IntSize& viewSize); bool enterAcceleratedCompositingMode(); bool exitAcceleratedCompositingMode(); + void setNeedsSurfaceResize() { m_pendingSurfaceResize = true; } #endif #if ENABLE(INPUT_TYPE_COLOR) @@ -246,6 +247,7 @@ private: OwnPtr<Evas_GL> m_evasGL; OwnPtr<WebKit::EvasGLContext> m_evasGLContext; OwnPtr<WebKit::EvasGLSurface> m_evasGLSurface; + bool m_pendingSurfaceResize; #endif OwnPtr<WebKit::PageClientBase> m_pageClient; RefPtr<WebKit::WebPageProxy> m_pageProxy; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d5d50ed0a..349b086e9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -387,8 +387,7 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); #if USE(ACCELERATED_COMPOSITING) - if (width && height) - impl->createGLSurface(IntSize(width, height)); + impl->setNeedsSurfaceResize(); #endif #if USE(TILED_BACKING_STORE) impl->pageClient()->updateViewportSize(IntSize(width, height)); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index 25fe0698b..922c3ec21 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -134,7 +134,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_navigation) ASSERT_FALSE(ewk_view_forward_possible(webView())); } -TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom) +TEST_F(EWK2UnitTestBase, DISABLED_ewk_view_setting_encoding_custom) { ASSERT_FALSE(ewk_view_custom_encoding_get(webView())); ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), "UTF-8")); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp index ef2da1c98..13efe8c68 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp @@ -23,15 +23,40 @@ #include "AuthenticationChallengeProxy.h" #include "AuthenticationDecisionListener.h" #include "WebCredential.h" +#include "WebKitWebViewBasePrivate.h" +#include "WebKitWebViewPrivate.h" +#include <gtk/gtk.h> namespace WebKit { +// This is necessary because GtkEventBox does not draw a background by default, +// but we want it to have a normal GtkWindow background. +static gboolean drawSignal(GtkWidget* widget, cairo_t* cr, GtkStyleContext* styleContext) +{ + gtk_render_background(styleContext, cr, 0, 0, + gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget)); + return FALSE; +} + WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge) - : GtkAuthenticationDialog(0, authenticationChallenge->core()) + : GtkAuthenticationDialog(authenticationChallenge->core()) , m_authenticationChallenge(authenticationChallenge) + , m_styleContext(adoptGRef(gtk_style_context_new())) { - // We aren't passing a toplevel to the GtkAuthenticationDialog constructor, - // because eventually this widget will be embedded into the WebView itself. + m_dialog = gtk_event_box_new(); + + GtkWidget* frame = gtk_frame_new(0); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + gtk_container_add(GTK_CONTAINER(m_dialog), frame); + createContentsInContainer(frame); + + gtk_style_context_add_class(m_styleContext.get(), GTK_STYLE_CLASS_BACKGROUND); + GtkWidgetPath* path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_WINDOW); + gtk_style_context_set_path(m_styleContext.get(), path); + gtk_widget_path_free(path); + + g_signal_connect(m_dialog, "draw", G_CALLBACK(drawSignal), m_styleContext.get()); } void WebKit2GtkAuthenticationDialog::authenticate(const WebCore::Credential& credential) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h index 60c5e0588..67064622c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h @@ -17,22 +17,32 @@ * Boston, MA 02110-1301, USA. */ +#ifndef WebKit2GtkAuthenticationDialog_h +#define WebKit2GtkAuthenticationDialog_h + #include "AuthenticationChallengeProxy.h" #include "WKRetainPtr.h" +#include "WebKitWebViewBase.h" #include <WebCore/Credential.h> #include <WebCore/GtkAuthenticationDialog.h> +#include <wtf/gobject/GRefPtr.h> namespace WebKit { class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog { public: WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*); + virtual ~WebKit2GtkAuthenticationDialog() { } + GtkWidget* widget() { return m_dialog; } protected: virtual void authenticate(const WebCore::Credential&); private: RefPtr<AuthenticationChallengeProxy> m_authenticationChallenge; + GRefPtr<GtkStyleContext> m_styleContext; }; } // namespace WebKit + +#endif // WebKit2GtkAuthenticationDialog_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index be06eddf6..1eae26753 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -118,8 +118,7 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo) { - WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(toImpl(authenticationChallenge)); - dialog->show(); + webkitWebViewHandleAuthenticationChallenge(WEBKIT_WEB_VIEW(clientInfo), toImpl(authenticationChallenge)); } void attachLoaderClientToView(WebKitWebView* webView) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 6598b6602..fb0c5ed9a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -1261,6 +1261,7 @@ static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent if (loadEvent == WEBKIT_LOAD_STARTED) { webkitWebViewSetIsLoading(webView, true); webkitWebViewWatchForChangesInFavicon(webView); + webkitWebViewBaseCancelAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView)); } else if (loadEvent == WEBKIT_LOAD_FINISHED) { webkitWebViewSetIsLoading(webView, false); webView->priv->waitingForMainResource = false; @@ -1609,6 +1610,13 @@ void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmission g_signal_emit(webView, signals[SUBMIT_FORM], 0, request); } +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge) +{ + WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(authenticationChallenge); + webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), dialog); + dialog->show(); +} + /** * webkit_web_view_new: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index de741c2e3..c46deb27a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -83,7 +83,7 @@ struct _WebKitWebViewBasePrivate { _WebKitWebViewBasePrivate() : imContext(adoptGRef(gtk_im_multicontext_new())) #if USE(TEXTURE_MAPPER_GL) - , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) + , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext)) #endif { } @@ -106,6 +106,7 @@ struct _WebKitWebViewBasePrivate { IntSize resizerSize; GRefPtr<AtkObject> accessible; bool needsResizeOnMap; + WebKit2GtkAuthenticationDialog* authenticationDialog; GtkWidget* inspectorView; unsigned inspectorViewHeight; GOwnPtr<GdkEvent> contextMenuEvent; @@ -272,16 +273,20 @@ static void webkitWebViewBaseRealize(GtkWidget* widget) webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel)); } +static bool webkitWebViewChildIsInternalWidget(WebKitWebViewBase* webViewBase, GtkWidget* widget) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + return widget == priv->inspectorView || (priv->authenticationDialog && priv->authenticationDialog->widget() == widget); +} + static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); WebKitWebViewBasePrivate* priv = webView->priv; - if (WEBKIT_IS_WEB_VIEW_BASE(widget) - && WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) { - ASSERT(!priv->inspectorView); - priv->inspectorView = widget; - } else { + // Internal widgets like the web inspector and authentication dialog have custom + // allocations so we don't need to add them to our list of children. + if (!webkitWebViewChildIsInternalWidget(webView, widget)) { GtkAllocation childAllocation; gtk_widget_get_allocation(widget, &childAllocation); priv->children.set(widget, childAllocation); @@ -290,6 +295,26 @@ static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* wi gtk_widget_set_parent(widget, GTK_WIDGET(container)); } +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase* webViewBase, WebKit2GtkAuthenticationDialog* dialog) +{ + webViewBase->priv->authenticationDialog = dialog; + gtk_container_add(GTK_CONTAINER(webViewBase), dialog->widget()); + gtk_widget_queue_draw(GTK_WIDGET(webViewBase)); // We need to draw the shadow over the widget. +} + +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase* webViewBase) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + priv->authenticationDialog->destroy(); +} + +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase* webViewBase, GtkWidget* inspector) +{ + webViewBase->priv->inspectorView = inspector; + gtk_container_add(GTK_CONTAINER(webViewBase), inspector); +} + static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); @@ -302,6 +327,8 @@ static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* if (priv->inspectorView == widget) { priv->inspectorView = 0; priv->inspectorViewHeight = 0; + } else if (priv->authenticationDialog && priv->authenticationDialog->widget() == widget) { + priv->authenticationDialog = 0; } else { ASSERT(priv->children.contains(widget)); priv->children.remove(widget); @@ -322,12 +349,14 @@ static void webkitWebViewBaseContainerForall(GtkContainer* container, gboolean i if (includeInternals && priv->inspectorView) (*callback)(priv->inspectorView, callbackData); + + if (includeInternals && priv->authenticationDialog) + (*callback)(priv->authenticationDialog->widget(), callbackData); } void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* child, const IntRect& childRect) { const IntRect& geometry = webView->priv->children.get(child); - if (geometry == childRect) return; @@ -359,6 +388,8 @@ static void webkitWebViewBaseConstructed(GObject* object) if (priv->redirectedWindow) priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, object); #endif + + priv->authenticationDialog = 0; } #if USE(TEXTURE_MAPPER_GL) @@ -400,6 +431,12 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr) WebCore::Region unpaintedRegion; // This is simply unused. drawingArea->paint(cr, clipRect, unpaintedRegion); + if (webViewBase->priv->authenticationDialog) { + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba(cr, 0, 0, 0, 0.5); + cairo_paint(cr); + } + return FALSE; } @@ -434,6 +471,22 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase viewRect.setHeight(allocation->height - priv->inspectorViewHeight); } + // The authentication dialog is centered in the view rect, which means that it + // never overlaps the web inspector. Thus, we need to calculate the allocation here + // after calculating the inspector allocation. + if (priv->authenticationDialog) { + GtkRequisition naturalSize; + gtk_widget_get_preferred_size(priv->authenticationDialog->widget(), 0, &naturalSize); + + GtkAllocation childAllocation = { + (viewRect.width() - naturalSize.width) / 2, + (viewRect.height() - naturalSize.height) / 2, + naturalSize.width, + naturalSize.height + }; + gtk_widget_size_allocate(priv->authenticationDialog->widget(), &childAllocation); + } + #if USE(TEXTURE_MAPPER_GL) if (sizeChanged && webViewBase->priv->redirectedWindow) webViewBase->priv->redirectedWindow->resize(viewRect.size()); @@ -515,6 +568,9 @@ static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* e WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event); + #if ENABLE(FULLSCREEN_API) if (priv->fullScreenModeActive) { switch (event->keyval) { @@ -561,6 +617,10 @@ static gboolean webkitWebViewBaseButtonPressEvent(GtkWidget* widget, GdkEventBut { WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent)) @@ -579,6 +639,9 @@ static gboolean webkitWebViewBaseButtonReleaseEvent(GtkWidget* widget, GdkEventB WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); @@ -590,6 +653,9 @@ static gboolean webkitWebViewBaseScrollEvent(GtkWidget* widget, GdkEventScroll* WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event))); return TRUE; @@ -600,6 +666,9 @@ static gboolean webkitWebViewBaseMotionNotifyEvent(GtkWidget* widget, GdkEventMo WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); return TRUE; @@ -737,7 +806,20 @@ static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* oldParent) { if (!gtk_widget_get_parent(widget)) webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0); +} + +static gboolean webkitWebViewBaseFocus(GtkWidget* widget, GtkDirectionType direction) +{ + // If the authentication dialog is active, we need to forward focus events there. This + // ensures that you can tab between elements in the box. + WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; + if (priv->authenticationDialog) { + gboolean returnValue; + g_signal_emit_by_name(priv->authenticationDialog->widget(), "focus", direction, &returnValue); + return returnValue; + } + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->focus(widget, direction); } static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass) @@ -748,6 +830,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; widgetClass->map = webkitWebViewBaseMap; widgetClass->unmap = webkitWebViewBaseUnmap; + widgetClass->focus = webkitWebViewBaseFocus; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index ef05f2289..2bd0bc002 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -29,6 +29,7 @@ #define WebKitWebViewBasePrivate_h #include "WebContextMenuProxyGtk.h" +#include "WebKit2GtkAuthenticationDialog.h" #include "WebKitPrivate.h" #include "WebKitWebViewBase.h" #include "WebPageProxy.h" @@ -64,4 +65,8 @@ typedef void (*WebKitWebViewBaseDownloadRequestHandler) (WebKitWebViewBase*, Web void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase*, WebKitWebViewBaseDownloadRequestHandler); void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase*, WebKit::DownloadProxy*); +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase*, WebKit::WebKit2GtkAuthenticationDialog*); +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase*); +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector); + #endif // WebKitWebViewBasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index 2e1fed30e..66da58476 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -55,5 +55,6 @@ bool webkitWebViewEnterFullScreen(WebKitWebView*); bool webkitWebViewLeaveFullScreen(WebKitWebView*); void webkitWebViewPopulateContextMenu(WebKitWebView*, WebKit::ImmutableArray* proposedMenu, WebKit::WebHitTestResult*); void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*); +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*); #endif // WebKitWebViewPrivate_h diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h index 8768fd067..66b23e47c 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h @@ -139,6 +139,7 @@ private: virtual void recommendedScrollbarStyleDidChange(int32_t newStyle); virtual WKView* wkView() const { return m_wkView; } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) OVERRIDE; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index 9ed7feea1..0172cb077 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -558,6 +558,11 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) #endif } +void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + [m_wkView _setIntrinsicContentSize:intrinsicContentSize]; +} + bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) { return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 4e30b3368..b1470fea9 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -215,6 +215,8 @@ struct WKViewInterpretKeyEventsParameters { RefPtr<WebCore::Image> _promisedImage; String _promisedFilename; String _promisedURL; + + NSSize _intrinsicContentSize; } @end @@ -356,6 +358,11 @@ struct WKViewInterpretKeyEventsParameters { return YES; } +- (NSSize)intrinsicContentSize +{ + return _data->_intrinsicContentSize; +} + - (void)setFrameSize:(NSSize)size { if (!NSEqualSizes(size, [self frame].size)) @@ -2925,6 +2932,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return ![sink.get() didReceiveUnhandledCommand]; } +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize +{ + _data->_intrinsicContentSize = intrinsicContentSize; + [self invalidateIntrinsicContentSize]; +} + - (void)_cacheWindowBottomCornerRect { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -3021,6 +3034,8 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_mouseDownEvent = nil; _data->_ignoringMouseDraggedEvents = NO; + _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); + [self _registerDraggedTypes]; if ([self _shouldUseTiledDrawingArea]) { @@ -3126,6 +3141,16 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } +- (CGFloat)minimumLayoutWidth +{ + return _data->_page->minimumLayoutWidth(); +} + +- (void)setMinimumLayoutWidth:(CGFloat)minimumLayoutWidth +{ + _data->_page->setMinimumLayoutWidth(minimumLayoutWidth); +} + @end @implementation WKResponderChainSink diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index 3f612d240..9b02947a3 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -61,6 +61,7 @@ namespace WebKit { - (BOOL)_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; - (bool)_executeSavedCommandBySelector:(SEL)selector; +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize; - (NSRect)_convertToDeviceSpace:(NSRect)rect; - (NSRect)_convertToUserSpace:(NSRect)rect; - (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h index 51578764f..2161eb786 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -50,4 +50,6 @@ - (void)performDictionaryLookupAtCurrentMouseLocation; + (void)hideWordDefinitionWindow; +@property (readwrite) CGFloat minimumLayoutWidth; + @end diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index a45636a79..e83e13379 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -319,6 +319,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true); webPageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true); + webPageProxy->pageGroup()->preferences()->setWebGLEnabled(true); pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController); webPageProxy->initializeWebPage(); diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index f5f0bd3f9..3f9c3b2ae 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -130,6 +130,11 @@ void QRawWebViewPrivate::updateTextInputState() notImplemented(); } +void QRawWebViewPrivate::handleWillSetInputMethodState() +{ + notImplemented(); +} + #if ENABLE(GESTURE_EVENTS) void QRawWebViewPrivate::doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h index 545096d02..7bc6f1162 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h @@ -71,6 +71,7 @@ public: #endif // USE(ACCELERATED_COMPOSITING) virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); #if ENABLE(GESTURE_EVENTS) virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled); #endif diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro index 7c72fd2f1..3fd3d4583 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_DesktopBehavior OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 3e217b369..b340235e4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_WebView OBJECTS_DIR = obj_WebView/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml new file mode 100644 index 000000000..5f6c63b57 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml @@ -0,0 +1,175 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import Test 1.0 +import "../common" + +Item { + TestWebView { + id: webView + width: 320 + height: 480 + + property variant result + + property variant content: "data:text/html," + + "<head>" + + " <meta name='viewport' content='width=device-width'>" + + "</head>" + + "<body>" + + " <div id='target' style='width: 240px; height: 360px;'>" + + " </div>" + + "</body>" + + signal resultReceived + } + + SignalSpy { + id: resultSpy + target: webView + signalName: "resultReceived" + } + + SignalSpy { + id: scaleSpy + target: webView.experimental.test + signalName: "contentsScaleCommitted" + } + + SignalSpy { + id: sizeSpy + target: webView.experimental.test + signalName: "contentsSizeChanged" + } + + TestCase { + name: "Resize" + when: windowShown + + property variant test: webView.experimental.test + + function init() { + resultSpy.clear() + scaleSpy.clear() + viewportSpy.clear() + } + + function run(signalSpy, script) { + signalSpy.clear(); + var result; + webView.experimental.evaluateJavaScript( + script, + function(value) { webView.resultReceived(); result = value }); + signalSpy.wait(); + return result; + } + + function contentsSize() { + return test.contentsSize.width + "x" + test.contentsSize.height; + } + + function elementRect(id) { + return JSON.parse(run(resultSpy, "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());")) + } + + function doubleTapAtPoint(x, y) { + scaleSpy.clear() + test.touchDoubleTap(webView, x, y) + scaleSpy.wait() + } + + function resize(w, h) { + sizeSpy.clear() + webView.width = w + sizeSpy.wait() + webView.height = h + sizeSpy.wait() + } + + function test_basic() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + } + + function test_resizeAfterNeutralZoom() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Zoom in and out. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, 1.0) + + // Now check resizing still works as expected. + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + + function test_resizeZoomedIn() { + // Note that if we change the behavior of resize on zoomed-in content, for instance + // to preserve the visible width (like rotate), this test will need to be updated. + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Double tap to zoom in. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + // Resize just a small bit, not changing scale. + resize(288, 432) + compare(contentsSize(), "288x432") + compare(test.contentsScale, targetScale) + + // And double tap to reset zoom. + target = elementRect("target"); + targetScale = webView.width / (target.width + 2 * 10) + doubleTapAtPoint(100, 50) + compare(test.contentsScale, targetScale) + + // Double tap again to zoom out. + doubleTapAtPoint(100, 50) + compare(contentsSize(), "288x432") + compare(test.contentsScale, 1.0) + + // And reset + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 123b25ce2..a1133530d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -6,7 +6,7 @@ TARGET = tst_$$TARGET INCLUDEPATH += $$PWD SOURCES += ../util.cpp -QT += testlib webkitwidgets +QT += testlib webkit have?(QTQUICK) { QT += qml quick quick-private HEADERS += ../bytearraytestdata.h \ diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 7fae9a011..71c4bcbd6 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -216,8 +216,8 @@ void LayerTreeRenderer::adjustPositionForFixedLayers() FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize); FloatSize delta = scrollPosition - renderedScrollPosition; - LayerMap::iterator end = m_fixedLayers.end(); - for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it) + LayerRawPtrMap::iterator end = m_fixedLayers.end(); + for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it) toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); } @@ -266,17 +266,16 @@ void LayerTreeRenderer::destroyCanvas(WebLayerID id) void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); Vector<GraphicsLayer*> children; for (size_t i = 0; i < childIDs.size(); ++i) { WebLayerID childID = childIDs[i]; GraphicsLayer* child = layerByID(childID); if (!child) { - child = createLayer(childID).leakPtr(); - m_layers.add(childID, child); + OwnPtr<GraphicsLayer*> newChild = createLayer(childID); + child = newChild.get(); + m_layers.add(childID, newChild.release()); } children.append(child); } @@ -286,11 +285,8 @@ void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID> #if ENABLE(CSS_FILTERS) void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& filters) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); + GraphicsLayer* layer = ensureLayer(id); - GraphicsLayer* layer = it->value; #if ENABLE(CSS_SHADERS) injectCachedCustomFilterPrograms(filters); #endif @@ -332,11 +328,7 @@ void LayerTreeRenderer::removeCustomFilterProgram(int id) void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerInfo) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); - - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); layer->setReplicatedByLayer(layerByID(layerInfo.replica)); layer->setMaskLayer(layerByID(layerInfo.mask)); @@ -371,26 +363,29 @@ void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerIn void LayerTreeRenderer::deleteLayer(WebLayerID layerID) { - GraphicsLayer* layer = layerByID(layerID); + OwnPtr<GraphicsLayer> layer = m_layers.take(layerID); if (!layer) return; layer->removeFromParent(); - m_layers.remove(layerID); m_fixedLayers.remove(layerID); #if USE(GRAPHICS_SURFACE) m_surfaceBackingStores.remove(layerID); #endif - delete layer; } -void LayerTreeRenderer::ensureLayer(WebLayerID id) +WebCore::GraphicsLayer* LayerTreeRenderer::ensureLayer(WebLayerID id) { - // We have to leak the new layer's pointer and manage it ourselves, - // because OwnPtr is not copyable. - if (m_layers.find(id) == m_layers.end()) - m_layers.add(id, createLayer(id).leakPtr()); + LayerMap::iterator it = m_layers.find(id); + if (it != m_layers.end()) + return it->value.get(); + + OwnPtr<WebCore::GraphicsLayer> newLayer = createLayer(id); + WebCore::GraphicsLayer* layer = newLayer.get(); + m_layers.add(id, newLayer.release()); + + return layer; } void LayerTreeRenderer::setRootLayerID(WebLayerID layerID) diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 6f1056aac..946ac6d49 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -142,7 +142,7 @@ private: void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID); void removeReleasedImageBackingsIfNeeded(); void ensureRootLayer(); - void ensureLayer(WebLayerID); + WebCore::GraphicsLayer* ensureLayer(WebLayerID); void commitPendingBackingStoreOperations(); CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*); @@ -151,7 +151,6 @@ private: void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*); void resetBackingStoreSizeToLayerSize(WebCore::GraphicsLayer*); - typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap; WebCore::FloatSize m_contentsSize; WebCore::FloatRect m_visibleContentsRect; @@ -181,8 +180,10 @@ private: OwnPtr<WebCore::GraphicsLayer> m_rootLayer; + typedef HashMap<WebLayerID, OwnPtr<WebCore::GraphicsLayer> > LayerMap; LayerMap m_layers; - LayerMap m_fixedLayers; + typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerRawPtrMap; + LayerRawPtrMap m_fixedLayers; WebLayerID m_rootLayerID; WebCore::IntPoint m_renderedContentsScrollPosition; WebCore::IntPoint m_pendingRenderedContentsScrollPosition; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 74a87a455..c4ed068b4 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -81,6 +81,7 @@ public: virtual void waitForPossibleGeometryUpdate() { } virtual void colorSpaceDidChange() { } + virtual void minimumLayoutWidthDidChange() { } #if USE(COORDINATED_GRAPHICS) virtual void updateViewport(); @@ -118,7 +119,8 @@ private: virtual void updateAcceleratedCompositingMode(uint64_t /* backingStoreStateID */, const LayerTreeContext&) { } #endif #if PLATFORM(MAC) - virtual void didUpdateGeometry() { } + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) { } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) { } #endif }; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in index 7dbdcebab..b3f02afec 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -31,6 +31,7 @@ messages -> DrawingAreaProxy { #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingAreaProxy. - DidUpdateGeometry() + DidUpdateGeometry(WebCore::IntSize newIntrinsicContentSize) + IntrinsicContentSizeDidChange(WebCore::IntSize newIntrinsicContentSize) #endif } diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index dd0cd5a1c..56dc9a141 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -127,6 +127,7 @@ public: virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; + virtual void handleWillSetInputMethodState() = 0; #endif // PLATFORM(QT). #if PLATFORM(QT) || PLATFORM(EFL) @@ -224,6 +225,7 @@ public: #if USE(APPKIT) virtual WKView* wkView() const = 0; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0; virtual void removeDictationAlternatives(uint64_t dictationContext) = 0; diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index ff135a2cf..e56869f23 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -111,7 +111,7 @@ void PageViewportController::didChangeContentsSize(const IntSize& newSize) { m_contentsSize = newSize; - bool minimumScaleUpdated = updateMinimumScaleToFit(); + bool minimumScaleUpdated = updateMinimumScaleToFit(false); if (m_initiallyFitToViewport) { // Restrict scale factors to m_minimumScaleToFit. @@ -209,7 +209,7 @@ void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewp void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVector) { - DrawingAreaProxy* const drawingArea = m_webPageProxy->drawingArea(); + DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea(); if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return; @@ -232,10 +232,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport if (!m_initiallyFitToViewport) WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); - if (updateMinimumScaleToFit()) + if (updateMinimumScaleToFit(true)) m_client->didChangeViewportAttributes(); - - syncVisibleContents(); } WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const @@ -277,11 +275,13 @@ void PageViewportController::applyPositionAfterRenderingContents(const FloatPoin syncVisibleContents(); } -bool PageViewportController::updateMinimumScaleToFit() +bool PageViewportController::updateMinimumScaleToFit(bool userInitiatedUpdate) { if (m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return false; + bool currentlyScaledToFit = fuzzyCompare(m_effectiveScale, toViewportScale(m_minimumScaleToFit), 0.001); + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize), devicePixelRatio()); if (minimumScale <= 0) @@ -290,8 +290,16 @@ bool PageViewportController::updateMinimumScaleToFit() if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) { m_minimumScaleToFit = minimumScale; - if (!m_hadUserInteraction && !hasSuspendedContent()) - applyScaleAfterRenderingContents(toViewportScale(minimumScale)); + if (!hasSuspendedContent()) { + if (!m_hadUserInteraction || (userInitiatedUpdate && currentlyScaledToFit)) + applyScaleAfterRenderingContents(toViewportScale(m_minimumScaleToFit)); + else { + // Ensure the effective scale stays within bounds. + float boundedScale = innerBoundedViewportScale(m_effectiveScale); + if (!fuzzyCompare(boundedScale, m_effectiveScale, 0.001)) + applyScaleAfterRenderingContents(boundedScale); + } + } return true; } diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index 052e89ab0..029228dde 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -84,7 +84,7 @@ private: void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); void applyScaleAfterRenderingContents(float scale); void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos); - bool updateMinimumScaleToFit(); + bool updateMinimumScaleToFit(bool userInitiatedUpdate); WebCore::FloatSize viewportSizeInContentsCoordinates() const; WebPageProxy* const m_webPageProxy; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp index f497895db..834c87fc4 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -45,12 +45,12 @@ PluginProcessManager::PluginProcessManager() { } -void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PluginProcess::Type processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { ASSERT(!pluginPath.isNull()); PluginModuleInfo plugin = pluginInfoStore.infoForPluginWithPath(pluginPath); - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, processType); pluginProcess->getPluginProcessConnection(reply); } @@ -64,32 +64,33 @@ void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginPr void PluginProcessManager::getSitesWithData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->getSitesWithData(webPluginSiteDataManager, callbackID); } void PluginProcessManager::clearSiteData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID); } -PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath) +PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath, PluginProcess::Type processType) { for (size_t i = 0; i < m_pluginProcesses.size(); ++i) { - if (m_pluginProcesses[i]->pluginInfo().path == pluginPath) - return m_pluginProcesses[i].get(); + RefPtr<PluginProcessProxy>& pluginProcessProxy = m_pluginProcesses[i]; + if (pluginProcessProxy->pluginInfo().path == pluginPath && pluginProcessProxy->processType() == processType) + return pluginProcessProxy.get(); } return 0; } -PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin) +PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin, PluginProcess::Type processType) { - if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path)) + if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path, processType)) return pluginProcess; - RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin); + RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin, processType); PluginProcessProxy* pluginProcessPtr = pluginProcess.get(); m_pluginProcesses.append(pluginProcess.release()); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 5e519427b..f84521a49 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -29,6 +29,7 @@ #if ENABLE(PLUGIN_PROCESS) #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "WebProcessProxyMessages.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -50,7 +51,7 @@ class PluginProcessManager { public: static PluginProcessManager& shared(); - void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PluginProcess::Type, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); void removePluginProcessProxy(PluginProcessProxy*); void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID); @@ -63,8 +64,8 @@ public: private: PluginProcessManager(); - PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&); - PluginProcessProxy* pluginProcessWithPath(const String& pluginPath); + PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&, PluginProcess::Type); + PluginProcessProxy* pluginProcessWithPath(const String& pluginPath, PluginProcess::Type); Vector<RefPtr<PluginProcessProxy> > m_pluginProcesses; }; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index 0c2e8689e..5a49f9598 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -50,12 +50,12 @@ namespace WebKit { static const double minimumLifetime = 30 * 60; static const double shutdownTimeout = 10 * 60; -PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) { - return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo)); + return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo, processType)); } -PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) : m_pluginProcessManager(PluginProcessManager) , m_pluginInfo(pluginInfo) , m_numPendingConnectionRequests(0) @@ -64,6 +64,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage , m_fullscreenWindowIsShowing(false) , m_preFullscreenAppPresentationOptions(0) #endif + , m_processType(processType) { ProcessLauncher::LaunchOptions launchOptions; launchOptions.processType = ProcessLauncher::PluginProcess; @@ -173,7 +174,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*) const Vector<WebContext*>& contexts = WebContext::allContexts(); for (size_t i = 0; i < contexts.size(); ++i) - contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path)); + contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path, m_processType)); // This will cause us to be deleted. pluginProcessCrashedOrFailedToLaunch(); @@ -204,6 +205,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio PluginProcessCreationParameters parameters; parameters.pluginPath = m_pluginInfo.path; + parameters.processType = m_processType; parameters.minimumLifetime = minimumLifetime; parameters.terminationTimeout = shutdownTimeout; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index 1357e6c7f..194d7a373 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "ProcessLauncher.h" #include "WebProcessProxyMessages.h" #include <wtf/Deque.h> @@ -62,7 +63,7 @@ struct RawPluginMetaData { class PluginProcessProxy : public RefCounted<PluginProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client { public: - static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&); + static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); ~PluginProcessProxy(); const PluginModuleInfo& pluginInfo() const { return m_pluginInfo; } @@ -82,6 +83,8 @@ public: bool isValid() const { return m_connection; } + PluginProcess::Type processType() const { return m_processType; } + #if PLATFORM(MAC) void setApplicationIsOccluded(bool); @@ -97,7 +100,7 @@ public: #endif private: - PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&); + PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); void pluginProcessCrashedOrFailedToLaunch(); @@ -171,6 +174,8 @@ private: bool m_fullscreenWindowIsShowing; unsigned m_preFullscreenAppPresentationOptions; #endif + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index df416c09d..9d914cf28 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -233,6 +233,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_renderTreeSize(0) , m_shouldSendEventsSynchronously(false) , m_suppressVisibilityUpdates(false) + , m_minimumLayoutWidth(0) , m_mediaVolume(1) , m_mayStartMediaWhenInWindow(true) #if ENABLE(PAGE_VISIBILITY_API) @@ -4129,6 +4130,20 @@ void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event) m_process->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0); } +void WebPageProxy::setMinimumLayoutWidth(double minimumLayoutWidth) +{ + if (m_minimumLayoutWidth == minimumLayoutWidth) + return; + + m_minimumLayoutWidth = minimumLayoutWidth; + m_drawingArea->minimumLayoutWidthDidChange(); + +#if PLATFORM(MAC) + if (m_minimumLayoutWidth <= 0) + intrinsicContentSizeDidChange(IntSize(-1, -1)); +#endif +} + #if PLATFORM(MAC) void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 9139b482e..ff8ec5133 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -409,6 +409,7 @@ public: #if USE(APPKIT) WKView* wkView() const; + void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize); #endif #endif #if PLATFORM(WIN) @@ -757,6 +758,9 @@ public: const WebLoaderClient& loaderClient() { return m_loaderClient; } + double minimumLayoutWidth() const { return m_minimumLayoutWidth; } + void setMinimumLayoutWidth(double); + private: WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID); @@ -895,6 +899,9 @@ private: #endif void editorStateChanged(const EditorState&); +#if PLATFORM(QT) + void willSetInputMethodState(); +#endif // Back/Forward list management void backForwardAddItem(uint64_t itemID); @@ -1239,6 +1246,7 @@ private: bool m_shouldSendEventsSynchronously; bool m_suppressVisibilityUpdates; + float m_minimumLayoutWidth; float m_mediaVolume; bool m_mayStartMediaWhenInWindow; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index f88eda49e..5c89fae35 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -205,7 +205,9 @@ messages -> WebPageProxy { #if PLATFORM(WIN) DidChangeCompositionSelection(bool hasChanged) #endif - +#if PLATFORM(QT) + WillSetInputMethodState() +#endif # Find messages DidCountStringMatches(WTF::String string, uint32_t matchCount) SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index fdeda3a8f..6ca003ab3 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -406,9 +406,9 @@ void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlStr #if ENABLE(PLUGIN_PROCESS) -void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { - PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply); + PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, static_cast<PluginProcess::Type>(processType), reply); } #elif ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 4c9996125..32325d508 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -154,7 +154,7 @@ private: void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); #elif ENABLE(NETSCAPE_PLUGIN_API) void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); void didClearPluginSiteData(uint64_t callbackID); diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index 22e2f08ea..a83e1e84c 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -39,7 +39,7 @@ messages -> WebProcessProxy { GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy) #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed + GetPluginProcessConnection(WTF::String pluginPath, uint32_t processType) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed #endif #if ENABLE(NETSCAPE_PLUGIN_API) && !ENABLE(PLUGIN_PROCESS) void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp index d4e4cd8bb..2b411fde0 100644 --- a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp @@ -93,7 +93,7 @@ void WebInspectorProxy::createInspectorWindow() gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector")); gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight); - gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView); + webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_inspectorWindow), m_inspectorView); gtk_widget_show(m_inspectorView); g_object_add_weak_pointer(G_OBJECT(m_inspectorWindow), reinterpret_cast<void**>(&m_inspectorWindow)); diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h index 08b16508d..c78610984 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h @@ -48,13 +48,15 @@ private: virtual void sizeDidChange() OVERRIDE; virtual void waitForPossibleGeometryUpdate() OVERRIDE; virtual void colorSpaceDidChange() OVERRIDE; + virtual void minimumLayoutWidthDidChange() OVERRIDE; virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) OVERRIDE; virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; // Message handlers. - virtual void didUpdateGeometry() OVERRIDE; + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; void sendUpdateGeometry(); @@ -63,6 +65,9 @@ private: // The last size we sent to the web process. WebCore::IntSize m_lastSentSize; + + // The last minimum layout width we sent to the web process. + double m_lastSentMinimumLayoutWidth; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm index a0c181768..3de8be7a6 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm @@ -47,6 +47,7 @@ PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> TiledCoreAnimationDrawingAreaProx TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy(WebPageProxy* webPageProxy) : DrawingAreaProxy(DrawingAreaTypeTiledCoreAnimation, webPageProxy) , m_isWaitingForDidUpdateGeometry(false) + , m_lastSentMinimumLayoutWidth(0) { } @@ -103,6 +104,19 @@ void TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange() m_webPageProxy->process()->send(Messages::DrawingArea::SetColorSpace(m_webPageProxy->colorSpace()), m_webPageProxy->pageID()); } +void TiledCoreAnimationDrawingAreaProxy::minimumLayoutWidthDidChange() +{ + if (!m_webPageProxy->isValid()) + return; + + // We only want one UpdateGeometry message in flight at once, so if we've already sent one but + // haven't yet received the reply we'll just return early here. + if (m_isWaitingForDidUpdateGeometry) + return; + + sendUpdateGeometry(); +} + void TiledCoreAnimationDrawingAreaProxy::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext) { m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); @@ -119,24 +133,36 @@ void TiledCoreAnimationDrawingAreaProxy::updateAcceleratedCompositingMode(uint64 m_webPageProxy->updateAcceleratedCompositingMode(layerTreeContext); } -void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry() +void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry(const IntSize& newIntrinsicContentSize) { ASSERT(m_isWaitingForDidUpdateGeometry); m_isWaitingForDidUpdateGeometry = false; + double minimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); + // If the WKView was resized while we were waiting for a DidUpdateGeometry reply from the web process, // we need to resend the new size here. - if (m_lastSentSize != m_size) + if (m_lastSentSize != m_size || m_lastSentMinimumLayoutWidth != minimumLayoutWidth) sendUpdateGeometry(); + + if (minimumLayoutWidth > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); +} + +void TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange(const IntSize& newIntrinsicContentSize) +{ + if (m_webPageProxy->minimumLayoutWidth() > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); } void TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry() { ASSERT(!m_isWaitingForDidUpdateGeometry); + m_lastSentMinimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); m_lastSentSize = m_size; - m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size), m_webPageProxy->pageID()); + m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size, m_lastSentMinimumLayoutWidth), m_webPageProxy->pageID()); m_isWaitingForDidUpdateGeometry = true; } diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index 137c22f2c..849ba20f8 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -474,6 +474,11 @@ WKView* WebPageProxy::wkView() const return m_pageClient->wkView(); } +void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + m_pageClient->intrinsicContentSizeDidChange(intrinsicContentSize); +} + void WebPageProxy::setAcceleratedCompositingRootLayer(const GraphicsLayer* rootLayer) { m_pageClient->setAcceleratedCompositingRootLayer(rootLayer->platformLayer()); diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index b8ccd977b..1cf3ae568 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -88,7 +88,7 @@ void PageViewportControllerClientQt::setContentRectVisiblePositionAtScale(const // 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_pageItem->position() + location * itemScale); + QPointF newPosition(m_pageItem->pos() + location * itemScale); m_viewportItem->setContentPos(newPosition); } @@ -317,7 +317,7 @@ QRectF PageViewportControllerClientQt::nearestValidVisibleContentsRect() const void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint) { - QPointF newPosition((m_pageItem->position() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); + QPointF newPosition((m_pageItem->pos() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); m_viewportItem->setContentPos(newPosition); updateViewportController(); } diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 7737f6529..89a40c923 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -256,6 +256,12 @@ void QtPageClient::updateTextInputState() m_eventHandler->updateTextInputState(); } +void QtPageClient::handleWillSetInputMethodState() +{ + ASSERT(m_eventHandler); + m_eventHandler->handleWillSetInputMethodState(); +} + #if ENABLE(GESTURE_EVENTS) void QtPageClient::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index e493ce8ad..fc10ca653 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -103,6 +103,7 @@ public: virtual void pageTransitionViewportReady(); virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); #if ENABLE(TOUCH_EVENTS) virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 88dae15b8..b80613438 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -435,6 +435,12 @@ void QtWebPageEventHandler::updateTextInputState() setInputPanelVisible(editor.isContentEditable); } +void QtWebPageEventHandler::handleWillSetInputMethodState() +{ + if (qApp->inputMethod()->isVisible()) + qApp->inputMethod()->commit(); +} + void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { if (event.type() != WebEvent::GestureSingleTap) diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 04c75ab3f..005cb4ca0 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -89,6 +89,7 @@ public: void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); #endif void handleInputEvent(const QInputEvent*); + void handleWillSetInputMethodState(); void resetGestureRecognizers(); PageViewportControllerClientQt* viewportController() { return m_viewportController; } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 46429461f..8a205f91d 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -171,4 +171,9 @@ void WebPageProxy::closePopupMenu() process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); } +void WebPageProxy::willSetInputMethodState() +{ + m_pageClient->handleWillSetInputMethodState(); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 1b2c83099..1b4e85af7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -71,7 +71,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> -#if ENABLE(SHADOW_DOM) +#if ENABLE(SHADOW_DOM) || ENABLE(CSS_REGIONS) #include <WebCore/RuntimeEnabledFeatures.h> #endif @@ -182,11 +182,15 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page } } +#if ENABLE(CSS_REGIONS) + if (preference == "WebKitCSSRegionsEnabled") + RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); +#endif + // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore. #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \ macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \ macro(WebKitCSSCustomFilterEnabled, CSSCustomFilterEnabled, cssCustomFilterEnabled) \ - macro(WebKitCSSRegionsEnabled, CSSRegionsEnabled, cssRegionsEnabled) \ macro(WebKitCSSGridLayoutEnabled, CSSGridLayoutEnabled, cssGridLayoutEnabled) \ macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \ macro(WebKitJavaScriptEnabled, ScriptEnabled, javaScriptEnabled) \ @@ -646,6 +650,15 @@ void InjectedBundle::setShadowDOMEnabled(bool enabled) #endif } +void InjectedBundle::setCSSRegionsEnabled(bool enabled) +{ +#if ENABLE(CSS_REGIONS) + RuntimeEnabledFeatures::setCSSRegionsEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + void InjectedBundle::dispatchPendingLoadRequests() { resourceLoadScheduler()->servePendingRequests(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h index fd716d3d3..8c065cc14 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h @@ -180,6 +180,7 @@ public: void setTabKeyCyclesThroughElements(WebPage*, bool enabled); void setSerialLoadingEnabled(bool); void setShadowDOMEnabled(bool); + void setCSSRegionsEnabled(bool); void dispatchPendingLoadRequests(); private: diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h index 132c28774..67f53d241 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h @@ -67,6 +67,7 @@ public: void clickedLink(NSURL *); void saveToPDF(); + void writeItemsToPasteboard(NSArray *items, NSArray *types); private: explicit PDFPlugin(WebFrame*); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm index f50fb8c0e..7417929bc 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm @@ -36,10 +36,12 @@ #import "PDFPluginAnnotation.h" #import "PluginView.h" #import "ShareableBitmap.h" +#import "WebContextMessages.h" #import "WebEvent.h" #import "WebEventConversion.h" #import "WebPage.h" #import "WebPageProxyMessages.h" +#import "WebProcess.h" #import <PDFKit/PDFKit.h> #import <QuartzCore/QuartzCore.h> #import <WebCore/ArchiveResource.h> @@ -154,15 +156,7 @@ static const char* annotationStyle = - (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types { - // FIXME: Handle types other than plain text. - - for (NSUInteger i = 0, count = items.count; i < count; ++i) { - NSString *type = [types objectAtIndex:i]; - if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) { - RetainPtr<NSString> plainTextString(AdoptNS, [[NSString alloc] initWithData:[items objectAtIndex:i] encoding:NSUTF8StringEncoding]); - Pasteboard::generalPasteboard()->writePlainText(plainTextString.get(), Pasteboard::CannotSmartReplace); - } - } + _pdfPlugin->writeItemsToPasteboard(items, types); } - (void)showDefinitionForAttributedString:(NSAttributedString *)string atPoint:(CGPoint)point @@ -765,6 +759,44 @@ void PDFPlugin::saveToPDF() webFrame()->page()->send(Messages::WebPageProxy::SavePDFToFileInDownloadsFolder(suggestedFilename(), webFrame()->url(), dataReference)); } +void PDFPlugin::writeItemsToPasteboard(NSArray *items, NSArray *types) +{ + Vector<String> pasteboardTypes; + + for (NSString *type in types) + pasteboardTypes.append(type); + + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardTypes(NSGeneralPboard, pasteboardTypes), 0); + + for (NSUInteger i = 0, count = items.count; i < count; ++i) { + NSString *type = [types objectAtIndex:i]; + NSData *data = [items objectAtIndex:i]; + + // We don't expect the data for any items to be empty, but aren't completely sure. + // Avoid crashing in the SharedMemory constructor in release builds if we're wrong. + ASSERT(data.length); + if (!data.length) + continue; + + if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) { + RetainPtr<NSString> plainTextString(AdoptNS, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardStringForType(NSGeneralPboard, type, plainTextString.get()), 0); + } else { + RefPtr<SharedBuffer> buffer = SharedBuffer::wrapNSData(data); + + if (!buffer) + continue; + + SharedMemory::Handle handle; + RefPtr<SharedMemory> sharedMemory = SharedMemory::create(buffer->size()); + memcpy(sharedMemory->data(), buffer->data(), buffer->size()); + sharedMemory->createHandle(handle, SharedMemory::ReadOnly); + WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardBufferForType(NSGeneralPboard, type, handle, buffer->size()), 0); + } + } + +} + } // namespace WebKit #endif // ENABLE(PDFKIT_PLUGIN) diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp index 648a51eb8..b75c5a876 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp @@ -41,10 +41,11 @@ using namespace WebCore; namespace WebKit { -PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) +PluginProcessConnection::PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) : m_pluginProcessConnectionManager(pluginProcessConnectionManager) , m_pluginPath(pluginPath) , m_supportsAsynchronousPluginInitialization(supportsAsynchronousPluginInitialization) + , m_processType(processType) { m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop()); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h index bc6558ffd..35993d45e 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnection.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "Plugin.h" +#include "PluginProcess.h" #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> @@ -43,9 +44,9 @@ class PluginProxy; class PluginProcessConnection : public RefCounted<PluginProcessConnection>, CoreIPC::Connection::Client { public: - static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) + static PassRefPtr<PluginProcessConnection> create(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, PluginProcess::Type processType, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousPluginInitialization) { - return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, connectionIdentifier, supportsAsynchronousPluginInitialization)); + return adoptRef(new PluginProcessConnection(pluginProcessConnectionManager, pluginPath, processType, connectionIdentifier, supportsAsynchronousPluginInitialization)); } ~PluginProcessConnection(); @@ -60,8 +61,10 @@ public: bool supportsAsynchronousPluginInitialization() const { return m_supportsAsynchronousPluginInitialization; } + PluginProcess::Type processType() const { return m_processType; } + private: - PluginProcessConnection(PluginProcessConnectionManager*, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization); + PluginProcessConnection(PluginProcessConnectionManager*, const String& pluginPath, PluginProcess::Type, CoreIPC::Connection::Identifier connectionIdentifier, bool supportsAsynchronousInitialization); // CoreIPC::Connection::Client virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE; @@ -85,6 +88,8 @@ private: RefPtr<NPRemoteObjectMap> m_npRemoteObjectMap; bool m_supportsAsynchronousPluginInitialization; + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp index b77050992..64bfc2b7d 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.cpp @@ -49,16 +49,17 @@ PluginProcessConnectionManager::~PluginProcessConnectionManager() { } -PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath) +PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(const String& pluginPath, PluginProcess::Type processType) { for (size_t i = 0; i < m_pluginProcessConnections.size(); ++i) { - if (m_pluginProcessConnections[i]->pluginPath() == pluginPath) - return m_pluginProcessConnections[i].get(); + RefPtr<PluginProcessConnection>& pluginProcessConnection = m_pluginProcessConnections[i]; + if (pluginProcessConnection->pluginPath() == pluginPath && pluginProcessConnection->processType() == processType) + return pluginProcessConnection.get(); } CoreIPC::Attachment encodedConnectionIdentifier; bool supportsAsynchronousInitialization; - if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginPath), + if (!WebProcess::shared().connection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginPath, processType), Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0)) return 0; @@ -72,14 +73,14 @@ PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnect return 0; #endif - RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, connectionIdentifier, supportsAsynchronousInitialization); + RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginPath, processType, connectionIdentifier, supportsAsynchronousInitialization); m_pluginProcessConnections.append(pluginProcessConnection); { MutexLocker locker(m_pathsAndConnectionsMutex); - ASSERT(!m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + ASSERT(!m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), processType))); - m_pathsAndConnections.set(pluginPath, pluginProcessConnection->connection()); + m_pathsAndConnections.set(std::make_pair(pluginPath, processType), pluginProcessConnection->connection()); } return pluginProcessConnection.get(); @@ -92,18 +93,18 @@ void PluginProcessConnectionManager::removePluginProcessConnection(PluginProcess { MutexLocker locker(m_pathsAndConnectionsMutex); - ASSERT(m_pathsAndConnections.contains(pluginProcessConnection->pluginPath())); + ASSERT(m_pathsAndConnections.contains(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType()))); - m_pathsAndConnections.remove(pluginProcessConnection->pluginPath()); + m_pathsAndConnections.remove(std::make_pair(pluginProcessConnection->pluginPath(), pluginProcessConnection->processType())); } m_pluginProcessConnections.remove(vectorIndex); } -void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath) +void PluginProcessConnectionManager::pluginProcessCrashed(const String& pluginPath, PluginProcess::Type processType) { MutexLocker locker(m_pathsAndConnectionsMutex); - CoreIPC::Connection* connection = m_pathsAndConnections.get(pluginPath).get(); + CoreIPC::Connection* connection = m_pathsAndConnections.get(std::make_pair(pluginPath, processType)).get(); // It's OK for connection to be null here; it will happen if this web process doesn't know // anything about the plug-in process. diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h index 45515cdf1..86449f651 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProcessConnectionManager.h @@ -28,6 +28,7 @@ #if ENABLE(PLUGIN_PROCESS) +#include "PluginProcess.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -51,17 +52,17 @@ public: PluginProcessConnectionManager(); ~PluginProcessConnectionManager(); - PluginProcessConnection* getPluginProcessConnection(const String& pluginPath); + PluginProcessConnection* getPluginProcessConnection(const String& pluginPath, PluginProcess::Type); void removePluginProcessConnection(PluginProcessConnection*); // Called on the web process connection work queue. - void pluginProcessCrashed(const String& pluginPath); + void pluginProcessCrashed(const String& pluginPath, PluginProcess::Type); private: Vector<RefPtr<PluginProcessConnection> > m_pluginProcessConnections; Mutex m_pathsAndConnectionsMutex; - HashMap<String, RefPtr<CoreIPC::Connection> > m_pathsAndConnections; + HashMap<std::pair<String, PluginProcess::Type>, RefPtr<CoreIPC::Connection> > m_pathsAndConnections; }; } diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index f7ead5664..6633d8247 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -55,12 +55,12 @@ static uint64_t generatePluginInstanceID() return ++uniquePluginInstanceID; } -PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath) +PassRefPtr<PluginProxy> PluginProxy::create(const String& pluginPath, PluginProcess::Type processType) { - return adoptRef(new PluginProxy(pluginPath)); + return adoptRef(new PluginProxy(pluginPath, processType)); } -PluginProxy::PluginProxy(const String& pluginPath) +PluginProxy::PluginProxy(const String& pluginPath, PluginProcess::Type processType) : m_pluginPath(pluginPath) , m_pluginInstanceID(generatePluginInstanceID()) , m_pluginBackingStoreContainsValidData(false) @@ -69,6 +69,7 @@ PluginProxy::PluginProxy(const String& pluginPath) , m_wantsWheelEvents(false) , m_remoteLayerClientID(0) , m_waitingOnAsynchronousInitialization(false) + , m_processType(processType) { } @@ -84,7 +85,7 @@ void PluginProxy::pluginProcessCrashed() bool PluginProxy::initialize(const Parameters& parameters) { ASSERT(!m_connection); - m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginPath); + m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginPath, m_processType); if (!m_connection) return false; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h index 535c8c7fe..af1d5e1ed 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "Plugin.h" +#include "PluginProcess.h" #include <WebCore/AffineTransform.h> #include <WebCore/IntRect.h> #include <WebCore/SecurityOrigin.h> @@ -54,7 +55,7 @@ struct PluginCreationParameters; class PluginProxy : public Plugin { public: - static PassRefPtr<PluginProxy> create(const String& pluginPath); + static PassRefPtr<PluginProxy> create(const String& pluginPath, PluginProcess::Type); ~PluginProxy(); uint64_t pluginInstanceID() const { return m_pluginInstanceID; } @@ -66,7 +67,7 @@ public: bool isBeingAsynchronouslyInitialized() const { return m_waitingOnAsynchronousInitialization; } private: - explicit PluginProxy(const String& pluginPath); + explicit PluginProxy(const String& pluginPath, PluginProcess::Type); // Plugin virtual bool initialize(const Parameters&); @@ -205,6 +206,8 @@ private: #if PLATFORM(MAC) RetainPtr<CALayer> m_pluginLayer; #endif + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 2a5da5c59..283a839c4 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -432,7 +432,7 @@ PlatformPageClient WebChromeClient::platformPageClient() const return 0; } -void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& /*size*/) const +void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const { if (!m_page->corePage()->settings()->frameFlatteningEnabled()) { WebFrame* largestFrame = findLargestFrameInFrameSet(m_page); @@ -456,6 +456,8 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& /*size*/) #endif + m_page->drawingArea()->mainFrameContentSizeChanged(size); + FrameView* frameView = frame->view(); if (frameView && !frameView->delegatesScrolling()) { bool hasHorizontalScrollbar = frameView->horizontalScrollbar(); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index 1c8c0b7b5..4a6cf83c5 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -469,7 +469,11 @@ void WebEditorClient::getGuessesForWord(const String& word, const String& contex void WebEditorClient::willSetInputMethodState() { +#if PLATFORM(QT) + m_page->send(Messages::WebPageProxy::WillSetInputMethodState()); +#else notImplemented(); +#endif } void WebEditorClient::setInputMethodState(bool) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp index c04664439..88434f599 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp @@ -39,18 +39,20 @@ #include <WebCore/KURL.h> #include <WebCore/LoaderStrategy.h> #include <WebCore/Page.h> +#include <WebCore/PlatformCookieJar.h> #include <WebCore/PlatformPasteboard.h> #include <wtf/Atomics.h> +#if ENABLE(NETWORK_PROCESS) +#include "NetworkConnectionToWebProcessMessages.h" +#include "NetworkProcessConnection.h" +#endif + #if PLATFORM(WIN) && USE(CFNETWORK) #include "WebFrameNetworkingContext.h" #include <WebKitSystemInterface/WebKitSystemInterface.h> #endif -#if USE(CF) -#include <wtf/RetainPtr.h> -#endif - using namespace WebCore; namespace WebKit { @@ -113,6 +115,124 @@ RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage() } #endif +String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + String result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) + return String(); + return result; + } +#endif + + return WebCore::cookiesForDOM(context, firstParty, url); +} + +void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(firstParty, url, cookieString), 0); + return; + } +#endif + + WebCore::setCookiesFromDOM(context, firstParty, url, cookieString); +} + +bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + bool result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) + return false; + return result; + } +#endif + + return WebCore::cookiesEnabled(context, firstParty, url); +} + +String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + String result; + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0)) + return String(); + return result; + } +#endif + + return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url); +} + +bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) + return false; + return true; + } +#endif + + return WebCore::getRawCookies(context, firstParty, url, rawCookies); +} + +void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(url, cookieName), 0); + return; + } +#endif + + WebCore::deleteCookie(context, url, cookieName); +} + +void WebPlatformStrategies::getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + Vector<String> hostnamesVector; + WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetHostnamesWithCookies(), Messages::NetworkConnectionToWebProcess::GetHostnamesWithCookies::Reply(hostnamesVector), 0); + for (unsigned i = 0; i != hostnamesVector.size(); ++i) + hostnames.add(hostnamesVector[i]); + return; + } +#endif + + WebCore::getHostnamesWithCookies(context, hostnames); +} + +void WebPlatformStrategies::deleteCookiesForHostname(NetworkingContext* context, const String& hostname) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookiesForHostname(hostname), 0); + return; + } +#endif + + WebCore::deleteCookiesForHostname(context, hostname); +} + +void WebPlatformStrategies::deleteAllCookies(NetworkingContext* context) +{ +#if ENABLE(NETWORK_PROCESS) + if (WebProcess::shared().usesNetworkProcess()) { + WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteAllCookies(), 0); + return; + } +#endif + + WebCore::deleteAllCookies(context); +} + // LoaderStrategy #if ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h index 040cfb1a9..80acfe037 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h @@ -58,6 +58,15 @@ private: #if PLATFORM(MAC) || USE(CFNETWORK) virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() OVERRIDE; #endif + virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE; + virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE; + virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE; + virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&) OVERRIDE; + virtual void getHostnamesWithCookies(WebCore::NetworkingContext*, HashSet<String>& hostnames) OVERRIDE; + virtual void deleteCookiesForHostname(WebCore::NetworkingContext*, const String& hostname) OVERRIDE; + virtual void deleteAllCookies(WebCore::NetworkingContext*) OVERRIDE; // WebCore::LoaderStrategy #if ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h index c8e96c3c0..327f651c9 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -86,6 +86,7 @@ public: virtual void setPaintingEnabled(bool) { } virtual void updatePreferences(const WebPreferencesStore&) { } + virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { } #if USE(ACCELERATED_COMPOSITING) virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; } @@ -121,7 +122,7 @@ private: #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingArea. - virtual void updateGeometry(const WebCore::IntSize& viewSize) { } + virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) { } virtual void setDeviceScaleFactor(float) { } virtual void setColorSpace(const ColorSpaceData&) { } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in index fe98c7364..dec86ec22 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in @@ -30,7 +30,7 @@ messages -> DrawingArea { #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingArea. - UpdateGeometry(WebCore::IntSize viewSize) + UpdateGeometry(WebCore::IntSize viewSize, double minimumLayoutWidth) SetDeviceScaleFactor(float deviceScaleFactor) SetColorSpace(WebKit::ColorSpaceData colorSpace) #endif diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 83c0ae7fd..3e20c830d 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -114,6 +114,7 @@ #include <WebCore/ResourceRequest.h> #include <WebCore/ResourceResponse.h> #include <WebCore/RunLoop.h> +#include <WebCore/RuntimeEnabledFeatures.h> #include <WebCore/SchemeRegistry.h> #include <WebCore/ScriptValue.h> #include <WebCore/SerializedScriptValue.h> @@ -535,7 +536,8 @@ PassRefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* plu } #if ENABLE(PLUGIN_PROCESS) - return PluginProxy::create(pluginPath); + PluginProcess::Type processType = (pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcess::TypeSnapshotProcess : PluginProcess::TypeRegularProcess); + return PluginProxy::create(pluginPath, processType); #else NetscapePlugin::setSetExceptionFunction(NPRuntimeObjectMap::setGlobalException); return NetscapePlugin::create(NetscapePluginModule::getOrCreate(pluginPath)); @@ -1025,8 +1027,21 @@ void WebPage::sendViewportAttributesChanged() ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, m_page->deviceScaleFactor(), m_viewportSize); attr.initialScale = m_page->viewportArguments().zoom; // Resets auto (-1) if no value was set by user. + // Keep the current position, update size only. + // For the new loads position is already reset to (0,0). + FrameView* view = m_page->mainFrame()->view(); + IntPoint contentFixedOrigin = view->fixedVisibleContentRect().location(); + + // Put the width and height to the viewport width and height. In css units however. + // FIXME: This should be in scaled units but this currently affects viewport attributes calculation. + IntSize contentFixedSize = m_viewportSize; + contentFixedSize.scale(1 / m_page->deviceScaleFactor()); + + setFixedVisibleContentRect(IntRect(contentFixedOrigin, contentFixedSize)); + // This also takes care of the relayout. - setFixedLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height()))); + setFixedLayoutSize(roundedIntSize(attr.layoutSize)); + send(Messages::WebPageProxy::DidChangeViewportProperties(attr)); } @@ -1506,20 +1521,18 @@ void WebPage::mouseEvent(const WebMouseEvent& mouseEvent) return; } #endif - bool handled = false; - if (m_pageOverlay) { // Let the page overlay handle the event. handled = m_pageOverlay->mouseEvent(mouseEvent); } - if (!handled) { + if (!handled && canHandleUserEvents()) { CurrentEvent currentEvent(mouseEvent); // We need to do a full, normal hit test during this mouse event if the page is active or if a mouse - // button is currently pressed. It is possible that neither of those things will be true since on - // Lion when legacy scrollbars are enabled, WebKit receives mouse events all the time. If it is one + // button is currently pressed. It is possible that neither of those things will be true since on + // Lion when legacy scrollbars are enabled, WebKit receives mouse events all the time. If it is one // of those cases where the page is not active and the mouse is not pressed, then we can fire a more // efficient scrollbars-only version of the event. bool onlyUpdateScrollbars = !(m_page->focusController()->isActive() || (mouseEvent.button() != WebMouseEvent::NoButton)); @@ -1558,9 +1571,13 @@ static bool handleWheelEvent(const WebWheelEvent& wheelEvent, Page* page) void WebPage::wheelEvent(const WebWheelEvent& wheelEvent) { - CurrentEvent currentEvent(wheelEvent); + bool handled = false; - bool handled = handleWheelEvent(wheelEvent, m_page.get()); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(wheelEvent); + + handled = handleWheelEvent(wheelEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(wheelEvent.type()), handled)); } @@ -1583,13 +1600,16 @@ static bool handleKeyEvent(const WebKeyboardEvent& keyboardEvent, Page* page) void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) { - CurrentEvent currentEvent(keyboardEvent); + bool handled = false; - bool handled = handleKeyEvent(keyboardEvent, m_page.get()); - // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). - if (!handled) - handled = performDefaultBehaviorForKeyEvent(keyboardEvent); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(keyboardEvent); + handled = handleKeyEvent(keyboardEvent, m_page.get()); + // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). + if (!handled) + handled = performDefaultBehaviorForKeyEvent(keyboardEvent); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled)); } @@ -1615,9 +1635,13 @@ static bool handleGestureEvent(const WebGestureEvent& gestureEvent, Page* page) void WebPage::gestureEvent(const WebGestureEvent& gestureEvent) { - CurrentEvent currentEvent(gestureEvent); + bool handled = false; + + if (canHandleUserEvents()) { + CurrentEvent currentEvent(gestureEvent); - bool handled = handleGestureEvent(gestureEvent, m_page.get()); + handled = handleGestureEvent(gestureEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled)); } #endif @@ -1733,10 +1757,13 @@ static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page) void WebPage::touchEvent(const WebTouchEvent& touchEvent) { - CurrentEvent currentEvent(touchEvent); + bool handled = false; - bool handled = handleTouchEvent(touchEvent, m_page.get()); + if (canHandleUserEvents()) { + CurrentEvent currentEvent(touchEvent); + handled = handleTouchEvent(touchEvent, m_page.get()); + } send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(touchEvent.type()), handled)); } @@ -1883,6 +1910,15 @@ void WebPage::setCanStartMediaTimerFired() m_page->setCanStartMedia(true); } +inline bool WebPage::canHandleUserEvents() const +{ +#if USE(TILED_BACKING_STORE) + // Should apply only if the area was frozen by didStartPageTransition(). + return !m_drawingArea->layerTreeStateIsFrozen(); +#endif + return true; +} + void WebPage::setIsInWindow(bool isInWindow) { if (!isInWindow) { @@ -2236,7 +2272,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey())); settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey())); settings->setCSSCustomFilterEnabled(store.getBoolValueForKey(WebPreferencesKey::cssCustomFilterEnabledKey())); - settings->setCSSRegionsEnabled(store.getBoolValueForKey(WebPreferencesKey::cssRegionsEnabledKey())); + RuntimeEnabledFeatures::setCSSRegionsEnabled(store.getBoolValueForKey(WebPreferencesKey::cssRegionsEnabledKey())); settings->setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey())); settings->setRegionBasedColumnsEnabled(store.getBoolValueForKey(WebPreferencesKey::regionBasedColumnsEnabledKey())); settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey())); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 00ea81c8c..d4817c028 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -781,6 +781,8 @@ private: void changeSelectedIndex(int32_t index); void setCanStartMediaTimerFired(); + bool canHandleUserEvents() const; + static bool platformCanHandleRequest(const WebCore::ResourceRequest&); OwnPtr<WebCore::Page> m_page; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h index 7d5b3be96..90c76c457 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h @@ -65,6 +65,7 @@ private: virtual void didUninstallPageOverlay() OVERRIDE; virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) OVERRIDE; virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE; + virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) OVERRIDE; virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&) OVERRIDE; @@ -80,7 +81,7 @@ private: // Message handlers. virtual void suspendPainting() OVERRIDE; virtual void resumePainting() OVERRIDE; - virtual void updateGeometry(const WebCore::IntSize& viewSize) OVERRIDE; + virtual void updateGeometry(const WebCore::IntSize& viewSize, double minimumLayoutWidth) OVERRIDE; virtual void setDeviceScaleFactor(float) OVERRIDE; virtual void setLayerHostingMode(uint32_t) OVERRIDE; virtual void setColorSpace(const ColorSpaceData&) OVERRIDE; @@ -105,6 +106,10 @@ private: OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; bool m_isPaintingSuspended; + + double m_minimumLayoutWidth; + WebCore::IntSize m_lastSentIntrinsicContentSize; + bool m_inUpdateGeometry; }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index cf5d23e01..103d2513b 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -33,6 +33,7 @@ #import "EventDispatcher.h" #import "LayerHostingContext.h" #import "LayerTreeContext.h" +#import "WebFrame.h" #import "WebPage.h" #import "WebPageCreationParameters.h" #import "WebPageProxyMessages.h" @@ -69,6 +70,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c , m_layerTreeStateIsFrozen(false) , m_layerFlushScheduler(this) , m_isPaintingSuspended(!parameters.isVisible) + , m_minimumLayoutWidth(0) { Page* page = m_webPage->corePage(); @@ -229,6 +231,21 @@ void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore& ScrollingThread::dispatch(bind(&ScrollingTree::setDebugRootLayer, m_webPage->corePage()->scrollingCoordinator()->scrollingTree(), m_debugInfoLayer)); } +void TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged(const IntSize& contentSize) +{ + if (!m_minimumLayoutWidth) + return; + + if (m_inUpdateGeometry) + return; + + if (m_lastSentIntrinsicContentSize == contentSize) + return; + + m_lastSentIntrinsicContentSize = contentSize; + m_webPage->send(Messages::DrawingAreaProxy::IntrinsicContentSizeDidChange(contentSize)); +} + void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>& functionRef) { m_webPage->ref(); @@ -330,9 +347,24 @@ void TiledCoreAnimationDrawingArea::resumePainting() m_webPage->corePage()->resumeScriptedAnimations(); } -void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize) +void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, double minimumLayoutWidth) { - m_webPage->setSize(viewSize); + m_inUpdateGeometry = true; + + m_minimumLayoutWidth = minimumLayoutWidth; + + IntSize size = viewSize; + IntSize contentSize = IntSize(-1, -1); + + if (m_minimumLayoutWidth > 0) { + m_webPage->setSize(IntSize(m_minimumLayoutWidth, 0)); + m_webPage->layoutIfNeeded(); + + contentSize = m_webPage->mainWebFrame()->contentBounds().size(); + size = contentSize; + } + + m_webPage->setSize(size); m_webPage->layoutIfNeeded(); if (m_pageOverlayLayer) @@ -351,7 +383,10 @@ void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize) [CATransaction flush]; [CATransaction synchronize]; - m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry()); + m_lastSentIntrinsicContentSize = contentSize; + m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry(contentSize)); + + m_inUpdateGeometry = false; } void TiledCoreAnimationDrawingArea::setDeviceScaleFactor(float deviceScaleFactor) diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp index 28b7bfd7b..1621612f2 100644 --- a/Source/WebKit2/WebProcess/WebProcess.cpp +++ b/Source/WebKit2/WebProcess/WebProcess.cpp @@ -1079,9 +1079,9 @@ void WebProcess::networkProcessCrashed(CoreIPC::Connection*) #endif #if ENABLE(PLUGIN_PROCESS) -void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath) +void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath, uint32_t processType) { - m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath); + m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath, static_cast<PluginProcess::Type>(processType)); } #endif diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index 82e6cc8f2..01330a607 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -254,7 +254,7 @@ private: void networkProcessCrashed(CoreIPC::Connection*); #endif #if ENABLE(PLUGIN_PROCESS) - void pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath); + void pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath, uint32_t processType); #endif void startMemorySampler(const SandboxExtension::Handle&, const String&, const double); diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in index edcad34ff..4346b9d81 100644 --- a/Source/WebKit2/WebProcess/WebProcess.messages.in +++ b/Source/WebKit2/WebProcess/WebProcess.messages.in @@ -69,7 +69,7 @@ messages -> WebProcess { #endif #if ENABLE(PLUGIN_PROCESS) - PluginProcessCrashed(String pluginProcess) DispatchOnConnectionQueue + PluginProcessCrashed(String pluginProcess, uint32_t processType) DispatchOnConnectionQueue #endif void StartMemorySampler(WebKit::SandboxExtension::Handle sampleLogFileHandle, WTF::String sampleLogFilePath, double interval); diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index 87c7f35b1..c5920940c 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -364,4 +364,3 @@ EXPORTS ?getCGImageRef@BitmapImage@WebCore@@UAEPAUCGImage@@XZ ?getFirstCGImageRefOfSize@BitmapImage@WebCore@@UAEPAUCGImage@@ABVIntSize@2@@Z ?getCGImageArray@BitmapImage@WebCore@@UAE?AV?$RetainPtr@PBU__CFArray@@@WTF@@XZ - ?notSolidColor@BitmapImage@WebCore@@UAE_NXZ diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 420ecf0f4..b3bd1f099 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -353,4 +353,3 @@ EXPORTS ?frameAtIndex@BitmapImage@WebCore@@IAEPAVNativeImageCairo@2@I@Z ?draw@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@1W4ColorSpace@2@W4CompositeOperator@2@W4RespectImageOrientationEnum@2@@Z ?frameCount@BitmapImage@WebCore@@MAEIXZ - ?notSolidColor@BitmapImage@WebCore@@UAE_NXZ |