[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric.carlson at apple.com eric.carlson at apple.com
Wed Dec 22 11:56:04 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 128d908339d21e78bb1c62ebf6c44b2654bb4358
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 11 18:56:50 2010 +0000

    2010-08-11  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Darin Adler.
    
            Inserting a <source> element should immediately set networkState to NETWORK_NO_SOURCE.
            https://bugs.webkit.org/show_bug.cgi?id=42897
    
            A <source> element inserted as a child of a media element with a networkState of NETWORK_EMPTY
            should cause the networkState to immediately change to NETWORK_NO_SOURCE.
    
            * WebCore.xcodeproj/project.pbxproj:
            * html/HTMLMediaElement.cpp:
            (WebCore::HTMLMediaElement::HTMLMediaElement): Remove unused variable m_processingLoad.
            (WebCore::HTMLMediaElement::prepareForLoad): Set m_networkState to NETWORK_NO_SOURCE.
            (WebCore::HTMLMediaElement::loadInternal): Remove unused variable m_processingLoad.
            (WebCore::HTMLMediaElement::selectMediaResource): No need to change m_networkState, it was done in prepareForLoad.
            * html/HTMLMediaElement.h:
    
            * html/HTMLSourceElement.cpp:
            (WebCore::HTMLSourceElement::insertedIntoTree): Renamed from insertedIntoDocument because we want
            to do this setup whether or not the parent media element is in the document.
            * html/HTMLSourceElement.h:
    
    2010-08-11  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Darin Adler.
    
            Inserting a <source> element should immediately set networkState to NETWORK_NO_SOURCE.
            https://bugs.webkit.org/show_bug.cgi?id=42897
    
            * media/remove-from-document-no-load-expected.txt:
            * media/remove-from-document-no-load.html:
            * media/video-pause-empty-events-expected.txt:
            * media/video-pause-empty-events.html:
            * media/video-source-inserted-expected.txt: Added.
            * media/video-source-inserted.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65170 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f102c5f..c14e5e4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-11  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Inserting a <source> element should immediately set networkState to NETWORK_NO_SOURCE.
+        https://bugs.webkit.org/show_bug.cgi?id=42897
+
+        * media/remove-from-document-no-load-expected.txt:
+        * media/remove-from-document-no-load.html:
+        * media/video-pause-empty-events-expected.txt:
+        * media/video-pause-empty-events.html:
+        * media/video-source-inserted-expected.txt: Added.
+        * media/video-source-inserted.html: Added.
+
 2010-08-11  Nate Chapin  <japhet at chromium.org>
 
         Unreviewed, Chromium rebaseline.
diff --git a/LayoutTests/media/remove-from-document-no-load-expected.txt b/LayoutTests/media/remove-from-document-no-load-expected.txt
index d096282..14c427b 100644
--- a/LayoutTests/media/remove-from-document-no-load-expected.txt
+++ b/LayoutTests/media/remove-from-document-no-load-expected.txt
@@ -1,6 +1,6 @@
 Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.
 
-EXPECTED (video.networkState == '0') OK
+EXPECTED (video.networkState == '3') OK
 RUN(document.body.removeChild(video))
 EXPECTED (didReceiveLoadStartEvent == 'false') OK
 END OF TEST
diff --git a/LayoutTests/media/remove-from-document-no-load.html b/LayoutTests/media/remove-from-document-no-load.html
index 3dbce71..1cb37bb 100644
--- a/LayoutTests/media/remove-from-document-no-load.html
+++ b/LayoutTests/media/remove-from-document-no-load.html
@@ -6,7 +6,7 @@
     didReceiveLoadStartEvent = false;
     video.addEventListener('loadstart', function() { didReceiveLoadStartEvent = true; });
     video.src = findMediaFile("video", "content/test");
-    testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY);
+    testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
     run("document.body.removeChild(video)");
     testExpected("didReceiveLoadStartEvent", false);
     endTest();
diff --git a/LayoutTests/media/video-pause-empty-events-expected.txt b/LayoutTests/media/video-pause-empty-events-expected.txt
index 4f86ea0..d87003f 100644
--- a/LayoutTests/media/video-pause-empty-events-expected.txt
+++ b/LayoutTests/media/video-pause-empty-events-expected.txt
@@ -1,6 +1,6 @@
 Test that pause() from EMPTY network state triggers load()
 
-EXPECTED (video.networkState == '0') OK
+EXPECTED (video.networkState == '3') OK
 RUN(video.pause())
 SCRIPT DONE
 EVENT(loadstart)
diff --git a/LayoutTests/media/video-pause-empty-events.html b/LayoutTests/media/video-pause-empty-events.html
index 1513442..9c157db 100644
--- a/LayoutTests/media/video-pause-empty-events.html
+++ b/LayoutTests/media/video-pause-empty-events.html
@@ -4,7 +4,7 @@
 <script src=video-test.js></script>
 <script>
     video.src = findMediaFile("video", "content/test");
-    testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY);
+    testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
 
     waitForEvent("loadstart");
     waitForEvent("ratechange");
diff --git a/LayoutTests/media/video-source-inserted-expected.txt b/LayoutTests/media/video-source-inserted-expected.txt
new file mode 100644
index 0000000..337b4dc
--- /dev/null
+++ b/LayoutTests/media/video-source-inserted-expected.txt
@@ -0,0 +1,10 @@
+Test that a <source> inserted when networkState is NETWORK_NO_SOURCE triggers resource selection, immediately changing networkState to NETWORK_NO_SOURCE.
+
+<source> inserted by the parser.
+EXPECTED (video.networkState == '3') OK
+
+<video> created with script.
+EXPECTED (video.networkState == '0') OK
+<source> inserted by script.
+EXPECTED (video.networkState == '3') OK
+
diff --git a/LayoutTests/media/video-source-inserted.html b/LayoutTests/media/video-source-inserted.html
new file mode 100644
index 0000000..191aee4
--- /dev/null
+++ b/LayoutTests/media/video-source-inserted.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+    <head>
+        <title>networkState after inserting &lt;source&gt; test</title>
+        <script src=video-test.js></script>
+    </head>
+    <body>
+        <video controls><source></video>
+
+        <p>Test that a &lt;source&gt; inserted when networkState is NETWORK_NO_SOURCE triggers
+        resource selection, immediately changing networkState to NETWORK_NO_SOURCE.</p>
+
+        <script>
+            consoleWrite("&lt;source&gt; inserted by the parser.");
+            video = document.querySelector('video');
+            testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
+
+            consoleWrite("<br>&lt;video&gt; created with script.");
+            video = document.createElement('video');
+            testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_EMPTY, "==");
+            consoleWrite("&lt;source&gt; inserted by script.");
+            video.appendChild(document.createElement('source'));
+            testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        </script>
+
+    </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fe1d89a..0531842 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-08-11  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Inserting a <source> element should immediately set networkState to NETWORK_NO_SOURCE.
+        https://bugs.webkit.org/show_bug.cgi?id=42897
+
+        A <source> element inserted as a child of a media element with a networkState of NETWORK_EMPTY
+        should cause the networkState to immediately change to NETWORK_NO_SOURCE.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement): Remove unused variable m_processingLoad.
+        (WebCore::HTMLMediaElement::prepareForLoad): Set m_networkState to NETWORK_NO_SOURCE.
+        (WebCore::HTMLMediaElement::loadInternal): Remove unused variable m_processingLoad.
+        (WebCore::HTMLMediaElement::selectMediaResource): No need to change m_networkState, it was done in prepareForLoad.
+        * html/HTMLMediaElement.h:
+
+        * html/HTMLSourceElement.cpp:
+        (WebCore::HTMLSourceElement::insertedIntoTree): Renamed from insertedIntoDocument because we want
+        to do this setup whether or not the parent media element is in the document.
+        * html/HTMLSourceElement.h:
+
 2010-08-11  Adam Barth  <abarth at webkit.org>
 
         Rubber-stamped by Eric Seidel.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index b1f5819..bcbf6c2 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -112,7 +112,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
     , m_processingMediaPlayerCallback(0)
     , m_playing(false)
     , m_isWaitingUntilMediaCanStart(false)
-    , m_processingLoad(false)
     , m_delayingTheLoadEvent(false)
     , m_haveFiredLoadedData(false)
     , m_inActiveDocument(true)
@@ -532,6 +531,16 @@ void HTMLMediaElement::prepareForLoad()
     m_error = 0;
     m_autoplaying = true;
 
+    // 7 - Invoke the media element's resource selection algorithm.
+
+    // 8 - Note: Playback of any previously playing media resource for this element stops.
+
+    // The resource selection algorithm
+    // 1 - Set the networkState to NETWORK_NO_SOURCE
+    m_networkState = NETWORK_NO_SOURCE;
+
+    // 2 - Asynchronously await a stable state.
+
     m_playedTimeRanges = TimeRanges::create();
     m_lastSeekTime = 0;
     m_closedCaptionsVisible = false;
@@ -549,11 +558,7 @@ void HTMLMediaElement::loadInternal()
         return;
     }
 
-    // Steps 1 - 6 were done in prepareForLoad
-
-    // 7 - Invoke the media element's resource selection algorithm.
     selectMediaResource();
-    m_processingLoad = false;
 }
 
 void HTMLMediaElement::selectMediaResource()
@@ -561,11 +566,6 @@ void HTMLMediaElement::selectMediaResource()
     enum Mode { attribute, children };
     Mode mode = attribute;
 
-    // 1 - Set the networkState to NETWORK_NO_SOURCE
-    m_networkState = NETWORK_NO_SOURCE;
-
-    // 2 - Asynchronously await a stable state.
-
     // 3 - ... the media element has neither a src attribute ...
     if (!hasAttribute(srcAttr)) {
         // ... nor a source element child: ...
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index aeec188..a73abba 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -340,7 +340,6 @@ private:
 
     bool m_playing : 1;
     bool m_isWaitingUntilMediaCanStart : 1;
-    bool m_processingLoad : 1;
     bool m_delayingTheLoadEvent : 1;
     bool m_haveFiredLoadedData : 1;
     bool m_inActiveDocument : 1;
diff --git a/WebCore/html/HTMLSourceElement.cpp b/WebCore/html/HTMLSourceElement.cpp
index 6c26610..96c9829 100644
--- a/WebCore/html/HTMLSourceElement.cpp
+++ b/WebCore/html/HTMLSourceElement.cpp
@@ -52,9 +52,9 @@ PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tag
     return adoptRef(new HTMLSourceElement(tagName, document));
 }
 
-void HTMLSourceElement::insertedIntoDocument()
+void HTMLSourceElement::insertedIntoTree(bool deep)
 {
-    HTMLElement::insertedIntoDocument();
+    HTMLElement::insertedIntoTree(deep);
     if (parentNode() && (parentNode()->hasTagName(audioTag) ||  parentNode()->hasTagName(videoTag))) {
         HTMLMediaElement* media = static_cast<HTMLMediaElement*>(parentNode());
         if (media->networkState() == HTMLMediaElement::NETWORK_EMPTY)
diff --git a/WebCore/html/HTMLSourceElement.h b/WebCore/html/HTMLSourceElement.h
index 20049cc..7d49a3e 100644
--- a/WebCore/html/HTMLSourceElement.h
+++ b/WebCore/html/HTMLSourceElement.h
@@ -52,7 +52,7 @@ private:
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     virtual int tagPriority() const { return 0; }
     
-    virtual void insertedIntoDocument();
+    virtual void insertedIntoTree(bool);
     virtual bool isURLAttribute(Attribute*) const;
 
     void errorEventTimerFired(Timer<HTMLSourceElement>*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list