Skip to content

Commit

Permalink
[WPE] TestWebKitWebView /webkit/WebKitWebView/fullscreen is a tim…
Browse files Browse the repository at this point in the history
…eout

https://bugs.webkit.org/show_bug.cgi?id=258850

Reviewed by Michael Catanzaro.

On WPE `WKWPE::View` creates a web page with its own page client.

But when using GLib API we must somehow notify the wrapper `WebKitWebView`
about entering and exiting fullscreen mode.

The solution is to extend `WKWPE::API::Client` with two new methods:
- `enterFullScreen()`
- `exitFullScreen()`

`WebKitWebViewClient`, which implements `WKWPE::API::Client` and has
a reference to `WebKitWebView` wrapper, can react on these events and
call appropriate handlers.

* Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:
(WebKitWebViewClient::enterFullScreen):
(WebKitWebViewClient::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/APIViewClient.h:
(API::ViewClient::enterFullScreen):
(API::ViewClient::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::enterFullScreen):
(WebKit::PageClientImpl::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/WPEView.cpp:
(WKWPE::View::enterFullScreen):
(WKWPE::View::exitFullScreen):
* Source/WebKit/UIProcess/API/wpe/WPEView.h:
* Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h:
* Tools/TestWebKitAPI/glib/TestExpectations.json:

Canonical link: https://commits.webkit.org/265799@main
  • Loading branch information
obyknovenius committed Jul 6, 2023
1 parent 9204150 commit 59f29ab
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,18 @@ WebKitWebResourceLoadManager* WebKitWebViewClient::webResourceLoadManager()
{
return webkitWebViewGetWebResourceLoadManager(m_webView);
}

#if ENABLE(FULLSCREEN_API)
void WebKitWebViewClient::enterFullScreen(WKWPE::View&)
{
webkitWebViewEnterFullScreen(m_webView);
}

void WebKitWebViewClient::exitFullScreen(WKWPE::View&)
{
webkitWebViewExitFullScreen(m_webView);
}
#endif
#endif

static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, const char* failingURI, GError* error)
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit/UIProcess/API/wpe/APIViewClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class ViewClient {
virtual void didChangePageID(WKWPE::View&) { }
virtual void didReceiveUserMessage(WKWPE::View&, WebKit::UserMessage&&, CompletionHandler<void(WebKit::UserMessage&&)>&& completionHandler) { completionHandler(WebKit::UserMessage()); }
virtual WebKit::WebKitWebResourceLoadManager* webResourceLoadManager() { return nullptr; }

#if ENABLE(FULLSCREEN_API)
virtual void enterFullScreen(WKWPE::View&) { };
virtual void exitFullScreen(WKWPE::View&) { };
#endif
};

} // namespace API
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ void PageClientImpl::exitFullScreen()
fullScreenManagerProxy->willExitFullScreen();
if (!m_view.setFullScreen(false))
fullScreenManagerProxy->didEnterFullScreen();

}
}

Expand Down
4 changes: 4 additions & 0 deletions Source/WebKit/UIProcess/API/wpe/WPEView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ bool View::setFullScreen(bool fullScreenState)
return false;
#endif
m_fullScreenModeActive = fullScreenState;
if (m_fullScreenModeActive)
m_client->enterFullScreen(*this);
else
m_client->exitFullScreen(*this);
return true;
};
#endif
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit/UIProcess/API/wpe/WebKitWebViewClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@ class WebKitWebViewClient final : public API::ViewClient {
void didReceiveUserMessage(WKWPE::View&, WebKit::UserMessage&&, CompletionHandler<void(WebKit::UserMessage&&)>&&) override;
WebKit::WebKitWebResourceLoadManager* webResourceLoadManager() override;

#if ENABLE(FULLSCREEN_API)
void enterFullScreen(WKWPE::View&) override;
void exitFullScreen(WKWPE::View&) override;
#endif

WebKitWebView* m_webView;
};
5 changes: 1 addition & 4 deletions Tools/TestWebKitAPI/glib/TestExpectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@
"expected": {"all": {"slow": true }}
},
"/webkit/WebKitWebView/fullscreen": {
"expected": {
"gtk": {"status": ["SKIP"], "bug": "webkit.org/b/248203"},
"wpe": {"status": ["TIMEOUT", "PASS"]}
}
"expected": {"gtk": {"status": ["SKIP"], "bug": "webkit.org/b/248203"}}
}
}
},
Expand Down

0 comments on commit 59f29ab

Please sign in to comment.