[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric.carlson at apple.com eric.carlson at apple.com
Thu Apr 8 02:07:58 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9f8dbf40b4967430c02339a63564424270dcb891
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 3 17:19:02 2010 +0000

    2010-03-03  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Adele Peterson.
    
            Replace 'autobuffer' attribute with 'preload' to align with spec revision 4811.
            https://bugs.webkit.org/show_bug.cgi?id=35385
            rdar://problem/7689602
    
            Tests: media/audio-constructor-preload.html
                   media/video-dom-preload.html
    
            * html/HTMLAttributeNames.in: Remove autobuffer, add preload
    
            * html/HTMLAudioElement.cpp:
            (WebCore::HTMLAudioElement::createForJSConstructor): set preload to 'auto' instead of
                autobuffer to true.
    
            * html/HTMLMediaElement.cpp:
            (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_preload.
            (WebCore::HTMLMediaElement::parseMappedAttribute): Deal with 'preload' attribute.
            (WebCore::HTMLMediaElement::loadResource): Call setPreload() on the newly created MediaPlayer,
                before calling load() so it can pass the setting through to the media engine.
            (WebCore::HTMLMediaElement::preload): New.
            (WebCore::HTMLMediaElement::setPreload): Ditto
            * html/HTMLMediaElement.h:
            * html/HTMLMediaElement.idl:
    
            * platform/graphics/MediaPlayer.cpp:
            (WebCore::MediaPlayer::MediaPlayer): Initialize m_preload.
            (WebCore::MediaPlayer::load): Pass m_preload to newly created media engine.
            (WebCore::MediaPlayer::preload): New, return m_preload.
            (WebCore::MediaPlayer::setPreload): New, set m_preload.
            * platform/graphics/MediaPlayer.h:
            (WebCore::MediaPlayer::):
            * platform/graphics/MediaPlayerPrivate.h:
            (WebCore::MediaPlayerPrivateInterface::setPreload):
    
            * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
            (WebCore::MediaPlayerPrivate::setPreload): Renamed from setAutoplay, fix logic for preload.
            * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
    
    2010-03-03  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Adele Peterson.
    
            Replace 'autobuffer' attribute with 'preload' to align with spec revision 4811.
            https://bugs.webkit.org/show_bug.cgi?id=35385
            rdar://problem/7689602
    
            * media/audio-constructor-autobuffer-expected.txt: Removed.
            * media/audio-constructor-autobuffer.html: Removed.
            * media/audio-constructor-preload-expected.txt: Added.
            * media/audio-constructor-preload.html: Added.
            * media/video-dom-autobuffer-expected.txt: Removed.
            * media/video-dom-autobuffer.html: Removed.
            * media/video-dom-preload-expected.txt: Added.
            * media/video-dom-preload.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55463 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9536602..90f4fa2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-03-03  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Replace 'autobuffer' attribute with 'preload' to align with spec revision 4811.
+        https://bugs.webkit.org/show_bug.cgi?id=35385
+        rdar://problem/7689602
+
+        * media/audio-constructor-autobuffer-expected.txt: Removed.
+        * media/audio-constructor-autobuffer.html: Removed.
+        * media/audio-constructor-preload-expected.txt: Added.
+        * media/audio-constructor-preload.html: Added.
+        * media/video-dom-autobuffer-expected.txt: Removed.
+        * media/video-dom-autobuffer.html: Removed.
+        * media/video-dom-preload-expected.txt: Added.
+        * media/video-dom-preload.html: Added.
+
 2010-03-03  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/media/audio-constructor-autobuffer-expected.txt b/LayoutTests/media/audio-constructor-autobuffer-expected.txt
deleted file mode 100644
index 92a0f3a..0000000
--- a/LayoutTests/media/audio-constructor-autobuffer-expected.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Test that Audio() sets 'autobuffer' attribute.
-
-RUN(mediaElement = new Audio())
-
-++ Test initial attribute value
-EXPECTED (mediaElement.getAttribute('autobuffer') != 'null') OK
-EXPECTED (mediaElement.autobuffer == 'true') OK
-
-RUN(mediaElement.src = 'content/test.wav')
-RUN(mediaElement.load())
-
-++ Test after 'canplaythrough' event
-EXPECTED (mediaElement.getAttribute('autobuffer') != 'null') OK
-EXPECTED (mediaElement.autobuffer == 'true') OK
-END OF TEST
-
diff --git a/LayoutTests/media/audio-constructor-autobuffer.html b/LayoutTests/media/audio-constructor-autobuffer.html
deleted file mode 100644
index 40fd10a..0000000
--- a/LayoutTests/media/audio-constructor-autobuffer.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html>
-    <head>
-        <script src=media-file.js></script>
-        <script src=video-test.js></script>
-
-        <script>
-
-            function canplaythrough()
-            {
-                consoleWrite("++ Test after 'canplaythrough' event");
-                testExpected("mediaElement.getAttribute('autobuffer')", null, "!=");
-                testExpected("mediaElement.autobuffer", true);
-                endTest();
-            }
-
-            function start()
-            {
-                run("mediaElement = new Audio()");
-                consoleWrite("");
-
-                consoleWrite("++ Test initial attribute value");
-                testExpected("mediaElement.getAttribute('autobuffer')", null, "!=");
-                testExpected("mediaElement.autobuffer", true);
-                consoleWrite("");
-
-                mediaElement.addEventListener("canplaythrough", canplaythrough);
-                run("mediaElement.src = '" + findMediaFile("audio", "content/test") + "'");
-                run("mediaElement.load()");
-
-                consoleWrite("");
-            }
-
-        </script>
-    </head>
-
-    <body onload="start()">
-        <p>Test that Audio() sets 'autobuffer' attribute.</p>
-    </body>
-</html>
diff --git a/LayoutTests/media/audio-constructor-preload-expected.txt b/LayoutTests/media/audio-constructor-preload-expected.txt
new file mode 100644
index 0000000..33a3520
--- /dev/null
+++ b/LayoutTests/media/audio-constructor-preload-expected.txt
@@ -0,0 +1,16 @@
+Test that Audio() sets 'preload' attribute.
+
+RUN(mediaElement = new Audio())
+
+++ Test initial attribute value
+EXPECTED (mediaElement.getAttribute('preload') == 'auto') OK
+EXPECTED (mediaElement.preload == 'auto') OK
+
+RUN(mediaElement.src = 'content/test.wav')
+RUN(mediaElement.load())
+
+++ Test after 'canplaythrough' event
+EXPECTED (mediaElement.getAttribute('preload') == 'auto') OK
+EXPECTED (mediaElement.preload == 'auto') OK
+END OF TEST
+
diff --git a/LayoutTests/media/audio-constructor-preload.html b/LayoutTests/media/audio-constructor-preload.html
new file mode 100644
index 0000000..d3a104f
--- /dev/null
+++ b/LayoutTests/media/audio-constructor-preload.html
@@ -0,0 +1,39 @@
+<html>
+    <head>
+        <script src=media-file.js></script>
+        <script src=video-test.js></script>
+
+        <script>
+
+            function canplaythrough()
+            {
+                consoleWrite("++ Test after 'canplaythrough' event");
+                testExpected("mediaElement.getAttribute('preload')", "auto");
+                testExpected("mediaElement.preload", "auto");
+                endTest();
+            }
+
+            function start()
+            {
+                run("mediaElement = new Audio()");
+                consoleWrite("");
+
+                consoleWrite("++ Test initial attribute value");
+                testExpected("mediaElement.getAttribute('preload')", "auto");
+                testExpected("mediaElement.preload", "auto");
+                consoleWrite("");
+
+                mediaElement.addEventListener("canplaythrough", canplaythrough);
+                run("mediaElement.src = '" + findMediaFile("audio", "content/test") + "'");
+                run("mediaElement.load()");
+
+                consoleWrite("");
+            }
+
+        </script>
+    </head>
+
+    <body onload="start()">
+        <p>Test that Audio() sets 'preload' attribute.</p>
+    </body>
+</html>
diff --git a/LayoutTests/media/video-dom-autobuffer-expected.txt b/LayoutTests/media/video-dom-autobuffer-expected.txt
deleted file mode 100644
index 117bdd1..0000000
--- a/LayoutTests/media/video-dom-autobuffer-expected.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-
-++ Test initial attribute value
-EXPECTED (video.autobuffer == 'true') OK
-EXPECTED (video.getAttribute('autobuffer') != 'null') OK
-
-++ Set to false via DOM
-RUN(video.autobuffer = false;)
-EXPECTED (video.getAttribute('autobuffer') == 'null') OK
-EXPECTED (video.autobuffer == 'false') OK
-
-++ Set to true via DOM
-RUN(video.autobuffer = true;)
-EXPECTED (video.autobuffer == 'true') OK
-EXPECTED (video.getAttribute('autobuffer') != 'null') OK
-
-++ Remove attribute
-RUN(video.removeAttribute('autobuffer'))
-EXPECTED (video.autobuffer == 'false') OK
-
-++ Set to true via attribute
-RUN(video.setAttribute('autobuffer', true);)
-EXPECTED (video.autobuffer == 'true') OK
-EXPECTED (video.getAttribute('autobuffer') != 'null') OK
-
-END OF TEST
-
diff --git a/LayoutTests/media/video-dom-autobuffer.html b/LayoutTests/media/video-dom-autobuffer.html
deleted file mode 100644
index 2f576e2..0000000
--- a/LayoutTests/media/video-dom-autobuffer.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<html>
-    <body>
-
-    <video controls autobuffer></video>
-
-    <script src=video-test.js></script>
-    <script>
-        consoleWrite("");
-
-        consoleWrite("++ Test initial attribute value");
-        testExpected("video.autobuffer", true);
-        testExpected("video.getAttribute('autobuffer')", null, "!=");
-        consoleWrite("");
-
-        consoleWrite("++ Set to false via DOM");
-        run("video.autobuffer = false;");
-        testExpected("video.getAttribute('autobuffer')", null);
-        testExpected("video.autobuffer", false);
-        consoleWrite("");
-
-        consoleWrite("++ Set to true via DOM");
-        run("video.autobuffer = true;");
-        testExpected("video.autobuffer", true);
-        testExpected("video.getAttribute('autobuffer')", null, "!=");
-        consoleWrite("");
-
-        consoleWrite("++ Remove attribute");
-        run("video.removeAttribute('autobuffer')");
-        testExpected("video.autobuffer", false);
-        consoleWrite("");
-
-        consoleWrite("++ Set to true via attribute");
-        run("video.setAttribute('autobuffer', true);");
-        testExpected("video.autobuffer", true);
-        testExpected("video.getAttribute('autobuffer')", null, "!=");
-        consoleWrite("");
-
-        endTest();
-    </script>
-    
-    </body>
-</html>
-
diff --git a/LayoutTests/media/video-dom-preload-expected.txt b/LayoutTests/media/video-dom-preload-expected.txt
new file mode 100644
index 0000000..8cc83db
--- /dev/null
+++ b/LayoutTests/media/video-dom-preload-expected.txt
@@ -0,0 +1,58 @@
+
+++ Test default attribute value
+EXPECTED (video.preload == 'auto') OK
+EXPECTED (video.getAttribute('preload') == 'null') OK
+
+++ Remove attribute, should revert to default
+RUN(video.removeAttribute('preload'))
+EXPECTED (video.preload == 'auto') OK
+
+++ Set to 'none'
+- set via DOM
+RUN(video.removeAttribute('preload'))
+RUN(video.preload = 'none')
+EXPECTED (video.getAttribute('preload') == 'none') OK
+EXPECTED (video.preload == 'none') OK
+- and via attribute
+RUN(video.removeAttribute('preload'))
+RUN(video.setAttribute('preload', 'none'))
+EXPECTED (video.preload == 'none') OK
+EXPECTED (video.getAttribute('preload') == 'none') OK
+
+++ Set to 'auto'
+- set via DOM
+RUN(video.removeAttribute('preload'))
+RUN(video.preload = 'auto')
+EXPECTED (video.getAttribute('preload') == 'auto') OK
+EXPECTED (video.preload == 'auto') OK
+- and via attribute
+RUN(video.removeAttribute('preload'))
+RUN(video.setAttribute('preload', 'auto'))
+EXPECTED (video.preload == 'auto') OK
+EXPECTED (video.getAttribute('preload') == 'auto') OK
+
+++ set to bogus value, should revert to default value
+RUN(video.removeAttribute('preload'))
+- set via DOM
+RUN(video.preload = 'bogus')
+EXPECTED (video.getAttribute('preload') == 'bogus') OK
+EXPECTED (video.preload == 'auto') OK
+- and via attribute
+RUN(video.setAttribute('preload', 'bogus'))
+EXPECTED (video.preload == 'auto') OK
+EXPECTED (video.getAttribute('preload') == 'bogus') OK
+
+++ Set to 'metadata'
+- set via DOM
+RUN(video.removeAttribute('preload'))
+RUN(video.preload = 'metadata')
+EXPECTED (video.getAttribute('preload') == 'metadata') OK
+EXPECTED (video.preload == 'metadata') OK
+- and via attribute
+RUN(video.removeAttribute('preload'))
+RUN(video.setAttribute('preload', 'metadata'))
+EXPECTED (video.preload == 'metadata') OK
+EXPECTED (video.getAttribute('preload') == 'metadata') OK
+
+END OF TEST
+
diff --git a/LayoutTests/media/video-dom-preload.html b/LayoutTests/media/video-dom-preload.html
new file mode 100644
index 0000000..02f79de
--- /dev/null
+++ b/LayoutTests/media/video-dom-preload.html
@@ -0,0 +1,67 @@
+<html>
+    <head>
+        <script src=video-test.js></script>
+        <script>
+            function setPreload(value, expected)
+            {
+                consoleWrite("- set via DOM");
+                run("video.removeAttribute('preload')");
+                run("video.preload = '" + value + "'");
+                testExpected("video.getAttribute('preload')", expected);
+                testExpected("video.preload", expected);
+                consoleWrite("- and via attribute");
+                run("video.removeAttribute('preload')");
+                run("video.setAttribute('preload', '" + value + "')");
+                testExpected("video.preload", expected);
+                testExpected("video.getAttribute('preload')", expected);
+                consoleWrite("");
+
+            }
+
+            function test()
+            {
+                findMediaElement();
+                consoleWrite("");
+
+                consoleWrite("++ Test default attribute value");
+                testExpected("video.preload", "auto");
+                testExpected("video.getAttribute('preload')", null);
+                consoleWrite("");
+
+                consoleWrite("++ Remove attribute, should revert to default");
+                run("video.removeAttribute('preload')");
+                testExpected("video.preload", "auto");
+                consoleWrite("");
+
+                consoleWrite("++ Set to 'none'");
+                setPreload("none", "none");
+
+                consoleWrite("++ Set to 'auto'");
+                setPreload("auto", "auto");
+
+                consoleWrite("++ set to bogus value, should revert to default value");
+                run("video.removeAttribute('preload')");
+                consoleWrite("- set via DOM");
+                run("video.preload = 'bogus'");
+                testExpected("video.getAttribute('preload')", "bogus");
+                testExpected("video.preload", "auto");
+                consoleWrite("- and via attribute");
+                run("video.setAttribute('preload', 'bogus')");
+                testExpected("video.preload", "auto");
+                testExpected("video.getAttribute('preload')", "bogus");
+                consoleWrite("");
+
+                consoleWrite("++ Set to 'metadata'");
+                setPreload("metadata", "metadata");
+        
+                endTest();
+            }
+        </script>
+
+    </head>
+
+    <body onload="test()">
+        <video controls></video>
+    </body>
+</html>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8bcf81e..9db0fa5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,44 @@
+2010-03-03  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Replace 'autobuffer' attribute with 'preload' to align with spec revision 4811.
+        https://bugs.webkit.org/show_bug.cgi?id=35385
+        rdar://problem/7689602
+
+        Tests: media/audio-constructor-preload.html
+               media/video-dom-preload.html
+
+        * html/HTMLAttributeNames.in: Remove autobuffer, add preload
+
+        * html/HTMLAudioElement.cpp:
+        (WebCore::HTMLAudioElement::createForJSConstructor): set preload to 'auto' instead of 
+            autobuffer to true.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_preload.
+        (WebCore::HTMLMediaElement::parseMappedAttribute): Deal with 'preload' attribute.
+        (WebCore::HTMLMediaElement::loadResource): Call setPreload() on the newly created MediaPlayer,
+            before calling load() so it can pass the setting through to the media engine.
+        (WebCore::HTMLMediaElement::preload): New.
+        (WebCore::HTMLMediaElement::setPreload): Ditto
+        * html/HTMLMediaElement.h:
+        * html/HTMLMediaElement.idl:
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::MediaPlayer): Initialize m_preload.
+        (WebCore::MediaPlayer::load): Pass m_preload to newly created media engine.
+        (WebCore::MediaPlayer::preload): New, return m_preload.
+        (WebCore::MediaPlayer::setPreload): New, set m_preload.
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayer::):
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::setPreload):
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivate::setPreload): Renamed from setAutoplay, fix logic for preload.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
 2010-03-03  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index e85497d..0ccb2af 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -42,7 +42,6 @@ aria-valuemax
 aria-valuemin
 aria-valuenow
 aria-valuetext
-autobuffer
 autocomplete
 autofocus
 autoplay
@@ -223,6 +222,7 @@ placeholder
 pluginurl
 poster
 precision
+preload
 primary
 profile
 progress
diff --git a/WebCore/html/HTMLAudioElement.cpp b/WebCore/html/HTMLAudioElement.cpp
index 347b8c4..6018b52 100644
--- a/WebCore/html/HTMLAudioElement.cpp
+++ b/WebCore/html/HTMLAudioElement.cpp
@@ -44,7 +44,7 @@ HTMLAudioElement::HTMLAudioElement(const QualifiedName& tagName, Document* docum
 PassRefPtr<HTMLAudioElement> HTMLAudioElement::createForJSConstructor(Document* document, const String& src)
 {
     RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(audioTag, document);
-    audio->setAutobuffer(true);
+    audio->setPreload("auto");
     if (!src.isNull()) {
         audio->setSrc(src);
         audio->scheduleLoad();
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 6a7ebe0..8def9c7 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -102,6 +102,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
     , m_currentSourceNode(0)
     , m_player(0)
     , m_restrictions(NoRestrictions)
+    , m_preload(MediaPlayer::Auto)
     , m_playing(false)
     , m_processingMediaPlayerCallback(0)
     , m_processingLoad(false)
@@ -178,9 +179,23 @@ void HTMLMediaElement::parseMappedAttribute(MappedAttribute* attr)
 {
     const QualifiedName& attrName = attr->name();
 
-    if (attrName == autobufferAttr) {
-        if (m_player)
-            m_player->setAutobuffer(!attr->isNull());
+    if (attrName == preloadAttr) {
+        String value = attr->value();
+
+        if (equalIgnoringCase(value, "none"))
+            m_preload = MediaPlayer::None;
+        else if (equalIgnoringCase(value, "metadata"))
+            m_preload = MediaPlayer::MetaData;
+        else {
+            // The spec does not define an "invalid value default" but "auto" is suggested as the
+            // "missing value default", so use it for everything except "none" and "metadata"
+            m_preload = MediaPlayer::Auto;
+        }
+
+        // The attribute must be ignored if the autoplay attribute is present
+        if (!autoplay() && m_player)
+            m_player->setPreload(m_preload);
+
     } else if (attrName == onabortAttr)
         setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
     else if (attrName == onbeforeloadAttr)
@@ -586,7 +601,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
         m_player = MediaPlayer::create(this);
 #endif
 
-    m_player->setAutobuffer(autobuffer());
+    m_player->setPreload(m_preload);
     m_player->setPreservesPitch(m_webkitPreservesPitch);
     updateVolume();
 
@@ -1118,14 +1133,27 @@ void HTMLMediaElement::setAutoplay(bool b)
     setBooleanAttribute(autoplayAttr, b);
 }
 
-bool HTMLMediaElement::autobuffer() const
+String HTMLMediaElement::preload() const
 {
-    return hasAttribute(autobufferAttr);
+    switch (m_preload) {
+    case MediaPlayer::None:
+        return "none";
+        break;
+    case MediaPlayer::MetaData:
+        return "metadata";
+        break;
+    case MediaPlayer::Auto:
+        return "auto";
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return String();
 }
 
-void HTMLMediaElement::setAutobuffer(bool b)
+void HTMLMediaElement::setPreload(const String& preload)
 {
-    setBooleanAttribute(autobufferAttr, b);
+    setAttribute(preloadAttr, preload);
 }
 
 void HTMLMediaElement::play(bool isUserGesture)
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index b0cec14..a2eb67a 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -100,8 +100,9 @@ public:
 
     enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_LOADED, NETWORK_NO_SOURCE };
     NetworkState networkState() const;
-    bool autobuffer() const;    
-    void setAutobuffer(bool);
+    
+    String preload() const;    
+    void setPreload(const String&);
 
     PassRefPtr<TimeRanges> buffered() const;
     void load(bool isUserGesture, ExceptionCode&);
@@ -309,11 +310,13 @@ protected:
     OwnPtr<MediaPlayer> m_player;
 
     BehaviorRestrictions m_restrictions;
+    
+    MediaPlayer::Preload m_preload;
 
     bool m_playing;
 
-    // counter incremented while processing a callback from the media player, so we can avoid
-    //  calling the media engine recursively
+    // Counter incremented while processing a callback from the media player, so we can avoid
+    // calling the media engine recursively.
     int m_processingMediaPlayerCallback;
 
     bool m_processingLoad : 1;
diff --git a/WebCore/html/HTMLMediaElement.idl b/WebCore/html/HTMLMediaElement.idl
index 46a2b86..5cd3293 100644
--- a/WebCore/html/HTMLMediaElement.idl
+++ b/WebCore/html/HTMLMediaElement.idl
@@ -39,7 +39,7 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement {
     const unsigned short NETWORK_LOADED = 3;
     const unsigned short NETWORK_NO_SOURCE = 4;
     readonly attribute unsigned short networkState;
-    attribute boolean autobuffer;
+    attribute DOMString preload;
 
     readonly attribute TimeRanges buffered;
     [NeedsUserGestureCheck] void load() 
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 6998570..9e6f1ab 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -204,12 +204,12 @@ MediaPlayer::MediaPlayer(MediaPlayerClient* client)
     , m_private(createNullMediaPlayer(this))
     , m_currentMediaEngine(0)
     , m_frameView(0)
+    , m_preload(Auto)
     , m_visible(false)
     , m_rate(1.0f)
     , m_volume(1.0f)
     , m_muted(false)
     , m_preservesPitch(true)
-    , m_autobuffer(false)
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     , m_playerProxy(0)
 #endif
@@ -260,7 +260,7 @@ void MediaPlayer::load(const String& url, const ContentType& contentType)
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
         m_private->setMediaPlayerProxy(m_playerProxy);
 #endif
-        m_private->setAutobuffer(autobuffer());
+        m_private->setPreload(m_preload);
         m_private->setPreservesPitch(preservesPitch());
     }
 
@@ -482,17 +482,14 @@ void MediaPlayer::setVisible(bool b)
     m_private->setVisible(b);
 }
 
-bool MediaPlayer::autobuffer() const
+MediaPlayer::Preload MediaPlayer::preload() const
 {
-    return m_autobuffer;
+    return m_preload;
 }
 
-void MediaPlayer::setAutobuffer(bool b)
+void MediaPlayer::setPreload(MediaPlayer::Preload preload)
 {
-    if (m_autobuffer != b) {
-        m_autobuffer = b;
-        m_private->setAutobuffer(b);
-    }
+    m_private->setPreload(preload);
 }
 
 void MediaPlayer::paint(GraphicsContext* p, const IntRect& r)
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index 2f28586..95cc7f1 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -194,8 +194,8 @@ public:
     bool hasClosedCaptions() const;
     void setClosedCaptionsVisible(bool closedCaptionsVisible);
 
-    bool autobuffer() const;    
-    void setAutobuffer(bool);
+    bool autoplay() const;    
+    void setAutoplay(bool);
 
     void paint(GraphicsContext*, const IntRect&);
     void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
@@ -209,6 +209,10 @@ public:
     enum MovieLoadType { Unknown, Download, StoredStream, LiveStream };
     MovieLoadType movieLoadType() const;
 
+    enum Preload { None, MetaData, Auto };
+    Preload preload() const;
+    void setPreload(Preload);
+
     void networkStateChanged();
     void readyStateChanged();
     void volumeChanged(float);
@@ -251,12 +255,12 @@ private:
     void* m_currentMediaEngine;
     FrameView* m_frameView;
     IntSize m_size;
+    Preload m_preload;
     bool m_visible;
     float m_rate;
     float m_volume;
     bool m_muted;
     bool m_preservesPitch;
-    bool m_autobuffer;
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     WebMediaPlayerProxy* m_playerProxy;    // not owned or used, passed to m_private
 #endif
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index 3bb8475..16ff543 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -97,7 +97,7 @@ public:
 
     virtual void paintCurrentFrameInContext(GraphicsContext* c, const IntRect& r) { paint(c, r); }
 
-    virtual void setAutobuffer(bool) { };
+    virtual void setPreload(MediaPlayer::Preload) { };
 
     virtual bool hasAvailableVideoFrame() const { return readyState() >= MediaPlayer::HaveCurrentData; }
 
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 6a99d4f..fe4b2f9 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -1333,16 +1333,16 @@ bool MediaPlayerPrivate::supportsFullscreen() const
     return true;
 }
 
-void MediaPlayerPrivate::setAutobuffer(bool autoBuffer)
+void MediaPlayerPrivate::setPreload(MediaPlayer::Preload preload)
 {
     ASSERT(m_playBin);
 
     GstPlayFlags flags;
     g_object_get(m_playBin, "flags", &flags, NULL);
-    if (autoBuffer)
-        g_object_set(m_playBin, "flags", flags | GST_PLAY_FLAG_DOWNLOAD, NULL);
-    else
+    if (preload == MediaPlayer::None)
         g_object_set(m_playBin, "flags", flags & ~GST_PLAY_FLAG_DOWNLOAD, NULL);
+    else
+        g_object_set(m_playBin, "flags", flags | GST_PLAY_FLAG_DOWNLOAD, NULL);
 }
 
 void MediaPlayerPrivate::createGSTPlayBin()
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index e19b686..401dd65 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -87,7 +87,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
             void muteChanged();
             void muteChangedCallback();
 
-            void setAutobuffer(bool);
+            void setPreload(MediaPlayer::Preload);
             bool queryBufferingStats();
 
             MediaPlayer::NetworkState networkState() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list