2011-04-11 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 22:46:01 +0000 (22:46 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 22:46:01 +0000 (22:46 +0000)
        Reviewed by Simon Fraser.

        REGRESSION: Vimeo fullscreen video displays incorrectly
        https://bugs.webkit.org/show_bug.cgi?id=58291

        * fullscreen/video-specified-size-expected.txt: Added.
        * fullscreen/video-specified-size.html: Added.
        * fullscreen/full-screen-test.js:
        * fullscreen/full-screen-zIndex-expected.txt: Added.
        * fullscreen/full-screen-zIndex.html: Added.
        * platform/mac/fullscreen/full-screen-zIndex-expected.checksum: Added.
        * platform/mac/fullscreen/full-screen-zIndex-expected.png: Added.
2011-04-11  Jer Noble  <jer.noble@apple.com>

        Reviewed by Simon Fraser.

        REGRESSION: Vimeo fullscreen video displays incorrectly
        https://bugs.webkit.org/show_bug.cgi?id=58291

        Set the RenderFullScreen's zIndex to the max.  And make sure to override
        a video element's specified width and height by making its full screen rules
        important.  Also, always show the controls when a media element is in full
        screen mode.

        Test: fullscreen/video-specified-size.html
        Test: fullscreen/full-screen-zIndex.html

        * css/fullscreen.css:
        (video:-webkit-full-screen):
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::controls): Always show controls in full screen mode.
        (WebCore::HTMLMediaElement::preDispatchEventHandler): Added. Handle the fullscreen
            change event and hide or show the controls accordingly.
        * html/HTMLMediaElement.h:
        * rendering/RenderFullScreen.cpp:
        (RenderFullScreen::createFullScreenStyle): Set the zIndex to INT_MAX and use a
            vertical flexbox instead of a horizontal one.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fullscreen/full-screen-test.js
LayoutTests/fullscreen/full-screen-zIndex-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-zIndex.html [new file with mode: 0644]
LayoutTests/fullscreen/video-specified-size-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/video-specified-size.html [new file with mode: 0644]
LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/fullscreen.css
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/rendering/RenderFullScreen.cpp

index d2a653f..1b2aef0 100644 (file)
@@ -1,3 +1,18 @@
+2011-04-11  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        REGRESSION: Vimeo fullscreen video displays incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=58291
+
+        * fullscreen/video-specified-size-expected.txt: Added.
+        * fullscreen/video-specified-size.html: Added.
+        * fullscreen/full-screen-test.js:
+        * fullscreen/full-screen-zIndex-expected.txt: Added.
+        * fullscreen/full-screen-zIndex.html: Added.
+        * platform/mac/fullscreen/full-screen-zIndex-expected.checksum: Added.
+        * platform/mac/fullscreen/full-screen-zIndex-expected.png: Added.
+
 2011-04-12  Yael Aharon  <yael.aharon@nokia.com>
 
         Unreviewed.
index ac94091..b714f08 100644 (file)
@@ -1,9 +1,10 @@
 var console = null;
 var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
+var runPixelTests;
 
 logConsole();
 
-if (window.layoutTestController) {
+if (!runPixelTests && window.layoutTestController) {
     layoutTestController.dumpAsText();
     layoutTestController.waitUntilDone();
 }
@@ -80,9 +81,9 @@ function reportExpected(success, testFuncString, comparison, expected, observed)
     logResult(success, msg);
 }
 
-function waitForEventAndEnd(eventName, funcString)
+function waitForEventAndEnd(element, eventName, funcString)
 {
-    waitForEvent(eventName, funcString, true)
+    waitForEvent(element, eventName, funcString, true)
 }
 
 function waitForEvent(element, eventName, func, endit)
diff --git a/LayoutTests/fullscreen/full-screen-zIndex-expected.txt b/LayoutTests/fullscreen/full-screen-zIndex-expected.txt
new file mode 100644 (file)
index 0000000..0e6626e
--- /dev/null
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x114
+  RenderBlock {HTML} at (0,0) size 800x114
+    RenderBody {BODY} at (8,8) size 784x98
+      RenderBlock {DIV} at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 757x37
+          text run at (0,0) width 557: "This tests that an element with a positive z-index appears behind the full screen element. "
+          text run at (557,0) width 200: "After entering full screen mode,"
+          text run at (0,19) width 224: "only a green box should be visible. "
+          text run at (224,19) width 38: "Click "
+        RenderButton {BUTTON} at (264,20) size 89x18 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          RenderBlock (anonymous) at (8,2) size 73x13
+            RenderText {#text} at (0,0) size 73x13
+              text run at (0,0) width 73: "go full screen"
+        RenderText {#text} at (355,19) size 93x18
+          text run at (355,19) width 93: " to run the test."
+layer at (58,73) size 108x58
+  RenderBlock (relative positioned) zI: 500 {DIV} at (0,40) size 108x58 [bgcolor=#FF0000] [border: (4px solid #8B0000)]
+layer at (0,0) size 800x600
+  RenderFullScreen zI: 2147483647 at (0,0) size 800x600 [bgcolor=#000000]
+    RenderBlock {DIV} at (296,246) size 208x108 [bgcolor=#008000] [border: (4px solid #006400)]
diff --git a/LayoutTests/fullscreen/full-screen-zIndex.html b/LayoutTests/fullscreen/full-screen-zIndex.html
new file mode 100644 (file)
index 0000000..2d0d7ca
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script>
+            var runPixelTests = true;
+            
+            function init() {
+                // Bail out early if the full screen API is not enabled or is missing:
+                if (Element.prototype.webkitRequestFullScreen == undefined) {
+                    logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+                    endTest();
+                } else {
+                    waitForEventAndEnd(document, 'webkitfullscreenchange');
+                    runWithKeyDown(goFullScreen);
+                }
+            }
+            
+            function goFullScreen() {
+                document.getElementById('block1').webkitRequestFullScreen();
+            }
+        </script>
+        <script src="full-screen-test.js"></script>
+        <style>
+            #block1 {
+                width: 200px;
+                height: 100px;
+                border: 4px solid darkgreen;
+                background-color: green;
+            }
+            #block2 {
+                width: 100px;
+                height: 50px;
+                border: 4px solid darkred;
+                background-color: red;
+                z-index: 500;
+                position: relative;
+                left: 50px;
+                top: 25px;
+            }
+        </style>
+    </head>
+    <body onload="init()">
+        <div>This tests that an element with a positive z-index appears behind the full screen element.  
+             After entering full screen mode, only a green box should be visible.
+             Click <button onclick="goFullScreen()">go full screen</button> to run the test.</div>
+        <div id="block2"></div>
+        <div id="block1"></div>
+    </body>
\ No newline at end of file
diff --git a/LayoutTests/fullscreen/video-specified-size-expected.txt b/LayoutTests/fullscreen/video-specified-size-expected.txt
new file mode 100644 (file)
index 0000000..6b8700d
--- /dev/null
@@ -0,0 +1,3 @@
+EVENT(webkitfullscreenchange) TEST(video.clientWidth==document.width) OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/video-specified-size.html b/LayoutTests/fullscreen/video-specified-size.html
new file mode 100644 (file)
index 0000000..818706e
--- /dev/null
@@ -0,0 +1,18 @@
+<body>
+    <video id="video" width="300" controls></video>
+    <script src="full-screen-test.js"></script>
+    <script src=../media/media-file.js></script>
+    <script>
+        setSrcById("video", findMediaFile("video", "../media/content/test"));
+        var video = document.getElementById('video');
+
+        // Bail out early if the full screen API is not enabled or is missing:
+        if (Element.prototype.webkitRequestFullScreen == undefined) {
+            logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+            endTest();
+        } else {
+            waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video.clientWidth==document.width");
+            runWithKeyDown(function(){video.webkitRequestFullScreen()});
+        }
+    </script>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.checksum b/LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.checksum
new file mode 100644 (file)
index 0000000..6bd5e18
--- /dev/null
@@ -0,0 +1 @@
+129c6c8b636c0633a17868b2e7cf9451
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.png b/LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.png
new file mode 100644 (file)
index 0000000..297e412
Binary files /dev/null and b/LayoutTests/platform/mac/fullscreen/full-screen-zIndex-expected.png differ
index 5284a5e..e658f65 100644 (file)
@@ -1,3 +1,29 @@
+2011-04-11  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        REGRESSION: Vimeo fullscreen video displays incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=58291
+
+        Set the RenderFullScreen's zIndex to the max.  And make sure to override
+        a video element's specified width and height by making its full screen rules
+        important.  Also, always show the controls when a media element is in full
+        screen mode.
+
+        Test: fullscreen/video-specified-size.html
+        Test: fullscreen/full-screen-zIndex.html
+
+        * css/fullscreen.css:
+        (video:-webkit-full-screen): 
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::controls): Always show controls in full screen mode.
+        (WebCore::HTMLMediaElement::preDispatchEventHandler): Added. Handle the fullscreen
+            change event and hide or show the controls accordingly.
+        * html/HTMLMediaElement.h:
+        * rendering/RenderFullScreen.cpp:
+        (RenderFullScreen::createFullScreenStyle): Set the zIndex to INT_MAX and use a 
+            vertical flexbox instead of a horizontal one.
+
 2011-04-12  Chris Marrin  <cmarrin@apple.com>
 
         Reviewed by Simon Fraser.
index 2e38c95..537024c 100644 (file)
@@ -7,10 +7,13 @@
 }
 
 video:-webkit-full-screen {
-    background-color: black;
-    width: auto;   
-    height: 100%;
-    max-width: 100%;
+    background-color: black !important;
+    position: static !important;
+    margin: 0 !important;
+    height: 100% !important;
+    width: 100% !important;
+    -webkit-box-flex: 1 !important;
+    display: block !important;
 }
 
 img:-webkit-full-screen {
index 1778216..0a9ccf5 100644 (file)
@@ -1492,6 +1492,10 @@ bool HTMLMediaElement::controls() const
     if (isVideo() && document()->page() && document()->page()->chrome()->requiresFullscreenForVideoPlayback())
         return true;
 
+    // Always show controls when in full screen mode.
+    if (isFullscreen())
+        return true;
+
     return hasAttribute(controlsAttr);
 }
 
@@ -2651,6 +2655,22 @@ void HTMLMediaElement::ensureMediaControls()
     ensureShadowRoot()->appendChild(MediaControlRootElement::create(this), ec);
 }
 
+void* HTMLMediaElement::preDispatchEventHandler(Event* event) 
+{
+    if (event && event->type() == eventNames().webkitfullscreenchangeEvent) {
+        if (controls()) {
+            if (!hasMediaControls()) {
+                ensureMediaControls();
+                mediaControls()->reset();
+            }
+            mediaControls()->show();
+        } else if (hasMediaControls())
+            mediaControls()->hide();
+    }
+    return 0;
+}
+
+
 }
 
 #endif
index cfd38a6..837aa33 100644 (file)
@@ -326,6 +326,8 @@ private:
     bool hasMediaControls();
     void ensureMediaControls();
 
+    virtual void* preDispatchEventHandler(Event*);
+
     Timer<HTMLMediaElement> m_loadTimer;
     Timer<HTMLMediaElement> m_asyncEventTimer;
     Timer<HTMLMediaElement> m_progressEventTimer;
index a685064..476727d 100644 (file)
@@ -46,7 +46,7 @@ PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
     RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle();
 
     // Create a stacking context:
-    fullscreenStyle->setZIndex(0);
+    fullscreenStyle->setZIndex(INT_MAX);
 
     fullscreenStyle->setFontDescription(FontDescription());
     fullscreenStyle->font().update(0);
@@ -54,7 +54,7 @@ PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
     fullscreenStyle->setDisplay(BOX);
     fullscreenStyle->setBoxPack(BCENTER);
     fullscreenStyle->setBoxAlign(BCENTER);
-    fullscreenStyle->setBoxOrient(HORIZONTAL);
+    fullscreenStyle->setBoxOrient(VERTICAL);
     
     fullscreenStyle->setPosition(FixedPosition);
     fullscreenStyle->setWidth(Length(100.0, Percent));