Changeset 129545 in webkit


Ignore:
Timestamp:
Sep 25, 2012, 1:01:33 PM (13 years ago)
Author:
Beth Dakin
Message:

https://bugs.webkit.org/show_bug.cgi?id=95397
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):

Location:
trunk
Files:
1 added
87 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129543 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        This patch merges didFirstLayout, didFirstVisuallyNonEmptyLayout,
     12        and didNewFirstVisuallyNonEmptyLayout. Page keeps track of which
     13        layout milestones we are interested in with a bit mask, so that
     14        different ports/clients can opt-into different milestones. This
     15        will allow us to safely add more layout milestones in the future
     16        if that seems worthwhile.
     17
     18        Include new file LayoutMilestoneOptions.h
     19        * GNUmakefile.list.am:
     20        * Target.pri:
     21        * WebCore.exp.in:
     22        * WebCore.gypi:
     23        * WebCore.xcodeproj/project.pbxproj:
     24
     25        Remove dispatchDidFirstLayout,
     26        dispatchDidFirstVisuallyNonEmptyLayout, and
     27        dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced
     28        by dispatchDidLayout(LayoutMilestoneOptions)
     29        * loader/EmptyClients.h:
     30        (WebCore::EmptyFrameLoaderClient::dispatchDidLayout):
     31        * loader/FrameLoader.cpp:
     32        (WebCore::FrameLoader::didLayout):
     33        * loader/FrameLoader.h:
     34        (FrameLoader):
     35        * loader/FrameLoaderClient.h:
     36        (FrameLoaderClient):
     37        (WebCore::FrameLoaderClient::dispatchDidLayout):
     38        * page/LayoutMilestoneOptions.h: Added.
     39        (WebCore):
     40
     41        Check with Page to find out which layout milestones the client is
     42        interested in, and then dispatch the notifications when
     43        appropriate.
     44        * page/FrameView.cpp:
     45        (WebCore::FrameView::performPostLayoutTasks):
     46
     47        Remove setRelevantRepaintedObjectsCounterThreshold(). Instead keep
     48        track of the layout milestones bit mask.
     49        * page/Page.cpp:
     50        (WebCore::Page::Page):
     51        (WebCore::Page::addLayoutMilestones):
     52        (WebCore):
     53        (WebCore::Page::isCountingRelevantRepaintedObjects):
     54        (WebCore::Page::addRelevantRepaintedObject):
     55        * page/Page.h:
     56        (Page):
     57        (WebCore::Page::layoutMilestones):
     58
    1592012-09-25  Andreas Kling  <kling@webkit.org>
    260
  • trunk/Source/WebCore/GNUmakefile.list.am

    r129423 r129545  
    39933993        Source/WebCore/page/History.cpp \
    39943994        Source/WebCore/page/History.h \
     3995    Source/WebCore/page/LayoutMilestones.h \
    39953996        Source/WebCore/page/Location.cpp \
    39963997        Source/WebCore/page/Location.h \
  • trunk/Source/WebCore/Target.pri

    r129423 r129545  
    19951995    page/GroupSettings.h \
    19961996    page/History.h \
     1997    page/LayoutMilestones.h \
    19971998    page/Location.h \
    19981999    page/MouseEventWithHitTestResults.h \
  • trunk/Source/WebCore/WebCore.exp.in

    r129543 r129545  
    678678__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
    679679__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
     680__ZN7WebCore4Page19addLayoutMilestonesEj
    680681__ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
    681682__ZN7WebCore4Page20setDeviceScaleFactorEf
     
    694695__ZN7WebCore4Page36suspendActiveDOMObjectsAndAnimationsEv
    695696__ZN7WebCore4Page37setInLowQualityImageInterpolationModeEb
    696 __ZN7WebCore4Page43setRelevantRepaintedObjectsCounterThresholdEy
    697697__ZN7WebCore4Page6goBackEv
    698698__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
  • trunk/Source/WebCore/WebCore.gypi

    r129423 r129545  
    31283128            'page/History.cpp',
    31293129            'page/History.h',
     3130            'page/LayoutMilestones.h',
    31303131            'page/Location.cpp',
    31313132            'page/Location.h',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r129444 r129545  
    31533153                93153BE414195B2A00FCF5BE /* inputSpeech.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE314195B2900FCF5BE /* inputSpeech.png */; };
    31543154                931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3155                931D72F615FE695300C4C07E /* LayoutMilestones.h in Headers */ = {isa = PBXBuildFile; fileRef = 931D72F515FE695300C4C07E /* LayoutMilestones.h */; settings = {ATTRIBUTES = (Private, ); }; };
    31553156                9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AC09D14EE6000E61D7 /* CharsetData.cpp */; };
    31563157                9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */; };
     
    1034210343                93153BE314195B2900FCF5BE /* inputSpeech.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = inputSpeech.png; sourceTree = "<group>"; };
    1034310344                931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCanStartListener.h; sourceTree = "<group>"; };
     10345                931D72F515FE695300C4C07E /* LayoutMilestones.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutMilestones.h; sourceTree = "<group>"; };
    1034410346                9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLOptionsCollection.cpp; sourceTree = "<group>"; };
    1034510347                932871BF0B20DEB70049035A /* PlatformMenuDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlatformMenuDescription.h; sourceTree = "<group>"; };
     
    1583715839                                BC94D1510C275C8B006BC617 /* History.h */,
    1583815840                                BC94D1520C275C8B006BC617 /* History.idl */,
     15841                                931D72F515FE695300C4C07E /* LayoutMilestones.h */,
    1583915842                                BCE1C41A0D982980003B02F2 /* Location.cpp */,
    1584015843                                BCE1C4190D982980003B02F2 /* Location.h */,
     
    2557125574                                FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */,
    2557225575                                4F7B4A6615FF6D6A006B5F22 /* PlatformMemoryInstrumentation.h in Headers */,
     25576                                931D72F615FE695300C4C07E /* LayoutMilestones.h in Headers */,
    2557325577                        );
    2557425578                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/loader/EmptyClients.h

    r128572 r129545  
    261261    virtual void dispatchDidFinishDocumentLoad() { }
    262262    virtual void dispatchDidFinishLoad() { }
    263     virtual void dispatchDidFirstLayout() { }
    264     virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }
    265     virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
     263    virtual void dispatchDidLayout(LayoutMilestones) { }
    266264
    267265    virtual Frame* dispatchCreatePage(const NavigationAction&) { return 0; }
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r129462 r129545  
    22862286}
    22872287
    2288 void FrameLoader::didFirstLayout()
    2289 {
    2290     if (m_frame->page() && isBackForwardLoadType(m_loadType))
    2291         history()->restoreScrollPositionAndViewState();
    2292 
    2293     if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone())
    2294         m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone);
    2295 
    2296     m_client->dispatchDidFirstLayout();
    2297 }
    2298 
    2299 void FrameLoader::didFirstVisuallyNonEmptyLayout()
    2300 {
    2301     m_client->dispatchDidFirstVisuallyNonEmptyLayout();
    2302 }
    2303 
    2304 void FrameLoader::didNewFirstVisuallyNonEmptyLayout()
    2305 {
    2306     m_client->dispatchDidNewFirstVisuallyNonEmptyLayout();
     2288void FrameLoader::didLayout(LayoutMilestones milestones)
     2289{
     2290    if (milestones & DidFirstLayout) {
     2291        if (m_frame->page() && isBackForwardLoadType(m_loadType))
     2292            history()->restoreScrollPositionAndViewState();
     2293
     2294        if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone())
     2295            m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone);   
     2296    }
     2297
     2298    m_client->dispatchDidLayout(milestones);
    23072299}
    23082300
  • trunk/Source/WebCore/loader/FrameLoader.h

    r128418 r129545  
    3939#include "IconController.h"
    4040#include "IconURL.h"
     41#include "LayoutMilestones.h"
    4142#include "PolicyChecker.h"
    4243#include "ResourceHandle.h"
     
    175176    CachePolicy subresourceCachePolicy() const;
    176177
    177     void didFirstLayout();
    178 
    179     // FIXME: didFirstVisuallyNonEmptyLayout() and didNewFirstVisuallyNonEmptyLayout() should be merged.
    180     // The only reason for both to exist is to experiment with different heuristics for the time being.
    181     void didFirstVisuallyNonEmptyLayout();
    182     void didNewFirstVisuallyNonEmptyLayout();
     178    void didLayout(LayoutMilestones);
    183179
    184180    void loadedResourceFromMemoryCache(CachedResource*);
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r129020 r129545  
    3333#include "FrameLoaderTypes.h"
    3434#include "IconURL.h"
     35#include "LayoutMilestones.h"
    3536#include <wtf/Forward.h>
    3637#include <wtf/Vector.h>
     
    163164        virtual void dispatchDidFinishLoad() = 0;
    164165
    165         virtual void dispatchDidFirstLayout() = 0;
    166         virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
    167         virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
    168166        virtual void dispatchDidLayout() { }
     167        virtual void dispatchDidLayout(LayoutMilestones) { }
    169168
    170169        virtual Frame* dispatchCreatePage(const NavigationAction&) = 0;
  • trunk/Source/WebCore/page/FrameView.cpp

    r128570 r129545  
    24332433    m_frame->selection()->updateAppearance();
    24342434
     2435    LayoutMilestones milestonesOfInterest = 0;
     2436    LayoutMilestones milestonesAchieved = 0;
     2437    Page* page = m_frame->page();
     2438    if (page)
     2439        milestonesOfInterest = page->layoutMilestones();
     2440
    24352441    if (m_nestedLayoutCount <= 1) {
    24362442        if (m_firstLayoutCallbackPending) {
    24372443            m_firstLayoutCallbackPending = false;
    2438             m_frame->loader()->didFirstLayout();
    2439             if (Page* page = m_frame->page()) {
     2444            if (milestonesOfInterest & DidFirstLayout)
     2445                milestonesAchieved |= DidFirstLayout;
     2446            if (page) {
    24402447                if (page->mainFrame() == m_frame)
    24412448                    page->startCountingRelevantRepaintedObjects();
     
    24502457        if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
    24512458            m_firstVisuallyNonEmptyLayoutCallbackPending = false;
    2452             m_frame->loader()->didFirstVisuallyNonEmptyLayout();
    2453         }
    2454     }
    2455 
     2459            if (milestonesOfInterest & DidFirstVisuallyNonEmptyLayout)
     2460                milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
     2461        }
     2462    }
     2463
     2464    m_frame->loader()->didLayout(milestonesAchieved);
     2465   
     2466    // FIXME: We should consider adding DidLayout as a LayoutMilestone. That would let us merge this
     2467    // with didLayout(LayoutMilestones).
    24562468    m_frame->loader()->client()->dispatchDidLayout();
    24572469
     
    24652477    }
    24662478
    2467     if (Page* page = m_frame->page()) {
     2479    if (page) {
    24682480        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    24692481            scrollingCoordinator->frameViewLayoutUpdated(this);
     
    24942506#if ENABLE(INSPECTOR)
    24952507            if (InspectorInstrumentation::hasFrontends()) {
    2496                 if (Page* page = m_frame->page()) {
     2508                if (page) {
    24972509                    if (page->mainFrame() == m_frame) {
    24982510                        if (InspectorClient* inspectorClient = page->inspectorController()->inspectorClient())
  • trunk/Source/WebCore/page/Page.cpp

    r129423 r129545  
    163163#endif
    164164    , m_displayID(0)
     165    , m_layoutMilestones(0)
    165166    , m_isCountingRelevantRepaintedObjects(false)
    166167#ifndef NDEBUG
     
    11161117#endif
    11171118
    1118 // FIXME: gPaintedObjectCounterThreshold is no longer used for calculating relevant repainted areas,
    1119 // and it should be removed. For the time being, it is useful because it allows us to avoid doing
    1120 // any of this work for ports that don't make sure of didNewFirstVisuallyNonEmptyLayout. We should
    1121 // remove this when we resolve <rdar://problem/10791680> Need to merge didFirstVisuallyNonEmptyLayout
    1122 // and didNewFirstVisuallyNonEmptyLayout
    1123 static uint64_t gPaintedObjectCounterThreshold = 0;
     1119void Page::addLayoutMilestones(LayoutMilestones milestones)
     1120{
     1121    // In the future, we may want a function that replaces m_layoutMilestones instead of just adding to it.
     1122    m_layoutMilestones |= milestones;
     1123}
    11241124
    11251125// These are magical constants that might be tweaked over time.
     
    11271127static double gMaximumUnpaintedAreaRatio = 0.04;
    11281128
    1129 void Page::setRelevantRepaintedObjectsCounterThreshold(uint64_t threshold)
    1130 {
    1131     gPaintedObjectCounterThreshold = threshold;
    1132 }
    1133 
    11341129bool Page::isCountingRelevantRepaintedObjects() const
    11351130{
    1136     return m_isCountingRelevantRepaintedObjects && gPaintedObjectCounterThreshold > 0;
     1131    return m_isCountingRelevantRepaintedObjects && (m_layoutMilestones & DidHitRelevantRepaintedObjectsAreaThreshold);
    11371132}
    11381133
     
    11881183        resetRelevantPaintedObjectCounter();
    11891184        if (Frame* frame = mainFrame())
    1190             frame->loader()->didNewFirstVisuallyNonEmptyLayout();
     1185            frame->loader()->didLayout(DidHitRelevantRepaintedObjectsAreaThreshold);
    11911186    }
    11921187}
  • trunk/Source/WebCore/page/Page.h

    r128788 r129545  
    2525#include "FrameLoaderTypes.h"
    2626#include "FindOptions.h"
     27#include "LayoutMilestones.h"
    2728#include "LayoutTypes.h"
    2829#include "PageVisibilityState.h"
     
    327328        PlatformDisplayID displayID() const { return m_displayID; }
    328329
     330        void addLayoutMilestones(LayoutMilestones);
     331        LayoutMilestones layoutMilestones() const { return m_layoutMilestones; }
     332
    329333        bool isCountingRelevantRepaintedObjects() const;
    330         void setRelevantRepaintedObjectsCounterThreshold(uint64_t);
    331334        void startCountingRelevantRepaintedObjects();
    332335        void resetRelevantPaintedObjectCounter();
     
    447450#endif
    448451        PlatformDisplayID m_displayID;
     452
     453        LayoutMilestones m_layoutMilestones;
    449454
    450455        HashSet<RenderObject*> m_relevantUnpaintedRenderObjects;
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r129419 r129545  
    556556    m_webSettings->setUserAgentString(defaultUserAgent());
    557557    m_page->setDeviceScaleFactor(m_webSettings->devicePixelRatio());
     558
     559    m_page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
    558560
    559561#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebKit/blackberry/ChangeLog

    r129544 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     16        (WebCore::FrameLoaderClientBlackBerry::dispatchDidLayout):
     17        * WebCoreSupport/FrameLoaderClientBlackBerry.h:
     18        (FrameLoaderClientBlackBerry):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * Api/WebPage.cpp:
     23        (BlackBerry::WebKit::WebPagePrivate::init):
     24
    1252012-09-25  Mike Fenton  <mifenton@rim.com>
    226
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r129087 r129545  
    849849}
    850850
    851 void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout()
     851void FrameLoaderClientBlackBerry::dispatchDidLayout(LayoutMilestones milestones)
    852852{
    853853    if (!isMainFrame())
    854854        return;
    855855
    856     BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout");
    857 
    858     readyToRender(true);
    859 
    860     // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
    861     // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page
    862     // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of
    863     // the web page can be incorrect.
    864     FrameLoadType frameLoadType = m_frame->loader()->loadType();
    865     if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
    866         m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
    867 
    868     if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
    869         BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d;
    870         m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
    871         backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below.
    872         if (backingStorePrivate->renderVisibleContents()) {
    873             if (!backingStorePrivate->shouldDirectRenderingToWindow())
    874                 backingStorePrivate->blitVisibleContents();
    875             m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect());
     856    if (milestones & DidFirstVisuallyNonEmptyLayout) {
     857        BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout");
     858
     859        readyToRender(true);
     860
     861        // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
     862        // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page
     863        // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of
     864        // the web page can be incorrect.
     865        FrameLoadType frameLoadType = m_frame->loader()->loadType();
     866        if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
     867            m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
     868
     869        if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
     870            BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d;
     871            m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
     872            backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below.
     873            if (backingStorePrivate->renderVisibleContents()) {
     874                if (!backingStorePrivate->shouldDirectRenderingToWindow())
     875                    backingStorePrivate->blitVisibleContents();
     876                m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect());
     877            }
    876878        }
    877     }
    878 
    879     m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout();
     879
     880        m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout();
     881    }
    880882}
    881883
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h

    r129087 r129545  
    8383    virtual void dispatchDidFinishDocumentLoad();
    8484    virtual void dispatchDidFinishLoad();
    85     virtual void dispatchDidFirstLayout() { notImplemented(); }
    86     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     85    virtual void dispatchDidLayout(LayoutMilestones);
    8786    virtual Frame* dispatchCreatePage(const NavigationAction&);
    8887    virtual void dispatchShow() { notImplemented(); }
  • trunk/Source/WebKit/chromium/ChangeLog

    r129534 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * src/FrameLoaderClientImpl.cpp:
     16        (WebKit::FrameLoaderClientImpl::dispatchDidLayout):
     17        * src/FrameLoaderClientImpl.h:
     18        (FrameLoaderClientImpl):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * src/WebHelperPluginImpl.cpp:
     23        (WebKit::WebHelperPluginImpl::initPage):
     24        * src/WebPagePopupImpl.cpp:
     25        (WebKit::WebPagePopupImpl::initPage):
     26        * src/WebViewImpl.cpp:
     27        (WebKit::WebViewImpl::WebViewImpl):
     28
    1292012-09-25  Joshua Bell  <jsbell@chromium.org>
    230
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r129020 r129545  
    868868}
    869869
    870 void FrameLoaderClientImpl::dispatchDidFirstLayout()
    871 {
    872     if (m_webFrame->client())
     870void FrameLoaderClientImpl::dispatchDidLayout(LayoutMilestones milestones)
     871{
     872    if (!m_webFrame->client())
     873        return;
     874
     875    if (milestones & DidFirstLayout)
    873876        m_webFrame->client()->didFirstLayout(m_webFrame);
    874 }
    875 
    876 void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout()
    877 {
    878     if (m_webFrame->client())
     877    if (milestones & DidFirstVisuallyNonEmptyLayout)
    879878        m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame);
    880879}
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h

    r129020 r129545  
    111111    virtual void dispatchDidFinishDocumentLoad();
    112112    virtual void dispatchDidFinishLoad();
    113     virtual void dispatchDidFirstLayout();
    114     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     113    virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    115114    virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
    116115    virtual void dispatchShow();
  • trunk/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp

    r119988 r129545  
    185185    m_page->settings()->setPluginsEnabled(true);
    186186
     187    unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
     188    m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
     189
    187190    webView->client()->initializeHelperPluginWebFrame(this);
    188191
  • trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp

    r126940 r129545  
    183183    m_page->settings()->setDeviceSupportsTouch(m_webView->page()->settings()->deviceSupportsTouch());
    184184
     185    unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
     186    m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
     187
    185188    static ContextFeaturesClient* pagePopupFeaturesClient =  new PagePopupFeaturesClient();
    186189    provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient);
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r129511 r129545  
    484484    m_page->setGroupName(pageGroupName);
    485485
     486    unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
     487    m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
     488
    486489#if ENABLE(PAGE_VISIBILITY_API)
    487490    if (m_client)
  • trunk/Source/WebKit/efl/ChangeLog

    r129395 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * WebCoreSupport/FrameLoaderClientEfl.cpp:
     16        (WebCore::FrameLoaderClientEfl::dispatchDidLayout):
     17        * WebCoreSupport/FrameLoaderClientEfl.h:
     18        (FrameLoaderClientEfl):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * ewk/ewk_view.cpp:
     23        (_ewk_view_priv_new):
     24
    1252012-09-24  Dominik Röttsches  <dominik.rottsches@intel.com>
    226
  • trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r129319 r129545  
    679679}
    680680
    681 void FrameLoaderClientEfl::dispatchDidFirstLayout()
    682 {
    683     ewk_frame_load_firstlayout_finished(m_frame);
    684 }
    685 
    686 void FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout()
    687 {
    688     ewk_frame_load_firstlayout_nonempty_finished(m_frame);
     681void FrameLoaderClientEfl::dispatchDidLayout(LayoutMilestones milestones)
     682{
     683    if (milestones & DidFirstLayout)
     684        ewk_frame_load_firstlayout_finished(m_frame);
     685    if (milestones & DidFirstVisuallyNonEmptyLayout)
     686        ewk_frame_load_firstlayout_nonempty_finished(m_frame);
    689687}
    690688
  • trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h

    r127244 r129545  
    107107    virtual void dispatchDidFinishDocumentLoad();
    108108    virtual void dispatchDidFinishLoad();
    109     virtual void dispatchDidFirstLayout();
    110     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     109    virtual void dispatchDidLayout(LayoutMilestones);
    111110
    112111    virtual Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r129395 r129545  
    778778    priv->pageSettings = priv->page->settings();
    779779
     780    WebCore::LayoutMilestones layoutMilestones = WebCore::DidFirstLayout | WebCore::DidFirstVisuallyNonEmptyLayout;
     781    priv->page->addLayoutMilestones(layoutMilestones);
     782
    780783    priv->viewportArguments.width = WebCore::ViewportArguments::ValueAuto;
    781784    priv->viewportArguments.height = WebCore::ViewportArguments::ValueAuto;
  • trunk/Source/WebKit/gtk/ChangeLog

    r129537 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     16        (WebKit::FrameLoaderClient::dispatchDidLayout):
     17        * WebCoreSupport/FrameLoaderClientGtk.h:
     18        (FrameLoaderClient):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * webkit/webkitwebview.cpp:
     23        (webkit_web_view_init):
     24
    1252012-09-25  Paweł Forysiuk  <tuxator@o2.pl>
    226
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r125500 r129545  
    852852}
    853853
    854 void FrameLoaderClient::dispatchDidFirstLayout()
    855 {
    856     notImplemented();
    857 }
    858 
    859 void FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
     854void FrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
    860855{
    861856    if (m_loadingErrorPage)
    862857        return;
    863858
    864     notifyStatus(m_frame, WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT);
     859    if (milestones & DidFirstVisuallyNonEmptyLayout)
     860        notifyStatus(m_frame, WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT);
    865861}
    866862
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h

    r116121 r129545  
    9090        virtual void dispatchDidFinishDocumentLoad();
    9191        virtual void dispatchDidFinishLoad();
    92         virtual void dispatchDidFirstLayout();
    93         virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     92        virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    9493
    9594        virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r129000 r129545  
    36293629    priv->corePage = new Page(pageClients);
    36303630
     3631    priv->corePage->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
     3632
    36313633#if ENABLE(GEOLOCATION)
    36323634    if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
  • trunk/Source/WebKit/mac/ChangeLog

    r129444 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        The new API has two parts. First, the client has to opt into which
     12        layout milestones they are interested in hearing about using
     13        [WebView _layoutMilestones]. Then, WebKit will call
     14        the WebFrameLoader delegate's didLayout(WebLayoutMilestones)
     15        callback when the specified layout milestones have fired.
     16        didLayout takes the WebLayoutMilestones bit mask, which will
     17        indicate which milestones have fired since it is possible for two
     18        to fire at the same time.
     19
     20        Remove dispatchDidFirstLayout,
     21        dispatchDidFirstVisuallyNonEmptyLayout, and
     22        dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced
     23        by dispatchDidLayout(LayoutMilestones)
     24        * WebCoreSupport/WebFrameLoaderClient.h:
     25        (WebFrameLoaderClient):
     26        * WebCoreSupport/WebFrameLoaderClient.mm:
     27        (WebFrameLoaderClient::dispatchDidLayout):
     28
     29        Add new function to the delegate for didLayout.
     30        * WebView/WebDelegateImplementationCaching.h:
     31        (WebFrameLoadDelegateImplementationCache):
     32
     33        We need a delegate template that takes an NSUInteger.
     34        * WebView/WebDelegateImplementationCaching.mm:
     35        (CallDelegate):
     36        (CallFrameLoadDelegate):
     37
     38        Convert between WebCore and WebKit versions of the bit mask.
     39        * WebView/WebView.mm:
     40        (coreLayoutMilestones):
     41        (kitLayoutMilestones):
     42
     43        Add new delegate, and set the appropriate layout milestones in
     44        WebCore based on old delegates having implementations.
     45        (-[WebView _cacheFrameLoadDelegateImplementations]):
     46
     47        Call into WebCore.
     48        (-[WebView _listenForLayoutMilestones:]):
     49        (-[WebView _layoutMilestones]):
     50        * WebView/WebViewInternal.h:
     51        * WebView/WebViewPrivate.h:
     52
    1532012-09-24  Benjamin Poulain  <bpoulain@apple.com>
    254
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h

    r128129 r129545  
    109109    virtual void dispatchDidFinishDocumentLoad() OVERRIDE;
    110110    virtual void dispatchDidFinishLoad() OVERRIDE;
    111     virtual void dispatchDidFirstLayout() OVERRIDE;
    112     virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE;
     111    virtual void dispatchDidLayout(WebCore::LayoutMilestones) OVERRIDE;
    113112
    114113    virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r128403 r129545  
    663663}
    664664
    665 void WebFrameLoaderClient::dispatchDidFirstLayout()
     665void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
    666666{
    667667    WebView *webView = getWebView(m_webFrame.get());
    668668    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
    669     if (implementations->didFirstLayoutInFrameFunc)
    670         CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get());
    671    
    672     // See WebFrameLoaderClient::provisionalLoadStarted.
    673     WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
    674     if ([getWebView(m_webFrame.get()) drawsBackground])
    675         [scrollView setDrawsBackground:YES];
     669
     670    if (implementations->didLayoutFunc)
     671        CallFrameLoadDelegate(implementations->didLayoutFunc, webView, @selector(webView:didLayout:), kitLayoutMilestones(milestones));
     672
     673    if (milestones & DidFirstLayout) {
     674        // FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the
     675        // new didLayout API.
     676        if (implementations->didFirstLayoutInFrameFunc)
     677            CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get());
     678
     679        // See WebFrameLoaderClient::provisionalLoadStarted.
     680        WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
     681        if ([getWebView(m_webFrame.get()) drawsBackground])
     682            [scrollView setDrawsBackground:YES];
    676683#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    677     [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic];
    678     [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic];
     684        [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic];
     685        [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic];
    679686#endif
    680 }
    681 
    682 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
    683 {
    684     WebView *webView = getWebView(m_webFrame.get());
    685     WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
    686     if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc)
    687         CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get());
     687    }
     688
     689    if (milestones & DidFirstVisuallyNonEmptyLayout) {
     690        // FIXME: We should consider removing the old didFirstVisuallyNonEmptyLayoutForFrame API since this is doing
     691        // double duty with the new didLayout API.
     692        if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc)
     693            CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get());
     694    }
    688695}
    689696
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h

    r128129 r129545  
    7474    IMP didFirstLayoutInFrameFunc;
    7575    IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
     76    IMP didLayoutFunc;
    7677    IMP didReceiveIconForFrameFunc;
    7778    IMP didFinishDocumentLoadForFrameFunc;
     
    124125
    125126id CallFrameLoadDelegate(IMP, WebView *, SEL);
     127id CallFrameLoadDelegate(IMP, WebView *, SEL, NSUInteger);
    126128id CallFrameLoadDelegate(IMP, WebView *, SEL, id);
    127129id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id);
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm

    r128129 r129545  
    249249}
    250250
     251static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer)
     252{
     253    if (!delegate)
     254        return nil;
     255    @try {
     256        return implementation(delegate, selector, self, integer);
     257    } @catch(id exception) {
     258        ReportDiscardedDelegateException(selector, exception);
     259    }
     260    return nil;
     261}
     262
    251263static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object)
    252264{
     
    451463}
    452464
     465id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
     466{
     467    return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, integer);
     468}
     469
    453470id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object)
    454471{
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r129444 r129545  
    393393}
    394394
     395LayoutMilestones coreLayoutMilestones(WebLayoutMilestones milestones)
     396{
     397    return (milestones & WebDidFirstLayout ? DidFirstLayout : 0)
     398        | (milestones & WebDidFirstVisuallyNonEmptyLayout ? DidFirstVisuallyNonEmptyLayout : 0)
     399        | (milestones & WebDidHitRelevantRepaintedObjectsAreaThreshold ? DidHitRelevantRepaintedObjectsAreaThreshold : 0);
     400}
     401
     402WebLayoutMilestones kitLayoutMilestones(LayoutMilestones milestones)
     403{
     404    return (milestones & DidFirstLayout ? WebDidFirstLayout : 0)
     405        | (milestones & DidFirstVisuallyNonEmptyLayout ? WebDidFirstVisuallyNonEmptyLayout : 0)
     406        | (milestones & DidHitRelevantRepaintedObjectsAreaThreshold ? WebDidHitRelevantRepaintedObjectsAreaThreshold : 0);
     407}
     408
    395409@interface WebView (WebFileInternal)
    396410- (float)_deviceScaleFactor;
     
    16241638    cache->didFirstLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstLayoutInFrame:));
    16251639    cache->didFirstVisuallyNonEmptyLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:));
     1640    cache->didLayoutFunc = getMethod(delegate, @selector(webView:didLayout:));
    16261641    cache->didHandleOnloadEventsForFrameFunc = getMethod(delegate, @selector(webView:didHandleOnloadEventsForFrame:));
    16271642    cache->didReceiveIconForFrameFunc = getMethod(delegate, @selector(webView:didReceiveIcon:forFrame:));
     
    16351650    cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:));
    16361651    cache->didDetectXSSFunc = getMethod(delegate, @selector(webView:didDetectXSS:));
     1652
     1653    // It would be nice to get rid of this code and transition all clients to using didLayout instead of
     1654    // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required
     1655    // for backwards compatibility.
     1656    Page* page = core(self);
     1657    if (page) {
     1658        unsigned milestones = 0;
     1659        if (cache->didFirstLayoutInFrameFunc)
     1660            milestones |= DidFirstLayout;
     1661        if (cache->didFirstVisuallyNonEmptyLayoutInFrameFunc)
     1662            milestones |= DidFirstVisuallyNonEmptyLayout;
     1663        page->addLayoutMilestones(static_cast<LayoutMilestones>(milestones));
     1664    }
    16371665}
    16381666
     
    28622890    ASSERT_NOT_REACHED();
    28632891    return WebPaginationModeUnpaginated;
     2892}
     2893
     2894- (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones
     2895{
     2896    Page* page = core(self);
     2897    if (!page)
     2898        return;
     2899
     2900    page->addLayoutMilestones(coreLayoutMilestones(layoutMilestones));
     2901}
     2902
     2903- (WebLayoutMilestones)_layoutMilestones
     2904{
     2905    Page* page = core(self);
     2906    if (!page)
     2907        return 0;
     2908
     2909    return kitLayoutMilestones(page->layoutMilestones());
    28642910}
    28652911
  • trunk/Source/WebKit/mac/WebView/WebViewInternal.h

    r120357 r129545  
    3838#import <WebCore/FindOptions.h>
    3939#import <WebCore/FloatRect.h>
     40#import <WebCore/LayoutMilestones.h>
    4041#import <WebCore/TextAlternativeWithRange.h>
    4142#import <WebCore/WebCoreKeyboardUIMode.h>
     
    6566
    6667WebCore::FindOptions coreOptions(WebFindOptions options);
     68
     69WebCore::LayoutMilestones coreLayoutMilestones(WebLayoutMilestones);
     70WebLayoutMilestones kitLayoutMilestones(WebCore::LayoutMilestones);
    6771
    6872#if USE(DICTATION_ALTERNATIVES)
  • trunk/Source/WebKit/mac/WebView/WebViewPrivate.h

    r129444 r129545  
    109109} WebPaginationMode;
    110110
     111enum {
     112    WebDidFirstLayout = 1 << 0,
     113    WebDidFirstVisuallyNonEmptyLayout = 1 << 1,
     114    WebDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
     115};
     116typedef NSUInteger WebLayoutMilestones;
     117
    111118// This needs to be in sync with WebCore::NotificationClient::Permission
    112119typedef enum {
     
    566573- (void)_setPaginationMode:(WebPaginationMode)paginationMode;
    567574- (WebPaginationMode)_paginationMode;
     575
     576- (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones;
     577- (WebLayoutMilestones)_layoutMilestones;
    568578
    569579// Whether the column-break-{before,after} properties are respected instead of the
     
    760770- (void)webView:(WebView *)sender didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;
    761771
     772- (void)webView:(WebView *)sender didLayout:(WebLayoutMilestones)milestones;
     773
    762774// For implementing the WebInspector's test harness
    763775- (void)webView:(WebView *)webView didClearInspectorWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame;
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r128472 r129545  
    358358    // as expected out of the box, we use a default group similar to what other ports are doing.
    359359    page->setGroupName("Default Group");
     360
     361    page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
    360362
    361363    settings = new QWebSettings(page->settings());
  • trunk/Source/WebKit/qt/ChangeLog

    r129506 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * WebCoreSupport/FrameLoaderClientQt.cpp:
     16        (WebCore::FrameLoaderClientQt::dispatchDidLayout):
     17        * WebCoreSupport/FrameLoaderClientQt.h:
     18        (FrameLoaderClientQt):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * Api/qwebpage.cpp:
     23        (QWebPagePrivate::QWebPagePrivate):
     24
    1252012-09-25  Simon Hausmann  <simon.hausmann@digia.com>
    226
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r128403 r129545  
    528528}
    529529
    530 
    531 void FrameLoaderClientQt::dispatchDidFirstLayout()
    532 {
    533 }
    534 
    535 void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout()
    536 {
    537     if (m_webFrame)
     530void FrameLoaderClientQt::dispatchDidLayout(LayoutMilestones milestones)
     531{
     532    if (!m_webFrame)
     533        return;
     534
     535    if (milestones & DidFirstVisuallyNonEmptyLayout)
    538536        emit m_webFrame->initialLayoutCompleted();
    539537}
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h

    r125603 r129545  
    124124    virtual void dispatchDidFinishDocumentLoad();
    125125    virtual void dispatchDidFinishLoad();
    126     virtual void dispatchDidFirstLayout();
    127     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     126    virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    128127
    129128    virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  • trunk/Source/WebKit/win/ChangeLog

    r128988 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
     15        * WebCoreSupport/WebFrameLoaderClient.cpp:
     16        (WebFrameLoaderClient::dispatchDidLayout):
     17        * WebCoreSupport/WebFrameLoaderClient.h:
     18        (WebFrameLoaderClient):
     19
     20        It is now necessary to opt into getting any of the
     21        "layout milestone" notifications.
     22        * WebView.cpp:
     23        (WebView::initWithFrame):
     24
    1252012-09-19  Patrick Gansterer  <paroga@webkit.org>
    226
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r125500 r129545  
    417417}
    418418
    419 void WebFrameLoaderClient::dispatchDidFirstLayout()
    420 {
    421     WebView* webView = m_webFrame->webView();
    422     COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
    423     if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) && frameLoadDelegatePriv)
    424         frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame);
    425 }
    426 
    427 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
     419void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
    428420{
    429421    WebView* webView = m_webFrame->webView();
    430422    COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePrivate;
    431     if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate)
    432         frameLoadDelegatePrivate->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame);
     423
     424    if (milestones & DidFirstLayout) {
     425        if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate)
     426            frameLoadDelegatePrivate->didFirstLayoutInFrame(webView, m_webFrame);
     427    }
     428
     429    if (milestones & DidFirstVisuallyNonEmptyLayout) {
     430        if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate)
     431            frameLoadDelegatePrivate->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame);
     432    }
    433433}
    434434
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h

    r112474 r129545  
    7575    virtual void dispatchDidFinishDocumentLoad();
    7676    virtual void dispatchDidFinishLoad();
    77     virtual void dispatchDidFirstLayout();
    78     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     77    virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    7978
    8079    virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  • trunk/Source/WebKit/win/WebView.cpp

    r128988 r129545  
    26922692    provideGeolocationTo(m_page, new WebGeolocationClient(this));
    26932693
     2694    unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
     2695    m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
     2696
    26942697    BString localStoragePath;
    26952698    if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath)))
  • trunk/Source/WebKit/wince/ChangeLog

    r126926 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestones)
     15        * WebCoreSupport/FrameLoaderClientWinCE.cpp:
     16        (WebKit::FrameLoaderClientWinCE::dispatchDidLayout):
     17        * WebCoreSupport/FrameLoaderClientWinCE.h:
     18        (FrameLoaderClientWinCE):
     19
    1202012-08-28  Sheriff Bot  <webkit.review.bot@gmail.com>
    221
  • trunk/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp

    r125500 r129545  
    377377}
    378378
    379 void FrameLoaderClientWinCE::dispatchDidFirstLayout()
    380 {
    381     notImplemented();
    382 }
    383 
    384 void FrameLoaderClientWinCE::dispatchDidFirstVisuallyNonEmptyLayout()
     379void FrameLoaderClientWinCE::dispatchDidLayout(LayoutMilestones)
    385380{
    386381    notImplemented();
  • trunk/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h

    r115926 r129545  
    8484    virtual void dispatchDidFinishDocumentLoad();
    8585    virtual void dispatchDidFinishLoad();
    86     virtual void dispatchDidFirstLayout();
    87     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     86    virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    8887
    8988    virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  • trunk/Source/WebKit/wx/ChangeLog

    r128403 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Remove dispatchDidFirstLayout,
     12        dispatchDidFirstVisuallyNonEmptyLayout, and
     13        dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality
     14        is now replaced by dispatchDidLayout(LayoutMilestones)
     15        * WebKitSupport/FrameLoaderClientWx.cpp:
     16        (WebCore::FrameLoaderClientWx::dispatchDidLayout):
     17        * WebKitSupport/FrameLoaderClientWx.h:
     18        (FrameLoaderClientWx):
     19
    1202012-09-12  Sheriff Bot  <webkit.review.bot@gmail.com>
    221
  • trunk/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

    r127757 r129545  
    355355}
    356356
    357 
    358 void FrameLoaderClientWx::dispatchDidFirstLayout()
    359 {
    360     notImplemented();
    361 }
    362 
    363 void FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout()
     357void FrameLoaderClientWx::dispatchDidLayout(LayoutMilestones)
    364358{
    365359    notImplemented();
  • trunk/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h

    r116121 r129545  
    115115        virtual void dispatchDidFinishDocumentLoad();
    116116        virtual void dispatchDidFinishLoad();
    117         virtual void dispatchDidFirstLayout();
    118         virtual void dispatchDidFirstVisuallyNonEmptyLayout();
     117        virtual void dispatchDidLayout(WebCore::LayoutMilestones);
    119118        virtual void dispatchDidChangeIcons(WebCore::IconType);
    120119
  • trunk/Source/WebKit2/ChangeLog

    r129541 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        The new API has two parts. First, the client has to opt into which
     12        layout milestones they are interested in hearing about using
     13        WKPageListenForLayoutMilestones or
     14        WKBundlePageListenForLayoutMilestones(). Then, WebKit will call
     15        the didLayout(WKLayoutMilestones) callback on the appropriate
     16        clients when the specified layout milestones have fired. didLayout
     17        takes the WKLayoutMilestones bit mask, which will indicate which
     18        milestones have fired since it is possible for two to fire at the
     19        same time.
     20
     21        Define WKLayoutMilestoneOptions.
     22        * Shared/API/c/WKPageLoadTypes.h:
     23
     24        Define conversions between WKLayoutMilestoneOptions and
     25        WebCore::LayoutMilestoneOptions
     26        * Shared/API/c/WKSharedAPICast.h:
     27        (WebKit::toWKLayoutMilestoneOptions):
     28        (WebKit):
     29        (WebKit::toLayoutMilestoneOptions):
     30
     31        New API.
     32        * UIProcess/API/C/WKPage.cpp:
     33        (WKPageListenForLayoutMilestones):
     34        * UIProcess/API/C/WKPage.h:
     35        * UIProcess/WebLoaderClient.cpp:
     36        (WebKit::WebLoaderClient::didLayout):
     37        (WebKit):
     38        * UIProcess/WebLoaderClient.h:
     39        (WebLoaderClient):
     40
     41        didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame,
     42        and didNewFirstVisuallyNonEmptyLayout are now implemented with
     43        didLayout under the hood. So if those old callbacks have been
     44        defined, be sure to add the appropriate layout milestones here for
     45        backwards-compatibility.
     46        * UIProcess/WebPageProxy.cpp:
     47        (WebKit::WebPageProxy::initializeLoaderClient):
     48
     49        New API.
     50        (WebKit::WebPageProxy::listenForLayoutMilestones):
     51        (WebKit):
     52        (WebKit::WebPageProxy::didLayout):
     53        * UIProcess/WebPageProxy.h:
     54        (WebPageProxy):
     55        * UIProcess/WebPageProxy.messages.in:
     56
     57        New API. And remove the now-unnecessary
     58        WKBundlePageSetPaintedObjectsCounterThreshold.
     59        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     60        (WKBundlePageListenForLayoutMilestones):
     61        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     62        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
     63
     64        New API.
     65        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
     66        (WebKit::InjectedBundlePageLoaderClient::didNewFirstVisuallyNonEmptyLayout):
     67        (WebKit):
     68        (WebKit::InjectedBundlePageLoaderClient::didLayout):
     69        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
     70        (InjectedBundlePageLoaderClient):
     71
     72        Remove dispatchDidFirstLayout,
     73        dispatchDidFirstVisuallyNonEmptyLayout, and
     74        dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced
     75        by dispatchDidLayout(LayoutMilestoneOptions)
     76        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     77        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
     78        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     79        (WebFrameLoaderClient):
     80
     81        didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame,
     82        and didNewFirstVisuallyNonEmptyLayout are now implemented with
     83        didLayout under the hood. So if those old callbacks have been
     84        defined, be sure to add the appropriate layout milestones here for
     85        backwards-compatibility.
     86        * WebProcess/WebPage/WebPage.cpp:
     87        (WebKit::WebPage::initializeInjectedBundleLoaderClient):
     88        (WebKit):
     89
     90        Call into WebCore to set the layout milestones.
     91        (WebKit::WebPage::listenForLayoutMilestones):
     92        * WebProcess/WebPage/WebPage.h:
     93        (WebPage):
     94        * WebProcess/WebPage/WebPage.messages.in:
     95
     96        Account for the new member of PageLoadClient.
     97        * WebProcess/qt/QtBuiltinBundlePage.cpp:
     98        (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage):
     99
    11002012-09-25  Carlos Garcia Campos  <cgarcia@igalia.com>
    2101
  • trunk/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h

    r95901 r129545  
    4949typedef uint32_t WKSameDocumentNavigationType;
    5050
     51enum {
     52    kWKDidFirstLayout = 1 << 0,
     53    kWKDidFirstVisuallyNonEmptyLayout = 1 << 1,
     54    kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
     55};
     56typedef uint32_t WKLayoutMilestones;
     57
    5158#ifdef __cplusplus
    5259}
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r125700 r129545  
    4848#include <WebCore/FrameLoaderTypes.h>
    4949#include <WebCore/IntRect.h>
     50#include <WebCore/LayoutMilestones.h>
    5051#include <wtf/TypeTraits.h>
    5152
     
    749750}
    750751
     752inline WKLayoutMilestones toWKLayoutMilestones(WebCore::LayoutMilestones milestones)
     753{
     754    unsigned wkMilestones = 0;
     755
     756    if (milestones & WebCore::DidFirstLayout)
     757        wkMilestones |= kWKDidFirstLayout;
     758    if (milestones & WebCore::DidFirstVisuallyNonEmptyLayout)
     759        wkMilestones |= kWKDidFirstVisuallyNonEmptyLayout;
     760    if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold)
     761        wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold;
     762   
     763    return wkMilestones;
     764}
     765
     766inline WebCore::LayoutMilestones toLayoutMilestones(WKLayoutMilestones wkMilestones)
     767{
     768    WebCore::LayoutMilestones milestones = 0;
     769
     770    if (wkMilestones & kWKDidFirstLayout)
     771        milestones |= WebCore::DidFirstLayout;
     772    if (wkMilestones & kWKDidFirstVisuallyNonEmptyLayout)
     773        milestones |= WebCore::DidFirstVisuallyNonEmptyLayout;
     774    if (wkMilestones & kWKDidHitRelevantRepaintedObjectsAreaThreshold)
     775        milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
     776   
     777    return milestones;
     778}
     779
    751780inline ImageOptions toImageOptions(WKImageOptions wkImageOptions)
    752781{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r129096 r129545  
    331331}
    332332
     333void WKPageListenForLayoutMilestones(WKPageRef pageRef, WKLayoutMilestones milestones)
     334{
     335    toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones));
     336}
     337
    333338bool WKPageHasHorizontalScrollbar(WKPageRef pageRef)
    334339{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.h

    r128553 r129545  
    7676typedef void (*WKPageDidReceiveIntentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent, WKTypeRef userData, const void *clientInfo);
    7777typedef void (*WKPageRegisterIntentServiceForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef userData, const void *clientInfo);
     78typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo);
    7879
    7980// Deprecated
     
    116117    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
    117118
    118     // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
     119    // FIXME: didNewFirstVisuallyNonEmptyLayout should be removed. We should consider removing didFirstVisuallyNonEmptyLayoutForFrame
     120    // as well. Their functionality is replaced by didLayout.
    119121    WKPageDidNewFirstVisuallyNonEmptyLayoutCallback                     didNewFirstVisuallyNonEmptyLayout;
    120122
     
    127129    WKPageDidReceiveIntentForFrameCallback                              didReceiveIntentForFrame;
    128130    WKPageRegisterIntentServiceForFrameCallback                         registerIntentServiceForFrame;
     131
     132    WKPageDidLayoutCallback                                             didLayout;
    129133};
    130134typedef struct WKPageLoaderClient WKPageLoaderClient;
     
    426430WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page);
    427431
     432WK_EXPORT void WKPageListenForLayoutMilestones(WKPageRef page, WKLayoutMilestones milestones);
     433
    428434WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page);
    429435WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
  • trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp

    r123374 r129545  
    137137}
    138138
     139void WebLoaderClient::didLayout(WebPageProxy* page, LayoutMilestones milestones, APIObject* userData)
     140{
     141    if (!m_client.didLayout)
     142        return;
     143
     144    m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), toAPI(userData), m_client.clientInfo);
     145}
     146
    139147void WebLoaderClient::didRemoveFrameFromHierarchy(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
    140148{
  • trunk/Source/WebKit2/UIProcess/WebLoaderClient.h

    r123374 r129545  
    3030#include "SameDocumentNavigationType.h"
    3131#include "WKPage.h"
     32#include <WebCore/LayoutMilestones.h>
    3233#include <wtf/Forward.h>
    3334#include <wtf/RefPtr.h>
     
    8182#endif
    8283
    83     // FIXME: didFirstVisuallyNonEmptyLayoutForFrame and didNewFirstVisuallyNonEmptyLayout should be merged.
    84     // The only reason for both to exist is to experiment with different heuristics for the time being.
     84    // FIXME: didNewFirstVisuallyNonEmptyLayout should be removed. We should consider removing didFirstVisuallyNonEmptyLayoutForFrame
     85    // as well. They are both being replaced by didLayout.
    8586    void didNewFirstVisuallyNonEmptyLayout(WebPageProxy*, APIObject*);
     87    void didLayout(WebPageProxy*, WebCore::LayoutMilestones, APIObject*);
    8688   
    8789    bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r129493 r129545  
    285285        return;
    286286
     287    // It would be nice to get rid of this code and transition all clients to using didLayout instead of
     288    // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required
     289    // for backwards compatibility.
     290    WebCore::LayoutMilestones milestones = 0;
     291    if (loadClient->didFirstLayoutForFrame)
     292        milestones |= WebCore::DidFirstLayout;
     293    if (loadClient->didFirstVisuallyNonEmptyLayoutForFrame)
     294        milestones |= WebCore::DidFirstVisuallyNonEmptyLayout;
     295    if (loadClient->didNewFirstVisuallyNonEmptyLayout)
     296        milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
     297
     298    if (milestones)
     299        m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID);
     300
    287301    m_process->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
    288302}
     
    15131527}
    15141528
     1529void WebPageProxy::listenForLayoutMilestones(WebCore::LayoutMilestones milestones)
     1530{
     1531    if (!isValid())
     1532        return;
     1533
     1534    m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID);
     1535}
     1536
    15151537void WebPageProxy::setSuppressScrollbarAnimations(bool suppressAnimations)
    15161538{
     
    21632185
    21642186    m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
     2187}
     2188
     2189void WebPageProxy::didLayout(uint32_t layoutMilestones, CoreIPC::ArgumentDecoder* arguments)
     2190{
     2191    RefPtr<APIObject> userData;
     2192    WebContextUserMessageDecoder messageDecoder(userData, m_process.get());
     2193    if (!arguments->decode(messageDecoder))
     2194        return;
     2195
     2196    m_loaderClient.didLayout(this, static_cast<LayoutMilestones>(layoutMilestones), userData.get());
    21652197}
    21662198
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r128907 r129545  
    485485    const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
    486486
     487    void listenForLayoutMilestones(WebCore::LayoutMilestones);
     488
    487489    bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
    488490    bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
     
    766768    void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
    767769    void didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder*);
     770    void didLayout(uint32_t layoutMilestones, CoreIPC::ArgumentDecoder*);
    768771    void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*);
    769772    void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r128907 r129545  
    128128    DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
    129129    DidNewFirstVisuallyNonEmptyLayout(WebKit::InjectedBundleUserMessageEncoder userData)
     130    DidLayout(uint32_t type, WebKit::InjectedBundleUserMessageEncoder userData)
    130131    DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
    131132    DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r129493 r129545  
    322322}
    323323
     324void WKBundlePageListenForLayoutMilestones(WKBundlePageRef pageRef, WKLayoutMilestones milestones)
     325{
     326    toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones));
     327}
     328
    324329void WKBundlePageDeliverIntentToFrame(WKBundlePageRef pageRef, WKBundleFrameRef frameRef, WKBundleIntentRef intentRef)
    325330{
     
    371376}
    372377
    373 void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold)
    374 {
    375     toImpl(page)->setPaintedObjectsCounterThreshold(threshold);
    376 }
    377 
    378378void WKBundlePageSetTracksRepaints(WKBundlePageRef pageRef, bool trackRepaints)
    379379{
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r128623 r129545  
    112112typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo);
    113113typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo);
     114typedef void (*WKBundlePageDidLayoutCallback)(WKBundlePageRef page, WKLayoutMilestones milestones, WKTypeRef* userData, const void *clientInfo);
    114115
    115116struct WKBundlePageLoaderClient {
     
    154155    WKBundlePageDidReceiveIntentForFrameCallback                            didReceiveIntentForFrame;
    155156    WKBundlePageRegisterIntentServiceForFrameCallback                       registerIntentServiceForFrame;
     157    WKBundlePageDidLayoutCallback                                           didLayout;
    156158};
    157159typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
     
    420422WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page);
    421423
     424WK_EXPORT void WKBundlePageListenForLayoutMilestones(WKBundlePageRef page, WKLayoutMilestones milestones);
     425
    422426WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRef intent);
    423427
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h

    r129479 r129545  
    5959WK_EXPORT WKRenderLayerRef WKBundlePageCopyRenderLayerTree(WKBundlePageRef page);
    6060
    61 // FIXME: This is temporary. Ultimately WebKit should choose the threshold itself.
    62 WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold);
    63 
    6461WK_EXPORT void WKBundlePageSetTracksRepaints(WKBundlePageRef page, bool trackRepaints);
    6562WK_EXPORT bool WKBundlePageIsTrackingRepaints(WKBundlePageRef page);
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp

    r128129 r129545  
    255255    m_client.didNewFirstVisuallyNonEmptyLayout(toAPI(page), &userDataToPass, m_client.clientInfo);
    256256    userData = adoptRef(toImpl(userDataToPass));
    257 }   
     257}
     258
     259void InjectedBundlePageLoaderClient::didLayout(WebPage* page, LayoutMilestones milestones, RefPtr<APIObject>& userData)
     260{
     261    if (!m_client.didLayout)
     262        return;
     263
     264    WKTypeRef userDataToPass = 0;
     265    m_client.didLayout(toAPI(page), toWKLayoutMilestones(milestones), &userDataToPass, m_client.clientInfo);
     266    userData = adoptRef(toImpl(userDataToPass));
     267}
    258268
    259269void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h

    r128129 r129545  
    3131#include "WKBundlePage.h"
    3232#include <JavaScriptCore/JSBase.h>
     33#include <WebCore/LayoutMilestones.h>
    3334#include <wtf/Forward.h>
    3435
     
    8384    void didLayoutForFrame(WebPage*, WebFrame*);
    8485    void didNewFirstVisuallyNonEmptyLayout(WebPage*, WTF::RefPtr<APIObject>& userData);
     86    void didLayout(WebPage*, WebCore::LayoutMilestones, RefPtr<APIObject>& userData);
    8587
    8688    void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r129096 r129545  
    545545}
    546546
    547 void WebFrameLoaderClient::dispatchDidFirstLayout()
    548 {
    549     WebPage* webPage = m_frame->page();
    550     if (!webPage)
    551         return;
    552 
    553     RefPtr<APIObject> userData;
    554 
    555     // Notify the bundle client.
    556     webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData);
    557 
    558     // Notify the UIProcess.
    559     webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
    560 
    561     if (m_frame == m_frame->page()->mainWebFrame() && !webPage->corePage()->settings()->suppressesIncrementalRendering())
    562         webPage->drawingArea()->setLayerTreeStateIsFrozen(false);
    563 
     547void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
     548{
     549    WebPage* webPage = m_frame->page();
     550    if (!webPage)
     551        return;
     552
     553    RefPtr<APIObject> userData;
     554
     555    webPage->injectedBundleLoaderClient().didLayout(webPage, milestones, userData);
     556    webPage->send(Messages::WebPageProxy::DidLayout(milestones, InjectedBundleUserMessageEncoder(userData.get())));
     557
     558    if (milestones & DidFirstLayout) {
     559        // FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the
     560        // new didLayout API.
     561        webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData);
     562        webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
     563
     564        if (m_frame == m_frame->page()->mainWebFrame()) {
     565            if (!webPage->corePage()->settings()->suppressesIncrementalRendering())
     566                webPage->drawingArea()->setLayerTreeStateIsFrozen(false);
     567        }
     568   
    564569#if USE(TILED_BACKING_STORE)
    565     // Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
    566     ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
     570        // Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
     571        ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
    567572#endif
    568 }
    569 
    570 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
    571 {
    572     WebPage* webPage = m_frame->page();
    573     if (!webPage)
    574         return;
    575 
    576     RefPtr<APIObject> userData;
    577 
    578     // Notify the bundle client.
    579     webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData);
    580 
    581     // Notify the UIProcess.
    582     webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
    583 }
    584 
    585 void WebFrameLoaderClient::dispatchDidNewFirstVisuallyNonEmptyLayout()
    586 {
    587     WebPage* webPage = m_frame->page();
    588     if (!webPage)
    589         return;
    590 
    591     RefPtr<APIObject> userData;
    592 
    593     // Notify the bundle client.
    594     webPage->injectedBundleLoaderClient().didNewFirstVisuallyNonEmptyLayout(webPage, userData);
    595    
    596     // Notify the UIProcess.
    597     webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get())));
     573    }
     574
     575    if (milestones & DidFirstVisuallyNonEmptyLayout) {
     576        // FIXME: We should consider removing the old didFirstVisuallyNonEmptyLayoutForFrame API since this is doing
     577        // double duty with the new didLayout API.
     578        webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData);
     579        webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
     580    }
     581
     582    if (milestones & DidHitRelevantRepaintedObjectsAreaThreshold) {
     583        // FIXME: This can go away when we remove didNewFirstVisuallyNonEmptyLayout.
     584        webPage->injectedBundleLoaderClient().didNewFirstVisuallyNonEmptyLayout(webPage, userData);
     585        webPage->send(Messages::WebPageProxy::DidNewFirstVisuallyNonEmptyLayout(InjectedBundleUserMessageEncoder(userData.get())));
     586    }
    598587}
    599588
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r128129 r129545  
    9898    virtual void dispatchDidFinishLoad() OVERRIDE;
    9999
    100     virtual void dispatchDidFirstLayout() OVERRIDE;
    101     virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE;
    102     virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() OVERRIDE;
     100    virtual void dispatchDidLayout(WebCore::LayoutMilestones) OVERRIDE;
    103101    virtual void dispatchDidLayout() OVERRIDE;
    104102
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r129514 r129545  
    397397void WebPage::initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient* client)
    398398{
     399    // It would be nice to get rid of this code and transition all clients to using didLayout instead of
     400    // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required
     401    // for backwards compatibility.
     402    LayoutMilestones milestones = 0;
     403    if (client) {
     404        if (client->didFirstLayoutForFrame)
     405            milestones |= WebCore::DidFirstLayout;
     406        if (client->didFirstVisuallyNonEmptyLayoutForFrame)
     407            milestones |= WebCore::DidFirstVisuallyNonEmptyLayout;
     408        if (client->didNewFirstVisuallyNonEmptyLayout)
     409            milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
     410    }
     411
     412    if (milestones)
     413        listenForLayoutMilestones(milestones);
     414
    399415    m_loaderClient.initialize(client);
    400416}
     
    561577}
    562578
    563 void WebPage::setPaintedObjectsCounterThreshold(uint64_t threshold)
    564 {
    565     if (!m_page)
    566         return;
    567     m_page->setRelevantRepaintedObjectsCounterThreshold(threshold);
    568 }
    569 
    570579void WebPage::setTracksRepaints(bool trackRepaints)
    571580{
     
    11221131    if (view->didFirstLayout())
    11231132        view->forceLayout();
     1133}
     1134
     1135void WebPage::listenForLayoutMilestones(uint32_t milestones)
     1136{
     1137    if (!m_page)
     1138        return;
     1139    m_page->addLayoutMilestones(static_cast<LayoutMilestones>(milestones));
    11241140}
    11251141
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r128907 r129545  
    284284    String renderTreeExternalRepresentation() const;
    285285    uint64_t renderTreeSize() const;
    286     void setPaintedObjectsCounterThreshold(uint64_t);
    287286
    288287    void setTracksRepaints(bool);
     
    309308    bool useFixedLayout() const { return m_useFixedLayout; }
    310309    void setFixedLayoutSize(const WebCore::IntSize&);
     310
     311    void listenForLayoutMilestones(uint32_t /* LayoutMilestones */);
    311312
    312313    void setSuppressScrollbarAnimations(bool);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r128907 r129545  
    140140    SetUseFixedLayout(bool fixed)
    141141    SetFixedLayoutSize(WebCore::IntSize size)
    142 
     142    ListenForLayoutMilestones(uint32_t milestones)
    143143    SetSuppressScrollbarAnimations(bool suppressAnimations)
    144144
  • trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp

    r128129 r129545  
    7979        0, // didReceiveIntentForFrame
    8080        0, // registerIntentServiceForFrame
     81        0, // didLayout
    8182    };
    8283    WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
  • trunk/Tools/ChangeLog

    r129536 r129545  
     12012-09-25  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=95397
     4        Need to merge didFirstVisuallyNonEmptyLayout and
     5        didNewFirstVisuallyNonEmptyLayout
     6        -and corresponding-
     7        <rdar://problem/10791680>
     8
     9        Reviewed by Sam Weinig.
     10
     11        Account for the new member of the PageLoadClient.
     12        * MiniBrowser/mac/BrowserWindowController.m:
     13        (-[BrowserWindowController awakeFromNib]):
     14        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     15        (WTR::InjectedBundlePage::InjectedBundlePage):
     16        * WebKitTestRunner/TestController.cpp:
     17        (WTR::TestController::initialize):
     18
     19        The NewFirstVisuallyNonEmptyLayoutForImages has existed for a while,
     20        but it did not have the right target membership.
     21        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     22
     23        Use new didLayout API instead of old
     24        didNewFirstVisuallyNonEmptyLayout API.
     25        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp:
     26        (TestWebKitAPI):
     27        (TestWebKitAPI::didLayout):
     28        (TestWebKitAPI::setPageLoaderClient):
     29        (TestWebKitAPI::TEST):
     30        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp:
     31        (TestWebKitAPI):
     32        (TestWebKitAPI::didLayout):
     33        (TestWebKitAPI::setPageLoaderClient):
     34        (TestWebKitAPI::TEST):
     35        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp:
     36        (TestWebKitAPI):
     37        (TestWebKitAPI::didLayout):
     38        (TestWebKitAPI::setPageLoaderClient):
     39        (TestWebKitAPI::TEST):
     40        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp:
     41        (TestWebKitAPI):
     42        (TestWebKitAPI::didLayout):
     43        (TestWebKitAPI::setPageLoaderClient):
     44        (TestWebKitAPI::TEST):
     45
    1462012-09-25  Benjamin Poulain  <bpoulain@apple.com>
    247
  • trunk/Tools/MiniBrowser/mac/BrowserWindowController.m

    r128553 r129545  
    636636        0, // didReceiveIntentForFrame
    637637        0, // registerIntentServiceForFrame
     638        0, // didLayout
    638639    };
    639640    WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r127001 r129545  
    7373                81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
    7474                930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
     75                9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */; };
    7576                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
    7677                939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; };
     
    986987                                BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */,
    987988                                265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */,
     989                                9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */,
    988990                        );
    989991                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp

    r116180 r129545  
    3131namespace TestWebKitAPI {
    3232
    33 static bool didNewFirstVisuallyNonEmptyLayoutSucceed;
     33static bool didFirstLayoutAchieved;
     34static bool didFirstVisuallyNonEmptyLayoutAchieved;
     35static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved;
     36static bool didUnlockAllLayoutMilestones;
    3437
    35 static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *)
     38static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *)
    3639{
    37     didNewFirstVisuallyNonEmptyLayoutSucceed = true;
     40    switch (type) {
     41    case kWKDidFirstLayout:
     42        didFirstLayoutAchieved = true;
     43        break;
     44    case kWKDidFirstVisuallyNonEmptyLayout:
     45        didFirstVisuallyNonEmptyLayoutAchieved = true;
     46        break;
     47    case kWKDidHitRelevantRepaintedObjectsAreaThreshold:
     48        didHitRelevantRepaintedObjectsAreaThresholdAchieved = true;
     49        break;
     50    default:
     51        break;
     52    }
     53   
     54    if (didFirstLayoutAchieved && didFirstVisuallyNonEmptyLayoutAchieved && didHitRelevantRepaintedObjectsAreaThresholdAchieved)
     55        didUnlockAllLayoutMilestones = true;
    3856}
    3957
     
    4361    memset(&loaderClient, 0, sizeof(loaderClient));
    4462    loaderClient.version = kWKPageLoaderClientCurrentVersion;
    45     loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout;
     63    loaderClient.didLayout = didLayout;
    4664
    4765    WKPageSetPageLoaderClient(page, &loaderClient);
    4866}
    4967
     68// FIXME: This test has been broken since http://trac.webkit.org/changeset/115752 It's failing because
     69// the frame load is completing before didLayout() manages to unlock the
     70// kWKDidHitRelevantRepaintedObjectsAreaThreshold achievement. We probably need to fix this by making
     71// this test have a long-running resource.
    5072TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayout)
    5173{
     
    5981    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-text", "html")).get());
    6082
    61     Util::run(&didNewFirstVisuallyNonEmptyLayoutSucceed);
    62     EXPECT_TRUE(didNewFirstVisuallyNonEmptyLayoutSucceed);
     83    Util::run(&didUnlockAllLayoutMilestones);
     84    EXPECT_TRUE(didUnlockAllLayoutMilestones);
    6385}
    6486
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp

    r109944 r129545  
    3333namespace TestWebKitAPI {
    3434
    35 static bool didNewFirstVisuallyNonEmptyLayoutSucceed;
     35static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved;
    3636static bool test1Done;
    3737static bool test2Done;
     
    4949}
    5050
    51 static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *)
     51static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *)
    5252{
    53     didNewFirstVisuallyNonEmptyLayoutSucceed = true;
     53    if (type == kWKDidHitRelevantRepaintedObjectsAreaThreshold)
     54        didHitRelevantRepaintedObjectsAreaThresholdAchieved = true;
    5455}
    5556
     
    6061    loaderClient.version = kWKPageLoaderClientCurrentVersion;
    6162    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
    62     loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout;
     63    loaderClient.didLayout = didLayout;
    6364
    6465    WKPageSetPageLoaderClient(page, &loaderClient);
     
    8182    // By the time the forced repaint has finished, the counter would have been hit
    8283    // if it was sized reasonably for the page.
    83     EXPECT_FALSE(didNewFirstVisuallyNonEmptyLayoutSucceed);
     84    EXPECT_FALSE(didHitRelevantRepaintedObjectsAreaThresholdAchieved);
    8485}
    8586
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp

    r109944 r129545  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Setting the painted objects counter is necessary at this time to opt into
    45         // the didNewFirstVisuallyNonEmptyLayout heuristic.
    46         WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
     44        WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold);
    4745    }
    4846   
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp

    r110218 r129545  
    3131namespace TestWebKitAPI {
    3232
    33 static bool didNewFirstVisuallyNonEmptyLayoutSucceed;
     33static bool didFirstLayoutAchieved;
     34static bool didFirstVisuallyNonEmptyLayoutAchieved;
     35static bool didHitRelevantRepaintedObjectsAreaThresholdAchieved;
     36static bool didUnlockAllLayoutMilestones;
    3437
    35 static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *)
     38static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *)
    3639{
    37     didNewFirstVisuallyNonEmptyLayoutSucceed = true;
     40    switch (type) {
     41    case kWKDidFirstLayout:
     42        didFirstLayoutAchieved = true;
     43        break;
     44    case kWKDidFirstVisuallyNonEmptyLayout:
     45        didFirstVisuallyNonEmptyLayoutAchieved = true;
     46        break;
     47    case kWKDidHitRelevantRepaintedObjectsAreaThreshold:
     48        didHitRelevantRepaintedObjectsAreaThresholdAchieved = true;
     49        break;
     50    default:
     51        break;
     52    }
     53   
     54    if (didFirstLayoutAchieved && didFirstVisuallyNonEmptyLayoutAchieved && didHitRelevantRepaintedObjectsAreaThresholdAchieved)
     55        didUnlockAllLayoutMilestones = true;
    3856}
    3957
     
    4361    memset(&loaderClient, 0, sizeof(loaderClient));
    4462    loaderClient.version = kWKPageLoaderClientCurrentVersion;
    45     loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout;
     63    loaderClient.didLayout = didLayout;
    4664
    4765    WKPageSetPageLoaderClient(page, &loaderClient);
    4866}
    4967
    50 TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutForImages)
     68// FIXME: This test has been broken since http://trac.webkit.org/changeset/115752 It's failing because
     69// the frame load is completing before didLayout() manages to unlock the
     70// kWKDidHitRelevantRepaintedObjectsAreaThreshold achievement. We probably need to fix this by making
     71// this test have a long-running resource.
     72TEST(WebKit2, DISABLED_NewFirstVisuallyNonEmptyLayoutForImages)
    5173{
    5274    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutForImagesTest"));
     
    5981    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-images", "html")).get());
    6082
    61     Util::run(&didNewFirstVisuallyNonEmptyLayoutSucceed);
    62     EXPECT_TRUE(didNewFirstVisuallyNonEmptyLayoutSucceed);
     83    Util::run(&didUnlockAllLayoutMilestones);
     84    EXPECT_TRUE(didUnlockAllLayoutMilestones);
    6385}
    6486
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp

    r110218 r129545  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Setting the painted objects counter is necessary at this time to opt into
    45         // the didNewFirstVisuallyNonEmptyLayout heuristic.
    46         WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
     44        WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold);
    4745    }
    4846   
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp

    r106725 r129545  
    3333namespace TestWebKitAPI {
    3434
    35 static bool didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce;
    36 static unsigned newVisuallyNonEmptyLayoutCounter;
     35static bool didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce;
     36static unsigned didHitRelevantRepaintedObjectsAreaThresholdCounter;
    3737static bool test1Done;
    3838static bool test2Done;
     
    5050}
    5151
    52 static void didNewFirstVisuallyNonEmptyLayout(WKPageRef, WKTypeRef, const void *)
     52static void didLayout(WKPageRef, WKLayoutMilestones type, WKTypeRef, const void *)
    5353{
    54     ++newVisuallyNonEmptyLayoutCounter;
    55     if (newVisuallyNonEmptyLayoutCounter > 1)
    56         didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce = true;
     54    if (type != kWKDidHitRelevantRepaintedObjectsAreaThreshold)
     55        return;
     56
     57    ++didHitRelevantRepaintedObjectsAreaThresholdCounter;
     58    if (didHitRelevantRepaintedObjectsAreaThresholdCounter > 1)
     59        didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce = true;
    5760}
    5861
     
    6366    loaderClient.version = kWKPageLoaderClientCurrentVersion;
    6467    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
    65     loaderClient.didNewFirstVisuallyNonEmptyLayout = didNewFirstVisuallyNonEmptyLayout;
     68    loaderClient.didLayout = didLayout;
    6669
    6770    WKPageSetPageLoaderClient(page, &loaderClient);
     
    7073TEST(WebKit2, NewFirstVisuallyNonEmptyLayoutFrames)
    7174{
    72     newVisuallyNonEmptyLayoutCounter = 0;
     75    didHitRelevantRepaintedObjectsAreaThresholdCounter = 0;
    7376    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("NewFirstVisuallyNonEmptyLayoutFramesTest"));
    7477
     
    8386    // By the time the forced repaint has finished, the counter would have been hit
    8487    // if it was sized reasonably for the page.
    85     EXPECT_FALSE(didNewFirstVisuallyNonEmptyLayoutFireMoreThanOnce);
     88    EXPECT_FALSE(didHitRelevantRepaintedObjectsAreaThresholdMoreThanOnce);
    8689}
    8790
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp

    r109944 r129545  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Setting the painted objects counter is necessary at this time to opt into
    45         // the didNewFirstVisuallyNonEmptyLayout heuristic.
    46         WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
     44        WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold);
    4745    }
    4846   
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp

    r109944 r129545  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Setting the painted objects counter is necessary at this time to opt into
    45         // the didNewFirstVisuallyNonEmptyLayout heuristic.
    46         WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
     44        WKBundlePageListenForLayoutMilestones(page, kWKDidFirstLayout | kWKDidFirstVisuallyNonEmptyLayout | kWKDidHitRelevantRepaintedObjectsAreaThreshold);
    4745    }
    4846   
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r129487 r129545  
    329329        0, // shouldForceUniversalAccessFromLocalURL
    330330        didReceiveIntentForFrame, // didReceiveIntentForFrame
    331         registerIntentServiceForFrame // registerIntentServiceForFrame
     331        registerIntentServiceForFrame, // registerIntentServiceForFrame
     332        0, // didLayout
    332333    };
    333334    WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r129536 r129545  
    443443        0, // didReceiveIntentForFrame
    444444        0, // registerIntentServiceForFrame
     445        0, // didLayout
    445446    };
    446447    WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
Note: See TracChangeset for help on using the changeset viewer.