style: Fix servo build and tidy lints.

This commit is contained in:
Emilio Cobos Álvarez 2018-10-28 23:34:48 +01:00
parent a51b4e754c
commit 05f9f10a1c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 28 additions and 117 deletions

View file

@ -27,8 +27,8 @@ use std::sync::mpsc::Sender;
use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
use timer::Timer;
use values::computed::Time;
use values::computed::box_::TransitionProperty;
use values::computed::TimingFunction;
use values::computed::box_::TransitionProperty;
use values::generics::box_::AnimationIterationCount;
use values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction};

View file

@ -1032,13 +1032,13 @@ impl TrackSize<LengthOrPercentage> {
match *self {
TrackSize::FitContent(ref lop) => {
// Gecko sets min value to None and max value to the actual value in fit-content
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8209dfe4295944c0f1e0ce621/layout/style/nsRuleNode.cpp#7910
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8/layout/style/nsRuleNode.cpp#7910
gecko_min.set_value(CoordDataValue::None);
lop.to_gecko_style_coord(gecko_max);
},
TrackSize::Breadth(ref breadth) => {
// Set the value to both fields if there's one breadth value
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8209dfe4295944c0f1e0ce621/layout/style/nsRuleNode.cpp#7919
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8/layout/style/nsRuleNode.cpp#7919
breadth.to_gecko_style_coord(gecko_min);
breadth.to_gecko_style_coord(gecko_max);
},

View file

@ -2394,7 +2394,7 @@ fn static_assert() {
/// from the parent.
///
/// This is a port of Gecko's old ComputeScriptLevelSize function:
/// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8209dfe4295944c0f1e0ce621/layout/style/nsRuleNode.cpp#3103
/// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8/layout/style/nsRuleNode.cpp#3103
///
/// scriptlevel is a property that affects how font-size is inherited. If scriptlevel is
/// +1, for example, it will inherit as the script size multiplier times

View file

@ -9,10 +9,8 @@ use app_units::Au;
use dom::TElement;
use properties::{self, ComputedValues, StyleBuilder};
use properties::computed_value_flags::ComputedValueFlags;
use properties::longhands::_moz_appearance::computed_value::T as Appearance;
use properties::longhands::display::computed_value::T as Display;
use properties::longhands::float::computed_value::T as Float;
use properties::longhands::line_height::computed_value::T as LineHeight;
use properties::longhands::overflow_x::computed_value::T as Overflow;
use properties::longhands::position::computed_value::T as Position;
@ -700,22 +698,28 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// the computed value of 'line-height' is 'normal'.
///
/// https://github.com/w3c/csswg-drafts/issues/3257
#[cfg(feature = "gecko")]
fn adjust_for_appearance<E>(&mut self, element: Option<E>)
where
E: TElement,
{
if self.style.get_box().clone__moz_appearance() == Appearance::Menulist &&
self.style.get_inherited_text().clone_line_height() != LineHeight::normal() {
if self.style.pseudo.is_some() {
return;
}
let is_html_select_element =
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
if !is_html_select_element {
return;
}
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
use properties::longhands::_moz_appearance::computed_value::T as Appearance;
use properties::longhands::line_height::computed_value::T as LineHeight;
if self.style.get_box().clone__moz_appearance() == Appearance::Menulist {
if self.style.get_inherited_text().clone_line_height() == LineHeight::normal() {
return;
}
if self.style.pseudo.is_some() {
return;
}
let is_html_select_element =
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
if !is_html_select_element {
return;
}
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
}
}
/// Adjusts the style to account for various fixups that don't fit naturally
@ -779,7 +783,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
{
self.adjust_for_text_decorations_in_effect();
}
self.adjust_for_appearance(element);
#[cfg(feature = "gecko")]
{
self.adjust_for_appearance(element);
}
self.set_bits();
}
}

View file

@ -5,8 +5,8 @@
//! Generic types for CSS Easing Functions.
//! https://drafts.csswg.org/css-easing/#timing-functions
use values::CSSFloat;
use parser::ParserContext;
use values::CSSFloat;
/// A generic easing function.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]

View file

@ -753,7 +753,7 @@ impl ToComputedValue for KeywordSize {
// The tables in this function are originally from
// nsRuleNode::CalcFontPointSize in Gecko:
//
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8209dfe4295944c0f1e0ce621/layout/style/nsRuleNode.cpp#3150
// https://searchfox.org/mozilla-central/rev/c05d9d61188d32b8/layout/style/nsRuleNode.cpp#3150
//
// Mapping from base size and HTML size to pixels
// The first index is (base_size - 9), the second is the