REGRESSION (r149749): Video becomes invisible when it starts playing at newyorkbygehr...
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 06:40:52 +0000 (06:40 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 06:40:52 +0000 (06:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115963

Reviewed by Dean Jackson.

Source/WebCore:

Test: media/video-remove-insert-repaints.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::insertedInto): Set m_inActiveDocument when inserted into a document.
(WebCore::HTMLMediaElement::removedFrom): Fix logging.

LayoutTests:

* media/video-remove-insert-repaints.html: Added.
* media/video-remove-insert-repaints-expected.txt: Added.
* platform/mac/media/video-remove-insert-repaints-expected.png: Added.

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

LayoutTests/ChangeLog
LayoutTests/media/video-remove-insert-repaints-expected.txt [new file with mode: 0644]
LayoutTests/media/video-remove-insert-repaints.html [new file with mode: 0644]
LayoutTests/platform/mac/media/video-remove-insert-repaints-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index 4814cee..6cb8a99 100644 (file)
@@ -1,3 +1,14 @@
+2013-05-12  Eric Carlson  <eric.carlson@apple.com>
+
+        REGRESSION (r149749): Video becomes invisible when it starts playing at newyorkbygehry.com
+        https://bugs.webkit.org/show_bug.cgi?id=115963
+
+        Reviewed by Dean Jackson.
+
+        * media/video-remove-insert-repaints.html: Added.
+        * media/video-remove-insert-repaints-expected.txt: Added.
+        * platform/mac/media/video-remove-insert-repaints-expected.png: Added.
+
 2013-05-12  Jinwoo Song  <jinwoo7.song@samsung.com>
 
         [EFL] Unreviewed EFL gardening
diff --git a/LayoutTests/media/video-remove-insert-repaints-expected.txt b/LayoutTests/media/video-remove-insert-repaints-expected.txt
new file mode 100644 (file)
index 0000000..ea3a522
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 320x240
+  RenderVideo {VIDEO} at (0,0) size 320x240
diff --git a/LayoutTests/media/video-remove-insert-repaints.html b/LayoutTests/media/video-remove-insert-repaints.html
new file mode 100644 (file)
index 0000000..4b02a8f
--- /dev/null
@@ -0,0 +1,49 @@
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <title>Test that video is rendered after being re-inserted into a document.</title>
+
+        <script src=media-file.js></script>
+        <script>
+            if (window.testRunner)
+                testRunner.waitUntilDone();
+
+            function seeked()
+            {
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+
+            function playing()
+            {
+                video.pause();
+                video.currentTime = 0;
+            }
+
+            function canplaythrough()
+            {
+                document.body.removeChild(video);
+                document.body.offsetLeft;
+                document.body.appendChild(video);
+                video.play();
+            }
+            
+            function start()
+            {
+                video = document.getElementsByTagName('video')[0];
+                video.src = findMediaFile('video', 'content/test');
+                video.addEventListener('canplaythrough', canplaythrough);
+                video.addEventListener('playing', playing);
+                video.addEventListener('seeked', seeked);
+            }
+
+        </script>
+
+    </head>
+
+    <body onload="start()">
+
+        <video width=320 height=240 ></video>
+
+    </body>
+</html>
diff --git a/LayoutTests/platform/mac/media/video-remove-insert-repaints-expected.png b/LayoutTests/platform/mac/media/video-remove-insert-repaints-expected.png
new file mode 100644 (file)
index 0000000..4853621
Binary files /dev/null and b/LayoutTests/platform/mac/media/video-remove-insert-repaints-expected.png differ
index b8cc28e..ba27183 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-12  Eric Carlson  <eric.carlson@apple.com>
+
+        REGRESSION (r149749): Video becomes invisible when it starts playing at newyorkbygehry.com
+        https://bugs.webkit.org/show_bug.cgi?id=115963
+
+        Reviewed by Dean Jackson.
+
+        Test: media/video-remove-insert-repaints.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::insertedInto): Set m_inActiveDocument when inserted into a document.
+        (WebCore::HTMLMediaElement::removedFrom): Fix logging.
+
 2013-05-12  David Kilzer  <ddkilzer@apple.com>
 
         Move sudden termination symbols to the Mac-only section
index b2922e8..a863fef 100644 (file)
@@ -578,19 +578,25 @@ bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& chi
 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint)
 {
     LOG(Media, "HTMLMediaElement::insertedInto");
+
     HTMLElement::insertedInto(insertionPoint);
-    if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY)
-        scheduleDelayedAction(LoadMediaResource);
+    if (insertionPoint->inDocument()) {
+        m_inActiveDocument = true;
+
+        if (m_networkState == NETWORK_EMPTY && !getAttribute(srcAttr).isEmpty())
+            scheduleDelayedAction(LoadMediaResource);
+    }
+
     configureMediaControls();
     return InsertionDone;
 }
 
 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint)
 {
-    m_inActiveDocument = false;
+    LOG(Media, "HTMLMediaElement::removedFrom");
 
+    m_inActiveDocument = false;
     if (insertionPoint->inDocument()) {
-        LOG(Media, "HTMLMediaElement::removedFrom");
         configureMediaControls();
         if (m_networkState > NETWORK_EMPTY)
             pause();