Remove usage of unstable box syntax, except in the script crate

… because there’s a lot of it,
and script still uses any other unstable features anyway.
This commit is contained in:
Simon Sapin 2017-10-11 23:12:43 +02:00
parent 796a8dc618
commit aa5761a5fb
40 changed files with 195 additions and 195 deletions

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
#![feature(nonzero)] #![feature(nonzero)]
extern crate core; extern crate core;

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(mpsc_select)] #![feature(mpsc_select)]

View file

@ -68,14 +68,14 @@ impl NetworkListener {
} }
}; };
ROUTER.add_route(ipc_receiver.to_opaque(), box move |message| { ROUTER.add_route(ipc_receiver.to_opaque(), Box::new(move |message| {
let msg = message.to(); let msg = message.to();
match msg { match msg {
Ok(FetchResponseMsg::ProcessResponse(res)) => listener.check_redirect(res), Ok(FetchResponseMsg::ProcessResponse(res)) => listener.check_redirect(res),
Ok(msg_) => listener.send(msg_), Ok(msg_) => listener.send(msg_),
Err(e) => warn!("Error while receiving network listener message: {}", e), Err(e) => warn!("Error while receiving network listener message: {}", e),
}; };
}); }));
if let Err(e) = self.resource_threads.sender().send(msg) { if let Err(e) = self.resource_threads.sender().send(msg) {
warn!("Resource thread unavailable ({})", e); warn!("Resource thread unavailable ({})", e);

View file

@ -232,14 +232,14 @@ impl Pipeline {
let (script_to_devtools_chan, script_to_devtools_port) = ipc::channel() let (script_to_devtools_chan, script_to_devtools_port) = ipc::channel()
.expect("Pipeline script to devtools chan"); .expect("Pipeline script to devtools chan");
let devtools_chan = (*devtools_chan).clone(); let devtools_chan = (*devtools_chan).clone();
ROUTER.add_route(script_to_devtools_port.to_opaque(), box move |message| { ROUTER.add_route(script_to_devtools_port.to_opaque(), Box::new(move |message| {
match message.to::<ScriptToDevtoolsControlMsg>() { match message.to::<ScriptToDevtoolsControlMsg>() {
Err(e) => error!("Cast to ScriptToDevtoolsControlMsg failed ({}).", e), Err(e) => error!("Cast to ScriptToDevtoolsControlMsg failed ({}).", e),
Ok(message) => if let Err(e) = devtools_chan.send(DevtoolsControlMsg::FromScript(message)) { Ok(message) => if let Err(e) = devtools_chan.send(DevtoolsControlMsg::FromScript(message)) {
warn!("Sending to devtools failed ({})", e) warn!("Sending to devtools failed ({})", e)
}, },
} }
}); }));
script_to_devtools_chan script_to_devtools_chan
}); });

View file

@ -52,7 +52,7 @@ impl FramerateActor {
}; };
actor.start_recording(); actor.start_recording();
registry.register_later(box actor); registry.register_later(Box::new(actor));
actor_name actor_name
} }

View file

@ -196,7 +196,7 @@ impl NodeInfoToProtocol for NodeInfo {
pipeline: pipeline.clone(), pipeline: pipeline.clone(),
}; };
actors.register_script_actor(self.uniqueId, name.clone()); actors.register_script_actor(self.uniqueId, name.clone());
actors.register_later(box node_actor); actors.register_later(Box::new(node_actor));
name name
} else { } else {
actors.script_to_actor(self.uniqueId) actors.script_to_actor(self.uniqueId)
@ -558,7 +558,7 @@ impl Actor for InspectorActor {
}; };
let mut walker_name = self.walker.borrow_mut(); let mut walker_name = self.walker.borrow_mut();
*walker_name = Some(walker.name()); *walker_name = Some(walker.name());
registry.register_later(box walker); registry.register_later(Box::new(walker));
} }
let (tx, rx) = ipc::channel().unwrap(); let (tx, rx) = ipc::channel().unwrap();
@ -587,7 +587,7 @@ impl Actor for InspectorActor {
}; };
let mut pageStyle = self.pageStyle.borrow_mut(); let mut pageStyle = self.pageStyle.borrow_mut();
*pageStyle = Some(style.name()); *pageStyle = Some(style.name());
registry.register_later(box style); registry.register_later(Box::new(style));
} }
let msg = GetPageStyleReply { let msg = GetPageStyleReply {
@ -610,7 +610,7 @@ impl Actor for InspectorActor {
}; };
let mut highlighter = self.highlighter.borrow_mut(); let mut highlighter = self.highlighter.borrow_mut();
*highlighter = Some(highlighter_actor.name()); *highlighter = Some(highlighter_actor.name());
registry.register_later(box highlighter_actor); registry.register_later(Box::new(highlighter_actor));
} }
let msg = GetHighlighterReply { let msg = GetHighlighterReply {

View file

@ -45,7 +45,7 @@ impl MemoryActor {
name: actor_name.clone() name: actor_name.clone()
}; };
registry.register_later(box actor); registry.register_later(Box::new(actor));
actor_name actor_name
} }

View file

@ -34,7 +34,7 @@ impl ObjectActor {
}; };
registry.register_script_actor(uuid, name.clone()); registry.register_script_actor(uuid, name.clone());
registry.register_later(box actor); registry.register_later(Box::new(actor));
name name
} else { } else {

View file

@ -12,7 +12,6 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
extern crate devtools_traits; extern crate devtools_traits;
extern crate hyper; extern crate hyper;
@ -143,9 +142,9 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
let mut registry = ActorRegistry::new(); let mut registry = ActorRegistry::new();
let root = box RootActor { let root = Box::new(RootActor {
tabs: vec!(), tabs: vec!(),
}; });
registry.register(root); registry.register(root);
registry.find::<RootActor>("root"); registry.find::<RootActor>("root");
@ -262,17 +261,17 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
id: id, id: id,
}; };
actor_workers.insert((pipeline, id), worker.name.clone()); actor_workers.insert((pipeline, id), worker.name.clone());
actors.register(box worker); actors.register(Box::new(worker));
} }
actor_pipelines.insert(pipeline, tab.name.clone()); actor_pipelines.insert(pipeline, tab.name.clone());
actors.register(box tab); actors.register(Box::new(tab));
actors.register(box console); actors.register(Box::new(console));
actors.register(box inspector); actors.register(Box::new(inspector));
actors.register(box timeline); actors.register(Box::new(timeline));
actors.register(box profiler); actors.register(Box::new(profiler));
actors.register(box performance); actors.register(Box::new(performance));
actors.register(box thread); actors.register(Box::new(thread));
} }
fn handle_console_message(actors: Arc<Mutex<ActorRegistry>>, fn handle_console_message(actors: Arc<Mutex<ActorRegistry>>,
@ -467,7 +466,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
let actor_name = actors.new_name("netevent"); let actor_name = actors.new_name("netevent");
let actor = NetworkEventActor::new(actor_name.clone()); let actor = NetworkEventActor::new(actor_name.clone());
entry.insert(actor_name.clone()); entry.insert(actor_name.clone());
actors.register(box actor); actors.register(Box::new(actor));
actor_name actor_name
} }
} }

View file

@ -586,10 +586,10 @@ pub struct ClipScrollNode {
impl ClipScrollNode { impl ClipScrollNode {
pub fn to_define_item(&self, pipeline_id: PipelineId) -> DisplayItem { pub fn to_define_item(&self, pipeline_id: PipelineId) -> DisplayItem {
DisplayItem::DefineClipScrollNode(box DefineClipScrollNodeItem { DisplayItem::DefineClipScrollNode(Box::new(DefineClipScrollNodeItem {
base: BaseDisplayItem::empty(pipeline_id), base: BaseDisplayItem::empty(pipeline_id),
node: self.clone(), node: self.clone(),
}) }))
} }
} }

View file

@ -4,7 +4,6 @@
// For SIMD // For SIMD
#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(allocator_api))] #![cfg_attr(any(target_os = "linux", target_os = "android"), feature(allocator_api))]
#![feature(box_syntax)]
#![feature(cfg_target_feature)] #![feature(cfg_target_feature)]
#![deny(unsafe_code)] #![deny(unsafe_code)]

View file

@ -118,15 +118,15 @@ impl HeapSizeOf for FontContextHandle {
impl FontContextHandle { impl FontContextHandle {
pub fn new() -> FontContextHandle { pub fn new() -> FontContextHandle {
let user = Box::into_raw(box User { let user = Box::into_raw(Box::new(User {
size: 0, size: 0,
}); }));
let mem = Box::into_raw(box FT_MemoryRec_ { let mem = Box::into_raw(Box::new(FT_MemoryRec_ {
user: user as *mut c_void, user: user as *mut c_void,
alloc: Some(ft_alloc), alloc: Some(ft_alloc),
free: Some(ft_free), free: Some(ft_free),
realloc: Some(ft_realloc), realloc: Some(ft_realloc),
}); }));
unsafe { unsafe {
let mut ctx: FT_Library = ptr::null_mut(); let mut ctx: FT_Library = ptr::null_mut();

View file

@ -509,7 +509,7 @@ extern fn font_table_func(_: *mut hb_face_t,
// `Box::into_raw` intentionally leaks the FontTable so we don't destroy the buffer // `Box::into_raw` intentionally leaks the FontTable so we don't destroy the buffer
// while HarfBuzz is using it. When HarfBuzz is done with the buffer, it will pass // while HarfBuzz is using it. When HarfBuzz is done with the buffer, it will pass
// this raw pointer back to `destroy_blob_func` which will deallocate the Box. // this raw pointer back to `destroy_blob_func` which will deallocate the Box.
let font_table_ptr = Box::into_raw(box font_table); let font_table_ptr = Box::into_raw(Box::new(font_table));
let buf = (*font_table_ptr).buffer(); let buf = (*font_table_ptr).buffer();
// HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed. // HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed.

View file

@ -537,7 +537,7 @@ impl BlockFlow {
None => ForceNonfloatedFlag::ForceNonfloated, None => ForceNonfloatedFlag::ForceNonfloated,
}), }),
fragment: fragment, fragment: fragment,
float: float_kind.map(|kind| box FloatedBlockInfo::new(kind)), float: float_kind.map(|kind| Box::new(FloatedBlockInfo::new(kind))),
flags: BlockFlowFlags::empty(), flags: BlockFlowFlags::empty(),
} }
} }

View file

@ -348,15 +348,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
SpecificFragmentInfo::Iframe(IframeFragmentInfo::new(node)) SpecificFragmentInfo::Iframe(IframeFragmentInfo::new(node))
} }
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => { Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => {
let image_info = box ImageFragmentInfo::new(node.image_url(), let image_info = Box::new(ImageFragmentInfo::new(
node, node.image_url(), node, &self.layout_context
&self.layout_context); ));
SpecificFragmentInfo::Image(image_info) SpecificFragmentInfo::Image(image_info)
} }
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => { Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
let image_info = box ImageFragmentInfo::new(node.object_data(), let image_info = Box::new(ImageFragmentInfo::new(
node, node.object_data(), node, &self.layout_context
&self.layout_context); ));
SpecificFragmentInfo::Image(image_info) SpecificFragmentInfo::Image(image_info)
} }
Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => { Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => {
@ -374,11 +374,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
} }
Some(LayoutNodeType::Element(LayoutElementType::HTMLCanvasElement)) => { Some(LayoutNodeType::Element(LayoutElementType::HTMLCanvasElement)) => {
let data = node.canvas_data().unwrap(); let data = node.canvas_data().unwrap();
SpecificFragmentInfo::Canvas(box CanvasFragmentInfo::new(data)) SpecificFragmentInfo::Canvas(Box::new(CanvasFragmentInfo::new(data)))
} }
Some(LayoutNodeType::Element(LayoutElementType::SVGSVGElement)) => { Some(LayoutNodeType::Element(LayoutElementType::SVGSVGElement)) => {
let data = node.svg_data().unwrap(); let data = node.svg_data().unwrap();
SpecificFragmentInfo::Svg(box SvgFragmentInfo::new(data)) SpecificFragmentInfo::Svg(Box::new(SvgFragmentInfo::new(data)))
} }
_ => { _ => {
// This includes pseudo-elements. // This includes pseudo-elements.
@ -553,7 +553,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
// Add whitespace results. They will be stripped out later on when // Add whitespace results. They will be stripped out later on when
// between block elements, and retained when between inline elements. // between block elements, and retained when between inline elements.
let fragment_info = SpecificFragmentInfo::UnscannedText( let fragment_info = SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(" ".to_owned(), None)); Box::new(UnscannedTextFragmentInfo::new(" ".to_owned(), None))
);
let fragment = Fragment::from_opaque_node_and_style(whitespace_node, let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_pseudo, whitespace_pseudo,
whitespace_style, whitespace_style,
@ -686,7 +687,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
match text_content { match text_content {
TextContent::Text(string) => { TextContent::Text(string) => {
let info = box UnscannedTextFragmentInfo::new(string, node.selection()); let info = Box::new(UnscannedTextFragmentInfo::new(string, node.selection()));
let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info); let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info);
fragments.fragments.push_back(Fragment::from_opaque_node_and_style( fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
node.opaque(), node.opaque(),
@ -700,11 +701,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
for content_item in content_items.into_iter() { for content_item in content_items.into_iter() {
let specific_fragment_info = match content_item { let specific_fragment_info = match content_item {
ContentItem::String(string) => { ContentItem::String(string) => {
let info = box UnscannedTextFragmentInfo::new(string, None); let info = Box::new(UnscannedTextFragmentInfo::new(string, None));
SpecificFragmentInfo::UnscannedText(info) SpecificFragmentInfo::UnscannedText(info)
} }
content_item => { content_item => {
let content_item = box GeneratedContentInfo::ContentItem(content_item); let content_item = Box::new(GeneratedContentInfo::ContentItem(content_item));
SpecificFragmentInfo::GeneratedContent(content_item) SpecificFragmentInfo::GeneratedContent(content_item)
} }
}; };
@ -821,7 +822,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
whitespace_damage)) => { whitespace_damage)) => {
// Instantiate the whitespace fragment. // Instantiate the whitespace fragment.
let fragment_info = SpecificFragmentInfo::UnscannedText( let fragment_info = SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(" ".to_owned(), None)); Box::new(UnscannedTextFragmentInfo::new(" ".to_owned(), None))
);
let fragment = let fragment =
Fragment::from_opaque_node_and_style(whitespace_node, Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_pseudo, whitespace_pseudo,
@ -842,7 +844,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
if is_empty && node_style.has_padding_or_border() { if is_empty && node_style.has_padding_or_border() {
// An empty inline box needs at least one fragment to draw its background and borders. // An empty inline box needs at least one fragment to draw its background and borders.
let info = SpecificFragmentInfo::UnscannedText( let info = SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(String::new(), None)); Box::new(UnscannedTextFragmentInfo::new(String::new(), None))
);
let fragment = Fragment::from_opaque_node_and_style(node.opaque(), let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
node.get_pseudo_element_type().strip(), node.get_pseudo_element_type().strip(),
node_style.clone(), node_style.clone(),
@ -1199,9 +1202,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let flotation = FloatKind::from_property(flotation); let flotation = FloatKind::from_property(flotation);
let marker_fragments = match node.style(self.style_context()).get_list().list_style_image { let marker_fragments = match node.style(self.style_context()).get_list().list_style_image {
list_style_image::computed_value::T(Either::First(ref url_value)) => { list_style_image::computed_value::T(Either::First(ref url_value)) => {
let image_info = box ImageFragmentInfo::new(url_value.url().map(|u| u.clone()), let image_info = Box::new(ImageFragmentInfo::new(
node, url_value.url().map(|u| u.clone()), node, &self.layout_context
&self.layout_context); ));
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)] vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
} }
list_style_image::computed_value::T(Either::Second(_none)) => { list_style_image::computed_value::T(Either::Second(_none)) => {
@ -1215,7 +1218,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
unscanned_marker_fragments.push_back(Fragment::new( unscanned_marker_fragments.push_back(Fragment::new(
node, node,
SpecificFragmentInfo::UnscannedText( SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(text, None)), Box::new(UnscannedTextFragmentInfo::new(text, None))
),
self.layout_context)); self.layout_context));
let marker_fragments = let marker_fragments =
with_thread_local_font_context(self.layout_context, |mut font_context| { with_thread_local_font_context(self.layout_context, |mut font_context| {
@ -1825,7 +1829,8 @@ fn control_chars_to_fragment(node: &InlineFragmentNodeInfo,
restyle_damage: RestyleDamage) restyle_damage: RestyleDamage)
-> Fragment { -> Fragment {
let info = SpecificFragmentInfo::UnscannedText( let info = SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(String::from(text), None)); Box::new(UnscannedTextFragmentInfo::new(String::from(text), None))
);
let text_style = context.stylist.style_for_anonymous( let text_style = context.stylist.style_for_anonymous(
&context.guards, &PseudoElement::ServoText, &node.style); &context.guards, &PseudoElement::ServoText, &node.style);
Fragment::from_opaque_node_and_style(node.address, Fragment::from_opaque_node_and_style(node.address,

View file

@ -986,10 +986,10 @@ impl FragmentDisplayListBuilding for Fragment {
style.get_cursor(Cursor::Default), style.get_cursor(Cursor::Default),
display_list_section); display_list_section);
state.add_display_item( state.add_display_item(
DisplayItem::SolidColor(box SolidColorDisplayItem { DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
base: base, base: base,
color: background_color.to_gfx_color(), color: background_color.to_gfx_color(),
})); })));
// The background image is painted on top of the background color. // The background image is painted on top of the background color.
// Implements background image, per spec: // Implements background image, per spec:
@ -1231,14 +1231,14 @@ impl FragmentDisplayListBuilding for Fragment {
display_list_section); display_list_section);
debug!("(building display list) adding background image."); debug!("(building display list) adding background image.");
state.add_display_item(DisplayItem::Image(box ImageDisplayItem { state.add_display_item(DisplayItem::Image(Box::new(ImageDisplayItem {
base: base, base: base,
webrender_image: webrender_image, webrender_image: webrender_image,
image_data: None, image_data: None,
stretch_size: stretch_size, stretch_size: stretch_size,
tile_spacing: tile_spacing, tile_spacing: tile_spacing,
image_rendering: style.get_inheritedbox().image_rendering.clone(), image_rendering: style.get_inheritedbox().image_rendering.clone(),
})); })));
} }
@ -1430,10 +1430,10 @@ impl FragmentDisplayListBuilding for Fragment {
&gradient.items[..], &gradient.items[..],
angle_or_corner, angle_or_corner,
gradient.repeating); gradient.repeating);
DisplayItem::Gradient(box GradientDisplayItem { DisplayItem::Gradient(Box::new(GradientDisplayItem {
base: base, base: base,
gradient: gradient, gradient: gradient,
}) }))
} }
GradientKind::Radial(ref shape, ref center, _angle) => { GradientKind::Radial(ref shape, ref center, _angle) => {
let gradient = self.convert_radial_gradient(&bounds, let gradient = self.convert_radial_gradient(&bounds,
@ -1441,10 +1441,10 @@ impl FragmentDisplayListBuilding for Fragment {
shape, shape,
center, center,
gradient.repeating); gradient.repeating);
DisplayItem::RadialGradient(box RadialGradientDisplayItem { DisplayItem::RadialGradient(Box::new(RadialGradientDisplayItem {
base: base, base: base,
gradient: gradient, gradient: gradient,
}) }))
} }
}; };
state.add_display_item(display_item); state.add_display_item(display_item);
@ -1473,7 +1473,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
style.get_cursor(Cursor::Default), style.get_cursor(Cursor::Default),
display_list_section); display_list_section);
state.add_display_item(DisplayItem::BoxShadow(box BoxShadowDisplayItem { state.add_display_item(DisplayItem::BoxShadow(Box::new(BoxShadowDisplayItem {
base: base, base: base,
box_bounds: *absolute_bounds, box_bounds: *absolute_bounds,
color: box_shadow.base.color.unwrap_or(style.get_color().color).to_gfx_color(), color: box_shadow.base.color.unwrap_or(style.get_color().color).to_gfx_color(),
@ -1489,7 +1489,7 @@ impl FragmentDisplayListBuilding for Fragment {
} else { } else {
BoxShadowClipMode::Outset BoxShadowClipMode::Outset
}, },
})); })));
} }
} }
@ -1557,7 +1557,7 @@ impl FragmentDisplayListBuilding for Fragment {
match border_style_struct.border_image_source { match border_style_struct.border_image_source {
Either::First(_) => { Either::First(_) => {
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: border.to_physical(style.writing_mode), border_widths: border.to_physical(style.writing_mode),
details: BorderDetails::Normal(NormalBorder { details: BorderDetails::Normal(NormalBorder {
@ -1568,7 +1568,7 @@ impl FragmentDisplayListBuilding for Fragment {
style: border_style, style: border_style,
radius: build_border_radius(&bounds, border_style_struct), radius: build_border_radius(&bounds, border_style_struct),
}), }),
})); })));
} }
Either::Second(Image::Gradient(ref gradient)) => { Either::Second(Image::Gradient(ref gradient)) => {
match gradient.kind { match gradient.kind {
@ -1578,7 +1578,7 @@ impl FragmentDisplayListBuilding for Fragment {
&angle_or_corner, &angle_or_corner,
gradient.repeating); gradient.repeating);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: border.to_physical(style.writing_mode), border_widths: border.to_physical(style.writing_mode),
details: BorderDetails::Gradient(display_list::GradientBorder { details: BorderDetails::Gradient(display_list::GradientBorder {
@ -1587,7 +1587,7 @@ impl FragmentDisplayListBuilding for Fragment {
// TODO(gw): Support border-image-outset // TODO(gw): Support border-image-outset
outset: SideOffsets2D::zero(), outset: SideOffsets2D::zero(),
}), }),
})); })));
} }
GradientKind::Radial(ref shape, ref center, _angle) => { GradientKind::Radial(ref shape, ref center, _angle) => {
let grad = self.convert_radial_gradient(&bounds, let grad = self.convert_radial_gradient(&bounds,
@ -1595,7 +1595,7 @@ impl FragmentDisplayListBuilding for Fragment {
shape, shape,
center, center,
gradient.repeating); gradient.repeating);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: border.to_physical(style.writing_mode), border_widths: border.to_physical(style.writing_mode),
details: BorderDetails::RadialGradient( details: BorderDetails::RadialGradient(
@ -1605,7 +1605,7 @@ impl FragmentDisplayListBuilding for Fragment {
// TODO(gw): Support border-image-outset // TODO(gw): Support border-image-outset
outset: SideOffsets2D::zero(), outset: SideOffsets2D::zero(),
}), }),
})); })));
} }
} }
} }
@ -1619,7 +1619,7 @@ impl FragmentDisplayListBuilding for Fragment {
if let Some(webrender_image) = webrender_image { if let Some(webrender_image) = webrender_image {
let corners = &border_style_struct.border_image_slice.offsets; let corners = &border_style_struct.border_image_slice.offsets;
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: border.to_physical(style.writing_mode), border_widths: border.to_physical(style.writing_mode),
details: BorderDetails::Image(ImageBorder { details: BorderDetails::Image(ImageBorder {
@ -1634,7 +1634,7 @@ impl FragmentDisplayListBuilding for Fragment {
repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0), repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0),
repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1), repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1),
}), }),
})); })));
} }
} }
Either::Second(Image::Rect(..)) => { Either::Second(Image::Rect(..)) => {
@ -1652,7 +1652,7 @@ impl FragmentDisplayListBuilding for Fragment {
if let Some(webrender_image) = webrender_image { if let Some(webrender_image) = webrender_image {
let corners = &border_style_struct.border_image_slice.offsets; let corners = &border_style_struct.border_image_slice.offsets;
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: border.to_physical(style.writing_mode), border_widths: border.to_physical(style.writing_mode),
details: BorderDetails::Image(ImageBorder { details: BorderDetails::Image(ImageBorder {
@ -1667,7 +1667,7 @@ impl FragmentDisplayListBuilding for Fragment {
repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0), repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0),
repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1), repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1),
}), }),
})); })));
} }
} }
} }
@ -1708,7 +1708,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
style.get_cursor(Cursor::Default), style.get_cursor(Cursor::Default),
DisplayListSection::Outlines); DisplayListSection::Outlines);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: SideOffsets2D::new_all_same(width), border_widths: SideOffsets2D::new_all_same(width),
details: BorderDetails::Normal(NormalBorder { details: BorderDetails::Normal(NormalBorder {
@ -1716,7 +1716,7 @@ impl FragmentDisplayListBuilding for Fragment {
style: SideOffsets2D::new_all_same(outline_style), style: SideOffsets2D::new_all_same(outline_style),
radius: Default::default(), radius: Default::default(),
}), }),
})); })));
} }
fn build_debug_borders_around_text_fragments(&self, fn build_debug_borders_around_text_fragments(&self,
@ -1735,7 +1735,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
style.get_cursor(Cursor::Default), style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)), border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
details: BorderDetails::Normal(NormalBorder { details: BorderDetails::Normal(NormalBorder {
@ -1743,7 +1743,7 @@ impl FragmentDisplayListBuilding for Fragment {
style: SideOffsets2D::new_all_same(border_style::T::solid), style: SideOffsets2D::new_all_same(border_style::T::solid),
radius: Default::default(), radius: Default::default(),
}), }),
})); })));
// Draw a rectangle representing the baselines. // Draw a rectangle representing the baselines.
let mut baseline = LogicalRect::from_physical(self.style.writing_mode, let mut baseline = LogicalRect::from_physical(self.style.writing_mode,
@ -1758,11 +1758,11 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
style.get_cursor(Cursor::Default), style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Line(box LineDisplayItem { state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
base: base, base: base,
color: ColorF::rgb(0, 200, 0), color: ColorF::rgb(0, 200, 0),
style: LineStyle::Dashed, style: LineStyle::Dashed,
})); })));
} }
fn build_debug_borders_around_fragment(&self, fn build_debug_borders_around_fragment(&self,
@ -1775,7 +1775,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)), border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
details: BorderDetails::Normal(NormalBorder { details: BorderDetails::Normal(NormalBorder {
@ -1783,7 +1783,7 @@ impl FragmentDisplayListBuilding for Fragment {
style: SideOffsets2D::new_all_same(border_style::T::solid), style: SideOffsets2D::new_all_same(border_style::T::solid),
radius: Default::default(), radius: Default::default(),
}), }),
})); })));
} }
fn build_display_items_for_selection_if_necessary(&self, fn build_display_items_for_selection_if_necessary(&self,
@ -1810,10 +1810,11 @@ impl FragmentDisplayListBuilding for Fragment {
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
display_list_section); display_list_section);
state.add_display_item( state.add_display_item(
DisplayItem::SolidColor(box SolidColorDisplayItem { DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
base: base, base: base,
color: background_color.to_gfx_color(), color: background_color.to_gfx_color(),
})); }))
);
} }
// Draw a caret at the insertion point. // Draw a caret at the insertion point.
@ -1848,10 +1849,10 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
self.style.get_cursor(cursor), self.style.get_cursor(cursor),
display_list_section); display_list_section);
state.add_display_item(DisplayItem::SolidColor(box SolidColorDisplayItem { state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
base: base, base: base,
color: self.style().get_color().color.to_gfx_color(), color: self.style().get_color().color.to_gfx_color(),
})); })));
} }
fn build_display_list(&mut self, fn build_display_list(&mut self,
@ -2068,10 +2069,10 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
let item = DisplayItem::Iframe(box IframeDisplayItem { let item = DisplayItem::Iframe(Box::new(IframeDisplayItem {
base: base, base: base,
iframe: pipeline_id, iframe: pipeline_id,
}); }));
let size = Size2D::new(item.bounds().size.width.to_f32_px(), let size = Size2D::new(item.bounds().size.width.to_f32_px(),
item.bounds().size.height.to_f32_px()); item.bounds().size.height.to_f32_px());
@ -2090,14 +2091,14 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Image(box ImageDisplayItem { state.add_display_item(DisplayItem::Image(Box::new(ImageDisplayItem {
base: base, base: base,
webrender_image: WebRenderImageInfo::from_image(image), webrender_image: WebRenderImageInfo::from_image(image),
image_data: Some(Arc::new(image.bytes.clone())), image_data: Some(Arc::new(image.bytes.clone())),
stretch_size: stacking_relative_content_box.size, stretch_size: stacking_relative_content_box.size,
tile_spacing: Size2D::zero(), tile_spacing: Size2D::zero(),
image_rendering: self.style.get_inheritedbox().image_rendering.clone(), image_rendering: self.style.get_inheritedbox().image_rendering.clone(),
})); })));
} }
} }
SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => { SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => {
@ -2128,7 +2129,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.node, self.node,
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
let display_item = DisplayItem::Image(box ImageDisplayItem { let display_item = DisplayItem::Image(Box::new(ImageDisplayItem {
base: base, base: base,
webrender_image: WebRenderImageInfo { webrender_image: WebRenderImageInfo {
width: computed_width as u32, width: computed_width as u32,
@ -2140,7 +2141,7 @@ impl FragmentDisplayListBuilding for Fragment {
stretch_size: stacking_relative_content_box.size, stretch_size: stacking_relative_content_box.size,
tile_spacing: Size2D::zero(), tile_spacing: Size2D::zero(),
image_rendering: image_rendering::T::auto, image_rendering: image_rendering::T::auto,
}); }));
state.add_display_item(display_item); state.add_display_item(display_item);
} }
@ -2249,12 +2250,12 @@ impl FragmentDisplayListBuilding for Fragment {
// Shadows // Shadows
for shadow in text_shadows.iter().rev() { for shadow in text_shadows.iter().rev() {
state.add_display_item(DisplayItem::PushTextShadow(box PushTextShadowDisplayItem { state.add_display_item(DisplayItem::PushTextShadow(Box::new(PushTextShadowDisplayItem {
base: base.clone(), base: base.clone(),
blur_radius: Au::from(shadow.blur), blur_radius: Au::from(shadow.blur),
offset: Vector2D::new(Au::from(shadow.horizontal), Au::from(shadow.vertical)), offset: Vector2D::new(Au::from(shadow.horizontal), Au::from(shadow.vertical)),
color: shadow.color.unwrap_or(self.style().get_color().color).to_gfx_color(), color: shadow.color.unwrap_or(self.style().get_color().color).to_gfx_color(),
})); })));
} }
@ -2296,14 +2297,14 @@ impl FragmentDisplayListBuilding for Fragment {
} }
// Text // Text
state.add_display_item(DisplayItem::Text(box TextDisplayItem { state.add_display_item(DisplayItem::Text(Box::new(TextDisplayItem {
base: base.clone(), base: base.clone(),
text_run: text_fragment.run.clone(), text_run: text_fragment.run.clone(),
range: text_fragment.range, range: text_fragment.range,
text_color: text_color.to_gfx_color(), text_color: text_color.to_gfx_color(),
orientation: orientation, orientation: orientation,
baseline_origin: baseline_origin, baseline_origin: baseline_origin,
})); })));
// TODO(#17715): emit text-emphasis marks here. // TODO(#17715): emit text-emphasis marks here.
@ -2326,9 +2327,9 @@ impl FragmentDisplayListBuilding for Fragment {
// Pair all the PushTextShadows // Pair all the PushTextShadows
for _ in text_shadows { for _ in text_shadows {
state.add_display_item(DisplayItem::PopTextShadow(box PopTextShadowDisplayItem { state.add_display_item(DisplayItem::PopTextShadow(Box::new(PopTextShadowDisplayItem {
base: base.clone(), base: base.clone(),
})); })));
} }
} }
@ -2348,11 +2349,11 @@ impl FragmentDisplayListBuilding for Fragment {
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Line(box LineDisplayItem { state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
base: base, base: base,
color: color.to_gfx_color(), color: color.to_gfx_color(),
style: LineStyle::Solid, style: LineStyle::Solid,
})); })));
} }
fn unique_id(&self, id_type: IdType) -> u64 { fn unique_id(&self, id_type: IdType) -> u64 {
@ -3110,7 +3111,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
node, node,
None, None,
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::Border(box BorderDisplayItem { state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
base: base, base: base,
border_widths: SideOffsets2D::new_all_same(Au::from_px(2)), border_widths: SideOffsets2D::new_all_same(Au::from_px(2)),
details: BorderDetails::Normal(NormalBorder { details: BorderDetails::Normal(NormalBorder {
@ -3118,7 +3119,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
style: SideOffsets2D::new_all_same(border_style::T::solid), style: SideOffsets2D::new_all_same(border_style::T::solid),
radius: BorderRadii::all_same(Au(0)), radius: BorderRadii::all_same(Au(0)),
}), }),
})); })));
} }
} }

