Bug 182668 - Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners.
Summary: Removing the controls attribute from a <video> element does not tear down the...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-09 22:12 PST by Jer Noble
Modified: 2018-02-22 22:03 PST (History)
5 users (show)

See Also:


Attachments
Patch (38.58 KB, patch)
2018-02-09 22:17 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (46.85 KB, patch)
2018-02-09 22:53 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-sierra-wk2 (2.63 MB, application/zip)
2018-02-09 23:58 PST, EWS Watchlist
no flags Details
Patch (47.60 KB, patch)
2018-02-12 09:32 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (28.19 KB, patch)
2018-02-13 16:47 PST, Antoine Quint
jer.noble: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2018-02-09 22:12:04 PST
Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners.
Comment 1 Jer Noble 2018-02-09 22:12:41 PST
<rdar://problem/33793004>
Comment 2 Jer Noble 2018-02-09 22:17:49 PST
Created attachment 333553 [details]
Patch
Comment 3 Jer Noble 2018-02-09 22:53:44 PST
Created attachment 333554 [details]
Patch
Comment 4 EWS Watchlist 2018-02-09 23:58:45 PST
Comment on attachment 333554 [details]
Patch

Attachment 333554 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/6443628

New failing tests:
http/tests/contentextensions/text-track-blocked.html
Comment 5 EWS Watchlist 2018-02-09 23:58:46 PST
Created attachment 333555 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 Antoine Quint 2018-02-10 01:35:23 PST
So, we already do the right thing when entering or exiting fullscreen on iOS:

    _updateiOSFullscreenProperties()
    {
        // On iOS, we want to make sure not to update controls when we're in fullscreen since the UI
        // will be completely invisible.
        if (!(this.layoutTraits & LayoutTraits.iOS))
            return;

        const isFullscreen = this.isFullscreen;
        if (isFullscreen)
            this._supportingObjects.forEach(supportingObject => supportingObject.disable());
        else
            this._supportingObjects.forEach(supportingObject => supportingObject.enable());

        this.controls.visible = !isFullscreen;
    }

Sounds to me like we could extend this to dealing with changes to the controls attribute as well. Setting .visible on the controls will not remove the controls element itself but will prevent any content from being added to its subtree and so the shadow root will be mostly empty.
Comment 7 Jer Noble 2018-02-10 07:18:02 PST
> Sounds to me like we could extend this to dealing with changes to the
> controls attribute as well. Setting .visible on the controls will not remove
> the controls element itself but will prevent any content from being added to
> its subtree and so the shadow root will be mostly empty.

It’s a bigger issue than that; we set up all the controls and listeners and repaint timers even when there’s just a visible text track, and the media element never had the controls attribute in the first place. Though we should definitely disable all the listeners when the controls are invisible, but that is a separate bug.
Comment 8 Jer Noble 2018-02-12 09:32:06 PST
Created attachment 333599 [details]
Patch
Comment 9 Antoine Quint 2018-02-12 15:46:47 PST
There were some issues with Jer's patch, specifically LTR state wouldn't be preserved when turning controls back on and the AirPlay and PiP placards wouldn't be displayed. I have a patch coming up that addresses the reported issues and preserves LTR and placards.
Comment 10 Antoine Quint 2018-02-13 16:47:23 PST
Created attachment 333745 [details]
Patch
Comment 11 Jer Noble 2018-02-13 17:07:08 PST
Comment on attachment 333745 [details]
Patch

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

Do we have a test for verifying that the AirPlay plackard is shown when initiating remote playback from a media element without a controls attribute?

> Source/WebCore/Modules/modern-media-controls/media/placard-support.js:51
> +        if (this.mediaController.isFullscreen)

Does this need an iOS check? Presumably we still want the placards in Mac full screen?
Comment 12 Antoine Quint 2018-02-13 17:09:20 PST
(In reply to Jer Noble from comment #11)
> Comment on attachment 333745 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=333745&action=review
> 
> Do we have a test for verifying that the AirPlay plackard is shown when
> initiating remote playback from a media element without a controls attribute?
> 
> > Source/WebCore/Modules/modern-media-controls/media/placard-support.js:51
> > +        if (this.mediaController.isFullscreen)
> 
> Does this need an iOS check? Presumably we still want the placards in Mac
> full screen?

This code wouldn't be called on macOS fullscreen since controls will be forced in that scenario.
Comment 13 Antoine Quint 2018-02-13 17:36:27 PST
Committed r228445: <https://trac.webkit.org/changeset/228445>
Comment 14 Antoine Quint 2018-02-15 05:56:29 PST
This caused a regression on iOS where controls were no longer disabled while in fullscreen, see https://bugs.webkit.org/show_bug.cgi?id=182830. EWS didn't catch the failure but internal bots did since the test for this behaviour only runs internally due to usage of touch events.
Comment 15 Antoine Quint 2018-02-22 22:03:17 PST
This caused https://bugs.webkit.org/show_bug.cgi?id=183074.