diff --git a/components/style/animation.rs b/components/style/animation.rs index 057019950a4..70db7c2c5b7 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -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}; diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 8cd9e4bdde2..dff1aef30cc 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -1032,13 +1032,13 @@ impl TrackSize { 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); }, diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 430eb42bdc9..19d5ec8baba 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -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 diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index bf5752e6ea7..af53e3dcc7b 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -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(&mut self, element: Option) 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(); } } diff --git a/components/style/values/generics/easing.rs b/components/style/values/generics/easing.rs index f4f93a45479..c4436fb2efd 100644 --- a/components/style/values/generics/easing.rs +++ b/components/style/values/generics/easing.rs @@ -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)] diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index daedd16887e..c07bbe66f75 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -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 diff --git a/tests/unit/style/parsing/transition_timing_function.rs b/tests/unit/style/parsing/transition_timing_function.rs index c00bad94487..dab50b34275 100644 --- a/tests/unit/style/parsing/transition_timing_function.rs +++ b/tests/unit/style/parsing/transition_timing_function.rs @@ -35,19 +35,3 @@ fn test_steps() { assert!(parse(transition_timing_function::parse, "steps(-1)").is_err()); assert!(parse(transition_timing_function::parse, "steps(1, middle)").is_err()); } - -#[test] -fn test_frames() { - assert_roundtrip_with_context!(transition_timing_function::parse, "frames( 2 )", "frames(2)"); - assert_roundtrip_with_context!(transition_timing_function::parse, "frames(10000)"); - - // Frames number must be an integer greater than 1 - assert!(parse(transition_timing_function::parse, "frames(1)").is_err()); - assert!(parse(transition_timing_function::parse, "frames(-2)").is_err()); - assert!(parse(transition_timing_function::parse, "frames()").is_err()); - assert!(parse(transition_timing_function::parse, "frames(,)").is_err()); - assert!(parse(transition_timing_function::parse, "frames(a)").is_err()); - assert!(parse(transition_timing_function::parse, "frames(2.0)").is_err()); - assert!(parse(transition_timing_function::parse, "frames(2.5)").is_err()); - assert!(parse(transition_timing_function::parse, "frames(2 3)").is_err()); -} diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs index 2c5892f1e63..5c520ccc79d 100644 --- a/tests/unit/style/properties/serialization.rs +++ b/tests/unit/style/properties/serialization.rs @@ -707,86 +707,6 @@ mod shorthand_serialization { } } - mod transition { - pub use super::*; - - #[test] - fn transition_should_serialize_all_available_properties() { - let block_text = "transition-property: margin-left; \ - transition-duration: 3s; \ - transition-delay: 4s; \ - transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2);"; - - let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); - - let serialization = block.to_css_string(); - - assert_eq!(serialization, "transition: margin-left 3s cubic-bezier(0.2, 5, 0.5, 2) 4s;"); - } - - #[test] - fn serialize_multiple_transitions() { - let block_text = "transition-property: margin-left, width; \ - transition-duration: 3s, 2s; \ - transition-delay: 4s, 5s; \ - transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;"; - - let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); - - let serialization = block.to_css_string(); - - assert_eq!(serialization, "transition: \ - margin-left 3s cubic-bezier(0.2, 5, 0.5, 2) 4s, \ - width 2s ease 5s;"); - } - - #[test] - fn serialize_multiple_transitions_unequal_property_lists() { - // When the lengths of property values are different, the shorthand serialization - // should not be used. Previously the implementation cycled values if the lists were - // uneven. This is incorrect, in that we should serialize to a shorthand only when the - // lists have the same length (this affects background, transition and animation). - // https://github.com/servo/servo/issues/15398 ) - // The duration below has 1 extra value. - let block_text = "transition-property: margin-left, width; \ - transition-duration: 3s, 2s, 4s; \ - transition-delay: 4s, 5s; \ - transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;"; - - let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); - - let serialization = block.to_css_string(); - - assert_eq!(serialization, block_text); - } - - #[test] - fn transition_should_serialize_acceptable_step_timing_function() { - let block_text = "transition-property: margin-left; \ - transition-duration: 3s; \ - transition-delay: 4s; \ - transition-timing-function: steps(2, start);"; - let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); - - let serialization = block.to_css_string(); - - assert_eq!(serialization, "transition: margin-left 3s steps(2, start) 4s;"); - } - - #[test] - fn transition_should_serialize_acceptable_frames_timing_function() { - let block_text = "transition-property: margin-left; \ - transition-duration: 3s; \ - transition-delay: 4s; \ - transition-timing-function: frames(2);"; - let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); - - let serialization = block.to_css_string(); - - assert_eq!(serialization, "transition: margin-left 3s frames(2) 4s;"); - } - } - mod keywords { pub use super::*; #[test] diff --git a/tests/unit/style/stylesheets.rs b/tests/unit/style/stylesheets.rs index 0726eeab1e7..17c6e493db6 100644 --- a/tests/unit/style/stylesheets.rs +++ b/tests/unit/style/stylesheets.rs @@ -28,7 +28,7 @@ use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframePer use style::values::{KeyframesName, CustomIdent}; use style::values::computed::Percentage; use style::values::specified::{LengthOrPercentageOrAuto, PositionComponent}; -use style::values::specified::transform::TimingFunction; +use style::values::specified::TimingFunction; pub fn block_from(iterable: I) -> PropertyDeclarationBlock where I: IntoIterator {