mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Move WindowSizeData to script_traits.
This commit is contained in:
parent
54bb138ddc
commit
b8fe9e9637
14 changed files with 40 additions and 44 deletions
|
@ -28,16 +28,16 @@ use layers::platform::surface::NativeDisplay;
|
|||
use layers::rendergl;
|
||||
use layers::rendergl::RenderContext;
|
||||
use layers::scene::Scene;
|
||||
use msg::constellation_msg::{Image, PixelFormat};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{NavigationDirection, PipelineId, PipelineIndex, PipelineNamespaceId};
|
||||
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
|
||||
use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{LoadData, NavigationDirection, PipelineId};
|
||||
use msg::constellation_msg::{PipelineIndex, PipelineNamespaceId, WindowSizeType};
|
||||
use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest};
|
||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||
use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent};
|
||||
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
||||
use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton, MouseEventType};
|
||||
use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType, TouchId};
|
||||
use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType};
|
||||
use script_traits::{TouchId, WindowSizeData};
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fs::File;
|
||||
|
|
|
@ -27,7 +27,7 @@ use layout_traits::LayoutThreadFactory;
|
|||
use msg::constellation_msg::{FrameId, FrameType, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeType};
|
||||
use msg::constellation_msg::{self, PanicMsg};
|
||||
use msg::webdriver_msg;
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
|
@ -45,7 +45,7 @@ use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorM
|
|||
use script_traits::{DocumentState, LayoutControlMsg};
|
||||
use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest};
|
||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
||||
use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg};
|
||||
use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg, WindowSizeData};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Error as IOError;
|
||||
|
|
|
@ -18,7 +18,7 @@ use ipc_channel::router::ROUTER;
|
|||
use layers::geometry::DevicePixel;
|
||||
use layout_traits::LayoutThreadFactory;
|
||||
use msg::constellation_msg::{FrameId, FrameType, LoadData, PanicMsg, PipelineId};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, SubpageId};
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
|
@ -26,7 +26,7 @@ use profile_traits::mem as profile_mem;
|
|||
use profile_traits::time;
|
||||
use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent};
|
||||
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg};
|
||||
use script_traits::{ScriptThreadFactory, TimerEventRequest};
|
||||
use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData};
|
||||
use std::collections::HashMap;
|
||||
use std::io::Error as IOError;
|
||||
use std::process;
|
||||
|
|
|
@ -17,13 +17,11 @@ heapsize = "0.3.0"
|
|||
heapsize_plugin = "0.1.2"
|
||||
hyper = {version = "0.9.9", features = ["serde-serialization"]}
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]}
|
||||
plugins = {path = "../plugins"}
|
||||
rustc-serialize = "0.3.4"
|
||||
serde = "0.7.11"
|
||||
serde_macros = "0.7.11"
|
||||
url = {version = "1.0.0", features = ["heap_size", "serde"]}
|
||||
util = {path = "../util", features = ["servo"]}
|
||||
|
||||
[dependencies.webrender_traits]
|
||||
git = "https://github.com/servo/webrender_traits"
|
||||
|
|
|
@ -5,33 +5,16 @@
|
|||
//! The high-level interface from script to constellation. Using this abstract interface helps
|
||||
//! reduce coupling between these two components.
|
||||
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
use hyper::header::Headers;
|
||||
use hyper::method::Method;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use layers::geometry::DevicePixel;
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use url::Url;
|
||||
use util::geometry::{PagePx, ViewportPx};
|
||||
use webrender_traits;
|
||||
|
||||
pub type PanicMsg = (Option<PipelineId>, String, String);
|
||||
|
||||
#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct WindowSizeData {
|
||||
/// The size of the initial layout viewport, before parsing an
|
||||
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
||||
pub initial_viewport: TypedSize2D<ViewportPx, f32>,
|
||||
|
||||
/// The "viewing area" in page px. See `PagePx` documentation for details.
|
||||
pub visible_viewport: TypedSize2D<PagePx, f32>,
|
||||
|
||||
/// The resolution of the window in dppx, not including any "pinch zoom" factor.
|
||||
pub device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Eq, PartialEq, Serialize, Copy, Clone, HeapSizeOf)]
|
||||
pub enum WindowSizeType {
|
||||
Initial,
|
||||
|
|
|
@ -15,11 +15,9 @@ extern crate euclid;
|
|||
extern crate heapsize;
|
||||
extern crate hyper;
|
||||
extern crate ipc_channel;
|
||||
extern crate layers;
|
||||
extern crate rustc_serialize;
|
||||
extern crate serde;
|
||||
extern crate url;
|
||||
extern crate util;
|
||||
extern crate webrender_traits;
|
||||
|
||||
pub mod constellation_msg;
|
||||
|
|
|
@ -56,7 +56,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, TraceKind, JSObject, JSTracer};
|
|||
use js::jsval::JSVal;
|
||||
use js::rust::Runtime;
|
||||
use libc;
|
||||
use msg::constellation_msg::{FrameType, PipelineId, SubpageId, WindowSizeData, WindowSizeType, ReferrerPolicy};
|
||||
use msg::constellation_msg::{FrameType, PipelineId, SubpageId, WindowSizeType, ReferrerPolicy};
|
||||
use net_traits::filemanager_thread::{SelectedFileId, RelativePos};
|
||||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
|
||||
|
@ -70,7 +70,7 @@ use script_layout_interface::OpaqueStyleAndLayoutData;
|
|||
use script_layout_interface::reporter::CSSErrorReporter;
|
||||
use script_layout_interface::rpc::LayoutRPC;
|
||||
use script_runtime::ScriptChan;
|
||||
use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress};
|
||||
use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress, WindowSizeData};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::SmallVec;
|
||||
use std::boxed::FnBox;
|
||||
|
|
|
@ -43,8 +43,7 @@ use js::jsapi::{JS_GetRuntime, JS_GC, MutableHandleValue, SetWindowProxy};
|
|||
use js::rust::CompileOptionsWrapper;
|
||||
use js::rust::Runtime;
|
||||
use libc;
|
||||
use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId};
|
||||
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
|
||||
use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId, WindowSizeType};
|
||||
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
|
||||
|
@ -66,7 +65,7 @@ use script_thread::SendableMainThreadScriptChan;
|
|||
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
|
||||
use script_traits::{ConstellationControlMsg, UntrustedNodeAddress};
|
||||
use script_traits::{DocumentState, MsDuration, TimerEvent, TimerEventId};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource, WindowSizeData};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -65,7 +65,7 @@ use js::jsval::UndefinedValue;
|
|||
use js::rust::Runtime;
|
||||
use mem::heap_size_of_self_and_children;
|
||||
use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeType};
|
||||
use msg::webdriver_msg::WebDriverScriptCommand;
|
||||
use net_traits::LoadData as NetLoadData;
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
|
@ -87,7 +87,7 @@ use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult};
|
|||
use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent};
|
||||
use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource};
|
||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
|
||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
|
|
@ -7,12 +7,12 @@ use euclid::point::Point2D;
|
|||
use euclid::rect::Rect;
|
||||
use gfx_traits::{Epoch, LayerId};
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use msg::constellation_msg::{PanicMsg, PipelineId, WindowSizeData};
|
||||
use msg::constellation_msg::{PanicMsg, PipelineId};
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use profile_traits::mem::ReportsChan;
|
||||
use rpc::LayoutRPC;
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
||||
use script_traits::{LayoutMsg as ConstellationMsg, StackingContextScrollState};
|
||||
use script_traits::{LayoutMsg as ConstellationMsg, StackingContextScrollState, WindowSizeData};
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use string_cache::Atom;
|
||||
|
|
|
@ -17,6 +17,7 @@ gfx_traits = {path = "../gfx_traits"}
|
|||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]}
|
||||
libc = "0.2"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
|
|
|
@ -18,6 +18,7 @@ extern crate euclid;
|
|||
extern crate gfx_traits;
|
||||
extern crate heapsize;
|
||||
extern crate ipc_channel;
|
||||
extern crate layers;
|
||||
extern crate libc;
|
||||
extern crate msg;
|
||||
extern crate net_traits;
|
||||
|
@ -37,15 +38,18 @@ use euclid::Size2D;
|
|||
use euclid::length::Length;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
use gfx_traits::Epoch;
|
||||
use gfx_traits::LayerId;
|
||||
use gfx_traits::StackingContextId;
|
||||
use heapsize::HeapSizeOf;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use layers::geometry::DevicePixel;
|
||||
use libc::c_void;
|
||||
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData, WindowSizeType};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeType};
|
||||
use msg::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
|
@ -56,6 +60,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
|||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::{Sender, Receiver};
|
||||
use url::Url;
|
||||
use util::geometry::{PagePx, ViewportPx};
|
||||
use util::ipc::OptionalOpaqueIpcSender;
|
||||
|
||||
pub use script_msg::{LayoutMsg, ScriptMsg, EventResult};
|
||||
|
@ -521,6 +526,20 @@ pub struct StackingContextScrollState {
|
|||
pub scroll_offset: Point2D<f32>,
|
||||
}
|
||||
|
||||
/// Data about the window size.
|
||||
#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct WindowSizeData {
|
||||
/// The size of the initial layout viewport, before parsing an
|
||||
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
||||
pub initial_viewport: TypedSize2D<ViewportPx, f32>,
|
||||
|
||||
/// The "viewing area" in page px. See `PagePx` documentation for details.
|
||||
pub visible_viewport: TypedSize2D<PagePx, f32>,
|
||||
|
||||
/// The resolution of the window in dppx, not including any "pinch zoom" factor.
|
||||
pub device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>,
|
||||
}
|
||||
|
||||
/// Messages to the constellation originating from the WebDriver server.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum WebDriverCommandMsg {
|
||||
|
|
3
components/servo/Cargo.lock
generated
3
components/servo/Cargo.lock
generated
|
@ -1384,13 +1384,11 @@ dependencies = [
|
|||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.6 (git+https://github.com/servo/rust-layers)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
||||
|
@ -2012,6 +2010,7 @@ dependencies = [
|
|||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.6 (git+https://github.com/servo/rust-layers)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
|
|
3
ports/cef/Cargo.lock
generated
3
ports/cef/Cargo.lock
generated
|
@ -1286,13 +1286,11 @@ dependencies = [
|
|||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.6 (git+https://github.com/servo/rust-layers)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
||||
|
@ -1856,6 +1854,7 @@ dependencies = [
|
|||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.6 (git+https://github.com/servo/rust-layers)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue