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/UIProcess | |
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/UIProcess')
31 files changed, 308 insertions, 259 deletions
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*); |