Skip to content

Commit

Permalink
Move DevicePixel to script_traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Jan 11, 2017
1 parent 04a3242 commit 7879edb
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 27 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions components/compositing/compositor.rs
Expand Up @@ -11,8 +11,7 @@ use euclid::Point2D;
use euclid::point::TypedPoint2D;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use gfx_traits::{DevicePixel, ScrollRootId};
use gfx_traits::{Epoch, FragmentType};
use gfx_traits::{Epoch, FragmentType, ScrollRootId};
use gleam::gl;
use gleam::gl::types::{GLint, GLsizei};
use image::{DynamicImage, ImageFormat, RgbImage};
Expand All @@ -22,7 +21,7 @@ use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, Tra
use net_traits::image::base::{Image, PixelFormat};
use profile_traits::time::{self, ProfilerCategory, profile};
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton};
use script_traits::{ConstellationMsg, DevicePixel, LayoutControlMsg, LoadData, MouseButton};
use script_traits::{MouseEventType, StackingContextScrollState};
use script_traits::{TouchpadPressurePhase, TouchEventType, TouchId, WindowSizeData, WindowSizeType};
use script_traits::CompositorEvent::{self, MouseMoveEvent, MouseButtonEvent, TouchEvent, TouchpadPressureEvent};
Expand Down
3 changes: 1 addition & 2 deletions components/compositing/touch.rs
Expand Up @@ -4,8 +4,7 @@

use euclid::point::TypedPoint2D;
use euclid::scale_factor::ScaleFactor;
use gfx_traits::DevicePixel;
use script_traits::{EventResult, TouchId};
use script_traits::{DevicePixel, EventResult, TouchId};
use self::TouchState::*;

/// Minimum number of `ScreenPx` to begin touch scrolling.
Expand Down
3 changes: 1 addition & 2 deletions components/compositing/windowing.rs
Expand Up @@ -9,10 +9,9 @@ use euclid::{Point2D, Size2D};
use euclid::point::TypedPoint2D;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use gfx_traits::DevicePixel;
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use net_traits::net_error_list::NetError;
use script_traits::{MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
use script_traits::{DevicePixel, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
use servo_geometry::ScreenPx;
use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
Expand Down
3 changes: 1 addition & 2 deletions components/constellation/pipeline.rs
Expand Up @@ -11,7 +11,6 @@ use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use event_loop::EventLoop;
use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::DevicePixel;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::LayoutThreadFactory;
Expand All @@ -20,7 +19,7 @@ use net_traits::{IpcSend, ResourceThreads};
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem as profile_mem;
use profile_traits::time;
use script_traits::{ConstellationControlMsg, DiscardBrowsingContext, InitialScriptState};
use script_traits::{ConstellationControlMsg, DevicePixel, DiscardBrowsingContext, InitialScriptState};
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData};
Expand Down
8 changes: 0 additions & 8 deletions components/gfx_traits/lib.rs
Expand Up @@ -35,14 +35,6 @@ static NEXT_SPECIAL_STACKING_CONTEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT;
/// Note that we assume that the top 16 bits of the address space are unused on the platform.
const SPECIAL_STACKING_CONTEXT_ID_MASK: usize = 0xffff;

// Units for use with euclid::length and euclid::scale_factor.

/// One hardware pixel.
///
/// This unit corresponds to the smallest addressable element of the display hardware.
#[derive(Copy, Clone, Debug)]
pub enum DevicePixel {}

/// A newtype struct for denoting the age of messages; prevents race conditions.
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Epoch(pub u32);
Expand Down
7 changes: 6 additions & 1 deletion components/script_traits/lib.rs
Expand Up @@ -48,7 +48,6 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use gfx_traits::DevicePixel;
use gfx_traits::Epoch;
use gfx_traits::ScrollRootId;
use heapsize::HeapSizeOf;
Expand Down Expand Up @@ -642,6 +641,12 @@ pub struct StackingContextScrollState {
pub scroll_offset: Point2D<f32>,
}

/// One hardware pixel.
///
/// This unit corresponds to the smallest addressable element of the display hardware.
#[derive(Copy, Clone, Debug)]
pub enum DevicePixel {}

/// Data about the window size.
#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
pub struct WindowSizeData {
Expand Down
1 change: 0 additions & 1 deletion ports/cef/Cargo.toml
Expand Up @@ -21,7 +21,6 @@ debugmozjs = ["libservo/debugmozjs"]
compositing = {path = "../../components/compositing"}
devtools = {path = "../../components/devtools"}
euclid = "0.10.1"
gfx_traits = {path = "../../components/gfx_traits"}
gleam = "0.2.8"
glutin_app = {path = "../glutin"}
libc = "0.2"
Expand Down
1 change: 0 additions & 1 deletion ports/cef/lib.rs
Expand Up @@ -18,7 +18,6 @@ extern crate servo;
extern crate compositing;

extern crate euclid;
extern crate gfx_traits;
extern crate gleam;
extern crate glutin_app;
extern crate script_traits;
Expand Down
2 changes: 1 addition & 1 deletion ports/cef/window.rs
Expand Up @@ -22,10 +22,10 @@ use compositing::windowing::{WindowEvent, WindowMethods};
use euclid::point::Point2D;
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
use gfx_traits::DevicePixel;
use gleam::gl;
use msg::constellation_msg::{Key, KeyModifiers};
use net_traits::net_error_list::NetError;
use script_traits::DevicePixel;
use servo_geometry::ScreenPx;
use std::cell::RefCell;
use std::ffi::CString;
Expand Down
1 change: 0 additions & 1 deletion ports/glutin/Cargo.toml
Expand Up @@ -12,7 +12,6 @@ path = "lib.rs"
bitflags = "0.7"
compositing = {path = "../../components/compositing"}
euclid = "0.10.1"
gfx_traits = {path = "../../components/gfx_traits"}
gleam = "0.2.8"
log = "0.3.5"
msg = {path = "../../components/msg"}
Expand Down
1 change: 0 additions & 1 deletion ports/glutin/lib.rs
Expand Up @@ -11,7 +11,6 @@ extern crate compositing;
#[allow(unused_extern_crates)]
#[cfg(target_os = "android")] extern crate egl;
extern crate euclid;
extern crate gfx_traits;
extern crate gleam;
extern crate glutin;
#[macro_use] extern crate log;
Expand Down
3 changes: 1 addition & 2 deletions ports/glutin/window.rs
Expand Up @@ -13,7 +13,6 @@ use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
#[cfg(target_os = "windows")]
use gdi32;
use gfx_traits::DevicePixel;
use gleam::gl;
use glutin;
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, MouseScrollDelta, VirtualKeyCode};
Expand All @@ -25,7 +24,7 @@ use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER};
use net_traits::net_error_list::NetError;
#[cfg(any(target_os = "linux", target_os = "macos"))]
use osmesa_sys;
use script_traits::{TouchEventType, TouchpadPressurePhase};
use script_traits::{DevicePixel, TouchEventType, TouchpadPressurePhase};
use servo_config::opts;
use servo_config::prefs::PREFS;
use servo_config::resource_files;
Expand Down

0 comments on commit 7879edb

Please sign in to comment.