diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index f68ac639697..4866909899c 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -294,7 +294,9 @@ mod bindings { fn generate_structs() { let builder = Builder::get_initial_builder() .enable_cxx_namespaces() - .with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS); + .with_codegen_config( + CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS, + ); let mut fixups = vec![]; let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap()) .handle_common(&mut fixups) diff --git a/components/style/gecko/arc_types.rs b/components/style/gecko/arc_types.rs index 58d2fe5af9d..309f2395085 100644 --- a/components/style/gecko/arc_types.rs +++ b/components/style/gecko/arc_types.rs @@ -9,25 +9,25 @@ #![allow(non_snake_case, missing_docs)] use crate::gecko::url::CssUrlData; +use crate::gecko_bindings::structs::RawServoAnimationValue; use crate::gecko_bindings::structs::RawServoCounterStyleRule; +use crate::gecko_bindings::structs::RawServoCssUrlData; +use crate::gecko_bindings::structs::RawServoDeclarationBlock; +use crate::gecko_bindings::structs::RawServoFontFaceRule; use crate::gecko_bindings::structs::RawServoFontFeatureValuesRule; use crate::gecko_bindings::structs::RawServoImportRule; use crate::gecko_bindings::structs::RawServoKeyframe; use crate::gecko_bindings::structs::RawServoKeyframesRule; +use crate::gecko_bindings::structs::RawServoMediaList; use crate::gecko_bindings::structs::RawServoMediaRule; use crate::gecko_bindings::structs::RawServoMozDocumentRule; use crate::gecko_bindings::structs::RawServoNamespaceRule; use crate::gecko_bindings::structs::RawServoPageRule; -use crate::gecko_bindings::structs::RawServoSupportsRule; -use crate::gecko_bindings::structs::ServoCssRules; -use crate::gecko_bindings::structs::RawServoAnimationValue; -use crate::gecko_bindings::structs::RawServoCssUrlData; -use crate::gecko_bindings::structs::RawServoDeclarationBlock; -use crate::gecko_bindings::structs::RawServoFontFaceRule; -use crate::gecko_bindings::structs::RawServoMediaList; use crate::gecko_bindings::structs::RawServoQuotes; use crate::gecko_bindings::structs::RawServoStyleRule; use crate::gecko_bindings::structs::RawServoStyleSheetContents; +use crate::gecko_bindings::structs::RawServoSupportsRule; +use crate::gecko_bindings::structs::ServoCssRules; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong}; use crate::media_queries::MediaList; use crate::properties::animated_properties::AnimationValue; diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 4d667681938..356636fc6bb 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -1011,10 +1011,9 @@ impl<'a> From<&'a Matrix4x4Components> for Matrix3D { impl From for Matrix4x4Components { fn from(matrix: Matrix3D) -> Self { [ - matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21, - matrix.m22, matrix.m23, matrix.m24, matrix.m31, matrix.m32, - matrix.m33, matrix.m34, matrix.m41, matrix.m42, matrix.m43, - matrix.m44, + matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21, matrix.m22, matrix.m23, + matrix.m24, matrix.m31, matrix.m32, matrix.m33, matrix.m34, matrix.m41, matrix.m42, + matrix.m43, matrix.m44, ] } } diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index c49277409e0..479c12b9cde 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -33,7 +33,10 @@ impl ::selectors::parser::PseudoElement for PseudoElement { fn valid_after_slotted(&self) -> bool { matches!( *self, - PseudoElement::Before | PseudoElement::After | PseudoElement::Marker | PseudoElement::Placeholder + PseudoElement::Before | + PseudoElement::After | + PseudoElement::Marker | + PseudoElement::Placeholder ) } @@ -109,6 +112,12 @@ impl PseudoElement { *self == PseudoElement::After } + /// Whether this pseudo-element is the ::marker pseudo. + #[inline] + pub fn is_marker(&self) -> bool { + *self == PseudoElement::Marker + } + /// Whether this pseudo-element is ::first-letter. #[inline] pub fn is_first_letter(&self) -> bool { diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index dedfe7715e8..46eaa427b3a 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -53,7 +53,9 @@ use crate::gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT; use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES; use crate::gecko_bindings::structs::NODE_NEEDS_FRAME; use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag}; -use crate::gecko_bindings::structs::{Element as RawGeckoElement, nsINode as RawGeckoNode, nsXBLBinding as RawGeckoXBLBinding}; +use crate::gecko_bindings::structs::{ + nsINode as RawGeckoNode, nsXBLBinding as RawGeckoXBLBinding, Element as RawGeckoElement, +}; use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI}; use crate::global_style_data::GLOBAL_STYLE_DATA; use crate::hash::FxHashMap; @@ -321,7 +323,11 @@ impl<'ln> GeckoNode<'ln> { // `flattened_tree_parent`. if self.flattened_tree_parent_is_parent() { debug_assert_eq!( - unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).as_ref().map(GeckoNode) }, + unsafe { + bindings::Gecko_GetFlattenedTreeParentNode(self.0) + .as_ref() + .map(GeckoNode) + }, self.parent_node(), "Fast path stopped holding!" ); @@ -331,7 +337,11 @@ impl<'ln> GeckoNode<'ln> { // NOTE(emilio): If this call is too expensive, we could manually // inline more aggressively. - unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).as_ref().map(GeckoNode) } + unsafe { + bindings::Gecko_GetFlattenedTreeParentNode(self.0) + .as_ref() + .map(GeckoNode) + } } #[inline] @@ -381,7 +391,11 @@ impl<'ln> TNode for GeckoNode<'ln> { #[inline] fn prev_sibling(&self) -> Option { - unsafe { bindings::Gecko_GetPreviousSibling(self.0).as_ref().map(GeckoNode) } + unsafe { + bindings::Gecko_GetPreviousSibling(self.0) + .as_ref() + .map(GeckoNode) + } } #[inline] @@ -498,7 +512,9 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> { // however we can't express this easily with bindgen, and it would // introduce functions with two input lifetimes into bindgen, // which would be out of scope for elision. - bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)).as_ref().map(GeckoNode) + bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)) + .as_ref() + .map(GeckoNode) }, } } @@ -705,7 +721,11 @@ impl<'le> GeckoElement<'le> { // FIXME(heycam): Having trouble with bindgen on nsXULElement, // where the binding parent is stored in a member variable // rather than in slots. So just get it through FFI for now. - unsafe { bindings::Gecko_GetBindingParent(self.0).as_ref().map(GeckoElement) } + unsafe { + bindings::Gecko_GetBindingParent(self.0) + .as_ref() + .map(GeckoElement) + } } else { let binding_parent = unsafe { self.non_xul_xbl_binding_parent_raw_content().as_ref() } .map(GeckoNode::from_content) @@ -713,7 +733,11 @@ impl<'le> GeckoElement<'le> { debug_assert!( binding_parent == - unsafe { bindings::Gecko_GetBindingParent(self.0).as_ref().map(GeckoElement) } + unsafe { + bindings::Gecko_GetBindingParent(self.0) + .as_ref() + .map(GeckoElement) + } ); binding_parent } @@ -773,7 +797,11 @@ impl<'le> GeckoElement<'le> { return None; } - unsafe { bindings::Gecko_GetBeforeOrAfterPseudo(self.0, is_before).as_ref().map(GeckoElement) } + unsafe { + bindings::Gecko_GetBeforeOrAfterPseudo(self.0, is_before) + .as_ref() + .map(GeckoElement) + } } #[inline] @@ -795,11 +823,7 @@ impl<'le> GeckoElement<'le> { /// animation. /// /// Also this function schedules style flush. - pub unsafe fn note_explicit_hints( - &self, - restyle_hint: RestyleHint, - change_hint: nsChangeHint, - ) { + pub unsafe fn note_explicit_hints(&self, restyle_hint: RestyleHint, change_hint: nsChangeHint) { use crate::gecko::restyle_damage::GeckoRestyleDamage; let damage = GeckoRestyleDamage::new(change_hint); @@ -1042,13 +1066,10 @@ impl FontMetricsProvider for GeckoFontMetricsProvider { let style = context.style(); let (wm, font) = match base_size { - FontBaseSize::CurrentStyle => { - (style.writing_mode, style.get_font()) - }, + FontBaseSize::CurrentStyle => (style.writing_mode, style.get_font()), // These are only used for font-size computation, and the first is // really dubious... - FontBaseSize::InheritedStyleButStripEmUnits | - FontBaseSize::InheritedStyle => { + FontBaseSize::InheritedStyleButStripEmUnits | FontBaseSize::InheritedStyle => { (*style.inherited_writing_mode(), style.get_parent_font()) }, }; @@ -1142,7 +1163,11 @@ impl<'le> TElement for GeckoElement<'le> { return None; } - unsafe { bindings::Gecko_GetMarkerPseudo(self.0).as_ref().map(GeckoElement) } + unsafe { + bindings::Gecko_GetMarkerPseudo(self.0) + .as_ref() + .map(GeckoElement) + } } #[inline] @@ -1555,10 +1580,12 @@ impl<'le> TElement for GeckoElement<'le> { // should destroy all CSS animations in display:none subtree. let computed_data = self.borrow_data(); let computed_values = computed_data.as_ref().map(|d| d.styles.primary()); - let before_change_values = - before_change_style.as_ref().map_or(ptr::null(), |x| x.as_gecko_computed_style()); - let computed_values_opt = - computed_values.as_ref().map_or(ptr::null(), |x| x.as_gecko_computed_style()); + let before_change_values = before_change_style + .as_ref() + .map_or(ptr::null(), |x| x.as_gecko_computed_style()); + let computed_values_opt = computed_values + .as_ref() + .map_or(ptr::null(), |x| x.as_gecko_computed_style()); unsafe { Gecko_UpdateAnimations( self.0, @@ -1834,7 +1861,8 @@ impl<'le> TElement for GeckoElement<'le> { hints.push(SVG_TEXT_DISABLE_ZOOM_RULE.clone()); } } - let declarations = unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0).as_ref() }; + let declarations = + unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0).as_ref() }; let declarations: Option<&RawOffsetArc>> = declarations.and_then(|s| s.as_arc_opt()); if let Some(decl) = declarations { @@ -1884,7 +1912,8 @@ impl<'le> TElement for GeckoElement<'le> { .state() .intersects(NonTSPseudoClass::Active.state_flag()); if active { - let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0).as_ref() }; + let declarations = + unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0).as_ref() }; let declarations: Option<&RawOffsetArc>> = declarations.and_then(|s| s.as_arc_opt()); if let Some(decl) = declarations { diff --git a/components/style/global_style_data.rs b/components/style/global_style_data.rs index 8f852dccb45..90936ff7172 100644 --- a/components/style/global_style_data.rs +++ b/components/style/global_style_data.rs @@ -11,7 +11,6 @@ use crate::parallel::STYLE_THREAD_STACK_SIZE_KB; use crate::shared_lock::SharedRwLock; use crate::thread_state; use rayon; -use servo_config::pref; use std::env; /// Global style data @@ -67,6 +66,7 @@ lazy_static! { Ok(num) => num, #[cfg(feature = "servo")] _ => { + use servo_config::pref; // We always set this pref on startup, before layout or script // have had a chance of accessing (and thus creating) the // thread-pool. diff --git a/components/style/properties/longhands/counters.mako.rs b/components/style/properties/longhands/counters.mako.rs index 715aba1066e..f8971315603 100644 --- a/components/style/properties/longhands/counters.mako.rs +++ b/components/style/properties/longhands/counters.mako.rs @@ -41,4 +41,5 @@ ${helpers.predefined_type( animation_value_type="discrete", spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-set", servo_restyle_damage="rebuild_and_reflow", + products="gecko", )} diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index f57e27eff1e..c9bc2bd8e2f 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2759,7 +2759,7 @@ pub struct ComputedValuesInner { pub writing_mode: WritingMode, /// A set of flags we use to store misc information regarding this style. - flags: ComputedValueFlags, + pub flags: ComputedValueFlags, /// The rule node representing the ordered list of rules matched for this /// node. Can be None for default values and text nodes. This is @@ -3719,8 +3719,8 @@ mod lazy_static_module { use super::{ComputedValues, ComputedValuesInner, longhands, style_structs}; use super::computed_value_flags::ComputedValueFlags; - /// The initial values for all style structs as defined by the specification. lazy_static! { + /// The initial values for all style structs as defined by the specification. pub static ref INITIAL_SERVO_VALUES: ComputedValues = ComputedValues { inner: ComputedValuesInner { % for style_struct in data.active_style_structs(): @@ -3744,7 +3744,7 @@ mod lazy_static_module { writing_mode: WritingMode::empty(), rules: None, visited_style: None, - flags: Cell::new(ComputedValueFlags::empty()), + flags: ComputedValueFlags::empty(), } }; } diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index 9abfe976919..229f7dccdd2 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -142,6 +142,12 @@ impl PseudoElement { false } + /// Whether this pseudo-element is the ::marker pseudo. + #[inline] + pub fn is_marker(&self) -> bool { + false + } + /// Whether this pseudo-element is the ::before pseudo. #[inline] pub fn is_before(&self) -> bool { diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index 54b7dfc8a5b..070a2299969 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -180,7 +180,6 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { where E: TElement, { - use crate::selector_parser::PseudoElement; use crate::computed_values::list_style_position::T as ListStylePosition; let mut blockify = false; @@ -205,8 +204,11 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { blockify_if!(self.style.floated()); blockify_if!(self.style.out_of_flow_positioned()); - blockify_if!(self.style.pseudo == Some(&PseudoElement::Marker) && - self.style.get_parent_list().clone_list_style_position() == ListStylePosition::Outside); + blockify_if!( + self.style.pseudo.map_or(false, |p| p.is_marker()) && + self.style.get_parent_list().clone_list_style_position() == + ListStylePosition::Outside + ); if !blockify { return; @@ -232,11 +234,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { .clone_text_decoration_line() .is_empty() { - self.style.add_flags(ComputedValueFlags::HAS_TEXT_DECORATION_LINES); + self.style + .add_flags(ComputedValueFlags::HAS_TEXT_DECORATION_LINES); } if self.style.is_pseudo_element() { - self.style.add_flags(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE); + self.style + .add_flags(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE); } #[cfg(feature = "servo")] @@ -302,7 +306,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { .get_parent_flags() .contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK) { - self.style.add_flags(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK); + self.style + .add_flags(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK); } } @@ -588,7 +593,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { let self_display = self.style.get_box().clone_display(); // Check whether line break should be suppressed for this element. if self.should_suppress_linebreak(layout_parent_style) { - self.style.add_flags(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK); + self.style + .add_flags(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK); // Inlinify the display type if allowed. if !self.skip_item_display_fixup(element) { let inline_display = self_display.inlinify(); @@ -646,10 +652,12 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { } if element.unwrap().is_visited_link() { - self.style.add_flags(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); + self.style + .add_flags(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); } else { // Need to remove to handle unvisited link inside visited. - self.style.remove_flags(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); + self.style + .remove_flags(ComputedValueFlags::IS_RELEVANT_LINK_VISITED); } } @@ -725,9 +733,9 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { E: TElement, { use crate::properties::longhands::counter_increment::computed_value::T as ComputedIncrement; - use crate::values::CustomIdent; - use crate::values::generics::counters::{CounterPair}; + use crate::values::generics::counters::CounterPair; use crate::values::specified::list::MozListReversed; + use crate::values::CustomIdent; if self.style.get_box().clone_display() != Display::ListItem { return; @@ -752,8 +760,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { name: CustomIdent(atom!("list-item")), value: increment, }; - let increments = increments.iter().cloned().chain(std::iter::once(list_increment)); - self.style.mutate_counters().set_counter_increment(ComputedIncrement::new(increments.collect())); + let increments = increments + .iter() + .cloned() + .chain(std::iter::once(list_increment)); + self.style + .mutate_counters() + .set_counter_increment(ComputedIncrement::new(increments.collect())); } /// Adjusts the style to account for various fixups that don't fit naturally diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 3d7b29f19bf..02be35261db 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -27,7 +27,6 @@ use cssparser::CowRcStr; use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use euclid::TypedSize2D; use selectors::parser::SelectorParseErrorKind; -use servo_config::pref; use std::borrow::Cow; use std::cell::RefCell; use std::fmt::{self, Write}; @@ -39,6 +38,7 @@ use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, /// Whether parsing and processing of `@viewport` rules is enabled. #[cfg(feature = "servo")] pub fn enabled() -> bool { + use servo_config::pref; pref!(layout.viewport.enabled) } diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index 6bbcf23bc14..c78eb9df2e3 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -190,9 +190,7 @@ impl FontFamily { /// Get default font family as `serif` which is a generic font-family pub fn serif() -> Self { FontFamily { - families: FontFamilyList::new(Box::new([SingleFontFamily::Generic( - atom!("serif"), - )])), + families: FontFamilyList::new(Box::new([SingleFontFamily::Generic(atom!("serif"))])), is_system_font: false, } } @@ -204,7 +202,9 @@ impl MallocSizeOf for FontFamily { // SharedFontList objects are generally shared from the pointer // stored in the specified value. So only count this if the // SharedFontList is unshared. - unsafe { bindings::Gecko_SharedFontList_SizeOfIncludingThisIfUnshared(self.families.0.get()) } + unsafe { + bindings::Gecko_SharedFontList_SizeOfIncludingThisIfUnshared(self.families.0.get()) + } } } diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index a1f68bf1a1b..db56a16a82d 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -19,8 +19,8 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; pub use crate::values::specified::TextAlignKeyword as TextAlign; -pub use crate::values::specified::{TextEmphasisPosition, TextDecorationLine}; pub use crate::values::specified::{OverflowWrap, WordBreak}; +pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition}; /// A computed value for the `initial-letter` property. pub type InitialLetter = GenericInitialLetter; diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 750378682bb..631de5c87ec 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -135,7 +135,9 @@ impl FontRelativeLength { base_size: FontBaseSize, orientation: FontMetricsOrientation, ) -> FontMetrics { - context.font_metrics_provider.query(context, base_size, orientation) + context + .font_metrics_provider + .query(context, base_size, orientation) } let reference_font_size = base_size.resolve(context); @@ -160,13 +162,12 @@ impl FontRelativeLength { if context.for_non_inherited_property.is_some() { context.rule_cache_conditions.borrow_mut().set_uncacheable(); } - context.builder.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS); + context + .builder + .add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS); // The x-height is an intrinsically horizontal metric. - let metrics = query_font_metrics( - context, - base_size, - FontMetricsOrientation::Horizontal - ); + let metrics = + query_font_metrics(context, base_size, FontMetricsOrientation::Horizontal); let reference_size = metrics.x_height.unwrap_or_else(|| { // https://drafts.csswg.org/css-values/#ex // @@ -182,7 +183,9 @@ impl FontRelativeLength { if context.for_non_inherited_property.is_some() { context.rule_cache_conditions.borrow_mut().set_uncacheable(); } - context.builder.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS); + context + .builder + .add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS); // https://drafts.csswg.org/css-values/#ch: // // Equal to the used advance measure of the “0” (ZERO, @@ -190,11 +193,8 @@ impl FontRelativeLength { // measure of a glyph is its advance width or height, // whichever is in the inline axis of the element.) // - let metrics = query_font_metrics( - context, - base_size, - FontMetricsOrientation::MatchContext, - ); + let metrics = + query_font_metrics(context, base_size, FontMetricsOrientation::MatchContext); let reference_size = metrics.zero_advance_measure.unwrap_or_else(|| { // https://drafts.csswg.org/css-values/#ch // diff --git a/components/style/values/specified/list.rs b/components/style/values/specified/list.rs index d75455a1c71..dffce9a3001 100644 --- a/components/style/values/specified/list.rs +++ b/components/style/values/specified/list.rs @@ -125,7 +125,19 @@ impl Parse for Quotes { } /// Specified and computed `-moz-list-reversed` property (for UA sheets only). -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Clone, + Copy, + Debug, + Eq, + Hash, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] #[repr(u8)] pub enum MozListReversed { /// the initial value diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index ab4e45fd1ee..33bda52aa9d 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -282,7 +282,6 @@ bitflags! { } } - impl Parse for TextDecorationLine { /// none | [ underline || overline || line-through || blink ] fn parse<'i, 't>( @@ -318,7 +317,7 @@ impl Parse for TextDecorationLine { } if result.contains(flag) { - return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)) + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } result.insert(flag) @@ -341,6 +340,13 @@ impl ToCss for TextDecorationLine { return dest.write_str("none"); } + #[cfg(feature = "gecko")] + { + if *self == TextDecorationLine::COLOR_OVERRIDE { + return Ok(()); + } + } + let mut writer = SequenceWriter::new(dest, " "); let mut any = false; @@ -358,7 +364,7 @@ impl ToCss for TextDecorationLine { maybe_write!(LINE_THROUGH => "line-through"); maybe_write!(BLINK => "blink"); - debug_assert!(any || *self == TextDecorationLine::COLOR_OVERRIDE); + debug_assert!(any); Ok(()) }