Strict import formatting (grouping and granularity) (#30325)

* strict imports formatting

* Reformat all imports
This commit is contained in:
Samson 2023-09-11 21:16:54 +02:00 committed by GitHub
parent 413da4ca69
commit aad2dccc9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
802 changed files with 6861 additions and 6395 deletions

View file

@ -7,17 +7,18 @@
#[global_allocator] #[global_allocator]
static ALLOC: Allocator = Allocator; static ALLOC: Allocator = Allocator;
pub use crate::platform::*;
#[cfg(not(windows))] #[cfg(not(windows))]
pub use jemalloc_sys; pub use jemalloc_sys;
pub use crate::platform::*;
#[cfg(not(windows))] #[cfg(not(windows))]
mod platform { mod platform {
use jemalloc_sys as ffi;
use std::alloc::{GlobalAlloc, Layout}; use std::alloc::{GlobalAlloc, Layout};
use std::os::raw::{c_int, c_void}; use std::os::raw::{c_int, c_void};
use jemalloc_sys as ffi;
/// Get the size of a heap block. /// Get the size of a heap block.
pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize { pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize {
ffi::malloc_usable_size(ptr as *const _) ffi::malloc_usable_size(ptr as *const _)
@ -100,6 +101,7 @@ mod platform {
mod platform { mod platform {
pub use std::alloc::System as Allocator; pub use std::alloc::System as Allocator;
use std::os::raw::c_void; use std::os::raw::c_void;
use winapi::um::heapapi::{GetProcessHeap, HeapSize, HeapValidate}; use winapi::um::heapapi::{GetProcessHeap, HeapSize, HeapValidate};
/// Get the size of a heap block. /// Get the size of a heap block.

View file

@ -2,25 +2,24 @@
* 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 crate::sampler::{NativeStack, Sampler};
use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use log::warn;
use msg::constellation_msg::MonitoredComponentId;
use msg::constellation_msg::{
BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorExitSignal,
BackgroundHangMonitorRegister,
};
use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, HangAlert, HangAnnotation, HangMonitorAlert,
};
use std::cell::Cell; use std::cell::Cell;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use std::thread; use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use log::warn;
use msg::constellation_msg::{
BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorControlMsg,
BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister, HangAlert, HangAnnotation,
HangMonitorAlert, MonitoredComponentId,
};
use crate::sampler::{NativeStack, Sampler};
#[derive(Clone)] #[derive(Clone)]
pub struct HangMonitorRegister { pub struct HangMonitorRegister {
sender: Weak<Sender<(MonitoredComponentId, MonitoredComponentMsg)>>, sender: Weak<Sender<(MonitoredComponentId, MonitoredComponentMsg)>>,

View file

@ -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 std::ptr;
use backtrace; use backtrace;
use msg::constellation_msg::{HangProfile, HangProfileSymbol}; use msg::constellation_msg::{HangProfile, HangProfileSymbol};
use std::ptr;
const MAX_NATIVE_FRAMES: usize = 1024; const MAX_NATIVE_FRAMES: usize = 1024;

View file

@ -4,20 +4,18 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
use crate::sampler::{NativeStack, Sampler}; use std::cell::UnsafeCell;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::{io, mem, process, ptr, thread};
use libc; use libc;
use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal}; use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
use std::cell::UnsafeCell;
use std::io;
use std::mem;
use std::process;
use std::ptr;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::thread;
use unwind_sys::{ use unwind_sys::{
unw_cursor_t, unw_get_reg, unw_init_local, unw_step, UNW_ESUCCESS, UNW_REG_IP, UNW_REG_SP, unw_cursor_t, unw_get_reg, unw_init_local, unw_step, UNW_ESUCCESS, UNW_REG_IP, UNW_REG_SP,
}; };
use crate::sampler::{NativeStack, Sampler};
// Hack to workaround broken libunwind pkg-config contents for <1.1-3ubuntu.1. // Hack to workaround broken libunwind pkg-config contents for <1.1-3ubuntu.1.
// https://bugs.launchpad.net/ubuntu/+source/libunwind/+bug/1336912 // https://bugs.launchpad.net/ubuntu/+source/libunwind/+bug/1336912
#[link(name = "lzma")] #[link(name = "lzma")]

View file

@ -2,11 +2,11 @@
* 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 std::{panic, process};
use {libc, mach};
use crate::sampler::{Address, NativeStack, Registers, Sampler}; use crate::sampler::{Address, NativeStack, Registers, Sampler};
use libc;
use mach;
use std::panic;
use std::process;
type MonitoredThreadId = mach::mach_types::thread_act_t; type MonitoredThreadId = mach::mach_types::thread_act_t;

View file

@ -4,21 +4,19 @@
#![allow(unused_imports)] #![allow(unused_imports)]
use background_hang_monitor::HangMonitorRegister;
use ipc_channel::ipc;
use msg::constellation_msg::ScriptHangAnnotation;
use msg::constellation_msg::TEST_PIPELINE_ID;
use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorExitSignal, HangAlert, HangAnnotation,
HangMonitorAlert,
};
use msg::constellation_msg::{MonitoredComponentId, MonitoredComponentType};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc; use std::sync::{Arc, Mutex};
use std::sync::Mutex;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use background_hang_monitor::HangMonitorRegister;
use ipc_channel::ipc;
use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorExitSignal, HangAlert, HangAnnotation,
HangMonitorAlert, MonitoredComponentId, MonitoredComponentType, ScriptHangAnnotation,
TEST_PIPELINE_ID,
};
lazy_static::lazy_static! { lazy_static::lazy_static! {
static ref SERIAL: Mutex<()> = Mutex::new(()); static ref SERIAL: Mutex<()> = Mutex::new(());
} }

View file

@ -4,27 +4,32 @@
pub mod test; pub mod test;
use bitflags::bitflags;
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{
BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions,
};
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg};
use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse, GATTType};
use bluetooth_traits::{BluetoothError, BluetoothResponseResult, BluetoothResult};
use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic};
use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use log::warn;
use servo_config::pref;
use servo_rand::{self, Rng};
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::string::String; use std::string::String;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use bitflags::bitflags;
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{
BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions,
};
use bluetooth_traits::{
BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothDeviceMsg, BluetoothError,
BluetoothRequest, BluetoothResponse, BluetoothResponseResult, BluetoothResult,
BluetoothServiceMsg, GATTType,
};
use device::bluetooth::{
BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic, BluetoothGATTDescriptor,
BluetoothGATTService,
};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use log::warn;
use servo_config::pref;
use servo_rand::{self, Rng};
// A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed. // A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed.
// https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 480) // https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 480)
const MAXIMUM_TRANSACTION_TIME: u8 = 30; const MAXIMUM_TRANSACTION_TIME: u8 = 30;

View file

@ -2,18 +2,20 @@
* 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 crate::BluetoothManager;
use device::bluetooth::{BluetoothAdapter, BluetoothDevice};
use device::bluetooth::{
BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService,
};
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::error::Error; use std::error::Error;
use std::string::String; use std::string::String;
use device::bluetooth::{
BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic, BluetoothGATTDescriptor,
BluetoothGATTService,
};
use uuid::Uuid; use uuid::Uuid;
use crate::BluetoothManager;
thread_local!(pub static CACHED_IDS: RefCell<HashSet<Uuid>> = RefCell::new(HashSet::new())); thread_local!(pub static CACHED_IDS: RefCell<HashSet<Uuid>> = RefCell::new(HashSet::new()));
const ADAPTER_ERROR: &'static str = "No adapter found"; const ADAPTER_ERROR: &'static str = "No adapter found";

View file

@ -2,12 +2,13 @@
* 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::resources::{self, Resource};
use regex::Regex;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
use std::string::String; use std::string::String;
use embedder_traits::resources::{self, Resource};
use regex::Regex;
const EXCLUDE_READS: &str = "exclude-reads"; const EXCLUDE_READS: &str = "exclude-reads";
const EXCLUDE_WRITES: &str = "exclude-writes"; const EXCLUDE_WRITES: &str = "exclude-writes";
const VALID_UUID_REGEX: &str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; const VALID_UUID_REGEX: &str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";

View file

@ -5,10 +5,11 @@
pub mod blocklist; pub mod blocklist;
pub mod scanfilter; pub mod scanfilter;
use crate::scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothError { pub enum BluetoothError {
Type(String), Type(String),

View file

@ -2,8 +2,12 @@
* 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 crate::canvas_paint_thread::{AntialiasMode, ImageUpdate, WebrenderApi}; use std::cell::RefCell;
use crate::raqote_backend::Repetition; #[allow(unused_imports)]
use std::marker::PhantomData;
use std::mem;
use std::sync::{Arc, Mutex};
use canvas_traits::canvas::*; use canvas_traits::canvas::*;
use cssparser::RGBA; use cssparser::RGBA;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
@ -20,17 +24,15 @@ use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
use log::{debug, error, warn}; use log::{debug, error, warn};
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use std::cell::RefCell;
#[allow(unused_imports)]
use std::marker::PhantomData;
use std::mem;
use std::sync::{Arc, Mutex};
use style::properties::style_structs::Font as FontStyleStruct; use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font; use style::values::computed::font;
use style_traits::values::ToCss; use style_traits::values::ToCss;
use webrender_api::units::{DeviceIntSize, RectExt as RectExt_}; use webrender_api::units::{DeviceIntSize, RectExt as RectExt_};
use webrender_api::{ImageData, ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey}; use webrender_api::{ImageData, ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey};
use crate::canvas_paint_thread::{AntialiasMode, ImageUpdate, WebrenderApi};
use crate::raqote_backend::Repetition;
/// The canvas data stores a state machine for the current status of /// The canvas data stores a state machine for the current status of
/// the path data and any relevant transformations that are /// the path data and any relevant transformations that are
/// applied to it. The Azure drawing API expects the path to be in /// applied to it. The Azure drawing API expects the path to be in

View file

@ -2,7 +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 crate::canvas_data::*; use std::borrow::ToOwned;
use std::collections::HashMap;
use std::thread;
use canvas_traits::canvas::*; use canvas_traits::canvas::*;
use canvas_traits::ConstellationCanvasMsg; use canvas_traits::ConstellationCanvasMsg;
use crossbeam_channel::{select, unbounded, Sender}; use crossbeam_channel::{select, unbounded, Sender};
@ -11,11 +14,10 @@ use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use log::warn; use log::warn;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::thread;
use webrender_api::{ImageData, ImageDescriptor, ImageKey}; use webrender_api::{ImageData, ImageDescriptor, ImageKey};
use crate::canvas_data::*;
pub enum AntialiasMode { pub enum AntialiasMode {
Default, Default,
None, None,

View file

@ -2,13 +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 crate::canvas_data; use std::marker::PhantomData;
use crate::canvas_data::{
Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, ExtendMode, Filter,
GenericDrawTarget, GenericPathBuilder, GradientStop, GradientStops, Path, SourceSurface,
StrokeOptions, SurfaceFormat,
};
use crate::canvas_paint_thread::AntialiasMode;
use canvas_traits::canvas::*; use canvas_traits::canvas::*;
use cssparser::RGBA; use cssparser::RGBA;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
@ -17,7 +12,14 @@ use font_kit::font::Font;
use log::warn; use log::warn;
use lyon_geom::Arc; use lyon_geom::Arc;
use raqote::PathOp; use raqote::PathOp;
use std::marker::PhantomData;
use crate::canvas_data;
use crate::canvas_data::{
Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, ExtendMode, Filter,
GenericDrawTarget, GenericPathBuilder, GradientStop, GradientStops, Path, SourceSurface,
StrokeOptions, SurfaceFormat,
};
use crate::canvas_paint_thread::AntialiasMode;
pub struct RaqoteBackend; pub struct RaqoteBackend;

View file

@ -4,9 +4,7 @@
use canvas_traits::webgl::{GLLimits, WebGLVersion}; use canvas_traits::webgl::{GLLimits, WebGLVersion};
use sparkle::gl; use sparkle::gl;
use sparkle::gl::GLenum; use sparkle::gl::{GLenum, Gl, GlType};
use sparkle::gl::Gl;
use sparkle::gl::GlType;
pub trait GLLimitsDetect { pub trait GLLimitsDetect {
fn detect(gl: &Gl, webgl_version: WebGLVersion) -> Self; fn detect(gl: &Gl, webgl_version: WebGLVersion) -> Self;

View file

@ -2,15 +2,14 @@
* 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 crate::webgl_thread::{WebGLThread, WebGLThreadInit, WebXRBridgeInit}; use std::default::Default;
use canvas_traits::webgl::webgl_channel; use std::sync::{Arc, Mutex};
use canvas_traits::webgl::{WebGLContextId, WebGLMsg, WebGLThreads};
use canvas_traits::webgl::{webgl_channel, WebGLContextId, WebGLMsg, WebGLThreads};
use euclid::default::Size2D; use euclid::default::Size2D;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use log::debug; use log::debug;
use sparkle::gl::GlType; use sparkle::gl::GlType;
use std::default::Default;
use std::sync::{Arc, Mutex};
use surfman::chains::{SwapChainAPI, SwapChains, SwapChainsAPI}; use surfman::chains::{SwapChainAPI, SwapChains, SwapChainsAPI};
use surfman::{Device, SurfaceInfo, SurfaceTexture}; use surfman::{Device, SurfaceInfo, SurfaceTexture};
use webrender::RenderApiSender; use webrender::RenderApiSender;
@ -22,6 +21,8 @@ use webrender_traits::{
use webxr::SurfmanGL as WebXRSurfman; use webxr::SurfmanGL as WebXRSurfman;
use webxr_api::LayerGrandManager as WebXRLayerGrandManager; use webxr_api::LayerGrandManager as WebXRLayerGrandManager;
use crate::webgl_thread::{WebGLThread, WebGLThreadInit, WebXRBridgeInit};
pub struct WebGLComm { pub struct WebGLComm {
pub webgl_threads: WebGLThreads, pub webgl_threads: WebGLThreads,
pub image_handler: Box<dyn WebrenderExternalImageApi>, pub image_handler: Box<dyn WebrenderExternalImageApi>,

View file

@ -2,87 +2,54 @@
* 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 crate::webgl_limits::GLLimitsDetect; use std::borrow::Cow;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{slice, thread};
use bitflags::bitflags; use bitflags::bitflags;
use byteorder::{ByteOrder, NativeEndian, WriteBytesExt}; use byteorder::{ByteOrder, NativeEndian, WriteBytesExt};
use canvas_traits::webgl; use canvas_traits::webgl;
use canvas_traits::webgl::webgl_channel; use canvas_traits::webgl::{
use canvas_traits::webgl::ActiveAttribInfo; webgl_channel, ActiveAttribInfo, ActiveUniformBlockInfo, ActiveUniformInfo, AlphaTreatment,
use canvas_traits::webgl::ActiveUniformBlockInfo; GLContextAttributes, GLLimits, GlType, InternalFormatIntVec, ProgramLinkInfo, TexDataType,
use canvas_traits::webgl::ActiveUniformInfo; TexFormat, WebGLBufferId, WebGLChan, WebGLCommand, WebGLCommandBacktrace, WebGLContextId,
use canvas_traits::webgl::AlphaTreatment; WebGLCreateContextResult, WebGLFramebufferBindingRequest, WebGLFramebufferId, WebGLMsg,
use canvas_traits::webgl::GLContextAttributes; WebGLMsgSender, WebGLProgramId, WebGLQueryId, WebGLReceiver, WebGLRenderbufferId,
use canvas_traits::webgl::GLLimits; WebGLSLVersion, WebGLSamplerId, WebGLSender, WebGLShaderId, WebGLSyncId, WebGLTextureId,
use canvas_traits::webgl::GlType; WebGLVersion, WebGLVertexArrayId, WebXRCommand, WebXRLayerManagerId, YAxisTreatment,
use canvas_traits::webgl::InternalFormatIntVec; };
use canvas_traits::webgl::ProgramLinkInfo;
use canvas_traits::webgl::TexDataType;
use canvas_traits::webgl::TexFormat;
use canvas_traits::webgl::WebGLBufferId;
use canvas_traits::webgl::WebGLChan;
use canvas_traits::webgl::WebGLCommand;
use canvas_traits::webgl::WebGLCommandBacktrace;
use canvas_traits::webgl::WebGLContextId;
use canvas_traits::webgl::WebGLCreateContextResult;
use canvas_traits::webgl::WebGLFramebufferBindingRequest;
use canvas_traits::webgl::WebGLFramebufferId;
use canvas_traits::webgl::WebGLMsg;
use canvas_traits::webgl::WebGLMsgSender;
use canvas_traits::webgl::WebGLProgramId;
use canvas_traits::webgl::WebGLQueryId;
use canvas_traits::webgl::WebGLReceiver;
use canvas_traits::webgl::WebGLRenderbufferId;
use canvas_traits::webgl::WebGLSLVersion;
use canvas_traits::webgl::WebGLSamplerId;
use canvas_traits::webgl::WebGLSender;
use canvas_traits::webgl::WebGLShaderId;
use canvas_traits::webgl::WebGLSyncId;
use canvas_traits::webgl::WebGLTextureId;
use canvas_traits::webgl::WebGLVersion;
use canvas_traits::webgl::WebGLVertexArrayId;
use canvas_traits::webgl::WebXRCommand;
use canvas_traits::webgl::WebXRLayerManagerId;
use canvas_traits::webgl::YAxisTreatment;
use euclid::default::Size2D; use euclid::default::Size2D;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use half::f16; use half::f16;
use log::{debug, error, trace, warn}; use log::{debug, error, trace, warn};
use pixels::{self, PixelFormat}; use pixels::{self, PixelFormat};
use sparkle::gl; use sparkle::gl;
use sparkle::gl::GLint; use sparkle::gl::{GLint, GLuint, Gl};
use sparkle::gl::GLuint;
use sparkle::gl::Gl;
use std::borrow::Cow;
use std::collections::HashMap;
use std::rc::Rc;
use std::slice;
use std::sync::{Arc, Mutex};
use std::thread;
use surfman::chains::{PreserveBuffer, SwapChains, SwapChainsAPI}; use surfman::chains::{PreserveBuffer, SwapChains, SwapChainsAPI};
use surfman::{ use surfman::{
self, Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device, self, Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device,
GLVersion, SurfaceAccess, SurfaceInfo, SurfaceType, GLVersion, SurfaceAccess, SurfaceInfo, SurfaceType,
}; };
use webrender::{RenderApi, RenderApiSender, Transaction}; use webrender::{RenderApi, RenderApiSender, Transaction};
use webrender_api::units::DeviceIntSize;
use webrender_api::{ use webrender_api::{
units::DeviceIntSize, DirtyRect, DocumentId, ExternalImageData, ExternalImageId, DirtyRect, DocumentId, ExternalImageData, ExternalImageId, ExternalImageType, ImageBufferKind,
ExternalImageType, ImageBufferKind, ImageData, ImageDescriptor, ImageDescriptorFlags, ImageData, ImageDescriptor, ImageDescriptorFlags, ImageFormat, ImageKey,
ImageFormat, ImageKey,
}; };
use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType}; use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType};
use webxr::SurfmanGL as WebXRSurfman; use webxr::SurfmanGL as WebXRSurfman;
use webxr_api::ContextId as WebXRContextId; use webxr_api::{
use webxr_api::Error as WebXRError; ContextId as WebXRContextId, Error as WebXRError, GLContexts as WebXRContexts,
use webxr_api::GLContexts as WebXRContexts; GLTypes as WebXRTypes, LayerGrandManager as WebXRLayerGrandManager,
use webxr_api::GLTypes as WebXRTypes; LayerGrandManagerAPI as WebXRLayerGrandManagerAPI, LayerId as WebXRLayerId,
use webxr_api::LayerGrandManager as WebXRLayerGrandManager; LayerInit as WebXRLayerInit, LayerManager as WebXRLayerManager,
use webxr_api::LayerGrandManagerAPI as WebXRLayerGrandManagerAPI; LayerManagerAPI as WebXRLayerManagerAPI, LayerManagerFactory as WebXRLayerManagerFactory,
use webxr_api::LayerId as WebXRLayerId; SubImages as WebXRSubImages,
use webxr_api::LayerInit as WebXRLayerInit; };
use webxr_api::LayerManager as WebXRLayerManager;
use webxr_api::LayerManagerAPI as WebXRLayerManagerAPI; use crate::webgl_limits::GLLimitsDetect;
use webxr_api::LayerManagerFactory as WebXRLayerManagerFactory;
use webxr_api::SubImages as WebXRSubImages;
#[cfg(feature = "xr-profile")] #[cfg(feature = "xr-profile")]
fn to_ms(ns: u64) -> f64 { fn to_ms(ns: u64) -> f64 {

View file

@ -2,14 +2,15 @@
* 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 std::default::Default;
use std::str::FromStr;
use cssparser::RGBA; use cssparser::RGBA;
use euclid::default::{Point2D, Rect, Size2D, Transform2D}; use euclid::default::{Point2D, Rect, Size2D, Transform2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory}; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_bytes::ByteBuf; use serde_bytes::ByteBuf;
use std::default::Default;
use std::str::FromStr;
use style::properties::style_structs::Font as FontStyleStruct; use style::properties::style_structs::Font as FontStyleStruct;
use webrender_api::ImageKey; use webrender_api::ImageKey;

View file

@ -6,10 +6,11 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![deny(unsafe_code)] #![deny(unsafe_code)]
use crate::canvas::CanvasId;
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use euclid::default::Size2D; use euclid::default::Size2D;
use crate::canvas::CanvasId;
pub mod canvas; pub mod canvas;
#[macro_use] #[macro_use]
pub mod webgl; pub mod webgl;

View file

@ -2,22 +2,22 @@
* 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 std::borrow::Cow;
use std::fmt;
use std::num::{NonZeroU32, NonZeroU64};
use std::ops::Deref;
use euclid::default::{Rect, Size2D}; use euclid::default::{Rect, Size2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory}; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use pixels::PixelFormat; use pixels::PixelFormat;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sparkle::gl; use sparkle::gl;
use std::borrow::Cow;
use std::fmt;
use std::num::{NonZeroU32, NonZeroU64};
use std::ops::Deref;
use webrender_api::ImageKey; use webrender_api::ImageKey;
use webxr_api::ContextId as WebXRContextId; use webxr_api::{
use webxr_api::Error as WebXRError; ContextId as WebXRContextId, Error as WebXRError, LayerId as WebXRLayerId,
use webxr_api::LayerId as WebXRLayerId; LayerInit as WebXRLayerInit, SubImages as WebXRSubImages,
use webxr_api::LayerInit as WebXRLayerInit; };
use webxr_api::SubImages as WebXRSubImages;
/// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands. /// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands.
pub use crate::webgl_channel::webgl_channel; pub use crate::webgl_channel::webgl_channel;

View file

@ -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 serde::{Deserialize, Serialize};
use std::io; use std::io;
use serde::{Deserialize, Serialize};
pub type WebGLSender<T> = ipc_channel::ipc::IpcSender<T>; pub type WebGLSender<T> = ipc_channel::ipc::IpcSender<T>;
pub type WebGLReceiver<T> = ipc_channel::ipc::IpcReceiver<T>; pub type WebGLReceiver<T> = ipc_channel::ipc::IpcReceiver<T>;

View file

@ -7,13 +7,15 @@
mod ipc; mod ipc;
mod mpsc; mod mpsc;
use crate::webgl::WebGLMsg; use std::fmt;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_config::opts; use servo_config::opts;
use std::fmt;
use crate::webgl::WebGLMsg;
lazy_static! { lazy_static! {
static ref IS_MULTIPROCESS: bool = opts::multiprocess(); static ref IS_MULTIPROCESS: bool = opts::multiprocess();

View file

@ -2,8 +2,7 @@
* 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 serde::{Deserialize, Serialize}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::{Deserializer, Serializer};
macro_rules! unreachable_serializable { macro_rules! unreachable_serializable {
($name:ident) => { ($name:ident) => {

View file

@ -2,13 +2,13 @@
* 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/. */
#[cfg(feature = "gl")] use std::collections::HashMap;
use crate::gl; use std::env;
use crate::touch::{TouchAction, TouchHandler}; use std::fs::{create_dir_all, File};
use crate::windowing::{ use std::io::Write;
self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods, use std::num::NonZeroU32;
}; use std::rc::Rc;
use crate::InitialCompositorState;
use canvas::canvas_paint_thread::ImageUpdate; use canvas::canvas_paint_thread::ImageUpdate;
use compositing_traits::{ use compositing_traits::{
CompositingReason, CompositionPipeline, CompositorMsg, CompositorReceiver, ConstellationMsg, CompositingReason, CompositionPipeline, CompositorMsg, CompositorReceiver, ConstellationMsg,
@ -40,12 +40,6 @@ use script_traits::{
WindowSizeData, WindowSizeType, WindowSizeData, WindowSizeType,
}; };
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength}; use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
use std::collections::HashMap;
use std::env;
use std::fs::{create_dir_all, File};
use std::io::Write;
use std::num::NonZeroU32;
use std::rc::Rc;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor}; use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use time::{now, precise_time_ns, precise_time_s}; use time::{now, precise_time_ns, precise_time_s};
use webrender; use webrender;
@ -59,6 +53,14 @@ use webrender_api::{
}; };
use webrender_surfman::WebrenderSurfman; use webrender_surfman::WebrenderSurfman;
#[cfg(feature = "gl")]
use crate::gl;
use crate::touch::{TouchAction, TouchHandler};
use crate::windowing::{
self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods,
};
use crate::InitialCompositorState;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
enum UnableToComposite { enum UnableToComposite {
NotReadyToPaintImage(NotReadyToPaint), NotReadyToPaintImage(NotReadyToPaint),

View file

@ -4,18 +4,17 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
pub use crate::compositor::IOCompositor; use std::rc::Rc;
pub use crate::compositor::ShutdownState;
use compositing_traits::{CompositorProxy, CompositorReceiver, ConstellationMsg}; use compositing_traits::{CompositorProxy, CompositorReceiver, ConstellationMsg};
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use profile_traits::mem; use profile_traits::{mem, time};
use profile_traits::time;
use std::rc::Rc;
use webrender::RenderApi; use webrender::RenderApi;
use webrender_api::DocumentId; use webrender_api::DocumentId;
use webrender_surfman::WebrenderSurfman; use webrender_surfman::WebrenderSurfman;
pub use crate::compositor::{IOCompositor, ShutdownState};
mod compositor; mod compositor;
#[cfg(feature = "gl")] #[cfg(feature = "gl")]
mod gl; mod gl;

View file

@ -2,12 +2,13 @@
* 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 self::TouchState::*;
use euclid::{Point2D, Scale, Vector2D}; use euclid::{Point2D, Scale, Vector2D};
use log::warn; use log::warn;
use script_traits::{EventResult, TouchId}; use script_traits::{EventResult, TouchId};
use style_traits::DevicePixel; use style_traits::DevicePixel;
use self::TouchState::*;
/// Minimum number of `DeviceIndependentPixel` to begin touch scrolling. /// Minimum number of `DeviceIndependentPixel` to begin touch scrolling.
const TOUCH_PAN_MIN_SCREEN_PX: f32 = 20.0; const TOUCH_PAN_MIN_SCREEN_PX: f32 = 20.0;

View file

@ -4,6 +4,9 @@
//! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`.
use std::fmt::{Debug, Error, Formatter};
use std::time::Duration;
use embedder_traits::{EmbedderProxy, EventLoopWaker}; use embedder_traits::{EmbedderProxy, EventLoopWaker};
use euclid::Scale; use euclid::Scale;
use keyboard_types::KeyboardEvent; use keyboard_types::KeyboardEvent;
@ -12,10 +15,7 @@ use script_traits::{MediaSessionActionType, MouseButton, TouchEventType, TouchId
use servo_geometry::DeviceIndependentPixel; use servo_geometry::DeviceIndependentPixel;
use servo_media::player::context::{GlApi, GlContext, NativeDisplay}; use servo_media::player::context::{GlApi, GlContext, NativeDisplay};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
use std::time::Duration;
use style_traits::DevicePixel; use style_traits::DevicePixel;
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint}; use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint};
use webrender_api::ScrollLocation; use webrender_api::ScrollLocation;
use webrender_surfman::WebrenderSurfman; use webrender_surfman::WebrenderSurfman;

View file

@ -2,24 +2,22 @@
* 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 std::collections::HashMap;
use std::fmt;
use std::time::Duration;
use embedder_traits::Cursor; use embedder_traits::Cursor;
use gfx_traits::Epoch; use gfx_traits::Epoch;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent; use keyboard_types::KeyboardEvent;
use msg::constellation_msg::PipelineId; use msg::constellation_msg::{
use msg::constellation_msg::TopLevelBrowsingContextId; BrowsingContextId, PipelineId, TopLevelBrowsingContextId, TraversalDirection,
use msg::constellation_msg::{BrowsingContextId, TraversalDirection}; };
use script_traits::AnimationTickType; use script_traits::{
use script_traits::CompositorEvent; AnimationTickType, CompositorEvent, LogEntry, MediaSessionActionType, WebDriverCommandMsg,
use script_traits::LogEntry; WindowSizeData, WindowSizeType,
use script_traits::MediaSessionActionType; };
use script_traits::WebDriverCommandMsg;
use script_traits::WindowSizeData;
use script_traits::WindowSizeType;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::collections::HashMap;
use std::fmt;
use std::time::Duration;
/// Messages to the constellation. /// Messages to the constellation.
pub enum ConstellationMsg { pub enum ConstellationMsg {

View file

@ -6,9 +6,10 @@
mod constellation_msg; mod constellation_msg;
pub use constellation_msg::ConstellationMsg; use std::fmt::{Debug, Error, Formatter};
use canvas::canvas_paint_thread::ImageUpdate; use canvas::canvas_paint_thread::ImageUpdate;
pub use constellation_msg::ConstellationMsg;
use crossbeam_channel::{Receiver, Sender}; use crossbeam_channel::{Receiver, Sender};
use embedder_traits::EventLoopWaker; use embedder_traits::EventLoopWaker;
use euclid::Rect; use euclid::Rect;
@ -21,7 +22,6 @@ use script_traits::{
AnimationState, ConstellationControlMsg, EventResult, LayoutControlMsg, MouseButton, AnimationState, ConstellationControlMsg, EventResult, LayoutControlMsg, MouseButton,
MouseEventType, MouseEventType,
}; };
use std::fmt::{Debug, Error, Formatter};
use style_traits::CSSPixel; use style_traits::CSSPixel;
use webrender_api::units::{DeviceIntPoint, DeviceIntSize}; use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webrender_api::{self, FontInstanceKey, FontKey, ImageKey}; use webrender_api::{self, FontInstanceKey, FontKey, ImageKey};

View file

@ -5,6 +5,14 @@
//! Configuration options for a single run of the servo application. Created //! Configuration options for a single run of the servo application. Created
//! from command line arguments. //! from command line arguments.
use std::default::Default;
use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{RwLock, RwLockReadGuard};
use std::{env, process};
use euclid::Size2D; use euclid::Size2D;
use getopts::{Matches, Options}; use getopts::{Matches, Options};
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -12,14 +20,6 @@ use log::error;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_geometry::DeviceIndependentPixel; use servo_geometry::DeviceIndependentPixel;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::default::Default;
use std::env;
use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::path::{Path, PathBuf};
use std::process;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{RwLock, RwLockReadGuard};
use url::{self, Url}; use url::{self, Url};
use crate::{pref, set_pref}; use crate::{pref, set_pref};

View file

@ -2,13 +2,14 @@
* 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 serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;
use std::str::FromStr; use std::str::FromStr;
use std::sync::RwLock; use std::sync::RwLock;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum PrefValue { pub enum PrefValue {
Float(f64), Float(f64),

View file

@ -2,15 +2,16 @@
* 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::resources::{self, Resource};
use lazy_static::lazy_static;
use serde_json::{self, Value};
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::collections::HashMap; use std::collections::HashMap;
use embedder_traits::resources::{self, Resource};
use gen::Prefs;
use lazy_static::lazy_static;
use serde_json::{self, Value};
use crate::pref_util::Preferences; use crate::pref_util::Preferences;
pub use crate::pref_util::{PrefError, PrefValue}; pub use crate::pref_util::{PrefError, PrefValue};
use gen::Prefs;
lazy_static! { lazy_static! {
static ref PREFS: Preferences<'static, Prefs> = { static ref PREFS: Preferences<'static, Prefs> = {

View file

@ -2,14 +2,15 @@
* 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_config::basedir;
use servo_config::pref_util::Preferences;
use servo_config::prefs::{read_prefs_map, PrefValue};
use std::collections::HashMap; use std::collections::HashMap;
use std::error::Error; use std::error::Error;
use std::fs::{self, File}; use std::fs::{self, File};
use std::io::{Read, Write}; use std::io::{Read, Write};
use servo_config::basedir;
use servo_config::pref_util::Preferences;
use servo_config::prefs::{read_prefs_map, PrefValue};
#[test] #[test]
fn test_create_prefs_map() { fn test_create_prefs_map() {
let json_str = "{ let json_str = "{

View file

@ -4,14 +4,18 @@
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]
use std::collections::{hash_map, HashMap};
use std::fmt::Write;
use std::iter;
use itertools::Itertools; use itertools::Itertools;
use proc_macro2::{Span, TokenStream}; use proc_macro2::{Span, TokenStream};
use quote::*; use quote::*;
use std::collections::{hash_map, HashMap}; use syn::parse::Result;
use std::{fmt::Write, iter}; use syn::spanned::Spanned;
use syn::{ use syn::{
parse::Result, parse_macro_input, spanned::Spanned, Attribute, Ident, Lit, LitStr, Meta, parse_macro_input, Attribute, Ident, Lit, LitStr, Meta, MetaList, MetaNameValue, NestedMeta,
MetaList, MetaNameValue, NestedMeta, Path, Path,
}; };
mod parse; mod parse;

View file

@ -4,7 +4,8 @@
use proc_macro2::Span; use proc_macro2::Span;
use syn::parse::{Parse, ParseStream, Result}; use syn::parse::{Parse, ParseStream, Result};
use syn::{braced, punctuated::Punctuated, token, Attribute, Ident, Path, Token, Type}; use syn::punctuated::Punctuated;
use syn::{braced, token, Attribute, Ident, Path, Token, Type};
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
mod kw { mod kw {

View file

@ -2,15 +2,17 @@
* 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 crate::pipeline::Pipeline; use std::collections::{HashMap, HashSet};
use euclid::Size2D; use euclid::Size2D;
use log::warn; use log::warn;
use msg::constellation_msg::{ use msg::constellation_msg::{
BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId, BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId,
}; };
use std::collections::{HashMap, HashSet};
use style_traits::CSSPixel; use style_traits::CSSPixel;
use crate::pipeline::Pipeline;
/// Because a browsing context is only constructed once the document that's /// Because a browsing context is only constructed once the document that's
/// going to be in it becomes active (i.e. not when a pipeline is spawned), some /// going to be in it becomes active (i.e. not when a pipeline is spawned), some
/// values needed in browsing context are not easily available at the point of /// values needed in browsing context are not easily available at the point of

View file

@ -89,18 +89,15 @@
//! //!
//! See https://github.com/servo/servo/issues/14704 //! See https://github.com/servo/servo/issues/14704
use crate::browsingcontext::NewBrowsingContextInfo; use std::borrow::{Cow, ToOwned};
use crate::browsingcontext::{ use std::collections::hash_map::Entry;
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator, use std::collections::{HashMap, HashSet, VecDeque};
}; use std::marker::PhantomData;
use crate::event_loop::EventLoop; use std::mem::replace;
use crate::network_listener::NetworkListener; use std::rc::{Rc, Weak};
use crate::pipeline::{InitialPipelineState, Pipeline}; use std::sync::{Arc, Mutex};
use crate::serviceworker::ServiceWorkerUnprivilegedContent; use std::{process, thread};
use crate::session_history::{
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
};
use crate::timer_scheduler::TimerScheduler;
use background_hang_monitor::HangMonitorRegister; use background_hang_monitor::HangMonitorRegister;
use bluetooth_traits::BluetoothRequest; use bluetooth_traits::BluetoothRequest;
use canvas_traits::canvas::{CanvasId, CanvasMsg}; use canvas_traits::canvas::{CanvasId, CanvasMsg};
@ -115,9 +112,11 @@ use devtools_traits::{
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState, ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState,
ScriptToDevtoolsControlMsg, ScriptToDevtoolsControlMsg,
}; };
use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy}; use embedder_traits::{
use embedder_traits::{MediaSessionEvent, MediaSessionPlaybackState}; Cursor, EmbedderMsg, EmbedderProxy, MediaSessionEvent, MediaSessionPlaybackState,
use euclid::{default::Size2D as UntypedSize2D, Size2D}; };
use euclid::default::Size2D as UntypedSize2D;
use euclid::Size2D;
use gfx::font_cache_thread::FontCacheThread; use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch; use gfx_traits::Epoch;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
@ -129,60 +128,51 @@ use layout_traits::LayoutThreadFactory;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use media::{GLPlayerThreads, WindowGLContext}; use media::{GLPlayerThreads, WindowGLContext};
use msg::constellation_msg::{ use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, BroadcastChannelRouterId,
}; BrowsingContextGroupId, BrowsingContextId, HangMonitorAlert, HistoryStateId, MessagePortId,
use msg::constellation_msg::{ MessagePortRouterId, PipelineId, PipelineNamespace, PipelineNamespaceId,
BroadcastChannelRouterId, MessagePortId, MessagePortRouterId, PipelineNamespace, PipelineNamespaceRequest, TopLevelBrowsingContextId, TraversalDirection,
PipelineNamespaceId, PipelineNamespaceRequest, TraversalDirection,
};
use msg::constellation_msg::{
BrowsingContextGroupId, BrowsingContextId, HistoryStateId, PipelineId,
TopLevelBrowsingContextId,
}; };
use net_traits::pub_domains::reg_host; use net_traits::pub_domains::reg_host;
use net_traits::request::{Referrer, RequestBuilder}; use net_traits::request::{Referrer, RequestBuilder};
use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use net_traits::storage_thread::{StorageThreadMsg, StorageType};
use net_traits::{self, FetchResponseMsg, IpcSend, ResourceThreads}; use net_traits::{self, FetchResponseMsg, IpcSend, ResourceThreads};
use profile_traits::mem; use profile_traits::{mem, time};
use profile_traits::time;
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent}; use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
use script_traits::{webdriver_msg, LogEntry, ScriptToConstellationChan, ServiceWorkerMsg};
use script_traits::{ use script_traits::{
AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo, BroadcastMsg, webdriver_msg, AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo,
CompositorEvent, BroadcastMsg, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
DocumentActivity, DocumentState, HistoryEntryReplacement, IFrameLoadInfo,
IFrameLoadInfoWithData, IFrameSandboxState, IFrameSizeMsg, Job, LayoutControlMsg,
LayoutMsg as FromLayoutMsg, LoadData, LoadOrigin, LogEntry, MediaSessionActionType,
MessagePortMsg, MouseEventType, PortMessageTask, SWManagerMsg, SWManagerSenders,
ScriptMsg as FromScriptMsg, ScriptThreadFactory, ScriptToConstellationChan,
ServiceWorkerManagerFactory, ServiceWorkerMsg, StructuredSerializedData, TimerSchedulerMsg,
UpdatePipelineIdReason, WebDriverCommandMsg, WindowSizeData, WindowSizeType,
}; };
use script_traits::{ConstellationControlMsg, DiscardBrowsingContext};
use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData, LoadOrigin};
use script_traits::{HistoryEntryReplacement, IFrameSizeMsg, WindowSizeData, WindowSizeType};
use script_traits::{
IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg,
};
use script_traits::{
Job, LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory,
ServiceWorkerManagerFactory,
};
use script_traits::{MediaSessionActionType, MouseEventType};
use script_traits::{MessagePortMsg, PortMessageTask, StructuredSerializedData};
use script_traits::{SWManagerMsg, SWManagerSenders, UpdatePipelineIdReason, WebDriverCommandMsg};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_config::{opts, pref}; use servo_config::{opts, pref};
use servo_rand::{random, Rng, ServoRng, SliceRandom}; use servo_rand::{random, Rng, ServoRng, SliceRandom};
use servo_url::{Host, ImmutableOrigin, ServoUrl}; use servo_url::{Host, ImmutableOrigin, ServoUrl};
use std::borrow::{Cow, ToOwned};
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet, VecDeque};
use std::marker::PhantomData;
use std::mem::replace;
use std::process;
use std::rc::{Rc, Weak};
use std::sync::{Arc, Mutex};
use std::thread;
use style_traits::CSSPixel; use style_traits::CSSPixel;
use webgpu::{self, WebGPU, WebGPURequest}; use webgpu::{self, WebGPU, WebGPURequest};
use webrender::{RenderApi, RenderApiSender}; use webrender::{RenderApi, RenderApiSender};
use webrender_api::DocumentId; use webrender_api::DocumentId;
use webrender_traits::WebrenderExternalImageRegistry; use webrender_traits::WebrenderExternalImageRegistry;
use crate::browsingcontext::{
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator,
NewBrowsingContextInfo,
};
use crate::event_loop::EventLoop;
use crate::network_listener::NetworkListener;
use crate::pipeline::{InitialPipelineState, Pipeline};
use crate::serviceworker::ServiceWorkerUnprivilegedContent;
use crate::session_history::{
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
};
use crate::timer_scheduler::TimerScheduler;
type PendingApprovalNavigations = HashMap<PipelineId, (LoadData, HistoryEntryReplacement)>; type PendingApprovalNavigations = HashMap<PipelineId, (LoadData, HistoryEntryReplacement)>;
#[derive(Debug)] #[derive(Debug)]

View file

@ -6,11 +6,12 @@
//! view of a script thread. When an `EventLoop` is dropped, an `ExitScriptThread` //! view of a script thread. When an `EventLoop` is dropped, an `ExitScriptThread`
//! message is sent to the script thread, asking it to shut down. //! message is sent to the script thread, asking it to shut down.
use std::marker::PhantomData;
use std::rc::Rc;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use ipc_channel::Error; use ipc_channel::Error;
use script_traits::ConstellationControlMsg; use script_traits::ConstellationControlMsg;
use std::marker::PhantomData;
use std::rc::Rc;
/// <https://html.spec.whatwg.org/multipage/#event-loop> /// <https://html.spec.whatwg.org/multipage/#event-loop>
pub struct EventLoop { pub struct EventLoop {

View file

@ -2,6 +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 std::borrow::ToOwned;
use std::sync::Arc;
use std::thread;
use backtrace::Backtrace; use backtrace::Backtrace;
use compositing_traits::ConstellationMsg as FromCompositorMsg; use compositing_traits::ConstellationMsg as FromCompositorMsg;
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
@ -9,9 +13,6 @@ use log::{debug, Level, LevelFilter, Log, Metadata, Record};
use msg::constellation_msg::TopLevelBrowsingContextId; use msg::constellation_msg::TopLevelBrowsingContextId;
use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan}; use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan};
use servo_remutex::ReentrantMutex; use servo_remutex::ReentrantMutex;
use std::borrow::ToOwned;
use std::sync::Arc;
use std::thread;
/// The constellation uses logging to perform crash reporting. /// The constellation uses logging to perform crash reporting.
/// The constellation receives all `warn!`, `error!` and `panic!` messages, /// The constellation receives all `warn!`, `error!` and `panic!` messages,

View file

@ -15,8 +15,10 @@ use msg::constellation_msg::PipelineId;
use net::http_loader::{set_default_accept, set_default_accept_language}; use net::http_loader::{set_default_accept, set_default_accept_language};
use net_traits::request::{Destination, Referrer, RequestBuilder}; use net_traits::request::{Destination, Referrer, RequestBuilder};
use net_traits::response::ResponseInit; use net_traits::response::ResponseInit;
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg}; use net_traits::{
use net_traits::{IpcSend, NetworkError, ResourceThreads}; CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseMsg, IpcSend, NetworkError,
ResourceThreads,
};
pub struct NetworkListener { pub struct NetworkListener {
res_init: Option<ResponseInit>, res_init: Option<ResponseInit>,

View file

@ -2,14 +2,16 @@
* 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 crate::event_loop::EventLoop; use std::borrow::Cow;
use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent}; use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use background_hang_monitor::HangMonitorRegister; use background_hang_monitor::HangMonitorRegister;
use bluetooth_traits::BluetoothRequest; use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLPipeline; use canvas_traits::webgl::WebGLPipeline;
use compositing_traits::CompositionPipeline; use compositing_traits::{CompositionPipeline, CompositorMsg, CompositorProxy};
use compositing_traits::CompositorMsg;
use compositing_traits::CompositorProxy;
use crossbeam_channel::{unbounded, Sender}; use crossbeam_channel::{unbounded, Sender};
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
use embedder_traits::EventLoopWaker; use embedder_traits::EventLoopWaker;
@ -21,37 +23,30 @@ use layout_traits::LayoutThreadFactory;
use log::{debug, error, warn}; use log::{debug, error, warn};
use media::WindowGLContext; use media::WindowGLContext;
use metrics::PaintTimeMetrics; use metrics::PaintTimeMetrics;
use msg::constellation_msg::TopLevelBrowsingContextId;
use msg::constellation_msg::{ use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, BrowsingContextId,
}; HangMonitorAlert, HistoryStateId, PipelineId, PipelineNamespace, PipelineNamespaceId,
use msg::constellation_msg::{BrowsingContextId, HistoryStateId}; PipelineNamespaceRequest, TopLevelBrowsingContextId,
use msg::constellation_msg::{
PipelineId, PipelineNamespace, PipelineNamespaceId, PipelineNamespaceRequest,
}; };
use net::image_cache::ImageCacheImpl; use net::image_cache::ImageCacheImpl;
use net_traits::image_cache::ImageCache; use net_traits::image_cache::ImageCache;
use net_traits::ResourceThreads; use net_traits::ResourceThreads;
use profile_traits::mem as profile_mem; use profile_traits::{mem as profile_mem, time};
use profile_traits::time;
use script_traits::{ use script_traits::{
AnimationState, ConstellationControlMsg, DiscardBrowsingContext, ScriptToConstellationChan, AnimationState, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
InitialScriptState, LayoutControlMsg, LayoutMsg, LoadData, NewLayoutInfo, SWManagerMsg,
ScriptThreadFactory, ScriptToConstellationChan, TimerSchedulerMsg, WindowSizeData,
}; };
use script_traits::{DocumentActivity, InitialScriptState};
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData};
use script_traits::{NewLayoutInfo, SWManagerMsg};
use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_config::opts::{self, Opts}; use servo_config::opts::{self, Opts};
use servo_config::{prefs, prefs::PrefValue}; use servo_config::prefs;
use servo_config::prefs::PrefValue;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use webrender_api::DocumentId; use webrender_api::DocumentId;
use crate::event_loop::EventLoop;
use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent};
/// A `Pipeline` is the constellation's view of a `Document`. Each pipeline has an /// A `Pipeline` is the constellation's view of a `Document`. Each pipeline has an
/// event loop (executed by a script thread) and a layout thread. A script thread /// event loop (executed by a script thread) and a layout thread. A script thread
/// may be responsible for many pipelines, but a layout thread is only responsible /// may be responsible for many pipelines, but a layout thread is only responsible

View file

@ -2,8 +2,12 @@
* 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 crate::pipeline::UnprivilegedPipelineContent; use std::collections::HashMap;
use crate::serviceworker::ServiceWorkerUnprivilegedContent; #[cfg(not(windows))]
use std::env;
use std::ffi::OsStr;
use std::process;
#[cfg(any( #[cfg(any(
target_os = "macos", target_os = "macos",
all( all(
@ -19,11 +23,9 @@ use ipc_channel::Error;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_config::opts::Opts; use servo_config::opts::Opts;
use servo_config::prefs::PrefValue; use servo_config::prefs::PrefValue;
use std::collections::HashMap;
#[cfg(not(windows))] use crate::pipeline::UnprivilegedPipelineContent;
use std::env; use crate::serviceworker::ServiceWorkerUnprivilegedContent;
use std::ffi::OsStr;
use std::process;
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum UnprivilegedContent { pub enum UnprivilegedContent {
@ -50,9 +52,10 @@ impl UnprivilegedContent {
/// Our content process sandbox profile on Mac. As restrictive as possible. /// Our content process sandbox profile on Mac. As restrictive as possible.
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub fn content_process_sandbox_profile() -> Profile { pub fn content_process_sandbox_profile() -> Profile {
use std::path::PathBuf;
use embedder_traits::resources; use embedder_traits::resources;
use gaol::platform; use gaol::platform;
use std::path::PathBuf;
let mut operations = vec![ let mut operations = vec![
Operation::FileReadAll(PathPattern::Literal(PathBuf::from("/dev/urandom"))), Operation::FileReadAll(PathPattern::Literal(PathBuf::from("/dev/urandom"))),
@ -98,9 +101,10 @@ pub fn content_process_sandbox_profile() -> Profile {
not(target_arch = "aarch64") not(target_arch = "aarch64")
))] ))]
pub fn content_process_sandbox_profile() -> Profile { pub fn content_process_sandbox_profile() -> Profile {
use embedder_traits::resources;
use std::path::PathBuf; use std::path::PathBuf;
use embedder_traits::resources;
let mut operations = vec![Operation::FileReadAll(PathPattern::Literal(PathBuf::from( let mut operations = vec![Operation::FileReadAll(PathPattern::Literal(PathBuf::from(
"/dev/urandom", "/dev/urandom",
)))]; )))];

View file

@ -2,14 +2,16 @@
* 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 crate::sandboxing::{spawn_multiprocess, UnprivilegedContent}; use std::collections::HashMap;
use ipc_channel::Error; use ipc_channel::Error;
use script_traits::{SWManagerSenders, ServiceWorkerManagerFactory}; use script_traits::{SWManagerSenders, ServiceWorkerManagerFactory};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_config::opts::{self, Opts}; use servo_config::opts::{self, Opts};
use servo_config::prefs::{self, PrefValue}; use servo_config::prefs::{self, PrefValue};
use servo_url::ImmutableOrigin; use servo_url::ImmutableOrigin;
use std::collections::HashMap;
use crate::sandboxing::{spawn_multiprocess, UnprivilegedContent};
/// Conceptually, this is glue to start an agent-cluster for a service worker agent. /// Conceptually, this is glue to start an agent-cluster for a service worker agent.
/// <https://html.spec.whatwg.org/multipage/#obtain-a-service-worker-agent> /// <https://html.spec.whatwg.org/multipage/#obtain-a-service-worker-agent>

View file

@ -2,7 +2,9 @@
* 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 crate::browsingcontext::NewBrowsingContextInfo; use std::cmp::PartialEq;
use std::{fmt, mem};
use euclid::Size2D; use euclid::Size2D;
use log::debug; use log::debug;
use msg::constellation_msg::{ use msg::constellation_msg::{
@ -10,10 +12,10 @@ use msg::constellation_msg::{
}; };
use script_traits::LoadData; use script_traits::LoadData;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::cmp::PartialEq;
use std::{fmt, mem};
use style_traits::CSSPixel; use style_traits::CSSPixel;
use crate::browsingcontext::NewBrowsingContextInfo;
/// Represents the joint session history /// Represents the joint session history
/// https://html.spec.whatwg.org/multipage/#joint-session-history /// https://html.spec.whatwg.org/multipage/#joint-session-history
#[derive(Debug)] #[derive(Debug)]

View file

@ -2,11 +2,12 @@
* 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 script_traits::{TimerEvent, TimerEventRequest, TimerSchedulerMsg};
use std::cmp::{self, Ord}; use std::cmp::{self, Ord};
use std::collections::BinaryHeap; use std::collections::BinaryHeap;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use script_traits::{TimerEvent, TimerEventRequest, TimerSchedulerMsg};
pub struct TimerScheduler(BinaryHeap<ScheduledEvent>); pub struct TimerScheduler(BinaryHeap<ScheduledEvent>);
struct ScheduledEvent { struct ScheduledEvent {

View file

@ -3,6 +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::str::FromStr; use std::str::FromStr;
use synstructure::{self, decl_derive}; use synstructure::{self, decl_derive};
decl_derive!([DenyPublicFields] => deny_public_fields_derive); decl_derive!([DenyPublicFields] => deny_public_fields_derive);

View file

@ -5,11 +5,11 @@
use darling::{FromDeriveInput, FromField, FromVariant}; use darling::{FromDeriveInput, FromField, FromVariant};
use proc_macro2::{Span, TokenStream}; use proc_macro2::{Span, TokenStream};
use quote::{quote, TokenStreamExt}; use quote::{quote, TokenStreamExt};
use syn::{self, parse_quote, AngleBracketedGenericArguments, Binding, DeriveInput, Field}; use syn::{
use syn::{GenericArgument, GenericParam, Ident, Path}; self, parse_quote, AngleBracketedGenericArguments, Binding, DeriveInput, Field,
use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray, TypeGroup}; GenericArgument, GenericParam, Ident, Path, PathArguments, PathSegment, QSelf, Type, TypeArray,
use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple}; TypeGroup, TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple, Variant, WherePredicate,
use syn::{Variant, WherePredicate}; };
use synstructure::{self, BindStyle, BindingInfo, VariantAst, VariantInfo}; use synstructure::{self, BindStyle, BindingInfo, VariantAst, VariantInfo};
/// Given an input type which has some where clauses already, like: /// Given an input type which has some where clauses already, like:

View file

@ -2,11 +2,6 @@
* 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/. */
/// General actor system infrastructure.
use crate::StreamId;
use devtools_traits::PreciseTime;
use log::{debug, warn};
use serde_json::{Map, Value};
use std::any::Any; use std::any::Any;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::collections::HashMap; use std::collections::HashMap;
@ -14,6 +9,13 @@ use std::mem::replace;
use std::net::TcpStream; use std::net::TcpStream;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use devtools_traits::PreciseTime;
use log::{debug, warn};
use serde_json::{Map, Value};
/// General actor system infrastructure.
use crate::StreamId;
#[derive(PartialEq)] #[derive(PartialEq)]
pub enum ActorMessageStatus { pub enum ActorMessageStatus {
Processed, Processed,

View file

@ -7,6 +7,17 @@
//! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents. //! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents.
//! Supports dynamic attaching and detaching which control notifications of navigation, etc. //! Supports dynamic attaching and detaching which control notifications of navigation, etc.
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::net::TcpStream;
use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications};
use devtools_traits::{DevtoolsPageInfo, NavigationState};
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::emulation::EmulationActor; use crate::actors::emulation::EmulationActor;
use crate::actors::inspector::InspectorActor; use crate::actors::inspector::InspectorActor;
@ -18,16 +29,6 @@ use crate::actors::thread::ThreadActor;
use crate::actors::timeline::TimelineActor; use crate::actors::timeline::TimelineActor;
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crate::StreamId; use crate::StreamId;
use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications};
use devtools_traits::DevtoolsPageInfo;
use devtools_traits::NavigationState;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use serde::Serialize;
use serde_json::{Map, Value};
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
struct BrowsingContextTraits { struct BrowsingContextTraits {

View file

@ -7,30 +7,32 @@
//! Mediates interaction between the remote web console and equivalent functionality (object //! Mediates interaction between the remote web console and equivalent functionality (object
//! inspection, JS evaluation, autocompletion) in Servo. //! inspection, JS evaluation, autocompletion) in Servo.
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::cell::RefCell;
use crate::actors::browsing_context::BrowsingContextActor; use std::collections::HashMap;
use crate::actors::object::ObjectActor; use std::net::TcpStream;
use crate::actors::worker::WorkerActor;
use crate::protocol::JsonPacketStream; use devtools_traits::EvaluateJSReply::{
use crate::{StreamId, UniqueId}; ActorValue, BooleanValue, NullValue, NumberValue, StringValue, VoidValue,
use devtools_traits::CachedConsoleMessage; };
use devtools_traits::ConsoleMessage;
use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue};
use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue};
use devtools_traits::{ use devtools_traits::{
CachedConsoleMessageTypes, ConsoleAPI, DevtoolScriptControlMsg, LogLevel, PageError, CachedConsoleMessage, CachedConsoleMessageTypes, ConsoleAPI, ConsoleMessage,
DevtoolScriptControlMsg, LogLevel, PageError,
}; };
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use log::debug; use log::debug;
use msg::constellation_msg::TEST_PIPELINE_ID; use msg::constellation_msg::TEST_PIPELINE_ID;
use serde::Serialize; use serde::Serialize;
use serde_json::{self, Map, Number, Value}; use serde_json::{self, Map, Number, Value};
use std::cell::RefCell;
use std::collections::HashMap;
use std::net::TcpStream;
use time::precise_time_ns; use time::precise_time_ns;
use uuid::Uuid; use uuid::Uuid;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor;
use crate::actors::object::ObjectActor;
use crate::actors::worker::WorkerActor;
use crate::protocol::JsonPacketStream;
use crate::{StreamId, UniqueId};
trait EncodableConsoleMessage { trait EncodableConsoleMessage {
fn encode(&self) -> serde_json::Result<String>; fn encode(&self) -> serde_json::Result<String>;
} }

View file

@ -2,13 +2,14 @@
* 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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::net::TcpStream;
use crate::protocol::JsonPacketStream;
use crate::protocol::{ActorDescription, Method};
use crate::StreamId;
use serde::Serialize; use serde::Serialize;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use std::net::TcpStream;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::{ActorDescription, JsonPacketStream, Method};
use crate::StreamId;
#[derive(Serialize)] #[derive(Serialize)]
struct GetDescriptionReply { struct GetDescriptionReply {

View file

@ -2,10 +2,12 @@
* 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 std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId; use crate::StreamId;
use serde_json::{Map, Value};
use std::net::TcpStream;
pub struct EmulationActor { pub struct EmulationActor {
pub name: String, pub name: String,

View file

@ -2,15 +2,17 @@
* 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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::mem;
use crate::actors::timeline::HighResolutionStamp; use std::net::TcpStream;
use crate::StreamId;
use devtools_traits::DevtoolScriptControlMsg; use devtools_traits::DevtoolScriptControlMsg;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use std::mem;
use std::net::TcpStream; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::timeline::HighResolutionStamp;
use crate::StreamId;
pub struct FramerateActor { pub struct FramerateActor {
name: String, name: String,

View file

@ -5,19 +5,22 @@
//! Liberally derived from the [Firefox JS implementation] //! Liberally derived from the [Firefox JS implementation]
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). //! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::cell::RefCell;
use crate::actors::browsing_context::BrowsingContextActor; use std::net::TcpStream;
use crate::protocol::JsonPacketStream;
use crate::StreamId; use devtools_traits::DevtoolScriptControlMsg::{
use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, GetRootNode}; GetChildren, GetDocumentElement, GetLayout, GetRootNode, ModifyAttribute,
use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute}; };
use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo};
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
use serde::Serialize; use serde::Serialize;
use serde_json::{self, Map, Value}; use serde_json::{self, Map, Value};
use std::cell::RefCell;
use std::net::TcpStream; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor;
use crate::protocol::JsonPacketStream;
use crate::StreamId;
pub struct InspectorActor { pub struct InspectorActor {
pub name: String, pub name: String,

View file

@ -2,11 +2,13 @@
* 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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::net::TcpStream;
use crate::StreamId;
use serde::Serialize; use serde::Serialize;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use std::net::TcpStream;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId;
#[derive(Serialize)] #[derive(Serialize)]
pub struct TimelineMemoryReply { pub struct TimelineMemoryReply {

View file

@ -6,18 +6,19 @@
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js). //! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
//! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo. //! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo.
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::net::TcpStream;
use crate::protocol::JsonPacketStream;
use crate::StreamId; use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse};
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
use headers::{ContentType, Cookie, HeaderMapExt}; use headers::{ContentType, Cookie, HeaderMapExt};
use http::{header, HeaderMap, Method, StatusCode}; use http::{header, HeaderMap, Method, StatusCode};
use serde::Serialize; use serde::Serialize;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use std::net::TcpStream;
use time::Tm; use time::Tm;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
struct HttpRequest { struct HttpRequest {
url: String, url: String,
method: Method, method: Method,

View file

@ -2,10 +2,12 @@
* 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 std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId; use crate::StreamId;
use serde_json::{Map, Value};
use std::net::TcpStream;
pub struct ObjectActor { pub struct ObjectActor {
pub name: String, pub name: String,

View file

@ -2,12 +2,14 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::{ActorDescription, JsonPacketStream, Method}; use crate::protocol::{ActorDescription, JsonPacketStream, Method};
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
pub struct PerformanceActor { pub struct PerformanceActor {
name: String, name: String,

View file

@ -2,14 +2,16 @@
* 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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::net::TcpStream;
use crate::protocol::JsonPacketStream;
use crate::StreamId;
use serde::Serialize; use serde::Serialize;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use servo_config::pref_util::PrefValue; use servo_config::pref_util::PrefValue;
use servo_config::prefs::pref_map; use servo_config::prefs::pref_map;
use std::net::TcpStream;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
pub struct PreferenceActor { pub struct PreferenceActor {
name: String, name: String,

View file

@ -2,12 +2,14 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
struct ListWorkersReply { struct ListWorkersReply {

View file

@ -2,10 +2,12 @@
* 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 std::net::TcpStream;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::StreamId; use crate::StreamId;
use serde_json::{Map, Value};
use std::net::TcpStream;
pub struct ProfilerActor { pub struct ProfilerActor {
name: String, name: String,

View file

@ -2,6 +2,11 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
/// Liberally derived from the [Firefox JS implementation] /// Liberally derived from the [Firefox JS implementation]
/// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js). /// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js).
/// Connection point for all new remote devtools interactions, providing lists of know actors /// Connection point for all new remote devtools interactions, providing lists of know actors
@ -13,9 +18,6 @@ use crate::actors::tab::{TabDescriptorActor, TabDescriptorActorMsg};
use crate::actors::worker::{WorkerActor, WorkerMsg}; use crate::actors::worker::{WorkerActor, WorkerMsg};
use crate::protocol::{ActorDescription, JsonPacketStream}; use crate::protocol::{ActorDescription, JsonPacketStream};
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
struct ActorTraits { struct ActorTraits {

View file

@ -2,12 +2,14 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
struct GetStyleSheetsReply { struct GetStyleSheetsReply {

View file

@ -2,14 +2,16 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg}; use crate::actors::browsing_context::{BrowsingContextActor, BrowsingContextActorMsg};
use crate::actors::root::RootActor; use crate::actors::root::RootActor;
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
pub struct TabDescriptorTraits { pub struct TabDescriptorTraits {

View file

@ -2,12 +2,14 @@
* 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 std::net::TcpStream;
use serde::Serialize;
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crate::StreamId; use crate::StreamId;
use serde::Serialize;
use serde_json::{Map, Value};
use std::net::TcpStream;
#[derive(Serialize)] #[derive(Serialize)]
struct ThreadAttached { struct ThreadAttached {

View file

@ -2,18 +2,6 @@
* 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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::framerate::FramerateActor;
use crate::actors::memory::{MemoryActor, TimelineMemoryReply};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
use devtools_traits::DevtoolScriptControlMsg;
use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers};
use devtools_traits::{PreciseTime, TimelineMarker, TimelineMarkerType};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use msg::constellation_msg::PipelineId;
use serde::{Serialize, Serializer};
use serde_json::{Map, Value};
use std::cell::RefCell; use std::cell::RefCell;
use std::error::Error; use std::error::Error;
use std::net::TcpStream; use std::net::TcpStream;
@ -21,6 +9,19 @@ use std::sync::{Arc, Mutex};
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers};
use devtools_traits::{DevtoolScriptControlMsg, PreciseTime, TimelineMarker, TimelineMarkerType};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use msg::constellation_msg::PipelineId;
use serde::{Serialize, Serializer};
use serde_json::{Map, Value};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::framerate::FramerateActor;
use crate::actors::memory::{MemoryActor, TimelineMemoryReply};
use crate::protocol::JsonPacketStream;
use crate::StreamId;
pub struct TimelineActor { pub struct TimelineActor {
name: String, name: String,
script_sender: IpcSender<DevtoolScriptControlMsg>, script_sender: IpcSender<DevtoolScriptControlMsg>,

View file

@ -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 crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; use std::cell::RefCell;
use crate::protocol::JsonPacketStream; use std::collections::HashMap;
use crate::StreamId; use std::net::TcpStream;
use devtools_traits::DevtoolScriptControlMsg::WantsLiveNotifications; use devtools_traits::DevtoolScriptControlMsg::WantsLiveNotifications;
use devtools_traits::{DevtoolScriptControlMsg, WorkerId}; use devtools_traits::{DevtoolScriptControlMsg, WorkerId};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
@ -12,9 +13,10 @@ use msg::constellation_msg::TEST_PIPELINE_ID;
use serde::Serialize; use serde::Serialize;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::cell::RefCell;
use std::collections::HashMap; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use std::net::TcpStream; use crate::protocol::JsonPacketStream;
use crate::StreamId;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
#[allow(dead_code)] #[allow(dead_code)]

View file

@ -12,6 +12,27 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
use std::borrow::ToOwned;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::HashMap;
use std::io::Read;
use std::net::{Shutdown, TcpListener, TcpStream};
use std::sync::{Arc, Mutex};
use std::thread;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::{
ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolScriptControlMsg, DevtoolsControlMsg,
DevtoolsPageInfo, LogLevel, NavigationState, NetworkEvent, PageError,
ScriptToDevtoolsControlMsg, WorkerId,
};
use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult};
use ipc_channel::ipc::{self, IpcSender};
use log::{debug, warn};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use serde::Serialize;
use servo_rand::RngCore;
use crate::actor::{Actor, ActorRegistry}; use crate::actor::{Actor, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor; use crate::actors::browsing_context::BrowsingContextActor;
use crate::actors::console::{ConsoleActor, Root}; use crate::actors::console::{ConsoleActor, Root};
@ -25,25 +46,6 @@ use crate::actors::root::RootActor;
use crate::actors::thread::ThreadActor; use crate::actors::thread::ThreadActor;
use crate::actors::worker::{WorkerActor, WorkerType}; use crate::actors::worker::{WorkerActor, WorkerType};
use crate::protocol::JsonPacketStream; use crate::protocol::JsonPacketStream;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::{ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolsControlMsg};
use devtools_traits::{
DevtoolScriptControlMsg, DevtoolsPageInfo, LogLevel, NavigationState, NetworkEvent,
};
use devtools_traits::{PageError, ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult};
use ipc_channel::ipc::{self, IpcSender};
use log::{debug, warn};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use serde::Serialize;
use servo_rand::RngCore;
use std::borrow::ToOwned;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::HashMap;
use std::io::Read;
use std::net::{Shutdown, TcpListener, TcpStream};
use std::sync::{Arc, Mutex};
use std::thread;
mod actor; mod actor;
/// Corresponds to http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/ /// Corresponds to http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/

View file

@ -6,13 +6,14 @@
//! [JSON packets] //! [JSON packets]
//! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets). //! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
use log::debug;
use serde::Serialize;
use serde_json::{self, Value};
use std::error::Error; use std::error::Error;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::net::TcpStream; use std::net::TcpStream;
use log::debug;
use serde::Serialize;
use serde_json::{self, Value};
#[derive(Serialize)] #[derive(Serialize)]
pub struct ActorDescription { pub struct ActorDescription {
pub category: &'static str, pub category: &'static str,

View file

@ -11,16 +11,15 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
use std::net::TcpStream;
use bitflags::bitflags; use bitflags::bitflags;
use http::HeaderMap; use http::{HeaderMap, Method};
use http::Method;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use msg::constellation_msg::{BrowsingContextId, PipelineId}; use msg::constellation_msg::{BrowsingContextId, PipelineId};
use serde::Deserialize; use serde::{Deserialize, Serialize};
use serde::Serialize;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::net::TcpStream;
use time::{self, Duration, Tm}; use time::{self, Duration, Tm};
use uuid::Uuid; use uuid::Uuid;

View file

@ -5,8 +5,7 @@
#![recursion_limit = "128"] #![recursion_limit = "128"]
use proc_macro2; use proc_macro2;
use quote::quote; use quote::{quote, TokenStreamExt};
use quote::TokenStreamExt;
use syn::parse_quote; use syn::parse_quote;
#[proc_macro_derive(DomObject)] #[proc_macro_derive(DomObject)]

View file

@ -4,6 +4,8 @@
pub mod resources; pub mod resources;
use std::fmt::{Debug, Error, Formatter};
use crossbeam_channel::{Receiver, Sender}; use crossbeam_channel::{Receiver, Sender};
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent; use keyboard_types::KeyboardEvent;
@ -12,9 +14,7 @@ use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContex
use num_derive::FromPrimitive; use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize}; use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
pub use webxr_api::MainThreadWaker as EventLoopWaker; pub use webxr_api::MainThreadWaker as EventLoopWaker;
/// A cursor for the window. This is different from a CSS cursor (see /// A cursor for the window. This is different from a CSS cursor (see

View file

@ -2,10 +2,11 @@
* 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 lazy_static::lazy_static;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::{Once, RwLock}; use std::sync::{Once, RwLock};
use lazy_static::lazy_static;
lazy_static! { lazy_static! {
static ref RES: RwLock<Option<Box<dyn ResourceReaderMethods + Sync + Send>>> = static ref RES: RwLock<Option<Box<dyn ResourceReaderMethods + Sync + Send>>> =
RwLock::new(None); RwLock::new(None);

View file

@ -2,13 +2,12 @@
* 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 app_units::{Au, MAX_AU, MIN_AU};
use euclid::{
default::{Point2D, Rect, Size2D},
Length,
};
use malloc_size_of_derive::MallocSizeOf;
use std::f32; use std::f32;
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::default::{Point2D, Rect, Size2D};
use euclid::Length;
use malloc_size_of_derive::MallocSizeOf;
use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize}; use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};
// Units for use with euclid::length and euclid::scale_factor. // Units for use with euclid::length and euclid::scale_factor.

View file

@ -2,6 +2,27 @@
* 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 std::borrow::ToOwned;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::{iter, str};
use app_units::Au;
use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
use log::debug;
use serde::{Deserialize, Serialize};
use servo_atoms::{atom, Atom};
use smallvec::SmallVec;
use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight};
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::{GenericFontFamily, SingleFontFamily};
use unicode_script::Script;
use webrender_api::FontInstanceKey;
use crate::font_context::{FontContext, FontSource}; use crate::font_context::{FontContext, FontSource};
use crate::font_template::FontTemplateDescriptor; use crate::font_template::FontTemplateDescriptor;
use crate::platform::font::{FontHandle, FontTable}; use crate::platform::font::{FontHandle, FontTable};
@ -11,26 +32,6 @@ use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods; use crate::text::shaping::ShaperMethods;
use crate::text::Shaper; use crate::text::Shaper;
use app_units::Au;
use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
use log::debug;
use serde::{Deserialize, Serialize};
use servo_atoms::{atom, Atom};
use smallvec::SmallVec;
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::collections::HashMap;
use std::iter;
use std::rc::Rc;
use std::str;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use style::computed_values::{font_stretch, font_style, font_variant_caps, font_weight};
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::{GenericFontFamily, SingleFontFamily};
use unicode_script::Script;
use webrender_api::FontInstanceKey;
#[macro_export] #[macro_export]
macro_rules! ot_tag { macro_rules! ot_tag {

View file

@ -2,15 +2,12 @@
* 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 crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope}; use std::borrow::ToOwned;
use crate::font_context::FontSource; use std::collections::HashMap;
use crate::font_template::{FontTemplate, FontTemplateDescriptor}; use std::ops::Deref;
use crate::platform::font_context::FontContextHandle; use std::sync::{Arc, Mutex};
use crate::platform::font_list::for_each_available_family; use std::{f32, fmt, mem, thread};
use crate::platform::font_list::for_each_variation;
use crate::platform::font_list::system_default_family;
use crate::platform::font_list::SANS_SERIF_FONT_FAMILY;
use crate::platform::font_template::FontTemplateData;
use app_units::Au; use app_units::Au;
use gfx_traits::{FontData, WebrenderApi}; use gfx_traits::{FontData, WebrenderApi};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
@ -20,15 +17,19 @@ use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_atoms::Atom; use servo_atoms::Atom;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::ops::Deref;
use std::sync::{Arc, Mutex};
use std::{f32, fmt, mem, thread};
use style::font_face::{EffectiveSources, Source}; use style::font_face::{EffectiveSources, Source};
use style::values::computed::font::FamilyName; use style::values::computed::font::FamilyName;
use webrender_api::{FontInstanceKey, FontKey}; use webrender_api::{FontInstanceKey, FontKey};
use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope};
use crate::font_context::FontSource;
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
use crate::platform::font_context::FontContextHandle;
use crate::platform::font_list::{
for_each_available_family, for_each_variation, system_default_family, SANS_SERIF_FONT_FAMILY,
};
use crate::platform::font_template::FontTemplateData;
/// A list of font templates that make up a given font family. /// A list of font templates that make up a given font family.
pub struct FontTemplates { pub struct FontTemplates {
templates: Vec<FontTemplate>, templates: Vec<FontTemplate>,

View file

@ -2,6 +2,22 @@
* 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 std::cell::RefCell;
use std::collections::HashMap;
use std::default::Default;
use std::hash::{BuildHasherDefault, Hash, Hasher};
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};
use app_units::Au;
use fnv::FnvHasher;
use log::debug;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_arc::Arc;
use style::computed_values::font_variant_caps::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct;
use webrender_api::{FontInstanceKey, FontKey};
use crate::font::{ use crate::font::{
Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef, Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef,
}; };
@ -9,20 +25,6 @@ use crate::font_cache_thread::FontTemplateInfo;
use crate::font_template::FontTemplateDescriptor; use crate::font_template::FontTemplateDescriptor;
use crate::platform::font::FontHandle; use crate::platform::font::FontHandle;
pub use crate::platform::font_context::FontContextHandle; pub use crate::platform::font_context::FontContextHandle;
use app_units::Au;
use fnv::FnvHasher;
use log::debug;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_arc::Arc;
use std::cell::RefCell;
use std::collections::HashMap;
use std::default::Default;
use std::hash::{BuildHasherDefault, Hash, Hasher};
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};
use style::computed_values::font_variant_caps::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct;
use webrender_api::{FontInstanceKey, FontKey};
static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h)

View file

@ -2,19 +2,21 @@
* 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 std::fmt::{Debug, Error, Formatter};
use std::io::Error as IoError;
use std::sync::{Arc, Weak};
use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use style::computed_values::font_stretch::T as FontStretch;
use style::computed_values::font_style::T as FontStyle;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::FontWeight;
use crate::font::FontHandleMethods; use crate::font::FontHandleMethods;
use crate::platform::font::FontHandle; use crate::platform::font::FontHandle;
use crate::platform::font_context::FontContextHandle; use crate::platform::font_context::FontContextHandle;
use crate::platform::font_template::FontTemplateData; use crate::platform::font_template::FontTemplateData;
use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use std::fmt::{Debug, Error, Formatter};
use std::io::Error as IoError;
use std::sync::{Arc, Weak};
use style::computed_values::font_stretch::T as FontStretch;
use style::computed_values::font_style::T as FontStyle;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::FontWeight;
/// Describes how to select a font from a given family. This is very basic at the moment and needs /// Describes how to select a font from a given family. This is very basic at the moment and needs
/// to be expanded or refactored when we support more of the font styling parameters. /// to be expanded or refactored when we support more of the font styling parameters.

View file

@ -2,10 +2,12 @@
* 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 std::path::Path;
use ucd::{Codepoint, UnicodeBlock};
use super::xml::{Attribute, Node}; use super::xml::{Attribute, Node};
use crate::text::util::is_cjk; use crate::text::util::is_cjk;
use std::path::Path;
use ucd::{Codepoint, UnicodeBlock};
lazy_static! { lazy_static! {
static ref FONT_LIST: FontList = FontList::new(); static ref FONT_LIST: FontList = FontList::new();

View file

@ -2,9 +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 xml::reader::XmlEvent::*;
pub(super) use xml::attribute::OwnedAttribute as Attribute; pub(super) use xml::attribute::OwnedAttribute as Attribute;
use xml::reader::XmlEvent::*;
pub(super) enum Node { pub(super) enum Node {
Element { Element {

View file

@ -2,35 +2,36 @@
* 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 super::c_str_to_string;
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN};
use crate::platform::font_context::FontContextHandle;
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::GlyphId;
use crate::text::util::fixed_to_float;
use app_units::Au;
use freetype::freetype::FT_Sfnt_Tag;
use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face};
use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec};
use freetype::freetype::{FT_Get_Char_Index, FT_Get_Postscript_Name};
use freetype::freetype::{FT_Get_Kerning, FT_Get_Sfnt_Table, FT_Load_Sfnt_Table};
use freetype::freetype::{FT_GlyphSlot, FT_Library, FT_Long, FT_ULong};
use freetype::freetype::{FT_Int32, FT_Kerning_Mode, FT_STYLE_FLAG_ITALIC};
use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size};
use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector};
use freetype::succeeded;
use freetype::tt_os2::TT_OS2;
use log::debug;
use servo_atoms::Atom;
use std::ffi::CString; use std::ffi::CString;
use std::os::raw::{c_char, c_long}; use std::os::raw::{c_char, c_long};
use std::sync::Arc; use std::sync::Arc;
use std::{mem, ptr}; use std::{mem, ptr};
use app_units::Au;
use freetype::freetype::{
FT_Done_Face, FT_F26Dot6, FT_Face, FT_FaceRec, FT_Get_Char_Index, FT_Get_Kerning,
FT_Get_Postscript_Name, FT_Get_Sfnt_Table, FT_GlyphSlot, FT_Int32, FT_Kerning_Mode, FT_Library,
FT_Load_Glyph, FT_Load_Sfnt_Table, FT_Long, FT_New_Face, FT_New_Memory_Face, FT_Set_Char_Size,
FT_Sfnt_Tag, FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_ULong, FT_Vector, FT_STYLE_FLAG_ITALIC,
};
use freetype::succeeded;
use freetype::tt_os2::TT_OS2;
use log::debug;
use servo_atoms::Atom;
use style::computed_values::font_stretch::T as FontStretch; use style::computed_values::font_stretch::T as FontStretch;
use style::computed_values::font_weight::T as FontWeight; use style::computed_values::font_weight::T as FontWeight;
use style::values::computed::font::FontStyle; use style::values::computed::font::FontStyle;
use super::c_str_to_string;
use crate::font::{
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel, GPOS, GSUB,
KERN,
};
use crate::platform::font_context::FontContextHandle;
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::GlyphId;
use crate::text::util::fixed_to_float;
// This constant is not present in the freetype // This constant is not present in the freetype
// bindings due to bindgen not handling the way // bindings due to bindgen not handling the way
// the macro is defined. // the macro is defined.

View file

@ -2,19 +2,17 @@
* 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 freetype::freetype::FT_Add_Default_Modules; use std::os::raw::{c_long, c_void};
use freetype::freetype::FT_Done_Library; use std::ptr;
use freetype::freetype::FT_Library; use std::rc::Rc;
use freetype::freetype::FT_Memory;
use freetype::freetype::FT_MemoryRec_; use freetype::freetype::{
use freetype::freetype::FT_New_Library; FT_Add_Default_Modules, FT_Done_Library, FT_Library, FT_Memory, FT_MemoryRec_, FT_New_Library,
};
use freetype::succeeded; use freetype::succeeded;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_allocator::libc_compat::{free, malloc, realloc}; use servo_allocator::libc_compat::{free, malloc, realloc};
use servo_allocator::usable_size; use servo_allocator::usable_size;
use std::os::raw::{c_long, c_void};
use std::ptr;
use std::rc::Rc;
// We pass a |User| struct -- via an opaque |void*| -- to FreeType each time a new instance is // We pass a |User| struct -- via an opaque |void*| -- to FreeType each time a new instance is
// created. FreeType passes it back to the ft_alloc/ft_realloc/ft_free callbacks. We use it to // created. FreeType passes it back to the ft_alloc/ft_realloc/ft_free callbacks. We use it to

View file

@ -2,19 +2,21 @@
* 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 super::c_str_to_string;
use crate::text::util::is_cjk;
use fontconfig_sys::{FcChar8, FcResultMatch, FcSetSystem};
use fontconfig_sys::{FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute};
use fontconfig_sys::{FcDefaultSubstitute, FcFontMatch, FcNameParse, FcPatternGetString};
use fontconfig_sys::{FcFontSetDestroy, FcMatchPattern, FcPatternCreate, FcPatternDestroy};
use fontconfig_sys::{FcFontSetList, FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString};
use fontconfig_sys::{FcObjectSetAdd, FcPatternGetInteger};
use libc::{c_char, c_int};
use log::debug;
use std::ffi::CString; use std::ffi::CString;
use std::ptr; use std::ptr;
use fontconfig_sys::{
FcChar8, FcConfigGetCurrent, FcConfigGetFonts, FcConfigSubstitute, FcDefaultSubstitute,
FcFontMatch, FcFontSetDestroy, FcFontSetList, FcMatchPattern, FcNameParse, FcObjectSetAdd,
FcObjectSetCreate, FcObjectSetDestroy, FcPatternAddString, FcPatternCreate, FcPatternDestroy,
FcPatternGetInteger, FcPatternGetString, FcResultMatch, FcSetSystem,
};
use libc::{c_char, c_int};
use log::debug;
use super::c_str_to_string;
use crate::text::util::is_cjk;
static FC_FAMILY: &'static [u8] = b"family\0"; static FC_FAMILY: &'static [u8] = b"family\0";
static FC_FILE: &'static [u8] = b"file\0"; static FC_FILE: &'static [u8] = b"file\0";
static FC_INDEX: &'static [u8] = b"index\0"; static FC_INDEX: &'static [u8] = b"index\0";

View file

@ -2,12 +2,13 @@
* 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 serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use std::fmt; use std::fmt;
use std::fs::File; use std::fs::File;
use std::io::{Error, Read}; use std::io::{Error, Read};
use std::path::PathBuf; use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use servo_atoms::Atom;
use webrender_api::NativeFontHandle; use webrender_api::NativeFontHandle;
/// Platform specific font representation for Linux. /// Platform specific font representation for Linux.

View file

@ -2,13 +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 crate::font::{ use std::ops::Range;
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel, use std::sync::Arc;
}; use std::{fmt, ptr};
use crate::font::{GPOS, GSUB, KERN};
use crate::platform::font_template::FontTemplateData;
use crate::platform::macos::font_context::FontContextHandle;
use crate::text::glyph::GlyphId;
/// Implementation of Quartz (CoreGraphics) fonts. /// Implementation of Quartz (CoreGraphics) fonts.
use app_units::Au; use app_units::Au;
use byteorder::{BigEndian, ByteOrder}; use byteorder::{BigEndian, ByteOrder};
@ -18,15 +15,21 @@ use core_foundation::string::UniChar;
use core_graphics::font::CGGlyph; use core_graphics::font::CGGlyph;
use core_graphics::geometry::CGRect; use core_graphics::geometry::CGRect;
use core_text::font::CTFont; use core_text::font::CTFont;
use core_text::font_descriptor::kCTFontDefaultOrientation; use core_text::font_descriptor::{
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors}; kCTFontDefaultOrientation, SymbolicTraitAccessors, TraitAccessors,
};
use log::debug; use log::debug;
use servo_atoms::Atom; use servo_atoms::Atom;
use std::ops::Range;
use std::sync::Arc;
use std::{fmt, ptr};
use style::values::computed::font::{FontStretch, FontStyle, FontWeight}; use style::values::computed::font::{FontStretch, FontStyle, FontWeight};
use crate::font::{
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel, GPOS, GSUB,
KERN,
};
use crate::platform::font_template::FontTemplateData;
use crate::platform::macos::font_context::FontContextHandle;
use crate::text::glyph::GlyphId;
const KERN_PAIR_LEN: usize = 6; const KERN_PAIR_LEN: usize = 6;
pub struct FontTable { pub struct FontTable {

View file

@ -2,10 +2,11 @@
* 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 crate::text::util::unicode_plane;
use log::debug; use log::debug;
use ucd::{Codepoint, UnicodeBlock}; use ucd::{Codepoint, UnicodeBlock};
use crate::text::util::unicode_plane;
pub fn for_each_available_family<F>(mut callback: F) pub fn for_each_available_family<F>(mut callback: F)
where where
F: FnMut(String), F: FnMut(String),

View file

@ -2,6 +2,15 @@
* 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 std::borrow::ToOwned;
use std::collections::HashMap;
use std::fmt;
use std::fs::{self, File};
use std::io::{Error as IoError, Read};
use std::ops::Deref;
use std::path::Path;
use std::sync::{Arc, Mutex, RwLock};
use app_units::Au; use app_units::Au;
use core_foundation::array::CFArray; use core_foundation::array::CFArray;
use core_foundation::base::{CFType, TCFType}; use core_foundation::base::{CFType, TCFType};
@ -10,20 +19,11 @@ use core_foundation::string::CFString;
use core_graphics::data_provider::CGDataProvider; use core_graphics::data_provider::CGDataProvider;
use core_graphics::font::CGFont; use core_graphics::font::CGFont;
use core_text::font::CTFont; use core_text::font::CTFont;
use core_text::font_collection; use core_text::{font_collection, font_descriptor};
use core_text::font_descriptor;
use serde::de::{Error, Visitor}; use serde::de::{Error, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use servo_atoms::Atom; use servo_atoms::Atom;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::fmt;
use std::fs::{self, File};
use std::io::{Error as IoError, Read};
use std::ops::Deref;
use std::path::Path;
use std::sync::{Arc, Mutex, RwLock};
use webrender_api::NativeFontHandle; use webrender_api::NativeFontHandle;
/// Platform specific font representation for mac. /// Platform specific font representation for mac.

View file

@ -4,22 +4,20 @@
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
pub use crate::platform::freetype::{font, font_context}; pub use crate::platform::freetype::{font, font_context};
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
pub use crate::platform::freetype::{font_list, font_template}; pub use crate::platform::freetype::{font_list, font_template};
#[cfg(target_os = "macos")]
pub use crate::platform::macos::{font, font_context, font_list, font_template};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub use crate::platform::windows::{font, font_context, font_list, font_template}; pub use crate::platform::windows::{font, font_context, font_list, font_template};
#[cfg(target_os = "macos")]
pub use crate::platform::macos::{font, font_context, font_list, font_template};
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
mod freetype { mod freetype {
use libc::c_char;
use std::ffi::CStr; use std::ffi::CStr;
use std::str; use std::str;
use libc::c_char;
/// Creates a String from the given null-terminated buffer. /// Creates a String from the given null-terminated buffer.
/// Panics if the buffer does not contain UTF-8. /// Panics if the buffer does not contain UTF-8.
unsafe fn c_str_to_string(s: *const c_char) -> String { unsafe fn c_str_to_string(s: *const c_char) -> String {

View file

@ -6,20 +6,14 @@
// information for an approach that we'll likely need to take when the // information for an approach that we'll likely need to take when the
// renderer moves to a sandboxed process. // renderer moves to a sandboxed process.
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
use crate::font::{FontTableTag, FractionalPixel};
use crate::platform::font_template::FontTemplateData;
use crate::platform::windows::font_context::FontContextHandle;
use crate::platform::windows::font_list::font_from_atom;
use crate::text::glyph::GlyphId;
use app_units::Au;
use dwrote::{Font, FontFace, FontFile};
use dwrote::{FontStretch, FontStyle};
use log::debug;
use servo_atoms::Atom;
use std::fmt; use std::fmt;
use std::ops::Deref; use std::ops::Deref;
use std::sync::Arc; use std::sync::Arc;
use app_units::Au;
use dwrote::{Font, FontFace, FontFile, FontStretch, FontStyle};
use log::debug;
use servo_atoms::Atom;
use style::computed_values::font_stretch::T as StyleFontStretch; use style::computed_values::font_stretch::T as StyleFontStretch;
use style::computed_values::font_weight::T as StyleFontWeight; use style::computed_values::font_weight::T as StyleFontWeight;
use style::values::computed::font::FontStyle as StyleFontStyle; use style::values::computed::font::FontStyle as StyleFontStyle;
@ -27,6 +21,14 @@ use style::values::generics::font::FontStyle as GenericFontStyle;
use style::values::generics::NonNegative; use style::values::generics::NonNegative;
use style::values::specified::font::FontStretchKeyword; use style::values::specified::font::FontStretchKeyword;
use crate::font::{
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel,
};
use crate::platform::font_template::FontTemplateData;
use crate::platform::windows::font_context::FontContextHandle;
use crate::platform::windows::font_list::font_from_atom;
use crate::text::glyph::GlyphId;
// 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch // 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch
fn pt_to_px(pt: f64) -> f64 { fn pt_to_px(pt: f64) -> f64 {
pt / 72. * 96. pt / 72. * 96.
@ -88,6 +90,7 @@ impl FontInfo {
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::collections::HashMap; use std::collections::HashMap;
use std::io::Cursor; use std::io::Cursor;
use truetype::naming_table::{NameID, NamingTable}; use truetype::naming_table::{NameID, NamingTable};
use truetype::{Value, WindowsMetrics}; use truetype::{Value, WindowsMetrics};

View file

@ -2,15 +2,17 @@
* 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 crate::text::util::unicode_plane;
use dwrote::{Font, FontCollection, FontDescriptor};
use lazy_static::lazy_static;
use servo_atoms::Atom;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Mutex; use std::sync::Mutex;
use dwrote::{Font, FontCollection, FontDescriptor};
use lazy_static::lazy_static;
use servo_atoms::Atom;
use ucd::{Codepoint, UnicodeBlock}; use ucd::{Codepoint, UnicodeBlock};
use crate::text::util::unicode_plane;
lazy_static! { lazy_static! {
static ref FONT_ATOM_COUNTER: AtomicUsize = AtomicUsize::new(1); static ref FONT_ATOM_COUNTER: AtomicUsize = AtomicUsize::new(1);
static ref FONT_ATOM_MAP: Mutex<HashMap<Atom, FontDescriptor>> = Mutex::new(HashMap::new()); static ref FONT_ATOM_MAP: Mutex<HashMap<Atom, FontDescriptor>> = Mutex::new(HashMap::new());

View file

@ -2,13 +2,14 @@
* 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 crate::platform::windows::font_list::font_from_atom; use std::{fmt, io};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_atoms::Atom; use servo_atoms::Atom;
use std::fmt;
use std::io;
use webrender_api::NativeFontHandle; use webrender_api::NativeFontHandle;
use crate::platform::windows::font_list::font_from_atom;
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct FontTemplateData { pub struct FontTemplateData {
// If you add members here, review the Debug impl below // If you add members here, review the Debug impl below

View file

@ -2,6 +2,13 @@
* 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 std::cell::Cell;
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use std::rc::Rc;
use app_units::Au; use app_units::Au;
use gfx::font::{ use gfx::font::{
fallback_font_families, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope, fallback_font_families, FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope,
@ -11,18 +18,12 @@ use gfx::font_context::{FontContext, FontContextHandle, FontSource};
use gfx::font_template::FontTemplateDescriptor; use gfx::font_template::FontTemplateDescriptor;
use servo_arc::Arc; use servo_arc::Arc;
use servo_atoms::Atom; use servo_atoms::Atom;
use std::cell::Cell;
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use std::rc::Rc;
use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps; use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct; use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::{ use style::values::computed::font::{
FamilyName, FontFamily, FontFamilyList, FontFamilyNameSyntax, FontSize, FamilyName, FontFamily, FontFamilyList, FontFamilyNameSyntax, FontSize, FontStretch,
FontWeight, SingleFontFamily,
}; };
use style::values::computed::font::{FontStretch, FontWeight, SingleFontFamily};
use style::values::generics::font::FontStyle; use style::values::generics::font::FontStyle;
use webrender_api::{FontInstanceKey, FontKey, IdNamespace}; use webrender_api::{FontInstanceKey, FontKey, IdNamespace};

View file

@ -6,12 +6,13 @@
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
#[test] #[test]
fn test_font_template_descriptor() { fn test_font_template_descriptor() {
use gfx::font_context::FontContextHandle;
use gfx::font_template::{FontTemplate, FontTemplateDescriptor};
use servo_atoms::Atom;
use std::fs::File; use std::fs::File;
use std::io::prelude::*; use std::io::prelude::*;
use std::path::PathBuf; use std::path::PathBuf;
use gfx::font_context::FontContextHandle;
use gfx::font_template::{FontTemplate, FontTemplateDescriptor};
use servo_atoms::Atom;
use style::values::computed::font::{FontStretch, FontWeight}; use style::values::computed::font::{FontStretch, FontWeight};
use style::values::computed::Percentage; use style::values::computed::Percentage;
use style::values::generics::font::FontStyle; use style::values::generics::font::FontStyle;

View file

@ -2,16 +2,16 @@
* 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 app_units::Au;
use euclid::default::Point2D;
use log::debug;
use range::{self, EachIndex, Range, RangeIndex};
use serde::{Deserialize, Serialize};
use std::cmp::{Ordering, PartialOrd}; use std::cmp::{Ordering, PartialOrd};
use std::vec::Vec; use std::vec::Vec;
use std::{fmt, mem, u16}; use std::{fmt, mem, u16};
use app_units::Au;
use euclid::default::Point2D;
pub use gfx_traits::ByteIndex; pub use gfx_traits::ByteIndex;
use log::debug;
use range::{self, EachIndex, Range, RangeIndex};
use serde::{Deserialize, Serialize};
/// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing glyph data compactly. /// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing glyph data compactly.
/// ///

View file

@ -4,45 +4,33 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
use std::os::raw::{c_char, c_int, c_uint, c_void};
use std::{char, cmp, ptr};
use app_units::Au;
use euclid::default::Point2D;
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
// shapers. For now, however, HarfBuzz is a hard dependency.
use harfbuzz_sys::hb_blob_t;
use harfbuzz_sys::{
hb_blob_create, hb_bool_t, hb_buffer_add_utf8, hb_buffer_create, hb_buffer_destroy,
hb_buffer_get_glyph_infos, hb_buffer_get_glyph_positions, hb_buffer_get_length,
hb_buffer_set_direction, hb_buffer_set_script, hb_buffer_t, hb_codepoint_t,
hb_face_create_for_tables, hb_face_destroy, hb_face_t, hb_feature_t, hb_font_create,
hb_font_destroy, hb_font_funcs_create, hb_font_funcs_set_glyph_h_advance_func,
hb_font_funcs_set_nominal_glyph_func, hb_font_funcs_t, hb_font_set_funcs, hb_font_set_ppem,
hb_font_set_scale, hb_font_t, hb_glyph_info_t, hb_glyph_position_t, hb_position_t, hb_shape,
hb_tag_t, HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY,
};
use lazy_static::lazy_static;
use log::debug;
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN}; use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
use crate::ot_tag; use crate::ot_tag;
use crate::platform::font::FontTable; use crate::platform::font::FontTable;
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use crate::text::shaping::ShaperMethods; use crate::text::shaping::ShaperMethods;
use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
use app_units::Au;
use euclid::default::Point2D;
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
// shapers. For now, however, HarfBuzz is a hard dependency.
use harfbuzz_sys::hb_blob_t;
use harfbuzz_sys::hb_bool_t;
use harfbuzz_sys::hb_buffer_add_utf8;
use harfbuzz_sys::hb_buffer_destroy;
use harfbuzz_sys::hb_buffer_get_glyph_positions;
use harfbuzz_sys::hb_buffer_get_length;
use harfbuzz_sys::hb_face_destroy;
use harfbuzz_sys::hb_feature_t;
use harfbuzz_sys::hb_font_create;
use harfbuzz_sys::hb_font_funcs_create;
use harfbuzz_sys::hb_font_funcs_set_glyph_h_advance_func;
use harfbuzz_sys::hb_font_funcs_set_nominal_glyph_func;
use harfbuzz_sys::hb_font_set_funcs;
use harfbuzz_sys::hb_font_set_ppem;
use harfbuzz_sys::hb_font_set_scale;
use harfbuzz_sys::hb_glyph_info_t;
use harfbuzz_sys::hb_glyph_position_t;
use harfbuzz_sys::{hb_blob_create, hb_face_create_for_tables};
use harfbuzz_sys::{hb_buffer_create, hb_font_destroy};
use harfbuzz_sys::{hb_buffer_get_glyph_infos, hb_shape};
use harfbuzz_sys::{hb_buffer_set_direction, hb_buffer_set_script};
use harfbuzz_sys::{hb_buffer_t, hb_codepoint_t, hb_font_funcs_t};
use harfbuzz_sys::{hb_face_t, hb_font_t};
use harfbuzz_sys::{hb_position_t, hb_tag_t};
use harfbuzz_sys::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
use lazy_static::lazy_static;
use log::debug;
use std::os::raw::{c_char, c_int, c_uint, c_void};
use std::{char, cmp, ptr};
const NO_GLYPH: i32 = -1; const NO_GLYPH: i32 = -1;
const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a'); const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a');

View file

@ -7,11 +7,10 @@
//! //!
//! Currently, only harfbuzz bindings are implemented. //! Currently, only harfbuzz bindings are implemented.
pub use self::harfbuzz::Shaper;
use crate::font::ShapingOptions; use crate::font::ShapingOptions;
use crate::text::glyph::GlyphStore; use crate::text::glyph::GlyphStore;
pub use self::harfbuzz::Shaper;
pub mod harfbuzz; pub mod harfbuzz;
pub trait ShaperMethods { pub trait ShaperMethods {

View file

@ -2,23 +2,24 @@
* 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 crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags};
use crate::font::{RunMetrics, ShapingOptions};
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphStore};
use app_units::Au;
use log::debug;
use range::Range;
use serde::{Deserialize, Serialize};
use std::cell::Cell; use std::cell::Cell;
use std::cmp::{max, Ordering}; use std::cmp::{max, Ordering};
use std::slice::Iter; use std::slice::Iter;
use std::sync::Arc; use std::sync::Arc;
use app_units::Au;
use log::debug;
use range::Range;
use serde::{Deserialize, Serialize};
use style::str::char_is_whitespace; use style::str::char_is_whitespace;
use unicode_bidi as bidi; use unicode_bidi as bidi;
use webrender_api::FontInstanceKey; use webrender_api::FontInstanceKey;
use xi_unicode::LineBreakLeafIter; use xi_unicode::LineBreakLeafIter;
use crate::font::{Font, FontHandleMethods, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
use crate::platform::font_template::FontTemplateData;
use crate::text::glyph::{ByteIndex, GlyphStore};
thread_local! { thread_local! {
static INDEX_OF_FIRST_GLYPH_RUN_CACHE: Cell<Option<(*const TextRun, ByteIndex, usize)>> = static INDEX_OF_FIRST_GLYPH_RUN_CACHE: Cell<Option<(*const TextRun, ByteIndex, usize)>> =
Cell::new(None) Cell::new(None)

View file

@ -8,10 +8,11 @@
pub mod print_tree; pub mod print_tree;
use std::sync::atomic::{AtomicUsize, Ordering};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use range::{int_range_index, RangeIndex}; use range::{int_range_index, RangeIndex};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::atomic::{AtomicUsize, Ordering};
use webrender_api::{Epoch as WebRenderEpoch, FontInstanceKey, FontKey, NativeFontHandle}; use webrender_api::{Epoch as WebRenderEpoch, FontInstanceKey, FontKey, NativeFontHandle};
/// A newtype struct for denoting the age of messages; prevents race conditions. /// A newtype struct for denoting the age of messages; prevents race conditions.

View file

@ -3,8 +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 syn::parse_quote; use syn::parse_quote;
use synstructure::decl_derive; use synstructure::{decl_derive, quote};
use synstructure::quote;
decl_derive!([JSTraceable, attributes(no_trace, custom_trace)] => decl_derive!([JSTraceable, attributes(no_trace, custom_trace)] =>
/// Implements `JSTraceable` on structs and enums /// Implements `JSTraceable` on structs and enums

View file

@ -25,30 +25,10 @@
//! //!
//! http://dev.w3.org/csswg/css-sizing/ //! http://dev.w3.org/csswg/css-sizing/
use crate::context::LayoutContext; use std::cmp::{max, min};
use crate::display_list::items::DisplayListSection; use std::fmt;
use crate::display_list::{ use std::sync::Arc;
BorderPaintingMode, DisplayListBuildState, StackingContextCollectionFlags,
StackingContextCollectionState,
};
use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo};
use crate::flow::{
BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag, GetBaseFlow,
};
use crate::flow::{
FlowFlags, FragmentationContext, ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow,
};
use crate::flow_list::FlowList;
use crate::fragment::{
CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow,
};
use crate::incremental::RelayoutMode;
use crate::model::{
AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto,
};
use crate::sequential;
use crate::traversal::PreorderFlowTraversal;
use crate::{layout_debug, layout_debug_scope};
use app_units::{Au, MAX_AU}; use app_units::{Au, MAX_AU};
use bitflags::bitflags; use bitflags::bitflags;
use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D};
@ -56,9 +36,6 @@ use gfx_traits::print_tree::PrintTree;
use log::{debug, trace}; use log::{debug, trace};
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use servo_geometry::MaxRect; use servo_geometry::MaxRect;
use std::cmp::{max, min};
use std::fmt;
use std::sync::Arc;
use style::computed_values::box_sizing::T as BoxSizing; use style::computed_values::box_sizing::T as BoxSizing;
use style::computed_values::display::T as Display; use style::computed_values::display::T as Display;
use style::computed_values::float::T as Float; use style::computed_values::float::T as Float;
@ -71,6 +48,28 @@ use style::properties::ComputedValues;
use style::servo::restyle_damage::ServoRestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::{LengthPercentageOrAuto, MaxSize, Size}; use style::values::computed::{LengthPercentageOrAuto, MaxSize, Size};
use crate::context::LayoutContext;
use crate::display_list::items::DisplayListSection;
use crate::display_list::{
BorderPaintingMode, DisplayListBuildState, StackingContextCollectionFlags,
StackingContextCollectionState,
};
use crate::floats::{ClearType, FloatKind, Floats, PlacementInfo};
use crate::flow::{
BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, FlowFlags, ForceNonfloatedFlag,
FragmentationContext, GetBaseFlow, ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow,
};
use crate::flow_list::FlowList;
use crate::fragment::{
CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentFlags, Overflow,
};
use crate::incremental::RelayoutMode;
use crate::model::{
AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto,
};
use crate::traversal::PreorderFlowTraversal;
use crate::{layout_debug, layout_debug_scope, sequential};
/// Information specific to floated blocks. /// Information specific to floated blocks.
#[derive(Clone, Serialize)] #[derive(Clone, Serialize)]
pub struct FloatedBlockInfo { pub struct FloatedBlockInfo {

View file

@ -11,43 +11,12 @@
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet. //! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
//! Construction items bubble up the tree from children to parents until they find their homes. //! Construction items bubble up the tree from children to parents until they find their homes.
use crate::block::BlockFlow; use std::collections::LinkedList;
use crate::context::{with_thread_local_font_context, LayoutContext}; use std::marker::PhantomData;
use crate::data::{LayoutData, LayoutDataFlags}; use std::mem;
use crate::display_list::items::OpaqueNode; use std::sync::atomic::Ordering;
use crate::flex::FlexFlow; use std::sync::Arc;
use crate::floats::FloatKind;
use crate::flow::{AbsoluteDescendants, Flow, FlowClass, GetBaseFlow, ImmutableFlowUtils};
use crate::flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
use crate::flow_ref::FlowRef;
use crate::fragment::{
CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo,
};
use crate::fragment::{
ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo,
};
use crate::fragment::{
InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo,
};
use crate::fragment::{
TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult,
};
use crate::inline::{InlineFlow, InlineFragmentNodeFlags, InlineFragmentNodeInfo};
use crate::linked_list::prepend_from;
use crate::list_item::{ListItemFlow, ListStyleTypeContent};
use crate::multicol::{MulticolColumnFlow, MulticolFlow};
use crate::parallel;
use crate::table::TableFlow;
use crate::table_caption::TableCaptionFlow;
use crate::table_cell::TableCellFlow;
use crate::table_colgroup::TableColGroupFlow;
use crate::table_row::TableRowFlow;
use crate::table_rowgroup::TableRowGroupFlow;
use crate::table_wrapper::TableWrapperFlow;
use crate::text::TextRunScanner;
use crate::traversal::PostorderNodeMutTraversal;
use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers};
use crate::ServoArc;
use html5ever::{local_name, namespace_url, ns}; use html5ever::{local_name, namespace_url, ns};
use log::debug; use log::debug;
use script_layout_interface::wrapper_traits::{ use script_layout_interface::wrapper_traits::{
@ -56,11 +25,6 @@ use script_layout_interface::wrapper_traits::{
use script_layout_interface::{LayoutElementType, LayoutNodeType}; use script_layout_interface::{LayoutElementType, LayoutNodeType};
use servo_config::opts; use servo_config::opts;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::collections::LinkedList;
use std::marker::PhantomData;
use std::mem;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use style::computed_values::caption_side::T as CaptionSide; use style::computed_values::caption_side::T as CaptionSide;
use style::computed_values::display::T as Display; use style::computed_values::display::T as Display;
use style::computed_values::empty_cells::T as EmptyCells; use style::computed_values::empty_cells::T as EmptyCells;
@ -77,6 +41,39 @@ use style::values::computed::Image;
use style::values::generics::counters::ContentItem; use style::values::generics::counters::ContentItem;
use style::LocalName; use style::LocalName;
use crate::block::BlockFlow;
use crate::context::{with_thread_local_font_context, LayoutContext};
use crate::data::{LayoutData, LayoutDataFlags};
use crate::display_list::items::OpaqueNode;
use crate::flex::FlexFlow;
use crate::floats::FloatKind;
use crate::flow::{
AbsoluteDescendants, Flow, FlowClass, FlowFlags, GetBaseFlow, ImmutableFlowUtils,
MutableFlowUtils, MutableOwnedFlowUtils,
};
use crate::flow_ref::FlowRef;
use crate::fragment::{
CanvasFragmentInfo, Fragment, FragmentFlags, GeneratedContentInfo, IframeFragmentInfo,
ImageFragmentInfo, InlineAbsoluteFragmentInfo, InlineAbsoluteHypotheticalFragmentInfo,
InlineBlockFragmentInfo, MediaFragmentInfo, SpecificFragmentInfo, SvgFragmentInfo,
TableColumnFragmentInfo, UnscannedTextFragmentInfo, WhitespaceStrippingResult,
};
use crate::inline::{InlineFlow, InlineFragmentNodeFlags, InlineFragmentNodeInfo};
use crate::linked_list::prepend_from;
use crate::list_item::{ListItemFlow, ListStyleTypeContent};
use crate::multicol::{MulticolColumnFlow, MulticolFlow};
use crate::table::TableFlow;
use crate::table_caption::TableCaptionFlow;
use crate::table_cell::TableCellFlow;
use crate::table_colgroup::TableColGroupFlow;
use crate::table_row::TableRowFlow;
use crate::table_rowgroup::TableRowGroupFlow;
use crate::table_wrapper::TableWrapperFlow;
use crate::text::TextRunScanner;
use crate::traversal::PostorderNodeMutTraversal;
use crate::wrapper::{LayoutNodeLayoutData, TextContent, ThreadSafeLayoutNodeHelpers};
use crate::{parallel, ServoArc};
/// The results of flow construction for a DOM node. /// The results of flow construction for a DOM node.
#[derive(Clone)] #[derive(Clone)]
pub enum ConstructionResult { pub enum ConstructionResult {

Some files were not shown because too many files have changed in this diff Show more