WebCore:
authoradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2007 20:02:21 +0000 (20:02 +0000)
committeradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2007 20:02:21 +0000 (20:02 +0000)
        Reviewed by Oliver.

        Fix for <rdar://problem/5631356> Toggling display property on video causes controls to get lost

        * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::attach): Call updateFromElement.
        * html/HTMLMediaElement.h:

LayoutTests:

        Reviewed by Oliver.

        Fix <rdar://problem/5631356> Toggling display property on video causes controls to get lost

        * media/video-display-toggle.html: Added.
        * platform/mac/media/video-display-toggle-expected.checksum: Added.
        * platform/mac/media/video-display-toggle-expected.png: Added.
        * platform/mac/media/video-display-toggle-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/media/video-display-toggle.html [new file with mode: 0644]
LayoutTests/platform/mac/media/video-display-toggle-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/media/video-display-toggle-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/media/video-display-toggle-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLMediaElement.cpp
WebCore/html/HTMLMediaElement.h

index c088a5e..8c02a44 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-06  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Oliver.
+
+        Fix <rdar://problem/5631356> Toggling display property on video causes controls to get lost
+
+        * media/video-display-toggle.html: Added.
+        * platform/mac/media/video-display-toggle-expected.checksum: Added.
+        * platform/mac/media/video-display-toggle-expected.png: Added.
+        * platform/mac/media/video-display-toggle-expected.txt: Added.
+
 2007-12-05  Rob Buis  <buis@kde.org>
 
         Reviewed by Mitz.
diff --git a/LayoutTests/media/video-display-toggle.html b/LayoutTests/media/video-display-toggle.html
new file mode 100644 (file)
index 0000000..9b708b7
--- /dev/null
@@ -0,0 +1,34 @@
+<html>
+    <head>
+        <script>            
+            function toggleDisplay()
+            {
+                var video = document.getElementById('vid');
+                if (video.style.display == "none")
+                    video.style.display = "inline-block";
+                else
+                    video.style.display = "none";
+                
+            }
+            function test()
+            {
+                if (window.layoutTestController)
+                    layoutTestController.waitUntilDone();
+                document.getElementById('vid').addEventListener("load", test2);    
+            }
+            function test2()
+            {
+                toggleDisplay();
+                toggleDisplay();
+
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone(); 
+            }
+        </script>
+    </head>
+    <body onload="test()">
+        This tests that toggling the display property won't make the controls disappear.<br>
+        <video id="vid" controls src="content/test.mp4"></video>
+    </body>
+</html>
+
diff --git a/LayoutTests/platform/mac/media/video-display-toggle-expected.checksum b/LayoutTests/platform/mac/media/video-display-toggle-expected.checksum
new file mode 100644 (file)
index 0000000..db0c22a
--- /dev/null
@@ -0,0 +1 @@
+0789af559988bfaa1c506059f5ac52e3
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/media/video-display-toggle-expected.png b/LayoutTests/platform/mac/media/video-display-toggle-expected.png
new file mode 100644 (file)
index 0000000..1f0f30e
Binary files /dev/null and b/LayoutTests/platform/mac/media/video-display-toggle-expected.png differ
diff --git a/LayoutTests/platform/mac/media/video-display-toggle-expected.txt b/LayoutTests/platform/mac/media/video-display-toggle-expected.txt
new file mode 100644 (file)
index 0000000..9661f1e
--- /dev/null
@@ -0,0 +1,29 @@
+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 493x18
+        text run at (0,0) width 493: "This tests that toggling the display property won't make the controls disappear."
+      RenderBR {BR} at (493,14) size 0x0
+      RenderVideo {VIDEO} at (0,18) size 320x240
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (8,26) size 320x240
+  RenderBlock (positioned) {DIV} at (8,26) size 320x240
+layer at (51,173) size 234x69
+  RenderBlock (positioned) {DIV} at (43,147) size 234x69 [bgcolor=#00000099] [border: (2px solid #EEEEEE)]
+layer at (135,180) size 66x40
+  RenderButton {INPUT} at (84,7) size 66x40 [color=#FFFFFF]
+    RenderBlock (anonymous) at (0,0) size 66x40
+      RenderText at (18,0) size 30x38
+        text run at (18,0) width 30: "\x{25B6}"
+layer at (58,219) size 220x16
+  RenderBlock (positioned) {DIV} at (7,46) size 220x16 [bgcolor=#EEEEEE]
+    RenderText {#text} at (165,0) size 50x15
+      text run at (165,0) width 50: "00:00:00"
+layer at (63,218) size 142x17
+  RenderSlider zI: 1 {INPUT} at (12,45) size 142x16 [border: (2px solid #FFFFFF)]
+layer at (65,221) size 15x15
+  RenderBlock (relative positioned) {DIV} at (2,2) size 15x15
index 67d702f..b34de6b 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-06  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Oliver.
+
+        Fix for <rdar://problem/5631356> Toggling display property on video causes controls to get lost
+
+        * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::attach): Call updateFromElement.
+        * html/HTMLMediaElement.h:
+
 2007-12-05  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Oliver.
index 98ceca9..39d5a49 100644 (file)
@@ -145,6 +145,16 @@ void HTMLMediaElement::removedFromDocument()
     HTMLElement::removedFromDocument();
 }
 
+void HTMLMediaElement::attach()
+{
+    ASSERT(!attached());
+
+    HTMLElement::attach();
+
+    if (renderer())
+        renderer()->updateFromElement();
+}
+
 void HTMLMediaElement::scheduleLoad()
 {
     m_loadTimer.startOneShot(0);
@@ -338,7 +348,6 @@ end:
     m_loadNestingLevel--;
 }
 
-
 void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*)
 {
     if (!m_begun || m_networkState == EMPTY)
index e01abfa..58efb61 100644 (file)
@@ -56,6 +56,7 @@ public:
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
+    virtual void attach();
     
     MediaPlayer* player() const { return m_player; }