Title: [122035] trunk
Revision
122035
Author
[email protected]
Date
2012-07-06 14:40:59 -0700 (Fri, 06 Jul 2012)

Log Message

[BlackBerry] exitFullScreenForElement() is not working for fullscreen elements in iframes
https://bugs.webkit.org/show_bug.cgi?id=90327

Patch by Max Feil <[email protected]> on 2012-07-06
Reviewed by Antonio Gomes.

Source/WebKit/blackberry:

Fix exit fullscreen problem for elements in iframes. The
exitFullScreenForElement() call is passed a null element in
this case, instead of the original element which entered
fullscreen. If you look in Document.cpp you can see the
exitFullScreenForElement() call being made on the topDocument
(which has a null m_fullScreenElement) instead of the iframe's
document.

The Chromium and Windows ports get around this problem by
storing either the fullscreen element or its frame during
enterFullScreenForElement(), so I will bring the BlackBerry port
in line with this. See also bug 89817.

* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
(WebCore::ChromeClientBlackBerry::exitFullScreenForElement):
* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):

LayoutTests:

Test of exit fullscreen for an iframe.

* fullscreen/exit-full-screen-iframe-expected.txt: Added.
* fullscreen/exit-full-screen-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122034 => 122035)


--- trunk/LayoutTests/ChangeLog	2012-07-06 20:43:20 UTC (rev 122034)
+++ trunk/LayoutTests/ChangeLog	2012-07-06 21:40:59 UTC (rev 122035)
@@ -1,3 +1,15 @@
+2012-07-06  Max Feil  <[email protected]>
+
+        [BlackBerry] exitFullScreenForElement() is not working for fullscreen elements in iframes
+        https://bugs.webkit.org/show_bug.cgi?id=90327
+
+        Reviewed by Antonio Gomes.
+
+        Test of exit fullscreen for an iframe.
+
+        * fullscreen/exit-full-screen-iframe-expected.txt: Added.
+        * fullscreen/exit-full-screen-iframe.html: Added.
+
 2012-07-06  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening, skip new failing tests.

Added: trunk/LayoutTests/fullscreen/exit-full-screen-iframe-expected.txt (0 => 122035)


--- trunk/LayoutTests/fullscreen/exit-full-screen-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/exit-full-screen-iframe-expected.txt	2012-07-06 21:40:59 UTC (rev 122035)
@@ -0,0 +1,10 @@
+Test for bug 90327: webkitCancelFullScreen for iframes
+
+To test manually, click the "Go full screen" button - the page should enter full screen mode and immediately exit again, without crashing.
+
+EVENT(webkitfullscreenchange)
+TEST(document.getElementById('frame').contentDocument.webkitIsFullScreen==true) OK
+EVENT(webkitfullscreenchange)
+TEST(document.getElementById('frame').contentDocument.webkitIsFullScreen==false) OK
+END OF TEST
+

Added: trunk/LayoutTests/fullscreen/exit-full-screen-iframe.html (0 => 122035)


--- trunk/LayoutTests/fullscreen/exit-full-screen-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/exit-full-screen-iframe.html	2012-07-06 21:40:59 UTC (rev 122035)
@@ -0,0 +1,31 @@
+<p>Test for <a href="" 90327</a>: 
+webkitCancelFullScreen for iframes</p>
+<p>To test manually, click the "Go full screen" button - the page should enter full screen mode and immediately exit again, without crashing.</p>
+<script src=""
+<script>
+function runTest() {
+    var frame = document.getElementById('frame');
+
+    waitForEventOnce(frame.contentDocument, 'webkitfullscreenchange', function() {
+        test("document.getElementById('frame').contentDocument.webkitIsFullScreen==true")
+        waitForEventOnce(frame.contentDocument, 'webkitfullscreenchange', function() {
+            test("document.getElementById('frame').contentDocument.webkitIsFullScreen==false")
+            endTest();
+        });
+
+        document.webkitCancelFullScreen();
+    });
+
+    runWithKeyDown(function() {
+
+        setTimeout(function() {
+            consoleWrite("FAIL - did not enter and exit full screen in time!");
+            endTest();
+        }, 100);
+
+        frame.contentDocument.documentElement.webkitRequestFullScreen();
+    });
+}
+</script>
+<iframe id="frame" src="" width="300" height="100" _onload_="runTest()" webkitallowfullscreen>
+</iframe>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (122034 => 122035)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-07-06 20:43:20 UTC (rev 122034)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-07-06 21:40:59 UTC (rev 122035)
@@ -3728,3 +3728,6 @@
 BUGWK88171 WIN : css1/formatting_model/floating_elements.html = IMAGE
 
 BUGWK90517 WIN : svg/W3C-I18N/tspan-dirRTL-ubNone-in-default-context.svg = PASS CRASH
+
+// webkitIsFullScreen does not have the correct value after an iframe exits fullscreen
+BUGWK90704 : fullscreen/exit-full-screen-iframe.html = TEXT

Modified: trunk/Source/WebKit/blackberry/ChangeLog (122034 => 122035)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-06 20:43:20 UTC (rev 122034)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-06 21:40:59 UTC (rev 122035)
@@ -1,3 +1,29 @@
+2012-07-06  Max Feil  <[email protected]>
+
+        [BlackBerry] exitFullScreenForElement() is not working for fullscreen elements in iframes
+        https://bugs.webkit.org/show_bug.cgi?id=90327
+
+        Reviewed by Antonio Gomes.
+
+        Fix exit fullscreen problem for elements in iframes. The
+        exitFullScreenForElement() call is passed a null element in
+        this case, instead of the original element which entered
+        fullscreen. If you look in Document.cpp you can see the
+        exitFullScreenForElement() call being made on the topDocument
+        (which has a null m_fullScreenElement) instead of the iframe's
+        document.
+
+        The Chromium and Windows ports get around this problem by
+        storing either the fullscreen element or its frame during
+        enterFullScreenForElement(), so I will bring the BlackBerry port
+        in line with this. See also bug 89817.
+
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::enterFullScreenForElement):
+        (WebCore::ChromeClientBlackBerry::exitFullScreenForElement):
+        * WebCoreSupport/ChromeClientBlackBerry.h:
+        (ChromeClientBlackBerry):
+
 2012-07-06  Benjamin C Meyer  <[email protected]>
 
         Add an API to explicitly call a _javascript_ function with args.

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp (122034 => 122035)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp	2012-07-06 20:43:20 UTC (rev 122034)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp	2012-07-06 21:40:59 UTC (rev 122035)
@@ -727,13 +727,19 @@
     element->document()->webkitWillEnterFullScreenForElement(element);
     m_webPagePrivate->enterFullScreenForElement(element);
     element->document()->webkitDidEnterFullScreenForElement(element);
+    m_fullScreenElement = element;
 }
 
-void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element* element)
+void ChromeClientBlackBerry::exitFullScreenForElement(WebCore::Element*)
 {
-    element->document()->webkitWillExitFullScreenForElement(element);
-    m_webPagePrivate->exitFullScreenForElement(element);
-    element->document()->webkitDidExitFullScreenForElement(element);
+    // The element passed into this function is not reliable, i.e. it could
+    // be null. In addition the parameter may be disappearing in the future.
+    // So we use the reference to the element we saved above.
+    ASSERT(m_fullScreenElement);
+    m_fullScreenElement->document()->webkitWillExitFullScreenForElement(m_fullScreenElement.get());
+    m_webPagePrivate->exitFullScreenForElement(m_fullScreenElement.get());
+    m_fullScreenElement->document()->webkitDidExitFullScreenForElement(m_fullScreenElement.get());
+    m_fullScreenElement.clear();
 }
 
 void ChromeClientBlackBerry::fullScreenRendererChanged(RenderBox* fullScreenRenderer)

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h (122034 => 122035)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h	2012-07-06 20:43:20 UTC (rev 122034)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h	2012-07-06 21:40:59 UTC (rev 122035)
@@ -168,6 +168,7 @@
 
 private:
     BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
+    RefPtr<WebCore::Element> m_fullScreenElement;
 };
 
 } // WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to