style: Update to euclid 0.20.

Differential Revision: https://phabricator.services.mozilla.com/D38530
This commit is contained in:
Nicolas Silva 2019-07-18 22:54:16 +02:00 committed by Emilio Cobos Álvarez
parent 66eae2fc81
commit 239f2da9d9
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
16 changed files with 39 additions and 38 deletions

View file

@ -27,7 +27,7 @@ servo = [
app_units = "0.7" app_units = "0.7"
crossbeam-channel = { version = "0.3", optional = true } crossbeam-channel = { version = "0.3", optional = true }
cssparser = "0.25" cssparser = "0.25"
euclid = "0.19" euclid = "0.20"
hashglobe = { path = "../hashglobe" } hashglobe = { path = "../hashglobe" }
hyper = { version = "0.12", optional = true } hyper = { version = "0.12", optional = true }
hyper_serde = { version = "0.11", optional = true } hyper_serde = { version = "0.11", optional = true }

View file

@ -625,25 +625,25 @@ impl<T: MallocSizeOf, Unit> MallocSizeOf for euclid::Length<T, Unit> {
} }
} }
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedScale<T, Src, Dst> { impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::Scale<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.0.size_of(ops) self.0.size_of(ops)
} }
} }
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedPoint2D<T, U> { impl<T: MallocSizeOf, U> MallocSizeOf for euclid::Point2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.x.size_of(ops) + self.y.size_of(ops) self.x.size_of(ops) + self.y.size_of(ops)
} }
} }
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedRect<T, U> { impl<T: MallocSizeOf, U> MallocSizeOf for euclid::Rect<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.origin.size_of(ops) + self.size.size_of(ops) self.origin.size_of(ops) + self.size.size_of(ops)
} }
} }
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSideOffsets2D<T, U> { impl<T: MallocSizeOf, U> MallocSizeOf for euclid::SideOffsets2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.top.size_of(ops) + self.top.size_of(ops) +
self.right.size_of(ops) + self.right.size_of(ops) +
@ -652,13 +652,13 @@ impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSideOffsets2D<T, U> {
} }
} }
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedSize2D<T, U> { impl<T: MallocSizeOf, U> MallocSizeOf for euclid::Size2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.width.size_of(ops) + self.height.size_of(ops) self.width.size_of(ops) + self.height.size_of(ops)
} }
} }
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform2D<T, Src, Dst> { impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::Transform2D<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.m11.size_of(ops) + self.m11.size_of(ops) +
self.m12.size_of(ops) + self.m12.size_of(ops) +
@ -669,7 +669,7 @@ impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform2D<T, Src
} }
} }
impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform3D<T, Src, Dst> { impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::Transform3D<T, Src, Dst> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.m11.size_of(ops) + self.m11.size_of(ops) +
self.m12.size_of(ops) + self.m12.size_of(ops) +
@ -690,7 +690,7 @@ impl<T: MallocSizeOf, Src, Dst> MallocSizeOf for euclid::TypedTransform3D<T, Src
} }
} }
impl<T: MallocSizeOf, U> MallocSizeOf for euclid::TypedVector2D<T, U> { impl<T: MallocSizeOf, U> MallocSizeOf for euclid::Vector2D<T, U> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
self.x.size_of(ops) + self.y.size_of(ops) self.x.size_of(ops) + self.y.size_of(ops)
} }

View file

@ -36,7 +36,7 @@ crossbeam-channel = { version = "0.3", optional = true }
derive_more = "0.13" derive_more = "0.13"
new_debug_unreachable = "1.0" new_debug_unreachable = "1.0"
encoding_rs = {version = "0.8", optional = true} encoding_rs = {version = "0.8", optional = true}
euclid = "0.19" euclid = "0.20"
fallible = { path = "../fallible" } fallible = { path = "../fallible" }
fxhash = "0.2" fxhash = "0.2"
hashglobe = { path = "../hashglobe" } hashglobe = { path = "../hashglobe" }

View file

@ -31,8 +31,8 @@ use crate::traversal_flags::TraversalFlags;
use app_units::Au; use app_units::Au;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use euclid::Size2D; use euclid::default::Size2D;
use euclid::TypedScale; use euclid::Scale;
use fxhash::FxHashMap; use fxhash::FxHashMap;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use parking_lot::RwLock; use parking_lot::RwLock;
@ -195,7 +195,7 @@ impl<'a> SharedStyleContext<'a> {
} }
/// The device pixel ratio /// The device pixel ratio
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> { pub fn device_pixel_ratio(&self) -> Scale<f32, CSSPixel, DevicePixel> {
self.stylist.device().device_pixel_ratio() self.stylist.device().device_pixel_ratio()
} }

View file

