2010-08-16 Balazs Kelemen <kb@inf.u-szeged.hu>
authorabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Aug 2010 13:39:56 +0000 (13:39 +0000)
committerabecsi@webkit.org <abecsi@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Aug 2010 13:39:56 +0000 (13:39 +0000)
        Reviewed by Kenneth Rohde Christiansen.

        Handle content size change in WebKit2
        Re-landing after fix.

        https://bugs.webkit.org/show_bug.cgi?id=43198

        * MiniBrowser/mac/BrowserWindowController.m:
        (-[BrowserWindowController awakeFromNib]): Initialize WKPageUICallback::contetsSizeChanged to 0.
        * MiniBrowser/win/BrowserView.cpp:
        (BrowserView::create): Initialize WKPageUICallback::contetsSizeChanged to 0.
2010-08-16  Balazs Kelemen  <kb@inf.u-szeged.hu>

        Reviewed by Kenneth Rohde Christiansen.

        Handle content size change in WebKit2
        Re-landing after fix.

        https://bugs.webkit.org/show_bug.cgi?id=43198

        Based on the work of Antti Koivisto.
        Send message to the UI client when the contents size has changed through the WebChromeClient
        and propagate it to the WKPageUIClient.

        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
        (WebPageProxyMessage::): Added ContentsSizeChanged message kind.
        * UIProcess/API/C/WKPage.h: Added WKPageContentsSizeChangedCallback callback to the WKPageUIClient.
        * UIProcess/API/qt/qwkpage.cpp:
        (QWKPage::QWKPage): Initialize the new callback to 0.
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::didReceiveMessage): Handle ContentsSizeChanged message. Calls contetsSizeChanged.
        (WebKit::WebPageProxy::contentsSizeChanged): Added. Propagate the event to the the UI client.
        * UIProcess/WebPageProxy.h:
        * UIProcess/WebUIClient.cpp:
        (WebKit::WebUIClient::contentsSizeChanged): Added. Propagate the event forward to the WKPageUIClient.
        * UIProcess/WebUIClient.h:
        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::contentsSizeChanged): Implemented.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65422 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebKit2/ChangeLog
WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
WebKit2/UIProcess/API/C/WKPage.h
WebKit2/UIProcess/API/qt/qwkpage.cpp
WebKit2/UIProcess/WebPageProxy.cpp
WebKit2/UIProcess/WebPageProxy.h
WebKit2/UIProcess/WebUIClient.cpp
WebKit2/UIProcess/WebUIClient.h
WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
WebKitTools/ChangeLog
WebKitTools/MiniBrowser/mac/BrowserWindowController.m
WebKitTools/MiniBrowser/win/BrowserView.cpp

index f08689c..c4f5fc5 100644 (file)
@@ -1,3 +1,31 @@
+2010-08-16  Balazs Kelemen  <kb@inf.u-szeged.hu>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Handle content size change in WebKit2
+        Re-landing after fix.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43198
+
+        Based on the work of Antti Koivisto.
+        Send message to the UI client when the contents size has changed through the WebChromeClient
+        and propagate it to the WKPageUIClient.
+
+        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
+        (WebPageProxyMessage::): Added ContentsSizeChanged message kind.
+        * UIProcess/API/C/WKPage.h: Added WKPageContentsSizeChangedCallback callback to the WKPageUIClient.
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPage::QWKPage): Initialize the new callback to 0.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage): Handle ContentsSizeChanged message. Calls contetsSizeChanged.
+        (WebKit::WebPageProxy::contentsSizeChanged): Added. Propagate the event to the the UI client.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::contentsSizeChanged): Added. Propagate the event forward to the WKPageUIClient.
+        * UIProcess/WebUIClient.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::contentsSizeChanged): Implemented.
+
 2010-08-16  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r65419.
index 591249f..b552993 100644 (file)
@@ -38,8 +38,9 @@ enum Kind {
     RunJavaScriptAlert,
     RunJavaScriptConfirm,
     RunJavaScriptPrompt,
-    
+
     ClosePage,
+    ContentsSizeChanged,
     DecidePolicyForMIMEType,
     DecidePolicyForNavigationAction,
     DecidePolicyForNewWindowAction,
index b4d7b21..072ad61 100644 (file)
@@ -130,6 +130,7 @@ typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo);
 typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKPageContentsSizeChangedCallback)(WKPageRef page, int width, int height, WKFrameRef frame, const void *clientInfo);
 
 struct WKPageUIClient {
     int                                                                 version;
@@ -140,6 +141,7 @@ struct WKPageUIClient {
     WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
     WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
     WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
+    WKPageContentsSizeChangedCallback                                   contentsSizeChanged;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
index 7052f57..b6d2916 100644 (file)
@@ -227,7 +227,8 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
         qt_wk_close,
         qt_wk_runJavaScriptAlert,
         0,  /* runJavaScriptConfirm */
-        0   /* runJavaScriptPrompt */
+        0,  /* runJavaScriptPrompt */
+        0   /* contentsSizeChanged */
     };
     WKPageSetPageUIClient(pageRef(), &uiClient);
 }
