servo/
lib.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5//! Servo, the mighty web browser engine from the future.
6//!
7//! This is a very simple library that wires all of Servo's components together as
8//! type `Servo`, along with a Webview implementation, `WebView` to create a working
9//! web browser.
10//!
11//! The `Servo` type is responsible for configuring a `Constellation`, which does the
12//! heavy lifting of coordinating all of Servo's internal subsystems, including the
13//! `ScriptThread` and the `LayoutThread`, as well maintains the navigation context.
14
15mod clipboard_delegate;
16#[cfg(feature = "gamepad")]
17mod gamepad_provider;
18mod javascript_evaluator;
19mod network_manager;
20mod proxies;
21mod responders;
22mod servo;
23mod servo_delegate;
24mod site_data_manager;
25mod user_content_manager;
26mod webview;
27mod webview_delegate;
28
29// These are Servo's public exports. Everything (apart from a couple exceptions below)
30// should be exported at the root. See <https://github.com/servo/servo/issues/18475>.
31pub use accesskit;
32pub use base::generic_channel::GenericSender;
33pub use base::id::WebViewId;
34pub use embedder_traits::user_contents::UserScript;
35pub use embedder_traits::*;
36pub use image::RgbaImage;
37pub use keyboard_types::{
38    Code, CompositionEvent, CompositionState, Key, KeyState, Location, Modifiers, NamedKey,
39};
40pub use media::{
41    GlApi as MediaGlApi, GlContext as MediaGlContext, NativeDisplay as MediaNativeDisplay,
42};
43// This API should probably not be exposed in this way. Instead there should be a fully
44// fleshed out public domains API if we want to expose it.
45pub use net_traits::pub_domains::is_reg_domain;
46pub use paint::WebRenderDebugOption;
47pub use paint_api::rendering_context::{
48    OffscreenRenderingContext, RenderingContext, SoftwareRenderingContext, WindowRenderingContext,
49};
50// This should be replaced with an API on ServoBuilder.
51// See <https://github.com/servo/servo/issues/40950>.
52pub use resources;
53pub use servo_config::opts::{DiagnosticsLogging, Opts, OutputOptions};
54pub use servo_config::prefs::{PrefValue, Preferences, UserAgentPlatform};
55pub use servo_config::{opts, pref, prefs};
56pub use servo_geometry::{
57    DeviceIndependentIntRect, DeviceIndependentPixel, convert_rect_to_css_pixel,
58};
59pub use servo_url::ServoUrl;
60pub use style::Zero;
61pub use style_traits::CSSPixel;
62pub use webrender_api::units::{
63    DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel, DevicePoint, DeviceVector2D,
64};
65
66#[cfg(feature = "gamepad")]
67pub use crate::gamepad_provider::{
68    GamepadHapticEffectRequest, GamepadHapticEffectRequestType, GamepadProvider,
69};
70pub use crate::network_manager::{CacheEntry, NetworkManager};
71pub use crate::servo::{Servo, ServoBuilder, run_content_process};
72pub use crate::servo_delegate::{ServoDelegate, ServoError};
73pub use crate::site_data_manager::{SiteData, SiteDataManager, StorageType};
74pub use crate::user_content_manager::UserContentManager;
75pub use crate::webview::{WebView, WebViewBuilder};
76pub use crate::webview_delegate::{
77    AlertDialog, AllowOrDenyRequest, AuthenticationRequest, ColorPicker, ConfirmDialog,
78    ContextMenu, CreateNewWebViewRequest, EmbedderControl, FilePicker, InputMethodControl,
79    NavigationRequest, PermissionRequest, PromptDialog, SelectElement, SimpleDialog,
80    WebResourceLoad, WebViewDelegate,
81};
82
83#[cfg(feature = "webxr")]
84pub mod webxr {
85    #[cfg(not(any(target_os = "android", target_env = "ohos")))]
86    pub use webxr::glwindow::{GlWindow, GlWindowDiscovery, GlWindowMode, GlWindowRenderTarget};
87    #[cfg(not(any(target_os = "android", target_env = "ohos")))]
88    pub use webxr::headless::HeadlessMockDiscovery;
89    #[cfg(target_os = "windows")]
90    pub use webxr::openxr::{AppInfo as OpenXrAppInfo, OpenXrDiscovery};
91    pub use webxr::{Discovery, MainThreadRegistry, WebXrRegistry};
92}
93
94// TODO: The protocol handler interface needs to be cleaned and simplified.
95pub mod protocol_handler {
96    pub use net::fetch::methods::{DoneChannel, FetchContext};
97    pub use net::filemanager_thread::FILE_CHUNK_SIZE;
98    pub use net::protocols::{ProtocolHandler, ProtocolRegistry};
99    pub use net_traits::filemanager_thread::RelativePos;
100    pub use net_traits::http_status::HttpStatus;
101    pub use net_traits::request::Request;
102    pub use net_traits::response::{Response, ResponseBody};
103    pub use net_traits::{NetworkError, ResourceFetchTiming};
104
105    pub use crate::webview_delegate::ProtocolHandlerRegistration;
106}