Bug 227951

Summary: [WPE] Implement fullscreen in WPEView
Product: WebKit Reporter: Imanol Fernandez <ifernandez>
Component: WPE WebKitAssignee: Imanol Fernandez <ifernandez>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, lmoura
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/WebPlatformForEmbedded/libwpe/pull/86
https://github.com/Igalia/cog/pull/329
https://bugs.webkit.org/show_bug.cgi?id=229380
Bug Depends on: 228793    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Imanol Fernandez 2021-07-14 07:27:32 PDT
Implement fullscreen in WPEView:
- Notify DOM fullscreen enter request to libwpe
- Handle exit fullscreen from libwpe
Comment 1 Imanol Fernandez 2021-07-14 09:09:15 PDT
Created attachment 433505 [details]
Patch

wip
Comment 2 Imanol Fernandez 2021-07-19 08:27:08 PDT
Created attachment 433792 [details]
Patch

Update to latest libwpe API
Comment 3 Adrian Perez 2021-07-27 04:35:19 PDT
As for the WPE build failure, we will need to land the new API
in libwpe first, and then update the Flatpak SDK to build a newer
revision of libwpe. We should do that in a separate patch that only
touches the SDK build recipes :)
Comment 4 Adrian Perez 2021-08-04 13:10:26 PDT
Comment on attachment 433792 [details]
Patch

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

> Source/WebKit/UIProcess/API/wpe/WPEView.cpp:260
> +#if ENABLE(FULLSCREEN_API)

It would be good to make guards check also WPE_CHECK_VERSION(1, 11, 1)
to make it possible to build WebKit using older libwpe versions.

> Source/WebKit/UIProcess/API/wpe/WPEView.cpp:291
> +    wpe_view_backend_set_dom_fullscreen_client(m_backend, &s_fullscreenClient, this);

You will need to adapt this to the function name changes in the version
of the libwpe PR that we got landed.
Comment 5 Adrian Perez 2021-08-04 13:19:29 PDT
Also I expect that implementing this will make a few more layout
tests pass. It would be good to look into enabling them, if so.
We might need some work in WKTR (Tools/WebKitTestRunner/wpe/) to
provide a fullscreening handler there and also it would be great
to make it work in the MiniBrowser (Tools/MiniBrowser/wpe/).
Comment 6 Imanol Fernandez 2021-08-05 10:03:58 PDT
Created attachment 434998 [details]
Patch

Update to API function name changes. Add WPE version checks
Comment 7 Lauro Moura 2021-08-05 16:56:40 PDT
(In reply to Adrian Perez from comment #4)
> 
> You will need to adapt this to the function name changes in the version
> of the libwpe PR that we got landed.

The SDK with libwpe 1.11.1 has just landed in the repo.
Comment 8 Imanol Fernandez 2021-08-06 04:50:24 PDT
Created attachment 435062 [details]
Patch

Implement fullscreen in the minibrowser. Reset state if WPEView->setFullscreen fails
Comment 9 Imanol Fernandez 2021-08-06 04:57:46 PDT
(In reply to Adrian Perez from comment #5)
> Also I expect that implementing this will make a few more layout
> tests pass. It would be good to look into enabling them, if so.
> We might need some work in WKTR (Tools/WebKitTestRunner/wpe/) to
> provide a fullscreening handler there and also it would be great
> to make it work in the MiniBrowser (Tools/MiniBrowser/wpe/).

I have looked into the WKTR tests and confirmed that they are not using the platform PageClientImpl->enterFullScreen path (which calls WPEView->setFullscreen). Instead the WKTR is using fullscreen code from InjectedBundlePage which sets DOM fullscreen state without calling platform fullscreen handlers. I understant that WKTR uses headless testing so it probably doesn't make sense to use real fullscreening here. Adding a WPE fullscreen handler in WKTR would not have any effect. The fullscreen related tests have the same results as before the pathc.

(In reply to Lauro Moura from comment #7)
> (In reply to Adrian Perez from comment #4)
> > 
> > You will need to adapt this to the function name changes in the version
> > of the libwpe PR that we got landed.
> 
> The SDK with libwpe 1.11.1 has just landed in the repo.

Great, I already tested with it instead of the local flatpak-sdk build :)
Comment 10 Adrian Perez 2021-08-09 05:27:21 PDT
(In reply to Imanol Fernandez from comment #9)
> (In reply to Adrian Perez from comment #5)
> > Also I expect that implementing this will make a few more layout
> > tests pass. It would be good to look into enabling them, if so.
> > We might need some work in WKTR (Tools/WebKitTestRunner/wpe/) to
> > provide a fullscreening handler there and also it would be great
> > to make it work in the MiniBrowser (Tools/MiniBrowser/wpe/).
> 
> I have looked into the WKTR tests and confirmed that they are not using the
> platform PageClientImpl->enterFullScreen path (which calls
> WPEView->setFullscreen). Instead the WKTR is using fullscreen code from
> InjectedBundlePage which sets DOM fullscreen state without calling platform
> fullscreen handlers. I understant that WKTR uses headless testing so it
> probably doesn't make sense to use real fullscreening here. Adding a WPE
> fullscreen handler in WKTR would not have any effect. The fullscreen related
> tests have the same results as before the pathc.
> 
> (In reply to Lauro Moura from comment #7)
> > (In reply to Adrian Perez from comment #4)
> > > 
> > > You will need to adapt this to the function name changes in the version
> > > of the libwpe PR that we got landed.
> > 
> > The SDK with libwpe 1.11.1 has just landed in the repo.
> 
> Great, I already tested with it instead of the local flatpak-sdk build :)

And the EWS passed, too!
Comment 11 Adrian Perez 2021-08-09 05:30:29 PDT
Comment on attachment 435062 [details]
Patch

The Mac EWS failures are unrelated, so let's land this ^_^
Comment 12 EWS 2021-08-09 05:49:33 PDT
Committed r280774 (240358@main): <https://commits.webkit.org/240358@main>

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