@ -14,7 +14,7 @@ use crate::values::computed::CSSPixelLength;
use crate::values::computed::Resolution; use crate::values::computed::Resolution;
use crate::Atom; use crate::Atom;
use app_units::Au; use app_units::Au;
use euclid::Size2D; use euclid::default::Size2D;
fn viewport_size(device: &Device) -> Size2D<Au> { fn viewport_size(device: &Device) -> Size2D<Au> {
if let Some(pc) = device.pres_context() { if let Some(pc) = device.pres_context() {

View file

@ -16,8 +16,8 @@ use crate::values::{CustomIdent, KeyframesName};
use app_units::Au; use app_units::Au;
use app_units::AU_PER_PX; use app_units::AU_PER_PX;
use cssparser::RGBA; use cssparser::RGBA;
use euclid::Size2D; use euclid::default::Size2D;
use euclid::TypedScale; use euclid::Scale;
use servo_arc::Arc; use servo_arc::Arc;
use std::fmt; use std::fmt;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering}; use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
@ -247,20 +247,20 @@ impl Device {
} }
/// Returns the device pixel ratio. /// Returns the device pixel ratio.
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> { pub fn device_pixel_ratio(&self) -> Scale<f32, CSSPixel, DevicePixel> {
let pc = match self.pres_context() { let pc = match self.pres_context() {
Some(pc) => pc, Some(pc) => pc,
None => return TypedScale::new(1.), None => return Scale::new(1.),
}; };
let override_dppx = pc.mOverrideDPPX; let override_dppx = pc.mOverrideDPPX;
if override_dppx > 0.0 { if override_dppx > 0.0 {
return TypedScale::new(override_dppx); return Scale::new(override_dppx);
} }
let au_per_dpx = pc.mCurAppUnitsPerDevPixel as f32; let au_per_dpx = pc.mCurAppUnitsPerDevPixel as f32;
let au_per_px = AU_PER_PX as f32; let au_per_px = AU_PER_PX as f32;
TypedScale::new(au_per_px / au_per_dpx) Scale::new(au_per_px / au_per_dpx)
} }
/// Returns whether document colors are enabled. /// Returns whether document colors are enabled.

View file

@ -6,7 +6,7 @@
use crate::properties::style_structs; use crate::properties::style_structs;
use euclid::num::Zero; use euclid::num::Zero;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::default::{Point2D, Rect, Size2D, SideOffsets2D};
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter}; use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};

View file

@ -15,7 +15,7 @@ use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName; use crate::values::KeyframesName;
use app_units::Au; use app_units::Au;
use cssparser::RGBA; use cssparser::RGBA;
use euclid::{Size2D, TypedScale, TypedSize2D}; use euclid::{Size2D, Scale, Size2D};
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering}; use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
use style_traits::viewport::ViewportConstraints; use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel}; use style_traits::{CSSPixel, DevicePixel};
@ -29,9 +29,9 @@ pub struct Device {
/// The current media type used by de device. /// The current media type used by de device.
media_type: MediaType, media_type: MediaType,
/// The current viewport size, in CSS pixels. /// The current viewport size, in CSS pixels.
viewport_size: TypedSize2D<f32, CSSPixel>, viewport_size: Size2D<f32, CSSPixel>,
/// The current device pixel ratio, from CSS pixels to device pixels. /// The current device pixel ratio, from CSS pixels to device pixels.
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
/// The font size of the root element /// The font size of the root element
/// This is set when computing the style of the root /// This is set when computing the style of the root
@ -59,8 +59,8 @@ impl Device {
/// Trivially construct a new `Device`. /// Trivially construct a new `Device`.
pub fn new( pub fn new(
media_type: MediaType, media_type: MediaType,
viewport_size: TypedSize2D<f32, CSSPixel>, viewport_size: Size2D<f32, CSSPixel>,
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
) -> Device { ) -> Device {
Device { Device {
media_type, media_type,
@ -140,7 +140,7 @@ impl Device {
} }
/// Returns the device pixel ratio. /// Returns the device pixel ratio.
pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> { pub fn device_pixel_ratio(&self) -> Scale<f32, CSSPixel, DevicePixel> {
self.device_pixel_ratio self.device_pixel_ratio
} }

View file

@ -25,7 +25,7 @@ use crate::values::specified::{NonNegativeLengthPercentageOrAuto, ViewportPercen
use app_units::Au; use app_units::Au;
use cssparser::CowRcStr; use cssparser::CowRcStr;
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use euclid::TypedSize2D; use euclid::Size2D;
use selectors::parser::SelectorParseErrorKind; use selectors::parser::SelectorParseErrorKind;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::RefCell; use std::cell::RefCell;
@ -832,7 +832,7 @@ impl MaybeNew for ViewportConstraints {
}); });
Some(ViewportConstraints { Some(ViewportConstraints {
size: TypedSize2D::new(width.to_f32_px(), height.to_f32_px()), size: Size2D::new(width.to_f32_px(), height.to_f32_px()),
// TODO: compute a zoom factor for 'auto' as suggested by DEVICE-ADAPT § 10. // TODO: compute a zoom factor for 'auto' as suggested by DEVICE-ADAPT § 10.
initial_zoom: PinchZoomFactor::new(initial_zoom.unwrap_or(1.)), initial_zoom: PinchZoomFactor::new(initial_zoom.unwrap_or(1.)),

View file

@ -23,7 +23,7 @@ use crate::rule_cache::RuleCacheConditions;
use crate::Atom; use crate::Atom;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use crate::Prefix; use crate::Prefix;
use euclid::Size2D; use euclid::default::Size2D;
use std::cell::RefCell; use std::cell::RefCell;
use std::cmp; use std::cmp;
use std::f32; use std::f32;

View file

@ -10,7 +10,7 @@ use crate::values::animated::ToAnimatedZero;
use crate::values::computed::{Angle, Integer, Length, LengthPercentage, Number, Percentage}; use crate::values::computed::{Angle, Integer, Length, LengthPercentage, Number, Percentage};
use crate::values::generics::transform as generic; use crate::values::generics::transform as generic;
use crate::Zero; use crate::Zero;
use euclid::{Transform3D, Vector3D}; use euclid::default::{Transform3D, Vector3D};
pub use crate::values::generics::transform::TransformStyle; pub use crate::values::generics::transform::TransformStyle;

View file

@ -5,7 +5,7 @@
//! Machinery to compute distances between animatable values. //! Machinery to compute distances between animatable values.
use app_units::Au; use app_units::Au;
use euclid::Size2D; use euclid::default::Size2D;
use std::iter::Sum; use std::iter::Sum;
use std::ops::Add; use std::ops::Add;

View file

@ -12,7 +12,8 @@ use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercent
use crate::values::{computed, CSSFloat}; use crate::values::{computed, CSSFloat};
use crate::Zero; use crate::Zero;
use app_units::Au; use app_units::Au;
use euclid::{self, Rect, Transform3D}; use euclid::default::{Rect, Transform3D};
use euclid;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
@ -562,7 +563,7 @@ impl<T: ToMatrix> Transform<T> {
for operation in &*self.0 { for operation in &*self.0 {
let matrix = operation.to_3d_matrix(reference_box)?; let matrix = operation.to_3d_matrix(reference_box)?;
contain_3d |= operation.is_3d(); contain_3d |= operation.is_3d();
transform = transform.pre_mul(&matrix); transform = transform.pre_transform(&matrix);
} }
Ok((transform, contain_3d)) Ok((transform, contain_3d))

View file

@ -22,7 +22,7 @@ use crate::values::CSSFloat;
use crate::Zero; use crate::Zero;
use app_units::Au; use app_units::Au;
use cssparser::{Parser, Token}; use cssparser::{Parser, Token};
use euclid::Size2D; use euclid::default::Size2D;
use std::cmp; use std::cmp;
use std::ops::{Add, Mul}; use std::ops::{Add, Mul};
use style_traits::values::specified::AllowedNumericType; use style_traits::values::specified::AllowedNumericType;

View file

@ -17,7 +17,7 @@ gecko = []
app_units = "0.7" app_units = "0.7"
cssparser = "0.25" cssparser = "0.25"
bitflags = "1.0" bitflags = "1.0"
euclid = "0.19" euclid = "0.20"
lazy_static = "1" lazy_static = "1"
malloc_size_of = { path = "../malloc_size_of" } malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1" malloc_size_of_derive = "0.1"

View file

@ -6,7 +6,7 @@
use crate::{CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss}; use crate::{CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss};
use cssparser::Parser; use cssparser::Parser;
use euclid::TypedSize2D; use euclid::Size2D;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
define_css_keyword_enum! { define_css_keyword_enum! {
@ -33,7 +33,7 @@ pub struct ViewportConstraints {
/// Width and height: /// Width and height:
/// * https://drafts.csswg.org/css-device-adapt/#width-desc /// * https://drafts.csswg.org/css-device-adapt/#width-desc
/// * https://drafts.csswg.org/css-device-adapt/#height-desc /// * https://drafts.csswg.org/css-device-adapt/#height-desc
pub size: TypedSize2D<f32, CSSPixel>, pub size: Size2D<f32, CSSPixel>,
/// <https://drafts.csswg.org/css-device-adapt/#zoom-desc> /// <https://drafts.csswg.org/css-device-adapt/#zoom-desc>
pub initial_zoom: PinchZoomFactor, pub initial_zoom: PinchZoomFactor,
/// <https://drafts.csswg.org/css-device-adapt/#min-max-width-desc> /// <https://drafts.csswg.org/css-device-adapt/#min-max-width-desc>