Bug 209610 - Swipe down gestures cause the video layer to stick for a moment before bouncing back into place
Summary: Swipe down gestures cause the video layer to stick for a moment before bounci...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-26 10:54 PDT by Peng Liu
Modified: 2020-03-27 13:57 PDT (History)
12 users (show)

See Also:


Attachments
Patch (2.46 KB, patch)
2020-03-26 11:07 PDT, Peng Liu
no flags Details | Formatted Diff | Diff
Revised the patch based on comments from Darin and Eric (2.73 KB, patch)
2020-03-26 13:08 PDT, Peng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peng Liu 2020-03-26 10:54:08 PDT
Swipe down gestures cause video layer to stick for a moment before bouncing back into place
Comment 1 Peng Liu 2020-03-26 10:56:03 PDT
<rdar://problem/55814988>
Comment 2 Peng Liu 2020-03-26 11:07:50 PDT
Created attachment 394629 [details]
Patch
Comment 3 Darin Adler 2020-03-26 11:15:16 PDT
Comment on attachment 394629 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394629&action=review

We *must* find a way to test these animations rather than just making code changes and manually trying it out each time. This has turned out to be a difficult area to code properly and seems likely we will continue to break it over and over again in the future. It’s worth lots of extra effort to find a way to test this. Even if we can’t do it right at this moment and need to land this fix first.

> Source/WebCore/html/HTMLMediaElement.cpp:6132
> +        scheduleEvent(eventNames().webkitendfullscreenEvent);

Is this correct in the case where we are about to call *enter*VideoFullscreenForVideoElement because m_videoFullscreenStandby is true?

> Source/WebCore/html/HTMLMediaElement.cpp:6138
>          else
> -            document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
> -        scheduleEvent(eventNames().webkitendfullscreenEvent);
> +            m_fullscreenTaskQueue.enqueueTask([this] {
> +                document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
> +            });

Change log does not make it clear why enqueing this on the task queue will properly sequence with the scheduled event. Is there something that makes sure that the events and the full screen task queue work in sequence?

Multiple-line else body gets braces in WebKit coding style.
Comment 4 Peng Liu 2020-03-26 12:51:31 PDT
Comment on attachment 394629 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394629&action=review

Completely agree with you that we need tests for the animation. But I need to complete a patch for webkit.org/b/203723 before we can add more tests for video fullscreen and PiP.

It is difficult to write reliable tests to test the animation itself, but we definitely can test the configurations related to animations in the WebCore side, e.g., the source/destination rect of animations. For this bug, such kind of tests can prevent regression in the future.

>> Source/WebCore/html/HTMLMediaElement.cpp:6132
>> +        scheduleEvent(eventNames().webkitendfullscreenEvent);
> 
> Is this correct in the case where we are about to call *enter*VideoFullscreenForVideoElement because m_videoFullscreenStandby is true?

When m_videoFullscreenStandby is true, this patch only changes the order to call scheduleEvent() and *enter*VideoFullscreenForVideoElement(). We will enter PiP when m_videoFullscreenStandby is true. It is a kind of exit fullscreen.

>> Source/WebCore/html/HTMLMediaElement.cpp:6138
>> +            });
> 
> Change log does not make it clear why enqueing this on the task queue will properly sequence with the scheduled event. Is there something that makes sure that the events and the full screen task queue work in sequence?
> 
> Multiple-line else body gets braces in WebKit coding style.

Unfortunately, this patch does not guarantee the things will happen in sequence. Eric proposed a solution: call exitVideoFullscreenForVideoElement() after HTMLElement::dispatchEvent(event) in HTMLMediaElement::dispatchEvent(). I will upload a new patch based on his solution.

Sorry, will fix the style issue.
Comment 5 Peng Liu 2020-03-26 13:08:31 PDT
Created attachment 394647 [details]
Revised the patch based on comments from Darin and Eric
Comment 6 EWS 2020-03-26 17:13:30 PDT
Committed r259095: <https://trac.webkit.org/changeset/259095>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394647 [details].