mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Update to euclid 0.20.
Differential Revision: https://phabricator.services.mozilla.com/D38530
This commit is contained in:
parent
66eae2fc81
commit
239f2da9d9
16 changed files with 39 additions and 38 deletions
|
@ -36,7 +36,7 @@ crossbeam-channel = { version = "0.3", optional = true }
|
|||
derive_more = "0.13"
|
||||
new_debug_unreachable = "1.0"
|
||||
encoding_rs = {version = "0.8", optional = true}
|
||||
euclid = "0.19"
|
||||
euclid = "0.20"
|
||||
fallible = { path = "../fallible" }
|
||||
fxhash = "0.2"
|
||||
hashglobe = { path = "../hashglobe" }
|
||||
|
|
|
@ -31,8 +31,8 @@ use crate::traversal_flags::TraversalFlags;
|
|||
use app_units::Au;
|
||||
#[cfg(feature = "servo")]
|
||||
use crossbeam_channel::Sender;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use euclid::default::Size2D;
|
||||
use euclid::Scale;
|
||||
use fxhash::FxHashMap;
|
||||
#[cfg(feature = "servo")]
|
||||
use parking_lot::RwLock;
|
||||
|
@ -195,7 +195,7 @@ impl<'a> SharedStyleContext<'a> {
|
|||
}
|
||||
|
||||
/// 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()
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::values::computed::CSSPixelLength;
|
|||
use crate::values::computed::Resolution;
|
||||
use crate::Atom;
|
||||
use app_units::Au;
|
||||
use euclid::Size2D;
|
||||
use euclid::default::Size2D;
|
||||
|
||||
fn viewport_size(device: &Device) -> Size2D<Au> {
|
||||
if let Some(pc) = device.pres_context() {
|
||||
|
|
|
@ -16,8 +16,8 @@ use crate::values::{CustomIdent, KeyframesName};
|
|||
use app_units::Au;
|
||||
use app_units::AU_PER_PX;
|
||||
use cssparser::RGBA;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use euclid::default::Size2D;
|
||||
use euclid::Scale;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
|
||||
|
@ -247,20 +247,20 @@ impl Device {
|
|||
}
|
||||
|
||||
/// 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() {
|
||||
Some(pc) => pc,
|
||||
None => return TypedScale::new(1.),
|
||||
None => return Scale::new(1.),
|
||||
};
|
||||
|
||||
let override_dppx = pc.mOverrideDPPX;
|
||||
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_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.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use crate::properties::style_structs;
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::default::{Point2D, Rect, Size2D, SideOffsets2D};
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
use std::ops::{Add, Sub};
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::values::computed::CSSPixelLength;
|
|||
use crate::values::KeyframesName;
|
||||
use app_units::Au;
|
||||
use cssparser::RGBA;
|
||||
use euclid::{Size2D, TypedScale, TypedSize2D};
|
||||
use euclid::{Size2D, Scale, Size2D};
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
|
@ -29,9 +29,9 @@ pub struct Device {
|
|||
/// The current media type used by de device.
|
||||
media_type: MediaType,
|
||||
/// 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.
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
|
||||
|
||||
/// The font size of the root element
|
||||
/// This is set when computing the style of the root
|
||||
|
@ -59,8 +59,8 @@ impl Device {
|
|||
/// Trivially construct a new `Device`.
|
||||
pub fn new(
|
||||
media_type: MediaType,
|
||||
viewport_size: TypedSize2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
|
||||
viewport_size: Size2D<f32, CSSPixel>,
|
||||
device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
|
||||
) -> Device {
|
||||
Device {
|
||||
media_type,
|
||||
|
@ -140,7 +140,7 @@ impl Device {
|
|||
}
|
||||
|
||||
/// 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
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::values::specified::{NonNegativeLengthPercentageOrAuto, ViewportPercen
|
|||
use app_units::Au;
|
||||
use cssparser::CowRcStr;
|
||||
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use euclid::TypedSize2D;
|
||||
use euclid::Size2D;
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
|
@ -832,7 +832,7 @@ impl MaybeNew for 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.
|
||||
initial_zoom: PinchZoomFactor::new(initial_zoom.unwrap_or(1.)),
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::rule_cache::RuleCacheConditions;
|
|||
use crate::Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use crate::Prefix;
|
||||
use euclid::Size2D;
|
||||
use euclid::default::Size2D;
|
||||
use std::cell::RefCell;
|
||||
use std::cmp;
|
||||
use std::f32;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::values::animated::ToAnimatedZero;
|
|||
use crate::values::computed::{Angle, Integer, Length, LengthPercentage, Number, Percentage};
|
||||
use crate::values::generics::transform as generic;
|
||||
use crate::Zero;
|
||||
use euclid::{Transform3D, Vector3D};
|
||||
use euclid::default::{Transform3D, Vector3D};
|
||||
|
||||
pub use crate::values::generics::transform::TransformStyle;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Machinery to compute distances between animatable values.
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::Size2D;
|
||||
use euclid::default::Size2D;
|
||||
use std::iter::Sum;
|
||||
use std::ops::Add;
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercent
|
|||
use crate::values::{computed, CSSFloat};
|
||||
use crate::Zero;
|
||||
use app_units::Au;
|
||||
use euclid::{self, Rect, Transform3D};
|
||||
use euclid::default::{Rect, Transform3D};
|
||||
use euclid;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
|
@ -562,7 +563,7 @@ impl<T: ToMatrix> Transform<T> {
|
|||
for operation in &*self.0 {
|
||||
let matrix = operation.to_3d_matrix(reference_box)?;
|
||||
contain_3d |= operation.is_3d();
|
||||
transform = transform.pre_mul(&matrix);
|
||||
transform = transform.pre_transform(&matrix);
|
||||
}
|
||||
|
||||
Ok((transform, contain_3d))
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::values::CSSFloat;
|
|||
use crate::Zero;
|
||||
use app_units::Au;
|
||||
use cssparser::{Parser, Token};
|
||||
use euclid::Size2D;
|
||||
use euclid::default::Size2D;
|
||||
use std::cmp;
|
||||
use std::ops::{Add, Mul};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue