mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
libservo: Clean up Servo exports and export more at the root (#40951)
This change makes it easier for embedders to embed the types that they need by exporting almost everything necessary to use Servo at the root of libservo, apart from a few exceptions. In addition, the `Servo` is moved to its own file so that public exports can be more easily spotted from `components/servo/lib.rs`. Testing: This should not change behavior and is thus covered by existing tests. Fixes: #18475. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -8216,8 +8216,6 @@ dependencies = [
|
||||
"mime_guess",
|
||||
"napi-derive-ohos",
|
||||
"napi-ohos",
|
||||
"net",
|
||||
"net_traits",
|
||||
"nix",
|
||||
"objc2-app-kit 0.3.2",
|
||||
"objc2-foundation 0.3.2",
|
||||
|
||||
@@ -7,7 +7,7 @@ use constellation_traits::EmbedderToConstellationMessage;
|
||||
use embedder_traits::{JSValue, JavaScriptEvaluationError, JavaScriptEvaluationId};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::ConstellationProxy;
|
||||
use crate::proxies::ConstellationProxy;
|
||||
|
||||
struct PendingEvaluation {
|
||||
callback: Box<dyn FnOnce(Result<JSValue, JavaScriptEvaluationError>)>,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1190
components/servo/servo.rs
Normal file
1190
components/servo/servo.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,10 +29,11 @@ use webrender_api::units::{DeviceIntRect, DevicePixel, DevicePoint, DeviceRect};
|
||||
|
||||
use crate::clipboard_delegate::{ClipboardDelegate, DefaultClipboardDelegate};
|
||||
use crate::javascript_evaluator::JavaScriptEvaluator;
|
||||
use crate::proxies::ConstellationProxy;
|
||||
use crate::webview_delegate::{DefaultWebViewDelegate, WebViewDelegate};
|
||||
use crate::{
|
||||
ColorPicker, ConstellationProxy, ContextMenu, EmbedderControl, InputMethodControl,
|
||||
SelectElement, Servo, WebRenderDebugOption,
|
||||
ColorPicker, ContextMenu, EmbedderControl, InputMethodControl, SelectElement, Servo,
|
||||
WebRenderDebugOption,
|
||||
};
|
||||
|
||||
pub(crate) const MINIMUM_WEBVIEW_SIZE: Size2D<i32, DevicePixel> = Size2D::new(1, 1);
|
||||
|
||||
@@ -20,8 +20,9 @@ use serde::Serialize;
|
||||
use url::Url;
|
||||
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
|
||||
use crate::proxies::ConstellationProxy;
|
||||
use crate::responders::ServoErrorSender;
|
||||
use crate::{ConstellationProxy, RegisterOrUnregister, WebView};
|
||||
use crate::{RegisterOrUnregister, WebView};
|
||||
|
||||
/// A request to navigate a [`WebView`] or one of its inner frames. This can be handled
|
||||
/// asynchronously. If not handled, the request will automatically be allowed.
|
||||
@@ -801,7 +802,7 @@ mod test {
|
||||
fn test_allow_deny_request() {
|
||||
use base::generic_channel;
|
||||
|
||||
use crate::ServoErrorChannel;
|
||||
use crate::responders::ServoErrorChannel;
|
||||
|
||||
for default_response in [AllowOrDeny::Allow, AllowOrDeny::Deny] {
|
||||
// Explicit allow yields allow and nothing else
|
||||
@@ -867,7 +868,7 @@ mod test {
|
||||
fn test_authentication_request() {
|
||||
use base::generic_channel;
|
||||
|
||||
use crate::ServoErrorChannel;
|
||||
use crate::responders::ServoErrorChannel;
|
||||
|
||||
let url = Url::parse("https://example.com").expect("Guaranteed by argument");
|
||||
|
||||
@@ -917,7 +918,7 @@ mod test {
|
||||
use base::generic_channel;
|
||||
use http::{HeaderMap, Method, StatusCode};
|
||||
|
||||
use crate::ServoErrorChannel;
|
||||
use crate::responders::ServoErrorChannel;
|
||||
|
||||
let web_resource_request = || WebResourceRequest {
|
||||
method: Method::GET,
|
||||
|
||||
@@ -115,8 +115,6 @@ egui_glow = { version = "0.33.2", features = ["winit"] }
|
||||
gilrs = "0.11.0"
|
||||
glow = { workspace = true }
|
||||
headers = { workspace = true }
|
||||
net = { path = "../../components/net" }
|
||||
net_traits = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
# For optional feature servo_allocator/use-system-allocator and servo_allocator/allocation-tracking
|
||||
servo_allocator = { path = "../../components/allocator" }
|
||||
|
||||
@@ -14,41 +14,39 @@ pub(crate) fn setup_gl_accelerated_media(_: RefMut<'_, Device>, _: RefMut<'_, Co
|
||||
|
||||
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
|
||||
pub(crate) fn setup_gl_accelerated_media(device: RefMut<'_, Device>, context: RefMut<'_, Context>) {
|
||||
use servo::Servo;
|
||||
use servo::media::{GlContext, NativeDisplay};
|
||||
use servo::{MediaGlContext, MediaNativeDisplay, Servo};
|
||||
use surfman::platform::generic::multi::connection::NativeConnection;
|
||||
use surfman::platform::generic::multi::context::NativeContext;
|
||||
|
||||
let api = api(&device, &context);
|
||||
let context = match device.native_context(&context) {
|
||||
NativeContext::Default(NativeContext::Default(native_context)) => {
|
||||
GlContext::Egl(native_context.egl_context as usize)
|
||||
MediaGlContext::Egl(native_context.egl_context as usize)
|
||||
},
|
||||
NativeContext::Default(NativeContext::Alternate(native_context)) => {
|
||||
GlContext::Egl(native_context.egl_context as usize)
|
||||
MediaGlContext::Egl(native_context.egl_context as usize)
|
||||
},
|
||||
NativeContext::Alternate(_) => GlContext::Unknown,
|
||||
NativeContext::Alternate(_) => MediaGlContext::Unknown,
|
||||
};
|
||||
let display = match device.connection().native_connection() {
|
||||
surfman::NativeConnection::Default(NativeConnection::Default(connection)) => {
|
||||
NativeDisplay::Egl(connection.0 as usize)
|
||||
MediaNativeDisplay::Egl(connection.0 as usize)
|
||||
},
|
||||
surfman::NativeConnection::Default(NativeConnection::Alternate(connection)) => {
|
||||
NativeDisplay::X11(connection.x11_display as usize)
|
||||
MediaNativeDisplay::X11(connection.x11_display as usize)
|
||||
},
|
||||
surfman::NativeConnection::Alternate(_) => NativeDisplay::Unknown,
|
||||
surfman::NativeConnection::Alternate(_) => MediaNativeDisplay::Unknown,
|
||||
};
|
||||
Servo::initialize_gl_accelerated_media(display, api, context);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub(crate) fn setup_gl_accelerated_media(device: RefMut<'_, Device>, context: RefMut<'_, Context>) {
|
||||
use servo::Servo;
|
||||
use servo::media::{GlContext, NativeDisplay};
|
||||
use servo::{MediaGlContext, MediaNativeDisplay, Servo};
|
||||
|
||||
let api = api(&device, &context);
|
||||
let context = GlContext::Egl(device.native_context(&context).egl_context as usize);
|
||||
let display = NativeDisplay::Egl(device.native_device().egl_display as usize);
|
||||
let context = MediaGlContext::Egl(device.native_context(&context).egl_context as usize);
|
||||
let display = MediaNativeDisplay::Egl(device.native_device().egl_display as usize);
|
||||
Servo::initialize_gl_accelerated_media(display, api, context);
|
||||
}
|
||||
|
||||
@@ -56,8 +54,8 @@ pub(crate) fn setup_gl_accelerated_media(device: RefMut<'_, Device>, context: Re
|
||||
all(target_os = "linux", not(target_env = "ohos")),
|
||||
target_os = "windows"
|
||||
))]
|
||||
fn api(device: &RefMut<Device>, context: &RefMut<Context>) -> servo::media::GlApi {
|
||||
use servo::media::GlApi;
|
||||
fn api(device: &RefMut<Device>, context: &RefMut<Context>) -> servo::MediaGlApi {
|
||||
use servo::MediaGlApi;
|
||||
use surfman::GLApi;
|
||||
|
||||
let descriptor = device.context_descriptor(context);
|
||||
@@ -65,9 +63,9 @@ fn api(device: &RefMut<Device>, context: &RefMut<Context>) -> servo::media::GlAp
|
||||
let major = attributes.version.major;
|
||||
let minor = attributes.version.minor;
|
||||
match device.connection().gl_api() {
|
||||
GLApi::GL if major >= 3 && minor >= 2 => GlApi::OpenGL3,
|
||||
GLApi::GL => GlApi::OpenGL,
|
||||
GLApi::GLES if major > 1 => GlApi::Gles2,
|
||||
GLApi::GLES => GlApi::Gles1,
|
||||
GLApi::GL if major >= 3 && minor >= 2 => MediaGlApi::OpenGL3,
|
||||
GLApi::GL => MediaGlApi::OpenGL,
|
||||
GLApi::GLES if major > 1 => MediaGlApi::Gles2,
|
||||
GLApi::GLES => MediaGlApi::Gles1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,10 @@ use std::rc::Rc;
|
||||
use std::time::Instant;
|
||||
use std::{env, fs};
|
||||
|
||||
use net::protocols::ProtocolRegistry;
|
||||
use servo::config::opts::Opts;
|
||||
use servo::config::prefs::Preferences;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::user_content_manager::{UserContentManager, UserScript};
|
||||
use servo::{EventLoopWaker, ServoBuilder};
|
||||
use servo::protocol_handler::ProtocolRegistry;
|
||||
use servo::{
|
||||
EventLoopWaker, Opts, Preferences, ServoBuilder, ServoUrl, UserContentManager, UserScript,
|
||||
};
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::event::WindowEvent;
|
||||
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoopProxy};
|
||||
|
||||
@@ -11,12 +11,11 @@ use egui::{
|
||||
use egui_file_dialog::{DialogState, FileDialog as EguiFileDialog};
|
||||
use euclid::Length;
|
||||
use log::warn;
|
||||
use servo::base::generic_channel::GenericSender;
|
||||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::{
|
||||
AlertResponse, AuthenticationRequest, ColorPicker, ConfirmResponse, ContextMenu,
|
||||
ContextMenuItem, EmbedderControlId, FilePicker, PermissionRequest, PromptResponse, RgbColor,
|
||||
SelectElement, SelectElementOption, SelectElementOptionOrOptgroup, SimpleDialog,
|
||||
ContextMenuItem, DeviceIndependentPixel, EmbedderControlId, FilePicker, GenericSender,
|
||||
PermissionRequest, PromptResponse, RgbColor, SelectElement, SelectElementOption,
|
||||
SelectElementOptionOrOptgroup, SimpleDialog,
|
||||
};
|
||||
|
||||
/// The minimum width of many UI elements including dialog boxes and menus,
|
||||
|
||||
@@ -7,10 +7,9 @@ use std::collections::HashMap;
|
||||
use gilrs::ff::{BaseEffect, BaseEffectType, Effect, EffectBuilder, Repeat, Replay, Ticks};
|
||||
use gilrs::{EventType, Gilrs};
|
||||
use log::{debug, warn};
|
||||
use servo::ipc_channel::ipc::IpcSender;
|
||||
use servo::{
|
||||
GamepadEvent, GamepadHapticEffectType, GamepadIndex, GamepadInputBounds,
|
||||
GamepadSupportedHapticEffects, GamepadUpdateType, InputEvent, WebView,
|
||||
GamepadSupportedHapticEffects, GamepadUpdateType, InputEvent, IpcSender, WebView,
|
||||
};
|
||||
|
||||
pub struct HapticEffect {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use euclid::{Point2D, Size2D};
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::DevicePixel;
|
||||
use winit::dpi::{PhysicalPosition, PhysicalSize};
|
||||
|
||||
pub fn winit_size_to_euclid_size<T>(size: PhysicalSize<T>) -> Size2D<T, DevicePixel> {
|
||||
|
||||
@@ -17,12 +17,9 @@ use egui_glow::{CallbackFn, EguiGlow};
|
||||
use egui_winit::EventResponse;
|
||||
use euclid::{Box2D, Length, Point2D, Rect, Scale, Size2D};
|
||||
use log::warn;
|
||||
use servo::base::id::WebViewId;
|
||||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::{
|
||||
Image, LoadStatus, OffscreenRenderingContext, PixelFormat, PrefValue, RenderingContext, WebView,
|
||||
DeviceIndependentPixel, DevicePixel, Image, LoadStatus, OffscreenRenderingContext, PixelFormat,
|
||||
PrefValue, RenderingContext, ServoUrl, WebView, WebViewId,
|
||||
};
|
||||
use winit::event::{ElementState, MouseButton, WindowEvent};
|
||||
use winit::event_loop::{ActiveEventLoop, EventLoopProxy};
|
||||
|
||||
@@ -17,21 +17,15 @@ use euclid::{Angle, Length, Point2D, Rotation3D, Scale, Size2D, UnknownUnit, Vec
|
||||
use keyboard_types::ShortcutMatcher;
|
||||
use log::{debug, info, warn};
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawWindowHandle};
|
||||
use servo::base::generic_channel::GenericSender;
|
||||
use servo::servo_geometry::{
|
||||
DeviceIndependentIntRect, DeviceIndependentPixel, convert_rect_to_css_pixel,
|
||||
};
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::webrender_api::units::{
|
||||
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel, DevicePoint,
|
||||
};
|
||||
use servo::{
|
||||
AuthenticationRequest, Cursor, EmbedderControl, EmbedderControlId, ImeEvent, InputEvent,
|
||||
InputEventId, InputEventResult, InputMethodControl, Key, KeyState, KeyboardEvent, Modifiers,
|
||||
MouseButton as ServoMouseButton, MouseButtonAction, MouseButtonEvent, MouseLeftViewportEvent,
|
||||
MouseMoveEvent, NamedKey, OffscreenRenderingContext, PermissionRequest, RenderingContext,
|
||||
ScreenGeometry, Theme, TouchEvent, TouchEventType, TouchId, WebRenderDebugOption, WebView,
|
||||
WebViewId, WheelDelta, WheelEvent, WheelMode, WindowRenderingContext,
|
||||
AuthenticationRequest, Cursor, DeviceIndependentIntRect, DeviceIndependentPixel,
|
||||
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel, DevicePoint, EmbedderControl,
|
||||
EmbedderControlId, GenericSender, ImeEvent, InputEvent, InputEventId, InputEventResult,
|
||||
InputMethodControl, Key, KeyState, KeyboardEvent, Modifiers, MouseButton as ServoMouseButton,
|
||||
MouseButtonAction, MouseButtonEvent, MouseLeftViewportEvent, MouseMoveEvent, NamedKey,
|
||||
OffscreenRenderingContext, PermissionRequest, RenderingContext, ScreenGeometry, ServoUrl,
|
||||
Theme, TouchEvent, TouchEventType, TouchId, WebRenderDebugOption, WebView, WebViewId,
|
||||
WheelDelta, WheelEvent, WheelMode, WindowRenderingContext, convert_rect_to_css_pixel,
|
||||
};
|
||||
use url::Url;
|
||||
use winit::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
|
||||
@@ -1002,10 +996,7 @@ impl PlatformWindow for Window {
|
||||
}
|
||||
|
||||
#[cfg(feature = "webxr")]
|
||||
fn new_glwindow(
|
||||
&self,
|
||||
event_loop: &ActiveEventLoop,
|
||||
) -> Rc<dyn servo::webxr::glwindow::GlWindow> {
|
||||
fn new_glwindow(&self, event_loop: &ActiveEventLoop) -> Rc<dyn servo::webxr::GlWindow> {
|
||||
let size = self.winit_window.outer_size();
|
||||
|
||||
let window_attr = winit::window::Window::default_attributes()
|
||||
@@ -1196,12 +1187,12 @@ struct XRWindowPose {
|
||||
}
|
||||
|
||||
#[cfg(feature = "webxr")]
|
||||
impl servo::webxr::glwindow::GlWindow for XRWindow {
|
||||
impl servo::webxr::GlWindow for XRWindow {
|
||||
fn get_render_target(
|
||||
&self,
|
||||
device: &mut surfman::Device,
|
||||
_context: &mut surfman::Context,
|
||||
) -> servo::webxr::glwindow::GlWindowRenderTarget {
|
||||
) -> servo::webxr::GlWindowRenderTarget {
|
||||
self.winit_window.set_visible(true);
|
||||
let window_handle = self
|
||||
.winit_window
|
||||
@@ -1213,7 +1204,7 @@ impl servo::webxr::glwindow::GlWindow for XRWindow {
|
||||
.connection()
|
||||
.create_native_widget_from_window_handle(window_handle, size)
|
||||
.expect("Failed to create native widget");
|
||||
servo::webxr::glwindow::GlWindowRenderTarget::NativeWidget(native_widget)
|
||||
servo::webxr::GlWindowRenderTarget::NativeWidget(native_widget)
|
||||
}
|
||||
|
||||
fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> {
|
||||
@@ -1224,18 +1215,18 @@ impl servo::webxr::glwindow::GlWindow for XRWindow {
|
||||
self.pose.xr_translation.get()
|
||||
}
|
||||
|
||||
fn get_mode(&self) -> servo::webxr::glwindow::GlWindowMode {
|
||||
use servo::servo_config::pref;
|
||||
fn get_mode(&self) -> servo::webxr::GlWindowMode {
|
||||
use servo::pref;
|
||||
if pref!(dom_webxr_glwindow_red_cyan) {
|
||||
servo::webxr::glwindow::GlWindowMode::StereoRedCyan
|
||||
servo::webxr::GlWindowMode::StereoRedCyan
|
||||
} else if pref!(dom_webxr_glwindow_left_right) {
|
||||
servo::webxr::glwindow::GlWindowMode::StereoLeftRight
|
||||
servo::webxr::GlWindowMode::StereoLeftRight
|
||||
} else if pref!(dom_webxr_glwindow_spherical) {
|
||||
servo::webxr::glwindow::GlWindowMode::Spherical
|
||||
servo::webxr::GlWindowMode::Spherical
|
||||
} else if pref!(dom_webxr_glwindow_cubemap) {
|
||||
servo::webxr::glwindow::GlWindowMode::Cubemap
|
||||
servo::webxr::GlWindowMode::Cubemap
|
||||
} else {
|
||||
servo::webxr::glwindow::GlWindowMode::Blit
|
||||
servo::webxr::GlWindowMode::Blit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use euclid::{Point2D, Scale, Size2D};
|
||||
use servo::servo_geometry::{
|
||||
DeviceIndependentIntRect, DeviceIndependentPixel, convert_rect_to_css_pixel,
|
||||
use servo::{
|
||||
DeviceIndependentIntRect, DeviceIndependentPixel, DeviceIntPoint, DeviceIntRect, DeviceIntSize,
|
||||
DevicePixel, RenderingContext, ScreenGeometry, SoftwareRenderingContext, WebView,
|
||||
convert_rect_to_css_pixel,
|
||||
};
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||
use servo::{RenderingContext, ScreenGeometry, SoftwareRenderingContext, WebView};
|
||||
use winit::dpi::PhysicalSize;
|
||||
|
||||
use crate::prefs::ServoShellPreferences;
|
||||
@@ -130,7 +130,7 @@ impl PlatformWindow for Window {
|
||||
fn new_glwindow(
|
||||
&self,
|
||||
_event_loop: &winit::event_loop::ActiveEventLoop,
|
||||
) -> Rc<dyn servo::webxr::glwindow::GlWindow> {
|
||||
) -> Rc<dyn servo::webxr::GlWindow> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,10 @@ use std::io::BufReader;
|
||||
use std::pin::Pin;
|
||||
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use net::fetch::methods::{DoneChannel, FetchContext};
|
||||
use net::filemanager_thread::FILE_CHUNK_SIZE;
|
||||
use net::protocols::ProtocolHandler;
|
||||
use net_traits::ResourceFetchTiming;
|
||||
use net_traits::filemanager_thread::RelativePos;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use servo::protocol_handler::{
|
||||
DoneChannel, FILE_CHUNK_SIZE, FetchContext, ProtocolHandler, RelativePos, Request,
|
||||
ResourceFetchTiming, Response, ResponseBody,
|
||||
};
|
||||
use tokio::sync::mpsc::unbounded_channel;
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@@ -13,12 +13,11 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use net::fetch::methods::{DoneChannel, FetchContext};
|
||||
use net::protocols::ProtocolHandler;
|
||||
use net_traits::ResourceFetchTiming;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use servo::config::prefs::UserAgentPlatform;
|
||||
use servo::UserAgentPlatform;
|
||||
use servo::protocol_handler::{
|
||||
DoneChannel, FetchContext, ProtocolHandler, Request, ResourceFetchTiming, Response,
|
||||
ResponseBody,
|
||||
};
|
||||
|
||||
use crate::desktop::protocols::resource::ResourceProtocolHandler;
|
||||
use crate::prefs::EXPERIMENTAL_PREFS;
|
||||
|
||||
@@ -6,12 +6,10 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use net::fetch::methods::{DoneChannel, FetchContext};
|
||||
use net::protocols::ProtocolHandler;
|
||||
use net_traits::ResourceFetchTiming;
|
||||
use net_traits::http_status::HttpStatus;
|
||||
use net_traits::request::Request;
|
||||
use net_traits::response::{Response, ResponseBody};
|
||||
use servo::protocol_handler::{
|
||||
DoneChannel, FetchContext, HttpStatus, ProtocolHandler, Request, ResourceFetchTiming, Response,
|
||||
ResponseBody,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct UrlInfoProtocolHander {}
|
||||
|
||||
@@ -7,12 +7,10 @@ use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use servo::config::pref;
|
||||
use servo::config::prefs::{self, Preferences};
|
||||
use servo::webxr::WebXrRegistry;
|
||||
use servo::webxr::glwindow::GlWindowDiscovery;
|
||||
use servo::webxr::{GlWindowDiscovery, WebXrRegistry};
|
||||
#[cfg(target_os = "windows")]
|
||||
use servo::webxr::openxr::{AppInfo, OpenXrDiscovery};
|
||||
use servo::webxr::{OpenXrAppInfo, OpenXrDiscovery};
|
||||
use servo::{Preferences, pref, prefs};
|
||||
use winit::event_loop::ActiveEventLoop;
|
||||
|
||||
use crate::window::PlatformWindow;
|
||||
@@ -42,7 +40,7 @@ impl XrDiscoveryWebXrRegistry {
|
||||
let xr_discovery = if preferences.dom_webxr_openxr_enabled {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let app_info = AppInfo::new("Servoshell", 0, "Servo", 0);
|
||||
let app_info = OpenXrAppInfo::new("Servoshell", 0, "Servo", 0);
|
||||
Some(XrDiscovery::OpenXr(OpenXrDiscovery::new(None, app_info)))
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
@@ -75,7 +73,7 @@ impl prefs::PreferencesObserver for XrPrefObserver {
|
||||
|
||||
impl WebXrRegistry for XrDiscoveryWebXrRegistry {
|
||||
fn register(&self, xr: &mut servo::webxr::MainThreadRegistry) {
|
||||
use servo::webxr::headless::HeadlessMockDiscovery;
|
||||
use servo::webxr::HeadlessMockDiscovery;
|
||||
|
||||
let mock_enabled = Arc::new(AtomicBool::new(pref!(dom_webxr_test)));
|
||||
xr.register_mock(HeadlessMockDiscovery::new(mock_enabled.clone()));
|
||||
|
||||
@@ -26,10 +26,9 @@ use raw_window_handle::{
|
||||
WindowHandle,
|
||||
};
|
||||
use resources::ResourceReaderInstance;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::{
|
||||
self, EventLoopWaker, InputMethodControl, LoadStatus, MediaSessionActionType, MouseButton,
|
||||
PrefValue,
|
||||
self, DevicePixel, EventLoopWaker, InputMethodControl, LoadStatus, MediaSessionActionType,
|
||||
MouseButton, PrefValue,
|
||||
};
|
||||
pub use servo::{MediaSessionPlaybackState, WindowRenderingContext};
|
||||
|
||||
|
||||
@@ -9,19 +9,13 @@ use euclid::{Rect, Scale};
|
||||
use keyboard_types::{CompositionEvent, CompositionState, Key, KeyState, NamedKey};
|
||||
use log::{info, warn};
|
||||
use raw_window_handle::{RawWindowHandle, WindowHandle};
|
||||
use servo::base::id::WebViewId;
|
||||
use servo::config::opts::Opts;
|
||||
use servo::config::prefs::Preferences;
|
||||
use servo::servo_geometry::{
|
||||
DeviceIndependentIntRect, DeviceIndependentPixel, convert_rect_to_css_pixel,
|
||||
};
|
||||
use servo::webrender_api::units::{DeviceIntSize, DevicePixel, DevicePoint, DeviceVector2D};
|
||||
use servo::{
|
||||
AlertResponse, EmbedderControl, EmbedderControlId, EventLoopWaker, ImeEvent, InputEvent,
|
||||
KeyboardEvent, LoadStatus, MediaSessionActionType, MediaSessionEvent, MouseButton,
|
||||
MouseButtonAction, MouseButtonEvent, MouseMoveEvent, RefreshDriver, RenderingContext,
|
||||
ScreenGeometry, Scroll, Servo, ServoBuilder, SimpleDialog, TouchEvent, TouchEventType, TouchId,
|
||||
WebView, WindowRenderingContext,
|
||||
AlertResponse, DeviceIndependentIntRect, DeviceIndependentPixel, DeviceIntSize, DevicePixel,
|
||||
DevicePoint, DeviceVector2D, EmbedderControl, EmbedderControlId, EventLoopWaker, ImeEvent,
|
||||
InputEvent, KeyboardEvent, LoadStatus, MediaSessionActionType, MediaSessionEvent, MouseButton,
|
||||
MouseButtonAction, MouseButtonEvent, MouseMoveEvent, Opts, Preferences, RefreshDriver,
|
||||
RenderingContext, ScreenGeometry, Scroll, Servo, ServoBuilder, SimpleDialog, TouchEvent,
|
||||
TouchEventType, TouchId, WebView, WebViewId, WindowRenderingContext, convert_rect_to_css_pixel,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* 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/. */
|
||||
|
||||
use servo::ipc_channel::ipc::IpcSender;
|
||||
use servo::{GamepadHapticEffectType, WebView};
|
||||
use servo::{GamepadHapticEffectType, IpcSender, WebView};
|
||||
|
||||
/// A dummy version of [`crate::desktop::GamepadSupport`] used to avoid conditional compilation in
|
||||
/// servoshell and as a skeleton to implement gamepad support for platforms that do not
|
||||
|
||||
@@ -36,11 +36,9 @@ use raw_window_handle::{
|
||||
DisplayHandle, OhosDisplayHandle, OhosNdkWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||
WindowHandle,
|
||||
};
|
||||
use servo::style::Zero;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::{
|
||||
self, EventLoopWaker, InputMethodControl, InputMethodType, LoadStatus,
|
||||
MediaSessionPlaybackState, WebViewId, WindowRenderingContext,
|
||||
self, DevicePixel, EventLoopWaker, InputMethodControl, InputMethodType, LoadStatus,
|
||||
MediaSessionPlaybackState, PrefValue, WebViewId, WindowRenderingContext, Zero,
|
||||
};
|
||||
use xcomponent_sys::{
|
||||
OH_NativeXComponent, OH_NativeXComponent_Callback, OH_NativeXComponent_GetKeyEvent,
|
||||
@@ -213,7 +211,7 @@ fn init_app(
|
||||
};
|
||||
|
||||
if native_values.device_type == ohos_deviceinfo::OhosDeviceType::Phone {
|
||||
preferences.set_value("viewport_meta_enabled", servo::PrefValue::Bool(true));
|
||||
preferences.set_value("viewport_meta_enabled", PrefValue::Bool(true));
|
||||
}
|
||||
|
||||
if servoshell_preferences.log_to_file {
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::panic::PanicHookInfo;
|
||||
use std::{env, thread};
|
||||
|
||||
use log::{error, warn};
|
||||
use servo::config::opts;
|
||||
use servo::opts;
|
||||
|
||||
use crate::crash_handler::raise_signal_or_exit_with_error;
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use servo::net_traits::pub_domains::is_reg_domain;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::{ServoUrl, is_reg_domain};
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
|
||||
pub fn parse_url_or_filename(cwd: &Path, input: &str) -> Result<ServoUrl, ()> {
|
||||
|
||||
@@ -16,10 +16,9 @@ use bpaf::*;
|
||||
use euclid::Size2D;
|
||||
use log::warn;
|
||||
use serde_json::Value;
|
||||
use servo::config::opts::{DebugOptions, Opts, OutputOptions};
|
||||
use servo::config::prefs::{PrefValue, Preferences};
|
||||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::{
|
||||
DebugOptions, DeviceIndependentPixel, Opts, OutputOptions, PrefValue, Preferences, ServoUrl,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
use crate::VERSION;
|
||||
|
||||
@@ -13,18 +13,13 @@ use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||
use euclid::Rect;
|
||||
use image::{DynamicImage, ImageFormat, RgbaImage};
|
||||
use log::{error, info, warn};
|
||||
use servo::base::generic_channel::GenericSender;
|
||||
use servo::base::id::WebViewId;
|
||||
use servo::config::pref;
|
||||
use servo::ipc_channel::ipc::IpcSender;
|
||||
use servo::style_traits::CSSPixel;
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntSize};
|
||||
use servo::{
|
||||
AllowOrDenyRequest, AuthenticationRequest, EmbedderControl, EmbedderControlId, EventLoopWaker,
|
||||
GamepadHapticEffectType, InputEvent, InputEventId, InputEventResult, JSValue, LoadStatus,
|
||||
MediaSessionEvent, PermissionRequest, ScreenshotCaptureError, Servo, ServoDelegate, ServoError,
|
||||
TraversalId, WebDriverCommandMsg, WebDriverJSResult, WebDriverLoadStatus,
|
||||
WebDriverScriptCommand, WebDriverSenders, WebView, WebViewBuilder, WebViewDelegate,
|
||||
AllowOrDenyRequest, AuthenticationRequest, CSSPixel, DeviceIntPoint, DeviceIntSize,
|
||||
EmbedderControl, EmbedderControlId, EventLoopWaker, GamepadHapticEffectType, GenericSender,
|
||||
InputEvent, InputEventId, InputEventResult, IpcSender, JSValue, LoadStatus, MediaSessionEvent,
|
||||
PermissionRequest, ScreenshotCaptureError, Servo, ServoDelegate, ServoError, TraversalId,
|
||||
WebDriverCommandMsg, WebDriverJSResult, WebDriverLoadStatus, WebDriverScriptCommand,
|
||||
WebDriverSenders, WebView, WebViewBuilder, WebViewDelegate, WebViewId, pref,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
use euclid::Scale;
|
||||
use servo::base::generic_channel::GenericSender;
|
||||
use servo::servo_geometry::{DeviceIndependentIntRect, DeviceIndependentPixel};
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePixel};
|
||||
use servo::{
|
||||
AuthenticationRequest, Cursor, EmbedderControl, EmbedderControlId, InputEventId,
|
||||
InputEventResult, MediaSessionEvent, PermissionRequest, RenderingContext, ScreenGeometry,
|
||||
WebView, WebViewBuilder, WebViewId,
|
||||
AuthenticationRequest, Cursor, DeviceIndependentIntRect, DeviceIndependentPixel,
|
||||
DeviceIntPoint, DeviceIntSize, DevicePixel, EmbedderControl, EmbedderControlId, GenericSender,
|
||||
InputEventId, InputEventResult, MediaSessionEvent, PermissionRequest, RenderingContext,
|
||||
ScreenGeometry, WebView, WebViewBuilder, WebViewId,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
@@ -334,7 +332,7 @@ pub(crate) trait PlatformWindow {
|
||||
fn new_glwindow(
|
||||
&self,
|
||||
event_loop: &winit::event_loop::ActiveEventLoop,
|
||||
) -> Rc<dyn servo::webxr::glwindow::GlWindow>;
|
||||
) -> Rc<dyn servo::webxr::GlWindow>;
|
||||
/// This returns [`RenderingContext`] matching the viewport.
|
||||
fn rendering_context(&self) -> Rc<dyn RenderingContext>;
|
||||
fn theme(&self) -> servo::Theme {
|
||||
|
||||
Reference in New Issue
Block a user