constellation: Rename messages sent to the Constellation (#36341)

Messages that are sent to the `Constellation` have pretty ambiguous
names.
This change does two renames:

- `ConstellationMsg` → `EmbedderToConstellationMessage`
- `ScriptMsg` → `ScriptToConstellationMessage`

This naming reflects that the `Constellation` stands in between the
embedding layer and the script layer and can receive messages from both.
Soon both of these message types will live in `constellation_traits`,
reflecting the idea that the `_traits` variant for a crate is
responsible for exposing the API for that crate.

Testing: No new tests are necessary here as this just renames two enums.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-04-04 21:39:38 +02:00 committed by GitHub
parent c7a7862574
commit 5a35e1faec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 415 additions and 364 deletions

View file

@ -5,7 +5,7 @@
use base::id::WebViewId;
use embedder_traits::EmbedderMsg;
use ipc_channel::ipc::channel;
use script_traits::{ScriptMsg, ScriptToConstellationChan};
use script_traits::{ScriptToConstellationChan, ScriptToConstellationMessage};
/// A trait which abstracts access to the embedder's clipboard in order to allow unit
/// testing clipboard-dependent parts of `script`.
@ -25,19 +25,17 @@ impl ClipboardProvider for EmbedderClipboardProvider {
fn get_text(&mut self) -> Result<String, String> {
let (tx, rx) = channel().unwrap();
self.constellation_sender
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::GetClipboardText(
self.webview_id,
tx,
)))
.send(ScriptToConstellationMessage::ForwardToEmbedder(
EmbedderMsg::GetClipboardText(self.webview_id, tx),
))
.unwrap();
rx.recv().unwrap()
}
fn set_text(&mut self, s: String) {
self.constellation_sender
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::SetClipboardText(
self.webview_id,
s,
)))
.send(ScriptToConstellationMessage::ForwardToEmbedder(
EmbedderMsg::SetClipboardText(self.webview_id, s),
))
.unwrap();
}
}