mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Fix existing syntactics nits.
This commit is contained in:
parent
7f935f010b
commit
8bb853f643
93 changed files with 393 additions and 397 deletions
|
@ -93,7 +93,7 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin
|
|||
|
||||
/// Recalculates style for a set of animations. This does *not* run with the DOM lock held.
|
||||
pub fn recalc_style_for_animations(flow: &mut Flow,
|
||||
animations: &HashMap<OpaqueNode,Vec<Animation>>) {
|
||||
animations: &HashMap<OpaqueNode, Vec<Animation>>) {
|
||||
let mut damage = RestyleDamage::empty();
|
||||
flow.mutate_fragments(&mut |fragment| {
|
||||
if let Some(ref animations) = animations.get(&OpaqueNode(fragment.node.id())) {
|
||||
|
|
|
@ -124,7 +124,7 @@ pub struct SharedLayoutContext {
|
|||
pub visible_rects: Arc<HashMap<LayerId, Rect<Au>, DefaultState<FnvHasher>>>,
|
||||
|
||||
/// The animations that are currently running.
|
||||
pub running_animations: Arc<HashMap<OpaqueNode,Vec<Animation>>>,
|
||||
pub running_animations: Arc<HashMap<OpaqueNode, Vec<Animation>>>,
|
||||
|
||||
/// Why is this reflow occurring
|
||||
pub goal: ReflowGoal,
|
||||
|
|
|
@ -139,7 +139,7 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
|
|||
static APPLICABLE_DECLARATIONS_CACHE_SIZE: usize = 32;
|
||||
|
||||
pub struct ApplicableDeclarationsCache {
|
||||
cache: SimpleHashCache<ApplicableDeclarationsCacheEntry,Arc<ComputedValues>>,
|
||||
cache: SimpleHashCache<ApplicableDeclarationsCacheEntry, Arc<ComputedValues>>,
|
||||
}
|
||||
|
||||
impl ApplicableDeclarationsCache {
|
||||
|
|
|
@ -45,10 +45,10 @@ use std::sync::Arc;
|
|||
use std::sync::mpsc::channel;
|
||||
use std::f32;
|
||||
use style::computed_values::filter::Filter;
|
||||
use style::computed_values::{background_attachment, background_clip, background_origin,
|
||||
background_repeat, background_size};
|
||||
use style::computed_values::{border_style, image_rendering, overflow_x, position,
|
||||
visibility, transform, transform_style};
|
||||
use style::computed_values::{background_attachment, background_clip, background_origin};
|
||||
use style::computed_values::{background_repeat, background_size};
|
||||
use style::computed_values::{border_style, image_rendering, overflow_x, position};
|
||||
use style::computed_values::{visibility, transform, transform_style};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs::Border;
|
||||
use style::values::RGBA;
|
||||
|
@ -1108,7 +1108,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
},
|
||||
None => IpcSharedMemory::from_byte(0xFFu8, width * height * 4),
|
||||
};
|
||||
display_list.content.push_back(DisplayItem::ImageClass(box ImageDisplayItem{
|
||||
display_list.content.push_back(DisplayItem::ImageClass(box ImageDisplayItem {
|
||||
base: BaseDisplayItem::new(stacking_relative_content_box,
|
||||
DisplayItemMetadata::new(self.node,
|
||||
&*self.style,
|
||||
|
|
|
@ -468,10 +468,10 @@ pub trait MutableFlowUtils {
|
|||
// Traversals
|
||||
|
||||
/// Traverses the tree in preorder.
|
||||
fn traverse_preorder<T:PreorderFlowTraversal>(self, traversal: &T);
|
||||
fn traverse_preorder<T: PreorderFlowTraversal>(self, traversal: &T);
|
||||
|
||||
/// Traverses the tree in postorder.
|
||||
fn traverse_postorder<T:PostorderFlowTraversal>(self, traversal: &T);
|
||||
fn traverse_postorder<T: PostorderFlowTraversal>(self, traversal: &T);
|
||||
|
||||
/// Traverse the Absolute flow tree in preorder.
|
||||
///
|
||||
|
@ -1301,7 +1301,7 @@ impl<'a> ImmutableFlowUtils for &'a (Flow + 'a) {
|
|||
|
||||
impl<'a> MutableFlowUtils for &'a mut (Flow + 'a) {
|
||||
/// Traverses the tree in preorder.
|
||||
fn traverse_preorder<T:PreorderFlowTraversal>(self, traversal: &T) {
|
||||
fn traverse_preorder<T: PreorderFlowTraversal>(self, traversal: &T) {
|
||||
if traversal.should_process(self) {
|
||||
traversal.process(self);
|
||||
}
|
||||
|
@ -1312,7 +1312,7 @@ impl<'a> MutableFlowUtils for &'a mut (Flow + 'a) {
|
|||
}
|
||||
|
||||
/// Traverses the tree in postorder.
|
||||
fn traverse_postorder<T:PostorderFlowTraversal>(self, traversal: &T) {
|
||||
fn traverse_postorder<T: PostorderFlowTraversal>(self, traversal: &T) {
|
||||
for kid in child_iter(self) {
|
||||
kid.traverse_postorder(traversal);
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ impl OpaqueFlow {
|
|||
#[allow(unsafe_code)]
|
||||
pub fn from_flow(flow: &Flow) -> OpaqueFlow {
|
||||
unsafe {
|
||||
let object = mem::transmute::<&Flow,raw::TraitObject>(flow);
|
||||
let object = mem::transmute::<&Flow, raw::TraitObject>(flow);
|
||||
OpaqueFlow(object.data as usize)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1446,7 +1446,7 @@ impl Fragment {
|
|||
|
||||
/// A helper method that uses the breaking strategy described by `slice_iterator` (at present,
|
||||
/// either natural word breaking or character breaking) to split this fragment.
|
||||
fn calculate_split_position_using_breaking_strategy<'a,I>(
|
||||
fn calculate_split_position_using_breaking_strategy<'a, I>(
|
||||
&self,
|
||||
slice_iterator: I,
|
||||
max_inline_size: Au,
|
||||
|
|
|
@ -101,7 +101,7 @@ pub struct ResolveGeneratedContent<'a> {
|
|||
/// The counter representing an ordered list item.
|
||||
list_item: Counter,
|
||||
/// Named CSS counters.
|
||||
counters: HashMap<String,Counter>,
|
||||
counters: HashMap<String, Counter>,
|
||||
/// The level of quote nesting.
|
||||
quote: u32,
|
||||
}
|
||||
|
|
|
@ -309,11 +309,11 @@ impl LineBreaker {
|
|||
}
|
||||
|
||||
/// Reflows the given fragments, which have been plucked out of the inline flow.
|
||||
fn reflow_fragments<'a,I>(&mut self,
|
||||
mut old_fragment_iter: I,
|
||||
flow: &'a InlineFlow,
|
||||
layout_context: &LayoutContext)
|
||||
where I: Iterator<Item=Fragment> {
|
||||
fn reflow_fragments<'a, I>(&mut self,
|
||||
mut old_fragment_iter: I,
|
||||
flow: &'a InlineFlow,
|
||||
layout_context: &LayoutContext)
|
||||
where I: Iterator<Item=Fragment> {
|
||||
loop {
|
||||
// Acquire the next fragment to lay out from the work list or fragment list, as
|
||||
// appropriate.
|
||||
|
|
|
@ -139,7 +139,7 @@ pub struct LayoutTaskData {
|
|||
pub offset_parent_response: OffsetParentResponse,
|
||||
|
||||
/// The list of currently-running animations.
|
||||
pub running_animations: Arc<HashMap<OpaqueNode,Vec<Animation>>>,
|
||||
pub running_animations: Arc<HashMap<OpaqueNode, Vec<Animation>>>,
|
||||
|
||||
/// Receives newly-discovered animations.
|
||||
pub new_animations_receiver: Receiver<Animation>,
|
||||
|
@ -708,7 +708,7 @@ impl LayoutTask {
|
|||
url: Url,
|
||||
mq: MediaQueryList,
|
||||
pending: PendingAsyncLoad,
|
||||
responder: Box<StylesheetLoadResponder+Send>,
|
||||
responder: Box<StylesheetLoadResponder + Send>,
|
||||
possibly_locked_rw_data:
|
||||
&mut Option<MutexGuard<'a, LayoutTaskData>>) {
|
||||
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
|
||||
|
|
|
@ -89,14 +89,14 @@ pub type UnsafeFlowList = (Box<Vec<UnsafeLayoutNode>>, usize);
|
|||
|
||||
pub type ChunkedDomTraversalFunction =
|
||||
extern "Rust" fn(UnsafeLayoutNodeList,
|
||||
&mut WorkerProxy<SharedLayoutContext,UnsafeLayoutNodeList>);
|
||||
&mut WorkerProxy<SharedLayoutContext, UnsafeLayoutNodeList>);
|
||||
|
||||
pub type DomTraversalFunction =
|
||||
extern "Rust" fn(UnsafeLayoutNode,
|
||||
&mut WorkerProxy<SharedLayoutContext,UnsafeLayoutNodeList>);
|
||||
&mut WorkerProxy<SharedLayoutContext, UnsafeLayoutNodeList>);
|
||||
|
||||
pub type ChunkedFlowTraversalFunction =
|
||||
extern "Rust" fn(UnsafeFlowList, &mut WorkerProxy<SharedLayoutContext,UnsafeFlowList>);
|
||||
extern "Rust" fn(UnsafeFlowList, &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>);
|
||||
|
||||
pub type FlowTraversalFunction = extern "Rust" fn(UnsafeFlow, &SharedLayoutContext);
|
||||
|
||||
|
@ -104,13 +104,13 @@ pub type FlowTraversalFunction = extern "Rust" fn(UnsafeFlow, &SharedLayoutConte
|
|||
pub trait ParallelPreorderDomTraversal : PreorderDomTraversal {
|
||||
fn run_parallel(&self,
|
||||
nodes: UnsafeLayoutNodeList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeLayoutNodeList>);
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeLayoutNodeList>);
|
||||
|
||||
#[inline(always)]
|
||||
fn run_parallel_helper(
|
||||
&self,
|
||||
unsafe_nodes: UnsafeLayoutNodeList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeLayoutNodeList>,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeLayoutNodeList>,
|
||||
top_down_func: ChunkedDomTraversalFunction,
|
||||
bottom_up_func: DomTraversalFunction) {
|
||||
let mut discovered_child_nodes = Vec::new();
|
||||
|
@ -168,7 +168,7 @@ trait ParallelPostorderDomTraversal : PostorderDomTraversal {
|
|||
/// fetch-and-subtract the parent's children count.
|
||||
fn run_parallel(&self,
|
||||
mut unsafe_node: UnsafeLayoutNode,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeLayoutNodeList>) {
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeLayoutNodeList>) {
|
||||
loop {
|
||||
// Get a real layout node.
|
||||
let node: LayoutNode = unsafe {
|
||||
|
@ -284,14 +284,14 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
|
|||
trait ParallelPreorderFlowTraversal : PreorderFlowTraversal {
|
||||
fn run_parallel(&self,
|
||||
unsafe_flows: UnsafeFlowList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeFlowList>);
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>);
|
||||
|
||||
fn should_record_thread_ids(&self) -> bool;
|
||||
|
||||
#[inline(always)]
|
||||
fn run_parallel_helper(&self,
|
||||
unsafe_flows: UnsafeFlowList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeFlowList>,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>,
|
||||
top_down_func: ChunkedFlowTraversalFunction,
|
||||
bottom_up_func: FlowTraversalFunction) {
|
||||
let mut discovered_child_flows = Vec::new();
|
||||
|
@ -335,7 +335,7 @@ trait ParallelPreorderFlowTraversal : PreorderFlowTraversal {
|
|||
impl<'a> ParallelPreorderFlowTraversal for AssignISizes<'a> {
|
||||
fn run_parallel(&self,
|
||||
unsafe_flows: UnsafeFlowList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeFlowList>) {
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>) {
|
||||
self.run_parallel_helper(unsafe_flows,
|
||||
proxy,
|
||||
assign_inline_sizes,
|
||||
|
@ -397,7 +397,7 @@ fn construct_flows(unsafe_node: UnsafeLayoutNode,
|
|||
}
|
||||
|
||||
fn assign_inline_sizes(unsafe_flows: UnsafeFlowList,
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext,UnsafeFlowList>) {
|
||||
proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>) {
|
||||
let shared_layout_context = proxy.user_data();
|
||||
let layout_context = LayoutContext::new(shared_layout_context);
|
||||
let assign_inline_sizes_traversal = AssignISizes {
|
||||
|
@ -438,12 +438,12 @@ fn build_display_list(unsafe_flow: UnsafeFlow,
|
|||
build_display_list_traversal.run_parallel(unsafe_flow);
|
||||
}
|
||||
|
||||
fn run_queue_with_custom_work_data_type<To,F>(
|
||||
fn run_queue_with_custom_work_data_type<To, F>(
|
||||
queue: &mut WorkQueue<SharedLayoutContext, WorkQueueData>,
|
||||
callback: F,
|
||||
shared_layout_context: &SharedLayoutContext)
|
||||
where To: 'static + Send, F: FnOnce(&mut WorkQueue<SharedLayoutContext,To>) {
|
||||
let queue: &mut WorkQueue<SharedLayoutContext,To> = unsafe {
|
||||
where To: 'static + Send, F: FnOnce(&mut WorkQueue<SharedLayoutContext, To>) {
|
||||
let queue: &mut WorkQueue<SharedLayoutContext, To> = unsafe {
|
||||
mem::transmute(queue)
|
||||
};
|
||||
callback(queue);
|
||||
|
|
|
@ -137,7 +137,7 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut FlowRef,
|
|||
};
|
||||
|
||||
// FIXME(#2795): Get the real container size.
|
||||
doit(kid, level+1, iterator, &stacking_context_position);
|
||||
doit(kid, level + 1, iterator, &stacking_context_position);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ impl TableRowFlow {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn populate_collapsed_border_spacing<'a,I>(
|
||||
pub fn populate_collapsed_border_spacing<'a, I>(
|
||||
&mut self,
|
||||
collapsed_inline_direction_border_widths_for_table: &[Au],
|
||||
collapsed_block_direction_border_widths_for_table: &mut Peekable<I>)
|
||||
|
|
|
@ -83,7 +83,7 @@ impl TableRowGroupFlow {
|
|||
&self.block_flow.fragment
|
||||
}
|
||||
|
||||
pub fn populate_collapsed_border_spacing<'a,I>(
|
||||
pub fn populate_collapsed_border_spacing<'a, I>(
|
||||
&mut self,
|
||||
collapsed_inline_direction_border_widths_for_table: &[Au],
|
||||
collapsed_block_direction_border_widths_for_table: &mut Peekable<I>)
|
||||
|
|
|
@ -280,7 +280,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
|
||||
/// Borrows the layout data immutably. Fails on a conflicting borrow.
|
||||
#[inline(always)]
|
||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option<LayoutDataWrapper>> {
|
||||
unsafe {
|
||||
mem::transmute(self.get_jsmanaged().layout_data())
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
|
||||
/// Borrows the layout data mutably. Fails on a conflicting borrow.
|
||||
#[inline(always)]
|
||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option<LayoutDataWrapper>> {
|
||||
unsafe {
|
||||
mem::transmute(self.get_jsmanaged().layout_data_mut())
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
///
|
||||
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
||||
#[inline(always)]
|
||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
|
||||
pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option<LayoutDataWrapper>> {
|
||||
self.node.borrow_layout_data()
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
///
|
||||
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
|
||||
#[inline(always)]
|
||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
|
||||
pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option<LayoutDataWrapper>> {
|
||||
self.node.mutate_layout_data()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue