Skip to content
  • bdakin@apple.com's avatar
    https://bugs.webkit.org/show_bug.cgi?id=95397 · 0b27e9af
    bdakin@apple.com authored
    Need to merge didFirstVisuallyNonEmptyLayout and 
    didNewFirstVisuallyNonEmptyLayout
    -and corresponding-
    <rdar://problem/10791680>
    
    Reviewed by Sam Weinig.
    
    Source/WebCore: 
    
    This patch merges didFirstLayout, didFirstVisuallyNonEmptyLayout, 
    and didNewFirstVisuallyNonEmptyLayout. Page keeps track of which 
    layout milestones we are interested in with a bit mask, so that 
    different ports/clients can opt-into different milestones. This 
    will allow us to safely add more layout milestones in the future 
    if that seems worthwhile.
    
    Include new file LayoutMilestoneOptions.h
    * GNUmakefile.list.am:
    * Target.pri:
    * WebCore.exp.in:
    * WebCore.gypi:
    * WebCore.xcodeproj/project.pbxproj:
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
    by dispatchDidLayout(LayoutMilestoneOptions)
    * loader/EmptyClients.h:
    (WebCore::EmptyFrameLoaderClient::dispatchDidLayout):
    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::didLayout):
    * loader/FrameLoader.h:
    (FrameLoader):
    * loader/FrameLoaderClient.h:
    (FrameLoaderClient):
    (WebCore::FrameLoaderClient::dispatchDidLayout):
    * page/LayoutMilestoneOptions.h: Added.
    (WebCore):
    
    Check with Page to find out which layout milestones the client is 
    interested in, and then dispatch the notifications when 
    appropriate.
    * page/FrameView.cpp:
    (WebCore::FrameView::performPostLayoutTasks):
    
    Remove setRelevantRepaintedObjectsCounterThreshold(). Instead keep 
    track of the layout milestones bit mask.
    * page/Page.cpp:
    (WebCore::Page::Page):
    (WebCore::Page::addLayoutMilestones):
    (WebCore):
    (WebCore::Page::isCountingRelevantRepaintedObjects):
    (WebCore::Page::addRelevantRepaintedObject):
    * page/Page.h:
    (Page):
    (WebCore::Page::layoutMilestones):
    
    Source/WebKit/blackberry: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
    (WebCore::FrameLoaderClientBlackBerry::dispatchDidLayout):
    * WebCoreSupport/FrameLoaderClientBlackBerry.h:
    (FrameLoaderClientBlackBerry):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * Api/WebPage.cpp:
    (BlackBerry::WebKit::WebPagePrivate::init):
    
    Source/WebKit/chromium: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * src/FrameLoaderClientImpl.cpp:
    (WebKit::FrameLoaderClientImpl::dispatchDidLayout):
    * src/FrameLoaderClientImpl.h:
    (FrameLoaderClientImpl):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * src/WebHelperPluginImpl.cpp:
    (WebKit::WebHelperPluginImpl::initPage):
    * src/WebPagePopupImpl.cpp:
    (WebKit::WebPagePopupImpl::initPage):
    * src/WebViewImpl.cpp:
    (WebKit::WebViewImpl::WebViewImpl):
    
    Source/WebKit/efl: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * WebCoreSupport/FrameLoaderClientEfl.cpp:
    (WebCore::FrameLoaderClientEfl::dispatchDidLayout):
    * WebCoreSupport/FrameLoaderClientEfl.h:
    (FrameLoaderClientEfl):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * ewk/ewk_view.cpp:
    (_ewk_view_priv_new):
    
    Source/WebKit/gtk: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * WebCoreSupport/FrameLoaderClientGtk.cpp:
    (WebKit::FrameLoaderClient::dispatchDidLayout):
    * WebCoreSupport/FrameLoaderClientGtk.h:
    (FrameLoaderClient):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * webkit/webkitwebview.cpp:
    (webkit_web_view_init):
    
    Source/WebKit/mac: 
    
    The new API has two parts. First, the client has to opt into which 
    layout milestones they are interested in hearing about using 
    [WebView _layoutMilestones]. Then, WebKit will call 
    the WebFrameLoader delegate's didLayout(WebLayoutMilestones) 
    callback when the specified layout milestones have fired. 
    didLayout takes the WebLayoutMilestones bit mask, which will 
    indicate which milestones have fired since it is possible for two 
    to fire at the same time.
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
    by dispatchDidLayout(LayoutMilestones)
    * WebCoreSupport/WebFrameLoaderClient.h:
    (WebFrameLoaderClient):
    * WebCoreSupport/WebFrameLoaderClient.mm:
    (WebFrameLoaderClient::dispatchDidLayout):
    
    Add new function to the delegate for didLayout.
    * WebView/WebDelegateImplementationCaching.h:
    (WebFrameLoadDelegateImplementationCache):
    
    We need a delegate template that takes an NSUInteger.
    * WebView/WebDelegateImplementationCaching.mm:
    (CallDelegate):
    (CallFrameLoadDelegate):
    
    Convert between WebCore and WebKit versions of the bit mask.
    * WebView/WebView.mm:
    (coreLayoutMilestones):
    (kitLayoutMilestones):
    
    Add new delegate, and set the appropriate layout milestones in 
    WebCore based on old delegates having implementations.
    (-[WebView _cacheFrameLoadDelegateImplementations]):
    
    Call into WebCore.
    (-[WebView _listenForLayoutMilestones:]):
    (-[WebView _layoutMilestones]):
    * WebView/WebViewInternal.h:
    * WebView/WebViewPrivate.h:
    
    Source/WebKit/qt: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * WebCoreSupport/FrameLoaderClientQt.cpp:
    (WebCore::FrameLoaderClientQt::dispatchDidLayout):
    * WebCoreSupport/FrameLoaderClientQt.h:
    (FrameLoaderClientQt):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * Api/qwebpage.cpp:
    (QWebPagePrivate::QWebPagePrivate):
    
    Source/WebKit/win: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
    * WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebFrameLoaderClient::dispatchDidLayout):
    * WebCoreSupport/WebFrameLoaderClient.h:
    (WebFrameLoaderClient):
    
    It is now necessary to opt into getting any of the 
    "layout milestone" notifications.
    * WebView.cpp:
    (WebView::initWithFrame):
    
    Source/WebKit/wince: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestones)
    * WebCoreSupport/FrameLoaderClientWinCE.cpp:
    (WebKit::FrameLoaderClientWinCE::dispatchDidLayout):
    * WebCoreSupport/FrameLoaderClientWinCE.h:
    (FrameLoaderClientWinCE):
    
    Source/WebKit/wx: 
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
    is now replaced by dispatchDidLayout(LayoutMilestones)
    * WebKitSupport/FrameLoaderClientWx.cpp:
    (WebCore::FrameLoaderClientWx::dispatchDidLayout):
    * WebKitSupport/FrameLoaderClientWx.h:
    (FrameLoaderClientWx):
    
    Source/WebKit2: 
    
    The new API has two parts. First, the client has to opt into which 
    layout milestones they are interested in hearing about using 
    WKPageListenForLayoutMilestones or 
    WKBundlePageListenForLayoutMilestones(). Then, WebKit will call 
    the didLayout(WKLayoutMilestones) callback on the appropriate 
    clients when the specified layout milestones have fired. didLayout 
    takes the WKLayoutMilestones bit mask, which will indicate which 
    milestones have fired since it is possible for two to fire at the 
    same time.
    
    Define WKLayoutMilestoneOptions.
    * Shared/API/c/WKPageLoadTypes.h:
    
    Define conversions between WKLayoutMilestoneOptions and 
    WebCore::LayoutMilestoneOptions
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toWKLayoutMilestoneOptions):
    (WebKit):
    (WebKit::toLayoutMilestoneOptions):
    
    New API.
    * UIProcess/API/C/WKPage.cpp:
    (WKPageListenForLayoutMilestones):
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebLoaderClient.cpp:
    (WebKit::WebLoaderClient::didLayout):
    (WebKit):
    * UIProcess/WebLoaderClient.h:
    (WebLoaderClient):
    
    didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, 
    and didNewFirstVisuallyNonEmptyLayout are now implemented with 
    didLayout under the hood. So if those old callbacks have been 
    defined, be sure to add the appropriate layout milestones here for 
    backwards-compatibility.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::initializeLoaderClient):
    
    New API.
    (WebKit::WebPageProxy::listenForLayoutMilestones):
    (WebKit):
    (WebKit::WebPageProxy::didLayout):
    * UIProcess/WebPageProxy.h:
    (WebPageProxy):
    * UIProcess/WebPageProxy.messages.in:
    
    New API. And remove the now-unnecessary 
    WKBundlePageSetPaintedObjectsCounterThreshold. 
    * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
    (WKBundlePageListenForLayoutMilestones):
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
    
    New API.
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
    (WebKit::InjectedBundlePageLoaderClient::didNewFirstVisuallyNonEmptyLayout):
    (WebKit):
    (WebKit::InjectedBundlePageLoaderClient::didLayout):
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
    (InjectedBundlePageLoaderClient):
    
    Remove dispatchDidFirstLayout, 
    dispatchDidFirstVisuallyNonEmptyLayout, and 
    dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
    by dispatchDidLayout(LayoutMilestoneOptions)
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchDidLayout):
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
    (WebFrameLoaderClient):
    
    didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, 
    and didNewFirstVisuallyNonEmptyLayout are now implemented with 
    didLayout under the hood. So if those old callbacks have been 
    defined, be sure to add the appropriate layout milestones here for 
    backwards-compatibility.
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::initializeInjectedBundleLoaderClient):
    (WebKit):
    
    Call into WebCore to set the layout milestones.
    (WebKit::WebPage::listenForLayoutMilestones):
    * WebProcess/WebPage/WebPage.h:
    (WebPage):
    * WebProcess/WebPage/WebPage.messages.in:
    
    Account for the new member of PageLoadClient.
    * WebProcess/qt/QtBuiltinBundlePage.cpp:
    (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage):
    
    Tools: 
    
    Account for the new member of the PageLoadClient.
    * MiniBrowser/mac/BrowserWindowController.m:
    (-[BrowserWindowController awakeFromNib]):
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::InjectedBundlePage::InjectedBundlePage):
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::initialize):
    
    The NewFirstVisuallyNonEmptyLayoutForImages has existed for a while, 
    but it did not have the right target membership.
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    
    Use new didLayout API instead of old 
    didNewFirstVisuallyNonEmptyLayout API.
    * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp:
    (TestWebKitAPI):
    (TestWebKitAPI::didLayout):
    (TestWebKitAPI::setPageLoaderClient):
    (TestWebKitAPI::TEST):
    * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp:
    (TestWebKitAPI):
    (TestWebKitAPI::didLayout):
    (TestWebKitAPI::setPageLoaderClient):
    (TestWebKitAPI::TEST):
    * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp:
    (TestWebKitAPI):
    (TestWebKitAPI::didLayout):
    (TestWebKitAPI::setPageLoaderClient):
    (TestWebKitAPI::TEST):
    * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp:
    (TestWebKitAPI):
    (TestWebKitAPI::didLayout):
    (TestWebKitAPI::setPageLoaderClient):
    (TestWebKitAPI::TEST):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    0b27e9af