Commit 563ba091 authored by hyatt's avatar hyatt

Make onload do an explicit paint when a top-level document is ready...

        Make onload do an explicit paint when a top-level document is ready (to ensure that a first paint always
        happens before any timers set by the onload can fire).

        Reviewed by aroben

        * dom/Document.cpp:
        (WebCore::Document::implicitClose):
        * platform/ScrollView.h:
        * platform/mac/ScrollViewMac.mm:
        (WebCore::ScrollView::update):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b26bd0ed
2007-03-17 David Hyatt <hyatt@apple.com>
Make onload do an explicit paint when a top-level document is ready (to ensure that a first paint always
happens before any timers set by the onload can fire).
Reviewed by aroben
* dom/Document.cpp:
(WebCore::Document::implicitClose):
* platform/ScrollView.h:
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::update):
2007-03-17 Dave Hyatt <hyatt@apple.com>
Prevent starvation of user input and painting when processing timers.
......
......@@ -1417,6 +1417,12 @@ void Document::implicitClose()
// Always do a layout after loading if needed.
if (view() && renderer() && (!renderer()->firstChild() || renderer()->needsLayout()))
view()->layout();
// Paint immediately after the document is ready. We do this to ensure that any timers set by the
// onload don't have a chance to fire before we would have painted. To avoid over-flushing we only
// worry about this for the top-level document.
if (view() && !ownerElement())
view()->update();
}
#if PLATFORM(MAC)
......
......@@ -77,6 +77,7 @@ namespace WebCore {
virtual void resizeContents(int w, int h);
void updateContents(const IntRect&, bool now = false);
void update();
// Event coordinates are assumed to be in the coordinate space of a window that contains
// the entire widget hierarchy. It is up to the platform to decide what the precise definition
......
......@@ -359,6 +359,17 @@ void ScrollView::updateContents(const IntRect &rect, bool now)
END_BLOCK_OBJC_EXCEPTIONS;
}
void ScrollView::update()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSView *view = getView();
[[view window] displayIfNeeded];
[[view window] flushWindowIfNeeded];
END_BLOCK_OBJC_EXCEPTIONS;
}
// "Containing Window" means the NSWindow's coord system, which is origin lower left
IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment