style: Indent properly a couple more functions.

This commit is contained in:
Emilio Cobos Álvarez 2018-02-24 23:23:16 +01:00
parent a6c6ef91e0
commit 13f61a6e5f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 46 additions and 31 deletions

View file

@ -47,14 +47,19 @@ impl<'a> RecalcStyleAndConstructFlows<'a> {
#[allow(unsafe_code)] #[allow(unsafe_code)]
impl<'a, E> DomTraversal<E> for RecalcStyleAndConstructFlows<'a> impl<'a, E> DomTraversal<E> for RecalcStyleAndConstructFlows<'a>
where E: TElement, where
E: TElement,
E::ConcreteNode: LayoutNode, E::ConcreteNode: LayoutNode,
E::FontMetricsProvider: Send, E::FontMetricsProvider: Send,
{ {
fn process_preorder<F>(&self, traversal_data: &PerLevelTraversalData, fn process_preorder<F>(
&self,
traversal_data: &PerLevelTraversalData,
context: &mut StyleContext<E>, node: E::ConcreteNode, context: &mut StyleContext<E>, node: E::ConcreteNode,
note_child: F) note_child: F,
where F: FnMut(E::ConcreteNode) )
where
F: FnMut(E::ConcreteNode)
{ {
// FIXME(pcwalton): Stop allocating here. Ideally this should just be // FIXME(pcwalton): Stop allocating here. Ideally this should just be
// done by the HTML parser. // done by the HTML parser.

View file

@ -384,7 +384,8 @@ impl fmt::Display for TraversalStatistics {
impl TraversalStatistics { impl TraversalStatistics {
/// Computes the traversal time given the start time in seconds. /// Computes the traversal time given the start time in seconds.
pub fn finish<E, D>(&mut self, traversal: &D, parallel: bool, start: f64) pub fn finish<E, D>(&mut self, traversal: &D, parallel: bool, start: f64)
where E: TElement, where
E: TElement,
D: DomTraversal<E>, D: DomTraversal<E>,
{ {
let threshold = traversal.shared_context().options.style_statistics_threshold; let threshold = traversal.shared_context().options.style_statistics_threshold;

View file

@ -135,7 +135,8 @@ where
} }
impl<'a, E> fmt::Debug for ElementWrapper<'a, E> impl<'a, E> fmt::Debug for ElementWrapper<'a, E>
where E: TElement, where
E: TElement,
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Ignore other fields for now, can change later if needed. // Ignore other fields for now, can change later if needed.
@ -144,7 +145,8 @@ impl<'a, E> fmt::Debug for ElementWrapper<'a, E>
} }
impl<'a, E> Element for ElementWrapper<'a, E> impl<'a, E> Element for ElementWrapper<'a, E>
where E: TElement, where
E: TElement,
{ {
type Impl = SelectorImpl; type Impl = SelectorImpl;

View file

@ -77,9 +77,11 @@ type WorkUnit<N> = ArrayVec<[SendNode<N>; WORK_UNIT_MAX]>;
#[inline(never)] #[inline(never)]
fn create_thread_local_context<'scope, E, D>( fn create_thread_local_context<'scope, E, D>(
traversal: &'scope D, traversal: &'scope D,
slot: &mut Option<ThreadLocalStyleContext<E>>) slot: &mut Option<ThreadLocalStyleContext<E>>,
where E: TElement + 'scope, )
D: DomTraversal<E> where
E: TElement + 'scope,
D: DomTraversal<E>,
{ {
*slot = Some(ThreadLocalStyleContext::new(traversal.shared_context())); *slot = Some(ThreadLocalStyleContext::new(traversal.shared_context()));
} }
@ -99,14 +101,17 @@ fn create_thread_local_context<'scope, E, D>(
/// a thread-local cache to share styles between siblings. /// a thread-local cache to share styles between siblings.
#[inline(always)] #[inline(always)]
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn top_down_dom<'a, 'scope, E, D>(nodes: &'a [SendNode<E::ConcreteNode>], fn top_down_dom<'a, 'scope, E, D>(
nodes: &'a [SendNode<E::ConcreteNode>],
root: OpaqueNode, root: OpaqueNode,
mut traversal_data: PerLevelTraversalData, mut traversal_data: PerLevelTraversalData,
scope: &'a rayon::Scope<'scope>, scope: &'a rayon::Scope<'scope>,
pool: &'scope rayon::ThreadPool, pool: &'scope rayon::ThreadPool,
traversal: &'scope D, traversal: &'scope D,
tls: &'scope ScopedTLS<'scope, ThreadLocalStyleContext<E>>) tls: &'scope ScopedTLS<'scope, ThreadLocalStyleContext<E>>,
where E: TElement + 'scope, )
where
E: TElement + 'scope,
D: DomTraversal<E>, D: DomTraversal<E>,
{ {
debug_assert!(nodes.len() <= WORK_UNIT_MAX); debug_assert!(nodes.len() <= WORK_UNIT_MAX);

View file

@ -1096,14 +1096,16 @@ impl StrongRuleNode {
/// Returns true if any properties specified by `rule_type_mask` was set by /// Returns true if any properties specified by `rule_type_mask` was set by
/// an author rule. /// an author rule.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub fn has_author_specified_rules<E>(&self, pub fn has_author_specified_rules<E>(
&self,
mut element: E, mut element: E,
mut pseudo: Option<PseudoElement>, mut pseudo: Option<PseudoElement>,
guards: &StylesheetGuards, guards: &StylesheetGuards,
rule_type_mask: u32, rule_type_mask: u32,
author_colors_allowed: bool) author_colors_allowed: bool,
-> bool ) -> bool
where E: ::dom::TElement where
E: ::dom::TElement
{ {
use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BACKGROUND; use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BACKGROUND;
use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BORDER; use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BORDER;