mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix servo build and rustfmt recent changes.
We need to introduce another Cursor enum that is specific to embedder_traits and that layout converts to to avoid dependency hell.
This commit is contained in:
parent
05881b5ab4
commit
90c0ec0cf7
19 changed files with 243 additions and 111 deletions
|
@ -26,13 +26,10 @@ impl Animate for LengthPercentage {
|
|||
let length = self
|
||||
.unclamped_length()
|
||||
.animate(&other.unclamped_length(), procedure)?;
|
||||
let percentage = animate_percentage_half(
|
||||
self.specified_percentage(),
|
||||
other.specified_percentage(),
|
||||
)?;
|
||||
let is_calc = self.was_calc ||
|
||||
other.was_calc ||
|
||||
self.has_percentage != other.has_percentage;
|
||||
let percentage =
|
||||
animate_percentage_half(self.specified_percentage(), other.specified_percentage())?;
|
||||
let is_calc =
|
||||
self.was_calc || other.was_calc || self.has_percentage != other.has_percentage;
|
||||
Ok(Self::with_clamping_mode(
|
||||
length,
|
||||
percentage,
|
||||
|
|
|
@ -32,16 +32,14 @@ fn to_number_or_percentage(
|
|||
value: &SvgLengthPercentageOrNumber<LengthPercentage, Number>,
|
||||
) -> Result<NumberOrPercentage, ()> {
|
||||
Ok(match *value {
|
||||
SvgLengthPercentageOrNumber::LengthPercentage(ref l) => {
|
||||
match l.specified_percentage() {
|
||||
Some(p) => {
|
||||
if l.unclamped_length().px() != 0. {
|
||||
return Err(());
|
||||
}
|
||||
NumberOrPercentage::Percentage(p)
|
||||
},
|
||||
None => NumberOrPercentage::Number(l.length().px()),
|
||||
}
|
||||
SvgLengthPercentageOrNumber::LengthPercentage(ref l) => match l.specified_percentage() {
|
||||
Some(p) => {
|
||||
if l.unclamped_length().px() != 0. {
|
||||
return Err(());
|
||||
}
|
||||
NumberOrPercentage::Percentage(p)
|
||||
},
|
||||
None => NumberOrPercentage::Number(l.length().px()),
|
||||
},
|
||||
SvgLengthPercentageOrNumber::Number(ref n) => NumberOrPercentage::Number(*n),
|
||||
})
|
||||
|
|
|
@ -102,7 +102,8 @@ pub struct LengthPercentage {
|
|||
// like calc(0px + 5%) and such.
|
||||
impl PartialEq for LengthPercentage {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.length == other.length && self.percentage == other.percentage &&
|
||||
self.length == other.length &&
|
||||
self.percentage == other.percentage &&
|
||||
self.has_percentage == other.has_percentage
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +116,8 @@ impl ComputeSquaredDistance for LengthPercentage {
|
|||
Ok(self
|
||||
.unclamped_length()
|
||||
.compute_squared_distance(&other.unclamped_length())? +
|
||||
self.percentage.compute_squared_distance(&other.percentage)?)
|
||||
self.percentage
|
||||
.compute_squared_distance(&other.percentage)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +218,8 @@ impl LengthPercentage {
|
|||
/// percentages.
|
||||
pub fn maybe_to_pixel_length(&self, container_len: Option<Au>) -> Option<Length> {
|
||||
if self.has_percentage {
|
||||
let length = self.unclamped_length().px() + container_len?.scale_by(self.percentage.0).to_f32_px();
|
||||
let length = self.unclamped_length().px() +
|
||||
container_len?.scale_by(self.percentage.0).to_f32_px();
|
||||
return Some(Length::new(self.clamping_mode.clamp(length)));
|
||||
}
|
||||
Some(self.length())
|
||||
|
@ -431,8 +434,7 @@ impl ToComputedValue for specified::LengthPercentage {
|
|||
return specified::LengthPercentage::Percentage(p);
|
||||
}
|
||||
|
||||
if !computed.has_percentage &&
|
||||
computed.clamping_mode.clamp(length.px()) == length.px() {
|
||||
if !computed.has_percentage && computed.clamping_mode.clamp(length.px()) == length.px() {
|
||||
return specified::LengthPercentage::Length(ToComputedValue::from_computed_value(
|
||||
&length,
|
||||
));
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
//! Generic values for UI properties.
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use values::specified::ui::CursorKind;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::specified::ui::CursorKind;
|
||||
|
||||
/// A generic value for the `cursor` property.
|
||||
///
|
||||
|
|
|
@ -163,6 +163,7 @@ pub enum UserSelect {
|
|||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
FromPrimitive,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
|
@ -208,8 +209,12 @@ pub enum CursorKind {
|
|||
ZoomIn,
|
||||
ZoomOut,
|
||||
Auto,
|
||||
#[cfg(feature = "gecko")]
|
||||
MozGrab,
|
||||
#[cfg(feature = "gecko")]
|
||||
MozGrabbing,
|
||||
#[cfg(feature = "gecko")]
|
||||
MozZoomIn,
|
||||
#[cfg(feature = "gecko")]
|
||||
MozZoomOut,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue