Skip to content
Permalink
Browse files
WebCore:
2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Add new FrameLoaderClient method to indicate the first visually
        non-empty layout based on an heuristic.  Right now that heuristic
        is the first layout after an image, text or plugin has been added
        to the render tree, but I can imagine it becoming much smarter.

        * loader/EmptyClients.h:
        (WebCore::EmptyFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::didFirstVisuallyNonEmptyLayout):
        * loader/FrameLoader.h:
        * loader/FrameLoaderClient.h:
        * page/FrameView.cpp:
        (WebCore::FrameViewPrivate::reset):
        (WebCore::FrameView::layout):
        (WebCore::FrameView::performPostLayoutTasks):
        (WebCore::FrameView::setIsVisuallyNonEmpty):
        * page/FrameView.h:
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::RenderImage):
        * rendering/RenderPartObject.cpp:
        (WebCore::RenderPartObject::RenderPartObject):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::RenderText):

WebKit/gtk:

2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
        * WebCoreSupport/FrameLoaderClientGtk.h:

WebKit/mac:

2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Implement FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() by calling
        a new private frame load delegate method.

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
        * WebView/WebView.mm:
        (-[WebView _cacheFrameLoadDelegateImplementations]):
        * WebView/WebViewInternal.h:
        * WebView/WebViewPrivate.h:

WebKit/qt:

2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout):
        * WebCoreSupport/FrameLoaderClientQt.h:

WebKit/win:

2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Implement FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() by calling
        a new private frame load delegate method.

        * Interfaces/IWebFrameLoadDelegatePrivate.idl:
        * WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
        * WebCoreSupport/WebFrameLoaderClient.h:

WebKit/wx:

2008-12-18  Sam Weinig  <sam@webkit.org>

        Reviewed by John Sullivan.

        Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

        * WebKitSupport/FrameLoaderClientWx.cpp:
        (WebCore::FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout):
        * WebKitSupport/FrameLoaderClientWx.h:



Canonical link: https://commits.webkit.org/31588@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Dec 19, 2008
1 parent a5988cd commit 1569e40dea92cddbef0de4e2306e1c076e83bbfd
Showing 29 changed files with 176 additions and 2 deletions.
@@ -1,3 +1,31 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Add new FrameLoaderClient method to indicate the first visually
non-empty layout based on an heuristic. Right now that heuristic
is the first layout after an image, text or plugin has been added
to the render tree, but I can imagine it becoming much smarter.

* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didFirstVisuallyNonEmptyLayout):
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* page/FrameView.cpp:
(WebCore::FrameViewPrivate::reset):
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::setIsVisuallyNonEmpty):
* page/FrameView.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::RenderImage):
* rendering/RenderPartObject.cpp:
(WebCore::RenderPartObject::RenderPartObject):
* rendering/RenderText.cpp:
(WebCore::RenderText::RenderText):

2008-12-18 Darin Adler <darin@apple.com>

Reviewed by Sam Weinig.
@@ -184,6 +184,7 @@ class EmptyFrameLoaderClient : public FrameLoaderClient {
virtual void dispatchDidFinishDocumentLoad() { }
virtual void dispatchDidFinishLoad() { }
virtual void dispatchDidFirstLayout() { }
virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }

virtual Frame* dispatchCreatePage() { return 0; }
virtual void dispatchShow() { }
@@ -3272,6 +3272,11 @@ void FrameLoader::didFirstLayout()
m_client->dispatchDidFirstLayout();
}

void FrameLoader::didFirstVisuallyNonEmptyLayout()
{
m_client->dispatchDidFirstVisuallyNonEmptyLayout();
}

