From 757e2cf4e54e4a4ac1668066d6c280ae577851ab Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 15 Sep 2015 16:34:17 -0700 Subject: [PATCH] layout: Reformat some long lines and fix some whitespace issues. --- components/gfx/text/glyph.rs | 11 +++-- components/layout/context.rs | 6 +-- components/layout/display_list_builder.rs | 2 + components/layout/layout_task.rs | 58 +++++++++++++++-------- 4 files changed, 52 insertions(+), 25 deletions(-) diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index f5999f614f7..9ce46b79045 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -529,7 +529,10 @@ impl<'a> GlyphStore { } // used when a character index has no associated glyph---for example, a ligature continuation. - pub fn add_nonglyph_for_char_index(&mut self, i: CharIndex, cluster_start: bool, ligature_start: bool) { + pub fn add_nonglyph_for_char_index(&mut self, + i: CharIndex, + cluster_start: bool, + ligature_start: bool) { assert!(i < self.char_len()); let entry = GlyphEntry::complex(cluster_start, ligature_start, 0); @@ -691,8 +694,10 @@ impl<'a> GlyphIterator<'a> { #[inline(never)] fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> { match self.glyph_range.as_mut().unwrap().next() { - Some(j) => Some((self.char_index, - GlyphInfo::Detail(self.store, self.char_index, j.get() as u16 /* ??? */))), + Some(j) => { + Some((self.char_index, + GlyphInfo::Detail(self.store, self.char_index, j.get() as u16 /* ??? */))) + } None => { // No more glyphs for current character. Try to get another. self.glyph_range = None; diff --git a/components/layout/context.rs b/components/layout/context.rs index cbea54c47be..3003c6cf56a 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -204,9 +204,8 @@ impl<'a> LayoutContext<'a> { } // Not yet requested, async mode - request image from the cache (ImageState::NotRequested, false) => { - self.shared.image_cache_task.request_image(url, - self.shared.image_cache_sender.clone(), - None); + self.shared.image_cache_task + .request_image(url, self.shared.image_cache_sender.clone(), None); None } // Image has been requested, is still pending. Return no image @@ -218,3 +217,4 @@ impl<'a> LayoutContext<'a> { } } } + diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index bafe3d2be10..c4f1d0b14c8 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1024,6 +1024,7 @@ impl FragmentDisplayListBuilding for Fragment { &clip); } } + if !self.is_scanned_text_fragment() { self.build_display_list_for_box_shadow_if_applicable(&*self.style, display_list, @@ -2107,3 +2108,4 @@ pub enum StackingContextCreationMode { OuterScrollWrapper, InnerScrollWrapper, } + diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 921f49b8672..1a8311e0a78 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -20,8 +20,9 @@ use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAI use layout_debug; use opaque_node::OpaqueNodeMethods; use parallel::{self, WorkQueueData}; -use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request, MarginPadding, Side}; -use query::{MarginRetrievingFragmentBorderBoxIterator, PositionProperty, PositionRetrievingFragmentBorderBoxIterator}; +use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request}; +use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionProperty}; +use query::{PositionRetrievingFragmentBorderBoxIterator, Side}; use sequential; use wrapper::LayoutNode; @@ -244,7 +245,9 @@ impl LayoutTaskFactory for LayoutTask { mem_profiler_chan: mem::ProfilerChan, shutdown_chan: Sender<()>) { let ConstellationChan(con_chan) = constellation_chan.clone(); - spawn_named_with_send_on_failure(format!("LayoutTask {:?}", id), task_state::LAYOUT, move || { + spawn_named_with_send_on_failure(format!("LayoutTask {:?}", id), + task_state::LAYOUT, + move || { { // Ensures layout task is destroyed before we send shutdown message let sender = chan.sender(); let layout_chan = LayoutChan(sender); @@ -561,7 +564,11 @@ impl LayoutTask { self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data) } Msg::LoadStylesheet(url, mq, pending, link_element) => { - self.handle_load_stylesheet(url, mq, pending, link_element, possibly_locked_rw_data) + self.handle_load_stylesheet(url, + mq, + pending, + link_element, + possibly_locked_rw_data) } Msg::SetQuirksMode => self.handle_set_quirks_mode(possibly_locked_rw_data), Msg::GetRPC(response_chan) => { @@ -734,7 +741,9 @@ impl LayoutTask { Origin::Author); //TODO: mark critical subresources as blocking load as well (#5974) - self.script_chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap(); + self.script_chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, + url, + responder)).unwrap(); self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data); } @@ -923,19 +932,22 @@ impl LayoutTask { atom!("padding-right") => (MarginPadding::Padding, Side::Right), _ => unreachable!() }; - let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node); + let requested_node: OpaqueNode = + OpaqueNodeMethods::from_script_node(requested_node); let mut iterator = MarginRetrievingFragmentBorderBoxIterator::new(requested_node, side, margin_padding, style.writing_mode); - sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator); + sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, + &mut iterator); rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string()); }, atom!("bottom") | atom!("top") | atom!("right") | atom!("left") | atom!("width") | atom!("height") - if applies && positioned && style.get_box().display != display::computed_value::T::none => { + if applies && positioned && style.get_box().display != + display::computed_value::T::none => { let layout_data = layout_node.borrow_layout_data(); let position = layout_data.as_ref().map(|layout_data| { match layout_data.data.flow_construction_result { @@ -954,17 +966,20 @@ impl LayoutTask { atom!("height") => PositionProperty::Height, _ => unreachable!() }; - let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node); + let requested_node: OpaqueNode = + OpaqueNodeMethods::from_script_node(requested_node); let mut iterator = PositionRetrievingFragmentBorderBoxIterator::new(requested_node, property, position); - sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator); + sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, + &mut iterator); rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string()); }, // FIXME: implement used value computation for line-height property => { - rw_data.resolved_style_response = style.computed_value_to_string(property.as_slice()); + rw_data.resolved_style_response = + style.computed_value_to_string(property.as_slice()); } }; } @@ -1193,8 +1208,13 @@ impl LayoutTask { process_content_boxes_request(node, &mut root_flow, &mut rw_data), ReflowQueryType::NodeGeometryQuery(node) => self.process_node_geometry_request(node, &mut root_flow, &mut rw_data), - ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => - self.process_resolved_style_request(node, pseudo, property, &mut root_flow, &mut rw_data), + ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => { + self.process_resolved_style_request(node, + pseudo, + property, + &mut root_flow, + &mut rw_data) + } ReflowQueryType::OffsetParentQuery(node) => self.process_offset_parent_query(node, &mut root_flow, &mut rw_data), ReflowQueryType::NoQuery => {} @@ -1312,16 +1332,16 @@ impl LayoutTask { self.profiler_metadata(), self.time_profiler_chan.clone(), || { - if opts::get().nonincremental_layout || flow_ref::deref_mut(&mut root_flow) - .compute_layout_damage() - .contains(REFLOW_ENTIRE_DOCUMENT) { + if opts::get().nonincremental_layout || + flow_ref::deref_mut(&mut root_flow).compute_layout_damage() + .contains(REFLOW_ENTIRE_DOCUMENT) { flow_ref::deref_mut(&mut root_flow).reflow_entire_document() } }); - // Verification of the flow tree, which ensures that all nodes were either marked as leaves - // or as non-leaves. This becomes a no-op in release builds. (It is inconsequential to - // memory safety but is a useful debugging tool.) + // Verification of the flow tree, which ensures that all nodes were either marked as + // leaves or as non-leaves. This becomes a no-op in release builds. (It is + // inconsequential to memory safety but is a useful debugging tool.) self.verify_flow_tree(&mut root_flow); if opts::get().trace_layout {