diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
commit | 33b26980cb24288b5a9f2590ccf32a949281bb79 (patch) | |
tree | cc0203dac37338b24b0b25a4694c0b76d4e4164b /Source/WebKit2 | |
parent | 715be629d51174233403237bfc563cf150087dc8 (diff) | |
download | qtwebkit-33b26980cb24288b5a9f2590ccf32a949281bb79.tar.gz |
Imported WebKit commit c596dd7f03007fa7ed896b928106497e8784b3b5 (http://svn.webkit.org/repository/webkit/trunk@129610)
New snapshot that removes QtQuick1 support (to be moved into QtQuick1 module)
Diffstat (limited to 'Source/WebKit2')
59 files changed, 1018 insertions, 330 deletions
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 66240b840..5492dce9a 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,545 @@ +2012-09-25 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> + + [DRT][WTR] Support overriding the 'WebKitDisplayImagesKey' preference + https://bugs.webkit.org/show_bug.cgi?id=96883 + + Reviewed by Kenneth Rohde Christiansen. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add + support for changing + WebPreferencesKey::loadsImagesAutomaticallyKey(). + +2012-09-25 Dan Bernstein <mitz@apple.com> + + Try to fix non-Mac builds. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): + +2012-09-25 Dan Bernstein <mitz@apple.com> + + WebKit2 part of <rdar://problem/11455228> [mac] Stop using screen fonts + https://bugs.webkit.org/show_bug.cgi?id=97620 + + Reviewed by John Sullivan. + + * Shared/WebPreferencesStore.h: + (WebKit): Changed the default value of the screenFontSubstitutionEnabled preference to false. + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added an initializer for + the new shouldForceScreenFontSubstitution data member. + (WebKit::WebProcessCreationParameters::encode): Added encoding of shouldForceScreenFontSubstitution. + (WebKit::WebProcessCreationParameters::decode): Added decoding of shouldForceScreenFontSubstitution. + * Shared/WebProcessCreationParameters.h: + (WebProcessCreationParameters): Added shouldForceScreenFontSubstitution boolean data member. + * UIProcess/mac/WebContextMac.mm: + (WebKit::WebContext::platformInitializeWebProcess): Added code to set shouldForceScreenFontSubstitution + in the process creation parameters to the value of the NSFontDefaultScreenFontSubstitutionEnabled user + defaults key. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::updatePreferences): Changed to enable screen font substitution also if + shouldForceScreenFontSubstitution() is true. + * WebProcess/WebProcess.h: + (WebKit::WebProcess::shouldForceScreenFontSubstitution): Added this getter. + (WebProcess): Added m_shouldForceScreenFontSubstitution boolean data member. + * WebProcess/mac/WebProcessMac.mm: + (WebKit::WebProcess::platformInitializeWebProcess): Added initialization of + m_shouldForceScreenFontSubstitution from the creation parameters. + +2012-09-25 Alexey Proskuryakov <ap@apple.com> + + Get rid of WebContext::m_pendingMessagesToPostToInjectedBundle + https://bugs.webkit.org/show_bug.cgi?id=94368 + + Reviewed by Anders Carlsson. + + It doesn't appear to be of any use. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::createNewWebProcess): + (WebKit::WebContext::postMessageToInjectedBundle): + * UIProcess/WebContext.h: + +2012-09-24 Simon Fraser <simon.fraser@apple.com> + + <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed + + Reviewed by Mark Rowe. + + Use a new WebKitSytemInterface function to add data to crash logs about which + test was running when the crash happened. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation. + +2012-09-25 Beth Dakin <bdakin@apple.com> + + Build fix. I removed this function as a part of + https://bugs.webkit.org/show_bug.cgi?id=95397 but it is + still needed for nightlies and open source builds. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageSetPaintedObjectsCounterThreshold): + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + The new API has two parts. First, the client has to opt into which + layout milestones they are interested in hearing about using + WKPageListenForLayoutMilestones or + WKBundlePageListenForLayoutMilestones(). Then, WebKit will call + the didLayout(WKLayoutMilestones) callback on the appropriate + clients when the specified layout milestones have fired. didLayout + takes the WKLayoutMilestones bit mask, which will indicate which + milestones have fired since it is possible for two to fire at the + same time. + + Define WKLayoutMilestoneOptions. + * Shared/API/c/WKPageLoadTypes.h: + + Define conversions between WKLayoutMilestoneOptions and + WebCore::LayoutMilestoneOptions + * Shared/API/c/WKSharedAPICast.h: + (WebKit::toWKLayoutMilestoneOptions): + (WebKit): + (WebKit::toLayoutMilestoneOptions): + + New API. + * UIProcess/API/C/WKPage.cpp: + (WKPageListenForLayoutMilestones): + * UIProcess/API/C/WKPage.h: + * UIProcess/WebLoaderClient.cpp: + (WebKit::WebLoaderClient::didLayout): + (WebKit): + * UIProcess/WebLoaderClient.h: + (WebLoaderClient): + + didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, + and didNewFirstVisuallyNonEmptyLayout are now implemented with + didLayout under the hood. So if those old callbacks have been + defined, be sure to add the appropriate layout milestones here for + backwards-compatibility. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::initializeLoaderClient): + + New API. + (WebKit::WebPageProxy::listenForLayoutMilestones): + (WebKit): + (WebKit::WebPageProxy::didLayout): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + + New API. And remove the now-unnecessary + WKBundlePageSetPaintedObjectsCounterThreshold. + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageListenForLayoutMilestones): + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: + + New API. + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: + (WebKit::InjectedBundlePageLoaderClient::didNewFirstVisuallyNonEmptyLayout): + (WebKit): + (WebKit::InjectedBundlePageLoaderClient::didLayout): + * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: + (InjectedBundlePageLoaderClient): + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced + by dispatchDidLayout(LayoutMilestoneOptions) + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidLayout): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: + (WebFrameLoaderClient): + + didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, + and didNewFirstVisuallyNonEmptyLayout are now implemented with + didLayout under the hood. So if those old callbacks have been + defined, be sure to add the appropriate layout milestones here for + backwards-compatibility. + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::initializeInjectedBundleLoaderClient): + (WebKit): + + Call into WebCore to set the layout milestones. + (WebKit::WebPage::listenForLayoutMilestones): + * WebProcess/WebPage/WebPage.h: + (WebPage): + * WebProcess/WebPage/WebPage.messages.in: + + Account for the new member of PageLoadClient. + * WebProcess/qt/QtBuiltinBundlePage.cpp: + (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): + +2012-09-25 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK][EFL] Disk cache is never dumped to disk in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=97583 + + Reviewed by Martin Robinson. + + The problem is that WebProcess::platformTerminate(), where the + cache is currently dumped, is not called when the web process + finishes because the UI process closes the connection. The cache + is created and loaded in the main() so it can also be flushed and + dumped there, so that we also make sure it's always called when + the process finishes normally when the main loop quits. + + * WebProcess/efl/WebProcessMainEfl.cpp: + (WebKit::WebProcessMainEfl): Flush and dump the disk cache when + the main loop returns. + * WebProcess/gtk/WebProcessMainGtk.cpp: + (WebKit::WebProcessMainGtk): Ditto. + * WebProcess/soup/WebProcessSoup.cpp: + (WebKit::WebProcess::platformTerminate): Do not flush and dump + the disk cache. + +2012-09-25 Benjamin Poulain <bpoulain@apple.com> + + Add missing support for Geolocation tests on WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=97518 + + Reviewed by Sam Weinig. + + The existing API for reporting error does not support passing and error message. + + The interface UIProcess<->WebProcess is changed to take an error message, the + existing API now pass a null String, and the new function + WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage() provide + the extended support with error message. + + * UIProcess/API/C/WKGeolocationManager.cpp: + (WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage): + * UIProcess/API/C/WKGeolocationManager.h: + * UIProcess/WebGeolocationManagerProxy.cpp: + (WebKit::WebGeolocationManagerProxy::providerDidFailToDeterminePosition): + * UIProcess/WebGeolocationManagerProxy.h: + (WebGeolocationManagerProxy): + * WebProcess/Geolocation/WebGeolocationManager.cpp: + (WebKit::WebGeolocationManager::didFailToDeterminePosition): + * WebProcess/Geolocation/WebGeolocationManager.h: + (WebGeolocationManager): + * WebProcess/Geolocation/WebGeolocationManager.messages.in: + +2012-09-25 Akash Vaswani <avaswani@apple.com> + + Crash after clicking in plugin at kauaiexplorer.com + <rdar://problem/11525987/> and https://bugs.webkit.org/show_bug.cgi?id=90925 + + Reviewed by Sam Weinig. + + Bug: Clicking the plugin to navigate away from the page caused the browser to crash. + This is because it is possible for a beforeunload handler to destroy the plugin + while it is still needed. In this case the handler set visibility to "none" and + then accessed a property on the plugin script object. This forced a layout + that destroyed the plugin. + Fix: Protecting PluginView objects until they are no longer required. + This was done by adding a RefPtr at the beginning of performURLRequest() + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::performURLRequest): + +2012-09-25 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Don't kill automatically the web process when the ui process finishes + https://bugs.webkit.org/show_bug.cgi?id=97580 + + Reviewed by Martin Robinson. + + We use prctl(PR_SET_PDEATHSIG, SIGKILL); in linux to make sure the + web process is killed when the UI process finishes. This is not + needed any more since now the web process stops the main loop when + the connection with the UI process is closed in + WebProcess::didClose(). This approach is better because it works + for any platform and makes the web process finish normally from + main(). + + * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp: + (WebKit::childSetupFunction): Don't call prctl(PR_SET_PDEATHSIG, + SIGKILL) in the child process. + +2012-09-25 Benjamin Poulain <benjamin@webkit.org> + + Build fix, GeolocationClientMock should not be included by WebProcess InjectedBundle + + Unreviewed. + + The patch r129252 removes the dependencies on GeolocationClientMock, r129444 removes + GeolocationClientMock from the Mac port. The #include breaks new Mac build. + + * WebProcess/InjectedBundle/InjectedBundle.cpp: + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] PageViewportController: Consolidate positionRangeForViewportAtScale and boundPosition + https://bugs.webkit.org/show_bug.cgi?id=97222 + + Reviewed by Kenneth Rohde Christiansen. + + Those methods are used together everywhere, merge them into a single + clampViewportToContents method. + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::innerBoundedViewportScale): + (WebKit::PageViewportController::outerBoundedViewportScale): + (WebKit::PageViewportController::clampViewportToContents): + (WebKit): + (WebKit::PageViewportController::pageDidRequestScroll): + (WebKit::PageViewportController::syncVisibleContents): + * UIProcess/PageViewportController.h: + (PageViewportController): + (WebKit): + * UIProcess/qt/PageViewportControllerClientQt.cpp: + (WebKit::PageViewportControllerClientQt::focusEditableArea): + (WebKit::PageViewportControllerClientQt::zoomToAreaGestureEnded): + (WebKit::PageViewportControllerClientQt::nearestValidVisibleContentsRect): + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Unify the PageViewportController<->Client interface regarding positions + https://bugs.webkit.org/show_bug.cgi?id=97220 + + Reviewed by Kenneth Rohde Christiansen. + + - Make sure that css units are used for all position arguments + - Make sure that all positions represent the viewport relatively to the contents + rather than the other way around + - Delay clamping the viewport to the contents size in the controller rather than in the client + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewFlickablePrivate::updateViewportSize): + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::pageDidRequestScroll): + (WebKit::PageViewportController::didChangeViewportSize): + (WebKit::PageViewportController::didChangeContentsVisibility): + (WebKit::PageViewportController::syncVisibleContents): + (WebKit::PageViewportController::positionRangeForViewportAtScale): + * UIProcess/PageViewportController.h: + (PageViewportController): + * UIProcess/PageViewportControllerClient.h: + (PageViewportControllerClient): + * UIProcess/qt/PageViewportControllerClientQt.cpp: + (WebKit::PageViewportControllerClientQt::animateContentRectVisible): + (WebKit::PageViewportControllerClientQt::focusEditableArea): + (WebKit::PageViewportControllerClientQt::zoomToAreaGestureEnded): + (WebKit::PageViewportControllerClientQt::nearestValidVisibleContentsRect): + (WebKit::PageViewportControllerClientQt::setViewportPosition): + (WebKit::PageViewportControllerClientQt::updateViewportController): + * UIProcess/qt/PageViewportControllerClientQt.h: + (PageViewportControllerClientQt): + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Make sure that desktop pages honour the devicePixelRatio + https://bugs.webkit.org/show_bug.cgi?id=97215 + + Reviewed by Kenneth Rohde Christiansen. + + The desktopWidth given to computeViewportAttributes is expected to be pixel-ratio adjusted already. + We need to make sure that the viewport size is divided by the pixel ratio to prevent + the equivalent of a 1.0 devicePixelRatio to be in effect once viewportSize.width() is larger + than layoutFallbackWidth. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::sendViewportAttributesChanged): + +2012-09-25 Simon Pena <spena@igalia.com> + + [GTK] Add Undo / Redo method to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=97553 + + Reviewed by Martin Robinson. + + Add the macros for Undo / Redo support, and include them + in the documentation. + + * UIProcess/API/gtk/WebKitEditingCommands.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Abstract as much devicePixelRatio logic as possible behind PageViewportController + https://bugs.webkit.org/show_bug.cgi?id=97214 + + Reviewed by Kenneth Rohde Christiansen. + + Currently the client is required to multiply the scales it receives each bime by the + devicePixelRatio. This shouldn't be required since essentially, the only places that the + devicePixelRatio should be in use, is to adjust the layout size, multiply the base scale + and for scale constants. + + Other related changes: + - Make sure that the controller and it's client are only exchanging effective scales + (cssScale * devicePixelRatio) + - Remove members duplicating m_rawAttributes values + - Use a separate member for the minimum scale to fit the page, separate from the viewport arguments + - Make sure that the minimum scale to fit is adjusted if the contents size isn't + updated after the viewport attributes changed + - Make the scale conversion functions private to discourage this logic from spreading in the client + + * UIProcess/PageViewportController.cpp: + (WebKit::PageViewportController::PageViewportController): + (WebKit::PageViewportController::innerBoundedViewportScale): + (WebKit::PageViewportController::outerBoundedViewportScale): + (WebKit): + (WebKit::PageViewportController::devicePixelRatio): + (WebKit::PageViewportController::didChangeContentsSize): + (WebKit::PageViewportController::didChangeViewportAttributes): + (WebKit::PageViewportController::resumeContent): + (WebKit::PageViewportController::updateMinimumScaleToFit): + * UIProcess/PageViewportController.h: + (PageViewportController): + (WebKit::PageViewportController::minimumContentsScale): + (WebKit::PageViewportController::maximumContentsScale): + (WebKit::PageViewportController::currentContentsScale): + (WebKit::PageViewportController::fromViewportScale): + (WebKit::PageViewportController::toViewportScale): + * UIProcess/qt/PageViewportControllerClientQt.cpp: + (WebKit::PageViewportControllerClientQt::focusEditableArea): + (WebKit::PageViewportControllerClientQt::zoomToAreaGestureEnded): + (WebKit::PageViewportControllerClientQt::nearestValidVisibleContentsRect): + (WebKit::PageViewportControllerClientQt::setContentsRectToNearestValidBounds): + (WebKit::PageViewportControllerClientQt::pinchGestureRequestUpdate): + +2012-09-25 Simon Pena <spena@igalia.com> + + [GTK] Fix typo in accessing union field in a GdkEvent in a WebKit2 unit test + https://bugs.webkit.org/show_bug.cgi?id=97564 + + Reviewed by Martin Robinson. + + In the WebViewTest::moveMouseTo method, the wrong field in + a union was being accessed in a GdkEvent: instead of the button + field, we were supposed to act on the motion one. This patch + fixes the typo. + + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (WebViewTest::mouseMoveTo): + +2012-09-25 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Don't use the C API internally in WebKitFindController + https://bugs.webkit.org/show_bug.cgi?id=96775 + + Reviewed by Gustavo Noronha Silva. + + Using the C++ classes directly instead of the C API wrappers we + avoid a lot of toImpl/toAPI casts, string conversions and + allocations. The code is also a lot simpler and easier to read. + + * UIProcess/API/gtk/WebKitFindController.cpp: + (getPage): + (webkitFindControllerConstructed): + (webKitFindControllerPerform): + (webkit_find_controller_search_next): + (webkit_find_controller_search_previous): + (webkit_find_controller_search_finish): + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Apply the devicePixelRatio as soon as possible + https://bugs.webkit.org/show_bug.cgi?id=97211 + + Reviewed by Kenneth Rohde Christiansen. + + Having to wait for the contents size to apply the devicePixelRatio can + be problematic since the devicePixelRatio affects the layout width, which + then affects the contents size. + + Fix the initial issue that this was working around by preventing the + early return if useFixedLayout() is true. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::QQuickWebViewPrivate): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + (QQuickWebViewExperimental::devicePixelRatio): + (QQuickWebViewExperimental::setDevicePixelRatio): + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate::didChangeContentsSize): + (QQuickWebViewPrivate): + * UIProcess/DrawingAreaProxyImpl.cpp: + (WebKit::DrawingAreaProxyImpl::sendUpdateBackingStoreState): + +2012-09-25 Jocelyn Turcotte <jocelyn.turcotte@digia.com> + + [Qt] Don't render at scale 1.0 when doing a pinch-zoom out + https://bugs.webkit.org/show_bug.cgi?id=97212 + + Reviewed by Kenneth Rohde Christiansen. + + When the user starts pinching this creates extra rendering that is bound to the + page size and can be considerably big, reducing performance and peaking the tile + memory usage. + + Fixing this might require a different approach that we could experiment with. + + * UIProcess/qt/PageViewportControllerClientQt.cpp: + (WebKit::PageViewportControllerClientQt::animateContentRectVisible): + (WebKit::PageViewportControllerClientQt::pinchGestureRequestUpdate): + +2012-09-25 Michael Brüning <michael.bruning@digia.com> + + [Qt][WK2] Focus out is not handled properly + https://bugs.webkit.org/show_bug.cgi?id=96997 + + Reviewed by Simon Hausmann. + + Adds a handler for QQuickWebView::itemChange event that is sent to + QQuickItems when their focus has been changed to replace focusOutEvent. + + This fixes the problem because the focus has been updated when + itemChange is called, while it is not yet update when focusOutEvent + is called. + + * UIProcess/API/qt/qquickwebview.cpp: Removed focusOutEvent. + (QQuickWebView::itemChange): Added in place of focusOutEvent. + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/qt/QtWebPageEventHandler.cpp: + (WebKit::QtWebPageEventHandler::handleFocusLost): Renamed from handleFocusOutEvent, parameter removed. + * UIProcess/qt/QtWebPageEventHandler.h: + (QtWebPageEventHandler): + +2012-09-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [WK2] Supported media MIME types are not included to the list of shown MIME types. + https://bugs.webkit.org/show_bug.cgi?id=97552 + + Reviewed by Kenneth Rohde Christiansen. + + Added supported media MIME types to the list of shown MIME types in order to fix + media tests regression after r129479. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::canShowMIMEType): + * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: + (WKBundlePageCanShowMIMEType): + +2012-09-25 KwangYong Choi <ky0.choi@samsung.com> + + [EFL][WK2] Added hideColorPicker test case + https://bugs.webkit.org/show_bug.cgi?id=97522 + + Reviewed by Kenneth Rohde Christiansen. + + Added a test case for removing input element during color picker is shown. + + * UIProcess/API/efl/tests/test_ewk2_view.cpp: + (setColorPickerColor): + (showColorPicker): + (hideColorPicker): + (TEST_F): + 2012-09-25 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> [WK2][WTR] WTR bundle client loads binary data as text diff --git a/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h index ec8ae99f2..67500b40f 100644 --- a/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h +++ b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h @@ -48,6 +48,13 @@ enum { }; typedef uint32_t WKSameDocumentNavigationType; +enum { + kWKDidFirstLayout = 1 << 0, + kWKDidFirstVisuallyNonEmptyLayout = 1 << 1, + kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2 +}; +typedef uint32_t WKLayoutMilestones; + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index 8a73a01fa..94a77e176 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -47,6 +47,7 @@ #include <WebCore/FloatRect.h> #include <WebCore/FrameLoaderTypes.h> #include <WebCore/IntRect.h> +#include <WebCore/LayoutMilestones.h> #include <wtf/TypeTraits.h> namespace WebKit { @@ -748,6 +749,34 @@ inline WKSameDocumentNavigationType toAPI(SameDocumentNavigationType type) return wkType; } +inline WKLayoutMilestones toWKLayoutMilestones(WebCore::LayoutMilestones milestones) +{ + unsigned wkMilestones = 0; + + if (milestones & WebCore::DidFirstLayout) + wkMilestones |= kWKDidFirstLayout; + if (milestones & WebCore::DidFirstVisuallyNonEmptyLayout) + wkMilestones |= kWKDidFirstVisuallyNonEmptyLayout; + if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold) + wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold; + + return wkMilestones; +} + +inline WebCore::LayoutMilestones toLayoutMilestones(WKLayoutMilestones wkMilestones) +{ + WebCore::LayoutMilestones milestones = 0; + + if (wkMilestones & kWKDidFirstLayout) + milestones |= WebCore::DidFirstLayout; + if (wkMilestones & kWKDidFirstVisuallyNonEmptyLayout) + milestones |= WebCore::DidFirstVisuallyNonEmptyLayout; + if (wkMilestones & kWKDidHitRelevantRepaintedObjectsAreaThreshold) + milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold; + + return milestones; +} + inline ImageOptions toImageOptions(WKImageOptions wkImageOptions) { unsigned imageOptions = 0; diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index b70767c75..dbaa4f203 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -54,6 +54,12 @@ namespace WebKit { #define DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED false #endif +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 +#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED false +#else +#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED true +#endif + #define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \ macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \ macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \ @@ -128,7 +134,7 @@ namespace WebKit { macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false) \ macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, 0) \ macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED) \ - macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, true) \ + macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED) \ \ #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \ diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp index 31f11a7e8..cc2cecc88 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -41,6 +41,7 @@ WebProcessCreationParameters::WebProcessCreationParameters() #if PLATFORM(MAC) , nsURLCacheMemoryCapacity(0) , nsURLCacheDiskCapacity(0) + , shouldForceScreenFontSubstitution(false) #elif PLATFORM(WIN) , shouldPaintNativeControls(false) #endif @@ -91,6 +92,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con encoder->encode(acceleratedCompositingPort); encoder->encode(uiProcessBundleResourcePath); encoder->encode(uiProcessBundleResourcePathExtensionHandle); + encoder->encode(shouldForceScreenFontSubstitution); #elif PLATFORM(WIN) encoder->encode(shouldPaintNativeControls); encoder->encode(cfURLCachePath); @@ -196,6 +198,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.uiProcessBundleResourcePathExtensionHandle)) return false; + if (!decoder->decode(parameters.shouldForceScreenFontSubstitution)) + return false; #elif PLATFORM(WIN) if (!decoder->decode(parameters.shouldPaintNativeControls)) return false; diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h index 892ab8bcb..67ab33070 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.h +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -115,6 +115,7 @@ struct WebProcessCreationParameters { String uiProcessBundleResourcePath; SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle; + bool shouldForceScreenFontSubstitution; #elif PLATFORM(WIN) String cfURLCachePath; uint64_t cfURLCacheDiskCapacity; diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp index ee84090b9..384e05156 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,3 +50,8 @@ void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManager { toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition(); } + +void WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(WKGeolocationManagerRef geolocationManagerRef, WKStringRef errorMessage) +{ + toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition(toWTFString(errorMessage)); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h index bc2bdd910..7f9cb6891 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -53,6 +53,8 @@ WK_EXPORT void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocati WK_EXPORT void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManager, WKGeolocationPositionRef position); WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManager); +WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(WKGeolocationManagerRef geolocationManager, WKStringRef errorMessage); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index b2ce4fcc2..94fda474a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -330,6 +330,11 @@ WKSize WKPageFixedLayoutSize(WKPageRef pageRef) return toAPI(toImpl(pageRef)->fixedLayoutSize()); } +void WKPageListenForLayoutMilestones(WKPageRef pageRef, WKLayoutMilestones milestones) +{ + toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones)); +} + bool WKPageHasHorizontalScrollbar(WKPageRef pageRef) { return toImpl(pageRef)->hasHorizontalScrollbar(); diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index 73cf68139..62db9174c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -75,6 +75,7 @@ typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBack typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo); typedef void (*WKPageDidReceiveIntentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent, WKTypeRef userData, const void *clientInfo); typedef void (*WKPageRegisterIntentServiceForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo); // Deprecated typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo); @@ -115,7 +116,8 @@ struct WKPageLoaderClient { // Version 1 WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; - // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged. + // FIXME: didNewFirstVisuallyNonEmptyLayout should be removed. We should consider removing didFirstVisuallyNonEmptyLayoutForFrame + // as well. Their functionality is replaced by didLayout. WKPageDidNewFirstVisuallyNonEmptyLayoutCallback didNewFirstVisuallyNonEmptyLayout; WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; @@ -126,6 +128,8 @@ struct WKPageLoaderClient { // Version 2 WKPageDidReceiveIntentForFrameCallback didReceiveIntentForFrame; WKPageRegisterIntentServiceForFrameCallback registerIntentServiceForFrame; + + WKPageDidLayoutCallback didLayout; }; typedef struct WKPageLoaderClient WKPageLoaderClient; @@ -425,6 +429,8 @@ WK_EXPORT void WKPageSetFixedLayoutSize(WKPageRef page, WKSize size); WK_EXPORT bool WKPageUseFixedLayout(WKPageRef page); WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page); +WK_EXPORT void WKPageListenForLayoutMilestones(WKPageRef page, WKLayoutMilestones milestones); + WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page); WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index c3d35214c..73f3ac749 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -649,7 +649,7 @@ static unsigned char setColorPickerColor(void* data) { Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); - // 3. Change color to changed color. + // 4. Change color to changed color. EXPECT_TRUE(ewk_view_color_picker_color_set(smartData->self, changedRed, changedGreen, changedBlue, changedAlpha)); evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); @@ -664,7 +664,7 @@ static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, int r, int g, i isColorPickerShown = true; if (isFirstRun) { - // 1. Check initial value from html file. + // 2. Check initial value from html file. EXPECT_EQ(r, initialRed); EXPECT_EQ(g, initialGreen); EXPECT_EQ(b, initialBlue); @@ -672,34 +672,64 @@ static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, int r, int g, i isFirstRun = false; } else { - // 4. Input values should be same as changed color. + // 7. Input values should be same as changed color. EXPECT_EQ(r, changedRed); EXPECT_EQ(g, changedGreen); EXPECT_EQ(b, changedBlue); EXPECT_EQ(a, changedAlpha); + + evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); + return true; } - // 2. Return after making a color picker. + // 3. Return after making a color picker. ecore_timer_add(0.0, setColorPickerColor, smartData); return true; } static Eina_Bool hideColorPicker(Ewk_View_Smart_Data*) { - // Test color picker is shown. + // 5. Test color picker is shown. EXPECT_TRUE(isColorPickerShown); isColorPickerShown = false; } +static Eina_Bool hideColorPickerByRemovingElement(Ewk_View_Smart_Data* smartData) +{ + // 9. input_picker_color_dismiss() is called if the element is removed. + EXPECT_TRUE(isColorPickerShown); + isColorPickerShown = false; + evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0); +} + TEST_F(EWK2UnitTestBase, ewk_view_color_picker_color_set) { Ewk_View_Smart_Class* api = ewkViewClass(); api->input_picker_color_request = showColorPicker; api->input_picker_color_dismiss = hideColorPicker; - loadUrlSync("data:text/html,<input type='color' value='#123456'>"); - - // Click input element. + const char colorPickerHTML[] = + "<!DOCTYPE html>" + "<html>" + "<head>" + "<script>function removeInputElement(){" + "var parentElement = document.getElementById('parent');" + "var inputElement = document.getElementById('color');" + "parentElement.removeChild(inputElement);" + "}</script>" + "</head>" + "<body>" + "<div id='parent'>" + "<input type='color' value='#123456' id='color'>" + "<button onclick='removeInputElement();'>Remove Element</button>" + "</div>" + "</body>" + "</html>"; + + ewk_view_html_string_load(webView(), colorPickerHTML, 0, 0); + waitUntilLoadFinished(); + + // 1. Click input element to show color picker. mouseClick(30, 20); bool handled = false; @@ -707,12 +737,20 @@ TEST_F(EWK2UnitTestBase, ewk_view_color_picker_color_set) while (!handled) ecore_main_loop_iterate(); - // Click input element again. + // 6. Click input element to show color picker again. mouseClick(30, 20); handled = false; while (!handled) ecore_main_loop_iterate(); + + // 8. Click button to remove input element during color picker is shown. + api->input_picker_color_dismiss = hideColorPickerByRemovingElement; + mouseClick(80, 20); + + handled = false; + while (!handled) + ecore_main_loop_iterate(); evas_object_smart_callback_del(webView(), "input,type,color,request", onColorPickerDone); } #endif // ENABLE(INPUT_TYPE_COLOR) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h index 36c72a0d3..437395710 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h @@ -67,11 +67,33 @@ G_BEGIN_DECLS * * The select all command. Selects all the content of the current text field in * a #WebKitWebView. - * It is always possible to select all text, no matter wheter the #WebKitWebView content - * is editable or not. You can still check it with webkit_web_view_can_execute_editing_command(). + * It is always possible to select all text, no matter whether the + * #WebKitWebView content is editable or not. You can still check it + * with webkit_web_view_can_execute_editing_command(). */ #define WEBKIT_EDITING_COMMAND_SELECT_ALL "SelectAll" +/** + * WEBKIT_EDITING_COMMAND_UNDO: + * + * The undo command. Undoes the last editing command in a #WebKitWebView. + * You can check whether it's possible to execute the command with + * webkit_web_view_can_execute_editing_command(). It's only possible + * to undo a command after a previously executed editing operation. + */ +#define WEBKIT_EDITING_COMMAND_UNDO "Undo" + +/** + * WEBKIT_EDITING_COMMAND_REDO: + * + * The redo command. Redoes a previously undone editing command in + * a #WebKitWebView. + * You can check whether it's possible to execute the command with + * webkit_web_view_can_execute_editing_command(). It's only possible + * to redo a command when it has been previously undone. + */ +#define WEBKIT_EDITING_COMMAND_REDO "Redo" + G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp index 56be3c767..3e76b2393 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp @@ -63,11 +63,11 @@ static guint signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE(WebKitFindController, webkit_find_controller, G_TYPE_OBJECT) -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards); -COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE, FindOptionsCaseInsensitive); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_AT_WORD_STARTS, FindOptionsAtWordStarts); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, FindOptionsTreatMedialCapitalAsWordStart); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_BACKWARDS, FindOptionsBackwards); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_FIND_OPTIONS_WRAP_AROUND, FindOptionsWrapAround); static void didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo) { @@ -91,9 +91,9 @@ static void webkit_find_controller_init(WebKitFindController* findController) new (priv) WebKitFindControllerPrivate(); } -static WKPageRef inline getWKPageFromWebKitWebView(WebKitWebView* webView) +static inline WebPageProxy* getPage(WebKitFindController* findController) { - return toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); + return webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(findController->priv->webView)); } static void webkitFindControllerConstructed(GObject* object) @@ -107,7 +107,7 @@ static void webkitFindControllerConstructed(GObject* object) didCountStringMatches }; - WKPageSetPageFindClient(getWKPageFromWebKitWebView(findController->priv->webView), &wkFindClient); + WKPageSetPageFindClient(toAPI(getPage(findController)), &wkFindClient); } static void webkitFindControllerGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) @@ -342,15 +342,14 @@ WebKitWebView* webkit_find_controller_get_web_view(WebKitFindController* findCon static void webKitFindControllerPerform(WebKitFindController* findController, WebKitFindControllerOperation operation) { - WKFindOptions wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions); - WKRetainPtr<WKStringRef> wkSearchText(AdoptWK, WKStringCreateWithUTF8CString(findController->priv->searchText.data())); - WKPageRef wkPage = getWKPageFromWebKitWebView(findController->priv->webView); - + WebKitFindControllerPrivate* priv = findController->priv; if (operation == CountOperation) { - WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); + getPage(findController)->countStringMatches(String::fromUTF8(priv->searchText.data()), + static_cast<WebKit::FindOptions>(priv->findOptions), priv->maxMatchCount); return; } + uint32_t findOptions = priv->findOptions; if (operation == FindOperation) // Unconditionally highlight text matches when the search // starts. WK1 API was forcing clients to enable/disable @@ -359,9 +358,10 @@ static void webKitFindControllerPerform(WebKitFindController* findController, We // unconditionally show highlights. Both search_next() and // search_prev() should not enable highlighting to avoid an // extra unmarkAllTextMatches() + markAllTextMatches() - wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight); + findOptions |= FindOptionsShowHighlight; - WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); + getPage(findController)->findString(String::fromUTF8(priv->searchText.data()), static_cast<WebKit::FindOptions>(findOptions), + priv->maxMatchCount); } static inline void webKitFindControllerSetSearchData(WebKitFindController* findController, const gchar* searchText, guint32 findOptions, guint maxMatchCount) @@ -420,8 +420,8 @@ void webkit_find_controller_search_next(WebKitFindController* findController) { g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController)); - findController->priv->findOptions = findController->priv->findOptions & ~WEBKIT_FIND_OPTIONS_BACKWARDS; - findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; + findController->priv->findOptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS; + findController->priv->findOptions &= ~FindOptionsShowHighlight; webKitFindControllerPerform(findController, FindNextPrevOperation); } @@ -438,8 +438,8 @@ void webkit_find_controller_search_previous(WebKitFindController* findController { g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController)); - findController->priv->findOptions = findController->priv->findOptions | WEBKIT_FIND_OPTIONS_BACKWARDS; - findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; + findController->priv->findOptions |= WEBKIT_FIND_OPTIONS_BACKWARDS; + findController->priv->findOptions &= ~FindOptionsShowHighlight; webKitFindControllerPerform(findController, FindNextPrevOperation); } @@ -479,5 +479,5 @@ void webkit_find_controller_search_finish(WebKitFindController* findController) { g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController)); - WKPageHideFindUI(getWKPageFromWebKitWebView(findController->priv->webView)); + getPage(findController)->hideFindUI(); } diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index bbf979b64..1827b6b16 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -71,6 +71,8 @@ WEBKIT_EDITING_COMMAND_CUT WEBKIT_EDITING_COMMAND_COPY WEBKIT_EDITING_COMMAND_PASTE WEBKIT_EDITING_COMMAND_SELECT_ALL +WEBKIT_EDITING_COMMAND_UNDO +WEBKIT_EDITING_COMMAND_REDO <SUBSECTION> webkit_web_view_new diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp index a8d20f88c..04747480e 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp @@ -238,7 +238,7 @@ void WebViewTest::mouseMoveTo(int x, int y, unsigned int mouseModifiers) event->motion.time = GDK_CURRENT_TIME; event->motion.window = gtk_widget_get_window(viewWidget); g_object_ref(event->motion.window); - event->button.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget))); + event->motion.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget))); event->motion.state = mouseModifiers; event->motion.axes = 0; diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 80f1ba7f0..b78cae0f3 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -272,7 +272,6 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) , m_navigatorQtObjectEnabled(false) , m_renderToOffscreenBuffer(false) , m_allowAnyHTTPSCertificateForLocalHost(false) - , m_customDevicePixelRatio(0) , m_loadProgress(0) { viewport->setClip(true); @@ -798,20 +797,6 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& emit q_ptr->experimental()->messageReceived(variantMap); } -void QQuickWebViewPrivate::didChangeContentsSize(const QSize& newSize) -{ - if (newSize.isEmpty() || !m_customDevicePixelRatio || webPageProxy->deviceScaleFactor() == m_customDevicePixelRatio) - return; - - // DrawingAreaProxy returns early if the page size is empty - // and the device pixel ratio property is propagated from QML - // before the QML page item has a valid size yet, thus the - // information would not reach the web process. - // Set the custom device pixel ratio requested from QML as soon - // as the content item has a valid size. - webPageProxy->setCustomDeviceScaleFactor(m_customDevicePixelRatio); -} - QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport) : QQuickWebViewPrivate(viewport) { @@ -883,7 +868,7 @@ void QQuickWebViewFlickablePrivate::updateViewportSize() Q_Q(QQuickWebView); if (m_pageViewportController) - m_pageViewportController->setViewportSize(QSizeF(q->width(), q->height())); + m_pageViewportController->didChangeViewportSize(QSizeF(q->width(), q->height())); } void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) @@ -894,8 +879,8 @@ void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) { - pageView->setContentsSize(newSize); // emits contentsSizeChanged() QQuickWebViewPrivate::didChangeContentsSize(newSize); + pageView->setContentsSize(newSize); // emits contentsSizeChanged() m_pageViewportController->didChangeContentsSize(newSize); } @@ -1239,10 +1224,6 @@ void QQuickWebViewExperimental::setUserAgent(const QString& userAgent) qreal QQuickWebViewExperimental::devicePixelRatio() const { Q_D(const QQuickWebView); - - if (d->m_customDevicePixelRatio) - return d->m_customDevicePixelRatio; - return d->webPageProxy->deviceScaleFactor(); } @@ -1252,7 +1233,7 @@ void QQuickWebViewExperimental::setDevicePixelRatio(qreal devicePixelRatio) if (0 >= devicePixelRatio || devicePixelRatio == this->devicePixelRatio()) return; - d->m_customDevicePixelRatio = devicePixelRatio; + d->webPageProxy->setCustomDeviceScaleFactor(devicePixelRatio); emit devicePixelRatioChanged(); } @@ -1857,10 +1838,15 @@ void QQuickWebView::focusInEvent(QFocusEvent* event) d->pageView->eventHandler()->handleFocusInEvent(event); } -void QQuickWebView::focusOutEvent(QFocusEvent* event) +void QQuickWebView::itemChange(ItemChange change, const ItemChangeData &value) { Q_D(QQuickWebView); - d->pageView->eventHandler()->handleFocusOutEvent(event); + if (change == ItemActiveFocusHasChanged) { + bool focus = value.boolValue; + if (!focus) + d->pageView->eventHandler()->handleFocusLost(); + } + QQuickFlickable::itemChange(change, value); } void QQuickWebView::touchEvent(QTouchEvent* event) diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index 5feb4b45a..e8b1bf7a1 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -178,7 +178,7 @@ protected: virtual void keyReleaseEvent(QKeyEvent*); virtual void inputMethodEvent(QInputMethodEvent*); virtual void focusInEvent(QFocusEvent*); - virtual void focusOutEvent(QFocusEvent*); + virtual void itemChange(ItemChange change, const ItemChangeData &value); virtual void touchEvent(QTouchEvent*); virtual void mousePressEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index a154da8f5..f172ad68f 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -130,7 +130,7 @@ public: WebCore::IntSize viewSize() const; void didReceiveMessageFromNavigatorQtObject(const String& message); virtual void pageDidRequestScroll(const QPoint& pos) { } - virtual void didChangeContentsSize(const QSize& newSize); + virtual void didChangeContentsSize(const QSize& newSize) { } void processDidCrash(); void didRelaunchProcess(); PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy(); @@ -194,7 +194,6 @@ protected: bool m_navigatorQtObjectEnabled; bool m_renderToOffscreenBuffer; bool m_allowAnyHTTPSCertificateForLocalHost; - qreal m_customDevicePixelRatio; WTF::String m_iconUrl; int m_loadProgress; WTF::String m_currentUrl; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp index baf6470ec..966ac6b3c 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp @@ -307,7 +307,7 @@ void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot r if (m_isWaitingForDidUpdateBackingStoreState) return; - if (m_webPageProxy->viewSize().isEmpty()) + if (m_webPageProxy->viewSize().isEmpty() && !m_webPageProxy->useFixedLayout()) return; m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately; diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp index 8fb619ecd..f9b8e5b02 100644 --- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp @@ -60,11 +60,6 @@ static void childSetupFunction(gpointer userData) // 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); -#endif } static void childFinishedFunction(GPid, gint status, gpointer userData) diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index e9a513af1..e42006a14 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -32,21 +32,11 @@ using namespace WebCore; namespace WebKit { -static inline float bound(float min, float value, float max) -{ - return clampTo<float>(value, min, max); -} - bool fuzzyCompare(float a, float b, float epsilon) { return std::abs(a - b) < epsilon; } -FloatPoint boundPosition(const FloatPoint minPosition, const FloatPoint& position, const FloatPoint& maxPosition) -{ - return FloatPoint(bound(minPosition.x(), position.x(), maxPosition.x()), bound(minPosition.y(), position.y(), maxPosition.y())); -} - ViewportUpdateDeferrer::ViewportUpdateDeferrer(PageViewportController* PageViewportController, SuspendContentFlag suspendContentFlag) : m_controller(PageViewportController) { @@ -73,9 +63,7 @@ PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, Page : m_webPageProxy(proxy) , m_client(client) , m_allowsUserScaling(false) - , m_minimumScale(1) - , m_maximumScale(1) - , m_devicePixelRatio(1) + , m_minimumScaleToFit(1) , m_activeDeferrerCount(0) , m_hasSuspendedContent(false) , m_hadUserInteraction(false) @@ -84,38 +72,41 @@ PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, Page // Initializing Viewport Raw Attributes to avoid random negative scale factors // if there is a race condition between the first layout and setting the viewport attributes for the first time. m_rawAttributes.initialScale = 1; - m_rawAttributes.minimumScale = m_minimumScale; - m_rawAttributes.maximumScale = m_maximumScale; + m_rawAttributes.minimumScale = 1; + m_rawAttributes.maximumScale = 1; m_rawAttributes.userScalable = m_allowsUserScaling; ASSERT(m_client); m_client->setController(this); } -FloatRect PageViewportController::convertToViewport(const FloatRect& cssRect) const -{ - return FloatRect( - convertToViewport(cssRect.x()), - convertToViewport(cssRect.y()), - convertToViewport(cssRect.width()), - convertToViewport(cssRect.height()) - ); -} - -float PageViewportController::innerBoundedContentsScale(float cssScale) const +float PageViewportController::innerBoundedViewportScale(float viewportScale) const { - return bound(m_minimumScale, cssScale, m_maximumScale); + return clampTo(viewportScale, toViewportScale(m_minimumScaleToFit), toViewportScale(m_rawAttributes.maximumScale)); } -float PageViewportController::outerBoundedContentsScale(float cssScale) const +float PageViewportController::outerBoundedViewportScale(float viewportScale) const { if (m_allowsUserScaling) { // Bounded by [0.1, 10.0] like the viewport meta code in WebCore. - float hardMin = std::max<float>(0.1, 0.5 * m_minimumScale); - float hardMax = std::min<float>(10, 2 * m_maximumScale); - return bound(hardMin, cssScale, hardMax); + float hardMin = toViewportScale(std::max<float>(0.1, 0.5 * m_minimumScaleToFit)); + float hardMax = toViewportScale(std::min<float>(10, 2 * m_rawAttributes.maximumScale)); + return clampTo(viewportScale, hardMin, hardMax); } - return innerBoundedContentsScale(cssScale); + return innerBoundedViewportScale(viewportScale); +} + +float PageViewportController::devicePixelRatio() const +{ + return m_webPageProxy->deviceScaleFactor(); +} + +FloatPoint PageViewportController::clampViewportToContents(const WebCore::FloatPoint& viewportPos, float viewportScale) +{ + const float horizontalRange = std::max(0.f, m_contentsSize.width() - m_viewportSize.width() / viewportScale); + const float verticalRange = std::max(0.f, m_contentsSize.height() - m_viewportSize.height() / viewportScale); + + return FloatPoint(clampTo(viewportPos.x(), 0.f, horizontalRange), clampTo(viewportPos.y(), 0.f, verticalRange)); } void PageViewportController::didChangeContentsSize(const IntSize& newSize) @@ -124,17 +115,7 @@ void PageViewportController::didChangeContentsSize(const IntSize& newSize) return; m_contentsSize = newSize; - - float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), newSize); - - if (!fuzzyCompare(minimumScale, m_rawAttributes.minimumScale, 0.001)) { - m_minimumScale = minimumScale; - - if (!m_hadUserInteraction && !hasSuspendedContent()) - m_client->setContentsScale(convertToViewport(minimumScale), true /* isInitialScale */); - - m_client->didChangeViewportAttributes(); - } + updateMinimumScaleToFit(); m_client->didChangeContentsSize(); } @@ -145,15 +126,10 @@ void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition) if (m_activeDeferrerCount) return; - FloatRect endPosRange = positionRangeForContentAtScale(m_effectiveScale); - FloatPoint endPosition(cssPosition); - endPosition.scale(m_effectiveScale, m_effectiveScale); - endPosition = boundPosition(endPosRange.minXMinYCorner(), endPosition, endPosRange.maxXMaxYCorner()); - - m_client->setContentsPosition(endPosition); + m_client->setViewportPosition(clampViewportToContents(cssPosition, m_effectiveScale)); } -void PageViewportController::setViewportSize(const FloatSize& newSize) +void PageViewportController::didChangeViewportSize(const FloatSize& newSize) { if (newSize.isEmpty()) return; @@ -167,9 +143,9 @@ void PageViewportController::setViewportSize(const FloatSize& newSize) syncVisibleContents(); } -void PageViewportController::setVisibleContentsRect(const FloatRect& visibleContentsRect, float viewportScale, const FloatPoint& trajectoryVector) +void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewportPos, float viewportScale, const FloatPoint& trajectoryVector) { - m_visibleContentsRect = visibleContentsRect; + m_viewportPos = viewportPos; m_effectiveScale = viewportScale; syncVisibleContents(trajectoryVector); } @@ -177,10 +153,12 @@ void PageViewportController::setVisibleContentsRect(const FloatRect& visibleCont void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVector) { DrawingAreaProxy* const drawingArea = m_webPageProxy->drawingArea(); - if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty() || m_visibleContentsRect.isEmpty()) + if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return; - drawingArea->setVisibleContentsRect(m_visibleContentsRect, m_effectiveScale, trajectoryVector); + FloatRect visibleContentsRect(clampViewportToContents(m_viewportPos, m_effectiveScale), m_viewportSize / m_effectiveScale); + visibleContentsRect.intersect(FloatRect(FloatPoint::zero(), m_contentsSize)); + drawingArea->setVisibleContentsRect(visibleContentsRect, m_effectiveScale, trajectoryVector); m_client->didChangeVisibleContents(); } @@ -193,10 +171,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport m_rawAttributes = newAttributes; WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); - m_devicePixelRatio = m_webPageProxy->deviceScaleFactor(); m_allowsUserScaling = !!m_rawAttributes.userScalable; - m_minimumScale = m_rawAttributes.minimumScale; - m_maximumScale = m_rawAttributes.maximumScale; + updateMinimumScaleToFit(); m_client->didChangeViewportAttributes(); } @@ -214,7 +190,7 @@ void PageViewportController::resumeContent() { if (!m_rawAttributes.layoutSize.isEmpty() && m_rawAttributes.initialScale > 0) { m_hadUserInteraction = false; - m_client->setContentsScale(convertToViewport(innerBoundedContentsScale(m_rawAttributes.initialScale)), /* isInitialScale */ true); + m_client->setContentsScale(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale)), /* isInitialScale */ true); m_rawAttributes.initialScale = -1; // Mark used. } @@ -227,14 +203,18 @@ void PageViewportController::resumeContent() m_webPageProxy->resumeActiveDOMObjectsAndAnimations(); } -FloatRect PageViewportController::positionRangeForContentAtScale(float viewportScale) const +void PageViewportController::updateMinimumScaleToFit() { - const FloatSize contentSize = m_contentsSize * viewportScale; + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize)); - const float horizontalRange = contentSize.width() - m_viewportSize.width(); - const float verticalRange = contentSize.height() - m_viewportSize.height(); + if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) { + m_minimumScaleToFit = minimumScale; - return FloatRect(0, 0, horizontalRange, verticalRange); + if (!m_hadUserInteraction && !hasSuspendedContent()) + m_client->setContentsScale(toViewportScale(minimumScale), true /* isInitialScale */); + + m_client->didChangeViewportAttributes(); + } } } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index 1820d8d69..acbb22a58 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -74,30 +74,25 @@ public: void suspendContent(); void resumeContent(); - WebCore::FloatRect positionRangeForContentAtScale(float viewportScale) const; - - float convertFromViewport(float value) const { return value / m_devicePixelRatio; } - float convertToViewport(float value) const { return value * m_devicePixelRatio; } - WebCore::FloatRect convertToViewport(const WebCore::FloatRect&) const; - - float innerBoundedContentsScale(float) const; - float outerBoundedContentsScale(float) const; + float innerBoundedViewportScale(float) const; + float outerBoundedViewportScale(float) const; + WebCore::FloatPoint clampViewportToContents(const WebCore::FloatPoint& viewportPos, float viewportScale); bool hasSuspendedContent() const { return m_hasSuspendedContent; } bool hadUserInteraction() const { return m_hadUserInteraction; } bool allowsUserScaling() const { return m_allowsUserScaling; } WebCore::FloatSize contentsLayoutSize() const { return m_rawAttributes.layoutSize; } - float devicePixelRatio() const { return m_devicePixelRatio; } - float minimumContentsScale() const { return m_minimumScale; } - float maximumContentsScale() const { return m_maximumScale; } - float currentContentsScale() const { return convertFromViewport(m_effectiveScale); } + float devicePixelRatio() const; + float minimumContentsScale() const { return m_minimumScaleToFit; } + float maximumContentsScale() const { return m_rawAttributes.maximumScale; } + float currentContentsScale() const { return fromViewportScale(m_effectiveScale); } void setHadUserInteraction(bool didUserInteract) { m_hadUserInteraction = didUserInteract; } - // Notifications to the WebProcess. - void setViewportSize(const WebCore::FloatSize& newSize); - void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float viewportScale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero()); + // Notifications from the viewport. + void didChangeViewportSize(const WebCore::FloatSize& newSize); + void didChangeContentsVisibility(const WebCore::FloatPoint& viewportPos, float viewportScale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero()); // Notifications from the WebProcess. void didChangeContentsSize(const WebCore::IntSize& newSize); @@ -105,7 +100,10 @@ public: void pageDidRequestScroll(const WebCore::IntPoint& cssPosition); private: + float fromViewportScale(float scale) const { return scale / devicePixelRatio(); } + float toViewportScale(float scale) const { return scale * devicePixelRatio(); } void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); + void updateMinimumScaleToFit(); WebPageProxy* const m_webPageProxy; PageViewportControllerClient* m_client; @@ -113,24 +111,21 @@ private: WebCore::ViewportAttributes m_rawAttributes; bool m_allowsUserScaling; - float m_minimumScale; - float m_maximumScale; - float m_devicePixelRatio; + float m_minimumScaleToFit; int m_activeDeferrerCount; bool m_hasSuspendedContent; bool m_hadUserInteraction; + WebCore::FloatPoint m_viewportPos; WebCore::FloatSize m_viewportSize; WebCore::FloatSize m_contentsSize; - WebCore::FloatRect m_visibleContentsRect; float m_effectiveScale; // Should always be cssScale * devicePixelRatio. friend class ViewportUpdateDeferrer; }; bool fuzzyCompare(float, float, float epsilon); -WebCore::FloatPoint boundPosition(const WebCore::FloatPoint minPosition, const WebCore::FloatPoint& position, const WebCore::FloatPoint& maxPosition); } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/PageViewportControllerClient.h b/Source/WebKit2/UIProcess/PageViewportControllerClient.h index 6a50b4217..3d91b9aac 100644 --- a/Source/WebKit2/UIProcess/PageViewportControllerClient.h +++ b/Source/WebKit2/UIProcess/PageViewportControllerClient.h @@ -33,8 +33,8 @@ public: PageViewportControllerClient() { } virtual ~PageViewportControllerClient() { } - virtual void setContentsPosition(const WebCore::FloatPoint& localPoint) = 0; - virtual void setContentsScale(float localScale, bool treatAsInitialValue) = 0; + virtual void setViewportPosition(const WebCore::FloatPoint& contentsPoint) = 0; + virtual void setContentsScale(float, bool treatAsInitialValue) = 0; virtual void didResumeContent() = 0; virtual void didChangeContentsSize() = 0; diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp index fbdc6b3fa..f0c3580c1 100644 --- a/Source/WebKit2/UIProcess/WebContext.cpp +++ b/Source/WebKit2/UIProcess/WebContext.cpp @@ -366,13 +366,6 @@ PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess() injectedBundleInitializationUserData = m_injectedBundleInitializationUserData; process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0); - for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) { - pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i]; - process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get()))); - } - // FIXME (Multi-WebProcess) (94368): What does this mean in the brave new world? - m_pendingMessagesToPostToInjectedBundle.clear(); - return process.release(); } @@ -566,18 +559,14 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) { - if (m_processes.isEmpty()) { - m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); + if (m_processes.isEmpty()) return; - } + + // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process. for (size_t i = 0; i < m_processes.size(); ++i) { - // FIXME (Multi-WebProcess): Evolve m_pendingMessagesToPostToInjectedBundle to work with multiple secondary processes. - if (!m_processes[i]->canSendMessage()) { - m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody)); - continue; - } // FIXME: We should consider returning false from this function if the messageBody cannot be encoded. + // FIXME: Can we encode the message body outside the loop for all the processes? m_processes[i]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody))); } } diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h index 1d051c817..2de4a71c6 100644 --- a/Source/WebKit2/UIProcess/WebContext.h +++ b/Source/WebKit2/UIProcess/WebContext.h @@ -307,8 +307,6 @@ private: bool m_alwaysUsesComplexTextCodePath; bool m_shouldUseFontSmoothing; - Vector<pair<String, RefPtr<APIObject> > > m_pendingMessagesToPostToInjectedBundle; - CacheModel m_cacheModel; WebDownloadClient m_downloadClient; diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index 14ab88aed..af49f9bc1 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,12 +64,12 @@ void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPositio m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data())); } -void WebGeolocationManagerProxy::providerDidFailToDeterminePosition() +void WebGeolocationManagerProxy::providerDidFailToDeterminePosition(const String& errorMessage) { if (!m_context) return; - m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition()); + m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage)); } void WebGeolocationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h index 509169318..65d7b7a7e 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,6 +29,7 @@ #include "APIObject.h" #include "MessageID.h" #include "WebGeolocationProvider.h" +#include <wtf/text/WTFString.h> namespace CoreIPC { class ArgumentDecoder; @@ -53,7 +54,7 @@ public: void initializeProvider(const WKGeolocationProvider*); void providerDidChangePosition(WebGeolocationPosition*); - void providerDidFailToDeterminePosition(); + void providerDidFailToDeterminePosition(const String& errorMessage = String()); void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp index 4d3c459ce..93c60d430 100644 --- a/Source/WebKit2/UIProcess/WebLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp @@ -136,6 +136,14 @@ void WebLoaderClient::didNewFirstVisuallyNonEmptyLayout(WebPageProxy* page, APIO m_client.didNewFirstVisuallyNonEmptyLayout(toAPI(page), toAPI(userData), m_client.clientInfo); } +void WebLoaderClient::didLayout(WebPageProxy* page, LayoutMilestones milestones, APIObject* userData) +{ + if (!m_client.didLayout) + return; + + m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), 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 f1291a288..85f107287 100644 --- a/Source/WebKit2/UIProcess/WebLoaderClient.h +++ b/Source/WebKit2/UIProcess/WebLoaderClient.h @@ -29,6 +29,7 @@ #include "APIClient.h" #include "SameDocumentNavigationType.h" #include "WKPage.h" +#include <WebCore/LayoutMilestones.h> #include <wtf/Forward.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -80,9 +81,10 @@ public: void registerIntentServiceForFrame(WebPageProxy*, WebFrameProxy*, WebIntentServiceInfo*, APIObject*); #endif - // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged. - // The only reason for both to exist is to experiment with different heuristics for the time being. + // FIXME: didNewFirstVisuallyNonEmptyLayout should be removed. We should consider removing didFirstVisuallyNonEmptyLayoutForFrame + // as well. They are both being replaced by didLayout. void didNewFirstVisuallyNonEmptyLayout(WebPageProxy*, APIObject*); + void didLayout(WebPageProxy*, WebCore::LayoutMilestones, 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 9bbabe12b..a0e9ee7f7 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -284,6 +284,20 @@ void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient) if (!loadClient) return; + // It would be nice to get rid of this code and transition all clients to using didLayout instead of + // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required + // for backwards compatibility. + WebCore::LayoutMilestones milestones = 0; + if (loadClient->didFirstLayoutForFrame) + milestones |= WebCore::DidFirstLayout; + if (loadClient->didFirstVisuallyNonEmptyLayoutForFrame) + milestones |= WebCore::DidFirstVisuallyNonEmptyLayout; + if (loadClient->didNewFirstVisuallyNonEmptyLayout) + milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold; + + if (milestones) + m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID); + m_process->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID); } @@ -737,6 +751,9 @@ bool WebPageProxy::canShowMIMEType(const String& mimeType) const if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) return true; + if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType)) + return true; + if (mimeType.startsWith("text/", false)) return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType); @@ -1509,6 +1526,14 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size) m_process->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); } +void WebPageProxy::listenForLayoutMilestones(WebCore::LayoutMilestones milestones) +{ + if (!isValid()) + return; + + m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID); +} + void WebPageProxy::setSuppressScrollbarAnimations(bool suppressAnimations) { if (!isValid()) @@ -2161,6 +2186,16 @@ void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* a m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get()); } +void WebPageProxy::didLayout(uint32_t layoutMilestones, CoreIPC::ArgumentDecoder* arguments) +{ + RefPtr<APIObject> userData; + WebContextUserMessageDecoder messageDecoder(userData, m_process.get()); + if (!arguments->decode(messageDecoder)) + return; + + m_loaderClient.didLayout(this, static_cast<LayoutMilestones>(layoutMilestones), userData.get()); +} + void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) { RefPtr<APIObject> userData; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 28c5da90a..4cbafa3a9 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -484,6 +484,8 @@ public: bool useFixedLayout() const { return m_useFixedLayout; }; const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; }; + void listenForLayoutMilestones(WebCore::LayoutMilestones); + bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; } bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; } @@ -765,6 +767,7 @@ private: void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); void didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder*); + void didLayout(uint32_t layoutMilestones, CoreIPC::ArgumentDecoder*); void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*); void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index a4a3c57bf..3a755e1dd 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -127,6 +127,7 @@ messages -> WebPageProxy { DidFirstLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData) DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData) + DidLayout(uint32_t type, 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) diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm index b1d99c812..68c8e1125 100644 --- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm @@ -97,6 +97,9 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity]; parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity]; +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"]; +#endif #if ENABLE(PLUGIN_PROCESS) parameters.disablePluginProcessMessageTimeout = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisablePluginProcessMessageTimeout"]; diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index c517023e2..9e2531f57 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -106,16 +106,15 @@ void PageViewportControllerClientQt::animateContentRectVisible(const QRectF& con return; } + // Inform the web process about the requested visible content rect immediately so that new tiles + // are rendered at the final destination during the animation. + m_controller->didChangeContentsVisibility(contentRect.topLeft(), viewportScaleForRect(contentRect)); + // Since we have to animate scale and position at the same time the scale animation interpolates // from the current viewport rect in content coordinates to a visible rect of the content. m_scaleAnimation->setStartValue(viewportRectInContentCoords); m_scaleAnimation->setEndValue(contentRect); - // Inform the web process about the requested visible content rect - // if zooming-out so that no white tiles are exposed during animation. - if (viewportRectInContentCoords.width() / contentRect.width() < m_pageItem->contentsScale()) - m_controller->setVisibleContentsRect(contentRect, viewportScaleForRect(contentRect)); - m_scaleAnimation->start(); } @@ -186,34 +185,30 @@ void PageViewportControllerClientQt::focusEditableArea(const QRectF& caretArea, // This can only happen as a result of a user interaction. ASSERT(m_controller->hadUserInteraction()); - QRectF endArea = m_controller->convertToViewport(targetArea); - - qreal endItemScale = m_controller->convertToViewport(m_controller->innerBoundedContentsScale(2.0)); + const float editingFixedScale = 2 * m_controller->devicePixelRatio(); + float targetScale = m_controller->innerBoundedViewportScale(editingFixedScale); const QRectF viewportRect = m_viewportItem->boundingRect(); qreal x; - const qreal borderOffset = 10; - if ((endArea.width() + borderOffset) * endItemScale <= viewportRect.width()) { + const qreal borderOffset = 10 * m_controller->devicePixelRatio(); + if ((targetArea.width() + borderOffset) * targetScale <= viewportRect.width()) { // Center the input field in the middle of the view, if it is smaller than // the view at the scale target. - x = viewportRect.center().x() - endArea.width() * endItemScale / 2.0; + x = viewportRect.center().x() - targetArea.width() * targetScale / 2.0; } else { // Ensure that the caret always has borderOffset contents pixels to the right // of it, and secondarily (if possible), that the area has borderOffset // contents pixels to the left of it. - qreal caretOffset = m_controller->convertToViewport(caretArea.x()) - endArea.x(); - x = qMin(viewportRect.width() - (caretOffset + borderOffset) * endItemScale, borderOffset * endItemScale); + qreal caretOffset = caretArea.x() - targetArea.x(); + x = qMin(viewportRect.width() - (caretOffset + borderOffset) * targetScale, borderOffset * targetScale); } - const QPointF hotspot = QPointF(endArea.x(), endArea.center().y()); + const QPointF hotspot = QPointF(targetArea.x(), targetArea.center().y()); const QPointF viewportHotspot = QPointF(x, /* FIXME: visibleCenter */ viewportRect.center().y()); - QPointF endPosition = hotspot * endItemScale - viewportHotspot; - QRectF endPosRange = m_controller->positionRangeForContentAtScale(endItemScale); - - endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); - - QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); + QPointF endPosition = hotspot - viewportHotspot / targetScale; + endPosition = m_controller->clampViewportToContents(endPosition, targetScale); + QRectF endVisibleContentRect(endPosition, viewportRect.size() / targetScale); animateContentRectVisible(endVisibleContentRect); } @@ -229,28 +224,25 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch if (m_controller->hasSuspendedContent()) return; - const int margin = 10; // We want at least a little bit of margin. - QRectF endArea = m_controller->convertToViewport(targetArea.adjusted(-margin, -margin, margin, margin)); + const float margin = 10 * m_controller->devicePixelRatio(); // We want at least a little bit of margin. + QRectF endArea = targetArea.adjusted(-margin, -margin, margin, margin); const QRectF viewportRect = m_viewportItem->boundingRect(); - qreal targetCSSScale = viewportRect.size().width() / endArea.size().width(); - qreal endCSSScale = m_controller->innerBoundedContentsScale(qMin(targetCSSScale, qreal(2.5))); - qreal endItemScale = m_controller->convertToViewport(endCSSScale); + qreal minViewportScale = qreal(2.5) * m_controller->devicePixelRatio(); + qreal targetScale = viewportRect.size().width() / endArea.size().width(); + targetScale = m_controller->innerBoundedViewportScale(qMin(minViewportScale, targetScale)); qreal currentScale = m_pageItem->contentsScale(); // We want to end up with the target area filling the whole width of the viewport (if possible), // and centralized vertically where the user requested zoom. Thus our hotspot is the center of // the targetArea x-wise and the requested zoom position, y-wise. - const QPointF hotspot = QPointF(endArea.center().x(), m_controller->convertToViewport(touchPoint.y())); + const QPointF hotspot = QPointF(endArea.center().x(), touchPoint.y()); const QPointF viewportHotspot = viewportRect.center(); - QPointF endPosition = hotspot * endCSSScale - viewportHotspot; - - QRectF endPosRange = m_controller->positionRangeForContentAtScale(endItemScale); - endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); - - QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); + QPointF endPosition = hotspot - viewportHotspot / targetScale; + endPosition = m_controller->clampViewportToContents(endPosition, targetScale); + QRectF endVisibleContentRect(endPosition, viewportRect.size() / targetScale); enum { ZoomIn, ZoomBack, ZoomOut, NoZoom } zoomAction = ZoomIn; @@ -258,9 +250,9 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch // Zoom back out if attempting to scale to the same current scale, or // attempting to continue scaling out from the inner most level. // Use fuzzy compare with a fixed error to be able to deal with largish differences due to pixel rounding. - if (fuzzyCompare(endItemScale, currentScale, 0.01)) { + if (fuzzyCompare(targetScale, currentScale, 0.01)) { // If moving the viewport would expose more of the targetRect and move at least 40 pixels, update position but do not scale out. - QRectF currentContentRect(visibleContentsRect()); + QRectF currentContentRect(m_viewportItem->mapRectToWebContent(viewportRect)); QRectF targetIntersection = endVisibleContentRect.intersected(targetArea); if (!currentContentRect.contains(targetIntersection) && (qAbs(endVisibleContentRect.top() - currentContentRect.top()) >= 40 @@ -268,34 +260,32 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch zoomAction = NoZoom; else zoomAction = ZoomBack; - } else if (fuzzyCompare(endItemScale, m_zoomOutScale, 0.01)) + } else if (fuzzyCompare(targetScale, m_zoomOutScale, 0.01)) zoomAction = ZoomBack; - else if (endItemScale < currentScale) + else if (targetScale < currentScale) zoomAction = ZoomOut; } switch (zoomAction) { case ZoomIn: - m_scaleStack.append(ScaleStackItem(currentScale, m_viewportItem->contentPos().x())); - m_zoomOutScale = endItemScale; + m_scaleStack.append(ScaleStackItem(currentScale, m_viewportItem->contentPos().x() / currentScale)); + m_zoomOutScale = targetScale; break; case ZoomBack: { ScaleStackItem lastScale = m_scaleStack.takeLast(); - endItemScale = lastScale.scale; - endCSSScale = m_controller->convertFromViewport(lastScale.scale); - // Recalculate endPosition and bound it according to new scale. - endPosition.setY(hotspot.y() * endCSSScale - viewportHotspot.y()); + targetScale = lastScale.scale; + // Recalculate endPosition and clamp it according to the new scale. + endPosition.setY(hotspot.y() - viewportHotspot.y() / targetScale); endPosition.setX(lastScale.xPosition); - endPosRange = m_controller->positionRangeForContentAtScale(endItemScale); - endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); - endVisibleContentRect = QRectF(endPosition / endItemScale, viewportRect.size() / endItemScale); + endPosition = m_controller->clampViewportToContents(endPosition, targetScale); + endVisibleContentRect = QRectF(endPosition, viewportRect.size() / targetScale); break; } case ZoomOut: // Unstack all scale-levels deeper than the new level, so a zoom-back won't end up zooming in. - while (!m_scaleStack.isEmpty() && m_scaleStack.last().scale >= endItemScale) + while (!m_scaleStack.isEmpty() && m_scaleStack.last().scale >= targetScale) m_scaleStack.removeLast(); - m_zoomOutScale = endItemScale; + m_zoomOutScale = targetScale; break; case NoZoom: break; @@ -306,24 +296,20 @@ void PageViewportControllerClientQt::zoomToAreaGestureEnded(const QPointF& touch QRectF PageViewportControllerClientQt::nearestValidVisibleContentsRect() const { - float cssScale = m_controller->convertFromViewport(m_pageItem->contentsScale()); - float endItemScale = m_controller->convertToViewport(m_controller->innerBoundedContentsScale(cssScale)); + float targetScale = m_controller->innerBoundedViewportScale(m_pageItem->contentsScale()); const QRectF viewportRect = m_viewportItem->boundingRect(); QPointF viewportHotspot = viewportRect.center(); - QPointF endPosition = m_viewportItem->mapToWebContent(viewportHotspot) * endItemScale - viewportHotspot; + // Keep the center at the position of the old center, and substract viewportHotspot / targetScale to get the top left position. + QPointF endPosition = m_viewportItem->mapToWebContent(viewportHotspot) - viewportHotspot / targetScale; - FloatRect endPosRange = m_controller->positionRangeForContentAtScale(endItemScale); - endPosition = boundPosition(endPosRange.minXMinYCorner(), endPosition, endPosRange.maxXMaxYCorner()); - - QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale); - - return endVisibleContentRect; + endPosition = m_controller->clampViewportToContents(endPosition, targetScale); + return QRectF(endPosition, viewportRect.size() / targetScale); } -void PageViewportControllerClientQt::setContentsPosition(const FloatPoint& localPoint) +void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint) { - QPointF newPosition(m_pageItem->pos() + QPointF(localPoint)); + QPointF newPosition((m_pageItem->pos() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); m_viewportItem->setContentPos(newPosition); updateViewportController(); } @@ -343,8 +329,8 @@ void PageViewportControllerClientQt::setContentsScale(float localScale, bool tre void PageViewportControllerClientQt::setContentsRectToNearestValidBounds() { ViewportUpdateDeferrer guard(m_controller); - float validCSSScale = m_controller->innerBoundedContentsScale(m_controller->convertFromViewport(m_pageItem->contentsScale())); - setContentRectVisiblePositionAtScale(nearestValidVisibleContentsRect().topLeft(), m_controller->convertToViewport(validCSSScale)); + float targetScale = m_controller->innerBoundedViewportScale(m_pageItem->contentsScale()); + setContentRectVisiblePositionAtScale(nearestValidVisibleContentsRect().topLeft(), targetScale); } void PageViewportControllerClientQt::didResumeContent() @@ -450,22 +436,17 @@ void PageViewportControllerClientQt::pinchGestureRequestUpdate(const QPointF& pi return; // Changes of the center position should move the page even if the zoom factor does not change. - const qreal cssScale = m_controller->convertFromViewport(m_pinchStartScale * totalScaleFactor); + const qreal pinchScale = m_pinchStartScale * totalScaleFactor; // Allow zooming out beyond mimimum scale on pages that do not explicitly disallow it. - const qreal targetItemScale = m_controller->convertToViewport(m_controller->outerBoundedContentsScale(cssScale)); + const qreal targetScale = m_controller->outerBoundedViewportScale(pinchScale); - scaleContent(targetItemScale, m_viewportItem->mapToWebContent(pinchCenterInViewportCoordinates)); + scaleContent(targetScale, m_viewportItem->mapToWebContent(pinchCenterInViewportCoordinates)); const QPointF positionDiff = pinchCenterInViewportCoordinates - m_lastPinchCenterInViewportCoordinates; m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; m_viewportItem->setContentPos(m_viewportItem->contentPos() - positionDiff); - - // Inform the web process to render the currently visible area with low-resolution tiles not - // to expose white tiles during pinch gestures and to show fixed position layers correctly. - // The actual scale is restored after the pinch gesture ends. - updateViewportController(QPointF(), 1); } void PageViewportControllerClientQt::pinchGestureEnded() @@ -487,12 +468,6 @@ void PageViewportControllerClientQt::pinchGestureCancelled() m_scaleUpdateDeferrer.reset(); } -QRectF PageViewportControllerClientQt::visibleContentsRect() const -{ - const QRectF visibleRect(m_viewportItem->boundingRect().intersected(m_pageItem->boundingRect())); - return m_viewportItem->mapRectToWebContent(visibleRect); -} - void PageViewportControllerClientQt::didChangeContentsSize() { // Emit for testing purposes, so that it can be verified that @@ -526,9 +501,9 @@ void PageViewportControllerClientQt::didChangeViewportAttributes() void PageViewportControllerClientQt::updateViewportController(const QPointF& trajectory, qreal scale) { - FloatRect currentVisibleRect(visibleContentsRect()); - float viewportScale = (scale < 0) ? viewportScaleForRect(currentVisibleRect) : scale; - m_controller->setVisibleContentsRect(currentVisibleRect, viewportScale, trajectory); + FloatPoint viewportPos = m_viewportItem->mapToWebContent(QPointF()); + float viewportScale = (scale < 0) ? m_pageItem->contentsScale() : scale; + m_controller->didChangeContentsVisibility(viewportPos, viewportScale, trajectory); } void PageViewportControllerClientQt::scaleContent(qreal itemScale, const QPointF& centerInCSSCoordinates) diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h index 19b27ae9e..bd0e1731b 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h @@ -47,8 +47,8 @@ public: PageViewportControllerClientQt(QQuickWebView*, QQuickWebPage*); ~PageViewportControllerClientQt(); - virtual void setContentsPosition(const WebCore::FloatPoint& localPoint); - virtual void setContentsScale(float localScale, bool treatAsInitialValue); + virtual void setViewportPosition(const WebCore::FloatPoint& contentsPoint); + virtual void setContentsScale(float scale, bool treatAsInitialValue); virtual void didResumeContent(); virtual void didChangeContentsSize(); @@ -121,7 +121,6 @@ private: QQuickWebPage* const m_pageItem; float viewportScaleForRect(const QRectF&) const; - QRectF visibleContentsRect() const; QRectF nearestValidVisibleContentsRect() const; void setContentsRectToNearestValidBounds(); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 64bcdbdf9..819d4a0a2 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -300,7 +300,7 @@ void QtWebPageEventHandler::handleFocusInEvent(QFocusEvent*) m_webPageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); } -void QtWebPageEventHandler::handleFocusOutEvent(QFocusEvent*) +void QtWebPageEventHandler::handleFocusLost() { m_webPageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 8724f2ede..04c75ab3f 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -61,7 +61,7 @@ public: void handleKeyPressEvent(QKeyEvent*); void handleKeyReleaseEvent(QKeyEvent*); void handleFocusInEvent(QFocusEvent*); - void handleFocusOutEvent(QFocusEvent*); + void handleFocusLost(); void handleMouseMoveEvent(QMouseEvent*); void handleMousePressEvent(QMouseEvent*); void handleMouseReleaseEvent(QMouseEvent*); diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp index 691844aaa..f07c4060d 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -88,11 +88,11 @@ void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data #endif // ENABLE(GEOLOCATION) } -void WebGeolocationManager::didFailToDeterminePosition() +void WebGeolocationManager::didFailToDeterminePosition(const String& errorMessage) { #if ENABLE(GEOLOCATION) // FIXME: Add localized error string. - RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, /* Localized error string */ String("")); + RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage); Vector<RefPtr<WebPage> > webPageCopy; copyToVector(m_pageSet, webPageCopy); @@ -101,6 +101,8 @@ void WebGeolocationManager::didFailToDeterminePosition() if (page->corePage()) GeolocationController::from(page->corePage())->errorOccurred(error.get()); } +#else + UNUSED_PARAM(errorMessage); #endif // ENABLE(GEOLOCATION) } diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h index 78fbd5acf..5c3dfae93 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,6 +41,10 @@ namespace WebCore { class Geolocation; } +namespace WTF { +class String; +} + namespace WebKit { class WebProcess; @@ -64,7 +68,7 @@ private: void didReceiveWebGeolocationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); void didChangePosition(const WebGeolocationPosition::Data&); - void didFailToDeterminePosition(); + void didFailToDeterminePosition(const WTF::String& errorMessage); WebProcess* m_process; HashSet<WebPage*> m_pageSet; diff --git a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in index f2e9a9da9..898d1aecc 100644 --- a/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in +++ b/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in @@ -22,5 +22,5 @@ messages -> WebGeolocationManager { DidChangePosition(WebKit::WebGeolocationPosition::Data position); - DidFailToDeterminePosition(); + DidFailToDeterminePosition(WTF::String errorMessage); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index c635e6e84..15088e7d6 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -321,6 +321,11 @@ double WKBundlePageGetBackingScaleFactor(WKBundlePageRef pageRef) return toImpl(pageRef)->deviceScaleFactor(); } +void WKBundlePageListenForLayoutMilestones(WKBundlePageRef pageRef, WKLayoutMilestones milestones) +{ + toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones)); +} + void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKBundleIntentRef intentRef) { #if ENABLE(WEB_INTENTS) @@ -370,9 +375,10 @@ WKRenderLayerRef WKBundlePageCopyRenderLayerTree(WKBundlePageRef pageRef) return toAPI(WebRenderLayer::create(toImpl(pageRef)).leakRef()); } -void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold) +void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef, uint64_t) { - toImpl(page)->setPaintedObjectsCounterThreshold(threshold); + // FIXME: This function is only still here to keep open source Mac builds building. + // We should remove it as soon as we can. } void WKBundlePageSetTracksRepaints(WKBundlePageRef pageRef, bool trackRepaints) @@ -427,6 +433,9 @@ bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeTypeRef) if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) return true; + if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType)) + return true; + if (mimeType.startsWith("text/", false)) return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 04abc86ae..dce7cf862 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -111,6 +111,7 @@ typedef void (*WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback) typedef bool (*WKBundlePageShouldForceUniversalAccessFromLocalURLCallback)(WKBundlePageRef, WKStringRef url, const void* clientInfo); typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo); typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo); +typedef void (*WKBundlePageDidLayoutCallback)(WKBundlePageRef page, WKLayoutMilestones milestones, WKTypeRef* userData, const void *clientInfo); struct WKBundlePageLoaderClient { int version; @@ -153,6 +154,7 @@ struct WKBundlePageLoaderClient { // Version 3 WKBundlePageDidReceiveIntentForFrameCallback didReceiveIntentForFrame; WKBundlePageRegisterIntentServiceForFrameCallback registerIntentServiceForFrame; + WKBundlePageDidLayoutCallback didLayout; }; typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient; @@ -419,6 +421,8 @@ WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBun WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page); +WK_EXPORT void WKBundlePageListenForLayoutMilestones(WKBundlePageRef page, WKLayoutMilestones milestones); + WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRef intent); #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h index c7393ba3f..11b20dc93 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h @@ -58,7 +58,8 @@ WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page); WK_EXPORT WKRenderObjectRef WKBundlePageCopyRenderTree(WKBundlePageRef page); WK_EXPORT WKRenderLayerRef WKBundlePageCopyRenderLayerTree(WKBundlePageRef page); -// FIXME: This is temporary. Ultimately WebKit should choose the threshold itself. +// FIXME: This function is only still here to keep open source Mac builds building. It doesn't do anything anymore! +// We should remove it as soon as we can. WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold); WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 470d39b17..44d9a10ab 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -52,7 +52,6 @@ #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> @@ -183,7 +182,8 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page macro(WebKitWebGLEnabled, WebGLEnabled, webGLEnabled) \ macro(WebKitXSSAuditorEnabled, XSSAuditorEnabled, xssAuditorEnabled) \ macro(WebKitShouldRespectImageOrientation, ShouldRespectImageOrientation, shouldRespectImageOrientation) \ - macro(WebKitEnableCaretBrowsing, CaretBrowsingEnabled, caretBrowsingEnabled) + macro(WebKitEnableCaretBrowsing, CaretBrowsingEnabled, caretBrowsingEnabled) \ + macro(WebKitDisplayImagesKey, LoadsImagesAutomatically, loadsImagesAutomatically) if (preference == "WebKitAcceleratedCompositingEnabled") enabled = enabled && LayerTreeHost::supportsAcceleratedCompositing(); diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp index a6a06123f..8f68a3e28 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp @@ -254,7 +254,17 @@ void InjectedBundlePageLoaderClient::didNewFirstVisuallyNonEmptyLayout(WebPage* WKTypeRef userDataToPass = 0; m_client.didNewFirstVisuallyNonEmptyLayout(toAPI(page), &userDataToPass, m_client.clientInfo); userData = adoptRef(toImpl(userDataToPass)); -} +} + +void InjectedBundlePageLoaderClient::didLayout(WebPage* page, LayoutMilestones milestones, RefPtr<APIObject>& userData) +{ + if (!m_client.didLayout) + return; + + WKTypeRef userDataToPass = 0; + m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), &userDataToPass, m_client.clientInfo); + userData = adoptRef(toImpl(userDataToPass)); +} void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world) { diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h index 81d9be44d..c6b277cff 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h @@ -30,6 +30,7 @@ #include "SameDocumentNavigationType.h" #include "WKBundlePage.h" #include <JavaScriptCore/JSBase.h> +#include <WebCore/LayoutMilestones.h> #include <wtf/Forward.h> namespace WebCore { @@ -82,6 +83,7 @@ public: void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); void didLayoutForFrame(WebPage*, WebFrame*); void didNewFirstVisuallyNonEmptyLayout(WebPage*, WTF::RefPtr<APIObject>& userData); + void didLayout(WebPage*, WebCore::LayoutMilestones, RefPtr<APIObject>& userData); void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*); void didCancelClientRedirectForFrame(WebPage*, WebFrame*); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 40a0d7a21..e2a6e1f05 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -854,6 +854,9 @@ void PluginView::pendingURLRequestsTimerFired() void PluginView::performURLRequest(URLRequest* request) { + // This protector is needed to make sure the PluginView is not destroyed while it is still needed. + RefPtr<PluginView> protect(this); + // First, check if this is a javascript: url. if (protocolIsJavaScript(request->request().url())) { performJavaScriptURLRequest(request); diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 9640edaa7..e13908e63 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -544,7 +544,7 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() loadListener->didFinishLoad(m_frame); } -void WebFrameLoaderClient::dispatchDidFirstLayout() +void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones) { WebPage* webPage = m_frame->page(); if (!webPage) @@ -552,49 +552,38 @@ void WebFrameLoaderClient::dispatchDidFirstLayout() RefPtr<APIObject> userData; - // Notify the bundle client. - webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData); - - // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); + webPage->injectedBundleLoaderClient().didLayout(webPage, milestones, userData); + webPage->send(Messages::WebPageProxy::DidLayout(milestones, InjectedBundleUserMessageEncoder(userData.get()))); - if (m_frame == m_frame->page()->mainWebFrame() && !webPage->corePage()->settings()->suppressesIncrementalRendering()) - webPage->drawingArea()->setLayerTreeStateIsFrozen(false); + if (milestones & DidFirstLayout) { + // FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the + // new didLayout API. + webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData); + webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); + if (m_frame == m_frame->page()->mainWebFrame()) { + if (!webPage->corePage()->settings()->suppressesIncrementalRendering()) + webPage->drawingArea()->setLayerTreeStateIsFrozen(false); + } + #if USE(TILED_BACKING_STORE) - // Make sure viewport properties are dispatched on the main frame by the time the first layout happens. - ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged()); + // Make sure viewport properties are dispatched on the main frame by the time the first layout happens. + ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged()); #endif -} - -void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() -{ - WebPage* webPage = m_frame->page(); - if (!webPage) - return; - - RefPtr<APIObject> userData; - - // Notify the bundle client. - webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData); - - // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); -} - -void WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout() -{ - WebPage* webPage = m_frame->page(); - if (!webPage) - return; + } - RefPtr<APIObject> userData; + if (milestones & DidFirstVisuallyNonEmptyLayout) { + // FIXME: We should consider removing the old didFirstVisuallyNonEmptyLayoutForFrame API since this is doing + // double duty with the new didLayout API. + webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData); + webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get()))); + } - // Notify the bundle client. - webPage->injectedBundleLoaderClient().didNewFirstVisuallyNonEmptyLayout(webPage, userData); - - // Notify the UIProcess. - webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get()))); + if (milestones & DidHitRelevantRepaintedObjectsAreaThreshold) { + // FIXME: This can go away when we remove didNewFirstVisuallyNonEmptyLayout. + webPage->injectedBundleLoaderClient().didNewFirstVisuallyNonEmptyLayout(webPage, userData); + webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get()))); + } } void WebFrameLoaderClient::dispatchDidLayout() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h index 207e44266..213a2fea0 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h @@ -97,9 +97,7 @@ private: virtual void dispatchDidFinishDocumentLoad() OVERRIDE; virtual void dispatchDidFinishLoad() OVERRIDE; - virtual void dispatchDidFirstLayout() OVERRIDE; - virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE; - virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() OVERRIDE; + virtual void dispatchDidLayout(WebCore::LayoutMilestones) OVERRIDE; virtual void dispatchDidLayout() OVERRIDE; virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index eb1049212..1897675dc 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -124,6 +124,7 @@ void InitWebCoreSystemInterface(void) INIT(RecommendedScrollerStyle); INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard); INIT(CopyDefaultSearchProviderDisplayName); + INIT(SetCrashReportApplicationSpecificInformation); INIT(AVAssetResolvedURL); INIT(Cursor); #else diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index b6143e649..61e82b5d9 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -396,6 +396,22 @@ void WebPage::initializeInjectedBundleFormClient(WKBundlePageFormClient* client) void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* client) { + // It would be nice to get rid of this code and transition all clients to using didLayout instead of + // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required + // for backwards compatibility. + LayoutMilestones milestones = 0; + if (client) { + if (client->didFirstLayoutForFrame) + milestones |= WebCore::DidFirstLayout; + if (client->didFirstVisuallyNonEmptyLayoutForFrame) + milestones |= WebCore::DidFirstVisuallyNonEmptyLayout; + if (client->didNewFirstVisuallyNonEmptyLayout) + milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold; + } + + if (milestones) + listenForLayoutMilestones(milestones); + m_loaderClient.initialize(client); } @@ -560,13 +576,6 @@ uint64_t WebPage::renderTreeSize() const return m_page->renderTreeSize().treeSize; } -void WebPage::setPaintedObjectsCounterThreshold(uint64_t threshold) -{ - if (!m_page) - return; - m_page->setRelevantRepaintedObjectsCounterThreshold(threshold); -} - void WebPage::setTracksRepaints(bool trackRepaints) { if (FrameView* view = mainFrameView()) @@ -940,7 +949,7 @@ void WebPage::sendViewportAttributesChanged() // Recalculate the recommended layout size, when the available size (device pixel) changes. Settings* settings = m_page->settings(); - int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_viewportSize.width()); + int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), int(m_viewportSize.width() / m_page->deviceScaleFactor())); // If unset we use the viewport dimensions. This fits with the behavior of desktop browsers. int deviceWidth = (settings->deviceWidth() > 0) ? settings->deviceWidth() : m_viewportSize.width(); @@ -1123,6 +1132,13 @@ void WebPage::setFixedLayoutSize(const IntSize& size) view->forceLayout(); } +void WebPage::listenForLayoutMilestones(uint32_t milestones) +{ + if (!m_page) + return; + m_page->addLayoutMilestones(static_cast<LayoutMilestones>(milestones)); +} + void WebPage::setSuppressScrollbarAnimations(bool suppressAnimations) { m_page->setShouldSuppressScrollbarAnimations(suppressAnimations); @@ -2056,7 +2072,11 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) settings->setMinimumLogicalFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey())); settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey())); settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey())); - settings->setScreenFontSubstitutionEnabled(store.getBoolValueForKey(WebPreferencesKey::screenFontSubstitutionEnabledKey())); + settings->setScreenFontSubstitutionEnabled(store.getBoolValueForKey(WebPreferencesKey::screenFontSubstitutionEnabledKey()) +#if PLATFORM(MAC) + || WebProcess::shared().shouldForceScreenFontSubstitution() +#endif + ); settings->setLayoutFallbackWidth(store.getUInt32ValueForKey(WebPreferencesKey::layoutFallbackWidthKey())); settings->setDeviceWidth(store.getUInt32ValueForKey(WebPreferencesKey::deviceWidthKey())); settings->setDeviceHeight(store.getUInt32ValueForKey(WebPreferencesKey::deviceHeightKey())); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 775b8270a..fadd3bd7f 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -283,7 +283,6 @@ public: String renderTreeExternalRepresentation() const; uint64_t renderTreeSize() const; - void setPaintedObjectsCounterThreshold(uint64_t); void setTracksRepaints(bool); bool isTrackingRepaints() const; @@ -309,6 +308,8 @@ public: bool useFixedLayout() const { return m_useFixedLayout; } void setFixedLayoutSize(const WebCore::IntSize&); + void listenForLayoutMilestones(uint32_t /* LayoutMilestones */); + void setSuppressScrollbarAnimations(bool); void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 59362bcf5..f113fc24e 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -139,7 +139,7 @@ messages -> WebPage { SetUseFixedLayout(bool fixed) SetFixedLayoutSize(WebCore::IntSize size) - + ListenForLayoutMilestones(uint32_t milestones) SetSuppressScrollbarAnimations(bool suppressAnimations) SetPaginationMode(uint32_t mode); diff --git a/Source/WebKit2/WebProcess/WebProcess.h b/Source/WebKit2/WebProcess/WebProcess.h index 0f542bedb..e34d15f29 100644 --- a/Source/WebKit2/WebProcess/WebProcess.h +++ b/Source/WebKit2/WebProcess/WebProcess.h @@ -149,6 +149,7 @@ public: WebPageGroupProxy* webPageGroup(const WebPageGroupData&); #if PLATFORM(MAC) pid_t presenterApplicationPid() const { return m_presenterApplicationPid; } + bool shouldForceScreenFontSubstitution() const { return m_shouldForceScreenFontSubstitution; } #endif #if PLATFORM(QT) @@ -304,6 +305,7 @@ private: #if PLATFORM(MAC) pid_t m_presenterApplicationPid; dispatch_group_t m_clearResourceCachesDispatchGroup; + bool m_shouldForceScreenFontSubstitution; #endif bool m_fullKeyboardAccessEnabled; diff --git a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp index 931244c27..589aa70fe 100644 --- a/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp +++ b/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp @@ -90,7 +90,6 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) SoupCache* soupCache = soup_cache_new(soupCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER); soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache)); soup_cache_load(soupCache); - g_object_unref(soupCache); #if USE(COORDINATED_GRAPHICS) CoordinatedGraphicsLayer::initFactory(); @@ -102,6 +101,10 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]) WebProcess::shared().initialize(socket, RunLoop::main()); RunLoop::run(); + soup_cache_flush(soupCache); + soup_cache_dump(soupCache); + g_object_unref(soupCache); + return 0; } diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp index defd418a0..7dacc226e 100644 --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp @@ -85,6 +85,9 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]) RunLoop::run(); + soup_cache_flush(soupCache.get()); + soup_cache_dump(soupCache.get()); + return 0; } diff --git a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm index 738e0d881..ff75ceba5 100644 --- a/Source/WebKit2/WebProcess/mac/WebProcessMac.mm +++ b/Source/WebKit2/WebProcess/mac/WebProcessMac.mm @@ -271,6 +271,8 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters [NSURLCache setSharedURLCache:parentProcessURLCache.get()]; } + m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution; + m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp b/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp index d5c60fcc0..3304d4073 100644 --- a/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp +++ b/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp @@ -78,6 +78,7 @@ QtBuiltinBundlePage::QtBuiltinBundlePage(QtBuiltinBundle* bundle, WKBundlePageRe 0, // shouldForceUniversalAccessFromLocalURL 0, // didReceiveIntentForFrame 0, // registerIntentServiceForFrame + 0, // didLayout }; WKBundlePageSetPageLoaderClient(m_page, &loaderClient); } diff --git a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp index 365236b09..51ef3a7b2 100644 --- a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp +++ b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp @@ -171,11 +171,6 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters void WebProcess::platformTerminate() { - SoupSession* session = WebCore::ResourceHandle::defaultSession(); - SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); - soup_cache_flush(cache); - soup_cache_dump(cache); - WebCore::removeLanguageChangeObserver(this); } |