2010-08-26 Eric Carlson <eric.carlson@apple.com>
authorAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Thu, 20 Jan 2011 18:23:08 +0000 (15:23 -0300)
committerAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Thu, 20 Jan 2011 19:55:40 +0000 (16:55 -0300)
commit4733735af523d01d0394ed0ccf040e52117caec9
treeb47f1a2015875d326ba0beeb53ca4dec652050c3
parentc7a166301d05c1928986d7f1bcc40add0f07f412
2010-08-26  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Darin Adler and Maciej Stachowiak.

        https://bugs.webkit.org/show_bug.cgi?id=44013
        HTMLMediaElement should delay document load event

        Test: media/video-delay-load-event.html

        * dom/Document.cpp:
        (WebCore::Document::Document): Initialize incrementLoadEventDelayCount.
        (WebCore::Document::decrementLoadEventDelayCount): New, decrement incrementLoadEventDelayCount
        and call loader->checkCompleted() when it reaches zero.
        * dom/Document.h:
        (WebCore::Document::incrementLoadEventDelayCount): New.
        (WebCore::Document::isDelayingLoadEvent): New.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::~HTMLMediaElement): Stop delaying the load event if necessary.
        (WebCore::HTMLMediaElement::willMoveToNewOwnerDocument): Ditto.
        (WebCore::HTMLMediaElement::didMoveToNewOwnerDocument): Delay the load event if we don't the
        meta data for the movie yet.
        (WebCore::HTMLMediaElement::prepareForLoad): Delay the load event.
        (WebCore::HTMLMediaElement::selectMediaResource): Don't delay the load event when there are
        no more sources to consider. Don't change m_delayingTheLoadEvent directly, call
        setShouldDelayLoadEvent() instead.
        (WebCore::HTMLMediaElement::waitForSourceChange): Stop delaying the load event.
        (WebCore::HTMLMediaElement::noneSupported): Ditto.
        (WebCore::HTMLMediaElement::mediaEngineError): Ditto.
        (WebCore::HTMLMediaElement::setReadyState): Ditto.
        (WebCore::HTMLMediaElement::userCancelledLoad): Ditto.
        (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): New, increment/decrement the document's
        load event delay count.
        * html/HTMLMediaElement.h:

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::checkCompleted): See if the document wants to delay completion for
        elements that don't go through a FrameLoader.
        (WebCore::FrameLoader::checkCallImplicitClose): Ditto
        * page/Frame.cpp:

2010-08-26  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Darin Adler and Maciej Stachowiak.

        https://bugs.webkit.org/show_bug.cgi?id=44013
        HTMLMediaElement should delay document load event

        * media/video-delay-load-event-expected.txt: Added.
        * media/video-delay-load-event.html: Added.
        * media/video-layer-crash.html: Trigger test with script inline in the <body> instead
        of from an onload handler as that runs too late. Reformat script to make it readable.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66110 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:

WebCore/dom/Document.h
LayoutTests/ChangeLog
LayoutTests/media/video-delay-load-event-expected.txt [new file with mode: 0644]
LayoutTests/media/video-delay-load-event.html [new file with mode: 0644]
LayoutTests/media/video-layer-crash.html
WebCore/ChangeLog
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/html/HTMLMediaElement.cpp
WebCore/html/HTMLMediaElement.h
WebCore/loader/FrameLoader.cpp