Can't show multiple views because of compositor webviews are not in sync
Closed this issue · 0 comments
Describe the bug:
I've been experimenting with multiview features like #31545 recently. For my use case, I want to display two views in the window at the same time. I noticed the other webview usually won't show when I send EmbedderEvent::ShowWebView
or EmbedderEvent::FocusWebView
during EmbedderMsg::WebViewOpened
message. It didn't always happen, but it feels like 80% of chance.
This is because constellation and compositor have their own webview managers. The other webviews aren't immediately added to the compositor's webview manager when NewWebView
is received. So, when the compositor is handling ShowWebView,
it might not have added the webview yet.
To Reproduce:
Servoshell hasn't supported multiview yet. But the whole workflow is like the following:
- Embedder sends an
EmbedderEvent::NewWebView
to create a second view. - Constellation receives the event, send
EmbedderMsg::WebViewOpened
back to embedder, but it doesn't send any event to compositor to add this webview yet. - Embedder receives the message and sends
EmbedderEvent::FocusWebView
, constellation receives the event and sendsEmbedderEvent::WebViewFocused
, and finally embedder sendsEmbedderEvent::ShowWebView
in hope to see the webview eventually. - Compositor received the event, which was redirected by constellation. But now, compositor's webview manager doesn't have this webview yet. Hence, it can't show the webview.
- After a few more iterations, constellation finally called update_webview_in_compositor to add this webview because it needs to traverse history or change session.
Platform:
I've tested on Windows and mac. It should apply to all other platforms.