void FrameLoader::frameLoadCompleted()
{
m_client->frameLoadCompleted();
@@ -261,6 +261,8 @@ namespace WebCore {
void didFirstLayout();
bool firstLayoutDone() const;

void didFirstVisuallyNonEmptyLayout();

void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
void clientRedirected(const KURL&, double delay, double fireDate, bool lockHistory, bool isJavaScriptFormAction);
bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
@@ -113,6 +113,7 @@ namespace WebCore {
virtual void dispatchDidFinishDocumentLoad() = 0;
virtual void dispatchDidFinishLoad() = 0;
virtual void dispatchDidFirstLayout() = 0;
virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;

virtual Frame* dispatchCreatePage() = 0;
virtual void dispatchShow() = 0;
@@ -108,6 +108,8 @@ class FrameViewPrivate {
m_repaintRects.clear();
m_paintRestriction = PaintRestrictionNone;
m_isPainting = false;
m_isVisuallyNonEmpty = false;
m_firstVisuallyNonEmptyLayoutCallbackPending = true;
}

bool m_doFullRepaint;
@@ -160,6 +162,9 @@ class FrameViewPrivate {
RefPtr<Node> m_nodeToDraw;
PaintRestriction m_paintRestriction;
bool m_isPainting;

bool m_isVisuallyNonEmpty;
bool m_firstVisuallyNonEmptyLayoutCallbackPending;
};

FrameView::FrameView(Frame* frame)
@@ -543,7 +548,7 @@ void FrameView::layout(bool allowSubtree)
if (oldSize != m_size)
d->m_doFullRepaint = true;
}

RenderLayer* layer = root->enclosingLayer();

pauseScheduledEvents();
@@ -960,7 +965,12 @@ void FrameView::performPostLayoutTasks()
d->m_firstLayoutCallbackPending = false;
m_frame->loader()->didFirstLayout();
}


if (d->m_isVisuallyNonEmpty && d->m_firstVisuallyNonEmptyLayoutCallbackPending) {
d->m_firstVisuallyNonEmptyLayoutCallbackPending = false;
m_frame->loader()->didFirstVisuallyNonEmptyLayout();
}

RenderView* root = m_frame->contentRenderer();

root->updateWidgetPositions();
@@ -1269,4 +1279,9 @@ void FrameView::layoutIfNeededRecursive()
static_cast<FrameView*>(*current)->layoutIfNeededRecursive();
}

void FrameView::setIsVisuallyNonEmpty()
{
d->m_isVisuallyNonEmpty = true;
}

} // namespace WebCore
@@ -162,6 +162,8 @@ class FrameView : public ScrollView {

void layoutIfNeededRecursive();

void setIsVisuallyNonEmpty();

private:
void init();

@@ -28,6 +28,7 @@

#include "BitmapImage.h"
#include "Document.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
@@ -182,6 +183,8 @@ RenderImage::RenderImage(Node* node)
, m_cachedImage(0)
{
updateAltText();

view()->frameView()->setIsVisuallyNonEmpty();
}

RenderImage::~RenderImage()
@@ -37,6 +37,7 @@
#include "MIMETypeRegistry.h"
#include "Page.h"
#include "PluginData.h"
#include "RenderView.h"
#include "Text.h"

namespace WebCore {
@@ -49,6 +50,9 @@ RenderPartObject::RenderPartObject(HTMLFrameOwnerElement* element)
// init RenderObject attributes
setInline(true);
m_hasFallbackContent = false;

if (element->hasTagName(embedTag) || element->hasTagName(objectTag))
view()->frameView()->setIsVisuallyNonEmpty();
}

RenderPartObject::~RenderPartObject()
@@ -26,11 +26,13 @@
#include "RenderText.h"

#include "CharacterNames.h"
#include "FrameView.h"
#include "InlineTextBox.h"
#include "Range.h"
#include "RenderArena.h"
#include "RenderBlock.h"
#include "RenderLayer.h"
#include "RenderView.h"
#include "Text.h"
#include "TextBreakIterator.h"
#include "break_lines.h"
@@ -66,6 +68,8 @@ RenderText::RenderText(Node* node, PassRefPtr<StringImpl> str)
ASSERT(m_text);
setRenderText();
m_text = m_text->replace('\\', backslashAsCurrencySymbol());

view()->frameView()->setIsVisuallyNonEmpty();
}

#ifndef NDEBUG
@@ -1,3 +1,13 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
* WebCoreSupport/FrameLoaderClientGtk.h:

2008-12-13 Holger Hans Peter Freyther <zecke@selfish.org>

Reviewed by Cameron Zwarich.
@@ -542,6 +542,11 @@ void FrameLoaderClient::dispatchDidFirstLayout()
notImplemented();
}

void FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
{
notImplemented();
}

void FrameLoaderClient::dispatchShow()
{
WebKitWebView* webView = getViewFromFrame(m_frame);
@@ -85,6 +85,7 @@ namespace WebKit {
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout();
virtual void dispatchDidFirstVisuallyNonEmptyLayout();

virtual WebCore::Frame* dispatchCreatePage();
virtual void dispatchShow();
@@ -1,3 +1,18 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Implement FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() by calling
a new private frame load delegate method.

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
* WebView/WebView.mm:
(-[WebView _cacheFrameLoadDelegateImplementations]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

2008-12-16 Antti Koivisto <antti@apple.com>

Reviewed by John Sullivan.
@@ -100,6 +100,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout();
virtual void dispatchDidFirstVisuallyNonEmptyLayout();

virtual WebCore::Frame* dispatchCreatePage();
virtual void dispatchShow();
@@ -558,6 +558,14 @@ - (void)invalidate;
CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get());
}

void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
{
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didFirstLayoutInFrameFunc)
CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get());
}

