Repository: servo/servo
File: components/shared/constellation/lib.rs (Rust)

Code before:
    pub port_message_queue: VecDeque<PortMessageTask>,
    /// A boolean indicating whether the port has been disentangled while in transfer,
    /// if so, the disentanglement should be completed along with the transfer.
    /// <https://html.spec.whatwg.org/multipage/#disentangle>
    pub disentangled: bool,
}

/// Messages for communication between the constellation and a global managing ports.
#[derive(Debug, Deserialize, Serialize)]
#[expect(clippy::large_enum_variant)]
pub enum MessagePortMsg {
    /// Complete the transfer for a batch of ports.
    CompleteTransfer(FxHashMap<MessagePortId, PortTransferInfo>),
    /// Complete the transfer of a single port,
    /// whose transfer was pending because it had been requested
    /// while a previous failed transfer was being rolled-back.
    CompletePendingTransfer(MessagePortId, PortTransferInfo),
    /// <https://html.spec.whatwg.org/multipage/#disentangle>
    CompleteDisentanglement(MessagePortId),
    /// Handle a new port-message-task.
    NewTask(MessagePortId, PortMessageTask),
}

/// If renderer is scrolled, we need to send these states to update the scroll tree in the constellation.
#[derive(Debug, Deserialize, Serialize)]
pub struct ScrollStatesUpdate {
    /// Which node that is scrolled. This is required for JS scroll event.
    pub scrolled_node: ExternalScrollId,
    /// The whole scroll offsets from the renderer's scroll tree.
    pub offsets: FxHashMap<ExternalScrollId, LayoutVector2D>,
}


Review comment (suggestion):
Nit:

```suggestion
pub struct ScrollStateUpdate {
```

Code after:
    pub port_message_queue: VecDeque<PortMessageTask>,
    /// A boolean indicating whether the port has been disentangled while in transfer,
    /// if so, the disentanglement should be completed along with the transfer.
    /// <https://html.spec.whatwg.org/multipage/#disentangle>
    pub disentangled: bool,
}

/// Messages for communication between the constellation and a global managing ports.
#[derive(Debug, Deserialize, Serialize)]
#[expect(clippy::large_enum_variant)]
pub enum MessagePortMsg {
    /// Complete the transfer for a batch of ports.
    CompleteTransfer(FxHashMap<MessagePortId, PortTransferInfo>),
    /// Complete the transfer of a single port,
    /// whose transfer was pending because it had been requested
    /// while a previous failed transfer was being rolled-back.
    CompletePendingTransfer(MessagePortId, PortTransferInfo),
    /// <https://html.spec.whatwg.org/multipage/#disentangle>
    CompleteDisentanglement(MessagePortId),
    /// Handle a new port-message-task.
    NewTask(MessagePortId, PortMessageTask),
}

/// A data structure which contains information for the pipeline after a scroll happens in the
/// embedder-side `WebView`.
#[derive(Debug, Deserialize, Serialize)]
pub struct ScrollStateUpdate {
    /// The [`ExternalScrollId`] of the node that that was scrolled.
    pub scrolled_node: ExternalScrollId,
    /// A map containing the scroll offsets of the entire scroll tree. This is necessary,
    /// because scroll events can cause other nodes to scroll due to sticky positioning.
    pub offsets: FxHashMap<ExternalScrollId, LayoutVector2D>,
}