View file

@ -790,12 +790,13 @@ impl Fragment {
}, },
_ => (ScannedTextFlags::empty(), None) _ => (ScannedTextFlags::empty(), None)
}; };
let info = box ScannedTextFragmentInfo::new( let info = Box::new(ScannedTextFragmentInfo::new(
text_run, text_run,
split.range, split.range,
size, size,
insertion_point, insertion_point,
flags); flags,
));
self.transform(size, SpecificFragmentInfo::ScannedText(info)) self.transform(size, SpecificFragmentInfo::ScannedText(info))
} }
@ -808,7 +809,9 @@ impl Fragment {
let mut ellipsis_fragment = self.transform( let mut ellipsis_fragment = self.transform(
self.border_box.size, self.border_box.size,
SpecificFragmentInfo::UnscannedText( SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(text_overflow_string, None))); Box::new(UnscannedTextFragmentInfo::new(text_overflow_string, None))
)
);
unscanned_ellipsis_fragments.push_back(ellipsis_fragment); unscanned_ellipsis_fragments.push_back(ellipsis_fragment);
let ellipsis_fragments = with_thread_local_font_context(layout_context, |font_context| { let ellipsis_fragments = with_thread_local_font_context(layout_context, |font_context| {
TextRunScanner::new().scan_for_runs(font_context, unscanned_ellipsis_fragments) TextRunScanner::new().scan_for_runs(font_context, unscanned_ellipsis_fragments)
@ -1706,10 +1709,10 @@ impl Fragment {
(LogicalSize::zero(self.style.writing_mode), None) (LogicalSize::zero(self.style.writing_mode), None)
}; };
let mut result = self.transform(size, SpecificFragmentInfo::Generic); let mut result = self.transform(size, SpecificFragmentInfo::Generic);
result.specific = SpecificFragmentInfo::TruncatedFragment(box TruncatedFragmentInfo { result.specific = SpecificFragmentInfo::TruncatedFragment(Box::new(TruncatedFragmentInfo {
text_info: text_info, text_info: text_info,
full: self, full: self,
}); }));
result result
} }

View file

@ -248,7 +248,7 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
// so that it isn't processed again on the next layout. FIXME (mbrubeck): When // so that it isn't processed again on the next layout. FIXME (mbrubeck): When
// processing an inline flow, this traversal should be allowed to insert or remove // processing an inline flow, this traversal should be allowed to insert or remove
// fragments. Then we can just remove these fragments rather than adding placeholders. // fragments. Then we can just remove these fragments rather than adding placeholders.
None => SpecificFragmentInfo::GeneratedContent(box GeneratedContentInfo::Empty) None => SpecificFragmentInfo::GeneratedContent(Box::new(GeneratedContentInfo::Empty))
}; };
} }
@ -436,7 +436,8 @@ fn render_text(layout_context: &LayoutContext,
-> Option<SpecificFragmentInfo> { -> Option<SpecificFragmentInfo> {
let mut fragments = LinkedList::new(); let mut fragments = LinkedList::new();
let info = SpecificFragmentInfo::UnscannedText( let info = SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new(string, None)); Box::new(UnscannedTextFragmentInfo::new(string, None))
);
fragments.push_back(Fragment::from_opaque_node_and_style(node, fragments.push_back(Fragment::from_opaque_node_and_style(node,
pseudo, pseudo,
style.clone(), style.clone(),

View file

@ -64,7 +64,7 @@ impl Scope {
STATE_KEY.with(|ref r| { STATE_KEY.with(|ref r| {
if let Some(ref mut state) = *r.borrow_mut() { if let Some(ref mut state) = *r.borrow_mut() {
let flow_trace = to_value(&flow::base(&*state.flow_root)).unwrap(); let flow_trace = to_value(&flow::base(&*state.flow_root)).unwrap();
let data = box ScopeData::new(name.clone(), flow_trace); let data = Box::new(ScopeData::new(name.clone(), flow_trace));
state.scope_stack.push(data); state.scope_stack.push(data);
} }
}); });
@ -102,7 +102,7 @@ pub fn begin_trace(flow_root: FlowRef) {
STATE_KEY.with(|ref r| { STATE_KEY.with(|ref r| {
let flow_trace = to_value(&flow::base(&*flow_root)).unwrap(); let flow_trace = to_value(&flow::base(&*flow_root)).unwrap();
let state = State { let state = State {
scope_stack: vec![box ScopeData::new("root".to_owned(), flow_trace)], scope_stack: vec![Box::new(ScopeData::new("root".to_owned(), flow_trace))],
flow_root: flow_root.clone(), flow_root: flow_root.clone(),
}; };
*r.borrow_mut() = Some(state); *r.borrow_mut() = Some(state);

View file

@ -4,7 +4,6 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(nonzero)] #![feature(nonzero)]
#![feature(raw)] #![feature(raw)]

View file

@ -235,7 +235,7 @@ impl ListStyleTypeContent {
let text = generated_content::static_representation(list_style_type); let text = generated_content::static_representation(list_style_type);
ListStyleTypeContent::StaticText(text) ListStyleTypeContent::StaticText(text)
} }
_ => ListStyleTypeContent::GeneratedContent(box GeneratedContentInfo::ListItem), _ => ListStyleTypeContent::GeneratedContent(Box::new(GeneratedContentInfo::ListItem)),
} }
} }
} }

View file

@ -377,12 +377,13 @@ impl TextRunScanner {
None None
}; };
let mut new_text_fragment_info = box ScannedTextFragmentInfo::new( let mut new_text_fragment_info = Box::new(ScannedTextFragmentInfo::new(
scanned_run.run, scanned_run.run,
byte_range, byte_range,
text_size, text_size,
insertion_point, insertion_point,
flags); flags
));
let new_metrics = new_text_fragment_info.run.metrics_for_range(&byte_range); let new_metrics = new_text_fragment_info.run.metrics_for_range(&byte_range);
let writing_mode = old_fragment.style.writing_mode; let writing_mode = old_fragment.style.writing_mode;
@ -506,10 +507,12 @@ fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragm
} }
}; };
} }
first_fragment.transform(first_fragment.border_box.size, first_fragment.transform(
SpecificFragmentInfo::UnscannedText( first_fragment.border_box.size,
box UnscannedTextFragmentInfo::new(string_before, SpecificFragmentInfo::UnscannedText(Box::new(
selection_before))) UnscannedTextFragmentInfo::new(string_before, selection_before)
))
)
}; };
fragments.push_front(new_fragment); fragments.push_front(new_fragment);

View file

@ -5,7 +5,6 @@
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be //! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
//! painted. //! painted.
#![feature(box_syntax)]
#![feature(mpsc_select)] #![feature(mpsc_select)]
#![feature(nonzero)] #![feature(nonzero)]
@ -689,8 +688,9 @@ impl LayoutThread {
} }
Msg::SetQuirksMode(mode) => self.handle_set_quirks_mode(mode), Msg::SetQuirksMode(mode) => self.handle_set_quirks_mode(mode),
Msg::GetRPC(response_chan) => { Msg::GetRPC(response_chan) => {
response_chan.send(box LayoutRPCImpl(self.rw_data.clone()) as response_chan.send(
Box<LayoutRPC + Send>).unwrap(); Box::new(LayoutRPCImpl(self.rw_data.clone())) as Box<LayoutRPC + Send>
).unwrap();
}, },
Msg::Reflow(data) => { Msg::Reflow(data) => {
let mut data = ScriptReflowResult::new(data); let mut data = ScriptReflowResult::new(data);

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
extern crate base64; extern crate base64;
extern crate brotli; extern crate brotli;

View file

@ -454,73 +454,73 @@ impl GroupedClassifier {
fn image_classifer() -> GroupedClassifier { fn image_classifer() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::image_x_icon(), Box::new(ByteMatcher::image_x_icon()),
box ByteMatcher::image_x_icon_cursor(), Box::new(ByteMatcher::image_x_icon_cursor()),
box ByteMatcher::image_bmp(), Box::new(ByteMatcher::image_bmp()),
box ByteMatcher::image_gif89a(), Box::new(ByteMatcher::image_gif89a()),
box ByteMatcher::image_gif87a(), Box::new(ByteMatcher::image_gif87a()),
box ByteMatcher::image_webp(), Box::new(ByteMatcher::image_webp()),
box ByteMatcher::image_png(), Box::new(ByteMatcher::image_png()),
box ByteMatcher::image_jpeg(), Box::new(ByteMatcher::image_jpeg()),
] ]
} }
} }
fn audio_video_classifier() -> GroupedClassifier { fn audio_video_classifier() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::video_webm(), Box::new(ByteMatcher::video_webm()),
box ByteMatcher::audio_basic(), Box::new(ByteMatcher::audio_basic()),
box ByteMatcher::audio_aiff(), Box::new(ByteMatcher::audio_aiff()),
box ByteMatcher::audio_mpeg(), Box::new(ByteMatcher::audio_mpeg()),
box ByteMatcher::application_ogg(), Box::new(ByteMatcher::application_ogg()),
box ByteMatcher::audio_midi(), Box::new(ByteMatcher::audio_midi()),
box ByteMatcher::video_avi(), Box::new(ByteMatcher::video_avi()),
box ByteMatcher::audio_wave(), Box::new(ByteMatcher::audio_wave()),
box Mp4Matcher Box::new(Mp4Matcher)
] ]
} }
} }
fn scriptable_classifier() -> GroupedClassifier { fn scriptable_classifier() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::text_html_doctype(), Box::new(ByteMatcher::text_html_doctype()),
box ByteMatcher::text_html_page(), Box::new(ByteMatcher::text_html_page()),
box ByteMatcher::text_html_head(), Box::new(ByteMatcher::text_html_head()),
box ByteMatcher::text_html_script(), Box::new(ByteMatcher::text_html_script()),
box ByteMatcher::text_html_iframe(), Box::new(ByteMatcher::text_html_iframe()),
box ByteMatcher::text_html_h1(), Box::new(ByteMatcher::text_html_h1()),
box ByteMatcher::text_html_div(), Box::new(ByteMatcher::text_html_div()),
box ByteMatcher::text_html_font(), Box::new(ByteMatcher::text_html_font()),
box ByteMatcher::text_html_table(), Box::new(ByteMatcher::text_html_table()),
box ByteMatcher::text_html_a(), Box::new(ByteMatcher::text_html_a()),
box ByteMatcher::text_html_style(), Box::new(ByteMatcher::text_html_style()),
box ByteMatcher::text_html_title(), Box::new(ByteMatcher::text_html_title()),
box ByteMatcher::text_html_b(), Box::new(ByteMatcher::text_html_b()),
box ByteMatcher::text_html_body(), Box::new(ByteMatcher::text_html_body()),
box ByteMatcher::text_html_br(), Box::new(ByteMatcher::text_html_br()),
box ByteMatcher::text_html_p(), Box::new(ByteMatcher::text_html_p()),
box ByteMatcher::text_html_comment(), Box::new(ByteMatcher::text_html_comment()),
box ByteMatcher::text_xml(), Box::new(ByteMatcher::text_xml()),
box ByteMatcher::application_pdf() Box::new(ByteMatcher::application_pdf())
] ]
} }
} }
fn plaintext_classifier() -> GroupedClassifier { fn plaintext_classifier() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::text_plain_utf_8_bom(), Box::new(ByteMatcher::text_plain_utf_8_bom()),
box ByteMatcher::text_plain_utf_16le_bom(), Box::new(ByteMatcher::text_plain_utf_16le_bom()),
box ByteMatcher::text_plain_utf_16be_bom(), Box::new(ByteMatcher::text_plain_utf_16be_bom()),
box ByteMatcher::application_postscript() Box::new(ByteMatcher::application_postscript())
] ]
} }
} }
fn archive_classifier() -> GroupedClassifier { fn archive_classifier() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::application_x_gzip(), Box::new(ByteMatcher::application_x_gzip()),
box ByteMatcher::application_zip(), Box::new(ByteMatcher::application_zip()),
box ByteMatcher::application_x_rar_compressed() Box::new(ByteMatcher::application_x_rar_compressed())
] ]
} }
} }
@ -528,11 +528,11 @@ impl GroupedClassifier {
fn font_classifier() -> GroupedClassifier { fn font_classifier() -> GroupedClassifier {
GroupedClassifier { GroupedClassifier {
byte_matchers: vec![ byte_matchers: vec![
box ByteMatcher::application_font_woff(), Box::new(ByteMatcher::application_font_woff()),
box ByteMatcher::true_type_collection(), Box::new(ByteMatcher::true_type_collection()),
box ByteMatcher::open_type(), Box::new(ByteMatcher::open_type()),
box ByteMatcher::true_type(), Box::new(ByteMatcher::true_type()),
box ByteMatcher::application_vnd_ms_font_object(), Box::new(ByteMatcher::application_vnd_ms_font_object()),
] ]
} }
} }

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
@ -392,7 +391,7 @@ pub fn fetch_async<F>(request: RequestInit, core_resource_thread: &CoreResourceT
{ {
let (action_sender, action_receiver) = ipc::channel().unwrap(); let (action_sender, action_receiver) = ipc::channel().unwrap();
ROUTER.add_route(action_receiver.to_opaque(), ROUTER.add_route(action_receiver.to_opaque(),
box move |message| f(message.to().unwrap())); Box::new(move |message| f(message.to().unwrap())));
core_resource_thread.send(CoreResourceMsg::Fetch(request, action_sender)).unwrap(); core_resource_thread.send(CoreResourceMsg::Fetch(request, action_sender)).unwrap();
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![cfg_attr(not(target_os = "windows"), feature(alloc_jemalloc))] #![cfg_attr(not(target_os = "windows"), feature(alloc_jemalloc))]
#![feature(box_syntax)]
#![deny(unsafe_code)] #![deny(unsafe_code)]

View file

@ -55,10 +55,10 @@ impl Profiler {
// be unregistered, because as long as the memory profiler is running the system memory // be unregistered, because as long as the memory profiler is running the system memory
// reporter can make measurements. // reporter can make measurements.
let (system_reporter_sender, system_reporter_receiver) = ipc::channel().unwrap(); let (system_reporter_sender, system_reporter_receiver) = ipc::channel().unwrap();
ROUTER.add_route(system_reporter_receiver.to_opaque(), box |message| { ROUTER.add_route(system_reporter_receiver.to_opaque(), Box::new(|message| {
let request: ReporterRequest = message.to().unwrap(); let request: ReporterRequest = message.to().unwrap();
system_reporter::collect_reports(request) system_reporter::collect_reports(request)
}); }));
mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(), mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(),
Reporter(system_reporter_sender))); Reporter(system_reporter_sender)));

View file

@ -7,7 +7,6 @@
//! modules won't have to depend on `profile`. //! modules won't have to depend on `profile`.
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
extern crate ipc_channel; extern crate ipc_channel;
#[macro_use] #[macro_use]

View file

@ -52,11 +52,11 @@ impl ProfilerChan {
{ {
// Register the memory reporter. // Register the memory reporter.
let (reporter_sender, reporter_receiver) = ipc::channel().unwrap(); let (reporter_sender, reporter_receiver) = ipc::channel().unwrap();
ROUTER.add_route(reporter_receiver.to_opaque(), box move |message| { ROUTER.add_route(reporter_receiver.to_opaque(), Box::new(move |message| {
// Just injects an appropriate event into the paint thread's queue. // Just injects an appropriate event into the paint thread's queue.
let request: ReporterRequest = message.to().unwrap(); let request: ReporterRequest = message.to().unwrap();
channel_for_reporter.send(msg(request.reports_channel)); channel_for_reporter.send(msg(request.reports_channel));
}); }));
self.send(ProfilerMsg::RegisterReporter(reporter_name.clone(), self.send(ProfilerMsg::RegisterReporter(reporter_name.clone(),
Reporter(reporter_sender))); Reporter(reporter_sender)));

View file

@ -7,7 +7,6 @@
//! to depend on script. //! to depend on script.
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
#![feature(nonzero)] #![feature(nonzero)]
extern crate app_units; extern crate app_units;

View file

@ -15,7 +15,6 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![feature(box_syntax)]
#![feature(plugin)] #![feature(plugin)]
#![feature(plugin_registrar)] #![feature(plugin_registrar)]
#![feature(rustc_private)] #![feature(rustc_private)]
@ -34,7 +33,7 @@ mod utils;
#[plugin_registrar] #[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) { pub fn plugin_registrar(reg: &mut Registry) {
reg.register_late_lint_pass(box unrooted_must_root::UnrootedPass::new()); reg.register_late_lint_pass(Box::new(unrooted_must_root::UnrootedPass::new()));
reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted); reg.register_attribute("allow_unrooted_interior".to_string(), Whitelisted);
reg.register_attribute("must_root".to_string(), Whitelisted); reg.register_attribute("must_root".to_string(), Whitelisted);
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![feature(box_syntax)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(link_args)] #![feature(link_args)]

View file

@ -11,7 +11,7 @@ use types::{cef_string_list_t,cef_string_t};
#[no_mangle] #[no_mangle]
pub extern "C" fn cef_string_list_alloc() -> *mut cef_string_list_t { pub extern "C" fn cef_string_list_alloc() -> *mut cef_string_list_t {
Box::into_raw(box vec!()) Box::into_raw(Box::new(vec!()))
} }
#[no_mangle] #[no_mangle]
@ -63,6 +63,6 @@ pub extern "C" fn cef_string_list_copy(lt: *mut cef_string_list_t) -> *mut cef_s
unsafe { unsafe {
if lt.is_null() { return 0 as *mut cef_string_list_t; } if lt.is_null() { return 0 as *mut cef_string_list_t; }
let copy = (*lt).clone(); let copy = (*lt).clone();
Box::into_raw(box copy) Box::into_raw(Box::new(copy))
} }
} }

View file

@ -13,7 +13,7 @@ use types::{cef_string_map_t, cef_string_t};
#[no_mangle] #[no_mangle]
pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t { pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t {
Box::into_raw(box BTreeMap::new()) Box::into_raw(Box::new(BTreeMap::new()))
} }
#[no_mangle] #[no_mangle]

View file

@ -13,7 +13,7 @@ use types::{cef_string_multimap_t,cef_string_t};
#[no_mangle] #[no_mangle]
pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t { pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t {
Box::into_raw(box BTreeMap::new()) Box::into_raw(Box::new(BTreeMap::new()))
} }
#[no_mangle] #[no_mangle]

View file

@ -302,10 +302,10 @@ impl WindowMethods for Window {
app_wakeup(); app_wakeup();
} }
fn clone(&self) -> Box<EventLoopWaker + Send> { fn clone(&self) -> Box<EventLoopWaker + Send> {
box CefEventLoopWaker Box::new(CefEventLoopWaker)
} }
} }
box CefEventLoopWaker Box::new(CefEventLoopWaker)
} }
fn prepare_for_composite(&self, width: usize, height: usize) -> bool { fn prepare_for_composite(&self, width: usize, height: usize) -> bool {

View file

@ -205,11 +205,11 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
// FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch // FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch
// stack space to create the object in. What a botch. // stack space to create the object in. What a botch.
Box::into_raw(box cef_string_utf16 { Box::into_raw(Box::new(cef_string_utf16 {
str: ptr, str: ptr,
length: buffer.len(), length: buffer.len(),
dtor: Some(free_boxed_utf16_string as extern "C" fn(*mut c_ushort)), dtor: Some(free_boxed_utf16_string as extern "C" fn(*mut c_ushort)),
}) as *const _ })) as *const _
} }
} }
unsafe fn to_rust(cef_string: *const cef_string_t) -> &'a [u16] { unsafe fn to_rust(cef_string: *const cef_string_t) -> &'a [u16] {

View file

@ -4,7 +4,6 @@
//! A simple application that uses glutin to open a window for Servo to display in. //! A simple application that uses glutin to open a window for Servo to display in.
#![feature(box_syntax)]
#[macro_use] extern crate bitflags; #[macro_use] extern crate bitflags;
extern crate compositing; extern crate compositing;

View file

@ -1088,15 +1088,15 @@ impl WindowMethods for Window {
} }
} }
fn clone(&self) -> Box<EventLoopWaker + Send> { fn clone(&self) -> Box<EventLoopWaker + Send> {
box GlutinEventLoopWaker { Box::new(GlutinEventLoopWaker {
window_proxy: self.window_proxy.clone(), window_proxy: self.window_proxy.clone(),
} })
} }
} }
let window_proxy = create_window_proxy(self); let window_proxy = create_window_proxy(self);
box GlutinEventLoopWaker { Box::new(GlutinEventLoopWaker {
window_proxy: window_proxy, window_proxy: window_proxy,
} })
} }
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]