mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
style: Rustfmt.
This commit is contained in:
parent
c6dfe53483
commit
2d85b54db0
5 changed files with 300 additions and 438 deletions
|
@ -11,9 +11,9 @@
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use crate::gecko::values::GeckoStyleCoordConvertible;
|
use crate::gecko::values::GeckoStyleCoordConvertible;
|
||||||
use crate::gecko_bindings::bindings;
|
use crate::gecko_bindings::bindings;
|
||||||
|
use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||||
use crate::gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
|
use crate::gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
|
||||||
use crate::gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
|
use crate::gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
|
||||||
use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
|
||||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||||
use crate::stylesheets::{Origin, RulesMutateError};
|
use crate::stylesheets::{Origin, RulesMutateError};
|
||||||
use crate::values::computed::image::LineDirection;
|
use crate::values::computed::image::LineDirection;
|
||||||
|
@ -1145,22 +1145,35 @@ pub unsafe fn string_from_chars_pointer(p: *const u16) -> String {
|
||||||
String::from_utf16_lossy(char_vec)
|
String::from_utf16_lossy(char_vec)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From< &'a RawGeckoGfxMatrix4x4> for Matrix3D {
|
impl<'a> From<&'a RawGeckoGfxMatrix4x4> for Matrix3D {
|
||||||
fn from(m: &'a RawGeckoGfxMatrix4x4) -> Matrix3D {
|
fn from(m: &'a RawGeckoGfxMatrix4x4) -> Matrix3D {
|
||||||
Matrix3D {
|
Matrix3D {
|
||||||
m11: m[0], m12: m[1], m13: m[2], m14: m[3],
|
m11: m[0],
|
||||||
m21: m[4], m22: m[5], m23: m[6], m24: m[7],
|
m12: m[1],
|
||||||
m31: m[8], m32: m[9], m33: m[10], m34: m[11],
|
m13: m[2],
|
||||||
m41: m[12], m42: m[13], m43: m[14], m44: m[15],
|
m14: m[3],
|
||||||
|
m21: m[4],
|
||||||
|
m22: m[5],
|
||||||
|
m23: m[6],
|
||||||
|
m24: m[7],
|
||||||
|
m31: m[8],
|
||||||
|
m32: m[9],
|
||||||
|
m33: m[10],
|
||||||
|
m34: m[11],
|
||||||
|
m41: m[12],
|
||||||
|
m42: m[13],
|
||||||
|
m43: m[14],
|
||||||
|
m44: m[15],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Matrix3D> for RawGeckoGfxMatrix4x4 {
|
impl From<Matrix3D> for RawGeckoGfxMatrix4x4 {
|
||||||
fn from(matrix: Matrix3D) -> RawGeckoGfxMatrix4x4 {
|
fn from(matrix: Matrix3D) -> RawGeckoGfxMatrix4x4 {
|
||||||
[ matrix.m11, matrix.m12, matrix.m13, matrix.m14,
|
[
|
||||||
matrix.m21, matrix.m22, matrix.m23, matrix.m24,
|
matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21, matrix.m22, matrix.m23,
|
||||||
matrix.m31, matrix.m32, matrix.m33, matrix.m34,
|
matrix.m24, matrix.m31, matrix.m32, matrix.m33, matrix.m34, matrix.m41, matrix.m42,
|
||||||
matrix.m41, matrix.m42, matrix.m43, matrix.m44 ]
|
matrix.m43, matrix.m44,
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ use std::cmp;
|
||||||
|
|
||||||
pub mod color;
|
pub mod color;
|
||||||
pub mod effects;
|
pub mod effects;
|
||||||
pub mod transform;
|
|
||||||
mod font;
|
mod font;
|
||||||
mod length;
|
mod length;
|
||||||
mod svg;
|
mod svg;
|
||||||
|
pub mod transform;
|
||||||
|
|
||||||
/// The category a property falls into for ordering purposes.
|
/// The category a property falls into for ordering purposes.
|
||||||
///
|
///
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -529,14 +529,7 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue,
|
||||||
Copy,
|
|
||||||
Debug,
|
|
||||||
MallocSizeOf,
|
|
||||||
PartialEq,
|
|
||||||
SpecifiedValueInfo,
|
|
||||||
ToAnimatedZero,
|
|
||||||
ToComputedValue,
|
|
||||||
)]
|
)]
|
||||||
/// A value of the `Rotate` property
|
/// A value of the `Rotate` property
|
||||||
///
|
///
|
||||||
|
@ -598,14 +591,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue,
|
||||||
Copy,
|
|
||||||
Debug,
|
|
||||||
MallocSizeOf,
|
|
||||||
PartialEq,
|
|
||||||
SpecifiedValueInfo,
|
|
||||||
ToAnimatedZero,
|
|
||||||
ToComputedValue,
|
|
||||||
)]
|
)]
|
||||||
/// A value of the `Scale` property
|
/// A value of the `Scale` property
|
||||||
///
|
///
|
||||||
|
@ -646,13 +632,7 @@ impl<Number: ToCss + PartialEq> ToCss for Scale<Number> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue,
|
||||||
Debug,
|
|
||||||
MallocSizeOf,
|
|
||||||
PartialEq,
|
|
||||||
SpecifiedValueInfo,
|
|
||||||
ToAnimatedZero,
|
|
||||||
ToComputedValue,
|
|
||||||
)]
|
)]
|
||||||
/// A value of the `Translate` property
|
/// A value of the `Translate` property
|
||||||
///
|
///
|
||||||
|
|
|
@ -1299,26 +1299,25 @@ impl BreakBetween {
|
||||||
///
|
///
|
||||||
/// See https://drafts.csswg.org/css-break/#page-break-properties.
|
/// See https://drafts.csswg.org/css-break/#page-break-properties.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn parse_legacy<'i>(
|
pub fn parse_legacy<'i>(input: &mut Parser<'i, '_>) -> Result<Self, ParseError<'i>> {
|
||||||
input: &mut Parser<'i, '_>,
|
|
||||||
) -> Result<Self, ParseError<'i>> {
|
|
||||||
let location = input.current_source_location();
|
let location = input.current_source_location();
|
||||||
let ident = input.expect_ident()?;
|
let ident = input.expect_ident()?;
|
||||||
let break_value = match BreakBetween::from_ident(ident) {
|
let break_value = match BreakBetween::from_ident(ident) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(()) => return Err(location.new_custom_error(
|
Err(()) => {
|
||||||
SelectorParseErrorKind::UnexpectedIdent(ident.clone())
|
return Err(location
|
||||||
)),
|
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
|
||||||
|
},
|
||||||
};
|
};
|
||||||
match break_value {
|
match break_value {
|
||||||
BreakBetween::Always => Ok(BreakBetween::Page),
|
BreakBetween::Always => Ok(BreakBetween::Page),
|
||||||
BreakBetween::Auto |
|
BreakBetween::Auto | BreakBetween::Avoid | BreakBetween::Left | BreakBetween::Right => {
|
||||||
BreakBetween::Avoid |
|
Ok(break_value)
|
||||||
BreakBetween::Left |
|
},
|
||||||
BreakBetween::Right => Ok(break_value),
|
|
||||||
BreakBetween::Page => {
|
BreakBetween::Page => {
|
||||||
Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
|
Err(location
|
||||||
}
|
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1330,10 +1329,9 @@ impl BreakBetween {
|
||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
BreakBetween::Auto |
|
BreakBetween::Auto | BreakBetween::Avoid | BreakBetween::Left | BreakBetween::Right => {
|
||||||
BreakBetween::Avoid |
|
self.to_css(dest)
|
||||||
BreakBetween::Left |
|
},
|
||||||
BreakBetween::Right => self.to_css(dest),
|
|
||||||
BreakBetween::Page => dest.write_str("always"),
|
BreakBetween::Page => dest.write_str("always"),
|
||||||
BreakBetween::Always => Ok(()),
|
BreakBetween::Always => Ok(()),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue