summaryrefslogtreecommitdiff
path: root/Source/WebKit2
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2')
-rw-r--r--Source/WebKit2/ChangeLog2739
-rw-r--r--Source/WebKit2/Configurations/BaseTarget.xcconfig14
-rw-r--r--Source/WebKit2/Configurations/FeatureDefines.xcconfig4
-rw-r--r--Source/WebKit2/Configurations/PluginProcess.xcconfig2
-rw-r--r--Source/WebKit2/Configurations/Version.xcconfig2
-rw-r--r--Source/WebKit2/Configurations/WebKit2.xcconfig4
-rw-r--r--Source/WebKit2/Configurations/WebProcess.xcconfig2
-rw-r--r--Source/WebKit2/GNUmakefile.am78
-rw-r--r--Source/WebKit2/Platform/CoreIPC/Connection.cpp3
-rw-r--r--Source/WebKit2/Platform/CoreIPC/Connection.h10
-rw-r--r--Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp3
-rw-r--r--Source/WebKit2/Platform/RunLoop.h161
-rw-r--r--Source/WebKit2/Platform/SharedMemory.h2
-rw-r--r--Source/WebKit2/Platform/gtk/RunLoopGtk.cpp134
-rw-r--r--Source/WebKit2/Platform/mac/RunLoopMac.mm153
-rw-r--r--Source/WebKit2/Platform/qt/RunLoopQt.cpp163
-rw-r--r--Source/WebKit2/Platform/win/RunLoopWin.cpp179
-rw-r--r--Source/WebKit2/PluginProcess/PluginControllerProxy.h6
-rw-r--r--Source/WebKit2/PluginProcess/PluginProcess.cpp3
-rw-r--r--Source/WebKit2/PluginProcess/PluginProcess.h7
-rw-r--r--Source/WebKit2/PluginProcess/WebProcessConnection.cpp5
-rw-r--r--Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp4
-rw-r--r--Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements8
-rw-r--r--Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm6
-rwxr-xr-xSource/WebKit2/PluginProcess/mac/add-entitlements.sh35
-rw-r--r--Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp4
-rw-r--r--Source/WebKit2/Shared/API/c/WKFindOptions.h3
-rw-r--r--Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp15
-rw-r--r--Source/WebKit2/Shared/API/c/WKSecurityOrigin.h4
-rw-r--r--Source/WebKit2/Shared/API/c/WKSharedAPICast.h2
-rw-r--r--Source/WebKit2/Shared/ChildProcess.cpp2
-rw-r--r--Source/WebKit2/Shared/ChildProcess.h4
-rw-r--r--Source/WebKit2/Shared/EditorState.cpp12
-rw-r--r--Source/WebKit2/Shared/EditorState.h7
-rw-r--r--Source/WebKit2/Shared/PrintInfo.cpp20
-rw-r--r--Source/WebKit2/Shared/PrintInfo.h13
-rw-r--r--Source/WebKit2/Shared/ShareableBitmap.h1
-rw-r--r--Source/WebKit2/Shared/WebEvent.h11
-rw-r--r--Source/WebKit2/Shared/WebFindOptions.h3
-rw-r--r--Source/WebKit2/Shared/WebGraphicsContext.cpp8
-rw-r--r--Source/WebKit2/Shared/WebGraphicsContext.h8
-rw-r--r--Source/WebKit2/Shared/WebLayerTreeInfo.h28
-rw-r--r--Source/WebKit2/Shared/WebPageCreationParameters.cpp6
-rw-r--r--Source/WebKit2/Shared/WebPageCreationParameters.h3
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.cpp23
-rw-r--r--Source/WebKit2/Shared/WebPreferencesStore.h9
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.cpp13
-rw-r--r--Source/WebKit2/Shared/WebProcessCreationParameters.h7
-rw-r--r--Source/WebKit2/Shared/WebSecurityOrigin.h11
-rw-r--r--Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp74
-rw-r--r--Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h10
-rw-r--r--Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp (renamed from Source/WebKit2/Platform/RunLoop.cpp)50
-rw-r--r--Source/WebKit2/Shared/mac/WebEventFactory.mm700
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp22
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkReplyData.h18
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp12
-rw-r--r--Source/WebKit2/Shared/qt/QtNetworkRequestData.h11
-rw-r--r--Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp15
-rw-r--r--Source/WebKit2/Shared/win/ShareableBitmapWin.cpp5
-rw-r--r--Source/WebKit2/Target.pri8
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNotificationManager.h2
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp15
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPagePrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp27
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp9
-rw-r--r--Source/WebKit2/UIProcess/API/efl/PageClientImpl.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_private.h34
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp510
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h88
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp115
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h27
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h38
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp11
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitError.h24
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp (renamed from Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.cpp)43
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h27
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp307
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h91
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h28
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp71
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h27
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp119
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h68
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h28
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h10
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp62
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp86
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h29
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIRequestPrivate.h34
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp55
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h7
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp92
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.h51
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp98
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h78
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp40
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp125
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.h55
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h1
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt76
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types2
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/AccessibilityTestServer.cpp58
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am49
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp34
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp410
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp (renamed from Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp)21
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp230
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp202
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h8
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/webkit2.h1
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list6
-rw-r--r--Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h6
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm10
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h3
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm59
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp156
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h36
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp48
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h17
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp35
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h3
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp150
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h23
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h15
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp44
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h46
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp170
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml94
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/tests.pri7
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.h4
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp17
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h7
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp13
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp3
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp2
-rw-r--r--Source/WebKit2/UIProcess/LayerTreeHostProxy.h48
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotification.cpp4
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotification.h6
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp55
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h11
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in2
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp17
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h4
-rw-r--r--Source/WebKit2/UIProcess/PageClient.h5
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp4
-rw-r--r--Source/WebKit2/UIProcess/ResponsivenessTimer.cpp2
-rw-r--r--Source/WebKit2/UIProcess/ResponsivenessTimer.h4
-rw-r--r--Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/VisitedLinkProvider.h4
-rw-r--r--Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp2
-rw-r--r--Source/WebKit2/UIProcess/WebConnectionToWebProcess.h4
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp10
-rw-r--r--Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.cpp1
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.h4
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp90
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h46
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in7
-rw-r--r--Source/WebKit2/UIProcess/WebPreferences.h3
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp5
-rw-r--r--Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp9
-rw-r--r--Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp2
-rw-r--r--Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp4
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp5
-rw-r--r--Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm9
-rw-r--r--Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm17
-rw-r--r--Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp85
-rw-r--r--Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp84
-rw-r--r--Source/WebKit2/UIProcess/qt/QtDialogRunner.h14
-rw-r--r--Source/WebKit2/UIProcess/qt/QtPageClient.cpp28
-rw-r--r--Source/WebKit2/UIProcess/qt/QtPageClient.h5
-rw-r--r--Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp10
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp5
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h1
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebContext.cpp2
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp3
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h2
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp41
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h8
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp8
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp10
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.cpp33
-rw-r--r--Source/WebKit2/WebKit2.pri5
-rw-r--r--Source/WebKit2/WebKit2.xcodeproj/project.pbxproj32
-rw-r--r--Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp8
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp14
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h1
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h3
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h5
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp66
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h3
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp6
-rw-r--r--Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp16
-rw-r--r--Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp45
-rw-r--r--Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h12
-rw-r--r--Source/WebKit2/WebProcess/Notifications/WebNotificationManager.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp2
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h6
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp7
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h6
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp2
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h6
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginView.h7
-rw-r--r--Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebConnectionToUIProcess.h4
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h9
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp11
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp23
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h1
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp187
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h23
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp36
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp39
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp20
-rw-r--r--Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/PageOverlay.h4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp121
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TapHighlightController.h73
-rw-r--r--Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp5
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.cpp8
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebFrame.h1
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp120
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h33
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in10
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h7
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h4
-rw-r--r--Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm8
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp140
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.h64
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp19
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp389
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h94
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h8
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm50
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp35
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h11
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.cpp10
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.h8
-rw-r--r--Source/WebKit2/WebProcess/WebProcess.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp7
-rw-r--r--Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp4
-rw-r--r--Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm5
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMac.mm4
-rw-r--r--Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm4
-rw-r--r--Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp63
-rw-r--r--Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h9
-rw-r--r--Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp27
-rw-r--r--Source/WebKit2/WebProcess/qt/QtNetworkReply.h5
-rw-r--r--Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp5
-rw-r--r--Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp4
-rw-r--r--Source/WebKit2/config.h6
-rw-r--r--Source/WebKit2/win/WebKit2.def12
-rwxr-xr-xSource/WebKit2/win/WebKit2.vcproj12
-rw-r--r--Source/WebKit2/win/WebKit2CFLite.def11
291 files changed, 9739 insertions, 2662 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 064d7ff76..e2d0471f2 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,2740 @@
+2012-02-02 Claudio Saavedra <csaavedra@igalia.com> and Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] WebKitWebView won't work in a GtkOffscreenWindow
+ https://bugs.webkit.org/show_bug.cgi?id=76911
+
+ Reviewed by Philippe Normand.
+
+ * UIProcess/API/gtk/WebKitUIClient.cpp:
+ (getWindowFrame): Use the new helper.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewCreateJavaScriptDialog): Ditto
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseRealize): Ditto.
+ (webkitWebViewBaseSizeAllocate): Ditto.
+ (webkitWebViewBaseFocusInEvent): Ditto.
+
+2012-02-01 Philippe Normand <pnormand@igalia.com>
+
+ [GStreamer] FFTFrame implementation
+ https://bugs.webkit.org/show_bug.cgi?id=73545
+
+ Reviewed by Chris Rogers.
+
+ * GNUmakefile.am: Remove libfftw compilation flags.
+
+2012-02-01 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Texmap] Use glScissors for clipping in TextureMapperGL when possible
+ https://bugs.webkit.org/show_bug.cgi?id=77575
+
+ Reviewed by Martin Robinson.
+
+ Instead of applying the scissor clip in QQuickWebPage, we trickle it down to
+ TextureMapperGL, and apply it there as part of beginClip(). All direct GL operations are
+ now cleaned out of QQuickWebPage.
+
+ * UIProcess/API/qt/qquickwebpage.cpp:
+ (QQuickWebPagePrivate::paintToCurrentGLContext):
+ * UIProcess/DrawingAreaProxy.h:
+ (WebKit::DrawingAreaProxy::paintToCurrentGLContext):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::paintToCurrentGLContext):
+ * UIProcess/DrawingAreaProxyImpl.h:
+ (DrawingAreaProxyImpl):
+ * UIProcess/LayerTreeHostProxy.h:
+ (LayerTreeHostProxy):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToCurrentGLContext):
+
+2012-02-01 Dan Bernstein <mitz@apple.com>
+
+ WebKit2 part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after}
+ https://bugs.webkit.org/show_bug.cgi?id=77505
+
+ Reviewed by Darin Adler.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode): Encode paginationBehavesLikeColumns.
+ (WebKit::WebPageCreationParameters::decode): Decode paginationBehavesLikeColumns.
+ * Shared/WebPageCreationParameters.h:
+ (WebPageCreationParameters): Added paginationBehavesLikeColumns boolean.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPaginationBehavesLikeColumns): Added this setter.
+ (WKPageGetPaginationBehavesLikeColumns): Added this getter.
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/API/mac/WKBrowsingContextController.mm:
+ (-[WKBrowsingContextController setPaginationBehavesLikeColumns:]): Added this Objective-C
+ wrapper around WKPageSetPaginationBehavesLikeColumns.
+ (-[WKBrowsingContextController paginationBehavesLikeColumns]): Added this Objective-C wrapper
+ around WKPageGetPaginationBehavesLikeColumns.
+ * UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Added call to setPaginationBehavesLikeColumns() with
+ the value from the creation parameters.
+ (WebKit::WebPageProxy::setPaginationBehavesLikeColumns): Added this setter.
+ (WebKit::WebPageProxy::creationParameters): Populate paginationBehavesLikeColumns.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::paginationBehavesLikeColumns): Added this getter.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setPaginationBehavesLikeColumns): Added this setter.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Added SetPaginationBehavesLikeColumns message.
+
+2012-02-01 Anders Carlsson <andersca@apple.com>
+
+ REGRESSION (r104727): Strange graphics corruption opening a new tab in Safari
+ https://bugs.webkit.org/show_bug.cgi?id=77578
+ <rdar://problem/10767174>
+
+ Reviewed by Dan Bernstein.
+
+ Resizing a window will always invalidate the window backing store, so make sure to set
+ _data->_windowHasValidBackingStore to NO whenever that happens.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView addWindowObserversForWindow:]):
+ Use separate methods for the NSWindowDidMoveNotification and NSWindowDidResizeNotification notifications.
+
+ (-[WKView _windowDidMove:]):
+ Call -[WKView _updateWindowAndViewFrames].
+
+ (-[WKView _windowDidResize:]):
+ Call -[WKView _updateWindowAndViewFrames] and mark the window backing store as invalid.
+
+2012-02-01 Beth Dakin <bdakin@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77383
+ Add a different didFirstVisuallNonEmptyLayout heuristic to experiment with
+ -and corresponding-
+ <rdar://problem/10709560>
+
+ Reviewed by Sam Weinig.
+
+ Machinery for didNewFirstVisuallNonEmptyLayout.
+ * UIProcess/API/C/WKPage.h:
+ * UIProcess/WebLoaderClient.cpp:
+ (WebKit::WebLoaderClient::didNewFirstVisuallyNonEmptyLayout):
+ (WebKit):
+ * UIProcess/WebLoaderClient.h:
+ (WebLoaderClient):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didNewFirstVisuallyNonEmptyLayout):
+ (WebKit):
+ * UIProcess/WebPageProxy.h:
+ (WebPageProxy):
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout):
+ (WebKit):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ (WebFrameLoaderClient):
+
+ This temporary API allows the client to specify the threshold for the painted
+ objects counter on Page. This is temporary.
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageSetPaintedObjectsCounterThreshold):
+ * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setPaintedObjectsCounterThreshold):
+ (WebKit):
+ * WebProcess/WebPage/WebPage.h:
+ (WebPage):
+
+2012-01-31 Alexey Proskuryakov <ap@apple.com>
+
+ REGRESSION (WebKit2): event.keyCode is always zero when typing in Russian
+ https://bugs.webkit.org/show_bug.cgi?id=77473
+ <rdar://problem/10751357>
+
+ Reviewed by Darin Adler.
+
+ * Shared/mac/WebEventFactory.mm: Removed broken copy/pasted implementation in favor of
+ WebCore ones.
+
+2012-01-31 Alexey Proskuryakov <ap@apple.com>
+
+ PluginProcess should be able to use remote open and save panels
+ https://bugs.webkit.org/show_bug.cgi?id=77461
+ <rdar://problem/10783615>
+
+ Reviewed by Mark Rowe.
+
+ * PluginProcess/mac/PluginProcess.entitlements: Added.
+ * PluginProcess/mac/add-entitlements.sh: Added.
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add appropriate entitlement, plus ad hoc binary signing for it to work.
+
+2012-01-31 Allan Sandfeld Jensen <allan.jensen@nokia.com>
+
+ Ensure tiles are repainted when scrolling using mouse wheel.
+ https://bugs.webkit.org/show_bug.cgi?id=77339
+
+ A new slot visibleContentRectAndScaleChanged has been added
+ that is emited by non-animated scrolling code in the
+ QtViewportInteractionEngine.
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initializeDesktop):
+ (QQuickWebViewPrivate::initializeTouch):
+ (QQuickWebViewPrivate::_q_resume):
+ (QQuickWebViewPrivate::_q_updateVisibleContentRectAndScale):
+ (QQuickWebViewPrivate::updateTouchViewportSize):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ (QQuickWebViewPrivate):
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::QtViewportInteractionEngine::wheelEvent):
+ * UIProcess/qt/QtViewportInteractionEngine.h:
+ (QtViewportInteractionEngine):
+
+2012-01-31 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Make UIProcess decide about encoding of input data for application URL schemes.
+ https://bugs.webkit.org/show_bug.cgi?id=77417
+
+ Make the UIProcess decide about the encoding and display
+ a warning in case no encoding was defined.
+ Make the QQuickNetworkReply store a QWeakPointer to the
+ QQuickWebViewExperimental to get rid of hackish chain of parental queries.
+
+ Reviewed by Simon Hausmann.
+
+ * UIProcess/API/qt/qquicknetworkreply.cpp:
+ (QQuickNetworkReply::send):
+ (QQuickNetworkReply::setWebViewExperimental):
+ * UIProcess/API/qt/qquicknetworkreply_p.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewExperimental::schemeDelegates_Append):
+ * WebProcess/qt/QtNetworkReply.cpp:
+ (WebKit::QtNetworkReply::QtNetworkReply):
+ (WebKit::QtNetworkReply::setReplyData):
+
+2012-01-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] Disconnect the LayerTreeHost from layers when they get removed from their parent.
+ https://bugs.webkit.org/show_bug.cgi?id=77362
+
+ Reviewed by Noam Rosenthal.
+
+ This fixes crashes seen in layout tests under certain timing circumstances
+ that appeared after r106109 was landed.
+
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::replaceChild):
+ (WebCore::WebGraphicsLayer::removeFromParent):
+
+2012-01-30 Beth Dakin <bdakin@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77263
+ PlatformScreenMac should not rely on NSWindow for important bits of data
+
+ Reviewed by Geoff Garen.
+
+ toUserSpace() and toDeviceSpace() now take a parameter for the
+ deviceScaleFactor.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _convertToDeviceSpace:]):
+ (-[WKView _convertToUserSpace:]):
+
+2012-01-26 No'am Rosenthal <noam.rosenthal@nokia.com> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] WKTR: Use a software rendering pipiline when running tests.
+ https://bugs.webkit.org/show_bug.cgi?id=76708
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Animation layout tests require the graphics layers tree to be updated
+ to pass. WebkitTestRunner doesn't show its wrapping QQuickView, which
+ prevents the rendering pipeline to run and then in turn blocks the web
+ process from processing further graphics layer updates.
+
+ This allows the tests to use a TextureMapperQt to empty the LayerTreeHost's
+ message queue and render the layers in software on an offscreen buffer.
+
+ * UIProcess/API/qt/qquickwebpage.cpp:
+ (QQuickWebPagePrivate::paint):
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::QQuickWebViewPrivate):
+ (QQuickWebViewPrivate::setNeedsDisplay):
+ (QQuickWebViewExperimental::setRenderToOffscreenBuffer):
+ (QQuickWebViewExperimental::renderToOffscreenBuffer):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ (QQuickWebViewPrivate::setRenderToOffscreenBuffer):
+ (QQuickWebViewPrivate::renderToOffscreenBuffer):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToGraphicsContext):
+
+2012-01-30 Andras Becsi <andras.becsi@nokia.com>
+
+ [Qt][WK2] Render layers do not get flushed when the scroll animation finishes
+ https://bugs.webkit.org/show_bug.cgi?id=77338
+
+ Reviewed by Noam Rosenthal.
+
+ Schedule a layer flush when setting the visible content rect and scale.
+
+ Fixed with the help of Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
+
+2012-01-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Unreviewed. Fix make distcheck.
+
+ * GNUmakefile.am: Add missing files.
+ * WebProcess/WebPage/TapHighlightController.cpp: Add #if
+ ENABLE(TOUCH_EVENTS).
+
+2012-01-29 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r106022.
+ http://trac.webkit.org/changeset/106022
+ https://bugs.webkit.org/show_bug.cgi?id=77305
+
+ It broke Qt-WK2 API tests (Requested by Ossy_weekend on
+ #webkit).
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
+ (QQuickWebView::geometryChanged):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qwebviewportinfo.cpp:
+ (QWebViewportInfo::currentScale):
+ (QWebViewportInfo::devicePixelRatio):
+ (QWebViewportInfo::initialScale):
+ (QWebViewportInfo::minimumScale):
+ (QWebViewportInfo::maximumScale):
+ (QWebViewportInfo::isScalable):
+ (QWebViewportInfo::layoutSize):
+
+2012-01-29 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r106109.
+ http://trac.webkit.org/changeset/106109
+ https://bugs.webkit.org/show_bug.cgi?id=77302
+
+ It made tests crash (Requested by Ossy_weekend on #webkit).
+
+ * UIProcess/API/qt/qquickwebpage.cpp:
+ * UIProcess/API/qt/qquickwebpage_p_p.h:
+ (QQuickWebPagePrivate):
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::QQuickWebViewPrivate):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ (QQuickWebViewPrivate):
+ * UIProcess/DrawingAreaProxy.h:
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ * UIProcess/DrawingAreaProxyImpl.h:
+ (DrawingAreaProxyImpl):
+ * UIProcess/LayerTreeHostProxy.h:
+ (LayerTreeHostProxy):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToCurrentGLContext):
+ * UIProcess/qt/QtPageClient.cpp:
+ (QtPageClient::setViewNeedsDisplay):
+
+2012-01-27 Fady Samuel <fsamuel@chromium.org>
+
+ Rename shouldLayoutFixedElementsRelativeToFrame and make it a setting
+ https://bugs.webkit.org/show_bug.cgi?id=76459
+
+ Reviewed by Darin Fisher.
+
+ * win/WebKit2.def:
+ * win/WebKit2CFLite.def:
+
+2012-01-27 Martin Robinson <mrobinson@igalia.com>
+
+ Fix a compilation warning in a WebKit2 GTK+ API test.
+
+ Reviewed by Gustavo Noronha Silva.
+
+ * UIProcess/API/gtk/tests/TestBackForwardList.cpp:
+ (testBackForwardListLimitAndCache): Use an int instead of size_t
+ because we want to print them as ints and do subtraction on them.
+
+2012-01-27 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] [WK2] Implement the policy client
+ https://bugs.webkit.org/show_bug.cgi?id=76343
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Implement the abstract WebKitPolicyDecision, WebKitNavigationPolicyDecision,
+ and add the decide-policy signal to WebKitWebView.
+
+ * GNUmakefile.am: Add new files to the source list.
+ * UIProcess/API/gtk/WebKitError.cpp: Use the WebCore namespace because
+ of changes to ASSERT_MATCHING_ENUMS.
+ * UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp: Added.
+ * UIProcess/API/gtk/WebKitNavigationPolicyDecision.h: Added.
+ * UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitPolicyClient.cpp: Added.
+ * UIProcess/API/gtk/WebKitPolicyClientPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitPolicyDecision.cpp: Added.
+ * UIProcess/API/gtk/WebKitPolicyDecision.h: Added.
+ * UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitPrivate.h: Modify ASSERT_MATCHING_ENUMS to make
+ it useful for non-WebCore enums.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewConstructed): Attach the policy client callbacks to the page.
+ (webkit_web_view_class_init): Add the decide-policy signal definition.
+ (webkitWebViewMakePolicyDecision): Added this private method to fire the signal.
+ * UIProcess/API/gtk/WebKitWebView.h: Added new signal to the list.
+ * UIProcess/API/gtk/WebKitWebViewPrivate.h: Added new method declaration.
+ * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Added new classes to the docs.
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Ditto.
+ * UIProcess/API/gtk/tests/GNUmakefile.am: Added new test to the source list.
+ * UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp: Added.
+ * UIProcess/API/gtk/webkit2marshal.list: decide-policy has a new signature.
+
+2012-01-27 Ada Chan <adachan@apple.com>
+
+ Add API to get the parent frame in WKBundleFrameRef
+ https://bugs.webkit.org/show_bug.cgi?id=77161
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+ (WKBundleFrameGetParentFrame): Get the parent frame by calling WebFrame::parentFrame().
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::parentFrame): Return null if the frame does not have an owner element.
+ Otherwise, return the owner element's frame.
+ * WebProcess/WebPage/WebFrame.h:
+
+2012-01-27 Gustavo Noronha Silva <gns@gnome.org>
+
+ [GTK] Sometimes fails to build when using make -j
+ https://bugs.webkit.org/show_bug.cgi?id=77226
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am: use a different name for the scripts used to
+ generate enum files for WebKitGTK+ and WebKit2GTK+, so they do not
+ clash;
+
+2012-01-27 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Fix overridePreference for WebKitHixie76WebSocketProtocolEnabled in WebKitTestRunner.
+ https://bugs.webkit.org/show_bug.cgi?id=77220
+
+ Reviewed by Noam Rosenthal.
+
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): The macro already stringify TestRunnerName.
+
+2012-01-27 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add a GKeyFile especialization to GOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=77191
+
+ Reviewed by Martin Robinson.
+
+ * Shared/gtk/ArgumentCodersGtk.cpp:
+ (CoreIPC::decodeGKeyFile): Use GOwnPtr for GKeyFile.
+ (CoreIPC::encode): Ditto.
+ (CoreIPC::decode): Ditto.
+
+2012-01-27 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Fade out tap highlighting when starting to pan
+ https://bugs.webkit.org/show_bug.cgi?id=77202
+
+ Reviewed by Simon Hausmann.
+
+ Basically we need to fade out the potential tap highlighting
+ when ever the gesture recognition fails or another gesture
+ is recognized. We do that with this change.
+
+ * UIProcess/qt/QtTapGestureRecognizer.cpp:
+ (WebKit::QtTapGestureRecognizer::QtTapGestureRecognizer):
+ (WebKit::QtTapGestureRecognizer::recognize):
+ (WebKit::QtTapGestureRecognizer::reset):
+
+ Remove reset as it does nothing but call code before the
+ event handler is installed.
+
+2012-01-26 No'am Rosenthal <noam.rosenthal@nokia.com> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] WKTR: Use a software rendering pipiline when running tests.
+ https://bugs.webkit.org/show_bug.cgi?id=76708
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Animation layout tests require the graphics layers tree to be updated
+ to pass. WebkitTestRunner doesn't show its wrapping QQuickView, which
+ prevents the rendering pipeline to run and then in turn blocks the web
+ process from processing further graphics layer updates.
+
+ This allows the tests to use a TextureMapperQt to empty the LayerTreeHost's
+ message queue and render the layers in software on an offscreen buffer.
+
+ * UIProcess/API/qt/qquickwebpage.cpp:
+ (QQuickWebPagePrivate::paint):
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::QQuickWebViewPrivate):
+ (QQuickWebViewPrivate::setNeedsDisplay):
+ (QQuickWebViewExperimental::setRenderToOffscreenBuffer):
+ (QQuickWebViewExperimental::renderToOffscreenBuffer):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ (QQuickWebViewPrivate::setRenderToOffscreenBuffer):
+ (QQuickWebViewPrivate::renderToOffscreenBuffer):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToGraphicsContext):
+
+2012-01-27 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Re-creating QQuickWebView starts new web process every time
+ https://bugs.webkit.org/show_bug.cgi?id=77194
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Since the WebKit::WebContext is never fully destructed due to circular
+ references, we should use the real shared context instead of re-creating
+ a new WebContext every time.
+
+ * UIProcess/qt/QtWebContext.cpp:
+ (WebKit::QtWebContext::defaultContext):
+
+2012-01-26 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add basic printing support to WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=76172
+
+ Reviewed by Gustavo Noronha Silva.
+
+ * GNUmakefile.am: Add new files to compilation.
+ * Shared/PrintInfo.cpp:
+ (WebKit::PrintInfo::encode): Encode also GtkPrintSettings and
+ GtkPageSetup for the GTK+ port.
+ (WebKit::PrintInfo::decode): Decode also GtkPrintSettings and
+ GtkPageSetup for the GTK+ port.
+ * Shared/PrintInfo.h: Add GtkPrintSettings and GtkPageSetup member
+ for the GTK+ port.
+ * Shared/gtk/ArgumentCodersGtk.cpp:
+ (CoreIPC::encodeGKeyFile): Helper function to encode a GKeyFile as
+ a DataReference object.
+ (CoreIPC::decodeGKeyFile): Helper function to decode a GKeyFile to
+ a DataReference object.
+ (CoreIPC::encode): Encode GtkPrintSettings and GtkPageSetup using
+ the GKeyFile representation.
+ (CoreIPC::decode): Decode GtkPrintSettings and GtkPageSetup using
+ the GKeyFile representation.
+ * Shared/gtk/ArgumentCodersGtk.h:
+ * Shared/gtk/PrintInfoGtk.cpp: Copied from Source/WebKit2/Shared/PrintInfo.cpp.
+ (WebKit::PrintInfo::PrintInfo): Add PrintInfo constructor that
+ takes GtkPrintSettings and GtkPageSetup instances.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::drawPagesForPrinting): Send
+ DrawPagesForPrinting message to Web process to start printing.
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::beginPrinting): Create a WebPrintOperationGtk.
+ (WebKit::WebPage::endPrinting): Delete the WebPrintOperationGtk
+ object.
+ (WebKit::WebPage::drawPagesForPrinting): Start printing pages.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Add DrawPagesForPrinting message.
+ * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: Added.
+ (WebKit::PrintPagesData::PrintPagesData): Struct to store all data
+ used to render pages for printing.
+ (WebKit::PrintPagesData::incrementPageSequence): Helper function
+ to increment the page sequence.
+ (WebKit::WebPrintOperationGtk::create): Create a
+ WebPrintOperationGtkUnix or WebPrintOperationGtkWin32 depending on
+ the platform.
+ (WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
+ (WebKit::WebPrintOperationGtk::~WebPrintOperationGtk):
+ (WebKit::WebPrintOperationGtk::pageCount): Return the total pages
+ of the document to print.
+ (WebKit::WebPrintOperationGtk::rotatePage): Helper function to
+ transform the context according to orientation.
+ (WebKit::WebPrintOperationGtk::renderPage): Render the given page
+ into the printing context.
+ (WebKit::WebPrintOperationGtk::printPagesIdle): Idle function used
+ to print pages.
+ (WebKit::WebPrintOperationGtk::printPagesIdleDone): Callback
+ called when printPagesIdle finishes.
+ (WebKit::WebPrintOperationGtk::printDone): Helper function to
+ finish the print operation, called when all pages have been rendered.
+ (WebKit::WebPrintOperationGtk::print): Start printing the document
+ using the given cairo surface.
+ * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: Added.
+ (WebKit::WebPrintOperationGtk::printSettings):
+ (WebKit::WebPrintOperationGtk::pageSetup):
+ (WebKit::WebPrintOperationGtk::pagesToPrint):
+ (WebKit::WebPrintOperationGtk::pageRanges):
+ (WebKit::WebPrintOperationGtk::pageRangesCount):
+
+2012-01-26 Tim Horton <hortont424@gmail.com>
+
+ 3D transformed elements hide when showing the print dialog
+ https://bugs.webkit.org/show_bug.cgi?id=45894
+ <rdar://problem/7441593>
+
+ Reviewed by Andy Estes.
+
+ Suspend updates of the compositing layer tree while printing is taking place,
+ preventing on-screen layers from moving to their print-mode positions.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::beginPrinting):
+ (WebKit::WebPage::endPrinting):
+ * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+ * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h:
+ * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm:
+ (WebKit::LayerTreeHostCAMac::forceRepaint):
+ (WebKit::LayerTreeHostCAMac::flushPendingLayerChanges):
+
+2012-01-26 Andras Becsi <andras.becsi@nokia.com>
+
+ [Qt][WK2] Add the componentComplete method to WebView
+ https://bugs.webkit.org/show_bug.cgi?id=77111
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Move the touch/desktop initialization to componentComplete.
+ Also return valid default values in the viewport info functions
+ if the interaction engine is not yet initialized because the
+ viewport info component could finish initialization earlier
+ than the WebView, which results in QML warnings during MiniBrowser
+ startup.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
+ (QQuickWebView::geometryChanged):
+ (QQuickWebView::componentComplete):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qwebviewportinfo.cpp:
+ (QWebViewportInfo::currentScale):
+ (QWebViewportInfo::devicePixelRatio):
+ (QWebViewportInfo::initialScale):
+ (QWebViewportInfo::minimumScale):
+ (QWebViewportInfo::maximumScale):
+ (QWebViewportInfo::isScalable):
+ (QWebViewportInfo::layoutSize):
+
+2012-01-26 Anders Carlsson <andersca@apple.com>
+
+ WebWheelEvent::Phase and PlatformWheelEvent::Phase declarations should match AppKit
+ https://bugs.webkit.org/show_bug.cgi?id=77123
+
+ Reviewed by Beth Dakin.
+
+ * Shared/WebEvent.h:
+ ():
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::phaseForEvent):
+
+2012-01-26 Andras Becsi <andras.becsi@nokia.com>
+
+ ASSERT(!m_overlay) reached in TapHighlightController.cpp:73
+ https://bugs.webkit.org/show_bug.cgi?id=77117
+
+ Reviewed by Tor Arne Vestbø.
+
+ The PageOverlay does only get uninstalled after the fade-out animation finishes,
+ so do not assert on !m_overlay after the uninstallPageOverlay call.
+
+ * WebProcess/WebPage/TapHighlightController.cpp:
+ (WebKit::TapHighlightController::hideHighlight):
+
+2012-01-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ WebPreferencesStore: use DEFINE_STATIC_LOCAL for overrides HashMap
+ https://bugs.webkit.org/show_bug.cgi?id=77109
+
+ Reviewed by Andreas Kling.
+
+ Fix build for Clang.
+
+ * Shared/WebPreferencesStore.cpp:
+ (WebKit):
+ (WebKit::boolTestRunnerOverridesMap):
+ (WebKit::WebPreferencesStore::overrideBoolValueForKey):
+ (WebKit::WebPreferencesStore::removeTestRunnerOverrides):
+ (WebKit::WebPreferencesStore::getBoolValueForKey):
+
+2012-01-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Implement overridePreference for boolean preferences in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=77033
+
+ Reviewed by Alexey Proskuryakov.
+
+ Implement a way to WebKitTestRunner override preferences for the pages
+ loaded. Follows the same approach taken by
+ overrideXSSAuditorEnabledForTestRunner() from r66551, but generalizing to many
+ preferences.
+
+ Preferences are stored in the UI process using WebPreferencesStore, and when
+ there's a change, this data is sent to Web process, triggering
+ WebPage::preferencesDidChange(), which take a WebPreferencesStore and apply it's
+ data to the WebCore::Settings object.
+
+ The overridePreference() is executed on the Web process, and set the preferences
+ without communicating to the UI process. The overriden preferences are stored in
+ a static map and WebPreferencesStore query this map before returning the values
+ of each preference. This static map is used only on the Web process.
+
+ To clear the overrides we need to clear the map. Since WTR only sets preferences
+ when resetting the page, we hook the clearing at WebPage::preferencesDidChange().
+ A WKPreferences private function was exposed to WTR force the update, in case
+ there's no effective change at UI process (all the properties remains the same).
+
+ This clearing could be improved by creating a proper message instead of hooking
+ at WebPage::preferencesDidChange().
+
+ * Shared/WebPreferencesStore.cpp:
+ (WebKit::WebPreferencesStore::decode):
+ (WebKit::WebPreferencesStore::overrideBoolValueForKey):
+ (WebKit::WebPreferencesStore::removeTestRunnerOverrides):
+ (WebKit::WebPreferencesStore::getBoolValueForKey):
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesResetTestRunnerOverrides):
+ * UIProcess/API/C/WKPreferencesPrivate.h:
+ * UIProcess/WebPreferences.h:
+ (WebKit::WebPreferences::forceUpdate):
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleOverrideBoolPreferenceForTestRunner):
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+ (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+
+2012-01-26 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK][WK2] Primary clipboard should be updated with the current selection in X11 platforms
+ https://bugs.webkit.org/show_bug.cgi?id=77097
+
+ Reviewed by Martin Robinson.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::respondToChangedSelection): Call
+ setSelectionPrimaryClipboardIfNeeded() to update primary clipboard
+ in X11 platforms.
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+ * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
+ (WebKit::collapseSelection): Callback called when clearing
+ clipboard contents.
+ (WebKit::WebEditorClient::setSelectionPrimaryClipboardIfNeeded):
+ Updaye primary clipboard with the current selection.
+
+2012-01-26 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Use QVariant for payload data in application URL schemes.
+ https://bugs.webkit.org/show_bug.cgi?id=77007
+
+ Make application schemes use QVariant for payload data.
+ This allows passing QByteArrays as well as simple String data.
+
+ Remove unneeded http header parts that were exposed in
+ QQuickNetworkReply.
+
+ Add ByteArrayTestData class to allow injecting QByteArray
+ data into an application scheme handler for testing.
+
+ Reviewed by Simon Hausmann.
+
+ * Shared/qt/QtNetworkReplyData.cpp:
+ (WebKit::QtNetworkReplyData::QtNetworkReplyData):
+ (WebKit::QtNetworkReplyData::encode):
+ (WebKit::QtNetworkReplyData::decode):
+ * Shared/qt/QtNetworkReplyData.h:
+ * UIProcess/API/qt/qquicknetworkreply.cpp:
+ (QQuickNetworkReply::QQuickNetworkReply):
+ (QQuickNetworkReply::data):
+ (QQuickNetworkReply::setData):
+ (QQuickNetworkReply::send):
+ * UIProcess/API/qt/qquicknetworkreply_p.h:
+ * UIProcess/API/qt/tests/bytearraytestdata.cpp: Added.
+ (ByteArrayTestData::ByteArrayTestData):
+ (ByteArrayTestData::latin1Data):
+ (ByteArrayTestData::utf8Data):
+ * UIProcess/API/qt/tests/bytearraytestdata.h: Added.
+ * UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml:
+ * UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp:
+ (main):
+ * UIProcess/API/qt/tests/tests.pri:
+ * WebProcess/qt/QtNetworkReply.cpp:
+ (WebKit::QtNetworkReply::setReplyData):
+ * WebProcess/qt/QtNetworkReply.h:
+
+2012-01-26 Thiago Marcos P. Santos <tmpsantos@gmail.com>
+
+ [Qt] Fixed build when using force_static_libs_as_shared
+ https://bugs.webkit.org/attachment.cgi?bugid=77082
+
+ Reviewed by Simon Hausmann.
+
+ * Target.pri:
+
+2012-01-26 Nándor Huszka <huszka.nandor@stud.u-szeged.hu>
+
+ [WK2] WebKitTestRunner needs layoutTestController.setGeolocationPermission
+ https://bugs.webkit.org/show_bug.cgi?id=42545
+
+ Reviewed by Zoltan Herczeg.
+
+ Implement the setGeolocationPermission method.
+
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleSetGeolocationPermission):
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::setGeoLocationPermission):
+ (WebKit):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+ (InjectedBundle):
+
+2012-01-25 Mark Rowe <mrowe@apple.com>
+
+ Build in to an alternate location when USE_STAGING_INSTALL_PATH is set.
+
+ <rdar://problem/10609417> Adopt USE_STAGING_INSTALL_PATH
+
+ Reviewed by David Kilzer.
+
+ * Configurations/BaseTarget.xcconfig: Define NORMAL_WEBKIT2_FRAMEWORKS_DIR, which contains
+ the path where WebKit is normally installed. Update WEBKIT2_FRAMEWORKS_DIR to point to
+ the staged frameworks directory when USE_STAGING_INSTALL_PATH is set. Update
+ UMBRELLA_FRAMEWORKS_DIR so we can find WebCore at the top level of the staged frameworks
+ directory when USE_STAGING_INSTALL_PATH is set, rather than finding it embedded inside of
+ WebKit.framework.
+ * Configurations/PluginProcess.xcconfig: Set our install path based on WEBKIT2_FRAMEWORKS_DIR.
+ * Configurations/WebKit2.xcconfig: Set our install path based on WEBKIT2_FRAMEWORKS_DIR.
+ Always set the framework's install name based on the normal framework location. This prevents
+ an incorrect install name from being used when installing in to the staged frameworks directory.
+ * Configurations/WebProcess.xcconfig: Set our install path based on WEBKIT2_FRAMEWORKS_DIR.
+
+2012-01-25 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [WK2][Qt] REGRESSION: Pages with transform animations sometimes omit some of the layers since r105413
+ https://bugs.webkit.org/show_bug.cgi?id=76886
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ We now render the whole layer if it or one if its ancestors has an active transform
+ animations. It's possible to optimize further in the future, but not currently necessary.
+ Also, we make sure that when a WebGraphicsLayer's property that affects transformation is
+ changed, all its descandants layers are marked as modified so that we re-adjust their
+ visible rect in the next pass.
+
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::notifyChangeRecursively):
+ (WebCore):
+ (WebCore::WebGraphicsLayer::setPosition):
+ (WebCore::WebGraphicsLayer::setAnchorPoint):
+ (WebCore::WebGraphicsLayer::setSize):
+ (WebCore::WebGraphicsLayer::setTransform):
+ (WebCore::WebGraphicsLayer::setChildrenTransform):
+ (WebCore::WebGraphicsLayer::setPreserves3D):
+ (WebCore::WebGraphicsLayer::setMasksToBounds):
+ (WebCore::WebGraphicsLayer::addAnimation):
+ (WebCore::WebGraphicsLayer::removeAnimation):
+ (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+ (WebCore::WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ (WebGraphicsLayer):
+
+2012-01-25 Hajime Morita <morrita@google.com>
+
+ ENABLE_SHADOW_DOM should be available via build-webkit --shadow-dom
+ https://bugs.webkit.org/show_bug.cgi?id=76863
+
+ Reviewed by Dimitri Glazkov.
+
+ Added a feature flag.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-01-25 Martin Robinson <mrobinson@igalia.com>
+
+ [WK2] Navigation events not triggered by a mouse event claim to be triggered by the left mouse button during policy decisions
+ https://bugs.webkit.org/show_bug.cgi?id=76344
+
+ Reviewed by Sam Weinig.
+
+ When creating InjectedBundleNavigationActions, initialize the mouse button to NoButton.
+ This ensures that when there is no mouse event associated with the action, when the event
+ hits the client-API layer, the button is still NoButton.
+
+ * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
+ (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction): Initialize m_mouseButton
+ to WebMouseEvent::NoButton.
+
+2012-01-25 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Implement tap feedback respecting -webkit-tap-highlight-color
+ https://bugs.webkit.org/show_bug.cgi?id=76914
+
+ Reviewed by Simon Hausmann.
+
+ Implement tap highlighting for Qt. When a touch press is issued,
+ which is not handled by the web page, then we highlight any
+ activatable node below. In all otehr cases, we hide any highlights.
+
+ The highlighting itself is painted on an accelerated PageOverlay,
+ on the web process side.
+
+ * Target.pri:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::handlePotentialActivation):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/qt/QtTapGestureRecognizer.cpp:
+ (WebKit::QtTapGestureRecognizer::recognize):
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::handlePotentialSingleTapEvent):
+ * UIProcess/qt/QtWebPageEventHandler.h:
+ * WebProcess/WebPage/TapHighlightController.cpp: Added.
+ (WebKit::TapHighlightController::TapHighlightController):
+ (WebKit::TapHighlightController::~TapHighlightController):
+ (WebKit::TapHighlightController::highlight):
+ (WebKit::TapHighlightController::hideHighlight):
+ (WebKit::TapHighlightController::pageOverlayDestroyed):
+ (WebKit::TapHighlightController::willMoveToWebPage):
+ (WebKit::TapHighlightController::didMoveToWebPage):
+ (WebKit::highlightColor):
+ (WebKit::TapHighlightController::drawRect):
+ (WebKit::TapHighlightController::mouseEvent):
+ * WebProcess/WebPage/TapHighlightController.h: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::highlightPotentialActivation):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::tapHighlightController):
+ * WebProcess/WebPage/WebPage.messages.in:
+
+2012-01-25 Nándor Huszka <huszka.nandor@stud.u-szeged.hu>
+
+ [WK2] WebKitTestRunner needs layoutTestController.setPopupBlockingEnabled
+ https://bugs.webkit.org/show_bug.cgi?id=63458
+
+ Reviewed by Adam Roben.
+
+ Implement the setPopupBlockingEnabled method.
+
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleSetPrivateBrowsingEnabled):
+ (WKBundleSetPopupBlockingEnabled):
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::setPopupBlockingEnabled):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+
+2012-01-25 Yael Aharon <yael.aharon@nokia.com>
+
+ [Qt] Build fix when using force_static_libs_as_shared
+ https://bugs.webkit.org/show_bug.cgi?id=76832
+
+ Reviewed by Simon Hausmann.
+
+ Add a dependency on QtWidgets.
+
+ * Target.pri:
+
+2012-01-24 Sergio Villar Senin <svillar@igalia.com>
+
+ [WK2] FindController should not assume that ports do not want to highlight text matches
+ https://bugs.webkit.org/show_bug.cgi?id=76921
+
+ Reviewed by Darin Adler.
+
+ FindController must obey the FindOptionsShowHighlight flag instead
+ of assuming that ports do not want to highlight search matches.
+
+ * Shared/API/c/WKFindOptions.h: added kWKFindOptionsShowHighlight.
+ * Shared/API/c/WKSharedAPICast.h:
+ (WebKit::toFindOptions): Ditto.
+ * Shared/WebFindOptions.h: added FindOptionsShowHighlight.
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::findString):
+
+2012-01-25 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Page clients don't need to be GObjects anymore in WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=76899
+
+ Reviewed by Martin Robinson.
+
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp: Renamed from
+ Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.cpp.
+ (didStartProvisionalLoadForFrame): Use clientInfo instead fo
+ getting the view from the page.
+ (didReceiveServerRedirectForProvisionalLoadForFrame): Ditto.
+ (didFailProvisionalLoadWithErrorForFrame): Ditto.
+ (didCommitLoadForFrame): Ditto.
+ (didFinishLoadForFrame): Ditto.
+ (didFailLoadWithErrorForFrame): Ditto.
+ (didSameDocumentNavigationForFrame): Ditto.
+ (didReceiveTitleForFrame): Ditto.
+ (didChangeProgress): Ditto.
+ (didChangeBackForwardList): Ditto.
+ (attachLoaderClientToView): Pass WebKitWebView as clientInfo to
+ callbacks.
+ * UIProcess/API/gtk/WebKitLoaderClient.h: Added.
+ * UIProcess/API/gtk/WebKitUIClient.cpp:
+ (createNewPage): Use clientInfo instead fo getting the view from
+ the page.
+ (showPage): Ditto.
+ (closePage): Ditto.
+ (runJavaScriptAlert): Ditto.
+ (runJavaScriptConfirm): Ditto.
+ (runJavaScriptPrompt): Ditto.
+ (toolbarsAreVisible): Ditto.
+ (setToolbarsAreVisible): Ditto.
+ (menuBarIsVisible): Ditto.
+ (setMenuBarIsVisible): Ditto.
+ (statusBarIsVisible): Ditto.
+ (setStatusBarIsVisible): Ditto.
+ (isResizable): Ditto.
+ (setIsResizable): Ditto.
+ (getWindowFrame): Ditto.
+ (setWindowFrame): Ditto.
+ (attachUIClientToView): Pass WebKitWebView as clientInfo to
+ callbacks.
+ * UIProcess/API/gtk/WebKitUIClient.h: Remove GObject boilerplate.
+ * UIProcess/API/gtk/WebKitWebLoaderClient.h: Removed.
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewConstructed): Remove UIClient and LoaderClient
+ objects and call attachUIClientToView() and attachLoaderClientToView().
+ * UIProcess/API/gtk/tests/GNUmakefile.am: Rename
+ WebKitWebLoaderClient to WebKitLoaderClient.
+ * UIProcess/API/gtk/tests/TestLoaderClient.cpp: Renamed from
+ Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp.
+
+2012-01-25 Roland Steiner <rolandsteiner@chromium.org>
+
+ <style scoped>: Implement registering of <style scoped> with the scoping element
+ https://bugs.webkit.org/show_bug.cgi?id=67790
+
+ Add symbols for windows.internals.numberOfScopedHTMLStyleChildren
+
+ Reviewed by Dimitri Glazkov.
+
+ * win/WebKit2.def:
+ * win/WebKit2CFLite.def:
+
+2012-01-24 Beth Dakin <bdakin@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=76928
+ Accelerated drawing should force compositing mode
+ -and corresponding-
+ <rdar://problem/10697417>
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
+2012-01-24 Alexis Menard <alexis.menard@openbossa.org>
+
+ Unreviewed build fix for Qt.
+
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::showDebugBorders):
+ (WebKit::LayerTreeHostQt::showRepaintCounter):
+
+2012-01-23 Simon Fraser <simon.fraser@apple.com>
+
+ Show layer borders for scrollbar layers
+ https://bugs.webkit.org/show_bug.cgi?id=76888
+
+ Reviewed by Beth Dakin.
+
+ Update for new signatures of GraphicsLayerClient::showDebugBorders()
+ and GraphicsLayerClient::showRepaintCounter().
+
+ * UIProcess/LayerTreeHostProxy.h:
+ (WebKit::LayerTreeHostProxy::showDebugBorders):
+ (WebKit::LayerTreeHostProxy::showRepaintCounter):
+ * WebProcess/WebPage/ca/LayerTreeHostCA.cpp:
+ (WebKit::LayerTreeHostCA::showDebugBorders):
+ (WebKit::LayerTreeHostCA::showRepaintCounter):
+ * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+
+2012-01-24 David Levin <levin@chromium.org>
+
+ [windows] Convert usage of GetDC to HWndDC Part 3.
+ https://bugs.webkit.org/show_bug.cgi?id=76889
+
+ Reviewed by Adam Roben.
+
+ * UIProcess/win/WebPopupMenuProxyWin.cpp:
+ (WebKit::WebPopupMenuProxyWin::paint): Fix a dc leak and use the dellayed allocation.
+
+2012-01-24 Sergio Villar Senin <svillar@igalia.com>
+
+ [WK2] [GTK] TestDownloads hitting an assertion in Debug builds
+ https://bugs.webkit.org/show_bug.cgi?id=76915
+
+ Reviewed by Martin Robinson.
+
+ No new tests required as it fixes some assertions in a unit test.
+
+ * WebProcess/Downloads/soup/DownloadSoup.cpp:
+ (WebKit::Download::start):
+ (WebKit::Download::startWithHandle):
+
+2012-01-24 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Qt][WK2] Qt's cross-process AC copies images excessively when updating tiles.
+ https://bugs.webkit.org/show_bug.cgi?id=76877
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Instead of copying QImages, pass a reference to the ShareableBitmap that was originally
+ created by the web process. Also, swizzle the image's RGB in the web process, before it's
+ transferred to the UI process.
+
+ Data flow before change:
+ (Web Process) Render to image -> IPC -> (UI Process) Copy (render queue) -> Copy Swizzled RGB -> Upload
+
+ Data flow after change:
+ (Web Process) Render to image -> swizzle RGB -> IPC -> (UI Process) -> Upload
+
+ * Shared/ShareableBitmap.h:
+ * Shared/qt/ShareableBitmapQt.cpp:
+ (WebKit::ShareableBitmap::swizzleRGB):
+ * UIProcess/LayerTreeHostProxy.h:
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::updateTile):
+ (WebKit::LayerTreeHostProxy::createImage):
+ (WebKit::LayerTreeHostProxy::syncRemoteContent):
+ (WebKit::LayerTreeHostProxy::updateTileForLayer):
+ (WebKit::LayerTreeHostProxy::createDirectlyCompositedImage):
+ (WebKit::LayerTreeHostProxy::purgeGLResources):
+ * WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
+ (WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::adoptImageBackingStore):
+
+2012-01-24 Rafael Brandao <rafael.lobo@openbossa.org>
+
+ [Qt][WK2] QtWebIconDatabaseClient leaves a dangling pointer on WebIconDatabase after its destruction
+ https://bugs.webkit.org/show_bug.cgi?id=76399
+
+ Reviewed by Simon Hausmann.
+
+ Due a circular dependency between WebContext and WebProcessProxy, WebContext it not
+ being destroyed, neither WebIconDatabase. As QtWebIconDatabaseClient's life time is the same
+ as QtWebContext and this one is being destroyed, the remaining reference to our client
+ on WebIconDatabase should be cleaned upon its destruction.
+
+ * UIProcess/qt/QtWebIconDatabaseClient.cpp:
+ (QtWebIconDatabaseClient::QtWebIconDatabaseClient):
+ (QtWebIconDatabaseClient::~QtWebIconDatabaseClient): Clear client pointer on WebIconDatabase.
+ * UIProcess/qt/QtWebIconDatabaseClient.h: Make this client hold a reference to WebIconDatabase.
+
+2012-01-24 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Add test for application URL schemes.
+ https://bugs.webkit.org/show_bug.cgi?id=74933
+
+ Add a test that checks handling of url strings.
+ Add a test that verifies replies in case of multiple
+ available application url schemes.
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml:
+
+2012-01-24 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Fix /webkit2/WebKitWebView/reload after r105688
+ https://bugs.webkit.org/show_bug.cgi?id=76898
+
+ Reviewed by Alejandro G. Castro.
+
+ * UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
+ (LoadTrackingTest::reload): Add reload method that clears events
+ and initializes progress.
+ * UIProcess/API/gtk/tests/LoadTrackingTest.h:
+ * UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp:
+ (testWebViewReload): Use LoadTrackingTest::reload() instead of
+ webkit_web_view_reload().
+
+2012-01-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Some qmake build files must include Qt5's "quick" module.
+ https://bugs.webkit.org/show_bug.cgi?id=76671
+
+ Unreviewed build fix.
+
+ * UIProcess/API/qt/tests/tests.pri:
+
+2012-01-24 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Application URL schemes cause asserts when using debug.
+ https://bugs.webkit.org/show_bug.cgi?id=76700
+
+ Instances of QtNetworkRequestData / QtNetworkReplyData are meant
+ to be used for transfering data over IPC. To allow transferring
+ instances of these classes over IPC they need to be copyable,
+ and it must be possible to create such instances on the stack.
+ Because classes that inherit from RefCounted always need to be
+ used in connection with RefPtr, QtNetworkRequestData and
+ QtNetworkReplyData cannot inherit directly from RefCounted.
+
+ Deleting an object that inherits from RefCounted, without
+ the proper sequence of ref()/deref() being called by it's
+ RefPtr, causes asserts when running a debug version.
+
+ Reviewed by Simon Hausmann.
+
+ * Shared/qt/QtNetworkReplyData.h:
+ (WebKit::QtRefCountedNetworkReplyData::data):
+ * Shared/qt/QtNetworkRequestData.cpp:
+ (WebKit::QtRefCountedNetworkRequestData::QtRefCountedNetworkRequestData):
+ * Shared/qt/QtNetworkRequestData.h:
+ (WebKit::QtRefCountedNetworkRequestData::data):
+ * Target.pri:
+ * UIProcess/API/qt/qquicknetworkreply.cpp:
+ (QQuickNetworkReply::QQuickNetworkReply):
+ (QQuickNetworkReply::contentType):
+ (QQuickNetworkReply::setContentType):
+ (QQuickNetworkReply::operation):
+ (QQuickNetworkReply::setOperation):
+ (QQuickNetworkReply::contentDisposition):
+ (QQuickNetworkReply::setContentDisposition):
+ (QQuickNetworkReply::location):
+ (QQuickNetworkReply::setLocation):
+ (QQuickNetworkReply::lastModified):
+ (QQuickNetworkReply::setLastModified):
+ (QQuickNetworkReply::cookie):
+ (QQuickNetworkReply::setCookie):
+ (QQuickNetworkReply::userAgent):
+ (QQuickNetworkReply::setUserAgent):
+ (QQuickNetworkReply::server):
+ (QQuickNetworkReply::setServer):
+ (QQuickNetworkReply::data):
+ (QQuickNetworkReply::setData):
+ (QQuickNetworkReply::send):
+ (QQuickNetworkReply::networkRequestData):
+ (QQuickNetworkReply::setNetworkRequestData):
+ (QQuickNetworkReply::networkReplyData):
+ * UIProcess/API/qt/qquicknetworkreply_p.h:
+ * UIProcess/API/qt/qquicknetworkrequest.cpp:
+ (QQuickNetworkRequest::QQuickNetworkRequest):
+ (QQuickNetworkRequest::setNetworkRequestData):
+ (QQuickNetworkRequest::url):
+ * UIProcess/API/qt/qquicknetworkrequest_p.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewExperimental::invokeApplicationSchemeHandler):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/qt/QtPageClient.cpp:
+ (QtPageClient::handleApplicationSchemeRequest):
+ * UIProcess/qt/QtPageClient.h:
+ * UIProcess/qt/WebPageProxyQt.cpp:
+ (WebKit::WebPageProxy::resolveApplicationSchemeRequest):
+ (WebKit::WebPageProxy::sendApplicationSchemeReply):
+ * WebProcess/qt/QtNetworkReply.cpp:
+ (WebKit::QtNetworkReply::setData):
+ (WebKit::QtNetworkReply::readData):
+
+2012-01-24 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Implement DownloadClient in WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=72952
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am: Add new files to compilation.
+ * UIProcess/API/gtk/WebKitDownloadClient.cpp: Added.
+ (didStart): Call webkitWebContextDownloadStarted().
+ (didReceiveResponse): Call webkitDownloadSetResponse() with the
+ received response.
+ (didReceiveData): Call webkitDownloadNotifyProgress().
+ (decideDestinationWithSuggestedFilename): Call
+ webkitDownloadDecideDestinationWithSuggestedFilename().
+ (didCreateDestination): Call webkitDownloadDestinationCreated().
+ (didFail): Call webkitDownloadFailed() or
+ webkitDownloadCancelled() if the download was cancelled before
+ failing.
+ (didCancel): Call webkitDownloadCancelled().
+ (didFinish): Call webkitDownloadFinished().
+ (attachDownloadClientToContext): Add
+ implementation for download client callbacks.
+ * UIProcess/API/gtk/WebKitDownloadClient.h: Added.
+ * UIProcess/API/gtk/WebKitError.cpp:
+ (webkit_download_error_quark): Add quark for download errors.
+ * UIProcess/API/gtk/WebKitError.h:
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (webkit_web_context_class_init): Add download-started signal.
+ (createDefaultWebContext): Initialize the download client.
+ (downloadsMap): HashMap containing download objects for all
+ ongoing download operations.
+ (webkit_web_context_download_uri): Start a new download for the
+ given URI.
+ (webkitWebContextGetOrCreateDownload): Helper function to create a
+ new download object or return the existing one from the downloads map.
+ (webkitWebContextRemoveDownload): Remove the download object from
+ the downloads map.
+ (webkitWebContextDownloadStarted): Emit
+ WebKitWebContext::download-started for the given download object.
+ * UIProcess/API/gtk/WebKitWebContext.h:
+ * UIProcess/API/gtk/WebKitWebContextPrivate.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
+ * UIProcess/API/gtk/tests/GNUmakefile.am: Add new test for downloads.
+ * UIProcess/API/gtk/tests/TestDownloads.cpp: Added.
+ (getWebKit1TestResoucesDir):
+ (testDownloadLocalFile):
+ (testDownloadLocalFileError):
+ (serverCallback):
+ (testDownloadRemoteFile):
+ (testDownloadRemoteFileError):
+ (beforeAll):
+ (afterAll):
+
+2012-01-23 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add WebKitDownload to WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=72949
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am: Add new files to compilation.
+ * UIProcess/API/gtk/WebKitDownload.cpp: Added.
+ (webkitDownloadFinalize):
+ (webkitDownloadGetProperty):
+ (webkitDownloadDecideDestination):
+ (webkit_download_init):
+ (webkit_download_class_init):
+ (webkitDownloadCreate): Create a new WebKitDownload for a given
+ WKDownloadRef.
+ (webkitDownloadSetResponse): Set the network response of the
+ download.
+ (webkitDownloadIsCancelled): Whether the download has been
+ cancelled by the user.
+ (webkitDownloadNotifyProgress): Emit notify::estimated-progress if
+ needed.
+ (webkitDownloadFailed): Emit WebKitDownload::failed with the given
+ error.
+ (webkitDownloadCancelled): Emit WebKitDownload::failed with
+ cancelled error.
+ (webkitDownloadFinished): Emit WebKitDownload::finished.
+ (webkitDownloadDecideDestinationWithSuggestedFilename): Emit
+ WebKitDownload::decide-destination.
+ (webkitDownloadDestinationCreated): Emit
+ WebKitDownload::created-destination.
+ (webkit_download_get_destination): Return the destination URI of
+ the download.
+ (webkit_download_set_destination): Set the destination URI of the
+ download.
+ (webkit_download_get_response): Return the response received by
+ the server.
+ (webkit_download_cancel): Cancel the download.
+ (webkit_download_get_estimated_progress): Return the estimated
+ progress.
+ (webkit_download_get_elapsed_time): Return the time elapsed since
+ the download started.
+ * UIProcess/API/gtk/WebKitDownload.h: Added.
+ * UIProcess/API/gtk/WebKitDownloadPrivate.h: Added.
+ * UIProcess/API/gtk/WebKitPrivate.h:
+ * UIProcess/API/gtk/WebKitURIResponse.cpp:
+ (webkitURIResponseGetResourceResponse):
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
+ * UIProcess/API/gtk/docs/webkit2gtk.types: Add
+ webkit_download_get_type().
+ * UIProcess/API/gtk/webkit2.h: Include WebKitDownload.h.
+ * UIProcess/API/gtk/webkit2marshal.list:
+
+2012-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ JSValue::toString() should return a JSString* instead of a UString
+ https://bugs.webkit.org/show_bug.cgi?id=76861
+
+ Reviewed by Gavin Barraclough.
+
+ Mechanical changes to call value() after calling toString(), to
+ convert from "JS string" (JSString*) to "C++ string" (UString), since
+ toString() no longer returns a "C++ string".
+
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
+
+2012-01-23 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ [Qt][WK2] QQuickWebView is initializing touch mode twice while being constructed
+ https://bugs.webkit.org/show_bug.cgi?id=76859
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Removing d->initializeTouch() from QQuickWebView::QQuickWebView()
+ since in QQuickWebViewPrivate::initialize() there is a call for
+ setUseTraditionalDesktopBehaviour(false), which will call initializeTouch.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebView::QQuickWebView):
+
+2012-01-23 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK][WK2] Make the LoadTracking and WebView test fixtures more flexible
+ https://bugs.webkit.org/show_bug.cgi?id=76755
+
+ Reviewed by Alejandro G. Castro.
+
+ Always clear the loading events when loading new content in the load tracking
+ test. In the WebView test correctly handle loading HTML with a URL that isn't
+ "about:blank."
+
+ * UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
+ (LoadTrackingTest::loadURI): Reset the class state when starting a new load.
+ (LoadTrackingTest::loadHtml): Ditto.
+ (LoadTrackingTest::loadPlainText): Ditto.
+ (LoadTrackingTest::loadRequest): Ditto.
+ * UIProcess/API/gtk/tests/LoadTrackingTest.h: Added new method definitions.
+ * UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp:
+ (assertNormalLoadHappened): No longer clear loading events. The fixture handles that now.
+ (testLoadHtml): Update to reflect new method name.
+ (testLoadPlainText): Ditto.
+ (testLoadRequest): Ditto.
+ (testWebViewReload): Ditto.
+ * UIProcess/API/gtk/tests/WebViewTest.cpp:
+ (WebViewTest::loadHtml): Properly interpret the baseURL parameter.
+ * UIProcess/API/gtk/tests/WebViewTest.h: Make loading methods virtual.
+
+2012-01-23 Alexander Færøy <alexander.faeroy@nokia.com>
+
+ [Qt] Implement SSL error handling QML API.
+ https://bugs.webkit.org/show_bug.cgi?id=76793
+
+ Reviewed by Simon Hausmann.
+
+ This patch implements support for accepting or rejecting invalid SSL
+ certificates from the QML API.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::QQuickWebViewPrivate):
+ (QQuickWebViewPrivate::handleCertificateVerificationRequest):
+ (QQuickWebViewExperimental::certificateVerificationDialog):
+ (QQuickWebViewExperimental::setCertificateVerificationDialog):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::certificateVerificationRequest):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/qt/QtDialogRunner.cpp:
+ (CertificateVerificationDialogContextObject::CertificateVerificationDialogContextObject):
+ (CertificateVerificationDialogContextObject::hostname):
+ (CertificateVerificationDialogContextObject::accept):
+ (CertificateVerificationDialogContextObject::reject):
+ (QtDialogRunner::initForCertificateVerification):
+ * UIProcess/qt/QtDialogRunner.h:
+ * UIProcess/qt/QtPageClient.cpp:
+ (QtPageClient::handleCertificateVerificationRequest):
+ * UIProcess/qt/QtPageClient.h:
+ * WebProcess/qt/QtNetworkAccessManager.cpp:
+ (WebKit::QtNetworkAccessManager::QtNetworkAccessManager):
+ (WebKit::QtNetworkAccessManager::onSslErrors):
+ * WebProcess/qt/QtNetworkAccessManager.h:
+
+2012-01-23 David Levin <levin@chromium.org>
+
+ [windows] Convert usages of GetDC to HWndDC Part 2.
+ https://bugs.webkit.org/show_bug.cgi?id=76750
+
+ Reviewed by Adam Roben.
+
+ * Shared/win/ShareableBitmapWin.cpp:
+ (WebKit::ShareableBitmap::windowsContext): Fix incorrect usage of OwnPtr<HDC> which
+ would do a DeleteDC instead of a ReleaseDC.
+
+2012-01-23 David Levin <levin@chromium.org>
+
+ [windows] Convert usages of GetDC to HWndDC Part 1.
+ https://bugs.webkit.org/show_bug.cgi?id=76744
+
+ Reviewed by Adam Roben.
+
+ * UIProcess/win/WebView.cpp:
+ (WebKit::WebView::flashBackingStoreUpdates): Typical conversion.
+
+2012-01-21 Timothy Hatcher <timothy@apple.com>
+
+ Make WebKit2 remember the height of the Web Inspector when it is docked.
+
+ https://webkit.org/b/76769
+
+ Reviewed by Dan Bernstein.
+
+ * Shared/WebPreferencesStore.h: Added InspectorAttachedHeight.
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::setAttachedWindowHeight): Call WebPreferencesStore::setInspectorAttachedHeight.
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::platformAttach): Set the height of the inspector's WKView to inspectorAttachedHeight.
+ (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): Remove unneeded setNeedsDisplay: calls.
+
+2012-01-20 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ [Qt] [WK2] Division by zero error in QtViewportInteractionEngine::setItemRectVisible
+ https://bugs.webkit.org/show_bug.cgi?id=76674
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Make sure that itemRect is not empty.
+
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::QtViewportInteractionEngine::setItemRectVisible):
+
+2012-01-20 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Drag/drop of a file into a WebView on Windows needs to allow access to that file
+ https://bugs.webkit.org/show_bug.cgi?id=76753
+ <rdar://problem/10731719>
+
+ The Windows drag/drop code path was missing the code to open a file read exception.
+
+ Added code to match the Mac version, while allowing directories and multiple files to
+ also be dragged (matching our previous behavior).
+
+ * UIProcess/win/WebView.cpp:
+ (WebKit::maybeCreateSandboxExtensionFromDragData): Added.
+ (WebKit::WebView::Drop): Add a universal read exception if we're dragging a file into a WebView to open it.
+
+2012-01-20 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] Trigger forcing accelerated compositing from the UI process side.
+ https://bugs.webkit.org/show_bug.cgi?id=76296
+
+ Reviewed by Noam Rosenthal.
+
+ Some messages can be sent from the web view to the LayerTreeHost before
+ accelerated compositing is entered on the web process and signaled back.
+ By letting the UI process decide if AC has to be forced, we can create
+ the LayerTreeHostProxy earlier to send messages to the web process while
+ AC is being entered there.
+
+ This patch also fixes the flow of DidRenderFrame and RenderNextFrame messages
+ by setting the m_waitingForUIProcess flag properly and only send the
+ RenderNextFrame once the painting thread on the UI process is ready to paint.
+
+ This fixes the first visible content rect message not being received when
+ loading pages from the disk.
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initialize):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::flushLayerChanges):
+ (WebKit::LayerTreeHostProxy::didRenderFrame):
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::performScheduledLayerFlush):
+ * WebProcess/WebPage/qt/WebPageQt.cpp:
+ (WebKit::WebPage::platformInitialize):
+
+2012-01-20 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r105497.
+ http://trac.webkit.org/changeset/105497
+ https://bugs.webkit.org/show_bug.cgi?id=76696
+
+ Leaking in Qt layout tests and timing out in GTK API tests.
+ (Requested by jturcotte on #webkit).
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initialize):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+ * WebProcess/WebPage/qt/WebPageQt.cpp:
+ (WebKit::WebPage::platformInitialize):
+
+2012-01-20 Mario Sanchez Prada <msanchez@igalia.com>
+
+ [GTK] Expose accessibility hierarchy in WebKit2 to ATK/AT-SPI based ATs
+ https://bugs.webkit.org/show_bug.cgi?id=72589
+
+ Reviewed by Martin Robinson.
+
+ Expose the accessibility hierarchy in the multi-process
+ architecture of WK2 through AtkSocket and AtkPlug.
+
+ Make the WebView widget return an AtkSocket when calling to
+ gtk_widget_get_accessible().
+
+ * GNUmakefile.am: Add new files.
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkit_web_view_base_init):
+ (webkitWebViewBaseGetAccessible):
+ (webkit_web_view_base_class_init):
+ * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp: Added.
+ (webkitWebViewBaseAccessibleWidgetFinalize):
+ (webkitWebViewBaseAccessibleWidgetDestroyed):
+ (webkitWebViewBaseAccessibleInitialize):
+ (webkitWebViewBaseAccessibleRefStateSet):
+ (webkitWebViewBaseAccessibleGetIndexInParent):
+ (webkit_web_view_base_accessible_init):
+ (webkit_web_view_base_accessible_class_init):
+ (webkitWebViewBaseAccessibleNew):
+ * UIProcess/API/gtk/WebKitWebViewBaseAccessible.h: Added.
+
+ Make the WebPage create an AtkPlug on its initialization and
+ sending the ID of that plug to the UI process, so it can embed the
+ plug in the socket.
+
+ Also, take care of all the needed wrapping around the WebCore's
+ accessibility objects, exposing them in the UI process's
+ accessibility hierarchy thanks to the socket-plug connection.
+
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::accessibilityPlugID):
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/gtk/WebPageProxyGtk.cpp:
+ (WebKit::WebPageProxy::bindAccessibilityTree):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ * WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp: Added.
+ (accessibilityRootObjectWrapper):
+ (webPageAccessibilityObjectInitialize):
+ (webPageAccessibilityObjectGetIndexInParent):
+ (webPageAccessibilityObjectGetNChildren):
+ (webPageAccessibilityObjectRefChild):
+ (web_page_accessibility_object_init):
+ (web_page_accessibility_object_class_init):
+ (webPageAccessibilityObjectNew):
+ (webPageAccessibilityObjectRefresh):
+ * WebProcess/WebPage/gtk/WebPageAccessibilityObject.h: Added.
+ * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+ (WebKit::WebPage::platformInitialize):
+ (WebKit::WebPage::updateAccessibilityTree):
+
+ New unit test for checking accessibility support in WK2GTK.
+
+ * UIProcess/API/gtk/tests/AccessibilityTestServer.cpp: Added.
+ (loadChangedCallback): Notify the parent process (the test)
+ when ready.
+ (main):
+ * UIProcess/API/gtk/tests/GNUmakefile.am:
+ * UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp: Added.
+ (stopTestServer):
+ (sigAbortHandler):
+ (testServerMonitorThreadFunc):
+ (startTestServerMonitor):
+ (startTestServer):
+ (checkAtspiAccessible):
+ (findTestServerApplication):
+ (testAtspiBasicHierarchy):
+ (beforeAll):
+ (afterAll):
+
+2012-01-19 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] Public API watch dog auto test.
+ https://bugs.webkit.org/show_bug.cgi?id=73922
+
+ Reviewed by Simon Hausmann.
+
+ This test aims to prevent unintended/unapproved
+ modifications to the public QML API.
+
+ * UIProcess/API/qt/tests/publicapi/publicapi.pro: Added.
+ * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp: Added.
+ (isCheckedEnum):
+ (isCheckedClass):
+ (checkKnownType):
+ (gatherAPI):
+ (tst_publicapi::publicAPI):
+
+2012-01-13 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] Trigger forcing accelerated compositing from the UI process side.
+ https://bugs.webkit.org/show_bug.cgi?id=76296
+
+ Reviewed by Noam Rosenthal.
+
+ Some messages can be sent from the web view to the LayerTreeHost before
+ accelerated compositing is entered on the web process and signaled back.
+ By letting the UI process decide if AC has to be forced, we can create
+ the LayerTreeHostProxy earlier to send messages to the web process while
+ AC is being entered there.
+
+ This fixes the first visible content rect message not being received when
+ loading pages from the disk.
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initialize):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+ * WebProcess/WebPage/qt/WebPageQt.cpp:
+ (WebKit::WebPage::platformInitialize):
+
+2012-01-20 Alexandru Chiculita <achicu@adobe.com>
+
+ CSS Shaders: Add a Settings flag to enable/disable CSS Shaders at runtime
+ https://bugs.webkit.org/show_bug.cgi?id=76444
+
+ Reviewed by Nikolas Zimmermann.
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetCSSCustomFilterEnabled):
+ (WKPreferencesGetCSSCustomFilterEnabled):
+ * UIProcess/API/C/WKPreferencesPrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
+2012-01-19 Sam Weinig <sam@webkit.org>
+
+ Replace improper #import with an #include.
+
+ * UIProcess/Plugins/PluginProcessProxy.cpp:
+ Fixes warnings.
+
+2012-01-18 Sam Weinig <sam@webkit.org>
+
+ Move RunLoop to WebCore/platform
+ https://bugs.webkit.org/show_bug.cgi?id=76471
+
+ Reviewed by Anders Carlsson.
+
+ * GNUmakefile.am:
+ * Platform/CoreIPC/Connection.cpp:
+ * Platform/CoreIPC/Connection.h:
+ * Platform/CoreIPC/mac/ConnectionMac.cpp:
+ * PluginProcess/PluginControllerProxy.h:
+ * PluginProcess/PluginProcess.cpp:
+ * PluginProcess/PluginProcess.h:
+ * PluginProcess/WebProcessConnection.cpp:
+ * PluginProcess/mac/PluginProcessMainMac.mm:
+ * PluginProcess/qt/PluginProcessMainQt.cpp:
+ * Shared/ChildProcess.cpp:
+ * Shared/ChildProcess.h:
+ * Target.pri:
+ * UIProcess/API/mac/FindIndicatorWindow.h:
+ * UIProcess/API/mac/WKView.mm:
+ * UIProcess/DrawingAreaProxyImpl.h:
+ * UIProcess/Launcher/ThreadLauncher.cpp:
+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ * UIProcess/Launcher/mac/ThreadLauncherMac.mm:
+ * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
+ * UIProcess/Launcher/qt/ThreadLauncherQt.cpp:
+ * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
+ * UIProcess/Launcher/win/ThreadLauncherWin.cpp:
+ * UIProcess/LayerTreeHostProxy.h:
+ * UIProcess/Plugins/PluginProcessProxy.cpp:
+ * UIProcess/ResponsivenessTimer.cpp:
+ * UIProcess/ResponsivenessTimer.h:
+ * UIProcess/TiledDrawingAreaProxy.h:
+ * UIProcess/VisitedLinkProvider.h:
+ * UIProcess/WebConnectionToWebProcess.cpp:
+ * UIProcess/WebConnectionToWebProcess.h:
+ * UIProcess/WebContext.cpp:
+ * UIProcess/win/WebView.cpp:
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
+ * WebProcess/Plugins/PluginView.h:
+ * WebProcess/WebConnectionToUIProcess.cpp:
+ * WebProcess/WebConnectionToUIProcess.h:
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ * WebProcess/WebPage/DrawingAreaImpl.h:
+ * WebProcess/WebPage/EventDispatcher.cpp:
+ * WebProcess/WebPage/PageOverlay.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebProcess.cpp:
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::runLoop):
+ * WebProcess/gtk/WebProcessMainGtk.cpp:
+ * WebProcess/mac/WebProcessMainMac.mm:
+ * WebProcess/qt/WebProcessMainQt.cpp:
+ * WebProcess/win/WebProcessMainWin.cpp:
+ * win/WebKit2.vcproj:
+ Remove RunLoop code and update #includes.
+
+2012-01-18 Ada Chan <adachan@apple.com>
+
+ Need a WebKit2 API for setting media volume
+ https://bugs.webkit.org/show_bug.cgi?id=76560
+
+ Reviewed by Dan Bernstein.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode): Encode the mediaVolume parameter.
+ (WebKit::WebPageCreationParameters::decode): Decode the mediaVolume parameter.
+ * Shared/WebPageCreationParameters.h:
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetMediaVolume): Call WebPageProxy::setMediaVolume().
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Initialize new data member m_mediaVolume.
+ (WebKit::WebPageProxy::setMediaVolume): Bail if the volume hasn't changed. Update m_mediaVolume
+ and bail if the page is no longer valid. Otherwise, send a WebPage::SetMediaVolume message to
+ the web process.
+ (WebKit::WebPageProxy::creationParameters): Add media volume to the creation parameters.
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Initialize media volume from the WebPageCreationParameters.
+ (WebKit::WebPage::setMediaVolume): Call Page::setMediaVolume().
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Add the SetMediaVolume message.
+
+2012-01-19 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] WebKit2 GTK+ API public headers are not installed
+ https://bugs.webkit.org/show_bug.cgi?id=76626
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am: Rename webkit2gtk_headers as
+ libwebkit2gtkinclude_HEADERS to match libwebkit2gtkincludedir so
+ that headers are installed during make install.
+
+2012-01-19 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add print-backgrounds setting to WebKit2 GTK+ API
+ https://bugs.webkit.org/show_bug.cgi?id=76616
+
+ Reviewed by Martin Robinson.
+
+ * UIProcess/API/gtk/WebKitSettings.cpp:
+ (webKitSettingsSetProperty):
+ (webKitSettingsGetProperty):
+ (webkit_settings_class_init):
+ (webkit_settings_get_print_backgrounds):
+ (webkit_settings_set_print_backgrounds):
+ * UIProcess/API/gtk/WebKitSettings.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt:
+ * UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
+ (testWebKitSettings):
+
+2012-01-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ [Qt] Handle the layers visible rect calculation on the web process.
+ https://bugs.webkit.org/show_bug.cgi?id=74720
+
+ Reviewed by Noam Rosenthal.
+
+ The layers now get their visible rect on the web process through the
+ root layer when the UI process call setVisibleContentRectAndScale,
+ previously only used for the non-composited content layer.
+ The rect is then carried down the layers in the tree which apply it the inverse
+ of their transform before handing it to their tiled backing store.
+
+ This ensures that new layers get a proper visible rect right on creation,
+ and also that simultaneous visible rect and scale changes are applied synchronously.
+
+ This patch also uses clampedBoundsOfProjectedQuad instead of mapRect
+ to transform the visible rect correctly for 3D transformed layers.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initializeDesktop):
+ (QQuickWebViewPrivate::initializeTouch):
+ (QQuickWebViewPrivate::updateDesktopViewportSize):
+ (QQuickWebViewPrivate::updateTouchViewportSize):
+ (QQuickWebView::geometryChanged):
+ Make sure that the visible rect is updated for the desktop view as well.
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ * UIProcess/LayerTreeHostProxy.h:
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToCurrentGLContext):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::setChildren):
+ (WebCore::WebGraphicsLayer::addChild):
+ (WebCore::WebGraphicsLayer::addChildAtIndex):
+ (WebCore::WebGraphicsLayer::addChildAbove):
+ (WebCore::WebGraphicsLayer::addChildBelow):
+ (WebCore::WebGraphicsLayer::replaceChild):
+ (WebCore::WebGraphicsLayer::setMaskLayer):
+ (WebCore::WebGraphicsLayer::syncCompositingState):
+ (WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
+ (WebCore::WebGraphicsLayer::setVisibleContentRectAndScale):
+ (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+ (WebCore::WebGraphicsLayer::computeTransformedVisibleRect):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ * WebProcess/WebPage/LayerTreeHost.messages.in:
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+
+2012-01-18 Jon Lee <jonlee@apple.com>
+
+ Another build fix for r105364.
+
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess): Missing #if.
+
+2012-01-18 Jon Lee <jonlee@apple.com>
+
+ Build fix for r105364. Unreviewed.
+
+ * WebProcess/Notifications/WebNotificationManager.cpp: Wrap methods in #if ENABLE(NOTIFICATIONS)
+ (WebKit::WebNotificationManager::initialize):
+ (WebKit::WebNotificationManager::didUpdateNotificationDecision):
+ (WebKit::WebNotificationManager::didRemoveNotificationDecisions):
+ (WebKit::WebNotificationManager::policyForOrigin):
+
+2012-01-18 Jon Lee <jonlee@apple.com>
+
+ [WK2] Sync call for notifications permissions causes flashes on gmail.com
+ https://bugs.webkit.org/show_bug.cgi?id=76570
+ <rdar://problem/10647155>
+
+ Reviewed by Anders Carlsson and Sam Weinig.
+
+ The website code figures out the permission level for its security origin by making a JS call (called
+ checkPermission()) that is synchronous. The way this was implemented was to make a synchronous call from
+ the WebNotificationManager to its proxy. That call goes to the WK API layer to find the policy, and
+ returns that policy back to the JS.
+
+ The synchronous nature of this call causes the white flash to appear in certain cases.
+
+ To fix this, the checkPermission() call is handled all within the web process, instead of going up into
+ the UI process. To do this, the web process initializes the WebNotificationManager with a copy of the
+ notification permissions. Any time the WK client makes a change to the permissions, that gets sent down
+ asynchronously, and the cached copy in WebNotificationManager gets updated.
+
+ A page's settings may disable notifications altogether. Before, this would have been handled by the WK
+ client, since retrieving the permissions were also handled there. Now that the lookup happens in the web
+ process, we need to add that setting in WebCore.
+
+ == Update notification permissions to use the security origin's string representation, rather than its
+ database identifier.
+
+ * UIProcess/Notifications/WebNotification.cpp:
+ (WebKit::WebNotification::WebNotification):
+ * UIProcess/Notifications/WebNotification.h:
+ (WebKit::WebNotification::create):
+ * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+ (WebKit::WebNotificationManagerProxy::show): Registering the provider with the manager is handled in
+ initialize() now.
+ (WebKit::WebNotificationManagerProxy::cancel): Registering the provider with the manager is handled in
+ initialize() now.
+ * UIProcess/Notifications/WebNotificationManagerProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestNotificationPermission):
+ (WebKit::WebPageProxy::showNotification):
+ * UIProcess/WebPageProxy.h:
+
+ * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
+ (WebKit::NotificationPermissionRequestManager::startRequest): Only start the request if notifications
+ are enabled.
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::show): Only show notification is they are enabled.
+ (WebKit::WebNotificationManager::cancel): Only cancel if notifications are enabled.
+
+ == Remove synchronous message to get policy for a given origin. Instead, use the cached copy in
+ WebNotificationManager.
+
+ * WebProcess/Notifications/WebNotificationManager.h:
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::policyForOrigin): Looks for the permission in the cached copy.
+ If it doesn't exist, return NotificationPresenter::PermissionNotAllowed.
+ * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
+ (WebKit::NotificationPermissionRequestManager::permissionLevel): Update permissionLevel to use
+ policyForOrigin().
+
+ Remove old WK API function to get the policy. Because this function was the only synchronous message,
+ we remove the sync-message-related functions also. Also, add in some #includes that might have been
+ omitted in prior patches.
+
+ * UIProcess/API/C/WKNotificationProvider.h:
+ * UIProcess/Notifications/WebNotificationManagerProxy.messages.in: Remove NotificationPermissionLevel.
+ * UIProcess/Notifications/WebNotificationManagerProxy.h:
+ * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+
+ * UIProcess/Notifications/WebNotificationProvider.h: Remove policyForNotificationPermissionAtOrigin().
+ * UIProcess/Notifications/WebNotificationProvider.cpp:
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didReceiveSyncMessage): Remove conditional to forward sync messages to the
+ notification manager proxy.
+
+ == Mechanism for client to update the permissions copy in WebNotificationManager.
+
+ * WebProcess/Notifications/WebNotificationManager.messages.in: Add new messages
+ didUpdateNotificationDecision and didRemoveNotificationDecisions.
+ * WebProcess/Notifications/WebNotificationManager.h:
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::initialize):
+ (WebKit::WebNotificationManager::didUpdateNotificationDecision): Update the entry.
+ (WebKit::WebNotificationManager::didRemoveNotificationDecisions): Remove the entry.
+
+ * UIProcess/Notifications/WebNotificationManagerProxy.h:
+ * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+ (WebKit::WebNotificationManagerProxy::providerDidUpdateNotificationPolicy):
+ (WebKit::WebNotificationManagerProxy::providerDidRemoveNotificationPolicies): Convert the array of
+ origins to remove, and send it to the WebNotificationManager.
+
+ * UIProcess/API/C/WKNotificationManager.h: Expose these update functions as WK API.
+ * UIProcess/API/C/WKNotificationManager.cpp:
+ (WKNotificationManagerProviderDidUpdateNotificationPolicy):
+ (WKNotificationManagerProviderDidRemoveNotificationPolicies):
+
+ == Initialize WebNotificationManager with permissions. Initialize WebPage with notifications enabled bit
+ from settings.
+
+ * Shared/WebProcessCreationParameters.h: Add map of notification permissions as part of the
+ parameters.
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode):
+ (WebKit::WebProcessCreationParameters::decode):
+
+ * UIProcess/Notifications/WebNotificationProvider.h: Retrieve copy of existing notification permissions.
+ * UIProcess/Notifications/WebNotificationProvider.cpp:
+ * UIProcess/API/C/WKNotificationProvider.h: Add WK API to get a copy of the permissions.
+
+ * UIProcess/Notifications/WebNotificationManagerProxy.h: Add populateCopyOfNotificationPermissions().
+ * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+ (WebKit::WebNotificationManagerProxy::initializeProvider): Add the manager at the time of initialization.
+ Similar calls in show() and cancel() are removed in following patch.
+ (WebKit::WebNotificationManagerProxy::populateCopyOfNotificationPermissions): Clear the existing copy.
+ Populate with origin string, and whether that origin is allowed to post. If no decision has been made
+ by the user, then there should be no item in this dictionary.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::ensureWebProcess): When the web process is initialized, we get a copy of the
+ permissions, and send it to the web process to initialize the notification manager.
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess): Initialize the notification manager.
+
+ * WebProcess/Notifications/WebNotificationManager.h:
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::initialize): Initialize the permissions copy.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences): Set notifications enabled bit from settings.
+
+ == Expose toString() method from WebCore::SecurityOrigin. Work is also towards bug 74956.
+
+ * Shared/API/c/WKSecurityOrigin.h: Refactor WKSecurityOriginCreateFromIdentifier to
+ WKSecurityOriginCreateFromDatabaseIdentifier and add WKSecurityOriginCreateFromString function.
+ * Shared/API/c/WKSecurityOrigin.cpp:
+ (WKSecurityOriginCreateFromString):
+ (WKSecurityOriginCreateFromDatabaseIdentifier):
+ (WKSecurityOriginCopyToString):
+
+ Refactor WebSecurityOrigin::create() to WebSecurityOrigin::createFromDatabaseIdentifier()
+ and add WebSecurityOrigin::createFromString().
+
+ * Shared/WebSecurityOrigin.h:
+ (WebKit::WebSecurityOrigin::createFromString):
+ (WebKit::WebSecurityOrigin::createFromDatabaseIdentifier):
+ (WebKit::WebSecurityOrigin::toString): Added function.
+
+ Refactor with renamed createFromDatabaseIdentifier() method.
+
+ * UIProcess/WebDatabaseManagerProxy.cpp:
+ (WebKit::WebDatabaseManagerProxy::didGetDatabasesByOrigin):
+ (WebKit::WebDatabaseManagerProxy::didGetDatabaseOrigins):
+ (WebKit::WebDatabaseManagerProxy::didModifyOrigin):
+ (WebKit::WebDatabaseManagerProxy::didModifyDatabase):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::exceededDatabaseQuota):
+ (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
+
+ == Add WK API calls to change notificationsEnabled bit in WebCore::Settings.
+
+ * Shared/WebPreferencesStore.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetNotificationsEnabled):
+ (WKPreferencesGetNotificationsEnabled):
+ * UIProcess/API/C/WKPreferences.h:
+
+2012-01-18 Anders Carlsson <andersca@apple.com>
+
+ REGRESSION (r88886): Tabs restore blank when running Safari with a nightly build for the first time
+ https://bugs.webkit.org/show_bug.cgi?id=76587
+ <rdar://problem/9739135>
+
+ Reviewed by Sam Weinig.
+
+ * UIProcess/cf/WebPageProxyCF.cpp:
+ Change CurrentSessionStateDataVersion back to 2.
+
+ * WebProcess/WebPage/DecoderAdapter.cpp:
+ (WebKit::DecoderAdapter::decodeString):
+ * WebProcess/WebPage/EncoderAdapter.cpp:
+ (WebKit::EncoderAdapter::encodeString):
+ Backport the CoreIPC string encoding and decoding functions that were in place prior to r88886.
+
+2012-01-17 Alexey Proskuryakov <ap@apple.com>
+
+ [Mac] Add a flag telling plug-in if it can enter sandbox
+ https://bugs.webkit.org/show_bug.cgi?id=76467
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_GetValue): Added a private flag.
+
+2012-01-18 Eric Carlson <eric.carlson@apple.com>
+
+ Provide access to user's list of preferred languages
+ https://bugs.webkit.org/show_bug.cgi?id=76138
+
+ Reviewed by Alexey Proskuryakov.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode): Encode the languages array.
+ (WebKit::WebProcessCreationParameters::decode): Decode the languages array.
+ * Shared/WebProcessCreationParameters.h:
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::languageChanged): Override the WebProcess userPreferredLanguages.
+ (WebKit::WebContext::ensureWebProcess): Initialize parameters.languages.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeWebProcess): Override user languages array.
+ (WebKit::WebProcess::userPreferredLanguagesChanged): Ditto.
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in: Define UserPreferredLanguagesChanged.
+
+ * win/WebKit2.def: Export the new functions.
+ * win/WebKit2CFLite.def: Ditto.
+
+2012-01-18 Luciano Wolf <luciano.wolf@openbossa.org>
+
+ [Qt][WK2] Broken build with undefined reference to shm_open and shm_unlink
+ https://bugs.webkit.org/show_bug.cgi?id=76538
+
+ Reviewed by Tor Arne Vestbø.
+
+ The -lrt parameter was coming before -lWebKit2 during linkage.
+
+ Moved rt lib inclusion from Source/api.pri to WebKit2.pri as it should be aware
+ of its own dependencies instead of letting WebKit guess about. Letting
+ it on api.pri can lead to a wrong parameter's order during linker phase.
+ Ubuntu 11.10 was giving errors about SharedMemory (shm_open and
+ shm_unlink undefined symbols).
+
+ The issue was fixed with the help of Aloisio Almeida and Lauro Venancio.
+
+ * WebKit2.pri:
+
+2012-01-18 Carlos Garnacho <carlosg@gnome.org>
+
+ [GTK] Listen to GDK_SCROLL_MASK
+ https://bugs.webkit.org/show_bug.cgi?id=76529
+
+ Set GDK_SCROLL_MASK explicitly, as WebKitWebViewBase does handle
+ scroll events, scrolling currently works because GTK+ happens
+ to send such events to widgets listening to GDK_BUTTON_PRESS_MASK,
+ but this isn't the intended behavior, so it's subject to change.
+
+ Reviewed by Martin Robinson.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseRealize):
+
+2012-01-18 Andras Becsi <andras.becsi@nokia.com>
+
+ [Qt][WK2] Fix the debug build.
+
+ Unreviewed.
+
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (setInputPanelVisible): Remove assertion from non-member function.
+
+2012-01-12 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Zoom in to the focused node only when vkb starts becoming visible
+ https://bugs.webkit.org/show_bug.cgi?id=76174
+
+ Reviewed by Simon Hausmann.
+
+ Remove the old code which always zoomed in when something got focus,
+ even via JavaScript, and replaced it with code checking the state of
+ the Qt input panel.
+
+ Also make sure that we do not zoom in or request the input panel if
+ the item is not focused.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/qt/QtPageClient.cpp:
+ * UIProcess/qt/QtPageClient.h:
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::QtWebPageEventHandler):
+ (QtWebPageEventHandler::~QtWebPageEventHandler):
+ (QtWebPageEventHandler::inputPanelVisibleChanged):
+ * UIProcess/qt/QtWebPageEventHandler.h:
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::respondToChangedSelection):
+
+2012-01-18 Shinya Kawanaka <shinyak@google.com>
+
+ Move ShadowContentElement from dom/ to html/ and make ShadowContentElement subclass of HTMLElement.
+ https://bugs.webkit.org/show_bug.cgi?id=76241
+
+ Reviewed by Dimitri Glazkov.
+
+ * win/WebKit2.def: Exposed necessary symbols.
+ * win/WebKit2CFLite.def: ditto.
+
+2012-01-17 Hajime Morrita <morrita@chromium.org>
+
+ [Internals] Should be able to access corresponding Document object.
+ https://bugs.webkit.org/show_bug.cgi?id=76425
+
+ Reviewed by Adam Barth.
+
+ * win/WebKit2.def: Added exporting symbols.
+ * win/WebKit2CFLite.def: Added exporting symbols.
+
+2012-01-17 Matthew Delaney <mdelaney@apple.com>
+
+ On post-Lion releases, preserve the Lion behavior where WebKit explicitly calls -setGeometryFlipped on the hosting layer for applications that were linked on Lion or earlier.
+ <rdar://problem/10692025>
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: Init new function.
+ (InitWebCoreSystemInterface):
+
+2012-01-17 Sam Weinig <sam@webkit.org>
+
+ Rename quickLookPreviewItemsAtWindowLocation: to quickLookWithEvent:
+ <rdar://problem/10688913>
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView quickLookWithEvent:]):
+
+2012-01-17 Sam Weinig <sam@webkit.org>
+
+ Add helper macro for forward declaring objective-c classes
+ https://bugs.webkit.org/show_bug.cgi?id=76485
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/WebCoreSupport/WebDragClient.h:
+ Deploy OBJC_CLASS for a little code reduction.
+
+ * config.h:
+ Remove duplicate copy of OBJC_CLASS.
+
+2012-01-17 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] [WK2] WebKitPrivate should include the entire WebKit2 C API
+ https://bugs.webkit.org/show_bug.cgi?id=76345
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Isolate all of the WebKit2 C API includes into WebKitPrivate.h and no longer
+ include anything other than WebKit2.h for the C API.
+
+ * UIProcess/API/gtk/WebKitBackForwardList.cpp: Use WebKitPrivate.h now.
+ * UIProcess/API/gtk/WebKitBackForwardListItem.cpp: Ditto.
+ * UIProcess/API/gtk/WebKitPrivate.h: Add WebKit2.h, WKAPICast.h and WKRetainPtr.h includes.
+ * UIProcess/API/gtk/WebKitSettings.cpp: Use WebKitPrivate.h.
+ * UIProcess/API/gtk/WebKitUIClient.cpp: Ditto.
+ * UIProcess/API/gtk/WebKitWebContext.cpp: Ditto.
+ * UIProcess/API/gtk/WebKitWebView.cpp: Ditto.
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp: Ditto.
+ * UIProcess/API/gtk/WebKitWindowProperties.cpp: Ditto.
+
+2012-01-17 Alexander Færøy <alexander.faeroy@nokia.com>
+
+ [Qt] Implement HTTP authentication QML API
+ https://bugs.webkit.org/show_bug.cgi?id=75535
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ This patch implements the QML API for handling HTTP authentication.
+ The implementation uses a syncronous message between the WebProcess
+ and the UIProcess which is called when the authenticationRequired
+ signal is emitted from QNAM.
+
+ Based in part upon patch by Peter Hartmann.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::QQuickWebViewPrivate):
+ (QQuickWebViewPrivate::handleAuthenticationRequiredRequest):
+ (QQuickWebViewExperimental::authenticationDialog):
+ (QQuickWebViewExperimental::setAuthenticationDialog):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::authenticationRequiredRequest):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/qt/QtDialogRunner.cpp:
+ (AuthenticationDialogContextObject::AuthenticationDialogContextObject):
+ (AuthenticationDialogContextObject::hostname):
+ (AuthenticationDialogContextObject::realm):
+ (AuthenticationDialogContextObject::prefilledUsername):
+ (AuthenticationDialogContextObject::accept):
+ (AuthenticationDialogContextObject::reject):
+ (QtDialogRunner::initForAuthentication):
+ * UIProcess/qt/QtDialogRunner.h:
+ (QtDialogRunner::username):
+ (QtDialogRunner::password):
+ (QtDialogRunner::onAuthenticationAccepted):
+ * UIProcess/qt/QtPageClient.cpp:
+ (QtPageClient::handleAuthenticationRequiredRequest):
+ * UIProcess/qt/QtPageClient.h:
+ * WebProcess/qt/QtNetworkAccessManager.cpp:
+ (WebKit::QtNetworkAccessManager::QtNetworkAccessManager):
+ (WebKit::QtNetworkAccessManager::onAuthenticationRequired):
+ * WebProcess/qt/QtNetworkAccessManager.h:
+
+2012-01-16 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/10702758> REGRESSION: Every Safari Reader WKView leaks
+
+ Reviewed by John Sullivan and Ada Chan.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView viewDidMoveToWindow]): Since this method can be called multiple times in a row
+ while [self window] is non-nil, check if there isn’t already an event monitor before adding
+ a new one.
+
+2012-01-16 Anders Carlsson <andersca@apple.com>
+
+ Crash when calling SecItemAdd with a null result pointer
+ https://bugs.webkit.org/show_bug.cgi?id=76407
+ <rdar://problem/10696087>
+
+ Reviewed by Brady Eidson.
+
+ Add null check.
+
+ * WebProcess/mac/SecItemShimMethods.mm:
+ (WebKit::webSecItemAdd):
+
+2012-01-16 Jon Lee <jonlee@apple.com>
+
+ Build fix for r105086.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2012-01-16 Zeno Albisser <zeno@webkit.org>
+
+ [Qt] Fix QT_VERSION related warnings when building on Mac OS X
+ https://bugs.webkit.org/show_bug.cgi?id=76340
+
+ This bug was caused by r104826.
+ As was already mentioned for https://bugs.webkit.org/show_bug.cgi?id=57239
+ we should not use "using namespace WebCore" in header files,
+ because it might cause ambiguous references.
+ This patch reverts the changes from r104826 and r104981
+ and removes the "using namespace WebCore" statement from
+ two header files.
+
+ Reviewed by Tor Arne Vestbø.
+
+ * Shared/WebLayerTreeInfo.h:
+ (WebKit::WebLayerUpdateInfo::WebLayerUpdateInfo):
+ (WebKit::WebLayerAnimation::WebLayerAnimation):
+ * UIProcess/LayerTreeHostProxy.h:
+ (WebKit::LayerTreeHostProxy::layerByID):
+ (WebKit::LayerTreeHostProxy::rootLayer):
+ (WebKit::LayerTreeHostProxy::notifyAnimationStarted):
+ (WebKit::LayerTreeHostProxy::notifySyncRequired):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+
+2012-01-16 Alexander Færøy <alexander.faeroy@nokia.com>
+
+ [Qt] Remove references to PagePointer in the FrameNetworkingContext
+ https://bugs.webkit.org/show_bug.cgi?id=76342
+
+ Reviewed by Simon Hausmann.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::createNetworkingContext):
+ * WebProcess/qt/QtNetworkAccessManager.cpp:
+ (WebKit::QtNetworkAccessManager::obtainOriginatingWebPage):
+ * WebProcess/qt/QtNetworkAccessManager.h:
+
+2012-01-14 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/10696295> Crash in WebProcess at com.apple.CFNetwork: URLCredentialStorage::CreateCurrentPersistentCredentials + 298
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/mac/SecItemShimMethods.mm:
+ (WebKit::initializeSecItemShim): Removed an early return that was accidentally added in r105008.
+
+2012-01-13 Anders Carlsson <andersca@apple.com>
+
+ Delay updating the root compositing layer if the layer tree state is frozen
+ https://bugs.webkit.org/show_bug.cgi?id=76316
+
+ Reviewed by Dan Bernstein.
+
+ When the layer tree is frozen, stash the root layer in m_pendingRootCompositingLayer and set it in flushLayers.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
+ (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+
+2012-01-13 Anders Carlsson <andersca@apple.com>
+
+ Implement TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen
+ https://bugs.webkit.org/show_bug.cgi?id=76308
+
+ Reviewed by Sam Weinig.
+
+ Keep track of whether the layer tree state is frozen and suspend/resume the layer flush scheduler accordingly.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+ (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
+ (WebKit::TiledCoreAnimationDrawingArea::layerTreeStateIsFrozen):
+ (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerSync):
+ (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+
+2012-01-13 Anders Carlsson <andersca@apple.com>
+
+ Disable implicit animations when setting the root compositing layer
+ https://bugs.webkit.org/show_bug.cgi?id=76304
+
+ Reviewed by Sam Weinig.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
+
+2012-01-13 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ TextureMapper: Extract layer transform logic to a LayerTransform class.
+ https://bugs.webkit.org/show_bug.cgi?id=76291
+
+ Reviewed by Noam Rosenthal.
+
+ Move the paint call before the visible rect collection to make sure that
+ transforms are computed. This will increase the delay for the visible rects
+ to get to the WebProcess until we move this calculation out of the UI Process.
+ This fixes an assert triggering in LayerTransform::combineTransforms.
+
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::paintToCurrentGLContext):
+
+2012-01-13 Brent Fulgham <bfulgham@webkit.org>
+
+ [WinCairo] Build correction.
+
+ * Shared/WebGraphicsContext.h: Use proper include path for RefPtrCairo.h.
+
+2012-01-12 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] [WebKit2] WebKitURIRequest and WebKitURIResponse should wrap the corresponding WebCore classes
+ https://bugs.webkit.org/show_bug.cgi?id=74478
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Have WebKitURIRequest wrap a ResourceRquesst and WebKitURIResponse wrap a ResourceResponse.
+ They are the WebCore types they are meant to represent and we will need to expose more
+ information from them in the future to make them useful. Later we can have ResourceResponse
+ generate a SoupMessage lazily if necessary.
+
+ * GNUmakefile.am:
+ * UIProcess/API/gtk/WebKitURIRequest.cpp:
+ (webkit_uri_request_class_init): Remove the set property vmethod.
+ (webkit_uri_request_new): The URI property is no longer settable.
+ (webkitURIRequestCreateForResourceRequest): Added this private constructor.
+ (webkit_uri_request_get_uri): Now we just get the URI directly from the ResourceRequest.
+ * UIProcess/API/gtk/WebKitURIResponse.cpp:
+ (webkit_uri_response_class_init): Remove the set property vmethod.
+ (webkit_uri_response_get_uri): Get the URI directly from the ResourceReponse.
+ (webkit_uri_response_get_status_code): Get the status code directly from the ResourceResponse.
+ (webkit_uri_response_get_content_length): Get the content length directly from the ResourceResponse.
+ (webkitURIResponseCreateForResourceResponse): Added this private constructor.
+ * UIProcess/API/gtk/WebKitURIResponsePrivate.h: Removed unnecessary methods.
+
+2012-01-12 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Qt][WK2] WebProcesses crashes when composited reflections/masks are present
+ https://bugs.webkit.org/show_bug.cgi?id=75883
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Make sure masks and replica layers can access layerTreeTileClient. Let masks
+ have the right contents/visible rect so that they can render content tiles.
+ Default the mask's size to be the layer's size.
+
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::WebGraphicsLayer):
+ (WebCore::WebGraphicsLayer::setSize):
+ (WebCore::WebGraphicsLayer::setMaskLayer):
+ (WebCore::WebGraphicsLayer::setReplicatedByLayer):
+ (WebCore::WebGraphicsLayer::syncCompositingState):
+ (WebCore::WebGraphicsLayer::setContentsScale):
+ (WebCore::WebGraphicsLayer::setVisibleContentRect):
+ (WebCore::WebGraphicsLayer::tiledBackingStoreContentsRect):
+ (WebCore::WebGraphicsLayer::updateTileBuffersRecursively):
+ (WebCore::WebGraphicsLayer::layerTreeTileClient):
+ (WebCore::WebGraphicsLayer::purgeBackingStores):
+ (WebCore::WebGraphicsLayer::recreateBackingStoreIfNeeded):
+ (WebCore::WebGraphicsLayer::setLayerTreeTileClient):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ (WebCore::WebGraphicsLayer::maskTarget):
+ (WebCore::WebGraphicsLayer::setMaskTarget):
+
+2012-01-12 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Set the input method hints on the QtQuick item
+ https://bugs.webkit.org/show_bug.cgi?id=76169
+
+ Reviewed by Simon Hausmann.
+
+ Set the input method hints given the HTMLElement type and state.
+
+ * Shared/EditorState.cpp:
+ (WebKit::EditorState::encode):
+ (WebKit::EditorState::decode):
+ * Shared/EditorState.h:
+ (WebKit::EditorState::EditorState):
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::updateTextInputState):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::editorState):
+
+2012-01-12 Eunmi Lee <eunmi15.lee@samsung.com>
+
+ [EFL][WK2] Update and show ewk_view with updated webpage.
+ https://bugs.webkit.org/show_bug.cgi?id=76023
+
+ Reviewed by Andreas Kling.
+
+ Update ewk_view with BackingStore image which is rendered webpage
+ image by WebProcess, and show updated image's area when
+ PageClientImpl::setViewNeedsDisplay() is called.
+ The ewk_view_display() function is used to display updated area of
+ evas_object_image and the ewk_view_image_data_set() function is used
+ to set evas_object_image's data with rendered webpage.
+
+ * UIProcess/API/efl/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::setViewNeedsDisplay):
+ * UIProcess/API/efl/ewk_private.h: Added.
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_add):
+ (ewk_view_display):
+ (ewk_view_image_data_set):
+ * UIProcess/cairo/BackingStoreCairo.cpp:
+ (WebKit::BackingStore::incorporateUpdate):
+
+2012-01-12 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [EFL][WK2] Network is not available when SOUP is enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=76112
+
+ Reviewed by Andreas Kling.
+
+ ecore_main_loop_glib_integrate should be called to use glib based library
+ such as SOUP.
+
+ * WebProcess/efl/WebProcessMainEfl.cpp:
+ (WebKit::WebProcessMainEfl):
+
+2012-01-12 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [EFL][WK2] Add PLATFORM(EFL) in SharedMemory.h, WebProcessStore.h, WebEditorClient.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=76115
+
+ Reviewed by Andreas Kling.
+
+ This patch added PLATFORM(EFL) guard in SharedMemory.h to use UNIX_DOMAIN_SOCKETS
+ and WebProcessStore.h to have font family preference
+ and WebEditorClient.cpp to use platform specific handleKeyboardEvent(),
+ handleInputMethodKeydown()
+
+ * Platform/SharedMemory.h:
+ * Shared/WebPreferencesStore.h:
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+
+2012-01-11 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Web process should use the same locale than UI process
+ https://bugs.webkit.org/show_bug.cgi?id=76054
+
+ Reviewed by Gustavo Noronha Silva.
+
+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+ (WebKit::childSetupFunction): Make child process use the same
+ locale than its parent.
+
+2012-01-11 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [WK2] Share cairo specific codes with EFL port.
+ https://bugs.webkit.org/show_bug.cgi?id=75457
+
+ Reviewed by Brent Fulgham.
+
+ Change PLATFORM(GTK) to USE(CAIRO) in WebGraphicsContext{h,cpp} to share
+ with EFL port.
+
+ * Shared/WebGraphicsContext.cpp:
+ (WebKit::WebGraphicsContext::WebGraphicsContext):
+ * Shared/WebGraphicsContext.h:
+
+2012-01-11 Beth Dakin <bdakin@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75904
+ WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all
+ the time
+ -and corresponding-
+ <rdar://problem/10498816>
+
+ Reviewed by Darin Adler.
+
+ This patch gets rid of the optional parameter called onlyUpdateScrollbars for
+ WebCore::EventHandler::mouseMoved() and instead moves that functionality into
+ its own function called passMouseMovedEventToScrollbars().
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::handleMouseEvent):
+
+2012-01-11 Brent Fulgham <bfulgham@webkit.org>
+
+ WinCairo build correction.
+
+ * UIProcess/WebPageProxy.h: Don't define viewWidget for WinCairo port.
+
+2012-01-11 Anders Carlsson <andersca@apple.com>
+
+ Webpages flash white when switching between windows
+ https://bugs.webkit.org/show_bug.cgi?id=76080
+ <rdar://problem/9893565>
+
+ Reviewed by Dan Bernstein.
+
+ Introduce a _windowHasValidBackingStore boolean and only paint the background (white or clear)
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView setFrameSize:]):
+ Set _windowHasValidBackingStore to false if the new size is different from the old size.
+
+ (-[WKView viewDidMoveToWindow]):
+ Set _windowHasValidBackingStore to false.
+
+ (-[WKView _windowDidMiniaturize:]):
+ Set _windowHasValidBackingStore to false.
+
+ (-[WKView _windowDidChangeBackingProperties:]):
+ Set _windowHasValidBackingStore to false.
+
+ (-[WKView drawRect:]):
+ Only call drawPageBackground if _windowHasValidBackingStore is false. Set it to true after painting.
+
+2012-01-11 Anders Carlsson <andersca@apple.com>
+
+ Fix the Mac GCC build.
+
+ Work around the fact that GCC doesn't work very well with Blocks and C++ objets.
+
+ * UIProcess/mac/WebProcessProxyMac.mm:
+ (WebKit::dispatchFunctionOnQueue):
+ (WebKit::WebProcessProxy::secItemRequest):
+ (WebKit::WebProcessProxy::secKeychainItemRequest):
+
+2012-01-11 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Qt][WK2] Directly-composited images sometimes appear with a wrong geometry
+ https://bugs.webkit.org/show_bug.cgi?id=75882
+
+ Reviewed by Simon Hausmann.
+
+ When assigning a directly composited image to a TextureMapperNode in WebKit2, we take
+ contentsRect() onto account. However, contentsRect() might be changed after the image
+ is already assigned.
+ We have to reassign the image when contentsRect() changes. This is a pretty cheap
+ operation, since the image is already converted to a texture and we simply change the
+ geometric values.
+
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::syncLayerParameters):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
+
+2012-01-11 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Add the editor rect to the EditorState
+ https://bugs.webkit.org/show_bug.cgi?id=76053
+
+ Reviewed by Simon Hausmann.
+
+ Also rename some members to match the new Qt naming scheme.
+
+ * Shared/EditorState.cpp:
+ (WebKit::EditorState::encode):
+ (WebKit::EditorState::decode):
+ * Shared/EditorState.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebView::inputMethodQuery):
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::respondToChangedSelection):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::editorState):
+
+2012-01-11 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Linking of big binaries should be serialized to avoid thrashing
+ https://bugs.webkit.org/show_bug.cgi?id=75977
+
+ Reviewed by Martin Robinson.
+
+ Added artificial dependencies so that libwebkitgtk is always
+ linked first, libwebkit2gtk second, and WebKitPluginProcess
+ last. Automake unfortunately replaces the whole rule used to build
+ the libraries if the actual name is used to add the dependency, so
+ we use helper variables to work around that.
+
+ * GNUmakefile.am:
+
+2012-01-11 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [EFL][WK2] Rename viewObject to viewWidget
+ https://bugs.webkit.org/show_bug.cgi?id=75947
+
+ Reviewed by Martin Robinson.
+
+ Rename viewObject to viewWidget for the EFL port to use WidgetBackingStore
+ which calls viewWidget().
+
+ * UIProcess/API/efl/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::PageClientImpl):
+ (WebKit::PageClientImpl::setViewNeedsDisplay):
+ (WebKit::PageClientImpl::viewSize):
+ * UIProcess/API/efl/PageClientImpl.h:
+ (WebKit::PageClientImpl::create):
+ (WebKit::PageClientImpl::viewWidget):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/efl/WebPageProxyEfl.cpp:
+ (WebKit::WebPageProxy::viewWidget):
+
2012-01-10 Mark Rowe <mrowe@apple.com>
REGRESSION (r104377): All pages print blank on Snow Leopard
@@ -10816,7 +13553,7 @@
Reviewed by Adam Roben.
- This avoids calling into the plug-in when only the plug-in position relative to the window changes.
+ This avoids calling into the plug-in when only the plug-in position relative to the window changes.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::geometryDidChange):
diff --git a/Source/WebKit2/Configurations/BaseTarget.xcconfig b/Source/WebKit2/Configurations/BaseTarget.xcconfig
index b7d0798fa..a7a4705d8 100644
--- a/Source/WebKit2/Configurations/BaseTarget.xcconfig
+++ b/Source/WebKit2/Configurations/BaseTarget.xcconfig
@@ -29,10 +29,22 @@ GCC_PREFIX_HEADER = WebKit2Prefix.h;
GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit2
HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(BUILT_PRODUCTS_DIR)/usr/local/include $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(HEADER_SEARCH_PATHS);
+NORMAL_WEBKIT2_FRAMEWORKS_DIR = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME));
+NORMAL_WEBKIT2_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+
+WEBKIT2_FRAMEWORKS_DIR = $(WEBKIT2_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME));
+WEBKIT2_FRAMEWORKS_DIR_macosx = $(WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
+WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_ = $(WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO);
+WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR);
+WEBKIT2_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
+
UMBRELLA_FRAMEWORKS_DIR = $(UMBRELLA_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION));
UMBRELLA_FRAMEWORKS_DIR_macosx_Release = $(UMBRELLA_FRAMEWORKS_DIR_engineering);
UMBRELLA_FRAMEWORKS_DIR_macosx_Debug = $(UMBRELLA_FRAMEWORKS_DIR_engineering);
-UMBRELLA_FRAMEWORKS_DIR_macosx_Production = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+UMBRELLA_FRAMEWORKS_DIR_macosx_Production = $(UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
+UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_ = $(UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_NO);
+UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_NO = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
+UMBRELLA_FRAMEWORKS_DIR_macosx_Production_USE_STAGING_INSTALL_PATH_YES = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
UMBRELLA_FRAMEWORKS_DIR_engineering = $(BUILT_PRODUCTS_DIR);
WEBCORE_PRIVATE_HEADERS_DIR = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders;
diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig
index 0dbc8bd15..9be349394 100644
--- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig
+++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig
@@ -106,11 +106,13 @@ ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG;
ENABLE_QUOTA = ;
ENABLE_REGISTER_PROTOCOL_HANDLER = ;
ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME;
+ENABLE_SHADOW_DOM = ;
ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS;
ENABLE_SQL_DATABASE = ENABLE_SQL_DATABASE;
ENABLE_STYLE_SCOPED = ;
ENABLE_SVG = ENABLE_SVG;
ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
+ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY;
ENABLE_TOUCH_ICON_LOADING = ;
ENABLE_VIDEO = ENABLE_VIDEO;
ENABLE_VIDEO_TRACK = ENABLE_VIDEO_TRACK;
@@ -121,4 +123,4 @@ ENABLE_WEB_TIMING = ;
ENABLE_WORKERS = ENABLE_WORKERS;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT);
diff --git a/Source/WebKit2/Configurations/PluginProcess.xcconfig b/Source/WebKit2/Configurations/PluginProcess.xcconfig
index 14d29fd97..0c89a420f 100644
--- a/Source/WebKit2/Configurations/PluginProcess.xcconfig
+++ b/Source/WebKit2/Configurations/PluginProcess.xcconfig
@@ -26,4 +26,4 @@
GCC_ENABLE_OBJC_GC = NO;
PRODUCT_NAME = PluginProcess;
INFOPLIST_FILE = PluginProcess/Info.plist;
-INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/WebKit2.framework;
+INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework;
diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig
index 01f0fea7b..1b5b0ad13 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 = 535;
-MINOR_VERSION = 16;
+MINOR_VERSION = 19;
TINY_VERSION = 0;
FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
diff --git a/Source/WebKit2/Configurations/WebKit2.xcconfig b/Source/WebKit2/Configurations/WebKit2.xcconfig
index 57794e1ef..14b5d2516 100644
--- a/Source/WebKit2/Configurations/WebKit2.xcconfig
+++ b/Source/WebKit2/Configurations/WebKit2.xcconfig
@@ -26,8 +26,8 @@
PRODUCT_NAME = WebKit2;
INFOPLIST_FILE = Info.plist;
-// The framework location specified in mac/MainMac.cpp needs to be kept in sync with the install path.
-INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR);
+DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR);
OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)) $(OTHER_LDFLAGS);
OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
diff --git a/Source/WebKit2/Configurations/WebProcess.xcconfig b/Source/WebKit2/Configurations/WebProcess.xcconfig
index ceae1212d..df6dd8ef6 100644
--- a/Source/WebKit2/Configurations/WebProcess.xcconfig
+++ b/Source/WebKit2/Configurations/WebProcess.xcconfig
@@ -26,7 +26,7 @@
GCC_ENABLE_OBJC_GC = NO;
PRODUCT_NAME = WebProcess;
INFOPLIST_FILE = WebProcess/Info.plist;
-INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/WebKit2.framework;
+INSTALL_PATH = $(WEBKIT2_FRAMEWORKS_DIR)/WebKit2.framework;
APP_ICON = $(APP_ICON_$(CONFIGURATION));
APP_ICON_Debug = WebKit.icns;
diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am
index dcb47a19f..1cf1a2d90 100644
--- a/Source/WebKit2/GNUmakefile.am
+++ b/Source/WebKit2/GNUmakefile.am
@@ -78,15 +78,19 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_HEA
$(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h
libwebkit2gtkincludedir = $(libwebkitgtkincludedir)/webkit2
-webkit2gtk_headers = \
+libwebkit2gtkinclude_HEADERS = \
+ DerivedSources/WebKit2/webkit2gtk/webkit2/WebKitEnumTypes.h \
$(WebKit2)/UIProcess/API/gtk/WebKitBackForwardList.h \
$(WebKit2)/UIProcess/API/gtk/WebKitBackForwardListItem.h \
$(WebKit2)/UIProcess/API/gtk/WebKitDefines.h \
+ $(WebKit2)/UIProcess/API/gtk/WebKitDownload.h \
$(WebKit2)/UIProcess/API/gtk/WebKitError.h \
- $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \
+ $(WebKit2)/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \
+ $(WebKit2)/UIProcess/API/gtk/WebKitPolicyDecision.h \
$(WebKit2)/UIProcess/API/gtk/WebKitSettings.h \
$(WebKit2)/UIProcess/API/gtk/WebKitURIRequest.h \
$(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \
+ $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \
$(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \
$(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \
$(WebKit2)/UIProcess/API/gtk/WebKitWindowProperties.h \
@@ -209,15 +213,12 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \
Source/WebKit2/Platform/gtk/LoggingGtk.cpp \
Source/WebKit2/Platform/gtk/ModuleGtk.cpp \
- Source/WebKit2/Platform/gtk/RunLoopGtk.cpp \
Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \
Source/WebKit2/Platform/Logging.cpp \
Source/WebKit2/Platform/Logging.h \
Source/WebKit2/Platform/Module.cpp \
Source/WebKit2/Platform/Module.h \
Source/WebKit2/Platform/PlatformProcessIdentifier.h \
- Source/WebKit2/Platform/RunLoop.cpp \
- Source/WebKit2/Platform/RunLoop.h \
Source/WebKit2/Platform/SharedMemory.h \
Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp \
Source/WebKit2/Platform/WorkQueue.cpp \
@@ -321,6 +322,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp \
Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp \
Source/WebKit2/Shared/gtk/PlatformCertificateInfo.h \
+ Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp \
Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp \
Source/WebKit2/Shared/gtk/WebEventFactory.cpp \
Source/WebKit2/Shared/gtk/WebEventFactory.h \
@@ -523,8 +525,23 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h \
Source/WebKit2/UIProcess/API/gtk/WebKitError.h \
Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h \
Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h \
@@ -533,20 +550,21 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h \
Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitURIRequestPrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.h \
Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h \
- Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.h \
- Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.h \
@@ -891,8 +909,14 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU
Source/WebKit2/WebProcess/WebPage/EventDispatcher.h \
Source/WebKit2/WebProcess/WebPage/FindController.cpp \
Source/WebKit2/WebProcess/WebPage/FindController.h \
+ Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp \
+ Source/WebKit2/WebProcess/WebPage/TapHighlightController.h \
Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp \
+ Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.h \
+ Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp \
Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp \
+ Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp \
+ Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h \
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp \
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h \
Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp \
@@ -997,6 +1021,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP
$(COVERAGE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
+ $(GTK_UNIX_PRINTING_CFLAGS) \
$(LIBSOUP_CFLAGS) \
$(UNICODE_CFLAGS) \
$(XT_CFLAGS)
@@ -1011,6 +1036,12 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CFL
lib_LTLIBRARIES += \
libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la
+# Artificial dependency to make sure libwebkit2gtk and libwebkitgtk are not linked at the same time
+# The variable creation is to avoid having automake override the entire rule instead of adding the
+# dependency.
+webkit2gtk_lib_for_dep = libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la
+$(webkit2gtk_lib_for_dep): libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la
+
libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_ladir = \
$(libwebkit2gtkincludedir)/WebKit2
@@ -1044,6 +1075,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIB
$(GLIB_LIBS) \
$(GSTREAMER_LIBS) \
$(GTK_LIBS) \
+ $(GTK_UNIX_PRINTING_LIBS) \
$(JPEG_LIBS) \
$(LIBSOUP_LIBS) \
$(LIBXML_LIBS) \
@@ -1066,7 +1098,7 @@ generate-webkit2-forwarding-headers: $(WebKit2)/Scripts/generate-forwarding-head
BUILT_SOURCES += generate-webkit2-forwarding-headers
-$(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2: $(webkit2gtk_headers)
+$(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2: $(libwebkit2gtkinclude_HEADERS)
$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/include \
&& ln -n -s -f ${shell pwd}/$(WebKit2)/UIProcess/API/gtk $@
@@ -1116,7 +1148,7 @@ webkit2gtk_built_headers_dir := $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2
$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h: stamp-webkit2enumtypes
@true
-stamp-webkit2enumtypes: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am
+stamp-webkit2enumtypes: $(libwebkit2gtkinclude_HEADERS) $(WebKit2)/GNUmakefile.am
$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \
&& glib-mkenums \
--fhead "#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)\n" \
@@ -1132,15 +1164,15 @@ stamp-webkit2enumtypes: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am
--fprod "#include <webkit2/@basename@>\n\n" \
--eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
--eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
- $(webkit2gtk_headers) | \
+ $(libwebkit2gtkinclude_HEADERS) | \
sed 's,web_kit,webkit,' | \
sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
- > xgen-gth \
- && (cmp -s xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h || cp xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h) \
- && rm -f xgen-gth \
+ > wk2-xgen-gth \
+ && (cmp -s wk2-xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h || cp wk2-xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h) \
+ && rm -f wk2-xgen-gth \
&& echo timestamp > $(@F)
-$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am
+$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(libwebkit2gtkinclude_HEADERS) $(WebKit2)/GNUmakefile.am
$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \
&& glib-mkenums \
--fhead "#include <config.h>\n" \
@@ -1157,11 +1189,11 @@ $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(webkit2gtk_heade
--vtail " type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
--vtail " return type;\n}\n\n" \
--ftail "}\n" \
- $(webkit2gtk_headers) | \
+ $(libwebkit2gtkinclude_HEADERS) | \
sed 's,web_kit,webkit,' \
- > xgen-gtc \
- && cp xgen-gtc $@ \
- && rm -f xgen-gtc
+ > wk2-xgen-gtc \
+ && cp wk2-xgen-gtc $@ \
+ && rm -f wk2-xgen-gtc
WEBKIT2_MARSHAL_LIST = $(WebKit2)/UIProcess/API/gtk/webkit2marshal.list
@@ -1209,6 +1241,7 @@ Programs_WebKitWebProcess_CFLAGS = \
$(CAIRO_CFLAGS) \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
+ $(GTK_UNIX_PRINTING_CFLAGS) \
$(LIBSOUP_CFLAGS) \
$(ZLIB_CFLAGS)
@@ -1219,6 +1252,7 @@ Programs_WebKitWebProcess_LDADD = \
libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
$(GLIB_LIBS) \
$(GTK_LIBS) \
+ $(GTK_UNIX_PRINTING_LIBS) \
$(LIBSOUP_LIBS) \
$(ZLIB_CFLAGS)
@@ -1271,6 +1305,10 @@ libWebCoreGtk2_la_CPPFLAGS = \
libexec_PROGRAMS += \
Programs/WebKitPluginProcess
+# Serialize linking of the plugin process with both webkit libraries.
+plugin_process_for_dep = Programs/WebKitPluginProcess
+$(plugin_process_for_dep): libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la libwebkit2gtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la
+
Programs_WebKitPluginProcess_CPPFLAGS = \
-include $(srcdir)/Source/WebKit2/WebKit2Prefix.h \
-I$(srcdir)/Source/WebKit2 \
@@ -1353,11 +1391,8 @@ Programs_WebKitPluginProcess_SOURCES = \
Source/WebKit2/Platform/Module.h \
Source/WebKit2/Platform/WorkQueue.cpp \
Source/WebKit2/Platform/WorkQueue.h \
- Source/WebKit2/Platform/RunLoop.cpp \
- Source/WebKit2/Platform/RunLoop.h \
Source/WebKit2/Platform/SharedMemory.h \
Source/WebKit2/Platform/gtk/ModuleGtk.cpp \
- Source/WebKit2/Platform/gtk/RunLoopGtk.cpp \
Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \
Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp \
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp \
@@ -1444,7 +1479,6 @@ Programs_WebKitPluginProcess_LDADD = \
$(XRENDER_LIBS) \
$(XT_LIBS) \
$(WINMM_LIBS) \
- $(LIBFFTW_LIBS) \
$(ZLIB_LIBS)
Programs_WebKitPluginProcess_LDFLAGS = \
diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp
index 3e17bbd23..3c2f14ced 100644
--- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp
+++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp
@@ -28,10 +28,11 @@
#include "BinarySemaphore.h"
#include "CoreIPCMessageKinds.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
#include <wtf/CurrentTime.h>
using namespace std;
+using namespace WebCore;
namespace CoreIPC {
diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h
index bafa99918..81553aeb7 100644
--- a/Source/WebKit2/Platform/CoreIPC/Connection.h
+++ b/Source/WebKit2/Platform/CoreIPC/Connection.h
@@ -50,7 +50,9 @@ class QSocketNotifier;
#include "PlatformProcessIdentifier.h"
#endif
+namespace WebCore {
class RunLoop;
+}
namespace CoreIPC {
@@ -118,8 +120,8 @@ public:
typedef int Identifier;
#endif
- static PassRefPtr<Connection> createServerConnection(Identifier, Client*, RunLoop* clientRunLoop);
- static PassRefPtr<Connection> createClientConnection(Identifier, Client*, RunLoop* clientRunLoop);
+ static PassRefPtr<Connection> createServerConnection(Identifier, Client*, WebCore::RunLoop* clientRunLoop);
+ static PassRefPtr<Connection> createClientConnection(Identifier, Client*, WebCore::RunLoop* clientRunLoop);
~Connection();
#if OS(DARWIN)
@@ -207,7 +209,7 @@ public:
typedef Message<ArgumentEncoder> OutgoingMessage;
private:
- Connection(Identifier, bool isServer, Client*, RunLoop* clientRunLoop);
+ Connection(Identifier, bool isServer, Client*, WebCore::RunLoop* clientRunLoop);
void platformInitialize(Identifier);
void platformInvalidate();
@@ -253,7 +255,7 @@ private:
bool m_isConnected;
WorkQueue m_connectionQueue;
- RunLoop* m_clientRunLoop;
+ WebCore::RunLoop* m_clientRunLoop;
Vector<QueueClient*> m_connectionQueueClients;
diff --git a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp
index 97975abea..1119a2847 100644
--- a/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp
+++ b/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp
@@ -29,11 +29,12 @@
#include "CoreIPCMessageKinds.h"
#include "MachPort.h"
#include "MachUtilities.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
#include <mach/mach_error.h>
#include <mach/vm_map.h>
using namespace std;
+using namespace WebCore;
namespace CoreIPC {
diff --git a/Source/WebKit2/Platform/RunLoop.h b/Source/WebKit2/Platform/RunLoop.h
deleted file mode 100644
index 57a79a8f3..000000000
--- a/Source/WebKit2/Platform/RunLoop.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RunLoop_h
-#define RunLoop_h
-
-#include <wtf/Forward.h>
-#include <wtf/Functional.h>
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/ThreadSpecific.h>
-#include <wtf/Threading.h>
-#include <wtf/Vector.h>
-#if PLATFORM(GTK)
-#include <wtf/gobject/GRefPtr.h>
-typedef struct _GSource GSource;
-typedef struct _GMainLoop GMainLoop;
-typedef struct _GMainContext GMainContext;
-typedef int gboolean;
-#endif
-
-class RunLoop {
-public:
- // Must be called from the main thread.
- static void initializeMainRunLoop();
-
- static RunLoop* current();
- static RunLoop* main();
-
- void dispatch(const Function<void()>&);
-
- static void run();
- void stop();
-
-#if PLATFORM(MAC)
- void runForDuration(double duration);
-#endif
-
- class TimerBase {
- friend class RunLoop;
- public:
- TimerBase(RunLoop*);
- virtual ~TimerBase();
-
- void startRepeating(double repeatInterval) { start(repeatInterval, true); }
- void startOneShot(double interval) { start(interval, false); }
-
- void stop();
- bool isActive() const;
-
- virtual void fired() = 0;
-
- private:
- void start(double nextFireInterval, bool repeat);
-
- RunLoop* m_runLoop;
-
-#if PLATFORM(WIN)
- static void timerFired(RunLoop*, uint64_t ID);
- uint64_t m_ID;
- bool m_isRepeating;
-#elif PLATFORM(MAC)
- static void timerFired(CFRunLoopTimerRef, void*);
- CFRunLoopTimerRef m_timer;
-#elif PLATFORM(QT)
- static void timerFired(RunLoop*, int ID);
- int m_ID;
- bool m_isRepeating;
-#elif PLATFORM(GTK)
- static gboolean timerFiredCallback(RunLoop::TimerBase*);
- gboolean isRepeating() const { return m_isRepeating; }
- void clearTimerSource();
- GRefPtr<GSource> m_timerSource;
- gboolean m_isRepeating;
-#endif
- };
-
- template <typename TimerFiredClass>
- class Timer : public TimerBase {
- public:
- typedef void (TimerFiredClass::*TimerFiredFunction)();
-
- Timer(RunLoop* runLoop, TimerFiredClass* o, TimerFiredFunction f)
- : TimerBase(runLoop)
- , m_object(o)
- , m_function(f)
- {
- }
-
- private:
- virtual void fired() { (m_object->*m_function)(); }
-
- TimerFiredClass* m_object;
- TimerFiredFunction m_function;
- };
-
-private:
- friend class WTF::ThreadSpecific<RunLoop>;
-
- RunLoop();
- ~RunLoop();
-
- void performWork();
- void wakeUp();
-
- Mutex m_functionQueueLock;
- Vector<Function<void()> > m_functionQueue;
-
-#if PLATFORM(WIN)
- static bool registerRunLoopMessageWindowClass();
- static LRESULT CALLBACK RunLoopWndProc(HWND, UINT, WPARAM, LPARAM);
- LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
- HWND m_runLoopMessageWindow;
-
- typedef HashMap<uint64_t, TimerBase*> TimerMap;
- TimerMap m_activeTimers;
-#elif PLATFORM(MAC)
- static void performWork(void*);
- CFRunLoopRef m_runLoop;
- CFRunLoopSourceRef m_runLoopSource;
- int m_nestingLevel;
-#elif PLATFORM(QT)
- typedef HashMap<int, TimerBase*> TimerMap;
- TimerMap m_activeTimers;
- class TimerObject;
- TimerObject* m_timerObject;
-#elif PLATFORM(GTK)
-public:
- static gboolean queueWork(RunLoop*);
- GMainLoop* mainLoop();
-private:
- GMainContext* m_runLoopContext;
- GMainLoop* m_runLoopMain;
-#endif
-};
-
-#endif // RunLoop_h
diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h
index 23ec58ce7..a6f832851 100644
--- a/Source/WebKit2/Platform/SharedMemory.h
+++ b/Source/WebKit2/Platform/SharedMemory.h
@@ -30,7 +30,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#if PLATFORM(QT) || PLATFORM(GTK)
+#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
#include "Attachment.h"
#include <wtf/text/WTFString.h>
#endif
diff --git a/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp b/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp
deleted file mode 100644
index 81cbeaaf1..000000000
--- a/Source/WebKit2/Platform/gtk/RunLoopGtk.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RunLoop.h"
-
-#include "WKBase.h"
-#include <glib.h>
-
-RunLoop::RunLoop()
-{
- m_runLoopContext = g_main_context_default();
- ASSERT(m_runLoopContext);
- m_runLoopMain = g_main_loop_new(m_runLoopContext, FALSE);
- ASSERT(m_runLoopMain);
-}
-
-RunLoop::~RunLoop()
-{
- if (m_runLoopMain) {
- if (g_main_loop_is_running(m_runLoopMain))
- g_main_loop_quit(m_runLoopMain);
- g_main_loop_unref(m_runLoopMain);
- }
-
- if (m_runLoopContext)
- g_main_context_unref(m_runLoopContext);
-}
-
-void RunLoop::run()
-{
- g_main_loop_run(RunLoop::main()->mainLoop());
-}
-
-GMainLoop* RunLoop::mainLoop()
-{
- return m_runLoopMain;
-}
-
-void RunLoop::stop()
-{
- g_main_loop_quit(m_runLoopMain);
-}
-
-gboolean RunLoop::queueWork(RunLoop* runLoop)
-{
- runLoop->performWork();
- return FALSE;
-}
-
-void RunLoop::wakeUp()
-{
- GRefPtr<GSource> source = adoptGRef(g_idle_source_new());
- g_source_set_priority(source.get(), G_PRIORITY_DEFAULT);
- g_source_set_callback(source.get(), reinterpret_cast<GSourceFunc>(&RunLoop::queueWork), this, 0);
- g_source_attach(source.get(), m_runLoopContext);
-
- g_main_context_wakeup(m_runLoopContext);
-}
-
-RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
- : m_runLoop(runLoop)
- , m_timerSource(0)
-{
-}
-
-RunLoop::TimerBase::~TimerBase()
-{
- stop();
-}
-
-void RunLoop::TimerBase::clearTimerSource()
-{
- m_timerSource = 0;
-}
-
-gboolean RunLoop::TimerBase::timerFiredCallback(RunLoop::TimerBase* timer)
-{
- GSource* currentTimerSource = timer->m_timerSource.get();
- bool isRepeating = timer->isRepeating();
- // This can change the timerSource by starting a new timer within the callback.
- timer->fired();
- if (!isRepeating && currentTimerSource == timer->m_timerSource.get())
- timer->clearTimerSource();
- return isRepeating;
-}
-
-void RunLoop::TimerBase::start(double fireInterval, bool repeat)
-{
- if (m_timerSource)
- stop();
-
- m_timerSource = adoptGRef(g_timeout_source_new(static_cast<guint>(fireInterval * 1000)));
- m_isRepeating = repeat;
- g_source_set_callback(m_timerSource.get(), reinterpret_cast<GSourceFunc>(&RunLoop::TimerBase::timerFiredCallback), this, 0);
- g_source_attach(m_timerSource.get(), m_runLoop->m_runLoopContext);
-}
-
-void RunLoop::TimerBase::stop()
-{
- if (!m_timerSource)
- return;
-
- g_source_destroy(m_timerSource.get());
- clearTimerSource();
-}
-
-bool RunLoop::TimerBase::isActive() const
-{
- return m_timerSource;
-}
diff --git a/Source/WebKit2/Platform/mac/RunLoopMac.mm b/Source/WebKit2/Platform/mac/RunLoopMac.mm
deleted file mode 100644
index 03bb86e8d..000000000
--- a/Source/WebKit2/Platform/mac/RunLoopMac.mm
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "RunLoop.h"
-
-void RunLoop::performWork(void* context)
-{
- // Wrap main thread in an Autorelease pool. Sending messages can call
- // into objc code and accumulate memory.
- if (current() == main()) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- static_cast<RunLoop*>(context)->performWork();
- [pool drain];
- } else
- static_cast<RunLoop*>(context)->performWork();
-}
-
-RunLoop::RunLoop()
- : m_runLoop(CFRunLoopGetCurrent())
- , m_nestingLevel(0)
-{
- CFRunLoopSourceContext context = { 0, this, 0, 0, 0, 0, 0, 0, 0, performWork };
- m_runLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
- CFRunLoopAddSource(m_runLoop, m_runLoopSource, kCFRunLoopCommonModes);
-}
-
-RunLoop::~RunLoop()
-{
- // FIXME: Tear down the work item queue here.
- CFRunLoopSourceInvalidate(m_runLoopSource);
- CFRelease(m_runLoopSource);
-}
-
-void RunLoop::run()
-{
- current()->m_nestingLevel++;
- if (current() == main() && current()->m_nestingLevel == 1) {
- // Use -[NSApplication run] for the main run loop.
- [NSApp run];
- } else {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- CFRunLoopRun();
- [pool drain];
- }
- current()->m_nestingLevel--;
-}
-
-void RunLoop::runForDuration(double duration)
-{
- CFRunLoopRunInMode(kCFRunLoopDefaultMode, duration, true);
-}
-
-void RunLoop::stop()
-{
- ASSERT(m_runLoop == CFRunLoopGetCurrent());
-
- if (m_runLoop == main()->m_runLoop && m_nestingLevel == 1) {
- [NSApp stop:nil];
- NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined
- location:NSMakePoint(0, 0)
- modifierFlags:0
- timestamp:0.0
- windowNumber:0
- context:nil
- subtype: 0
- data1:0
- data2:0];
- [NSApp postEvent:event atStart:true];
- } else
- CFRunLoopStop(m_runLoop);
-}
-
-void RunLoop::wakeUp()
-{
- CFRunLoopSourceSignal(m_runLoopSource);
- CFRunLoopWakeUp(m_runLoop);
-}
-
-// RunLoop::Timer
-
-void RunLoop::TimerBase::timerFired(CFRunLoopTimerRef, void* context)
-{
- TimerBase* timer = static_cast<TimerBase*>(context);
-
- // Wrap main thread in an Autorelease pool. The timer can call
- // into objc code and accumulate memory outside of the main event loop.
- if (current() == main()) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- timer->fired();
- [pool drain];
- } else
- timer->fired();
-}
-
-RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
- : m_runLoop(runLoop)
- , m_timer(0)
-{
-}
-
-RunLoop::TimerBase::~TimerBase()
-{
- stop();
-}
-
-void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
-{
- if (m_timer)
- stop();
-
- CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
- CFTimeInterval repeatInterval = repeat ? nextFireInterval : 0;
- m_timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context);
- CFRunLoopAddTimer(m_runLoop->m_runLoop, m_timer, kCFRunLoopCommonModes);
-}
-
-void RunLoop::TimerBase::stop()
-{
- if (!m_timer)
- return;
-
- CFRunLoopTimerInvalidate(m_timer);
- CFRelease(m_timer);
- m_timer = 0;
-}
-
-bool RunLoop::TimerBase::isActive() const
-{
- return m_timer && CFRunLoopTimerIsValid(m_timer);
-}
diff --git a/Source/WebKit2/Platform/qt/RunLoopQt.cpp b/Source/WebKit2/Platform/qt/RunLoopQt.cpp
deleted file mode 100644
index 007a0a5b1..000000000
--- a/Source/WebKit2/Platform/qt/RunLoopQt.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RunLoop.h"
-
-#include <QCoreApplication>
-#include <QAbstractEventDispatcher>
-#include <QObject>
-#include <QMetaMethod>
-#include <QMetaObject>
-#include <QTimerEvent>
-
-class RunLoop::TimerObject : public QObject
-{
- Q_OBJECT
-public:
- TimerObject(RunLoop* runLoop) : m_runLoop(runLoop)
- {
- int methodIndex = metaObject()->indexOfMethod("performWork()");
- m_method = metaObject()->method(methodIndex);
- }
-
- Q_SLOT void performWork() { m_runLoop->performWork(); }
- inline void wakeUp() { m_method.invoke(this, Qt::QueuedConnection); }
-
-protected:
- virtual void timerEvent(QTimerEvent* event)
- {
- RunLoop::TimerBase::timerFired(m_runLoop, event->timerId());
- }
-
-private:
- RunLoop* m_runLoop;
- QMetaMethod m_method;
-};
-
-static QEventLoop* currentEventLoop;
-
-void RunLoop::run()
-{
- static bool mainEventLoopIsRunning = false;
- if (!mainEventLoopIsRunning) {
- mainEventLoopIsRunning = true;
- QCoreApplication::exec();
- mainEventLoopIsRunning = false;
- } else {
- QEventLoop eventLoop;
-
- QEventLoop* previousEventLoop = currentEventLoop;
- currentEventLoop = &eventLoop;
-
- eventLoop.exec();
-
- currentEventLoop = previousEventLoop;
- }
-}
-
-void RunLoop::stop()
-{
- if (currentEventLoop)
- currentEventLoop->exit();
- else
- QCoreApplication::exit();
-}
-
-RunLoop::RunLoop()
- : m_timerObject(new TimerObject(this))
-{
-}
-
-RunLoop::~RunLoop()
-{
- delete m_timerObject;
-}
-
-void RunLoop::wakeUp()
-{
- m_timerObject->wakeUp();
-}
-
-// RunLoop::Timer
-
-void RunLoop::TimerBase::timerFired(RunLoop* runLoop, int ID)
-{
- TimerMap::iterator it = runLoop->m_activeTimers.find(ID);
- ASSERT(it != runLoop->m_activeTimers.end());
- TimerBase* timer = it->second;
-
- if (!timer->m_isRepeating) {
- // Stop the timer (calling stop would need another hash table lookup).
- runLoop->m_activeTimers.remove(it);
- runLoop->m_timerObject->killTimer(timer->m_ID);
- timer->m_ID = 0;
- }
-
- timer->fired();
-}
-
-RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
- : m_runLoop(runLoop)
- , m_ID(0)
- , m_isRepeating(false)
-{
-}
-
-RunLoop::TimerBase::~TimerBase()
-{
- stop();
-}
-
-void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
-{
- stop();
- int millis = static_cast<int>(nextFireInterval * 1000);
- m_isRepeating = repeat;
- m_ID = m_runLoop->m_timerObject->startTimer(millis);
- ASSERT(m_ID);
- m_runLoop->m_activeTimers.set(m_ID, this);
-}
-
-void RunLoop::TimerBase::stop()
-{
- if (!m_ID)
- return;
- TimerMap::iterator it = m_runLoop->m_activeTimers.find(m_ID);
- if (it == m_runLoop->m_activeTimers.end())
- return;
-
- m_runLoop->m_activeTimers.remove(it);
- m_runLoop->m_timerObject->killTimer(m_ID);
- m_ID = 0;
-}
-
-bool RunLoop::TimerBase::isActive() const
-{
- return m_ID;
-}
-
-#include "RunLoopQt.moc"
diff --git a/Source/WebKit2/Platform/win/RunLoopWin.cpp b/Source/WebKit2/Platform/win/RunLoopWin.cpp
deleted file mode 100644
index dfbcaee56..000000000
--- a/Source/WebKit2/Platform/win/RunLoopWin.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RunLoop.h"
-
-#include "BinarySemaphore.h"
-#include <wtf/CurrentTime.h>
-
-using namespace CoreIPC;
-using namespace std;
-
-static const UINT PerformWorkMessage = WM_USER + 1;
-static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
-
-LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0);
-
- if (RunLoop* runLoop = reinterpret_cast<RunLoop*>(longPtr))
- return runLoop->wndProc(hWnd, message, wParam, lParam);
-
- if (message == WM_CREATE) {
- LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam);
-
- // Associate the RunLoop with the window.
- ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams);
- return 0;
- }
-
- return ::DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-LRESULT RunLoop::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) {
- case PerformWorkMessage:
- performWork();
- return 0;
- case WM_TIMER:
- RunLoop::TimerBase::timerFired(this, wParam);
- return 0;
- }
-
- return ::DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-void RunLoop::run()
-{
- MSG message;
- while (BOOL result = ::GetMessage(&message, 0, 0, 0)) {
- if (result == -1)
- break;
- ::TranslateMessage(&message);
- ::DispatchMessage(&message);
- }
-}
-
-void RunLoop::stop()
-{
- ::PostQuitMessage(0);
-}
-
-bool RunLoop::registerRunLoopMessageWindowClass()
-{
- // FIXME: This really only needs to be called once.
-
- WNDCLASSEX windowClass = { 0 };
- windowClass.cbSize = sizeof(windowClass);
- windowClass.lpfnWndProc = RunLoop::RunLoopWndProc;
- windowClass.cbWndExtra = sizeof(RunLoop*);
- windowClass.lpszClassName = kRunLoopMessageWindowClassName;
-
- return !!::RegisterClassEx(&windowClass);
-}
-
-RunLoop::RunLoop()
-{
- registerRunLoopMessageWindowClass();
-
- m_runLoopMessageWindow = ::CreateWindow(kRunLoopMessageWindowClassName, 0, 0,
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
- HWND_MESSAGE, 0, 0, this);
- ASSERT(::IsWindow(m_runLoopMessageWindow));
-}
-
-RunLoop::~RunLoop()
-{
- // FIXME: Tear down the work item queue here.
-}
-
-void RunLoop::wakeUp()
-{
- // FIXME: No need to wake up the run loop if we've already called dispatch
- // before the run loop has had the time to respond.
- ::PostMessage(m_runLoopMessageWindow, PerformWorkMessage, reinterpret_cast<WPARAM>(this), 0);
-}
-
-// RunLoop::Timer
-
-void RunLoop::TimerBase::timerFired(RunLoop* runLoop, uint64_t ID)
-{
- TimerMap::iterator it = runLoop->m_activeTimers.find(ID);
- if (it == runLoop->m_activeTimers.end()) {
- // The timer must have been stopped after the WM_TIMER message was posted to the message queue.
- return;
- }
-
- TimerBase* timer = it->second;
-
- if (!timer->m_isRepeating) {
- runLoop->m_activeTimers.remove(it);
- ::KillTimer(runLoop->m_runLoopMessageWindow, ID);
- }
-
- timer->fired();
-}
-
-static uint64_t generateTimerID()
-{
- static uint64_t uniqueTimerID = 1;
- return uniqueTimerID++;
-}
-
-RunLoop::TimerBase::TimerBase(RunLoop* runLoop)
- : m_runLoop(runLoop)
- , m_ID(generateTimerID())
- , m_isRepeating(false)
-{
-}
-
-RunLoop::TimerBase::~TimerBase()
-{
- stop();
-}
-
-void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
-{
- m_isRepeating = repeat;
- m_runLoop->m_activeTimers.set(m_ID, this);
- ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval * 1000, 0);
-}
-
-void RunLoop::TimerBase::stop()
-{
- TimerMap::iterator it = m_runLoop->m_activeTimers.find(m_ID);
- if (it == m_runLoop->m_activeTimers.end())
- return;
-
- m_runLoop->m_activeTimers.remove(it);
- ::KillTimer(m_runLoop->m_runLoopMessageWindow, m_ID);
-}
-
-bool RunLoop::TimerBase::isActive() const
-{
- return m_runLoop->m_activeTimers.contains(m_ID);
-}
diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.h b/Source/WebKit2/PluginProcess/PluginControllerProxy.h
index 51c348da1..c79211a8c 100644
--- a/Source/WebKit2/PluginProcess/PluginControllerProxy.h
+++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.h
@@ -32,8 +32,8 @@
#include "Plugin.h"
#include "PluginController.h"
#include "PluginControllerProxyMessages.h"
-#include "RunLoop.h"
#include "ShareableBitmap.h"
+#include <WebCore/RunLoop.h>
#include <wtf/Noncopyable.h>
#if PLATFORM(MAC)
@@ -167,14 +167,14 @@ private:
WebCore::IntRect m_dirtyRect;
// The paint timer, used for coalescing painting.
- RunLoop::Timer<PluginControllerProxy> m_paintTimer;
+ WebCore::RunLoop::Timer<PluginControllerProxy> m_paintTimer;
// A counter used to prevent the plug-in from being destroyed.
unsigned m_pluginDestructionProtectCount;
// A timer that we use to prevent destruction of the plug-in while plug-in
// code is on the stack.
- RunLoop::Timer<PluginControllerProxy> m_pluginDestroyTimer;
+ WebCore::RunLoop::Timer<PluginControllerProxy> m_pluginDestroyTimer;
// Will point to the plug-in creation parameters of the plug-in we're currently initializing and will be null when we're done initializing.
const PluginCreationParameters* m_pluginCreationParameters;
diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp
index a366f5db7..099bf3a48 100644
--- a/Source/WebKit2/PluginProcess/PluginProcess.cpp
+++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp
@@ -36,6 +36,7 @@
#include "PluginProcessCreationParameters.h"
#include "WebProcessConnection.h"
#include <WebCore/NotImplemented.h>
+#include <WebCore/RunLoop.h>
#if USE(UNIX_DOMAIN_SOCKETS)
#include <errno.h>
@@ -55,6 +56,8 @@
#endif // SOCK_SEQPACKET
#endif // USE(UNIX_DOMAIN_SOCKETS)
+using namespace WebCore;
+
namespace WebKit {
static const double shutdownTimeout = 15.0;
diff --git a/Source/WebKit2/PluginProcess/PluginProcess.h b/Source/WebKit2/PluginProcess/PluginProcess.h
index a610326b4..0cf39c6e5 100644
--- a/Source/WebKit2/PluginProcess/PluginProcess.h
+++ b/Source/WebKit2/PluginProcess/PluginProcess.h
@@ -29,10 +29,13 @@
#if ENABLE(PLUGIN_PROCESS)
#include "ChildProcess.h"
-#include "RunLoop.h"
#include <wtf/Forward.h>
#include <wtf/text/WTFString.h>
+namespace WebCore {
+class RunLoop;
+}
+
namespace WebKit {
class NetscapePluginModule;
@@ -44,7 +47,7 @@ class PluginProcess : ChildProcess {
public:
static PluginProcess& shared();
- void initialize(CoreIPC::Connection::Identifier, RunLoop*);
+ void initialize(CoreIPC::Connection::Identifier, WebCore::RunLoop*);
void removeWebProcessConnection(WebProcessConnection* webProcessConnection);
NetscapePluginModule* netscapePluginModule();
diff --git a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp
index ab63b05bb..a27d11390 100644
--- a/Source/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/Source/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -34,10 +34,11 @@
#include "PluginCreationParameters.h"
#include "PluginProcess.h"
#include "PluginProcessConnectionMessages.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
-namespace WebKit {
+using namespace WebCore;
+namespace WebKit {
class ConnectionStack {
public:
diff --git a/Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp b/Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp
index 9942604e7..992d74075 100644
--- a/Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp
+++ b/Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp
@@ -27,12 +27,14 @@
#include "PluginProcessMainGtk.h"
#include "PluginProcess.h"
-#include <WebKit2/RunLoop.h>
+#include <WebCore/RunLoop.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
+using namespace WebCore;
+
namespace WebKit {
static int webkitgtkXError(Display* xdisplay, XErrorEvent* error)
diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements b/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements
new file mode 100644
index 000000000..080e1e075
--- /dev/null
+++ b/Source/WebKit2/PluginProcess/mac/PluginProcess.entitlements
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.security.files.user-selected.read-write</key>
+ <true/>
+</dict>
+</plist>
diff --git a/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
index 5e93e2bdd..8561f9959 100644
--- a/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
+++ b/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm
@@ -32,19 +32,21 @@
#import "EnvironmentUtilities.h"
#import "NetscapePluginModule.h"
#import "PluginProcess.h"
-#import "RunLoop.h"
+#import <WebCore/RunLoop.h>
#import <WebKitSystemInterface.h>
#import <mach/mach_error.h>
#import <runtime/InitializeThreading.h>
#import <servers/bootstrap.h>
+#import <stdio.h>
#import <wtf/MainThread.h>
#import <wtf/RetainPtr.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
-#include <stdio.h>
#define SHOW_CRASH_REPORTER 1
+using namespace WebCore;
+
namespace WebKit {
// FIXME: There is much code here that is duplicated in WebProcessMainMac.mm, we should add a shared base class where
diff --git a/Source/WebKit2/PluginProcess/mac/add-entitlements.sh b/Source/WebKit2/PluginProcess/mac/add-entitlements.sh
new file mode 100755
index 000000000..825695a2b
--- /dev/null
+++ b/Source/WebKit2/PluginProcess/mac/add-entitlements.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This script is needed because adding entitlements through Xcode configuration doesn't get dependencies right in some cases, <rdar://problem/10783446>.
+
+app_path="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}"
+app_binary_path="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+entitlement_file=PluginProcess/mac/PluginProcess.entitlements
+
+if [[ ${CONFIGURATION} == "Production" ]]; then
+ exit
+fi
+
+osx_version=$(sw_vers -productVersion | cut -d. -f 2)
+if (( ${osx_version} <= 6 )); then
+ exit
+fi
+
+needs_signing=0
+
+# If the signature is invalid (e.g. due to updated resources), we need to re-sign it.
+codesign --verify "${app_path}" 2> /dev/null
+if [[ $? != 0 ]]; then
+ needs_signing=1
+else
+ # If the entitlements file is newer than the binary, we need to re-sign the app.
+ if [[ "${entitlement_file}" -nt "${app_binary_path}" ]]; then
+ needs_signing=1
+ fi
+fi
+
+if [[ $needs_signing == 0 ]]; then
+ exit
+fi
+
+codesign -f -s - --entitlements "${entitlement_file}" "${app_path}"
diff --git a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
index 3e0033ff0..d3a0ec3e2 100644
--- a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+++ b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
@@ -30,8 +30,8 @@
#include "CommandLine.h"
#include "PluginProcess.h"
-#include "RunLoop.h"
#include <WebCore/NotImplemented.h>
+#include <WebCore/RunLoop.h>
#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
#include <wtf/RetainPtr.h>
@@ -40,6 +40,8 @@
#define SHOW_CRASH_REPORTER 1
+using namespace WebCore;
+
namespace WebKit {
int PluginProcessMain(const CommandLine& commandLine)
diff --git a/Source/WebKit2/Shared/API/c/WKFindOptions.h b/Source/WebKit2/Shared/API/c/WKFindOptions.h
index 3330035e1..5c1c8ce23 100644
--- a/Source/WebKit2/Shared/API/c/WKFindOptions.h
+++ b/Source/WebKit2/Shared/API/c/WKFindOptions.h
@@ -37,7 +37,8 @@ enum {
kWKFindOptionsBackwards = 1 << 3,
kWKFindOptionsWrapAround = 1 << 4,
kWKFindOptionsShowOverlay = 1 << 5,
- kWKFindOptionsShowFindIndicator = 1 << 6
+ kWKFindOptionsShowFindIndicator = 1 << 6,
+ kWKFindOptionsShowHighlight = 1 << 7
};
typedef uint32_t WKFindOptions;
diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp
index cf7624f42..f7291065f 100644
--- a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp
+++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp
@@ -36,9 +36,15 @@ WKTypeID WKSecurityOriginGetTypeID()
return toAPI(WebSecurityOrigin::APIType);
}
-WKSecurityOriginRef WKSecurityOriginCreateFromIdentifier(WKStringRef identifier)
+WKSecurityOriginRef WKSecurityOriginCreateFromString(WKStringRef string)
{
- RefPtr<WebSecurityOrigin> securityOrigin = WebSecurityOrigin::create(toImpl(identifier)->string());
+ RefPtr<WebSecurityOrigin> securityOrigin = WebSecurityOrigin::createFromString(toImpl(string)->string());
+ return toAPI(securityOrigin.release().leakRef());
+}
+
+WKSecurityOriginRef WKSecurityOriginCreateFromDatabaseIdentifier(WKStringRef identifier)
+{
+ RefPtr<WebSecurityOrigin> securityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(toImpl(identifier)->string());
return toAPI(securityOrigin.release().leakRef());
}
@@ -53,6 +59,11 @@ WKStringRef WKSecurityOriginCopyDatabaseIdentifier(WKSecurityOriginRef securityO
return toCopiedAPI(toImpl(securityOrigin)->databaseIdentifier());
}
+WKStringRef WKSecurityOriginCopyToString(WKSecurityOriginRef securityOrigin)
+{
+ return toCopiedAPI(toImpl(securityOrigin)->toString());
+}
+
WKStringRef WKSecurityOriginCopyProtocol(WKSecurityOriginRef securityOrigin)
{
return toCopiedAPI(toImpl(securityOrigin)->protocol());
diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h
index 29040d898..d932e93a4 100644
--- a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h
+++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.h
@@ -34,10 +34,12 @@ extern "C" {
WK_EXPORT WKTypeID WKSecurityOriginGetTypeID();
-WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromIdentifier(WKStringRef identifier);
+WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromString(WKStringRef string);
+WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreateFromDatabaseIdentifier(WKStringRef identifier);
WK_EXPORT WKSecurityOriginRef WKSecurityOriginCreate(WKStringRef protocol, WKStringRef host, int port);
WK_EXPORT WKStringRef WKSecurityOriginCopyDatabaseIdentifier(WKSecurityOriginRef securityOrigin);
+WK_EXPORT WKStringRef WKSecurityOriginCopyToString(WKSecurityOriginRef securityOrigin);
WK_EXPORT WKStringRef WKSecurityOriginCopyProtocol(WKSecurityOriginRef securityOrigin);
WK_EXPORT WKStringRef WKSecurityOriginCopyHost(WKSecurityOriginRef securityOrigin);
WK_EXPORT unsigned short WKSecurityOriginGetPort(WKSecurityOriginRef securityOrigin);
diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
index bf71cbaa3..5e4bf69ff 100644
--- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
@@ -688,6 +688,8 @@ inline FindOptions toFindOptions(WKFindOptions wkFindOptions)
findOptions |= FindOptionsShowOverlay;
if (wkFindOptions & kWKFindOptionsShowFindIndicator)
findOptions |= FindOptionsShowFindIndicator;
+ if (wkFindOptions & kWKFindOptionsShowHighlight)
+ findOptions |= FindOptionsShowHighlight;
return static_cast<FindOptions>(findOptions);
}
diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp
index 8b3cdb282..571fe9586 100644
--- a/Source/WebKit2/Shared/ChildProcess.cpp
+++ b/Source/WebKit2/Shared/ChildProcess.cpp
@@ -30,6 +30,8 @@
#include <unistd.h>
#endif
+using namespace WebCore;
+
namespace WebKit {
void ChildProcess::disableTermination()
diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h
index 4259830d8..50eceb594 100644
--- a/Source/WebKit2/Shared/ChildProcess.h
+++ b/Source/WebKit2/Shared/ChildProcess.h
@@ -27,7 +27,7 @@
#define ChildProcess_h
#include "Connection.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
namespace WebKit {
@@ -77,7 +77,7 @@ private:
// after a given period of time.
unsigned m_terminationCounter;
- RunLoop::Timer<ChildProcess> m_terminationTimer;
+ WebCore::RunLoop::Timer<ChildProcess> m_terminationTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/EditorState.cpp b/Source/WebKit2/Shared/EditorState.cpp
index dc997a329..6e44a0f15 100644
--- a/Source/WebKit2/Shared/EditorState.cpp
+++ b/Source/WebKit2/Shared/EditorState.cpp
@@ -44,8 +44,10 @@ void EditorState::encode(CoreIPC::ArgumentEncoder* encoder) const
#if PLATFORM(QT)
encoder->encode(cursorPosition);
encoder->encode(anchorPosition);
- encoder->encode(microFocus);
+ encoder->encode(editorRect);
+ encoder->encode(cursorRect);
encoder->encode(compositionRect);
+ encoder->encode(inputMethodHints);
encoder->encode(selectedText);
encoder->encode(surroundingText);
#endif
@@ -81,12 +83,18 @@ bool EditorState::decode(CoreIPC::ArgumentDecoder* decoder, EditorState& result)
if (!decoder->decode(result.anchorPosition))
return false;
- if (!decoder->decode(result.microFocus))
+ if (!decoder->decode(result.editorRect))
+ return false;
+
+ if (!decoder->decode(result.cursorRect))
return false;
if (!decoder->decode(result.compositionRect))
return false;
+ if (!decoder->decode(result.inputMethodHints))
+ return false;
+
if (!decoder->decode(result.selectedText))
return false;
diff --git a/Source/WebKit2/Shared/EditorState.h b/Source/WebKit2/Shared/EditorState.h
index 52324d5c0..ac1d793ac 100644
--- a/Source/WebKit2/Shared/EditorState.h
+++ b/Source/WebKit2/Shared/EditorState.h
@@ -45,6 +45,7 @@ struct EditorState {
#if PLATFORM(QT)
, cursorPosition(0)
, anchorPosition(0)
+ , inputMethodHints(0)
#endif
{
}
@@ -63,8 +64,12 @@ struct EditorState {
unsigned cursorPosition;
unsigned anchorPosition;
- WebCore::IntRect microFocus;
+ WebCore::IntRect editorRect;
+ WebCore::IntRect cursorRect;
WebCore::IntRect compositionRect;
+
+ uint64_t inputMethodHints;
+
WTF::String selectedText;
WTF::String surroundingText;
#endif
diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp
index 23d3ef982..ce11935ad 100644
--- a/Source/WebKit2/Shared/PrintInfo.cpp
+++ b/Source/WebKit2/Shared/PrintInfo.cpp
@@ -30,6 +30,10 @@
#include "ArgumentEncoder.h"
#include "Arguments.h"
+#if PLATFORM(GTK)
+#include "ArgumentCodersGtk.h"
+#endif
+
namespace WebKit {
PrintInfo::PrintInfo()
@@ -42,11 +46,25 @@ PrintInfo::PrintInfo()
void PrintInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(CoreIPC::In(pageSetupScaleFactor, availablePaperWidth, availablePaperHeight));
+#if PLATFORM(GTK)
+ CoreIPC::encode(encoder, printSettings.get());
+ CoreIPC::encode(encoder, pageSetup.get());
+#endif
}
bool PrintInfo::decode(CoreIPC::ArgumentDecoder* decoder, PrintInfo& info)
{
- return decoder->decode(CoreIPC::Out(info.pageSetupScaleFactor, info.availablePaperWidth, info.availablePaperHeight));
+ if (!decoder->decode(CoreIPC::Out(info.pageSetupScaleFactor, info.availablePaperWidth, info.availablePaperHeight)))
+ return false;
+
+#if PLATFORM(GTK)
+ if (!CoreIPC::decode(decoder, info.printSettings))
+ return false;
+ if (!CoreIPC::decode(decoder, info.pageSetup))
+ return false;
+#endif
+
+ return true;
}
}
diff --git a/Source/WebKit2/Shared/PrintInfo.h b/Source/WebKit2/Shared/PrintInfo.h
index 502be9361..b73b7c5e3 100644
--- a/Source/WebKit2/Shared/PrintInfo.h
+++ b/Source/WebKit2/Shared/PrintInfo.h
@@ -30,6 +30,10 @@
#if PLATFORM(MAC)
OBJC_CLASS NSPrintInfo;
+#elif PLATFORM(GTK)
+typedef struct _GtkPrintSettings GtkPrintSettings;
+typedef struct _GtkPageSetup GtkPageSetup;
+#include <wtf/gobject/GRefPtr.h>
#else
// FIXME: This should use the windows equivalent.
class NSPrintInfo;
@@ -44,12 +48,21 @@ namespace WebKit {
struct PrintInfo {
PrintInfo();
+#if PLATFORM(GTK)
+ explicit PrintInfo(GtkPrintSettings*, GtkPageSetup*);
+#else
explicit PrintInfo(NSPrintInfo *);
+#endif
float pageSetupScaleFactor;
float availablePaperWidth;
float availablePaperHeight;
+#if PLATFORM(GTK)
+ GRefPtr<GtkPrintSettings> printSettings;
+ GRefPtr<GtkPageSetup> pageSetup;
+#endif
+
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, PrintInfo&);
};
diff --git a/Source/WebKit2/Shared/ShareableBitmap.h b/Source/WebKit2/Shared/ShareableBitmap.h
index 12cd7ab55..c78a14e09 100644
--- a/Source/WebKit2/Shared/ShareableBitmap.h
+++ b/Source/WebKit2/Shared/ShareableBitmap.h
@@ -135,6 +135,7 @@ public:
// This creates a QImage that directly references the shared bitmap data.
// This is only safe to use when we know that the contents of the shareable bitmap won't change.
QImage createQImage();
+ void swizzleRGB();
#endif
private:
diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h
index c18236937..7ec01d499 100644
--- a/Source/WebKit2/Shared/WebEvent.h
+++ b/Source/WebKit2/Shared/WebEvent.h
@@ -166,11 +166,12 @@ public:
#if PLATFORM(MAC)
enum Phase {
PhaseNone = 0,
- PhaseBegan = 1 << 1,
- PhaseStationary = 1 << 2,
- PhaseChanged = 1 << 3,
- PhaseEnded = 1 << 4,
- PhaseCancelled = 1 << 5,
+ PhaseBegan = 1 << 0,
+ PhaseStationary = 1 << 1,
+ PhaseChanged = 1 << 2,
+ PhaseEnded = 1 << 3,
+ PhaseCancelled = 1 << 4,
+ PhaseMayBegin = 1 << 5,
};
#endif
diff --git a/Source/WebKit2/Shared/WebFindOptions.h b/Source/WebKit2/Shared/WebFindOptions.h
index 9c2a89969..272b3d7d7 100644
--- a/Source/WebKit2/Shared/WebFindOptions.h
+++ b/Source/WebKit2/Shared/WebFindOptions.h
@@ -35,7 +35,8 @@ enum FindOptions {
FindOptionsBackwards = 1 << 3,
FindOptionsWrapAround = 1 << 4,
FindOptionsShowOverlay = 1 << 5,
- FindOptionsShowFindIndicator = 1 << 6
+ FindOptionsShowFindIndicator = 1 << 6,
+ FindOptionsShowHighlight = 1 << 7
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebGraphicsContext.cpp b/Source/WebKit2/Shared/WebGraphicsContext.cpp
index 72220b319..01dfcfddf 100644
--- a/Source/WebKit2/Shared/WebGraphicsContext.cpp
+++ b/Source/WebKit2/Shared/WebGraphicsContext.cpp
@@ -26,9 +26,9 @@
#include "config.h"
#include "WebGraphicsContext.h"
-#if PLATFORM(GTK)
-#include <WebCore/PlatformContextCairo.h>
-#endif
+#if USE(CAIRO)
+#include <WebCore/PlatformContextCairo.h>
+#endif
using namespace WebCore;
@@ -37,7 +37,7 @@ namespace WebKit {
WebGraphicsContext::WebGraphicsContext(GraphicsContext* graphicsContext)
#if USE(CG)
: m_platformContext(graphicsContext->platformContext())
-#elif PLATFORM(GTK)
+#elif USE(CAIRO)
: m_platformContext(graphicsContext->platformContext()->cr())
#endif
{
diff --git a/Source/WebKit2/Shared/WebGraphicsContext.h b/Source/WebKit2/Shared/WebGraphicsContext.h
index 5f72aae03..8585d34a9 100644
--- a/Source/WebKit2/Shared/WebGraphicsContext.h
+++ b/Source/WebKit2/Shared/WebGraphicsContext.h
@@ -32,8 +32,8 @@
#if USE(CG)
#include <wtf/RetainPtr.h>
-#elif PLATFORM(GTK)
-#include "RefPtrCairo.h"
+#elif USE(CAIRO)
+#include <WebCore/RefPtrCairo.h>
#endif
namespace WebKit {
@@ -49,7 +49,7 @@ public:
#if USE(CG)
CGContextRef platformContext() { return m_platformContext.get(); }
-#elif PLATFORM(GTK)
+#elif USE(CAIRO)
cairo_t* platformContext() { return m_platformContext.get(); }
#endif
@@ -61,7 +61,7 @@ private:
#if USE(CG)
RetainPtr<CGContextRef> m_platformContext;
-#elif PLATFORM(GTK)
+#elif USE(CAIRO)
RefPtr<cairo_t> m_platformContext;
#endif
};
diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.h b/Source/WebKit2/Shared/WebLayerTreeInfo.h
index aae0ef0af..54e1cb5ba 100644
--- a/Source/WebKit2/Shared/WebLayerTreeInfo.h
+++ b/Source/WebKit2/Shared/WebLayerTreeInfo.h
@@ -29,8 +29,6 @@
#include "GraphicsLayer.h"
#include "ShareableBitmap.h"
-using namespace WebCore;
-
namespace WebKit {
typedef uint32_t WebLayerID;
@@ -38,12 +36,12 @@ enum { InvalidWebLayerID = 0 };
struct WebLayerUpdateInfo {
WebLayerUpdateInfo() { }
- WebLayerUpdateInfo(const IntRect& r)
+ WebLayerUpdateInfo(const WebCore::IntRect& r)
: layerID(InvalidWebLayerID)
, rect(r) { }
WebLayerID layerID;
- IntRect rect;
+ WebCore::IntRect rect;
ShareableBitmap::Handle bitmapHandle;
void encode(CoreIPC::ArgumentEncoder*) const;
@@ -53,9 +51,9 @@ struct WebLayerUpdateInfo {
struct WebLayerAnimation {
WebLayerAnimation()
: operation(InvalidAnimation)
- , keyframeList(AnimatedPropertyInvalid)
+ , keyframeList(WebCore::AnimatedPropertyInvalid)
, startTime(0) { }
- WebLayerAnimation(const KeyframeValueList& valueList)
+ WebLayerAnimation(const WebCore::KeyframeValueList& valueList)
: operation(InvalidAnimation)
, keyframeList(valueList)
, startTime(0) { }
@@ -67,9 +65,9 @@ struct WebLayerAnimation {
PauseAnimation,
InvalidAnimation
} operation;
- IntSize boxSize;
- RefPtr<Animation> animation;
- KeyframeValueList keyframeList;
+ WebCore::IntSize boxSize;
+ RefPtr<WebCore::Animation> animation;
+ WebCore::KeyframeValueList keyframeList;
double startTime;
void encode(CoreIPC::ArgumentEncoder*) const;
@@ -93,12 +91,12 @@ struct WebLayerInfo {
WebLayerID mask;
int64_t imageBackingStoreID;
- FloatPoint pos;
- FloatPoint3D anchorPoint;
- FloatSize size;
- TransformationMatrix transform;
- TransformationMatrix childrenTransform;
- IntRect contentsRect;
+ WebCore::FloatPoint pos;
+ WebCore::FloatPoint3D anchorPoint;
+ WebCore::FloatSize size;
+ WebCore::TransformationMatrix transform;
+ WebCore::TransformationMatrix childrenTransform;
+ WebCore::IntRect contentsRect;
float opacity;
union {
diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp
index 2e4d99db1..08bedb61f 100644
--- a/Source/WebKit2/Shared/WebPageCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp
@@ -47,6 +47,7 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(useFixedLayout);
encoder->encode(fixedLayoutSize);
encoder->encodeEnum(paginationMode);
+ encoder->encode(paginationBehavesLikeColumns);
encoder->encode(pageLength);
encoder->encode(gapBetweenPages);
encoder->encode(userAgent);
@@ -55,6 +56,7 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(canRunBeforeUnloadConfirmPanel);
encoder->encode(canRunModal);
encoder->encode(deviceScaleFactor);
+ encoder->encode(mediaVolume);
#if PLATFORM(MAC)
encoder->encode(isSmartInsertDeleteEnabled);
@@ -95,6 +97,8 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decodeEnum(parameters.paginationMode))
return false;
+ if (!decoder->decode(parameters.paginationBehavesLikeColumns))
+ return false;
if (!decoder->decode(parameters.pageLength))
return false;
if (!decoder->decode(parameters.gapBetweenPages))
@@ -111,6 +115,8 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decode(parameters.deviceScaleFactor))
return false;
+ if (!decoder->decode(parameters.mediaVolume))
+ return false;
#if PLATFORM(MAC)
if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.h b/Source/WebKit2/Shared/WebPageCreationParameters.h
index 972dcb083..7e4f63a4c 100644
--- a/Source/WebKit2/Shared/WebPageCreationParameters.h
+++ b/Source/WebKit2/Shared/WebPageCreationParameters.h
@@ -64,6 +64,7 @@ struct WebPageCreationParameters {
WebCore::IntSize fixedLayoutSize;
WebCore::Page::Pagination::Mode paginationMode;
+ bool paginationBehavesLikeColumns;
double pageLength;
double gapBetweenPages;
@@ -76,6 +77,8 @@ struct WebPageCreationParameters {
bool canRunModal;
float deviceScaleFactor;
+
+ float mediaVolume;
#if PLATFORM(MAC)
bool isSmartInsertDeleteEnabled;
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp
index 138f69105..8668bec0c 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.cpp
+++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp
@@ -47,9 +47,13 @@ namespace WebPreferencesKey {
} // namespace WebPreferencesKey
+typedef HashMap<String, bool> BoolOverridesMap;
-static bool hasXSSAuditorEnabledTestRunnerOverride;
-static bool xssAuditorEnabledTestRunnerOverride;
+static BoolOverridesMap& boolTestRunnerOverridesMap()
+{
+ DEFINE_STATIC_LOCAL(BoolOverridesMap, map, ());
+ return map;
+}
WebPreferencesStore::WebPreferencesStore()
{
@@ -73,22 +77,17 @@ bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferenc
return false;
if (!decoder->decode(result.m_doubleValues))
return false;
-
- if (hasXSSAuditorEnabledTestRunnerOverride)
- result.m_boolValues.set(WebPreferencesKey::xssAuditorEnabledKey(), xssAuditorEnabledTestRunnerOverride);
-
return true;
}
-void WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(bool enabled)
+void WebPreferencesStore::overrideBoolValueForKey(const String& key, bool value)
{
- hasXSSAuditorEnabledTestRunnerOverride = true;
- xssAuditorEnabledTestRunnerOverride = enabled;
+ boolTestRunnerOverridesMap().set(key, value);
}
void WebPreferencesStore::removeTestRunnerOverrides()
{
- hasXSSAuditorEnabledTestRunnerOverride = false;
+ boolTestRunnerOverridesMap().clear();
}
@@ -185,6 +184,10 @@ bool WebPreferencesStore::setBoolValueForKey(const String& key, bool value)
bool WebPreferencesStore::getBoolValueForKey(const String& key) const
{
+ // FIXME: Extend overriding to other key types used from LayoutTestController.
+ BoolOverridesMap::const_iterator it = boolTestRunnerOverridesMap().find(key);
+ if (it != boolTestRunnerOverridesMap().end())
+ return it->second;
return valueForKey(m_boolValues, key);
}
diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h
index 8ff2f7515..0cdc97594 100644
--- a/Source/WebKit2/Shared/WebPreferencesStore.h
+++ b/Source/WebKit2/Shared/WebPreferencesStore.h
@@ -66,10 +66,12 @@ namespace WebKit {
macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true) \
macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false) \
macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \
+ macro(ForceCompositingMode, forceCompositingMode, Bool, bool, false) \
macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, false) \
macro(CanvasUsesAcceleratedDrawing, canvasUsesAcceleratedDrawing, Bool, bool, true) \
macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \
macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \
+ macro(CSSCustomFilterEnabled, cssCustomFilterEnabled, Bool, bool, true) \
macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \
macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED) \
@@ -102,6 +104,7 @@ namespace WebKit {
macro(ShouldDisplaySubtitles, shouldDisplaySubtitles, Bool, bool, false) \
macro(ShouldDisplayCaptions, shouldDisplayCaptions, Bool, bool, false) \
macro(ShouldDisplayTextDescriptions, shouldDisplayTextDescriptions, Bool, bool, false) \
+ macro(NotificationsEnabled, notificationsEnabled, Bool, bool, true) \
\
#define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
@@ -126,6 +129,7 @@ namespace WebKit {
macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 854) \
macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
+ macro(InspectorAttachedHeight, inspectorAttachedHeight, UInt32, uint32_t, 300) \
\
#if PLATFORM(WIN)
@@ -152,7 +156,7 @@ namespace WebKit {
macro(PictographFontFamily, pictographFontFamily, String, String, "Apple Color Emoji") \
\
-#elif PLATFORM(QT) || PLATFORM(GTK)
+#elif PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
macro(StandardFontFamily, standardFontFamily, String, String, "Times") \
@@ -210,7 +214,8 @@ struct WebPreferencesStore {
bool setDoubleValueForKey(const String& key, double value);
double getDoubleValueForKey(const String& key) const;
- static void overrideXSSAuditorEnabledForTestRunner(bool);
+ // For WebKitTestRunner usage.
+ static void overrideBoolValueForKey(const String& key, bool value);
static void removeTestRunnerOverrides();
HashMap<String, String> m_stringValues;
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
index 776184b0a..8e1d16485 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
@@ -67,7 +67,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
#if ENABLE(PLUGIN_PROCESS)
encoder->encode(disablePluginProcessMessageTimeout);
#endif
- encoder->encode(languageCode);
+ encoder->encode(languages);
encoder->encode(textCheckerState);
encoder->encode(fullKeyboardAccessEnabled);
encoder->encode(defaultRequestTimeoutInterval);
@@ -99,6 +99,10 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
#if PLATFORM(QT)
encoder->encode(cookieStorageDirectory);
#endif
+
+#if ENABLE(NOTIFICATIONS)
+ encoder->encode(notificationPermissions);
+#endif
}
bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebProcessCreationParameters& parameters)
@@ -138,7 +142,7 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
#endif
- if (!decoder->decode(parameters.languageCode))
+ if (!decoder->decode(parameters.languages))
return false;
if (!decoder->decode(parameters.textCheckerState))
return false;
@@ -193,6 +197,11 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
return false;
#endif
+#if ENABLE(NOTIFICATIONS)
+ if (!decoder->decode(parameters.notificationPermissions))
+ return false;
+#endif
+
return true;
}
diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h
index 9b1f34e1e..3a3764d44 100644
--- a/Source/WebKit2/Shared/WebProcessCreationParameters.h
+++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h
@@ -31,6 +31,7 @@
#include "TextCheckerState.h"
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(MAC)
@@ -77,7 +78,7 @@ struct WebProcessCreationParameters {
bool disablePluginProcessMessageTimeout;
#endif
- String languageCode;
+ Vector<String> languages;
TextCheckerState textCheckerState;
@@ -121,6 +122,10 @@ struct WebProcessCreationParameters {
#if PLATFORM(QT)
String cookieStorageDirectory;
#endif
+
+#if ENABLE(NOTIFICATIONS)
+ HashMap<String, bool> notificationPermissions;
+#endif
};
} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebSecurityOrigin.h b/Source/WebKit2/Shared/WebSecurityOrigin.h
index 347f83eda..66074c54a 100644
--- a/Source/WebKit2/Shared/WebSecurityOrigin.h
+++ b/Source/WebKit2/Shared/WebSecurityOrigin.h
@@ -36,7 +36,15 @@ class WebSecurityOrigin : public APIObject {
public:
static const Type APIType = TypeSecurityOrigin;
- static PassRefPtr<WebSecurityOrigin> create(const String& identifier)
+ static PassRefPtr<WebSecurityOrigin> createFromString(const String& string)
+ {
+ RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(string);
+ if (!securityOrigin)
+ return 0;
+ return adoptRef(new WebSecurityOrigin(securityOrigin.release()));
+ }
+
+ static PassRefPtr<WebSecurityOrigin> createFromDatabaseIdentifier(const String& identifier)
{
RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromDatabaseIdentifier(identifier);
if (!securityOrigin)
@@ -57,6 +65,7 @@ public:
unsigned short port() const { return m_securityOrigin->port(); }
const String databaseIdentifier() const { return m_securityOrigin->databaseIdentifier(); }
+ const String toString() const { return m_securityOrigin->toString(); }
private:
WebSecurityOrigin(PassRefPtr<WebCore::SecurityOrigin> securityOrigin)
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
index 0cfbd4ec4..8b802e9f7 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "ArgumentCodersGtk.h"
+#include "DataReference.h"
#include "ShareableBitmap.h"
#include "WebCoreArgumentCoders.h"
#include <WebCore/DataObjectGtk.h>
@@ -33,6 +34,7 @@
#include <WebCore/GraphicsContext.h>
#include <WebCore/GtkVersioning.h>
#include <WebCore/PlatformContextCairo.h>
+#include <wtf/gobject/GOwnPtr.h>
using namespace WebCore;
using namespace WebKit;
@@ -216,4 +218,76 @@ bool ArgumentCoder<DragData>::decode(ArgumentDecoder* decoder, DragData& dragDat
return true;
}
+static void encodeGKeyFile(ArgumentEncoder* encoder, GKeyFile* keyFile)
+{
+ gsize dataSize;
+ GOwnPtr<char> data(g_key_file_to_data(keyFile, &dataSize, 0));
+ DataReference dataReference(reinterpret_cast<uint8_t*>(data.get()), dataSize);
+ encoder->encode(dataReference);
+}
+
+static bool decodeGKeyFile(ArgumentDecoder* decoder, GOwnPtr<GKeyFile>& keyFile)
+{
+ DataReference dataReference;
+ if (!decoder->decode(dataReference))
+ return false;
+
+ if (!dataReference.size())
+ return true;
+
+ keyFile.set(g_key_file_new());
+ if (!g_key_file_load_from_data(keyFile.get(), reinterpret_cast<const gchar*>(dataReference.data()), dataReference.size(), G_KEY_FILE_NONE, 0)) {
+ keyFile.clear();
+ return false;
+ }
+
+ return true;
+}
+
+void encode(ArgumentEncoder* encoder, GtkPrintSettings* printSettings)
+{
+ GOwnPtr<GKeyFile> keyFile(g_key_file_new());
+ gtk_print_settings_to_key_file(printSettings, keyFile.get(), "Print Settings");
+ encodeGKeyFile(encoder, keyFile.get());
+}
+
+bool decode(ArgumentDecoder* decoder, GRefPtr<GtkPrintSettings>& printSettings)
+{
+ GOwnPtr<GKeyFile> keyFile;
+ if (!decodeGKeyFile(decoder, keyFile))
+ return false;
+
+ printSettings = adoptGRef(gtk_print_settings_new());
+ if (!keyFile)
+ return true;
+
+ if (!gtk_print_settings_load_key_file(printSettings.get(), keyFile.get(), "Print Settings", 0))
+ printSettings = 0;
+
+ return printSettings;
+}
+
+void encode(ArgumentEncoder* encoder, GtkPageSetup* pageSetup)
+{
+ GOwnPtr<GKeyFile> keyFile(g_key_file_new());
+ gtk_page_setup_to_key_file(pageSetup, keyFile.get(), "Page Setup");
+ encodeGKeyFile(encoder, keyFile.get());
+}
+
+bool decode(ArgumentDecoder* decoder, GRefPtr<GtkPageSetup>& pageSetup)
+{
+ GOwnPtr<GKeyFile> keyFile;
+ if (!decodeGKeyFile(decoder, keyFile))
+ return false;
+
+ pageSetup = adoptGRef(gtk_page_setup_new());
+ if (!keyFile)
+ return true;
+
+ if (!gtk_page_setup_load_key_file(pageSetup.get(), keyFile.get(), "Page Setup", 0))
+ pageSetup = 0;
+
+ return pageSetup;
+}
+
}
diff --git a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
index 82f46d2d8..888424562 100644
--- a/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
+++ b/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.h
@@ -27,6 +27,10 @@
#define ArgumentCodersGtk_h
#include "ArgumentCoders.h"
+#include <wtf/gobject/GRefPtr.h>
+
+typedef struct _GtkPrintSettings GtkPrintSettings;
+typedef struct _GtkPageSetup GtkPageSetup;
namespace WebCore {
class DataObjectGtk;
@@ -40,6 +44,12 @@ template<> struct ArgumentCoder<WebCore::DragData> {
static bool decode(ArgumentDecoder*, WebCore::DragData&);
};
+void encode(ArgumentEncoder*, GtkPrintSettings*);
+bool decode(ArgumentDecoder*, GRefPtr<GtkPrintSettings>&);
+
+void encode(ArgumentEncoder*, GtkPageSetup*);
+bool decode(ArgumentDecoder*, GRefPtr<GtkPageSetup>&);
+
} // namespace CoreIPC
#endif // ArgumentCodersGtk_h
diff --git a/Source/WebKit2/Platform/RunLoop.cpp b/Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp
index e495ecc58..4066b202e 100644
--- a/Source/WebKit2/Platform/RunLoop.cpp
+++ b/Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,47 +24,21 @@
*/
#include "config.h"
-#include "RunLoop.h"
+#include "PrintInfo.h"
-#include <wtf/StdLibExtras.h>
+#include <gtk/gtk.h>
-static RunLoop* s_mainRunLoop;
+namespace WebKit {
-void RunLoop::initializeMainRunLoop()
+PrintInfo::PrintInfo(GtkPrintSettings* settings, GtkPageSetup* pageSetup)
+ : pageSetupScaleFactor(gtk_print_settings_get_scale(settings) / 100.0)
+ , availablePaperWidth(gtk_page_setup_get_paper_width(pageSetup, GTK_UNIT_POINTS) - gtk_page_setup_get_left_margin(pageSetup, GTK_UNIT_POINTS) - gtk_page_setup_get_right_margin(pageSetup, GTK_UNIT_POINTS))
+ , availablePaperHeight(gtk_page_setup_get_paper_height(pageSetup, GTK_UNIT_POINTS) - gtk_page_setup_get_top_margin(pageSetup, GTK_UNIT_POINTS) - gtk_page_setup_get_bottom_margin(pageSetup, GTK_UNIT_POINTS))
+ , printSettings(settings)
+ , pageSetup(pageSetup)
{
- if (s_mainRunLoop)
- return;
- s_mainRunLoop = RunLoop::current();
+ ASSERT(settings);
+ ASSERT(pageSetup);
}
-RunLoop* RunLoop::current()
-{
- DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<RunLoop>, runLoopData, ());
- return &*runLoopData;
-}
-
-RunLoop* RunLoop::main()
-{
- ASSERT(s_mainRunLoop);
- return s_mainRunLoop;
-}
-
-void RunLoop::performWork()
-{
- Vector<Function<void()> > functionQueue;
- {
- MutexLocker locker(m_functionQueueLock);
- m_functionQueue.swap(functionQueue);
- }
-
- for (size_t i = 0; i < functionQueue.size(); ++i)
- functionQueue[i]();
-}
-
-void RunLoop::dispatch(const Function<void()>& function)
-{
- MutexLocker locker(m_functionQueueLock);
- m_functionQueue.append(function);
-
- wakeUp();
}
diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm
index 8e7238727..59d6e9d5a 100644
--- a/Source/WebKit2/Shared/mac/WebEventFactory.mm
+++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm
@@ -28,6 +28,7 @@
#import "WebKitSystemInterface.h"
#import <wtf/ASCIICType.h>
+#import <WebCore/PlatformEventFactoryMac.h>
#import <WebCore/Scrollbar.h>
#import <WebCore/WindowsKeyboardCodes.h>
@@ -35,6 +36,8 @@ using namespace WebCore;
namespace WebKit {
+// FIXME: This is a huge copy/paste from WebCore/PlatformEventFactoryMac.mm. The code should be merged.
+
static WebMouseEvent::Button currentMouseButton()
{
NSUInteger pressedMouseButtons = [NSEvent pressedMouseButtons];
@@ -200,6 +203,11 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
phase |= WebWheelEvent::PhaseEnded;
if ([event phase] & NSEventPhaseCancelled)
phase |= WebWheelEvent::PhaseCancelled;
+#if !defined(BUILDING_ON_LION)
+ if ([event phase] & NSEventPhaseMayBegin)
+ phase |= WebWheelEvent::PhaseMayBegin;
+#endif
+
return static_cast<WebWheelEvent::Phase>(phase);
#else
return WebWheelEvent::PhaseNone;
@@ -270,327 +278,6 @@ static inline String unmodifiedTextFromEvent(NSEvent* event)
return String([event charactersIgnoringModifiers]);
}
-static String keyIdentifierForKeyEvent(NSEvent* event)
-{
- if ([event type] == NSFlagsChanged)
- switch ([event keyCode]) {
- case 54: // Right Command
- case 55: // Left Command
- return String("Meta");
-
- case 57: // Capslock
- return String("CapsLock");
-
- case 56: // Left Shift
- case 60: // Right Shift
- return String("Shift");
-
- case 58: // Left Alt
- case 61: // Right Alt
- return String("Alt");
-
- case 59: // Left Ctrl
- case 62: // Right Ctrl
- return String("Control");
-
- default:
- ASSERT_NOT_REACHED();
- return String("");
- }
-
- NSString *s = [event charactersIgnoringModifiers];
- if ([s length] != 1)
- return String("Unidentified");
-
- unichar c = [s characterAtIndex:0];
- switch (c) {
- // Each identifier listed in the DOM spec is listed here.
- // Many are simply commented out since they do not appear on standard Macintosh keyboards
- // or are on a key that doesn't have a corresponding character.
-
- // "Accept"
- // "AllCandidates"
-
- // "Alt"
- case NSMenuFunctionKey:
- return String("Alt");
-
- // "Apps"
- // "BrowserBack"
- // "BrowserForward"
- // "BrowserHome"
- // "BrowserRefresh"
- // "BrowserSearch"
- // "BrowserStop"
- // "CapsLock"
-
- // "Clear"
- case NSClearLineFunctionKey:
- return String("Clear");
-
- // "CodeInput"
- // "Compose"
- // "Control"
- // "Crsel"
- // "Convert"
- // "Copy"
- // "Cut"
-
- // "Down"
- case NSDownArrowFunctionKey:
- return String("Down");
- // "End"
- case NSEndFunctionKey:
- return String("End");
- // "Enter"
- case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM
- return String("Enter");
-
- // "EraseEof"
-
- // "Execute"
- case NSExecuteFunctionKey:
- return String("Execute");
-
- // "Exsel"
-
- // "F1"
- case NSF1FunctionKey:
- return String("F1");
- // "F2"
- case NSF2FunctionKey:
- return String("F2");
- // "F3"
- case NSF3FunctionKey:
- return String("F3");
- // "F4"
- case NSF4FunctionKey:
- return String("F4");
- // "F5"
- case NSF5FunctionKey:
- return String("F5");
- // "F6"
- case NSF6FunctionKey:
- return String("F6");
- // "F7"
- case NSF7FunctionKey:
- return String("F7");
- // "F8"
- case NSF8FunctionKey:
- return String("F8");
- // "F9"
- case NSF9FunctionKey:
- return String("F9");
- // "F10"
- case NSF10FunctionKey:
- return String("F10");
- // "F11"
- case NSF11FunctionKey:
- return String("F11");
- // "F12"
- case NSF12FunctionKey:
- return String("F12");
- // "F13"
- case NSF13FunctionKey:
- return String("F13");
- // "F14"
- case NSF14FunctionKey:
- return String("F14");
- // "F15"
- case NSF15FunctionKey:
- return String("F15");
- // "F16"
- case NSF16FunctionKey:
- return String("F16");
- // "F17"
- case NSF17FunctionKey:
- return String("F17");
- // "F18"
- case NSF18FunctionKey:
- return String("F18");
- // "F19"
- case NSF19FunctionKey:
- return String("F19");
- // "F20"
- case NSF20FunctionKey:
- return String("F20");
- // "F21"
- case NSF21FunctionKey:
- return String("F21");
- // "F22"
- case NSF22FunctionKey:
- return String("F22");
- // "F23"
- case NSF23FunctionKey:
- return String("F23");
- // "F24"
- case NSF24FunctionKey:
- return String("F24");
-
- // "FinalMode"
-
- // "Find"
- case NSFindFunctionKey:
- return String("Find");
-
- // "FullWidth"
- // "HalfWidth"
- // "HangulMode"
- // "HanjaMode"
-
- // "Help"
- case NSHelpFunctionKey:
- return String("Help");
-
- // "Hiragana"
-
- // "Home"
- case NSHomeFunctionKey:
- return String("Home");
- // "Insert"
- case NSInsertFunctionKey:
- return String("Insert");
-
- // "JapaneseHiragana"
- // "JapaneseKatakana"
- // "JapaneseRomaji"
- // "JunjaMode"
- // "KanaMode"
- // "KanjiMode"
- // "Katakana"
- // "LaunchApplication1"
- // "LaunchApplication2"
- // "LaunchMail"
-
- // "Left"
- case NSLeftArrowFunctionKey:
- return String("Left");
-
- // "Meta"
- // "MediaNextTrack"
- // "MediaPlayPause"
- // "MediaPreviousTrack"
- // "MediaStop"
-
- // "ModeChange"
- case NSModeSwitchFunctionKey:
- return String("ModeChange");
-
- // "Nonconvert"
- // "NumLock"
-
- // "PageDown"
- case NSPageDownFunctionKey:
- return String("PageDown");
- // "PageUp"
- case NSPageUpFunctionKey:
- return String("PageUp");
-
- // "Paste"
-
- // "Pause"
- case NSPauseFunctionKey:
- return String("Pause");
-
- // "Play"
- // "PreviousCandidate"
-
- // "PrintScreen"
- case NSPrintScreenFunctionKey:
- return String("PrintScreen");
-
- // "Process"
- // "Props"
-
- // "Right"
- case NSRightArrowFunctionKey:
- return String("Right");
-
- // "RomanCharacters"
-
- // "Scroll"
- case NSScrollLockFunctionKey:
- return String("Scroll");
- // "Select"
- case NSSelectFunctionKey:
- return String("Select");
-
- // "SelectMedia"
- // "Shift"
-
- // "Stop"
- case NSStopFunctionKey:
- return String("Stop");
- // "Up"
- case NSUpArrowFunctionKey:
- return String("Up");
- // "Undo"
- case NSUndoFunctionKey:
- return String("Undo");
-
- // "VolumeDown"
- // "VolumeMute"
- // "VolumeUp"
- // "Win"
- // "Zoom"
-
- // More function keys, not in the key identifier specification.
- case NSF25FunctionKey:
- return String("F25");
- case NSF26FunctionKey:
- return String("F26");
- case NSF27FunctionKey:
- return String("F27");
- case NSF28FunctionKey:
- return String("F28");
- case NSF29FunctionKey:
- return String("F29");
- case NSF30FunctionKey:
- return String("F30");
- case NSF31FunctionKey:
- return String("F31");
- case NSF32FunctionKey:
- return String("F32");
- case NSF33FunctionKey:
- return String("F33");
- case NSF34FunctionKey:
- return String("F34");
- case NSF35FunctionKey:
- return String("F35");
-
- // Turn 0x7F into 0x08, because backspace needs to always be 0x08.
- case 0x7F:
- return String("U+0008");
- // Standard says that DEL becomes U+007F.
- case NSDeleteFunctionKey:
- return String("U+007F");
-
- // Always use 0x09 for tab instead of AppKit's backtab character.
- case NSBackTabCharacter:
- return String("U+0009");
-
- case NSBeginFunctionKey:
- case NSBreakFunctionKey:
- case NSClearDisplayFunctionKey:
- case NSDeleteCharFunctionKey:
- case NSDeleteLineFunctionKey:
- case NSInsertCharFunctionKey:
- case NSInsertLineFunctionKey:
- case NSNextFunctionKey:
- case NSPrevFunctionKey:
- case NSPrintFunctionKey:
- case NSRedoFunctionKey:
- case NSResetFunctionKey:
- case NSSysReqFunctionKey:
- case NSSystemFunctionKey:
- case NSUserFunctionKey:
- // FIXME: We should use something other than the vendor-area Unicode values for the above keys.
- // For now, just fall through to the default.
- default:
- return String::format("U+%04X", toASCIIUpper(c));
- }
-}
-
static bool isKeypadEvent(NSEvent* event)
{
// Check that this is the type of event that has a keyCode.
@@ -628,377 +315,6 @@ static bool isKeypadEvent(NSEvent* event)
return false;
}
-static int windowsKeyCodeForKeyEvent(NSEvent* event)
-{
- switch ([event keyCode]) {
- // VK_TAB (09) TAB key
- case 48: return 0x09;
-
- // VK_APPS (5D) Right windows/meta key
- case 54: // Right Command
- return 0x5D;
-
- // VK_LWIN (5B) Left windows/meta key
- case 55: // Left Command
- return 0x5B;
-
- // VK_CAPITAL (14) caps locks key
- case 57: // Capslock
- return 0x14;
-
- // VK_SHIFT (10) either shift key
- case 56: // Left Shift
- case 60: // Right Shift
- return 0x10;
-
- // VK_MENU (12) either alt key
- case 58: // Left Alt
- case 61: // Right Alt
- return 0x12;
-
- // VK_CONTROL (11) either ctrl key
- case 59: // Left Ctrl
- case 62: // Right Ctrl
- return 0x11;
-
- // VK_CLEAR (0C) CLEAR key
- case 71: return 0x0C;
-
- // VK_NUMPAD0 (60) Numeric keypad 0 key
- case 82: return 0x60;
- // VK_NUMPAD1 (61) Numeric keypad 1 key
- case 83: return 0x61;
- // VK_NUMPAD2 (62) Numeric keypad 2 key
- case 84: return 0x62;
- // VK_NUMPAD3 (63) Numeric keypad 3 key
- case 85: return 0x63;
- // VK_NUMPAD4 (64) Numeric keypad 4 key
- case 86: return 0x64;
- // VK_NUMPAD5 (65) Numeric keypad 5 key
- case 87: return 0x65;
- // VK_NUMPAD6 (66) Numeric keypad 6 key
- case 88: return 0x66;
- // VK_NUMPAD7 (67) Numeric keypad 7 key
- case 89: return 0x67;
- // VK_NUMPAD8 (68) Numeric keypad 8 key
- case 91: return 0x68;
- // VK_NUMPAD9 (69) Numeric keypad 9 key
- case 92: return 0x69;
- // VK_MULTIPLY (6A) Multiply key
- case 67: return 0x6A;
- // VK_ADD (6B) Add key
- case 69: return 0x6B;
-
- // VK_SUBTRACT (6D) Subtract key
- case 78: return 0x6D;
- // VK_DECIMAL (6E) Decimal key
- case 65: return 0x6E;
- // VK_DIVIDE (6F) Divide key
- case 75: return 0x6F;
- }
-
- if ([event type] == NSFlagsChanged)
- return 0;
-
- NSString* s = [event charactersIgnoringModifiers];
- if ([s length] != 1)
- return 0;
-
- switch ([s characterAtIndex:0]) {
- // VK_LBUTTON (01) Left mouse button
- // VK_RBUTTON (02) Right mouse button
- // VK_CANCEL (03) Control-break processing
- // VK_MBUTTON (04) Middle mouse button (three-button mouse)
- // VK_XBUTTON1 (05)
- // VK_XBUTTON2 (06)
-
- // VK_BACK (08) BACKSPACE key
- case 8: case 0x7F: return 0x08;
- // VK_TAB (09) TAB key
- case 9: return 0x09;
-
- // VK_CLEAR (0C) CLEAR key
- // handled by key code above
-
- // VK_RETURN (0D)
- case 0xD: case 3: return 0x0D;
-
- // VK_SHIFT (10) SHIFT key
- // VK_CONTROL (11) CTRL key
- // VK_MENU (12) ALT key
-
- // VK_PAUSE (13) PAUSE key
- case NSPauseFunctionKey: return 0x13;
-
- // VK_CAPITAL (14) CAPS LOCK key
- // VK_KANA (15) Input Method Editor (IME) Kana mode
- // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
- // VK_HANGUL (15) IME Hangul mode
- // VK_JUNJA (17) IME Junja mode
- // VK_FINAL (18) IME final mode
- // VK_HANJA (19) IME Hanja mode
- // VK_KANJI (19) IME Kanji mode
-
- // VK_ESCAPE (1B) ESC key
- case 0x1B: return 0x1B;
-
- // VK_CONVERT (1C) IME convert
- // VK_NONCONVERT (1D) IME nonconvert
- // VK_ACCEPT (1E) IME accept
- // VK_MODECHANGE (1F) IME mode change request
-
- // VK_SPACE (20) SPACEBAR
- case ' ': return 0x20;
- // VK_PRIOR (21) PAGE UP key
- case NSPageUpFunctionKey: return 0x21;
- // VK_NEXT (22) PAGE DOWN key
- case NSPageDownFunctionKey: return 0x22;
- // VK_END (23) END key
- case NSEndFunctionKey: return 0x23;
- // VK_HOME (24) HOME key
- case NSHomeFunctionKey: return 0x24;
- // VK_LEFT (25) LEFT ARROW key
- case NSLeftArrowFunctionKey: return 0x25;
- // VK_UP (26) UP ARROW key
- case NSUpArrowFunctionKey: return 0x26;
- // VK_RIGHT (27) RIGHT ARROW key
- case NSRightArrowFunctionKey: return 0x27;
- // VK_DOWN (28) DOWN ARROW key
- case NSDownArrowFunctionKey: return 0x28;
- // VK_SELECT (29) SELECT key
- case NSSelectFunctionKey: return 0x29;
- // VK_PRINT (2A) PRINT key
- case NSPrintFunctionKey: return 0x2A;
- // VK_EXECUTE (2B) EXECUTE key
- case NSExecuteFunctionKey: return 0x2B;
- // VK_SNAPSHOT (2C) PRINT SCREEN key
- case NSPrintScreenFunctionKey: return 0x2C;
- // VK_INSERT (2D) INS key
- case NSInsertFunctionKey: case NSHelpFunctionKey: return 0x2D;
- // VK_DELETE (2E) DEL key
- case NSDeleteFunctionKey: return 0x2E;
-
- // VK_HELP (2F) HELP key
-
- // (30) 0 key
- case '0': case ')': return 0x30;
- // (31) 1 key
- case '1': case '!': return 0x31;
- // (32) 2 key
- case '2': case '@': return 0x32;
- // (33) 3 key
- case '3': case '#': return 0x33;
- // (34) 4 key
- case '4': case '$': return 0x34;
- // (35) 5 key
- case '5': case '%': return 0x35;
- // (36) 6 key
- case '6': case '^': return 0x36;
- // (37) 7 key
- case '7': case '&': return 0x37;
- // (38) 8 key
- case '8': case '*': return 0x38;
- // (39) 9 key
- case '9': case '(': return 0x39;
- // (41) A key
- case 'a': case 'A': return 0x41;
- // (42) B key
- case 'b': case 'B': return 0x42;
- // (43) C key
- case 'c': case 'C': return 0x43;
- // (44) D key
- case 'd': case 'D': return 0x44;
- // (45) E key
- case 'e': case 'E': return 0x45;
- // (46) F key
- case 'f': case 'F': return 0x46;
- // (47) G key
- case 'g': case 'G': return 0x47;
- // (48) H key
- case 'h': case 'H': return 0x48;
- // (49) I key
- case 'i': case 'I': return 0x49;
- // (4A) J key
- case 'j': case 'J': return 0x4A;
- // (4B) K key
- case 'k': case 'K': return 0x4B;
- // (4C) L key
- case 'l': case 'L': return 0x4C;
- // (4D) M key
- case 'm': case 'M': return 0x4D;
- // (4E) N key
- case 'n': case 'N': return 0x4E;
- // (4F) O key
- case 'o': case 'O': return 0x4F;
- // (50) P key
- case 'p': case 'P': return 0x50;
- // (51) Q key
- case 'q': case 'Q': return 0x51;
- // (52) R key
- case 'r': case 'R': return 0x52;
- // (53) S key
- case 's': case 'S': return 0x53;
- // (54) T key
- case 't': case 'T': return 0x54;
- // (55) U key
- case 'u': case 'U': return 0x55;
- // (56) V key
- case 'v': case 'V': return 0x56;
- // (57) W key
- case 'w': case 'W': return 0x57;
- // (58) X key
- case 'x': case 'X': return 0x58;
- // (59) Y key
- case 'y': case 'Y': return 0x59;
- // (5A) Z key
- case 'z': case 'Z': return 0x5A;
-
- // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard)
- // VK_RWIN (5C) Right Windows key (Natural keyboard)
- // VK_APPS (5D) Applications key (Natural keyboard)
- // VK_SLEEP (5F) Computer Sleep key
-
- // VK_NUMPAD0 (60) Numeric keypad 0 key
- // VK_NUMPAD1 (61) Numeric keypad 1 key
- // VK_NUMPAD2 (62) Numeric keypad 2 key
- // VK_NUMPAD3 (63) Numeric keypad 3 key
- // VK_NUMPAD4 (64) Numeric keypad 4 key
- // VK_NUMPAD5 (65) Numeric keypad 5 key
- // VK_NUMPAD6 (66) Numeric keypad 6 key
- // VK_NUMPAD7 (67) Numeric keypad 7 key
- // VK_NUMPAD8 (68) Numeric keypad 8 key
- // VK_NUMPAD9 (69) Numeric keypad 9 key
- // VK_MULTIPLY (6A) Multiply key
- // VK_ADD (6B) Add key
- // handled by key code above
-
- // VK_SEPARATOR (6C) Separator key
-
- // VK_SUBTRACT (6D) Subtract key
- // VK_DECIMAL (6E) Decimal key
- // VK_DIVIDE (6F) Divide key
- // handled by key code above
-
- // VK_F1 (70) F1 key
- case NSF1FunctionKey: return 0x70;
- // VK_F2 (71) F2 key
- case NSF2FunctionKey: return 0x71;
- // VK_F3 (72) F3 key
- case NSF3FunctionKey: return 0x72;
- // VK_F4 (73) F4 key
- case NSF4FunctionKey: return 0x73;
- // VK_F5 (74) F5 key
- case NSF5FunctionKey: return 0x74;
- // VK_F6 (75) F6 key
- case NSF6FunctionKey: return 0x75;
- // VK_F7 (76) F7 key
- case NSF7FunctionKey: return 0x76;
- // VK_F8 (77) F8 key
- case NSF8FunctionKey: return 0x77;
- // VK_F9 (78) F9 key
- case NSF9FunctionKey: return 0x78;
- // VK_F10 (79) F10 key
- case NSF10FunctionKey: return 0x79;
- // VK_F11 (7A) F11 key
- case NSF11FunctionKey: return 0x7A;
- // VK_F12 (7B) F12 key
- case NSF12FunctionKey: return 0x7B;
- // VK_F13 (7C) F13 key
- case NSF13FunctionKey: return 0x7C;
- // VK_F14 (7D) F14 key
- case NSF14FunctionKey: return 0x7D;
- // VK_F15 (7E) F15 key
- case NSF15FunctionKey: return 0x7E;
- // VK_F16 (7F) F16 key
- case NSF16FunctionKey: return 0x7F;
- // VK_F17 (80H) F17 key
- case NSF17FunctionKey: return 0x80;
- // VK_F18 (81H) F18 key
- case NSF18FunctionKey: return 0x81;
- // VK_F19 (82H) F19 key
- case NSF19FunctionKey: return 0x82;
- // VK_F20 (83H) F20 key
- case NSF20FunctionKey: return 0x83;
- // VK_F21 (84H) F21 key
- case NSF21FunctionKey: return 0x84;
- // VK_F22 (85H) F22 key
- case NSF22FunctionKey: return 0x85;
- // VK_F23 (86H) F23 key
- case NSF23FunctionKey: return 0x86;
- // VK_F24 (87H) F24 key
- case NSF24FunctionKey: return 0x87;
-
- // VK_NUMLOCK (90) NUM LOCK key
-
- // VK_SCROLL (91) SCROLL LOCK key
- case NSScrollLockFunctionKey: return 0x91;
-
- // VK_LSHIFT (A0) Left SHIFT key
- // VK_RSHIFT (A1) Right SHIFT key
- // VK_LCONTROL (A2) Left CONTROL key
- // VK_RCONTROL (A3) Right CONTROL key
- // VK_LMENU (A4) Left MENU key
- // VK_RMENU (A5) Right MENU key
- // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
- // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
- // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
- // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
- // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
- // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
- // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
- // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
- // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
- // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
- // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
- // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
- // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
- // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
- // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
- // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
- // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
- // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
-
- // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
- case ';': case ':': return 0xBA;
- // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
- case '=': case '+': return 0xBB;
- // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
- case ',': case '<': return 0xBC;
- // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
- case '-': case '_': return 0xBD;
- // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
- case '.': case '>': return 0xBE;
- // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
- case '/': case '?': return 0xBF;
- // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
- case '`': case '~': return 0xC0;
- // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
- case '[': case '{': return 0xDB;
- // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
- case '\\': case '|': return 0xDC;
- // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
- case ']': case '}': return 0xDD;
- // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
- case '\'': case '"': return 0xDE;
-
- // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
- // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
- // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
- // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
- // VK_ATTN (F6) Attn key
- // VK_CRSEL (F7) CrSel key
- // VK_EXSEL (F8) ExSel key
- // VK_EREOF (F9) Erase EOF key
- // VK_PLAY (FA) Play key
- // VK_ZOOM (FB) Zoom key
- // VK_NONAME (FC) Reserved for future use
- // VK_PA1 (FD) PA1 key
- // VK_OEM_CLEAR (FE) Clear key
- }
-
- return 0;
-}
-
static inline bool isKeyUpEvent(NSEvent *event)
{
if ([event type] != NSFlagsChanged)
diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
index 62e5807f3..abc43b168 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
+++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.cpp
@@ -39,21 +39,13 @@ namespace WebKit {
QtNetworkReplyData::QtNetworkReplyData()
: m_contentLength(0)
- , m_lastModified(0)
{ }
void QtNetworkReplyData::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(m_urlString);
- encoder->encodeEnum(m_operation);
- encoder->encode(m_contentDisposition);
encoder->encode(m_contentType);
encoder->encodeUInt64(m_contentLength);
- encoder->encode(m_location);
- encoder->encodeUInt64(m_lastModified);
- encoder->encode(m_cookie);
- encoder->encode(m_userAgent);
- encoder->encode(m_server);
encoder->encode(m_replyUuid);
encoder->encode(m_dataHandle);
}
@@ -62,24 +54,10 @@ bool QtNetworkReplyData::decode(CoreIPC::ArgumentDecoder* decoder, QtNetworkRepl
{
if (!decoder->decode(destination.m_urlString))
return false;
- if (!decoder->decodeEnum(destination.m_operation))
- return false;
- if (!decoder->decode(destination.m_contentDisposition))
- return false;
if (!decoder->decode(destination.m_contentType))
return false;
if (!decoder->decodeUInt64(destination.m_contentLength))
return false;
- if (!decoder->decode(destination.m_location))
- return false;
- if (!decoder->decodeUInt64(destination.m_lastModified))
- return false;
- if (!decoder->decode(destination.m_cookie))
- return false;
- if (!decoder->decode(destination.m_userAgent))
- return false;
- if (!decoder->decode(destination.m_server))
- return false;
if (!decoder->decode(destination.m_replyUuid))
return false;
if (!decoder->decode(destination.m_dataHandle))
diff --git a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
index d74b422cc..d1565bec2 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
+++ b/Source/WebKit2/Shared/qt/QtNetworkReplyData.h
@@ -39,9 +39,7 @@ class ArgumentDecoder;
namespace WebKit {
-struct QtNetworkReplyData : public WTF::RefCounted<QtNetworkReplyData> {
- WTF_MAKE_NONCOPYABLE(QtNetworkReplyData);
-public:
+struct QtNetworkReplyData {
QtNetworkReplyData();
void encode(CoreIPC::ArgumentEncoder*) const;
@@ -49,20 +47,20 @@ public:
WTF::String m_urlString;
- QNetworkAccessManager::Operation m_operation;
- WTF::String m_contentDisposition;
WTF::String m_contentType;
uint64_t m_contentLength;
- WTF::String m_location;
- uint64_t m_lastModified;
- WTF::String m_cookie;
- WTF::String m_userAgent;
- WTF::String m_server;
String m_replyUuid;
SharedMemory::Handle m_dataHandle;
};
+struct QtRefCountedNetworkReplyData : public WTF::RefCounted<QtRefCountedNetworkReplyData> {
+ QtNetworkReplyData& data() { return m_data; }
+private:
+ QtNetworkReplyData m_data;
+};
+
+
} // namespace WebKit
#endif // QtNetworkReplyData_h
diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
index c6ea6e30e..f210660fd 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
+++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.cpp
@@ -36,6 +36,10 @@
namespace WebKit {
+QtRefCountedNetworkRequestData::QtRefCountedNetworkRequestData(const QtNetworkRequestData& data)
+ : m_data(data)
+{ }
+
QtNetworkRequestData::QtNetworkRequestData()
{ }
@@ -46,14 +50,6 @@ QtNetworkRequestData::QtNetworkRequestData(const QNetworkRequest& request, QNetw
m_replyUuid = QUuid::createUuid().toString();
}
-QtNetworkRequestData::QtNetworkRequestData(const QtNetworkRequestData& origin)
- : RefCounted<QtNetworkRequestData>(),
- m_scheme(origin.m_scheme),
- m_urlString(origin.m_urlString),
- m_replyUuid(origin.m_replyUuid)
-{
-}
-
void QtNetworkRequestData::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(m_scheme);
diff --git a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
index 156796442..082d499cc 100644
--- a/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
+++ b/Source/WebKit2/Shared/qt/QtNetworkRequestData.h
@@ -39,11 +39,9 @@ class QNetworkReply;
namespace WebKit {
-struct QtNetworkRequestData : public WTF::RefCounted<QtNetworkRequestData> {
+struct QtNetworkRequestData {
QtNetworkRequestData();
QtNetworkRequestData(const QNetworkRequest&, QNetworkReply*);
- QtNetworkRequestData(const QtNetworkRequestData&);
-
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, QtNetworkRequestData&);
@@ -52,6 +50,13 @@ struct QtNetworkRequestData : public WTF::RefCounted<QtNetworkRequestData> {
String m_replyUuid;
};
+struct QtRefCountedNetworkRequestData : public WTF::RefCounted<QtRefCountedNetworkRequestData> {
+ QtRefCountedNetworkRequestData(const QtNetworkRequestData&);
+ QtNetworkRequestData& data() { return m_data; }
+private:
+ QtNetworkRequestData m_data;
+};
+
} // namespace WebKit
#endif // QtNetworkRequestData_h
diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
index b0ab2ec16..d5e371def 100644
--- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
+++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
@@ -70,4 +70,17 @@ void ShareableBitmap::paint(GraphicsContext& /*context*/, float /*scaleFactor*/,
notImplemented();
}
-} // namespace WebKit
+void ShareableBitmap::swizzleRGB()
+{
+ uint32_t* data = reinterpret_cast<uint32_t*>(this->data());
+ int width = size().width();
+ int height = size().height();
+ for (int y = 0; y < height; ++y) {
+ uint32_t* p = data + y * width;
+ for (int x = 0; x < width; ++x)
+ p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
+ }
+}
+
+}
+// namespace WebKit
diff --git a/Source/WebKit2/Shared/win/ShareableBitmapWin.cpp b/Source/WebKit2/Shared/win/ShareableBitmapWin.cpp
index bf23dcdff..2ed8428b0 100644
--- a/Source/WebKit2/Shared/win/ShareableBitmapWin.cpp
+++ b/Source/WebKit2/Shared/win/ShareableBitmapWin.cpp
@@ -28,6 +28,7 @@
#include <WebCore/BitmapInfo.h>
#include <WebCore/GraphicsContext.h>
+#include <WebCore/HWndDC.h>
using namespace WebCore;
@@ -39,10 +40,10 @@ HDC ShareableBitmap::windowsContext() const
if (m_windowsContext)
return m_windowsContext.get();
- OwnPtr<HDC> screenDC = adoptPtr(::GetDC(0));
+ HWndDC screenDC(0);
BitmapInfo bmInfo = BitmapInfo::createBottomUp(m_size);
- m_windowsContext = adoptPtr(::CreateCompatibleDC(screenDC.get()));
+ m_windowsContext = adoptPtr(::CreateCompatibleDC(screenDC));
m_windowsBitmap = adoptPtr(CreateDIBSection(m_windowsContext.get(), &bmInfo, DIB_RGB_COLORS, 0, m_sharedMemory->handle(), 0));
::SelectObject(m_windowsContext.get(), m_windowsBitmap.get());
diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri
index 35983f076..7bd4a72a0 100644
--- a/Source/WebKit2/Target.pri
+++ b/Source/WebKit2/Target.pri
@@ -12,7 +12,7 @@ load(features)
include(WebKit2.pri)
WEBKIT += wtf javascriptcore webcore
-QT += declarative
+QT += declarative quick widgets
CONFIG += staticlib
@@ -31,7 +31,6 @@ HEADERS += \
Platform/Logging.h \
Platform/Module.h \
Platform/PlatformProcessIdentifier.h \
- Platform/RunLoop.h \
Platform/SharedMemory.h \
Platform/WorkQueue.h \
PluginProcess/PluginControllerProxy.h \
@@ -348,6 +347,7 @@ HEADERS += \
WebProcess/WebPage/DrawingAreaImpl.h \
WebProcess/WebPage/EventDispatcher.h \
WebProcess/WebPage/FindController.h \
+ WebProcess/WebPage/TapHighlightController.h \
WebProcess/WebPage/PageOverlay.h \
WebProcess/WebPage/WebContextMenu.h \
WebProcess/WebPage/WebFrame.h \
@@ -373,10 +373,8 @@ SOURCES += \
Platform/CoreIPC/DataReference.cpp \
Platform/Logging.cpp \
Platform/Module.cpp \
- Platform/RunLoop.cpp \
Platform/WorkQueue.cpp \
Platform/qt/ModuleQt.cpp \
- Platform/qt/RunLoopQt.cpp \
PluginProcess/PluginControllerProxy.cpp \
PluginProcess/PluginProcess.cpp \
PluginProcess/WebProcessConnection.cpp \
@@ -510,6 +508,7 @@ SOURCES += \
UIProcess/API/qt/qquickwebview.cpp \
UIProcess/API/qt/qwebiconimageprovider.cpp \
UIProcess/API/qt/qquicknetworkreply.cpp \
+ UIProcess/API/qt/qquicknetworkrequest.cpp \
UIProcess/API/qt/qquickurlschemedelegate.cpp \
UIProcess/API/qt/qwebpreferences.cpp \
UIProcess/API/qt/qwebviewportinfo.cpp \
@@ -701,6 +700,7 @@ SOURCES += \
WebProcess/WebPage/EncoderAdapter.cpp \
WebProcess/WebPage/EventDispatcher.cpp \
WebProcess/WebPage/FindController.cpp \
+ WebProcess/WebPage/TapHighlightController.cpp \
WebProcess/WebPage/LayerTreeHost.cpp \
WebProcess/WebPage/PageOverlay.cpp \
WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp \
diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp
index 6ddfa4cc8..60671a7e1 100644
--- a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp
@@ -55,3 +55,13 @@ void WKNotificationManagerProviderDidCloseNotifications(WKNotificationManagerRef
{
toImpl(managerRef)->providerDidCloseNotifications(toImpl(notificationIDs));
}
+
+void WKNotificationManagerProviderDidUpdateNotificationPolicy(WKNotificationManagerRef managerRef, WKSecurityOriginRef origin, bool allowed)
+{
+ toImpl(managerRef)->providerDidUpdateNotificationPolicy(toImpl(origin), allowed);
+}
+
+void WKNotificationManagerProviderDidRemoveNotificationPolicies(WKNotificationManagerRef managerRef, WKArrayRef origins)
+{
+ toImpl(managerRef)->providerDidRemoveNotificationPolicies(toImpl(origins));
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h
index 7360dad01..7074a2186 100644
--- a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h
+++ b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h
@@ -39,6 +39,8 @@ WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef manager
WK_EXPORT void WKNotificationManagerProviderDidShowNotification(WKNotificationManagerRef managerRef, uint64_t notificationID);
WK_EXPORT void WKNotificationManagerProviderDidClickNotification(WKNotificationManagerRef managerRef, uint64_t notificationID);
WK_EXPORT void WKNotificationManagerProviderDidCloseNotifications(WKNotificationManagerRef managerRef, WKArrayRef notificationIDs);
+WK_EXPORT void WKNotificationManagerProviderDidUpdateNotificationPolicy(WKNotificationManagerRef managerRef, WKSecurityOriginRef origin, bool allowed);
+WK_EXPORT void WKNotificationManagerProviderDidRemoveNotificationPolicies(WKNotificationManagerRef managerRef, WKArrayRef origins);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h
index 580608ccf..42a4beb92 100644
--- a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h
+++ b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h
@@ -35,9 +35,9 @@ extern "C" {
typedef void (*WKNotificationProviderShowCallback)(WKPageRef page, WKNotificationRef notification, const void* clientInfo);
typedef void (*WKNotificationProviderCancelCallback)(WKNotificationRef notification, const void* clientInfo);
typedef void (*WKNotificationProviderDidDestroyNotificationCallback)(WKNotificationRef notification, const void* clientInfo);
-typedef int (*WKNotificationProviderPolicyForNotificationPermissionAtOriginCallback)(WKSecurityOriginRef origin, const void *clientInfo);
typedef void (*WKNotificationProviderAddNotificationManagerCallback)(WKNotificationManagerRef manager, const void* clientInfo);
typedef void (*WKNotificationProviderRemoveNotificationManagerCallback)(WKNotificationManagerRef manager, const void* clientInfo);
+typedef WKDictionaryRef (*WKNotificationProviderNotificationPermissionsCallback)(const void* clientInfo);
struct WKNotificationProvider {
int version;
@@ -45,9 +45,9 @@ struct WKNotificationProvider {
WKNotificationProviderShowCallback show;
WKNotificationProviderCancelCallback cancel;
WKNotificationProviderDidDestroyNotificationCallback didDestroyNotification;
- WKNotificationProviderPolicyForNotificationPermissionAtOriginCallback policyForNotificationPermissionAtOrigin;
WKNotificationProviderAddNotificationManagerCallback addNotificationManager;
WKNotificationProviderRemoveNotificationManagerCallback removeNotificationManager;
+ WKNotificationProviderNotificationPermissionsCallback notificationPermissions;
};
typedef struct WKNotificationProvider WKNotificationProvider;
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index 9c7a02916..3010016c3 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -379,6 +379,16 @@ WKPaginationMode WKPageGetPaginationMode(WKPageRef pageRef)
return kWKPaginationModeUnpaginated;
}
+void WKPageSetPaginationBehavesLikeColumns(WKPageRef pageRef, bool behavesLikeColumns)
+{
+ toImpl(pageRef)->setPaginationBehavesLikeColumns(behavesLikeColumns);
+}
+
+bool WKPageGetPaginationBehavesLikeColumns(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->paginationBehavesLikeColumns();
+}
+
void WKPageSetPageLength(WKPageRef pageRef, double pageLength)
{
toImpl(pageRef)->setPageLength(pageLength);
@@ -661,3 +671,8 @@ void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync)
{
toImpl(page)->setShouldSendEventsSynchronously(sync);
}
+
+void WKPageSetMediaVolume(WKPageRef page, float volume)
+{
+ toImpl(page)->setMediaVolume(volume);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index 1de70628c..ea8049dd5 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -70,6 +70,7 @@ typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef
typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
typedef void (*WKPageDidFailToInitializePluginCallback)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
+typedef void (*WKPageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
struct WKPageLoaderClient {
int version;
@@ -106,6 +107,9 @@ struct WKPageLoaderClient {
// Version 1
WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame;
+
+ // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
+ WKPageDidNewFirstVisuallyNonEmptyLayoutCallback didNewFirstVisuallyNonEmptyLayout;
};
typedef struct WKPageLoaderClient WKPageLoaderClient;
diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
index d378adef6..097aabfe1 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
@@ -61,6 +61,8 @@ typedef uint32_t WKPaginationMode;
WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode);
WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
+WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns);
+WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page);
WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView);
WK_EXPORT double WKPageGetPageLength(WKPageRef page);
WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
@@ -87,6 +89,8 @@ WK_EXPORT WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef page);
WK_EXPORT void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync);
+WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 35eb5d923..60e7b7264 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -382,6 +382,16 @@ bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferen
return toImpl(preferencesRef)->compositingRepaintCountersVisible();
}
+void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setCSSCustomFilterEnabled(flag);
+}
+
+bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->cssCustomFilterEnabled();
+}
+
void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setWebGLEnabled(flag);
@@ -711,3 +721,20 @@ bool WKPreferencesGetShouldDisplayTextDescriptions(WKPreferencesRef preferencesR
{
return toImpl(preferencesRef)->shouldDisplayTextDescriptions();
}
+
+void WKPreferencesSetNotificationsEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+ toImpl(preferencesRef)->setNotificationsEnabled(enabled);
+}
+
+bool WKPreferencesGetNotificationsEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->notificationsEnabled();
+}
+
+void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef)
+{
+ // Currently we reset the overrides on the web process when preferencesDidChange() is called. Since WTR preferences
+ // are usually always the same (in the UI process), they are not sent to web process, not triggering the reset.
+ toImpl(preferencesRef)->forceUpdate();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
index 00fc89df8..f13559acb 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -193,6 +193,10 @@ WK_EXPORT bool WKPreferencesGetShouldDisplayCaptions(WKPreferencesRef preference
WK_EXPORT void WKPreferencesSetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef);
+// Defaults to false
+WK_EXPORT void WKPreferencesSetNotificationsEnabled(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetNotificationsEnabled(WKPreferencesRef preferencesRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index f11fb3af2..3208c6ea3 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -80,6 +80,10 @@ WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef);
WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef);
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef);
+
// Defaults to false.
WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
@@ -156,6 +160,8 @@ WK_EXPORT bool WKPreferencesGetMockScrollbarsEnabled(WKPreferencesRef preference
WK_EXPORT void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef, bool enabled);
WK_EXPORT bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef);
+WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
index aaee9563d..a56265adb 100644
--- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
@@ -32,13 +32,14 @@
#include "WebContext.h"
#include "WebContextMenuProxy.h"
#include "WebPageProxy.h"
+#include "ewk_private.h"
using namespace WebCore;
namespace WebKit {
-PageClientImpl::PageClientImpl(WebContext* context, WebPageGroup* pageGroup, Evas_Object* viewObject)
- : m_viewObject(viewObject)
+PageClientImpl::PageClientImpl(WebContext* context, WebPageGroup* pageGroup, Evas_Object* viewWidget)
+ : m_viewWidget(viewWidget)
{
m_page = context->createWebPage(this, pageGroup);
m_page->initializeWebPage();
@@ -56,7 +57,7 @@ PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
{
- evas_object_image_data_update_add(m_viewObject, rect.x(), rect.y(), rect.width(), rect.height());
+ ewk_view_display(m_viewWidget, rect);
}
void PageClientImpl::displayView()
@@ -72,7 +73,7 @@ void PageClientImpl::scrollView(const WebCore::IntRect& scrollRect, const WebCor
WebCore::IntSize PageClientImpl::viewSize()
{
int width, height;
- evas_object_geometry_get(m_viewObject, 0, 0, &width, &height);
+ evas_object_geometry_get(m_viewWidget, 0, 0, &width, &height);
return IntSize(width, height);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
index 01a2483c7..2522153d4 100644
--- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
@@ -33,13 +33,13 @@ namespace WebKit {
class PageClientImpl : public PageClient {
public:
- static PassOwnPtr<PageClientImpl> create(WebContext* context, WebPageGroup* pageGroup, Evas_Object* viewObject)
+ static PassOwnPtr<PageClientImpl> create(WebContext* context, WebPageGroup* pageGroup, Evas_Object* viewWidget)
{
- return adoptPtr(new PageClientImpl(context, pageGroup, viewObject));
+ return adoptPtr(new PageClientImpl(context, pageGroup, viewWidget));
}
~PageClientImpl();
- Evas_Object* viewObject() const { return m_viewObject; }
+ Evas_Object* viewWidget() const { return m_viewWidget; }
WebPageProxy* page() const { return m_page.get(); }
@@ -100,7 +100,7 @@ private:
private:
RefPtr<WebPageProxy> m_page;
- Evas_Object* m_viewObject;
+ Evas_Object* m_viewWidget;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_private.h
new file mode 100644
index 000000000..d331d996f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_private.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ewk_private_h
+#define ewk_private_h
+
+#include <Evas.h>
+
+namespace WebCore {
+class IntRect;
+class IntSize;
+}
+
+void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect);
+void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size);
+
+#endif // ewk_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index 592f58034..269c072d6 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -479,7 +479,7 @@ Evas_Object* ewk_view_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef
return 0;
}
- priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), smartData->image);
+ priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
return ewkView;
}
@@ -491,3 +491,23 @@ WKPageRef ewk_view_page_get(Evas_Object* ewkView)
return toAPI(priv->pageClient->page());
}
+
+void ewk_view_display(Evas_Object* ewkView, const IntRect& rect)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ if (!smartData->image)
+ return;
+
+ evas_object_image_data_update_add(smartData->image, rect.x(), rect.y(), rect.width(), rect.height());
+}
+
+void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSize& size)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+ if (!imageData || !smartData->image)
+ return;
+
+ evas_object_resize(smartData->image, size.width(), size.height());
+ evas_object_image_size_set(smartData->image, size.width(), size.height());
+ evas_object_image_data_copy_set(smartData->image, imageData);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
index fab54fb21..1caca868e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp
@@ -22,7 +22,7 @@
#include "WebKitBackForwardListPrivate.h"
#include "WebKitMarshal.h"
-#include <WebKit2/WKBackForwardList.h>
+#include "WebKitPrivate.h"
#include <wtf/gobject/GRefPtr.h>
/**
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
index ed44f1f1e..c6a4b598c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp
@@ -21,8 +21,7 @@
#include "WebKitBackForwardListItem.h"
#include "WebKitBackForwardListPrivate.h"
-#include <WebKit2/WKBackForwardListItem.h>
-#include <WebKit2/WKRetainPtr.h>
+#include "WebKitPrivate.h"
#include <wtf/HashMap.h>
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
new file mode 100644
index 000000000..4d4eba18d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
@@ -0,0 +1,510 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDownload.h"
+
+#include "WebKitDownloadPrivate.h"
+#include "WebKitMarshal.h"
+#include "WebKitURIResponsePrivate.h"
+#include <WebCore/ErrorsGtk.h>
+#include <WebCore/ResourceResponse.h>
+#include <glib/gi18n-lib.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+enum {
+ RECEIVED_DATA,
+ FINISHED,
+ FAILED,
+ DECIDE_DESTINATION,
+ CREATED_DESTINATION,
+
+ LAST_SIGNAL
+};
+
+enum {
+ PROP_0,
+
+ PROP_DESTINATION,
+ PROP_RESPONSE,
+ PROP_ESTIMATED_PROGRESS
+};
+
+struct _WebKitDownloadPrivate {
+ WKRetainPtr<WKDownloadRef> wkDownload;
+
+ GRefPtr<WebKitURIResponse> response;
+ CString destinationURI;
+ guint64 currentSize;
+ bool isCancelled;
+ GOwnPtr<GTimer> timer;
+ gdouble lastProgress;
+ gdouble lastElapsed;
+};
+
+static guint signals[LAST_SIGNAL] = { 0, };
+
+G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT)
+
+static void webkitDownloadFinalize(GObject* object)
+{
+ WEBKIT_DOWNLOAD(object)->priv->~WebKitDownloadPrivate();
+ G_OBJECT_CLASS(webkit_download_parent_class)->finalize(object);
+}
+
+static void webkitDownloadGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+ WebKitDownload* download = WEBKIT_DOWNLOAD(object);
+
+ switch (propId) {
+ case PROP_DESTINATION:
+ g_value_set_string(value, webkit_download_get_destination(download));
+ break;
+ case PROP_RESPONSE:
+ g_value_set_object(value, webkit_download_get_response(download));
+ break;
+ case PROP_ESTIMATED_PROGRESS:
+ g_value_set_double(value, webkit_download_get_estimated_progress(download));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+ }
+}
+
+static gboolean webkitDownloadDecideDestination(WebKitDownload* download, const gchar* suggestedFilename)
+{
+ if (!download->priv->destinationURI.isNull())
+ return FALSE;
+ GOwnPtr<char> destination(g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD), suggestedFilename, NULL));
+ GOwnPtr<char> destinationURI(g_filename_to_uri(destination.get(), 0, 0));
+ download->priv->destinationURI = destinationURI.get();
+ g_object_notify(G_OBJECT(download), "destination");
+ return TRUE;
+}
+
+static void webkit_download_init(WebKitDownload* download)
+{
+ WebKitDownloadPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(download, WEBKIT_TYPE_DOWNLOAD, WebKitDownloadPrivate);
+ download->priv = priv;
+ new (priv) WebKitDownloadPrivate();
+}
+
+static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
+{
+ GObjectClass* objectClass = G_OBJECT_CLASS(downloadClass);
+ objectClass->get_property = webkitDownloadGetProperty;
+ objectClass->finalize = webkitDownloadFinalize;
+
+ downloadClass->decide_destination = webkitDownloadDecideDestination;
+
+ /**
+ * WebKitDownload:destination:
+ *
+ * The local URI to where the download will be saved.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_DESTINATION,
+ g_param_spec_string("destination",
+ _("Destination"),
+ _("The local URI to where the download will be saved"),
+ 0,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitDownload:response:
+ *
+ * The #WebKitURIResponse associated with this download.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_RESPONSE,
+ g_param_spec_object("response",
+ _("Response"),
+ _("The response of the download"),
+ WEBKIT_TYPE_URI_RESPONSE,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitDownload:estimated-progress:
+ *
+ * An estimate of the percent completion for the download operation.
+ * This value will range from 0.0 to 1.0. The value is an estimate
+ * based on the total number of bytes expected to be received for
+ * a download.
+ * If you need a more accurate progress information you can connect to
+ * #WebKitDownload::received-data signal to track the progress.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_ESTIMATED_PROGRESS,
+ g_param_spec_double("estimated-progress",
+ _("Estimated Progress"),
+ _("Determines the current progress of the download"),
+ 0.0, 1.0, 1.0,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitDownload::received-data:
+ * @download: the #WebKitDownload
+ * @data_length: the length of data received in bytes
+ *
+ * This signal is emitted after response is received,
+ * every time new data has been written to the destination. It's
+ * useful to know the progress of the download operation.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ */
+ signals[RECEIVED_DATA] =
+ g_signal_new("received-data",
+ G_TYPE_FROM_CLASS(objectClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitDownloadClass, received_data),
+ g_signal_accumulator_true_handled, NULL,
+ webkit_marshal_BOOLEAN__UINT64,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_UINT64);
+
+ /**
+ * WebKitDownload::finished:
+ * @download: the #WebKitDownload
+ *
+ * This signal is emitted when download finishes successfully or due to an error.
+ * In case of errors #WebKitDownload::failed signal is emitted before this one.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ */
+ signals[FINISHED] =
+ g_signal_new("finished",
+ G_TYPE_FROM_CLASS(objectClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitDownloadClass, finished),
+ g_signal_accumulator_true_handled, NULL,
+ webkit_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN, 0);
+
+ /**
+ * WebKitDownload::failed:
+ * @download: the #WebKitDownload
+ * @error: the #GError that was triggered
+ *
+ * This signal is emitted when an error occurs during the download
+ * operation. The given @error, of the domain %WEBKIT_DOWNLOAD_ERROR,
+ * contains further details of the failure. If the download is cancelled
+ * with webkit_download_cancel(), this signal is emitted with error
+ * %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER. The download operation finishes
+ * after an error and #WebKitDownload::finished signal is emitted after this one.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ */
+ signals[FAILED] =
+ g_signal_new("failed",
+ G_TYPE_FROM_CLASS(objectClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitDownloadClass, failed),
+ g_signal_accumulator_true_handled, NULL,
+ webkit_marshal_BOOLEAN__POINTER,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_POINTER);
+
+ /**
+ * WebKitDownload::decide-destination:
+ * @download: the #WebKitDownload
+ * @suggested_filename: the filename suggested for the download
+ *
+ * This signal is emitted after response is received to
+ * decide a destination URI for the download. If this signal is not
+ * handled the file will be downloaded to %G_USER_DIRECTORY_DOWNLOAD
+ * directory using @suggested_filename.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ */
+ signals[DECIDE_DESTINATION] =
+ g_signal_new("decide-destination",
+ G_TYPE_FROM_CLASS(objectClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitDownloadClass, decide_destination),
+ g_signal_accumulator_true_handled, NULL,
+ webkit_marshal_BOOLEAN__STRING,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_STRING);
+
+ /**
+ * WebKitDownload::created-destination:
+ * @download: the #WebKitDownload
+ * @destination: the destination URI
+ *
+ * This signal is emitted after #WebKitDownload::decide-destination and before
+ * #WebKitDownload::received-data to notify that destination file has been
+ * created successfully at @destination.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ */
+ signals[CREATED_DESTINATION] =
+ g_signal_new("created-destination",
+ G_TYPE_FROM_CLASS(objectClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitDownloadClass, created_destination),
+ g_signal_accumulator_true_handled, NULL,
+ webkit_marshal_BOOLEAN__STRING,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_STRING);
+
+ g_type_class_add_private(downloadClass, sizeof(WebKitDownloadPrivate));
+}
+
+WebKitDownload* webkitDownloadCreate(WKDownloadRef wkDownload)
+{
+ ASSERT(wkDownload);
+ WebKitDownload* download = WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, NULL));
+ download->priv->wkDownload = wkDownload;
+ return download;
+}
+
+void webkitDownloadSetResponse(WebKitDownload* download, WebKitURIResponse* response)
+{
+ download->priv->response = response;
+ g_object_notify(G_OBJECT(download), "response");
+}
+
+bool webkitDownloadIsCancelled(WebKitDownload* download)
+{
+ return download->priv->isCancelled;
+}
+
+void webkitDownloadNotifyProgress(WebKitDownload* download, guint64 bytesReceived)
+{
+ WebKitDownloadPrivate* priv = download->priv;
+ if (priv->isCancelled)
+ return;
+
+ if (!download->priv->timer)
+ download->priv->timer.set(g_timer_new());
+
+ priv->currentSize += bytesReceived;
+ gboolean returnValue;
+ g_signal_emit(download, signals[RECEIVED_DATA], 0, bytesReceived, &returnValue);
+
+ // Throttle progress notification to not consume high amounts of
+ // CPU on fast links, except when the last notification occured
+ // more than 0.016 secs ago (60 FPS), or the last notified progress
+ // is passed in 1% or we reached the end.
+ gdouble currentElapsed = g_timer_elapsed(priv->timer.get(), 0);
+ gdouble currentProgress = webkit_download_get_estimated_progress(download);
+
+ if (priv->lastElapsed
+ && priv->lastProgress
+ && (currentElapsed - priv->lastElapsed) < 0.016
+ && (currentProgress - priv->lastProgress) < 0.01
+ && currentProgress < 1.0) {
+ return;
+ }
+ priv->lastElapsed = currentElapsed;
+ priv->lastProgress = currentProgress;
+ g_object_notify(G_OBJECT(download), "estimated-progress");
+}
+
+void webkitDownloadFailed(WebKitDownload* download, const ResourceError& resourceError)
+{
+ GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
+ resourceError.errorCode(),
+ resourceError.localizedDescription().utf8().data()));
+ if (download->priv->timer)
+ g_timer_stop(download->priv->timer.get());
+ gboolean returnValue;
+ g_signal_emit(download, signals[FAILED], 0, webError.get(), &returnValue);
+ g_signal_emit(download, signals[FINISHED], 0, &returnValue);
+}
+
+void webkitDownloadCancelled(WebKitDownload* download)
+{
+ WebKitDownloadPrivate* priv = download->priv;
+ webkitDownloadFailed(download, downloadCancelledByUserError(priv->response ? webkitURIResponseGetResourceResponse(priv->response.get()) : ResourceResponse()));
+}
+
+void webkitDownloadFinished(WebKitDownload* download)
+{
+ if (download->priv->isCancelled) {
+ // Since cancellation is asynchronous, didFinish might be called even
+ // if the download was cancelled. User cancelled the download,
+ // so we should fail with cancelled error even if the download
+ // actually finished successfully.
+ webkitDownloadCancelled(download);
+ return;
+ }
+ if (download->priv->timer)
+ g_timer_stop(download->priv->timer.get());
+ gboolean returnValue;
+ g_signal_emit(download, signals[FINISHED], 0, &returnValue);
+}
+
+CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload* download, const CString& suggestedFilename)
+{
+ if (download->priv->isCancelled)
+ return "";
+ gboolean returnValue;
+ g_signal_emit(download, signals[DECIDE_DESTINATION], 0, suggestedFilename.data(), &returnValue);
+ return download->priv->destinationURI;
+}
+
+void webkitDownloadDestinationCreated(WebKitDownload* download, const CString& destinationURI)
+{
+ if (download->priv->isCancelled)
+ return;
+ gboolean returnValue;
+ g_signal_emit(download, signals[CREATED_DESTINATION], 0, destinationURI.data(), &returnValue);
+}
+
+/**
+ * webkit_download_get_destination:
+ * @download: a #WebKitDownload
+ *
+ * Obtains the URI to which the downloaded file will be written. You
+ * can connect to #WebKitDownload::created-destination to make
+ * sure this method returns a valid destination.
+ *
+ * Returns: the destination URI or %NULL
+ */
+const gchar* webkit_download_get_destination(WebKitDownload* download)
+{
+ g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0);
+
+ return download->priv->destinationURI.data();
+}
+
+/**
+ * webkit_download_set_destination:
+ * @download: a #WebKitDownload
+ * @uri: the destination URI
+ *
+ * Sets the URI to which the downloaded file will be written.
+ * This method should be called before the download transfer
+ * starts or it will not have any effect on the ongoing download
+ * operation. To set the destination using the filename suggested
+ * by the server connect to #WebKitDownload::decide-destination
+ * signal and call webkit_download_set_destination(). If you want to
+ * set a fixed destination URI that doesn't depend on the suggested
+ * filename you can connect to notify::response signal and call
+ * webkit_download_set_destination().
+ * If #WebKitDownload::decide-destination signal is not handled
+ * and destination URI is not set when the download tranfer starts,
+ * the file will be saved with the filename suggested by the server in
+ * %G_USER_DIRECTORY_DOWNLOAD directory.
+ */
+void webkit_download_set_destination(WebKitDownload* download, const gchar* uri)
+{
+ g_return_if_fail(WEBKIT_IS_DOWNLOAD(download));
+ g_return_if_fail(uri);
+
+ WebKitDownloadPrivate* priv = download->priv;
+ if (priv->destinationURI == uri)
+ return;
+
+ priv->destinationURI = uri;
+ g_object_notify(G_OBJECT(download), "destination");
+}
+
+/**
+ * webkit_download_get_response:
+ * @download: a #WebKitDownload
+ *
+ * Retrieves the #WebKitURIResponse object that backs the download
+ * process. This method returns %NULL if called before the response
+ * is received from the server. You can connect to notify::response
+ * signal to be notified when the response is received.
+ *
+ * Returns: (transfer none): the #WebKitURIResponse, or %NULL if
+ * the response hasn't been received yet.
+ */
+WebKitURIResponse* webkit_download_get_response(WebKitDownload* download)
+{
+ g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0);
+
+ return download->priv->response.get();
+}
+
+/**
+ * webkit_download_cancel:
+ * @download: a #WebKitDownload
+ *
+ * Cancels the download. When the ongoing download
+ * operation is effectively cancelled the signal
+ * #WebKitDownload::failed is emitted with
+ * %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER error.
+ */
+void webkit_download_cancel(WebKitDownload* download)
+{
+ g_return_if_fail(WEBKIT_IS_DOWNLOAD(download));
+
+ download->priv->isCancelled = true;
+ WKDownloadCancel(download->priv->wkDownload.get());
+}
+
+/**
+ * webkit_download_get_estimated_progress:
+ * @download: a #WebKitDownload
+ *
+ * Gets the value of the #WebKitDownload:estimated-progress property.
+ * You can monitor the estimated progress of the download operation by
+ * connecting to the notify::estimated-progress signal of @download.
+ *
+ * Returns: an estimate of the of the percent complete for a download
+ * as a range from 0.0 to 1.0.
+ */
+gdouble webkit_download_get_estimated_progress(WebKitDownload* download)
+{
+ g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0);
+
+ WebKitDownloadPrivate* priv = download->priv;
+ if (!priv->response)
+ return 0;
+
+ guint64 contentLength = webkit_uri_response_get_content_length(priv->response.get());
+ if (!contentLength)
+ return 0;
+
+ return static_cast<gdouble>(priv->currentSize) / static_cast<gdouble>(contentLength);
+}
+
+/**
+ * webkit_download_get_elapsed_time:
+ * @download: a #WebKitDownload
+ *
+ * Gets the elapsed time in seconds, including any fractional part.
+ * If the download finished, had an error or was cancelled this is
+ * the time between its start and the event.
+ *
+ * Returns: seconds since the download was started
+ */
+gdouble webkit_download_get_elapsed_time(WebKitDownload* download)
+{
+ g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0);
+
+ WebKitDownloadPrivate* priv = download->priv;
+ if (!priv->timer)
+ return 0;
+
+ return g_timer_elapsed(priv->timer.get(), 0);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
new file mode 100644
index 000000000..e200fec53
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitDownload_h
+#define WebKitDownload_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitURIResponse.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_DOWNLOAD (webkit_download_get_type())
+#define WEBKIT_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOWNLOAD, WebKitDownload))
+#define WEBKIT_IS_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOWNLOAD))
+#define WEBKIT_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOWNLOAD, WebKitDownloadClass))
+#define WEBKIT_IS_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOWNLOAD))
+#define WEBKIT_DOWNLOAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOWNLOAD, WebKitDownloadClass))
+
+typedef struct _WebKitDownload WebKitDownload;
+typedef struct _WebKitDownloadClass WebKitDownloadClass;
+typedef struct _WebKitDownloadPrivate WebKitDownloadPrivate;
+
+struct _WebKitDownload {
+ GObject parent;
+
+ WebKitDownloadPrivate *priv;
+};
+
+struct _WebKitDownloadClass {
+ GObjectClass parent_class;
+
+ gboolean (* received_data) (WebKitDownload *download,
+ guint64 data_length);
+ gboolean (* finished) (WebKitDownload *download);
+ gboolean (* failed) (WebKitDownload *download,
+ GError *error);
+ gboolean (* decide_destination) (WebKitDownload *download,
+ const gchar *suggested_filename);
+ gboolean (* created_destination) (WebKitDownload *download,
+ const gchar *destination);
+};
+
+WEBKIT_API GType
+webkit_download_get_type (void);
+
+WEBKIT_API const gchar *
+webkit_download_get_destination (WebKitDownload *download);
+
+WEBKIT_API void
+webkit_download_set_destination (WebKitDownload *download,
+ const gchar *uri);
+
+WEBKIT_API WebKitURIResponse*
+webkit_download_get_response (WebKitDownload *download);
+
+WEBKIT_API void
+webkit_download_cancel (WebKitDownload *download);
+
+WEBKIT_API gdouble
+webkit_download_get_estimated_progress (WebKitDownload *download);
+
+WEBKIT_API gdouble
+webkit_download_get_elapsed_time (WebKitDownload *download);
+
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp
new file mode 100644
index 000000000..6e72496ef
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDownloadClient.h"
+
+#include "WebContext.h"
+#include "WebKitDownloadPrivate.h"
+#include "WebKitURIResponsePrivate.h"
+#include "WebKitWebContextPrivate.h"
+#include "WebURLResponse.h"
+#include <WebKit2/WKString.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+static void didStart(WKContextRef, WKDownloadRef wkDownload, const void* clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ webkitWebContextDownloadStarted(WEBKIT_WEB_CONTEXT(clientInfo), download.get());
+}
+
+static void didReceiveResponse(WKContextRef, WKDownloadRef wkDownload, WKURLResponseRef wkResponse, const void* clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ if (webkitDownloadIsCancelled(download.get()))
+ return;
+
+ GRefPtr<WebKitURIResponse> response = adoptGRef(webkitURIResponseCreateForResourceResponse(toImpl(wkResponse)->resourceResponse()));
+ webkitDownloadSetResponse(download.get(), response.get());
+}
+
+static void didReceiveData(WKContextRef, WKDownloadRef wkDownload, uint64_t length, const void* clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ webkitDownloadNotifyProgress(download.get(), length);
+}
+
+static WKStringRef decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef wkDownload, WKStringRef filename, bool* allowOverwrite, const void* clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ CString destinationURI = webkitDownloadDecideDestinationWithSuggestedFilename(download.get(),
+ toImpl(filename)->string().utf8());
+ return WKStringCreateWithUTF8CString(destinationURI.data());
+}
+
+static void didCreateDestination(WKContextRef, WKDownloadRef wkDownload, WKStringRef path, const void* clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ webkitDownloadDestinationCreated(download.get(), toImpl(path)->string().utf8());
+}
+
+static void didFail(WKContextRef, WKDownloadRef wkDownload, WKErrorRef error, const void *clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ if (webkitDownloadIsCancelled(download.get())) {
+ // Cancellation takes precedence over other errors.
+ webkitDownloadCancelled(download.get());
+ } else
+ webkitDownloadFailed(download.get(), toImpl(error)->platformError());
+ webkitWebContextRemoveDownload(wkDownload);
+}
+
+static void didCancel(WKContextRef, WKDownloadRef wkDownload, const void *clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ webkitDownloadCancelled(download.get());
+ webkitWebContextRemoveDownload(wkDownload);
+}
+
+static void didFinish(WKContextRef wkContext, WKDownloadRef wkDownload, const void *clientInfo)
+{
+ GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(wkDownload);
+ webkitDownloadFinished(download.get());
+ webkitWebContextRemoveDownload(wkDownload);
+}
+
+void attachDownloadClientToContext(WebKitWebContext* webContext)
+{
+ WKContextDownloadClient wkDownloadClient = {
+ kWKContextDownloadClientCurrentVersion,
+ webContext, // ClientInfo
+ didStart,
+ 0, // didReceiveAuthenticationChallenge
+ didReceiveResponse,
+ didReceiveData,
+ 0, // shouldDecodeSourceDataOfMIMEType
+ decideDestinationWithSuggestedFilename,
+ didCreateDestination,
+ didFinish,
+ didFail,
+ didCancel,
+ 0, // processDidCrash
+ };
+ WKContextSetDownloadClient(webkitWebContextGetWKContext(webContext), &wkDownloadClient);
+}
+
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h
new file mode 100644
index 000000000..c2566e897
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDownloadClient_h
+#define WebKitDownloadClient_h
+
+#include "WebKitWebContext.h"
+
+void attachDownloadClientToContext(WebKitWebContext*);
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
new file mode 100644
index 000000000..6f4b5363c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDownloadPrivate_h
+#define WebKitDownloadPrivate_h
+
+#include "WebKitDownload.h"
+#include "WebKitPrivate.h"
+#include <WebCore/ResourceError.h>
+#include <wtf/text/CString.h>
+
+WebKitDownload* webkitDownloadCreate(WKDownloadRef);
+bool webkitDownloadIsCancelled(WebKitDownload*);
+void webkitDownloadSetResponse(WebKitDownload*, WebKitURIResponse*);
+void webkitDownloadNotifyProgress(WebKitDownload*, guint64 bytesReceived);
+void webkitDownloadFailed(WebKitDownload*, const WebCore::ResourceError&);
+void webkitDownloadCancelled(WebKitDownload*);
+void webkitDownloadFinished(WebKitDownload*);
+CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload*, const CString& suggestedFilename);
+void webkitDownloadDestinationCreated(WebKitDownload*, const CString& destinationURI);
+
+#endif // WebKitDownloadPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
index 6c24aa12e..42cf0ab35 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
@@ -24,6 +24,8 @@
#include "WebKitPrivate.h"
#include <WebCore/ErrorsGtk.h>
+using namespace WebCore;
+
GQuark webkit_network_error_quark()
{
return g_quark_from_static_string(WebCore::errorDomainNetwork);
@@ -57,3 +59,12 @@ COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN, PluginError
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE, PluginErrorJavaUnavailable);
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED, PluginErrorConnectionCancelled);
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, PluginErrorWillHandleLoad);
+
+GQuark webkit_download_error_quark()
+{
+ return g_quark_from_static_string(WebCore::errorDomainDownload);
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_NETWORK, DownloadErrorNetwork);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER, DownloadErrorCancelledByUser);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_DOWNLOAD_ERROR_DESTINATION, DownloadErrorDestination);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitError.h b/Source/WebKit2/UIProcess/API/gtk/WebKitError.h
index 3ce0e20f1..9b0e630c8 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitError.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitError.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
#define WEBKIT_NETWORK_ERROR webkit_network_error_quark ()
#define WEBKIT_POLICY_ERROR webkit_policy_error_quark ()
#define WEBKIT_PLUGIN_ERROR webkit_plugin_error_quark ()
+#define WEBKIT_DOWNLOAD_ERROR webkit_download_error_quark ()
/**
* WebKitNetworkError:
@@ -89,14 +90,31 @@ typedef enum {
WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD = 204,
} WebKitPluginError;
+/**
+ * WebKitDownloadError:
+ * @WEBKIT_DOWNLOAD_ERROR_NETWORK: Download failure due to network error
+ * @WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER: Download was cancelled by user
+ * @WEBKIT_DOWNLOAD_ERROR_DESTINATION: Download failure due to destination error
+ *
+ * Enum values used to denote the various download errors.
+ */
+typedef enum {
+ WEBKIT_DOWNLOAD_ERROR_NETWORK = 499,
+ WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER = 400,
+ WEBKIT_DOWNLOAD_ERROR_DESTINATION = 401
+} WebKitDownloadError;
+
+WEBKIT_API GQuark
+webkit_network_error_quark (void);
+
WEBKIT_API GQuark
-webkit_network_error_quark (void);
+webkit_policy_error_quark (void);
WEBKIT_API GQuark
-webkit_policy_error_quark (void);
+webkit_plugin_error_quark (void);
WEBKIT_API GQuark
-webkit_plugin_error_quark (void);
+webkit_download_error_quark (void);
G_END_DECLS
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
index d27560f53..6d1133941 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
@@ -19,9 +19,10 @@
*/
#include "config.h"
-#include "WebKitWebLoaderClient.h"
+#include "WebKitLoaderClient.h"
#include "WebKitBackForwardListPrivate.h"
+#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/text/CString.h>
@@ -29,14 +30,12 @@
using namespace WebKit;
using namespace WebCore;
-G_DEFINE_TYPE(WebKitWebLoaderClient, webkit_web_loader_client, G_TYPE_OBJECT)
-
static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_STARTED);
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED);
}
static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
@@ -44,7 +43,7 @@ static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, W
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_REDIRECTED);
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_REDIRECTED);
}
static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo)
@@ -56,7 +55,7 @@ static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef f
GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
resourceError.errorCode(),
resourceError.localizedDescription().utf8().data()));
- webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_STARTED,
+ webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_STARTED,
resourceError.failingURL().utf8().data(), webError.get());
}
@@ -65,7 +64,7 @@ static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_COMMITTED);
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED);
}
static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
@@ -73,7 +72,7 @@ static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_FINISHED);
+ webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_FINISHED);
}
static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
@@ -85,43 +84,41 @@ static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErr
GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
resourceError.errorCode(),
resourceError.localizedDescription().utf8().data()));
- webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), WEBKIT_LOAD_COMMITTED,
+ webkitWebViewLoadFailed(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_COMMITTED,
resourceError.failingURL().utf8().data(), webError.get());
}
-static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void*)
+static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType, WKTypeRef, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frame))
return;
- webkitWebViewUpdateURI(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ webkitWebViewUpdateURI(WEBKIT_WEB_VIEW(clientInfo));
}
-static void didReceiveTitleForFrame(WKPageRef page, WKStringRef titleRef, WKFrameRef frameRef, WKTypeRef, const void*)
+static void didReceiveTitleForFrame(WKPageRef page, WKStringRef titleRef, WKFrameRef frameRef, WKTypeRef, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frameRef))
return;
- webkitWebViewSetTitle(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(titleRef)->string().utf8());
+ webkitWebViewSetTitle(WEBKIT_WEB_VIEW(clientInfo), toImpl(titleRef)->string().utf8());
}
static void didChangeProgress(WKPageRef page, const void* clientInfo)
{
- WebKitWebView* webView = WEBKIT_WEB_VIEW(toImpl(page)->viewWidget());
- webkitWebViewSetEstimatedLoadProgress(webView, WKPageGetEstimatedProgress(page));
+ webkitWebViewSetEstimatedLoadProgress(WEBKIT_WEB_VIEW(clientInfo), WKPageGetEstimatedProgress(page));
}
static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void* clientInfo)
{
- WebKitWebView* webView = WEBKIT_WEB_VIEW(toImpl(page)->viewWidget());
- webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(webView), addedItem, removedItems);
+ webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(clientInfo)), addedItem, removedItems);
}
-void webkitWebLoaderClientAttachLoaderClientToPage(WebKitWebLoaderClient* loaderClient, WKPageRef wkPage)
+void attachLoaderClientToView(WebKitWebView* webView)
{
WKPageLoaderClient wkLoaderClient = {
kWKPageLoaderClientCurrentVersion,
- loaderClient, // clientInfo
+ webView, // clientInfo
didStartProvisionalLoadForFrame,
didReceiveServerRedirectForProvisionalLoadForFrame,
didFailProvisionalLoadWithErrorForFrame,
@@ -149,13 +146,7 @@ void webkitWebLoaderClientAttachLoaderClientToPage(WebKitWebLoaderClient* loader
0, // didFailToInitializePlugin
0 // didDetectXSSForFrame
};
+ WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
WKPageSetPageLoaderClient(wkPage, &wkLoaderClient);
}
-static void webkit_web_loader_client_init(WebKitWebLoaderClient*)
-{
-}
-
-static void webkit_web_loader_client_class_init(WebKitWebLoaderClientClass*)
-{
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h
new file mode 100644
index 000000000..dfac3c86f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitLoaderClient_h
+#define WebKitLoaderClient_h
+
+#include "WebKitWebView.h"
+
+void attachLoaderClientToView(WebKitWebView*);
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
new file mode 100644
index 000000000..fcd57b4a6
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitNavigationPolicyDecision.h"
+
+#include "WebKitEnumTypes.h"
+#include "WebKitPolicyDecisionPrivate.h"
+#include "WebKitPrivate.h"
+#include "WebKitURIRequestPrivate.h"
+#include "WebURLRequest.h"
+#include <gdk/gdk.h>
+#include <glib/gi18n-lib.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * SECTION: WebKitNavigationPolicyDecision
+ * @Short_description: A policy decision for navigation actions
+ * @Title: WebKitNavigationPolicyDecision
+ * @See_also: #WebKitPolicyDecision, #WebKitWebView
+ *
+ * WebKitNavigationPolicyDecision represents a policy decision for events associated with
+ * navigations. If the value of WebKitNavigationPolicyDecision:mouse-button is not 0, then
+ * the navigation was triggered by a mouse event.
+ */
+
+G_DEFINE_TYPE(WebKitNavigationPolicyDecision, webkit_navigation_policy_decision, WEBKIT_TYPE_POLICY_DECISION)
+
+struct _WebKitNavigationPolicyDecisionPrivate {
+ WebKitNavigationType navigationType;
+ unsigned modifiers;
+ unsigned mouseButton;
+ GRefPtr<WebKitURIRequest> request;
+ CString frameName;
+};
+
+enum {
+ PROP_0,
+ PROP_NAVIGATION_TYPE,
+ PROP_MOUSE_BUTTON,
+ PROP_MODIFIERS,
+ PROP_REQUEST,
+ PROP_FRAME_NAME,
+};
+
+static void webkit_navigation_policy_decision_init(WebKitNavigationPolicyDecision* decision)
+{
+ decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionPrivate);
+ new (decision->priv) WebKitNavigationPolicyDecisionPrivate();
+}
+
+static void webkitNavigationPolicyDecisionFinalize(GObject* object)
+{
+ WEBKIT_NAVIGATION_POLICY_DECISION(object)->priv->~WebKitNavigationPolicyDecisionPrivate();
+ G_OBJECT_CLASS(webkit_navigation_policy_decision_parent_class)->finalize(object);
+}
+
+static void webkitNavigationPolicyDecisionGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+ WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(object);
+ switch (propId) {
+ case PROP_NAVIGATION_TYPE:
+ g_value_set_enum(value, webkit_navigation_policy_decision_get_navigation_type(decision));
+ break;
+ case PROP_MOUSE_BUTTON:
+ g_value_set_enum(value, webkit_navigation_policy_decision_get_mouse_button(decision));
+ break;
+ case PROP_MODIFIERS:
+ g_value_set_uint(value, webkit_navigation_policy_decision_get_modifiers(decision));
+ break;
+ case PROP_REQUEST:
+ g_value_set_object(value, webkit_navigation_policy_decision_get_request(decision));
+ break;
+ case PROP_FRAME_NAME:
+ g_value_set_string(value, webkit_navigation_policy_decision_get_frame_name(decision));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+ break;
+ }
+}
+
+static void webkit_navigation_policy_decision_class_init(WebKitNavigationPolicyDecisionClass* decisionClass)
+{
+ GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass);
+ objectClass->finalize = webkitNavigationPolicyDecisionFinalize;
+ objectClass->get_property = webkitNavigationPolicyDecisionGetProperty;
+ g_type_class_add_private(decisionClass, sizeof(WebKitNavigationPolicyDecisionPrivate));
+
+ /**
+ * WebKitNavigationPolicyDecision:navigation-type:
+ *
+ * The type of navigation that triggered this policy decision. This is
+ * useful for enacting different policies depending on what type of user
+ * action caused the navigation.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_NAVIGATION_TYPE,
+ g_param_spec_enum("navigation-type",
+ _("Navigation type"),
+ _("The type of navigation triggering this decision"),
+ WEBKIT_TYPE_NAVIGATION_TYPE,
+ WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitNavigationPolicyDecision:mouse-button:
+ *
+ * If the navigation associated with this policy decision was originally
+ * triggered by a mouse event, this property contains non-zero button number
+ * of the button triggering that event. The button numbers match those from GDK.
+ * If the navigation was not triggered by a mouse event, the value of this
+ * property will be 0.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_MOUSE_BUTTON,
+ g_param_spec_uint("mouse-button",
+ _("Mouse button"),
+ _("The mouse button used if this decision was triggered by a mouse event"),
+ 0, G_MAXUINT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitNavigationPolicyDecision:modifiers:
+ *
+ * If the navigation associated with this policy decision was originally
+ * triggered by a mouse event, this property contains a bitmask of various
+ * GdkModifierType values describing the modifiers used for that click.
+ * If the navigation was not triggered by a mouse event or no modifiers
+ * were active, the value of this property will be zero.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_MODIFIERS,
+ g_param_spec_uint("modifiers",
+ _("Mouse event modifiers"),
+ _("The modifiers active if this decision was triggered by a mouse event"),
+ 0, G_MAXUINT, 0,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitNavigationPolicyDecision:request:
+ *
+ * This property contains the #WebKitURIRequest associated with this
+ * navigation.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_REQUEST,
+ g_param_spec_object("request",
+ _("Navigation URI request"),
+ _("The URI request that is associated with this navigation"),
+ WEBKIT_TYPE_URI_REQUEST,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitNavigationPolicyDecision:frame-name:
+ *
+ * If this navigation request targets a new frame, this property contains
+ * the name of that frame. For example if the decision was triggered by clicking a
+ * link with a target attribute equal to "_blank", this property will contain the
+ * value of that attribute. In all other cases, this value will be %NULL.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_FRAME_NAME,
+ g_param_spec_string("frame-name",
+ _("Frame name"),
+ _("The name of the new frame this navigation action targets"),
+ 0,
+ WEBKIT_PARAM_READABLE));
+}
+
+/**
+ * webkit_navigation_policy_decision_get_navigation_type:
+ * @decision: a #WebKitNavigationPolicyDecision
+ *
+ * Gets the value of the #WebKitNavigationPolicyDecision:navigation-type property.
+ *
+ * Returns: The type of navigation triggering this policy decision.
+ */
+WebKitNavigationType webkit_navigation_policy_decision_get_navigation_type(WebKitNavigationPolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), WEBKIT_NAVIGATION_TYPE_OTHER);
+ return decision->priv->navigationType;
+}
+
+/**
+ * webkit_navigation_policy_decision_get_mouse_button:
+ * @decision: a #WebKitNavigationPolicyDecision
+ *
+ * Gets the value of the #WebKitNavigationPolicyDecision:mouse-button property.
+ *
+ * Returns: The mouse button used if this decision was triggered by a mouse event or 0 otherwise
+ */
+guint webkit_navigation_policy_decision_get_mouse_button(WebKitNavigationPolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ return decision->priv->mouseButton;
+}
+
+/**
+ * webkit_navigation_policy_decision_get_modifiers:
+ * @decision: a #WebKitNavigationPolicyDecision
+ *
+ * Gets the value of the #WebKitNavigationPolicyDecision:modifiers property.
+ *
+ * Returns: The modifiers active if this decision was triggered by a mouse event
+ */
+unsigned webkit_navigation_policy_decision_get_modifiers(WebKitNavigationPolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ return decision->priv->modifiers;
+}
+
+/**
+ * webkit_navigation_policy_decision_get_request:
+ * @decision: a #WebKitNavigationPolicyDecision
+ *
+ * Gets the value of the #WebKitNavigationPolicyDecision:request property.
+ *
+ * Returns: (transfer none): The URI request that is associated with this navigation
+ */
+WebKitURIRequest* webkit_navigation_policy_decision_get_request(WebKitNavigationPolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ return decision->priv->request.get();
+}
+
+/**
+ * webkit_navigation_policy_decision_get_frame_name:
+ * @decision: a #WebKitNavigationPolicyDecision
+ *
+ * Gets the value of the #WebKitNavigationPolicyDecision:frame-name property.
+ *
+ * Returns: The name of the new frame this navigation action targets or %NULL
+ */
+const char* webkit_navigation_policy_decision_get_frame_name(WebKitNavigationPolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_NAVIGATION_POLICY_DECISION(decision), 0);
+ return decision->priv->frameName.data();
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_LINK_CLICKED, kWKFrameNavigationTypeLinkClicked);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED, kWKFrameNavigationTypeFormSubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_BACK_FORWARD, kWKFrameNavigationTypeBackForward);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_RELOAD, kWKFrameNavigationTypeReload);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED, kWKFrameNavigationTypeFormResubmitted);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NAVIGATION_TYPE_OTHER, kWKFrameNavigationTypeOther);
+
+static unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton wkButton)
+{
+ switch (wkButton) {
+ case kWKEventMouseButtonNoButton:
+ return 0;
+ case kWKEventMouseButtonLeftButton:
+ return 1;
+ case kWKEventMouseButtonMiddleButton:
+ return 2;
+ case kWKEventMouseButtonRightButton:
+ return 3;
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+unsigned wkEventModifiersToUnsigned(WKEventModifiers wkModifiers)
+{
+ unsigned modifiers = 0;
+ if (wkModifiers & kWKEventModifiersShiftKey)
+ modifiers |= GDK_SHIFT_MASK;
+ if (wkModifiers & kWKEventModifiersControlKey)
+ modifiers |= GDK_CONTROL_MASK;
+ if (wkModifiers & kWKEventModifiersAltKey)
+ modifiers |= GDK_MOD1_MASK;
+ if (wkModifiers & kWKEventModifiersMetaKey)
+ modifiers |= GDK_META_MASK;
+ return modifiers;
+}
+
+WebKitNavigationPolicyDecision* webkitNavigationPolicyDecisionCreate(WKFrameNavigationType navigationType, WKEventMouseButton mouseButton, WKEventModifiers modifiers, WKURLRequestRef request, const char* frameName, WKFramePolicyListenerRef listener)
+{
+ WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, NULL));
+ decision->priv->navigationType = static_cast<WebKitNavigationType>(navigationType);
+ decision->priv->mouseButton = wkEventMouseButtonToWebKitMouseButton(mouseButton);
+ decision->priv->modifiers = wkEventModifiersToUnsigned(modifiers);
+ decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(request)->resourceRequest()));
+ decision->priv->frameName = frameName;
+ webkitPolicyDecisionSetListener(WEBKIT_POLICY_DECISION(decision), listener);
+ return decision;
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
new file mode 100644
index 000000000..bbf241268
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitNavigationPolicyDecision_h
+#define WebKitNavigationPolicyDecision_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitPolicyDecision.h>
+#include <webkit2/WebKitURIRequest.h>
+
+G_BEGIN_DECLS
+
+/**
+ * WebKitNavigationType:
+ * @WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: The navigation was triggered by clicking a link.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: The navigation was triggered by submitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: The navigation was triggered by navigating forward or backward.
+ * @WEBKIT_NAVIGATION_TYPE_RELOAD: The navigation was triggered by reloading.
+ * @WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form.
+ * @WEBKIT_NAVIGATION_TYPE_OTHER: The navigation was triggered by some other action.
+ *
+ * Enum values used to denote the various navigation types.
+ */
+typedef enum {
+ WEBKIT_NAVIGATION_TYPE_LINK_CLICKED,
+ WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_BACK_FORWARD,
+ WEBKIT_NAVIGATION_TYPE_RELOAD,
+ WEBKIT_NAVIGATION_TYPE_FORM_RESUBMITTED,
+ WEBKIT_NAVIGATION_TYPE_OTHER,
+} WebKitNavigationType;
+
+#define WEBKIT_TYPE_NAVIGATION_POLICY_DECISION (webkit_navigation_policy_decision_get_type())
+#define WEBKIT_NAVIGATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecision))
+#define WEBKIT_NAVIGATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionClass))
+#define WEBKIT_IS_NAVIGATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION))
+#define WEBKIT_IS_NAVIGATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION))
+#define WEBKIT_NAVIGATION_POLICY_DECISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecisionClass))
+
+typedef struct _WebKitNavigationPolicyDecision WebKitNavigationPolicyDecision;
+typedef struct _WebKitNavigationPolicyDecisionClass WebKitNavigationPolicyDecisionClass;
+typedef struct _WebKitNavigationPolicyDecisionPrivate WebKitNavigationPolicyDecisionPrivate;
+
+struct _WebKitNavigationPolicyDecision {
+ WebKitPolicyDecision parent;
+
+ /*< private >*/
+ WebKitNavigationPolicyDecisionPrivate *priv;
+};
+
+struct _WebKitNavigationPolicyDecisionClass {
+ WebKitPolicyDecisionClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_navigation_policy_decision_get_type (void);
+
+WEBKIT_API WebKitNavigationType
+webkit_navigation_policy_decision_get_navigation_type (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API guint
+webkit_navigation_policy_decision_get_mouse_button (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API guint
+webkit_navigation_policy_decision_get_modifiers (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API WebKitURIRequest *
+webkit_navigation_policy_decision_get_request (WebKitNavigationPolicyDecision *decision);
+WEBKIT_API const gchar *
+webkit_navigation_policy_decision_get_frame_name (WebKitNavigationPolicyDecision *decision);
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
new file mode 100644
index 000000000..f3c0e1f50
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitNavigationPolicyDecisionPrivate_h
+#define WebKitNavigationPolicyDecisionPrivate_h
+
+#include "WebKitNavigationPolicyDecision.h"
+#include "WebKitPrivate.h"
+
+WebKitNavigationPolicyDecision* webkitNavigationPolicyDecisionCreate(WKFrameNavigationType, WKEventMouseButton, WKEventModifiers, WKURLRequestRef, const char* frameName, WKFramePolicyListenerRef);
+
+#endif // WebKitNavigationPolicyDecisionPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp
new file mode 100644
index 000000000..61757d428
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitPolicyClient.h"
+
+#include "WebKitNavigationPolicyDecisionPrivate.h"
+#include "WebKitPolicyDecision.h"
+#include "WebKitPrivate.h"
+#include "WebKitWebViewBasePrivate.h"
+#include "WebKitWebViewPrivate.h"
+#include <wtf/gobject/GRefPtr.h>
+
+using namespace WebKit;
+
+static void decidePolicyForNavigationActionCallback(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitNavigationPolicyDecision> decision =
+ adoptGRef(webkitNavigationPolicyDecisionCreate(navigationType,
+ mouseButton,
+ modifiers,
+ request,
+ 0, /* frame name */
+ listener));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
+
+static void decidePolicyForNewWindowActionCallback(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitNavigationPolicyDecision> decision =
+ adoptGRef(webkitNavigationPolicyDecisionCreate(navigationType,
+ mouseButton,
+ modifiers,
+ request,
+ toImpl(frameName)->string().utf8().data(),
+ listener));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
+
+void attachPolicyClientToPage(WebKitWebView* webView)
+{
+ WKPagePolicyClient policyClient = {
+ kWKPagePolicyClientCurrentVersion,
+ webView, // clientInfo
+ decidePolicyForNavigationActionCallback,
+ decidePolicyForNewWindowActionCallback,
+ 0, // decidePolicyForResponseCallback,
+ 0, // unableToImplementPolicy
+ };
+ WKPageSetPagePolicyClient(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))), &policyClient);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h
new file mode 100644
index 000000000..90d8d62cc
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitPolicyClient_h
+#define WebKitPolicyClient_h
+
+#include "WebKitWebView.h"
+
+void attachPolicyClientToPage(WebKitWebView*);
+
+#endif // WebKitPolicyClient_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp
new file mode 100644
index 000000000..6b6759012
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitPolicyDecision.h"
+
+#include "WebKitPolicyDecisionPrivate.h"
+#include "WebKitPrivate.h"
+
+
+/**
+ * SECTION: WebKitPolicyDecision
+ * @Short_description: A pending policy decision
+ * @Title: WebKitPolicyDecision
+ * @See_also: #WebKitWebView
+ *
+ * Often WebKit allows the client to decide the policy for certain
+ * operations. For instance, a client may want to open a link in a new
+ * tab, block a navigation entirely, query the user or trigger a download
+ * instead of a navigation. In these cases WebKit will fire the
+ * #WebKitWebView::decide-policy signal with a #WebKitPolicyDecision
+ * object. If the signal handler does nothing, WebKit will act as if
+ * webkit_policy_decision_use() was called as soon as signal handling
+ * completes. To make a policy decision asynchronously, simply increment
+ * the reference count of the #WebKitPolicyDecision object.
+ */
+G_DEFINE_ABSTRACT_TYPE(WebKitPolicyDecision, webkit_policy_decision, G_TYPE_OBJECT)
+
+struct _WebKitPolicyDecisionPrivate {
+ WKRetainPtr<WKFramePolicyListenerRef> listener;
+ bool madePolicyDecision;
+};
+
+static void webkit_policy_decision_init(WebKitPolicyDecision* decision)
+{
+ decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_POLICY_DECISION, WebKitPolicyDecisionPrivate);
+ new (decision->priv) WebKitPolicyDecisionPrivate();
+ decision->priv->madePolicyDecision = false;
+}
+
+static void webkitPolicyDecisionFinalize(GObject* object)
+{
+ WebKitPolicyDecisionPrivate* priv = WEBKIT_POLICY_DECISION(object)->priv;
+
+ // This is the default choice for all policy decisions in WebPageProxy.cpp.
+ if (!priv->madePolicyDecision)
+ WKFramePolicyListenerUse(priv->listener.get());
+
+ priv->~WebKitPolicyDecisionPrivate();
+ G_OBJECT_CLASS(webkit_policy_decision_parent_class)->finalize(object);
+}
+
+void webkitPolicyDecisionSetListener(WebKitPolicyDecision* decision, WKFramePolicyListenerRef listener)
+{
+ decision->priv->listener = listener;
+}
+
+static void webkit_policy_decision_class_init(WebKitPolicyDecisionClass* decisionClass)
+{
+ GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass);
+ objectClass->finalize = webkitPolicyDecisionFinalize;
+ g_type_class_add_private(decisionClass, sizeof(WebKitPolicyDecisionPrivate));
+}
+
+/**
+ * webkit_policy_decision_use:
+ * @decision: a #WebKitPolicyDecision
+ *
+ * Accept the action which triggerd this decision.
+ */
+void webkit_policy_decision_use(WebKitPolicyDecision* decision)
+{
+ g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
+ WKFramePolicyListenerUse(decision->priv->listener.get());
+ decision->priv->madePolicyDecision = true;
+}
+
+/**
+ * webkit_policy_decision_ignore:
+ * @decision: a #WebKitPolicyDecision
+ *
+ * Ignore the action which triggerd this decision. For instance, for a
+ * #WebKitResponsePolicyDecision, this would cancel the request.
+ */
+void webkit_policy_decision_ignore(WebKitPolicyDecision* decision)
+{
+ g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
+ WKFramePolicyListenerIgnore(decision->priv->listener.get());
+ decision->priv->madePolicyDecision = true;
+}
+
+/**
+ * webkit_policy_decision_download:
+ * @decision: a #WebKitPolicyDecision
+ *
+ * Spawn a download from this decision.
+ */
+void webkit_policy_decision_download(WebKitPolicyDecision* decision)
+{
+ g_return_if_fail(WEBKIT_IS_POLICY_DECISION(decision));
+ WKFramePolicyListenerDownload(decision->priv->listener.get());
+ decision->priv->madePolicyDecision = true;
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h
new file mode 100644
index 000000000..ecca5f9c3
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitPolicyDecision_h
+#define WebKitPolicyDecision_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_POLICY_DECISION (webkit_policy_decision_get_type())
+#define WEBKIT_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_POLICY_DECISION, WebKitPolicyDecision))
+#define WEBKIT_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_POLICY_DECISION, WebKitPolicyDecisionClass))
+#define WEBKIT_IS_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_POLICY_DECISION))
+#define WEBKIT_IS_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_POLICY_DECISION))
+#define WEBKIT_POLICY_DECISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_POLICY_DECISION, WebKitPolicyDecisionClass))
+
+typedef struct _WebKitPolicyDecision WebKitPolicyDecision;
+typedef struct _WebKitPolicyDecisionClass WebKitPolicyDecisionClass;
+typedef struct _WebKitPolicyDecisionPrivate WebKitPolicyDecisionPrivate;
+
+struct _WebKitPolicyDecision {
+ GObject parent;
+
+ /*< private >*/
+ WebKitPolicyDecisionPrivate *priv;
+};
+
+struct _WebKitPolicyDecisionClass {
+ GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_policy_decision_get_type (void);
+
+WEBKIT_API void
+webkit_policy_decision_use (WebKitPolicyDecision *decision);
+
+WEBKIT_API void
+webkit_policy_decision_ignore (WebKitPolicyDecision *decision);
+
+WEBKIT_API void
+webkit_policy_decision_download (WebKitPolicyDecision *decision);
+
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h
new file mode 100644
index 000000000..62580c83e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitPolicyDecisionPrivate_h
+#define WebKitPolicyDecisionPrivate_h
+
+#include "WebKitPolicyDecision.h"
+#include <WebKit2/WebKit2.h>
+
+void webkitPolicyDecisionSetListener(WebKitPolicyDecision*, WKFramePolicyListenerRef);
+
+#endif // WebKitResponsePolicyDecisionPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
index 423c464b0..13280d600 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
@@ -26,18 +26,18 @@
#ifndef WebKitPrivate_h
#define WebKitPrivate_h
+#include <WebKit2/WKAPICast.h>
+#include <WebKit2/WKDownload.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WebKit2.h>
#include <glib.h>
#include <wtf/Assertions.h>
-G_BEGIN_DECLS
-
#define WEBKIT_PARAM_READABLE (static_cast<GParamFlags>(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
#define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
#define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
#define COMPILE_ASSERT_MATCHING_ENUM(webkitName, webcoreName) \
- COMPILE_ASSERT(int(webkitName) == int(WebCore::webcoreName), mismatchingEnums)
-
-G_END_DECLS
+ COMPILE_ASSERT(int(webkitName) == int(webcoreName), mismatchingEnums)
#endif // WebKitPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
index 837a9a1e5..06418613d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
@@ -33,9 +33,6 @@
#include "WebKitPrivate.h"
#include "WebKitSettingsPrivate.h"
-#include <WebKit2/WKAPICast.h>
-#include <WebKit2/WKString.h>
-#include <WebKit2/WKRetainPtr.h>
#include <glib/gi18n-lib.h>
#include <wtf/text/CString.h>
@@ -103,7 +100,8 @@ enum {
PROP_ENABLE_TABS_TO_LINKS,
PROP_ENABLE_DNS_PREFETCHING,
PROP_ENABLE_CARET_BROWSING,
- PROP_ENABLE_FULLSCREEN
+ PROP_ENABLE_FULLSCREEN,
+ PROP_PRINT_BACKGROUNDS
};
static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
@@ -201,6 +199,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
case PROP_ENABLE_FULLSCREEN:
webkit_settings_set_enable_fullscreen(settings, g_value_get_boolean(value));
break;
+ case PROP_PRINT_BACKGROUNDS:
+ webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -302,6 +303,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
case PROP_ENABLE_FULLSCREEN:
g_value_set_boolean(value, webkit_settings_get_enable_fullscreen(settings));
break;
+ case PROP_PRINT_BACKGROUNDS:
+ g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -751,6 +755,19 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
FALSE,
readWriteConstructParamFlags));
+ /**
+ * WebKitSettings:print-backgrounds:
+ *
+ * Whether background images should be drawn during printing.
+ */
+ g_object_class_install_property(gObjectClass,
+ PROP_PRINT_BACKGROUNDS,
+ g_param_spec_boolean("print-backgrounds",
+ _("Print Backgrounds"),
+ _("Whether background images should be drawn during printing"),
+ TRUE,
+ readWriteConstructParamFlags));
+
g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
}
@@ -1885,7 +1902,7 @@ gboolean webkit_settings_get_enable_fullscreen(WebKitSettings* settings)
}
/**
- * webkit_settings_set_enable_fullscreen
+ * webkit_settings_set_enable_fullscreen:
* @settings: a #WebKitSettings
* @enabled: Value to be set
*
@@ -1903,3 +1920,38 @@ void webkit_settings_set_enable_fullscreen(WebKitSettings* settings, gboolean en
WKPreferencesSetFullScreenEnabled(priv->preferences.get(), enabled);
g_object_notify(G_OBJECT(settings), "enable-fullscreen");
}
+
+/**
+ * webkit_settings_get_print_backgrounds:
+ * @settings: a #WebKitSettings
+ *
+ * Get the #WebKitSettings:print-backgrounds property.
+ *
+ * Returns: %TRUE If background images should be printed or %FALSE otherwise.
+ */
+gboolean webkit_settings_get_print_backgrounds(WebKitSettings* settings)
+{
+ g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
+
+ return WKPreferencesGetShouldPrintBackgrounds(settings->priv->preferences.get());
+}
+
+/**
+ * webkit_settings_set_print_backgrounds:
+ * @settings: a #WebKitSettings
+ * @print_backgrounds: Value to be set
+ *
+ * Set the #WebKitSettings:print-backgrounds property.
+ */
+void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean printBackgrounds)
+{
+ g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+ WebKitSettingsPrivate* priv = settings->priv;
+ bool currentValue = WKPreferencesGetShouldPrintBackgrounds(priv->preferences.get());
+ if (currentValue == printBackgrounds)
+ return;
+
+ WKPreferencesSetShouldPrintBackgrounds(priv->preferences.get(), printBackgrounds);
+ g_object_notify(G_OBJECT(settings), "print-backgrounds");
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
index 8b19a465b..a6769fc0e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
@@ -286,6 +286,13 @@ WEBKIT_API void
webkit_settings_set_enable_fullscreen (WebKitSettings *settings,
gboolean enabled);
+WEBKIT_API gboolean
+webkit_settings_get_print_backgrounds (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_print_backgrounds (WebKitSettings *settings,
+ gboolean print_backgrounds);
+
G_END_DECLS
#endif /* WebKitSettings_h */
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
index fcfdddb53..a659ad314 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2011, 2012 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,117 +20,117 @@
#include "config.h"
#include "WebKitUIClient.h"
+#include "WebKitPrivate.h"
+#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include "WebPageProxy.h"
-#include <WebKit2/WKBase.h>
+#include <WebCore/GtkUtilities.h>
using namespace WebKit;
-G_DEFINE_TYPE(WebKitUIClient, webkit_ui_client, G_TYPE_OBJECT)
-
-static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef, WKDictionaryRef wkWindowFeatures, WKEventModifiers, WKEventMouseButton, const void*)
+static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef, WKDictionaryRef wkWindowFeatures, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
{
- return webkitWebViewCreateNewPage(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), wkWindowFeatures);
+ return webkitWebViewCreateNewPage(WEBKIT_WEB_VIEW(clientInfo), wkWindowFeatures);
}
-static void showPage(WKPageRef page, const void*)
+static void showPage(WKPageRef page, const void* clientInfo)
{
- webkitWebViewReadyToShowPage(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ webkitWebViewReadyToShowPage(WEBKIT_WEB_VIEW(clientInfo));
}
-static void closePage(WKPageRef page, const void*)
+static void closePage(WKPageRef page, const void* clientInfo)
{
- webkitWebViewClosePage(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ webkitWebViewClosePage(WEBKIT_WEB_VIEW(clientInfo));
}
-static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef, const void*)
+static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef, const void* clientInfo)
{
- webkitWebViewRunJavaScriptAlert(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(message)->string().utf8());
+ webkitWebViewRunJavaScriptAlert(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
}
-static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef, const void*)
+static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef, const void* clientInfo)
{
- return webkitWebViewRunJavaScriptConfirm(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(message)->string().utf8());
+ return webkitWebViewRunJavaScriptConfirm(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8());
}
-static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void*)
+static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef, const void* clientInfo)
{
- return webkitWebViewRunJavaScriptPrompt(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(message)->string().utf8(),
+ return webkitWebViewRunJavaScriptPrompt(WEBKIT_WEB_VIEW(clientInfo), toImpl(message)->string().utf8(),
toImpl(defaultValue)->string().utf8());
}
-static bool toolbarsAreVisible(WKPageRef page, const void*)
+static bool toolbarsAreVisible(WKPageRef page, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
return webkit_window_properties_get_toolbar_visible(windowProperties);
}
-static void setToolbarsAreVisible(WKPageRef page, bool toolbarsVisible, const void*)
+static void setToolbarsAreVisible(WKPageRef page, bool toolbarsVisible, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
webkitWindowPropertiesSetToolbarVisible(windowProperties, toolbarsVisible);
}
-static bool menuBarIsVisible(WKPageRef page, const void*)
+static bool menuBarIsVisible(WKPageRef page, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
return webkit_window_properties_get_menubar_visible(windowProperties);
}
-static void setMenuBarIsVisible(WKPageRef page, bool menuBarVisible, const void*)
+static void setMenuBarIsVisible(WKPageRef page, bool menuBarVisible, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
webkitWindowPropertiesSetMenubarVisible(windowProperties, menuBarVisible);
}
-static bool statusBarIsVisible(WKPageRef page, const void*)
+static bool statusBarIsVisible(WKPageRef page, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
return webkit_window_properties_get_statusbar_visible(windowProperties);
}
-static void setStatusBarIsVisible(WKPageRef page, bool statusBarVisible, const void*)
+static void setStatusBarIsVisible(WKPageRef page, bool statusBarVisible, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
webkitWindowPropertiesSetStatusbarVisible(windowProperties, statusBarVisible);
}
-static bool isResizable(WKPageRef page, const void*)
+static bool isResizable(WKPageRef page, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
return webkit_window_properties_get_resizable(windowProperties);
}
-static void setIsResizable(WKPageRef page, bool resizable, const void*)
+static void setIsResizable(WKPageRef page, bool resizable, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
webkitWindowPropertiesSetResizable(windowProperties, resizable);
}
-static WKRect getWindowFrame(WKPageRef page, const void*)
+static WKRect getWindowFrame(WKPageRef page, const void* clientInfo)
{
GdkRectangle geometry = { 0, 0, 0, 0 };
- GtkWidget* window = gtk_widget_get_toplevel(toImpl(page)->viewWidget());
- if (gtk_widget_is_toplevel(window) && gtk_widget_get_visible(window)) {
+ GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(clientInfo));
+ if (WebCore::widgetIsOnscreenToplevelWindow(window) && gtk_widget_get_visible(window)) {
gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
}
return WKRectMake(geometry.x, geometry.y, geometry.width, geometry.height);
}
-static void setWindowFrame(WKPageRef page, WKRect frame, const void*)
+static void setWindowFrame(WKPageRef page, WKRect frame, const void* clientInfo)
{
- WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()));
+ WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(clientInfo));
GdkRectangle geometry = { frame.origin.x, frame.origin.y, frame.size.width, frame.size.height };
webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
}
-void webkitUIClientAttachUIClientToPage(WebKitUIClient* uiClient, WKPageRef wkPage)
+void attachUIClientToView(WebKitWebView* webView)
{
WKPageUIClient wkUIClient = {
kWKPageUIClientCurrentVersion,
- uiClient, // clientInfo
+ webView, // clientInfo
0, // createNewPage_deprecatedForUseWithV0
showPage,
closePage,
@@ -174,13 +174,7 @@ void webkitUIClientAttachUIClientToPage(WebKitUIClient* uiClient, WKPageRef wkPa
0, // mouseDidMoveOverElement
0, // decidePolicyForNotificationPermissionRequest
};
+ WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)));
WKPageSetPageUIClient(wkPage, &wkUIClient);
}
-static void webkit_ui_client_init(WebKitUIClient* client)
-{
-}
-
-static void webkit_ui_client_class_init(WebKitUIClientClass* clientClass)
-{
-}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h
index 41ef3ec25..e5a1a3e0f 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.h
@@ -20,33 +20,8 @@
#ifndef WebKitUIClient_h
#define WebKitUIClient_h
-#include <WebKit2/WebKit2.h>
-#include <glib-object.h>
+#include "WebKitWebView.h"
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_UI_CLIENT (webkit_ui_client_get_type())
-#define WEBKIT_UI_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_UI_CLIENT, WebKitUIClient))
-#define WEBKIT_UI_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_UI_CLIENT, WebKitUIClientClass))
-#define WEBKIT_IS_UI_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_UI_CLIENT))
-#define WEBKIT_IS_UI_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_UI_CLIENT))
-#define WEBKIT_UI_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_UI_CLIENT, WebKitUIClientClass))
-
-typedef struct _WebKitUIClient WebKitUIClient;
-typedef struct _WebKitUIClientClass WebKitUIClientClass;
-
-struct _WebKitUIClient {
- GObject parent;
-};
-
-struct _WebKitUIClientClass {
- GObjectClass parent_class;
-};
-
-GType webkit_ui_client_get_type (void);
-
-void webkitUIClientAttachUIClientToPage(WebKitUIClient*, WKPageRef);
-
-G_END_DECLS
+void attachUIClientToView(WebKitWebView*);
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp
index 154532a83..b5c2b4e74 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp
@@ -21,9 +21,8 @@
#include "WebKitURIRequest.h"
#include "WebKitPrivate.h"
-#include "WebURLRequest.h"
+#include "WebKitURIRequestPrivate.h"
#include <glib/gi18n-lib.h>
-#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
enum {
@@ -37,6 +36,7 @@ using namespace WebCore;
G_DEFINE_TYPE(WebKitURIRequest, webkit_uri_request, G_TYPE_OBJECT)
struct _WebKitURIRequestPrivate {
+ WebCore::ResourceRequest resourceRequest;
CString uri;
};
@@ -65,7 +65,7 @@ static void webkitURIRequestSetProperty(GObject* object, guint propId, const GVa
switch (propId) {
case PROP_URI:
- request->priv->uri = g_value_get_string(value);
+ request->priv->resourceRequest.setURL(KURL(KURL(), g_value_get_string(value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
@@ -117,6 +117,13 @@ WebKitURIRequest* webkit_uri_request_new(const gchar* uri)
return WEBKIT_URI_REQUEST(g_object_new(WEBKIT_TYPE_URI_REQUEST, "uri", uri, NULL));
}
+WebKitURIRequest* webkitURIRequestCreateForResourceRequest(const WebCore::ResourceRequest& resourceRequest)
+{
+ WebKitURIRequest* uriRequest = WEBKIT_URI_REQUEST(g_object_new(WEBKIT_TYPE_URI_REQUEST, NULL));
+ uriRequest->priv->resourceRequest = resourceRequest;
+ return uriRequest;
+}
+
/**
* webkit_uri_request_get_uri:
* @request: a #WebKitURIRequest
@@ -127,6 +134,7 @@ const gchar* webkit_uri_request_get_uri(WebKitURIRequest* request)
{
g_return_val_if_fail(WEBKIT_IS_URI_REQUEST(request), 0);
+ request->priv->uri = request->priv->resourceRequest.url().string().utf8();
return request->priv->uri.data();
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequestPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequestPrivate.h
new file mode 100644
index 000000000..db85242af
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequestPrivate.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitURIRequestPrivate_h
+#define WebKitURIRequestPrivate_h
+
+#include "WebKitURIRequest.h"
+#include <WebCore/ResourceRequest.h>
+
+WebKitURIRequest* webkitURIRequestCreateForResourceRequest(const WebCore::ResourceRequest&);
+
+#endif // WebKitURIRequestPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
index 2a74cd03a..174bf12f8 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponse.cpp
@@ -22,10 +22,7 @@
#include "WebKitPrivate.h"
#include "WebKitURIResponsePrivate.h"
-#include "WebURLResponse.h"
#include <glib/gi18n-lib.h>
-#include <wtf/gobject/GOwnPtr.h>
-#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
enum {
@@ -41,9 +38,8 @@ using namespace WebCore;
G_DEFINE_TYPE(WebKitURIResponse, webkit_uri_response, G_TYPE_OBJECT)
struct _WebKitURIResponsePrivate {
+ WebCore::ResourceResponse resourceResponse;
CString uri;
- GRefPtr<SoupMessage> message;
- guint64 contentLength;
};
static void webkitURIResponseFinalize(GObject* object)
@@ -71,26 +67,12 @@ static void webkitURIResponseGetProperty(GObject* object, guint propId, GValue*
}
}
-static void webkitURIResponseSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
-{
- WebKitURIResponse* response = WEBKIT_URI_RESPONSE(object);
-
- switch (propId) {
- case PROP_URI:
- response->priv->uri = g_value_get_string(value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
- }
-}
-
static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass)
{
GObjectClass* objectClass = G_OBJECT_CLASS(responseClass);
objectClass->finalize = webkitURIResponseFinalize;
objectClass->get_property = webkitURIResponseGetProperty;
- objectClass->set_property = webkitURIResponseSetProperty;
/**
* WebKitURIResponse:uri:
@@ -103,7 +85,7 @@ static void webkit_uri_response_class_init(WebKitURIResponseClass* responseClass
_("URI"),
_("The URI for which the response was made."),
0,
- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+ WEBKIT_PARAM_READABLE));
/**
* WebKitURIResponse:status-code:
*
@@ -150,6 +132,7 @@ const gchar* webkit_uri_response_get_uri(WebKitURIResponse* response)
{
g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0);
+ response->priv->uri = response->priv->resourceResponse.url().string().utf8();
return response->priv->uri.data();
}
@@ -168,10 +151,7 @@ guint webkit_uri_response_get_status_code(WebKitURIResponse* response)
{
g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), SOUP_STATUS_NONE);
- if (!response->priv->message)
- return SOUP_STATUS_NONE;
-
- return response->priv->message->status_code;
+ return response->priv->resourceResponse.httpStatusCode();
}
/**
@@ -187,30 +167,17 @@ guint64 webkit_uri_response_get_content_length(WebKitURIResponse* response)
{
g_return_val_if_fail(WEBKIT_IS_URI_RESPONSE(response), 0);
- if (response->priv->contentLength)
- return response->priv->contentLength;
-
- if (!response->priv->message)
- return 0;
-
- SoupMessage* message = response->priv->message.get();
- return static_cast<guint64>(soup_message_headers_get_content_length(message->response_headers));
-}
-
-WebKitURIResponse* webkitURIResponseCreateForSoupMessage(SoupMessage* message)
-{
- GOwnPtr<char> uri(soup_uri_to_string(soup_message_get_uri(message), FALSE));
- WebKitURIResponse* response = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, "uri", uri.get(), NULL));
- response->priv->message = message;
- return response;
+ return response->priv->resourceResponse.expectedContentLength();
}
-SoupMessage* webkitURIResponseGetSoupMessage(WebKitURIResponse* response)
+WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse& resourceResponse)
{
- return response->priv->message.get();
+ WebKitURIResponse* uriResponse = WEBKIT_URI_RESPONSE(g_object_new(WEBKIT_TYPE_URI_RESPONSE, NULL));
+ uriResponse->priv->resourceResponse = resourceResponse;
+ return uriResponse;
}
-void webkitURIResponseSetContentLength(WebKitURIResponse* response, guint64 contentLength)
+const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse* uriResponse)
{
- response->priv->contentLength = contentLength;
+ return uriResponse->priv->resourceResponse;
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
index fe84f8b1c..c2dc49c17 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitURIResponsePrivate.h
@@ -27,10 +27,9 @@
#define WebKitURIResponsePrivate_h
#include "WebKitURIResponse.h"
-#include <libsoup/soup.h>
+#include <WebCore/ResourceResponse.h>
-WebKitURIResponse* webkitURIResponseCreateForSoupMessage(SoupMessage*);
-SoupMessage* webkitURIResponseGetSoupMessage(WebKitURIResponse*);
-void webkitURIResponseSetContentLength(WebKitURIResponse*, guint64 contentLength);
+WebKitURIResponse* webkitURIResponseCreateForResourceResponse(const WebCore::ResourceResponse&);
+const WebCore::ResourceResponse& webkitURIResponseGetResourceResponse(WebKitURIResponse*);
#endif // WebKitURIResponsePrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index 1f9590c52..360b0a627 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -20,15 +20,29 @@
#include "config.h"
#include "WebKitWebContext.h"
+#include "WebContext.h"
+#include "WebKitDownloadClient.h"
+#include "WebKitDownloadPrivate.h"
+#include "WebKitPrivate.h"
#include "WebKitWebContextPrivate.h"
-#include <WebKit2/WKContext.h>
-#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKType.h>
+#include <wtf/HashMap.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+enum {
+ DOWNLOAD_STARTED,
+
+ LAST_SIGNAL
+};
struct _WebKitWebContextPrivate {
WKRetainPtr<WKContextRef> context;
};
+static guint signals[LAST_SIGNAL] = { 0, };
+
G_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)
static void webkitWebContextFinalize(GObject* object)
@@ -49,15 +63,32 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
GObjectClass* gObjectClass = G_OBJECT_CLASS(webContextClass);
gObjectClass->finalize = webkitWebContextFinalize;
+ /**
+ * WebKitWebContext::download-started:
+ * @context: the #WebKitWebContext
+ * @download: the #WebKitDownload associated with this event
+ *
+ * This signal is emitted when a new download request is made.
+ */
+ signals[DOWNLOAD_STARTED] =
+ g_signal_new("download-started",
+ G_TYPE_FROM_CLASS(gObjectClass),
+ G_SIGNAL_RUN_LAST,
+ 0, 0, 0,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_DOWNLOAD);
+
g_type_class_add_private(webContextClass, sizeof(WebKitWebContextPrivate));
}
-
static gpointer createDefaultWebContext(gpointer)
{
WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL));
webContext->priv->context = WKContextGetSharedProcessContext();
WKContextSetCacheModel(webContext->priv->context.get(), kWKCacheModelPrimaryWebBrowser);
+ attachDownloadClientToContext(webContext);
+
return webContext;
}
@@ -152,6 +183,59 @@ WebKitCacheModel webkit_web_context_get_cache_model(WebKitWebContext* context)
return WEBKIT_CACHE_MODEL_WEB_BROWSER;
}
+typedef HashMap<WKDownloadRef, GRefPtr<WebKitDownload> > DownloadsMap;
+
+static DownloadsMap& downloadsMap()
+{
+ DEFINE_STATIC_LOCAL(DownloadsMap, downloads, ());
+ return downloads;
+}
+
+/**
+ * webkit_web_context_download_uri:
+ * @context: a #WebKitWebContext
+ * @uri: the URI to download
+ *
+ * Requests downloading of the specified URI string.
+ *
+ * Returns: (transfer full): a new #WebKitDownload representing the
+ * the download operation.
+ */
+WebKitDownload* webkit_web_context_download_uri(WebKitWebContext* context, const gchar* uri)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
+ g_return_val_if_fail(uri, 0);
+
+ WebKitWebContextPrivate* priv = context->priv;
+ WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKURLCreateWithUTF8CString(uri));
+ WKRetainPtr<WKURLRequestRef> wkRequest(AdoptWK, WKURLRequestCreateWithWKURL(wkURL.get()));
+ WKRetainPtr<WKDownloadRef> wkDownload = WKContextDownloadURLRequest(priv->context.get(), wkRequest.get());
+ WebKitDownload* download = webkitDownloadCreate(wkDownload.get());
+ downloadsMap().set(wkDownload.get(), download);
+ return download;
+}
+
+WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload)
+{
+ GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload);
+ if (download)
+ return download.get();
+
+ download = adoptGRef(webkitDownloadCreate(wkDownload));
+ downloadsMap().set(wkDownload, download.get());
+ return download.get();
+}
+
+void webkitWebContextRemoveDownload(WKDownloadRef wkDownload)
+{
+ downloadsMap().remove(wkDownload);
+}
+
+void webkitWebContextDownloadStarted(WebKitWebContext* context, WebKitDownload* download)
+{
+ g_signal_emit(context, signals[DOWNLOAD_STARTED], 0, download);
+}
+
WKContextRef webkitWebContextGetWKContext(WebKitWebContext* context)
{
g_assert(WEBKIT_IS_WEB_CONTEXT(context));
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
index 2f38dbc25..b88bed0da 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitDownload.h>
G_BEGIN_DECLS
@@ -89,6 +90,10 @@ webkit_web_context_set_cache_model (WebKitWebContext *context,
WEBKIT_API WebKitCacheModel
webkit_web_context_get_cache_model (WebKitWebContext *context);
+WEBKIT_API WebKitDownload *
+webkit_web_context_download_uri (WebKitWebContext *context,
+ const gchar *uri);
+
G_END_DECLS
#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
index 86d7dec8b..d2dd81361 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContextPrivate.h
@@ -32,6 +32,9 @@
G_BEGIN_DECLS
WKContextRef webkitWebContextGetWKContext(WebKitWebContext*);
+WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef);
+void webkitWebContextRemoveDownload(WKDownloadRef);
+void webkitWebContextDownloadStarted(WebKitWebContext*, WebKitDownload*);
G_END_DECLS
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.h
deleted file mode 100644
index c6044bc07..000000000
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebLoaderClient.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitWebLoaderClient_h
-#define WebKitWebLoaderClient_h
-
-#include <glib-object.h>
-#include <WebKit2/WebKit2.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_WEB_LOADER_CLIENT (webkit_web_loader_client_get_type())
-#define WEBKIT_WEB_LOADER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_LOADER_CLIENT, WebKitWebLoaderClient))
-#define WEBKIT_WEB_LOADER_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_LOADER_CLIENT, WebKitWebLoaderClientClass))
-#define WEBKIT_IS_WEB_LOADER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_LOADER_CLIENT))
-#define WEBKIT_IS_WEB_LOADER_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_LOADER_CLIENT))
-#define WEBKIT_WEB_LOADER_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_LOADER_CLIENT, WebKitWebLoaderClientClass))
-
-typedef struct _WebKitWebLoaderClient WebKitWebLoaderClient;
-typedef struct _WebKitWebLoaderClientClass WebKitWebLoaderClientClass;
-
-struct _WebKitWebLoaderClient {
- GObject parent;
-};
-
-struct _WebKitWebLoaderClientClass {
- GObjectClass parentClass;
-};
-
-GType webkit_web_loader_client_get_type (void);
-void webkitWebLoaderClientAttachLoaderClientToPage(WebKitWebLoaderClient*, WKPageRef);
-
-G_END_DECLS
-
-#endif
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
index fd2bb5190..fcaa2db1d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
@@ -24,20 +24,19 @@
#include "WebKitBackForwardListPrivate.h"
#include "WebKitEnumTypes.h"
#include "WebKitError.h"
+#include "WebKitLoaderClient.h"
#include "WebKitMarshal.h"
+#include "WebKitPolicyClient.h"
#include "WebKitSettingsPrivate.h"
#include "WebKitUIClient.h"
#include "WebKitWebContextPrivate.h"
-#include "WebKitWebLoaderClient.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
#include "WebKitPrivate.h"
#include "WebPageProxy.h"
#include <WebCore/DragIcon.h>
-#include <WebKit2/WKBase.h>
-#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKURL.h>
+#include <WebCore/GtkUtilities.h>
#include <glib/gi18n-lib.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GRefPtr.h>
@@ -58,6 +57,8 @@ enum {
SCRIPT_CONFIRM,
SCRIPT_PROMPT,
+ DECIDE_POLICY,
+
LAST_SIGNAL
};
@@ -79,8 +80,6 @@ struct _WebKitWebViewPrivate {
CString activeURI;
bool replacingContent;
- GRefPtr<WebKitWebLoaderClient> loaderClient;
- GRefPtr<WebKitUIClient> uiClient;
GRefPtr<WebKitBackForwardList> backForwardList;
GRefPtr<WebKitSettings> settings;
GRefPtr<WebKitWindowProperties> windowProperties;
@@ -111,7 +110,7 @@ static GtkWidget* webkitWebViewCreate(WebKitWebView*)
static GtkWidget* webkitWebViewCreateJavaScriptDialog(WebKitWebView* webView, GtkMessageType type, GtkButtonsType buttons, int defaultResponse, const char* message)
{
GtkWidget* parent = gtk_widget_get_toplevel(GTK_WIDGET(webView));
- GtkWidget* dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(parent) ? GTK_WINDOW(parent) : 0,
+ GtkWidget* dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(parent) ? GTK_WINDOW(parent) : 0,
GTK_DIALOG_DESTROY_WITH_PARENT, type, buttons, "%s", message);
GOwnPtr<char> title(g_strdup_printf("JavaScript - %s", webkit_web_view_get_uri(webView)));
gtk_window_set_title(GTK_WINDOW(dialog), title.get());
@@ -149,10 +148,10 @@ static gboolean webkitWebViewScriptPrompt(WebKitWebView* webView, const char* me
return TRUE;
}
-static void webkitWebViewSetLoaderClient(WebKitWebView* webView, WebKitWebLoaderClient* loaderClient, WKPageRef wkPage)
+static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* decision, WebKitPolicyDecisionType)
{
- webView->priv->loaderClient = loaderClient;
- webkitWebLoaderClientAttachLoaderClientToPage(loaderClient, wkPage);
+ webkit_policy_decision_use(decision);
+ return TRUE;
}
static void webkitWebViewConstructed(GObject* object)
@@ -166,15 +165,11 @@ static void webkitWebViewConstructed(GObject* object)
webkitWebViewBaseCreateWebPage(webViewBase, webkitWebContextGetWKContext(priv->context), 0);
- WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
-
- static GRefPtr<WebKitWebLoaderClient> defaultLoaderClient = adoptGRef(WEBKIT_WEB_LOADER_CLIENT(g_object_new(WEBKIT_TYPE_WEB_LOADER_CLIENT, NULL)));
- webkitWebViewSetLoaderClient(webView, defaultLoaderClient.get(), toAPI(page));
-
- static GRefPtr<WebKitUIClient> defaultUIClient = adoptGRef(WEBKIT_UI_CLIENT(g_object_new(WEBKIT_TYPE_UI_CLIENT, NULL)));
- priv->uiClient = defaultUIClient.get();
- webkitUIClientAttachUIClientToPage(priv->uiClient.get(), toAPI(page));
+ attachLoaderClientToView(webView);
+ attachUIClientToView(webView);
+ attachPolicyClientToPage(webView);
+ WebPageProxy* page = webkitWebViewBaseGetPage(webViewBase);
priv->backForwardList = adoptGRef(webkitBackForwardListCreate(WKPageGetBackForwardList(toAPI(page))));
priv->settings = adoptGRef(webkit_settings_new());
webkitSettingsAttachSettingsToPage(priv->settings.get(), toAPI(page));
@@ -259,6 +254,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
webViewClass->script_alert = webkitWebViewScriptAlert;
webViewClass->script_confirm = webkitWebViewScriptConfirm;
webViewClass->script_prompt = webkitWebViewScriptPrompt;
+ webViewClass->decide_policy = webkitWebViewDecidePolicy;
g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate));
@@ -557,6 +553,66 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_TYPE_BOOLEAN, 3,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
+ /**
+ * WebKitPolicyClient::decide-policy
+ * @web_view: the #WebKitWebView on which the signal is emitted
+ * @decision: the #WebKitNavigationPolicyDecision
+ * @decision_type: a #WebKitPolicyDecisionType denoting the type of @decision
+ *
+ * This signal is emitted when WebKit is requesting the client to decide a policy
+ * decision, such as whether to navigate to a page, open a new window or whether or
+ * not to download a resource. The #WebKitNavigationPolicyDecision passed in the
+ * @decision argument is a generic type, but should be casted to a more
+ * specific type when making the decision. For example:
+ *
+ * <informalexample><programlisting>
+ * static gboolean
+ * decide_policy_cb (WebKitWebView *web_view,
+ * WebKitPolicyDecision *decision,
+ * WebKitPolicyDecisionType type)
+ * {
+ * switch (type) {
+ * case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
+ * WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
+ * /<!-- -->* Make a policy decision here. *<!-- -->/
+ * break;
+ * case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
+ * WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
+ * /<!-- -->* Make a policy decision here. *<!-- -->/
+ * break;
+ * case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
+ * WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision);
+ * /<!-- -->* Make a policy decision here. *<!-- -->/
+ * break;
+ * default:
+ * /<!-- -->* Making no decision results in webkit_policy_decision_use(). *<!-- -->/
+ * return FALSE;
+ * }
+ * return TRUE;
+ * }
+ * </programlisting></informalexample>
+ *
+ * It is possible to make policy decision asynchronously, by simply calling g_object_ref()
+ * on the @decision argument and returning %TRUE to block the default signal handler.
+ * If the last reference is removed on a #WebKitPolicyDecision and no decision has been
+ * made explicitly, webkit_policy_decision_use() will be the default policy decision. The
+ * default signal handler will simply call webkit_policy_decision_use(). Only the first
+ * policy decision chosen for a given #WebKitPolicyDecision will have any affect.
+ *
+ * Returns: %TRUE to stop other handlers from being invoked for the event.
+ * %FALSE to propagate the event further.
+ *
+ */
+ signals[DECIDE_POLICY] =
+ g_signal_new("decide-policy",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitWebViewClass, decide_policy),
+ g_signal_accumulator_true_handled, 0 /* accumulator data */,
+ webkit_marshal_BOOLEAN__OBJECT_ENUM,
+ G_TYPE_BOOLEAN, 2, /* number of parameters */
+ WEBKIT_TYPE_POLICY_DECISION,
+ WEBKIT_TYPE_POLICY_DECISION_TYPE);
}
void webkitWebViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent)
@@ -662,6 +718,12 @@ WKStringRef webkitWebViewRunJavaScriptPrompt(WebKitWebView* webView, const CStri
return text ? WKStringCreateWithUTF8CString(text.get()) : 0;
}
+void webkitWebViewMakePolicyDecision(WebKitWebView* webView, WebKitPolicyDecisionType type, WebKitPolicyDecision* decision)
+{
+ gboolean returnValue;
+ g_signal_emit(webView, signals[DECIDE_POLICY], 0, decision, type, &returnValue);
+}
+
/**
* webkit_web_view_new:
*
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
index a25c438dd..697fcdc80 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
@@ -35,9 +35,44 @@
#include <webkit2/WebKitURIRequest.h>
#include <webkit2/WebKitWebViewBase.h>
#include <webkit2/WebKitWindowProperties.h>
+#include <webkit2/WebKitPolicyDecision.h>
G_BEGIN_DECLS
+/**
+ * WebKitPolicyDecisionType:
+ * @WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: This type of policy decision
+ * is requested when WebKit is about to navigate to a new page in either the
+ * main frame or a subframe. Acceptable policy decisions are either
+ * webkit_policy_decision_use() or webkit_policy_decision_ignore(). This
+ * type of policy decision is always a #WebKitNavigationPolicyDecision.
+ * @WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: This type of policy decision
+ * is requested when WebKit is about to create a new window. Acceptable policy
+ * decisions are either webkit_policy_decision_use() or
+ * webkit_policy_decision_ignore(). This type of policy decision is always
+ * a #WebKitNavigationPolicyDecision. These decisions are useful for implementing
+ * special actions for new windows, such as forcing the new window to open
+ * in a tab when a keyboard modifier is active or handling a special
+ * target attribute on &lt;a&gt; elements.
+ * @WEBKIT_POLICY_DECISION_TYPE_RESPONSE: This type of decision is used when WebKit has
+ * received a response for a network resource and is about to start the load.
+ * Note that these resources include all subresources of a page such as images
+ * and stylesheets as well as main documents. Appropriate policy responses to
+ * this decision are webkit_policy_decision_use(), webkit_policy_decision_ignore(),
+ * or webkit_policy_decision_download(). This type of policy decision is always
+ * a #WebKitResponsePolicyDecision. This decision is useful for forcing
+ * some types of resources to be downloaded rather than rendered in the WebView
+ * or to block the transfer of resources entirely.
+ *
+ * Enum values used for determining the type of a policy decision during
+ * WebKitWebView::decide-policy.
+ */
+typedef enum {
+ WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION,
+ WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION,
+ WEBKIT_POLICY_DECISION_TYPE_RESPONSE,
+} WebKitPolicyDecisionType;
+
#define WEBKIT_TYPE_WEB_VIEW (webkit_web_view_get_type())
#define WEBKIT_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebView))
#define WEBKIT_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass))
@@ -81,26 +116,29 @@ struct _WebKitWebView {
struct _WebKitWebViewClass {
WebKitWebViewBaseClass parent;
- void (* load_changed) (WebKitWebView *web_view,
- WebKitLoadEvent load_event);
- gboolean (* load_failed) (WebKitWebView *web_view,
- WebKitLoadEvent load_event,
- const gchar *failing_uri,
- GError *error);
-
- GtkWidget *(* create) (WebKitWebView *web_view);
- void (* ready_to_show) (WebKitWebView *web_view);
- void (* close) (WebKitWebView *web_view);
-
- gboolean (* script_alert) (WebKitWebView *web_view,
- const gchar *message);
- gboolean (* script_confirm) (WebKitWebView *web_view,
- const gchar *message,
- gboolean *confirmed);
- gboolean (* script_prompt) (WebKitWebView *web_view,
- const gchar *message,
- const gchar *default_text,
- gchar **text);
+ void (* load_changed) (WebKitWebView *web_view,
+ WebKitLoadEvent load_event);
+ gboolean (* load_failed) (WebKitWebView *web_view,
+ WebKitLoadEvent load_event,
+ const gchar *failing_uri,
+ GError *error);
+
+ GtkWidget *(* create) (WebKitWebView *web_view);
+ void (* ready_to_show) (WebKitWebView *web_view);
+ void (* close) (WebKitWebView *web_view);
+
+ gboolean (* script_alert) (WebKitWebView *web_view,
+ const gchar *message);
+ gboolean (* script_confirm) (WebKitWebView *web_view,
+ const gchar *message,
+ gboolean *confirmed);
+ gboolean (* script_prompt) (WebKitWebView *web_view,
+ const gchar *message,
+ const gchar *default_text,
+ gchar **text);
+ gboolean (* decide_policy) (WebKitWebView *web_view,
+ WebKitPolicyDecision *decision,
+ WebKitPolicyDecisionType type);
/* Padding for future expansion */
void (*_webkit_reserved0) (void);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
index 86607162f..d9ccaa32a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
@@ -35,6 +35,8 @@
#include "PageClientImpl.h"
#include "WebContext.h"
#include "WebEventFactory.h"
+#include "WebKitPrivate.h"
+#include "WebKitWebViewBaseAccessible.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebPageProxy.h"
#include <WebCore/ClipboardGtk.h>
@@ -50,7 +52,6 @@
#include <WebCore/PasteboardHelper.h>
#include <WebCore/RefPtrCairo.h>
#include <WebCore/Region.h>
-#include <WebKit2/WKContext.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
@@ -69,6 +70,7 @@ struct _WebKitWebViewBasePrivate {
GtkDragAndDropHelper dragAndDropHelper;
DragIcon dragIcon;
IntSize resizerSize;
+ GRefPtr<AtkObject> accessible;
};
G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER)
@@ -118,6 +120,7 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
| GDK_EXPOSURE_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
+ | GDK_SCROLL_MASK
| GDK_POINTER_MOTION_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK
@@ -139,7 +142,7 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
gtk_im_context_set_client_window(priv->imContext.get(), window);
GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
- if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel)) {
+ if (widgetIsOnscreenToplevelWindow(toplevel)) {
webkitWebViewBaseNotifyResizerSizeForWindow(webView, GTK_WINDOW(toplevel));
g_signal_connect(toplevel, "notify::resize-grip-visible",
G_CALLBACK(toplevelWindowResizeGripVisibilityChanged), webView);
@@ -211,7 +214,7 @@ static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allo
priv->pageProxy->drawingArea()->setSize(IntSize(allocation->width, allocation->height), IntSize());
GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
- if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel))
+ if (widgetIsOnscreenToplevelWindow(toplevel))
webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(toplevel));
}
@@ -221,7 +224,7 @@ static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus*
WebKitWebViewBasePrivate* priv = webViewBase->priv;
GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
- if (gtk_widget_is_toplevel(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
+ if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
gtk_im_context_focus_in(priv->imContext.get());
if (!priv->isPageActive) {
priv->isPageActive = TRUE;
@@ -374,6 +377,34 @@ static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext*
gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
}
+static AtkObject* webkitWebViewBaseGetAccessible(GtkWidget* widget)
+{
+ // If the socket has already been created and embedded a plug ID, return it.
+ WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
+ if (priv->accessible && atk_socket_is_occupied(ATK_SOCKET(priv->accessible.get())))
+ return priv->accessible.get();
+
+ // Create the accessible object and associate it to the widget.
+ if (!priv->accessible) {
+ priv->accessible = adoptGRef(ATK_OBJECT(webkitWebViewBaseAccessibleNew(widget)));
+
+ // Set the parent not to break bottom-up navigation.
+ GtkWidget* parentWidget = gtk_widget_get_parent(widget);
+ AtkObject* axParent = parentWidget ? gtk_widget_get_accessible(parentWidget) : 0;
+ if (axParent)
+ atk_object_set_parent(priv->accessible.get(), axParent);
+ }
+
+ // Try to embed the plug in the socket, if posssible.
+ String plugID = priv->pageProxy->accessibilityPlugID();
+ if (plugID.isNull())
+ return priv->accessible.get();
+
+ atk_socket_embed(ATK_SOCKET(priv->accessible.get()), const_cast<gchar*>(plugID.utf8().data()));
+
+ return priv->accessible.get();
+}
+
static gboolean webkitWebViewBaseDragMotion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
@@ -438,6 +469,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
widgetClass->drag_leave = webkitWebViewBaseDragLeave;
widgetClass->drag_drop = webkitWebViewBaseDragDrop;
widgetClass->drag_data_received = webkitWebViewBaseDragDataReceived;
+ widgetClass->get_accessible = webkitWebViewBaseGetAccessible;
GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass);
gobjectClass->finalize = webkitWebViewBaseFinalize;
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp
new file mode 100644
index 000000000..09a11abe6
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitWebViewBaseAccessible.h"
+
+#include <gtk/gtk.h>
+
+struct _WebKitWebViewBaseAccessiblePrivate {
+ GtkWidget* widget;
+};
+
+G_DEFINE_TYPE(WebKitWebViewBaseAccessible, webkit_web_view_base_accessible, ATK_TYPE_SOCKET)
+
+static void webkitWebViewBaseAccessibleFinalize(GObject* gobject)
+{
+ WebKitWebViewBaseAccessible* accessible = WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(gobject);
+ accessible->priv->~WebKitWebViewBaseAccessiblePrivate();
+ G_OBJECT_CLASS(webkit_web_view_base_accessible_parent_class)->finalize(gobject);
+}
+
+static void webkitWebViewBaseAccessibleWidgetDestroyed(GtkWidget* widget, WebKitWebViewBaseAccessible* accessible)
+{
+ accessible->priv->widget = 0;
+ atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, TRUE);
+}
+
+static void webkitWebViewBaseAccessibleInitialize(AtkObject* atkObject, gpointer data)
+{
+ if (ATK_OBJECT_CLASS(webkit_web_view_base_accessible_parent_class)->initialize)
+ ATK_OBJECT_CLASS(webkit_web_view_base_accessible_parent_class)->initialize(atkObject, data);
+
+ if (data && GTK_IS_WIDGET(data)) {
+ WebKitWebViewBaseAccessible* accessible = WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(atkObject);
+ accessible->priv->widget = GTK_WIDGET(data);
+
+ g_signal_connect_after(accessible->priv->widget, "destroy",
+ G_CALLBACK(webkitWebViewBaseAccessibleWidgetDestroyed), atkObject);
+ }
+
+ atk_object_set_role(atkObject, ATK_ROLE_FILLER);
+}
+
+static AtkStateSet* webkitWebViewBaseAccessibleRefStateSet(AtkObject* atkObject)
+{
+ WebKitWebViewBaseAccessible* accessible = WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(atkObject);
+
+ AtkStateSet* stateSet;
+ if (accessible->priv->widget) {
+ // Use the implementation of AtkSocket if the widget is still alive.
+ stateSet = ATK_OBJECT_CLASS(webkit_web_view_base_accessible_parent_class)->ref_state_set(atkObject);
+ } else {
+ // If the widget is no longer alive, save some remote calls
+ // (because of AtkSocket's implementation of ref_state_set())
+ // and just return that this AtkObject is defunct.
+ stateSet = atk_state_set_new();
+ atk_state_set_add_state(stateSet, ATK_STATE_DEFUNCT);
+ }
+
+ return stateSet;
+}
+
+static gint webkitWebViewBaseAccessibleGetIndexInParent(AtkObject* atkObject)
+{
+ AtkObject* atkParent = atk_object_get_parent(atkObject);
+ if (!atkParent)
+ return -1;
+
+ guint count = atk_object_get_n_accessible_children(atkParent);
+ for (guint i = 0; i < count; ++i) {
+ AtkObject* child = atk_object_ref_accessible_child(atkParent, i);
+ bool childIsObject = child == atkObject;
+ g_object_unref(child);
+ if (childIsObject)
+ return i;
+ }
+
+ return -1;
+}
+
+static void webkit_web_view_base_accessible_init(WebKitWebViewBaseAccessible* accessible)
+{
+ WebKitWebViewBaseAccessiblePrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(accessible, WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, WebKitWebViewBaseAccessiblePrivate);
+ accessible->priv = priv;
+ new (priv) WebKitWebViewBaseAccessiblePrivate();
+}
+
+static void webkit_web_view_base_accessible_class_init(WebKitWebViewBaseAccessibleClass* klass)
+{
+ GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
+ gObjectClass->finalize = webkitWebViewBaseAccessibleFinalize;
+
+ // No need to implement get_n_children() and ref_child() here
+ // since this is a subclass of AtkSocket and all the logic related
+ // to those functions will be implemented by the ATK bridge.
+ AtkObjectClass* atkObjectClass = ATK_OBJECT_CLASS(klass);
+ atkObjectClass->initialize = webkitWebViewBaseAccessibleInitialize;
+ atkObjectClass->ref_state_set = webkitWebViewBaseAccessibleRefStateSet;
+ atkObjectClass->get_index_in_parent = webkitWebViewBaseAccessibleGetIndexInParent;
+
+ g_type_class_add_private(klass, sizeof(WebKitWebViewBaseAccessiblePrivate));
+}
+
+WebKitWebViewBaseAccessible* webkitWebViewBaseAccessibleNew(GtkWidget* widget)
+{
+ AtkObject* object = ATK_OBJECT(g_object_new(WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, NULL));
+ atk_object_initialize(object, widget);
+ return WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(object);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.h
new file mode 100644
index 000000000..3e932c3cd
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBaseAccessible.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitWebViewBaseAccessible_h
+#define WebKitWebViewBaseAccessible_h
+
+#include <atk/atk.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE (webkit_web_view_base_accessible_get_type())
+#define WEBKIT_WEB_VIEW_BASE_ACCESSIBLE(object) (G_TYPE_CHECK_INSTANCE_CAST((object), WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, WebKitWebViewBaseAccessible))
+#define WEBKIT_WEB_VIEW_BASE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, WebKitWebViewBaseAccessibleClass))
+#define WEBKIT_IS_WEB_VIEW_BASE_ACCESSIBLE(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE))
+#define WEBKIT_IS_WEB_VIEW_BASE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE))
+#define WEBKIT_WEB_VIEW_BASE_ACCESSIBLE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), WEBKIT_TYPE_WEB_VIEW_BASE_ACCESSIBLE, WebKitWebViewBaseAccessibleClass))
+
+typedef struct _WebKitWebViewBaseAccessible WebKitWebViewBaseAccessible;
+typedef struct _WebKitWebViewBaseAccessibleClass WebKitWebViewBaseAccessibleClass;
+typedef struct _WebKitWebViewBaseAccessiblePrivate WebKitWebViewBaseAccessiblePrivate;
+
+
+struct _WebKitWebViewBaseAccessible {
+ AtkSocket parent;
+ /*< private >*/
+ WebKitWebViewBaseAccessiblePrivate* priv;
+};
+
+struct _WebKitWebViewBaseAccessibleClass {
+ AtkSocketClass parentClass;
+};
+
+GType webkit_web_view_base_accessible_get_type();
+
+WebKitWebViewBaseAccessible* webkitWebViewBaseAccessibleNew(GtkWidget*);
+
+G_END_DECLS
+
+#endif // WebKitWebViewBaseAccessible_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
index 5c8161afd..66386d028 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
@@ -42,5 +42,6 @@ void webkitWebViewClosePage(WebKitWebView*);
void webkitWebViewRunJavaScriptAlert(WebKitWebView*, const CString& message);
bool webkitWebViewRunJavaScriptConfirm(WebKitWebView*, const CString& message);
WKStringRef webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText);
+void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*);
#endif // WebKitWebViewPrivate_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
index c99f6d6e8..b170c82c9 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp
@@ -24,10 +24,6 @@
#include "WebKitWindowPropertiesPrivate.h"
#include "WebURLRequest.h"
#include <WebCore/IntRect.h>
-#include <WebKit2/WKDictionary.h>
-#include <WebKit2/WKNumber.h>
-#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKString.h>
#include <glib/gi18n-lib.h>
/**
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
index c513959c2..c6f943ab2 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
@@ -20,6 +20,9 @@
<xi:include href="xml/WebKitURIRequest.xml"/>
<xi:include href="xml/WebKitURIResponse.xml"/>
<xi:include href="xml/WebKitWindowProperties.xml"/>
+ <xi:include href="xml/WebKitDownload.xml"/>
+ <xi:include href="xml/WebKitPolicyDecision.xml"/>
+ <xi:include href="xml/WebKitNavigationPolicyDecision.xml"/>
<xi:include href="xml/WebKitError.xml"/>
</chapter>
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
index 84468945d..ef44b2bed 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
@@ -27,6 +27,7 @@ WebKitCacheModel
webkit_web_context_get_default
webkit_web_context_get_cache_model
webkit_web_context_set_cache_model
+webkit_web_context_download_uri
<SUBSECTION Standard>
WebKitWebContextClass
@@ -47,6 +48,7 @@ webkit_web_context_get_type
<TITLE>WebKitWebView</TITLE>
WebKitWebView
WebKitLoadEvent
+WebKitPolicyDecisionType
webkit_web_view_new
webkit_web_view_new_with_context
webkit_web_view_get_context
@@ -202,6 +204,8 @@ webkit_settings_get_enable_caret_browsing
webkit_settings_set_enable_caret_browsing
webkit_settings_get_enable_fullscreen
webkit_settings_set_enable_fullscreen
+webkit_settings_get_print_backgrounds
+webkit_settings_set_print_backgrounds
<SUBSECTION Standard>
WebKitSettingsClass
@@ -285,15 +289,87 @@ webkit_window_properties_get_type
</SECTION>
<SECTION>
+<FILE>WebKitDownload</FILE>
+WebKitDownload
+webkit_download_get_destination
+webkit_download_set_destination
+webkit_download_get_response
+webkit_download_cancel
+webkit_download_get_estimated_progress
+webkit_download_get_elapsed_time
+
+<SUBSECTION Standard>
+WebKitDownloadClass
+WEBKIT_TYPE_DOWNLOAD
+WEBKIT_DOWNLOAD
+WEBKIT_IS_DOWNLOAD
+WEBKIT_DOWNLOAD_CLASS
+WEBKIT_IS_DOWNLOAD_CLASS
+WEBKIT_DOWNLOAD_GET_CLASS
+
+<SUBSECTION Private>
+WebKitDownloadPrivate
+webkit_download_get_type
+</SECTION>
+
+<SECTION>
+<FILE>WebKitPolicyDecision</FILE>
+WebKitPolicyDecision
+webkit_policy_decision_download
+webkit_policy_decision_ignore
+webkit_policy_decision_use
+
+<SUBSECTION Standard>
+WebKitPolicyDecisionClass
+WEBKIT_TYPE_POLICY_DECISION
+WEBKIT_POLICY_DECISION
+WEBKIT_IS_POLICY_DECISION
+WEBKIT_POLICY_DECISION_CLASS
+WEBKIT_IS_POLICY_DECISION_CLASS
+WEBKIT_POLICY_DECISION_GET_CLASS
+
+<SUBSECTION Private>
+WebKitPolicyDecisionPrivate
+webkit_policy_decision_get_type
+</SECTION>
+
+<SECTION>
+<FILE>WebKitNavigationPolicyDecision</FILE>
+WebKitNavigationPolicyDecision
+WebKitNavigationType
+webkit_navigation_policy_decision_get_frame_name
+webkit_navigation_policy_decision_get_modifiers
+webkit_navigation_policy_decision_get_mouse_button
+webkit_navigation_policy_decision_get_navigation_type
+webkit_navigation_policy_decision_get_request
+
+<SUBSECTION Standard>
+WebKitNavigationPolicyDecisionClass
+WEBKIT_TYPE_NAVIGATION_POLICY_DECISION
+WEBKIT_NAVIGATION_POLICY_DECISION
+WEBKIT_IS_NAVIGATION_POLICY_DECISION
+WEBKIT_NAVIGATION_POLICY_DECISION_CLASS
+WEBKIT_IS_NAVIGATION_POLICY_DECISION_CLASS
+WEBKIT_NAVIGATION_POLICY_DECISION_GET_CLASS
+
+<SUBSECTION Private>
+WebKitNavigationPolicyDecisionPrivate
+webkit_navigation_policy_decision_get_type
+</SECTION>
+
+<SECTION>
<FILE>WebKitError</FILE>
WEBKIT_NETWORK_ERROR
WEBKIT_PLUGIN_ERROR
WEBKIT_POLICY_ERROR
+WEBKIT_DOWNLOAD_ERROR
WebKitNetworkError
WebKitPluginError
WebKitPolicyError
+WebKitDownloadError
webkit_network_error_quark
webkit_plugin_error_quark
webkit_policy_error_quark
+webkit_download_error_quark
</SECTION>
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
index 40a841c89..cba2df42c 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
@@ -8,3 +8,5 @@ webkit_settings_get_type
webkit_uri_response_get_type
webkit_uri_request_get_type
webkit_window_properties_get_type
+webkit_download_get_type
+
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/AccessibilityTestServer.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/AccessibilityTestServer.cpp
new file mode 100644
index 000000000..a8bbbc3fa
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/AccessibilityTestServer.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <webkit2/webkit2.h>
+
+static void loadChangedCallback(WebKitWebView*, WebKitLoadEvent loadEvent, gpointer)
+{
+ // Send a message to the parent process when we're ready.
+ if (loadEvent == WEBKIT_LOAD_FINISHED)
+ g_print("OK");
+}
+
+int main(int argc, char** argv)
+{
+ // Make sure that both GAIL and the ATK bridge are loaded.
+ g_setenv("GTK_MODULES", "gail:atk-bridge", TRUE);
+
+ gtk_init(&argc, &argv);
+
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ webkit_web_view_load_html(webView,
+ "<html>"
+ " <body>"
+ " <h1>This is a test</h1>"
+ " <p>This is a paragraph with some plain text.</p>"
+ " <p>This paragraph contains <a href=\"http://www.webkitgtk.org\">a link</a> in the middle.</p>"
+ " </body>"
+ "</html>",
+ 0);
+
+ GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView));
+ gtk_widget_show_all(window);
+
+ g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), 0);
+ g_signal_connect(webView, "load-changed", G_CALLBACK(loadChangedCallback), 0);
+
+ gtk_main();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
index d912b657e..175a149e4 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
@@ -1,13 +1,23 @@
TEST_PROGS += \
Programs/WebKit2APITests/TestWebKitWebContext \
Programs/WebKit2APITests/TestWebKitWebView \
- Programs/WebKit2APITests/TestWebKitWebLoaderClient \
+ Programs/WebKit2APITests/TestLoaderClient \
Programs/WebKit2APITests/TestWebKitSettings \
- Programs/WebKit2APITests/TestBackForwardList
+ Programs/WebKit2APITests/TestBackForwardList \
+ Programs/WebKit2APITests/TestDownloads \
+ Programs/WebKit2APITests/TestWebKitPolicyClient
noinst_PROGRAMS += $(TEST_PROGS)
+
+if HAVE_ATSPI2
+TEST_PROGS += Programs/WebKit2APITests/TestWebKitAccessibility
+
+noinst_PROGRAMS += Programs/WebKit2APITests/AccessibilityTestServer
+endif
+
webkit2_tests_cppflags = \
-DWEBKIT_EXEC_PATH=\"${shell pwd}/$(top_builddir)/Programs\" \
+ -DWEBKIT_SRC_DIR=\"${shell pwd}/${srcdir}\" \
$(javascriptcore_cppflags) \
-I$(srcdir)/Source/JavaScriptCore \
-I$(srcdir)/Source \
@@ -58,11 +68,11 @@ Programs_WebKit2APITests_TestWebKitWebView_CPPFLAGS = $(webkit2_tests_cppflags)
Programs_WebKit2APITests_TestWebKitWebView_LDADD = $(webkit2_tests_ldadd)
Programs_WebKit2APITests_TestWebKitWebView_LDFLAGS = $(webkit2_tests_ldflags)
-Programs_WebKit2APITests_TestWebKitWebLoaderClient_SOURCES = \
- Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp
-Programs_WebKit2APITests_TestWebKitWebLoaderClient_CPPFLAGS = $(webkit2_tests_cppflags)
-Programs_WebKit2APITests_TestWebKitWebLoaderClient_LDADD = $(webkit2_tests_ldadd)
-Programs_WebKit2APITests_TestWebKitWebLoaderClient_LDFLAGS = $(webkit2_tests_ldflags)
+Programs_WebKit2APITests_TestLoaderClient_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
+Programs_WebKit2APITests_TestLoaderClient_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestLoaderClient_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestLoaderClient_LDFLAGS = $(webkit2_tests_ldflags)
Programs_WebKit2APITests_TestWebKitSettings_SOURCES = \
Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
@@ -76,3 +86,28 @@ Programs_WebKit2APITests_TestBackForwardList_CPPFLAGS = $(webkit2_tests_cppflags
Programs_WebKit2APITests_TestBackForwardList_LDADD = $(webkit2_tests_ldadd)
Programs_WebKit2APITests_TestBackForwardList_LDFLAGS = $(webkit2_tests_ldflags)
+Programs_WebKit2APITests_TestWebKitPolicyClient_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp
+Programs_WebKit2APITests_TestWebKitPolicyClient_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestWebKitPolicyClient_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestWebKitPolicyClient_LDFLAGS = $(webkit2_tests_ldflags)
+
+if HAVE_ATSPI2
+Programs_WebKit2APITests_AccessibilityTestServer_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/AccessibilityTestServer.cpp
+Programs_WebKit2APITests_AccessibilityTestServer_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_AccessibilityTestServer_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_AccessibilityTestServer_LDFLAGS = $(webkit2_tests_ldflags)
+
+Programs_WebKit2APITests_TestWebKitAccessibility_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp
+Programs_WebKit2APITests_TestWebKitAccessibility_CPPFLAGS = $(webkit2_tests_cppflags) $(ATSPI2_CFLAGS)
+Programs_WebKit2APITests_TestWebKitAccessibility_LDADD = $(webkit2_tests_ldadd) $(ATSPI2_LIBS)
+Programs_WebKit2APITests_TestWebKitAccessibility_LDFLAGS = $(webkit2_tests_ldflags)
+endif
+
+Programs_WebKit2APITests_TestDownloads_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp
+Programs_WebKit2APITests_TestDownloads_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestDownloads_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestDownloads_LDFLAGS = $(webkit2_tests_ldflags)
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
index 7581f2f6e..9eb08575d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
@@ -138,3 +138,37 @@ void LoadTrackingTest::estimatedProgressChanged()
m_estimatedProgress = progress;
}
+void LoadTrackingTest::loadURI(const char* uri)
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ WebViewTest::loadURI(uri);
+}
+
+void LoadTrackingTest::loadHtml(const char* html, const char* baseURI)
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ WebViewTest::loadHtml(html, baseURI);
+}
+
+void LoadTrackingTest::loadPlainText(const char* plainText)
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ WebViewTest::loadPlainText(plainText);
+}
+
+void LoadTrackingTest::loadRequest(WebKitURIRequest* request)
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ WebViewTest::loadRequest(request);
+}
+
+void LoadTrackingTest::reload()
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ webkit_web_view_reload(m_webView);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h
index 308aa9ce1..2d95c48f4 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h
@@ -39,6 +39,12 @@ public:
virtual void loadFailed(const char* failingURI, GError*);
virtual void estimatedProgressChanged();
+ void loadURI(const char* uri);
+ void loadHtml(const char* html, const char* baseURI);
+ void loadPlainText(const char* plainText);
+ void loadRequest(WebKitURIRequest*);
+ void reload();
+
void setRedirectURI(const char* uri) { m_redirectURI = uri; }
enum LoadEvents {
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp
index ac2a57235..cc657cc64 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp
@@ -27,7 +27,7 @@
#include <webkit2/webkit2.h>
// Back forward list limit is 100 by default.
-static const size_t kBackForwardListLimit = 100;
+static const int kBackForwardListLimit = 100;
static WebKitTestServer* kServer;
@@ -240,7 +240,7 @@ static void testBackForwardListNavigation(BackForwardListTest* test, gconstpoint
static void testBackForwardListLimitAndCache(BackForwardListTest* test, gconstpointer)
{
- for (size_t i = 0; i < kBackForwardListLimit; i++) {
+ for (int i = 0; i < kBackForwardListLimit; i++) {
GOwnPtr<char> path(g_strdup_printf("/Page%d", i));
test->m_changedFlags = BackForwardListTest::CurrentItem | BackForwardListTest::AddedItem;
test->loadURI(kServer->getURIForPath(path.get()).data());
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp
new file mode 100644
index 000000000..461cefa0e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp
@@ -0,0 +1,410 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "TestMain.h"
+#include "WebKitTestServer.h"
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include <libsoup/soup.h>
+#include <string.h>
+#include <webkit2/webkit2.h>
+#include <wtf/Vector.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+static char* kTempDirectory;
+
+class DownloadTest: public Test {
+public:
+ MAKE_GLIB_TEST_FIXTURE(DownloadTest);
+
+ enum DownloadEvent {
+ Started,
+ ReceivedResponse,
+ CreatedDestination,
+ ReceivedData,
+ Failed,
+ Finished
+ };
+
+ static void receivedResponseCallback(WebKitDownload* download, GParamSpec*, DownloadTest* test)
+ {
+ g_assert(webkit_download_get_response(download));
+ test->receivedResponse(download);
+ }
+
+ static gboolean createdDestinationCallback(WebKitDownload* download, const gchar* destination, DownloadTest* test)
+ {
+ g_assert(webkit_download_get_destination(download));
+ g_assert_cmpstr(webkit_download_get_destination(download), ==, destination);
+ test->createdDestination(download, destination);
+ return TRUE;
+ }
+
+ static gboolean receivedDataCallback(WebKitDownload* download, guint64 dataLength, DownloadTest* test)
+ {
+ test->receivedData(download, dataLength);
+ return TRUE;
+ }
+
+ static gboolean finishedCallback(WebKitDownload* download, DownloadTest* test)
+ {
+ test->finished(download);
+ return TRUE;
+ }
+
+ static gboolean failedCallback(WebKitDownload* download, GError* error, DownloadTest* test)
+ {
+ g_assert(error);
+ test->failed(download, error);
+ return TRUE;
+ }
+
+ static gboolean decideDestinationCallback(WebKitDownload* download, const gchar* suggestedFilename, DownloadTest* test)
+ {
+ g_assert(suggestedFilename);
+ test->decideDestination(download, suggestedFilename);
+ return TRUE;
+ }
+
+ static void downloadStartedCallback(WebKitWebContext* context, WebKitDownload* download, DownloadTest* test)
+ {
+ test->started(download);
+ g_signal_connect(download, "notify::response", G_CALLBACK(receivedResponseCallback), test);
+ g_signal_connect(download, "created-destination", G_CALLBACK(createdDestinationCallback), test);
+ g_signal_connect(download, "received-data", G_CALLBACK(receivedDataCallback), test);
+ g_signal_connect(download, "finished", G_CALLBACK(finishedCallback), test);
+ g_signal_connect(download, "failed", G_CALLBACK(failedCallback), test);
+ g_signal_connect(download, "decide-destination", G_CALLBACK(decideDestinationCallback), test);
+ }
+
+ DownloadTest()
+ : m_webContext(webkit_web_context_get_default())
+ , m_mainLoop(g_main_loop_new(0, TRUE))
+ , m_downloadSize(0)
+ {
+ g_signal_connect(m_webContext, "download-started", G_CALLBACK(downloadStartedCallback), this);
+ }
+
+ ~DownloadTest()
+ {
+ g_signal_handlers_disconnect_matched(m_webContext, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+ g_main_loop_unref(m_mainLoop);
+ }
+
+ virtual void started(WebKitDownload* download)
+ {
+ m_downloadEvents.append(Started);
+ }
+
+ virtual void receivedResponse(WebKitDownload* download)
+ {
+ m_downloadEvents.append(ReceivedResponse);
+ }
+
+ virtual void createdDestination(WebKitDownload* download, const char* destination)
+ {
+ m_downloadEvents.append(CreatedDestination);
+ }
+
+ virtual void receivedData(WebKitDownload* download, guint64 dataLength)
+ {
+ m_downloadSize += dataLength;
+ if (!m_downloadEvents.contains(ReceivedData))
+ m_downloadEvents.append(ReceivedData);
+ }
+
+ virtual void finished(WebKitDownload* download)
+ {
+ m_downloadEvents.append(Finished);
+ g_main_loop_quit(m_mainLoop);
+ }
+
+ virtual void failed(WebKitDownload* download, GError* error)
+ {
+ m_downloadEvents.append(Failed);
+ }
+
+ virtual void decideDestination(WebKitDownload* download, const gchar* suggestedFilename)
+ {
+ GOwnPtr<char> destination(g_build_filename(kTempDirectory, suggestedFilename, NULL));
+ GOwnPtr<char> destinationURI(g_filename_to_uri(destination.get(), 0, 0));
+ webkit_download_set_destination(download, destinationURI.get());
+ }
+
+ void waitUntilDownloadFinishes()
+ {
+ g_main_loop_run(m_mainLoop);
+ }
+
+ void checkDestinationAndDeleteFile(WebKitDownload* download, const char* expectedName)
+ {
+ if (!webkit_download_get_destination(download))
+ return;
+ GRefPtr<GFile> destFile = adoptGRef(g_file_new_for_uri(webkit_download_get_destination(download)));
+ GOwnPtr<char> destBasename(g_file_get_basename(destFile.get()));
+ g_assert_cmpstr(destBasename.get(), ==, expectedName);
+
+ g_file_delete(destFile.get(), 0, 0);
+ }
+
+ WebKitWebContext* m_webContext;
+ GMainLoop* m_mainLoop;
+ Vector<DownloadEvent> m_downloadEvents;
+ guint64 m_downloadSize;
+};
+
+static CString getWebKit1TestResoucesDir()
+{
+ GOwnPtr<char> resourcesDir(g_build_filename(WEBKIT_SRC_DIR, "Source", "WebKit", "gtk", "tests", "resources", NULL));
+ return resourcesDir.get();
+}
+
+static void testDownloadLocalFile(DownloadTest* test, gconstpointer)
+{
+ GOwnPtr<char> sourcePath(g_build_filename(getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
+ GRefPtr<GFile> source = adoptGRef(g_file_new_for_path(sourcePath.get()));
+ GRefPtr<GFileInfo> sourceInfo = adoptGRef(g_file_query_info(source.get(), G_FILE_ATTRIBUTE_STANDARD_SIZE, static_cast<GFileQueryInfoFlags>(0), 0, 0));
+ GOwnPtr<char> sourceURI(g_file_get_uri(source.get()));
+ GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, sourceURI.get()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 5);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::CreatedDestination);
+ g_assert_cmpint(events[3], ==, DownloadTest::ReceivedData);
+ g_assert_cmpint(events[4], ==, DownloadTest::Finished);
+
+ g_assert_cmpint(test->m_downloadSize, ==, g_file_info_get_size(sourceInfo.get()));
+ g_assert(webkit_download_get_destination(download.get()));
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1);
+ test->checkDestinationAndDeleteFile(download.get(), "test.pdf");
+}
+
+class DownloadErrorTest: public DownloadTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(DownloadErrorTest);
+
+ DownloadErrorTest()
+ : m_expectedError(WEBKIT_DOWNLOAD_ERROR_NETWORK)
+ {
+ }
+
+ void receivedResponse(WebKitDownload* download)
+ {
+ DownloadTest::receivedResponse(download);
+ if (m_expectedError == WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER)
+ webkit_download_cancel(download);
+ }
+
+ void createdDestination(WebKitDownload* download, const char* destination)
+ {
+ g_assert_not_reached();
+ }
+
+ void failed(WebKitDownload* download, GError* error)
+ {
+ g_assert(g_error_matches(error, WEBKIT_DOWNLOAD_ERROR, m_expectedError));
+ DownloadTest::failed(download, error);
+ }
+
+ void decideDestination(WebKitDownload* download, const gchar* suggestedFilename)
+ {
+ if (m_expectedError != WEBKIT_DOWNLOAD_ERROR_DESTINATION) {
+ DownloadTest::decideDestination(download, suggestedFilename);
+ return;
+ }
+ webkit_download_set_destination(download, "file:///foo/bar");
+ }
+
+ WebKitDownloadError m_expectedError;
+};
+
+static void testDownloadLocalFileError(DownloadErrorTest* test, gconstpointer)
+{
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_NETWORK;
+ GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, "file:///foo/bar"));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 3);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[2], ==, DownloadTest::Finished);
+ events.clear();
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_DESTINATION;
+ GOwnPtr<char> path(g_build_filename(getWebKit1TestResoucesDir().data(), "test.pdf", NULL));
+ GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(path.get()));
+ GOwnPtr<char> uri(g_file_get_uri(file.get()));
+ download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, uri.get()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 4);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[3], ==, DownloadTest::Finished);
+ events.clear();
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+ test->checkDestinationAndDeleteFile(download.get(), "bar");
+
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER;
+ download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, uri.get()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 4);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[3], ==, DownloadTest::Finished);
+ events.clear();
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+ test->checkDestinationAndDeleteFile(download.get(), "test.pdf");
+}
+
+static WebKitTestServer* kServer;
+static const char* kServerSuggestedFilename = "webkit-downloaded-file";
+
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+ if (message->method != SOUP_METHOD_GET) {
+ soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+ return;
+ }
+
+ GOwnPtr<char> filePath(g_build_filename(getWebKit1TestResoucesDir().data(), path, NULL));
+ char* contents;
+ gsize contentsLength;
+ if (!g_file_get_contents(filePath.get(), &contents, &contentsLength, 0)) {
+ soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+ soup_message_body_complete(message->response_body);
+ return;
+ }
+
+ soup_message_set_status(message, SOUP_STATUS_OK);
+
+ GOwnPtr<char> contentDisposition(g_strdup_printf("filename=%s", kServerSuggestedFilename));
+ soup_message_headers_append(message->response_headers, "Content-Disposition", contentDisposition.get());
+ soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, contents, contentsLength);
+
+ soup_message_body_complete(message->response_body);
+}
+
+static void testDownloadRemoteFile(DownloadTest* test, gconstpointer)
+{
+ GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 5);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::CreatedDestination);
+ g_assert_cmpint(events[3], ==, DownloadTest::ReceivedData);
+ g_assert_cmpint(events[4], ==, DownloadTest::Finished);
+ events.clear();
+
+ g_assert(webkit_download_get_destination(download.get()));
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1);
+ test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename);
+}
+
+static void testDownloadRemoteFileError(DownloadErrorTest* test, gconstpointer)
+{
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_NETWORK;
+ GRefPtr<WebKitDownload> download = adoptGRef(webkit_web_context_download_uri(test->m_webContext,
+ kServer->getURIForPath("/foo").data()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ Vector<DownloadTest::DownloadEvent>& events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 4);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[3], ==, DownloadTest::Finished);
+ events.clear();
+ WebKitURIResponse* response = webkit_download_get_response(download.get());
+ g_assert_cmpuint(webkit_uri_response_get_status_code(response), ==, 404);
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_DESTINATION;
+ download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 4);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[3], ==, DownloadTest::Finished);
+ events.clear();
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+ test->checkDestinationAndDeleteFile(download.get(), "bar");
+
+ test->m_expectedError = WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER;
+ download = adoptGRef(webkit_web_context_download_uri(test->m_webContext, kServer->getURIForPath("/test.pdf").data()));
+ test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(download.get()));
+ test->waitUntilDownloadFinishes();
+
+ events = test->m_downloadEvents;
+ g_assert_cmpint(events.size(), ==, 4);
+ g_assert_cmpint(events[0], ==, DownloadTest::Started);
+ g_assert_cmpint(events[1], ==, DownloadTest::ReceivedResponse);
+ g_assert_cmpint(events[2], ==, DownloadTest::Failed);
+ g_assert_cmpint(events[3], ==, DownloadTest::Finished);
+ events.clear();
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), <, 1);
+ test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename);
+}
+
+void beforeAll()
+{
+ kServer = new WebKitTestServer();
+ kServer->run(serverCallback);
+
+ kTempDirectory = g_dir_make_tmp("WebKit2Tests-XXXXXX", 0);
+ g_assert(kTempDirectory);
+
+ DownloadTest::add("Downloads", "local-file", testDownloadLocalFile);
+ DownloadErrorTest::add("Downloads", "local-file-error", testDownloadLocalFileError);
+ DownloadTest::add("Downloads", "remote-file", testDownloadRemoteFile);
+ DownloadErrorTest::add("Downloads", "remote-file-error", testDownloadRemoteFileError);
+}
+
+void afterAll()
+{
+ delete kServer;
+ g_rmdir(kTempDirectory);
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
index aaa9ff873..3afa2b96f 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
@@ -55,27 +55,26 @@ static void testLoadingError(LoadTrackingTest* test, gconstpointer)
g_assert_cmpint(events[2], ==, LoadTrackingTest::LoadFinished);
}
-static void assertNormalLoadHappenedAndClearEvents(Vector<LoadTrackingTest::LoadEvents>& events)
+static void assertNormalLoadHappened(Vector<LoadTrackingTest::LoadEvents>& events)
{
g_assert_cmpint(events.size(), ==, 3);
g_assert_cmpint(events[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
g_assert_cmpint(events[1], ==, LoadTrackingTest::LoadCommitted);
g_assert_cmpint(events[2], ==, LoadTrackingTest::LoadFinished);
- events.clear();
}
static void testLoadHtml(LoadTrackingTest* test, gconstpointer)
{
test->loadHtml("<html><body>Hello WebKit-GTK+</body></html>", 0);
test->waitUntilLoadFinished();
- assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+ assertNormalLoadHappened(test->m_loadEvents);
}
static void testLoadPlainText(LoadTrackingTest* test, gconstpointer)
{
test->loadPlainText("Hello WebKit-GTK+");
test->waitUntilLoadFinished();
- assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+ assertNormalLoadHappened(test->m_loadEvents);
}
static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
@@ -83,7 +82,7 @@ static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
GRefPtr<WebKitURIRequest> request(webkit_uri_request_new(kServer->getURIForPath("/normal").data()));
test->loadRequest(request.get());
test->waitUntilLoadFinished();
- assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+ assertNormalLoadHappened(test->m_loadEvents);
}
class LoadStopTrackingTest : public LoadTrackingTest {
@@ -126,16 +125,16 @@ static void testWebViewTitle(LoadTrackingTest* test, gconstpointer)
static void testWebViewReload(LoadTrackingTest* test, gconstpointer)
{
// Check that nothing happens when there's nothing to reload.
- webkit_web_view_reload(test->m_webView);
+ test->reload();
test->wait(0.25); // Wait for a quarter of a second.
test->loadURI(kServer->getURIForPath("/normal").data());
test->waitUntilLoadFinished();
- assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+ assertNormalLoadHappened(test->m_loadEvents);
- webkit_web_view_reload(test->m_webView);
+ test->reload();
test->waitUntilLoadFinished();
- assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+ assertNormalLoadHappened(test->m_loadEvents);
}
static void testLoadProgress(LoadTrackingTest* test, gconstpointer)
@@ -240,8 +239,8 @@ void beforeAll()
kServer = new WebKitTestServer();
kServer->run(serverCallback);
- LoadTrackingTest::add("WebKitWebLoaderClient", "loading-status", testLoadingStatus);
- LoadTrackingTest::add("WebKitWebLoaderClient", "loading-error", testLoadingError);
+ LoadTrackingTest::add("WebKitWebView", "loading-status", testLoadingStatus);
+ LoadTrackingTest::add("WebKitWebView", "loading-error", testLoadingError);
LoadTrackingTest::add("WebKitWebView", "load-html", testLoadHtml);
LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText);
LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp
new file mode 100644
index 000000000..3db9094a5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitAccessibility.cpp
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "TestMain.h"
+#include "WebViewTest.h"
+
+// The libatspi headers don't use G_BEGIN_DECLS
+extern "C" {
+#include <atspi/atspi.h>
+}
+
+#include <errno.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
+
+// Name of the test server application creating the webView object.
+static const char* kTestServerAppName = "AccessibilityTestServer";
+
+// Max seconds to wait for the test server before inspecting it.
+static const int kMaxWaitForChild = 5;
+
+// The PID for the test server running, so we can kill it if needed.
+static GPid kChildProcessPid = 0;
+
+// Whether the child has replied and it's ready.
+static bool kChildIsReady = false;
+
+static void stopTestServer()
+{
+ // Do nothing if there's no server running.
+ if (!kChildProcessPid)
+ return;
+
+ g_spawn_close_pid(kChildProcessPid);
+ kill(kChildProcessPid, SIGTERM);
+ kChildProcessPid = 0;
+}
+
+static void sigAbortHandler(int sigNum)
+{
+ // Just stop the test server if SIGABRT was received.
+ stopTestServer();
+}
+
+static gpointer testServerMonitorThreadFunc(gpointer)
+{
+ // Wait for the specified timeout to happen.
+ g_usleep(kMaxWaitForChild * G_USEC_PER_SEC);
+
+ // Kill the child process if not ready yet.
+ if (!kChildIsReady)
+ stopTestServer();
+
+ g_thread_exit(0);
+ return 0;
+}
+
+static void startTestServerMonitor()
+{
+ kChildIsReady = false;
+
+#if (!GLIB_CHECK_VERSION(2, 31, 0))
+ g_thread_create(testServerMonitorThreadFunc, 0, FALSE, 0);
+#else
+ g_thread_new("TestServerMonitor", testServerMonitorThreadFunc, 0);
+#endif
+}
+
+static void startTestServer()
+{
+ // Prepare argv[] for spawning the server process.
+ GOwnPtr<char> testServerPath(g_build_filename(WEBKIT_EXEC_PATH, "WebKit2APITests", kTestServerAppName, NULL));
+
+ char* testServerArgv[2];
+ testServerArgv[0] = testServerPath.get();
+ testServerArgv[1] = 0;
+
+ // Spawn the server, getting its stdout file descriptor to set a
+ // communication channel, so we know when it's ready.
+ int childStdout = 0;
+ if (!g_spawn_async_with_pipes(0, testServerArgv, 0, static_cast<GSpawnFlags>(0), 0, 0,
+ &kChildProcessPid, 0, &childStdout, 0, 0)) {
+ close(childStdout);
+ return;
+ }
+
+ // Start monitoring the test server (in a separate thread) to
+ // ensure we don't block on the child process more than a timeout.
+ startTestServerMonitor();
+
+ char msg[2];
+ GIOChannel* ioChannel = g_io_channel_unix_new(childStdout);
+ if (g_io_channel_read_chars(ioChannel, msg, 2, 0, 0) == G_IO_STATUS_NORMAL) {
+ // Check whether the server sent a message saying it's ready
+ // and store the result globally, so the monitor can see it.
+ kChildIsReady = msg[0] == 'O' && msg[1] == 'K';
+ }
+ g_io_channel_unref(ioChannel);
+ close(childStdout);
+
+ // The timeout was reached and the server is not ready yet, so
+ // stop it inmediately, and let the unit tests fail.
+ if (!kChildIsReady)
+ stopTestServer();
+}
+
+static void checkAtspiAccessible(AtspiAccessible* accessible, const char* targetName, AtspiRole targetRole)
+{
+ g_assert(ATSPI_IS_ACCESSIBLE(accessible));
+
+ GOwnPtr<char> name(atspi_accessible_get_name(accessible, 0));
+ g_assert_cmpstr(targetName, ==, name.get());
+ g_assert_cmpint(targetRole, ==, atspi_accessible_get_role(accessible, 0));
+}
+
+static GRefPtr<AtspiAccessible> findTestServerApplication()
+{
+ // Only one desktop is supported by ATSPI at the moment.
+ GRefPtr<AtspiAccessible> desktop = adoptGRef(atspi_get_desktop(0));
+
+ // Look for the server application in the list of apps.
+ GRefPtr<AtspiAccessible> current;
+ int childCount = atspi_accessible_get_child_count(desktop.get(), 0);
+ for (int i = 0; i < childCount; i++) {
+ current = adoptGRef(atspi_accessible_get_child_at_index(desktop.get(), i, 0));
+ if (!g_strcmp0(atspi_accessible_get_name(current.get(), 0), kTestServerAppName))
+ return current;
+ }
+
+ return 0;
+}
+
+static void testAtspiBasicHierarchy(WebViewTest* test, gconstpointer)
+{
+ // The test server's accessibility object (UI Process).
+ GRefPtr<AtspiAccessible> testServerApp = findTestServerApplication();
+ g_assert(ATSPI_IS_ACCESSIBLE(testServerApp.get()));
+ checkAtspiAccessible(testServerApp.get(), "AccessibilityTestServer", ATSPI_ROLE_APPLICATION);
+
+ // The main window's accessibility object (UI Process).
+ GRefPtr<AtspiAccessible> currentParent = testServerApp;
+ GRefPtr<AtspiAccessible> currentChild = adoptGRef(atspi_accessible_get_child_at_index(currentParent.get(), 0, 0));
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_FRAME);
+
+ // The WebView's accessibility object (UI Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_FILLER);
+
+ // The WebPage's accessibility object (Web Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_FILLER);
+
+ // HTML root element's accessible element (Web Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+
+ // HTML body's accessible element (Web Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_DOCUMENT_FRAME);
+
+ // HTML H1's accessible element (Web Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "This is a test", ATSPI_ROLE_HEADING);
+
+ // HTML first paragraph's accessible element (Web Process).
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 1, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_PARAGRAPH);
+
+ // HTML second paragraph's accessible element (Web Process).
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 2, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "", ATSPI_ROLE_PARAGRAPH);
+
+ // HTML link's accessible element (Web Process).
+ currentParent = currentChild;
+ currentChild = atspi_accessible_get_child_at_index(currentParent.get(), 0, 0);
+ g_assert(ATSPI_IS_ACCESSIBLE(currentChild.get()));
+ checkAtspiAccessible(currentChild.get(), "a link", ATSPI_ROLE_LINK);
+}
+
+void beforeAll()
+{
+ // We install a handler to ensure that we kill the child process
+ // if the parent dies because of whatever the reason is.
+ signal(SIGABRT, sigAbortHandler);
+
+ // Start the accessibility test server and load the tests.
+ startTestServer();
+ WebViewTest::add("WebKitAccessibility", "atspi-basic-hierarchy", testAtspiBasicHierarchy);
+}
+
+void afterAll()
+{
+ // Ensure we stop the server.
+ stopTestServer();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp
new file mode 100644
index 000000000..7cbe4e7f9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "LoadTrackingTest.h"
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+class PolicyClientTest: public LoadTrackingTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(PolicyClientTest);
+
+ enum PolicyDecisionResponse {
+ Use,
+ Ignore,
+ Download,
+ None
+ };
+
+ PolicyClientTest()
+ : LoadTrackingTest()
+ , m_policyDecisionResponse(None)
+ , m_policyDecisionTypeFilter(0)
+ , m_respondToPolicyDecisionAsynchronously(false)
+ , m_haltMainLoopAfterMakingDecision(false)
+ {
+ g_signal_connect(m_webView, "decide-policy", G_CALLBACK(decidePolicyCallback), this);
+ }
+
+ static gboolean quitMainLoopLater(GMainLoop* loop)
+ {
+ g_main_loop_quit(loop);
+ return FALSE;
+ }
+
+ static void respondToPolicyDecision(PolicyClientTest* test, WebKitPolicyDecision* decision)
+ {
+ switch (test->m_policyDecisionResponse) {
+ case Use:
+ webkit_policy_decision_use(decision);
+ break;
+ case Ignore:
+ webkit_policy_decision_ignore(decision);
+ break;
+ case Download:
+ webkit_policy_decision_download(decision);
+ break;
+ case None:
+ break;
+ }
+
+ if (test->m_haltMainLoopAfterMakingDecision)
+ g_idle_add(reinterpret_cast<GSourceFunc>(quitMainLoopLater), test->m_mainLoop);
+ }
+
+ static gboolean respondToPolicyDecisionLater(PolicyClientTest* test)
+ {
+ respondToPolicyDecision(test, test->m_previousPolicyDecision.get());
+ test->m_previousPolicyDecision = 0;
+ return FALSE;
+ }
+
+ static gboolean decidePolicyCallback(WebKitWebView* webView, WebKitPolicyDecision* decision, WebKitPolicyDecisionType type, PolicyClientTest* test)
+ {
+ if (test->m_policyDecisionTypeFilter != type)
+ return FALSE;
+
+ test->m_previousPolicyDecision = decision;
+ if (test->m_respondToPolicyDecisionAsynchronously) {
+ g_idle_add(reinterpret_cast<GSourceFunc>(respondToPolicyDecisionLater), test);
+ return TRUE;
+ }
+
+ respondToPolicyDecision(test, decision);
+
+ // We return FALSE here to ensure that the default policy decision
+ // handler doesn't override whatever we use here.
+ return FALSE;
+ }
+
+ PolicyDecisionResponse m_policyDecisionResponse;
+ int m_policyDecisionTypeFilter;
+ bool m_respondToPolicyDecisionAsynchronously;
+ bool m_haltMainLoopAfterMakingDecision;
+ GRefPtr<WebKitPolicyDecision> m_previousPolicyDecision;
+};
+
+static void testNavigationPolicy(PolicyClientTest* test, gconstpointer)
+{
+ test->m_policyDecisionTypeFilter = WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION;
+
+ test->m_policyDecisionResponse = PolicyClientTest::Use;
+ test->loadHtml("<html/>", "http://webkitgtk.org/");
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
+
+ // Ideally we'd like to have a more intensive test here, but it's still pretty tricky
+ // to trigger different types of navigations with the GTK+ WebKit2 API.
+ WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(test->m_previousPolicyDecision.get());
+ g_assert_cmpint(webkit_navigation_policy_decision_get_navigation_type(decision), ==, WEBKIT_NAVIGATION_TYPE_OTHER);
+ g_assert_cmpint(webkit_navigation_policy_decision_get_mouse_button(decision), ==, 0);
+ g_assert_cmpint(webkit_navigation_policy_decision_get_modifiers(decision), ==, 0);
+ g_assert_cmpstr(webkit_navigation_policy_decision_get_frame_name(decision), ==, 0);
+ WebKitURIRequest* request = webkit_navigation_policy_decision_get_request(decision);
+ g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, "http://webkitgtk.org/");
+
+ test->m_policyDecisionResponse = PolicyClientTest::Use;
+ test->m_respondToPolicyDecisionAsynchronously = true;
+ test->loadHtml("<html/>", "http://webkitgtk.org/");
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
+
+ // If we are waiting until load completion, it will never complete if we ignore the
+ // navigation. So we tell the main loop to quit sometime later.
+ test->m_policyDecisionResponse = PolicyClientTest::Ignore;
+ test->m_respondToPolicyDecisionAsynchronously = false;
+ test->m_haltMainLoopAfterMakingDecision = true;
+ test->loadHtml("<html/>", "http://webkitgtk.org/");
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 0);
+
+ test->m_policyDecisionResponse = PolicyClientTest::Ignore;
+ test->loadHtml("<html/>", "http://webkitgtk.org/");
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 0);
+}
+
+struct CreateCallbackData {
+ bool triedToOpenWindow;
+ GMainLoop* mainLoop;
+};
+
+static WebKitWebView* createCallback(WebKitWebView* webView, CreateCallbackData* data)
+{
+ data->triedToOpenWindow = true;
+ g_main_loop_quit(data->mainLoop);
+ return 0;
+}
+
+static void testNewWindowPolicy(PolicyClientTest* test, gconstpointer)
+{
+ static const char* windowOpeningHTML =
+ "<html><body>"
+ " <a id=\"link\" href=\"http://www.google.com\" target=\"_blank\">Link</a>"
+ " <script>"
+ " var event = document.createEvent('MouseEvents');"
+ " event.initEvent('click', true, false);"
+ " document.getElementById('link').dispatchEvent(event);"
+ " </script>"
+ "</body></html>";
+ test->m_policyDecisionTypeFilter = WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION;
+ webkit_settings_set_javascript_can_open_windows_automatically(webkit_web_view_get_settings(test->m_webView), TRUE);
+
+ CreateCallbackData data;
+ data.triedToOpenWindow = false;
+ data.mainLoop = test->m_mainLoop;
+
+ g_signal_connect(test->m_webView, "create", G_CALLBACK(createCallback), &data);
+ test->m_policyDecisionResponse = PolicyClientTest::Use;
+ test->loadHtml(windowOpeningHTML, "http://webkitgtk.org/");
+ test->wait(1);
+ g_assert(data.triedToOpenWindow);
+
+ WebKitNavigationPolicyDecision* decision = WEBKIT_NAVIGATION_POLICY_DECISION(test->m_previousPolicyDecision.get());
+ g_assert_cmpstr(webkit_navigation_policy_decision_get_frame_name(decision), ==, "_blank");
+
+ // Using a short timeout is a bit ugly here, but it's hard to get around because if we block
+ // the new window signal we cannot halt the main loop in the create callback. If we
+ // halt the main loop in the policy decision, the create callback never executes.
+ data.triedToOpenWindow = false;
+ test->m_policyDecisionResponse = PolicyClientTest::Ignore;
+ test->loadHtml(windowOpeningHTML, "http://webkitgtk.org/");
+ test->wait(.2);
+ g_assert(!data.triedToOpenWindow);
+}
+
+void beforeAll()
+{
+ PolicyClientTest::add("WebKitPolicyClient", "navigation-policy", testNavigationPolicy);
+ PolicyClientTest::add("WebKitPolicyClient", "new-window-policy", testNewWindowPolicy);
+}
+
+void afterAll()
+{
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
index 93e9c9cd2..cce7e1fe7 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
@@ -184,6 +184,11 @@ static void testWebKitSettings(Test*, gconstpointer)
webkit_settings_set_enable_fullscreen(settings, TRUE);
g_assert(webkit_settings_get_enable_fullscreen(settings));
+ // Print backgrounds is enabled by default
+ g_assert(webkit_settings_get_print_backgrounds(settings));
+ webkit_settings_set_print_backgrounds(settings, FALSE);
+ g_assert(!webkit_settings_get_print_backgrounds(settings));
+
g_object_unref(G_OBJECT(settings));
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
index dfd9da475..099eabda5 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
@@ -48,7 +48,10 @@ void WebViewTest::loadURI(const char* uri)
void WebViewTest::loadHtml(const char* html, const char* baseURI)
{
- m_activeURI = "about:blank";
+ if (!baseURI)
+ m_activeURI = "about:blank";
+ else
+ m_activeURI = baseURI;
webkit_web_view_load_html(m_webView, html, baseURI);
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
index 662354032..882e8b224 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
@@ -31,10 +31,10 @@ public:
WebViewTest();
virtual ~WebViewTest();
- void loadURI(const char* uri);
- void loadHtml(const char* html, const char* baseURI);
- void loadPlainText(const char* plainText);
- void loadRequest(WebKitURIRequest*);
+ virtual void loadURI(const char* uri);
+ virtual void loadHtml(const char* html, const char* baseURI);
+ virtual void loadPlainText(const char* plainText);
+ virtual void loadRequest(WebKitURIRequest*);
void replaceContent(const char* html, const char* contentURI, const char* baseURI);
void goBack();
void goForward();
diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h
index ab0e0a8f1..e9d892b54 100644
--- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h
+++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h
@@ -26,6 +26,7 @@
#include <webkit2/WebKitBackForwardList.h>
#include <webkit2/WebKitBackForwardListItem.h>
#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitDownload.h>
#include <webkit2/WebKitEnumTypes.h>
#include <webkit2/WebKitError.h>
#include <webkit2/WebKitSettings.h>
diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list b/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list
index 89c250e3e..5918d095a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list
+++ b/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list
@@ -1,7 +1,13 @@
BOOLEAN:ENUM,STRING,POINTER
+BOOLEAN:OBJECT
+BOOLEAN:OBJECT,ENUM
+BOOLEAN:OBJECT,STRING,POINTER
+BOOLEAN:POINTER
BOOLEAN:STRING
BOOLEAN:STRING,POINTER
BOOLEAN:STRING,STRING,POINTER
+BOOLEAN:UINT64
+BOOLEAN:VOID
OBJECT:VOID
VOID:ENUM
VOID:OBJECT,POINTER
diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h
index 7836a546a..cbe34a1a9 100644
--- a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h
+++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h
@@ -26,12 +26,12 @@
#ifndef FindIndicatorWindow_h
#define FindIndicatorWindow_h
+#import "WebKitSystemInterface.h"
+#import <WebCore/RunLoop.h>
#import <wtf/Noncopyable.h>
#import <wtf/PassOwnPtr.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
-#import "RunLoop.h"
-#import "WebKitSystemInterface.h"
@class WKFindIndicatorWindowAnimation;
@class WKView;
@@ -68,7 +68,7 @@ private:
WKWindowBounceAnimationContextRef m_bounceAnimationContext;
RetainPtr<WKFindIndicatorWindowAnimation> m_bounceAnimation;
- RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
+ WebCore::RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
RetainPtr<WKFindIndicatorWindowAnimation> m_fadeOutAnimation;
};
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
index 955b93045..2c4341b5d 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
@@ -243,6 +243,16 @@ static inline NSURL *autoreleased(WKURLRef url)
return WKPaginationModeUnpaginated;
}
+- (void)setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
+{
+ WKPageSetPaginationBehavesLikeColumns(self._pageRef, behavesLikeColumns);
+}
+
+- (BOOL)paginationBehavesLikeColumns
+{
+ return WKPageGetPaginationBehavesLikeColumns(self._pageRef);
+}
+
- (void)setPageLength:(CGFloat)pageLength
{
WKPageSetPageLength(self._pageRef, pageLength);
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h
index 3585642d3..c362c55c2 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h
@@ -35,6 +35,9 @@ typedef NSUInteger WKBrowsingContextPaginationMode;
@interface WKBrowsingContextController (Private)
@property WKBrowsingContextPaginationMode paginationMode;
+// Whether the column-break-{before,after} properties are respected instead of the
+// page-break-{before,after} properties.
+@property BOOL paginationBehavesLikeColumns;
// Set to 0 to have the page length equal the view length.
@property CGFloat pageLength;
@property CGFloat gapBetweenPages;
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index 1e2509ba6..7d21e9b7f 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -40,7 +40,6 @@
#import "PDFViewController.h"
#import "PageClientImpl.h"
#import "PasteboardTypes.h"
-#import "RunLoop.h"
#import "TextChecker.h"
#import "TextCheckerState.h"
#import "TiledCoreAnimationDrawingAreaProxy.h"
@@ -70,6 +69,7 @@
#import <WebCore/PlatformEventFactoryMac.h>
#import <WebCore/PlatformScreen.h>
#import <WebCore/Region.h>
+#import <WebCore/RunLoop.h>
#import <WebKitSystemInterface.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
@@ -187,7 +187,14 @@ struct WKViewInterpretKeyEventsParameters {
NSRect _windowBottomCornerIntersectionRect;
unsigned _frameSizeUpdatesDisabledCount;
+
+ // Whether the containing window of the WKView has a valid backing store.
+ // The window server invalidates the backing store whenever the window is resized or minimized.
+ // We use this flag to determine when we need to paint the background (white or clear)
+ // when the web process is unresponsive or takes too long to paint.
+ BOOL _windowHasValidBackingStore;
}
+
@end
@implementation WKViewData
@@ -324,6 +331,9 @@ struct WKViewInterpretKeyEventsParameters {
- (void)setFrameSize:(NSSize)size
{
+ if (!NSEqualSizes(size, [self frame].size))
+ _data->_windowHasValidBackingStore = NO;
+
[super setFrameSize:size];
if (![self frameSizeUpdatesDisabled])
@@ -1766,9 +1776,9 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
name:NSWindowDidMiniaturizeNotification object:window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:)
name:NSWindowDidDeminiaturizeNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:)
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMove:)
name:NSWindowDidMoveNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowFrameDidChange:)
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:)
name:NSWindowDidResizeNotification object:window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:)
name:@"NSWindowDidOrderOffScreenNotification" object:window];
@@ -1818,15 +1828,18 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
// update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then
// update the active state.
if ([self window]) {
+ _data->_windowHasValidBackingStore = NO;
_data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow);
[self _updateWindowVisibility];
[self _updateWindowAndViewFrames];
- _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
- [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
- return flagsChangedEvent;
- }];
+ if (!_data->_flagsChangedEventMonitor) {
+ _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
+ [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
+ return flagsChangedEvent;
+ }];
+ }
[self _accessibilityRegisterUIProcessTokens];
} else {
@@ -1883,6 +1896,8 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
- (void)_windowDidMiniaturize:(NSNotification *)notification
{
+ _data->_windowHasValidBackingStore = NO;
+
[self _updateWindowVisibility];
}
@@ -1891,8 +1906,15 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
[self _updateWindowVisibility];
}
-- (void)_windowFrameDidChange:(NSNotification *)notification
+- (void)_windowDidMove:(NSNotification *)notification
{
+ [self _updateWindowAndViewFrames];
+}
+
+- (void)_windowDidResize:(NSNotification *)notification
+{
+ _data->_windowHasValidBackingStore = NO;
+
[self _updateWindowAndViewFrames];
}
@@ -1919,6 +1941,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
if (oldBackingScaleFactor == newBackingScaleFactor)
return;
+ _data->_windowHasValidBackingStore = NO;
_data->_page->setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
}
@@ -1963,9 +1986,15 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
IntRect rect = enclosingIntRect(rectsBeingDrawn[i]);
drawingArea->paint(context, rect, unpaintedRegion);
- Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
- for (size_t i = 0; i < unpaintedRects.size(); ++i)
- drawPageBackground(context, _data->_page.get(), unpaintedRects[i]);
+ // If the window doesn't have a valid backing store, we need to fill the parts of the page that we
+ // didn't paint with the background color (white or clear), to avoid garbage in those areas.
+ if (!_data->_windowHasValidBackingStore) {
+ Vector<IntRect> unpaintedRects = unpaintedRegion.rects();
+ for (size_t i = 0; i < unpaintedRects.size(); ++i)
+ drawPageBackground(context, _data->_page.get(), unpaintedRects[i]);
+
+ _data->_windowHasValidBackingStore = YES;
+ }
}
} else
drawPageBackground(context, _data->_page.get(), enclosingIntRect(rect));
@@ -2119,9 +2148,9 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
}
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
-- (void)quickLookPreviewItemsAtWindowLocation:(NSPoint)location
+- (void)quickLookWithEvent:(NSEvent *)event
{
- NSPoint locationInViewCoordinates = [self convertPoint:location fromView:nil];
+ NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil];
_data->_page->performDictionaryLookupAtLocation(FloatPoint(locationInViewCoordinates.x, locationInViewCoordinates.y));
}
#endif
@@ -2250,12 +2279,12 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (NSRect)_convertToDeviceSpace:(NSRect)rect
{
- return toDeviceSpace(rect, [self window]);
+ return toDeviceSpace(rect, [self window], _data->_page->deviceScaleFactor());
}
- (NSRect)_convertToUserSpace:(NSRect)rect
{
- return toUserSpace(rect, [self window]);
+ return toUserSpace(rect, [self window], _data->_page->deviceScaleFactor());
}
// Any non-zero value will do, but using something recognizable might help us debug some day.
diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp
index 4e8810302..38ac7b909 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply.cpp
@@ -30,151 +30,95 @@ using namespace WebKit;
QQuickNetworkReply::QQuickNetworkReply(QObject* parent)
: QObject(parent)
- , m_networkReplyData(adoptRef(new WebKit::QtNetworkReplyData))
+ , m_networkReplyData(adoptRef(new WebKit::QtRefCountedNetworkReplyData))
{
Q_ASSERT(parent);
}
QString QQuickNetworkReply::contentType() const
{
- return m_networkReplyData->m_contentType;
+ return m_networkReplyData->data().m_contentType;
}
void QQuickNetworkReply::setContentType(const QString& contentType)
{
- m_networkReplyData->m_contentType = contentType;
+ m_networkReplyData->data().m_contentType = contentType;
}
-QNetworkAccessManager::Operation QQuickNetworkReply::operation() const
+QVariant QQuickNetworkReply::data() const
{
- return m_networkReplyData->m_operation;
+ return m_data;
}
-void QQuickNetworkReply::setOperation(QNetworkAccessManager::Operation operation)
+void QQuickNetworkReply::setData(const QVariant& data)
{
- m_networkReplyData->m_operation = operation;
+ m_data = data;
}
-QString QQuickNetworkReply::contentDisposition() const
-{
- return m_networkReplyData->m_contentDisposition;
-}
-
-void QQuickNetworkReply::setContentDisposition(const QString& disposition)
-{
- m_networkReplyData->m_contentDisposition = disposition;
-}
-
-QString QQuickNetworkReply::location() const
-{
- return m_networkReplyData->m_location;
-}
-
-void QQuickNetworkReply::setLocation(const QString& location)
-{
- m_networkReplyData->m_location = location;
-}
-
-QString QQuickNetworkReply::lastModified() const
-{
- return QDateTime::fromMSecsSinceEpoch(m_networkReplyData->m_lastModified).toString(Qt::ISODate);
-}
-
-void QQuickNetworkReply::setLastModified(const QString& lastModified)
-{
- m_networkReplyData->m_lastModified = QDateTime::fromString(lastModified, Qt::ISODate).toMSecsSinceEpoch();
-}
-
-QString QQuickNetworkReply::cookie() const
-{
- return m_networkReplyData->m_cookie;
-}
-
-void QQuickNetworkReply::setCookie(const QString& cookie)
-{
- m_networkReplyData->m_cookie = cookie;
-}
-
-QString QQuickNetworkReply::userAgent() const
-{
- return m_networkReplyData->m_userAgent;
-}
-
-void QQuickNetworkReply::setUserAgent(const QString& userAgent)
-{
- m_networkReplyData->m_userAgent = userAgent;
-}
-
-QString QQuickNetworkReply::server() const
-{
- return m_networkReplyData->m_server;
-}
-
-void QQuickNetworkReply::setServer(const QString& server)
-{
- m_networkReplyData->m_server = server;
-}
-
-QString QQuickNetworkReply::data() const
-{
- if (m_networkReplyData->m_dataHandle.isNull())
- return QString();
- RefPtr<SharedMemory> sm = SharedMemory::create(m_networkReplyData->m_dataHandle, SharedMemory::ReadOnly);
- if (!sm)
- return QString();
-
- uint64_t stringLength = m_networkReplyData->m_contentLength / sizeof(UChar);
- return QString(reinterpret_cast<const QChar*>(sm->data()), stringLength);
-}
-
-void QQuickNetworkReply::setData(const QString& data)
+void QQuickNetworkReply::send()
{
- // This function can be called several times. In this case the previous SharedMemory handles
- // will be overwritten and the previously allocated SharedMemory will die with the last handle.
- m_networkReplyData->m_contentLength = 0;
+ if (m_data.isNull())
+ return;
- if (data.isNull())
+ uint64_t smLength = 0;
+ const void* ptrData = 0;
+ QString stringData;
+ QByteArray byteArrayData;
+ if (m_data.type() == QVariant::String) {
+ stringData = m_data.toString();
+ ptrData = reinterpret_cast<const void*>(stringData.constData());
+ smLength = sizeof(QChar) * stringData.length();
+ setContentType(QLatin1String("text/html; charset=utf-16"));
+ } else {
+ if (!m_data.canConvert<QByteArray>())
+ return;
+ byteArrayData = m_data.toByteArray();
+ ptrData = byteArrayData.data();
+ smLength = byteArrayData.size();
+ }
+
+ if (contentType().isEmpty()) {
+ qWarning("QQuickNetworkReply::send - Cannot send raw data without a content type being specified!");
return;
- const UChar* ucharData = reinterpret_cast<const UChar*>(data.constData());
- uint64_t smLength = sizeof(UChar) * data.length();
+ }
- RefPtr<SharedMemory> sm = SharedMemory::create(smLength);
- if (!sm)
+ WTF::RefPtr<WebKit::SharedMemory> sharedMemory = SharedMemory::create(smLength);
+ if (!sharedMemory)
return;
// The size of the allocated shared memory can be bigger than requested.
// Usually the size will be rounded up to the next multiple of a page size.
- memcpy(sm->data(), ucharData, smLength);
+ memcpy(sharedMemory->data(), ptrData, smLength);
- if (!sm->createHandle(m_networkReplyData->m_dataHandle, SharedMemory::ReadOnly))
- return;
- m_networkReplyData->m_contentLength = smLength;
+ if (sharedMemory->createHandle(m_networkReplyData->data().m_dataHandle, SharedMemory::ReadOnly)) {
+ m_networkReplyData->data().m_contentLength = smLength;
+ if (m_webViewExperimental)
+ m_webViewExperimental.data()->sendApplicationSchemeReply(this);
+ }
+
+ // After sending the reply data, we have to reinitialize the m_networkReplyData,
+ // to make sure we have a fresh SharesMemory::Handle.
+ m_networkReplyData = adoptRef(new WebKit::QtRefCountedNetworkReplyData);
}
-void QQuickNetworkReply::send()
+void QQuickNetworkReply::setWebViewExperimental(QQuickWebViewExperimental* webViewExperimental)
{
- QObject* schemeParent = parent()->parent();
- if (!schemeParent)
- return;
- QQuickWebViewExperimental* webViewExperimental = qobject_cast<QQuickWebViewExperimental*>(schemeParent->parent());
- if (!webViewExperimental)
- return;
- webViewExperimental->sendApplicationSchemeReply(this);
+ m_webViewExperimental = webViewExperimental;
}
-WTF::RefPtr<WebKit::QtNetworkRequestData> QQuickNetworkReply::networkRequestData() const
+WebKit::QtRefCountedNetworkRequestData* QQuickNetworkReply::networkRequestData() const
{
- return m_networkRequestData;
+ return m_networkRequestData.get();
}
-void QQuickNetworkReply::setNetworkRequestData(WTF::RefPtr<WebKit::QtNetworkRequestData> data)
+void QQuickNetworkReply::setNetworkRequestData(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData> data)
{
m_networkRequestData = data;
- m_networkReplyData->m_replyUuid = data->m_replyUuid;
+ m_networkReplyData->data().m_replyUuid = m_networkRequestData->data().m_replyUuid;
}
-WTF::RefPtr<WebKit::QtNetworkReplyData> QQuickNetworkReply::networkReplyData() const
+WebKit::QtRefCountedNetworkReplyData* QQuickNetworkReply::networkReplyData() const
{
- return m_networkReplyData;
+ return m_networkReplyData.get();
}
#include "moc_qquicknetworkreply_p.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h
index ffe45f3c9..1007f3a78 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkreply_p.h
@@ -23,50 +23,42 @@
#include "QtNetworkReplyData.h"
#include "QtNetworkRequestData.h"
+#include "qquickwebview_p.h"
+#include "SharedMemory.h"
#include "qwebkitglobal.h"
#include <QNetworkAccessManager>
#include <QObject>
+#include <QWeakPointer>
#include <QtDeclarative/qdeclarativelist.h>
#include <QtQuick/qquickitem.h>
class QWEBKIT_EXPORT QQuickNetworkReply : public QObject {
Q_OBJECT
Q_PROPERTY(QString contentType READ contentType WRITE setContentType)
- Q_PROPERTY(QString data READ data WRITE setData)
+ Q_PROPERTY(QVariant data READ data WRITE setData)
Q_ENUMS(QNetworkAccessManager::Operation)
public:
QQuickNetworkReply(QObject* parent);
QString contentType() const;
void setContentType(const QString&);
- QNetworkAccessManager::Operation operation() const;
- void setOperation(QNetworkAccessManager::Operation);
- QString contentDisposition() const;
- void setContentDisposition(const QString&);
- QString location() const;
- void setLocation(const QString&);
- QString lastModified() const;
- void setLastModified(const QString&);
- QString cookie() const;
- void setCookie(const QString&);
- QString userAgent() const;
- void setUserAgent(const QString&);
- QString server() const;
- void setServer(const QString&);
- QString data() const;
- void setData(const QString& data);
+ QVariant data() const;
+ void setData(const QVariant& data);
- WTF::RefPtr<WebKit::QtNetworkRequestData> networkRequestData() const;
- void setNetworkRequestData(WTF::RefPtr<WebKit::QtNetworkRequestData> data);
- WTF::RefPtr<WebKit::QtNetworkReplyData> networkReplyData() const;
+ void setWebViewExperimental(QQuickWebViewExperimental*);
+ WebKit::QtRefCountedNetworkRequestData* networkRequestData() const;
+ void setNetworkRequestData(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData> data);
+ WebKit::QtRefCountedNetworkReplyData* networkReplyData() const;
public Q_SLOTS:
void send();
private:
- WTF::RefPtr<WebKit::QtNetworkRequestData> m_networkRequestData;
- WTF::RefPtr<WebKit::QtNetworkReplyData> m_networkReplyData;
+ WTF::RefPtr<WebKit::QtRefCountedNetworkRequestData> m_networkRequestData;
+ WTF::RefPtr<WebKit::QtRefCountedNetworkReplyData> m_networkReplyData;
+ QVariant m_data;
+ QWeakPointer<QQuickWebViewExperimental> m_webViewExperimental;
};
QML_DECLARE_TYPE(QQuickNetworkReply)
diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp
new file mode 100644
index 000000000..152ef4e5d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "qquicknetworkrequest_p.h"
+
+#include "QtNetworkRequestData.h"
+#include "qquickwebview_p.h"
+
+using namespace WebKit;
+
+QQuickNetworkRequest::QQuickNetworkRequest(QObject* parent)
+ : QObject(parent)
+{
+ Q_ASSERT(parent);
+}
+
+void QQuickNetworkRequest::setNetworkRequestData(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData> data)
+{
+ m_networkRequestData = data;
+}
+
+QUrl QQuickNetworkRequest::url() const
+{
+ if (m_networkRequestData)
+ return QUrl(m_networkRequestData->data().m_urlString);
+ return QUrl();
+}
+
+#include "moc_qquicknetworkrequest_p.cpp"
+
diff --git a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h
index 113114c87..7df66f569 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquicknetworkrequest_p.h
@@ -21,6 +21,8 @@
#ifndef qquicknetworkrequest_p_h
#define qquicknetworkrequest_p_h
+#include "QtNetworkRequestData.h"
+#include "RefPtr.h"
#include "qwebkitglobal.h"
#include <QObject>
#include <QtDeclarative/qdeclarativelist.h>
@@ -28,20 +30,17 @@
class QWEBKIT_EXPORT QQuickNetworkRequest : public QObject {
Q_OBJECT
- Q_PROPERTY(QString url READ url)
+ Q_PROPERTY(QUrl url READ url)
public:
- QQuickNetworkRequest(QObject* parent)
- : QObject(parent)
- {
- Q_ASSERT(parent);
- }
+ QQuickNetworkRequest(QObject* parent);
- QString url() const { return m_url; }
- void setUrl(const QString& url) { m_url = url; }
+ void setNetworkRequestData(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData> data);
+
+ QUrl url() const;
private:
- QString m_url;
+ WTF::RefPtr<WebKit::QtRefCountedNetworkRequestData> m_networkRequestData;
};
QML_DECLARE_TYPE(QQuickNetworkRequest)
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
index b5db3938f..206ba2522 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
@@ -30,9 +30,9 @@
#include <QtQuick/QSGGeometryNode>
#include <QtQuick/QSGMaterial>
-QQuickWebPage::QQuickWebPage(QQuickItem* parent)
- : QQuickItem(parent)
- , d(new QQuickWebPagePrivate(this))
+QQuickWebPage::QQuickWebPage(QQuickWebView* viewportItem)
+ : QQuickItem(viewportItem)
+ , d(new QQuickWebPagePrivate(this, viewportItem))
{
setFlag(ItemHasContents);
@@ -62,8 +62,9 @@ void QQuickWebPage::geometryChanged(const QRectF& newGeometry, const QRectF& old
d->setDrawingAreaSize(newGeometry.size().toSize());
}
-QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q)
+QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem)
: q(q)
+ , viewportItem(viewportItem)
, webPageProxy(0)
, sgUpdateQueue(q)
, paintingIsInitialized(false)
@@ -76,7 +77,7 @@ QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q)
void QQuickWebPagePrivate::initialize(WebKit::WebPageProxy* webPageProxy)
{
this->webPageProxy = webPageProxy;
- eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q));
+ eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q, viewportItem));
}
static float computeEffectiveOpacity(const QQuickItem* item)
@@ -99,6 +100,12 @@ void QQuickWebPagePrivate::setDrawingAreaSize(const QSize& size)
drawingArea->setSize(WebCore::IntSize(size), WebCore::IntSize());
}
+void QQuickWebPagePrivate::paint(QPainter* painter)
+{
+ if (webPageProxy->drawingArea())
+ webPageProxy->drawingArea()->paintLayerTree(painter);
+}
+
void QQuickWebPagePrivate::paintToCurrentGLContext()
{
if (!q->isVisible())
@@ -117,23 +124,7 @@ void QQuickWebPagePrivate::paintToCurrentGLContext()
if (!drawingArea)
return;
- // Make sure that no GL error code stays from previous QT operations.
- glGetError();
-
- glEnable(GL_SCISSOR_TEST);
- ASSERT(!glGetError());
- const int left = clipRect.left();
- const int width = clipRect.width();
- const int bottom = q->canvas()->height() - (clipRect.bottom() + 1);
- const int height = clipRect.height();
-
- glScissor(left, bottom, width, height);
- ASSERT(!glGetError());
-
- drawingArea->paintToCurrentGLContext(transform, opacity);
-
- glDisable(GL_SCISSOR_TEST);
- ASSERT(!glGetError());
+ drawingArea->paintToCurrentGLContext(transform, opacity, clipRect);
}
struct PageProxyMaterial;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
index f797810f6..bf44b9dc7 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
@@ -27,6 +27,7 @@
#include <QtQuick/QQuickItem>
class QQuickWebPagePrivate;
+class QQuickWebView;
class QtWebPageEventHandler;
class QWebPreferences;
@@ -37,7 +38,7 @@ class QtSGUpdateQueue;
class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
Q_OBJECT
public:
- QQuickWebPage(QQuickItem* parent = 0);
+ QQuickWebPage(QQuickWebView* view = 0);
virtual ~QQuickWebPage();
void setContentSize(const QSizeF& size);
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
index 3b58eb510..0c17aa5b5 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
@@ -34,7 +34,7 @@ class QtWebPageEventHandler;
class QQuickWebPagePrivate {
public:
- QQuickWebPagePrivate(QQuickWebPage* q);
+ QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem);
~QQuickWebPagePrivate();
void initialize(WebKit::WebPageProxy*);
@@ -43,10 +43,12 @@ public:
void updateSize();
void paintToCurrentGLContext();
+ void paint(QPainter*);
void resetPaintNode();
QScopedPointer<QtWebPageEventHandler> eventHandler;
QQuickWebPage* const q;
+ QQuickWebView* const viewportItem;
WebKit::WebPageProxy* webPageProxy;
WebKit::QtSGUpdateQueue sgUpdateQueue;
bool paintingIsInitialized;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 187b9b4ca..5712ca593 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -34,6 +34,7 @@
#include "WebPreferences.h"
#include "qquicknetworkreply_p.h"
+#include "qquicknetworkrequest_p.h"
#include "qquickwebpage_p_p.h"
#include "qquickwebview_p_p.h"
#include "qwebdownloaditem_p_p.h"
@@ -47,19 +48,26 @@
#include <QDeclarativeEngine>
#include <QFileDialog>
#include <QtQuick/QQuickCanvas>
+#include <WebCore/IntPoint.h>
+#include <WebCore/IntRect.h>
#include <WKOpenPanelResultListener.h>
#include <wtf/text/WTFString.h>
+using namespace WebCore;
+
QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport)
: q_ptr(viewport)
, alertDialog(0)
, confirmDialog(0)
, promptDialog(0)
+ , authenticationDialog(0)
+ , certificateVerificationDialog(0)
, itemSelector(0)
, postTransitionState(adoptPtr(new PostTransitionState(this)))
, isTransitioningToNewPage(false)
, pageIsSuspended(false)
, m_navigatorQtObjectEnabled(false)
+ , m_renderToOffscreenBuffer(false)
{
viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
@@ -100,6 +108,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
// Any page setting should preferrable be set before creating the page.
setUseTraditionalDesktopBehaviour(false);
webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
+ webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController);
webPageProxy->initializeWebPage();
@@ -128,10 +137,12 @@ void QQuickWebViewPrivate::initializeDesktop(QQuickWebView* viewport)
QObject::disconnect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), viewport, SLOT(_q_suspend()));
QObject::disconnect(interactionEngine.data(), SIGNAL(contentResumeRequested()), viewport, SLOT(_q_resume()));
QObject::disconnect(interactionEngine.data(), SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), viewport, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&)));
+ QObject::disconnect(interactionEngine.data(), SIGNAL(visibleContentRectAndScaleChanged()), viewport, SLOT(_q_updateVisibleContentRectAndScale()));
}
interactionEngine.reset(0);
pageView->d->eventHandler->setViewportInteractionEngine(0);
enableMouseEvents();
+ updateDesktopViewportSize();
}
void QQuickWebViewPrivate::initializeTouch(QQuickWebView* viewport)
@@ -142,7 +153,22 @@ void QQuickWebViewPrivate::initializeTouch(QQuickWebView* viewport)
QObject::connect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), viewport, SLOT(_q_suspend()));
QObject::connect(interactionEngine.data(), SIGNAL(contentResumeRequested()), viewport, SLOT(_q_resume()));
QObject::connect(interactionEngine.data(), SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), viewport, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&)));
- updateViewportSize();
+ QObject::connect(interactionEngine.data(), SIGNAL(visibleContentRectAndScaleChanged()), viewport, SLOT(_q_updateVisibleContentRectAndScale()));
+ updateTouchViewportSize();
+}
+
+void QQuickWebViewPrivate::setNeedsDisplay()
+{
+ Q_Q(QQuickWebView);
+ if (renderToOffscreenBuffer()) {
+ // TODO: we can maintain a real image here and use it for pixel tests. Right now this is used only for running the rendering code-path while running tests.
+ QImage dummyImage(1, 1, QImage::Format_ARGB32);
+ QPainter painter(&dummyImage);
+ q->page()->d->paint(&painter);
+ return;
+ }
+
+ q->page()->update();
}
void QQuickWebViewPrivate::loadDidCommit()
@@ -190,7 +216,7 @@ void QQuickWebViewPrivate::_q_resume()
postTransitionState->apply();
}
- updateVisibleContentRectAndScale();
+ _q_updateVisibleContentRectAndScale();
}
void QQuickWebViewPrivate::didChangeContentsSize(const QSize& newSize)
@@ -274,7 +300,7 @@ void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download)
context->downloadManager()->addDownload(download, downloadItem);
}
-void QQuickWebViewPrivate::updateVisibleContentRectAndScale()
+void QQuickWebViewPrivate::_q_updateVisibleContentRectAndScale()
{
DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
if (!drawingArea)
@@ -316,7 +342,19 @@ void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* d
emit q->experimental()->downloadRequested(downloadItem);
}
-void QQuickWebViewPrivate::updateViewportSize()
+void QQuickWebViewPrivate::updateDesktopViewportSize()
+{
+ Q_Q(QQuickWebView);
+ QSize viewportSize = q->boundingRect().size().toSize();
+ pageView->setWidth(viewportSize.width());
+ pageView->setHeight(viewportSize.height());
+ // The fixed layout is handled by the FrameView and the drawing area doesn't behave differently
+ // wether its fixed or not. We still need to tell the drawing area which part of it
+ // has to be rendered on tiles, and in desktop mode it's all of it.
+ webPageProxy->drawingArea()->setVisibleContentsRectAndScale(IntRect(IntPoint(), viewportSize), 1);
+}
+
+void QQuickWebViewPrivate::updateTouchViewportSize()
{
Q_Q(QQuickWebView);
QSize viewportSize = q->boundingRect().size().toSize();
@@ -329,7 +367,7 @@ void QQuickWebViewPrivate::updateViewportSize()
webPageProxy->setViewportSize(viewportSize);
interactionEngine->applyConstraints(computeViewportConstraints());
- updateVisibleContentRectAndScale();
+ _q_updateVisibleContentRectAndScale();
}
void QQuickWebViewPrivate::PostTransitionState::apply()
@@ -440,6 +478,45 @@ QString QQuickWebViewPrivate::runJavaScriptPrompt(const QString& message, const
return dialogRunner.result();
}
+void QQuickWebViewPrivate::handleAuthenticationRequiredRequest(const QString& hostname, const QString& realm, const QString& prefilledUsername, QString& username, QString& password)
+{
+ if (!authenticationDialog)
+ return;
+
+ Q_Q(QQuickWebView);
+ QtDialogRunner dialogRunner;
+ if (!dialogRunner.initForAuthentication(authenticationDialog, q, hostname, realm, prefilledUsername))
+ return;
+
+ setViewInAttachedProperties(dialogRunner.dialog());
+
+ disableMouseEvents();
+ dialogRunner.exec();
+ enableMouseEvents();
+
+ username = dialogRunner.username();
+ password = dialogRunner.password();
+}
+
+bool QQuickWebViewPrivate::handleCertificateVerificationRequest(const QString& hostname)
+{
+ if (!certificateVerificationDialog)
+ return false;
+
+ Q_Q(QQuickWebView);
+ QtDialogRunner dialogRunner;
+ if (!dialogRunner.initForCertificateVerification(certificateVerificationDialog, q, hostname))
+ return false;
+
+ setViewInAttachedProperties(dialogRunner.dialog());
+
+ disableMouseEvents();
+ dialogRunner.exec();
+ enableMouseEvents();
+
+ return dialogRunner.wasAccepted();
+}
+
void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtWebPageUIClient::FileChooserType type)
{
#ifndef QT_NO_FILEDIALOG
@@ -607,6 +684,18 @@ void QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour(bool enable)
d->setUseTraditionalDesktopBehaviour(enable);
}
+void QQuickWebViewExperimental::setRenderToOffscreenBuffer(bool enable)
+{
+ Q_D(QQuickWebView);
+ d->setRenderToOffscreenBuffer(enable);
+}
+
+bool QQuickWebViewExperimental::renderToOffscreenBuffer() const
+{
+ Q_D(const QQuickWebView);
+ return d->renderToOffscreenBuffer();
+}
+
void QQuickWebViewExperimental::postMessage(const QString& message)
{
Q_D(QQuickWebView);
@@ -671,6 +760,36 @@ void QQuickWebViewExperimental::setPromptDialog(QDeclarativeComponent* promptDia
emit promptDialogChanged();
}
+QDeclarativeComponent* QQuickWebViewExperimental::authenticationDialog() const
+{
+ Q_D(const QQuickWebView);
+ return d->authenticationDialog;
+}
+
+void QQuickWebViewExperimental::setAuthenticationDialog(QDeclarativeComponent* authenticationDialog)
+{
+ Q_D(QQuickWebView);
+ if (d->authenticationDialog == authenticationDialog)
+ return;
+ d->authenticationDialog = authenticationDialog;
+ emit authenticationDialogChanged();
+}
+
+QDeclarativeComponent* QQuickWebViewExperimental::certificateVerificationDialog() const
+{
+ Q_D(const QQuickWebView);
+ return d->certificateVerificationDialog;
+}
+
+void QQuickWebViewExperimental::setCertificateVerificationDialog(QDeclarativeComponent* certificateVerificationDialog)
+{
+ Q_D(QQuickWebView);
+ if (d->certificateVerificationDialog == certificateVerificationDialog)
+ return;
+ d->certificateVerificationDialog = certificateVerificationDialog;
+ emit certificateVerificationDialogChanged();
+}
+
QDeclarativeComponent* QQuickWebViewExperimental::itemSelector() const
{
Q_D(const QQuickWebView);
@@ -707,6 +826,7 @@ void QQuickWebViewExperimental::schemeDelegates_Append(QDeclarativeListProperty<
QQuickWebViewExperimental* webViewExperimental = qobject_cast<QQuickWebViewExperimental*>(property->object->parent());
if (!webViewExperimental)
return;
+ scheme->reply()->setWebViewExperimental(webViewExperimental);
QQuickWebViewPrivate* d = webViewExperimental->d_func();
d->webPageProxy->registerApplicationScheme(scheme->scheme());
}
@@ -735,15 +855,17 @@ QDeclarativeListProperty<QQuickUrlSchemeDelegate> QQuickWebViewExperimental::sch
QQuickWebViewExperimental::schemeDelegates_Clear);
}
-void QQuickWebViewExperimental::invokeApplicationSchemeHandler(PassRefPtr<QtNetworkRequestData> request)
+void QQuickWebViewExperimental::invokeApplicationSchemeHandler(PassRefPtr<QtRefCountedNetworkRequestData> request)
{
+ RefPtr<QtRefCountedNetworkRequestData> req = request;
const QObjectList children = schemeParent->children();
for (int index = 0; index < children.count(); index++) {
QQuickUrlSchemeDelegate* delegate = qobject_cast<QQuickUrlSchemeDelegate*>(children.at(index));
if (!delegate)
continue;
- if (!delegate->scheme().compare(QString(request->m_scheme), Qt::CaseInsensitive)) {
- delegate->reply()->setNetworkRequestData(request);
+ if (!delegate->scheme().compare(QString(req->data().m_scheme), Qt::CaseInsensitive)) {
+ delegate->request()->setNetworkRequestData(req);
+ delegate->reply()->setNetworkRequestData(req);
emit delegate->receivedRequest();
return;
}
@@ -782,7 +904,6 @@ QQuickWebView::QQuickWebView(QQuickItem* parent)
{
Q_D(QQuickWebView);
d->initialize();
- d->initializeTouch(this);
}
QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent)
@@ -924,7 +1045,7 @@ QVariant QQuickWebView::inputMethodQuery(Qt::InputMethodQuery property) const
switch(property) {
case Qt::ImCursorRectangle:
- return QRectF(state.microFocus);
+ return QRectF(state.cursorRect);
case Qt::ImFont:
return QVariant();
case Qt::ImCursorPosition:
@@ -964,11 +1085,10 @@ void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& old
Q_D(QQuickWebView);
QQuickItem::geometryChanged(newGeometry, oldGeometry);
if (newGeometry.size() != oldGeometry.size()) {
- if (d->pageView->usesTraditionalDesktopBehaviour()) {
- d->pageView->setWidth(newGeometry.width());
- d->pageView->setHeight(newGeometry.height());
- } else
- d->updateViewportSize();
+ if (d->pageView->usesTraditionalDesktopBehaviour())
+ d->updateDesktopViewportSize();
+ else
+ d->updateTouchViewportSize();
}
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
index 0fa0791cf..7a713d133 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
@@ -44,7 +44,7 @@ class PlatformWebView;
}
namespace WebKit {
-class QtNetworkRequestData;
+class QtRefCountedNetworkRequestData;
}
namespace WTF {
@@ -165,6 +165,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_suspend());
Q_PRIVATE_SLOT(d_func(), void _q_resume());
Q_PRIVATE_SLOT(d_func(), void _q_viewportTrajectoryVectorChanged(const QPointF&));
+ Q_PRIVATE_SLOT(d_func(), void _q_updateVisibleContentRectAndScale());
Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFilesSelected());
Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
@@ -208,6 +209,8 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
Q_PROPERTY(QDeclarativeComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
Q_PROPERTY(QDeclarativeComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged)
Q_PROPERTY(QDeclarativeComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* authenticationDialog READ authenticationDialog WRITE setAuthenticationDialog NOTIFY authenticationDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged)
Q_PROPERTY(QDeclarativeComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
Q_PROPERTY(bool useTraditionalDesktopBehaviour READ useTraditionalDesktopBehaviour WRITE setUseTraditionalDesktopBehaviour)
@@ -229,13 +232,18 @@ public:
void setConfirmDialog(QDeclarativeComponent*);
QDeclarativeComponent* promptDialog() const;
void setPromptDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* authenticationDialog() const;
+ void setAuthenticationDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* certificateVerificationDialog() const;
+ void setCertificateVerificationDialog(QDeclarativeComponent*);
QDeclarativeComponent* itemSelector() const;
void setItemSelector(QDeclarativeComponent*);
-
+ bool useTraditionalDesktopBehaviour() const;
+ void setUseTraditionalDesktopBehaviour(bool enable);
+
QWebViewportInfo* viewportInfo();
QWebPreferences* preferences() const;
- bool useTraditionalDesktopBehaviour() const;
QWebNavigationHistory* navigationHistory() const;
QQuickWebPage* page();
@@ -244,11 +252,14 @@ public:
static int schemeDelegates_Count(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*);
static void schemeDelegates_Clear(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*);
QDeclarativeListProperty<QQuickUrlSchemeDelegate> schemeDelegates();
- void invokeApplicationSchemeHandler(WTF::PassRefPtr<WebKit::QtNetworkRequestData>);
+ void invokeApplicationSchemeHandler(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData>);
void sendApplicationSchemeReply(QQuickNetworkReply*);
+ // C++ only
+ bool renderToOffscreenBuffer() const;
+ void setRenderToOffscreenBuffer(bool enable);
+
public Q_SLOTS:
- void setUseTraditionalDesktopBehaviour(bool enable);
void goBackTo(int index);
void goForwardTo(int index);
void postMessage(const QString&);
@@ -257,6 +268,8 @@ Q_SIGNALS:
void alertDialogChanged();
void confirmDialogChanged();
void promptDialogChanged();
+ void authenticationDialogChanged();
+ void certificateVerificationDialogChanged();
void itemSelectorChanged();
void downloadRequested(QWebDownloadItem* downloadItem);
void permissionRequested(QWebPermissionRequest* permission);
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
index 4be71707c..17a5cf82a 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
@@ -77,10 +77,13 @@ public:
void didChangeViewportProperties(const WebCore::ViewportArguments& args);
void didChangeBackForwardList();
- void updateViewportSize();
+ void setNeedsDisplay();
+
+ void updateDesktopViewportSize();
+ void updateTouchViewportSize();
QtViewportInteractionEngine::Constraints computeViewportConstraints();
- void updateVisibleContentRectAndScale();
+ void _q_updateVisibleContentRectAndScale();
void _q_suspend();
void _q_resume();
@@ -96,11 +99,16 @@ public:
bool runJavaScriptConfirm(const QString&);
QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
+ void handleAuthenticationRequiredRequest(const QString& hostname, const QString& realm, const QString& prefilledUsername, QString& username, QString& password);
+ bool handleCertificateVerificationRequest(const QString& hostname);
+
void setUseTraditionalDesktopBehaviour(bool enable);
+ void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; }
void setViewInAttachedProperties(QObject*);
void setIcon(const QUrl&);
bool navigatorQtObjectEnabled() const;
+ bool renderToOffscreenBuffer() const { return m_renderToOffscreenBuffer; }
void setNavigatorQtObjectEnabled(bool);
// PageClient.
@@ -150,6 +158,8 @@ private:
QDeclarativeComponent* alertDialog;
QDeclarativeComponent* confirmDialog;
QDeclarativeComponent* promptDialog;
+ QDeclarativeComponent* authenticationDialog;
+ QDeclarativeComponent* certificateVerificationDialog;
QDeclarativeComponent* itemSelector;
WebCore::ViewportArguments viewportArguments;
@@ -160,6 +170,7 @@ private:
bool isTransitioningToNewPage;
bool pageIsSuspended;
bool m_navigatorQtObjectEnabled;
+ bool m_renderToOffscreenBuffer;
QUrl m_iconURL;
};
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp
new file mode 100644
index 000000000..e0c2c256c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "bytearraytestdata.h"
+
+ByteArrayTestData::ByteArrayTestData(QObject* parent)
+ : QObject(parent)
+{
+ QString text = QStringLiteral("<html><head><title>title with copyright %1</title></head><body>content</body></html>");
+ text = text.arg(QChar::fromLatin1(169));
+
+ m_latin1Data = text.toLatin1();
+ m_utf8Data = text.toUtf8();
+
+ Q_ASSERT(m_latin1Data != m_utf8Data);
+}
+
+QVariant ByteArrayTestData::latin1Data() const
+{
+ return QVariant(m_latin1Data);
+}
+
+QVariant ByteArrayTestData::utf8Data() const
+{
+ return QVariant(m_utf8Data);
+}
+
+#include "moc_bytearraytestdata.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
new file mode 100644
index 000000000..7170f6594
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef bytearraytestdata_h
+#define bytearraytestdata_h
+
+#include "qwebkitglobal.h"
+#include <QByteArray>
+#include <QObject>
+#include <QtQuick/qquickitem.h>
+
+class QWEBKIT_EXPORT ByteArrayTestData : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QVariant latin1Data READ latin1Data)
+ Q_PROPERTY(QVariant utf8Data READ utf8Data)
+
+public:
+ ByteArrayTestData(QObject* parent = 0);
+ QVariant latin1Data() const;
+ QVariant utf8Data() const;
+
+private:
+ QByteArray m_latin1Data;
+ QByteArray m_utf8Data;
+};
+
+QML_DECLARE_TYPE(ByteArrayTestData)
+
+#endif // bytearraytestdata_h
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro
new file mode 100644
index 000000000..728521f8a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro
@@ -0,0 +1,2 @@
+include(../tests.pri)
+CONFIG += qtwebkit-private
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
new file mode 100644
index 000000000..f1a81bc18
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
@@ -0,0 +1,170 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QMetaEnum>
+#include <QMetaMethod>
+#include <QMetaObject>
+#include <QMetaProperty>
+#include <QMetaType>
+#include <QtTest/QtTest>
+#include <qquickwebview_p.h>
+#include <qwebnavigationrequest_p.h>
+
+class tst_publicapi : public QObject {
+ Q_OBJECT
+private slots:
+ void publicAPI();
+};
+
+static QList<const QMetaObject*> typesToCheck = QList<const QMetaObject*>()
+ << &QQuickWebView::staticMetaObject
+ << &QWebNavigationRequest::staticMetaObject;
+
+static QStringList expectedAPI = QStringList()
+ << "QQuickWebView.AcceptRequest --> NavigationRequestAction"
+ << "QQuickWebView.IgnoreRequest --> NavigationRequestAction"
+ << "QQuickWebView.InternalErrorDomain --> ErrorDomain"
+ << "QQuickWebView.NetworkErrorDomain --> ErrorDomain"
+ << "QQuickWebView.HttpErrorDomain --> ErrorDomain"
+ << "QQuickWebView.DownloadErrorDomain --> ErrorDomain"
+ << "QQuickWebView.title --> QString"
+ << "QQuickWebView.url --> QUrl"
+ << "QQuickWebView.icon --> QUrl"
+ << "QQuickWebView.loadProgress --> int"
+ << "QQuickWebView.canGoBack --> bool"
+ << "QQuickWebView.canGoForward --> bool"
+ << "QQuickWebView.loading --> bool"
+ << "QQuickWebView.canReload --> bool"
+ << "QQuickWebView.titleChanged(QString) --> void"
+ << "QQuickWebView.loadStarted() --> void"
+ << "QQuickWebView.loadSucceeded() --> void"
+ << "QQuickWebView.loadFailed(QQuickWebView::ErrorDomain,int,QUrl,QString) --> void"
+ << "QQuickWebView.loadProgressChanged(int) --> void"
+ << "QQuickWebView.urlChanged(QUrl) --> void"
+ << "QQuickWebView.iconChanged(QUrl) --> void"
+ << "QQuickWebView.linkHovered(QUrl,QString) --> void"
+ << "QQuickWebView.navigationStateChanged() --> void"
+ << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void"
+ << "QQuickWebView.load(QUrl) --> void"
+ << "QQuickWebView.loadHtml(QString,QUrl) --> void"
+ << "QQuickWebView.loadHtml(QString) --> void"
+ << "QQuickWebView.goBack() --> void"
+ << "QQuickWebView.goForward() --> void"
+ << "QQuickWebView.stop() --> void"
+ << "QQuickWebView.reload() --> void"
+ << "QWebNavigationRequest.url --> QUrl"
+ << "QWebNavigationRequest.originatingUrl --> QUrl"
+ << "QWebNavigationRequest.button --> int"
+ << "QWebNavigationRequest.modifiers --> int"
+ << "QWebNavigationRequest.action --> int"
+ << "QWebNavigationRequest.actionChanged() --> void"
+ ;
+
+static bool isCheckedEnum(const QByteArray& typeName)
+{
+ QList<QByteArray> tokens = typeName.split(':');
+ if (tokens.size() == 3) {
+ QByteArray& enumClass = tokens[0];
+ QByteArray& enumName = tokens[2];
+ foreach (const QMetaObject* mo, typesToCheck) {
+ if (mo->className() != enumClass)
+ continue;
+ for (int i = mo->enumeratorOffset(); i < mo->enumeratorCount(); ++i)
+ if (mo->enumerator(i).name() == enumName)
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool isCheckedClass(const QByteArray& typeName)
+{
+ foreach (const QMetaObject* mo, typesToCheck) {
+ QByteArray moTypeName(mo->className());
+ if (moTypeName == typeName || moTypeName + "*" == typeName)
+ return true;
+ }
+ return false;
+}
+
+static void checkKnownType(const QByteArray& typeName)
+{
+ if ((typeName != "void" && !QMetaType::type(typeName)) || QMetaType::type(typeName) >= QMetaType::User) {
+ bool knownEnum = isCheckedEnum(typeName);
+ bool knownClass = isCheckedClass(typeName);
+ QVERIFY2(knownEnum || knownClass, qPrintable(QString("The API uses an unknown type [%1], you might have to add it to the typesToCheck list.").arg(typeName.constData())));
+ }
+}
+
+static void gatherAPI(const QString& prefix, const QMetaEnum& metaEnum, QStringList* output)
+{
+ for (int i = 0; i < metaEnum.keyCount(); ++i)
+ *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(metaEnum.key(i)).arg(metaEnum.name());
+}
+
+static void gatherAPI(const QString& prefix, const QMetaProperty& property, QStringList* output)
+{
+ *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(property.name()).arg(property.typeName());
+ checkKnownType(property.typeName());
+}
+
+static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringList* output)
+{
+ if (method.access() != QMetaMethod::Private) {
+ const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void";
+ *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName);
+
+ checkKnownType(methodTypeName);
+ foreach (QByteArray paramType, method.parameterTypes())
+ checkKnownType(paramType);
+ }
+}
+
+static void gatherAPI(const QString& prefix, const QMetaObject* meta, QStringList* output)
+{
+ // *Offset points us only at the leaf class members, we don't have inheritance in our API yet anyway.
+ for (int i = meta->enumeratorOffset(); i < meta->enumeratorCount(); ++i)
+ gatherAPI(prefix, meta->enumerator(i), output);
+ for (int i = meta->propertyOffset(); i < meta->propertyCount(); ++i)
+ gatherAPI(prefix, meta->property(i), output);
+ for (int i = meta->methodOffset(); i < meta->methodCount(); ++i)
+ gatherAPI(prefix, meta->method(i), output);
+}
+
+void tst_publicapi::publicAPI()
+{
+ QStringList actualAPI;
+ foreach (const QMetaObject* meta, typesToCheck)
+ gatherAPI(QString::fromLatin1(meta->className()) + ".", meta, &actualAPI);
+
+ // Uncomment to print the actual API.
+ // foreach(QString actual, actualAPI)
+ // printf(" << \"%s\"\n", qPrintable(actual));
+
+ // Make sure that nothing slips in the public API unintentionally.
+ foreach (QString actual, actualAPI)
+ QVERIFY2(expectedAPI.contains(actual), qPrintable(actual));
+ // Make sure that the expected list is up-to-date with intentionally added APIs.
+ foreach (QString expected, expectedAPI)
+ QVERIFY2(actualAPI.contains(expected), qPrintable(expected));
+}
+
+QTEST_MAIN(tst_publicapi)
+
+#include "tst_publicapi.moc"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml
index 29774e117..239483c5b 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
import QtTest 1.0
import QtWebKit 3.0
import QtWebKit.experimental 3.0
+import Test 1.0
WebView {
id: webView
@@ -16,7 +17,47 @@ WebView {
reply.data = "<html><head><title>Test Application Scheme</title></head><body>A test page.</body></html>"
reply.send()
}
+ },
+ UrlSchemeDelegate {
+ scheme: "scheme1"
+ onReceivedRequest: {
+ reply.data = "<html><head><title>Scheme1 Reply</title></head><body>A test page.</body></html>"
+ reply.send()
+ }
+ },
+ UrlSchemeDelegate {
+ scheme: "scheme2"
+ onReceivedRequest: {
+ reply.data = "<html><head><title>Scheme2 Reply</title></head><body>A test page.</body></html>"
+ reply.send()
+ }
+ },
+ UrlSchemeDelegate {
+ scheme: "scheme3"
+ onReceivedRequest: {
+ if (request.url == "scheme3://url1")
+ reply.data = "<html><head><title>Scheme3 Reply1</title></head><body>A test page.</body></html>"
+ else if (request.url == "scheme3://url2")
+ reply.data = "<html><head><title>Scheme3 Reply2</title></head><body>A test page.</body></html>"
+ else
+ reply.data = "<html><head><title>Should not happen</title></head><body>A test page.</body></html>"
+ reply.send()
+ }
+ },
+ UrlSchemeDelegate {
+ scheme: "schemeCharset"
+ onReceivedRequest: {
+ if (request.url == "schemecharset://latin1") {
+ reply.data = byteArrayHelper.latin1Data
+ reply.contentType = "text/html; charset=iso-8859-1"
+ } else if (request.url == "schemecharset://utf-8") {
+ reply.data = byteArrayHelper.utf8Data
+ reply.contentType = "text/html; charset=utf-8"
+ }
+ reply.send()
+ }
}
+
]
}
@@ -26,16 +67,67 @@ WebView {
signalName: "titleChanged"
}
+ ByteArrayTestData {
+ id: byteArrayHelper
+ }
+
TestCase {
name: "WebViewApplicationSchemes"
function test_applicationScheme() {
+ spyTitle.clear()
compare(spyTitle.count, 0)
var testUrl = "applicationScheme://something"
webView.load(testUrl)
spyTitle.wait()
compare(webView.title, "Test Application Scheme")
}
- }
+ function test_multipleSchemes() {
+ // Test if we receive the right reply when defining multiple schemes.
+ spyTitle.clear()
+ compare(spyTitle.count, 0)
+ var testUrl = "scheme2://some-url-string"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "Scheme2 Reply")
+
+ testUrl = "scheme1://some-url-string"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "Scheme1 Reply")
+
+ compare(spyTitle.count, 2)
+ }
+
+ function test_multipleUrlsForScheme() {
+ spyTitle.clear()
+ compare(spyTitle.count, 0)
+ var testUrl = "scheme3://url1"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "Scheme3 Reply1")
+
+ testUrl = "scheme3://url2"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "Scheme3 Reply2")
+
+ compare(spyTitle.count, 2)
+ }
+
+ function test_charsets() {
+ spyTitle.clear()
+ compare(spyTitle.count, 0)
+ var testUrl = "schemeCharset://latin1"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "title with copyright ©")
+
+ testUrl = "schemeCharset://utf-8"
+ webView.load(testUrl)
+ spyTitle.wait()
+ compare(webView.title, "title with copyright ©")
+ }
+ }
}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
index e8d9aab0e..8c8c4b3e6 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "../bytearraytestdata.h"
#include "../util.h"
#include <QVarLengthArray>
@@ -41,5 +42,6 @@ int main(int argc, char** argv)
// Instantiate QApplication to prevent quick_test_main to instantiate a QGuiApplication.
// This can be removed as soon as we do not use QtWidgets any more.
QApplication app(argc, argv);
+ qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData");
return quick_test_main(argc, argv, "qmltests", 0, QUICK_TEST_SOURCE_DIR);
}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
index 297bcec92..06ff1a0a3 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
+++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
@@ -3,11 +3,14 @@ TEMPLATE = app
VPATH += $$_PRO_FILE_PWD_
TARGET = tst_$$TARGET
+HEADERS += ../bytearraytestdata.h
+
SOURCES += $${TARGET}.cpp \
- ../util.cpp
+ ../util.cpp \
+ ../bytearraytestdata.cpp
INCLUDEPATH += $$PWD
-QT += testlib declarative widgets
+QT += testlib declarative widgets quick
CONFIG += qtwebkit
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
index 2f5832287..617c17506 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
@@ -27,6 +27,7 @@
#ifndef DrawingAreaProxy_h
#define DrawingAreaProxy_h
+#include "BackingStore.h"
#include "DrawingAreaInfo.h"
#include <WebCore/IntRect.h>
#include <WebCore/IntSize.h>
@@ -87,7 +88,8 @@ public:
virtual WebCore::IntRect viewportVisibleRect() const { return contentsRect(); }
virtual WebCore::IntRect contentsRect() const;
virtual bool isBackingStoreReady() const { return true; }
- virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float opacity) { }
+ virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&) { }
+ virtual void paintLayerTree(BackingStore::PlatformGraphicsContext) { }
LayerTreeHostProxy* layerTreeHostProxy() const { return m_layerTreeHostProxy.get(); }
#if USE(TILED_BACKING_STORE)
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
index 7b153848d..24a5aed18 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
@@ -30,7 +30,9 @@
#include "DrawingAreaProxyMessages.h"
#include "LayerTreeContext.h"
#include "UpdateInfo.h"
+#include "WebPageGroup.h"
#include "WebPageProxy.h"
+#include "WebPreferences.h"
#include "WebProcessProxy.h"
#include <WebCore/Region.h>
@@ -56,6 +58,11 @@ DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
, m_isBackingStoreDiscardable(true)
, m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore)
{
+#if USE(TEXTURE_MAPPER)
+ // Construct the proxy early to allow messages to be sent to the web process while AC is entered there.
+ if (webPageProxy->pageGroup()->preferences()->forceCompositingMode())
+ m_layerTreeHostProxy = adoptPtr(new LayerTreeHostProxy(this));
+#endif
}
DrawingAreaProxyImpl::~DrawingAreaProxyImpl()
@@ -353,10 +360,16 @@ void DrawingAreaProxyImpl::setVisibleContentRectTrajectoryVector(const WebCore::
m_layerTreeHostProxy->setVisibleContentRectTrajectoryVector(trajectoryVector);
}
-void DrawingAreaProxyImpl::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity)
+void DrawingAreaProxyImpl::paintLayerTree(BackingStore::PlatformGraphicsContext context)
+{
+ if (m_layerTreeHostProxy)
+ m_layerTreeHostProxy->paintToGraphicsContext(context);
+}
+
+void DrawingAreaProxyImpl::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect)
{
if (m_layerTreeHostProxy)
- m_layerTreeHostProxy->paintToCurrentGLContext(matrix, opacity);
+ m_layerTreeHostProxy->paintToCurrentGLContext(matrix, opacity, clipRect);
}
#endif
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
index 05d735423..5fcf24c50 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -29,7 +29,7 @@
#include "BackingStore.h"
#include "DrawingAreaProxy.h"
#include "LayerTreeContext.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -80,7 +80,8 @@ private:
#if USE(TILED_BACKING_STORE)
virtual void setVisibleContentsRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale);
virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
- virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float opacity);
+ virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float opacity, const WebCore::FloatRect&);
+ virtual void paintLayerTree(BackingStore::PlatformGraphicsContext);
void didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
#else
@@ -116,7 +117,7 @@ private:
bool m_isBackingStoreDiscardable;
OwnPtr<BackingStore> m_backingStore;
- RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer;
+ WebCore::RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
index 3c0fbf160..f37a5d3a2 100644
--- a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.cpp
@@ -26,7 +26,9 @@
#include "config.h"
#include "ThreadLauncher.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
+
+using namespace WebCore;
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
index d7a50829d..94cad5fc4 100644
--- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
@@ -28,18 +28,20 @@
#include "ProcessLauncher.h"
#include "Connection.h"
-#include "RunLoop.h"
#include <WebCore/FileSystem.h>
#include <WebCore/ResourceHandle.h>
+#include <WebCore/RunLoop.h>
#include <errno.h>
-#if OS(LINUX)
-#include <sys/prctl.h>
-#endif
+#include <locale.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GlibUtilities.h>
+#if OS(LINUX)
+#include <sys/prctl.h>
+#endif
+
#ifdef SOCK_SEQPACKET
#define SOCKET_TYPE SOCK_SEQPACKET
#else
@@ -58,6 +60,9 @@ static void childSetupFunction(gpointer userData)
int socket = GPOINTER_TO_INT(userData);
close(socket);
+ // Make child process inherit parent's locale.
+ g_setenv("LC_ALL", setlocale(LC_ALL, 0), TRUE);
+
#if OS(LINUX)
// Kill child process when parent dies.
prctl(PR_SET_PDEATHSIG, SIGKILL);
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index c70f62edf..dc839c84f 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -28,9 +28,9 @@
#import "DynamicLinkerEnvironmentExtractor.h"
#import "EnvironmentVariables.h"
-#import "RunLoop.h"
#import "WebProcess.h"
#import "WebKitSystemInterface.h"
+#import <WebCore/RunLoop.h>
#import <crt_externs.h>
#import <mach-o/dyld.h>
#import <mach/machine.h>
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
index 1c74b7d28..dd53b3ef1 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ThreadLauncherMac.mm
@@ -26,13 +26,15 @@
#import "config.h"
#import "ThreadLauncher.h"
-#import "RunLoop.h"
#import "WebProcess.h"
#import "WebSystemInterface.h"
#import <runtime/InitializeThreading.h>
+#import <WebCore/RunLoop.h>
#import <wtf/MainThread.h>
#import <wtf/Threading.h>
+using namespace WebCore;
+
namespace WebKit {
static void* webThreadBody(void* context)
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
index 837f59baf..8e8262063 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
@@ -28,7 +28,6 @@
#include "ProcessLauncher.h"
#include "Connection.h"
-#include "RunLoop.h"
#include "WebProcess.h"
#include <QCoreApplication>
#include <QDebug>
@@ -39,6 +38,7 @@
#include <QString>
#include <QtCore/qglobal.h>
#include <WebCore/NotImplemented.h>
+#include <WebCore/RunLoop.h>
#include <errno.h>
#include <fcntl.h>
#include <runtime/InitializeThreading.h>
@@ -50,6 +50,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
#include <wtf/text/WTFString.h>
+
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
#include <signal.h>
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
index 7b95ca049..1d0caf3ae 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ThreadLauncherQt.cpp
@@ -27,8 +27,8 @@
#include "config.h"
#include "ThreadLauncher.h"
-#include "RunLoop.h"
#include "WebProcess.h"
+#include <WebCore/RunLoop.h>
#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
#include <wtf/Threading.h>
diff --git a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
index d526c0307..7de782f68 100644
--- a/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
@@ -27,7 +27,7 @@
#include "ProcessLauncher.h"
#include "Connection.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
#include <shlwapi.h>
#include <wtf/text/WTFString.h>
@@ -43,6 +43,8 @@ const LPCWSTR webKitDLLName = L"WebKit_debug.dll";
const LPCWSTR webKitDLLName = L"WebKit.dll";
#endif
+using namespace WebCore;
+
namespace WebKit {
void ProcessLauncher::launchProcess()
diff --git a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
index 2596998ea..f9d1c0481 100644
--- a/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/win/ThreadLauncherWin.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "ThreadLauncher.h"
-#include "RunLoop.h"
#include "WebProcess.h"
+#include <WebCore/RunLoop.h>
#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
#include <wtf/Threading.h>
diff --git a/Source/WebKit2/UIProcess/LayerTreeHostProxy.h b/Source/WebKit2/UIProcess/LayerTreeHostProxy.h
index 871e3bf09..4c971875c 100644
--- a/Source/WebKit2/UIProcess/LayerTreeHostProxy.h
+++ b/Source/WebKit2/UIProcess/LayerTreeHostProxy.h
@@ -24,12 +24,12 @@
#include "DrawingAreaProxy.h"
#include "MessageQueue.h"
#include "Region.h"
-#include "RunLoop.h"
#include "WebLayerTreeInfo.h"
#include <WebCore/GraphicsContext.h>
#include <WebCore/GraphicsLayer.h>
#include <WebCore/IntRect.h>
#include <WebCore/IntSize.h>
+#include <WebCore/RunLoop.h>
#include <wtf/HashSet.h>
#if USE(TEXTURE_MAPPER)
@@ -42,11 +42,9 @@ namespace WebKit {
class WebLayerInfo;
class WebLayerUpdateInfo;
-using namespace WebCore;
-
class LayerTreeMessageToRenderer;
-class LayerTreeHostProxy : public GraphicsLayerClient {
+class LayerTreeHostProxy : public WebCore::GraphicsLayerClient {
public:
LayerTreeHostProxy(DrawingAreaProxy*);
virtual ~LayerTreeHostProxy();
@@ -54,10 +52,11 @@ public:
void deleteCompositingLayer(WebLayerID);
void setRootCompositingLayer(WebLayerID);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void paintToCurrentGLContext(const TransformationMatrix&, float);
+ void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&);
+ void paintToGraphicsContext(BackingStore::PlatformGraphicsContext);
void purgeGLResources();
- void setVisibleContentsRectAndScale(const IntRect&, float);
- void setVisibleContentRectTrajectoryVector(const FloatPoint&);
+ void setVisibleContentsRectAndScale(const WebCore::IntRect&, float);
+ void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
#if USE(TILED_BACKING_STORE)
void syncRemoteContent();
void swapContentBuffers();
@@ -68,40 +67,39 @@ public:
void createDirectlyCompositedImage(int64_t, const WebKit::ShareableBitmap::Handle&);
void destroyDirectlyCompositedImage(int64_t);
void didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void setVisibleContentsRectForLayer(WebLayerID, const IntRect&);
void updateViewport();
#endif
protected:
- PassOwnPtr<GraphicsLayer> createLayer(WebLayerID);
+ PassOwnPtr<WebCore::GraphicsLayer> createLayer(WebLayerID);
- GraphicsLayer* layerByID(WebLayerID id) { return (id == InvalidWebLayerID) ? 0 : m_layers.get(id); }
- GraphicsLayer* rootLayer() { return m_rootLayer.get(); }
+ WebCore::GraphicsLayer* layerByID(WebLayerID id) { return (id == InvalidWebLayerID) ? 0 : m_layers.get(id); }
+ WebCore::GraphicsLayer* rootLayer() { return m_rootLayer.get(); }
// Reimplementations from WebCore::GraphicsLayerClient.
- virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
- virtual void notifySyncRequired(const GraphicsLayer*) { }
- virtual bool showDebugBorders() const { return false; }
- virtual bool showRepaintCounter() const { return false; }
+ virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { }
+ virtual void notifySyncRequired(const WebCore::GraphicsLayer*) { }
+ virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; }
+ virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; }
void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) { }
- RunLoop::Timer<LayerTreeHostProxy> m_animationTimer;
+ WebCore::RunLoop::Timer<LayerTreeHostProxy> m_animationTimer;
DrawingAreaProxy* m_drawingAreaProxy;
typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap;
- IntRect m_visibleContentsRect;
+ WebCore::IntRect m_visibleContentsRect;
float m_contentsScale;
MessageQueue<LayerTreeMessageToRenderer> m_messagesToRenderer;
void pushUpdateToQueue(PassOwnPtr<LayerTreeMessageToRenderer>);
#if USE(TEXTURE_MAPPER)
- OwnPtr<TextureMapper> m_textureMapper;
+ OwnPtr<WebCore::TextureMapper> m_textureMapper;
#endif
#if PLATFORM(QT)
- typedef HashMap<IntPoint, RefPtr<BitmapTexture> > TiledImage;
- TextureMapperNode::NodeRectMap m_nodeVisualContentsRectMap;
+ typedef HashMap<WebCore::IntPoint, RefPtr<WebCore::BitmapTexture> > TiledImage;
+ WebCore::TextureMapperNode::NodeRectMap m_nodeVisualContentsRectMap;
HashMap<int, int> m_tileToNodeTile;
int remoteTileIDToNodeTileID(int tileID) const;
HashMap<int64_t, TiledImage> m_directlyCompositedImages;
@@ -113,8 +111,8 @@ protected:
void syncLayerParameters(const WebLayerInfo&);
void createTile(WebLayerID, int, float scale);
void removeTile(WebLayerID, int);
- void updateTile(WebLayerID, int, const IntRect&, const IntRect&, const QImage&);
- void createImage(int64_t, const QImage&);
+ void updateTile(WebLayerID, int, const WebCore::IntRect&, const WebCore::IntRect&, ShareableBitmap*);
+ void createImage(int64_t, ShareableBitmap*);
void destroyImage(int64_t);
void assignImageToLayer(WebCore::GraphicsLayer*, int64_t imageID);
void flushLayerChanges();
@@ -123,12 +121,12 @@ protected:
#endif
- OwnPtr<GraphicsLayer> m_rootLayer;
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
Vector<WebLayerID> m_layersToDelete;
#if PLATFORM(QT)
- void didFireViewportUpdateTimer(Timer<LayerTreeHostProxy>*);
- Timer<LayerTreeHostProxy> m_viewportUpdateTimer;
+ void didFireViewportUpdateTimer(WebCore::Timer<LayerTreeHostProxy>*);
+ WebCore::Timer<LayerTreeHostProxy> m_viewportUpdateTimer;
#endif
LayerMap m_layers;
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
index 7bb74432c..065bbbf7f 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
@@ -33,10 +33,10 @@
namespace WebKit {
-WebNotification::WebNotification(const String& title, const String& body, const String& originIdentifier, uint64_t notificationID)
+WebNotification::WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID)
: m_title(title)
, m_body(body)
- , m_origin(WebSecurityOrigin::create(originIdentifier))
+ , m_origin(WebSecurityOrigin::createFromString(originString))
, m_notificationID(notificationID)
{
}
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.h b/Source/WebKit2/UIProcess/Notifications/WebNotification.h
index 0b89a0aab..9447da427 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotification.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.h
@@ -45,9 +45,9 @@ class WebNotification : public APIObject {
public:
static const Type APIType = TypeNotification;
- static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& originIdentifier, uint64_t notificationID)
+ static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& originString, uint64_t notificationID)
{
- return adoptRef(new WebNotification(title, body, originIdentifier, notificationID));
+ return adoptRef(new WebNotification(title, body, originString, notificationID));
}
const String& title() const { return m_title; }
@@ -57,7 +57,7 @@ public:
uint64_t notificationID() const { return m_notificationID; }
private:
- WebNotification(const String& title, const String& body, const String& originIdentifier, uint64_t notificationID);
+ WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID);
virtual Type type() const { return APIType; }
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
index 7d7c045db..e74ad07b7 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
@@ -27,6 +27,7 @@
#include "WebNotificationManagerProxy.h"
#include "ImmutableArray.h"
+#include "ImmutableDictionary.h"
#include "WebContext.h"
#include "WebNotification.h"
#include "WebNotificationManagerMessages.h"
@@ -57,26 +58,31 @@ void WebNotificationManagerProxy::invalidate()
void WebNotificationManagerProxy::initializeProvider(const WKNotificationProvider *provider)
{
m_provider.initialize(provider);
+ m_provider.addNotificationManager(this);
}
-void WebNotificationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+void WebNotificationManagerProxy::populateCopyOfNotificationPermissions(HashMap<String, bool>& permissions)
{
- didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments);
+ RefPtr<ImmutableDictionary> knownPermissions = m_provider.notificationPermissions();
+ permissions.clear();
+ RefPtr<ImmutableArray> knownOrigins = knownPermissions->keys();
+ for (size_t i = 0; i < knownOrigins->size(); ++i) {
+ WebString* origin = knownOrigins->at<WebString>(i);
+ permissions.set(origin->string(), knownPermissions->get<WebBoolean>(origin->string())->value());
+ }
}
-void WebNotificationManagerProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
+void WebNotificationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
{
- didReceiveSyncWebNotificationManagerProxyMessage(connection, messageID, arguments, reply);
+ didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments);
}
-void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& originIdentifier, uint64_t notificationID)
+void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& originString, uint64_t notificationID)
{
if (!isNotificationIDValid(notificationID))
return;
- m_provider.addNotificationManager(this);
-
- RefPtr<WebNotification> notification = WebNotification::create(title, body, originIdentifier, notificationID);
+ RefPtr<WebNotification> notification = WebNotification::create(title, body, originString, notificationID);
m_notifications.set(notificationID, notification);
m_provider.show(page, notification.get());
}
@@ -90,7 +96,6 @@ void WebNotificationManagerProxy::cancel(uint64_t notificationID)
if (!notification)
return;
- m_provider.addNotificationManager(this);
m_provider.cancel(notification.get());
}
@@ -106,12 +111,6 @@ void WebNotificationManagerProxy::didDestroyNotification(uint64_t notificationID
m_provider.didDestroyNotification(notification.get());
}
-void WebNotificationManagerProxy::notificationPermissionLevel(const String& originIdentifier, uint64_t& permissionLevel)
-{
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
- permissionLevel = m_provider.policyForNotificationPermissionAtOrigin(origin.get());
-}
-
void WebNotificationManagerProxy::providerDidShowNotification(uint64_t notificationID)
{
if (!m_context)
@@ -148,4 +147,30 @@ void WebNotificationManagerProxy::providerDidCloseNotifications(ImmutableArray*
m_context->sendToAllProcesses(Messages::WebNotificationManager::DidCloseNotifications(vectorNotificationIDs));
}
+void WebNotificationManagerProxy::providerDidUpdateNotificationPolicy(const WebSecurityOrigin* origin, bool allowed)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebNotificationManager::DidUpdateNotificationDecision(origin->toString(), allowed));
+}
+
+void WebNotificationManagerProxy::providerDidRemoveNotificationPolicies(ImmutableArray* origins)
+{
+ if (!m_context)
+ return;
+
+ size_t size = origins->size();
+ if (!size)
+ return;
+
+ Vector<String> originStrings;
+ originStrings.reserveInitialCapacity(size);
+
+ for (size_t i = 0; i < size; ++i)
+ originStrings.append(origins->at<WebSecurityOrigin>(i)->toString());
+
+ m_context->sendToAllProcesses(Messages::WebNotificationManager::DidRemoveNotificationDecisions(originStrings));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
index 1705abcf4..8f4b9e9de 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
@@ -29,9 +29,11 @@
#include "APIObject.h"
#include "MessageID.h"
#include "WebNotificationProvider.h"
+#include <WebCore/NotificationPresenter.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/text/StringHash.h>
namespace CoreIPC {
class ArgumentDecoder;
@@ -44,6 +46,7 @@ namespace WebKit {
class ImmutableArray;
class WebContext;
class WebPageProxy;
+class WebSecurityOrigin;
class WebNotificationManagerProxy : public APIObject {
public:
@@ -55,15 +58,17 @@ public:
void clearContext() { m_context = 0; }
void initializeProvider(const WKNotificationProvider*);
+ void populateCopyOfNotificationPermissions(HashMap<String, bool>&);
- void show(WebPageProxy*, const WTF::String& title, const WTF::String& body, const WTF::String& originIdentifier, uint64_t notificationID);
+ void show(WebPageProxy*, const String& title, const String& body, const String& originString, uint64_t notificationID);
void providerDidShowNotification(uint64_t notificationID);
void providerDidClickNotification(uint64_t notificationID);
void providerDidCloseNotifications(ImmutableArray* notificationIDs);
+ void providerDidUpdateNotificationPolicy(const WebSecurityOrigin*, bool allowed);
+ void providerDidRemoveNotificationPolicies(ImmutableArray* origins);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
private:
explicit WebNotificationManagerProxy(WebContext*);
@@ -71,12 +76,10 @@ private:
virtual Type type() const { return APIType; }
void didReceiveWebNotificationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- void didReceiveSyncWebNotificationManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
// Message handlers
void cancel(uint64_t notificationID);
void didDestroyNotification(uint64_t notificationID);
- void notificationPermissionLevel(const WTF::String& originIdentifier, uint64_t& permissionLevel);
typedef HashMap<uint64_t, RefPtr<WebNotification> > WebNotificationMap;
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
index 04d1a01b1..a06fd0292 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
@@ -23,6 +23,4 @@
messages -> WebNotificationManagerProxy {
Cancel(uint64_t notificationID);
DidDestroyNotification(uint64_t notificationID);
-
- NotificationPermissionLevel(WTF::String originIdentifier) -> (uint64_t policy)
}
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
index 080aea666..afd13bccd 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "WebNotificationProvider.h"
+#include "ImmutableDictionary.h"
#include "WKAPICast.h"
#include "WebNotification.h"
#include "WebNotificationManagerProxy.h"
@@ -57,14 +58,6 @@ void WebNotificationProvider::didDestroyNotification(WebNotification* notificati
m_client.didDestroyNotification(toAPI(notification), m_client.clientInfo);
}
-int WebNotificationProvider::policyForNotificationPermissionAtOrigin(WebSecurityOrigin* origin)
-{
- if (!m_client.policyForNotificationPermissionAtOrigin)
- return INT_MIN;
-
- return m_client.policyForNotificationPermissionAtOrigin(toAPI(origin), m_client.clientInfo);
-}
-
void WebNotificationProvider::addNotificationManager(WebNotificationManagerProxy* manager)
{
if (!m_client.addNotificationManager)
@@ -81,4 +74,12 @@ void WebNotificationProvider::removeNotificationManager(WebNotificationManagerPr
m_client.removeNotificationManager(toAPI(manager), m_client.clientInfo);
}
+PassRefPtr<ImmutableDictionary> WebNotificationProvider::notificationPermissions()
+{
+ if (!m_client.notificationPermissions)
+ return ImmutableDictionary::create();
+
+ return adoptRef(toImpl(m_client.notificationPermissions(m_client.clientInfo)));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
index 43d963919..8503ee27c 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
@@ -32,6 +32,7 @@
namespace WebKit {
+class ImmutableDictionary;
class WebNotification;
class WebNotificationManagerProxy;
class WebPageProxy;
@@ -42,10 +43,11 @@ public:
void show(WebPageProxy*, WebNotification*);
void cancel(WebNotification*);
void didDestroyNotification(WebNotification*);
- int policyForNotificationPermissionAtOrigin(WebSecurityOrigin*);
void addNotificationManager(WebNotificationManagerProxy*);
void removeNotificationManager(WebNotificationManagerProxy*);
+
+ PassRefPtr<ImmutableDictionary> notificationPermissions();
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h
index c94ea1a13..bd6096c93 100644
--- a/Source/WebKit2/UIProcess/PageClient.h
+++ b/Source/WebKit2/UIProcess/PageClient.h
@@ -106,11 +106,12 @@ public:
#if PLATFORM(QT)
virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
- virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&) = 0;
virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0;
virtual void handleDownloadRequest(DownloadProxy*) = 0;
virtual void updateTextInputState() = 0;
-#endif
+ 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;
+#endif // PLATFORM(QT).
#if PLATFORM(QT) || PLATFORM(GTK)
virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 41c7a47cb..893f84732 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -31,18 +31,20 @@
#include "PluginProcessCreationParameters.h"
#include "PluginProcessManager.h"
#include "PluginProcessMessages.h"
-#include "RunLoop.h"
#include "WebContext.h"
#include "WebCoreArgumentCoders.h"
#include "WebPluginSiteDataManager.h"
#include "WebProcessMessages.h"
#include "WebProcessProxy.h"
#include <WebCore/NotImplemented.h>
+#include <WebCore/RunLoop.h>
#if PLATFORM(MAC)
#include "MachPort.h"
#endif
+using namespace WebCore;
+
namespace WebKit {
PassOwnPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo)
diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
index 057cc7435..87838ca26 100644
--- a/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
+++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.cpp
@@ -26,6 +26,8 @@
#include "config.h"
#include "ResponsivenessTimer.h"
+using namespace WebCore;
+
namespace WebKit {
static const double kResponsivenessTimeout = 3;
diff --git a/Source/WebKit2/UIProcess/ResponsivenessTimer.h b/Source/WebKit2/UIProcess/ResponsivenessTimer.h
index 659191612..36733151f 100644
--- a/Source/WebKit2/UIProcess/ResponsivenessTimer.h
+++ b/Source/WebKit2/UIProcess/ResponsivenessTimer.h
@@ -26,7 +26,7 @@
#ifndef ResponsivenessTimer_h
#define ResponsivenessTimer_h
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
namespace WebKit {
@@ -55,7 +55,7 @@ private:
ResponsivenessTimer::Client* m_client;
bool m_isResponsive;
- RunLoop::Timer<ResponsivenessTimer> m_timer;
+ WebCore::RunLoop::Timer<ResponsivenessTimer> m_timer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
index 855977de9..0fcccf4e1 100644
--- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
@@ -31,10 +31,9 @@
#include "DrawingAreaProxy.h"
#include <WebCore/GraphicsContext.h>
#include <WebCore/IntRect.h>
+#include <WebCore/RunLoop.h>
#include <wtf/HashSet.h>
-#include "RunLoop.h"
-
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#ifdef __OBJC__
diff --git a/Source/WebKit2/UIProcess/VisitedLinkProvider.h b/Source/WebKit2/UIProcess/VisitedLinkProvider.h
index a428d5b83..461c5ac94 100644
--- a/Source/WebKit2/UIProcess/VisitedLinkProvider.h
+++ b/Source/WebKit2/UIProcess/VisitedLinkProvider.h
@@ -26,9 +26,9 @@
#ifndef VisitedLinkProvider_h
#define VisitedLinkProvider_h
-#include "RunLoop.h"
#include "VisitedLinkTable.h"
#include <WebCore/LinkHash.h>
+#include <WebCore/RunLoop.h>
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
@@ -58,7 +58,7 @@ private:
VisitedLinkTable m_table;
HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_pendingVisitedLinks;
- RunLoop::Timer<VisitedLinkProvider> m_pendingVisitedLinksTimer;
+ WebCore::RunLoop::Timer<VisitedLinkProvider> m_pendingVisitedLinksTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp
index b1d103fbc..be814c0a9 100644
--- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp
+++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp
@@ -30,6 +30,8 @@
#include "WebContextUserMessageCoders.h"
#include "WebProcessProxy.h"
+using namespace WebCore;
+
namespace WebKit {
PassRefPtr<WebConnectionToWebProcess> WebConnectionToWebProcess::create(WebProcessProxy* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop)
diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h
index b9d58f2c7..f4962e26c 100644
--- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h
+++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h
@@ -35,14 +35,14 @@ class WebProcessProxy;
class WebConnectionToWebProcess : public WebConnection, CoreIPC::Connection::Client {
public:
- static PassRefPtr<WebConnectionToWebProcess> create(WebProcessProxy*, CoreIPC::Connection::Identifier, RunLoop*);
+ static PassRefPtr<WebConnectionToWebProcess> create(WebProcessProxy*, CoreIPC::Connection::Identifier, WebCore::RunLoop*);
CoreIPC::Connection* connection() { return m_connection.get(); }
void invalidate();
private:
- WebConnectionToWebProcess(WebProcessProxy*, CoreIPC::Connection::Identifier, RunLoop*);
+ WebConnectionToWebProcess(WebProcessProxy*, CoreIPC::Connection::Identifier, WebCore::RunLoop*);
// WebConnection
virtual void postMessage(const String&, APIObject*);
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 18bca116a..23ca56be6 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -31,7 +31,6 @@
#include "InjectedBundleMessageKinds.h"
#include "Logging.h"
#include "MutableDictionary.h"
-#include "RunLoop.h"
#include "SandboxExtension.h"
#include "StatisticsData.h"
#include "TextChecker.h"
@@ -58,6 +57,7 @@
#include <WebCore/LinkHash.h>
#include <WebCore/Logging.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/RunLoop.h>
#include <runtime/InitializeThreading.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
@@ -231,7 +231,7 @@ void WebContext::languageChanged(void* context)
void WebContext::languageChanged()
{
- sendToAllProcesses(Messages::WebProcess::LanguageChanged(defaultLanguage()));
+ sendToAllProcesses(Messages::WebProcess::UserPreferredLanguagesChanged(userPreferredLanguages()));
}
void WebContext::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
@@ -255,7 +255,7 @@ void WebContext::ensureWebProcess()
parameters.shouldTrackVisitedLinks = m_historyClient.shouldTrackVisitedLinks();
parameters.cacheModel = m_cacheModel;
- parameters.languageCode = defaultLanguage();
+ parameters.languages = userPreferredLanguages();
parameters.applicationCacheDirectory = applicationCacheDirectory();
parameters.databaseDirectory = databaseDirectory();
parameters.localStorageDirectory = localStorageDirectory();
@@ -281,6 +281,10 @@ void WebContext::ensureWebProcess()
parameters.defaultRequestTimeoutInterval = WebURLRequest::defaultTimeoutInterval();
+#if ENABLE(NOTIFICATIONS)
+ m_notificationManagerProxy->populateCopyOfNotificationPermissions(parameters.notificationPermissions);
+#endif
+
// Add any platform specific parameters
platformInitializeWebProcess(parameters);
diff --git a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
index 26c518fd8..e61faa162 100644
--- a/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
@@ -137,7 +137,7 @@ void WebDatabaseManagerProxy::didGetDatabasesByOrigin(const Vector<OriginAndData
for (size_t i = 0; i < originAndDatabasesCount; ++i) {
const OriginAndDatabases& originAndDatabases = originAndDatabasesVector[i];
- RefPtr<APIObject> origin = WebSecurityOrigin::create(originAndDatabases.originIdentifier);
+ RefPtr<APIObject> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originAndDatabases.originIdentifier);
size_t databasesCount = originAndDatabases.databases.size();
Vector<RefPtr<APIObject> > databases(databasesCount);
@@ -188,7 +188,7 @@ void WebDatabaseManagerProxy::didGetDatabaseOrigins(const Vector<String>& origin
Vector<RefPtr<APIObject> > securityOrigins(originIdentifiersCount);
for (size_t i = 0; i < originIdentifiersCount; ++i)
- securityOrigins[i] = WebSecurityOrigin::create(originIdentifiers[i]);
+ securityOrigins[i] = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifiers[i]);
callback->performCallbackWithReturnValue(ImmutableArray::adopt(securityOrigins).get());
}
@@ -219,13 +219,13 @@ void WebDatabaseManagerProxy::setQuotaForOrigin(WebSecurityOrigin* origin, uint6
void WebDatabaseManagerProxy::didModifyOrigin(const String& originIdentifier)
{
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+ RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
m_client.didModifyOrigin(this, origin.get());
}
void WebDatabaseManagerProxy::didModifyDatabase(const String& originIdentifier, const String& databaseIdentifier)
{
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+ RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
m_client.didModifyDatabase(this, origin.get(), databaseIdentifier);
}
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
index a7057e083..825420a4a 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -148,6 +148,7 @@ void WebInspectorProxy::detach()
void WebInspectorProxy::setAttachedWindowHeight(unsigned height)
{
+ inspectorPageGroup()->preferences()->setInspectorAttachedHeight(height);
platformSetAttachedWindowHeight(height);
}
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
index 624169e4e..87feea062 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
@@ -123,6 +123,14 @@ void WebLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy* page,
m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
}
+void WebLoaderClient::didNewFirstVisuallyNonEmptyLayout(WebPageProxy* page, APIObject* userData)
+{
+ if (!m_client.didNewFirstVisuallyNonEmptyLayout)
+ return;
+
+ m_client.didNewFirstVisuallyNonEmptyLayout(toAPI(page), toAPI(userData), m_client.clientInfo);
+}
+
void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
{
if (!m_client.didRemoveFrameFromHierarchy)
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.h b/Source/WebKit2/UIProcess/WebLoaderClient.h
index 9fe8fce2f..970591937 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.h
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.h
@@ -64,6 +64,10 @@ public:
void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
void didDetectXSSForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
+
+ // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
+ // The only reason for both to exist is to experiment with different heuristics for the time being.
+ void didNewFirstVisuallyNonEmptyLayout(WebPageProxy*, APIObject*);
bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 7e08cecd8..b945ef0b5 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -166,6 +166,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
, m_areMemoryCacheClientCallsEnabled(true)
, m_useFixedLayout(false)
, m_paginationMode(Page::Pagination::Unpaginated)
+ , m_paginationBehavesLikeColumns(false)
, m_pageLength(0)
, m_gapBetweenPages(0)
, m_isValid(true)
@@ -199,6 +200,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
, m_pageCount(0)
, m_renderTreeSize(0)
, m_shouldSendEventsSynchronously(false)
+ , m_mediaVolume(1)
{
#ifndef NDEBUG
webPageProxyCounter.increment();
@@ -976,6 +978,13 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
#endif
#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(QT)
+void WebPageProxy::handlePotentialActivation(const IntPoint& layoutPoint)
+{
+ process()->send(Messages::WebPage::HighlightPotentialActivation(layoutPoint), m_pageID);
+}
+#endif
+
void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
{
if (!isValid())
@@ -1305,6 +1314,18 @@ void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
}
+void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
+{
+ if (behavesLikeColumns == m_paginationBehavesLikeColumns)
+ return;
+
+ m_paginationBehavesLikeColumns = behavesLikeColumns;
+
+ if (!isValid())
+ return;
+ process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
+}
+
void WebPageProxy::setPageLength(double pageLength)
{
if (pageLength == m_pageLength)
@@ -1858,6 +1879,16 @@ void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, Core
m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
}
+void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
+{
+ RefPtr<APIObject> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
+ if (!arguments->decode(messageDecoder))
+ return;
+
+ m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
+}
+
void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
@@ -2320,6 +2351,19 @@ void WebPageProxy::printMainFrame()
printFrame(m_mainFrame->frameID());
}
+void WebPageProxy::setMediaVolume(float volume)
+{
+ if (volume == m_mediaVolume)
+ return;
+
+ m_mediaVolume = volume;
+
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
+}
+
#if PLATFORM(QT)
void WebPageProxy::didChangeContentsSize(const IntSize& size)
{
@@ -2331,11 +2375,6 @@ void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& ar
m_pageClient->didFindZoomableArea(target, area);
}
-void WebPageProxy::focusEditableArea(const WebCore::IntRect& caret, const WebCore::IntRect& area)
-{
- m_pageClient->focusEditableArea(caret, area);
-}
-
void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point)
{
if (!isValid())
@@ -2353,7 +2392,17 @@ void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
{
m_pageClient->handleDownloadRequest(download);
}
-#endif
+
+void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
+{
+ m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
+}
+
+void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
+{
+ m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
+}
+#endif // PLATFORM(QT).
#if ENABLE(TOUCH_EVENTS)
void WebPageProxy::needTouchEvents(bool needTouchEvents)
@@ -3234,6 +3283,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
parameters.useFixedLayout = m_useFixedLayout;
parameters.fixedLayoutSize = m_fixedLayoutSize;
parameters.paginationMode = m_paginationMode;
+ parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
parameters.pageLength = m_pageLength;
parameters.gapBetweenPages = m_gapBetweenPages;
parameters.userAgent = userAgent();
@@ -3242,6 +3292,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
parameters.canRunModal = m_uiClient.canRunModal();
parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
+ parameters.mediaVolume = m_mediaVolume;
#if PLATFORM(MAC)
parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
@@ -3296,7 +3347,7 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+ RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
}
@@ -3306,28 +3357,29 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+ // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
+ RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
request->deny();
}
-void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originIdentifier)
+void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
{
if (!isRequestIDValid(requestID))
return;
- RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
+ RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromString(originString);
RefPtr<NotificationPermissionRequest> request = m_notificationPermissionRequestManager.createRequest(requestID);
if (!m_uiClient.decidePolicyForNotificationPermissionRequest(this, origin.get(), request.get()))
request->deny();
}
-void WebPageProxy::showNotification(const String& title, const String& body, const String& originIdentifier, uint64_t notificationID)
+void WebPageProxy::showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID)
{
- m_process->context()->notificationManagerProxy()->show(this, title, body, originIdentifier, notificationID);
+ m_process->context()->notificationManagerProxy()->show(this, title, body, originString, notificationID);
}
float WebPageProxy::headerHeight(WebFrameProxy* frame)
@@ -3475,6 +3527,20 @@ void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printIn
m_dataCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
+#elif PLATFORM(GTK)
+void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<VoidCallback> didPrintCallback)
+{
+ RefPtr<VoidCallback> callback = didPrintCallback;
+ if (!isValid()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_voidCallbacks.set(callbackID, callback.get());
+ m_isInPrintingMode = true;
+ process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
+}
#endif
void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index cf5130419..caa5df4a2 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -107,6 +107,12 @@ class WKView;
#endif
#endif
+#if PLATFORM(GTK)
+typedef GtkWidget* PlatformWidget;
+#elif PLATFORM(EFL)
+typedef Evas_Object* PlatformWidget;
+#endif
+
namespace WebKit {
class NativeWebKeyboardEvent;
@@ -314,7 +320,9 @@ public:
void registerApplicationScheme(const String& scheme);
void resolveApplicationSchemeRequest(QtNetworkRequestData);
void sendApplicationSchemeReply(const QQuickNetworkReply*);
-#endif
+ void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
+ void certificateVerificationRequest(const String& hostname, bool& ignoreErrors);
+#endif // PLATFORM(QT).
#if PLATFORM(QT)
void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
@@ -358,11 +366,8 @@ public:
HWND nativeWindow() const;
#endif
-#if PLATFORM(GTK)
- GtkWidget* viewWidget();
-#endif
-#if PLATFORM(EFL)
- Evas_Object* viewObject();
+#if USE(CAIRO) && !PLATFORM(WIN_CAIRO)
+ PlatformWidget viewWidget();
#endif
#if USE(TILED_BACKING_STORE)
void setFixedVisibleContentRect(const WebCore::IntRect&);
@@ -377,6 +382,9 @@ public:
#endif
#if ENABLE(TOUCH_EVENTS)
void handleTouchEvent(const NativeWebTouchEvent&);
+#if PLATFORM(QT)
+ void handlePotentialActivation(const WebCore::IntPoint&);
+#endif
#endif
void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
@@ -433,6 +441,8 @@ public:
void setPaginationMode(WebCore::Page::Pagination::Mode);
WebCore::Page::Pagination::Mode paginationMode() const { return m_paginationMode; }
+ void setPaginationBehavesLikeColumns(bool);
+ bool paginationBehavesLikeColumns() const { return m_paginationBehavesLikeColumns; }
void setPageLength(double);
double pageLength() const { return m_pageLength; }
void setGapBetweenPages(double);
@@ -567,12 +577,18 @@ public:
void setSmartInsertDeleteEnabled(bool);
#endif
+#if PLATFORM(GTK)
+ String accessibilityPlugID() const { return m_accessibilityPlugID; }
+#endif
+
void beginPrinting(WebFrameProxy*, const PrintInfo&);
void endPrinting();
void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
#if PLATFORM(MAC) || PLATFORM(WIN)
void drawRectToPDF(WebFrameProxy*, const PrintInfo&, const WebCore::IntRect&, PassRefPtr<DataCallback>);
void drawPagesToPDF(WebFrameProxy*, const PrintInfo&, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
+#elif PLATFORM(GTK)
+ void drawPagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<VoidCallback>);
#endif
const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
@@ -603,6 +619,8 @@ public:
void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; };
void printMainFrame();
+
+ void setMediaVolume(float);
// WebPopupMenuProxy::Client
virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
@@ -639,6 +657,7 @@ private:
void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
+ void didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder*);
void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*);
void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
@@ -705,8 +724,8 @@ private:
void reattachToWebProcess();
void reattachToWebProcessWithItem(WebBackForwardListItem*);
- void requestNotificationPermission(uint64_t notificationID, const String& originIdentifier);
- void showNotification(const String& title, const String& body, const String& originIdentifier, uint64_t notificationID);
+ void requestNotificationPermission(uint64_t notificationID, const String& originString);
+ void showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID);
#if USE(TILED_BACKING_STORE)
void pageDidRequestScroll(const WebCore::IntPoint&);
@@ -715,7 +734,6 @@ private:
#if PLATFORM(QT)
void didChangeContentsSize(const WebCore::IntSize&);
void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
- void focusEditableArea(const WebCore::IntRect& caret, const WebCore::IntRect&);
#endif
#if ENABLE(TOUCH_EVENTS)
void needTouchEvents(bool);
@@ -745,6 +763,7 @@ private:
#if PLATFORM(GTK)
void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
+ void bindAccessibilityTree(const String&);
#endif
#if PLATFORM(EFL)
void getEditorCommandsForKeyEvent(Vector<String>&);
@@ -930,6 +949,7 @@ private:
WebCore::IntSize m_fixedLayoutSize;
WebCore::Page::Pagination::Mode m_paginationMode;
+ bool m_paginationBehavesLikeColumns;
double m_pageLength;
double m_gapBetweenPages;
@@ -974,6 +994,10 @@ private:
bool m_isSmartInsertDeleteEnabled;
#endif
+#if PLATFORM(GTK)
+ String m_accessibilityPlugID;
+#endif
+
int64_t m_spellDocumentTag;
bool m_hasSpellDocumentTag;
unsigned m_pendingLearnOrIgnoreWordMessageCount;
@@ -999,9 +1023,11 @@ private:
static WKPageDebugPaintFlags s_debugPaintFlags;
bool m_shouldSendEventsSynchronously;
+
+ float m_mediaVolume;
#if PLATFORM(QT)
- WTF::HashSet<RefPtr<QtNetworkRequestData> > m_applicationSchemeRequests;
+ WTF::HashSet<RefPtr<QtRefCountedNetworkRequestData> > m_applicationSchemeRequests;
#endif
};
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 5c2133ab4..8c8ce4995 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -74,7 +74,8 @@ messages -> WebPageProxy {
#if PLATFORM(QT)
DidChangeContentsSize(WebCore::IntSize newSize)
DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
- FocusEditableArea(WebCore::IntRect caret, WebCore::IntRect area)
+ AuthenticationRequiredRequest(WTF::String hostname, WTF::String realm, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password)
+ CertificateVerificationRequest(WTF::String hostname) -> (bool ignoreErrors)
#endif
#if ENABLE(TOUCH_EVENTS)
NeedTouchEvents(bool needTouchEvents)
@@ -105,6 +106,7 @@ messages -> WebPageProxy {
DidFinishLoadForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
+ DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData)
DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WTF::String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData)
@@ -147,6 +149,9 @@ messages -> WebPageProxy {
#if PLATFORM(GTK)
# Support for GTK+ platform keybindings
GetEditorCommandsForKeyEvent(AtomicString eventType) -> (Vector<WTF::String> commandsList)
+
+ # Support for connecting the Accessibility worlds of the UI and the Web processes
+ BindAccessibilityTree(WTF::String plugID)
#endif
# BackForward messages
diff --git a/Source/WebKit2/UIProcess/WebPreferences.h b/Source/WebKit2/UIProcess/WebPreferences.h
index 0f4943ab6..53b610200 100644
--- a/Source/WebKit2/UIProcess/WebPreferences.h
+++ b/Source/WebKit2/UIProcess/WebPreferences.h
@@ -69,6 +69,9 @@ public:
#undef DECLARE_PREFERENCE_GETTER_AND_SETTERS
+ // Exposed for WebKitTestRunner use only.
+ void forceUpdate() { update(); }
+
private:
WebPreferences();
WebPreferences(const String& identifier);
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index 8c99b4efa..2109d9e7a 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -334,11 +334,6 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
return;
}
- if (messageID.is<CoreIPC::MessageClassWebNotificationManagerProxy>()) {
- m_context->notificationManagerProxy()->didReceiveSyncMessage(connection, messageID, arguments, reply);
- return;
- }
-
uint64_t pageID = arguments->destinationID();
if (!pageID)
return;
diff --git a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp
index 51608a588..fec82b773 100644
--- a/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp
+++ b/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp
@@ -33,6 +33,10 @@
#include <WebCore/GraphicsContext.h>
#include <cairo/cairo.h>
+#if PLATFORM(EFL)
+#include "ewk_private.h"
+#endif
+
using namespace WebCore;
namespace WebKit {
@@ -64,6 +68,11 @@ void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo&
srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
bitmap->paint(graphicsContext, updateRect.location(), srcRect);
}
+
+#if PLATFORM(EFL)
+ // Update ewk_view with new backingStore image.
+ ewk_view_image_data_set(m_webPageProxy->viewWidget(), cairo_image_surface_get_data(m_backingStore->cairoSurface()), m_size);
+#endif
}
void BackingStore::scroll(const IntRect& scrollRect, const IntSize& scrollOffset)
diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index 41fd01baa..0524bc517 100644
--- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -44,7 +44,7 @@ namespace WebKit {
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryKey, (CFSTR("SessionHistory")));
DEFINE_STATIC_GETTER(CFStringRef, ProvisionalURLKey, (CFSTR("ProvisionalURL")));
-static const UInt32 CurrentSessionStateDataVersion = 3;
+static const UInt32 CurrentSessionStateDataVersion = 2;
PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback filter, void* context) const
{
diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
index ae314b857..b076b4ef6 100644
--- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
+++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
@@ -33,9 +33,9 @@
namespace WebKit {
-Evas_Object* WebPageProxy::viewObject()
+Evas_Object* WebPageProxy::viewWidget()
{
- return static_cast<PageClientImpl*>(m_pageClient)->viewObject();
+ return static_cast<PageClientImpl*>(m_pageClient)->viewWidget();
}
String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
index 1127dde84..f6b300eb7 100644
--- a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
@@ -49,6 +49,11 @@ void WebPageProxy::getEditorCommandsForKeyEvent(const AtomicString& eventType, V
m_pageClient->getEditorCommandsForKeyEvent(m_keyEventQueue.first(), eventType, commandsList);
}
+void WebPageProxy::bindAccessibilityTree(const String& plugID)
+{
+ m_accessibilityPlugID = plugID;
+}
+
void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index 26410bce0..d43a2ac04 100644
--- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -32,7 +32,9 @@
#import "WebContext.h"
#import "WKInspectorMac.h"
#import "WKViewPrivate.h"
+#import "WebPageGroup.h"
#import "WebPageProxy.h"
+#import "WebPreferences.h"
#import "WebProcessProxy.h"
#import <WebKitSystemInterface.h>
#import <WebCore/InspectorFrontendClientLocal.h>
@@ -207,6 +209,10 @@ void WebInspectorProxy::platformAttach()
[m_inspectorView.get() removeFromSuperview];
+ // The inspector view shares the width and the left starting point of the inspected view.
+ NSRect inspectedViewFrame = [inspectedView frame];
+ [m_inspectorView.get() setFrame:NSMakeRect(NSMinX(inspectedViewFrame), 0, NSWidth(inspectedViewFrame), inspectorPageGroup()->preferences()->inspectorAttachedHeight())];
+
[[inspectedView superview] addSubview:m_inspectorView.get() positioned:NSWindowBelow relativeTo:inspectedView];
[m_inspectorWindow.get() orderOut:nil];
@@ -249,9 +255,6 @@ void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned height)
[m_inspectorView.get() setFrame:NSMakeRect(NSMinX(inspectedViewFrame), 0.0, NSWidth(inspectedViewFrame), height)];
inspectedViewFrameDidChange();
-
- [m_inspectorView.get() setNeedsDisplay:YES];
- [inspectedView setNeedsDisplay:YES];
}
String WebInspectorProxy::inspectorPageURL() const
diff --git a/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm
index 37e8caae0..66422a147 100644
--- a/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm
@@ -74,12 +74,25 @@ static void handleSecItemRequest(CoreIPC::Connection* connection, uint64_t reque
connection->send(Messages::WebProcess::SecItemResponse(requestID, response), 0);
}
+static void dispatchFunctionOnQueue(dispatch_queue_t queue, const Function<void ()>& function)
+{
+#if COMPILER(CLANG)
+ dispatch_async(queue, function);
+#else
+ Function<void ()>* functionPtr = new Function<void ()>(function);
+ dispatch_async(queue, ^{
+ (*functionPtr)();
+ delete functionPtr;
+ });
+#endif
+}
+
void WebProcessProxy::secItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)
{
// Since we don't want the connection work queue to be held up, we do all
// keychain interaction work on a global dispatch queue.
dispatch_queue_t keychainWorkQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- dispatch_async(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
+ dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
}
static void handleSecKeychainItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecKeychainItemRequestData& request)
@@ -128,7 +141,7 @@ void WebProcessProxy::secKeychainItemRequest(CoreIPC::Connection* connection, ui
// Since we don't want the connection work queue to be held up, we do all
// keychain interaction work on a global dispatch queue.
dispatch_queue_t keychainWorkQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- dispatch_async(keychainWorkQueue, bind(handleSecKeychainItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
+ dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecKeychainItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
}
bool WebProcessProxy::fullKeyboardAccessEnabled()
diff --git a/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp b/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp
index 60736b1df..8969bbbe3 100644
--- a/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp
@@ -27,6 +27,7 @@
#include "MessageID.h"
#include "ShareableBitmap.h"
#include "TextureMapperGL.h"
+#include "TextureMapperQt.h"
#include "UpdateInfo.h"
#include "WebCoreArgumentCoders.h"
#include "WebLayerTreeInfo.h"
@@ -57,6 +58,8 @@ public:
virtual Type type() const = 0;
};
+using namespace WebCore;
+
template<class MessageData, LayerTreeMessageToRenderer::Type messageType>
class LayerTreeMessageToRendererWithData : public LayerTreeMessageToRenderer {
public:
@@ -94,7 +97,7 @@ struct UpdateTileMessageData {
int remoteTileID;
IntRect sourceRect;
IntRect targetRect;
- QImage image;
+ RefPtr<ShareableBitmap> bitmap;
};
struct RemoveTileMessageData {
@@ -104,7 +107,7 @@ struct RemoveTileMessageData {
struct CreateImageMessageData {
int64_t imageID;
- QImage image;
+ RefPtr<ShareableBitmap> bitmap;
};
struct DestroyImageMessageData {
@@ -165,10 +168,11 @@ LayerTreeHostProxy::~LayerTreeHostProxy()
}
// This function needs to be reentrant.
-void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity)
+void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect)
{
if (!m_textureMapper)
m_textureMapper = TextureMapperGL::create();
+ ASSERT(dynamic_cast<TextureMapperGL*>(m_textureMapper.get()));
syncRemoteContent();
GraphicsLayer* currentRootLayer = rootLayer();
@@ -182,11 +186,11 @@ void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& mat
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
- IntRect viewportRect(viewport[0], viewport[1], viewport[2], viewport[3]);
m_textureMapper->setViewportSize(IntSize(viewport[2], viewport[3]));
node->setTextureMapper(m_textureMapper.get());
m_textureMapper->beginPainting();
m_textureMapper->bindSurface(0);
+ m_textureMapper->beginClip(TransformationMatrix(), clipRect);
if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
currentRootLayer->setOpacity(opacity);
@@ -194,20 +198,8 @@ void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& mat
currentRootLayer->syncCompositingStateForThisLayerOnly();
}
- TextureMapperNode::NodeRectMap nodeVisualContentsRectMap;
- if (node->collectVisibleContentsRects(nodeVisualContentsRectMap, viewportRect)) {
- TextureMapperNode::NodeRectMap::iterator endIterator = nodeVisualContentsRectMap.end();
- for (TextureMapperNode::NodeRectMap::iterator it = nodeVisualContentsRectMap.begin(); it != endIterator; ++it) {
- WebLayerID layerID = it->first->id();
- // avoid updating non-synced root layer
- if (!layerID)
- continue;
- IntRect visibleRect = IntRect(it->second);
- setVisibleContentsRectForLayer(layerID, visibleRect);
- }
- }
node->paint();
-
+ m_textureMapper->endClip();
m_textureMapper->endPainting();
if (node->descendantsOrSelfHaveRunningAnimations()) {
@@ -216,6 +208,28 @@ void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& mat
}
}
+void LayerTreeHostProxy::paintToGraphicsContext(QPainter* painter)
+{
+ if (!m_textureMapper)
+ m_textureMapper = TextureMapperQt::create();
+ ASSERT(dynamic_cast<TextureMapperQt*>(m_textureMapper.get()));
+
+ syncRemoteContent();
+ TextureMapperNode* node = toTextureMapperNode(rootLayer());
+
+ if (!node)
+ return;
+
+ GraphicsContext graphicsContext(painter);
+ m_textureMapper->setGraphicsContext(&graphicsContext);
+ m_textureMapper->beginPainting();
+ m_textureMapper->bindSurface(0);
+ node->paint();
+ m_textureMapper->endPainting();
+ m_textureMapper->setGraphicsContext(0);
+}
+
+
void LayerTreeHostProxy::didFireViewportUpdateTimer(Timer<LayerTreeHostProxy>*)
{
updateViewport();
@@ -226,11 +240,6 @@ void LayerTreeHostProxy::updateViewport()
m_drawingAreaProxy->updateViewport();
}
-void LayerTreeHostProxy::setVisibleContentsRectForLayer(WebLayerID layerID, const IntRect& rect)
-{
- m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentRectForLayer(layerID, rect), m_drawingAreaProxy->page()->pageID());
-}
-
int LayerTreeHostProxy::remoteTileIDToNodeTileID(int tileID) const
{
HashMap<int, int>::const_iterator it = m_tileToNodeTile.find(tileID);
@@ -245,6 +254,7 @@ void LayerTreeHostProxy::syncLayerParameters(const WebLayerInfo& layerInfo)
ensureLayer(id);
LayerMap::iterator it = m_layers.find(id);
GraphicsLayer* layer = it->second;
+ bool needsToUpdateImageTiles = layerInfo.imageIsUpdated || layerInfo.contentsRect != layer->contentsRect();
layer->setName(layerInfo.name);
@@ -261,7 +271,7 @@ void LayerTreeHostProxy::syncLayerParameters(const WebLayerInfo& layerInfo)
layer->setContentsRect(layerInfo.contentsRect);
layer->setDrawsContent(layerInfo.drawsContent);
- if (layerInfo.imageIsUpdated)
+ if (needsToUpdateImageTiles)
assignImageToLayer(layer, layerInfo.imageBackingStoreID);
// Never make the root layer clip.
@@ -366,7 +376,7 @@ void LayerTreeHostProxy::removeTile(WebLayerID layerID, int tileID)
m_tileToNodeTile.remove(tileID);
}
-void LayerTreeHostProxy::updateTile(WebLayerID layerID, int tileID, const IntRect& sourceRect, const IntRect& targetRect, const QImage& image)
+void LayerTreeHostProxy::updateTile(WebLayerID layerID, int tileID, const IntRect& sourceRect, const IntRect& targetRect, ShareableBitmap* bitmap)
{
ensureLayer(layerID);
TextureMapperNode* node = toTextureMapperNode(layerByID(layerID));
@@ -377,15 +387,16 @@ void LayerTreeHostProxy::updateTile(WebLayerID layerID, int tileID, const IntRec
if (!nodeTileID)
return;
- QImage imageRef(image);
node->setTextureMapper(m_textureMapper.get());
- node->setContentsTileBackBuffer(nodeTileID, sourceRect, targetRect, imageRef.bits(), BitmapTexture::BGRAFormat);
+ QImage image = bitmap->createQImage();
+ node->setContentsTileBackBuffer(nodeTileID, sourceRect, targetRect, image.constBits());
}
-void LayerTreeHostProxy::createImage(int64_t imageID, const QImage& image)
+void LayerTreeHostProxy::createImage(int64_t imageID, ShareableBitmap* bitmap)
{
TiledImage tiledImage;
static const int TileDimension = 1024;
+ QImage image = bitmap->createQImage();
bool imageHasAlpha = image.hasAlphaChannel();
IntRect imageRect(0, 0, image.width(), image.height());
for (int y = 0; y < image.height(); y += TileDimension) {
@@ -399,13 +410,12 @@ void LayerTreeHostProxy::createImage(int64_t imageID, const QImage& image)
subImage = image.copy(rect);
RefPtr<BitmapTexture> texture = m_textureMapper->createTexture();
texture->reset(rect.size(), !imageHasAlpha);
- texture->updateContents(imageHasAlpha ? BitmapTexture::BGRAFormat : BitmapTexture::BGRFormat, IntRect(IntPoint::zero(), rect.size()), subImage.bits());
+ texture->updateRawContents(IntRect(IntPoint::zero(), rect.size()), subImage.constBits());
tiledImage.add(rect.location(), texture);
}
}
- m_directlyCompositedImages.remove(imageID);
- m_directlyCompositedImages.add(imageID, tiledImage);
+ m_directlyCompositedImages.set(imageID, tiledImage);
}
void LayerTreeHostProxy::destroyImage(int64_t imageID)
@@ -447,6 +457,8 @@ void LayerTreeHostProxy::assignImageToLayer(GraphicsLayer* layer, int64_t imageI
void LayerTreeHostProxy::flushLayerChanges()
{
m_rootLayer->syncCompositingState(FloatRect());
+ // The pending tiles state is on its way for the screen, tell the web process to render the next one.
+ m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::RenderNextFrame(), m_drawingAreaProxy->page()->pageID());
}
void LayerTreeHostProxy::ensureRootLayer()
@@ -504,18 +516,18 @@ void LayerTreeHostProxy::syncRemoteContent()
case LayerTreeMessageToRenderer::UpdateTile: {
const UpdateTileMessageData& data = static_cast<UpdateTileMessage*>(nextMessage.get())->data();
- updateTile(data.layerID, data.remoteTileID, data.sourceRect, data.targetRect, data.image);
+ updateTile(data.layerID, data.remoteTileID, data.sourceRect, data.targetRect, data.bitmap.get());
break;
}
case LayerTreeMessageToRenderer::CreateImage: {
const CreateImageMessageData& data = static_cast<CreateImageMessage*>(nextMessage.get())->data();
- createImage(data.imageID, data.image);
+ createImage(data.imageID, data.bitmap.get());
break;
}
case LayerTreeMessageToRenderer::DestroyImage: {
- const CreateImageMessageData& data = static_cast<CreateImageMessage*>(nextMessage.get())->data();
+ const DestroyImageMessageData& data = static_cast<DestroyImageMessage*>(nextMessage.get())->data();
destroyImage(data.imageID);
break;
}
@@ -548,8 +560,7 @@ void LayerTreeHostProxy::updateTileForLayer(int layerID, int tileID, const WebKi
UpdateTileMessageData data;
data.layerID = layerID;
data.remoteTileID = tileID;
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle);
- data.image = bitmap->createQImage().copy();
+ data.bitmap = ShareableBitmap::create(updateInfo.bitmapHandle);
data.sourceRect = IntRect(IntPoint::zero(), updateInfo.updateRectBounds.size());
data.targetRect = updateInfo.updateRectBounds;
pushUpdateToQueue(UpdateTileMessage::create(data));
@@ -587,7 +598,6 @@ void LayerTreeHostProxy::syncCompositingLayerState(const WebLayerInfo& info)
void LayerTreeHostProxy::didRenderFrame()
{
- m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::RenderNextFrame(), m_drawingAreaProxy->page()->pageID());
pushUpdateToQueue(FlushLayerChangesMessage::create());
updateViewport();
}
@@ -595,9 +605,8 @@ void LayerTreeHostProxy::didRenderFrame()
void LayerTreeHostProxy::createDirectlyCompositedImage(int64_t key, const WebKit::ShareableBitmap::Handle& handle)
{
CreateImageMessageData data;
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle);
data.imageID = key;
- data.image = bitmap->createQImage().copy();
+ data.bitmap = ShareableBitmap::create(handle);
pushUpdateToQueue(CreateImageMessage::create(data));
}
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
index 32de21af7..f7e2b8514 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
@@ -69,6 +69,64 @@ private:
QString m_defaultValue;
};
+class AuthenticationDialogContextObject : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString hostname READ hostname CONSTANT)
+ Q_PROPERTY(QString realm READ realm CONSTANT)
+ Q_PROPERTY(QString prefilledUsername READ prefilledUsername CONSTANT)
+
+public:
+ AuthenticationDialogContextObject(const QString& hostname, const QString& realm, const QString& prefilledUsername)
+ : QObject()
+ , m_hostname(hostname)
+ , m_realm(realm)
+ , m_prefilledUsername(prefilledUsername)
+ {
+ }
+
+ QString hostname() const { return m_hostname; }
+ QString realm() const { return m_realm; }
+ QString prefilledUsername() const { return m_prefilledUsername; }
+
+public slots:
+ void accept(const QString& username, const QString& password) { emit accepted(username, password); }
+ void reject() { emit rejected(); }
+
+signals:
+ void accepted(const QString& username, const QString& password);
+ void rejected();
+
+private:
+ QString m_hostname;
+ QString m_realm;
+ QString m_prefilledUsername;
+};
+
+class CertificateVerificationDialogContextObject : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString hostname READ hostname CONSTANT)
+
+public:
+ CertificateVerificationDialogContextObject(const QString& hostname)
+ : QObject()
+ , m_hostname(hostname)
+ {
+ }
+
+ QString hostname() const { return m_hostname; }
+
+public slots:
+ void accept() { emit accepted(); }
+ void reject() { emit rejected(); }
+
+signals:
+ void accepted();
+ void rejected();
+
+private:
+ QString m_hostname;
+};
+
bool QtDialogRunner::initForAlert(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& message)
{
DialogContextObject* contextObject = new DialogContextObject(message);
@@ -103,6 +161,32 @@ bool QtDialogRunner::initForPrompt(QDeclarativeComponent* component, QQuickItem*
return true;
}
+bool QtDialogRunner::initForAuthentication(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& hostname, const QString& realm, const QString& prefilledUsername)
+{
+ AuthenticationDialogContextObject* contextObject = new AuthenticationDialogContextObject(hostname, realm, prefilledUsername);
+ if (!createDialog(component, dialogParent, contextObject))
+ return false;
+
+ connect(contextObject, SIGNAL(accepted(QString, QString)), SLOT(onAuthenticationAccepted(QString, QString)));
+ connect(contextObject, SIGNAL(accepted(QString, QString)), SLOT(quit()));
+ connect(contextObject, SIGNAL(rejected()), SLOT(quit()));
+
+ return true;
+}
+
+bool QtDialogRunner::initForCertificateVerification(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& hostname)
+{
+ CertificateVerificationDialogContextObject* contextObject = new CertificateVerificationDialogContextObject(hostname);
+ if (!createDialog(component, dialogParent, contextObject))
+ return false;
+
+ connect(contextObject, SIGNAL(accepted()), SLOT(onAccepted()));
+ connect(contextObject, SIGNAL(accepted()), SLOT(quit()));
+ connect(contextObject, SIGNAL(rejected()), SLOT(quit()));
+
+ return true;
+}
+
bool QtDialogRunner::createDialog(QDeclarativeComponent* component, QQuickItem* dialogParent, QObject* contextObject)
{
QDeclarativeContext* baseContext = component->creationContext();
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
index bfa530264..96dcea27f 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
@@ -38,12 +38,17 @@ public:
bool initForAlert(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& message);
bool initForConfirm(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& message);
bool initForPrompt(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& message, const QString& defaultValue);
+ bool initForAuthentication(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& hostname, const QString& realm, const QString& prefilledUsername);
+ bool initForCertificateVerification(QDeclarativeComponent*, QQuickItem*, const QString& hostname);
QQuickItem* dialog() const { return m_dialog.get(); }
bool wasAccepted() const { return m_wasAccepted; }
QString result() const { return m_result; }
+ QString username() const { return m_username; }
+ QString password() const { return m_password; }
+
public slots:
void onAccepted(const QString& result = QString())
{
@@ -51,6 +56,12 @@ public slots:
m_result = result;
}
+ void onAuthenticationAccepted(const QString& username, const QString& password)
+ {
+ m_username = username;
+ m_password = password;
+ }
+
private:
bool createDialog(QDeclarativeComponent*, QQuickItem* dialogParent, QObject* contextObject);
@@ -58,6 +69,9 @@ private:
OwnPtr<QQuickItem> m_dialog;
QString m_result;
bool m_wasAccepted;
+
+ QString m_username;
+ QString m_password;
};
#endif // QtDialogRunner_h
diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
index cc96876be..cdc863b61 100644
--- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
@@ -62,7 +62,7 @@ PassOwnPtr<DrawingAreaProxy> QtPageClient::createDrawingAreaProxy()
void QtPageClient::setViewNeedsDisplay(const WebCore::IntRect& rect)
{
- m_webView->page()->update();
+ QQuickWebViewPrivate::get(m_webView)->setNeedsDisplay();
}
void QtPageClient::pageDidRequestScroll(const IntPoint& pos)
@@ -100,11 +100,27 @@ void QtPageClient::handleDownloadRequest(DownloadProxy* download)
QQuickWebViewPrivate::get(m_webView)->handleDownloadRequest(download);
}
-void QtPageClient::handleApplicationSchemeRequest(PassRefPtr<QtNetworkRequestData> requestData)
+void QtPageClient::handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData> requestData)
{
if (!m_webView || !m_webView->experimental())
return;
- m_webView->experimental()->invokeApplicationSchemeHandler(requestData.get());
+ m_webView->experimental()->invokeApplicationSchemeHandler(requestData);
+}
+
+void QtPageClient::handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
+{
+ QString qUsername;
+ QString qPassword;
+
+ QQuickWebViewPrivate::get(m_webView)->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, qUsername, qPassword);
+
+ username = qUsername;
+ password = qPassword;
+}
+
+void QtPageClient::handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors)
+{
+ ignoreErrors = QQuickWebViewPrivate::get(m_webView)->handleCertificateVerificationRequest(hostname);
}
void QtPageClient::setCursor(const WebCore::Cursor& cursor)
@@ -184,12 +200,6 @@ void QtPageClient::didFindZoomableArea(const IntPoint& target, const IntRect& ar
m_eventHandler->didFindZoomableArea(target, area);
}
-void QtPageClient::focusEditableArea(const IntRect& caret, const IntRect& area)
-{
- ASSERT(m_eventHandler);
- m_eventHandler->focusEditableArea(caret, area);
-}
-
void QtPageClient::didReceiveMessageFromNavigatorQtObject(const String& message)
{
QQuickWebViewPrivate::get(m_webView)->didReceiveMessageFromNavigatorQtObject(message);
diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h
index 7715026f8..43050f502 100644
--- a/Source/WebKit2/UIProcess/qt/QtPageClient.h
+++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h
@@ -53,7 +53,9 @@ public:
virtual void didRelaunchProcess();
virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
virtual void handleDownloadRequest(DownloadProxy*);
- virtual void handleApplicationSchemeRequest(PassRefPtr<QtNetworkRequestData>);
+ virtual void handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData>);
+ virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
+ virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors);
virtual void displayView();
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
@@ -92,7 +94,6 @@ public:
virtual void findStringInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { }
virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { }
virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
- virtual void focusEditableArea(const WebCore::IntRect&, const WebCore::IntRect&);
virtual void updateTextInputState();
virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled);
virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
diff --git a/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp b/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp
index 2ed773c11..7032220d5 100644
--- a/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp
@@ -35,7 +35,6 @@ QtTapGestureRecognizer::QtTapGestureRecognizer(QtWebPageEventHandler* eventHandl
: QtGestureRecognizer(eventHandler)
, m_tapState(NoTap)
{
- reset();
}
bool QtTapGestureRecognizer::recognize(const QTouchEvent* event, qint64 eventTimestampMillis)
@@ -68,6 +67,11 @@ bool QtTapGestureRecognizer::recognize(const QTouchEvent* event, qint64 eventTim
} else
m_tapState = SingleTapStarted;
m_touchBeginEventForTap = adoptPtr(new QTouchEvent(*event));
+
+ if (m_tapState == SingleTapStarted) {
+ const QTouchEvent::TouchPoint& touchPoint = event->touchPoints().first();
+ m_eventHandler->handlePotentialSingleTapEvent(touchPoint);
+ }
break;
case QEvent::TouchUpdate:
// If the touch point moves further than the threshold, we cancel the tap gesture.
@@ -82,6 +86,7 @@ bool QtTapGestureRecognizer::recognize(const QTouchEvent* event, qint64 eventTim
break;
case QEvent::TouchEnd:
m_tapAndHoldTimer.stop();
+ m_eventHandler->handlePotentialSingleTapEvent(QTouchEvent::TouchPoint());
switch (m_tapState) {
case DoubleTapCandidate:
@@ -111,6 +116,7 @@ bool QtTapGestureRecognizer::recognize(const QTouchEvent* event, qint64 eventTim
default:
break;
}
+
return false;
}
@@ -140,6 +146,8 @@ void QtTapGestureRecognizer::tapAndHoldTimeout()
void QtTapGestureRecognizer::reset()
{
+ m_eventHandler->handlePotentialSingleTapEvent(QTouchEvent::TouchPoint());
+
m_tapState = NoTap;
m_touchBeginEventForTap.clear();
m_tapAndHoldTimer.stop();
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
index d12eb0bbd..d2eb1566d 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
@@ -173,6 +173,9 @@ qreal QtViewportInteractionEngine::outerBoundedCSSScale(qreal cssScale)
void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect)
{
+ if (itemRect.isEmpty())
+ return;
+
ViewportUpdateDeferrer guard(this);
qreal itemScale = m_viewport->width() / itemRect.width();
@@ -302,6 +305,8 @@ void QtViewportInteractionEngine::wheelEvent(QWheelEvent* ev)
QRectF endPosRange = computePosRangeForItemAtScale(m_content->contentScale());
m_content->setPos(-boundPosition(endPosRange.topLeft(), newPos, endPosRange.bottomRight()));
+
+ emit visibleContentRectAndScaleChanged();
}
void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition)
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
index 1790c72ed..a4b699030 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
@@ -106,6 +106,7 @@ Q_SIGNALS:
void contentResumeRequested();
void viewportTrajectoryVectorChanged(const QPointF&);
+ void visibleContentRectAndScaleChanged();
private Q_SLOTS:
// Respond to changes of content that are not driven by us, like the page resizing itself.
diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
index 29a547ba9..df27961b5 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
@@ -69,7 +69,7 @@ PassRefPtr<QtWebContext> QtWebContext::defaultContext()
if (s_defaultContext)
return PassRefPtr<QtWebContext>(s_defaultContext);
- RefPtr<WebContext> context = WebContext::create(String());
+ RefPtr<WebContext> context = WebContext::sharedProcessContext();
RefPtr<QtWebContext> defaultContext = QtWebContext::create(context.get());
s_defaultContext = defaultContext.get();
defaultContext->initialize();
diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
index 8b09b20f3..19ba336ae 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
@@ -53,11 +53,12 @@ QtWebIconDatabaseClient::QtWebIconDatabaseClient(QtWebContext *qtWebContext)
iconDatabaseClient.version = kWKIconDatabaseClientCurrentVersion;
iconDatabaseClient.clientInfo = this;
iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL;
- WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase), &iconDatabaseClient);
+ WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), &iconDatabaseClient);
}
QtWebIconDatabaseClient::~QtWebIconDatabaseClient()
{
+ WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0);
}
void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo)
diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
index e8d056248..b2c00a8ee 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
@@ -58,7 +58,7 @@ private:
unsigned iconURLHashForPageURL(const String&);
static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo);
uint64_t m_contextId;
- WebKit::WebIconDatabase* m_iconDatabase;
+ RefPtr<WebKit::WebIconDatabase> m_iconDatabase;
Mutex m_imageLock;
};
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index e5175201a..09f896021 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
@@ -26,6 +26,7 @@
#include "NativeWebWheelEvent.h"
#include "QtViewportInteractionEngine.h"
#include "qquickwebpage_p.h"
+#include "qquickwebview_p.h"
#include <QDrag>
#include <QGraphicsSceneMouseEvent>
#include <QGuiApplication>
@@ -84,20 +85,23 @@ static inline WebCore::DragOperation dropActionToDragOperation(Qt::DropActions a
return (DragOperation)result;
}
-QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage)
+QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView)
: m_webPageProxy(toImpl(pageRef))
, m_panGestureRecognizer(this)
, m_pinchGestureRecognizer(this)
, m_tapGestureRecognizer(this)
, m_webPage(qmlWebPage)
+ , m_webView(qmlWebView)
, m_previousClickButton(Qt::NoButton)
, m_clickCount(0)
, m_postponeTextInputStateChanged(false)
{
+ connect(qApp->inputPanel(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
}
QtWebPageEventHandler::~QtWebPageEventHandler()
{
+ disconnect(qApp->inputPanel(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
}
bool QtWebPageEventHandler::handleEvent(QEvent* ev)
@@ -282,6 +286,12 @@ bool QtWebPageEventHandler::handleDropEvent(QDropEvent* ev)
return accepted;
}
+void QtWebPageEventHandler::handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint& point)
+{
+ QTransform fromItemTransform = m_webPage->transformFromItem();
+ m_webPageProxy->handlePotentialActivation(fromItemTransform.map(point.pos()).toPoint());
+}
+
void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point)
{
m_postponeTextInputStateChanged = true;
@@ -429,6 +439,20 @@ static void setInputPanelVisible(bool visible)
qApp->inputPanel()->setVisible(visible);
}
+void QtWebPageEventHandler::inputPanelVisibleChanged()
+{
+ if (!m_interactionEngine)
+ return;
+
+ // We only respond to the input panel becoming visible.
+ if (!m_webView->hasFocus() || !qApp->inputPanel()->visible())
+ return;
+
+ const EditorState& editor = m_webPageProxy->editorState();
+ if (editor.isContentEditable)
+ m_interactionEngine->focusEditableArea(QRectF(editor.cursorRect), QRectF(editor.editorRect));
+}
+
void QtWebPageEventHandler::updateTextInputState()
{
if (m_postponeTextInputStateChanged)
@@ -436,6 +460,11 @@ void QtWebPageEventHandler::updateTextInputState()
const EditorState& editor = m_webPageProxy->editorState();
+ m_webView->setInputMethodHints(Qt::InputMethodHints(editor.inputMethodHints));
+
+ if (!m_webView->hasFocus())
+ return;
+
// Ignore input method requests not due to a tap gesture.
if (!editor.isContentEditable)
setInputPanelVisible(false);
@@ -448,7 +477,7 @@ void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, b
m_postponeTextInputStateChanged = false;
- if (!wasEventHandled)
+ if (!wasEventHandled || !m_webView->hasFocus())
return;
const EditorState& editor = m_webPageProxy->editorState();
@@ -517,14 +546,6 @@ void QtWebPageEventHandler::didFindZoomableArea(const IntPoint& target, const In
m_interactionEngine->zoomToAreaGestureEnded(QPointF(target), QRectF(area));
}
-void QtWebPageEventHandler::focusEditableArea(const IntRect& caret, const IntRect& area)
-{
- if (!m_interactionEngine)
- return;
-
- m_interactionEngine->focusEditableArea(QRectF(caret), QRectF(area));
-}
-
void QtWebPageEventHandler::startDrag(const WebCore::DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
QImage dragQImage;
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
index f5b7fb317..ebe95dd8d 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h
@@ -40,18 +40,18 @@ class QtWebPageEventHandler : public QObject {
Q_OBJECT
public:
- QtWebPageEventHandler(WKPageRef, QQuickWebPage*);
+ QtWebPageEventHandler(WKPageRef, QQuickWebPage*, QQuickWebView*);
~QtWebPageEventHandler();
bool handleEvent(QEvent*);
void setViewportInteractionEngine(QtViewportInteractionEngine*);
+ void handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint&);
void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area);
- void focusEditableArea(const WebCore::IntRect& caret, const WebCore::IntRect& area);
void updateTextInputState();
void doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled);
void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
@@ -68,6 +68,10 @@ protected:
QtPinchGestureRecognizer m_pinchGestureRecognizer;
QtTapGestureRecognizer m_tapGestureRecognizer;
QQuickWebPage* m_webPage;
+ QQuickWebView* m_webView;
+
+private slots:
+ void inputPanelVisibleChanged();
private:
bool handleKeyPressEvent(QKeyEvent*);
diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
index ac9fde418..bf86edce6 100644
--- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
@@ -87,17 +87,17 @@ void WebPageProxy::registerApplicationScheme(const String& scheme)
void WebPageProxy::resolveApplicationSchemeRequest(QtNetworkRequestData request)
{
- RefPtr<QtNetworkRequestData> requestData = adoptRef(new QtNetworkRequestData(request));
+ RefPtr<QtRefCountedNetworkRequestData> requestData = adoptRef(new QtRefCountedNetworkRequestData(request));
m_applicationSchemeRequests.add(requestData);
static_cast<QtPageClient*>(m_pageClient)->handleApplicationSchemeRequest(requestData);
}
void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply)
{
- RefPtr<QtNetworkRequestData> requestData = reply->networkRequestData();
+ RefPtr<QtRefCountedNetworkRequestData> requestData = reply->networkRequestData();
if (m_applicationSchemeRequests.contains(requestData)) {
- RefPtr<QtNetworkReplyData> replyData = reply->networkReplyData();
- process()->send(Messages::WebPage::ApplicationSchemeReply(*replyData), pageID());
+ RefPtr<QtRefCountedNetworkReplyData> replyData = reply->networkReplyData();
+ process()->send(Messages::WebPage::ApplicationSchemeReply(replyData->data()), pageID());
m_applicationSchemeRequests.remove(requestData);
}
}
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
index d32e0f817..a040ad4aa 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
@@ -34,6 +34,7 @@
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebCore/ScrollbarTheme.h>
#include <WebCore/BitmapInfo.h>
+#include <WebCore/HWndDC.h>
#include <WebCore/PlatformMouseEvent.h>
#include <windowsx.h>
@@ -808,7 +809,7 @@ void WebPopupMenuProxyWin::paint(const IntRect& damageRect, HDC hdc)
return;
if (!m_DC) {
- m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
+ m_DC = ::CreateCompatibleDC(HWndDC(m_popup));
if (!m_DC)
return;
}
@@ -848,12 +849,11 @@ void WebPopupMenuProxyWin::paint(const IntRect& damageRect, HDC hdc)
if (m_scrollbar)
m_scrollbar->paint(&context, damageRect);
- HDC localDC = hdc ? hdc : ::GetDC(m_popup);
- ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
+ HWndDC hWndDC;
+ HDC localDC = hdc ? hdc : hWndDC.setHWnd(m_popup);
- if (!hdc)
- ::ReleaseDC(m_popup, localDC);
+ ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
}
bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking)
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index d44e25560..c0e9f1729 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -32,11 +32,7 @@
#include "NativeWebKeyboardEvent.h"
#include "NativeWebMouseEvent.h"
#include "NativeWebWheelEvent.h"
-#include "RunLoop.h"
#include "WKAPICast.h"
-#if USE(CG)
-#include "WKCACFViewWindow.h"
-#endif
#include "WebContext.h"
#include "WebContextMenuProxyWin.h"
#include "WebEditCommandProxy.h"
@@ -48,19 +44,24 @@
#include <WebCore/Cursor.h>
#include <WebCore/DragSession.h>
#include <WebCore/Editor.h>
+#include <WebCore/FileSystem.h>
#include <WebCore/FloatRect.h>
-#if USE(CG)
-#include <WebCore/GraphicsContextCG.h>
-#endif
+#include <WebCore/HWndDC.h>
#include <WebCore/IntRect.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Region.h>
+#include <WebCore/RunLoop.h>
#include <WebCore/SoftLinking.h>
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebCore/WindowMessageBroadcaster.h>
#include <WebCore/WindowsTouch.h>
#include <wtf/text/WTFString.h>
+#if USE(CG)
+#include "WKCACFViewWindow.h"
+#include <WebCore/GraphicsContextCG.h>
+#endif
+
#if ENABLE(FULLSCREEN_API)
#include "WebFullScreenManagerProxy.h"
#include <WebCore/FullScreenController.h>
@@ -959,9 +960,8 @@ void WebView::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
void WebView::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
{
static HBRUSH brush = createBrush(WebPageProxy::backingStoreUpdatesFlashColor().rgb()).leakPtr();
- HDC dc = ::GetDC(m_window);
+ HWndDC dc(m_window);
flashRects(dc, updateRects.data(), updateRects.size(), brush);
- ::ReleaseDC(m_window, dc);
}
WebCore::IntSize WebView::viewSize()
@@ -1708,6 +1708,18 @@ HRESULT STDMETHODCALLTYPE WebView::DragLeave()
return S_OK;
}
+static bool maybeCreateSandboxExtensionFromDragData(const DragData& dragData, SandboxExtension::Handle& sandboxExtensionHandle)
+{
+ if (!dragData.containsFiles())
+ return false;
+
+ // Unlike on Mac, we allow multiple files and directories, since on Windows
+ // we have actions for those (open the first file, open a Windows Explorer window).
+
+ SandboxExtension::createHandle("\\", SandboxExtension::ReadOnly, sandboxExtensionHandle);
+ return true;
+}
+
HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
{
if (m_dropTargetHelper)
@@ -1720,6 +1732,9 @@ HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeySt
DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
SandboxExtension::Handle sandboxExtensionHandle;
+ bool createdExtension = maybeCreateSandboxExtensionFromDragData(data, sandboxExtensionHandle);
+ if (createdExtension)
+ m_page->process()->willAcquireUniversalFileReadSandboxExtension();
m_page->performDrag(&data, String(), sandboxExtensionHandle);
return S_OK;
}
diff --git a/Source/WebKit2/WebKit2.pri b/Source/WebKit2/WebKit2.pri
index f0dc33183..1fdcf2614 100644
--- a/Source/WebKit2/WebKit2.pri
+++ b/Source/WebKit2/WebKit2.pri
@@ -60,3 +60,8 @@ INCLUDEPATH += \
INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/Api
INCLUDEPATH += $$WEBKIT2_GENERATED_SOURCES_DIR
+
+linux-g++*: {
+ # -lrt is required for shm_open and shm_unlink.
+ LIBS += -lrt
+}
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index f851edc74..a4f5e3ac2 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -465,7 +465,6 @@
B63403F914910D57001070B5 /* APIObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63403F814910D57001070B5 /* APIObject.cpp */; };
B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = B878B613133428DC006888E9 /* CorrectionPanel.h */; };
B878B616133428DC006888E9 /* CorrectionPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = B878B614133428DC006888E9 /* CorrectionPanel.mm */; };
- BC0092F7115837A300E0AE2A /* RunLoopMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F5115837A300E0AE2A /* RunLoopMac.mm */; };
BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */; };
BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6010F4378D0058C15A /* WebChromeClient.h */; };
BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6210F4378D0058C15A /* WebContextMenuClient.h */; };
@@ -559,8 +558,6 @@
BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */; };
BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */; };
- BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E771141970C00A63B1E /* RunLoop.cpp */; };
- BC2E6E881141971500A63B1E /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E781141970C00A63B1E /* RunLoop.h */; };
BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; };
BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; };
BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3065C312592F8900E71278 /* WebProcessMac.mm */; };
@@ -1483,7 +1480,6 @@
B63403F814910D57001070B5 /* APIObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIObject.cpp; sourceTree = "<group>"; };
B878B613133428DC006888E9 /* CorrectionPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorrectionPanel.h; sourceTree = "<group>"; };
B878B614133428DC006888E9 /* CorrectionPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CorrectionPanel.mm; sourceTree = "<group>"; };
- BC0092F5115837A300E0AE2A /* RunLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RunLoopMac.mm; sourceTree = "<group>"; };
BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueMac.cpp; sourceTree = "<group>"; };
BC032D6010F4378D0058C15A /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; };
BC032D6210F4378D0058C15A /* WebContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuClient.h; sourceTree = "<group>"; };
@@ -1583,8 +1579,6 @@
BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SameDocumentNavigationType.h; sourceTree = "<group>"; };
BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypes.h; sourceTree = "<group>"; };
BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesCF.cpp; path = cf/WebPreferencesCF.cpp; sourceTree = "<group>"; };
- BC2E6E771141970C00A63B1E /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
- BC2E6E781141970C00A63B1E /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; };
BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; };
BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; };
BC3065C312592F8900E71278 /* WebProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessMac.mm; sourceTree = "<group>"; };
@@ -1930,6 +1924,8 @@
E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = WebProcess/mac/WebKit.icns; sourceTree = "<group>"; };
E134F01512EA5D11004EC58D /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; };
E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; };
+ E14E99F814D879B4001D221F /* PluginProcess.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginProcess.entitlements; sourceTree = "<group>"; };
+ E14E99F914D879C9001D221F /* add-entitlements.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "add-entitlements.sh"; sourceTree = "<group>"; };
E179FD9B134D38060015B883 /* ArgumentCodersMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCodersMac.h; sourceTree = "<group>"; };
E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArgumentCodersMac.mm; sourceTree = "<group>"; };
E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintInfo.cpp; sourceTree = "<group>"; };
@@ -2118,10 +2114,12 @@
isa = PBXGroup;
children = (
1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */,
+ E14E99F814D879B4001D221F /* PluginProcess.entitlements */,
1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */,
1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */,
1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */,
1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */,
+ E14E99F914D879C9001D221F /* add-entitlements.sh */,
);
path = mac;
sourceTree = "<group>";
@@ -2260,7 +2258,6 @@
1A24B5F011F531E800C38269 /* MachUtilities.cpp */,
1A24B5F111F531E800C38269 /* MachUtilities.h */,
C0E3AA481209E45000A49D01 /* ModuleMac.mm */,
- BC0092F5115837A300E0AE2A /* RunLoopMac.mm */,
1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */,
BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */,
);
@@ -3282,8 +3279,6 @@
C0E3AA451209E2BA00A49D01 /* Module.cpp */,
C0E3AA441209E2BA00A49D01 /* Module.h */,
BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */,
- BC2E6E771141970C00A63B1E /* RunLoop.cpp */,
- BC2E6E781141970C00A63B1E /* RunLoop.h */,
1A24BED3120894D100FBB059 /* SharedMemory.h */,
BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */,
BC2E6E7E1141970C00A63B1E /* WorkQueue.h */,
@@ -3848,7 +3843,6 @@
BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
BC597075116591D000551FCA /* ProcessModel.h in Headers */,
1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */,
- BC2E6E881141971500A63B1E /* RunLoop.h in Headers */,
BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,
1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */,
51D130541382EAC000351EDD /* SecItemRequestData.h in Headers */,
@@ -4229,6 +4223,7 @@
BCDE093813272496001259FB /* Resources */,
BCDE093A13272496001259FB /* Sources */,
BCDE093C13272496001259FB /* Copy Plug-in Process Shim */,
+ E14E99FA14D879DB001D221F /* Add Entitlements */,
);
buildRules = (
);
@@ -4406,6 +4401,21 @@
shellPath = /bin/sh;
shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n";
};
+ E14E99FA14D879DB001D221F /* Add Entitlements */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Add Entitlements";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "PluginProcess/mac/add-entitlements.sh";
+ showEnvVarsInLog = 0;
+ };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -4581,8 +4591,6 @@
1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */,
BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */,
BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */,
- BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */,
- BC0092F7115837A300E0AE2A /* RunLoopMac.mm in Sources */,
1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */,
51D130531382EAC000351EDD /* SecItemRequestData.cpp in Sources */,
51D130551382EAC000351EDD /* SecItemResponseData.cpp in Sources */,
diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp
index e43f7a4f7..2d96feeb7 100644
--- a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp
@@ -132,8 +132,8 @@ public:
void Download::start(WebPage* initiatingWebPage)
{
- ASSERT(m_downloadClient);
- ASSERT(m_resourceHandle);
+ ASSERT(!m_downloadClient);
+ ASSERT(!m_resourceHandle);
m_downloadClient = adoptPtr(new DownloadClient(this));
m_resourceHandle = ResourceHandle::create(0, m_request, m_downloadClient.get(), false, false);
didStart();
@@ -141,8 +141,8 @@ void Download::start(WebPage* initiatingWebPage)
void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* resourceHandle, const ResourceResponse&)
{
- ASSERT(m_downloadClient);
- ASSERT(m_resourceHandle);
+ ASSERT(!m_downloadClient);
+ ASSERT(!m_resourceHandle);
m_downloadClient = adoptPtr(new DownloadClient(this));
resourceHandle->setClient(m_downloadClient.get());
m_resourceHandle = resourceHandle;
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index d88281e1b..873931220 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -126,9 +126,9 @@ void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pa
toImpl(bundleRef)->removeAllUserContent(toImpl(pageGroupRef));
}
-void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
+void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef preference, bool enabled)
{
- toImpl(bundleRef)->overrideXSSAuditorEnabledForTestRunner(toImpl(pageGroupRef), enabled);
+ toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toImpl(preference)->string(), enabled);
}
void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
@@ -146,6 +146,11 @@ void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundleRef, WKBundlePageGroupR
toImpl(bundleRef)->setFrameFlatteningEnabled(toImpl(pageGroupRef), enabled);
}
+void WKBundleSetGeolocationPermission(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
+{
+ toImpl(bundleRef)->setGeoLocationPermission(toImpl(pageGroupRef), enabled);
+}
+
void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
{
toImpl(bundleRef)->setJavaScriptCanAccessClipboard(toImpl(pageGroupRef), enabled);
@@ -156,6 +161,11 @@ void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundleRef, WKBundlePageGroupR
toImpl(bundleRef)->setPrivateBrowsingEnabled(toImpl(pageGroupRef), enabled);
}
+void WKBundleSetPopupBlockingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
+{
+ toImpl(bundleRef)->setPopupBlockingEnabled(toImpl(pageGroupRef), enabled);
+}
+
void WKBundleSwitchNetworkLoaderToNewTestingSession(WKBundleRef bundleRef)
{
toImpl(bundleRef)->switchNetworkLoaderToNewTestingSession();
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index df729bff5..f2d5cb42a 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -47,6 +47,11 @@ bool WKBundleFrameIsMainFrame(WKBundleFrameRef frameRef)
return toImpl(frameRef)->isMainFrame();
}
+WKBundleFrameRef WKBundleFrameGetParentFrame(WKBundleFrameRef frameRef)
+{
+ return toAPI(toImpl(frameRef)->parentFrame());
+}
+
WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frameRef)
{
return toCopiedURLAPI(toImpl(frameRef)->url());
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index ce94badcb..8f2781a69 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -38,6 +38,7 @@ extern "C" {
WK_EXPORT WKTypeID WKBundleFrameGetTypeID();
WK_EXPORT bool WKBundleFrameIsMainFrame(WKBundleFrameRef frame);
+WK_EXPORT WKBundleFrameRef WKBundleFrameGetParentFrame(WKBundleFrameRef frame);
WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame);
WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 97347f2f9..3090c6e65 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -328,6 +328,11 @@ uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef pageRef)
return toImpl(pageRef)->renderTreeSize();
}
+void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold)
+{
+ toImpl(page)->setPaintedObjectsCounterThreshold(threshold);
+}
+
void WKBundlePageSetTracksRepaints(WKBundlePageRef pageRef, bool trackRepaints)
{
toImpl(pageRef)->setTracksRepaints(trackRepaints);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
index 73351b9fe..312331e77 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
@@ -55,6 +55,9 @@ WK_EXPORT void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint pos
WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
+// FIXME: This is temporary. Ultimately WebKit should choose the threshold itself.
+WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold);
+
WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints);
WK_EXPORT bool WKBundlePageIsTrackingRepaints(WKBundlePageRef page);
WK_EXPORT void WKBundlePageResetTrackedRepaints(WKBundlePageRef page);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index 95ca7ce7e..b371f56a5 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -64,12 +64,15 @@ WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundlePageGro
WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup);
// Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use.
-WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
+WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled);
+
WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
+WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
+WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle);
WK_EXPORT void WKBundleSetDatabaseQuota(WKBundleRef bundle, uint64_t);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index b87151e42..f40a24a2e 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -31,6 +31,7 @@
#include "InjectedBundleMessageKinds.h"
#include "InjectedBundleScriptWorld.h"
#include "InjectedBundleUserMessageCoders.h"
+#include "LayerTreeHost.h"
#include "WKAPICast.h"
#include "WKBundleAPICast.h"
#include "WebApplicationCacheManager.h"
@@ -46,6 +47,10 @@
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
#include <WebCore/GCController.h>
+#include <WebCore/GeolocationClient.h>
+#include <WebCore/GeolocationClientMock.h>
+#include <WebCore/GeolocationController.h>
+#include <WebCore/GeolocationPosition.h>
#include <WebCore/JSDOMWindow.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
@@ -113,10 +118,52 @@ void InjectedBundle::removeAllVisitedLinks()
PageGroup::removeAllVisitedLinks();
}
+void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* pageGroup, const String& preference, bool enabled)
+{
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
+
+ // FIXME: Need an explicit way to set "WebKitTabToLinksPreferenceKey" directly in WebPage.
+
+ // 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(WebKitJavaEnabled, JavaEnabled, javaEnabled) \
+ macro(WebKitJavaScriptEnabled, ScriptEnabled, javaScriptEnabled) \
+ macro(WebKitLoadSiteIconsKey, LoadsSiteIconsIgnoringImageLoadingSetting, loadsSiteIconsIgnoringImageLoadingPreference) \
+ macro(WebKitOfflineWebApplicationCacheEnabled, OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled) \
+ macro(WebKitPageCacheSupportsPluginsPreferenceKey, PageCacheSupportsPlugins, pageCacheSupportsPlugins) \
+ macro(WebKitPluginsEnabled, PluginsEnabled, pluginsEnabled) \
+ macro(WebKitUsesPageCachePreferenceKey, UsesPageCache, usesPageCache) \
+ macro(WebKitWebAudioEnabled, WebAudioEnabled, webAudioEnabled) \
+ macro(WebKitWebGLEnabled, WebGLEnabled, webGLEnabled) \
+ macro(WebKitXSSAuditorEnabled, XSSAuditorEnabled, xssAuditorEnabled)
+
+ if (preference == "WebKitAcceleratedCompositingEnabled")
+ enabled = enabled && LayerTreeHost::supportsAcceleratedCompositing();
+
+#define OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES(TestRunnerName, SettingsName, WebPreferencesName) \
+ if (preference == #TestRunnerName) { \
+ WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::WebPreferencesName##Key(), enabled); \
+ for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) \
+ (*iter)->settings()->set##SettingsName(enabled); \
+ return; \
+ }
+
+ FOR_EACH_OVERRIDE_BOOL_PREFERENCE(OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES)
+
+#if ENABLE(WEB_SOCKETS)
+ OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES(WebKitHixie76WebSocketProtocolEnabled, UseHixie76WebSocketProtocol, hixie76WebSocketProtocolEnabled)
+#endif
+
+#undef OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES
+#undef FOR_EACH_OVERRIDE_BOOL_PREFERENCE
+}
+
void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled)
{
// Override the preference for all future pages.
- WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(enabled);
+ WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::xssAuditorEnabledKey(), enabled);
// Change the setting for existing ones.
const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
@@ -145,6 +192,15 @@ void InjectedBundle::setFrameFlatteningEnabled(WebPageGroupProxy* pageGroup, boo
(*iter)->settings()->setFrameFlatteningEnabled(enabled);
}
+void InjectedBundle::setGeoLocationPermission(WebPageGroupProxy* pageGroup, bool enabled)
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
+ for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
+ static_cast<GeolocationClientMock*>((*iter)->geolocationController()->client())->setPermission(enabled);
+#endif
+}
+
void InjectedBundle::setJavaScriptCanAccessClipboard(WebPageGroupProxy* pageGroup, bool enabled)
{
const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
@@ -159,6 +215,14 @@ void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, boo
(*iter)->settings()->setPrivateBrowsingEnabled(enabled);
}
+void InjectedBundle::setPopupBlockingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
+{
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
+ HashSet<Page*>::const_iterator end = pages.end();
+ for (HashSet<Page*>::const_iterator iter = pages.begin(); iter != end; ++iter)
+ (*iter)->settings()->setJavaScriptCanOpenWindowsAutomatically(!enabled);
+}
+
void InjectedBundle::switchNetworkLoaderToNewTestingSession()
{
#if USE(CFURLSTORAGESESSIONS)
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index 6ff2cfa8e..d7498dff4 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -97,12 +97,15 @@ public:
void setShouldTrackVisitedLinks(bool);
void removeAllVisitedLinks();
void activateMacFontAscentHack();
+ void overrideBoolPreferenceForTestRunner(WebPageGroupProxy*, const String& preference, bool enabled);
void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled);
void setAllowUniversalAccessFromFileURLs(WebPageGroupProxy*, bool);
void setAllowFileAccessFromFileURLs(WebPageGroupProxy*, bool);
void setFrameFlatteningEnabled(WebPageGroupProxy*, bool);
+ void setGeoLocationPermission(WebPageGroupProxy*, bool);
void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool);
void setPrivateBrowsingEnabled(WebPageGroupProxy*, bool);
+ void setPopupBlockingEnabled(WebPageGroupProxy*, bool);
void switchNetworkLoaderToNewTestingSession();
void setAuthorAndUserStylesEnabled(WebPageGroupProxy*, bool);
void addOriginAccessWhitelistEntry(const String&, const String&, const String&, bool);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
index 7a40ee6fb..428135481 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
@@ -86,10 +86,10 @@ PassRefPtr<InjectedBundleNavigationAction> InjectedBundleNavigationAction::creat
}
InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, const NavigationAction& navigationAction, PassRefPtr<FormState> prpFormState)
+ : m_navigationType(navigationAction.type())
+ , m_modifiers(modifiersForNavigationAction(navigationAction))
+ , m_mouseButton(WebMouseEvent::NoButton)
{
- m_navigationType = navigationAction.type();
- m_modifiers = modifiersForNavigationAction(navigationAction);
-
if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false));
m_mouseButton = mouseButtonForMouseEvent(mouseEvent);
diff --git a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
index 3eeaa5022..7d662f12d 100644
--- a/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
+++ b/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
@@ -32,8 +32,10 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/Notification.h>
+#include <WebCore/Page.h>
#include <WebCore/ScriptExecutionContext.h>
#include <WebCore/SecurityOrigin.h>
+#include <WebCore/Settings.h>
using namespace WebCore;
@@ -60,11 +62,14 @@ NotificationPermissionRequestManager::NotificationPermissionRequestManager(WebPa
void NotificationPermissionRequestManager::startRequest(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback)
{
#if ENABLE(NOTIFICATIONS)
+ if (permissionLevel(origin) != NotificationPresenter::PermissionNotAllowed)
+ return;
+
uint64_t requestID = generateRequestID();
m_originToIDMap.set(origin, requestID);
m_idToOriginMap.set(requestID, origin);
m_idToCallbackMap.set(requestID, callback);
- m_page->send(Messages::WebPageProxy::RequestNotificationPermission(requestID, origin->databaseIdentifier()));
+ m_page->send(Messages::WebPageProxy::RequestNotificationPermission(requestID, origin->toString()));
#else
UNUSED_PARAM(origin);
UNUSED_PARAM(callback);
@@ -88,11 +93,10 @@ void NotificationPermissionRequestManager::cancelRequest(SecurityOrigin* origin)
NotificationPresenter::Permission NotificationPermissionRequestManager::permissionLevel(SecurityOrigin* securityOrigin)
{
#if ENABLE(NOTIFICATIONS)
- uint64_t permissionLevel;
- WebProcess::shared().connection()->sendSync(Messages::WebNotificationManagerProxy::NotificationPermissionLevel(securityOrigin->databaseIdentifier()),
- Messages::WebNotificationManagerProxy::NotificationPermissionLevel::Reply(permissionLevel),
- 0);
- return static_cast<NotificationPresenter::Permission>(permissionLevel);
+ if (!m_page->corePage()->settings()->notificationsEnabled())
+ return NotificationPresenter::PermissionDenied;
+
+ return WebProcess::shared().notificationManager().policyForOrigin(securityOrigin);
#else
UNUSED_PARAM(securityOrigin);
return NotificationPresenter::PermissionDenied;
diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
index dfc30f5f3..0c865292d 100644
--- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
+++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
@@ -34,8 +34,10 @@
#include "WebNotificationManagerProxyMessages.h"
#include "WebPageProxyMessages.h"
#include <WebCore/Notification.h>
+#include <WebCore/Page.h>
#include <WebCore/ScriptExecutionContext.h>
#include <WebCore/SecurityOrigin.h>
+#include <WebCore/Settings.h>
#endif
using namespace WebCore;
@@ -64,17 +66,54 @@ void WebNotificationManager::didReceiveMessage(CoreIPC::Connection* connection,
didReceiveWebNotificationManagerMessage(connection, messageID, arguments);
}
+void WebNotificationManager::initialize(const HashMap<String, bool>& permissions)
+{
+#if ENABLE(NOTIFICATIONS)
+ m_permissionsMap = permissions;
+#endif
+}
+
+void WebNotificationManager::didUpdateNotificationDecision(const String& originString, bool allowed)
+{
+#if ENABLE(NOTIFICATIONS)
+ m_permissionsMap.set(originString, allowed);
+#endif
+}
+
+void WebNotificationManager::didRemoveNotificationDecisions(const Vector<String>& originStrings)
+{
+#if ENABLE(NOTIFICATIONS)
+ size_t count = originStrings.size();
+ for (size_t i = 0; i < count; ++i)
+ m_permissionsMap.remove(originStrings[i]);
+#endif
+}
+
+NotificationPresenter::Permission WebNotificationManager::policyForOrigin(WebCore::SecurityOrigin *origin) const
+{
+#if ENABLE(NOTIFICATIONS)
+ if (!origin)
+ return NotificationPresenter::PermissionNotAllowed;
+
+ HashMap<String, bool>::const_iterator it = m_permissionsMap.find(origin->toString());
+ if (it != m_permissionsMap.end())
+ return it->second ? NotificationPresenter::PermissionAllowed : NotificationPresenter::PermissionDenied;
+#endif
+
+ return NotificationPresenter::PermissionNotAllowed;
+}
+
bool WebNotificationManager::show(Notification* notification, WebPage* page)
{
#if ENABLE(NOTIFICATIONS)
- if (!notification)
+ if (!notification || !page->corePage()->settings()->notificationsEnabled())
return true;
uint64_t notificationID = generateNotificationID();
m_notificationMap.set(notification, notificationID);
m_notificationIDMap.set(notificationID, notification);
- m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->scriptExecutionContext()->securityOrigin()->databaseIdentifier(), notificationID), page->pageID());
+ m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
#endif
return true;
}
@@ -82,7 +121,7 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page)
void WebNotificationManager::cancel(Notification* notification, WebPage* page)
{
#if ENABLE(NOTIFICATIONS)
- if (!notification)
+ if (!notification || !page->corePage()->settings()->notificationsEnabled())
return;
uint64_t notificationID = m_notificationMap.get(notification);
diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h
index 3b32f0ade..61507394c 100644
--- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h
+++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h
@@ -27,10 +27,12 @@
#define WebNotificationManager_h
#include "MessageID.h"
+#include <WebCore/NotificationPresenter.h>
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
namespace CoreIPC {
class ArgumentDecoder;
@@ -39,6 +41,7 @@ class Connection;
namespace WebCore {
class Notification;
+class SecurityOrigin;
}
namespace WebKit {
@@ -52,12 +55,17 @@ public:
explicit WebNotificationManager(WebProcess*);
~WebNotificationManager();
+ void initialize(const HashMap<String, bool>& permissions);
+
bool show(WebCore::Notification*, WebPage*);
void cancel(WebCore::Notification*, WebPage*);
// This callback comes from WebCore, not messaged from the UI process.
void didDestroyNotification(WebCore::Notification*, WebPage*);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ // Looks in local cache for permission. If not found, returns DefaultDenied.
+ WebCore::NotificationPresenter::Permission policyForOrigin(WebCore::SecurityOrigin*) const;
private:
// Implemented in generated WebNotificationManagerMessageReceiver.cpp
@@ -66,6 +74,8 @@ private:
void didShowNotification(uint64_t notificationID);
void didClickNotification(uint64_t notificationID);
void didCloseNotifications(const Vector<uint64_t>& notificationIDs);
+ void didUpdateNotificationDecision(const String& originString, bool allowed);
+ void didRemoveNotificationDecisions(const Vector<String>& originStrings);
WebProcess* m_process;
@@ -75,6 +85,8 @@ private:
typedef HashMap<uint64_t, RefPtr<WebCore::Notification> > NotificationIDMap;
NotificationIDMap m_notificationIDMap;
+
+ HashMap<String, bool> m_permissionsMap;
#endif
};
diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.messages.in b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.messages.in
index 13d97ff7a..b88f26c9e 100644
--- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.messages.in
+++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.messages.in
@@ -24,4 +24,6 @@ messages -> WebNotificationManager {
DidShowNotification(uint64_t notificationID);
DidClickNotification(uint64_t notificationID);
DidCloseNotifications(Vector<uint64_t> notificationIDs);
+ DidUpdateNotificationDecision(WTF::String originString, bool allowed);
+ DidRemoveNotificationDecisions(Vector<WTF::String> originStrings);
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
index 5aadd13f4..b4657f95f 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp
@@ -163,7 +163,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu
}
if (value.isString()) {
- NPString npString = createNPString(value.toString(exec).utf8());
+ NPString npString = createNPString(value.toString(exec)->value(exec).utf8());
STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, variant);
return;
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h
index bef701bee..deffd5431 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h
@@ -26,9 +26,7 @@
#ifndef NPJSObjectWrapperMap_h
#define NPJSObjectWrapperMap_h
-
-#include "RunLoop.h"
-
+#include <WebCore/RunLoop.h>
#include <heap/Weak.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
@@ -98,7 +96,7 @@ private:
HashMap<JSC::JSObject*, NPJSObject*> m_npJSObjects;
HashMap<NPObject*, JSC::Weak<JSNPObject> > m_jsNPObjects;
Vector<NPObject*> m_npObjectsToFinalize;
- RunLoop::Timer<NPRuntimeObjectMap> m_finalizationTimer;
+ WebCore::RunLoop::Timer<NPRuntimeObjectMap> m_finalizationTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index a8a806e01..e09ada40a 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -408,6 +408,9 @@ static const unsigned WKNVSupportsCompositingCoreAnimationPluginsBool = 74656;
// Whether the browser expects a non-retained Core Animation layer.
static const unsigned WKNVExpectsNonretainedLayer = 74657;
+// Whether plug-in code is allowed to enter (arbitrary) sandbox for the process.
+static const unsigned WKNVAllowedToEnterSandbox = 74658;
+
// The Core Animation render server port.
static const unsigned WKNVCALayerRenderServerPort = 71879;
@@ -495,6 +498,10 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
break;
}
+ case WKNVAllowedToEnterSandbox:
+ *(NPBool*)value = true;
+ break;
+
#ifndef NP_NO_QUICKDRAW
case NPNVsupportsQuickDrawBool:
// We don't support the QuickDraw drawing model.
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 84541820c..adad2d015 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -28,10 +28,10 @@
#include "NetscapePluginModule.h"
#include "Plugin.h"
-#include "RunLoop.h"
#include <WebCore/AffineTransform.h>
#include <WebCore/GraphicsLayer.h>
#include <WebCore/IntRect.h>
+#include <WebCore/RunLoop.h>
#include <wtf/HashMap.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringHash.h>
@@ -291,7 +291,7 @@ private:
bool m_repeat;
TimerFunc m_timerFunc;
- RunLoop::Timer<Timer> m_timer;
+ WebCore::RunLoop::Timer<Timer> m_timer;
};
typedef HashMap<unsigned, Timer*> TimerMap;
TimerMap m_timers;
@@ -332,7 +332,7 @@ private:
// FIXME: It's a bit wasteful to have one null event timer per plug-in.
// We should investigate having one per window.
- RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
+ WebCore::RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
NP_CGContext m_npCGContext;
#endif
#elif PLUGIN_ARCHITECTURE(WIN)
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
index 23a83fe6d..5e496e306 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
@@ -28,6 +28,8 @@
#include "NetscapePlugin.h"
#include <utility>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
using namespace WebCore;
using namespace std;
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h
index de26827fc..05873e4f4 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h
@@ -26,8 +26,8 @@
#ifndef NetscapePluginStream_h
#define NetscapePluginStream_h
-#include "RunLoop.h"
#include <WebCore/FileSystem.h>
+#include <WebCore/RunLoop.h>
#include <WebCore/npruntime_internal.h>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
@@ -36,7 +36,7 @@
#include <wtf/text/CString.h>
namespace WebCore {
- class KURL;
+class KURL;
}
namespace WebKit {
@@ -103,7 +103,7 @@ private:
CString m_mimeType;
CString m_headers;
- RunLoop::Timer<NetscapePluginStream> m_deliveryDataTimer;
+ WebCore::RunLoop::Timer<NetscapePluginStream> m_deliveryDataTimer;
OwnPtr< Vector<uint8_t> > m_deliveryData;
bool m_stopStreamWhenDoneDelivering;
};
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h
index 9624ac954..cd6363a58 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h
@@ -29,13 +29,12 @@
#include "NPRuntimeObjectMap.h"
#include "Plugin.h"
#include "PluginController.h"
-#include "RunLoop.h"
#include "WebFrame.h"
-
#include <WebCore/MediaCanStartListener.h>
+#include <WebCore/PluginViewBase.h>
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceResponse.h>
-#include <WebCore/PluginViewBase.h>
+#include <WebCore/RunLoop.h>
#include <wtf/Deque.h>
// FIXME: Eventually this should move to WebCore.
@@ -180,7 +179,7 @@ private:
// Pending URLRequests that the plug-in has made.
Deque<RefPtr<URLRequest> > m_pendingURLRequests;
- RunLoop::Timer<PluginView> m_pendingURLRequestsTimer;
+ WebCore::RunLoop::Timer<PluginView> m_pendingURLRequestsTimer;
// Pending frame loads that the plug-in has made.
typedef HashMap<RefPtr<WebFrame>, RefPtr<URLRequest> > FrameLoadMap;
diff --git a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp
index 9a64add1c..5e7955d67 100644
--- a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp
+++ b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp
@@ -30,6 +30,8 @@
#include "WebConnectionMessageKinds.h"
#include "WebProcess.h"
+using namespace WebCore;
+
namespace WebKit {
PassRefPtr<WebConnectionToUIProcess> WebConnectionToUIProcess::create(WebProcess* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop)
diff --git a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h
index 1d9c96c80..42b9cd716 100644
--- a/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h
+++ b/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h
@@ -35,14 +35,14 @@ class WebProcess;
class WebConnectionToUIProcess : public WebConnection, CoreIPC::Connection::Client {
public:
- static PassRefPtr<WebConnectionToUIProcess> create(WebProcess*, CoreIPC::Connection::Identifier, RunLoop*);
+ static PassRefPtr<WebConnectionToUIProcess> create(WebProcess*, CoreIPC::Connection::Identifier, WebCore::RunLoop*);
CoreIPC::Connection* connection() { return m_connection.get(); }
void invalidate();
private:
- WebConnectionToUIProcess(WebProcess*, CoreIPC::Connection::Identifier, RunLoop*);
+ WebConnectionToUIProcess(WebProcess*, CoreIPC::Connection::Identifier, WebCore::RunLoop*);
// WebConnection
virtual void postMessage(const String&, APIObject*);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
index f0109fddb..913eb6e56 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
@@ -29,13 +29,8 @@
#include <WebCore/DragClient.h>
#if PLATFORM(MAC)
-#ifdef __OBJC__
-@class WKPasteboardFilePromiseOwner;
-@class WKPasteboardOwner;
-#else
-class WKPasteboardFilePromiseOwner;
-class WKPasteboardOwner;
-#endif
+OBJC_CLASS WKPasteboardFilePromiseOwner;
+OBJC_CLASS WKPasteboardOwner;
#endif
namespace WebKit {
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 1e3986475..f22b26074 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -185,11 +185,6 @@ void WebEditorClient::respondToChangedSelection(Frame* frame)
EditorState state = m_page->editorState();
-#if PLATFORM(QT)
- if (Element* scope = frame->selection()->rootEditableElement())
- m_page->send(Messages::WebPageProxy::FocusEditableArea(state.microFocus, scope->getRect()));
-#endif
-
m_page->send(Messages::WebPageProxy::EditorStateChanged(state));
#if PLATFORM(WIN)
@@ -200,9 +195,11 @@ void WebEditorClient::respondToChangedSelection(Frame* frame)
unsigned start;
unsigned end;
m_page->send(Messages::WebPageProxy::DidChangeCompositionSelection(frame->editor()->getCompositionSelection(start, end)));
+#elif PLATFORM(GTK)
+ setSelectionPrimaryClipboardIfNeeded(frame);
#endif
}
-
+
void WebEditorClient::didEndEditing()
{
DEFINE_STATIC_LOCAL(String, WebViewDidEndEditingNotification, ("WebViewDidEndEditingNotification"));
@@ -279,7 +276,7 @@ void WebEditorClient::redo()
m_page->sendSync(Messages::WebPageProxy::ExecuteUndoRedo(static_cast<uint32_t>(WebPageProxy::Redo)), Messages::WebPageProxy::ExecuteUndoRedo::Reply(result));
}
-#if !PLATFORM(GTK) && !PLATFORM(MAC)
+#if !PLATFORM(GTK) && !PLATFORM(MAC) && !PLATFORM(EFL)
void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
if (m_page->handleEditingKeyboardEvent(event))
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
index 666427598..8f262205b 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
@@ -121,6 +121,7 @@ private:
#if PLATFORM(GTK)
bool executePendingEditorCommands(WebCore::Frame*, Vector<WTF::String>, bool) OVERRIDE;
void getEditorCommandsForKeyEvent(const WebCore::KeyboardEvent*, Vector<WTF::String>&) OVERRIDE;
+ void setSelectionPrimaryClipboardIfNeeded(WebCore::Frame*) OVERRIDE;
#endif
TextCheckerClient* textChecker() OVERRIDE { return this; }
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 3d0e22205..5ddf23caa 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -552,6 +552,18 @@ void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
}
+void WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ RefPtr<APIObject> userData;
+
+ // Notify the UIProcess.
+ webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get())));
+}
+
void WebFrameLoaderClient::dispatchDidLayout()
{
WebPage* webPage = m_frame->page();
@@ -1372,6 +1384,11 @@ void WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*
return;
webPage->injectedBundleLoaderClient().didClearWindowObjectForFrame(webPage, m_frame, world);
+
+#if PLATFORM(GTK)
+ // Ensure the accessibility hierarchy is updated.
+ webPage->updateAccessibilityTree();
+#endif
}
void WebFrameLoaderClient::documentElementAvailable()
@@ -1439,12 +1456,6 @@ void WebFrameLoaderClient::didChangeScrollOffset()
PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext()
{
RefPtr<WebFrameNetworkingContext> context = WebFrameNetworkingContext::create(m_frame);
-#if PLATFORM(QT)
- // We encapsulate the WebPage pointer as a property of the originating QObject.
- QObject* originatingObject = context->originatingObject();
- ASSERT(originatingObject);
- originatingObject->setProperty("PagePointer", QVariant::fromValue(static_cast<void*>(m_frame->page())));
-#endif
return context.release();
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index fb783535e..a93ecee92 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -93,6 +93,7 @@ private:
virtual void dispatchDidFirstLayout() OVERRIDE;
virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE;
+ virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() OVERRIDE;
virtual void dispatchDidLayout() OVERRIDE;
virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
index 907d20c5c..14b86aea4 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
@@ -25,6 +25,7 @@
#include "Animation.h"
#include "BackingStore.h"
+#include "FloatQuad.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
@@ -41,8 +42,6 @@ using namespace WebKit;
namespace WebCore {
-static const float gTileDimension = 1024.0;
-
static HashMap<WebLayerID, WebGraphicsLayer*>& layerByIDMap()
{
static HashMap<WebLayerID, WebGraphicsLayer*> globalMap;
@@ -70,8 +69,18 @@ void WebGraphicsLayer::notifyChange()
client()->notifySyncRequired(this);
}
+void WebGraphicsLayer::notifyChangeRecursively()
+{
+ notifyChange();
+ for (size_t i = 0; i < children().size(); ++i)
+ toWebGraphicsLayer(children()[i])->notifyChangeRecursively();
+ if (replicaLayer())
+ toWebGraphicsLayer(replicaLayer())->notifyChange();
+}
+
WebGraphicsLayer::WebGraphicsLayer(GraphicsLayerClient* client)
: GraphicsLayer(client)
+ , m_maskTarget(0)
, m_needsDisplay(false)
, m_modified(true)
, m_contentNeedsDisplay(false)
@@ -107,7 +116,7 @@ bool WebGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children)
return false;
for (int i = 0; i < children.size(); ++i) {
WebGraphicsLayer* child = toWebGraphicsLayer(children[i]);
- child->setContentsScale(m_contentsScale);
+ child->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
child->notifyChange();
}
notifyChange();
@@ -117,7 +126,7 @@ bool WebGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children)
void WebGraphicsLayer::addChild(GraphicsLayer* layer)
{
GraphicsLayer::addChild(layer);
- toWebGraphicsLayer(layer)->setContentsScale(m_contentsScale);
+ toWebGraphicsLayer(layer)->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
toWebGraphicsLayer(layer)->notifyChange();
notifyChange();
}
@@ -125,7 +134,7 @@ void WebGraphicsLayer::addChild(GraphicsLayer* layer)
void WebGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index)
{
GraphicsLayer::addChildAtIndex(layer, index);
- toWebGraphicsLayer(layer)->setContentsScale(m_contentsScale);
+ toWebGraphicsLayer(layer)->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
toWebGraphicsLayer(layer)->notifyChange();
notifyChange();
}
@@ -133,7 +142,7 @@ void WebGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index)
void WebGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildAbove(layer, sibling);
- toWebGraphicsLayer(layer)->setContentsScale(m_contentsScale);
+ toWebGraphicsLayer(layer)->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
toWebGraphicsLayer(layer)->notifyChange();
notifyChange();
}
@@ -141,7 +150,7 @@ void WebGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* siblin
void WebGraphicsLayer::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling)
{
GraphicsLayer::addChildBelow(layer, sibling);
- toWebGraphicsLayer(layer)->setContentsScale(m_contentsScale);
+ toWebGraphicsLayer(layer)->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
toWebGraphicsLayer(layer)->notifyChange();
notifyChange();
}
@@ -153,7 +162,8 @@ bool WebGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newC
return false;
notifyChange();
toWebGraphicsLayer(oldChild)->notifyChange();
- toWebGraphicsLayer(newChild)->setContentsScale(m_contentsScale);
+ toWebGraphicsLayer(oldChild)->setLayerTreeTileClient(0);
+ toWebGraphicsLayer(newChild)->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
toWebGraphicsLayer(newChild)->notifyChange();
return true;
}
@@ -165,6 +175,7 @@ void WebGraphicsLayer::removeFromParent()
GraphicsLayer::removeFromParent();
notifyChange();
+ setLayerTreeTileClient(0);
}
void WebGraphicsLayer::setPosition(const FloatPoint& p)
@@ -173,7 +184,7 @@ void WebGraphicsLayer::setPosition(const FloatPoint& p)
return;
GraphicsLayer::setPosition(p);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
@@ -182,7 +193,7 @@ void WebGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
return;
GraphicsLayer::setAnchorPoint(p);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setSize(const FloatSize& size)
@@ -192,7 +203,9 @@ void WebGraphicsLayer::setSize(const FloatSize& size)
GraphicsLayer::setSize(size);
setNeedsDisplay();
- notifyChange();
+ if (maskLayer())
+ maskLayer()->setSize(size);
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setTransform(const TransformationMatrix& t)
@@ -201,7 +214,7 @@ void WebGraphicsLayer::setTransform(const TransformationMatrix& t)
return;
GraphicsLayer::setTransform(t);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setChildrenTransform(const TransformationMatrix& t)
@@ -210,7 +223,7 @@ void WebGraphicsLayer::setChildrenTransform(const TransformationMatrix& t)
return;
GraphicsLayer::setChildrenTransform(t);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setPreserves3D(bool b)
@@ -219,7 +232,7 @@ void WebGraphicsLayer::setPreserves3D(bool b)
return;
GraphicsLayer::setPreserves3D(b);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setMasksToBounds(bool b)
@@ -227,7 +240,7 @@ void WebGraphicsLayer::setMasksToBounds(bool b)
if (masksToBounds() == b)
return;
GraphicsLayer::setMasksToBounds(b);
- notifyChange();
+ notifyChangeRecursively();
}
void WebGraphicsLayer::setDrawsContent(bool b)
@@ -294,9 +307,11 @@ bool WebGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const In
webAnimation.animation = Animation::create(anim);
webAnimation.startTime = timeOffset;
m_layerInfo.animations.append(webAnimation);
+ if (valueList.property() == AnimatedPropertyWebkitTransform)
+ m_transformAnimations.add(keyframesName);
m_hasPendingAnimations = true;
- notifyChange();
+ notifyChangeRecursively();
return true;
}
@@ -317,6 +332,7 @@ void WebGraphicsLayer::removeAnimation(const String& animationName)
webAnimation.name = animationName;
webAnimation.operation = WebLayerAnimation::RemoveAnimation;
m_layerInfo.animations.append(webAnimation);
+ m_transformAnimations.remove(animationName);
notifyChange();
}
@@ -354,14 +370,32 @@ void WebGraphicsLayer::setContentsToImage(Image* image)
void WebGraphicsLayer::setMaskLayer(GraphicsLayer* layer)
{
+ if (layer == maskLayer())
+ return;
+
GraphicsLayer::setMaskLayer(layer);
+
+ if (!layer)
+ return;
+
+ layer->setSize(size());
+ WebGraphicsLayer* webGraphicsLayer = toWebGraphicsLayer(layer);
+ webGraphicsLayer->setLayerTreeTileClient(layerTreeTileClient());
+ webGraphicsLayer->setMaskTarget(this);
+ webGraphicsLayer->setVisibleContentRectAndScale(m_pageVisibleRect, m_contentsScale);
+ webGraphicsLayer->notifyChange();
notifyChange();
+
}
void WebGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
{
if (layer == replicaLayer())
return;
+
+ if (layer)
+ toWebGraphicsLayer(layer)->setLayerTreeTileClient(layerTreeTileClient());
+
GraphicsLayer::setReplicatedByLayer(layer);
notifyChange();
}
@@ -385,13 +419,16 @@ WebLayerID WebGraphicsLayer::id() const
void WebGraphicsLayer::syncCompositingState(const FloatRect& rect)
{
+ if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+ mask->syncCompositingStateForThisLayerOnly();
+
+ if (WebGraphicsLayer* replica = toWebGraphicsLayer(replicaLayer()))
+ replica->syncCompositingStateForThisLayerOnly();
+
+ syncCompositingStateForThisLayerOnly();
+
for (size_t i = 0; i < children().size(); ++i)
children()[i]->syncCompositingState(rect);
- if (replicaLayer())
- replicaLayer()->syncCompositingState(rect);
- if (maskLayer())
- maskLayer()->syncCompositingState(rect);
- syncCompositingStateForThisLayerOnly();
}
WebGraphicsLayer* toWebGraphicsLayer(GraphicsLayer* layer)
@@ -409,16 +446,14 @@ void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
if (!m_modified)
return;
+ computeTransformedVisibleRect();
m_layerInfo.name = name();
m_layerInfo.anchorPoint = anchorPoint();
m_layerInfo.backfaceVisible = backfaceVisibility();
m_layerInfo.childrenTransform = childrenTransform();
m_layerInfo.contentsOpaque = contentsOpaque();
m_layerInfo.contentsRect = contentsRect();
-
- // In the shadow layer tree we create in the UI process, layers with directly composited images are always considered to draw content.
- // Otherwise, we'd have to check whether an layer with drawsContent==false has a directly composited image multiple times.
- m_layerInfo.drawsContent = drawsContent() || m_image;
+ m_layerInfo.drawsContent = drawsContent();
m_layerInfo.mask = toWebLayerID(maskLayer());
m_layerInfo.masksToBounds = masksToBounds();
m_layerInfo.opacity = opacity();
@@ -452,24 +487,6 @@ void WebGraphicsLayer::tiledBackingStorePaintBegin()
{
}
-void WebGraphicsLayer::setContentsScale(float scale)
-{
- for (size_t i = 0; i < children().size(); ++i) {
- WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
- layer->setContentsScale(scale);
- }
-
- m_contentsScale = scale;
- if (m_mainBackingStore && m_mainBackingStore->contentsScale() == scale)
- return;
-
- notifyChange();
-
- m_previousBackingStore = m_mainBackingStore.release();
- m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
- m_mainBackingStore->setContentsScale(scale);
-}
-
void WebGraphicsLayer::setRootLayer(bool isRoot)
{
m_layerInfo.isRootLayer = isRoot;
@@ -481,11 +498,25 @@ void WebGraphicsLayer::setVisibleContentRectTrajectoryVector(const FloatPoint& t
m_mainBackingStore->setVisibleRectTrajectoryVector(trajectoryVector);
}
-void WebGraphicsLayer::setVisibleContentRect(const IntRect& rect)
+void WebGraphicsLayer::setVisibleContentRectAndScale(const IntRect& pageVisibleRect, float scale)
{
- m_visibleContentRect = rect;
- notifyChange();
- m_mainBackingStore->adjustVisibleRect();
+ if (m_pageVisibleRect == pageVisibleRect && m_contentsScale == scale)
+ return;
+
+ m_pageVisibleRect = pageVisibleRect;
+ m_contentsScale = scale;
+
+ if (!m_mainBackingStore || m_mainBackingStore->contentsScale() != scale) {
+ m_previousBackingStore = m_mainBackingStore.release();
+ m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
+ m_mainBackingStore->setContentsScale(scale);
+ } else
+ m_mainBackingStore->adjustVisibleRect();
+
+ if (maskLayer())
+ toWebGraphicsLayer(maskLayer())->setVisibleContentRectAndScale(pageVisibleRect, scale);
+ for (size_t i = 0; i < children().size(); ++i)
+ toWebGraphicsLayer(children()[i])->setVisibleContentRectAndScale(pageVisibleRect, scale);
}
void WebGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
@@ -511,14 +542,26 @@ bool WebGraphicsLayer::tiledBackingStoreUpdatesAllowed() const
IntRect WebGraphicsLayer::tiledBackingStoreContentsRect()
{
- if (m_image)
+ if (!drawsContent())
return IntRect();
return IntRect(0, 0, size().width(), size().height());
}
IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
{
- return m_visibleContentRect;
+ // If this layer is part of an active transform animation, the visible rect might change,
+ // so we rather render the whole layer until some better optimization is available.
+ if (selfOrAncestorHasActiveTransformAnimations())
+ return tiledBackingStoreContentsRect();
+
+ // Non-invertible layers are not visible.
+ if (!m_layerTransform.combined().isInvertible())
+ return IntRect();
+
+ // Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates).
+ // The resulting quad might be squewed and the visible rect is the bounding box of this quad,
+ // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier).
+ return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_pageVisibleRect)));
}
Color WebGraphicsLayer::tiledBackingStoreBackgroundColor() const
@@ -554,13 +597,23 @@ void WebGraphicsLayer::updateTileBuffersRecursively()
WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
layer->updateTileBuffersRecursively();
}
+
+ if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+ mask->updateTileBuffersRecursively();
}
WebLayerTreeTileClient* WebGraphicsLayer::layerTreeTileClient() const
{
if (m_layerTreeTileClient)
return m_layerTreeTileClient;
- WebGraphicsLayer* parent = toWebGraphicsLayer(this->parent());
+ WebGraphicsLayer* parent;
+ if (this->replicatedLayer())
+ parent = toWebGraphicsLayer(this->replicatedLayer());
+ else if (this->maskTarget())
+ parent = toWebGraphicsLayer(this->maskTarget());
+ else
+ parent = toWebGraphicsLayer(this->parent());
+
if (!parent)
return 0;
return parent->layerTreeTileClient();
@@ -589,6 +642,9 @@ void WebGraphicsLayer::purgeBackingStores()
layer->purgeBackingStores();
}
+ if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+ mask->purgeBackingStores();
+
if (m_mainBackingStore)
m_mainBackingStore.clear();
@@ -605,6 +661,8 @@ void WebGraphicsLayer::recreateBackingStoreIfNeeded()
WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
layer->recreateBackingStoreIfNeeded();
}
+ if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+ mask->recreateBackingStoreIfNeeded();
if (!m_mainBackingStore) {
m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
@@ -620,6 +678,10 @@ void WebGraphicsLayer::setLayerTreeTileClient(WebKit::WebLayerTreeTileClient* cl
if (m_layerTreeTileClient == client)
return;
+ if (WebGraphicsLayer* replica = toWebGraphicsLayer(replicaLayer()))
+ replica->setLayerTreeTileClient(client);
+ if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
+ mask->setLayerTreeTileClient(client);
for (size_t i = 0; i < children().size(); ++i) {
WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
layer->setLayerTreeTileClient(client);
@@ -630,6 +692,20 @@ void WebGraphicsLayer::setLayerTreeTileClient(WebKit::WebLayerTreeTileClient* cl
m_layerTreeTileClient->didDeleteLayer(id());
m_layerTreeTileClient = client;
}
+
+void WebGraphicsLayer::computeTransformedVisibleRect()
+{
+ // FIXME: Consider transform animations in the visible rect calculation.
+ m_layerTransform.setLocalTransform(transform());
+ m_layerTransform.setPosition(position());
+ m_layerTransform.setAnchorPoint(anchorPoint());
+ m_layerTransform.setSize(size());
+ m_layerTransform.setFlattening(!preserves3D());
+ m_layerTransform.setChildrenTransform(childrenTransform());
+ m_layerTransform.combineTransforms(parent() ? toWebGraphicsLayer(parent())->m_layerTransform.combinedForChildren() : TransformationMatrix());
+ // The combined transform will be used in tiledBackingStoreVisibleRect.
+ m_mainBackingStore->adjustVisibleRect();
+}
#endif
static PassOwnPtr<GraphicsLayer> createWebGraphicsLayer(GraphicsLayerClient* client)
@@ -642,5 +718,16 @@ void WebGraphicsLayer::initFactory()
GraphicsLayer::setGraphicsLayerFactory(createWebGraphicsLayer);
}
+bool WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations() const
+{
+ if (!m_transformAnimations.isEmpty())
+ return true;
+
+ if (parent())
+ return toWebGraphicsLayer(parent())->selfOrAncestorHasActiveTransformAnimations();
+
+ return false;
+}
+
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
index 361fcb286..0b50763b7 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
@@ -25,7 +25,7 @@
#include "GraphicsLayer.h"
#include "Image.h"
#include "IntSize.h"
-#include "RunLoop.h"
+#include "LayerTransform.h"
#include "ShareableBitmap.h"
#include "TiledBackingStore.h"
#include "TiledBackingStoreClient.h"
@@ -34,6 +34,8 @@
#include "UpdateInfo.h"
#include "WebLayerTreeInfo.h"
#include "WebProcess.h"
+#include <WebCore/RunLoop.h>
+#include <wtf/text/StringHash.h>
#if USE(ACCELERATED_COMPOSITING)
@@ -46,7 +48,7 @@ public:
virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&) = 0;
virtual void removeTile(WebLayerID, int tileID) = 0;
virtual bool layerTreeTileUpdatesAllowed() const = 0;
- virtual int64_t adoptImageBackingStore(Image*) = 0;
+ virtual int64_t adoptImageBackingStore(WebCore::Image*) = 0;
virtual void releaseImageBackingStore(int64_t) = 0;
virtual void didSyncCompositingStateForLayer(const WebLayerInfo&) = 0;
virtual void didDeleteLayer(WebLayerID) = 0;
@@ -94,7 +96,7 @@ public:
void setNeedsDisplay();
void setNeedsDisplayInRect(const FloatRect&);
void setContentsNeedsDisplay();
- void setVisibleContentRect(const IntRect&);
+ void setVisibleContentRectAndScale(const IntRect&, float scale);
void setVisibleContentRectTrajectoryVector(const FloatPoint&);
virtual void syncCompositingState(const FloatRect&);
virtual void syncCompositingStateForThisLayerOnly();
@@ -107,6 +109,9 @@ public:
Image* image() { return m_image.get(); }
void notifyAnimationStarted(double);
+ GraphicsLayer* maskTarget() const { return m_maskTarget; }
+ void setMaskTarget(GraphicsLayer* layer) { m_maskTarget = layer; }
+
static void initFactory();
#if USE(TILED_BACKING_STORE)
@@ -129,7 +134,6 @@ public:
bool isReadyForTileBufferSwap() const;
void updateTileBuffersRecursively();
- void setContentsScale(float);
void updateContentBuffers();
void purgeBackingStores();
void recreateBackingStoreIfNeeded();
@@ -137,10 +141,11 @@ public:
private:
WebKit::WebLayerInfo m_layerInfo;
- WebKit::WebLayerTreeTileClient* m_layerTileClient;
RefPtr<Image> m_image;
+ GraphicsLayer* m_maskTarget;
FloatRect m_needsDisplayRect;
- IntRect m_visibleContentRect;
+ IntRect m_pageVisibleRect;
+ LayerTransform m_layerTransform;
bool m_needsDisplay : 1;
bool m_modified : 1;
bool m_contentNeedsDisplay : 1;
@@ -148,8 +153,14 @@ private:
bool m_inUpdateMode : 2;
void notifyChange();
+ void notifyChangeRecursively();
+ HashSet<String> m_transformAnimations;
+
+ bool selfOrAncestorHasActiveTransformAnimations() const;
#if USE(TILED_BACKING_STORE)
+ void computeTransformedVisibleRect();
+
WebKit::WebLayerTreeTileClient* m_layerTreeTileClient;
OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore;
OwnPtr<WebCore::TiledBackingStore> m_previousBackingStore;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
index 964a395c9..f59e69700 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
@@ -25,7 +25,9 @@
#include "WebPage.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
+#include <WebCore/DataObjectGtk.h>
#include <WebCore/KeyboardEvent.h>
+#include <WebCore/PasteboardHelper.h>
#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -127,4 +129,38 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*)
notImplemented();
}
+#if PLATFORM(X11)
+static Frame* frameSettingClipboard;
+static void collapseSelection(GtkClipboard* clipboard, Frame* frame)
+{
+ if (frameSettingClipboard && frameSettingClipboard == frame)
+ return;
+
+ // Collapse the selection without clearing it.
+ ASSERT(frame);
+ frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
+}
+#endif
+
+void WebEditorClient::setSelectionPrimaryClipboardIfNeeded(Frame* frame)
+{
+#if PLATFORM(X11)
+ GtkClipboard* clipboard = PasteboardHelper::defaultPasteboardHelper()->getPrimarySelectionClipboard(frame);
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+
+ if (!frame->selection()->isRange())
+ return;
+
+ dataObject->clearAll();
+ dataObject->setRange(frame->selection()->toNormalizedRange());
+
+ frameSettingClipboard = frame;
+ GClosure* callback = g_cclosure_new(G_CALLBACK(collapseSelection), frame, 0);
+ g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID);
+ PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, PasteboardHelper::DoNotIncludeSmartPaste, callback);
+ frameSettingClipboard = 0;
+#endif
+}
+
+
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 29c4ac3ee..c40a68ab8 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -156,6 +156,7 @@ void InitWebCoreSystemInterface(void)
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
INIT(GetMacOSXVersionString);
+ INIT(ExecutableWasLinkedOnOrBeforeLion);
#endif
});
diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
index 7c93dae7f..19083d6ad 100644
--- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
@@ -28,6 +28,7 @@
#include "DataReference.h"
#include "WebCoreArgumentCoders.h"
+#include <wtf/text/WTFString.h>
namespace WebKit {
@@ -83,7 +84,43 @@ bool DecoderAdapter::decodeDouble(double& value)
bool DecoderAdapter::decodeString(String& value)
{
- return m_decoder.decode(value);
+ // This mimics the CoreIPC binary encoding of Strings prior to r88886.
+ // Whenever the CoreIPC binary encoding changes, we'll have to "undo" the changes here.
+ // FIXME: We shouldn't use the CoreIPC binary encoding format for history,
+ // and we should come up with a migration strategy so we can actually bump the version number
+ // without breaking encoding/decoding of the history tree.
+
+ uint32_t length;
+ if (!m_decoder.decode(length))
+ return false;
+
+ if (length == std::numeric_limits<uint32_t>::max()) {
+ // This is the null string.
+ value = String();
+ return true;
+ }
+
+ uint64_t lengthInBytes;
+ if (!m_decoder.decode(lengthInBytes))
+ return false;
+
+ if (lengthInBytes % sizeof(UChar) || lengthInBytes / sizeof(UChar) != length) {
+ m_decoder.markInvalid();
+ return false;
+ }
+
+ if (!m_decoder.bufferIsLargeEnoughToContain<UChar>(length)) {
+ m_decoder.markInvalid();
+ return false;
+ }
+
+ UChar* buffer;
+ String string = String::createUninitialized(length, buffer);
+ if (!m_decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar), __alignof(UChar)))
+ return false;
+
+ value = string;
+ return true;
}
}
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index e281d3652..3ad27e7af 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -68,7 +68,7 @@ DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParamete
, m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::displayTimerFired)
, m_exitCompositingTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
{
- if (webPage->corePage()->settings()->acceleratedDrawingEnabled())
+ if (webPage->corePage()->settings()->acceleratedDrawingEnabled() || webPage->corePage()->settings()->forceCompositingMode())
m_alwaysUseCompositing = true;
if (m_alwaysUseCompositing)
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index 0dabf603a..28c8ce68c 100644
--- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -28,8 +28,8 @@
#include "DrawingArea.h"
#include "LayerTreeHost.h"
-#include "RunLoop.h"
#include <WebCore/Region.h>
+#include <WebCore/RunLoop.h>
namespace WebCore {
class GraphicsContext;
@@ -131,8 +131,8 @@ private:
bool m_isPaintingSuspended;
bool m_alwaysUseCompositing;
- RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
- RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
+ WebCore::RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
+ WebCore::RunLoop::Timer<DrawingAreaImpl> m_exitCompositingTimer;
// The layer tree host that handles accelerated compositing.
RefPtr<LayerTreeHost> m_layerTreeHost;
diff --git a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
index 547b68d73..1f0e13c71 100644
--- a/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/EncoderAdapter.cpp
@@ -28,6 +28,7 @@
#include "DataReference.h"
#include "WebCoreArgumentCoders.h"
+#include <wtf/text/WTFString.h>
namespace WebKit {
@@ -83,7 +84,24 @@ void EncoderAdapter::encodeDouble(double value)
void EncoderAdapter::encodeString(const String& value)
{
- m_encoder->encode(value);
+ // This mimics the CoreIPC binary encoding of Strings prior to r88886.
+ // Whenever the CoreIPC binary encoding changes, we'll have to "undo" the changes here.
+ // FIXME: We shouldn't use the CoreIPC binary encoding format for history,
+ // and we should come up with a migration strategy so we can actually bump the version number
+ // without breaking encoding/decoding of the history tree.
+
+ // Special case the null string.
+ if (value.isNull()) {
+ m_encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
+ return;
+ }
+
+ uint32_t length = value.length();
+ m_encoder->encode(length);
+
+ uint64_t lengthInBytes = length * sizeof(UChar);
+ m_encoder->encode(lengthInBytes);
+ m_encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(value.characters()), length * sizeof(UChar), __alignof(UChar));
}
}
diff --git a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
index 1a91d8e3c..3c2e73eca 100644
--- a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
@@ -26,13 +26,13 @@
#include "config.h"
#include "EventDispatcher.h"
-#include "RunLoop.h"
#include "WebEvent.h"
#include "WebEventConversion.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/Page.h>
+#include <WebCore/RunLoop.h>
#include <wtf/MainThread.h>
#if ENABLE(THREADED_SCROLLING)
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 9bdd80bb9..10cfdfc83 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -111,10 +111,12 @@ void FindController::findString(const String& string, FindOptions options, unsig
shouldShowOverlay = options & FindOptionsShowOverlay;
if (shouldShowOverlay) {
+ bool shouldShowHighlight = options & FindOptionsShowHighlight;
+
if (maxMatchCount == numeric_limits<unsigned>::max())
--maxMatchCount;
- unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount + 1);
+ unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1);
// Check if we have more matches than allowed.
if (matchCount > maxMatchCount) {
diff --git a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in
index d2e9c384e..4ee1cc3b4 100644
--- a/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in
@@ -20,7 +20,6 @@
#if USE(TILED_BACKING_STORE)
messages -> LayerTreeHost {
- SetVisibleContentRectForLayer(int layerID, WebCore::IntRect visibleContentRect)
SetVisibleContentRectTrajectoryVector(WebCore::FloatPoint trajectoryVectory)
SetVisibleContentRectAndScale(WebCore::IntRect contentRect, float scale)
RenderNextFrame()
diff --git a/Source/WebKit2/WebProcess/WebPage/PageOverlay.h b/Source/WebKit2/WebProcess/WebPage/PageOverlay.h
index 1f61cebe9..949767806 100644
--- a/Source/WebKit2/WebProcess/WebPage/PageOverlay.h
+++ b/Source/WebKit2/WebProcess/WebPage/PageOverlay.h
@@ -27,7 +27,7 @@
#define PageOverlay_h
#include "APIObject.h"
-#include "RunLoop.h"
+#include <WebCore/RunLoop.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
@@ -86,7 +86,7 @@ private:
Client* m_client;
WebPage* m_webPage;
- RunLoop::Timer<PageOverlay> m_fadeAnimationTimer;
+ WebCore::RunLoop::Timer<PageOverlay> m_fadeAnimationTimer;
double m_fadeAnimationStartTime;
double m_fadeAnimationDuration;
diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp
new file mode 100644
index 000000000..725324703
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "TapHighlightController.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "ShareableBitmap.h"
+#include "WKPage.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
+#include <WebCore/FocusController.h>
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/GestureTapHighlighter.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+
+#include <WebCore/RenderObject.h>
+
+using namespace std;
+using namespace WebCore;
+
+namespace WebKit {
+
+TapHighlightController::TapHighlightController(WebPage* webPage)
+ : m_webPage(webPage)
+ , m_overlay(0)
+{
+}
+
+TapHighlightController::~TapHighlightController()
+{
+}
+
+void TapHighlightController::highlight(Node* node)
+{
+ ASSERT(node);
+
+ m_path = GestureTapHighlighter::pathForNodeHighlight(node);
+ m_color = node->renderer()->style()->tapHighlightColor();
+
+ if (!m_overlay) {
+ RefPtr<PageOverlay> overlay = PageOverlay::create(this);
+ m_overlay = overlay.get();
+ m_webPage->installPageOverlay(overlay.release());
+ } else
+ m_overlay->setNeedsDisplay();
+}
+
+void TapHighlightController::hideHighlight()
+{
+ if (m_overlay)
+ m_webPage->uninstallPageOverlay(m_overlay, /* fadeout */ true);
+}
+
+void TapHighlightController::pageOverlayDestroyed(PageOverlay*)
+{
+}
+
+void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage)
+{
+ if (webPage)
+ return;
+
+ // The page overlay is moving away from the web page, reset it.
+ ASSERT(m_overlay);
+ m_overlay = 0;
+}
+
+void TapHighlightController::didMoveToWebPage(PageOverlay*, WebPage*)
+{
+}
+
+static Color highlightColor(Color baseColor, float fractionFadedIn)
+{
+ return Color(baseColor.red(), baseColor.green(), baseColor.blue(), int(baseColor.alpha() * fractionFadedIn));
+}
+
+void TapHighlightController::drawRect(PageOverlay* pageOverlay, GraphicsContext& context, const IntRect& dirtyRect)
+{
+ if (m_path.isEmpty())
+ return;
+
+ float fractionFadedIn = pageOverlay->fractionFadedIn();
+
+ {
+ GraphicsContextStateSaver stateSaver(context);
+ context.setFillColor(highlightColor(m_color, fractionFadedIn), ColorSpaceSRGB);
+ context.fillPath(m_path);
+ }
+}
+
+bool TapHighlightController::mouseEvent(PageOverlay*, const WebMouseEvent&)
+{
+ return false;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(TOUCH_EVENTS)
diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h
new file mode 100644
index 000000000..cb20858c6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TapHighlightController_h
+#define TapHighlightController_h
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "PageOverlay.h"
+#include <WebCore/Color.h>
+#include <WebCore/Path.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class Frame;
+class IntRect;
+class Node;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class TapHighlightController : private PageOverlay::Client {
+ WTF_MAKE_NONCOPYABLE(TapHighlightController);
+
+public:
+ explicit TapHighlightController(WebPage*);
+ virtual ~TapHighlightController();
+
+ void highlight(WebCore::Node*);
+ void hideHighlight();
+
+private:
+ // PageOverlay::Client.
+ virtual void pageOverlayDestroyed(PageOverlay*);
+ virtual void willMoveToWebPage(PageOverlay*, WebPage*);
+ virtual void didMoveToWebPage(PageOverlay*, WebPage*);
+ virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&);
+ virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+
+private:
+ WebPage* m_webPage;
+ PageOverlay* m_overlay;
+
+ WebCore::Path m_path;
+ WebCore::Color m_color;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // TapHighlightController_h
diff --git a/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp b/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp
index 4140e7279..7cea0b426 100644
--- a/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp
@@ -88,6 +88,11 @@ Vector<IntRect> TiledBackingStoreRemoteTile::updateBackBuffer()
OwnPtr<GraphicsContext> graphicsContext(bitmap->createGraphicsContext());
graphicsContext->drawImageBuffer(m_localBuffer.get(), ColorSpaceDeviceRGB, IntPoint(0, 0));
+#if PLATFORM(QT)
+ // Qt uses BGRA interally, we swizzle to RGBA for OpenGL.
+ bitmap->swizzleRGB();
+#endif
+
UpdateInfo updateInfo;
updateInfo.updateRectBounds = m_rect;
updateInfo.updateScaleFactor = m_tiledBackingStore->contentsScale();
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index b32543eee..43f443829 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -357,6 +357,14 @@ String WebFrame::innerText() const
return m_coreFrame->document()->documentElement()->innerText();
}
+WebFrame* WebFrame::parentFrame() const
+{
+ if (!m_coreFrame || !m_coreFrame->ownerElement() || !m_coreFrame->ownerElement()->document())
+ return 0;
+
+ return static_cast<WebFrameLoaderClient*>(m_coreFrame->ownerElement()->document()->frame()->loader()->client())->webFrame();
+}
+
PassRefPtr<ImmutableArray> WebFrame::childFrames()
{
if (!m_coreFrame)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index 29ced42de..29536c27a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -86,6 +86,7 @@ public:
String url() const;
String innerText() const;
bool isFrameSet() const;
+ WebFrame* parentFrame() const;
PassRefPtr<ImmutableArray> childFrames();
JSValueRef computedStyleIncludingVisitedInfo(JSObjectRef element);
JSGlobalContextRef jsContext();
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 660f6f99c..3b9a487e4 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -40,7 +40,6 @@
#include "PluginProxy.h"
#include "PluginView.h"
#include "PrintInfo.h"
-#include "RunLoop.h"
#include "SessionState.h"
#include "ShareableBitmap.h"
#include "WebBackForwardList.h"
@@ -90,6 +89,7 @@
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/FrameView.h>
#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HTMLInputElement.h>
#include <WebCore/HistoryItem.h>
#include <WebCore/KeyboardEvent.h>
#include <WebCore/MouseEvent.h>
@@ -103,6 +103,7 @@
#include <WebCore/RenderView.h>
#include <WebCore/ReplaceSelectionCommand.h>
#include <WebCore/ResourceRequest.h>
+#include <WebCore/RunLoop.h>
#include <WebCore/SchemeRegistry.h>
#include <WebCore/ScriptValue.h>
#include <WebCore/SerializedScriptValue.h>
@@ -133,7 +134,9 @@
#endif
#if PLATFORM(GTK)
+#include <gtk/gtk.h>
#include "DataObjectGtk.h"
+#include "WebPrintOperationGtk.h"
#endif
#ifndef NDEBUG
@@ -188,9 +191,14 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_keyboardEventBeingInterpreted(0)
#elif PLATFORM(WIN)
, m_nativeWindow(parameters.nativeWindow)
+#elif PLATFORM(GTK)
+ , m_accessibilityObject(0)
#endif
, m_setCanStartMediaTimer(WebProcess::shared().runLoop(), this, &WebPage::setCanStartMediaTimerFired)
, m_findController(this)
+#if PLATFORM(QT)
+ , m_tapHighlightController(this)
+#endif
, m_geolocationPermissionRequestManager(this)
, m_pageID(pageID)
, m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
@@ -253,6 +261,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
setDrawsTransparentBackground(parameters.drawsTransparentBackground);
setPaginationMode(parameters.paginationMode);
+ setPaginationBehavesLikeColumns(parameters.paginationBehavesLikeColumns);
setPageLength(parameters.pageLength);
setGapBetweenPages(parameters.gapBetweenPages);
@@ -270,6 +279,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
restoreSession(parameters.sessionState);
m_drawingArea->setPaintingEnabled(true);
+
+ setMediaVolume(parameters.mediaVolume);
#ifndef NDEBUG
webPageCounter.increment();
@@ -398,6 +409,32 @@ EditorState WebPage::editorState() const
if (!scope)
return result;
+ if (scope->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(scope);
+ if (input->isTelephoneField())
+ result.inputMethodHints |= Qt::ImhDialableCharactersOnly;
+ else if (input->isNumberField())
+ result.inputMethodHints |= Qt::ImhDigitsOnly;
+ else if (input->isEmailField()) {
+ result.inputMethodHints |= Qt::ImhEmailCharactersOnly;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ } else if (input->isURLField()) {
+ result.inputMethodHints |= Qt::ImhUrlCharactersOnly;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ } else if (input->isPasswordField()) {
+ // Set ImhHiddenText flag for password fields. The Qt platform
+ // is responsible for determining which widget will receive input
+ // method events for password fields.
+ result.inputMethodHints |= Qt::ImhHiddenText;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ result.inputMethodHints |= Qt::ImhNoPredictiveText;
+ result.inputMethodHints |= Qt::ImhSensitiveData;
+ }
+ }
+
+ if (selectionRoot)
+ result.editorRect = frame->view()->contentsToWindow(selectionRoot->getRect());
+
RefPtr<Range> range;
if (result.hasComposition && (range = frame->editor()->compositionRange())) {
frame->editor()->getCompositionSelection(result.anchorPosition, result.cursorPosition);
@@ -415,7 +452,7 @@ EditorState WebPage::editorState() const
}
if (range)
- result.microFocus = frame->view()->contentsToWindow(frame->editor()->firstRectForRange(range.get()));
+ result.cursorRect = frame->view()->contentsToWindow(frame->editor()->firstRectForRange(range.get()));
// FIXME: We should only transfer innerText when it changes and do this on the UI side.
if (result.isContentEditable && !result.isInPasswordField) {
@@ -451,6 +488,13 @@ uint64_t WebPage::renderTreeSize() const
return size;
}
+void WebPage::setPaintedObjectsCounterThreshold(uint64_t threshold)
+{
+ if (!m_page)
+ return;
+ m_page->setRelevantRepaintedObjectsCounterThreshold(threshold);
+}
+
void WebPage::setTracksRepaints(bool trackRepaints)
{
if (FrameView* view = mainFrameView())
@@ -980,6 +1024,13 @@ void WebPage::setPaginationMode(uint32_t mode)
m_page->setPagination(pagination);
}
+void WebPage::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
+{
+ Page::Pagination pagination = m_page->pagination();
+ pagination.behavesLikeColumns = behavesLikeColumns;
+ m_page->setPagination(pagination);
+}
+
void WebPage::setPageLength(double pageLength)
{
Page::Pagination pagination = m_page->pagination();
@@ -1205,7 +1256,9 @@ static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page, bool o
case PlatformEvent::MouseReleased:
return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
case PlatformEvent::MouseMoved:
- return frame->eventHandler()->mouseMoved(platformMouseEvent, onlyUpdateScrollbars);
+ if (onlyUpdateScrollbars)
+ return frame->eventHandler()->passMouseMovedEventToScrollbars(platformMouseEvent);
+ return frame->eventHandler()->mouseMoved(platformMouseEvent);
default:
ASSERT_NOT_REACHED();
return false;
@@ -1391,6 +1444,27 @@ void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& session
}
#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(QT)
+void WebPage::highlightPotentialActivation(const IntPoint& point)
+{
+ Node* activationNode = 0;
+ Frame* mainframe = m_page->mainFrame();
+
+ if (point != IntPoint::zero()) {
+ HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), /*allowShadowContent*/ false, /*ignoreClipping*/ true);
+ activationNode = result.innerNode();
+
+ if (!activationNode->isFocusable())
+ activationNode = activationNode->enclosingLinkEventParentOrSelf();
+ }
+
+ if (activationNode)
+ tapHighlightController().highlight(activationNode);
+ else
+ tapHighlightController().hideHighlight();
+}
+#endif
+
static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page)
{
Frame* frame = page->mainFrame();
@@ -1811,11 +1885,21 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setCanvasUsesAcceleratedDrawing(store.getBoolValueForKey(WebPreferencesKey::canvasUsesAcceleratedDrawingKey()) && LayerTreeHost::supportsAcceleratedCompositing());
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
+ settings->setCSSCustomFilterEnabled(store.getBoolValueForKey(WebPreferencesKey::cssCustomFilterEnabledKey()));
settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
settings->setMediaPlaybackRequiresUserGesture(store.getBoolValueForKey(WebPreferencesKey::mediaPlaybackRequiresUserGestureKey()));
settings->setMediaPlaybackAllowsInline(store.getBoolValueForKey(WebPreferencesKey::mediaPlaybackAllowsInlineKey()));
settings->setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
+ // <rdar://problem/10697417>: It is necessary to force compositing when accelerate drawing
+ // is enabled on Mac so that scrollbars are always in their own layers.
+#if PLATFORM(MAC)
+ if (settings->acceleratedDrawingEnabled())
+ settings->setForceCompositingMode(LayerTreeHost::supportsAcceleratedCompositing());
+ else
+#endif
+ settings->setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()) && LayerTreeHost::supportsAcceleratedCompositing());
+
#if ENABLE(SQL_DATABASE)
AbstractDatabase::setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
#endif
@@ -1849,6 +1933,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setShouldDisplayTextDescriptions(store.getBoolValueForKey(WebPreferencesKey::shouldDisplayTextDescriptionsKey()));
#endif
+#if ENABLE(NOTIFICATIONS)
+ settings->setNotificationsEnabled(store.getBoolValueForKey(WebPreferencesKey::notificationsEnabledKey()));
+#endif
+
platformPreferencesDidChange(store);
}
@@ -2608,14 +2696,24 @@ void WebPage::beginPrinting(uint64_t frameID, const PrintInfo& printInfo)
if (!m_printContext)
m_printContext = adoptPtr(new PrintContext(coreFrame));
+ drawingArea()->setLayerTreeStateIsFrozen(true);
m_printContext->begin(printInfo.availablePaperWidth, printInfo.availablePaperHeight);
float fullPageHeight;
m_printContext->computePageRects(FloatRect(0, 0, printInfo.availablePaperWidth, printInfo.availablePaperHeight), 0, 0, printInfo.pageSetupScaleFactor, fullPageHeight, true);
+
+#if PLATFORM(GTK)
+ if (!m_printOperation)
+ m_printOperation = WebPrintOperationGtk::create(this, printInfo);
+#endif
}
void WebPage::endPrinting()
{
+ drawingArea()->setLayerTreeStateIsFrozen(false);
+#if PLATFORM(GTK)
+ m_printOperation = 0;
+#endif
m_printContext = nullptr;
}
@@ -2795,8 +2893,24 @@ void WebPage::drawPagesToPDF(uint64_t frameID, const PrintInfo& printInfo, uint3
send(Messages::WebPageProxy::DataCallback(CoreIPC::DataReference(CFDataGetBytePtr(pdfPageData.get()), CFDataGetLength(pdfPageData.get())), callbackID));
}
+#elif PLATFORM(GTK)
+void WebPage::drawPagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID)
+{
+ beginPrinting(frameID, printInfo);
+ if (m_printContext && m_printOperation) {
+ m_printOperation->startPrint(m_printContext.get(), callbackID);
+ return;
+ }
+
+ send(Messages::WebPageProxy::VoidCallback(callbackID));
+}
#endif
+void WebPage::setMediaVolume(float volume)
+{
+ m_page->setMediaVolume(volume);
+}
+
void WebPage::runModal()
{
if (m_isClosed)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index 40072cfbf..09eef272a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -41,6 +41,7 @@
#include "InjectedBundlePageResourceLoadClient.h"
#include "InjectedBundlePageUIClient.h"
#include "MessageSender.h"
+#include "TapHighlightController.h"
#include "Plugin.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
@@ -70,6 +71,8 @@
#if PLATFORM(GTK)
#include "ArgumentCodersGtk.h"
+#include "WebPageAccessibilityObject.h"
+#include "WebPrintOperationGtk.h"
#endif
#if ENABLE(TOUCH_EVENTS)
@@ -249,6 +252,7 @@ public:
String renderTreeExternalRepresentation() const;
uint64_t renderTreeSize() const;
+ void setPaintedObjectsCounterThreshold(uint64_t);
void setTracksRepaints(bool);
bool isTrackingRepaints() const;
@@ -275,6 +279,7 @@ public:
void setFixedLayoutSize(const WebCore::IntSize&);
void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
+ void setPaginationBehavesLikeColumns(bool);
void setPageLength(double);
void setGapBetweenPages(double);
@@ -315,6 +320,10 @@ public:
static const WebEvent* currentEvent();
FindController& findController() { return m_findController; }
+#if PLATFORM(QT)
+ TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
+#endif
+
GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
NotificationPermissionRequestManager* notificationPermissionRequestManager();
@@ -397,6 +406,9 @@ public:
void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
void gestureDidScroll(const WebCore::IntSize&);
void gestureDidEnd();
+
+#elif PLATFORM(GTK)
+ void updateAccessibilityTree();
#endif
void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
@@ -436,8 +448,12 @@ public:
#if PLATFORM(MAC) || PLATFORM(WIN)
void drawRectToPDF(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, uint64_t callbackID);
void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
+#elif PLATFORM(GTK)
+ void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
#endif
+ void setMediaVolume(float);
+
bool mainFrameHasCustomRepresentation() const;
void didChangeScrollOffsetForMainFrame();
@@ -538,6 +554,9 @@ private:
#if ENABLE(TOUCH_EVENTS)
void touchEvent(const WebTouchEvent&);
void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
+#if PLATFORM(QT)
+ void highlightPotentialActivation(const WebCore::IntPoint&);
+#endif
#endif
void contextMenuHidden() { m_isShowingContextMenu = false; }
@@ -596,9 +615,9 @@ private:
void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
void setTextForActivePopupMenu(int32_t index);
-#if PLATFORM(GTK)
+#if PLATFORM(GTK)
void failedToShowPopupMenu();
-#endif
+#endif
void didChooseFilesForOpenPanel(const Vector<String>&);
void didCancelForOpenPanel();
@@ -675,9 +694,11 @@ private:
HWND m_nativeWindow;
RefPtr<WebCore::Node> m_gestureTargetNode;
+#elif PLATFORM(GTK)
+ WebPageAccessibilityObject* m_accessibilityObject;
#endif
- RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
+ WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap;
@@ -700,6 +721,9 @@ private:
#endif
FindController m_findController;
+#if PLATFORM(QT)
+ TapHighlightController m_tapHighlightController;
+#endif
RefPtr<PageOverlay> m_pageOverlay;
RefPtr<WebPage> m_underlayPage;
@@ -717,6 +741,9 @@ private:
RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
OwnPtr<WebCore::PrintContext> m_printContext;
+#if PLATFORM(GTK)
+ RefPtr<WebPrintOperationGtk> m_printOperation;
+#endif
SandboxExtensionTracker m_sandboxExtensionTracker;
uint64_t m_pageID;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 5a3bb450e..415460137 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -40,6 +40,9 @@ messages -> WebPage {
#if ENABLE(TOUCH_EVENTS)
TouchEvent(WebKit::WebTouchEvent event)
TouchEventSyncForTesting(WebKit::WebTouchEvent event) -> (bool handled)
+#if PLATFORM(QT)
+ HighlightPotentialActivation(WebCore::IntPoint point)
+#endif
#endif
ContextMenuHidden()
@@ -123,6 +126,7 @@ messages -> WebPage {
SetFixedLayoutSize(WebCore::IntSize size)
SetPaginationMode(uint32_t mode);
+ SetPaginationBehavesLikeColumns(bool behavesLikeColumns);
SetPageLength(double pageLength);
SetGapBetweenPages(double gap);
@@ -187,6 +191,12 @@ messages -> WebPage {
DrawRectToPDF(uint64_t frameID, WebKit::PrintInfo printInfo, WebCore::IntRect rect, uint64_t callbackID)
DrawPagesToPDF(uint64_t frameID, WebKit::PrintInfo printInfo, uint32_t first, uint32_t count, uint64_t callbackID)
#endif
+#if PLATFORM(GTK)
+ DrawPagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID)
+#endif
+
+ # Media
+ SetMediaVolume(float volume)
SetMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp
index 8b135fd06..87e9cedbe 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp
@@ -203,12 +203,12 @@ void LayerTreeHostCA::paintContents(const GraphicsLayer* graphicsLayer, Graphics
}
}
-bool LayerTreeHostCA::showDebugBorders() const
+bool LayerTreeHostCA::showDebugBorders(const GraphicsLayer*) const
{
return m_webPage->corePage()->settings()->showDebugBorders();
}
-bool LayerTreeHostCA::showRepaintCounter() const
+bool LayerTreeHostCA::showRepaintCounter(const GraphicsLayer*) const
{
return m_webPage->corePage()->settings()->showRepaintCounter();
}
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
index 0566e9733..64233347d 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
+++ b/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h
@@ -54,6 +54,7 @@ protected:
// LayerTreeHostCA
virtual void didPerformScheduledLayerFlush();
+ virtual bool flushPendingLayerChanges();
bool m_layerFlushSchedulingEnabled;
@@ -73,16 +74,14 @@ private:
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
- virtual bool showDebugBorders() const;
- virtual bool showRepaintCounter() const;
+ virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const;
+ virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const;
virtual float deviceScaleFactor() const;
virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { }
// LayerTreeHostCA
virtual void platformInitialize(LayerTreeContext&) = 0;
- bool flushPendingLayerChanges();
-
void createPageOverlayLayer();
void destroyPageOverlayLayer();
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h
index 06759e25d..153256b07 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h
+++ b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h
@@ -55,7 +55,9 @@ private:
// LayerTreeHostCA
virtual void platformInitialize(LayerTreeContext&);
virtual void didPerformScheduledLayerFlush();
-
+
+ virtual bool flushPendingLayerChanges();
+
// LayerFlushSchedulerClient
virtual bool flushLayers();
diff --git a/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
index 5ff8ad13b..d45837fd6 100644
--- a/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm
@@ -133,4 +133,12 @@ void LayerTreeHostCAMac::didPerformScheduledLayerFlush()
LayerTreeHostCA::didPerformScheduledLayerFlush();
}
+bool LayerTreeHostCAMac::flushPendingLayerChanges()
+{
+ if (m_layerFlushScheduler.isSuspended())
+ return false;
+
+ return LayerTreeHostCA::flushPendingLayerChanges();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp
new file mode 100644
index 000000000..223700032
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPageAccessibilityObject.h"
+
+#include "WebPage.h"
+#include <WebCore/AXObjectCache.h>
+#include <WebCore/Frame.h>
+#include <WebCore/Page.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+G_DEFINE_TYPE(WebPageAccessibilityObject, web_page_accessibility_object, ATK_TYPE_PLUG)
+
+static AtkObject* accessibilityRootObjectWrapper(AtkObject* atkObject)
+{
+ if (!AXObjectCache::accessibilityEnabled())
+ AXObjectCache::enableAccessibility();
+
+ WebPageAccessibilityObject* accessible = WEB_PAGE_ACCESSIBILITY_OBJECT(atkObject);
+ if (!accessible->m_page)
+ return 0;
+
+ Page* page = accessible->m_page->corePage();
+ if (!page)
+ return 0;
+
+ Frame* core = page->mainFrame();
+ if (!core || !core->document())
+ return 0;
+
+ AccessibilityObject* root = core->document()->axObjectCache()->rootObject();
+ if (!root)
+ return 0;
+
+ AtkObject* axRoot = root->wrapper();
+ if (!axRoot || !ATK_IS_OBJECT(axRoot))
+ return 0;
+
+ return axRoot;
+}
+
+static void webPageAccessibilityObjectInitialize(AtkObject* atkObject, gpointer data)
+{
+ if (ATK_OBJECT_CLASS(web_page_accessibility_object_parent_class)->initialize)
+ ATK_OBJECT_CLASS(web_page_accessibility_object_parent_class)->initialize(atkObject, data);
+
+ WEB_PAGE_ACCESSIBILITY_OBJECT(atkObject)->m_page = reinterpret_cast<WebPage*>(data);
+ atk_object_set_role(atkObject, ATK_ROLE_FILLER);
+}
+
+static gint webPageAccessibilityObjectGetIndexInParent(AtkObject *atkObject)
+{
+ // An AtkPlug is the only child an AtkSocket can have.
+ return 0;
+}
+
+static gint webPageAccessibilityObjectGetNChildren(AtkObject* atkObject)
+{
+ AtkObject* rootObject = accessibilityRootObjectWrapper(atkObject);
+ if (!rootObject)
+ return 0;
+
+ return 1;
+}
+
+static AtkObject* webPageAccessibilityObjectRefChild(AtkObject* atkObject, gint index)
+{
+ // It's supposed to have either one child or zero.
+ if (index && index != 1)
+ return 0;
+
+ AtkObject* rootObject = accessibilityRootObjectWrapper(atkObject);
+ if (!rootObject)
+ return 0;
+
+ atk_object_set_parent(rootObject, atkObject);
+ g_object_ref(rootObject);
+
+ return rootObject;
+}
+
+static void web_page_accessibility_object_init(WebPageAccessibilityObject* accessible)
+{
+}
+
+static void web_page_accessibility_object_class_init(WebPageAccessibilityObjectClass* klass)
+{
+ AtkObjectClass* atkObjectClass = ATK_OBJECT_CLASS(klass);
+
+ // No need to implement get_parent() here since this is a subclass
+ // of AtkPlug and all the logic related to that function will be
+ // implemented by the ATK bridge.
+ atkObjectClass->initialize = webPageAccessibilityObjectInitialize;
+ atkObjectClass->get_index_in_parent = webPageAccessibilityObjectGetIndexInParent;
+ atkObjectClass->get_n_children = webPageAccessibilityObjectGetNChildren;
+ atkObjectClass->ref_child = webPageAccessibilityObjectRefChild;
+}
+
+WebPageAccessibilityObject* webPageAccessibilityObjectNew(WebPage* page)
+{
+ AtkObject* object = ATK_OBJECT(g_object_new(WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT, NULL));
+ atk_object_initialize(object, page);
+ return WEB_PAGE_ACCESSIBILITY_OBJECT(object);
+}
+
+void webPageAccessibilityObjectRefresh(WebPageAccessibilityObject* accessible)
+{
+ // We just need to ensure that there's a connection in the ATK
+ // world between this accessibility object and the AtkObject of
+ // the accessibility object for the root of the DOM tree.
+ AtkObject* rootObject = accessibilityRootObjectWrapper(ATK_OBJECT(accessible));
+ if (!rootObject)
+ return;
+ atk_object_set_parent(rootObject, ATK_OBJECT(accessible));
+}
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.h b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.h
new file mode 100644
index 000000000..1b79d9bb8
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageAccessibilityObject.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPageAccessibilityObject_h
+#define WebPageAccessibilityObject_h
+
+#include <atk/atk.h>
+
+namespace WebKit {
+class WebPage;
+}
+
+G_BEGIN_DECLS
+
+#define WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT (web_page_accessibility_object_get_type())
+#define WEB_PAGE_ACCESSIBILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT, WebPageAccessibilityObject))
+#define WEB_PAGE_ACCESSIBILITY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT, WebPageAccessibilityObjectClass))
+#define WEB_IS_PAGE_ACCESSIBILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT))
+#define WEB_IS_PAGE_ACCESSIBILITY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT))
+#define WEB_PAGE_ACCESSIBILITY_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), WEB_TYPE_PAGE_ACCESSIBILITY_OBJECT, WebPageAccessibilityObjectClass))
+
+typedef struct _WebPageAccessibilityObject WebPageAccessibilityObject;
+typedef struct _WebPageAccessibilityObjectClass WebPageAccessibilityObjectClass;
+
+struct _WebPageAccessibilityObject {
+ AtkPlug parent;
+ WebKit::WebPage* m_page;
+};
+
+struct _WebPageAccessibilityObjectClass {
+ AtkPlugClass parentClass;
+};
+
+GType web_page_accessibility_object_get_type();
+
+WebPageAccessibilityObject* webPageAccessibilityObjectNew(WebKit::WebPage*);
+
+void webPageAccessibilityObjectRefresh(WebPageAccessibilityObject*);
+
+G_END_DECLS
+
+#endif // WebPageAccessibilityObject_h
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
index a25e1f7b3..2b2a9464e 100644
--- a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
@@ -30,6 +30,8 @@
#include "NotImplemented.h"
#include "WebEvent.h"
+#include "WebPageAccessibilityObject.h"
+#include "WebPageProxyMessages.h"
#include "WindowsKeyboardCodes.h"
#include <WebCore/FocusController.h>
#include <WebCore/Frame.h>
@@ -37,6 +39,7 @@
#include <WebCore/Page.h>
#include <WebCore/PlatformKeyboardEvent.h>
#include <WebCore/Settings.h>
+#include <wtf/gobject/GOwnPtr.h>
using namespace WebCore;
@@ -44,7 +47,21 @@ namespace WebKit {
void WebPage::platformInitialize()
{
- notImplemented();
+ // Create the accessible object (the plug) that will serve as the
+ // entry point to the Web process, and send a message to the UI
+ // process to connect the two worlds through the accessibility
+ // object there specifically placed for that purpose (the socket).
+ m_accessibilityObject = webPageAccessibilityObjectNew(this);
+ GOwnPtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject)));
+ send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
+}
+
+void WebPage::updateAccessibilityTree()
+{
+ if (!m_accessibilityObject)
+ return;
+
+ webPageAccessibilityObjectRefresh(m_accessibilityObject);
}
void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
new file mode 100644
index 000000000..704adf3ea
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPrintOperationGtk.h"
+
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include <WebCore/IntRect.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/PlatformContextCairo.h>
+#include <WebCore/PrintContext.h>
+#include <gtk/gtk.h>
+#include <wtf/Vector.h>
+#include <wtf/gobject/GOwnPtr.h>
+
+#ifdef HAVE_GTK_UNIX_PRINTING
+#include <cairo-pdf.h>
+#include <cairo-ps.h>
+#include <gtk/gtkunixprint.h>
+#endif
+
+namespace WebKit {
+
+#ifdef HAVE_GTK_UNIX_PRINTING
+class WebPrintOperationGtkUnix: public WebPrintOperationGtk {
+public:
+ WebPrintOperationGtkUnix(WebPage* page, const PrintInfo& printInfo)
+ : WebPrintOperationGtk(page, printInfo)
+ , m_printJob(0)
+ {
+ }
+
+ static gboolean enumeratePrintersFunction(GtkPrinter* printer, WebPrintOperationGtkUnix* printOperation)
+ {
+ GtkPrinter* selectedPrinter = 0;
+ const char* printerName = gtk_print_settings_get_printer(printOperation->printSettings());
+ if (printerName) {
+ if (!strcmp(printerName, gtk_printer_get_name(printer)))
+ selectedPrinter = printer;
+ } else if (gtk_printer_is_default(printer))
+ selectedPrinter = printer;
+
+ if (!selectedPrinter)
+ return FALSE;
+
+ static int jobNumber = 0;
+ const char* applicationName = g_get_application_name();
+ GOwnPtr<char>jobName(g_strdup_printf("%s job #%d", applicationName ? applicationName : "WebKit", ++jobNumber));
+ printOperation->m_printJob = adoptGRef(gtk_print_job_new(jobName.get(), selectedPrinter,
+ printOperation->printSettings(),
+ printOperation->pageSetup()));
+ return TRUE;
+ }
+
+ static void enumeratePrintersFinished(WebPrintOperationGtkUnix* printOperation)
+ {
+ if (!printOperation->m_printJob) {
+ // FIXME: Printing error.
+ return;
+ }
+
+ cairo_surface_t* surface = gtk_print_job_get_surface(printOperation->m_printJob.get(), 0);
+ if (!surface) {
+ // FIXME: Printing error.
+ return;
+ }
+
+ int rangesCount;
+ printOperation->m_pageRanges = gtk_print_job_get_page_ranges(printOperation->m_printJob.get(), &rangesCount);
+ printOperation->m_pageRangesCount = rangesCount;
+ printOperation->m_pagesToPrint = gtk_print_job_get_pages(printOperation->m_printJob.get());
+ printOperation->m_needsRotation = gtk_print_job_get_rotate(printOperation->m_printJob.get());
+
+ printOperation->print(surface, 72, 72);
+ }
+
+ void startPrint(WebCore::PrintContext* printContext, uint64_t callbackID)
+ {
+ m_printContext = printContext;
+ m_callbackID = callbackID;
+ gtk_enumerate_printers(reinterpret_cast<GtkPrinterFunc>(enumeratePrintersFunction), this,
+ reinterpret_cast<GDestroyNotify>(enumeratePrintersFinished), FALSE);
+ }
+
+ void startPage(cairo_t* cr)
+ {
+ GtkPaperSize* paperSize = gtk_page_setup_get_paper_size(m_pageSetup.get());
+ double width = gtk_paper_size_get_width(paperSize, GTK_UNIT_POINTS);
+ double height = gtk_paper_size_get_height(paperSize, GTK_UNIT_POINTS);
+
+ cairo_surface_t* surface = gtk_print_job_get_surface(m_printJob.get(), 0);
+ cairo_surface_type_t surfaceType = cairo_surface_get_type(surface);
+ if (surfaceType == CAIRO_SURFACE_TYPE_PS) {
+ cairo_ps_surface_set_size(surface, width, height);
+ cairo_ps_surface_dsc_begin_page_setup(surface);
+
+ switch (gtk_page_setup_get_orientation(m_pageSetup.get())) {
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ cairo_ps_surface_dsc_comment(surface, "%%PageOrientation: Portrait");
+ break;
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_ps_surface_dsc_comment(surface, "%%PageOrientation: Landscape");
+ break;
+ }
+ } else if (surfaceType == CAIRO_SURFACE_TYPE_PDF)
+ cairo_pdf_surface_set_size(surface, width, height);
+ }
+
+ void endPage(cairo_t* cr)
+ {
+ cairo_show_page(cr);
+ }
+
+ static void printJobComplete(GtkPrintJob* printJob, WebPrintOperationGtkUnix* printOperation, const GError*)
+ {
+ printOperation->m_printJob = 0;
+ }
+
+ static void printJobFinished(WebPrintOperationGtkUnix* printOperation)
+ {
+ printOperation->deref();
+ }
+
+ void endPrint()
+ {
+ cairo_surface_finish(gtk_print_job_get_surface(m_printJob.get(), 0));
+ // Make sure the operation is alive until the job is sent.
+ ref();
+ gtk_print_job_send(m_printJob.get(), reinterpret_cast<GtkPrintJobCompleteFunc>(printJobComplete), this,
+ reinterpret_cast<GDestroyNotify>(printJobFinished));
+ }
+
+ GRefPtr<GtkPrintJob> m_printJob;
+};
+#endif
+
+#ifdef G_OS_WIN32
+class WebPrintOperationGtkWin32: public WebPrintOperationGtk {
+public:
+ WebPrintOperationGtkWin32(WebPage* page, const PrintInfo& printInfo)
+ : WebPrintOperationGtk(page, printInfo)
+ {
+ }
+
+ void startPrint(WebCore::PrintContext* printContext, uint64_t callbackID)
+ {
+ m_printContext = printContext;
+ m_callbackID = callbackID;
+ notImplemented();
+ }
+
+ void startPage(cairo_t* cr)
+ {
+ notImplemented();
+ }
+
+ void endPage(cairo_t* cr)
+ {
+ notImplemented();
+ }
+
+ void endPrint()
+ {
+ notImplemented();
+ }
+};
+#endif
+
+struct PrintPagesData {
+ PrintPagesData(WebPrintOperationGtk* printOperation)
+ : printOperation(printOperation)
+ , totalPrinted(-1)
+ , pageNumber(0)
+ , pagePosition(0)
+ , isDone(false)
+ {
+ if (printOperation->pagesToPrint() == GTK_PRINT_PAGES_RANGES) {
+ Vector<GtkPageRange> pageRanges;
+ GtkPageRange* ranges = printOperation->pageRanges();
+ size_t rangesCount = printOperation->pageRangesCount();
+ int pageCount = printOperation->pageCount();
+
+ pageRanges.reserveCapacity(rangesCount);
+ for (size_t i = 0; i < rangesCount; ++i) {
+ if (ranges[i].start >= 0 && ranges[i].start < pageCount && ranges[i].end >= 0 && ranges[i].end < pageCount)
+ pageRanges.append(ranges[i]);
+ else if (ranges[i].start >= 0 && ranges[i].start < pageCount && ranges[i].end >= pageCount) {
+ pageRanges.append(ranges[i]);
+ pageRanges.last().end = pageCount - 1;
+ } else if (ranges[i].end >= 0 && ranges[i].end < pageCount && ranges[i].start < 0) {
+ pageRanges.append(ranges[i]);
+ pageRanges.last().start = 0;
+ }
+ }
+
+ for (size_t i = 0; i < pageRanges.size(); ++i) {
+ for (int j = pageRanges[i].start; j <= pageRanges[i].end; ++j)
+ pages.append(j);
+ }
+
+ } else {
+ for (int i = 0; i < printOperation->pageCount(); ++i)
+ pages.append(i);
+ }
+
+ pageNumber = pages[pagePosition];
+ }
+
+ void incrementPageSequence()
+ {
+ if (totalPrinted == -1) {
+ totalPrinted = 0;
+ return;
+ }
+
+ pagePosition++;
+ if (pagePosition >= pages.size()) {
+ isDone = true;
+ return;
+ }
+ pageNumber = pages[pagePosition];
+ totalPrinted++;
+ }
+
+ RefPtr<WebPrintOperationGtk> printOperation;
+
+ int totalPrinted;
+ size_t totalToPrint;
+ int pageNumber;
+ size_t pagePosition;
+ Vector<size_t> pages;
+
+ bool isDone : 1;
+};
+
+PassRefPtr<WebPrintOperationGtk> WebPrintOperationGtk::create(WebPage* page, const PrintInfo& printInfo)
+{
+#ifdef HAVE_GTK_UNIX_PRINTING
+ return adoptRef(new WebPrintOperationGtkUnix(page, printInfo));
+#endif
+#ifdef G_OS_WIN32
+ return adoptRef(new WebPrintOperationGtkWin32(page, printInfo));
+#endif
+}
+
+WebPrintOperationGtk::WebPrintOperationGtk(WebPage* page, const PrintInfo& printInfo)
+ : m_webPage(page)
+ , m_printSettings(printInfo.printSettings.get())
+ , m_pageSetup(printInfo.pageSetup.get())
+ , m_printContext(0)
+ , m_callbackID(0)
+ , m_xDPI(1)
+ , m_yDPI(1)
+ , m_printPagesIdleId(0)
+ , m_pagesToPrint(GTK_PRINT_PAGES_ALL)
+ , m_pageRanges(0)
+ , m_pageRangesCount(0)
+ , m_needsRotation(false)
+{
+}
+
+WebPrintOperationGtk::~WebPrintOperationGtk()
+{
+ if (m_printPagesIdleId)
+ g_source_remove(m_printPagesIdleId);
+}
+
+int WebPrintOperationGtk::pageCount() const
+{
+ return m_printContext ? m_printContext->pageCount() : 0;
+}
+
+void WebPrintOperationGtk::rotatePage()
+{
+ GtkPaperSize* paperSize = gtk_page_setup_get_paper_size(m_pageSetup.get());
+ double width = gtk_paper_size_get_width(paperSize, GTK_UNIT_INCH) * m_xDPI;
+ double height = gtk_paper_size_get_height(paperSize, GTK_UNIT_INCH) * m_yDPI;
+
+ cairo_matrix_t matrix;
+ switch (gtk_page_setup_get_orientation(m_pageSetup.get())) {
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ cairo_translate(m_cairoContext.get(), 0, height);
+ cairo_matrix_init(&matrix, 0, -1, 1, 0, 0, 0);
+ cairo_transform(m_cairoContext.get(), &matrix);
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ cairo_translate(m_cairoContext.get(), width, height);
+ cairo_matrix_init(&matrix, -1, 0, 0, -1, 0, 0);
+ cairo_transform(m_cairoContext.get(), &matrix);
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_translate(m_cairoContext.get(), width, 0);
+ cairo_matrix_init(&matrix, 0, 1, -1, 0, 0, 0);
+ cairo_transform(m_cairoContext.get(), &matrix);
+ break;
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ default:
+ break;
+ }
+}
+
+void WebPrintOperationGtk::renderPage(int pageNumber)
+{
+ startPage(m_cairoContext.get());
+
+ if (m_needsRotation)
+ rotatePage();
+
+ double left = gtk_page_setup_get_left_margin(m_pageSetup.get(), GTK_UNIT_INCH);
+ double top = gtk_page_setup_get_top_margin(m_pageSetup.get(), GTK_UNIT_INCH);
+ cairo_translate(m_cairoContext.get(), left * m_xDPI, top * m_yDPI);
+
+ double pageWidth = gtk_page_setup_get_page_width(m_pageSetup.get(), GTK_UNIT_INCH) * m_xDPI;
+ WebCore::PlatformContextCairo platformContext(m_cairoContext.get());
+ WebCore::GraphicsContext graphicsContext(&platformContext);
+ m_printContext->spoolPage(graphicsContext, pageNumber, pageWidth);
+
+ endPage(m_cairoContext.get());
+}
+
+gboolean WebPrintOperationGtk::printPagesIdle(gpointer userData)
+{
+ PrintPagesData* data = static_cast<PrintPagesData*>(userData);
+
+ data->incrementPageSequence();
+ if (data->isDone)
+ return FALSE;
+
+ data->printOperation->renderPage(data->pageNumber);
+ return TRUE;
+}
+
+void WebPrintOperationGtk::printPagesIdleDone(gpointer userData)
+{
+ PrintPagesData* data = static_cast<PrintPagesData*>(userData);
+
+ data->printOperation->printDone();
+ delete data;
+}
+
+void WebPrintOperationGtk::printDone()
+{
+ m_printPagesIdleId = 0;
+
+ endPrint();
+ // Job is now sent to the printer, we can notify the UI process that we are done.
+ m_webPage->send(Messages::WebPageProxy::VoidCallback(m_callbackID));
+ m_cairoContext = 0;
+}
+
+void WebPrintOperationGtk::print(cairo_surface_t* surface, double xDPI, double yDPI)
+{
+ ASSERT(m_printContext);
+
+ m_xDPI = xDPI;
+ m_yDPI = yDPI;
+ m_cairoContext = adoptRef(cairo_create(surface));
+
+ PrintPagesData* data = new PrintPagesData(this);
+ m_printPagesIdleId = gdk_threads_add_idle_full(G_PRIORITY_DEFAULT_IDLE + 10, printPagesIdle,
+ data, printPagesIdleDone);
+}
+
+}
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h b/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h
new file mode 100644
index 000000000..b142c4f63
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPrintOperationGtk_h
+#define WebPrintOperationGtk_h
+
+#include "PrintInfo.h"
+#include <WebCore/RefPtrCairo.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/gobject/GRefPtr.h>
+
+typedef struct _GtkPrintSettings GtkPrintSettings;
+typedef struct _GtkPageSetup GtkPageSetup;
+typedef struct _GtkPageRange GtkPageRange;
+
+namespace WebCore {
+class PrintContext;
+};
+
+namespace WebKit {
+
+class WebPage;
+
+class WebPrintOperationGtk : public RefCounted<WebPrintOperationGtk> {
+public:
+ static PassRefPtr<WebPrintOperationGtk> create(WebPage*, const PrintInfo&);
+ ~WebPrintOperationGtk();
+
+ GtkPrintSettings* printSettings() const { return m_printSettings.get(); }
+ GtkPageSetup* pageSetup() const { return m_pageSetup.get(); }
+ unsigned int pagesToPrint() const { return m_pagesToPrint; }
+ int pageCount() const;
+ GtkPageRange* pageRanges() const { return m_pageRanges; }
+ size_t pageRangesCount() const { return m_pageRangesCount; }
+
+ virtual void startPrint(WebCore::PrintContext*, uint64_t callbackID) = 0;
+
+protected:
+ WebPrintOperationGtk(WebPage*, const PrintInfo&);
+
+ virtual void startPage(cairo_t*) = 0;
+ virtual void endPage(cairo_t*) = 0;
+ virtual void endPrint() = 0;
+
+ static gboolean printPagesIdle(gpointer);
+ static void printPagesIdleDone(gpointer);
+
+ void print(cairo_surface_t*, double xDPI, double yDPI);
+ void renderPage(int pageNumber);
+ void rotatePage();
+ void printDone();
+
+ WebPage* m_webPage;
+ GRefPtr<GtkPrintSettings> m_printSettings;
+ GRefPtr<GtkPageSetup> m_pageSetup;
+ WebCore::PrintContext* m_printContext;
+ uint64_t m_callbackID;
+ RefPtr<cairo_t> m_cairoContext;
+ double m_xDPI;
+ double m_yDPI;
+
+ unsigned int m_printPagesIdleId;
+ unsigned int m_pagesToPrint;
+ GtkPageRange* m_pageRanges;
+ size_t m_pageRangesCount;
+ bool m_needsRotation;
+};
+
+}
+
+#endif // WebPrintOperationGtk_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
index 92620bec2..2dd065493 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
@@ -50,6 +50,8 @@ private:
virtual void setNeedsDisplay(const WebCore::IntRect&) OVERRIDE;
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) OVERRIDE;
+ virtual void setLayerTreeStateIsFrozen(bool) OVERRIDE;
+ virtual bool layerTreeStateIsFrozen() const OVERRIDE;
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) OVERRIDE;
virtual void scheduleCompositingLayerSync() OVERRIDE;
@@ -59,10 +61,14 @@ private:
// Message handlers.
virtual void updateGeometry(const WebCore::IntSize& viewSize) OVERRIDE;
+ void setRootCompositingLayer(CALayer *);
+
+ bool m_layerTreeStateIsFrozen;
WebCore::LayerFlushScheduler m_layerFlushScheduler;
- RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
+ RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
RetainPtr<CALayer> m_rootLayer;
+ RetainPtr<CALayer> m_pendingRootCompositingLayer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
index a1da6bde5..4aca80c4b 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
@@ -55,6 +55,7 @@ PassOwnPtr<TiledCoreAnimationDrawingArea> TiledCoreAnimationDrawingArea::create(
TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, const WebPageCreationParameters& parameters)
: DrawingArea(DrawingAreaTypeTiledCoreAnimation, webPage)
+ , m_layerTreeStateIsFrozen(false)
, m_layerFlushScheduler(this)
{
Page* page = webPage->corePage();
@@ -103,34 +104,58 @@ void TiledCoreAnimationDrawingArea::scroll(const IntRect& scrollRect, const IntS
void TiledCoreAnimationDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
- if (!graphicsLayer) {
- m_rootLayer.get().sublayers = nil;
+ CALayer *rootCompositingLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil;
+
+ if (m_layerTreeStateIsFrozen) {
+ m_pendingRootCompositingLayer = rootCompositingLayer;
return;
}
- m_rootLayer.get().sublayers = [NSArray arrayWithObject:graphicsLayer->platformLayer()];
+ setRootCompositingLayer(rootCompositingLayer);
+}
+
+void TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen(bool layerTreeStateIsFrozen)
+{
+ if (m_layerTreeStateIsFrozen == layerTreeStateIsFrozen)
+ return;
+
+ m_layerTreeStateIsFrozen = layerTreeStateIsFrozen;
+ if (m_layerTreeStateIsFrozen)
+ m_layerFlushScheduler.suspend();
+ else
+ m_layerFlushScheduler.resume();
+}
+
+bool TiledCoreAnimationDrawingArea::layerTreeStateIsFrozen() const
+{
+ return m_layerTreeStateIsFrozen;
}
void TiledCoreAnimationDrawingArea::scheduleCompositingLayerSync()
{
m_layerFlushScheduler.schedule();
- // FIXME: Implement
}
bool TiledCoreAnimationDrawingArea::flushLayers()
{
+ ASSERT(!m_layerTreeStateIsFrozen);
+
// This gets called outside of the normal event loop so wrap in an autorelease pool
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
m_webPage->layoutIfNeeded();
+ if (m_pendingRootCompositingLayer) {
+ setRootCompositingLayer(m_pendingRootCompositingLayer.get());
+ m_pendingRootCompositingLayer = nullptr;
+ }
+
bool returnValue = m_webPage->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes();
[pool drain];
return returnValue;
}
-
void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize)
{
m_webPage->setSize(viewSize);
@@ -149,4 +174,19 @@ void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize)
m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry());
}
+void TiledCoreAnimationDrawingArea::setRootCompositingLayer(CALayer *layer)
+{
+ ASSERT(!m_layerTreeStateIsFrozen);
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ if (!layer)
+ m_rootLayer.get().sublayers = nil;
+ else
+ m_rootLayer.get().sublayers = [NSArray arrayWithObject:layer];
+
+ [CATransaction commit];
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
index 341fb69e4..fc1e85b21 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
@@ -240,16 +240,16 @@ void LayerTreeHostQt::didDeleteLayer(WebLayerID id)
void LayerTreeHostQt::performScheduledLayerFlush()
{
- m_webPage->layoutIfNeeded();
-
- if (!m_isValid)
- return;
-
#if USE(TILED_BACKING_STORE)
if (m_isSuspended || m_waitingForUIProcess)
return;
#endif
+ m_webPage->layoutIfNeeded();
+
+ if (!m_isValid)
+ return;
+
m_shouldSyncFrame = false;
flushPendingLayerChanges();
if (!m_shouldSyncFrame)
@@ -261,6 +261,7 @@ void LayerTreeHostQt::performScheduledLayerFlush()
}
m_webPage->send(Messages::LayerTreeHostProxy::DidRenderFrame());
+ m_waitingForUIProcess = true;
if (!m_notifyAfterScheduledLayerFlush)
return;
@@ -320,6 +321,8 @@ int64_t LayerTreeHostQt::adoptImageBackingStore(Image* image)
graphicsContext->drawImage(image, ColorSpaceDeviceRGB, IntPoint::zero());
}
+ // Qt uses BGRA internally, we swizzle to RGBA for OpenGL.
+ bitmap->swizzleRGB();
ShareableBitmap::Handle handle;
bitmap->createHandle(handle);
m_webPage->send(Messages::LayerTreeHostProxy::CreateDirectlyCompositedImage(key, handle));
@@ -368,12 +371,12 @@ void LayerTreeHostQt::paintContents(const WebCore::GraphicsLayer* graphicsLayer,
}
}
-bool LayerTreeHostQt::showDebugBorders() const
+bool LayerTreeHostQt::showDebugBorders(const WebCore::GraphicsLayer*) const
{
return m_webPage->corePage()->settings()->showDebugBorders();
}
-bool LayerTreeHostQt::showRepaintCounter() const
+bool LayerTreeHostQt::showRepaintCounter(const WebCore::GraphicsLayer*) const
{
return m_webPage->corePage()->settings()->showRepaintCounter();
}
@@ -398,22 +401,12 @@ void LayerTreeHostQt::removeTile(WebLayerID layerID, int tileID)
m_webPage->send(Messages::LayerTreeHostProxy::RemoveTileForLayer(layerID, tileID));
}
-void LayerTreeHostQt::setVisibleContentRectForLayer(int layerID, const WebCore::IntRect& rect)
-{
- WebGraphicsLayer* layer = WebGraphicsLayer::layerByID(layerID);
- if (!layer)
- return;
- FloatRect visibleRect(rect);
- layer->setVisibleContentRect(rect);
-}
-
void LayerTreeHostQt::setVisibleContentRectAndScale(const IntRect& rect, float scale)
{
- WebGraphicsLayer* layer = toWebGraphicsLayer(m_rootLayer.get());
- if (!layer)
- return;
- layer->setContentsScale(scale);
- toWebGraphicsLayer(m_nonCompositedContentLayer.get())->setVisibleContentRect(rect);
+ if (m_rootLayer) {
+ toWebGraphicsLayer(m_rootLayer.get())->setVisibleContentRectAndScale(rect, scale);
+ scheduleLayerFlush();
+ }
}
void LayerTreeHostQt::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector)
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
index 8527c528b..07f04e88a 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
+++ b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
@@ -62,19 +62,18 @@ public:
virtual void pauseRendering() { m_isSuspended = true; }
virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); }
virtual void deviceScaleFactorDidChange() { }
- virtual int64_t adoptImageBackingStore(Image*);
+ virtual int64_t adoptImageBackingStore(WebCore::Image*);
virtual void releaseImageBackingStore(int64_t);
#if USE(TILED_BACKING_STORE)
virtual void createTile(WebLayerID, int tileID, const UpdateInfo&);
virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&);
virtual void removeTile(WebLayerID, int tileID);
- virtual void setVisibleContentRectForLayer(int layerID, const WebCore::IntRect&);
virtual void renderNextFrame();
virtual void purgeBackingStores();
virtual bool layerTreeTileUpdatesAllowed() const;
- virtual void setVisibleContentRectAndScale(const IntRect&, float scale);
- virtual void setVisibleContentRectTrajectoryVector(const FloatPoint&);
+ virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float scale);
+ virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
virtual void didSyncCompositingStateForLayer(const WebLayerInfo&);
virtual void didDeleteLayer(WebLayerID);
#endif
@@ -87,8 +86,8 @@ private:
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
- virtual bool showDebugBorders() const;
- virtual bool showRepaintCounter() const;
+ virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const;
+ virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const;
// LayerTreeHostQt
void createPageOverlayLayer();
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
index 55080d03c..7180a8c88 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
@@ -90,10 +90,6 @@ namespace WebKit {
void WebPage::platformInitialize()
{
- Settings* settings = m_page->settings();
-
- // If accelerated compositing is enabled, we want to be in force-compositing mode, so that we don't switch between composited/non-composited state.
- settings->setForceCompositingMode(true);
}
void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
diff --git a/Source/WebKit2/WebProcess/WebProcess.cpp b/Source/WebKit2/WebProcess/WebProcess.cpp
index 39b3bc8e5..d0981071f 100644
--- a/Source/WebKit2/WebProcess/WebProcess.cpp
+++ b/Source/WebKit2/WebProcess/WebProcess.cpp
@@ -31,7 +31,6 @@
#include "InjectedBundle.h"
#include "InjectedBundleMessageKinds.h"
#include "InjectedBundleUserMessageCoders.h"
-#include "RunLoop.h"
#include "SandboxExtension.h"
#include "StatisticsData.h"
#include "WebApplicationCacheManager.h"
@@ -72,6 +71,7 @@
#include <WebCore/PageCache.h>
#include <WebCore/PageGroup.h>
#include <WebCore/ResourceHandle.h>
+#include <WebCore/RunLoop.h>
#include <WebCore/SchemeRegistry.h>
#include <WebCore/SecurityOrigin.h>
#include <WebCore/Settings.h>
@@ -213,8 +213,8 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
setShouldTrackVisitedLinks(parameters.shouldTrackVisitedLinks);
setCacheModel(static_cast<uint32_t>(parameters.cacheModel));
- if (!parameters.languageCode.isEmpty())
- overrideDefaultLanguage(parameters.languageCode);
+ if (!parameters.languages.isEmpty())
+ overrideUserPreferredLanguages(parameters.languages);
m_textCheckerState = parameters.textCheckerState;
@@ -288,9 +288,9 @@ void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing)
WebCore::Font::setShouldUseSmoothing(useFontSmoothing);
}
-void WebProcess::languageChanged(const String& language) const
+void WebProcess::userPreferredLanguagesChanged(const Vector<String>& languages) const
{
- overrideDefaultLanguage(language);
+ overrideUserPreferredLanguages(languages);
}
void WebProcess::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h
index 1e50284c0..efa2e681a 100644
--- a/Source/WebKit2/WebProcess/WebProcess.h
+++ b/Source/WebKit2/WebProcess/WebProcess.h
@@ -82,10 +82,10 @@ class WebProcess : public ChildProcess, private CoreIPC::Connection::QueueClient
public:
static WebProcess& shared();
- void initialize(CoreIPC::Connection::Identifier, RunLoop*);
+ void initialize(CoreIPC::Connection::Identifier, WebCore::RunLoop*);
CoreIPC::Connection* connection() const { return m_connection->connection(); }
- RunLoop* runLoop() const { return m_runLoop; }
+ WebCore::RunLoop* runLoop() const { return m_runLoop; }
WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_connection.get(); }
@@ -161,7 +161,7 @@ private:
void setDefaultRequestTimeoutInterval(double);
void setAlwaysUsesComplexTextCodePath(bool);
void setShouldUseFontSmoothing(bool);
- void languageChanged(const String&) const;
+ void userPreferredLanguagesChanged(const Vector<String>&) const;
void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
#if PLATFORM(WIN)
void setShouldPaintNativeControls(bool);
@@ -241,7 +241,7 @@ private:
bool m_inDidClose;
- RunLoop* m_runLoop;
+ WebCore::RunLoop* m_runLoop;
// FIXME: The visited link table should not be per process.
VisitedLinkTable m_visitedLinkTable;
diff --git a/Source/WebKit2/WebProcess/WebProcess.messages.in b/Source/WebKit2/WebProcess/WebProcess.messages.in
index 641cc7df1..3b6a1f7b0 100644
--- a/Source/WebKit2/WebProcess/WebProcess.messages.in
+++ b/Source/WebKit2/WebProcess/WebProcess.messages.in
@@ -41,7 +41,7 @@ messages -> WebProcess {
SetDefaultRequestTimeoutInterval(double timeoutInterval)
SetAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
SetShouldUseFontSmoothing(bool useFontSmoothing)
- LanguageChanged(WTF::String language)
+ UserPreferredLanguagesChanged(Vector<WTF::String> languages)
FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
#if PLATFORM(WIN)
SetShouldPaintNativeControls(bool shouldPaintNativeControls)
diff --git a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp
index f8b3cd240..83c5c3be2 100644
--- a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp
+++ b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp
@@ -29,12 +29,14 @@
#include "WKBase.h"
#include <Ecore.h>
#include <WebCore/ResourceHandle.h>
-#include <WebKit2/RunLoop.h>
+#include <WebCore/RunLoop.h>
#include <WebKit2/WebProcess.h>
#include <runtime/InitializeThreading.h>
#include <unistd.h>
#include <wtf/MainThread.h>
+using namespace WebCore;
+
namespace WebKit {
WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
@@ -54,6 +56,9 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
#if ENABLE(GLIB_SUPPORT)
g_type_init();
+
+ if (!ecore_main_loop_glib_integrate())
+ return 1;
#endif
JSC::initializeThreading();
diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
index fb9698eda..18c506bcc 100644
--- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
+++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
@@ -31,13 +31,15 @@
#include "WKBase.h"
#include <WebCore/GtkAuthenticationDialog.h>
#include <WebCore/ResourceHandle.h>
-#include <WebKit2/RunLoop.h>
+#include <WebCore/RunLoop.h>
#include <WebKit2/WebProcess.h>
#include <gtk/gtk.h>
#include <runtime/InitializeThreading.h>
#include <unistd.h>
#include <wtf/MainThread.h>
+using namespace WebCore;
+
namespace WebKit {
WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
diff --git a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
index c3575744f..467c3e01c 100644
--- a/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
+++ b/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm
@@ -80,8 +80,9 @@ static OSStatus webSecItemAdd(CFDictionaryRef query, CFTypeRef* result)
OwnPtr<SecItemResponseData> response = sendSeqItemRequest(SecItemRequestData::Add, query);
if (!response)
return errSecInteractionNotAllowed;
-
- *result = response->resultObject().leakRef();
+
+ if (result)
+ *result = response->resultObject().leakRef();
return response->resultCode();
}
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
index 7d67e1e68..7d0d69c26 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
@@ -252,6 +252,10 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
WebInspector::setLocalizedStringsPath(parameters.webInspectorLocalizedStringsPath);
m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
+
+#if ENABLE(NOTIFICATIONS)
+ m_notificationManager.initialize(parameters.notificationPermissions);
+#endif
// rdar://9118639 accessibilityFocusedUIElement in NSApplication defaults to use the keyWindow. Since there's
// no window in WK2, NSApplication needs to use the focused page's focused element.
diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index b5a3fe07d..4e2b15532 100644
--- a/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -29,9 +29,9 @@
#import "CommandLine.h"
#import "EnvironmentUtilities.h"
#import "EnvironmentVariables.h"
-#import "RunLoop.h"
#import "WebProcess.h"
#import "WebSystemInterface.h"
+#import <WebCore/RunLoop.h>
#import <WebKit2/WKView.h>
#import <WebKitSystemInterface.h>
#import <mach/mach_error.h>
@@ -43,8 +43,8 @@
#import <stdio.h>
#import <sysexits.h>
#import <unistd.h>
-#import <wtf/RetainPtr.h>
#import <wtf/MainThread.h>
+#import <wtf/RetainPtr.h>
#import <wtf/text/CString.h>
#import <wtf/text/StringBuilder.h>
diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
index 57b953fea..aa487563d 100644
--- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
+++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +30,9 @@
#include "SharedMemory.h"
#include "WebFrameNetworkingContext.h"
#include "WebPage.h"
+#include "WebPageProxyMessages.h"
#include "WebProcess.h"
+#include <QAuthenticator>
#include <QNetworkReply>
#include <QNetworkRequest>
@@ -39,12 +42,8 @@ QtNetworkAccessManager::QtNetworkAccessManager(WebProcess* webProcess)
: QNetworkAccessManager()
, m_webProcess(webProcess)
{
-}
-
-QtNetworkAccessManager::QtNetworkAccessManager(QObject* parent)
- : QNetworkAccessManager(parent)
- , m_webProcess(0)
-{
+ connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*)));
+ connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(onSslErrors(QNetworkReply*, QList<QSslError>)));
}
WebPage* QtNetworkAccessManager::obtainOriginatingWebPage(const QNetworkRequest& request)
@@ -53,13 +52,8 @@ WebPage* QtNetworkAccessManager::obtainOriginatingWebPage(const QNetworkRequest&
if (!originatingObject)
return 0;
- QVariant pagePtr = originatingObject->property("PagePointer");
- if (!pagePtr.isValid() || !pagePtr.canConvert<void*>())
- return 0;
-
- WebPage* webPage = static_cast<WebPage*>(pagePtr.value<void*>());
- Q_ASSERT(webPage);
- return webPage;
+ qulonglong pageID = originatingObject->property("pageID").toULongLong();
+ return m_webProcess->webPage(pageID);
}
QNetworkReply* QtNetworkAccessManager::createRequest(Operation operation, const QNetworkRequest& request, QIODevice* outData)
@@ -79,6 +73,49 @@ void QtNetworkAccessManager::registerApplicationScheme(const WebPage* page, cons
m_applicationSchemes.insert(page, scheme.toLower());
}
+void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
+{
+ WebPage* webPage = obtainOriginatingWebPage(reply->request());
+
+ // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
+ if (!webPage)
+ return;
+
+ String hostname = reply->url().toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash);
+ String realm = authenticator->realm();
+ String prefilledUsername = authenticator->user();
+ String username;
+ String password;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::AuthenticationRequiredRequest(hostname, realm, prefilledUsername),
+ Messages::WebPageProxy::AuthenticationRequiredRequest::Reply(username, password))) {
+ if (!username.isEmpty())
+ authenticator->setUser(username);
+ if (!password.isEmpty())
+ authenticator->setPassword(password);
+ }
+}
+
+void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors)
+{
+ WebPage* webPage = obtainOriginatingWebPage(reply->request());
+
+ // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
+ if (!webPage)
+ return;
+
+ String hostname = reply->url().host();
+ bool ignoreErrors = false;
+
+ if (webPage->sendSync(
+ Messages::WebPageProxy::CertificateVerificationRequest(hostname),
+ Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) {
+ if (ignoreErrors)
+ reply->ignoreSslErrors(qSslErrors);
+ }
+}
+
}
#include "moc_QtNetworkAccessManager.cpp"
diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h
index 8d9eb1d0e..846221eb7 100644
--- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h
+++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,15 +39,19 @@ class WebProcess;
class QtNetworkAccessManager : public QNetworkAccessManager {
Q_OBJECT
public:
- QtNetworkAccessManager(QObject* parent);
QtNetworkAccessManager(WebProcess*);
void registerApplicationScheme(const WebPage*, const QString& scheme);
protected:
virtual QNetworkReply* createRequest(Operation, const QNetworkRequest&, QIODevice* outgoingData = 0) OVERRIDE;
- static WebPage* obtainOriginatingWebPage(const QNetworkRequest&);
+
+private Q_SLOTS:
+ void onAuthenticationRequired(QNetworkReply *, QAuthenticator *);
+ void onSslErrors(QNetworkReply*, const QList<QSslError>&);
private:
+ WebPage* obtainOriginatingWebPage(const QNetworkRequest&);
+
QMultiHash<const WebPage*, QString> m_applicationSchemes;
WebProcess* m_webProcess;
diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp
index fd0f5cb7a..e65022cdf 100644
--- a/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp
+++ b/Source/WebKit2/WebProcess/qt/QtNetworkReply.cpp
@@ -45,11 +45,12 @@ QtNetworkReply::QtNetworkReply(const QNetworkRequest& req, QtNetworkAccessManage
setOperation(QNetworkAccessManager::GetOperation);
setUrl(req.url());
setOpenMode(QIODevice::ReadOnly);
- setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QString::fromLocal8Bit("text/html; charset=UTF-16")));
}
void QtNetworkReply::setData(const SharedMemory::Handle& handle, qint64 dataSize)
{
+ if (handle.isNull())
+ return;
m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly);
if (!m_sharedMemory)
return;
@@ -60,28 +61,17 @@ void QtNetworkReply::setData(const SharedMemory::Handle& handle, qint64 dataSize
void QtNetworkReply::setReplyData(const QtNetworkReplyData& replyData)
{
- if (replyData.m_operation)
- setOperation(replyData.m_operation);
- if (!replyData.m_contentDisposition.isNull())
- setHeader(QNetworkRequest::ContentDispositionHeader, QString(replyData.m_contentDisposition));
- if (!replyData.m_contentType.isNull())
+ if (!replyData.m_contentType.isEmpty())
setHeader(QNetworkRequest::ContentTypeHeader, QString(replyData.m_contentType));
- if (!replyData.m_location.isNull())
- setHeader(QNetworkRequest::LocationHeader, QString(replyData.m_location));
- if (replyData.m_lastModified)
- setHeader(QNetworkRequest::LastModifiedHeader, QDateTime::fromMSecsSinceEpoch(replyData.m_lastModified));
- if (!replyData.m_cookie.isNull())
- setHeader(QNetworkRequest::SetCookieHeader, QVariant::fromValue(QNetworkCookie::parseCookies(QString(replyData.m_cookie).toAscii())));
- if (!replyData.m_userAgent.isNull())
- setHeader(QNetworkRequest::UserAgentHeader, QString(replyData.m_userAgent));
- if (!replyData.m_server.isNull())
- setHeader(QNetworkRequest::ServerHeader, QString(replyData.m_server));
setHeader(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(replyData.m_contentLength));
setData(replyData.m_dataHandle, replyData.m_contentLength);
}
qint64 QtNetworkReply::readData(char* data, qint64 maxlen)
{
+ if (!m_sharedMemory)
+ return 0;
+
qint64 bytesRead = maxlen < m_bytesAvailable ? maxlen : m_bytesAvailable;
if (qMemCopy(data, static_cast<char*>(m_sharedMemory->data()) + m_sharedMemorySize - m_bytesAvailable, bytesRead)) {
m_bytesAvailable -= bytesRead;
@@ -95,11 +85,6 @@ qint64 QtNetworkReply::bytesAvailable() const
return m_bytesAvailable + QNetworkReply::bytesAvailable();
}
-void QtNetworkReply::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
-{
- QNetworkReply::setHeader(header, value);
-}
-
void QtNetworkReply::abort() { }
void QtNetworkReply::close() { }
void QtNetworkReply::setReadBufferSize(qint64 size) { }
diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkReply.h b/Source/WebKit2/WebProcess/qt/QtNetworkReply.h
index 8ceb7926e..d32c82103 100644
--- a/Source/WebKit2/WebProcess/qt/QtNetworkReply.h
+++ b/Source/WebKit2/WebProcess/qt/QtNetworkReply.h
@@ -42,12 +42,12 @@ public:
virtual qint64 readData(char *data, qint64 maxlen);
virtual qint64 bytesAvailable() const;
- void setHeader(QNetworkRequest::KnownHeaders, const QVariant &value);
- void setData(const SharedMemory::Handle&, qint64 dataSize);
void setReplyData(const QtNetworkReplyData&);
void finalize();
protected:
+ void setData(const SharedMemory::Handle&, qint64 dataSize);
+
virtual void abort();
virtual void close();
virtual void setReadBufferSize(qint64);
@@ -55,7 +55,6 @@ protected:
private:
qint64 m_bytesAvailable;
- QByteArray m_buffer;
RefPtr<SharedMemory> m_sharedMemory;
qint64 m_sharedMemorySize;
};
diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
index c38e38241..91e7ae437 100644
--- a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
+++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp
@@ -25,9 +25,10 @@
*/
#include "config.h"
-#include "RunLoop.h"
-#include <runtime/InitializeThreading.h>
+
#include "WebProcess.h"
+#include <WebCore/RunLoop.h>
+#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
#include <QApplication>
diff --git a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
index 5edeefe5c..2a70685e4 100644
--- a/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
+++ b/Source/WebKit2/WebProcess/win/WebProcessMainWin.cpp
@@ -27,14 +27,16 @@
#include "WebProcessMain.h"
#include "CommandLine.h"
-#include "RunLoop.h"
#include "WebProcess.h"
+#include <WebCore/RunLoop.h>
#include <WebCore/SoftLinking.h>
#include <runtime/InitializeThreading.h>
#include <wtf/MainThread.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
+using namespace WebCore;
+
namespace WebKit {
#if USE(SAFARI_THEME)
diff --git a/Source/WebKit2/config.h b/Source/WebKit2/config.h
index b8e8a775b..7db76c020 100644
--- a/Source/WebKit2/config.h
+++ b/Source/WebKit2/config.h
@@ -61,12 +61,6 @@ static const type& name() \
#if PLATFORM(MAC)
-#ifdef __OBJC__
-#define OBJC_CLASS @class
-#else
-#define OBJC_CLASS class
-#endif
-
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
#define ENABLE_WEB_PROCESS_SANDBOX 1
#endif
diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def
index 1aa848167..a1926a5ea 100644
--- a/Source/WebKit2/win/WebKit2.def
+++ b/Source/WebKit2/win/WebKit2.def
@@ -133,7 +133,6 @@ EXPORTS
?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
?waitForThreadCompletion@WTF@@YAHIPAPAX@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
-
; Re-exports from WebCore for test harnesses
??0NodeRenderingContext@WebCore@@QAE@PAVNode@1@@Z
??1NodeRenderingContext@WebCore@@QAE@XZ
@@ -143,19 +142,22 @@ EXPORTS
??0ClientRect@WebCore@@AAE@XZ
??0String@WTF@@QAE@PBD@Z
??0String@WTF@@QAE@PB_W@Z
+ ??1FrameDestructionObserver@WebCore@@MAE@XZ
+ ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
+ ?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
- ?create@ShadowContentElement@WebCore@@SA?AV?$PassRefPtr@VShadowContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z
?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z
?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
+ ?frameDestroyed@FrameDestructionObserver@WebCore@@UAEXXZ
?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ
?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
@@ -164,13 +166,15 @@ EXPORTS
?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z
+ ?observeFrame@FrameDestructionObserver@WebCore@@IAEXPAVFrame@2@@Z
+ ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z
+ ; ?numberOfScopedHTMLStyleChildren@Element@WebCore@@QBEIXZ
?page@Document@WebCore@@QBEPAVPage@2@XZ
?paintControlTints@FrameView@WebCore@@AAEXXZ
?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVElement@2@HH_N@Z
?removeShadowRoot@Element@WebCore@@QAEXXZ
?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ
?scrollElementToRect@FrameView@WebCore@@QAEXPAVElement@2@ABVIntRect@2@@Z
- ?setShouldLayoutFixedElementsRelativeToFrame@FrameView@WebCore@@QAEX_N@Z
?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
?setMockScrollbarsEnabled@Settings@WebCore@@SAX_N@Z
?setPageScaleFactor@Page@WebCore@@QAEXMABVIntPoint@2@@Z
@@ -181,6 +185,7 @@ EXPORTS
?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
?settings@Document@WebCore@@QBEPAVSettings@2@XZ
?settings@Frame@WebCore@@QBEPAVSettings@2@XZ
+ ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z
?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
@@ -190,4 +195,5 @@ EXPORTS
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVRange@1@@Z
?toRange@WebCore@@YAPAVRange@1@VJSValue@JSC@@@Z
?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
+ ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ
?view@Document@WebCore@@QBEPAVFrameView@2@XZ
diff --git a/Source/WebKit2/win/WebKit2.vcproj b/Source/WebKit2/win/WebKit2.vcproj
index 752278ddc..167ba3d91 100755
--- a/Source/WebKit2/win/WebKit2.vcproj
+++ b/Source/WebKit2/win/WebKit2.vcproj
@@ -3887,14 +3887,6 @@
>
</File>
<File
- RelativePath="..\Platform\RunLoop.cpp"
- >
- </File>
- <File
- RelativePath="..\Platform\RunLoop.h"
- >
- </File>
- <File
RelativePath="..\Platform\SharedMemory.h"
>
</File>
@@ -3942,10 +3934,6 @@
>
</File>
<File
- RelativePath="..\Platform\win\RunLoopWin.cpp"
- >
- </File>
- <File
RelativePath="..\Platform\win\SharedMemoryWin.cpp"
>
</File>
diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def
index 6b6448db1..384992d31 100644
--- a/Source/WebKit2/win/WebKit2CFLite.def
+++ b/Source/WebKit2/win/WebKit2CFLite.def
@@ -136,19 +136,22 @@ EXPORTS
??0ClientRect@WebCore@@AAE@XZ
??0String@WTF@@QAE@PBD@Z
??0String@WTF@@QAE@PB_W@Z
+ ??1FrameDestructionObserver@WebCore@@MAE@XZ
+ ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
+ ?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
- ?create@ShadowContentElement@WebCore@@SA?AV?$PassRefPtr@VShadowContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z
?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z
?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
+ ?frameDestroyed@FrameDestructionObserver@WebCore@@UAEXXZ
?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ
?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
@@ -157,13 +160,15 @@ EXPORTS
?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z
+ ?observeFrame@FrameDestructionObserver@WebCore@@IAEXPAVFrame@2@@Z
+ ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z
+ ; ?numberOfScopedHTMLStyleChildren@Element@WebCore@@QBEIXZ
?page@Document@WebCore@@QBEPAVPage@2@XZ
?paintControlTints@FrameView@WebCore@@AAEXXZ
?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVElement@2@HH_N@Z
?removeShadowRoot@Element@WebCore@@QAEXXZ
?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ
?scrollElementToRect@FrameView@WebCore@@QAEXPAVElement@2@ABVIntRect@2@@Z
- ?setShouldLayoutFixedElementsRelativeToFrame@FrameView@WebCore@@QAEX_N@Z
?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
?setMockScrollbarsEnabled@Settings@WebCore@@SAX_N@Z
?setPageScaleFactor@Page@WebCore@@QAEXMABVIntPoint@2@@Z
@@ -174,6 +179,7 @@ EXPORTS
?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
?settings@Document@WebCore@@QBEPAVSettings@2@XZ
?settings@Frame@WebCore@@QBEPAVSettings@2@XZ
+ ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z
?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
@@ -183,4 +189,5 @@ EXPORTS
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVRange@1@@Z
?toRange@WebCore@@YAPAVRange@1@VJSValue@JSC@@@Z
?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
+ ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ
?view@Document@WebCore@@QBEPAVFrameView@2@XZ