~ubuntu-branches/ubuntu/lucid/webkit/lucid-updates

« back to all changes in this revision

Viewing changes to WebCore/html/HTMLMediaElement.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2010-01-06 21:25:06 UTC
  • mfrom: (1.2.6 upstream) (4.3.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100106212506-gd0czn4zrwf1j19l
* New upstream release
- adds basic Content-Encoding support, thanks to soup
  (Closes: #529271)
- fixes over-advertising content types as supported by
  the media player (Closes: #559420)
* debian/control:
- updated libsoup build requirement (>= 2.28.2)
* debian/libwebkit-1.0-2.symbols:
- updated with new symbols
* debian/copyright:
- updated information since 1.1.17
* Imported patch from https://bugs.webkit.org/show_bug.cgi?id=30623
- I am shipping this patch because I believe it is correct, it is the
  way to go, it fixes a race, and it needs testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#if ENABLE(VIDEO)
29
29
#include "HTMLMediaElement.h"
30
30
 
 
31
#include "Chrome.h"
 
32
#include "ChromeClient.h"
31
33
#include "ClientRect.h"
32
34
#include "ClientRectList.h"
33
 
#include "ChromeClient.h"
34
35
#include "CSSHelper.h"
35
36
#include "CSSPropertyNames.h"
36
37
#include "CSSValueKeywords.h"
297
298
    m_loadTimer.startOneShot(0);
298
299
}
299
300
 
300
 
void HTMLMediaElement::scheduleProgressEvent(const AtomicString& eventName)
301
 
{
302
 
    if (!m_sendProgressEvents)
303
 
        return;
304
 
 
305
 
    // FIXME: don't schedule timeupdate or progress events unless there are registered listeners
306
 
 
307
 
    bool totalKnown = m_player && m_player->totalBytesKnown();
308
 
    unsigned loaded = m_player ? m_player->bytesLoaded() : 0;
309
 
    unsigned total = m_player ? m_player->totalBytes() : 0;
310
 
 
311
 
    RefPtr<ProgressEvent> evt = ProgressEvent::create(eventName, totalKnown, loaded, total);
312
 
    enqueueEvent(evt);
313
 
 
314
 
    if (renderer())
315
 
        renderer()->updateFromElement();
316
 
}
317
 
 
318
301
void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
319
302
{
320
303
    enqueueEvent(Event::create(eventName, false, true));
529
512
    m_networkState = NETWORK_LOADING;
530
513
 
531
514
    // 5
532
 
    scheduleProgressEvent(eventNames().loadstartEvent);
 
515
    scheduleEvent(eventNames().loadstartEvent);
533
516
 
534
517
    // 6 - If the media element has a src attribute, then run these substeps
535
518
    ContentType contentType("");
652
635
    // 7 - Queue a task to fire a progress event called error at the media element, in
653
636
    // the context of the fetching process that was used to try to obtain the media
654
637
    // resource in the resource fetch algorithm.
655
 
    scheduleProgressEvent(eventNames().errorEvent);
 
638
    scheduleEvent(eventNames().errorEvent);
656
639
 
657
640
    // 8 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
658
641
    m_delayingTheLoadEvent = false;
677
660
 
678
661
    // 3 - Queue a task to fire a progress event called error at the media element, in
679
662
    // the context of the fetching process started by this instance of this algorithm.
680
 
    scheduleProgressEvent(eventNames().errorEvent);
 
663
    scheduleEvent(eventNames().errorEvent);
681
664
 
682
665
    // 4 - Set the element's networkState attribute to the NETWORK_EMPTY value and queue a
683
666
    // task to fire a simple event called emptied at the element.
744
727
    if (state == MediaPlayer::Idle) {
745
728
        if (m_networkState > NETWORK_IDLE) {
746
729
            stopPeriodicTimers();
747
 
            scheduleProgressEvent(eventNames().suspendEvent);
 
730
            scheduleEvent(eventNames().suspendEvent);
748
731
        }
749
732
        m_networkState = NETWORK_IDLE;
750
733
    }
764
747
 
765
748
            // Schedule one last progress event so we guarantee that at least one is fired
766
749
            // for files that load very quickly.
767
 
            scheduleProgressEvent(eventNames().progressEvent);
 
750
            scheduleEvent(eventNames().progressEvent);
768
751
 
769
752
            // Check to see if readyState changes need to be dealt with before sending the 
770
753
            // 'load' event so we report 'canplaythrough' first. This is necessary because a
773
756
            if (static_cast<ReadyState>(currentState) != m_readyState)
774
757
                setReadyState(currentState);
775
758
 
776
 
            scheduleProgressEvent(eventNames().loadEvent);
 
759
            scheduleEvent(eventNames().loadEvent);
777
760
        }
778
761
    }
779
762
}
890
873
 
891
874
    if (progress == m_previousProgress) {
892
875
        if (timedelta > 3.0 && !m_sentStalledEvent) {
893
 
            scheduleProgressEvent(eventNames().stalledEvent);
 
876
            scheduleEvent(eventNames().stalledEvent);
894
877
            m_sentStalledEvent = true;
895
878
        }
896
879
    } else {
897
 
        scheduleProgressEvent(eventNames().progressEvent);
 
880
        scheduleEvent(eventNames().progressEvent);
898
881
        m_previousProgress = progress;
899
882
        m_previousProgressTime = time;
900
883
        m_sentStalledEvent = false;
 
884
        if (renderer())
 
885
            renderer()->updateFromElement();
901
886
    }
902
887
}
903
888
 
1657
1642
 
1658
1643
    // 3 - Queue a task to fire a progress event called abort at the media element, in the context
1659
1644
    // of the fetching process started by this instance of this algorithm.
1660
 
    scheduleProgressEvent(eventNames().abortEvent);
 
1645
    scheduleEvent(eventNames().abortEvent);
1661
1646
 
1662
1647
    // 5 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
1663
1648
    // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a