mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Various fixes in style
This commit is contained in:
parent
840e4c90d5
commit
97422ad252
3 changed files with 20 additions and 20 deletions
|
@ -798,26 +798,26 @@ fn build_identity_transform_list(list: &Vec<TransformOperation>) -> Vec<Transfor
|
||||||
let mut result = vec!();
|
let mut result = vec!();
|
||||||
|
|
||||||
for operation in list {
|
for operation in list {
|
||||||
match operation {
|
match *operation {
|
||||||
&TransformOperation::Matrix(..) => {
|
TransformOperation::Matrix(..) => {
|
||||||
let identity = ComputedMatrix::identity();
|
let identity = ComputedMatrix::identity();
|
||||||
result.push(TransformOperation::Matrix(identity));
|
result.push(TransformOperation::Matrix(identity));
|
||||||
}
|
}
|
||||||
&TransformOperation::Skew(..) => {
|
TransformOperation::Skew(..) => {
|
||||||
result.push(TransformOperation::Skew(0.0, 0.0));
|
result.push(TransformOperation::Skew(0.0, 0.0));
|
||||||
}
|
}
|
||||||
&TransformOperation::Translate(..) => {
|
TransformOperation::Translate(..) => {
|
||||||
result.push(TransformOperation::Translate(LengthOrPercentage::zero(),
|
result.push(TransformOperation::Translate(LengthOrPercentage::zero(),
|
||||||
LengthOrPercentage::zero(),
|
LengthOrPercentage::zero(),
|
||||||
Au(0)));
|
Au(0)));
|
||||||
}
|
}
|
||||||
&TransformOperation::Scale(..) => {
|
TransformOperation::Scale(..) => {
|
||||||
result.push(TransformOperation::Scale(1.0, 1.0, 1.0));
|
result.push(TransformOperation::Scale(1.0, 1.0, 1.0));
|
||||||
}
|
}
|
||||||
&TransformOperation::Rotate(..) => {
|
TransformOperation::Rotate(..) => {
|
||||||
result.push(TransformOperation::Rotate(0.0, 0.0, 1.0, Angle(0.0)));
|
result.push(TransformOperation::Rotate(0.0, 0.0, 1.0, Angle(0.0)));
|
||||||
}
|
}
|
||||||
&TransformOperation::Perspective(..) => {
|
TransformOperation::Perspective(..) => {
|
||||||
// http://dev.w3.org/csswg/css-transforms/#identity-transform-function
|
// http://dev.w3.org/csswg/css-transforms/#identity-transform-function
|
||||||
let identity = ComputedMatrix::identity();
|
let identity = ComputedMatrix::identity();
|
||||||
result.push(TransformOperation::Matrix(identity));
|
result.push(TransformOperation::Matrix(identity));
|
||||||
|
|
|
@ -25,16 +25,16 @@ pub enum Range<T> {
|
||||||
|
|
||||||
impl Range<specified::Length> {
|
impl Range<specified::Length> {
|
||||||
fn to_computed_range(&self, viewport_size: Size2D<Au>) -> Range<Au> {
|
fn to_computed_range(&self, viewport_size: Size2D<Au>) -> Range<Au> {
|
||||||
let compute_width = |width| {
|
let compute_width = |&width| {
|
||||||
match width {
|
match width {
|
||||||
&specified::Length::Absolute(value) => value,
|
specified::Length::Absolute(value) => value,
|
||||||
&specified::Length::FontRelative(value) => {
|
specified::Length::FontRelative(value) => {
|
||||||
// http://dev.w3.org/csswg/mediaqueries3/#units
|
// http://dev.w3.org/csswg/mediaqueries3/#units
|
||||||
// em units are relative to the initial font-size.
|
// em units are relative to the initial font-size.
|
||||||
let initial_font_size = longhands::font_size::get_initial_value();
|
let initial_font_size = longhands::font_size::get_initial_value();
|
||||||
value.to_computed_value(initial_font_size, initial_font_size)
|
value.to_computed_value(initial_font_size, initial_font_size)
|
||||||
}
|
}
|
||||||
&specified::Length::ViewportPercentage(value) =>
|
specified::Length::ViewportPercentage(value) =>
|
||||||
value.to_computed_value(viewport_size),
|
value.to_computed_value(viewport_size),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,10 @@ impl ToCss for Zoom {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||||
where W: fmt::Write
|
where W: fmt::Write
|
||||||
{
|
{
|
||||||
match self {
|
match *self {
|
||||||
&Zoom::Number(number) => write!(dest, "{}", number),
|
Zoom::Number(number) => write!(dest, "{}", number),
|
||||||
&Zoom::Percentage(percentage) => write!(dest, "{}%", percentage * 100.),
|
Zoom::Percentage(percentage) => write!(dest, "{}%", percentage * 100.),
|
||||||
&Zoom::Auto => write!(dest, "auto")
|
Zoom::Auto => write!(dest, "auto")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,10 @@ impl Zoom {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_f32(&self) -> Option<f32> {
|
pub fn to_f32(&self) -> Option<f32> {
|
||||||
match self {
|
match *self {
|
||||||
&Zoom::Number(number) => Some(number as f32),
|
Zoom::Number(number) => Some(number as f32),
|
||||||
&Zoom::Percentage(percentage) => Some(percentage as f32),
|
Zoom::Percentage(percentage) => Some(percentage as f32),
|
||||||
&Zoom::Auto => None
|
Zoom::Auto => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ pub struct ViewportRule {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ViewportRule {
|
impl ViewportRule {
|
||||||
pub fn parse<'a>(input: &mut Parser, context: &'a ParserContext)
|
pub fn parse(input: &mut Parser, context: &ParserContext)
|
||||||
-> Result<ViewportRule, ()>
|
-> Result<ViewportRule, ()>
|
||||||
{
|
{
|
||||||
let parser = ViewportRuleParser { context: context };
|
let parser = ViewportRuleParser { context: context };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue