Update euclid.

There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
This commit is contained in:
Emilio Cobos Álvarez 2019-07-22 12:49:39 +02:00
parent 2ff7cb5a37
commit 3d57c22e9c
133 changed files with 686 additions and 596 deletions

View file

@ -5,8 +5,8 @@
//! Geometry in flow-relative space.
use crate::properties::style_structs;
use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D};
use euclid::num::Zero;
use euclid::default::{Point2D, Rect, Size2D, SideOffsets2D};
use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub};

View file

@ -262,7 +262,7 @@ trait PrivateMatchMethods: TElement {
// around...
None => {
return new_style_specifies_animations || new_style.is_pseudo_style();
}
},
};
let old_box_style = old_style.get_box();

View file

@ -15,7 +15,8 @@ use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
use app_units::Au;
use cssparser::RGBA;
use euclid::{Size2D, Scale, Size2D};
use euclid::default::Size2D as UntypedSize2D;
use euclid::{Scale, Size2D};
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel};
@ -121,7 +122,7 @@ impl Device {
/// Returns the viewport size of the current device in app units, needed,
/// among other things, to resolve viewport units.
#[inline]
pub fn au_viewport_size(&self) -> Size2D<Au> {
pub fn au_viewport_size(&self) -> UntypedSize2D<Au> {
Size2D::new(
Au::from_f32_px(self.viewport_size.width),
Au::from_f32_px(self.viewport_size.height),
@ -129,7 +130,7 @@ impl Device {
}
/// Like the above, but records that we've used viewport units.
pub fn au_viewport_size_for_viewport_unit_resolution(&self) -> Size2D<Au> {
pub fn au_viewport_size_for_viewport_unit_resolution(&self) -> UntypedSize2D<Au> {
self.used_viewport_units.store(true, Ordering::Relaxed);
self.au_viewport_size()
}

View file

@ -194,11 +194,15 @@ impl fmt::Debug for UrlExtraData {
spec.fmt(formatter)
}
}
}
};
}
define_debug_struct!(DebugURI, nsIURI, Gecko_nsIURI_Debug);
define_debug_struct!(DebugReferrerInfo, nsIReferrerInfo, Gecko_nsIReferrerInfo_Debug);
define_debug_struct!(
DebugReferrerInfo,
nsIReferrerInfo,
Gecko_nsIReferrerInfo_Debug
);
formatter
.debug_struct("URLExtraData")
@ -209,7 +213,11 @@ impl fmt::Debug for UrlExtraData {
)
.field(
"referrer",
&DebugReferrerInfo(self.as_ref().mReferrerInfo.raw::<structs::nsIReferrerInfo>()),
&DebugReferrerInfo(
self.as_ref()
.mReferrerInfo
.raw::<structs::nsIReferrerInfo>(),
),
)
.finish()
}

View file

@ -12,8 +12,8 @@ use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercent
use crate::values::{computed, CSSFloat};
use crate::Zero;
use app_units::Au;
use euclid::default::{Rect, Transform3D};
use euclid;
use euclid::default::{Rect, Transform3D};
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};

View file

@ -163,7 +163,7 @@ impl Parse for Quotes {
.try(|input| input.expect_ident_matching("none"))
.is_ok()
{
return Ok(Quotes::QuoteList(QuoteList::default()))
return Ok(Quotes::QuoteList(QuoteList::default()));
}
let mut quotes = Vec::new();
@ -180,7 +180,9 @@ impl Parse for Quotes {
}
if !quotes.is_empty() {
Ok(Quotes::QuoteList(QuoteList(crate::ArcSlice::from_iter(quotes.into_iter()))))
Ok(Quotes::QuoteList(QuoteList(crate::ArcSlice::from_iter(
quotes.into_iter(),
))))
} else {
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}

View file

@ -142,8 +142,8 @@ fn parse_number_with_clamping_mode<'i, 't>(
value: value.min(f32::MAX).max(f32::MIN),
calc_clamping_mode: None,
});
}
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {}
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
ref t => return Err(location.new_unexpected_token_error(t.clone())),
}
@ -537,7 +537,7 @@ impl Parse for Integer {
Token::Number {
int_value: Some(v), ..
} => return Ok(Integer::new(v)),
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {}
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
ref t => return Err(location.new_unexpected_token_error(t.clone())),
}
@ -813,7 +813,7 @@ impl Attr {
None => {
return Err(location
.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
},
};
Some((prefix, ns))
} else {
@ -823,10 +823,10 @@ impl Attr {
namespace: prefix_and_ns,
attribute: Atom::from(second_token.as_ref()),
});
}
},
// In the case of attr(foobar ) we don't want to error out
// because of the trailing whitespace
Token::WhiteSpace(..) => {}
Token::WhiteSpace(..) => {},
ref t => return Err(input.new_unexpected_token_error(t.clone())),
}
}

View file

@ -266,11 +266,14 @@ impl<S> PositionComponent<S> {
/// Returns the count of this component.
fn component_count(&self) -> usize {
match *self {
PositionComponent::Length(..) |
PositionComponent::Center => 1,
PositionComponent::Length(..) | PositionComponent::Center => 1,
PositionComponent::Side(_, ref lp) => {
if lp.is_some() { 2 } else { 1 }
}
if lp.is_some() {
2
} else {
1
}
},
}
}
}