2011-05-17 Jeremy Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2011 06:12:12 +0000 (06:12 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2011 06:12:12 +0000 (06:12 +0000)
        Reviewed by Darin Adler.

        Removing a full-screen element or ancestor from the DOM should trigger exiting full-screen mode.
        https://bugs.webkit.org/show_bug.cgi?id=60997

        Updated the following tests with the new expectation that removing an element from the DOM will trigger
        full screen mode to exit.

        * fullscreen/full-screen-remove-ancestor-expected.txt:
        * fullscreen/full-screen-remove-ancestor.html:
        * fullscreen/full-screen-remove-children-expected.txt:
        * fullscreen/full-screen-remove-children.html:
        * fullscreen/full-screen-remove-expected.txt:
        * fullscreen/full-screen-remove.html:
2011-05-17  Jeremy Noble  <jer.noble@apple.com>

        Reviewed by Darin Adler.

        Removing a full-screen element or ancestor from the DOM should trigger exiting full-screen mode.
        https://bugs.webkit.org/show_bug.cgi?id=60997

        Tests: fullscreen/full-screen-remove-ancestor.html
               fullscreen/full-screen-remove-children.html
               fullscreen/full-screen-remove.html

        * dom/Document.cpp:
        (WebCore::Document::fullScreenChangeDelayTimerFired): If the target node was removed from the document
            make sure to message the documentElement() as well.
        (WebCore::Document::fullScreenElementRemoved): Cancel full screen mode.

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

LayoutTests/ChangeLog
LayoutTests/fullscreen/full-screen-remove-ancestor-expected.txt
LayoutTests/fullscreen/full-screen-remove-ancestor.html
LayoutTests/fullscreen/full-screen-remove-children-expected.txt
LayoutTests/fullscreen/full-screen-remove-children.html
LayoutTests/fullscreen/full-screen-remove-expected.txt
LayoutTests/fullscreen/full-screen-remove.html
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp

index 927be0e..1f7fd33 100644 (file)
@@ -1,3 +1,20 @@
+2011-05-17  Jeremy Noble  <jer.noble@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Removing a full-screen element or ancestor from the DOM should trigger exiting full-screen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=60997
+
+        Updated the following tests with the new expectation that removing an element from the DOM will trigger
+        full screen mode to exit.
+
+        * fullscreen/full-screen-remove-ancestor-expected.txt:
+        * fullscreen/full-screen-remove-ancestor.html:
+        * fullscreen/full-screen-remove-children-expected.txt:
+        * fullscreen/full-screen-remove-children.html:
+        * fullscreen/full-screen-remove-expected.txt:
+        * fullscreen/full-screen-remove.html:
+
 2011-05-17  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [Qt] Skip failing tests on minor Qt platforms.
index d9a0ab3..d84e206 100644 (file)
@@ -1,6 +1,6 @@
 EVENT(webkitfullscreenchange)
 EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
 EVENT(webkitfullscreenchange)
-EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
 END OF TEST
 
index 10670fd..26f4ed7 100644 (file)
         var div = span.parentNode;
 
         var spanEnteredFullScreen = function(event) {
-            callback = documentEnteredFullScreen;
+            callback = spanExitedFullScreen;
             testExpected("document.webkitCurrentFullScreenElement", span);
             document.body.removeChild(div);
         };
 
-        var documentEnteredFullScreen = function(event) {
+        var spanExitedFullScreen = function(event) {
             callback = null;
-            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            testExpected("document.webkitCurrentFullScreenElement", null);
             endTest();
         };
 
index d9a0ab3..d84e206 100644 (file)
@@ -1,6 +1,6 @@
 EVENT(webkitfullscreenchange)
 EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
 EVENT(webkitfullscreenchange)
-EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
 END OF TEST
 
index a210206..627dc5d 100644 (file)
         var div = span.parentNode;
 
         var spanEnteredFullScreen = function(event) {
-            callback = documentEnteredFullScreen;
+            callback = spanExitedFullScreen;
             testExpected("document.webkitCurrentFullScreenElement", span);
             div.innerHTML = "";
         };
 
-        var documentEnteredFullScreen = function(event) {
+        var spanExitedFullScreen = function(event) {
             callback = null;
-            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            testExpected("document.webkitCurrentFullScreenElement", null);
             endTest();
         };
 
index d9a0ab3..d84e206 100644 (file)
@@ -1,6 +1,6 @@
 EVENT(webkitfullscreenchange)
 EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLElement]') OK
 EVENT(webkitfullscreenchange)
-EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLHtmlElement]') OK
+EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
 END OF TEST
 
index a3f46e4..b556cdb 100644 (file)
         var span = document.getElementsByTagName('span')[0];
     
         var spanEnteredFullScreen = function(event) {
-            callback = documentEnteredFullScreen;
+            callback = spanExitedFullScreen;
             testExpected("document.webkitCurrentFullScreenElement", span);
             span.parentNode.removeChild(span);
         };
     
-        var documentEnteredFullScreen = function(event) {
+        var spanExitedFullScreen = function(event) {
             callback = null;
-            testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
+            testExpected("document.webkitCurrentFullScreenElement", null);
             endTest();
         };
     
index fef502d..127fd3b 100644 (file)
@@ -1,3 +1,19 @@
+2011-05-17  Jeremy Noble  <jer.noble@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Removing a full-screen element or ancestor from the DOM should trigger exiting full-screen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=60997
+
+        Tests: fullscreen/full-screen-remove-ancestor.html
+               fullscreen/full-screen-remove-children.html
+               fullscreen/full-screen-remove.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::fullScreenChangeDelayTimerFired): If the target node was removed from the document
+            make sure to message the documentElement() as well.
+        (WebCore::Document::fullScreenElementRemoved): Cancel full screen mode.
+
 2011-05-17  Yuta Kitamura  <yutak@chromium.org>
 
         Reviewed by Kent Tamura.
index 13c7cb6..037a0ba 100644 (file)
@@ -4987,26 +4987,16 @@ void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
             element = documentElement();
         
         element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
+
+        // If the element was removed from our tree, also message the documentElement.
+        if (!contains(element.get()))
+            m_fullScreenChangeEventTargetQueue.append(documentElement());
     }
 }
 
 void Document::fullScreenElementRemoved()
 {
-    // If the current full screen element or any of its ancestors is removed, set the current
-    // full screen element to the document root, and fire a fullscreenchange event to inform 
-    // clients of the DOM.
-    if (m_fullScreenRenderer)
-        m_fullScreenRenderer->remove();
-    setFullScreenRenderer(0);
-
-    m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release());
-    m_fullScreenElement = documentElement();
-    recalcStyle(Force);
-    
-    // Dispatch this event manually, before the element is actually removed from the DOM
-    // so that the message cascades as expected.
-    fullScreenChangeDelayTimerFired(&m_fullScreenChangeDelayTimer);
-    m_fullScreenChangeDelayTimer.stop();
+    webkitCancelFullScreen();
 }
 
 void Document::removeFullScreenElementOfSubtree(Node* node, bool amongChildrenOnly)