aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared
diff options
context:
space:
mode:
Diffstat (limited to 'components/shared')
-rw-r--r--components/shared/compositing/constellation_msg.rs35
-rw-r--r--components/shared/compositing/lib.rs23
-rw-r--r--components/shared/embedder/lib.rs18
3 files changed, 55 insertions, 21 deletions
diff --git a/components/shared/compositing/constellation_msg.rs b/components/shared/compositing/constellation_msg.rs
index 8204ec6d2e3..64d593ee08c 100644
--- a/components/shared/compositing/constellation_msg.rs
+++ b/components/shared/compositing/constellation_msg.rs
@@ -11,13 +11,14 @@ use gfx_traits::Epoch;
use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent;
use msg::constellation_msg::{
- BrowsingContextId, PipelineId, TopLevelBrowsingContextId, TraversalDirection,
+ BrowsingContextId, PipelineId, TopLevelBrowsingContextId, TraversalDirection, WebViewId,
};
use script_traits::{
AnimationTickType, CompositorEvent, GamepadEvent, LogEntry, MediaSessionActionType,
WebDriverCommandMsg, WindowSizeData, WindowSizeType,
};
use servo_url::ServoUrl;
+use webrender_api::units::DeviceRect;
/// Messages to the constellation.
pub enum ConstellationMsg {
@@ -60,9 +61,17 @@ pub enum ConstellationMsg {
CloseWebView(TopLevelBrowsingContextId),
/// Panic a top level browsing context.
SendError(Option<TopLevelBrowsingContextId>, String),
- /// Make a top-level browsing context focused.
+ /// Move and/or resize a webview to the given rect.
+ MoveResizeWebView(TopLevelBrowsingContextId, DeviceRect),
+ /// Start painting a webview, and optionally stop painting all others.
+ ShowWebView(TopLevelBrowsingContextId, bool),
+ /// Stop painting a webview.
+ HideWebView(TopLevelBrowsingContextId),
+ /// Start painting a webview on top of all others, and optionally stop painting all others.
+ RaiseWebViewToTop(TopLevelBrowsingContextId, bool),
+ /// Make a webview focused.
FocusWebView(TopLevelBrowsingContextId),
- /// Make none of the top-level browsing contexts focused.
+ /// Make none of the webviews focused.
BlurWebView,
/// Forward an event to the script task of the given pipeline.
ForwardEvent(PipelineId, CompositorEvent),
@@ -80,16 +89,23 @@ pub enum ConstellationMsg {
SetWebViewThrottled(TopLevelBrowsingContextId, bool),
/// Virtual keyboard was dismissed
IMEDismissed,
- /// Compositing done, but external code needs to present.
- ReadyToPresent(TopLevelBrowsingContextId),
+ /// Notify the embedder that it needs to present a new frame.
+ ReadyToPresent(Vec<WebViewId>),
/// Gamepad state has changed
Gamepad(GamepadEvent),
}
impl fmt::Debug for ConstellationMsg {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ write!(formatter, "ConstellationMsg::{}", self.variant_name())
+ }
+}
+
+impl ConstellationMsg {
+ /// Return the variant name, for error logging that happens after the message is consumed.
+ pub fn variant_name(&self) -> &'static str {
use self::ConstellationMsg::*;
- let variant = match *self {
+ match *self {
Exit => "Exit",
GetBrowsingContext(..) => "GetBrowsingContext",
GetPipeline(..) => "GetPipeline",
@@ -106,6 +122,10 @@ impl fmt::Debug for ConstellationMsg {
LogEntry(..) => "LogEntry",
NewWebView(..) => "NewWebView",
CloseWebView(..) => "CloseWebView",
+ MoveResizeWebView(..) => "MoveResizeWebView",
+ ShowWebView(..) => "ShowWebView",
+ HideWebView(..) => "HideWebView",
+ RaiseWebViewToTop(..) => "RaiseWebViewToTop",
FocusWebView(..) => "FocusWebView",
BlurWebView => "BlurWebView",
SendError(..) => "SendError",
@@ -120,7 +140,6 @@ impl fmt::Debug for ConstellationMsg {
ClearCache => "ClearCache",
ReadyToPresent(..) => "ReadyToPresent",
Gamepad(..) => "Gamepad",
- };
- write!(formatter, "ConstellationMsg::{}", variant)
+ }
}
}
diff --git a/components/shared/compositing/lib.rs b/components/shared/compositing/lib.rs
index 8ab45b374ed..9c759bc4acf 100644
--- a/components/shared/compositing/lib.rs
+++ b/components/shared/compositing/lib.rs
@@ -24,7 +24,7 @@ use script_traits::{
ScriptToCompositorMsg,
};
use style_traits::CSSPixel;
-use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
+use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DeviceRect};
use webrender_api::{self, FontInstanceKey, FontKey, ImageKey};
/// Sends messages to the compositor.
@@ -73,8 +73,18 @@ pub enum CompositorMsg {
ShutdownComplete,
/// Alerts the compositor that the given pipeline has changed whether it is running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
- /// Replaces the current frame tree, typically called during main frame navigation.
- SetFrameTree(SendableFrameTree),
+ /// Create or update a webview, given its frame tree.
+ CreateOrUpdateWebView(SendableFrameTree),
+ /// Remove a webview.
+ RemoveWebView(TopLevelBrowsingContextId),
+ /// Move and/or resize a webview to the given rect.
+ MoveResizeWebView(TopLevelBrowsingContextId, DeviceRect),
+ /// Start painting a webview, and optionally stop painting all others.
+ ShowWebView(TopLevelBrowsingContextId, bool),
+ /// Stop painting a webview.
+ HideWebView(TopLevelBrowsingContextId),
+ /// Start painting a webview on top of all others, and optionally stop painting all others.
+ RaiseWebViewToTop(TopLevelBrowsingContextId, bool),
/// Script has handled a touch event, and either prevented or allowed default actions.
TouchEventProcessed(EventResult),
/// Composite to a PNG file and return the Image over a passed channel.
@@ -153,7 +163,12 @@ impl Debug for CompositorMsg {
CompositorMsg::ChangeRunningAnimationsState(_, state) => {
write!(f, "ChangeRunningAnimationsState({:?})", state)
},
- CompositorMsg::SetFrameTree(..) => write!(f, "SetFrameTree"),
+ CompositorMsg::CreateOrUpdateWebView(..) => write!(f, "CreateOrUpdateWebView"),
+ CompositorMsg::RemoveWebView(..) => write!(f, "RemoveWebView"),
+ CompositorMsg::MoveResizeWebView(..) => write!(f, "MoveResizeWebView"),
+ CompositorMsg::ShowWebView(..) => write!(f, "ShowWebView"),
+ CompositorMsg::HideWebView(..) => write!(f, "HideWebView"),
+ CompositorMsg::RaiseWebViewToTop(..) => write!(f, "RaiseWebViewToTop"),
CompositorMsg::TouchEventProcessed(..) => write!(f, "TouchEventProcessed"),
CompositorMsg::CreatePng(..) => write!(f, "CreatePng"),
CompositorMsg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
diff --git a/components/shared/embedder/lib.rs b/components/shared/embedder/lib.rs
index da6eca45291..0acf7d01ce5 100644
--- a/components/shared/embedder/lib.rs
+++ b/components/shared/embedder/lib.rs
@@ -10,7 +10,7 @@ use crossbeam_channel::{Receiver, Sender};
use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent;
use log::warn;
-use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId};
+use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId, WebViewId};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
@@ -156,13 +156,13 @@ pub enum EmbedderMsg {
AllowNavigationRequest(PipelineId, ServoUrl),
/// Whether or not to allow script to open a new tab/browser
AllowOpeningWebView(IpcSender<bool>),
- /// A browser was created
+ /// A webview was created.
WebViewOpened(TopLevelBrowsingContextId),
- /// A browser was destroyed
+ /// A webview was destroyed.
WebViewClosed(TopLevelBrowsingContextId),
- /// A browser gained focus for keyboard events
+ /// A webview gained focus for keyboard events.
WebViewFocused(TopLevelBrowsingContextId),
- /// All browsers lost focus for keyboard events
+ /// All webviews lost focus for keyboard events.
WebViewBlurred,
/// Wether or not to unload a document
AllowUnload(IpcSender<bool>),
@@ -210,8 +210,8 @@ pub enum EmbedderMsg {
MediaSessionEvent(MediaSessionEvent),
/// Report the status of Devtools Server with a token that can be used to bypass the permission prompt.
OnDevtoolsStarted(Result<u16, ()>, String),
- /// Compositing done, but external code needs to present.
- ReadyToPresent,
+ /// Notify the embedder that it needs to present a new frame.
+ ReadyToPresent(Vec<WebViewId>),
/// The given event was delivered to a pipeline in the given browser.
EventDelivered(CompositorEventVariant),
}
@@ -261,12 +261,12 @@ impl Debug for EmbedderMsg {
EmbedderMsg::WebViewOpened(..) => write!(f, "WebViewOpened"),
EmbedderMsg::WebViewClosed(..) => write!(f, "WebViewClosed"),
EmbedderMsg::WebViewFocused(..) => write!(f, "WebViewFocused"),
- EmbedderMsg::WebViewBlurred => write!(f, "WebViewUnfocused"),
+ EmbedderMsg::WebViewBlurred => write!(f, "WebViewBlurred"),
EmbedderMsg::ReportProfile(..) => write!(f, "ReportProfile"),
EmbedderMsg::MediaSessionEvent(..) => write!(f, "MediaSessionEvent"),
EmbedderMsg::OnDevtoolsStarted(..) => write!(f, "OnDevtoolsStarted"),
EmbedderMsg::ShowContextMenu(..) => write!(f, "ShowContextMenu"),
- EmbedderMsg::ReadyToPresent => write!(f, "ReadyToPresent"),
+ EmbedderMsg::ReadyToPresent(..) => write!(f, "ReadyToPresent"),
EmbedderMsg::EventDelivered(..) => write!(f, "HitTestedEvent"),
}
}