index d5d9878..5f49a92 100644 (file)
@@ -605,6 +605,14 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             goToItemInBackForwardList(process()->webBackForwardItem(itemID));
             break;
         }
+        case WebPageProxyMessage::ContentsSizeChanged: {
+            IntSize size;
+            uint64_t frameID;
+            if (!arguments->decode(CoreIPC::Out(frameID, size)))
+                return;
+            contentsSizeChanged(webFrame(frameID), size);
+            break;
+        }
         default:
             ASSERT_NOT_REACHED();
             break;
@@ -876,6 +884,11 @@ String WebPageProxy::runJavaScriptPrompt(WebFrameProxy* frame, const String& mes
     return m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
 }
 
+void WebPageProxy::contentsSizeChanged(WebFrameProxy* frame, const WebCore::IntSize& size)
+{
+    m_uiClient.contentsSizeChanged(this, size, frame);
+}
+
 // BackForwardList
 
 void WebPageProxy::addItemToBackForwardList(WebBackForwardListItem* item)
index 5eb483b..d281688 100644 (file)
@@ -200,6 +200,7 @@ private:
     void runJavaScriptAlert(WebFrameProxy*, const WTF::String&);
     bool runJavaScriptConfirm(WebFrameProxy* frame, const WTF::String&);
     WTF::String runJavaScriptPrompt(WebFrameProxy* frame, const WTF::String&, const WTF::String&);
+    void contentsSizeChanged(WebFrameProxy*, const WebCore::IntSize&);
 
     void addItemToBackForwardList(WebBackForwardListItem*);
     void goToItemInBackForwardList(WebBackForwardListItem*);
index 8c3942d..b22e69c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "WKAPICast.h"
 #include "WebPageProxy.h"
+#include <WebCore/IntSize.h>
 #include <WebCore/PlatformString.h>
 #include <string.h>
 
@@ -102,4 +103,12 @@ String WebUIClient::runJavaScriptPrompt(WebPageProxy* page, const String& messag
     return result;
 }
 
+void WebUIClient::contentsSizeChanged(WebPageProxy* page, const IntSize& size, WebFrameProxy* frame)
+{
+    if (!m_pageUIClient.contentsSizeChanged)
+        return;
+
+    m_pageUIClient.contentsSizeChanged(toRef(page), size.width(), size.height(), toRef(frame), m_pageUIClient.clientInfo);
+}
+
 } // namespace WebKit
index 4f8ed8f..ec530de 100644 (file)
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 
+namespace WebCore {
+class IntSize;
+}
+
 namespace WebKit {
 
 class WebFrameProxy;
@@ -46,6 +50,7 @@ public:
     void runJavaScriptAlert(WebPageProxy*, const WTF::String&, WebFrameProxy*);
     bool runJavaScriptConfirm(WebPageProxy*, const WTF::String&, WebFrameProxy*);
     WTF::String runJavaScriptPrompt(WebPageProxy*, const WTF::String&, const WTF::String&, WebFrameProxy*);
+    void contentsSizeChanged(WebPageProxy*, const WebCore::IntSize&, WebFrameProxy*);
 
 private:
     WKPageUIClient m_pageUIClient;
index 53b47c9..6c22c62 100644 (file)
@@ -345,9 +345,11 @@ PlatformPageClient WebChromeClient::platformPageClient() const
     return 0;
 }
 
-void WebChromeClient::contentsSizeChanged(Frame*, const IntSize&) const
+void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
 {
-    notImplemented();
+    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
+    WebProcess::shared().connection()->send(WebPageProxyMessage::ContentsSizeChanged, m_page->pageID(),
+                                            CoreIPC::In(webFrame->frameID(), size));
 }
 
 void WebChromeClient::scrollRectIntoView(const IntRect&, const ScrollView*) const
index 357b0ba..6164819 100644 (file)
@@ -1,3 +1,17 @@
+2010-08-16  Balazs Kelemen  <kb@inf.u-szeged.hu>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Handle content size change in WebKit2
+        Re-landing after fix.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43198
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]): Initialize WKPageUICallback::contetsSizeChanged to 0.
+        * MiniBrowser/win/BrowserView.cpp:
+        (BrowserView::create): Initialize WKPageUICallback::contetsSizeChanged to 0.
+
 2010-08-16  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r65419.
index 9a987d2..9842448 100644 (file)
@@ -411,7 +411,8 @@ static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKSt
         closePage,
         runJavaScriptAlert,
         runJavaScriptConfirm,
-        runJavaScriptPrompt
+        runJavaScriptPrompt,
+        0           /* contentsSizeChanged */
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }
index 49e46bf..ee67a08 100644 (file)
@@ -83,7 +83,8 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
         createNewPage,
         showPage,
         closePage,
-        runJavaScriptAlert
+        runJavaScriptAlert,
+        0               /* contentsSizeChanged */
     };
     WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);
 }