diff options
Diffstat (limited to 'Source/WebKit2/UIProcess')
54 files changed, 546 insertions, 92 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp index 50e4cb205..2f2629ce0 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp @@ -114,6 +114,9 @@ const Evas_Object* EwkViewImpl::viewFromPageViewMap(const WKPageRef page) EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, PassRefPtr<WebPageGroup> pageGroup, ViewBehavior behavior) : m_view(view) , m_context(context) +#if USE(ACCELERATED_COMPOSITING) + , m_pendingSurfaceResize(false) +#endif , m_pageClient(behavior == DefaultBehavior ? PageClientDefaultImpl::create(this) : PageClientLegacyImpl::create(this)) , m_pageProxy(m_context->webContext()->createWebPage(m_pageClient.get(), pageGroup.get())) , m_pageLoadClient(PageLoadClientEfl::create(this)) @@ -361,7 +364,12 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*) #if USE(COORDINATED_GRAPHICS) Ewk_View_Smart_Data* sd = smartData(); - evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); + if (m_pendingSurfaceResize) { + // Create a GL surface here so that Evas has no chance of painting to an empty GL surface. + createGLSurface(IntSize(sd->view.w, sd->view.h)); + m_pendingSurfaceResize = false; + } else + evas_gl_make_current(m_evasGL.get(), evasGLSurface(), evasGLContext()); // We are supposed to clip to the actual viewport, nothing less. IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h); diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h index cb1875672..bb93fedb1 100644 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h @@ -161,6 +161,7 @@ public: bool createGLSurface(const WebCore::IntSize& viewSize); bool enterAcceleratedCompositingMode(); bool exitAcceleratedCompositingMode(); + void setNeedsSurfaceResize() { m_pendingSurfaceResize = true; } #endif #if ENABLE(INPUT_TYPE_COLOR) @@ -246,6 +247,7 @@ private: OwnPtr<Evas_GL> m_evasGL; OwnPtr<WebKit::EvasGLContext> m_evasGLContext; OwnPtr<WebKit::EvasGLSurface> m_evasGLSurface; + bool m_pendingSurfaceResize; #endif OwnPtr<WebKit::PageClientBase> m_pageClient; RefPtr<WebKit::WebPageProxy> m_pageProxy; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index d5d50ed0a..349b086e9 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -387,8 +387,7 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); #if USE(ACCELERATED_COMPOSITING) - if (width && height) - impl->createGLSurface(IntSize(width, height)); + impl->setNeedsSurfaceResize(); #endif #if USE(TILED_BACKING_STORE) impl->pageClient()->updateViewportSize(IntSize(width, height)); diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp index 25fe0698b..922c3ec21 100644 --- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp @@ -134,7 +134,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_navigation) ASSERT_FALSE(ewk_view_forward_possible(webView())); } -TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom) +TEST_F(EWK2UnitTestBase, DISABLED_ewk_view_setting_encoding_custom) { ASSERT_FALSE(ewk_view_custom_encoding_get(webView())); ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), "UTF-8")); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp index ef2da1c98..13efe8c68 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp @@ -23,15 +23,40 @@ #include "AuthenticationChallengeProxy.h" #include "AuthenticationDecisionListener.h" #include "WebCredential.h" +#include "WebKitWebViewBasePrivate.h" +#include "WebKitWebViewPrivate.h" +#include <gtk/gtk.h> namespace WebKit { +// This is necessary because GtkEventBox does not draw a background by default, +// but we want it to have a normal GtkWindow background. +static gboolean drawSignal(GtkWidget* widget, cairo_t* cr, GtkStyleContext* styleContext) +{ + gtk_render_background(styleContext, cr, 0, 0, + gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget)); + return FALSE; +} + WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge) - : GtkAuthenticationDialog(0, authenticationChallenge->core()) + : GtkAuthenticationDialog(authenticationChallenge->core()) , m_authenticationChallenge(authenticationChallenge) + , m_styleContext(adoptGRef(gtk_style_context_new())) { - // We aren't passing a toplevel to the GtkAuthenticationDialog constructor, - // because eventually this widget will be embedded into the WebView itself. + m_dialog = gtk_event_box_new(); + + GtkWidget* frame = gtk_frame_new(0); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + gtk_container_add(GTK_CONTAINER(m_dialog), frame); + createContentsInContainer(frame); + + gtk_style_context_add_class(m_styleContext.get(), GTK_STYLE_CLASS_BACKGROUND); + GtkWidgetPath* path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_WINDOW); + gtk_style_context_set_path(m_styleContext.get(), path); + gtk_widget_path_free(path); + + g_signal_connect(m_dialog, "draw", G_CALLBACK(drawSignal), m_styleContext.get()); } void WebKit2GtkAuthenticationDialog::authenticate(const WebCore::Credential& credential) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h index 60c5e0588..67064622c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h @@ -17,22 +17,32 @@ * Boston, MA 02110-1301, USA. */ +#ifndef WebKit2GtkAuthenticationDialog_h +#define WebKit2GtkAuthenticationDialog_h + #include "AuthenticationChallengeProxy.h" #include "WKRetainPtr.h" +#include "WebKitWebViewBase.h" #include <WebCore/Credential.h> #include <WebCore/GtkAuthenticationDialog.h> +#include <wtf/gobject/GRefPtr.h> namespace WebKit { class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog { public: WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*); + virtual ~WebKit2GtkAuthenticationDialog() { } + GtkWidget* widget() { return m_dialog; } protected: virtual void authenticate(const WebCore::Credential&); private: RefPtr<AuthenticationChallengeProxy> m_authenticationChallenge; + GRefPtr<GtkStyleContext> m_styleContext; }; } // namespace WebKit + +#endif // WebKit2GtkAuthenticationDialog_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp index be06eddf6..1eae26753 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp @@ -118,8 +118,7 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo) { - WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(toImpl(authenticationChallenge)); - dialog->show(); + webkitWebViewHandleAuthenticationChallenge(WEBKIT_WEB_VIEW(clientInfo), toImpl(authenticationChallenge)); } void attachLoaderClientToView(WebKitWebView* webView) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 6598b6602..fb0c5ed9a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -1261,6 +1261,7 @@ static void webkitWebViewEmitLoadChanged(WebKitWebView* webView, WebKitLoadEvent if (loadEvent == WEBKIT_LOAD_STARTED) { webkitWebViewSetIsLoading(webView, true); webkitWebViewWatchForChangesInFavicon(webView); + webkitWebViewBaseCancelAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView)); } else if (loadEvent == WEBKIT_LOAD_FINISHED) { webkitWebViewSetIsLoading(webView, false); webView->priv->waitingForMainResource = false; @@ -1609,6 +1610,13 @@ void webkitWebViewSubmitFormRequest(WebKitWebView* webView, WebKitFormSubmission g_signal_emit(webView, signals[SUBMIT_FORM], 0, request); } +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge) +{ + WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(authenticationChallenge); + webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), dialog); + dialog->show(); +} + /** * webkit_web_view_new: * diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index de741c2e3..c46deb27a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -83,7 +83,7 @@ struct _WebKitWebViewBasePrivate { _WebKitWebViewBasePrivate() : imContext(adoptGRef(gtk_im_multicontext_new())) #if USE(TEXTURE_MAPPER_GL) - , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) + , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext)) #endif { } @@ -106,6 +106,7 @@ struct _WebKitWebViewBasePrivate { IntSize resizerSize; GRefPtr<AtkObject> accessible; bool needsResizeOnMap; + WebKit2GtkAuthenticationDialog* authenticationDialog; GtkWidget* inspectorView; unsigned inspectorViewHeight; GOwnPtr<GdkEvent> contextMenuEvent; @@ -272,16 +273,20 @@ static void webkitWebViewBaseRealize(GtkWidget* widget) webkitWebViewBaseSetToplevelOnScreenWindow(webView, GTK_WINDOW(toplevel)); } +static bool webkitWebViewChildIsInternalWidget(WebKitWebViewBase* webViewBase, GtkWidget* widget) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + return widget == priv->inspectorView || (priv->authenticationDialog && priv->authenticationDialog->widget() == widget); +} + static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); WebKitWebViewBasePrivate* priv = webView->priv; - if (WEBKIT_IS_WEB_VIEW_BASE(widget) - && WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) { - ASSERT(!priv->inspectorView); - priv->inspectorView = widget; - } else { + // Internal widgets like the web inspector and authentication dialog have custom + // allocations so we don't need to add them to our list of children. + if (!webkitWebViewChildIsInternalWidget(webView, widget)) { GtkAllocation childAllocation; gtk_widget_get_allocation(widget, &childAllocation); priv->children.set(widget, childAllocation); @@ -290,6 +295,26 @@ static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* wi gtk_widget_set_parent(widget, GTK_WIDGET(container)); } +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase* webViewBase, WebKit2GtkAuthenticationDialog* dialog) +{ + webViewBase->priv->authenticationDialog = dialog; + gtk_container_add(GTK_CONTAINER(webViewBase), dialog->widget()); + gtk_widget_queue_draw(GTK_WIDGET(webViewBase)); // We need to draw the shadow over the widget. +} + +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase* webViewBase) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + priv->authenticationDialog->destroy(); +} + +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase* webViewBase, GtkWidget* inspector) +{ + webViewBase->priv->inspectorView = inspector; + gtk_container_add(GTK_CONTAINER(webViewBase), inspector); +} + static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* widget) { WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container); @@ -302,6 +327,8 @@ static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget* if (priv->inspectorView == widget) { priv->inspectorView = 0; priv->inspectorViewHeight = 0; + } else if (priv->authenticationDialog && priv->authenticationDialog->widget() == widget) { + priv->authenticationDialog = 0; } else { ASSERT(priv->children.contains(widget)); priv->children.remove(widget); @@ -322,12 +349,14 @@ static void webkitWebViewBaseContainerForall(GtkContainer* container, gboolean i if (includeInternals && priv->inspectorView) (*callback)(priv->inspectorView, callbackData); + + if (includeInternals && priv->authenticationDialog) + (*callback)(priv->authenticationDialog->widget(), callbackData); } void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* child, const IntRect& childRect) { const IntRect& geometry = webView->priv->children.get(child); - if (geometry == childRect) return; @@ -359,6 +388,8 @@ static void webkitWebViewBaseConstructed(GObject* object) if (priv->redirectedWindow) priv->redirectedWindow->setDamageNotifyCallback(redirectedWindowDamagedCallback, object); #endif + + priv->authenticationDialog = 0; } #if USE(TEXTURE_MAPPER_GL) @@ -400,6 +431,12 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr) WebCore::Region unpaintedRegion; // This is simply unused. drawingArea->paint(cr, clipRect, unpaintedRegion); + if (webViewBase->priv->authenticationDialog) { + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba(cr, 0, 0, 0, 0.5); + cairo_paint(cr); + } + return FALSE; } @@ -434,6 +471,22 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase viewRect.setHeight(allocation->height - priv->inspectorViewHeight); } + // The authentication dialog is centered in the view rect, which means that it + // never overlaps the web inspector. Thus, we need to calculate the allocation here + // after calculating the inspector allocation. + if (priv->authenticationDialog) { + GtkRequisition naturalSize; + gtk_widget_get_preferred_size(priv->authenticationDialog->widget(), 0, &naturalSize); + + GtkAllocation childAllocation = { + (viewRect.width() - naturalSize.width) / 2, + (viewRect.height() - naturalSize.height) / 2, + naturalSize.width, + naturalSize.height + }; + gtk_widget_size_allocate(priv->authenticationDialog->widget(), &childAllocation); + } + #if USE(TEXTURE_MAPPER_GL) if (sizeChanged && webViewBase->priv->redirectedWindow) webViewBase->priv->redirectedWindow->resize(viewRect.size()); @@ -515,6 +568,9 @@ static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* e WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event); + #if ENABLE(FULLSCREEN_API) if (priv->fullScreenModeActive) { switch (event->keyval) { @@ -561,6 +617,10 @@ static gboolean webkitWebViewBaseButtonPressEvent(GtkWidget* widget, GdkEventBut { WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent)) @@ -579,6 +639,9 @@ static gboolean webkitWebViewBaseButtonReleaseEvent(GtkWidget* widget, GdkEventB WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + gtk_widget_grab_focus(widget); priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); @@ -590,6 +653,9 @@ static gboolean webkitWebViewBaseScrollEvent(GtkWidget* widget, GdkEventScroll* WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event))); return TRUE; @@ -600,6 +666,9 @@ static gboolean webkitWebViewBaseMotionNotifyEvent(GtkWidget* widget, GdkEventMo WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (priv->authenticationDialog) + return TRUE; + priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); return TRUE; @@ -737,7 +806,20 @@ static void webkitWebViewBaseParentSet(GtkWidget* widget, GtkWidget* oldParent) { if (!gtk_widget_get_parent(widget)) webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), 0); +} + +static gboolean webkitWebViewBaseFocus(GtkWidget* widget, GtkDirectionType direction) +{ + // If the authentication dialog is active, we need to forward focus events there. This + // ensures that you can tab between elements in the box. + WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; + if (priv->authenticationDialog) { + gboolean returnValue; + g_signal_emit_by_name(priv->authenticationDialog->widget(), "focus", direction, &returnValue); + return returnValue; + } + return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->focus(widget, direction); } static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass) @@ -748,6 +830,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; widgetClass->map = webkitWebViewBaseMap; widgetClass->unmap = webkitWebViewBaseUnmap; + widgetClass->focus = webkitWebViewBaseFocus; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h index ef05f2289..2bd0bc002 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h @@ -29,6 +29,7 @@ #define WebKitWebViewBasePrivate_h #include "WebContextMenuProxyGtk.h" +#include "WebKit2GtkAuthenticationDialog.h" #include "WebKitPrivate.h" #include "WebKitWebViewBase.h" #include "WebPageProxy.h" @@ -64,4 +65,8 @@ typedef void (*WebKitWebViewBaseDownloadRequestHandler) (WebKitWebViewBase*, Web void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase*, WebKitWebViewBaseDownloadRequestHandler); void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase*, WebKit::DownloadProxy*); +void webkitWebViewBaseAddAuthenticationDialog(WebKitWebViewBase*, WebKit::WebKit2GtkAuthenticationDialog*); +void webkitWebViewBaseCancelAuthenticationDialog(WebKitWebViewBase*); +void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector); + #endif // WebKitWebViewBasePrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index 2e1fed30e..66da58476 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -55,5 +55,6 @@ bool webkitWebViewEnterFullScreen(WebKitWebView*); bool webkitWebViewLeaveFullScreen(WebKitWebView*); void webkitWebViewPopulateContextMenu(WebKitWebView*, WebKit::ImmutableArray* proposedMenu, WebKit::WebHitTestResult*); void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*); +void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*); #endif // WebKitWebViewPrivate_h diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h index 8768fd067..66b23e47c 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h @@ -139,6 +139,7 @@ private: virtual void recommendedScrollbarStyleDidChange(int32_t newStyle); virtual WKView* wkView() const { return m_wkView; } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) OVERRIDE; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&); diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index 9ed7feea1..0172cb077 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -558,6 +558,11 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) #endif } +void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + [m_wkView _setIntrinsicContentSize:intrinsicContentSize]; +} + bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) { return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 4e30b3368..b1470fea9 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -215,6 +215,8 @@ struct WKViewInterpretKeyEventsParameters { RefPtr<WebCore::Image> _promisedImage; String _promisedFilename; String _promisedURL; + + NSSize _intrinsicContentSize; } @end @@ -356,6 +358,11 @@ struct WKViewInterpretKeyEventsParameters { return YES; } +- (NSSize)intrinsicContentSize +{ + return _data->_intrinsicContentSize; +} + - (void)setFrameSize:(NSSize)size { if (!NSEqualSizes(size, [self frame].size)) @@ -2925,6 +2932,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return ![sink.get() didReceiveUnhandledCommand]; } +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize +{ + _data->_intrinsicContentSize = intrinsicContentSize; + [self invalidateIntrinsicContentSize]; +} + - (void)_cacheWindowBottomCornerRect { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -3021,6 +3034,8 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_mouseDownEvent = nil; _data->_ignoringMouseDraggedEvents = NO; + _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); + [self _registerDraggedTypes]; if ([self _shouldUseTiledDrawingArea]) { @@ -3126,6 +3141,16 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } +- (CGFloat)minimumLayoutWidth +{ + return _data->_page->minimumLayoutWidth(); +} + +- (void)setMinimumLayoutWidth:(CGFloat)minimumLayoutWidth +{ + _data->_page->setMinimumLayoutWidth(minimumLayoutWidth); +} + @end @implementation WKResponderChainSink diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index 3f612d240..9b02947a3 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -61,6 +61,7 @@ namespace WebKit { - (BOOL)_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; - (bool)_executeSavedCommandBySelector:(SEL)selector; +- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize; - (NSRect)_convertToDeviceSpace:(NSRect)rect; - (NSRect)_convertToUserSpace:(NSRect)rect; - (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h index 51578764f..2161eb786 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -50,4 +50,6 @@ - (void)performDictionaryLookupAtCurrentMouseLocation; + (void)hideWordDefinitionWindow; +@property (readwrite) CGFloat minimumLayoutWidth; + @end diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index a45636a79..e83e13379 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -319,6 +319,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true); webPageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true); + webPageProxy->pageGroup()->preferences()->setWebGLEnabled(true); pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController); webPageProxy->initializeWebPage(); diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index f5f0bd3f9..3f9c3b2ae 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -130,6 +130,11 @@ void QRawWebViewPrivate::updateTextInputState() notImplemented(); } +void QRawWebViewPrivate::handleWillSetInputMethodState() +{ + notImplemented(); +} + #if ENABLE(GESTURE_EVENTS) void QRawWebViewPrivate::doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h index 545096d02..7bc6f1162 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h @@ -71,6 +71,7 @@ public: #endif // USE(ACCELERATED_COMPOSITING) virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); #if ENABLE(GESTURE_EVENTS) virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled); #endif diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro index 7c72fd2f1..3fd3d4583 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_DesktopBehavior OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro index 3e217b369..b340235e4 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -3,7 +3,7 @@ SOURCES += tst_qmltests.cpp TARGET = tst_qmltests_WebView OBJECTS_DIR = obj_WebView/$$activeBuildConfig() -QT += webkitwidgets-private +QT += webkit-private CONFIG += warn_on testcase QT += qmltest diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml new file mode 100644 index 000000000..5f6c63b57 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml @@ -0,0 +1,175 @@ +import QtQuick 2.0 +import QtTest 1.0 +import QtWebKit 3.0 +import QtWebKit.experimental 1.0 +import Test 1.0 +import "../common" + +Item { + TestWebView { + id: webView + width: 320 + height: 480 + + property variant result + + property variant content: "data:text/html," + + "<head>" + + " <meta name='viewport' content='width=device-width'>" + + "</head>" + + "<body>" + + " <div id='target' style='width: 240px; height: 360px;'>" + + " </div>" + + "</body>" + + signal resultReceived + } + + SignalSpy { + id: resultSpy + target: webView + signalName: "resultReceived" + } + + SignalSpy { + id: scaleSpy + target: webView.experimental.test + signalName: "contentsScaleCommitted" + } + + SignalSpy { + id: sizeSpy + target: webView.experimental.test + signalName: "contentsSizeChanged" + } + + TestCase { + name: "Resize" + when: windowShown + + property variant test: webView.experimental.test + + function init() { + resultSpy.clear() + scaleSpy.clear() + viewportSpy.clear() + } + + function run(signalSpy, script) { + signalSpy.clear(); + var result; + webView.experimental.evaluateJavaScript( + script, + function(value) { webView.resultReceived(); result = value }); + signalSpy.wait(); + return result; + } + + function contentsSize() { + return test.contentsSize.width + "x" + test.contentsSize.height; + } + + function elementRect(id) { + return JSON.parse(run(resultSpy, "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());")) + } + + function doubleTapAtPoint(x, y) { + scaleSpy.clear() + test.touchDoubleTap(webView, x, y) + scaleSpy.wait() + } + + function resize(w, h) { + sizeSpy.clear() + webView.width = w + sizeSpy.wait() + webView.height = h + sizeSpy.wait() + } + + function test_basic() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + } + + function test_resizeAfterNeutralZoom() { + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Zoom in and out. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, 1.0) + + // Now check resizing still works as expected. + resize(480, 720) + compare(contentsSize(), "480x720") + compare(test.contentsScale, 1.0) + + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + + function test_resizeZoomedIn() { + // Note that if we change the behavior of resize on zoomed-in content, for instance + // to preserve the visible width (like rotate), this test will need to be updated. + webView.url = webView.content + verify(webView.waitForViewportReady()) + + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + + var target = elementRect("target"); + var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px + + // Double tap to zoom in. + doubleTapAtPoint(100, 50) + + compare(test.contentsScale, targetScale) + + // Resize just a small bit, not changing scale. + resize(288, 432) + compare(contentsSize(), "288x432") + compare(test.contentsScale, targetScale) + + // And double tap to reset zoom. + target = elementRect("target"); + targetScale = webView.width / (target.width + 2 * 10) + doubleTapAtPoint(100, 50) + compare(test.contentsScale, targetScale) + + // Double tap again to zoom out. + doubleTapAtPoint(100, 50) + compare(contentsSize(), "288x432") + compare(test.contentsScale, 1.0) + + // And reset + resize(320, 480) + compare(contentsSize(), "320x480") + compare(test.contentsScale, 1.0) + } + } +} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro index bc5307f2d..4a8d86f80 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro @@ -1,4 +1,4 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro index ba8f4cea3..02dc197c7 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro @@ -1,3 +1,3 @@ include(../tests.pri) SOURCES += $${TARGET}.cpp -QT += webkitwidgets-private +QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 123b25ce2..a1133530d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -6,7 +6,7 @@ TARGET = tst_$$TARGET INCLUDEPATH += $$PWD SOURCES += ../util.cpp -QT += testlib webkitwidgets +QT += testlib webkit have?(QTQUICK) { QT += qml quick quick-private HEADERS += ../bytearraytestdata.h \ diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 7fae9a011..71c4bcbd6 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -216,8 +216,8 @@ void LayerTreeRenderer::adjustPositionForFixedLayers() FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize); FloatSize delta = scrollPosition - renderedScrollPosition; - LayerMap::iterator end = m_fixedLayers.end(); - for (LayerMap::iterator it = m_fixedLayers.begin(); it != end; ++it) + LayerRawPtrMap::iterator end = m_fixedLayers.end(); + for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it) toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); } @@ -266,17 +266,16 @@ void LayerTreeRenderer::destroyCanvas(WebLayerID id) void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); Vector<GraphicsLayer*> children; for (size_t i = 0; i < childIDs.size(); ++i) { WebLayerID childID = childIDs[i]; GraphicsLayer* child = layerByID(childID); if (!child) { - child = createLayer(childID).leakPtr(); - m_layers.add(childID, child); + OwnPtr<GraphicsLayer*> newChild = createLayer(childID); + child = newChild.get(); + m_layers.add(childID, newChild.release()); } children.append(child); } @@ -286,11 +285,8 @@ void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID> #if ENABLE(CSS_FILTERS) void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& filters) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); + GraphicsLayer* layer = ensureLayer(id); - GraphicsLayer* layer = it->value; #if ENABLE(CSS_SHADERS) injectCachedCustomFilterPrograms(filters); #endif @@ -332,11 +328,7 @@ void LayerTreeRenderer::removeCustomFilterProgram(int id) void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerInfo) { - ensureLayer(id); - LayerMap::iterator it = m_layers.find(id); - ASSERT(it != m_layers.end()); - - GraphicsLayer* layer = it->value; + GraphicsLayer* layer = ensureLayer(id); layer->setReplicatedByLayer(layerByID(layerInfo.replica)); layer->setMaskLayer(layerByID(layerInfo.mask)); @@ -371,26 +363,29 @@ void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerIn void LayerTreeRenderer::deleteLayer(WebLayerID layerID) { - GraphicsLayer* layer = layerByID(layerID); + OwnPtr<GraphicsLayer> layer = m_layers.take(layerID); if (!layer) return; layer->removeFromParent(); - m_layers.remove(layerID); m_fixedLayers.remove(layerID); #if USE(GRAPHICS_SURFACE) m_surfaceBackingStores.remove(layerID); #endif - delete layer; } -void LayerTreeRenderer::ensureLayer(WebLayerID id) +WebCore::GraphicsLayer* LayerTreeRenderer::ensureLayer(WebLayerID id) { - // We have to leak the new layer's pointer and manage it ourselves, - // because OwnPtr is not copyable. - if (m_layers.find(id) == m_layers.end()) - m_layers.add(id, createLayer(id).leakPtr()); + LayerMap::iterator it = m_layers.find(id); + if (it != m_layers.end()) + return it->value.get(); + + OwnPtr<WebCore::GraphicsLayer> newLayer = createLayer(id); + WebCore::GraphicsLayer* layer = newLayer.get(); + m_layers.add(id, newLayer.release()); + + return layer; } void LayerTreeRenderer::setRootLayerID(WebLayerID layerID) diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index 6f1056aac..946ac6d49 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -142,7 +142,7 @@ private: void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID); void removeReleasedImageBackingsIfNeeded(); void ensureRootLayer(); - void ensureLayer(WebLayerID); + WebCore::GraphicsLayer* ensureLayer(WebLayerID); void commitPendingBackingStoreOperations(); CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*); @@ -151,7 +151,6 @@ private: void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*); void resetBackingStoreSizeToLayerSize(WebCore::GraphicsLayer*); - typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap; WebCore::FloatSize m_contentsSize; WebCore::FloatRect m_visibleContentsRect; @@ -181,8 +180,10 @@ private: OwnPtr<WebCore::GraphicsLayer> m_rootLayer; + typedef HashMap<WebLayerID, OwnPtr<WebCore::GraphicsLayer> > LayerMap; LayerMap m_layers; - LayerMap m_fixedLayers; + typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerRawPtrMap; + LayerRawPtrMap m_fixedLayers; WebLayerID m_rootLayerID; WebCore::IntPoint m_renderedContentsScrollPosition; WebCore::IntPoint m_pendingRenderedContentsScrollPosition; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 74a87a455..c4ed068b4 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -81,6 +81,7 @@ public: virtual void waitForPossibleGeometryUpdate() { } virtual void colorSpaceDidChange() { } + virtual void minimumLayoutWidthDidChange() { } #if USE(COORDINATED_GRAPHICS) virtual void updateViewport(); @@ -118,7 +119,8 @@ private: virtual void updateAcceleratedCompositingMode(uint64_t /* backingStoreStateID */, const LayerTreeContext&) { } #endif #if PLATFORM(MAC) - virtual void didUpdateGeometry() { } + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) { } + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) { } #endif }; diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in index 7dbdcebab..b3f02afec 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -31,6 +31,7 @@ messages -> DrawingAreaProxy { #if PLATFORM(MAC) // Used by TiledCoreAnimationDrawingAreaProxy. - DidUpdateGeometry() + DidUpdateGeometry(WebCore::IntSize newIntrinsicContentSize) + IntrinsicContentSizeDidChange(WebCore::IntSize newIntrinsicContentSize) #endif } diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h index dd0cd5a1c..56dc9a141 100644 --- a/Source/WebKit2/UIProcess/PageClient.h +++ b/Source/WebKit2/UIProcess/PageClient.h @@ -127,6 +127,7 @@ public: virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0; virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0; virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0; + virtual void handleWillSetInputMethodState() = 0; #endif // PLATFORM(QT). #if PLATFORM(QT) || PLATFORM(EFL) @@ -224,6 +225,7 @@ public: #if USE(APPKIT) virtual WKView* wkView() const = 0; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0; #if USE(DICTATION_ALTERNATIVES) virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0; virtual void removeDictationAlternatives(uint64_t dictationContext) = 0; diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index ff135a2cf..e56869f23 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -111,7 +111,7 @@ void PageViewportController::didChangeContentsSize(const IntSize& newSize) { m_contentsSize = newSize; - bool minimumScaleUpdated = updateMinimumScaleToFit(); + bool minimumScaleUpdated = updateMinimumScaleToFit(false); if (m_initiallyFitToViewport) { // Restrict scale factors to m_minimumScaleToFit. @@ -209,7 +209,7 @@ void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewp void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVector) { - DrawingAreaProxy* const drawingArea = m_webPageProxy->drawingArea(); + DrawingAreaProxy* drawingArea = m_webPageProxy->drawingArea(); if (!drawingArea || m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return; @@ -232,10 +232,8 @@ void PageViewportController::didChangeViewportAttributes(const WebCore::Viewport if (!m_initiallyFitToViewport) WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(m_rawAttributes); - if (updateMinimumScaleToFit()) + if (updateMinimumScaleToFit(true)) m_client->didChangeViewportAttributes(); - - syncVisibleContents(); } WebCore::FloatSize PageViewportController::viewportSizeInContentsCoordinates() const @@ -277,11 +275,13 @@ void PageViewportController::applyPositionAfterRenderingContents(const FloatPoin syncVisibleContents(); } -bool PageViewportController::updateMinimumScaleToFit() +bool PageViewportController::updateMinimumScaleToFit(bool userInitiatedUpdate) { if (m_viewportSize.isEmpty() || m_contentsSize.isEmpty()) return false; + bool currentlyScaledToFit = fuzzyCompare(m_effectiveScale, toViewportScale(m_minimumScaleToFit), 0.001); + float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize), devicePixelRatio()); if (minimumScale <= 0) @@ -290,8 +290,16 @@ bool PageViewportController::updateMinimumScaleToFit() if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) { m_minimumScaleToFit = minimumScale; - if (!m_hadUserInteraction && !hasSuspendedContent()) - applyScaleAfterRenderingContents(toViewportScale(minimumScale)); + if (!hasSuspendedContent()) { + if (!m_hadUserInteraction || (userInitiatedUpdate && currentlyScaledToFit)) + applyScaleAfterRenderingContents(toViewportScale(m_minimumScaleToFit)); + else { + // Ensure the effective scale stays within bounds. + float boundedScale = innerBoundedViewportScale(m_effectiveScale); + if (!fuzzyCompare(boundedScale, m_effectiveScale, 0.001)) + applyScaleAfterRenderingContents(boundedScale); + } + } return true; } diff --git a/Source/WebKit2/UIProcess/PageViewportController.h b/Source/WebKit2/UIProcess/PageViewportController.h index 052e89ab0..029228dde 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.h +++ b/Source/WebKit2/UIProcess/PageViewportController.h @@ -84,7 +84,7 @@ private: void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero()); void applyScaleAfterRenderingContents(float scale); void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos); - bool updateMinimumScaleToFit(); + bool updateMinimumScaleToFit(bool userInitiatedUpdate); WebCore::FloatSize viewportSizeInContentsCoordinates() const; WebPageProxy* const m_webPageProxy; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp index f497895db..834c87fc4 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp @@ -45,12 +45,12 @@ PluginProcessManager::PluginProcessManager() { } -void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void PluginProcessManager::getPluginProcessConnection(const PluginInfoStore& pluginInfoStore, const String& pluginPath, PluginProcess::Type processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { ASSERT(!pluginPath.isNull()); PluginModuleInfo plugin = pluginInfoStore.infoForPluginWithPath(pluginPath); - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, processType); pluginProcess->getPluginProcessConnection(reply); } @@ -64,32 +64,33 @@ void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginPr void PluginProcessManager::getSitesWithData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->getSitesWithData(webPluginSiteDataManager, callbackID); } void PluginProcessManager::clearSiteData(const PluginModuleInfo& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID) { - PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin); + PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin, PluginProcess::TypeRegularProcess); pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID); } -PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath) +PluginProcessProxy* PluginProcessManager::pluginProcessWithPath(const String& pluginPath, PluginProcess::Type processType) { for (size_t i = 0; i < m_pluginProcesses.size(); ++i) { - if (m_pluginProcesses[i]->pluginInfo().path == pluginPath) - return m_pluginProcesses[i].get(); + RefPtr<PluginProcessProxy>& pluginProcessProxy = m_pluginProcesses[i]; + if (pluginProcessProxy->pluginInfo().path == pluginPath && pluginProcessProxy->processType() == processType) + return pluginProcessProxy.get(); } return 0; } -PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin) +PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginModuleInfo& plugin, PluginProcess::Type processType) { - if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path)) + if (PluginProcessProxy* pluginProcess = pluginProcessWithPath(plugin.path, processType)) return pluginProcess; - RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin); + RefPtr<PluginProcessProxy> pluginProcess = PluginProcessProxy::create(this, plugin, processType); PluginProcessProxy* pluginProcessPtr = pluginProcess.get(); m_pluginProcesses.append(pluginProcess.release()); diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h index 5e519427b..f84521a49 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h @@ -29,6 +29,7 @@ #if ENABLE(PLUGIN_PROCESS) #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "WebProcessProxyMessages.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -50,7 +51,7 @@ class PluginProcessManager { public: static PluginProcessManager& shared(); - void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const PluginInfoStore&, const String& pluginPath, PluginProcess::Type, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); void removePluginProcessProxy(PluginProcessProxy*); void getSitesWithData(const PluginModuleInfo&, WebPluginSiteDataManager*, uint64_t callbackID); @@ -63,8 +64,8 @@ public: private: PluginProcessManager(); - PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&); - PluginProcessProxy* pluginProcessWithPath(const String& pluginPath); + PluginProcessProxy* getOrCreatePluginProcess(const PluginModuleInfo&, PluginProcess::Type); + PluginProcessProxy* pluginProcessWithPath(const String& pluginPath, PluginProcess::Type); Vector<RefPtr<PluginProcessProxy> > m_pluginProcesses; }; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp index 0c2e8689e..5a49f9598 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp @@ -50,12 +50,12 @@ namespace WebKit { static const double minimumLifetime = 30 * 60; static const double shutdownTimeout = 10 * 60; -PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) { - return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo)); + return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo, processType)); } -PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo) +PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo, PluginProcess::Type processType) : m_pluginProcessManager(PluginProcessManager) , m_pluginInfo(pluginInfo) , m_numPendingConnectionRequests(0) @@ -64,6 +64,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage , m_fullscreenWindowIsShowing(false) , m_preFullscreenAppPresentationOptions(0) #endif + , m_processType(processType) { ProcessLauncher::LaunchOptions launchOptions; launchOptions.processType = ProcessLauncher::PluginProcess; @@ -173,7 +174,7 @@ void PluginProcessProxy::didClose(CoreIPC::Connection*) const Vector<WebContext*>& contexts = WebContext::allContexts(); for (size_t i = 0; i < contexts.size(); ++i) - contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path)); + contexts[i]->sendToAllProcesses(Messages::WebProcess::PluginProcessCrashed(m_pluginInfo.path, m_processType)); // This will cause us to be deleted. pluginProcessCrashedOrFailedToLaunch(); @@ -204,6 +205,7 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio PluginProcessCreationParameters parameters; parameters.pluginPath = m_pluginInfo.path; + parameters.processType = m_processType; parameters.minimumLifetime = minimumLifetime; parameters.terminationTimeout = shutdownTimeout; diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h index 1357e6c7f..194d7a373 100644 --- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h +++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h @@ -30,6 +30,7 @@ #include "Connection.h" #include "PluginModuleInfo.h" +#include "PluginProcess.h" #include "ProcessLauncher.h" #include "WebProcessProxyMessages.h" #include <wtf/Deque.h> @@ -62,7 +63,7 @@ struct RawPluginMetaData { class PluginProcessProxy : public RefCounted<PluginProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client { public: - static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&); + static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); ~PluginProcessProxy(); const PluginModuleInfo& pluginInfo() const { return m_pluginInfo; } @@ -82,6 +83,8 @@ public: bool isValid() const { return m_connection; } + PluginProcess::Type processType() const { return m_processType; } + #if PLATFORM(MAC) void setApplicationIsOccluded(bool); @@ -97,7 +100,7 @@ public: #endif private: - PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&); + PluginProcessProxy(PluginProcessManager*, const PluginModuleInfo&, PluginProcess::Type); void pluginProcessCrashedOrFailedToLaunch(); @@ -171,6 +174,8 @@ private: bool m_fullscreenWindowIsShowing; unsigned m_preFullscreenAppPresentationOptions; #endif + + PluginProcess::Type m_processType; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index df416c09d..9d914cf28 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -233,6 +233,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_renderTreeSize(0) , m_shouldSendEventsSynchronously(false) , m_suppressVisibilityUpdates(false) + , m_minimumLayoutWidth(0) , m_mediaVolume(1) , m_mayStartMediaWhenInWindow(true) #if ENABLE(PAGE_VISIBILITY_API) @@ -4129,6 +4130,20 @@ void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event) m_process->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0); } +void WebPageProxy::setMinimumLayoutWidth(double minimumLayoutWidth) +{ + if (m_minimumLayoutWidth == minimumLayoutWidth) + return; + + m_minimumLayoutWidth = minimumLayoutWidth; + m_drawingArea->minimumLayoutWidthDidChange(); + +#if PLATFORM(MAC) + if (m_minimumLayoutWidth <= 0) + intrinsicContentSizeDidChange(IntSize(-1, -1)); +#endif +} + #if PLATFORM(MAC) void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 9139b482e..ff8ec5133 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -409,6 +409,7 @@ public: #if USE(APPKIT) WKView* wkView() const; + void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize); #endif #endif #if PLATFORM(WIN) @@ -757,6 +758,9 @@ public: const WebLoaderClient& loaderClient() { return m_loaderClient; } + double minimumLayoutWidth() const { return m_minimumLayoutWidth; } + void setMinimumLayoutWidth(double); + private: WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID); @@ -895,6 +899,9 @@ private: #endif void editorStateChanged(const EditorState&); +#if PLATFORM(QT) + void willSetInputMethodState(); +#endif // Back/Forward list management void backForwardAddItem(uint64_t itemID); @@ -1239,6 +1246,7 @@ private: bool m_shouldSendEventsSynchronously; bool m_suppressVisibilityUpdates; + float m_minimumLayoutWidth; float m_mediaVolume; bool m_mayStartMediaWhenInWindow; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index f88eda49e..5c89fae35 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -205,7 +205,9 @@ messages -> WebPageProxy { #if PLATFORM(WIN) DidChangeCompositionSelection(bool hasChanged) #endif - +#if PLATFORM(QT) + WillSetInputMethodState() +#endif # Find messages DidCountStringMatches(WTF::String string, uint32_t matchCount) SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index fdeda3a8f..6ca003ab3 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -406,9 +406,9 @@ void WebProcessProxy::getPluginPath(const String& mimeType, const String& urlStr #if ENABLE(PLUGIN_PROCESS) -void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) +void WebProcessProxy::getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply) { - PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, reply); + PluginProcessManager::shared().getPluginProcessConnection(m_context->pluginInfoStore(), pluginPath, static_cast<PluginProcess::Type>(processType), reply); } #elif ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h index 4c9996125..32325d508 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.h +++ b/Source/WebKit2/UIProcess/WebProcessProxy.h @@ -154,7 +154,7 @@ private: void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >); #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - void getPluginProcessConnection(const String& pluginPath, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); + void getPluginProcessConnection(const String& pluginPath, uint32_t processType, PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>); #elif ENABLE(NETSCAPE_PLUGIN_API) void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID); void didClearPluginSiteData(uint64_t callbackID); diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in index 22e2f08ea..a83e1e84c 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in @@ -39,7 +39,7 @@ messages -> WebProcessProxy { GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath, uint32_t pluginLoadPolicy) #endif // ENABLE(NETSCAPE_PLUGIN_API) #if ENABLE(PLUGIN_PROCESS) - GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed + GetPluginProcessConnection(WTF::String pluginPath, uint32_t processType) -> (CoreIPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed #endif #if ENABLE(NETSCAPE_PLUGIN_API) && !ENABLE(PLUGIN_PROCESS) void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID) diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp index d4e4cd8bb..2b411fde0 100644 --- a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp +++ b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp @@ -93,7 +93,7 @@ void WebInspectorProxy::createInspectorWindow() gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector")); gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight); - gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView); + webkitWebViewBaseAddWebInspector(WEBKIT_WEB_VIEW_BASE(m_inspectorWindow), m_inspectorView); gtk_widget_show(m_inspectorView); g_object_add_weak_pointer(G_OBJECT(m_inspectorWindow), reinterpret_cast<void**>(&m_inspectorWindow)); diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h index 08b16508d..c78610984 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h @@ -48,13 +48,15 @@ private: virtual void sizeDidChange() OVERRIDE; virtual void waitForPossibleGeometryUpdate() OVERRIDE; virtual void colorSpaceDidChange() OVERRIDE; + virtual void minimumLayoutWidthDidChange() OVERRIDE; virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) OVERRIDE; virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) OVERRIDE; // Message handlers. - virtual void didUpdateGeometry() OVERRIDE; + virtual void didUpdateGeometry(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; + virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) OVERRIDE; void sendUpdateGeometry(); @@ -63,6 +65,9 @@ private: // The last size we sent to the web process. WebCore::IntSize m_lastSentSize; + + // The last minimum layout width we sent to the web process. + double m_lastSentMinimumLayoutWidth; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm index a0c181768..3de8be7a6 100644 --- a/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm +++ b/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm @@ -47,6 +47,7 @@ PassOwnPtr<TiledCoreAnimationDrawingAreaProxy> TiledCoreAnimationDrawingAreaProx TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy(WebPageProxy* webPageProxy) : DrawingAreaProxy(DrawingAreaTypeTiledCoreAnimation, webPageProxy) , m_isWaitingForDidUpdateGeometry(false) + , m_lastSentMinimumLayoutWidth(0) { } @@ -103,6 +104,19 @@ void TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange() m_webPageProxy->process()->send(Messages::DrawingArea::SetColorSpace(m_webPageProxy->colorSpace()), m_webPageProxy->pageID()); } +void TiledCoreAnimationDrawingAreaProxy::minimumLayoutWidthDidChange() +{ + if (!m_webPageProxy->isValid()) + return; + + // We only want one UpdateGeometry message in flight at once, so if we've already sent one but + // haven't yet received the reply we'll just return early here. + if (m_isWaitingForDidUpdateGeometry) + return; + + sendUpdateGeometry(); +} + void TiledCoreAnimationDrawingAreaProxy::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext) { m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); @@ -119,24 +133,36 @@ void TiledCoreAnimationDrawingAreaProxy::updateAcceleratedCompositingMode(uint64 m_webPageProxy->updateAcceleratedCompositingMode(layerTreeContext); } -void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry() +void TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry(const IntSize& newIntrinsicContentSize) { ASSERT(m_isWaitingForDidUpdateGeometry); m_isWaitingForDidUpdateGeometry = false; + double minimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); + // If the WKView was resized while we were waiting for a DidUpdateGeometry reply from the web process, // we need to resend the new size here. - if (m_lastSentSize != m_size) + if (m_lastSentSize != m_size || m_lastSentMinimumLayoutWidth != minimumLayoutWidth) sendUpdateGeometry(); + + if (minimumLayoutWidth > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); +} + +void TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange(const IntSize& newIntrinsicContentSize) +{ + if (m_webPageProxy->minimumLayoutWidth() > 0) + m_webPageProxy->intrinsicContentSizeDidChange(newIntrinsicContentSize); } void TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry() { ASSERT(!m_isWaitingForDidUpdateGeometry); + m_lastSentMinimumLayoutWidth = m_webPageProxy->minimumLayoutWidth(); m_lastSentSize = m_size; - m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size), m_webPageProxy->pageID()); + m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size, m_lastSentMinimumLayoutWidth), m_webPageProxy->pageID()); m_isWaitingForDidUpdateGeometry = true; } diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm index 137c22f2c..849ba20f8 100644 --- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm @@ -474,6 +474,11 @@ WKView* WebPageProxy::wkView() const return m_pageClient->wkView(); } +void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize) +{ + m_pageClient->intrinsicContentSizeDidChange(intrinsicContentSize); +} + void WebPageProxy::setAcceleratedCompositingRootLayer(const GraphicsLayer* rootLayer) { m_pageClient->setAcceleratedCompositingRootLayer(rootLayer->platformLayer()); diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index b8ccd977b..1cf3ae568 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -88,7 +88,7 @@ void PageViewportControllerClientQt::setContentRectVisiblePositionAtScale(const // To animate the position together with the scale we multiply the position with the current scale // and add it to the page position (displacement on the flickable contentItem because of additional items). - QPointF newPosition(m_pageItem->position() + location * itemScale); + QPointF newPosition(m_pageItem->pos() + location * itemScale); m_viewportItem->setContentPos(newPosition); } @@ -317,7 +317,7 @@ QRectF PageViewportControllerClientQt::nearestValidVisibleContentsRect() const void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint) { - QPointF newPosition((m_pageItem->position() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); + QPointF newPosition((m_pageItem->pos() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); m_viewportItem->setContentPos(newPosition); updateViewportController(); } diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 7737f6529..89a40c923 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -256,6 +256,12 @@ void QtPageClient::updateTextInputState() m_eventHandler->updateTextInputState(); } +void QtPageClient::handleWillSetInputMethodState() +{ + ASSERT(m_eventHandler); + m_eventHandler->handleWillSetInputMethodState(); +} + #if ENABLE(GESTURE_EVENTS) void QtPageClient::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.h b/Source/WebKit2/UIProcess/qt/QtPageClient.h index e493ce8ad..fc10ca653 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.h +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.h @@ -103,6 +103,7 @@ public: virtual void pageTransitionViewportReady(); virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); virtual void updateTextInputState(); + virtual void handleWillSetInputMethodState(); virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); #if ENABLE(TOUCH_EVENTS) virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 88dae15b8..b80613438 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -435,6 +435,12 @@ void QtWebPageEventHandler::updateTextInputState() setInputPanelVisible(editor.isContentEditable); } +void QtWebPageEventHandler::handleWillSetInputMethodState() +{ + if (qApp->inputMethod()->isVisible()) + qApp->inputMethod()->commit(); +} + void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled) { if (event.type() != WebEvent::GestureSingleTap) diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h index 04c75ab3f..005cb4ca0 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h @@ -89,6 +89,7 @@ public: void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); #endif void handleInputEvent(const QInputEvent*); + void handleWillSetInputMethodState(); void resetGestureRecognizers(); PageViewportControllerClientQt* viewportController() { return m_viewportController; } diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp index 46429461f..8a205f91d 100644 --- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -171,4 +171,9 @@ void WebPageProxy::closePopupMenu() process()->send(Messages::WebPage::HidePopupMenu(), m_pageID); } +void WebPageProxy::willSetInputMethodState() +{ + m_pageClient->handleWillSetInputMethodState(); +} + } // namespace WebKit |
