<rdar://problem/9515650> 30 second rewind button obscured in fullscreen controller...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 May 2011 00:19:51 +0000 (00:19 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 May 2011 00:19:51 +0000 (00:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=61714

Reviewed by Darin Adler.

* dom/Document.cpp:
(WebCore::Document::webkitDidEnterFullScreenForElement): Call didBecomeFullscreenElement() on the
new full screen element.
(WebCore::Document::webkitWillExitFullScreenForElement): Call willStopBeingFullscreenElement() on
the full screen element.
* dom/Element.h:
(WebCore::Element::didBecomeFullscreenElement): Added with a default implementation that does nothing.
(WebCore::Element::willStopBeingFullscreenElement): Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didBecomeFullscreenElement): Added this override, which calls
MediaControls::enteredFullscreen().
(WebCore::HTMLMediaElement::willStopBeingFullscreenElement): Added this override, which calls
MediaControls::exitedFullscreen().
* html/HTMLMediaElement.h:
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlFullscreenButtonElement::preDispatchEventHandler): Removed calls to
enteredFullscreen() and exitedFullscreen() from here, since they are now called in response to
changes to the fullscreen-ness of the element.

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/shadow/MediaControlElements.cpp

index b4048beffbf55181ebb5921ccbf51639acf77c0f..7727668d27a78cc7be99a8802037b53fb0fa46b1 100644 (file)
@@ -1,3 +1,29 @@
+2011-05-29  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/9515650> 30 second rewind button obscured in fullscreen controller when video uses custom inline controls
+        https://bugs.webkit.org/show_bug.cgi?id=61714
+
+        * dom/Document.cpp:
+        (WebCore::Document::webkitDidEnterFullScreenForElement): Call didBecomeFullscreenElement() on the
+        new full screen element.
+        (WebCore::Document::webkitWillExitFullScreenForElement): Call willStopBeingFullscreenElement() on
+        the full screen element.
+        * dom/Element.h:
+        (WebCore::Element::didBecomeFullscreenElement): Added with a default implementation that does nothing.
+        (WebCore::Element::willStopBeingFullscreenElement): Ditto.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Added this override, which calls
+        MediaControls::enteredFullscreen().
+        (WebCore::HTMLMediaElement::willStopBeingFullscreenElement): Added this override, which calls
+        MediaControls::exitedFullscreen().
+        * html/HTMLMediaElement.h:
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlFullscreenButtonElement::preDispatchEventHandler): Removed calls to
+        enteredFullscreen() and exitedFullscreen() from here, since they are now called in response to
+        changes to the fullscreen-ness of the element.
+
 2011-05-29  Darin Adler  <darin@apple.com>
 
         Reviewed by Kevin Decker.
index 26e6a890aea88ffd8044cbdf30523e0b44e307c0..ad5f470e23ab500a564e7e01c29f563b6d63bece 100644 (file)
@@ -4905,7 +4905,7 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
     
 void Document::webkitDidEnterFullScreenForElement(Element*)
 {
-    ASSERT(m_fullScreenElement);
+    m_fullScreenElement->didBecomeFullscreenElement();
 
     if (m_fullScreenRenderer) {
 #if USE(ACCELERATED_COMPOSITING)
@@ -4924,6 +4924,8 @@ void Document::webkitWillExitFullScreenForElement(Element*)
 {
     setContainsFullScreenElementRecursively(ownerElement(), false);
     
+    m_fullScreenElement->willStopBeingFullscreenElement();
+
     if (m_fullScreenRenderer) {
         setAnimatingFullScreen(true);
 #if USE(ACCELERATED_COMPOSITING)
index 4d8c642e3b7f940548a04ae2762bd08283fce042..4a445323a91856ddb3788e4458e479617dfec59b 100644 (file)
@@ -279,6 +279,9 @@ public:
     // Use Document::registerForPrivateBrowsingStateChangedCallbacks() to subscribe to this.
     virtual void privateBrowsingStateDidChange() { }
 
+    virtual void didBecomeFullscreenElement() { }
+    virtual void willStopBeingFullscreenElement() { }
+
     bool isFinishedParsingChildren() const { return isParsingChildrenFinished(); }
     virtual void finishParsingChildren();
     virtual void beginParsingChildren();
index 68029ff106c6c5bc63d7f2dd6c366c0c2c50125f..d9efc39990962c696e805caf887f4be7947cc686 100644 (file)
@@ -2556,6 +2556,18 @@ void HTMLMediaElement::exitFullscreen()
     }
 }
 
+void HTMLMediaElement::didBecomeFullscreenElement()
+{
+    if (hasMediaControls())
+        mediaControls()->enteredFullscreen();
+}
+
+void HTMLMediaElement::willStopBeingFullscreenElement()
+{
+    if (hasMediaControls())
+        mediaControls()->exitedFullscreen();
+}
+
 PlatformMedia HTMLMediaElement::platformMedia() const
 {
     return m_player ? m_player->platformMedia() : NoPlatformMedia;
index bdb8df03161c92a4702f8d7ad8f8443621afcada..d352e44aee68ea6212e0350443f5e0a08c28be2b 100644 (file)
@@ -227,7 +227,10 @@ private:
     virtual void recalcStyle(StyleChange);
     
     virtual void defaultEventHandler(Event*);
-    
+
+    virtual void didBecomeFullscreenElement();
+    virtual void willStopBeingFullscreenElement();
+
     // ActiveDOMObject functions.
     virtual bool canSuspend() const;
     virtual void suspend(ReasonForSuspension);
index 1d3213a7d4839cb597d4604d79cc71928af93334..5b111800607968444c2f4c76cc06a6763872928c 100644 (file)
@@ -808,13 +808,10 @@ void* MediaControlFullscreenButtonElement::preDispatchEventHandler(Event* event)
         // video implementation without requiring them to implement their own full 
         // screen behavior.
         if (document()->settings() && document()->settings()->fullScreenEnabled()) {
-            if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == mediaElement()) {
+            if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == mediaElement())
                 document()->webkitCancelFullScreen();
-                m_controls->exitedFullscreen();
-            } else {
+            else
                 document()->requestFullScreenForElement(mediaElement(), 0, Document::ExemptIFrameAllowFulScreenRequirement);
-                m_controls->enteredFullscreen();
-            }
         } else
 #endif
             mediaElement()->enterFullscreen();