Title: [259095] trunk/Source/WebCore
Revision
259095
Author
peng.l...@apple.com
Date
2020-03-26 17:13:25 -0700 (Thu, 26 Mar 2020)

Log Message

Swipe down gestures cause the video layer to stick for a moment before bouncing back into place
https://bugs.webkit.org/show_bug.cgi?id=209610

Reviewed by Eric Carlson.

Fix an exit fullscreen animation issue by firing the end fullscreen event
to let the page change the video element back to its original position/size
before exiting fullscreen.

Covered by existing tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::dispatchEvent):
(WebCore::HTMLMediaElement::exitFullscreen):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259094 => 259095)


--- trunk/Source/WebCore/ChangeLog	2020-03-27 00:11:31 UTC (rev 259094)
+++ trunk/Source/WebCore/ChangeLog	2020-03-27 00:13:25 UTC (rev 259095)
@@ -1,3 +1,20 @@
+2020-03-26  Peng Liu  <peng.l...@apple.com>
+
+        Swipe down gestures cause the video layer to stick for a moment before bouncing back into place
+        https://bugs.webkit.org/show_bug.cgi?id=209610
+
+        Reviewed by Eric Carlson.
+
+        Fix an exit fullscreen animation issue by firing the end fullscreen event
+        to let the page change the video element back to its original position/size
+        before exiting fullscreen.
+
+        Covered by existing tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::dispatchEvent):
+        (WebCore::HTMLMediaElement::exitFullscreen):
+
 2020-03-26  Michael Catanzaro  <mcatanz...@gnome.org>
 
         Fix various compiler warnings

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (259094 => 259095)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-27 00:11:31 UTC (rev 259094)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-27 00:13:25 UTC (rev 259095)
@@ -5877,6 +5877,14 @@
         document().userActivatedMediaFinishedPlaying();
 
     HTMLElement::dispatchEvent(event);
+
+    // Some pages may change the position/size of an inline video element
+    // when/after the video element enters fullscreen (rdar://problem/55814988).
+    // We need to fire the end fullscreen event to notify the page
+    // to change the position/size back *before* exiting fullscreen.
+    // Otherwise, the exit fullscreen animation will be incorrect.
+    if (!m_videoFullscreenStandby && event.type() == eventNames().webkitendfullscreenEvent)
+        document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
 }
 
 bool HTMLMediaElement::addEventListener(const AtomString& eventType, Ref<EventListener>&& listener, const AddEventListenerOptions& options)
@@ -6126,8 +6134,7 @@
     if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
         if (m_videoFullscreenStandby)
             document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
-        else
-            document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
+
         scheduleEvent(eventNames().webkitendfullscreenEvent);
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to