Run rustfmt on selectors, servo_arc, and style.

This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
Bobby Holley 2018-04-10 17:35:15 -07:00
parent f7ae1a37e3
commit c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions

View file

@ -92,12 +92,10 @@ impl<'a, 'b: 'a, E: TElement> StateAndAttrInvalidationProcessor<'a, 'b, E> {
}
}
/// Whether we should process the descendants of a given element for style
/// invalidation.
pub fn should_process_descendants(data: &ElementData) -> bool {
!data.styles.is_display_none() &&
!data.hint.contains(RestyleHint::RESTYLE_DESCENDANTS)
!data.styles.is_display_none() && !data.hint.contains(RestyleHint::RESTYLE_DESCENDANTS)
}
/// Propagates the bits after invalidating a descendant child.
@ -136,14 +134,17 @@ where
}
}
impl<'a, 'b: 'a, E: 'a> InvalidationProcessor<'a, E> for StateAndAttrInvalidationProcessor<'a, 'b, E>
impl<'a, 'b: 'a, E: 'a> InvalidationProcessor<'a, E>
for StateAndAttrInvalidationProcessor<'a, 'b, E>
where
E: TElement,
{
/// We need to invalidate style on an eager pseudo-element, in order to
/// process changes that could otherwise end up in ::before or ::after
/// content being generated.
fn invalidates_on_eager_pseudo_element(&self) -> bool { true }
fn invalidates_on_eager_pseudo_element(&self) -> bool {
true
}
fn matching_context(&mut self) -> &mut MatchingContext<'a, E::Impl> {
&mut self.matching_context
@ -158,8 +159,7 @@ where
) -> bool {
debug_assert!(element.has_snapshot(), "Why bothering?");
let wrapper =
ElementWrapper::new(element, &*self.shared_context.snapshot_map);
let wrapper = ElementWrapper::new(element, &*self.shared_context.snapshot_map);
let state_changes = wrapper.state_changes();
let snapshot = wrapper.snapshot().expect("has_snapshot lied");
@ -223,12 +223,11 @@ where
classes_removed
);
let lookup_element =
if element.implemented_pseudo_element().is_some() {
element.pseudo_element_originating_element().unwrap()
} else {
element
};
let lookup_element = if element.implemented_pseudo_element().is_some() {
element.pseudo_element_originating_element().unwrap()
} else {
element
};
let invalidated_self = {
let mut collector = Collector {
@ -255,7 +254,8 @@ where
for (cascade_data, origin) in self.shared_context.stylist.iter_origins() {
if document_origins.contains(origin.into()) {
collector.collect_dependencies_in_invalidation_map(cascade_data.invalidation_map());
collector
.collect_dependencies_in_invalidation_map(cascade_data.invalidation_map());
}
}
@ -294,7 +294,7 @@ where
fn should_process_descendants(&mut self, element: E) -> bool {
if element == self.element {
return should_process_descendants(&self.data)
return should_process_descendants(&self.data);
}
match element.borrow_data() {
@ -329,10 +329,7 @@ where
E: TElement,
'selectors: 'a,
{
fn collect_dependencies_in_invalidation_map(
&mut self,
map: &'selectors InvalidationMap,
) {
fn collect_dependencies_in_invalidation_map(&mut self, map: &'selectors InvalidationMap) {
let quirks_mode = self.matching_context.quirks_mode();
let removed_id = self.removed_id;
if let Some(ref id) = removed_id {
@ -360,30 +357,21 @@ where
}
}
let should_examine_attribute_selector_map =
self.snapshot.other_attr_changed() ||
let should_examine_attribute_selector_map = self.snapshot.other_attr_changed() ||
(self.snapshot.class_changed() && map.has_class_attribute_selectors) ||
(self.snapshot.id_changed() && map.has_id_attribute_selectors);
if should_examine_attribute_selector_map {
self.collect_dependencies_in_map(
&map.other_attribute_affecting_selectors
)
self.collect_dependencies_in_map(&map.other_attribute_affecting_selectors)
}
let state_changes = self.state_changes;
if !state_changes.is_empty() {
self.collect_state_dependencies(
&map.state_affecting_selectors,
state_changes,
)
self.collect_state_dependencies(&map.state_affecting_selectors, state_changes)
}
}
fn collect_dependencies_in_map(
&mut self,
map: &'selectors SelectorMap<Dependency>,
) {
fn collect_dependencies_in_map(&mut self, map: &'selectors SelectorMap<Dependency>) {
map.lookup_with_additional(
self.lookup_element,
self.matching_context.quirks_mode(),
@ -410,12 +398,14 @@ where
if !dependency.state.intersects(state_changes) {
return true;
}
let visited_dependent =
if dependency.state.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE) {
VisitedDependent::Yes
} else {
VisitedDependent::No
};
let visited_dependent = if dependency
.state
.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE)
{
VisitedDependent::Yes
} else {
VisitedDependent::No
};
self.scan_dependency(&dependency.dep, visited_dependent);
true
},
@ -431,27 +421,28 @@ where
) -> bool {
let element = &self.element;
let wrapper = &self.wrapper;
self.matching_context.with_visited_handling_mode(visited_handling_mode, |mut context| {
let matches_now = matches_selector(
&dependency.selector,
dependency.selector_offset,
None,
element,
&mut context,
&mut |_, _| {},
);
self.matching_context
.with_visited_handling_mode(visited_handling_mode, |mut context| {
let matches_now = matches_selector(
&dependency.selector,
dependency.selector_offset,
None,
element,
&mut context,
&mut |_, _| {},
);
let matched_then = matches_selector(
&dependency.selector,
dependency.selector_offset,
None,
wrapper,
&mut context,
&mut |_, _| {},
);
let matched_then = matches_selector(
&dependency.selector,
dependency.selector_offset,
None,
wrapper,
&mut context,
&mut |_, _| {},
);
matched_then != matches_now
})
matched_then != matches_now
})
}
fn scan_dependency(
@ -459,20 +450,17 @@ where
dependency: &'selectors Dependency,
is_visited_dependent: VisitedDependent,
) {
debug!("TreeStyleInvalidator::scan_dependency({:?}, {:?}, {:?})",
self.element,
dependency,
is_visited_dependent,
debug!(
"TreeStyleInvalidator::scan_dependency({:?}, {:?}, {:?})",
self.element, dependency, is_visited_dependent,
);
if !self.dependency_may_be_relevant(dependency) {
return;
}
let should_account_for_dependency = self.check_dependency(
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
dependency,
);
let should_account_for_dependency =
self.check_dependency(VisitedHandlingMode::AllLinksVisitedAndUnvisited, dependency);
if should_account_for_dependency {
return self.note_dependency(dependency);
@ -494,13 +482,9 @@ where
//
// NOTE: This thing is actually untested because testing it is flaky,
// see the tests that were added and then backed out in bug 1328509.
if is_visited_dependent == VisitedDependent::Yes &&
self.element.is_link()
{
let should_account_for_dependency = self.check_dependency(
VisitedHandlingMode::RelevantLinkVisited,
dependency,
);
if is_visited_dependent == VisitedDependent::Yes && self.element.is_link() {
let should_account_for_dependency =
self.check_dependency(VisitedHandlingMode::RelevantLinkVisited, dependency);
if should_account_for_dependency {
return self.note_dependency(dependency);
@ -518,10 +502,7 @@ where
}
debug_assert_ne!(dependency.selector_offset, 0);
debug_assert_ne!(
dependency.selector_offset,
dependency.selector.len()
);
debug_assert_ne!(dependency.selector_offset, dependency.selector.len());
let invalidation = Invalidation::new(
&dependency.selector,
@ -532,17 +513,23 @@ where
DependencyInvalidationKind::Element => unreachable!(),
DependencyInvalidationKind::ElementAndDescendants => {
self.invalidates_self = true;
self.descendant_invalidations.dom_descendants.push(invalidation);
}
self.descendant_invalidations
.dom_descendants
.push(invalidation);
},
DependencyInvalidationKind::Descendants => {
self.descendant_invalidations.dom_descendants.push(invalidation);
}
self.descendant_invalidations
.dom_descendants
.push(invalidation);
},
DependencyInvalidationKind::Siblings => {
self.sibling_invalidations.push(invalidation);
}
},
DependencyInvalidationKind::SlottedElements => {
self.descendant_invalidations.slotted_descendants.push(invalidation);
}
self.descendant_invalidations
.slotted_descendants
.push(invalidation);
},
}
}