Frame* WebFrameLoaderClient::dispatchCreatePage()
{
WebView *currentWebView = getWebView(m_webFrame.get());
@@ -1381,6 +1381,7 @@ - (void)_cacheFrameLoadDelegateImplementations
cache->didFinishDocumentLoadForFrameFunc = getMethod(delegate, @selector(webView:didFinishDocumentLoadForFrame:));
cache->didFinishLoadForFrameFunc = getMethod(delegate, @selector(webView:didFinishLoadForFrame:));
cache->didFirstLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstLayoutInFrame:));
cache->didFirstVisuallyNonEmptyLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:));
cache->didHandleOnloadEventsForFrameFunc = getMethod(delegate, @selector(webView:didHandleOnloadEventsForFrame:));
cache->didReceiveIconForFrameFunc = getMethod(delegate, @selector(webView:didReceiveIcon:forFrame:));
cache->didReceiveServerRedirectForProvisionalLoadForFrameFunc = getMethod(delegate, @selector(webView:didReceiveServerRedirectForProvisionalLoadForFrame:));
@@ -177,6 +177,7 @@ typedef struct _WebFrameLoadDelegateImplementationCache {
IMP didFailLoadWithErrorForFrameFunc;
IMP didFinishLoadForFrameFunc;
IMP didFirstLayoutInFrameFunc;
IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
IMP didReceiveIconForFrameFunc;
IMP didFinishDocumentLoadForFrameFunc;
} WebFrameLoadDelegateImplementationCache;
@@ -455,6 +455,8 @@ Could be worth adding to the API.
// Addresses 4192534. SPI for now.
- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;

- (void)webView:(WebView *)sender didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;

@end

@interface NSObject (WebResourceLoadDelegatePrivate)
@@ -1,3 +1,13 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout):
* WebCoreSupport/FrameLoaderClientQt.h:

2008-12-16 Simon Hausmann <hausmann@webkit.org>

Reviewed by Holger Freyther.
@@ -385,6 +385,10 @@ void FrameLoaderClientQt::dispatchDidFirstLayout()
emit m_webFrame->initialLayoutCompleted();
}

void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout()
{
notImplemented();
}

void FrameLoaderClientQt::dispatchShow()
{
@@ -113,6 +113,7 @@ namespace WebCore {
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout();
virtual void dispatchDidFirstVisuallyNonEmptyLayout();

virtual WebCore::Frame* dispatchCreatePage();
virtual void dispatchShow();
@@ -1,3 +1,15 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Implement FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() by calling
a new private frame load delegate method.

* Interfaces/IWebFrameLoadDelegatePrivate.idl:
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
* WebCoreSupport/WebFrameLoaderClient.h:

2008-12-16 Steve Falkenburg <sfalken@apple.com>

Windows build fix.
@@ -51,3 +51,14 @@ interface IWebFrameLoadDelegatePrivate : IUnknown
//- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;
HRESULT didHandleOnloadEventsForFrame([in] IWebView* sender, [in] IWebFrame* frame);
}

[
object,
oleautomation,
uuid(5566CB49-6E87-4075-80CE-9BAC374C52DE),
pointer_default(unique)
]
interface IWebFrameLoadDelegatePrivate2 : IWebFrameLoadDelegatePrivate
{
HRESULT didFirstVisuallyNonEmptyLayoutInFrame([in] IWebView* sender, [in] IWebFrame* frame);
}
@@ -298,6 +298,17 @@ void WebFrameLoaderClient::dispatchDidFirstLayout()
frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame);
}

void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
{
WebView* webView = m_webFrame->webView();
COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePrivate;
if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) {
COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePrivate2(Query, frameLoadDelegatePrivate);
if (frameLoadDelegatePrivate2)
frameLoadDelegatePrivate2->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame);
}
}

Frame* WebFrameLoaderClient::dispatchCreatePage()
{
WebView* webView = m_webFrame->webView();
@@ -69,6 +69,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidFirstLayout();
virtual void dispatchDidFirstVisuallyNonEmptyLayout();

virtual WebCore::Frame* dispatchCreatePage();
virtual void dispatchShow();
@@ -1,3 +1,13 @@
2008-12-18 Sam Weinig <sam@webkit.org>

Reviewed by John Sullivan.

Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()

* WebKitSupport/FrameLoaderClientWx.cpp:
(WebCore::FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout):
* WebKitSupport/FrameLoaderClientWx.h:

2008-12-13 Kevin Watters <kevinwatters@gmail.com>

Reviewed by Kevin Ollivier.

0 comments on commit 1569e40

Please sign in to comment.