mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
libservo: Stop using script_traits
in the embedding layer (#35185)
Many types used directly in the `libservo` API are in the `script_traits` crate, which was created to break circular dependencies. Move all API exposed types to `embedder_traits` which now contains types exposed via the `libservo` embedding API. Also expose these at the root of the `libservo` `servo` crate so that the API won't break when they move around in the future. The idea with `embedder_traits` in the future is that it contains types that are available throughout servo because they are used in the embedding API and thus should have minimal dependencies on other Servo crates (a bit like `base`). Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
78b90030bd
commit
a1cf0cbf86
39 changed files with 330 additions and 334 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -8344,6 +8344,7 @@ dependencies = [
|
||||||
"compositing_traits",
|
"compositing_traits",
|
||||||
"cookie 0.18.1",
|
"cookie 0.18.1",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
|
"embedder_traits",
|
||||||
"euclid",
|
"euclid",
|
||||||
"http 0.2.12",
|
"http 0.2.12",
|
||||||
"image",
|
"image",
|
||||||
|
|
|
@ -19,7 +19,7 @@ use compositing_traits::{
|
||||||
CompositionPipeline, CompositorMsg, CompositorReceiver, ConstellationMsg, SendableFrameTree,
|
CompositionPipeline, CompositorMsg, CompositorReceiver, ConstellationMsg, SendableFrameTree,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use embedder_traits::Cursor;
|
use embedder_traits::{Cursor, MouseButton, MouseEventType, TouchEventType, TouchId, WheelDelta};
|
||||||
use euclid::{Point2D, Rect, Scale, Transform3D, Vector2D};
|
use euclid::{Point2D, Rect, Scale, Transform3D, Vector2D};
|
||||||
use fnv::{FnvHashMap, FnvHashSet};
|
use fnv::{FnvHashMap, FnvHashSet};
|
||||||
use image::{DynamicImage, ImageFormat};
|
use image::{DynamicImage, ImageFormat};
|
||||||
|
@ -31,8 +31,8 @@ use profile_traits::time::{self as profile_time, ProfilerCategory};
|
||||||
use profile_traits::time_profile;
|
use profile_traits::time_profile;
|
||||||
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent, WheelEvent};
|
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent, WheelEvent};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationState, AnimationTickType, ConstellationControlMsg, MouseButton, MouseEventType,
|
AnimationState, AnimationTickType, ConstellationControlMsg, ScrollState, WindowSizeData,
|
||||||
ScrollState, TouchEventType, TouchId, WheelDelta, WindowSizeData, WindowSizeType,
|
WindowSizeType,
|
||||||
};
|
};
|
||||||
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
|
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
|
||||||
use style_traits::{CSSPixel, PinchZoomFactor};
|
use style_traits::{CSSPixel, PinchZoomFactor};
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use embedder_traits::TouchId;
|
||||||
use euclid::{Point2D, Scale, Vector2D};
|
use euclid::{Point2D, Scale, Vector2D};
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
use script_traits::{EventResult, TouchId};
|
use script_traits::EventResult;
|
||||||
use webrender_api::units::{DeviceIntPoint, DevicePixel, LayoutVector2D};
|
use webrender_api::units::{DeviceIntPoint, DevicePixel, LayoutVector2D};
|
||||||
|
|
||||||
use self::TouchState::*;
|
use self::TouchState::*;
|
||||||
|
|
|
@ -8,15 +8,14 @@ use std::fmt::{Debug, Error, Formatter};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use base::id::{PipelineId, TopLevelBrowsingContextId};
|
use base::id::{PipelineId, TopLevelBrowsingContextId};
|
||||||
use embedder_traits::EventLoopWaker;
|
use embedder_traits::{
|
||||||
|
ClipboardEventType, EventLoopWaker, GamepadEvent, MediaSessionActionType, MouseButton, Theme,
|
||||||
|
TouchEventType, TouchId, TraversalDirection, WheelDelta,
|
||||||
|
};
|
||||||
use euclid::Scale;
|
use euclid::Scale;
|
||||||
use keyboard_types::{CompositionEvent, KeyboardEvent};
|
use keyboard_types::{CompositionEvent, KeyboardEvent};
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use net::protocols::ProtocolRegistry;
|
use net::protocols::ProtocolRegistry;
|
||||||
use script_traits::{
|
|
||||||
ClipboardEventType, GamepadEvent, MediaSessionActionType, MouseButton, Theme, TouchEventType,
|
|
||||||
TouchId, TraversalDirection, WheelDelta,
|
|
||||||
};
|
|
||||||
use servo_geometry::{DeviceIndependentIntRect, DeviceIndependentIntSize, DeviceIndependentPixel};
|
use servo_geometry::{DeviceIndependentIntRect, DeviceIndependentIntSize, DeviceIndependentPixel};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use webrender_api::units::{
|
use webrender_api::units::{
|
||||||
|
|
|
@ -117,7 +117,8 @@ use devtools_traits::{
|
||||||
};
|
};
|
||||||
use embedder_traits::resources::{self, Resource};
|
use embedder_traits::resources::{self, Resource};
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
Cursor, EmbedderMsg, EmbedderProxy, MediaSessionEvent, MediaSessionPlaybackState,
|
ClipboardEventType, Cursor, EmbedderMsg, EmbedderProxy, GamepadEvent, MediaSessionActionType,
|
||||||
|
MediaSessionEvent, MediaSessionPlaybackState, MouseEventType, Theme, TraversalDirection,
|
||||||
};
|
};
|
||||||
use euclid::default::Size2D as UntypedSize2D;
|
use euclid::default::Size2D as UntypedSize2D;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
|
@ -138,14 +139,13 @@ use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
|
||||||
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
|
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
webdriver_msg, AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo,
|
webdriver_msg, AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo,
|
||||||
BroadcastMsg, ClipboardEventType, CompositorEvent, ConstellationControlMsg,
|
BroadcastMsg, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
|
||||||
DiscardBrowsingContext, DocumentActivity, DocumentState, GamepadEvent, IFrameLoadInfo,
|
DocumentActivity, DocumentState, IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState,
|
||||||
IFrameLoadInfoWithData, IFrameSandboxState, IFrameSizeMsg, Job, LayoutMsg as FromLayoutMsg,
|
IFrameSizeMsg, Job, LayoutMsg as FromLayoutMsg, LoadData, LoadOrigin, LogEntry, MessagePortMsg,
|
||||||
LoadData, LoadOrigin, LogEntry, MediaSessionActionType, MessagePortMsg, MouseEventType,
|
|
||||||
NavigationHistoryBehavior, PortMessageTask, SWManagerMsg, SWManagerSenders,
|
NavigationHistoryBehavior, PortMessageTask, SWManagerMsg, SWManagerSenders,
|
||||||
ScriptMsg as FromScriptMsg, ScriptToConstellationChan, ServiceWorkerManagerFactory,
|
ScriptMsg as FromScriptMsg, ScriptToConstellationChan, ServiceWorkerManagerFactory,
|
||||||
ServiceWorkerMsg, StructuredSerializedData, Theme, TraversalDirection, UpdatePipelineIdReason,
|
ServiceWorkerMsg, StructuredSerializedData, UpdatePipelineIdReason, WebDriverCommandMsg,
|
||||||
WebDriverCommandMsg, WindowSizeData, WindowSizeType,
|
WindowSizeData, WindowSizeType,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_config::{opts, pref};
|
use servo_config::{opts, pref};
|
||||||
|
|
|
@ -22,7 +22,10 @@ use cookie::Cookie;
|
||||||
use cssparser::match_ignore_ascii_case;
|
use cssparser::match_ignore_ascii_case;
|
||||||
use devtools_traits::ScriptToDevtoolsControlMsg;
|
use devtools_traits::ScriptToDevtoolsControlMsg;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::{
|
||||||
|
ClipboardEventType, EmbedderMsg, MouseButton, MouseEventType, TouchEventType, TouchId,
|
||||||
|
WheelDelta,
|
||||||
|
};
|
||||||
use encoding_rs::{Encoding, UTF_8};
|
use encoding_rs::{Encoding, UTF_8};
|
||||||
use euclid::default::{Point2D, Rect, Size2D};
|
use euclid::default::{Point2D, Rect, Size2D};
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace, QualName};
|
||||||
|
@ -48,9 +51,8 @@ use profile_traits::ipc as profile_ipc;
|
||||||
use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType};
|
use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType};
|
||||||
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
|
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationState, AnimationTickType, ClipboardEventType, CompositorEvent, DocumentActivity,
|
AnimationState, AnimationTickType, CompositorEvent, DocumentActivity, ScriptMsg,
|
||||||
MouseButton, MouseEventType, ScriptMsg, TouchEventType, TouchId, UntrustedNodeAddress,
|
UntrustedNodeAddress,
|
||||||
WheelDelta,
|
|
||||||
};
|
};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use embedder_traits::{GamepadSupportedHapticEffects, GamepadUpdateType};
|
||||||
use js::typedarray::{Float64, Float64Array};
|
use js::typedarray::{Float64, Float64Array};
|
||||||
use script_traits::{GamepadSupportedHapticEffects, GamepadUpdateType};
|
|
||||||
|
|
||||||
use super::bindings::buffer_source::HeapBufferSource;
|
use super::bindings::buffer_source::HeapBufferSource;
|
||||||
use crate::dom::bindings::codegen::Bindings::GamepadBinding::{GamepadHand, GamepadMethods};
|
use crate::dom::bindings::codegen::Bindings::GamepadBinding::{GamepadHand, GamepadMethods};
|
||||||
|
|
|
@ -6,11 +6,10 @@ use std::cell::Cell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::{DualRumbleEffectParams, EmbedderMsg};
|
use embedder_traits::{DualRumbleEffectParams, EmbedderMsg, GamepadSupportedHapticEffects};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::rust::MutableHandleValue;
|
use js::rust::MutableHandleValue;
|
||||||
use script_traits::GamepadSupportedHapticEffects;
|
|
||||||
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::GamepadHapticActuatorBinding::{
|
use crate::dom::bindings::codegen::Bindings::GamepadHapticActuatorBinding::{
|
||||||
|
|
|
@ -22,7 +22,9 @@ use content_security_policy::{CheckResult, CspList, PolicyDisposition};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use devtools_traits::{PageError, ScriptToDevtoolsControlMsg};
|
use devtools_traits::{PageError, ScriptToDevtoolsControlMsg};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::{
|
||||||
|
EmbedderMsg, GamepadEvent, GamepadSupportedHapticEffects, GamepadUpdateType,
|
||||||
|
};
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::glue::{IsWrapper, UnwrapObjectDynamic};
|
use js::glue::{IsWrapper, UnwrapObjectDynamic};
|
||||||
|
@ -56,8 +58,7 @@ use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_tim
|
||||||
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
||||||
use script_traits::transferable::MessagePortImpl;
|
use script_traits::transferable::MessagePortImpl;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
BroadcastMsg, GamepadEvent, GamepadSupportedHapticEffects, GamepadUpdateType, MessagePortMsg,
|
BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptMsg, ScriptToConstellationChan,
|
||||||
PortMessageTask, ScriptMsg, ScriptToConstellationChan,
|
|
||||||
};
|
};
|
||||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||||
use timers::{TimerEventId, TimerEventRequest, TimerSource};
|
use timers::{TimerEventId, TimerEventRequest, TimerSource};
|
||||||
|
|
|
@ -7,13 +7,14 @@ use std::cmp::Ordering;
|
||||||
|
|
||||||
use base::id::HistoryStateId;
|
use base::id::HistoryStateId;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use embedder_traits::TraversalDirection;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::{JSVal, NullValue, UndefinedValue};
|
use js::jsval::{JSVal, NullValue, UndefinedValue};
|
||||||
use js::rust::{HandleValue, MutableHandleValue};
|
use js::rust::{HandleValue, MutableHandleValue};
|
||||||
use net_traits::{CoreResourceMsg, IpcSend};
|
use net_traits::{CoreResourceMsg, IpcSend};
|
||||||
use profile_traits::ipc;
|
use profile_traits::ipc;
|
||||||
use profile_traits::ipc::channel;
|
use profile_traits::ipc::channel;
|
||||||
use script_traits::{ScriptMsg, StructuredSerializedData, TraversalDirection};
|
use script_traits::{ScriptMsg, StructuredSerializedData};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
|
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::{MediaMetadata as EmbedderMediaMetadata, MediaSessionEvent};
|
use embedder_traits::{
|
||||||
use script_traits::{MediaSessionActionType, ScriptMsg};
|
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
|
||||||
|
};
|
||||||
|
use script_traits::ScriptMsg;
|
||||||
|
|
||||||
use super::bindings::trace::HashMapTracedValues;
|
use super::bindings::trace::HashMapTracedValues;
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use embedder_traits::GamepadSupportedHapticEffects;
|
||||||
use js::conversions::ToJSValConvertible;
|
use js::conversions::ToJSValConvertible;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::{JSVal, UndefinedValue};
|
use js::jsval::{JSVal, UndefinedValue};
|
||||||
use js::rust::MutableHandleValue;
|
use js::rust::MutableHandleValue;
|
||||||
use script_traits::GamepadSupportedHapticEffects;
|
|
||||||
use webxr_api::{Handedness, InputFrame, InputId, InputSource, TargetRayMode};
|
use webxr_api::{Handedness, InputFrame, InputId, InputSource, TargetRayMode};
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{
|
use crate::dom::bindings::codegen::Bindings::XRInputSourceBinding::{
|
||||||
|
|
|
@ -25,7 +25,7 @@ use crossbeam_channel::{unbounded, Sender};
|
||||||
use cssparser::{Parser, ParserInput, SourceLocation};
|
use cssparser::{Parser, ParserInput, SourceLocation};
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult};
|
use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult, Theme};
|
||||||
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect};
|
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect};
|
||||||
use euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
|
use euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
|
||||||
use fonts::FontContext;
|
use fonts::FontContext;
|
||||||
|
@ -59,8 +59,8 @@ use script_layout_interface::{
|
||||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
ConstellationControlMsg, DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
ConstellationControlMsg, DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||||
ScriptMsg, ScriptToConstellationChan, ScrollState, StructuredSerializedData, Theme,
|
ScriptMsg, ScriptToConstellationChan, ScrollState, StructuredSerializedData, WindowSizeData,
|
||||||
WindowSizeData, WindowSizeType,
|
WindowSizeType,
|
||||||
};
|
};
|
||||||
use selectors::attr::CaseSensitivity;
|
use selectors::attr::CaseSensitivity;
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
|
|
|
@ -45,7 +45,10 @@ use devtools_traits::{
|
||||||
CSSError, DevtoolScriptControlMsg, DevtoolsPageInfo, NavigationState,
|
CSSError, DevtoolScriptControlMsg, DevtoolsPageInfo, NavigationState,
|
||||||
ScriptToDevtoolsControlMsg, WorkerId,
|
ScriptToDevtoolsControlMsg, WorkerId,
|
||||||
};
|
};
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::{
|
||||||
|
EmbedderMsg, MediaSessionActionType, MouseButton, MouseEventType, Theme, TouchEventType,
|
||||||
|
TouchId, WheelDelta,
|
||||||
|
};
|
||||||
use euclid::default::{Point2D, Rect};
|
use euclid::default::{Point2D, Rect};
|
||||||
use fonts::{FontContext, SystemFontServiceProxy};
|
use fonts::{FontContext, SystemFontServiceProxy};
|
||||||
use headers::{HeaderMapExt, LastModified, ReferrerPolicy as ReferrerPolicyHeader};
|
use headers::{HeaderMapExt, LastModified, ReferrerPolicy as ReferrerPolicyHeader};
|
||||||
|
@ -80,11 +83,10 @@ use script_layout_interface::{
|
||||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
|
CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
|
||||||
EventResult, InitialScriptState, JsEvalResult, LoadData, LoadOrigin, MediaSessionActionType,
|
EventResult, InitialScriptState, JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||||
MouseButton, MouseEventType, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptMsg, ScriptToConstellationChan,
|
||||||
ProgressiveWebMetricType, ScriptMsg, ScriptToConstellationChan, ScrollState,
|
ScrollState, StructuredSerializedData, UntrustedNodeAddress, UpdatePipelineIdReason,
|
||||||
StructuredSerializedData, Theme, TouchEventType, TouchId, UntrustedNodeAddress,
|
WindowSizeData, WindowSizeType,
|
||||||
UpdatePipelineIdReason, WheelDelta, WindowSizeData, WindowSizeType,
|
|
||||||
};
|
};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
|
|
|
@ -54,7 +54,7 @@ use constellation::{
|
||||||
UnprivilegedContent,
|
UnprivilegedContent,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::{unbounded, Sender};
|
use crossbeam_channel::{unbounded, Sender};
|
||||||
use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker};
|
pub use embedder_traits::*;
|
||||||
use env_logger::Builder as EnvLoggerBuilder;
|
use env_logger::Builder as EnvLoggerBuilder;
|
||||||
use euclid::Scale;
|
use euclid::Scale;
|
||||||
use fonts::SystemFontService;
|
use fonts::SystemFontService;
|
||||||
|
@ -71,6 +71,7 @@ pub use gleam::gl;
|
||||||
use gleam::gl::RENDERER;
|
use gleam::gl::RENDERER;
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
|
pub use keyboard_types::*;
|
||||||
#[cfg(feature = "layout_2013")]
|
#[cfg(feature = "layout_2013")]
|
||||||
pub use layout_thread_2013;
|
pub use layout_thread_2013;
|
||||||
use log::{error, trace, warn, Log, Metadata, Record};
|
use log::{error, trace, warn, Log, Metadata, Record};
|
||||||
|
@ -107,10 +108,10 @@ use webrender_traits::{
|
||||||
};
|
};
|
||||||
pub use {
|
pub use {
|
||||||
background_hang_monitor, base, bluetooth, bluetooth_traits, canvas, canvas_traits, compositing,
|
background_hang_monitor, base, bluetooth, bluetooth_traits, canvas, canvas_traits, compositing,
|
||||||
devtools, devtools_traits, embedder_traits, euclid, fonts, ipc_channel, keyboard_types,
|
devtools, devtools_traits, euclid, fonts, ipc_channel, layout_thread_2020, media, net,
|
||||||
layout_thread_2020, media, net, net_traits, profile, profile_traits, script,
|
net_traits, profile, profile_traits, script, script_layout_interface, script_traits,
|
||||||
script_layout_interface, script_traits, servo_config as config, servo_config, servo_geometry,
|
servo_config as config, servo_config, servo_geometry, servo_url, style, style_traits,
|
||||||
servo_url, style, style_traits, webrender_api, webrender_traits,
|
webrender_api, webrender_traits,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::proxies::ConstellationProxy;
|
use crate::proxies::ConstellationProxy;
|
||||||
|
|
|
@ -8,12 +8,13 @@ use std::time::Duration;
|
||||||
|
|
||||||
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId};
|
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId};
|
||||||
use base::Epoch;
|
use base::Epoch;
|
||||||
use embedder_traits::Cursor;
|
use embedder_traits::{
|
||||||
|
ClipboardEventType, Cursor, GamepadEvent, MediaSessionActionType, Theme, TraversalDirection,
|
||||||
|
};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use keyboard_types::{CompositionEvent, KeyboardEvent};
|
use keyboard_types::{CompositionEvent, KeyboardEvent};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationTickType, ClipboardEventType, CompositorEvent, GamepadEvent, LogEntry,
|
AnimationTickType, CompositorEvent, LogEntry, WebDriverCommandMsg, WindowSizeData,
|
||||||
MediaSessionActionType, Theme, TraversalDirection, WebDriverCommandMsg, WindowSizeData,
|
|
||||||
WindowSizeType,
|
WindowSizeType,
|
||||||
};
|
};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
|
@ -12,14 +12,12 @@ use base::id::{PipelineId, TopLevelBrowsingContextId};
|
||||||
use base::Epoch;
|
use base::Epoch;
|
||||||
pub use constellation_msg::ConstellationMsg;
|
pub use constellation_msg::ConstellationMsg;
|
||||||
use crossbeam_channel::{Receiver, Sender};
|
use crossbeam_channel::{Receiver, Sender};
|
||||||
use embedder_traits::EventLoopWaker;
|
use embedder_traits::{EventLoopWaker, MouseButton, MouseEventType};
|
||||||
use euclid::Rect;
|
use euclid::Rect;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use pixels::Image;
|
use pixels::Image;
|
||||||
use script_traits::{
|
use script_traits::{AnimationState, ConstellationControlMsg, EventResult};
|
||||||
AnimationState, ConstellationControlMsg, EventResult, MouseButton, MouseEventType,
|
|
||||||
};
|
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use webrender_api::units::DeviceRect;
|
use webrender_api::units::DeviceRect;
|
||||||
use webrender_api::DocumentId;
|
use webrender_api::DocumentId;
|
||||||
|
|
|
@ -539,3 +539,210 @@ impl WebResourceResponse {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The type of input represented by a multi-touch event.
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||||
|
pub enum TouchEventType {
|
||||||
|
/// A new touch point came in contact with the screen.
|
||||||
|
Down,
|
||||||
|
/// An existing touch point changed location.
|
||||||
|
Move,
|
||||||
|
/// A touch point was removed from the screen.
|
||||||
|
Up,
|
||||||
|
/// The system stopped tracking a touch point.
|
||||||
|
Cancel,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An opaque identifier for a touch point.
|
||||||
|
///
|
||||||
|
/// <http://w3c.github.io/touch-events/#widl-Touch-identifier>
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||||
|
pub struct TouchId(pub i32);
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
|
/// Index of gamepad in list of system's connected gamepads
|
||||||
|
pub struct GamepadIndex(pub usize);
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
/// The minimum and maximum values that can be reported for axis or button input from this gamepad
|
||||||
|
pub struct GamepadInputBounds {
|
||||||
|
/// Minimum and maximum axis values
|
||||||
|
pub axis_bounds: (f64, f64),
|
||||||
|
/// Minimum and maximum button values
|
||||||
|
pub button_bounds: (f64, f64),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
/// The haptic effects supported by this gamepad
|
||||||
|
pub struct GamepadSupportedHapticEffects {
|
||||||
|
/// Gamepad support for dual rumble effects
|
||||||
|
pub supports_dual_rumble: bool,
|
||||||
|
/// Gamepad support for trigger rumble effects
|
||||||
|
pub supports_trigger_rumble: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
/// The type of Gamepad event
|
||||||
|
pub enum GamepadEvent {
|
||||||
|
/// A new gamepad has been connected
|
||||||
|
/// <https://www.w3.org/TR/gamepad/#event-gamepadconnected>
|
||||||
|
Connected(
|
||||||
|
GamepadIndex,
|
||||||
|
String,
|
||||||
|
GamepadInputBounds,
|
||||||
|
GamepadSupportedHapticEffects,
|
||||||
|
),
|
||||||
|
/// An existing gamepad has been disconnected
|
||||||
|
/// <https://www.w3.org/TR/gamepad/#event-gamepaddisconnected>
|
||||||
|
Disconnected(GamepadIndex),
|
||||||
|
/// An existing gamepad has been updated
|
||||||
|
/// <https://www.w3.org/TR/gamepad/#receiving-inputs>
|
||||||
|
Updated(GamepadIndex, GamepadUpdateType),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
/// The type of Gamepad input being updated
|
||||||
|
pub enum GamepadUpdateType {
|
||||||
|
/// Axis index and input value
|
||||||
|
/// <https://www.w3.org/TR/gamepad/#dfn-represents-a-standard-gamepad-axis>
|
||||||
|
Axis(usize, f64),
|
||||||
|
/// Button index and input value
|
||||||
|
/// <https://www.w3.org/TR/gamepad/#dfn-represents-a-standard-gamepad-button>
|
||||||
|
Button(usize, f64),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||||
|
pub enum MouseButton {
|
||||||
|
/// The left mouse button.
|
||||||
|
Left = 1,
|
||||||
|
/// The right mouse button.
|
||||||
|
Right = 2,
|
||||||
|
/// The middle mouse button.
|
||||||
|
Middle = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The types of mouse events
|
||||||
|
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
|
pub enum MouseEventType {
|
||||||
|
/// Mouse button clicked
|
||||||
|
Click,
|
||||||
|
/// Mouse button down
|
||||||
|
MouseDown,
|
||||||
|
/// Mouse button up
|
||||||
|
MouseUp,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mode to measure WheelDelta floats in
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
|
pub enum WheelMode {
|
||||||
|
/// Delta values are specified in pixels
|
||||||
|
DeltaPixel = 0x00,
|
||||||
|
/// Delta values are specified in lines
|
||||||
|
DeltaLine = 0x01,
|
||||||
|
/// Delta values are specified in pages
|
||||||
|
DeltaPage = 0x02,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The Wheel event deltas in every direction
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
|
pub struct WheelDelta {
|
||||||
|
/// Delta in the left/right direction
|
||||||
|
pub x: f64,
|
||||||
|
/// Delta in the up/down direction
|
||||||
|
pub y: f64,
|
||||||
|
/// Delta in the direction going into/out of the screen
|
||||||
|
pub z: f64,
|
||||||
|
/// Mode to measure the floats in
|
||||||
|
pub mode: WheelMode,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The mouse button involved in the event.
|
||||||
|
/// The types of clipboard events
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub enum ClipboardEventType {
|
||||||
|
/// Contents of the system clipboard are changed
|
||||||
|
Change,
|
||||||
|
/// Copy
|
||||||
|
Copy,
|
||||||
|
/// Cut
|
||||||
|
Cut,
|
||||||
|
/// Paste
|
||||||
|
Paste(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ClipboardEventType {
|
||||||
|
/// Convert to event name
|
||||||
|
pub fn as_str(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
ClipboardEventType::Change => "clipboardchange",
|
||||||
|
ClipboardEventType::Copy => "copy",
|
||||||
|
ClipboardEventType::Cut => "cut",
|
||||||
|
ClipboardEventType::Paste(..) => "paste",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The direction of a history traversal
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||||
|
pub enum TraversalDirection {
|
||||||
|
/// Travel forward the given number of documents.
|
||||||
|
Forward(usize),
|
||||||
|
/// Travel backward the given number of documents.
|
||||||
|
Back(usize),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The type of platform theme.
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
|
||||||
|
pub enum Theme {
|
||||||
|
/// Light theme.
|
||||||
|
Light,
|
||||||
|
/// Dark theme.
|
||||||
|
Dark,
|
||||||
|
}
|
||||||
|
// The type of MediaSession action.
|
||||||
|
/// <https://w3c.github.io/mediasession/#enumdef-mediasessionaction>
|
||||||
|
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
||||||
|
pub enum MediaSessionActionType {
|
||||||
|
/// The action intent is to resume playback.
|
||||||
|
Play,
|
||||||
|
/// The action intent is to pause the currently active playback.
|
||||||
|
Pause,
|
||||||
|
/// The action intent is to move the playback time backward by a short period (i.e. a few
|
||||||
|
/// seconds).
|
||||||
|
SeekBackward,
|
||||||
|
/// The action intent is to move the playback time forward by a short period (i.e. a few
|
||||||
|
/// seconds).
|
||||||
|
SeekForward,
|
||||||
|
/// The action intent is to either start the current playback from the beginning if the
|
||||||
|
/// playback has a notion, of beginning, or move to the previous item in the playlist if the
|
||||||
|
/// playback has a notion of playlist.
|
||||||
|
PreviousTrack,
|
||||||
|
/// The action is to move to the playback to the next item in the playlist if the playback has
|
||||||
|
/// a notion of playlist.
|
||||||
|
NextTrack,
|
||||||
|
/// The action intent is to skip the advertisement that is currently playing.
|
||||||
|
SkipAd,
|
||||||
|
/// The action intent is to stop the playback and clear the state if appropriate.
|
||||||
|
Stop,
|
||||||
|
/// The action intent is to move the playback time to a specific time.
|
||||||
|
SeekTo,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for MediaSessionActionType {
|
||||||
|
fn from(value: i32) -> MediaSessionActionType {
|
||||||
|
match value {
|
||||||
|
1 => MediaSessionActionType::Play,
|
||||||
|
2 => MediaSessionActionType::Pause,
|
||||||
|
3 => MediaSessionActionType::SeekBackward,
|
||||||
|
4 => MediaSessionActionType::SeekForward,
|
||||||
|
5 => MediaSessionActionType::PreviousTrack,
|
||||||
|
6 => MediaSessionActionType::NextTrack,
|
||||||
|
7 => MediaSessionActionType::SkipAd,
|
||||||
|
8 => MediaSessionActionType::Stop,
|
||||||
|
9 => MediaSessionActionType::SeekTo,
|
||||||
|
_ => panic!("Unknown MediaSessionActionType"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,7 +31,10 @@ use bluetooth_traits::BluetoothRequest;
|
||||||
use canvas_traits::webgl::WebGLPipeline;
|
use canvas_traits::webgl::WebGLPipeline;
|
||||||
use crossbeam_channel::{RecvTimeoutError, Sender};
|
use crossbeam_channel::{RecvTimeoutError, Sender};
|
||||||
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use embedder_traits::CompositorEventVariant;
|
use embedder_traits::{
|
||||||
|
ClipboardEventType, CompositorEventVariant, GamepadEvent, MediaSessionActionType, MouseButton,
|
||||||
|
MouseEventType, Theme, TouchEventType, TouchId, WheelDelta,
|
||||||
|
};
|
||||||
use euclid::default::Point2D;
|
use euclid::default::Point2D;
|
||||||
use euclid::{Rect, Scale, Size2D, UnknownUnit, Vector2D};
|
use euclid::{Rect, Scale, Size2D, UnknownUnit, Vector2D};
|
||||||
use http::{HeaderMap, Method};
|
use http::{HeaderMap, Method};
|
||||||
|
@ -65,7 +68,6 @@ use webrender_traits::{
|
||||||
pub use crate::script_msg::{
|
pub use crate::script_msg::{
|
||||||
DOMMessage, EventResult, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType,
|
DOMMessage, EventResult, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType,
|
||||||
LayoutMsg, LogEntry, SWManagerMsg, SWManagerSenders, ScopeThings, ScriptMsg, ServiceWorkerMsg,
|
LayoutMsg, LogEntry, SWManagerMsg, SWManagerSenders, ScopeThings, ScriptMsg, ServiceWorkerMsg,
|
||||||
TraversalDirection,
|
|
||||||
};
|
};
|
||||||
use crate::serializable::{BlobData, BlobImpl};
|
use crate::serializable::{BlobData, BlobImpl};
|
||||||
use crate::transferable::MessagePortImpl;
|
use crate::transferable::MessagePortImpl;
|
||||||
|
@ -470,96 +472,6 @@ pub enum AnimationState {
|
||||||
NoAnimationCallbacksPresent,
|
NoAnimationCallbacksPresent,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of input represented by a multi-touch event.
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
|
||||||
pub enum TouchEventType {
|
|
||||||
/// A new touch point came in contact with the screen.
|
|
||||||
Down,
|
|
||||||
/// An existing touch point changed location.
|
|
||||||
Move,
|
|
||||||
/// A touch point was removed from the screen.
|
|
||||||
Up,
|
|
||||||
/// The system stopped tracking a touch point.
|
|
||||||
Cancel,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An opaque identifier for a touch point.
|
|
||||||
///
|
|
||||||
/// <http://w3c.github.io/touch-events/#widl-Touch-identifier>
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
|
||||||
pub struct TouchId(pub i32);
|
|
||||||
|
|
||||||
/// The mouse button involved in the event.
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
|
||||||
pub enum MouseButton {
|
|
||||||
/// The left mouse button.
|
|
||||||
Left = 1,
|
|
||||||
/// The right mouse button.
|
|
||||||
Right = 2,
|
|
||||||
/// The middle mouse button.
|
|
||||||
Middle = 4,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The types of mouse events
|
|
||||||
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
|
|
||||||
pub enum MouseEventType {
|
|
||||||
/// Mouse button clicked
|
|
||||||
Click,
|
|
||||||
/// Mouse button down
|
|
||||||
MouseDown,
|
|
||||||
/// Mouse button up
|
|
||||||
MouseUp,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mode to measure WheelDelta floats in
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
|
||||||
pub enum WheelMode {
|
|
||||||
/// Delta values are specified in pixels
|
|
||||||
DeltaPixel = 0x00,
|
|
||||||
/// Delta values are specified in lines
|
|
||||||
DeltaLine = 0x01,
|
|
||||||
/// Delta values are specified in pages
|
|
||||||
DeltaPage = 0x02,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The Wheel event deltas in every direction
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
|
||||||
pub struct WheelDelta {
|
|
||||||
/// Delta in the left/right direction
|
|
||||||
pub x: f64,
|
|
||||||
/// Delta in the up/down direction
|
|
||||||
pub y: f64,
|
|
||||||
/// Delta in the direction going into/out of the screen
|
|
||||||
pub z: f64,
|
|
||||||
/// Mode to measure the floats in
|
|
||||||
pub mode: WheelMode,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The types of clipboard events
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
pub enum ClipboardEventType {
|
|
||||||
/// Contents of the system clipboard are changed
|
|
||||||
Change,
|
|
||||||
/// Copy
|
|
||||||
Copy,
|
|
||||||
/// Cut
|
|
||||||
Cut,
|
|
||||||
/// Paste
|
|
||||||
Paste(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ClipboardEventType {
|
|
||||||
/// Convert to event name
|
|
||||||
pub fn as_str(&self) -> &str {
|
|
||||||
match *self {
|
|
||||||
ClipboardEventType::Change => "clipboardchange",
|
|
||||||
ClipboardEventType::Copy => "copy",
|
|
||||||
ClipboardEventType::Cut => "cut",
|
|
||||||
ClipboardEventType::Paste(..) => "paste",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Events from the compositor that the script thread needs to know about
|
/// Events from the compositor that the script thread needs to know about
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum CompositorEvent {
|
pub enum CompositorEvent {
|
||||||
|
@ -784,15 +696,6 @@ pub enum WindowSizeType {
|
||||||
Resize,
|
Resize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of platform theme.
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
|
|
||||||
pub enum Theme {
|
|
||||||
/// Light theme.
|
|
||||||
Light,
|
|
||||||
/// Dark theme.
|
|
||||||
Dark,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Messages to the constellation originating from the WebDriver server.
|
/// Messages to the constellation originating from the WebDriver server.
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum WebDriverCommandMsg {
|
pub enum WebDriverCommandMsg {
|
||||||
|
@ -1044,103 +947,3 @@ impl Clone for BroadcastMsg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of MediaSession action.
|
|
||||||
/// <https://w3c.github.io/mediasession/#enumdef-mediasessionaction>
|
|
||||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
|
||||||
pub enum MediaSessionActionType {
|
|
||||||
/// The action intent is to resume playback.
|
|
||||||
Play,
|
|
||||||
/// The action intent is to pause the currently active playback.
|
|
||||||
Pause,
|
|
||||||
/// The action intent is to move the playback time backward by a short period (i.e. a few
|
|
||||||
/// seconds).
|
|
||||||
SeekBackward,
|
|
||||||
/// The action intent is to move the playback time forward by a short period (i.e. a few
|
|
||||||
/// seconds).
|
|
||||||
SeekForward,
|
|
||||||
/// The action intent is to either start the current playback from the beginning if the
|
|
||||||
/// playback has a notion, of beginning, or move to the previous item in the playlist if the
|
|
||||||
/// playback has a notion of playlist.
|
|
||||||
PreviousTrack,
|
|
||||||
/// The action is to move to the playback to the next item in the playlist if the playback has
|
|
||||||
/// a notion of playlist.
|
|
||||||
NextTrack,
|
|
||||||
/// The action intent is to skip the advertisement that is currently playing.
|
|
||||||
SkipAd,
|
|
||||||
/// The action intent is to stop the playback and clear the state if appropriate.
|
|
||||||
Stop,
|
|
||||||
/// The action intent is to move the playback time to a specific time.
|
|
||||||
SeekTo,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<i32> for MediaSessionActionType {
|
|
||||||
fn from(value: i32) -> MediaSessionActionType {
|
|
||||||
match value {
|
|
||||||
1 => MediaSessionActionType::Play,
|
|
||||||
2 => MediaSessionActionType::Pause,
|
|
||||||
3 => MediaSessionActionType::SeekBackward,
|
|
||||||
4 => MediaSessionActionType::SeekForward,
|
|
||||||
5 => MediaSessionActionType::PreviousTrack,
|
|
||||||
6 => MediaSessionActionType::NextTrack,
|
|
||||||
7 => MediaSessionActionType::SkipAd,
|
|
||||||
8 => MediaSessionActionType::Stop,
|
|
||||||
9 => MediaSessionActionType::SeekTo,
|
|
||||||
_ => panic!("Unknown MediaSessionActionType"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(
|
|
||||||
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
|
||||||
)]
|
|
||||||
/// Index of gamepad in list of system's connected gamepads
|
|
||||||
pub struct GamepadIndex(pub usize);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
/// The minimum and maximum values that can be reported for axis or button input from this gamepad
|
|
||||||
pub struct GamepadInputBounds {
|
|
||||||
/// Minimum and maximum axis values
|
|
||||||
pub axis_bounds: (f64, f64),
|
|
||||||
/// Minimum and maximum button values
|
|
||||||
pub button_bounds: (f64, f64),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
/// The haptic effects supported by this gamepad
|
|
||||||
pub struct GamepadSupportedHapticEffects {
|
|
||||||
/// Gamepad support for dual rumble effects
|
|
||||||
pub supports_dual_rumble: bool,
|
|
||||||
/// Gamepad support for trigger rumble effects
|
|
||||||
pub supports_trigger_rumble: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
/// The type of Gamepad event
|
|
||||||
pub enum GamepadEvent {
|
|
||||||
/// A new gamepad has been connected
|
|
||||||
/// <https://www.w3.org/TR/gamepad/#event-gamepadconnected>
|
|
||||||
Connected(
|
|
||||||
GamepadIndex,
|
|
||||||
String,
|
|
||||||
GamepadInputBounds,
|
|
||||||
GamepadSupportedHapticEffects,
|
|
||||||
),
|
|
||||||
/// An existing gamepad has been disconnected
|
|
||||||
/// <https://www.w3.org/TR/gamepad/#event-gamepaddisconnected>
|
|
||||||
Disconnected(GamepadIndex),
|
|
||||||
/// An existing gamepad has been updated
|
|
||||||
/// <https://www.w3.org/TR/gamepad/#receiving-inputs>
|
|
||||||
Updated(GamepadIndex, GamepadUpdateType),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
/// The type of Gamepad input being updated
|
|
||||||
pub enum GamepadUpdateType {
|
|
||||||
/// Axis index and input value
|
|
||||||
/// <https://www.w3.org/TR/gamepad/#dfn-represents-a-standard-gamepad-axis>
|
|
||||||
Axis(usize, f64),
|
|
||||||
/// Button index and input value
|
|
||||||
/// <https://www.w3.org/TR/gamepad/#dfn-represents-a-standard-gamepad-button>
|
|
||||||
Button(usize, f64),
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ use base::id::{
|
||||||
use base::Epoch;
|
use base::Epoch;
|
||||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use embedder_traits::{EmbedderMsg, MediaSessionEvent};
|
use embedder_traits::{EmbedderMsg, MediaSessionEvent, TraversalDirection};
|
||||||
use euclid::default::Size2D as UntypedSize2D;
|
use euclid::default::Size2D as UntypedSize2D;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||||
|
@ -472,12 +472,3 @@ pub enum SWManagerMsg {
|
||||||
/// <https://github.com/servo/servo/issues/24660>
|
/// <https://github.com/servo/servo/issues/24660>
|
||||||
PostMessageToClient,
|
PostMessageToClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The direction of a history traversal
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
|
||||||
pub enum TraversalDirection {
|
|
||||||
/// Travel forward the given number of documents.
|
|
||||||
Forward(usize),
|
|
||||||
/// Travel backward the given number of documents.
|
|
||||||
Back(usize),
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ base64 = { workspace = true }
|
||||||
compositing_traits = { workspace = true }
|
compositing_traits = { workspace = true }
|
||||||
cookie = { workspace = true }
|
cookie = { workspace = true }
|
||||||
crossbeam-channel = { workspace = true }
|
crossbeam-channel = { workspace = true }
|
||||||
|
embedder_traits = { workspace = true }
|
||||||
euclid = { workspace = true }
|
euclid = { workspace = true }
|
||||||
http = { version = "0.2" }
|
http = { version = "0.2" }
|
||||||
image = { workspace = true }
|
image = { workspace = true }
|
||||||
|
|
|
@ -7,10 +7,11 @@ use std::time::{Duration, Instant};
|
||||||
use std::{cmp, thread};
|
use std::{cmp, thread};
|
||||||
|
|
||||||
use compositing_traits::ConstellationMsg;
|
use compositing_traits::ConstellationMsg;
|
||||||
|
use embedder_traits::{MouseButton, MouseEventType};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use keyboard_types::webdriver::KeyInputState;
|
use keyboard_types::webdriver::KeyInputState;
|
||||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||||
use script_traits::{MouseButton, MouseEventType, WebDriverCommandMsg};
|
use script_traits::WebDriverCommandMsg;
|
||||||
use webdriver::actions::{
|
use webdriver::actions::{
|
||||||
ActionSequence, ActionsType, GeneralAction, KeyAction, KeyActionItem, KeyDownAction,
|
ActionSequence, ActionsType, GeneralAction, KeyAction, KeyActionItem, KeyDownAction,
|
||||||
KeyUpAction, NullActionItem, PointerAction, PointerActionItem, PointerActionParameters,
|
KeyUpAction, NullActionItem, PointerAction, PointerActionItem, PointerActionParameters,
|
||||||
|
@ -83,7 +84,7 @@ fn compute_tick_duration(tick_actions: &ActionSequence) -> u64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn u64_to_mouse_button(button: u64) -> Option<MouseButton> {
|
fn u64_to_mouse_button(button: u64) -> Option<MouseButton> {
|
||||||
if MouseButton::Left as u64 == button {
|
if embedder_traits::MouseButton::Left as u64 == button {
|
||||||
Some(MouseButton::Left)
|
Some(MouseButton::Left)
|
||||||
} else if MouseButton::Middle as u64 == button {
|
} else if MouseButton::Middle as u64 == button {
|
||||||
Some(MouseButton::Middle)
|
Some(MouseButton::Middle)
|
||||||
|
|
|
@ -22,6 +22,7 @@ use capabilities::ServoCapabilities;
|
||||||
use compositing_traits::ConstellationMsg;
|
use compositing_traits::ConstellationMsg;
|
||||||
use cookie::{CookieBuilder, Expiration};
|
use cookie::{CookieBuilder, Expiration};
|
||||||
use crossbeam_channel::{after, select, unbounded, Receiver, Sender};
|
use crossbeam_channel::{after, select, unbounded, Receiver, Sender};
|
||||||
|
use embedder_traits::TraversalDirection;
|
||||||
use euclid::{Rect, Size2D};
|
use euclid::{Rect, Size2D};
|
||||||
use http::method::Method;
|
use http::method::Method;
|
||||||
use image::{DynamicImage, ImageFormat, RgbaImage};
|
use image::{DynamicImage, ImageFormat, RgbaImage};
|
||||||
|
@ -36,7 +37,7 @@ use script_traits::webdriver_msg::{
|
||||||
LoadStatus, WebDriverCookieError, WebDriverFrameId, WebDriverJSError, WebDriverJSResult,
|
LoadStatus, WebDriverCookieError, WebDriverFrameId, WebDriverJSError, WebDriverJSResult,
|
||||||
WebDriverJSValue, WebDriverScriptCommand,
|
WebDriverJSValue, WebDriverScriptCommand,
|
||||||
};
|
};
|
||||||
use script_traits::{LoadData, LoadOrigin, TraversalDirection, WebDriverCommandMsg};
|
use script_traits::{LoadData, LoadOrigin, WebDriverCommandMsg};
|
||||||
use serde::de::{Deserializer, MapAccess, Visitor};
|
use serde::de::{Deserializer, MapAccess, Visitor};
|
||||||
use serde::ser::Serializer;
|
use serde::ser::Serializer;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -13,15 +13,14 @@ use std::{env, fs};
|
||||||
use log::{info, trace};
|
use log::{info, trace};
|
||||||
use raw_window_handle::HasDisplayHandle;
|
use raw_window_handle::HasDisplayHandle;
|
||||||
use servo::base::id::WebViewId;
|
use servo::base::id::WebViewId;
|
||||||
use servo::compositing::windowing::{EmbedderEvent, WindowMethods};
|
use servo::compositing::windowing::{AnimationState, EmbedderEvent, WindowMethods};
|
||||||
use servo::compositing::CompositeTarget;
|
use servo::compositing::CompositeTarget;
|
||||||
use servo::config::opts::Opts;
|
use servo::config::opts::Opts;
|
||||||
use servo::config::prefs::Preferences;
|
use servo::config::prefs::Preferences;
|
||||||
use servo::embedder_traits::EventLoopWaker;
|
|
||||||
use servo::servo_config::pref;
|
use servo::servo_config::pref;
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
use servo::Servo;
|
use servo::{EventLoopWaker, Servo};
|
||||||
use surfman::Connection;
|
use surfman::Connection;
|
||||||
use webxr::glwindow::GlWindowDiscovery;
|
use webxr::glwindow::GlWindowDiscovery;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
@ -201,7 +200,7 @@ impl App {
|
||||||
fn get_coordinates(&self) -> servo::compositing::windowing::EmbedderCoordinates {
|
fn get_coordinates(&self) -> servo::compositing::windowing::EmbedderCoordinates {
|
||||||
self.0.get_coordinates()
|
self.0.get_coordinates()
|
||||||
}
|
}
|
||||||
fn set_animation_state(&self, state: servo::compositing::windowing::AnimationState) {
|
fn set_animation_state(&self, state: AnimationState) {
|
||||||
self.0.set_animation_state(state);
|
self.0.set_animation_state(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
use net::protocols::ProtocolRegistry;
|
use net::protocols::ProtocolRegistry;
|
||||||
use servo::compositing::windowing::EmbedderMethods;
|
use servo::compositing::windowing::EmbedderMethods;
|
||||||
use servo::embedder_traits::{EmbedderProxy, EventLoopWaker};
|
|
||||||
use servo::servo_config::pref;
|
use servo::servo_config::pref;
|
||||||
|
use servo::{EmbedderProxy, EventLoopWaker};
|
||||||
use webxr::glwindow::GlWindowDiscovery;
|
use webxr::glwindow::GlWindowDiscovery;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use webxr::openxr::OpenXrDiscovery;
|
use webxr::openxr::OpenXrDiscovery;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::sync::{Arc, Condvar, Mutex};
|
||||||
use std::time;
|
use std::time;
|
||||||
|
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use servo::embedder_traits::EventLoopWaker;
|
use servo::EventLoopWaker;
|
||||||
use winit::error::EventLoopError;
|
use winit::error::EventLoopError;
|
||||||
use winit::event_loop::EventLoop as WinitEventLoop;
|
use winit::event_loop::EventLoop as WinitEventLoop;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
|
|
@ -15,14 +15,15 @@ use servo::compositing::windowing::{
|
||||||
AnimationState, EmbedderCoordinates, EmbedderEvent, MouseWindowEvent, WindowMethods,
|
AnimationState, EmbedderCoordinates, EmbedderEvent, MouseWindowEvent, WindowMethods,
|
||||||
};
|
};
|
||||||
use servo::config::opts::Opts;
|
use servo::config::opts::Opts;
|
||||||
use servo::embedder_traits::Cursor;
|
|
||||||
use servo::keyboard_types::{Key, KeyState, KeyboardEvent};
|
|
||||||
use servo::script_traits::{TouchEventType, WheelDelta, WheelMode};
|
|
||||||
use servo::servo_config::pref;
|
use servo::servo_config::pref;
|
||||||
use servo::servo_geometry::DeviceIndependentPixel;
|
use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||||
use servo::webrender_api::ScrollLocation;
|
use servo::webrender_api::ScrollLocation;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
|
use servo::{
|
||||||
|
Cursor, Key, KeyState, KeyboardEvent, MouseButton as ServoMouseButton, Theme, TouchEventType,
|
||||||
|
TouchId, WheelDelta, WheelMode,
|
||||||
|
};
|
||||||
use surfman::{Context, Device, SurfaceType};
|
use surfman::{Context, Device, SurfaceType};
|
||||||
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
||||||
use winit::event::{ElementState, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase};
|
use winit::event::{ElementState, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase};
|
||||||
|
@ -40,7 +41,7 @@ pub struct Window {
|
||||||
screen_size: Size2D<u32, DeviceIndependentPixel>,
|
screen_size: Size2D<u32, DeviceIndependentPixel>,
|
||||||
inner_size: Cell<PhysicalSize<u32>>,
|
inner_size: Cell<PhysicalSize<u32>>,
|
||||||
toolbar_height: Cell<Length<f32, DeviceIndependentPixel>>,
|
toolbar_height: Cell<Length<f32, DeviceIndependentPixel>>,
|
||||||
mouse_down_button: Cell<Option<winit::event::MouseButton>>,
|
mouse_down_button: Cell<Option<MouseButton>>,
|
||||||
mouse_down_point: Cell<Point2D<i32, DevicePixel>>,
|
mouse_down_point: Cell<Point2D<i32, DevicePixel>>,
|
||||||
monitor: winit::monitor::MonitorHandle,
|
monitor: winit::monitor::MonitorHandle,
|
||||||
event_queue: RefCell<Vec<EmbedderEvent>>,
|
event_queue: RefCell<Vec<EmbedderEvent>>,
|
||||||
|
@ -228,18 +229,16 @@ impl Window {
|
||||||
/// Helper function to handle a click
|
/// Helper function to handle a click
|
||||||
fn handle_mouse(
|
fn handle_mouse(
|
||||||
&self,
|
&self,
|
||||||
button: winit::event::MouseButton,
|
button: MouseButton,
|
||||||
action: winit::event::ElementState,
|
action: ElementState,
|
||||||
coords: Point2D<i32, DevicePixel>,
|
coords: Point2D<i32, DevicePixel>,
|
||||||
) {
|
) {
|
||||||
use servo::script_traits::MouseButton;
|
|
||||||
|
|
||||||
let max_pixel_dist = 10.0 * self.hidpi_factor().get();
|
let max_pixel_dist = 10.0 * self.hidpi_factor().get();
|
||||||
let mouse_button = match &button {
|
let mouse_button = match &button {
|
||||||
winit::event::MouseButton::Left => MouseButton::Left,
|
MouseButton::Left => ServoMouseButton::Left,
|
||||||
winit::event::MouseButton::Right => MouseButton::Right,
|
MouseButton::Right => ServoMouseButton::Right,
|
||||||
winit::event::MouseButton::Middle => MouseButton::Middle,
|
MouseButton::Middle => ServoMouseButton::Middle,
|
||||||
_ => MouseButton::Left,
|
_ => ServoMouseButton::Left,
|
||||||
};
|
};
|
||||||
let event = match action {
|
let event = match action {
|
||||||
ElementState::Pressed => {
|
ElementState::Pressed => {
|
||||||
|
@ -455,8 +454,6 @@ impl WindowPortsMethods for Window {
|
||||||
self.event_queue.borrow_mut().push(scroll_event);
|
self.event_queue.borrow_mut().push(scroll_event);
|
||||||
},
|
},
|
||||||
winit::event::WindowEvent::Touch(touch) => {
|
winit::event::WindowEvent::Touch(touch) => {
|
||||||
use servo::script_traits::TouchId;
|
|
||||||
|
|
||||||
let phase = winit_phase_to_touch_event_type(touch.phase);
|
let phase = winit_phase_to_touch_event_type(touch.phase);
|
||||||
let id = TouchId(touch.id as i32);
|
let id = TouchId(touch.id as i32);
|
||||||
let position = touch.location;
|
let position = touch.location;
|
||||||
|
@ -484,8 +481,8 @@ impl WindowPortsMethods for Window {
|
||||||
},
|
},
|
||||||
winit::event::WindowEvent::ThemeChanged(theme) => {
|
winit::event::WindowEvent::ThemeChanged(theme) => {
|
||||||
let theme = match theme {
|
let theme = match theme {
|
||||||
winit::window::Theme::Light => servo::script_traits::Theme::Light,
|
winit::window::Theme::Light => Theme::Light,
|
||||||
winit::window::Theme::Dark => servo::script_traits::Theme::Dark,
|
winit::window::Theme::Dark => Theme::Dark,
|
||||||
};
|
};
|
||||||
self.event_queue
|
self.event_queue
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
|
|
@ -21,12 +21,11 @@ use glow::NativeFramebuffer;
|
||||||
use log::{trace, warn};
|
use log::{trace, warn};
|
||||||
use servo::base::id::WebViewId;
|
use servo::base::id::WebViewId;
|
||||||
use servo::compositing::windowing::EmbedderEvent;
|
use servo::compositing::windowing::EmbedderEvent;
|
||||||
use servo::script_traits::TraversalDirection;
|
|
||||||
use servo::servo_geometry::DeviceIndependentPixel;
|
use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use servo::webrender_api::units::DevicePixel;
|
use servo::webrender_api::units::DevicePixel;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
use servo::TopLevelBrowsingContextId;
|
use servo::{TopLevelBrowsingContextId, TraversalDirection};
|
||||||
use winit::event::{ElementState, MouseButton, WindowEvent};
|
use winit::event::{ElementState, MouseButton, WindowEvent};
|
||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::event_loop::ActiveEventLoop;
|
||||||
use winit::window::Window;
|
use winit::window::Window;
|
||||||
|
|
|
@ -22,7 +22,7 @@ macro_rules! trace_winit_event {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Log an event from servo ([servo::embedder_traits::EmbedderMsg]) at trace level.
|
/// Log an event from servo ([servo::EmbedderMsg]) at trace level.
|
||||||
/// - To disable tracing: RUST_LOG='servoshell<servo@=off'
|
/// - To disable tracing: RUST_LOG='servoshell<servo@=off'
|
||||||
/// - To enable tracing: RUST_LOG='servoshell<servo@'
|
/// - To enable tracing: RUST_LOG='servoshell<servo@'
|
||||||
/// - Recommended filters when tracing is enabled:
|
/// - Recommended filters when tracing is enabled:
|
||||||
|
@ -139,7 +139,7 @@ mod from_servo {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LogTarget for servo::embedder_traits::EmbedderMsg {
|
impl LogTarget for servo::EmbedderMsg {
|
||||||
fn log_target(&self) -> &'static str {
|
fn log_target(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Status(..) => target!("Status"),
|
Self::Status(..) => target!("Status"),
|
||||||
|
|
|
@ -20,19 +20,17 @@ use log::{debug, error, info, trace, warn};
|
||||||
use servo::base::id::TopLevelBrowsingContextId as WebViewId;
|
use servo::base::id::TopLevelBrowsingContextId as WebViewId;
|
||||||
use servo::compositing::windowing::{EmbedderEvent, WebRenderDebugOption};
|
use servo::compositing::windowing::{EmbedderEvent, WebRenderDebugOption};
|
||||||
use servo::config::opts::Opts;
|
use servo::config::opts::Opts;
|
||||||
use servo::embedder_traits::{
|
|
||||||
CompositorEventVariant, ContextMenuResult, DualRumbleEffectParams, EmbedderMsg, FilterPattern,
|
|
||||||
GamepadHapticEffectType, PermissionPrompt, PermissionRequest, PromptCredentialsInput,
|
|
||||||
PromptDefinition, PromptOrigin, PromptResult,
|
|
||||||
};
|
|
||||||
use servo::ipc_channel::ipc::IpcSender;
|
use servo::ipc_channel::ipc::IpcSender;
|
||||||
use servo::script_traits::{
|
|
||||||
ClipboardEventType, GamepadEvent, GamepadIndex, GamepadInputBounds,
|
|
||||||
GamepadSupportedHapticEffects, GamepadUpdateType, TouchEventType, TraversalDirection,
|
|
||||||
};
|
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use servo::webrender_api::units::DeviceRect;
|
use servo::webrender_api::units::DeviceRect;
|
||||||
use servo::webrender_api::ScrollLocation;
|
use servo::webrender_api::ScrollLocation;
|
||||||
|
use servo::{
|
||||||
|
ClipboardEventType, CompositorEventVariant, ContextMenuResult, DualRumbleEffectParams,
|
||||||
|
EmbedderMsg, FilterPattern, GamepadEvent, GamepadHapticEffectType, GamepadIndex,
|
||||||
|
GamepadInputBounds, GamepadSupportedHapticEffects, GamepadUpdateType, PermissionPrompt,
|
||||||
|
PermissionRequest, PromptCredentialsInput, PromptDefinition, PromptOrigin, PromptResult,
|
||||||
|
TouchEventType, TraversalDirection,
|
||||||
|
};
|
||||||
use tinyfiledialogs::{self, MessageBoxIcon, OkCancel, YesNo};
|
use tinyfiledialogs::{self, MessageBoxIcon, OkCancel, YesNo};
|
||||||
|
|
||||||
use super::keyutils::{CMD_OR_ALT, CMD_OR_CONTROL};
|
use super::keyutils::{CMD_OR_ALT, CMD_OR_CONTROL};
|
||||||
|
|
|
@ -9,9 +9,9 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use euclid::{Length, Scale};
|
use euclid::{Length, Scale};
|
||||||
use servo::compositing::windowing::{EmbedderEvent, WindowMethods};
|
use servo::compositing::windowing::{EmbedderEvent, WindowMethods};
|
||||||
use servo::embedder_traits::Cursor;
|
|
||||||
use servo::servo_geometry::DeviceIndependentPixel;
|
use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePixel};
|
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePixel};
|
||||||
|
use servo::Cursor;
|
||||||
|
|
||||||
// This should vary by zoom level and maybe actual text size (focused or under cursor)
|
// This should vary by zoom level and maybe actual text size (focused or under cursor)
|
||||||
pub const LINE_HEIGHT: f32 = 38.0;
|
pub const LINE_HEIGHT: f32 = 38.0;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use servo::embedder_traits::resources::{Resource, ResourceReaderMethods};
|
use servo::resources::{Resource, ResourceReaderMethods};
|
||||||
|
|
||||||
pub(crate) struct ResourceReaderInstance;
|
pub(crate) struct ResourceReaderInstance;
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,15 @@ use std::rc::Rc;
|
||||||
use servo::base::id::WebViewId;
|
use servo::base::id::WebViewId;
|
||||||
use servo::compositing::windowing::EmbedderEvent;
|
use servo::compositing::windowing::EmbedderEvent;
|
||||||
use servo::compositing::CompositeTarget;
|
use servo::compositing::CompositeTarget;
|
||||||
use servo::embedder_traits::resources;
|
|
||||||
/// The EventLoopWaker::wake function will be called from any thread.
|
|
||||||
/// It will be called to notify embedder that some events are available,
|
|
||||||
/// and that perform_updates need to be called
|
|
||||||
pub use servo::embedder_traits::EventLoopWaker;
|
|
||||||
pub use servo::embedder_traits::{InputMethodType, MediaSessionPlaybackState, PromptResult};
|
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
pub use servo::webrender_api::units::DeviceIntRect;
|
pub use servo::webrender_api::units::DeviceIntRect;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
use servo::{self, Servo};
|
/// The EventLoopWaker::wake function will be called from any thread.
|
||||||
|
/// It will be called to notify embedder that some events are available,
|
||||||
|
/// and that perform_updates need to be called
|
||||||
|
pub use servo::EventLoopWaker;
|
||||||
|
use servo::{self, resources, Servo};
|
||||||
|
pub use servo::{InputMethodType, MediaSessionPlaybackState, PromptResult};
|
||||||
use surfman::{Connection, SurfaceType};
|
use surfman::{Connection, SurfaceType};
|
||||||
|
|
||||||
use crate::egl::android::resources::ResourceReaderInstance;
|
use crate::egl::android::resources::ResourceReaderInstance;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use servo::embedder_traits::{InputMethodType, MediaSessionPlaybackState, PromptResult};
|
|
||||||
use servo::webrender_api::units::DeviceIntRect;
|
use servo::webrender_api::units::DeviceIntRect;
|
||||||
|
use servo::{InputMethodType, MediaSessionPlaybackState, PromptResult};
|
||||||
|
|
||||||
/// Callbacks. Implemented by embedder. Called by Servo.
|
/// Callbacks. Implemented by embedder. Called by Servo.
|
||||||
pub trait HostTrait {
|
pub trait HostTrait {
|
||||||
|
|
|
@ -21,9 +21,8 @@ use napi_ohos::{Env, JsObject, JsString, NapiRaw};
|
||||||
use ohos_ime::{AttachOptions, Ime, ImeProxy, RawTextEditorProxy};
|
use ohos_ime::{AttachOptions, Ime, ImeProxy, RawTextEditorProxy};
|
||||||
use ohos_ime_sys::types::InputMethod_EnterKeyType;
|
use ohos_ime_sys::types::InputMethod_EnterKeyType;
|
||||||
use servo::compositing::windowing::EmbedderEvent;
|
use servo::compositing::windowing::EmbedderEvent;
|
||||||
use servo::embedder_traits;
|
|
||||||
use servo::embedder_traits::{InputMethodType, PromptResult};
|
|
||||||
use servo::style::Zero;
|
use servo::style::Zero;
|
||||||
|
use servo::{InputMethodType, MediaSessionPlaybackState, PromptResult};
|
||||||
use simpleservo::EventLoopWaker;
|
use simpleservo::EventLoopWaker;
|
||||||
use xcomponent_sys::{
|
use xcomponent_sys::{
|
||||||
OH_NativeXComponent, OH_NativeXComponent_Callback, OH_NativeXComponent_GetKeyEvent,
|
OH_NativeXComponent, OH_NativeXComponent_Callback, OH_NativeXComponent_GetKeyEvent,
|
||||||
|
@ -740,7 +739,7 @@ impl HostTrait for HostCallbacks {
|
||||||
/// and shows the soft keyboard with default settings.
|
/// and shows the soft keyboard with default settings.
|
||||||
fn on_ime_show(
|
fn on_ime_show(
|
||||||
&self,
|
&self,
|
||||||
input_type: embedder_traits::InputMethodType,
|
input_type: InputMethodType,
|
||||||
_text: Option<(String, i32)>,
|
_text: Option<(String, i32)>,
|
||||||
multiline: bool,
|
multiline: bool,
|
||||||
_bounds: servo::webrender_api::units::DeviceIntRect,
|
_bounds: servo::webrender_api::units::DeviceIntRect,
|
||||||
|
@ -790,10 +789,7 @@ impl HostTrait for HostCallbacks {
|
||||||
warn!("on_media_session_metadata not implemented");
|
warn!("on_media_session_metadata not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_media_session_playback_state_change(
|
fn on_media_session_playback_state_change(&self, state: MediaSessionPlaybackState) {
|
||||||
&self,
|
|
||||||
state: servo::embedder_traits::MediaSessionPlaybackState,
|
|
||||||
) {
|
|
||||||
warn!("on_media_session_playback_state_change not implemented");
|
warn!("on_media_session_playback_state_change not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use servo::embedder_traits::resources::{Resource, ResourceReaderMethods};
|
use servo::resources::{Resource, ResourceReaderMethods};
|
||||||
|
|
||||||
pub(crate) struct ResourceReaderInstance {
|
pub(crate) struct ResourceReaderInstance {
|
||||||
resource_dir: PathBuf,
|
resource_dir: PathBuf,
|
||||||
|
|
|
@ -11,15 +11,14 @@ use log::{debug, error, info};
|
||||||
use servo::base::id::WebViewId;
|
use servo::base::id::WebViewId;
|
||||||
use servo::compositing::windowing::EmbedderEvent;
|
use servo::compositing::windowing::EmbedderEvent;
|
||||||
use servo::compositing::CompositeTarget;
|
use servo::compositing::CompositeTarget;
|
||||||
use servo::embedder_traits::resources;
|
|
||||||
/// The EventLoopWaker::wake function will be called from any thread.
|
|
||||||
/// It will be called to notify embedder that some events are available,
|
|
||||||
/// and that perform_updates need to be called
|
|
||||||
pub use servo::embedder_traits::EventLoopWaker;
|
|
||||||
use servo::euclid::Size2D;
|
use servo::euclid::Size2D;
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
use servo::{self, Servo};
|
/// The EventLoopWaker::wake function will be called from any thread.
|
||||||
|
/// It will be called to notify embedder that some events are available,
|
||||||
|
/// and that perform_updates need to be called
|
||||||
|
pub use servo::EventLoopWaker;
|
||||||
|
use servo::{self, resources, Servo};
|
||||||
use surfman::{Connection, SurfaceType};
|
use surfman::{Connection, SurfaceType};
|
||||||
use xcomponent_sys::{OH_NativeXComponent, OH_NativeXComponent_GetXComponentSize};
|
use xcomponent_sys::{OH_NativeXComponent, OH_NativeXComponent_GetXComponentSize};
|
||||||
|
|
||||||
|
|
|
@ -15,20 +15,17 @@ use servo::compositing::windowing::{
|
||||||
AnimationState, EmbedderCoordinates, EmbedderEvent, EmbedderMethods, MouseWindowEvent,
|
AnimationState, EmbedderCoordinates, EmbedderEvent, EmbedderMethods, MouseWindowEvent,
|
||||||
WindowMethods,
|
WindowMethods,
|
||||||
};
|
};
|
||||||
use servo::embedder_traits::{
|
|
||||||
ContextMenuResult, EmbedderMsg, EmbedderProxy, EventLoopWaker, MediaSessionEvent,
|
|
||||||
PermissionPrompt, PermissionRequest, PromptDefinition, PromptOrigin, PromptResult,
|
|
||||||
};
|
|
||||||
use servo::euclid::{Box2D, Point2D, Rect, Scale, Size2D, Vector2D};
|
use servo::euclid::{Box2D, Point2D, Rect, Scale, Size2D, Vector2D};
|
||||||
use servo::keyboard_types::{Key, KeyState, KeyboardEvent};
|
|
||||||
use servo::script_traits::{
|
|
||||||
MediaSessionActionType, MouseButton, TouchEventType, TouchId, TraversalDirection,
|
|
||||||
};
|
|
||||||
use servo::servo_geometry::DeviceIndependentPixel;
|
use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::webrender_api::units::DevicePixel;
|
use servo::webrender_api::units::DevicePixel;
|
||||||
use servo::webrender_api::ScrollLocation;
|
use servo::webrender_api::ScrollLocation;
|
||||||
use servo::webrender_traits::SurfmanRenderingContext;
|
use servo::webrender_traits::SurfmanRenderingContext;
|
||||||
use servo::{Servo, TopLevelBrowsingContextId};
|
use servo::{
|
||||||
|
ContextMenuResult, EmbedderMsg, EmbedderProxy, EventLoopWaker, Key, KeyState, KeyboardEvent,
|
||||||
|
MediaSessionActionType, MediaSessionEvent, MouseButton, PermissionPrompt, PermissionRequest,
|
||||||
|
PromptDefinition, PromptOrigin, PromptResult, Servo, TopLevelBrowsingContextId, TouchEventType,
|
||||||
|
TouchId, TraversalDirection,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::egl::host_trait::HostTrait;
|
use crate::egl::host_trait::HostTrait;
|
||||||
use crate::prefs::ServoShellPreferences;
|
use crate::prefs::ServoShellPreferences;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::sync::Mutex;
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use servo::embedder_traits::resources::{self, Resource};
|
use servo::resources::{self, Resource};
|
||||||
|
|
||||||
static CMD_RESOURCE_DIR: Mutex<Option<PathBuf>> = Mutex::new(None);
|
static CMD_RESOURCE_DIR: Mutex<Option<PathBuf>> = Mutex::new(None);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue