mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Run rustfmt on servo/components/style and servo/ports/geckolib
This patch is generated by running `cargo +nightly fmt` under `servo/components/style/` and `servo/ports/geckolib` against mozilla-central https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512 My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17) Manually remove the redundant braces in author_styles.rs to fix a warning. Differential Revision: https://phabricator.services.mozilla.com/D131556
This commit is contained in:
parent
33ad82c3da
commit
a0617bff0d
50 changed files with 486 additions and 340 deletions
|
@ -10,8 +10,8 @@ use crate::media_queries::MediaList;
|
|||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::{CssRule, StylesheetInDocument};
|
||||
use crate::stylesheets::layer_rule::LayerName;
|
||||
use crate::stylesheets::{CssRule, StylesheetInDocument};
|
||||
use crate::values::CssUrl;
|
||||
use cssparser::SourceLocation;
|
||||
use std::fmt::{self, Write};
|
||||
|
@ -131,7 +131,6 @@ pub struct ImportLayer {
|
|||
pub name: Option<LayerName>,
|
||||
}
|
||||
|
||||
|
||||
impl ToCss for ImportLayer {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
use crate::media_queries::MediaList;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::shared_lock::{Locked, SharedRwLock};
|
||||
use crate::stylesheets::import_rule::{ImportRule, ImportLayer};
|
||||
use crate::stylesheets::import_rule::{ImportLayer, ImportRule};
|
||||
use crate::values::CssUrl;
|
||||
use cssparser::SourceLocation;
|
||||
use servo_arc::Arc;
|
||||
|
|
|
@ -509,11 +509,11 @@ impl DeepCloneWithLock for CssRule {
|
|||
CssRule::Layer(Arc::new(
|
||||
lock.wrap(rule.deep_clone_with_lock(lock, guard, params)),
|
||||
))
|
||||
}
|
||||
},
|
||||
CssRule::ScrollTimeline(ref arc) => {
|
||||
let rule = arc.read_with(guard);
|
||||
CssRule::ScrollTimeline(Arc::new(lock.wrap(rule.clone())))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
&mut self,
|
||||
prelude: AtRulePrelude,
|
||||
start: &ParserState,
|
||||
) -> Result<Self::AtRule, ()> {
|
||||
) -> Result<Self::AtRule, ()> {
|
||||
let rule = match prelude {
|
||||
AtRulePrelude::Import(url, media, layer) => {
|
||||
let loader = self
|
||||
|
@ -613,15 +613,13 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
|
|||
0 | 1 => names.into_iter().next(),
|
||||
_ => return Err(input.new_error(BasicParseErrorKind::AtRuleBodyInvalid)),
|
||||
};
|
||||
Ok(CssRule::Layer(Arc::new(self.shared_lock.wrap(
|
||||
LayerRule {
|
||||
kind: LayerRuleKind::Block {
|
||||
name,
|
||||
rules: self.parse_nested_rules(input, CssRuleType::Layer),
|
||||
},
|
||||
source_location: start.source_location(),
|
||||
Ok(CssRule::Layer(Arc::new(self.shared_lock.wrap(LayerRule {
|
||||
kind: LayerRuleKind::Block {
|
||||
name,
|
||||
rules: self.parse_nested_rules(input, CssRuleType::Layer),
|
||||
},
|
||||
))))
|
||||
source_location: start.source_location(),
|
||||
}))))
|
||||
},
|
||||
AtRulePrelude::Import(..) | AtRulePrelude::Namespace(..) => {
|
||||
// These rules don't have blocks.
|
||||
|
@ -650,7 +648,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
|
|||
&mut self,
|
||||
prelude: AtRulePrelude,
|
||||
start: &ParserState,
|
||||
) -> Result<Self::AtRule, ()> {
|
||||
) -> Result<Self::AtRule, ()> {
|
||||
Ok(match prelude {
|
||||
AtRulePrelude::Layer(names) => {
|
||||
if names.is_empty() {
|
||||
|
@ -687,7 +685,10 @@ fn check_for_useless_selector(
|
|||
}
|
||||
if found_host && found_non_host {
|
||||
let location = input.current_source_location();
|
||||
context.log_css_error(location, ContextualParseError::NeverMatchingHostSelector(selector.to_css_string()));
|
||||
context.log_css_error(
|
||||
location,
|
||||
ContextualParseError::NeverMatchingHostSelector(selector.to_css_string()),
|
||||
);
|
||||
continue 'selector_loop;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ where
|
|||
LayerRuleKind::Block { ref rules, .. } => Some(rules.read_with(guard).0.iter()),
|
||||
LayerRuleKind::Statement { .. } => None,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,8 @@ impl<'a, 'b> EffectiveRulesIterator<'a, 'b> {
|
|||
guard: &'a SharedRwLockReadGuard<'b>,
|
||||
rule: &'a CssRule,
|
||||
) -> Self {
|
||||
let children = RulesIterator::<AllRules>::children(rule, device, quirks_mode, guard, &mut false);
|
||||
let children =
|
||||
RulesIterator::<AllRules>::children(rule, device, quirks_mode, guard, &mut false);
|
||||
EffectiveRulesIterator::new(device, quirks_mode, guard, children.unwrap_or([].iter()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -591,9 +591,11 @@ impl Clone for Stylesheet {
|
|||
// Make a deep clone of the media, using the new lock.
|
||||
let media = self.media.read_with(&guard).clone();
|
||||
let media = Arc::new(lock.wrap(media));
|
||||
let contents = Arc::new(self
|
||||
.contents
|
||||
.deep_clone_with_lock(&lock, &guard, &DeepCloneParams));
|
||||
let contents = Arc::new(self.contents.deep_clone_with_lock(
|
||||
&lock,
|
||||
&guard,
|
||||
&DeepCloneParams,
|
||||
));
|
||||
|
||||
Stylesheet {
|
||||
contents,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue