Commit 0b27e9af authored by bdakin@apple.com's avatar bdakin@apple.com

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):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 925e301b
2012-09-25 Beth Dakin <bdakin@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=95397
Need to merge didFirstVisuallyNonEmptyLayout and
didNewFirstVisuallyNonEmptyLayout
-and corresponding-
<rdar://problem/10791680>
Reviewed by Sam Weinig.
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):
2012-09-25 Andreas Kling <kling@webkit.org>
StylePropertySet: Use subclasses to manage varying object layouts.
......@@ -3992,6 +3992,7 @@ webcore_sources += \
Source/WebCore/page/GroupSettings.h \
Source/WebCore/page/History.cpp \
Source/WebCore/page/History.h \
Source/WebCore/page/LayoutMilestones.h \
Source/WebCore/page/Location.cpp \
Source/WebCore/page/Location.h \
Source/WebCore/page/MediaCanStartListener.h \
......
......@@ -1994,6 +1994,7 @@ HEADERS += \
page/GestureTapHighlighter.h\
page/GroupSettings.h \
page/History.h \
page/LayoutMilestones.h \
page/Location.h \
page/MouseEventWithHitTestResults.h \
page/NavigatorBase.h \
......
......@@ -677,6 +677,7 @@ __ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17willMoveOffscreenEv
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
__ZN7WebCore4Page19addLayoutMilestonesEj
__ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
__ZN7WebCore4Page20setDeviceScaleFactorEf
__ZN7WebCore4Page20unmarkAllTextMatchesEv
......@@ -693,7 +694,6 @@ __ZN7WebCore4Page35resumeActiveDOMObjectsAndAnimationsEv
__ZN7WebCore4Page36setShouldSuppressScrollbarAnimationsEb
__ZN7WebCore4Page36suspendActiveDOMObjectsAndAnimationsEv
__ZN7WebCore4Page37setInLowQualityImageInterpolationModeEb
__ZN7WebCore4Page43setRelevantRepaintedObjectsCounterThresholdEy
__ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
......
......@@ -3127,6 +3127,7 @@
'page/GroupSettings.cpp',
'page/History.cpp',
'page/History.h',
'page/LayoutMilestones.h',
'page/Location.cpp',
'page/Location.h',
'page/MemoryInfo.cpp',
......
......@@ -3152,6 +3152,7 @@
93153BE214195A5700FCF5BE /* missingImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE114195A5700FCF5BE /* missingImage.png */; };
93153BE414195B2A00FCF5BE /* inputSpeech.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE314195B2900FCF5BE /* inputSpeech.png */; };
931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
931D72F615FE695300C4C07E /* LayoutMilestones.h in Headers */ = {isa = PBXBuildFile; fileRef = 931D72F515FE695300C4C07E /* LayoutMilestones.h */; settings = {ATTRIBUTES = (Private, ); }; };
9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AC09D14EE6000E61D7 /* CharsetData.cpp */; };
9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */; };
932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 932871BF0B20DEB70049035A /* PlatformMenuDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -10341,6 +10342,7 @@
93153BE114195A5700FCF5BE /* missingImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = missingImage.png; sourceTree = "<group>"; };
93153BE314195B2900FCF5BE /* inputSpeech.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = inputSpeech.png; sourceTree = "<group>"; };
931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCanStartListener.h; sourceTree = "<group>"; };
931D72F515FE695300C4C07E /* LayoutMilestones.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutMilestones.h; sourceTree = "<group>"; };
9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLOptionsCollection.cpp; sourceTree = "<group>"; };
932871BF0B20DEB70049035A /* PlatformMenuDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlatformMenuDescription.h; sourceTree = "<group>"; };
932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = "<group>"; };
......@@ -15836,6 +15838,7 @@
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
BC94D1520C275C8B006BC617 /* History.idl */,
931D72F515FE695300C4C07E /* LayoutMilestones.h */,
BCE1C41A0D982980003B02F2 /* Location.cpp */,
BCE1C4190D982980003B02F2 /* Location.h */,
BCE1C4220D9829F2003B02F2 /* Location.idl */,
......@@ -25570,6 +25573,7 @@
FD537353137B651800008DCE /* ZeroPole.h in Headers */,
FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */,
4F7B4A6615FF6D6A006B5F22 /* PlatformMemoryInstrumentation.h in Headers */,
931D72F615FE695300C4C07E /* LayoutMilestones.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -260,9 +260,7 @@ public:
virtual void dispatchDidFailLoad(const ResourceError&) { }
virtual void dispatchDidFinishDocumentLoad() { }
virtual void dispatchDidFinishLoad() { }
virtual void dispatchDidFirstLayout() { }
virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }
virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
virtual void dispatchDidLayout(LayoutMilestones) { }
virtual Frame* dispatchCreatePage(const NavigationAction&) { return 0; }
virtual void dispatchShow() { }
......
......@@ -2285,25 +2285,17 @@ void FrameLoader::setOriginalURLForDownloadRequest(ResourceRequest& request)
}
}
void FrameLoader::didFirstLayout()
void FrameLoader::didLayout(LayoutMilestones milestones)
{
if (m_frame->page() && isBackForwardLoadType(m_loadType))
history()->restoreScrollPositionAndViewState();
if (milestones & DidFirstLayout) {
if (m_frame->page() && isBackForwardLoadType(m_loadType))
history()->restoreScrollPositionAndViewState();
if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone())
m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone);
m_client->dispatchDidFirstLayout();
}
void FrameLoader::didFirstVisuallyNonEmptyLayout()
{
m_client->dispatchDidFirstVisuallyNonEmptyLayout();
}
if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone())
m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone);
}
void FrameLoader::didNewFirstVisuallyNonEmptyLayout()
{
m_client->dispatchDidNewFirstVisuallyNonEmptyLayout();
m_client->dispatchDidLayout(milestones);
}
void FrameLoader::frameLoadCompleted()
......
......@@ -38,6 +38,7 @@
#include "HistoryController.h"
#include "IconController.h"
#include "IconURL.h"
#include "LayoutMilestones.h"
#include "PolicyChecker.h"
#include "ResourceHandle.h"
#include "ResourceLoadNotifier.h"
......@@ -174,12 +175,7 @@ public:
CachePolicy subresourceCachePolicy() const;
void didFirstLayout();
// FIXME: didFirstVisuallyNonEmptyLayout() and didNewFirstVisuallyNonEmptyLayout() should be merged.
// The only reason for both to exist is to experiment with different heuristics for the time being.
void didFirstVisuallyNonEmptyLayout();
void didNewFirstVisuallyNonEmptyLayout();
void didLayout(LayoutMilestones);
void loadedResourceFromMemoryCache(CachedResource*);
void tellClientAboutPastMemoryCacheLoads();
......
......@@ -32,6 +32,7 @@
#include "FrameLoaderTypes.h"
#include "IconURL.h"
#include "LayoutMilestones.h"
#include <wtf/Forward.h>
#include <wtf/Vector.h>
......@@ -162,10 +163,8 @@ namespace WebCore {
virtual void dispatchDidFinishDocumentLoad() = 0;
virtual void dispatchDidFinishLoad() = 0;
virtual void dispatchDidFirstLayout() = 0;
virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
virtual void dispatchDidNewFirstVisuallyNonEmptyLayout() { }
virtual void dispatchDidLayout() { }
virtual void dispatchDidLayout(LayoutMilestones) { }
virtual Frame* dispatchCreatePage(const NavigationAction&) = 0;
virtual void dispatchShow() = 0;
......
......@@ -2432,11 +2432,18 @@ void FrameView::performPostLayoutTasks()
m_frame->selection()->setCaretRectNeedsUpdate();
m_frame->selection()->updateAppearance();
LayoutMilestones milestonesOfInterest = 0;
LayoutMilestones milestonesAchieved = 0;
Page* page = m_frame->page();
if (page)
milestonesOfInterest = page->layoutMilestones();
if (m_nestedLayoutCount <= 1) {
if (m_firstLayoutCallbackPending) {
m_firstLayoutCallbackPending = false;
m_frame->loader()->didFirstLayout();
if (Page* page = m_frame->page()) {
if (milestonesOfInterest & DidFirstLayout)
milestonesAchieved |= DidFirstLayout;
if (page) {
if (page->mainFrame() == m_frame)
page->startCountingRelevantRepaintedObjects();
}
......@@ -2449,10 +2456,15 @@ void FrameView::performPostLayoutTasks()
// If the layout was done with pending sheets, we are not in fact visually non-empty yet.
if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
m_firstVisuallyNonEmptyLayoutCallbackPending = false;
m_frame->loader()->didFirstVisuallyNonEmptyLayout();
if (milestonesOfInterest & DidFirstVisuallyNonEmptyLayout)
milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
}
}
m_frame->loader()->didLayout(milestonesAchieved);
// FIXME: We should consider adding DidLayout as a LayoutMilestone. That would let us merge this
// with didLayout(LayoutMilestones).
m_frame->loader()->client()->dispatchDidLayout();
RenderView* root = rootRenderer(this);
......@@ -2464,7 +2476,7 @@ void FrameView::performPostLayoutTasks()
break;
}
if (Page* page = m_frame->page()) {
if (page) {
if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
scrollingCoordinator->frameViewLayoutUpdated(this);
}
......@@ -2493,7 +2505,7 @@ void FrameView::performPostLayoutTasks()
#if ENABLE(INSPECTOR)
if (InspectorInstrumentation::hasFrontends()) {
if (Page* page = m_frame->page()) {
if (page) {
if (page->mainFrame() == m_frame) {
if (InspectorClient* inspectorClient = page->inspectorController()->inspectorClient())
inspectorClient->didResizeMainFrame(m_frame.get());
......
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LayoutMilestones_h
#define LayoutMilestones_h
namespace WebCore {
enum LayoutMilestoneFlag {
DidFirstLayout = 1 << 0,
DidFirstVisuallyNonEmptyLayout = 1 << 1,
DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
};
typedef unsigned LayoutMilestones;
} // namespace WebCore
#endif // LayoutMilestones_h
......@@ -162,6 +162,7 @@ Page::Page(PageClients& pageClients)
, m_visibilityState(PageVisibilityStateVisible)
#endif
, m_displayID(0)
, m_layoutMilestones(0)
, m_isCountingRelevantRepaintedObjects(false)
#ifndef NDEBUG
, m_isPainting(false)
......@@ -1115,25 +1116,19 @@ PageVisibilityState Page::visibilityState() const
}
#endif
// FIXME: gPaintedObjectCounterThreshold is no longer used for calculating relevant repainted areas,
// and it should be removed. For the time being, it is useful because it allows us to avoid doing
// any of this work for ports that don't make sure of didNewFirstVisuallyNonEmptyLayout. We should
// remove this when we resolve <rdar://problem/10791680> Need to merge didFirstVisuallyNonEmptyLayout
// and didNewFirstVisuallyNonEmptyLayout
static uint64_t gPaintedObjectCounterThreshold = 0;
void Page::addLayoutMilestones(LayoutMilestones milestones)
{
// In the future, we may want a function that replaces m_layoutMilestones instead of just adding to it.
m_layoutMilestones |= milestones;
}
// These are magical constants that might be tweaked over time.
static double gMinimumPaintedAreaRatio = 0.1;
static double gMaximumUnpaintedAreaRatio = 0.04;
void Page::setRelevantRepaintedObjectsCounterThreshold(uint64_t threshold)
{
gPaintedObjectCounterThreshold = threshold;
}
bool Page::isCountingRelevantRepaintedObjects() const
{
return m_isCountingRelevantRepaintedObjects && gPaintedObjectCounterThreshold > 0;
return m_isCountingRelevantRepaintedObjects && (m_layoutMilestones & DidHitRelevantRepaintedObjectsAreaThreshold);
}
void Page::startCountingRelevantRepaintedObjects()
......@@ -1187,7 +1182,7 @@ void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& ob
m_isCountingRelevantRepaintedObjects = false;
resetRelevantPaintedObjectCounter();
if (Frame* frame = mainFrame())
frame->loader()->didNewFirstVisuallyNonEmptyLayout();
frame->loader()->didLayout(DidHitRelevantRepaintedObjectsAreaThreshold);
}
}
......
......@@ -24,6 +24,7 @@
#include "FeatureObserver.h"
#include "FrameLoaderTypes.h"
#include "FindOptions.h"
#include "LayoutMilestones.h"
#include "LayoutTypes.h"
#include "PageVisibilityState.h"
#include "Pagination.h"
......@@ -326,8 +327,10 @@ namespace WebCore {
PlatformDisplayID displayID() const { return m_displayID; }
void addLayoutMilestones(LayoutMilestones);
LayoutMilestones layoutMilestones() const { return m_layoutMilestones; }
bool isCountingRelevantRepaintedObjects() const;
void setRelevantRepaintedObjectsCounterThreshold(uint64_t);
void startCountingRelevantRepaintedObjects();
void resetRelevantPaintedObjectCounter();
void addRelevantRepaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
......@@ -447,6 +450,8 @@ namespace WebCore {
#endif
PlatformDisplayID m_displayID;
LayoutMilestones m_layoutMilestones;
HashSet<RenderObject*> m_relevantUnpaintedRenderObjects;
Region m_relevantPaintedRegion;
Region m_relevantUnpaintedRegion;
......
......@@ -556,6 +556,8 @@ void WebPagePrivate::init(const WebString& pageGroupName)
m_webSettings->setUserAgentString(defaultUserAgent());
m_page->setDeviceScaleFactor(m_webSettings->devicePixelRatio());
m_page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
#if USE(ACCELERATED_COMPOSITING)
m_tapHighlight = DefaultTapHighlight::create(this);
m_selectionOverlay = SelectionOverlay::create(this);
......
2012-09-25 Beth Dakin <bdakin@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=95397
Need to merge didFirstVisuallyNonEmptyLayout and
didNewFirstVisuallyNonEmptyLayout
-and corresponding-
<rdar://problem/10791680>
Reviewed by Sam Weinig.
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):
2012-09-25 Mike Fenton <mifenton@rim.com>
[BlackBerry] When zooming into an input field take the current zoom level into account.
......
......@@ -848,35 +848,37 @@ void FrameLoaderClientBlackBerry::postProgressEstimateChangedNotification()
m_webPagePrivate->m_client->notifyLoadProgress(m_frame->page()->progress()->estimatedProgress() * 100);
}
void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout()
void FrameLoaderClientBlackBerry::dispatchDidLayout(LayoutMilestones milestones)
{
if (!isMainFrame())
return;
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout");
readyToRender(true);
// For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
// dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page
// will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of
// the web page can be incorrect.
FrameLoadType frameLoadType = m_frame->loader()->loadType();
if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d;
m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below.
if (backingStorePrivate->renderVisibleContents()) {
if (!backingStorePrivate->shouldDirectRenderingToWindow())
backingStorePrivate->blitVisibleContents();
m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect());
if (milestones & DidFirstVisuallyNonEmptyLayout) {
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout");
readyToRender(true);
// For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call
// dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page
// will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of
// the web page can be incorrect.
FrameLoadType frameLoadType = m_frame->loader()->loadType();
if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))
m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true);
if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) {
BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d;
m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first.
backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below.
if (backingStorePrivate->renderVisibleContents()) {
if (!backingStorePrivate->shouldDirectRenderingToWindow())
backingStorePrivate->blitVisibleContents();
m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect());
}
}
}
m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout();
m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout();
}
}
void FrameLoaderClientBlackBerry::postProgressFinishedNotification()
......
......@@ -82,8 +82,7 @@ public:
virtual void dispatchDidFailLoad(const ResourceError&);
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout() { notImplemented(); }
virtual void dispatchDidFirstVisuallyNonEmptyLayout();
virtual void dispatchDidLayout(LayoutMilestones);
virtual Frame* dispatchCreatePage(const NavigationAction&);
virtual void dispatchShow() { notImplemented(); }
......
2012-09-25 Beth Dakin <bdakin@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=95397
Need to merge didFirstVisuallyNonEmptyLayout and
didNewFirstVisuallyNonEmptyLayout
-and corresponding-
<rdar://problem/10791680>
Reviewed by Sam Weinig.
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):
2012-09-25 Joshua Bell <jsbell@chromium.org>
IndexedDB: One transaction coordinator per database
......
......@@ -867,15 +867,14 @@ void FrameLoaderClientImpl::dispatchDidFinishLoad()
// provisional load succeeds or fails, not the "real" one.
}
void FrameLoaderClientImpl::dispatchDidFirstLayout()
void FrameLoaderClientImpl::dispatchDidLayout(LayoutMilestones milestones)
{
if (m_webFrame->client())
m_webFrame->client()->didFirstLayout(m_webFrame);
}
if (!m_webFrame->client())
return;
void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout()
{
if (m_webFrame->client())
if (milestones & DidFirstLayout)
m_webFrame->client()->didFirstLayout(m_webFrame);
if (milestones & DidFirstVisuallyNonEmptyLayout)
m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame);
}
......
......@@ -110,8 +110,7 @@ public:
virtual void dispatchDidFailLoad(const WebCore::ResourceError&);
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout();
virtual void dispatchDidFirstVisuallyNonEmptyLayout();
virtual void dispatchDidLayout(WebCore::LayoutMilestones);
virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
virtual void dispatchShow();
virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
......
......@@ -184,6 +184,9 @@ bool WebHelperPluginImpl::initPage(WebKit::WebViewImpl* webView, const String& p
m_page->settings()->setScriptEnabled(true);
m_page->settings()->setPluginsEnabled(true);
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
webView->client()->initializeHelperPluginWebFrame(this);
// The page's main frame was set in initializeFrame() as a result of the above call.
......
......@@ -182,6 +182,9 @@ bool WebPagePopupImpl::initPage()
m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor());
m_page->settings()->setDeviceSupportsTouch(m_webView->page()->settings()->deviceSupportsTouch());
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeaturesClient();
provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient);
static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient();
......
......@@ -483,6 +483,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
m_page->setGroupName(pageGroupName);
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
#if ENABLE(PAGE_VISIBILITY_API)
if (m_client)
setVisibilityState(m_client->visibilityState(), true);
......
2012-09-25 Beth Dakin <bdakin@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=95397
Need to merge didFirstVisuallyNonEmptyLayout and
didNewFirstVisuallyNonEmptyLayout
-and corresponding-
<rdar://problem/10791680>
Reviewed by Sam Weinig.
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):