mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender
This commit is contained in:
parent
76270ad6c1
commit
e17697fb0e
47 changed files with 196 additions and 211 deletions
|
@ -14,13 +14,13 @@ azure = {git = "https://github.com/servo/rust-azure"}
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
compositing = {path = "../compositing"}
|
||||
cssparser = "0.23.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fnv = "1.0"
|
||||
gleam = "0.4"
|
||||
ipc-channel = "0.9"
|
||||
log = "0.3.5"
|
||||
num-traits = "0.1.32"
|
||||
offscreen_gl_context = { version = "0.13", features = ["serde", "osmesa"] }
|
||||
offscreen_gl_context = { version = "0.14", features = ["serde", "osmesa"] }
|
||||
servo_config = {path = "../config"}
|
||||
webrender = {git = "https://github.com/servo/webrender"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
|
|
@ -11,13 +11,13 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
cssparser = "0.23.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
ipc-channel = "0.9"
|
||||
lazy_static = "1"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
nonzero = {path = "../nonzero"}
|
||||
offscreen_gl_context = { version = "0.13", features = ["serde"] }
|
||||
offscreen_gl_context = { version = "0.14", features = ["serde"] }
|
||||
serde = "1.0"
|
||||
servo_config = {path = "../config"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "compositing"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
gleam = "0.4"
|
||||
image = "0.17"
|
||||
|
|
|
@ -6,7 +6,7 @@ use CompositionPipeline;
|
|||
use SendableFrameTree;
|
||||
use compositor_thread::{CompositorProxy, CompositorReceiver};
|
||||
use compositor_thread::{InitialCompositorState, Msg};
|
||||
use euclid::{TypedPoint2D, TypedVector2D, ScaleFactor};
|
||||
use euclid::{TypedPoint2D, TypedVector2D, TypedScale};
|
||||
use gfx_traits::Epoch;
|
||||
use gleam::gl;
|
||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
|
@ -108,7 +108,7 @@ pub struct IOCompositor<Window: WindowMethods> {
|
|||
pipeline_details: HashMap<PipelineId, PipelineDetails>,
|
||||
|
||||
/// The scene scale, to allow for zooming and high-resolution painting.
|
||||
scale: ScaleFactor<f32, LayerPixel, DevicePixel>,
|
||||
scale: TypedScale<f32, LayerPixel, DevicePixel>,
|
||||
|
||||
/// The size of the rendering area.
|
||||
frame_size: DeviceUintSize,
|
||||
|
@ -124,10 +124,10 @@ pub struct IOCompositor<Window: WindowMethods> {
|
|||
max_viewport_zoom: Option<PinchZoomFactor>,
|
||||
|
||||
/// "Desktop-style" zoom that resizes the viewport to fit the window.
|
||||
page_zoom: ScaleFactor<f32, CSSPixel, DeviceIndependentPixel>,
|
||||
page_zoom: TypedScale<f32, CSSPixel, DeviceIndependentPixel>,
|
||||
|
||||
/// The device pixel ratio for this window.
|
||||
scale_factor: ScaleFactor<f32, DeviceIndependentPixel, DevicePixel>,
|
||||
scale_factor: TypedScale<f32, DeviceIndependentPixel, DevicePixel>,
|
||||
|
||||
/// The type of composition to perform
|
||||
composite_target: CompositeTarget,
|
||||
|
@ -366,7 +366,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
pipeline_details: HashMap::new(),
|
||||
frame_size: frame_size,
|
||||
window_rect: window_rect,
|
||||
scale: ScaleFactor::new(1.0),
|
||||
scale: TypedScale::new(1.0),
|
||||
scale_factor: scale_factor,
|
||||
composition_request: CompositionRequest::NoCompositingNecessary,
|
||||
touch_handler: TouchHandler::new(),
|
||||
|
@ -374,7 +374,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
waiting_for_results_of_scroll: false,
|
||||
composite_target: composite_target,
|
||||
shutdown_state: ShutdownState::NotShuttingDown,
|
||||
page_zoom: ScaleFactor::new(1.0),
|
||||
page_zoom: TypedScale::new(1.0),
|
||||
viewport_zoom: PinchZoomFactor::new(1.0),
|
||||
min_viewport_zoom: None,
|
||||
max_viewport_zoom: None,
|
||||
|
@ -1016,10 +1016,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
// deltas instead of summing them.
|
||||
if let ScrollLocation::Delta(delta) = last_combined_event.scroll_location {
|
||||
let old_event_count =
|
||||
ScaleFactor::new(last_combined_event.event_count as f32);
|
||||
TypedScale::new(last_combined_event.event_count as f32);
|
||||
last_combined_event.event_count += 1;
|
||||
let new_event_count =
|
||||
ScaleFactor::new(last_combined_event.event_count as f32);
|
||||
TypedScale::new(last_combined_event.event_count as f32);
|
||||
last_combined_event.scroll_location = ScrollLocation::Delta(
|
||||
(delta * old_event_count + this_delta) /
|
||||
new_event_count);
|
||||
|
@ -1110,34 +1110,34 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn hidpi_factor(&self) -> ScaleFactor<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
match opts::get().device_pixels_per_px {
|
||||
Some(device_pixels_per_px) => ScaleFactor::new(device_pixels_per_px),
|
||||
Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px),
|
||||
None => match opts::get().output_file {
|
||||
Some(_) => ScaleFactor::new(1.0),
|
||||
Some(_) => TypedScale::new(1.0),
|
||||
None => self.scale_factor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn device_pixels_per_page_px(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
|
||||
fn device_pixels_per_page_px(&self) -> TypedScale<f32, CSSPixel, DevicePixel> {
|
||||
self.page_zoom * self.hidpi_factor()
|
||||
}
|
||||
|
||||
fn update_zoom_transform(&mut self) {
|
||||
let scale = self.device_pixels_per_page_px();
|
||||
self.scale = ScaleFactor::new(scale.get());
|
||||
self.scale = TypedScale::new(scale.get());
|
||||
}
|
||||
|
||||
pub fn on_zoom_reset_window_event(&mut self) {
|
||||
self.page_zoom = ScaleFactor::new(1.0);
|
||||
self.page_zoom = TypedScale::new(1.0);
|
||||
self.update_zoom_transform();
|
||||
self.send_window_size(WindowSizeType::Resize);
|
||||
self.update_page_zoom_for_webrender();
|
||||
}
|
||||
|
||||
pub fn on_zoom_window_event(&mut self, magnification: f32) {
|
||||
self.page_zoom = ScaleFactor::new((self.page_zoom.get() * magnification)
|
||||
self.page_zoom = TypedScale::new((self.page_zoom.get() * magnification)
|
||||
.max(MIN_ZOOM).min(MAX_ZOOM));
|
||||
self.update_zoom_transform();
|
||||
self.send_window_size(WindowSizeType::Resize);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use euclid::{TypedPoint2D, TypedVector2D};
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::TypedScale;
|
||||
use script_traits::{EventResult, TouchId};
|
||||
use self::TouchState::*;
|
||||
use style_traits::DevicePixel;
|
||||
|
@ -124,7 +124,7 @@ impl TouchHandler {
|
|||
let (d1, c1) = self.pinch_distance_and_center();
|
||||
|
||||
let magnification = d1 / d0;
|
||||
let scroll_delta = c1 - c0 * ScaleFactor::new(magnification);
|
||||
let scroll_delta = c1 - c0 * TypedScale::new(magnification);
|
||||
|
||||
TouchAction::Zoom(magnification, scroll_delta)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use compositor_thread::EventLoopWaker;
|
||||
use euclid::{Point2D, Size2D};
|
||||
use euclid::{ScaleFactor, TypedPoint2D, TypedSize2D};
|
||||
use euclid::{TypedScale, TypedPoint2D, TypedSize2D};
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TopLevelBrowsingContextId, TraversalDirection};
|
||||
|
@ -162,7 +162,7 @@ pub trait WindowMethods {
|
|||
fn history_changed(&self, ctx: TopLevelBrowsingContextId, Vec<LoadData>, usize);
|
||||
|
||||
/// Returns the scale factor of the system (device pixels / device independent pixels).
|
||||
fn hidpi_factor(&self) -> ScaleFactor<f32, DeviceIndependentPixel, DevicePixel>;
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel>;
|
||||
|
||||
/// Returns a thread-safe object to wake up the window's event loop.
|
||||
fn create_event_loop_waker(&self) -> Box<EventLoopWaker>;
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "servo_config"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
getopts = "0.2.11"
|
||||
lazy_static = "1"
|
||||
log = "0.3.5"
|
||||
|
|
|
@ -18,7 +18,7 @@ canvas_traits = {path = "../canvas_traits"}
|
|||
compositing = {path = "../compositing"}
|
||||
debugger = {path = "../debugger"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
|
|
|
@ -106,7 +106,7 @@ use compositing::compositor_thread::{CompositorProxy, EmbedderMsg, EmbedderProxy
|
|||
use compositing::compositor_thread::Msg as ToCompositorMsg;
|
||||
use debugger;
|
||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
||||
use euclid::{Size2D, TypedSize2D, ScaleFactor};
|
||||
use euclid::{Size2D, TypedSize2D, TypedScale};
|
||||
use event_loop::EventLoop;
|
||||
#[cfg(all(any(target_os = "macos", target_os = "linux"), not(any(target_arch = "arm", target_arch = "aarch64"))))]
|
||||
use gecko_media::GeckoMedia;
|
||||
|
@ -596,9 +596,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
mem_profiler_chan: state.mem_profiler_chan,
|
||||
window_size: WindowSizeData {
|
||||
initial_viewport: opts::get().initial_window_size.to_f32() *
|
||||
ScaleFactor::new(1.0),
|
||||
TypedScale::new(1.0),
|
||||
device_pixel_ratio:
|
||||
ScaleFactor::new(opts::get().device_pixels_per_px.unwrap_or(1.0)),
|
||||
TypedScale::new(opts::get().device_pixels_per_px.unwrap_or(1.0)),
|
||||
},
|
||||
phantom: PhantomData,
|
||||
clipboard_ctx: if state.supports_clipboard {
|
||||
|
|
|
@ -8,7 +8,7 @@ use compositing::CompositionPipeline;
|
|||
use compositing::CompositorProxy;
|
||||
use compositing::compositor_thread::Msg as CompositorMsg;
|
||||
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
||||
use euclid::{TypedSize2D, ScaleFactor};
|
||||
use euclid::{TypedSize2D, TypedScale};
|
||||
use event_loop::EventLoop;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::Error;
|
||||
|
@ -149,7 +149,7 @@ pub struct InitialPipelineState {
|
|||
pub window_size: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
|
||||
/// Information about the device pixel ratio.
|
||||
pub device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
pub device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
|
||||
/// The event loop to run in, if applicable.
|
||||
pub event_loop: Option<Rc<EventLoop>>,
|
||||
|
|
|
@ -11,6 +11,6 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
app_units = "0.6"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
|
|
|
@ -16,7 +16,7 @@ unstable = ["simd"]
|
|||
[dependencies]
|
||||
app_units = "0.6"
|
||||
bitflags = "1.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fnv = "1.0"
|
||||
fontsan = {git = "https://github.com/servo/fontsan"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
|
|
|
@ -14,7 +14,7 @@ app_units = "0.6"
|
|||
atomic_refcell = "0.1"
|
||||
bitflags = "1.0"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fnv = "1.0"
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
|
|
|
@ -15,7 +15,7 @@ unstable = ["parking_lot/nightly", "nonzero/unstable"]
|
|||
[dependencies]
|
||||
app_units = "0.6"
|
||||
atomic_refcell = "0.1"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fnv = "1.0"
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
|
|
|
@ -54,7 +54,7 @@ mod dom_wrapper;
|
|||
use app_units::Au;
|
||||
use dom_wrapper::{ServoLayoutElement, ServoLayoutDocument, ServoLayoutNode};
|
||||
use dom_wrapper::drop_style_and_layout_data;
|
||||
use euclid::{Point2D, Rect, Size2D, ScaleFactor, TypedSize2D};
|
||||
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
|
||||
use fnv::FnvHashMap;
|
||||
use gfx::display_list::{OpaqueNode, WebRenderImageInfo};
|
||||
use gfx::font;
|
||||
|
@ -455,8 +455,8 @@ impl LayoutThread {
|
|||
// but it will be set correctly when the initial reflow takes place.
|
||||
let device = Device::new(
|
||||
MediaType::screen(),
|
||||
opts::get().initial_window_size.to_f32() * ScaleFactor::new(1.0),
|
||||
ScaleFactor::new(opts::get().device_pixels_per_px.unwrap_or(1.0)));
|
||||
opts::get().initial_window_size.to_f32() * TypedScale::new(1.0),
|
||||
TypedScale::new(opts::get().device_pixels_per_px.unwrap_or(1.0)));
|
||||
|
||||
let configuration =
|
||||
rayon::Configuration::new().num_threads(layout_threads)
|
||||
|
@ -1784,7 +1784,7 @@ impl RegisteredSpeculativePainter for RegisteredPainterImpl {
|
|||
impl Painter for RegisteredPainterImpl {
|
||||
fn draw_a_paint_image(&self,
|
||||
size: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
properties: Vec<(Atom, String)>,
|
||||
arguments: Vec<String>)
|
||||
-> DrawAPaintImageResult
|
||||
|
|
|
@ -14,7 +14,7 @@ servo = ["mozjs", "string_cache", "url", "webrender_api", "xml5ever"]
|
|||
[dependencies]
|
||||
app_units = "0.6"
|
||||
cssparser = "0.23.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
hashglobe = { path = "../hashglobe" }
|
||||
mozjs = { version = "0.1.8", features = ["promises"], optional = true }
|
||||
servo_arc = { path = "../servo_arc" }
|
||||
|
|
|
@ -582,7 +582,7 @@ impl<T: MallocSizeOf, Unit> MallocSizeOf for euclid::Length<T, Unit> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::ScaleFactor<T, Src, Dst> {
|
||||
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedScale<T, Src, Dst> {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.0.size_of(ops)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ devtools_traits = {path = "../devtools_traits"}
|
|||
dom_struct = {path = "../dom_struct"}
|
||||
domobject_derive = {path = "../domobject_derive"}
|
||||
encoding_rs = "0.7"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fnv = "1.0"
|
||||
gleam = "0.4"
|
||||
half = "1.0"
|
||||
|
@ -69,7 +69,7 @@ msg = {path = "../msg"}
|
|||
net_traits = {path = "../net_traits"}
|
||||
nonzero = {path = "../nonzero"}
|
||||
num-traits = "0.1.32"
|
||||
offscreen_gl_context = { version = "0.13", features = ["serde"] }
|
||||
offscreen_gl_context = { version = "0.14", features = ["serde"] }
|
||||
open = "1.1.1"
|
||||
parking_lot = "0.4"
|
||||
phf = "0.7.18"
|
||||
|
|
|
@ -48,7 +48,7 @@ use dom::bindings::str::{DOMString, USVString};
|
|||
use dom::bindings::utils::WindowProxyHandler;
|
||||
use dom::document::PendingRestyle;
|
||||
use encoding_rs::Encoding;
|
||||
use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, ScaleFactor};
|
||||
use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, TypedScale};
|
||||
use euclid::Length as EuclidLength;
|
||||
use html5ever::{Prefix, LocalName, Namespace, QualName};
|
||||
use html5ever::buffer_queue::BufferQueue;
|
||||
|
@ -526,7 +526,7 @@ unsafe impl JSTraceable for Point2D<f32> {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<T, U> JSTraceable for ScaleFactor<f32, T, U> {
|
||||
unsafe impl<T, U> JSTraceable for TypedScale<f32, T, U> {
|
||||
#[inline]
|
||||
unsafe fn trace(&self, _trc: *mut JSTracer) {
|
||||
// Do nothing
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::dommatrix::DOMMatrix;
|
|||
use dom::dompoint::DOMPoint;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{Transform3D, Radians};
|
||||
use euclid::{Transform3D, Angle};
|
||||
use std::cell::{Cell, Ref};
|
||||
use std::f64;
|
||||
|
||||
|
@ -256,19 +256,19 @@ impl DOMMatrixReadOnly {
|
|||
}
|
||||
if rotZ != 0.0 {
|
||||
// Step 5.
|
||||
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, Radians::new(rotZ.to_radians()));
|
||||
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, Angle::radians(rotZ.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
}
|
||||
if rotY != 0.0 {
|
||||
// Step 6.
|
||||
let rotation = Transform3D::create_rotation(0.0, 1.0, 0.0, Radians::new(rotY.to_radians()));
|
||||
let rotation = Transform3D::create_rotation(0.0, 1.0, 0.0, Angle::radians(rotY.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
}
|
||||
if rotX != 0.0 {
|
||||
// Step 7.
|
||||
let rotation = Transform3D::create_rotation(1.0, 0.0, 0.0, Radians::new(rotX.to_radians()));
|
||||
let rotation = Transform3D::create_rotation(1.0, 0.0, 0.0, Angle::radians(rotX.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ impl DOMMatrixReadOnly {
|
|||
// don't do anything when the rotation angle is zero or undefined
|
||||
if y != 0.0 || x < 0.0 {
|
||||
// Step 1.
|
||||
let rotZ = Radians::new(f64::atan2(y, x));
|
||||
let rotZ = Angle::radians(f64::atan2(y, x));
|
||||
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, rotZ);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
|
@ -292,7 +292,7 @@ impl DOMMatrixReadOnly {
|
|||
pub fn rotate_axis_angle_self(&self, x: f64, y: f64, z: f64, angle: f64) {
|
||||
// Step 1.
|
||||
let (norm_x, norm_y, norm_z) = normalize_point(x, y, z);
|
||||
let rotation = Transform3D::create_rotation(norm_x, norm_y, norm_z, Radians::new(angle.to_radians()));
|
||||
let rotation = Transform3D::create_rotation(norm_x, norm_y, norm_z, Angle::radians(angle.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
// Step 2.
|
||||
|
@ -305,7 +305,7 @@ impl DOMMatrixReadOnly {
|
|||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewxself
|
||||
pub fn skew_x_self(&self, sx: f64) {
|
||||
// Step 1.
|
||||
let skew = Transform3D::create_skew(Radians::new(sx.to_radians()), Radians::new(0.0));
|
||||
let skew = Transform3D::create_skew(Angle::radians(sx.to_radians()), Angle::radians(0.0));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = skew.post_mul(&matrix);
|
||||
// Step 2 in DOMMatrix.SkewXSelf
|
||||
|
@ -314,7 +314,7 @@ impl DOMMatrixReadOnly {
|
|||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewyself
|
||||
pub fn skew_y_self(&self, sy: f64) {
|
||||
// Step 1.
|
||||
let skew = Transform3D::create_skew(Radians::new(0.0), Radians::new(sy.to_radians()));
|
||||
let skew = Transform3D::create_skew(Angle::radians(0.0), Angle::radians(sy.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = skew.post_mul(&matrix);
|
||||
// Step 2 in DOMMatrix.SkewYSelf
|
||||
|
|
|
@ -26,8 +26,8 @@ use dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
|||
use dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||
use dom::workletglobalscope::WorkletGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use euclid::TypedSize2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -38,7 +38,7 @@ use style_traits::DevicePixel;
|
|||
#[dom_struct]
|
||||
pub struct PaintRenderingContext2D {
|
||||
context: CanvasRenderingContext2D,
|
||||
device_pixel_ratio: Cell<ScaleFactor<f32, CSSPixel, DevicePixel>>,
|
||||
device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>,
|
||||
}
|
||||
|
||||
impl PaintRenderingContext2D {
|
||||
|
@ -48,7 +48,7 @@ impl PaintRenderingContext2D {
|
|||
let base_url = global.upcast::<WorkletGlobalScope>().base_url();
|
||||
PaintRenderingContext2D {
|
||||
context: CanvasRenderingContext2D::new_inherited(global.upcast(), None, image_cache, base_url, size),
|
||||
device_pixel_ratio: Cell::new(ScaleFactor::new(1.0)),
|
||||
device_pixel_ratio: Cell::new(TypedScale::new(1.0)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl PaintRenderingContext2D {
|
|||
|
||||
pub fn set_bitmap_dimensions(&self,
|
||||
size: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>)
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>)
|
||||
{
|
||||
let size = size * device_pixel_ratio;
|
||||
self.device_pixel_ratio.set(device_pixel_ratio);
|
||||
|
|
|
@ -24,7 +24,7 @@ use dom::workletglobalscope::WorkletGlobalScope;
|
|||
use dom::workletglobalscope::WorkletGlobalScopeInit;
|
||||
use dom::workletglobalscope::WorkletTask;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::TypedScale;
|
||||
use euclid::TypedSize2D;
|
||||
use ipc_channel::ipc;
|
||||
use js::jsapi::Call;
|
||||
|
@ -79,7 +79,7 @@ pub struct PaintWorkletGlobalScope {
|
|||
/// The most recent size the worklet was drawn at
|
||||
cached_size: Cell<TypedSize2D<f32, CSSPixel>>,
|
||||
/// The most recent device pixel ratio the worklet was drawn at
|
||||
cached_device_pixel_ratio: Cell<ScaleFactor<f32, CSSPixel, DevicePixel>>,
|
||||
cached_device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>,
|
||||
/// The most recent properties the worklet was drawn at
|
||||
cached_properties: DomRefCell<Vec<(Atom, String)>>,
|
||||
/// The most recent arguments the worklet was drawn at
|
||||
|
@ -104,7 +104,7 @@ impl PaintWorkletGlobalScope {
|
|||
paint_class_instances: Default::default(),
|
||||
cached_name: DomRefCell::new(Atom::from("")),
|
||||
cached_size: Cell::new(TypedSize2D::zero()),
|
||||
cached_device_pixel_ratio: Cell::new(ScaleFactor::new(1.0)),
|
||||
cached_device_pixel_ratio: Cell::new(TypedScale::new(1.0)),
|
||||
cached_properties: Default::default(),
|
||||
cached_arguments: Default::default(),
|
||||
cached_result: DomRefCell::new(DrawAPaintImageResult {
|
||||
|
@ -173,7 +173,7 @@ impl PaintWorkletGlobalScope {
|
|||
fn draw_a_paint_image(&self,
|
||||
name: &Atom,
|
||||
size_in_px: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
properties: &StylePropertyMapReadOnly,
|
||||
arguments: &[String])
|
||||
-> DrawAPaintImageResult
|
||||
|
@ -193,7 +193,7 @@ impl PaintWorkletGlobalScope {
|
|||
name: &Atom,
|
||||
size_in_px: TypedSize2D<f32, CSSPixel>,
|
||||
size_in_dpx: TypedSize2D<u32, DevicePixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
properties: &StylePropertyMapReadOnly,
|
||||
arguments: &[String])
|
||||
-> DrawAPaintImageResult
|
||||
|
@ -340,7 +340,7 @@ impl PaintWorkletGlobalScope {
|
|||
impl Painter for WorkletPainter {
|
||||
fn draw_a_paint_image(&self,
|
||||
size: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
properties: Vec<(Atom, String)>,
|
||||
arguments: Vec<String>)
|
||||
-> DrawAPaintImageResult {
|
||||
|
@ -451,7 +451,7 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
|
|||
pub enum PaintWorkletTask {
|
||||
DrawAPaintImage(Atom,
|
||||
TypedSize2D<f32, CSSPixel>,
|
||||
ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
Vec<(Atom, String)>,
|
||||
Vec<String>,
|
||||
Sender<DrawAPaintImageResult>),
|
||||
|
|
|
@ -14,7 +14,7 @@ app_units = "0.6"
|
|||
atomic_refcell = "0.1"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
cssparser = "0.23.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
html5ever = "0.22"
|
||||
ipc-channel = "0.9"
|
||||
|
|
|
@ -14,7 +14,7 @@ bluetooth_traits = {path = "../bluetooth_traits"}
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
cookie = "0.10"
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
|
|
|
@ -41,7 +41,7 @@ pub mod webdriver_msg;
|
|||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas_traits::webgl::WebGLPipeline;
|
||||
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use euclid::{Size2D, Length, Point2D, Vector2D, Rect, ScaleFactor, TypedSize2D};
|
||||
use euclid::{Size2D, Length, Point2D, Vector2D, Rect, TypedScale, TypedSize2D};
|
||||
use gfx_traits::Epoch;
|
||||
use hyper::header::Headers;
|
||||
use hyper::method::Method;
|
||||
|
@ -732,7 +732,7 @@ pub struct WindowSizeData {
|
|||
pub initial_viewport: TypedSize2D<f32, CSSPixel>,
|
||||
|
||||
/// The resolution of the window in dppx, not including any "pinch zoom" factor.
|
||||
pub device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
pub device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
}
|
||||
|
||||
/// The type of window size change.
|
||||
|
@ -866,7 +866,7 @@ pub trait Painter: SpeculativePainter {
|
|||
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
|
||||
fn draw_a_paint_image(&self,
|
||||
size: TypedSize2D<f32, CSSPixel>,
|
||||
zoom: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
zoom: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
properties: Vec<(Atom, String)>,
|
||||
arguments: Vec<String>)
|
||||
-> DrawAPaintImageResult;
|
||||
|
|
|
@ -37,7 +37,7 @@ debugger = {path = "../debugger"}
|
|||
devtools = {path = "../devtools"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
env_logger = "0.4"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx = {path = "../gfx"}
|
||||
gleam = "0.4"
|
||||
ipc-channel = "0.9"
|
||||
|
|
|
@ -33,7 +33,7 @@ byteorder = "1.0"
|
|||
cfg-if = "0.1.0"
|
||||
cssparser = "0.23.0"
|
||||
encoding_rs = {version = "0.7", optional = true}
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
fallible = { path = "../fallible" }
|
||||
fnv = "1.0"
|
||||
hashglobe = { path = "../hashglobe" }
|
||||
|
|
|
@ -10,8 +10,8 @@ use bloom::StyleBloom;
|
|||
use data::{EagerPseudoStyles, ElementData};
|
||||
use dom::{TElement, SendElement};
|
||||
#[cfg(feature = "servo")] use dom::OpaqueNode;
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use fnv::FnvHashMap;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::structs;
|
||||
|
@ -171,7 +171,7 @@ impl<'a> SharedStyleContext<'a> {
|
|||
}
|
||||
|
||||
/// The device pixel ratio
|
||||
pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
|
||||
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> {
|
||||
self.stylist.device().device_pixel_ratio()
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ use app_units::AU_PER_PX;
|
|||
use app_units::Au;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{CssStringWriter, Parser, RGBA, Token, BasicParseErrorKind};
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs;
|
||||
|
@ -187,12 +187,12 @@ impl Device {
|
|||
}
|
||||
|
||||
/// Returns the device pixel ratio.
|
||||
pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
|
||||
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> {
|
||||
let override_dppx = self.pres_context().mOverrideDPPX;
|
||||
if override_dppx > 0.0 { return ScaleFactor::new(override_dppx); }
|
||||
if override_dppx > 0.0 { return TypedScale::new(override_dppx); }
|
||||
let au_per_dpx = self.pres_context().mCurAppUnitsPerDevPixel as f32;
|
||||
let au_per_px = AU_PER_PX as f32;
|
||||
ScaleFactor::new(au_per_px / au_per_dpx)
|
||||
TypedScale::new(au_per_px / au_per_dpx)
|
||||
}
|
||||
|
||||
/// Returns whether document colors are enabled.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use app_units::Au;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, RGBA};
|
||||
use euclid::{ScaleFactor, Size2D, TypedSize2D};
|
||||
use euclid::{TypedScale, Size2D, TypedSize2D};
|
||||
use media_queries::MediaType;
|
||||
use parser::ParserContext;
|
||||
use properties::ComputedValues;
|
||||
|
@ -31,7 +31,7 @@ pub struct Device {
|
|||
/// The current viewport size, in CSS pixels.
|
||||
viewport_size: TypedSize2D<f32, CSSPixel>,
|
||||
/// The current device pixel ratio, from CSS pixels to device pixels.
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
|
||||
/// The font size of the root element
|
||||
/// This is set when computing the style of the root
|
||||
|
@ -57,7 +57,7 @@ impl Device {
|
|||
pub fn new(
|
||||
media_type: MediaType,
|
||||
viewport_size: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>
|
||||
) -> Device {
|
||||
Device {
|
||||
media_type,
|
||||
|
@ -121,7 +121,7 @@ impl Device {
|
|||
}
|
||||
|
||||
/// Returns the device pixel ratio.
|
||||
pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
|
||||
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> {
|
||||
self.device_pixel_ratio
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Generic types for CSS values that are related to transformations.
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::{Radians, Rect, Transform3D};
|
||||
use euclid::{self, Rect, Transform3D};
|
||||
use num_traits::Zero;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -457,18 +457,20 @@ where
|
|||
let theta = TWO_PI - theta.as_ref().radians64();
|
||||
let (ax, ay, az, theta) =
|
||||
get_normalized_vector_and_angle(ax.into(), ay.into(), az.into(), theta);
|
||||
Transform3D::create_rotation(ax as f64, ay as f64, az as f64, Radians::new(theta))
|
||||
Transform3D::create_rotation(
|
||||
ax as f64, ay as f64, az as f64, euclid::Angle::radians(theta)
|
||||
)
|
||||
},
|
||||
RotateX(theta) => {
|
||||
let theta = Radians::new(TWO_PI - theta.as_ref().radians64());
|
||||
let theta = euclid::Angle::radians(TWO_PI - theta.as_ref().radians64());
|
||||
Transform3D::create_rotation(1., 0., 0., theta)
|
||||
},
|
||||
RotateY(theta) => {
|
||||
let theta = Radians::new(TWO_PI - theta.as_ref().radians64());
|
||||
let theta = euclid::Angle::radians(TWO_PI - theta.as_ref().radians64());
|
||||
Transform3D::create_rotation(0., 1., 0., theta)
|
||||
},
|
||||
RotateZ(theta) | Rotate(theta) => {
|
||||
let theta = Radians::new(TWO_PI - theta.as_ref().radians64());
|
||||
let theta = euclid::Angle::radians(TWO_PI - theta.as_ref().radians64());
|
||||
Transform3D::create_rotation(0., 0., 1., theta)
|
||||
},
|
||||
Perspective(ref d) => {
|
||||
|
@ -503,20 +505,20 @@ where
|
|||
},
|
||||
Skew(theta_x, theta_y) => {
|
||||
Transform3D::create_skew(
|
||||
Radians::new(theta_x.as_ref().radians64()),
|
||||
Radians::new(theta_y.map_or(0., |a| a.as_ref().radians64())),
|
||||
euclid::Angle::radians(theta_x.as_ref().radians64()),
|
||||
euclid::Angle::radians(theta_y.map_or(0., |a| a.as_ref().radians64())),
|
||||
)
|
||||
},
|
||||
SkewX(theta) => {
|
||||
Transform3D::create_skew(
|
||||
Radians::new(theta.as_ref().radians64()),
|
||||
Radians::new(0.),
|
||||
euclid::Angle::radians(theta.as_ref().radians64()),
|
||||
euclid::Angle::radians(0.),
|
||||
)
|
||||
},
|
||||
SkewY(theta) => {
|
||||
Transform3D::create_skew(
|
||||
Radians::new(0.),
|
||||
Radians::new(theta.as_ref().radians64()),
|
||||
euclid::Angle::radians(0.),
|
||||
euclid::Angle::radians(theta.as_ref().radians64()),
|
||||
)
|
||||
},
|
||||
Matrix3D(m) => m.into(),
|
||||
|
|
|
@ -17,7 +17,7 @@ gecko = []
|
|||
app_units = "0.6"
|
||||
cssparser = "0.23.0"
|
||||
bitflags = "1.0"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
selectors = { path = "../selectors" }
|
||||
|
|
|
@ -12,7 +12,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
base64 = "0.6"
|
||||
cookie = "0.10"
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
hyper = "0.10"
|
||||
image = "0.17"
|
||||
ipc-channel = "0.9"
|
||||
|
|
|
@ -15,7 +15,7 @@ oculusvr = ['rust-webvr/oculusvr']
|
|||
|
||||
[dependencies]
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
ipc-channel = "0.9"
|
||||
log = "0.3"
|
||||
msg = {path = "../msg"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue