2011-06-07 Sam Weinig <sam@webkit.org>
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jun 2011 23:38:54 +0000 (23:38 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jun 2011 23:38:54 +0000 (23:38 +0000)
        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebCore.xcodeproj/project.pbxproj:
        Make RenderArena.h private so it can be called from WebKit2.

        * loader/FrameLoaderClient.h:
        (WebCore::FrameLoaderClient::dispatchDidLayout):
        Added.

        * page/ChromeClient.h:
        Remove setRenderTreeSize.

        * page/FrameView.cpp:
        (WebCore::FrameView::performPostLayoutTasks):
        Call dispatchDidLayout for all frames instead of calling setRenderTreeSize
        for the main frame.
2011-06-07  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
        Add didLayoutForFrame callback.

        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
        (WKBundlePageGetRenderTreeSize):
        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
        Add render tree size getter in WebProcess.

        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
        (WebKit::InjectedBundlePageLoaderClient::didLayoutForFrame):
        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
        Added.

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        * WebProcess/WebCoreSupport/WebChromeClient.h:
        Removed setRenderTreeSize.

        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
        Call the new didLayoutForFrame client function.

        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::renderTreeSize):
        * WebProcess/WebPage/WebPage.h:
        Add iterative implementation to compute the total size of the render tree
        for a page.
2011-06-07  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage):
        Add stub for didLayoutForFrame.

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

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/FrameView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

index 105905e..8def605 100644 (file)
@@ -1,3 +1,25 @@
+2011-06-07  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Make RenderArena.h private so it can be called from WebKit2.
+
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::dispatchDidLayout):
+        Added.
+
+        * page/ChromeClient.h:
+        Remove setRenderTreeSize.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+        Call dispatchDidLayout for all frames instead of calling setRenderTreeSize
+        for the main frame.
+
 2011-06-07  Emil A Eklund  <eae@chromium.org>
 
         Reviewed by Eric Seidel.
index b459710..bfd0d95 100644 (file)
                BCEA485B097D93020094C9E4 /* RenderApplet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481C097D93020094C9E4 /* RenderApplet.cpp */; };
                BCEA485C097D93020094C9E4 /* RenderApplet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481D097D93020094C9E4 /* RenderApplet.h */; };
                BCEA485D097D93020094C9E4 /* RenderArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481E097D93020094C9E4 /* RenderArena.cpp */; };
-               BCEA485E097D93020094C9E4 /* RenderArena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481F097D93020094C9E4 /* RenderArena.h */; };
+               BCEA485E097D93020094C9E4 /* RenderArena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481F097D93020094C9E4 /* RenderArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4820097D93020094C9E4 /* RenderBlock.cpp */; };
                BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4821097D93020094C9E4 /* RenderBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4861097D93020094C9E4 /* RenderBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4822097D93020094C9E4 /* RenderBox.cpp */; };
                BCFA930810333193007B25D1 /* RenderOverflow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFA930710333193007B25D1 /* RenderOverflow.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFB2E5E0979E46400BA703D /* CachedResourceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2E5D0979E46400BA703D /* CachedResourceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFB2F76097A2E1A00BA703D /* Arena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFB2F74097A2E1A00BA703D /* Arena.cpp */; };
-               BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; };
+               BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFE2F0F0C1B58370020235F /* JSRect.cpp */; };
                BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
                BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
index 75cf601..5b0411c 100644 (file)
@@ -148,8 +148,10 @@ namespace WebCore {
         virtual void dispatchDidFailLoad(const ResourceError&) = 0;
         virtual void dispatchDidFinishDocumentLoad() = 0;
         virtual void dispatchDidFinishLoad() = 0;
+
         virtual void dispatchDidFirstLayout() = 0;
         virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
+        virtual void dispatchDidLayout() { }
 
         virtual Frame* dispatchCreatePage(const NavigationAction&) = 0;
         virtual void dispatchShow() = 0;
index 3e1bf26..f6ca2f5 100644 (file)
@@ -328,8 +328,6 @@ namespace WebCore {
         virtual void willRunModalDialogDuringPageDismissal(const DialogType&) const { }
 
         virtual void numWheelEventHandlersChanged(unsigned) = 0;
-
-        virtual void setRenderTreeSize(size_t) { }
         
     protected:
         virtual ~ChromeClient() { }
index e39c52f..b09bbe3 100644 (file)
@@ -2048,6 +2048,8 @@ void FrameView::performPostLayoutTasks()
         }
     }
 
+    m_frame->loader()->client()->dispatchDidLayout();
+
     RenderView* root = m_frame->contentRenderer();
 
     root->updateWidgetPositions();
@@ -2069,11 +2071,6 @@ void FrameView::performPostLayoutTasks()
         m_lastZoomFactor = currentZoomFactor;
         if (resized)
             m_frame->eventHandler()->sendResizeEvent();
-
-        if (Page* page = m_frame->page()) {
-            if (m_frame->page()->mainFrame() == m_frame)
-                page->chrome()->client()->setRenderTreeSize(m_frame->document()->renderArena()->totalRenderArenaSize());
-        }
     }
 }
 
index 542575d..ea1b7e4 100644 (file)
@@ -1,3 +1,38 @@
+2011-06-07  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        Add didLayoutForFrame callback.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageGetRenderTreeSize):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+        Add render tree size getter in WebProcess.
+
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::didLayoutForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        Added.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Removed setRenderTreeSize.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        Call the new didLayoutForFrame client function.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::renderTreeSize):
+        * WebProcess/WebPage/WebPage.h:
+        Add iterative implementation to compute the total size of the render tree
+        for a page.
+
 2011-06-07  Zalan Bujtas  <zbujtas@gmail.com>
 
         Reviewed by Andreas Kling.
index dc3dbd9..efd77ac 100644 (file)
@@ -178,6 +178,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_mainFrameHasVerticalScrollbar(false)
     , m_mainFrameIsPinnedToLeftSide(false)
     , m_mainFrameIsPinnedToRightSide(false)
+    , m_renderTreeSize(0)
 {
 #ifndef NDEBUG
     webPageProxyCounter.increment();
index f04423f..ac748b8 100644 (file)
@@ -281,3 +281,8 @@ void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, dou
 {
     toImpl(page)->simulateMouseMotion(toIntPoint(position), time);
 }
+
+uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef pageRef)
+{
+    return toImpl(pageRef)->renderTreeSize();
+}
index bf4dd9b..00e2046 100644 (file)
@@ -89,12 +89,12 @@ typedef void (*WKBundlePageDidFinishDocumentLoadForFrameCallback)(WKBundlePageRe
 typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidSameDocumentNavigationForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-typedef void (*WKBundlePageDidFirstLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidRemoveFrameFromHierarchyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidDisplayInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidRunInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-// FIXME: There are no WKPage equivilent of these functions yet.
+typedef void (*WKBundlePageDidFirstLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo);
 typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
 typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
@@ -112,17 +112,16 @@ struct WKBundlePageLoaderClient {
     WKBundlePageDidFailLoadWithErrorForFrameCallback                    didFailLoadWithErrorForFrame;
     WKBundlePageDidSameDocumentNavigationForFrameCallback               didSameDocumentNavigationForFrame;
     WKBundlePageDidReceiveTitleForFrameCallback                         didReceiveTitleForFrame;
-    WKBundlePageDidFirstLayoutForFrame                                  didFirstLayoutForFrame;
-    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame                  didFirstVisuallyNonEmptyLayoutForFrame;
+    WKBundlePageDidFirstLayoutForFrameCallback                          didFirstLayoutForFrame;
+    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback          didFirstVisuallyNonEmptyLayoutForFrame;
     WKBundlePageDidRemoveFrameFromHierarchyCallback                     didRemoveFrameFromHierarchy;
     WKBundlePageDidDisplayInsecureContentForFrameCallback               didDisplayInsecureContentForFrame;
     WKBundlePageDidRunInsecureContentForFrameCallback                   didRunInsecureContentForFrame;
-
-    // FIXME: There are no WKPage equivilent of these functions yet.
     WKBundlePageDidClearWindowObjectForFrameCallback                    didClearWindowObjectForFrame;
     WKBundlePageDidCancelClientRedirectForFrameCallback                 didCancelClientRedirectForFrame;
     WKBundlePageWillPerformClientRedirectForFrameCallback               willPerformClientRedirectForFrame;
     WKBundlePageDidHandleOnloadEventsForFrameCallback                   didHandleOnloadEventsForFrame;
+    WKBundlePageDidLayoutForFrameCallback                               didLayoutForFrame;
 };
 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
 
@@ -189,10 +188,10 @@ typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *
 typedef void (*WKBundlePagePaintCustomOverhangAreaCallback)(WKBundlePageRef page, WKGraphicsContextRef graphicsContext, WKRect horizontalOverhang, WKRect verticalOverhang, WKRect dirtyRect, const void* clientInfo);
 typedef WKStringRef (*WKBundlePageGenerateFileForUploadCallback)(WKBundlePageRef page, WKStringRef originalFilePath, const void* clientInfo);
 typedef bool (*WKBundlePageShouldRubberBandInDirectionCallback)(WKBundlePageRef page, WKScrollDirection scrollDirection, const void* clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisible)(WKBundlePageRef page, const void *clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisible)(WKBundlePageRef page, const void *clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisible)(WKBundlePageRef page, const void *clientInfo);
-    
+typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+
 struct WKBundlePageUIClient {
     int                                                                 version;
     const void *                                                        clientInfo;
@@ -207,9 +206,9 @@ struct WKBundlePageUIClient {
     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
     WKBundlePageShouldRubberBandInDirectionCallback                     shouldRubberBandInDirection;
-    WKBundlePageStatusBarIsVisible                                      statusBarIsVisible;
-    WKBundlePageMenuBarIsVisible                                        menuBarIsVisible;
-    WKBundlePageToolbarsAreVisible                                      toolbarsAreVisible;
+    WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
+    WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
+    WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
 };
 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
 
index 5e902d9..23bd018 100644 (file)
@@ -53,6 +53,8 @@ WK_EXPORT void WKBundlePageSimulateMouseDown(WKBundlePageRef page, int button, W
 WK_EXPORT void WKBundlePageSimulateMouseUp(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time);
 WK_EXPORT void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, double time);
 
+WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
+
 #ifdef __cplusplus
 }
 #endif
index 58a20cf..be25d43 100644 (file)
@@ -126,56 +126,65 @@ void InjectedBundlePageLoaderClient::didReceiveTitleForFrame(WebPage* page, cons
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy(WebPage* page , WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didFirstLayoutForFrame)
+    if (!m_client.didRemoveFrameFromHierarchy)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
+    if (!m_client.didDisplayInsecureContentForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy(WebPage* page , WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didRemoveFrameFromHierarchy)
+    if (!m_client.didRunInsecureContentForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didDisplayInsecureContentForFrame)
+    if (!m_client.didFirstLayoutForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didRunInsecureContentForFrame)
+    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
+
+void InjectedBundlePageLoaderClient::didLayoutForFrame(WebPage* page, WebFrame* frame)
+{
+    if (!m_client.didLayoutForFrame)
+        return;
+
+    m_client.didLayoutForFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
+}
+
 void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
 {
     if (!m_client.didClearWindowObjectForFrame)
index 88cb824..75898a6 100644 (file)
@@ -56,12 +56,14 @@ public:
     void didFailLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData);
     void didSameDocumentNavigationForFrame(WebPage*, WebFrame*, SameDocumentNavigationType, RefPtr<APIObject>& userData);
     void didReceiveTitleForFrame(WebPage*, const String&, WebFrame*, RefPtr<APIObject>& userData);
-    void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
-    void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRemoveFrameFromHierarchy(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
 
+    void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
+    void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
+    void didLayoutForFrame(WebPage*, WebFrame*);
+
     void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
     void didCancelClientRedirectForFrame(WebPage*, WebFrame*);
     void willPerformClientRedirectForFrame(WebPage*, WebFrame*, const String& url, double delay, double date);
index 90f2f96..c9cbcd0 100644 (file)
@@ -815,9 +815,4 @@ void WebChromeClient::numWheelEventHandlersChanged(unsigned count)
     m_page->send(Messages::WebPageProxy::NumWheelEventHandlersChanged(count));
 }
 
-void WebChromeClient::setRenderTreeSize(size_t treeSize)
-{
-    m_page->send(Messages::WebPageProxy::SetRenderTreeSize(treeSize));
-}
-
 } // namespace WebKit
index 2b67f74..73a122f 100644 (file)
@@ -230,8 +230,6 @@ private:
     
     virtual void numWheelEventHandlersChanged(unsigned);
 
-    virtual void setRenderTreeSize(size_t);
-
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;
index 5b4e582..a53bcbf 100644 (file)
@@ -555,6 +555,23 @@ void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
     webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
 }
 
+void WebFrameLoaderClient::dispatchDidLayout()
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    // Notify the bundle client.
+    webPage->injectedBundleLoaderClient().didLayoutForFrame(webPage, m_frame);
+
+    // NOTE: Unlike the other layout notifications, this does not notify the
+    // the UIProcess for every call.
+
+    // FIXME: Remove at the soonest possible time.
+    if (m_frame == m_frame->page()->mainFrame())
+        webPage->send(Messages::WebPageProxy::SetRenderTreeSize(webPage->renderTreeSize()));
+}
+
 Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction)
 {
     WebPage* webPage = m_frame->page();
index 972ff27..eb5703e 100644 (file)
@@ -91,9 +91,11 @@ private:
     virtual void dispatchDidFailLoad(const WebCore::ResourceError&);
     virtual void dispatchDidFinishDocumentLoad();
     virtual void dispatchDidFinishLoad();
+
     virtual void dispatchDidFirstLayout();
     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
-    
+    virtual void dispatchDidLayout();
+
     virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
     virtual void dispatchShow();
     
index b0f57e3..631cef7 100644 (file)
@@ -92,6 +92,7 @@
 #include <WebCore/Page.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/PrintContext.h>
+#include <WebCore/RenderArena.h>
 #include <WebCore/RenderLayer.h>
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/RenderView.h>
@@ -362,6 +363,22 @@ String WebPage::renderTreeExternalRepresentation() const
     return externalRepresentation(m_mainFrame->coreFrame(), RenderAsTextBehaviorNormal);
 }
 
+uint64_t WebPage::renderTreeSize() const
+{
+    if (!m_page)
+        return 0;
+
+    Frame* mainFrame = m_page->mainFrame();
+    if (!mainFrame)
+        return 0;
+
+    uint64_t size = 0;
+    for (Frame* coreFrame = mainFrame; coreFrame; coreFrame = coreFrame->tree()->traverseNext())
+        size += coreFrame->document()->renderArena()->totalRenderArenaSize();
+
+    return size;
+}
+
 void WebPage::executeEditingCommand(const String& commandName, const String& argument)
 {
     Frame* frame = m_page->focusController()->focusedOrMainFrame();
index 2678678..e74937d 100644 (file)
@@ -222,6 +222,8 @@ public:
     EditorState editorState() const;
 
     String renderTreeExternalRepresentation() const;
+    uint64_t renderTreeSize() const;
+
     void executeEditingCommand(const String& commandName, const String& argument);
     bool isEditingCommandEnabled(const String& commandName);
     void clearMainFrameName();
index 681cea2..2ae7059 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-07  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        Add stub for didLayoutForFrame.
+
 2011-06-07  Dirk Pranke  <dpranke@chromium.org>
 
         Reviewed by Tony Chang.
index 8bcddc9..6fcfe7c 100644 (file)
@@ -178,15 +178,16 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
         didFailLoadWithErrorForFrame,
         didSameDocumentNavigationForFrame,
         didReceiveTitleForFrame,
-        0,
-        0,
-        0,
+        0, // didFirstLayoutForFrame
+        0, // didFirstVisuallyNonEmptyLayoutForFrame
+        0, // didRemoveFrameFromHierarchy
         didDisplayInsecureContentForFrame,
         didRunInsecureContentForFrame,
         didClearWindowForFrame,
         didCancelClientRedirectForFrame,
         willPerformClientRedirectForFrame,
         didHandleOnloadEventsForFrame,
+        0, // didLayoutForFrame
     };
     WKBundlePageSetPageLoaderClient(m_page, &loaderClient);