Skip to content
Permalink
Browse files

Rustfmt recent changes.

  • Loading branch information
emilio committed Dec 15, 2019
1 parent e885ccb commit ef16c5844fbfb34366e103acf58395ae56d21a37
@@ -2548,8 +2548,16 @@ impl Flow for BlockFlow {
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().inline_start.is_auto() &&
self.fragment.style().logical_position().inline_end.is_auto()
self.fragment
.style()
.logical_position()
.inline_start
.is_auto() &&
self.fragment
.style()
.logical_position()
.inline_end
.is_auto()
{
self.base.position.start.i = inline_position
}
@@ -2560,7 +2568,11 @@ impl Flow for BlockFlow {
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().block_start.is_auto() &&
self.fragment
.style()
.logical_position()
.block_start
.is_auto() &&
self.fragment.style().logical_position().block_end.is_auto()
{
self.base.position.start.b = block_position
@@ -2848,11 +2860,8 @@ pub trait ISizeAndMarginsComputer {
parent_flow_inline_size: Au,
shared_context: &SharedStyleContext,
) -> MaybeAuto {
let inline_size = self.containing_block_inline_size(
block,
parent_flow_inline_size,
shared_context,
);
let inline_size =
self.containing_block_inline_size(block, parent_flow_inline_size, shared_context);

MaybeAuto::from_option(
block
@@ -91,7 +91,10 @@ fn convert_gradient_stops(
color,
position: None,
}),
GradientItem::ComplexColorStop { color, ref position } => Some(ColorStop {
GradientItem::ComplexColorStop {
color,
ref position,
} => Some(ColorStop {
color,
position: Some(position.clone()),
}),
@@ -125,7 +128,13 @@ fn convert_gradient_stops(
//
// FIXME(emilio): Once we know the offsets, it seems like converting the
// positions to absolute at once then process that would be cheaper.
let mut last_stop_position = stop_items.first().unwrap().position.as_ref().unwrap().clone();
let mut last_stop_position = stop_items
.first()
.unwrap()
.position
.as_ref()
.unwrap()
.clone();
for stop in stop_items.iter_mut().skip(1) {
if let Some(ref pos) = stop.position {
if position_to_offset(&last_stop_position, total_length) >
@@ -147,16 +156,19 @@ fn convert_gradient_stops(
// Initialize a new stop run.
// `unwrap()` here should never fail because this is the beginning of
// a stop run, which is always bounded by a length or percentage.
let start_offset =
position_to_offset(stop_items[i - 1].position.as_ref().unwrap(), total_length);
let start_offset = position_to_offset(
stop_items[i - 1].position.as_ref().unwrap(),
total_length,
);
// `unwrap()` here should never fail because this is the end of
// a stop run, which is always bounded by a length or percentage.
let (end_index, end_stop) = stop_items[(i + 1)..]
.iter()
.enumerate()
.find(|&(_, ref stop)| stop.position.is_some())
.unwrap();
let end_offset = position_to_offset(end_stop.position.as_ref().unwrap(), total_length);
let end_offset =
position_to_offset(end_stop.position.as_ref().unwrap(), total_length);
stop_run = Some(StopRun {
start_offset,
end_offset,
@@ -1113,12 +1113,11 @@ impl BaseFlow {
self.flags.set(
FlowFlags::INLINE_POSITION_IS_STATIC,
logical_position.inline_start.is_auto() &&
logical_position.inline_end.is_auto()
logical_position.inline_end.is_auto(),
);
self.flags.set(
FlowFlags::BLOCK_POSITION_IS_STATIC,
logical_position.block_start.is_auto() &&
logical_position.block_end.is_auto()
logical_position.block_start.is_auto() && logical_position.block_end.is_auto(),
);
}
}
@@ -2527,10 +2527,20 @@ impl Fragment {
{
continue;
}
if !inline_context_node.style.logical_margin().inline_end.is_definitely_zero() {
if !inline_context_node
.style
.logical_margin()
.inline_end
.is_definitely_zero()
{
return false;
}
if !inline_context_node.style.logical_padding().inline_end.is_definitely_zero() {
if !inline_context_node
.style
.logical_padding()
.inline_end
.is_definitely_zero()
{
return false;
}
if inline_context_node.style.logical_border_width().inline_end != Au(0) {
@@ -2549,10 +2559,20 @@ impl Fragment {
{
continue;
}
if !inline_context_node.style.logical_margin().inline_start.is_definitely_zero() {
if !inline_context_node
.style
.logical_margin()
.inline_start
.is_definitely_zero()
{
return false;
}
if !inline_context_node.style.logical_padding().inline_start.is_definitely_zero() {
if !inline_context_node
.style
.logical_padding()
.inline_start
.is_definitely_zero()
{
return false;
}
if inline_context_node
@@ -177,11 +177,15 @@ impl flow_relative::Vec2<MaxSize<LengthPercentage>> {
flow_relative::Vec2 {
inline: match self.inline {
MaxSize::None => None,
MaxSize::LengthPercentage(ref lp) => Some(lp.percentage_relative_to(containing_block.inline_size)),
MaxSize::LengthPercentage(ref lp) => {
Some(lp.percentage_relative_to(containing_block.inline_size))
},
},
block: match self.block {
MaxSize::None => None,
MaxSize::LengthPercentage(ref lp) => lp.maybe_percentage_relative_to(containing_block.block_size.non_auto()),
MaxSize::LengthPercentage(ref lp) => {
lp.maybe_percentage_relative_to(containing_block.block_size.non_auto())
},
},
}
}
@@ -180,7 +180,9 @@ impl From<stylo::Display> for Display {

fn size_to_length(size: Size) -> LengthPercentageOrAuto {
match size {
Size::LengthPercentage(length) => LengthPercentageOrAuto::LengthPercentage(length.0.clone()),
Size::LengthPercentage(length) => {
LengthPercentageOrAuto::LengthPercentage(length.0.clone())
},
Size::Auto => LengthPercentageOrAuto::Auto,
}
}
@@ -324,7 +324,7 @@ where
Component::LastOfType |
Component::OnlyOfType => {
specificity.class_like_selectors += 1;
}
},
Component::NonTSPseudoClass(ref pseudo) => {
if !pseudo.has_zero_specificity() {
specificity.class_like_selectors += 1;
@@ -867,14 +867,14 @@ pub trait TElement:
break;
}
inner_shadow = shadow;
}
},
None => {
// TODO(emilio): Should probably distinguish with
// MatchesDocumentRules::{No,Yes,IfPart} or
// something so that we could skip some work.
doc_rules_apply = true;
break;
}
},
}
}
}
@@ -7,8 +7,8 @@
#![deny(missing_docs)]

use crate::context::SharedStyleContext;
use crate::Atom;
use crate::values::computed::Length;
use crate::Atom;

/// Represents the font metrics that style needs from a font to compute the
/// value of certain CSS units like `ex`.
@@ -138,7 +138,8 @@ impl Device {

/// Set the font size of the root element (for rem)
pub fn set_root_font_size(&self, size: Au) {
self.root_font_size.store(size.0 as isize, Ordering::Relaxed)
self.root_font_size
.store(size.0 as isize, Ordering::Relaxed)
}

/// Sets the body text color for the "inherit color from body" quirk.
@@ -1000,7 +1000,8 @@ impl structs::FontSizePrefs {
GenericFontFamily::MozEmoji => unreachable!(
"Should never get here, since this doesn't (yet) appear on font family"
),
}).into()
})
.into()
}
}

@@ -2131,7 +2132,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
true
},
NonTSPseudoClass::MozNativeAnonymous |
NonTSPseudoClass::MozNativeAnonymousNoSpecificity => self.is_in_native_anonymous_subtree(),
NonTSPseudoClass::MozNativeAnonymousNoSpecificity => {
self.is_in_native_anonymous_subtree()
},
NonTSPseudoClass::MozUseShadowTreeRoot => self.is_root_of_use_element_shadow_tree(),
NonTSPseudoClass::MozTableBorderNonzero => unsafe {
bindings::Gecko_IsTableBorderNonzero(self.0)
@@ -396,9 +396,11 @@ impl<'a> SelectorVisitor for CompoundSelectorDependencyCollector<'a> {

if may_match_in_no_namespace {
if *local_name_lower == local_name!("id") {
self.flags.insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR)
self.flags
.insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR)
} else if *local_name_lower == local_name!("class") {
self.flags.insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR)
self.flags
.insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR)
}
}

@@ -204,7 +204,10 @@ where
}

if log_enabled!(::log::Level::Debug) {
debug!("Collecting changes for: {:?}, flags {:?}", element, attr_selector_flags);
debug!(
"Collecting changes for: {:?}, flags {:?}",
element, attr_selector_flags
);
if !state_changes.is_empty() {
debug!(" > state: {:?}", state_changes);
}
@@ -362,8 +365,8 @@ where
}
}

let should_examine_attribute_selector_map = self.snapshot.other_attr_changed() ||
map.flags.intersects(self.attr_selector_flags);
let should_examine_attribute_selector_map =
self.snapshot.other_attr_changed() || map.flags.intersects(self.attr_selector_flags);

if should_examine_attribute_selector_map {
self.collect_dependencies_in_map(&map.other_attribute_affecting_selectors)
@@ -916,7 +916,6 @@ impl<T> LogicalMargin<T> {
}
}


impl<T: Copy> LogicalMargin<T> {
#[inline]
pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin<T> {
@@ -348,7 +348,6 @@ where
return;
}


let inner_shadow_host = inner_shadow.host();
let outer_shadow = inner_shadow_host.containing_shadow();
let part_rules = match outer_shadow {
@@ -592,8 +592,8 @@ impl RuleTree {
last = node;
}

let rule =
self.insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev());
let rule = self
.insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev());
rule
}

@@ -11,8 +11,8 @@ use crate::media_queries::media_feature_expression::RangeOrOperator;
use crate::media_queries::MediaType;
use crate::properties::ComputedValues;
use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
use crate::values::specified::font::FONT_MEDIUM_PX;
use crate::values::KeyframesName;
use app_units::Au;
use cssparser::RGBA;
use euclid::default::Size2D as UntypedSize2D;
@@ -59,8 +59,8 @@ pub use self::rules_iterator::{AllRules, EffectiveRules};
pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
pub use self::style_rule::StyleRule;
pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet};
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
pub use self::stylesheet::{SanitizationData, SanitizationKind};
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
pub use self::supports_rule::SupportsRule;
pub use self::viewport_rule::ViewportRule;

@@ -368,9 +368,7 @@ impl SanitizationKind {
CssRule::Supports(..) |
CssRule::Import(..) => false,

CssRule::FontFace(..) |
CssRule::Namespace(..) |
CssRule::Style(..) => true,
CssRule::FontFace(..) | CssRule::Namespace(..) | CssRule::Style(..) => true,

CssRule::Keyframes(..) |
CssRule::Page(..) |
@@ -1373,11 +1373,7 @@ impl ComputedTranslate {
LengthPercentage::zero(),
Length::zero(),
),
Translate::Translate(ref tx, ref ty, ref tz) => (
tx.clone(),
ty.clone(),
tz.clone(),
),
Translate::Translate(ref tx, ref ty, ref tz) => (tx.clone(), ty.clone(), tz.clone()),
}
}
}
@@ -75,9 +75,7 @@ impl ToComputedValue for specified::Length {
///
/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
#[allow(missing_docs)]
#[derive(
Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue,
)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue)]
#[repr(C)]
pub struct LengthPercentage {
length: Length,
@@ -75,11 +75,11 @@ pub use self::resolution::Resolution;
pub use self::svg::MozContextProperties;
pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::text::TextUnderlinePosition;
pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight};
pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing};
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
pub use self::text::{TextDecorationLength, TextDecorationSkipInk};
pub use self::text::TextUnderlinePosition;
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
@@ -19,10 +19,10 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};

pub use crate::values::specified::TextAlignKeyword as TextAlign;
pub use crate::values::specified::TextUnderlinePosition;
pub use crate::values::specified::{LineBreak, OverflowWrap, WordBreak};
pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition};
pub use crate::values::specified::{TextDecorationSkipInk, TextTransform};
pub use crate::values::specified::TextUnderlinePosition;

/// A computed value for the `initial-letter` property.
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;

0 comments on commit ef16c58

Please sign in to comment.
You can’t perform that action at this time.