Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev.

This commit is contained in:
Ms2ger 2015-03-11 11:08:57 +01:00 committed by Josh Matthews
parent 65d4b12bf2
commit 5f15eb5fbf
140 changed files with 1420 additions and 1222 deletions

View file

@ -1 +1 @@
2015-02-07 2015-03-11

View file

@ -5,8 +5,6 @@
#![feature(core)] #![feature(core)]
#![feature(collections)] #![feature(collections)]
#![allow(missing_copy_implementations)]
extern crate azure; extern crate azure;
extern crate cssparser; extern crate cssparser;
extern crate geom; extern crate geom;

View file

@ -208,8 +208,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
composition_request: CompositionRequest::NoCompositingNecessary, composition_request: CompositionRequest::NoCompositingNecessary,
pending_scroll_events: Vec::new(), pending_scroll_events: Vec::new(),
shutdown_state: ShutdownState::NotShuttingDown, shutdown_state: ShutdownState::NotShuttingDown,
page_zoom: ScaleFactor(1.0), page_zoom: ScaleFactor::new(1.0),
viewport_zoom: ScaleFactor(1.0), viewport_zoom: ScaleFactor::new(1.0),
zoom_action: false, zoom_action: false,
zoom_time: 0f64, zoom_time: 0f64,
got_load_complete_message: false, got_load_complete_message: false,
@ -893,7 +893,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
match opts::get().device_pixels_per_px { match opts::get().device_pixels_per_px {
Some(device_pixels_per_px) => device_pixels_per_px, Some(device_pixels_per_px) => device_pixels_per_px,
None => match opts::get().output_file { None => match opts::get().output_file {
Some(_) => ScaleFactor(1.0), Some(_) => ScaleFactor::new(1.0),
None => self.hidpi_factor None => self.hidpi_factor
} }
} }
@ -905,7 +905,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn update_zoom_transform(&mut self) { fn update_zoom_transform(&mut self) {
let scale = self.device_pixels_per_page_px(); let scale = self.device_pixels_per_page_px();
self.scene.scale = ScaleFactor(scale.get()); self.scene.scale = ScaleFactor::new(scale.get());
// We need to set the size of the root layer again, since the window size // We need to set the size of the root layer again, since the window size
// has changed in unscaled layer pixels. // has changed in unscaled layer pixels.
@ -913,7 +913,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
} }
fn on_zoom_window_event(&mut self, magnification: f32) { fn on_zoom_window_event(&mut self, magnification: f32) {
self.page_zoom = ScaleFactor((self.page_zoom.get() * magnification).max(1.0)); self.page_zoom = ScaleFactor::new((self.page_zoom.get() * magnification).max(1.0));
self.update_zoom_transform(); self.update_zoom_transform();
self.send_window_size(); self.send_window_size();
} }
@ -924,7 +924,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.zoom_time = precise_time_s(); self.zoom_time = precise_time_s();
let old_viewport_zoom = self.viewport_zoom; let old_viewport_zoom = self.viewport_zoom;
self.viewport_zoom = ScaleFactor((self.viewport_zoom.get() * magnification).max(1.0)); self.viewport_zoom = ScaleFactor::new((self.viewport_zoom.get() * magnification).max(1.0));
let viewport_zoom = self.viewport_zoom; let viewport_zoom = self.viewport_zoom;
self.update_zoom_transform(); self.update_zoom_transform();

View file

@ -307,8 +307,8 @@ impl CompositorLayer for Layer<CompositorData> {
let min_x = (layer_size.width - content_size.width).get().min(0.0); let min_x = (layer_size.width - content_size.width).get().min(0.0);
let min_y = (layer_size.height - content_size.height).get().min(0.0); let min_y = (layer_size.height - content_size.height).get().min(0.0);
let new_offset : TypedPoint2D<LayerPixel, f32> = let new_offset : TypedPoint2D<LayerPixel, f32> =
Point2D(Length(new_offset.x.get().clamp(&min_x, &0.0)), Point2D(Length::new(new_offset.x.get().clamp(&min_x, &0.0)),
Length(new_offset.y.get().clamp(&min_y, &0.0))); Length::new(new_offset.y.get().clamp(&min_y, &0.0)));
if self.extra_data.borrow().scroll_offset == new_offset { if self.extra_data.borrow().scroll_offset == new_offset {
return ScrollEventResult::ScrollPositionUnchanged; return ScrollEventResult::ScrollPositionUnchanged;

View file

@ -34,6 +34,7 @@ use util::time::TimeProfilerChan;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::collections::{HashMap}; use std::collections::{HashMap};
use std::old_io as io; use std::old_io as io;
use std::marker::PhantomData;
use std::mem::replace; use std::mem::replace;
use std::sync::mpsc::{Receiver, channel}; use std::sync::mpsc::{Receiver, channel};
use url::Url; use url::Url;
@ -95,6 +96,8 @@ pub struct Constellation<LTF, STF> {
/// A channel through which messages can be sent to the memory profiler. /// A channel through which messages can be sent to the memory profiler.
pub memory_profiler_chan: MemoryProfilerChan, pub memory_profiler_chan: MemoryProfilerChan,
phantom: PhantomData<(LTF, STF)>,
pub window_size: WindowSizeData, pub window_size: WindowSizeData,
} }
@ -201,10 +204,11 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
time_profiler_chan: time_profiler_chan, time_profiler_chan: time_profiler_chan,
memory_profiler_chan: memory_profiler_chan, memory_profiler_chan: memory_profiler_chan,
window_size: WindowSizeData { window_size: WindowSizeData {
visible_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor(1.0), visible_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0),
initial_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor(1.0), initial_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0),
device_pixel_ratio: ScaleFactor(1.0), device_pixel_ratio: ScaleFactor::new(1.0),
}, },
phantom: PhantomData,
}; };
constellation.run(); constellation.run();
}); });
@ -227,7 +231,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.pipeline(pipeline_id).rect.map(|rect| { self.pipeline(pipeline_id).rect.map(|rect| {
WindowSizeData { WindowSizeData {
visible_viewport: rect.size, visible_viewport: rect.size,
initial_viewport: rect.size * ScaleFactor(1.0), initial_viewport: rect.size * ScaleFactor::new(1.0),
device_pixel_ratio: self.window_size.device_pixel_ratio, device_pixel_ratio: self.window_size.device_pixel_ratio,
} }
}) })
@ -448,7 +452,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let ScriptControlChan(ref script_chan) = script_chan; let ScriptControlChan(ref script_chan) = script_chan;
script_chan.send(ConstellationControlMsg::Resize(pipeline_id, WindowSizeData { script_chan.send(ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
visible_viewport: rect.size, visible_viewport: rect.size,
initial_viewport: rect.size * ScaleFactor(1.0), initial_viewport: rect.size * ScaleFactor::new(1.0),
device_pixel_ratio: self.window_size.device_pixel_ratio, device_pixel_ratio: self.window_size.device_pixel_ratio,
})).unwrap(); })).unwrap();

View file

@ -59,7 +59,7 @@ impl NullCompositor {
chan.send(ConstellationMsg::ResizedWindow(WindowSizeData { chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
initial_viewport: TypedSize2D(640_f32, 480_f32), initial_viewport: TypedSize2D(640_f32, 480_f32),
visible_viewport: TypedSize2D(640_f32, 480_f32), visible_viewport: TypedSize2D(640_f32, 480_f32),
device_pixel_ratio: ScaleFactor(1.0), device_pixel_ratio: ScaleFactor::new(1.0),
})).unwrap(); })).unwrap();
} }

View file

@ -18,4 +18,4 @@ path = "../util"
[dependencies] [dependencies]
time = "*" time = "*"
rustc-serialize = "0.2" rustc-serialize = "0.3"

View file

@ -14,7 +14,6 @@
#![feature(collections, std_misc)] #![feature(collections, std_misc)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(missing_copy_implementations)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View file

@ -15,4 +15,4 @@ path = "../util"
[dependencies] [dependencies]
url = "0.2.16" url = "0.2.16"
rustc-serialize = "0.2" rustc-serialize = "0.3"

View file

@ -12,7 +12,6 @@
#![feature(int_uint)] #![feature(int_uint)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(missing_copy_implementations)]
extern crate msg; extern crate msg;
extern crate "rustc-serialize" as rustc_serialize; extern crate "rustc-serialize" as rustc_serialize;

View file

@ -67,5 +67,5 @@ path = "../script_traits"
url = "0.2.16" url = "0.2.16"
time = "0.1.12" time = "0.1.12"
bitflags = "*" bitflags = "*"
rustc-serialize = "0.2" rustc-serialize = "0.3"
libc = "*" libc = "*"

View file

@ -7,7 +7,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
use geom::size::Size2D; use geom::size::Size2D;
use layers::platform::surface::NativePaintingGraphicsContext; use layers::platform::surface::NativePaintingGraphicsContext;
use layers::layers::LayerBuffer; use layers::layers::LayerBuffer;
use std::hash::{Hash, Hasher, Writer}; use std::hash::{Hash, Hasher};
use std::mem; use std::mem;
/// This is a struct used to store buffers when they are not in use. /// This is a struct used to store buffers when they are not in use.
@ -29,8 +29,8 @@ pub struct BufferMap {
#[derive(Eq, Copy)] #[derive(Eq, Copy)]
struct BufferKey([uint; 2]); struct BufferKey([uint; 2]);
impl<H: Hasher+Writer> Hash<H> for BufferKey { impl Hash for BufferKey {
fn hash(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
let BufferKey(ref bytes) = *self; let BufferKey(ref bytes) = *self;
bytes.as_slice().hash(state); bytes.as_slice().hash(state);
} }

View file

@ -16,7 +16,7 @@
#![feature(unicode)] #![feature(unicode)]
#![feature(unsafe_destructor)] #![feature(unsafe_destructor)]
#![allow(missing_copy_implementations)] #![plugin(plugins)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -32,8 +32,6 @@ extern crate png;
extern crate script_traits; extern crate script_traits;
extern crate "rustc-serialize" as rustc_serialize; extern crate "rustc-serialize" as rustc_serialize;
extern crate unicode; extern crate unicode;
#[no_link] #[plugin]
extern crate "plugins" as servo_plugins;
extern crate net; extern crate net;
#[macro_use] #[macro_use]
extern crate util; extern crate util;

View file

@ -850,9 +850,11 @@ impl<'a> PaintContext<'a> {
// Draw the text. // Draw the text.
let temporary_draw_target = let temporary_draw_target =
self.create_draw_target_for_blur_if_necessary(&text.base.bounds, text.blur_radius); self.create_draw_target_for_blur_if_necessary(&text.base.bounds, text.blur_radius);
self.font_context {
.get_paint_font_from_template(&text.text_run.font_template, // FIXME(https://github.com/rust-lang/rust/issues/23338)
text.text_run.actual_pt_size) let font = self.font_context.get_paint_font_from_template(
&text.text_run.font_template, text.text_run.actual_pt_size);
font
.borrow() .borrow()
.draw_text(&temporary_draw_target.draw_target, .draw_text(&temporary_draw_target.draw_target,
&*text.text_run, &*text.text_run,
@ -860,6 +862,7 @@ impl<'a> PaintContext<'a> {
baseline_origin, baseline_origin,
text.text_color, text.text_color,
opts::get().enable_text_antialiasing); opts::get().enable_text_antialiasing);
}
// Blur, if necessary. // Blur, if necessary.
self.blur_if_necessary(temporary_draw_target, text.blur_radius); self.blur_if_necessary(temporary_draw_target, text.blur_radius);

View file

@ -134,7 +134,7 @@ macro_rules! native_graphics_context(
) )
); );
impl<C> PaintTask<C> where C: PaintListener + Send { impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
pub fn create(id: PipelineId, pub fn create(id: PipelineId,
port: Receiver<Msg>, port: Receiver<Msg>,
compositor: C, compositor: C,

View file

@ -52,7 +52,7 @@ git = "https://github.com/servo/rust-geom"
[dependencies.string_cache] [dependencies.string_cache]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros] [dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.png] [dependencies.png]
@ -62,5 +62,5 @@ git = "https://github.com/servo/rust-png"
encoding = "0.2" encoding = "0.2"
url = "0.2.16" url = "0.2.16"
bitflags = "*" bitflags = "*"
rustc-serialize = "0.2" rustc-serialize = "0.3"
libc = "*" libc = "*"

View file

@ -1823,7 +1823,7 @@ impl Flow for BlockFlow {
self.base self.base
.absolute_position_info .absolute_position_info
.relative_containing_block_mode, .relative_containing_block_mode,
CoordinateSystem::Self); CoordinateSystem::Own);
let clip = self.fragment.clipping_region_for_children(&clip_in_child_coordinate_system, let clip = self.fragment.clipping_region_for_children(&clip_in_child_coordinate_system,
&stacking_relative_border_box); &stacking_relative_border_box);

View file

@ -52,7 +52,7 @@ use script::dom::htmlobjectelement::is_image_data;
use script::dom::node::NodeTypeId; use script::dom::node::NodeTypeId;
use util::opts; use util::opts;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::collections::DList; use std::collections::LinkedList;
use std::mem; use std::mem;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use style::computed_values::content::ContentItem; use style::computed_values::content::ContentItem;
@ -114,10 +114,10 @@ pub enum ConstructionItem {
#[derive(Clone)] #[derive(Clone)]
pub struct InlineFragmentsConstructionResult { pub struct InlineFragmentsConstructionResult {
/// Any {ib} splits that we're bubbling up. /// Any {ib} splits that we're bubbling up.
pub splits: DList<InlineBlockSplit>, pub splits: LinkedList<InlineBlockSplit>,
/// Any fragments that succeed the {ib} splits. /// Any fragments that succeed the {ib} splits.
pub fragments: DList<Fragment>, pub fragments: LinkedList<Fragment>,
/// Any absolute descendants that we're bubbling up. /// Any absolute descendants that we're bubbling up.
pub abs_descendants: AbsDescendants, pub abs_descendants: AbsDescendants,
@ -152,7 +152,7 @@ pub struct InlineFragmentsConstructionResult {
#[derive(Clone)] #[derive(Clone)]
pub struct InlineBlockSplit { pub struct InlineBlockSplit {
/// The inline fragments that precede the flow. /// The inline fragments that precede the flow.
pub predecessors: DList<Fragment>, pub predecessors: LinkedList<Fragment>,
/// The flow that caused this {ib} split. /// The flow that caused this {ib} split.
pub flow: FlowRef, pub flow: FlowRef,
@ -161,7 +161,7 @@ pub struct InlineBlockSplit {
/// Holds inline fragments that we're gathering for children of an inline node. /// Holds inline fragments that we're gathering for children of an inline node.
struct InlineFragmentsAccumulator { struct InlineFragmentsAccumulator {
/// The list of fragments. /// The list of fragments.
fragments: DList<Fragment>, fragments: LinkedList<Fragment>,
/// Whether we've created a range to enclose all the fragments. This will be Some() if the /// Whether we've created a range to enclose all the fragments. This will be Some() if the
/// outer node is an inline and None otherwise. /// outer node is an inline and None otherwise.
@ -171,20 +171,20 @@ struct InlineFragmentsAccumulator {
impl InlineFragmentsAccumulator { impl InlineFragmentsAccumulator {
fn new() -> InlineFragmentsAccumulator { fn new() -> InlineFragmentsAccumulator {
InlineFragmentsAccumulator { InlineFragmentsAccumulator {
fragments: DList::new(), fragments: LinkedList::new(),
enclosing_style: None, enclosing_style: None,
} }
} }
fn from_inline_node(node: &ThreadSafeLayoutNode) -> InlineFragmentsAccumulator { fn from_inline_node(node: &ThreadSafeLayoutNode) -> InlineFragmentsAccumulator {
let fragments = DList::new(); let fragments = LinkedList::new();
InlineFragmentsAccumulator { InlineFragmentsAccumulator {
fragments: fragments, fragments: fragments,
enclosing_style: Some(node.style().clone()), enclosing_style: Some(node.style().clone()),
} }
} }
fn push_all(&mut self, mut fragments: DList<Fragment>) { fn push_all(&mut self, mut fragments: LinkedList<Fragment>) {
if fragments.len() == 0 { if fragments.len() == 0 {
return return
} }
@ -192,7 +192,7 @@ impl InlineFragmentsAccumulator {
self.fragments.append(&mut fragments) self.fragments.append(&mut fragments)
} }
fn to_dlist(self) -> DList<Fragment> { fn to_dlist(self) -> LinkedList<Fragment> {
let InlineFragmentsAccumulator { let InlineFragmentsAccumulator {
mut fragments, mut fragments,
enclosing_style enclosing_style
@ -507,7 +507,7 @@ impl<'a> FlowConstructor<'a> {
fn build_flow_for_block_starting_with_fragments(&mut self, fn build_flow_for_block_starting_with_fragments(&mut self,
mut flow: FlowRef, mut flow: FlowRef,
node: &ThreadSafeLayoutNode, node: &ThreadSafeLayoutNode,
mut initial_fragments: DList<Fragment>) mut initial_fragments: LinkedList<Fragment>)
-> ConstructionResult { -> ConstructionResult {
// Gather up fragments for the inline flows we might need to create. // Gather up fragments for the inline flows we might need to create.
let mut inline_fragment_accumulator = InlineFragmentsAccumulator::new(); let mut inline_fragment_accumulator = InlineFragmentsAccumulator::new();
@ -577,7 +577,7 @@ impl<'a> FlowConstructor<'a> {
/// `<textarea>`. /// `<textarea>`.
fn build_flow_for_block(&mut self, flow: FlowRef, node: &ThreadSafeLayoutNode) fn build_flow_for_block(&mut self, flow: FlowRef, node: &ThreadSafeLayoutNode)
-> ConstructionResult { -> ConstructionResult {
let mut initial_fragments = DList::new(); let mut initial_fragments = LinkedList::new();
if node.get_pseudo_element_type() != PseudoElementType::Normal || if node.get_pseudo_element_type() != PseudoElementType::Normal ||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLInputElement))) || HTMLElementTypeId::HTMLInputElement))) ||
@ -600,7 +600,7 @@ impl<'a> FlowConstructor<'a> {
/// Pushes fragments appropriate for the content of the given node onto the given list. /// Pushes fragments appropriate for the content of the given node onto the given list.
fn create_fragments_for_node_text_content(&self, fn create_fragments_for_node_text_content(&self,
fragments: &mut DList<Fragment>, fragments: &mut LinkedList<Fragment>,
node: &ThreadSafeLayoutNode, node: &ThreadSafeLayoutNode,
style: &Arc<ComputedValues>) { style: &Arc<ComputedValues>) {
for content_item in node.text_content().into_iter() { for content_item in node.text_content().into_iter() {
@ -650,7 +650,7 @@ impl<'a> FlowConstructor<'a> {
/// whitespace. /// whitespace.
fn build_fragments_for_nonreplaced_inline_content(&mut self, node: &ThreadSafeLayoutNode) fn build_fragments_for_nonreplaced_inline_content(&mut self, node: &ThreadSafeLayoutNode)
-> ConstructionResult { -> ConstructionResult {
let mut opt_inline_block_splits: DList<InlineBlockSplit> = DList::new(); let mut opt_inline_block_splits: LinkedList<InlineBlockSplit> = LinkedList::new();
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node); let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
let mut abs_descendants = Descendants::new(); let mut abs_descendants = Descendants::new();
@ -769,7 +769,7 @@ impl<'a> FlowConstructor<'a> {
// If this is generated content, then we need to initialize the accumulator with the // If this is generated content, then we need to initialize the accumulator with the
// fragment corresponding to that content. Otherwise, just initialize with the ordinary // fragment corresponding to that content. Otherwise, just initialize with the ordinary
// fragment that needs to be generated for this inline node. // fragment that needs to be generated for this inline node.
let mut fragments = DList::new(); let mut fragments = LinkedList::new();
match (node.get_pseudo_element_type(), node.type_id()) { match (node.get_pseudo_element_type(), node.type_id()) {
(_, Some(NodeTypeId::Text)) => { (_, Some(NodeTypeId::Text)) => {
self.create_fragments_for_node_text_content(&mut fragments, node, &style) self.create_fragments_for_node_text_content(&mut fragments, node, &style)
@ -782,7 +782,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item = let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult { ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(), splits: LinkedList::new(),
fragments: fragments, fragments: fragments,
abs_descendants: Descendants::new(), abs_descendants: Descendants::new(),
}); });
@ -806,7 +806,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item = let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult { ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(), splits: LinkedList::new(),
fragments: fragment_accumulator.to_dlist(), fragments: fragment_accumulator.to_dlist(),
abs_descendants: abs_descendants, abs_descendants: abs_descendants,
}); });
@ -832,7 +832,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item = let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult { ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(), splits: LinkedList::new(),
fragments: fragment_accumulator.to_dlist(), fragments: fragment_accumulator.to_dlist(),
abs_descendants: abs_descendants, abs_descendants: abs_descendants,
}); });
@ -1042,7 +1042,7 @@ impl<'a> FlowConstructor<'a> {
ListStyleTypeContent::None => None, ListStyleTypeContent::None => None,
ListStyleTypeContent::StaticText(ch) => { ListStyleTypeContent::StaticText(ch) => {
let text = format!("{}\u{a0}", ch); let text = format!("{}\u{a0}", ch);
let mut unscanned_marker_fragments = DList::new(); let mut unscanned_marker_fragments = LinkedList::new();
unscanned_marker_fragments.push_back(Fragment::new( unscanned_marker_fragments.push_back(Fragment::new(
node, node,
SpecificFragmentInfo::UnscannedText( SpecificFragmentInfo::UnscannedText(
@ -1065,7 +1065,7 @@ impl<'a> FlowConstructor<'a> {
// we adopt Gecko's behavior rather than WebKit's when the marker causes an {ib} split, // we adopt Gecko's behavior rather than WebKit's when the marker causes an {ib} split,
// which has caused some malaise (Bugzilla #36854) but CSS 2.1 § 12.5.1 lets me do it, so // which has caused some malaise (Bugzilla #36854) but CSS 2.1 § 12.5.1 lets me do it, so
// there. // there.
let mut initial_fragments = DList::new(); let mut initial_fragments = LinkedList::new();
let main_fragment = self.build_fragment_for_block(node); let main_fragment = self.build_fragment_for_block(node);
let flow = match node.style().get_list().list_style_position { let flow = match node.style().get_list().list_style_position {
list_style_position::T::outside => { list_style_position::T::outside => {
@ -1477,7 +1477,7 @@ impl FlowConstructionUtils for FlowRef {
} }
/// Strips ignorable whitespace from the start of a list of fragments. /// Strips ignorable whitespace from the start of a list of fragments.
pub fn strip_ignorable_whitespace_from_start(this: &mut DList<Fragment>) { pub fn strip_ignorable_whitespace_from_start(this: &mut LinkedList<Fragment>) {
if this.is_empty() { if this.is_empty() {
return // Fast path. return // Fast path.
} }
@ -1489,7 +1489,7 @@ pub fn strip_ignorable_whitespace_from_start(this: &mut DList<Fragment>) {
} }
/// Strips ignorable whitespace from the end of a list of fragments. /// Strips ignorable whitespace from the end of a list of fragments.
pub fn strip_ignorable_whitespace_from_end(this: &mut DList<Fragment>) { pub fn strip_ignorable_whitespace_from_end(this: &mut LinkedList<Fragment>) {
if this.is_empty() { if this.is_empty() {
return return
} }

View file

@ -19,7 +19,7 @@ use util::smallvec::{SmallVec, SmallVec16};
use util::arc_ptr_eq; use util::arc_ptr_eq;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::mem; use std::mem;
use std::hash::{Hash, Hasher, Writer}; use std::hash::{Hash, Hasher};
use std::slice::Iter; use std::slice::Iter;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, Namespace};
use selectors::parser::PseudoElement; use selectors::parser::PseudoElement;
@ -78,8 +78,8 @@ impl PartialEq for ApplicableDeclarationsCacheEntry {
} }
impl Eq for ApplicableDeclarationsCacheEntry {} impl Eq for ApplicableDeclarationsCacheEntry {}
impl<H: Hasher+Writer> Hash<H> for ApplicableDeclarationsCacheEntry { impl Hash for ApplicableDeclarationsCacheEntry {
fn hash(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
let tmp = ApplicableDeclarationsCacheQuery::new(&*self.declarations); let tmp = ApplicableDeclarationsCacheQuery::new(&*self.declarations);
tmp.hash(state); tmp.hash(state);
} }
@ -119,8 +119,8 @@ impl<'a> PartialEq<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsC
} }
} }
impl<'a, H: Hasher+Writer> Hash<H> for ApplicableDeclarationsCacheQuery<'a> { impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
fn hash(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
for declaration in self.declarations.iter() { for declaration in self.declarations.iter() {
let ptr: uint = unsafe { let ptr: uint = unsafe {
mem::transmute_copy(declaration) mem::transmute_copy(declaration)
@ -357,7 +357,7 @@ impl StyleSharingCandidateCache {
} }
/// The results of attempting to share a style. /// The results of attempting to share a style.
pub enum StyleSharingResult<'ln> { pub enum StyleSharingResult {
/// We didn't find anybody to share the style with. The boolean indicates whether the style /// We didn't find anybody to share the style with. The boolean indicates whether the style
/// is shareable at all. /// is shareable at all.
CannotShare(bool), CannotShare(bool),

View file

@ -797,7 +797,7 @@ impl FragmentDisplayListBuilding for Fragment {
self.stacking_relative_border_box(stacking_relative_flow_origin, self.stacking_relative_border_box(stacking_relative_flow_origin,
relative_containing_block_size, relative_containing_block_size,
relative_containing_block_mode, relative_containing_block_mode,
CoordinateSystem::Self); CoordinateSystem::Own);
debug!("Fragment::build_display_list at rel={:?}, abs={:?}, dirty={:?}, flow origin={:?}: \ debug!("Fragment::build_display_list at rel={:?}, abs={:?}, dirty={:?}, flow origin={:?}: \
{:?}", {:?}",

View file

@ -5,21 +5,21 @@
use flow::Flow; use flow::Flow;
use flow_ref::FlowRef; use flow_ref::FlowRef;
use std::collections::{dlist, DList}; use std::collections::{linked_list, LinkedList};
// This needs to be reworked now that we have dynamically-sized types in Rust. // This needs to be reworked now that we have dynamically-sized types in Rust.
// Until then, it's just a wrapper around DList. // Until then, it's just a wrapper around LinkedList.
pub struct FlowList { pub struct FlowList {
flows: DList<FlowRef>, flows: LinkedList<FlowRef>,
} }
pub struct FlowListIterator<'a> { pub struct FlowListIterator<'a> {
it: dlist::Iter<'a, FlowRef>, it: linked_list::Iter<'a, FlowRef>,
} }
pub struct MutFlowListIterator<'a> { pub struct MutFlowListIterator<'a> {
it: dlist::IterMut<'a, FlowRef>, it: linked_list::IterMut<'a, FlowRef>,
} }
impl FlowList { impl FlowList {
@ -72,7 +72,7 @@ impl FlowList {
#[inline] #[inline]
pub fn new() -> FlowList { pub fn new() -> FlowList {
FlowList { FlowList {
flows: DList::new(), flows: LinkedList::new(),
} }
} }

View file

@ -39,7 +39,7 @@ use util::smallvec::SmallVec;
use util::str::is_whitespace; use util::str::is_whitespace;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::collections::DList; use std::collections::LinkedList;
use std::fmt; use std::fmt;
use std::num::ToPrimitive; use std::num::ToPrimitive;
use std::str::FromStr; use std::str::FromStr;
@ -829,7 +829,7 @@ impl Fragment {
/// Transforms this fragment into an ellipsis fragment, preserving all the other data. /// Transforms this fragment into an ellipsis fragment, preserving all the other data.
pub fn transform_into_ellipsis(&self, layout_context: &LayoutContext) -> Fragment { pub fn transform_into_ellipsis(&self, layout_context: &LayoutContext) -> Fragment {
let mut unscanned_ellipsis_fragments = DList::new(); let mut unscanned_ellipsis_fragments = LinkedList::new();
unscanned_ellipsis_fragments.push_back(self.transform( unscanned_ellipsis_fragments.push_back(self.transform(
self.border_box.size, self.border_box.size,
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text( SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(
@ -1950,7 +1950,7 @@ impl Fragment {
/// into account. /// into account.
/// ///
/// If `coordinate_system` is `Parent`, this returns the border box in the parent stacking /// If `coordinate_system` is `Parent`, this returns the border box in the parent stacking
/// context's coordinate system. Otherwise, if `coordinate_system` is `Self` and this fragment /// context's coordinate system. Otherwise, if `coordinate_system` is `Own` and this fragment
/// establishes a stacking context itself, this returns a border box anchored at (0, 0). (If /// establishes a stacking context itself, this returns a border box anchored at (0, 0). (If
/// this fragment does not establish a stacking context, then it always belongs to its parent /// this fragment does not establish a stacking context, then it always belongs to its parent
/// stacking context and thus `coordinate_system` is ignored.) /// stacking context and thus `coordinate_system` is ignored.)
@ -1966,7 +1966,7 @@ impl Fragment {
let container_size = let container_size =
relative_containing_block_size.to_physical(relative_containing_block_mode); relative_containing_block_size.to_physical(relative_containing_block_mode);
let border_box = self.border_box.to_physical(self.style.writing_mode, container_size); let border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
if coordinate_system == CoordinateSystem::Self && self.establishes_stacking_context() { if coordinate_system == CoordinateSystem::Own && self.establishes_stacking_context() {
return Rect(ZERO_POINT, border_box.size) return Rect(ZERO_POINT, border_box.size)
} }
@ -2119,7 +2119,7 @@ pub enum CoordinateSystem {
/// The border box returned is relative to the fragment's parent stacking context. /// The border box returned is relative to the fragment's parent stacking context.
Parent, Parent,
/// The border box returned is relative to the fragment's own stacking context, if applicable. /// The border box returned is relative to the fragment's own stacking context, if applicable.
Self, Own,
} }
/// Given a range and a text run, adjusts the range to eliminate trailing whitespace. Returns true /// Given a range and a text run, adjusts the range to eliminate trailing whitespace. Returns true

View file

@ -16,7 +16,7 @@ use incremental::{self, RESOLVE_GENERATED_CONTENT};
use text::TextRunScanner; use text::TextRunScanner;
use gfx::display_list::OpaqueNode; use gfx::display_list::OpaqueNode;
use std::collections::{DList, HashMap}; use std::collections::{LinkedList, HashMap};
use std::sync::Arc; use std::sync::Arc;
use style::computed_values::content::ContentItem; use style::computed_values::content::ContentItem;
use style::computed_values::{display, list_style_type}; use style::computed_values::{display, list_style_type};
@ -421,7 +421,7 @@ fn render_text(layout_context: &LayoutContext,
style: Arc<ComputedValues>, style: Arc<ComputedValues>,
string: String) string: String)
-> SpecificFragmentInfo { -> SpecificFragmentInfo {
let mut fragments = DList::new(); let mut fragments = LinkedList::new();
let info = SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(string)); let info = SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(string));
fragments.push_back(Fragment::from_opaque_node_and_style(node, fragments.push_back(Fragment::from_opaque_node_and_style(node,
style, style,

View file

@ -18,7 +18,7 @@ use layout_debug;
use model::IntrinsicISizesContribution; use model::IntrinsicISizesContribution;
use text; use text;
use collections::{RingBuf}; use collections::{VecDeque};
use geom::{Point2D, Rect}; use geom::{Point2D, Rect};
use gfx::font::FontMetrics; use gfx::font::FontMetrics;
use gfx::font_context::FontContext; use gfx::font_context::FontContext;
@ -171,7 +171,7 @@ struct LineBreaker {
/// The resulting fragment list for the flow, consisting of possibly-broken fragments. /// The resulting fragment list for the flow, consisting of possibly-broken fragments.
new_fragments: Vec<Fragment>, new_fragments: Vec<Fragment>,
/// The next fragment or fragments that we need to work on. /// The next fragment or fragments that we need to work on.
work_list: RingBuf<Fragment>, work_list: VecDeque<Fragment>,
/// The line we're currently working on. /// The line we're currently working on.
pending_line: Line, pending_line: Line,
/// The lines we've already committed. /// The lines we've already committed.
@ -187,7 +187,7 @@ impl LineBreaker {
fn new(float_context: Floats, first_line_indentation: Au) -> LineBreaker { fn new(float_context: Floats, first_line_indentation: Au) -> LineBreaker {
LineBreaker { LineBreaker {
new_fragments: Vec::new(), new_fragments: Vec::new(),
work_list: RingBuf::new(), work_list: VecDeque::new(),
pending_line: Line { pending_line: Line {
range: Range::empty(), range: Range::empty(),
bounds: LogicalRect::zero(float_context.writing_mode), bounds: LogicalRect::zero(float_context.writing_mode),
@ -513,7 +513,7 @@ impl LineBreaker {
.expect("LineBreaker: this split case makes no sense!"); .expect("LineBreaker: this split case makes no sense!");
let writing_mode = self.floats.writing_mode; let writing_mode = self.floats.writing_mode;
let split_fragment = |&: split: SplitInfo| { let split_fragment = |split: SplitInfo| {
let size = LogicalSize::new(writing_mode, let size = LogicalSize::new(writing_mode,
split.inline_size, split.inline_size,
in_fragment.border_box.size.block); in_fragment.border_box.size.block);
@ -1342,7 +1342,7 @@ impl Flow for InlineFlow {
self.base self.base
.absolute_position_info .absolute_position_info
.relative_containing_block_mode, .relative_containing_block_mode,
CoordinateSystem::Self); CoordinateSystem::Own);
let clip = fragment.clipping_region_for_children(&self.base.clip, let clip = fragment.clipping_region_for_children(&self.base.clip,
&stacking_relative_border_box); &stacking_relative_border_box);
match fragment.specific { match fragment.specific {

View file

@ -96,6 +96,7 @@ pub struct LayoutTaskData {
/// The root stacking context. /// The root stacking context.
pub stacking_context: Option<Arc<StackingContext>>, pub stacking_context: Option<Arc<StackingContext>>,
/// Performs CSS selector matching and style resolution.
pub stylist: Box<Stylist>, pub stylist: Box<Stylist>,
/// The workers that we use for parallel operation. /// The workers that we use for parallel operation.
@ -178,7 +179,7 @@ impl ImageResponder<UntrustedNodeAddress> for LayoutImageResponder {
fn respond(&self) -> Box<Fn(ImageResponseMsg, UntrustedNodeAddress)+Send> { fn respond(&self) -> Box<Fn(ImageResponseMsg, UntrustedNodeAddress)+Send> {
let id = self.id.clone(); let id = self.id.clone();
let script_chan = self.script_chan.clone(); let script_chan = self.script_chan.clone();
box move |&:_, node_address| { box move |_, node_address| {
let ScriptControlChan(ref chan) = script_chan; let ScriptControlChan(ref chan) = script_chan;
debug!("Dirtying {:x}", node_address.0 as uint); debug!("Dirtying {:x}", node_address.0 as uint);
let mut nodes = SmallVec1::new(); let mut nodes = SmallVec1::new();
@ -281,10 +282,13 @@ impl LayoutTask {
let local_image_cache = let local_image_cache =
Arc::new(Mutex::new(LocalImageCache::new(image_cache_task.clone()))); Arc::new(Mutex::new(LocalImageCache::new(image_cache_task.clone())));
let screen_size = Size2D(Au(0), Au(0)); let screen_size = Size2D(Au(0), Au(0));
let device = Device::new(MediaType::Screen, opts::get().initial_window_size.as_f32() * ScaleFactor(1.0)); let device = Device::new(
MediaType::Screen,
opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0));
let parallel_traversal = if opts::get().layout_threads != 1 { let parallel_traversal = if opts::get().layout_threads != 1 {
Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT, Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT,
opts::get().layout_threads, SharedLayoutContextWrapper(ptr::null()))) opts::get().layout_threads,
SharedLayoutContextWrapper(ptr::null())))
} else { } else {
None None
}; };
@ -568,7 +572,7 @@ impl LayoutTask {
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data); let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
if mq.evaluate(&rw_data.stylist.device) { if mq.evaluate(&rw_data.stylist.device) {
iter_font_face_rules(&sheet, &rw_data.stylist.device, &|&:family, src| { iter_font_face_rules(&sheet, &rw_data.stylist.device, &|family, src| {
self.font_cache_task.add_web_font(family.to_owned(), (*src).clone()); self.font_cache_task.add_web_font(family.to_owned(), (*src).clone());
}); });
rw_data.stylist.add_stylesheet(sheet); rw_data.stylist.add_stylesheet(sheet);

View file

@ -16,10 +16,13 @@
#![feature(thread_local)] #![feature(thread_local)]
#![feature(unicode)] #![feature(unicode)]
#![feature(unsafe_destructor)] #![feature(unsafe_destructor)]
#![feature(unsafe_no_drop_flag)]
#![deny(unsafe_blocks)] #![deny(unsafe_blocks)]
#![allow(unrooted_must_root)] #![allow(unrooted_must_root)]
#![allow(missing_copy_implementations)]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -37,7 +40,7 @@ extern crate "rustc-serialize" as rustc_serialize;
extern crate png; extern crate png;
extern crate style; extern crate style;
#[macro_use] #[macro_use]
#[no_link] #[plugin] #[no_link]
extern crate "plugins" as servo_plugins; extern crate "plugins" as servo_plugins;
extern crate net; extern crate net;
extern crate msg; extern crate msg;
@ -45,8 +48,6 @@ extern crate selectors;
#[macro_use] #[macro_use]
extern crate util; extern crate util;
#[no_link] #[macro_use] #[plugin]
extern crate string_cache_macros;
extern crate string_cache; extern crate string_cache;
extern crate alloc; extern crate alloc;

View file

@ -20,7 +20,7 @@ use util::geometry::Au;
use util::logical_geometry::{LogicalSize, WritingMode}; use util::logical_geometry::{LogicalSize, WritingMode};
use util::range::Range; use util::range::Range;
use util::smallvec::{SmallVec, SmallVec1}; use util::smallvec::{SmallVec, SmallVec1};
use std::collections::DList; use std::collections::LinkedList;
use std::mem; use std::mem;
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform}; use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
use style::computed_values::{white_space}; use style::computed_values::{white_space};
@ -30,17 +30,17 @@ use std::sync::Arc;
/// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextFragment`s. /// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextFragment`s.
pub struct TextRunScanner { pub struct TextRunScanner {
pub clump: DList<Fragment>, pub clump: LinkedList<Fragment>,
} }
impl TextRunScanner { impl TextRunScanner {
pub fn new() -> TextRunScanner { pub fn new() -> TextRunScanner {
TextRunScanner { TextRunScanner {
clump: DList::new(), clump: LinkedList::new(),
} }
} }
pub fn scan_for_runs(&mut self, font_context: &mut FontContext, mut fragments: DList<Fragment>) pub fn scan_for_runs(&mut self, font_context: &mut FontContext, mut fragments: LinkedList<Fragment>)
-> InlineFragments { -> InlineFragments {
debug!("TextRunScanner: scanning {} fragments for text runs...", fragments.len()); debug!("TextRunScanner: scanning {} fragments for text runs...", fragments.len());
@ -160,7 +160,7 @@ impl TextRunScanner {
// TextRuns contain a cycle which is usually resolved by the teardown sequence. // TextRuns contain a cycle which is usually resolved by the teardown sequence.
// If no clump takes ownership, however, it will leak. // If no clump takes ownership, however, it will leak.
if run_text.len() == 0 { if run_text.len() == 0 {
self.clump = DList::new(); self.clump = LinkedList::new();
return last_whitespace return last_whitespace
} }
@ -183,15 +183,15 @@ impl TextRunScanner {
flags: flags, flags: flags,
}; };
Arc::new(box TextRun::new(&mut *fontgroup.fonts.get(0).borrow_mut(), // FIXME(https://github.com/rust-lang/rust/issues/23338)
run_text, let mut font = fontgroup.fonts.get(0).borrow_mut();
&options)) Arc::new(box TextRun::new(&mut *font, run_text, &options))
}; };
// Make new fragments with the run and adjusted text indices. // Make new fragments with the run and adjusted text indices.
debug!("TextRunScanner: pushing {} fragment(s)", self.clump.len()); debug!("TextRunScanner: pushing {} fragment(s)", self.clump.len());
for (logical_offset, old_fragment) in for (logical_offset, old_fragment) in
mem::replace(&mut self.clump, DList::new()).into_iter().enumerate() { mem::replace(&mut self.clump, LinkedList::new()).into_iter().enumerate() {
let range = *new_ranges.get(logical_offset); let range = *new_ranges.get(logical_offset);
if range.is_empty() { if range.is_empty() {
debug!("Elided an `SpecificFragmentInfo::UnscannedText` because it was \ debug!("Elided an `SpecificFragmentInfo::UnscannedText` because it was \
@ -304,7 +304,9 @@ fn bounding_box_for_run_metrics(metrics: &RunMetrics, writing_mode: WritingMode)
pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<FontStyle>) pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<FontStyle>)
-> FontMetrics { -> FontMetrics {
let fontgroup = font_context.get_layout_font_group_for_style(font_style); let fontgroup = font_context.get_layout_font_group_for_style(font_style);
fontgroup.fonts.get(0).borrow().metrics.clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let font = fontgroup.fonts.get(0).borrow();
font.metrics.clone()
} }
/// Returns the line block-size needed by the given computed style and font size. /// Returns the line block-size needed by the given computed style and font size.

View file

@ -63,7 +63,7 @@ use msg::constellation_msg::{PipelineId, SubpageId};
use util::str::{LengthOrPercentageOrAuto, is_whitespace}; use util::str::{LengthOrPercentageOrAuto, is_whitespace};
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::{Ref, RefMut}; use std::cell::{Ref, RefMut};
use std::marker::ContravariantLifetime; use std::marker::PhantomData;
use std::mem; use std::mem;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, Namespace};
@ -173,8 +173,8 @@ pub struct LayoutNode<'a> {
/// The wrapped node. /// The wrapped node.
node: LayoutJS<Node>, node: LayoutJS<Node>,
/// Being chained to a ContravariantLifetime prevents `LayoutNode`s from escaping. /// Being chained to a PhantomData prevents `LayoutNode`s from escaping.
pub chain: ContravariantLifetime<'a>, pub chain: PhantomData<&'a ()>,
} }
impl<'ln> Clone for LayoutNode<'ln> { impl<'ln> Clone for LayoutNode<'ln> {
@ -347,7 +347,9 @@ impl<'ln> LayoutNode<'ln> {
} }
} }
impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> { impl<'ln> TNode<'ln> for LayoutNode<'ln> {
type Element = LayoutElement<'ln>;
fn parent_node(self) -> Option<LayoutNode<'ln>> { fn parent_node(self) -> Option<LayoutNode<'ln>> {
unsafe { unsafe {
self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node)) self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))

View file

@ -2,8 +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/. */
#![allow(missing_copy_implementations)]
extern crate gfx; extern crate gfx;
extern crate script_traits; extern crate script_traits;
extern crate msg; extern crate msg;

View file

@ -20,10 +20,6 @@ git = "https://github.com/servo/rust-azure"
[dependencies.geom] [dependencies.geom]
git = "https://github.com/servo/rust-geom" git = "https://github.com/servo/rust-geom"
[dependencies.hyper]
git = "https://github.com/servo/hyper"
branch = "servo"
[dependencies.layers] [dependencies.layers]
git = "https://github.com/servo/rust-layers" git = "https://github.com/servo/rust-layers"
@ -36,3 +32,4 @@ git = "https://github.com/servo/rust-io-surface"
[dependencies] [dependencies]
url = "0.2.16" url = "0.2.16"
bitflags = "*" bitflags = "*"
hyper = "0.3"

View file

@ -5,8 +5,6 @@
#![feature(hash)] #![feature(hash)]
#![feature(int_uint)] #![feature(int_uint)]
#![allow(missing_copy_implementations)]
extern crate azure; extern crate azure;
#[macro_use] extern crate bitflags; #[macro_use] extern crate bitflags;
extern crate geom; extern crate geom;

View file

@ -13,10 +13,6 @@ path = "../util"
[dependencies.geom] [dependencies.geom]
git = "https://github.com/servo/rust-geom" git = "https://github.com/servo/rust-geom"
[dependencies.hyper]
git = "https://github.com/servo/hyper"
branch = "servo"
[dependencies.png] [dependencies.png]
git = "https://github.com/servo/rust-png" git = "https://github.com/servo/rust-png"
@ -26,8 +22,9 @@ git = "https://github.com/servo/rust-stb-image"
[dependencies] [dependencies]
url = "0.2.16" url = "0.2.16"
time = "0.1.17" time = "0.1.17"
openssl="0.3.1" openssl="0.5.1"
rustc-serialize = "0.2" rustc-serialize = "0.3"
cookie="*" cookie="*"
regex = "0.1.14" regex = "0.1.14"
regex_macros = "0.1.8" regex_macros = "0.1.8"
hyper = "0.3"

View file

@ -11,7 +11,7 @@ use hyper::http::RawStatus;
use util::resource_files::resources_dir_path; use util::resource_files::resources_dir_path;
use std::borrow::IntoCow; use std::borrow::IntoCow;
use std::old_io::fs::PathExtensions; use std::fs::PathExt;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
pub fn factory(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) { pub fn factory(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
@ -36,7 +36,7 @@ pub fn factory(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>
let mut path = resources_dir_path(); let mut path = resources_dir_path();
path.push("failure.html"); path.push("failure.html");
assert!(path.exists()); assert!(path.exists());
load_data.url = Url::from_file_path(&path).unwrap(); load_data.url = Url::from_file_path(&*path).unwrap();
} }
_ => { _ => {
start_sending(senders, Metadata::default(load_data.url)) start_sending(senders, Metadata::default(load_data.url))

View file

@ -93,7 +93,7 @@ impl CookieStorage {
// http://tools.ietf.org/html/rfc6265#section-5.4 // http://tools.ietf.org/html/rfc6265#section-5.4
pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> { pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> {
let filterer = |&:c: &&mut Cookie| -> bool { let filterer = |c: &&mut Cookie| -> bool {
info!(" === SENT COOKIE : {} {} {:?} {:?}", c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path); info!(" === SENT COOKIE : {} {} {:?} {:?}", c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path);
info!(" === SENT COOKIE RESULT {}", c.appropriate_for_url(url, source)); info!(" === SENT COOKIE RESULT {}", c.appropriate_for_url(url, source));
// Step 1 // Step 1
@ -104,7 +104,7 @@ impl CookieStorage {
let mut url_cookies: Vec<&mut Cookie> = self.cookies.iter_mut().filter(filterer).collect(); let mut url_cookies: Vec<&mut Cookie> = self.cookies.iter_mut().filter(filterer).collect();
url_cookies.sort_by(|a, b| CookieStorage::cookie_comparator(*a, *b)); url_cookies.sort_by(|a, b| CookieStorage::cookie_comparator(*a, *b));
let reducer = |&:acc: String, c: &mut &mut Cookie| -> String { let reducer = |acc: String, c: &mut &mut Cookie| -> String {
// Step 3 // Step 3
c.touch(); c.touch();

View file

@ -19,7 +19,7 @@ use hyper::net::HttpConnector;
use hyper::status::{StatusCode, StatusClass}; use hyper::status::{StatusCode, StatusClass};
use std::error::Error; use std::error::Error;
use openssl::ssl::{SslContext, SslVerifyMode}; use openssl::ssl::{SslContext, SslVerifyMode};
use std::old_io::{IoError, IoErrorKind, Reader}; use std::io::{self, Read, Write};
use std::sync::mpsc::{Sender, channel}; use std::sync::mpsc::{Sender, channel};
use std::thunk::Invoke; use std::thunk::Invoke;
use util::task::spawn_named; use util::task::spawn_named;
@ -119,12 +119,14 @@ reason: \"certificate verify failed\" }]";
let mut req = match Request::with_connector(load_data.method.clone(), url.clone(), &mut connector) { let mut req = match Request::with_connector(load_data.method.clone(), url.clone(), &mut connector) {
Ok(req) => req, Ok(req) => req,
Err(HttpError::HttpIoError(IoError {kind: IoErrorKind::OtherIoError, Err(HttpError::HttpIoError(ref io_error)) if (
desc: "Error in OpenSSL", io_error.kind() == io::ErrorKind::Other &&
detail: Some(ref det)})) if det.as_slice() == ssl_err_string => { io_error.description() == "Error in OpenSSL" &&
io_error.detail() == Some(ssl_err_string.to_owned())
) => {
let mut image = resources_dir_path(); let mut image = resources_dir_path();
image.push("badcert.html"); image.push("badcert.html");
let load_data = LoadData::new(Url::from_file_path(&image).unwrap(), senders.eventual_consumer); let load_data = LoadData::new(Url::from_file_path(&*image).unwrap(), senders.eventual_consumer);
file_loader::factory(load_data, senders.immediate_consumer); file_loader::factory(load_data, senders.immediate_consumer);
return; return;
}, },
@ -186,7 +188,7 @@ reason: \"certificate verify failed\" }]";
}; };
match writer.write_all(&*data) { match writer.write_all(&*data) {
Err(e) => { Err(e) => {
send_error(url, e.desc.to_string(), senders); send_error(url, e.description().to_string(), senders);
return; return;
} }
_ => {} _ => {}
@ -301,7 +303,7 @@ reason: \"certificate verify failed\" }]";
unsafe { buf.set_len(1024); } unsafe { buf.set_len(1024); }
match response.read(buf.as_mut_slice()) { match response.read(buf.as_mut_slice()) {
Ok(len) => { Ok(len) if len > 0 => {
unsafe { buf.set_len(len); } unsafe { buf.set_len(len); }
if progress_chan.send(Payload(buf)).is_err() { if progress_chan.send(Payload(buf)).is_err() {
// The send errors when the receiver is out of scope, // The send errors when the receiver is out of scope,
@ -310,7 +312,7 @@ reason: \"certificate verify failed\" }]";
return; return;
} }
} }
Err(_) => { Ok(_) | Err(_) => {
let _ = progress_chan.send(Done(Ok(()))); let _ = progress_chan.send(Done(Ok(())));
break; break;
} }

View file

@ -24,7 +24,7 @@ pub struct ImageHolder<NodeAddress> {
local_image_cache: Arc<Mutex<LocalImageCache<NodeAddress>>>, local_image_cache: Arc<Mutex<LocalImageCache<NodeAddress>>>,
} }
impl<NodeAddress: Send> ImageHolder<NodeAddress> { impl<NodeAddress: Send + 'static> ImageHolder<NodeAddress> {
pub fn new(url: Url, local_image_cache: Arc<Mutex<LocalImageCache<NodeAddress>>>) pub fn new(url: Url, local_image_cache: Arc<Mutex<LocalImageCache<NodeAddress>>>)
-> ImageHolder<NodeAddress> { -> ImageHolder<NodeAddress> {
debug!("ImageHolder::new() {}", url.serialize()); debug!("ImageHolder::new() {}", url.serialize());

View file

@ -470,8 +470,8 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<Vec<u8>, ()>
pub fn spawn_listener<F, A>(f: F) -> Sender<A> pub fn spawn_listener<F, A>(f: F) -> Sender<A>
where F: FnOnce(Receiver<A>) + Send, where F: FnOnce(Receiver<A>) + Send + 'static,
A: Send A: Send + 'static
{ {
let (setup_chan, setup_port) = channel(); let (setup_chan, setup_port) = channel();
@ -566,7 +566,7 @@ mod tests {
} }
} }
fn mock_resource_task<T: Closure+Send>(on_load: Box<T>) -> ResourceTask { fn mock_resource_task<T: Closure + Send + 'static>(on_load: Box<T>) -> ResourceTask {
spawn_listener(move |port: Receiver<resource_task::ControlMsg>| { spawn_listener(move |port: Receiver<resource_task::ControlMsg>| {
loop { loop {
match port.recv().unwrap() { match port.recv().unwrap() {
@ -602,8 +602,8 @@ mod tests {
} }
#[test] #[test]
#[should_fail] #[should_panic]
fn should_fail_if_unprefetched_image_is_requested() { fn should_panic_if_unprefetched_image_is_requested() {
let mock_resource_task = mock_resource_task(box DoesNothing); let mock_resource_task = mock_resource_task(box DoesNothing);
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), profiler()); let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), profiler());

View file

@ -16,6 +16,8 @@
#![allow(missing_copy_implementations)] #![allow(missing_copy_implementations)]
#![plugin(regex_macros)]
extern crate "cookie" as cookie_rs; extern crate "cookie" as cookie_rs;
extern crate collections; extern crate collections;
extern crate geom; extern crate geom;
@ -30,8 +32,6 @@ extern crate stb_image;
extern crate time; extern crate time;
extern crate url; extern crate url;
#[plugin] #[no_link]
extern crate regex_macros;
extern crate regex; extern crate regex;
/// Image handling. /// Image handling.

View file

@ -47,7 +47,7 @@ struct ImageState {
last_response: ImageResponseMsg last_response: ImageResponseMsg
} }
impl<NodeAddress: Send> LocalImageCache<NodeAddress> { impl<NodeAddress: Send + 'static> LocalImageCache<NodeAddress> {
/// The local cache will only do a single remote request for a given /// The local cache will only do a single remote request for a given
/// URL in each 'round'. Layout should call this each time it begins /// URL in each 'round'. Layout should call this each time it begins
pub fn next_round(&mut self, on_image_available: Box<ImageResponder<NodeAddress> + Send>) { pub fn next_round(&mut self, on_image_available: Box<ImageResponder<NodeAddress> + Send>) {

View file

@ -38,7 +38,7 @@ use std::old_io::net::tcp::TcpListener;
static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None; static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None;
pub fn global_init() { pub fn global_init() {
if let Ok(host_file_path) = env::var_string("HOST_FILE") { if let Ok(host_file_path) = env::var("HOST_FILE") {
//TODO: handle bad file path //TODO: handle bad file path
let path = Path::new(host_file_path); let path = Path::new(host_file_path);
let mut file = BufferedReader::new(File::open(&path)); let mut file = BufferedReader::new(File::open(&path));
@ -241,7 +241,7 @@ pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>>
let address = ip_host[0].to_owned(); let address = ip_host[0].to_owned();
for token in ip_host.iter().skip(1) { for token in ip_host.iter().skip(1) {
if token[].as_bytes()[0] == b'#' { if token.as_bytes()[0] == b'#' {
break; break;
} }
host_table.insert(token.to_owned().to_string(), address.clone()); host_table.insert(token.to_owned().to_string(), address.clone());
@ -326,7 +326,7 @@ impl ResourceManager {
fn from_factory(factory: fn(LoadData, Sender<TargetedLoadResponse>)) fn from_factory(factory: fn(LoadData, Sender<TargetedLoadResponse>))
-> Box<Invoke<(LoadData, Sender<TargetedLoadResponse>)> + Send> { -> Box<Invoke<(LoadData, Sender<TargetedLoadResponse>)> + Send> {
box move |&:(load_data, start_chan)| { box move |(load_data, start_chan)| {
factory(load_data, start_chan) factory(load_data, start_chan)
} }
} }

View file

@ -48,7 +48,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
match (res, it.count()) { match (res, it.count()) {
(Some((s, span)), 0) => { (Some((s, span)), 0) => {
let new_s = s.chars().map(transform).collect::<String>(); let new_s = s.chars().map(transform).collect::<String>();
base::MacExpr::new(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice()))) base::MacEager::expr(cx.expr_str(span, token::intern_and_get_ident(new_s.as_slice())))
} }
(_, rest) => { (_, rest) => {
if rest > 0 { if rest > 0 {

View file

@ -34,7 +34,7 @@ pub fn expand_dom_struct(_: &mut ExtCtxt, _: Span, _: &MetaItem, item: P<Item>)
/// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable` /// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable`
/// ///
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method. /// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method.
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>)>) { pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: &Item, push: &mut FnMut(P<Item>)) {
let trait_def = TraitDef { let trait_def = TraitDef {
span: span, span: span,
attributes: Vec::new(), attributes: Vec::new(),

View file

@ -14,8 +14,6 @@
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)] #![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)]
#![allow(missing_copy_implementations)]
#[macro_use] #[macro_use]
extern crate syntax; extern crate syntax;
#[macro_use] #[macro_use]

View file

@ -41,8 +41,9 @@ impl LintPass for InheritancePass {
.map(|(_, f)| f.span); .map(|(_, f)| f.span);
// Find all #[dom_struct] fields // Find all #[dom_struct] fields
let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| { let dom_spans: Vec<_> = def.fields.iter().enumerate().filter_map(|(ctr, f)| {
if let ast::TyPath(_, ty_id) = f.node.ty.node { if let ast::TyPath(..) = f.node.ty.node {
if let Some(def::DefTy(def_id, _)) = cx.tcx.def_map.borrow().get(&ty_id).cloned() { if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") { if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") {
// If the field is not the first, it's probably // If the field is not the first, it's probably
// being misused (a) // being misused (a)

View file

@ -26,7 +26,7 @@ impl LintPass for TransmutePass {
match ex.node { match ex.node {
ast::ExprCall(ref expr, ref args) => { ast::ExprCall(ref expr, ref args) => {
match expr.node { match expr.node {
ast::ExprPath(ref path) => { ast::ExprPath(_, ref path) => {
if path.segments.last() if path.segments.last()
.map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute") .map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute")
&& args.len() == 1 { && args.len() == 1 {

View file

@ -33,9 +33,9 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
match ty.node { match ty.node {
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) | ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning), ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
ast::TyPath(_, id) => { ast::TyPath(..) => {
match cx.tcx.def_map.borrow()[id].clone() { match cx.tcx.def_map.borrow()[ty.id] {
def::DefTy(def_id, _) => { def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
if ty::has_attr(cx.tcx, def_id, "must_root") { if ty::has_attr(cx.tcx, def_id, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning); cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
} }

View file

@ -10,7 +10,7 @@ use syntax::ast;
use utils::match_ty_unwrap; use utils::match_ty_unwrap;
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, mut push: Box<FnMut(P<Item>) -> ()>) { pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, item: &Item, push: &mut FnMut(P<Item>) -> ()) {
if let ast::ItemStruct(ref def, _) = item.node { if let ast::ItemStruct(ref def, _) = item.node {
let struct_name = item.ident; let struct_name = item.ident;
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time // This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time

View file

@ -16,7 +16,7 @@ use syntax::attr::mark_used;
/// Try not to use this for types defined in crates you own, use match_lang_ty instead (for lint passes) /// Try not to use this for types defined in crates you own, use match_lang_ty instead (for lint passes)
pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> { pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> {
match ty.node { match ty.node {
TyPath(Path {segments: ref seg, ..}, _) => { TyPath(_, Path {segments: ref seg, ..}) => {
// So ast::Path isn't the full path, just the tokens that were provided. // So ast::Path isn't the full path, just the tokens that were provided.
// I could muck around with the maps and find the full path // I could muck around with the maps and find the full path
// however the more efficient way is to simply reverse the iterators and zip them // however the more efficient way is to simply reverse the iterators and zip them
@ -38,13 +38,13 @@ pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]>
/// Checks if a type has a #[servo_lang = "str"] attribute /// Checks if a type has a #[servo_lang = "str"] attribute
pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
let ty_id = match ty.node { match ty.node {
TyPath(_, ty_id) => ty_id, TyPath(..) => {},
_ => return false, _ => return false,
}; }
let def_id = match cx.tcx.def_map.borrow().get(&ty_id).cloned() { let def_id = match cx.tcx.def_map.borrow().get(&ty.id) {
Some(def::DefTy(def_id, _)) => def_id, Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) => def_id,
_ => return false, _ => return false,
}; };

View file

@ -51,10 +51,6 @@ git = "https://github.com/servo/rust-geom"
[dependencies.html5ever] [dependencies.html5ever]
git = "https://github.com/servo/html5ever" git = "https://github.com/servo/html5ever"
[dependencies.hyper]
git = "https://github.com/servo/hyper"
branch = "servo"
[dependencies.js] [dependencies.js]
git = "https://github.com/servo/rust-mozjs" git = "https://github.com/servo/rust-mozjs"
@ -64,7 +60,7 @@ git = "https://github.com/rust-lang/uuid"
[dependencies.string_cache] [dependencies.string_cache]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros] [dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies] [dependencies]
@ -74,3 +70,4 @@ time = "0.1.12"
bitflags = "*" bitflags = "*"
rustc-serialize = "*" rustc-serialize = "*"
libc = "*" libc = "*"
hyper = "0.3"

View file

@ -54,11 +54,12 @@ use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue};
use libc; use libc;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::default; use std::default;
use std::marker::MarkerTrait;
use std::slice; use std::slice;
/// A trait to retrieve the constants necessary to check if a `JSObject` /// A trait to retrieve the constants necessary to check if a `JSObject`
/// implements a given interface. /// implements a given interface.
pub trait IDLInterface { pub trait IDLInterface: MarkerTrait {
/// Returns the prototype ID. /// Returns the prototype ID.
fn get_prototype_id() -> PrototypeList::ID; fn get_prototype_id() -> PrototypeList::ID;
/// Returns the prototype depth, i.e., the number of interfaces this /// Returns the prototype depth, i.e., the number of interfaces this
@ -74,6 +75,7 @@ pub trait ToJSValConvertible {
/// A trait to convert `JSVal`s to Rust types. /// A trait to convert `JSVal`s to Rust types.
pub trait FromJSValConvertible { pub trait FromJSValConvertible {
/// Optional configurable behaviour switch; use () for no configuration.
type Config; type Config;
/// Convert `val` to type `Self`. /// Convert `val` to type `Self`.
/// Optional configuration of type `T` can be passed as the `option` /// Optional configuration of type `T` can be passed as the `option`

View file

@ -62,7 +62,7 @@ use util::smallvec::{SmallVec, SmallVec16};
use core::nonzero::NonZero; use core::nonzero::NonZero;
use std::cell::{Cell, UnsafeCell}; use std::cell::{Cell, UnsafeCell};
use std::default::Default; use std::default::Default;
use std::marker::ContravariantLifetime; use std::marker::PhantomData;
use std::mem; use std::mem;
use std::ops::Deref; use std::ops::Deref;
@ -677,7 +677,7 @@ impl<T: Reflectable> Root<T> {
pub fn r<'b>(&'b self) -> JSRef<'b, T> { pub fn r<'b>(&'b self) -> JSRef<'b, T> {
JSRef { JSRef {
ptr: self.ptr, ptr: self.ptr,
chain: ContravariantLifetime, chain: PhantomData,
} }
} }
@ -688,7 +688,7 @@ impl<T: Reflectable> Root<T> {
pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> { pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> {
JSRef { JSRef {
ptr: self.ptr, ptr: self.ptr,
chain: ContravariantLifetime, chain: PhantomData,
} }
} }
} }
@ -713,7 +713,7 @@ impl<'a, T: Reflectable> Deref for JSRef<'a, T> {
/// copyable. /// copyable.
pub struct JSRef<'a, T> { pub struct JSRef<'a, T> {
ptr: NonZero<*const T>, ptr: NonZero<*const T>,
chain: ContravariantLifetime<'a>, chain: PhantomData<&'a ()>,
} }
impl<'a, T> Copy for JSRef<'a, T> {} impl<'a, T> Copy for JSRef<'a, T> {}

View file

@ -32,6 +32,7 @@ use libc;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::hash_map::HashMap; use std::collections::hash_map::HashMap;
use std::collections::hash_map::Entry::{Vacant, Occupied}; use std::collections::hash_map::Entry::{Vacant, Occupied};
use std::marker::PhantomData;
use std::rc::Rc; use std::rc::Rc;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
@ -53,6 +54,7 @@ pub struct Trusted<T> {
refcount: Arc<Mutex<usize>>, refcount: Arc<Mutex<usize>>,
script_chan: Box<ScriptChan + Send>, script_chan: Box<ScriptChan + Send>,
owner_thread: *const libc::c_void, owner_thread: *const libc::c_void,
phantom: PhantomData<T>,
} }
unsafe impl<T: Reflectable> Send for Trusted<T> {} unsafe impl<T: Reflectable> Send for Trusted<T> {}
@ -71,6 +73,7 @@ impl<T: Reflectable> Trusted<T> {
refcount: refcount, refcount: refcount,
script_chan: script_chan.clone(), script_chan: script_chan.clone(),
owner_thread: (&*live_references) as *const _ as *const libc::c_void, owner_thread: (&*live_references) as *const _ as *const libc::c_void,
phantom: PhantomData,
} }
}) })
} }
@ -102,6 +105,7 @@ impl<T: Reflectable> Clone for Trusted<T> {
refcount: self.refcount.clone(), refcount: self.refcount.clone(),
script_chan: self.script_chan.clone(), script_chan: self.script_chan.clone(),
owner_thread: self.owner_thread, owner_thread: self.owner_thread,
phantom: PhantomData,
} }
} }
} }

View file

@ -5,7 +5,7 @@
//! The `ByteString` struct. //! The `ByteString` struct.
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::hash::{Hash, SipHasher}; use std::hash::{Hash, Hasher};
use std::str; use std::str;
use std::str::FromStr; use std::str::FromStr;
@ -144,8 +144,8 @@ impl ByteString {
} }
} }
impl Hash<SipHasher> for ByteString { impl Hash for ByteString {
fn hash(&self, state: &mut SipHasher) { fn hash<H: Hasher>(&self, state: &mut H) {
let ByteString(ref vec) = *self; let ByteString(ref vec) = *self;
vec.hash(state); vec.hash(state);
} }

View file

@ -184,10 +184,10 @@ impl<T: JSTraceable> JSTraceable for Option<T> {
} }
impl<K,V,S> JSTraceable for HashMap<K, V, S> impl<K,V,S> JSTraceable for HashMap<K, V, S>
where K: Hash<<S as HashState>::Hasher> + Eq + JSTraceable, where K: Hash + Eq + JSTraceable,
V: JSTraceable, V: JSTraceable,
S: HashState, S: HashState,
<S as HashState>::Hasher: Hasher<Output=u64>, <S as HashState>::Hasher: Hasher,
{ {
#[inline] #[inline]
fn trace(&self, trc: *mut JSTracer) { fn trace(&self, trc: *mut JSTracer) {

View file

@ -577,7 +577,10 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
debug!("outerizing"); debug!("outerizing");
let obj = *obj.unnamed_field1; let obj = *obj.unnamed_field1;
let win: Root<window::Window> = native_from_reflector_jsmanaged(obj).unwrap().root(); let win: Root<window::Window> = native_from_reflector_jsmanaged(obj).unwrap().root();
win.r().browser_context().as_ref().unwrap().window_proxy() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let win = win.r();
let context = win.browser_context();
context.as_ref().unwrap().window_proxy()
} }
} }

View file

@ -68,7 +68,9 @@ impl CharacterData {
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> { impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
fn Data(self) -> DOMString { fn Data(self) -> DOMString {
self.data.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
data.clone()
} }
fn SetData(self, arg: DOMString) -> ErrorResult { fn SetData(self, arg: DOMString) -> ErrorResult {
@ -77,11 +79,15 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
} }
fn Length(self) -> u32 { fn Length(self) -> u32 {
self.data.borrow().chars().count() as u32 // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
data.chars().count() as u32
} }
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> { fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
Ok(self.data.borrow().slice_chars(offset as usize, (offset + count) as usize).to_owned()) // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
Ok(data.slice_chars(offset as usize, (offset + count) as usize).to_owned())
} }
fn AppendData(self, arg: DOMString) -> ErrorResult { fn AppendData(self, arg: DOMString) -> ErrorResult {

View file

@ -188,9 +188,11 @@ pub trait DedicatedWorkerGlobalScopeHelpers {
impl<'a> DedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerGlobalScope> { impl<'a> DedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerGlobalScope> {
fn script_chan(self) -> Box<ScriptChan+Send> { fn script_chan(self) -> Box<ScriptChan+Send> {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let worker = self.worker.borrow();
box SendableWorkerScriptChan { box SendableWorkerScriptChan {
sender: self.own_sender.clone(), sender: self.own_sender.clone(),
worker: self.worker.borrow().as_ref().unwrap().clone(), worker: worker.as_ref().unwrap().clone(),
} }
} }
} }

View file

@ -365,10 +365,13 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document /// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
fn find_fragment_node(self, fragid: DOMString) -> Option<Temporary<Element>> { fn find_fragment_node(self, fragid: DOMString) -> Option<Temporary<Element>> {
self.GetElementById(fragid.clone()).or_else(|| { self.GetElementById(fragid.clone()).or_else(|| {
let check_anchor = |&:&node: &JSRef<HTMLAnchorElement>| { let check_anchor = |&node: &JSRef<HTMLAnchorElement>| {
let elem: JSRef<Element> = ElementCast::from_ref(node); let elem: JSRef<Element> = ElementCast::from_ref(node);
elem.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| { elem.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
attr.r().value().as_slice() == fragid.as_slice() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.as_slice() == fragid.as_slice()
}) })
}; };
let doc_node: JSRef<Node> = NodeCast::from_ref(self); let doc_node: JSRef<Node> = NodeCast::from_ref(self);
@ -461,7 +464,10 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
/// Sends this document's title to the compositor. /// Sends this document's title to the compositor.
fn send_title_to_compositor(self) { fn send_title_to_compositor(self) {
let window = self.window().root(); let window = self.window().root();
window.r().compositor().set_title(window.r().pipeline(), Some(self.Title())); // FIXME(https://github.com/rust-lang/rust/issues/23338)
let window = window.r();
let mut compositor = window.compositor();
compositor.set_title(window.pipeline(), Some(self.Title()));
} }
fn dirty_all_nodes(self) { fn dirty_all_nodes(self) {
@ -843,12 +849,16 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-document-characterset // http://dom.spec.whatwg.org/#dom-document-characterset
fn CharacterSet(self) -> DOMString { fn CharacterSet(self) -> DOMString {
self.encoding_name.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let encoding_name = self.encoding_name.borrow();
encoding_name.clone()
} }
// http://dom.spec.whatwg.org/#dom-document-inputencoding // http://dom.spec.whatwg.org/#dom-document-inputencoding
fn InputEncoding(self) -> DOMString { fn InputEncoding(self) -> DOMString {
self.encoding_name.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let encoding_name = self.encoding_name.borrow();
encoding_name.clone()
} }
// http://dom.spec.whatwg.org/#dom-document-content_type // http://dom.spec.whatwg.org/#dom-document-content_type
@ -893,7 +903,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid // http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> { fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> {
let id = Atom::from_slice(id.as_slice()); let id = Atom::from_slice(id.as_slice());
match self.idmap.borrow().get(&id) { // FIXME(https://github.com/rust-lang/rust/issues/23338)
let idmap = self.idmap.borrow();
match idmap.get(&id) {
None => None, None => None,
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())), Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
} }
@ -1218,7 +1230,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
None => return false, None => return false,
}; };
element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| { element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
attr.r().value().as_slice() == name.as_slice() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.as_slice() == name.as_slice()
}) })
}) })
} }

View file

@ -67,15 +67,23 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
// http://dom.spec.whatwg.org/#dom-domtokenlist-length // http://dom.spec.whatwg.org/#dom-domtokenlist-length
fn Length(self) -> u32 { fn Length(self) -> u32 {
self.attribute().root().map(|attr| { self.attribute().root().map(|attr| {
attr.r().value().tokens().map(|tokens| tokens.len()).unwrap_or(0) // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.tokens().map(|tokens| tokens.len()).unwrap_or(0)
}).unwrap_or(0) as u32 }).unwrap_or(0) as u32
} }
// http://dom.spec.whatwg.org/#dom-domtokenlist-item // http://dom.spec.whatwg.org/#dom-domtokenlist-item
fn Item(self, index: u32) -> Option<DOMString> { fn Item(self, index: u32) -> Option<DOMString> {
self.attribute().root().and_then(|attr| attr.r().value().tokens().and_then(|tokens| { self.attribute().root().and_then(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.tokens().and_then(|tokens| {
tokens.get(index as usize).map(|token| token.as_slice().to_owned()) tokens.get(index as usize).map(|token| token.as_slice().to_owned())
})) })
})
} }
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> { fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
@ -88,9 +96,10 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
fn Contains(self, token: DOMString) -> Fallible<bool> { fn Contains(self, token: DOMString) -> Fallible<bool> {
self.check_token_exceptions(token.as_slice()).map(|token| { self.check_token_exceptions(token.as_slice()).map(|token| {
self.attribute().root().map(|attr| { self.attribute().root().map(|attr| {
attr.r() // FIXME(https://github.com/rust-lang/rust/issues/23338)
.value() let attr = attr.r();
.tokens() let value = attr.value();
value.tokens()
.expect("Should have parsed this attribute") .expect("Should have parsed this attribute")
.iter() .iter()
.any(|atom| *atom == token) .any(|atom| *atom == token)

View file

@ -618,9 +618,14 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
} }
fn get_attributes(self, local_name: &Atom) -> Vec<Temporary<Attr>> { fn get_attributes(self, local_name: &Atom) -> Vec<Temporary<Attr>> {
self.attrs.borrow().iter().map(|attr| attr.root()).filter_map(|attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338)
if *attr.r().local_name() == *local_name { let attrs = self.attrs.borrow();
Some(Temporary::from_rooted(attr.r())) attrs.iter().map(|attr| attr.root()).filter_map(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let attr_local_name = attr.local_name();
if *attr_local_name == *local_name {
Some(Temporary::from_rooted(attr))
} else { } else {
None None
} }
@ -746,12 +751,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
let owner_doc = node.owner_doc().root(); let owner_doc = node.owner_doc().root();
owner_doc.r().quirks_mode() owner_doc.r().quirks_mode()
}; };
let is_equal = |&:lhs: &Atom, rhs: &Atom| match quirks_mode { let is_equal = |lhs: &Atom, rhs: &Atom| match quirks_mode {
NoQuirks | LimitedQuirks => lhs == rhs, NoQuirks | LimitedQuirks => lhs == rhs,
Quirks => lhs.as_slice().eq_ignore_ascii_case(rhs.as_slice()) Quirks => lhs.as_slice().eq_ignore_ascii_case(rhs.as_slice())
}; };
self.get_attribute(ns!(""), &atom!("class")).root().map(|attr| { self.get_attribute(ns!(""), &atom!("class")).root().map(|attr| {
attr.r().value().tokens().map(|tokens| { // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.tokens().map(|tokens| {
tokens.iter().any(|atom| is_equal(name, atom)) tokens.iter().any(|atom| is_equal(name, atom))
}).unwrap_or(false) }).unwrap_or(false)
}).unwrap_or(false) }).unwrap_or(false)
@ -764,9 +772,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
} }
fn has_attribute(self, name: &Atom) -> bool { fn has_attribute(self, name: &Atom) -> bool {
assert!(name.as_slice().bytes().all(|&:b| b.to_ascii_lowercase() == b)); assert!(name.as_slice().bytes().all(|b| b.to_ascii_lowercase() == b));
self.attrs.borrow().iter().map(|attr| attr.root()).any(|attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338)
*attr.r().local_name() == *name && *attr.r().namespace() == ns!("") let attrs = self.attrs.borrow();
attrs.iter().map(|attr| attr.root()).any(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let local_name = attr.local_name();
let namespace = attr.namespace();
*local_name == *name && *namespace == ns!("")
}) })
} }
@ -811,9 +825,10 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
fn get_tokenlist_attribute(self, name: &Atom) -> Vec<Atom> { fn get_tokenlist_attribute(self, name: &Atom) -> Vec<Atom> {
self.get_attribute(ns!(""), name).root().map(|attr| { self.get_attribute(ns!(""), name).root().map(|attr| {
attr.r() // FIXME(https://github.com/rust-lang/rust/issues/23338)
.value() let attr = attr.r();
.tokens() let value = attr.value();
value.tokens()
.expect("Expected a TokenListAttrValue") .expect("Expected a TokenListAttrValue")
.to_vec() .to_vec()
}).unwrap_or(vec!()) }).unwrap_or(vec!())
@ -1328,14 +1343,20 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> { fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| { self.get_attribute(namespace.clone(), attr).root().map(|attr| {
// This transmute is used to cheat the lifetime restriction. // This transmute is used to cheat the lifetime restriction.
unsafe { mem::transmute(attr.r().value().as_slice()) } // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
unsafe { mem::transmute(value.as_slice()) }
}) })
} }
#[allow(unsafe_blocks)] #[allow(unsafe_blocks)]
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> { fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| { self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
// This transmute is used to cheat the lifetime restriction. // This transmute is used to cheat the lifetime restriction.
unsafe { mem::transmute(attr.r().value().as_slice()) } unsafe { mem::transmute(value.as_slice()) }
}).collect() }).collect()
} }
fn get_link(self) -> Option<&'a str> { fn get_link(self) -> Option<&'a str> {
@ -1375,7 +1396,10 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
fn get_id(self) -> Option<Atom> { fn get_id(self) -> Option<Atom> {
self.get_attribute(ns!(""), &atom!("id")).map(|attr| { self.get_attribute(ns!(""), &atom!("id")).map(|attr| {
let attr = attr.root(); let attr = attr.root();
match *attr.r().value() { // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
match *value {
AttrValue::Atom(ref val) => val.clone(), AttrValue::Atom(ref val) => val.clone(),
_ => panic!("`id` attribute should be AttrValue::Atom"), _ => panic!("`id` attribute should be AttrValue::Atom"),
} }

View file

@ -68,12 +68,14 @@ impl ErrorEvent {
let event: JSRef<Event> = EventCast::from_ref(ev.r()); let event: JSRef<Event> = EventCast::from_ref(ev.r());
event.InitEvent(type_, bubbles == EventBubbles::Bubbles, event.InitEvent(type_, bubbles == EventBubbles::Bubbles,
cancelable == EventCancelable::Cancelable); cancelable == EventCancelable::Cancelable);
*ev.r().message.borrow_mut() = message; // FIXME(https://github.com/rust-lang/rust/issues/23338)
*ev.r().filename.borrow_mut() = filename; let ev = ev.r();
ev.r().lineno.set(lineno); *ev.message.borrow_mut() = message;
ev.r().colno.set(colno); *ev.filename.borrow_mut() = filename;
ev.r().error.set(error); ev.lineno.set(lineno);
Temporary::from_rooted(ev.r()) ev.colno.set(colno);
ev.error.set(error);
Temporary::from_rooted(ev)
} }
pub fn Constructor(global: GlobalRef, pub fn Constructor(global: GlobalRef,
@ -116,11 +118,15 @@ impl<'a> ErrorEventMethods for JSRef<'a, ErrorEvent> {
} }
fn Message(self) -> DOMString { fn Message(self) -> DOMString {
self.message.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let message = self.message.borrow();
message.clone()
} }
fn Filename(self) -> DOMString { fn Filename(self) -> DOMString {
self.filename.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let filename = self.filename.borrow();
filename.clone()
} }
fn Error(self, _cx: *mut JSContext) -> JSVal { fn Error(self, _cx: *mut JSContext) -> JSVal {

View file

@ -178,7 +178,9 @@ impl<'a> EventMethods for JSRef<'a, Event> {
} }
fn Type(self) -> DOMString { fn Type(self) -> DOMString {
self.type_.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let type_ = self.type_.borrow();
type_.clone()
} }
fn GetTarget(self) -> Option<Temporary<EventTarget>> { fn GetTarget(self) -> Option<Temporary<EventTarget>> {

View file

@ -245,7 +245,9 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
} }
fn has_handlers(self) -> bool { fn has_handlers(self) -> bool {
!self.handlers.borrow().is_empty() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let handlers = self.handlers.borrow();
!handlers.is_empty()
} }
} }

View file

@ -84,8 +84,10 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
#[allow(unsafe_blocks)] #[allow(unsafe_blocks)]
fn Get(self, name: DOMString) -> Option<FileOrString> { fn Get(self, name: DOMString) -> Option<FileOrString> {
if self.data.borrow().contains_key(&name) { // FIXME(https://github.com/rust-lang/rust/issues/23338)
match (*self.data.borrow())[name][0].clone() { let data = self.data.borrow();
if data.contains_key(&name) {
match data[name][0].clone() {
FormDatum::StringData(ref s) => Some(eString(s.clone())), FormDatum::StringData(ref s) => Some(eString(s.clone())),
FormDatum::FileData(ref f) => { FormDatum::FileData(ref f) => {
Some(eFile(Unrooted::from_js(*f))) Some(eFile(Unrooted::from_js(*f)))
@ -97,7 +99,9 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
} }
fn Has(self, name: DOMString) -> bool { fn Has(self, name: DOMString) -> bool {
self.data.borrow().contains_key(&name) // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
data.contains_key(&name)
} }
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) { fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {

View file

@ -229,7 +229,7 @@ impl<'a> Activatable for JSRef<'a, HTMLButtonElement> {
h h
}) })
.find(|r| r.form_owner() == owner) .find(|r| r.form_owner() == owner)
.map(|&:s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey)); .map(|s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
} }
} }
} }

View file

@ -32,6 +32,7 @@ use util::str::DOMString;
use string_cache::Atom; use string_cache::Atom;
use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::default::Default; use std::default::Default;
@ -161,7 +162,7 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> {
fn set_custom_attr(self, name: DOMString, value: DOMString) -> ErrorResult { fn set_custom_attr(self, name: DOMString, value: DOMString) -> ErrorResult {
if name.as_slice().chars() if name.as_slice().chars()
.skip_while(|&ch| ch != '\u{2d}') .skip_while(|&ch| ch != '\u{2d}')
.nth(1).map_or(false, |ch| ch as u8 - b'a' < 26) { .nth(1).map_or(false, |ch| ch >= 'a' && ch <= 'z') {
return Err(Syntax); return Err(Syntax);
} }
let element: JSRef<Element> = ElementCast::from_ref(self); let element: JSRef<Element> = ElementCast::from_ref(self);
@ -172,7 +173,10 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> {
let element: JSRef<Element> = ElementCast::from_ref(self); let element: JSRef<Element> = ElementCast::from_ref(self);
element.get_attribute(ns!(""), &Atom::from_slice(to_snake_case(name).as_slice())).map(|attr| { element.get_attribute(ns!(""), &Atom::from_slice(to_snake_case(name).as_slice())).map(|attr| {
let attr = attr.root(); let attr = attr.root();
attr.r().value().as_slice().to_owned() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.as_slice().to_owned()
}) })
} }

View file

@ -238,7 +238,9 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value // https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
fn Value(self) -> DOMString { fn Value(self) -> DOMString {
self.textinput.borrow().get_content() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let textinput = self.textinput.borrow();
textinput.get_content()
} }
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value // https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
@ -781,7 +783,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
h h
}) })
.find(|r| r.form_owner() == owner) .find(|r| r.form_owner() == owner)
.map(|&:s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey)); .map(|s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
} }
} }
} }

View file

@ -59,7 +59,12 @@ impl HTMLLinkElement {
fn get_attr(element: JSRef<Element>, name: &Atom) -> Option<String> { fn get_attr(element: JSRef<Element>, name: &Atom) -> Option<String> {
let elem = element.get_attribute(ns!(""), name).root(); let elem = element.get_attribute(ns!(""), name).root();
elem.map(|e| e.r().value().as_slice().to_owned()) elem.map(|e| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let e = e.r();
let value = e.value();
value.as_slice().to_owned()
})
} }
fn is_stylesheet(value: &Option<String>) -> bool { fn is_stylesheet(value: &Option<String>) -> bool {

View file

@ -177,7 +177,9 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value
fn Value(self) -> DOMString { fn Value(self) -> DOMString {
self.textinput.borrow().get_content() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let textinput = self.textinput.borrow();
textinput.get_content()
} }
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value

View file

@ -85,15 +85,17 @@ impl KeyboardEvent {
let ev = KeyboardEvent::new_uninitialized(window).root(); let ev = KeyboardEvent::new_uninitialized(window).root();
ev.r().InitKeyboardEvent(type_, canBubble, cancelable, view, key, location, ev.r().InitKeyboardEvent(type_, canBubble, cancelable, view, key, location,
"".to_owned(), repeat, "".to_owned()); "".to_owned(), repeat, "".to_owned());
*ev.r().code.borrow_mut() = code; // FIXME(https://github.com/rust-lang/rust/issues/23338)
ev.r().ctrl.set(ctrlKey); let ev = ev.r();
ev.r().alt.set(altKey); *ev.code.borrow_mut() = code;
ev.r().shift.set(shiftKey); ev.ctrl.set(ctrlKey);
ev.r().meta.set(metaKey); ev.alt.set(altKey);
ev.r().char_code.set(char_code); ev.shift.set(shiftKey);
ev.r().key_code.set(key_code); ev.meta.set(metaKey);
ev.r().is_composing.set(isComposing); ev.char_code.set(char_code);
Temporary::from_rooted(ev.r()) ev.key_code.set(key_code);
ev.is_composing.set(isComposing);
Temporary::from_rooted(ev)
} }
pub fn Constructor(global: GlobalRef, pub fn Constructor(global: GlobalRef,
@ -571,11 +573,15 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> {
} }
fn Key(self) -> DOMString { fn Key(self) -> DOMString {
self.key.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let key = self.key.borrow();
key.clone()
} }
fn Code(self) -> DOMString { fn Code(self) -> DOMString {
self.code.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let code = self.code.borrow();
code.clone()
} }
fn Location(self) -> u32 { fn Location(self) -> u32 {

View file

@ -33,11 +33,19 @@ impl NamedNodeMap {
impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> { impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> {
fn Length(self) -> u32 { fn Length(self) -> u32 {
self.owner.root().r().attrs().len() as u32 let owner = self.owner.root();
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let owner = owner.r();
let attrs = owner.attrs();
attrs.len() as u32
} }
fn Item(self, index: u32) -> Option<Temporary<Attr>> { fn Item(self, index: u32) -> Option<Temporary<Attr>> {
self.owner.root().r().attrs().as_slice().get(index as uint).map(|x| Temporary::new(x.clone())) let owner = self.owner.root();
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let owner = owner.r();
let attrs = owner.attrs();
attrs.as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
} }
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> { fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> {

View file

@ -856,7 +856,9 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
} }
fn get_unique_id(self) -> String { fn get_unique_id(self) -> String {
self.unique_id.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let id = self.unique_id.borrow();
id.clone()
} }
fn summarize(self) -> NodeInfo { fn summarize(self) -> NodeInfo {
@ -865,8 +867,10 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
*unique_id = uuid::Uuid::new_v4().to_simple_string(); *unique_id = uuid::Uuid::new_v4().to_simple_string();
} }
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let unique_id = self.unique_id.borrow();
NodeInfo { NodeInfo {
uniqueId: self.unique_id.borrow().clone(), uniqueId: unique_id.clone(),
baseURI: self.GetBaseURI().unwrap_or("".to_owned()), baseURI: self.GetBaseURI().unwrap_or("".to_owned()),
parent: self.GetParentNode().root().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()), parent: self.GetParentNode().root().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
nodeType: self.NodeType() as uint, nodeType: self.NodeType() as uint,
@ -1122,7 +1126,7 @@ impl NodeIterator {
} }
fn next_child<'b>(&self, node: JSRef<'b, Node>) -> Option<JSRef<'b, Node>> { fn next_child<'b>(&self, node: JSRef<'b, Node>) -> Option<JSRef<'b, Node>> {
let skip = |&:element: JSRef<Element>| { let skip = |element: JSRef<Element>| {
!self.include_descendants_of_void && element.is_void() !self.include_descendants_of_void && element.is_void()
}; };
@ -1163,10 +1167,10 @@ impl<'a> Iterator for NodeIterator {
.expect("Got to root without reaching start node") .expect("Got to root without reaching start node")
.root() .root()
.get_unsound_ref_forever(); .get_unsound_ref_forever();
self.depth -= 1;
if JS::from_rooted(candidate) == self.start_node { if JS::from_rooted(candidate) == self.start_node {
break; break;
} }
self.depth -= 1;
} }
if JS::from_rooted(candidate) != self.start_node { if JS::from_rooted(candidate) != self.start_node {
candidate.next_sibling().map(|node| JS::from_rooted(node.root().r())) candidate.next_sibling().map(|node| JS::from_rooted(node.root().r()))
@ -2058,13 +2062,18 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool { fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap(); let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
let other_characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(other).unwrap(); let other_characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(other).unwrap();
*characterdata.data() == *other_characterdata.data() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let own_data = characterdata.data();
let other_data = other_characterdata.data();
*own_data == *other_data
} }
fn is_equal_element_attrs(node: JSRef<Node>, other: JSRef<Node>) -> bool { fn is_equal_element_attrs(node: JSRef<Node>, other: JSRef<Node>) -> bool {
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap(); let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
let other_element: JSRef<Element> = ElementCast::to_ref(other).unwrap(); let other_element: JSRef<Element> = ElementCast::to_ref(other).unwrap();
assert!(element.attrs().len() == other_element.attrs().len()); assert!(element.attrs().len() == other_element.attrs().len());
element.attrs().iter().map(|attr| attr.root()).all(|attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338)
let attrs = element.attrs();
attrs.iter().map(|attr| attr.root()).all(|attr| {
other_element.attrs().iter().map(|attr| attr.root()).any(|other_attr| { other_element.attrs().iter().map(|attr| attr.root()).any(|other_attr| {
(*attr.r().namespace() == *other_attr.r().namespace()) && (*attr.r().namespace() == *other_attr.r().namespace()) &&
(attr.r().local_name() == other_attr.r().local_name()) && (attr.r().local_name() == other_attr.r().local_name()) &&
@ -2217,7 +2226,9 @@ impl<'a> VirtualMethods for JSRef<'a, Node> {
} }
} }
impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> { impl<'a> style::node::TNode<'a> for JSRef<'a, Node> {
type Element = JSRef<'a, Element>;
fn parent_node(self) -> Option<JSRef<'a, Node>> { fn parent_node(self) -> Option<JSRef<'a, Node>> {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way // FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods. // of disambiguating methods.
@ -2305,12 +2316,22 @@ impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
match attr.namespace { match attr.namespace {
NamespaceConstraint::Specific(ref ns) => { NamespaceConstraint::Specific(ref ns) => {
self.as_element().get_attribute(ns.clone(), name).root() self.as_element().get_attribute(ns.clone(), name).root()
.map_or(false, |attr| test(attr.r().value().as_slice())) .map_or(false, |attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
test(value.as_slice())
})
}, },
NamespaceConstraint::Any => { NamespaceConstraint::Any => {
self.as_element().get_attributes(name).into_iter() self.as_element().get_attributes(name).into_iter()
.map(|attr| attr.root()) .map(|attr| attr.root())
.any(|attr| test(attr.r().value().as_slice())) .any(|attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
test(value.as_slice())
})
} }
} }
} }

View file

@ -344,7 +344,7 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> {
} }
} }
pub trait TreeWalkerHelpers<'a> { pub trait TreeWalkerHelpers {
fn parent_node(self) -> Fallible<Option<Temporary<Node>>>; fn parent_node(self) -> Fallible<Option<Temporary<Node>>>;
fn first_child(self) -> Fallible<Option<Temporary<Node>>>; fn first_child(self) -> Fallible<Option<Temporary<Node>>>;
fn last_child(self) -> Fallible<Option<Temporary<Node>>>; fn last_child(self) -> Fallible<Option<Temporary<Node>>>;
@ -354,7 +354,7 @@ pub trait TreeWalkerHelpers<'a> {
fn prev_node(self) -> Fallible<Option<Temporary<Node>>>; fn prev_node(self) -> Fallible<Option<Temporary<Node>>>;
} }
impl<'a> TreeWalkerHelpers<'a> for JSRef<'a, TreeWalker> { impl<'a> TreeWalkerHelpers for JSRef<'a, TreeWalker> {
// http://dom.spec.whatwg.org/#dom-treewalker-parentnode // http://dom.spec.whatwg.org/#dom-treewalker-parentnode
fn parent_node(self) -> Fallible<Option<Temporary<Node>>> { fn parent_node(self) -> Fallible<Option<Temporary<Node>>> {
// "1. Let node be the value of the currentNode attribute." // "1. Let node be the value of the currentNode attribute."

View file

@ -53,7 +53,10 @@ impl URLSearchParams {
let u = u.root(); let u = u.root();
let usp = usp.r(); let usp = usp.r();
let mut map = usp.data.borrow_mut(); let mut map = usp.data.borrow_mut();
*map = u.r().data.borrow().clone(); // FIXME(https://github.com/rust-lang/rust/issues/23338)
let r = u.r();
let data = r.data.borrow();
*map = data.clone();
}, },
None => {} None => {}
} }
@ -81,11 +84,15 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
} }
fn Get(self, name: DOMString) -> Option<DOMString> { fn Get(self, name: DOMString) -> Option<DOMString> {
self.data.borrow().get(&name).map(|v| v[0].clone()) // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
data.get(&name).map(|v| v[0].clone())
} }
fn Has(self, name: DOMString) -> bool { fn Has(self, name: DOMString) -> bool {
self.data.borrow().contains_key(&name) // FIXME(https://github.com/rust-lang/rust/issues/23338)
let data = self.data.borrow();
data.contains_key(&name)
} }
fn Set(self, name: DOMString, value: DOMString) { fn Set(self, name: DOMString, value: DOMString) {

View file

@ -10,7 +10,7 @@
//[Unforgeable] readonly attribute WindowProxy window; //[Unforgeable] readonly attribute WindowProxy window;
//[Replaceable] readonly attribute WindowProxy self; //[Replaceable] readonly attribute WindowProxy self;
readonly attribute Window window; readonly attribute Window window;
readonly attribute Window self; [BinaryName="Self_"] readonly attribute Window self;
/*[Unforgeable]*/ readonly attribute Document document; /*[Unforgeable]*/ readonly attribute Document document;
// attribute DOMString name; // attribute DOMString name;
/*[PutForwards=href, Unforgeable]*/ readonly attribute Location location; /*[PutForwards=href, Unforgeable]*/ readonly attribute Location location;

View file

@ -5,7 +5,7 @@
// http://www.whatwg.org/html/#workerglobalscope // http://www.whatwg.org/html/#workerglobalscope
//[Exposed=Worker] //[Exposed=Worker]
interface WorkerGlobalScope : EventTarget { interface WorkerGlobalScope : EventTarget {
readonly attribute WorkerGlobalScope self; [BinaryName="Self_"] readonly attribute WorkerGlobalScope self;
readonly attribute WorkerLocation location; readonly attribute WorkerLocation location;
//void close(); //void close();

View file

@ -179,11 +179,11 @@ impl Window {
&self.image_cache_task &self.image_cache_task
} }
pub fn compositor(&self) -> RefMut<Box<ScriptListener+'static>> { pub fn compositor<'a>(&'a self) -> RefMut<'a, Box<ScriptListener+'static>> {
self.compositor.borrow_mut() self.compositor.borrow_mut()
} }
pub fn browser_context(&self) -> Ref<Option<BrowserContext>> { pub fn browser_context<'a>(&'a self) -> Ref<'a, Option<BrowserContext>> {
self.browser_context.borrow() self.browser_context.borrow()
} }
@ -281,7 +281,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
} }
fn Document(self) -> Temporary<Document> { fn Document(self) -> Temporary<Document> {
self.browser_context().as_ref().unwrap().active_document() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let context = self.browser_context();
context.as_ref().unwrap().active_document()
} }
fn Location(self) -> Temporary<Location> { fn Location(self) -> Temporary<Location> {
@ -301,7 +303,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
} }
fn GetFrameElement(self) -> Option<Temporary<Element>> { fn GetFrameElement(self) -> Option<Temporary<Element>> {
self.browser_context().as_ref().unwrap().frame_element() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let context = self.browser_context();
context.as_ref().unwrap().frame_element()
} }
fn Navigator(self) -> Temporary<Navigator> { fn Navigator(self) -> Temporary<Navigator> {
@ -356,7 +360,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::from_rooted(self) Temporary::from_rooted(self)
} }
fn Self(self) -> Temporary<Window> { fn Self_(self) -> Temporary<Window> {
self.Window() self.Window()
} }
@ -373,7 +377,10 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
browser_context.frame_element().map_or(self.Window(), |fe| { browser_context.frame_element().map_or(self.Window(), |fe| {
let frame_element = fe.root(); let frame_element = fe.root();
let window = window_from_node(frame_element.r()).root(); let window = window_from_node(frame_element.r()).root();
window.r().browser_context().as_ref().unwrap().active_window() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let r = window.r();
let context = r.browser_context();
context.as_ref().unwrap().active_window()
}) })
} }
@ -644,7 +651,9 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
} }
fn steal_fragment_name(self) -> Option<String> { fn steal_fragment_name(self) -> Option<String> {
self.fragment_name.borrow_mut().take() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let mut name = self.fragment_name.borrow_mut();
name.take()
} }
fn set_window_size(self, size: WindowSizeData) { fn set_window_size(self, size: WindowSizeData) {
@ -688,7 +697,9 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
} }
fn layout_is_idle(self) -> bool { fn layout_is_idle(self) -> bool {
self.layout_join_port.borrow().is_none() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let port = self.layout_join_port.borrow();
port.is_none()
} }
fn set_resize_event(self, event: WindowSizeData) { fn set_resize_event(self, event: WindowSizeData) {

View file

@ -84,7 +84,7 @@ impl WorkerGlobalScope {
} }
impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
fn Self(self) -> Temporary<WorkerGlobalScope> { fn Self_(self) -> Temporary<WorkerGlobalScope> {
Temporary::from_rooted(self) Temporary::from_rooted(self)
} }

View file

@ -369,9 +369,13 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
// Step 4 // Step 4
Some(Method::Connect) | Some(Method::Trace) => Err(Security), Some(Method::Connect) | Some(Method::Trace) => Err(Security),
Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security), Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
Some(_) if method.is_token() => { Some(parsed_method) => {
// Step 3
if !method.is_token() {
return Err(Syntax)
}
*self.request_method.borrow_mut() = maybe_method.unwrap(); *self.request_method.borrow_mut() = parsed_method;
// Step 6 // Step 6
let base = self.global.root().r().get_url(); let base = self.global.root().r().get_url();
@ -675,7 +679,9 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
self.status.get() self.status.get()
} }
fn StatusText(self) -> ByteString { fn StatusText(self) -> ByteString {
self.status_text.borrow().clone() // FIXME(https://github.com/rust-lang/rust/issues/23338)
let status_text = self.status_text.borrow();
status_text.clone()
} }
fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> { fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> {
self.filter_response_headers().iter().find(|h| { self.filter_response_headers().iter().find(|h| {
@ -981,9 +987,12 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
None => {} None => {}
} }
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let response = self.response.borrow();
// According to Simon, decode() should never return an error, so unwrap()ing // According to Simon, decode() should never return an error, so unwrap()ing
// the result should be fine. XXXManishearth have a closer look at this later // the result should be fine. XXXManishearth have a closer look at this later
encoding.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().to_owned() encoding.decode(response.as_slice(), DecoderTrap::Replace).unwrap().to_owned()
} }
fn filter_response_headers(self) -> Headers { fn filter_response_headers(self) -> Headers {
// http://fetch.spec.whatwg.org/#concept-response-header-list // http://fetch.spec.whatwg.org/#concept-response-header-list
@ -992,7 +1001,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
use hyper::header::SetCookie; use hyper::header::SetCookie;
// a dummy header so we can use headers.remove::<SetCookie2>() // a dummy header so we can use headers.remove::<SetCookie2>()
#[derive(Clone)] #[derive(Clone, Debug)]
struct SetCookie2; struct SetCookie2;
impl Header for SetCookie2 { impl Header for SetCookie2 {
fn header_name() -> &'static str { fn header_name() -> &'static str {

View file

@ -14,13 +14,16 @@
#![feature(std_misc)] #![feature(std_misc)]
#![feature(unicode)] #![feature(unicode)]
#![feature(unsafe_destructor)] #![feature(unsafe_destructor)]
#![feature(custom_attribute)]
#![deny(unsafe_blocks)] #![deny(unsafe_blocks)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(missing_copy_implementations)]
#![doc="The script crate contains all matters DOM."] #![doc="The script crate contains all matters DOM."]
#![plugin(string_cache_plugin)]
#![plugin(plugins)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -42,16 +45,12 @@ extern crate time;
extern crate canvas; extern crate canvas;
extern crate script_traits; extern crate script_traits;
extern crate selectors; extern crate selectors;
#[no_link] #[plugin] #[macro_use]
extern crate "plugins" as servo_plugins;
extern crate util; extern crate util;
#[macro_use] #[macro_use]
extern crate style; extern crate style;
extern crate url; extern crate url;
extern crate uuid; extern crate uuid;
extern crate string_cache; extern crate string_cache;
#[no_link] #[macro_use] #[plugin]
extern crate string_cache_macros;
pub mod cors; pub mod cors;

View file

@ -831,7 +831,7 @@ impl ScriptTask {
fn handle_page_fetch_complete(&self, id: PipelineId, subpage: Option<SubpageId>, fn handle_page_fetch_complete(&self, id: PipelineId, subpage: Option<SubpageId>,
response: LoadResponse) { response: LoadResponse) {
// Any notification received should refer to an existing, in-progress load that is tracked. // Any notification received should refer to an existing, in-progress load that is tracked.
let idx = self.incomplete_loads.borrow().iter().position(|&:load| { let idx = self.incomplete_loads.borrow().iter().position(|load| {
load.pipeline_id == id && load.subpage_id.map(|sub| sub.1) == subpage load.pipeline_id == id && load.subpage_id.map(|sub| sub.1) == subpage
}).unwrap(); }).unwrap();
let load = self.incomplete_loads.borrow_mut().remove(idx); let load = self.incomplete_loads.borrow_mut().remove(idx);

View file

@ -23,7 +23,7 @@ use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::mpsc::{channel, Sender}; use std::sync::mpsc::{channel, Sender};
use std::sync::mpsc::Select; use std::sync::mpsc::Select;
use std::hash::{Hash, Hasher, Writer}; use std::hash::{Hash, Hasher};
use std::old_io::timer::Timer; use std::old_io::timer::Timer;
use std::time::duration::Duration; use std::time::duration::Duration;
@ -47,8 +47,8 @@ pub enum TimerCallback {
FunctionTimerCallback(Function) FunctionTimerCallback(Function)
} }
impl<H: Writer + Hasher> Hash<H> for TimerId { impl Hash for TimerId {
fn hash(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
let TimerId(id) = *self; let TimerId(id) = *self;
id.hash(state); id.hash(state);
} }

View file

@ -5,8 +5,6 @@
#![feature(core)] #![feature(core)]
#![feature(int_uint)] #![feature(int_uint)]
#![allow(missing_copy_implementations)]
extern crate devtools_traits; extern crate devtools_traits;
extern crate geom; extern crate geom;
extern crate libc; extern crate libc;

View file

@ -1,4 +1,4 @@
paths = ["../../support/android-rs-glue"] paths = ["../../support/android-rs-glue"]
[target.arm-linux-androideabi] [target.arm-linux-androideabi]
linker = "../../support/android-rs-glue/apk-builder/target/apk-builder" linker = "../../support/android-rs-glue/apk-builder/target/debug/apk-builder"

File diff suppressed because it is too large Load diff

View file

@ -4,8 +4,6 @@
#![feature(core, env, libc, path, rustc_private, std_misc, thread_local)] #![feature(core, env, libc, path, rustc_private, std_misc, thread_local)]
#![allow(missing_copy_implementations)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -57,13 +55,14 @@ use std::sync::mpsc::channel;
#[cfg(not(test))] #[cfg(not(test))]
use std::thread::Builder; use std::thread::Builder;
pub struct Browser<Window> { pub struct Browser {
compositor: Box<CompositorEventListener + 'static>, compositor: Box<CompositorEventListener + 'static>,
} }
impl<Window> Browser<Window> where Window: WindowMethods + 'static { impl Browser {
#[cfg(not(test))] #[cfg(not(test))]
pub fn new(window: Option<Rc<Window>>) -> Browser<Window> { pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
where Window: WindowMethods + 'static {
use std::env; use std::env;
::util::opts::set_experimental_enabled(opts::get().enable_experimental); ::util::opts::set_experimental_enabled(opts::get().enable_experimental);
@ -120,7 +119,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
let url = match url::Url::parse(&*url) { let url = match url::Url::parse(&*url) {
Ok(url) => url, Ok(url) => url,
Err(url::ParseError::RelativeUrlWithoutBase) Err(url::ParseError::RelativeUrlWithoutBase)
=> url::Url::from_file_path(&cwd.join(&*url)).unwrap(), => url::Url::from_file_path(&*cwd.join(&*url)).unwrap(),
Err(_) => panic!("URL parsing failed"), Err(_) => panic!("URL parsing failed"),
}; };

View file

@ -2,7 +2,7 @@
* 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(env, os)] #![feature(env, os, start)]
#[cfg(target_os="android")] #[cfg(target_os="android")]
extern crate libc; extern crate libc;
@ -41,7 +41,7 @@ use std::borrow::ToOwned;
#[cfg(not(test))] #[cfg(not(test))]
struct BrowserWrapper { struct BrowserWrapper {
browser: Browser<app::window::Window>, browser: Browser,
} }
#[cfg(target_os="android")] #[cfg(target_os="android")]
@ -58,7 +58,7 @@ fn get_args() -> Vec<String> {
#[cfg(not(target_os="android"))] #[cfg(not(target_os="android"))]
fn get_args() -> Vec<String> { fn get_args() -> Vec<String> {
use std::env; use std::env;
env::args().map(|s| s.into_string().unwrap()).collect() env::args().collect()
} }
#[cfg(target_os="android")] #[cfg(target_os="android")]

View file

@ -30,13 +30,13 @@ git = "https://github.com/Kimundi/lazy-static.rs"
[dependencies.string_cache] [dependencies.string_cache]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros] [dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies] [dependencies]
text_writer = "0.1.1" text_writer = "0.1.1"
encoding = "0.2" encoding = "0.2"
rustc-serialize = "0.2" rustc-serialize = "0.3"
matches = "0.1" matches = "0.1"
url = "0.2.16" url = "0.2.16"
mod_path = "0.1" mod_path = "0.1"

View file

@ -2,7 +2,7 @@
* 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(path, io, env)] #![feature(env, old_io, old_path)]
use std::env; use std::env;
use std::old_path::Path; use std::old_path::Path;
@ -28,6 +28,6 @@ fn main() {
.output() .output()
.unwrap(); .unwrap();
assert_eq!(result.status, ProcessExit::ExitStatus(0)); assert_eq!(result.status, ProcessExit::ExitStatus(0));
let out = Path::new(env::var_string("OUT_DIR").unwrap()); let out = Path::new(env::var("OUT_DIR").unwrap());
File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap(); File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap();
} }

View file

@ -66,14 +66,13 @@ pub trait PresentationalHintSynthesis {
/// `common_style_affecting_attributes` or `rare_style_affecting_attributes` as appropriate. If /// `common_style_affecting_attributes` or `rare_style_affecting_attributes` as appropriate. If
/// you don't, you risk strange random nondeterministic failures due to false positives in /// you don't, you risk strange random nondeterministic failures due to false positives in
/// style sharing. /// style sharing.
fn synthesize_presentational_hints_for_legacy_attributes<'a,E,N,V>( fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>(
&self, &self,
node: &N, node: &N,
matching_rules_list: &mut V, matching_rules_list: &mut V,
shareable: &mut bool) shareable: &mut bool)
where E: TElement<'a> + where N: TNode<'a>,
TElementAttributes, N::Element: TElementAttributes,
N: TNode<'a,E>,
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>; V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
/// Synthesizes rules for the legacy `bgcolor` attribute. /// Synthesizes rules for the legacy `bgcolor` attribute.
fn synthesize_presentational_hint_for_legacy_background_color_attribute<'a,E,V>( fn synthesize_presentational_hint_for_legacy_background_color_attribute<'a,E,V>(
@ -100,14 +99,13 @@ pub trait PresentationalHintSynthesis {
} }
impl PresentationalHintSynthesis for Stylist { impl PresentationalHintSynthesis for Stylist {
fn synthesize_presentational_hints_for_legacy_attributes<'a,E,N,V>( fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>(
&self, &self,
node: &N, node: &N,
matching_rules_list: &mut V, matching_rules_list: &mut V,
shareable: &mut bool) shareable: &mut bool)
where E: TElement<'a> + where N: TNode<'a>,
TElementAttributes, N::Element: TElementAttributes,
N: TNode<'a,E>,
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> { V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> {
let element = node.as_element(); let element = node.as_element();
match element.get_local_name() { match element.get_local_name() {

View file

@ -12,9 +12,11 @@
#![allow(missing_copy_implementations)] #![allow(missing_copy_implementations)]
#![plugin(string_cache_plugin)]
#![plugin(mod_path)]
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] extern crate bitflags; #[macro_use] extern crate bitflags;
#[no_link] #[macro_use] #[plugin] extern crate string_cache_macros;
extern crate collections; extern crate collections;
extern crate geom; extern crate geom;
@ -37,8 +39,6 @@ extern crate lazy_static;
extern crate util; extern crate util;
#[plugin] #[no_link] extern crate mod_path;
pub mod stylesheets; pub mod stylesheets;
pub mod parser; pub mod parser;

View file

@ -3886,26 +3886,24 @@ pub mod shorthands {
// TODO(SimonSapin): Convert this to a syntax extension rather than a Mako template. // TODO(SimonSapin): Convert this to a syntax extension rather than a Mako template.
// Maybe submit for inclusion in libstd? // Maybe submit for inclusion in libstd?
mod property_bit_field { mod property_bit_field {
use std::uint;
use std::mem;
pub struct PropertyBitField { pub struct PropertyBitField {
storage: [uint; (${len(LONGHANDS)} - 1 + uint::BITS) / uint::BITS] storage: [u32; (${len(LONGHANDS)} - 1 + 32) / 32]
} }
impl PropertyBitField { impl PropertyBitField {
#[inline] #[inline]
pub fn new() -> PropertyBitField { pub fn new() -> PropertyBitField {
PropertyBitField { storage: unsafe { mem::zeroed() } } PropertyBitField { storage: [0; (${len(LONGHANDS)} - 1 + 32) / 32] }
} }
#[inline] #[inline]
fn get(&self, bit: uint) -> bool { fn get(&self, bit: uint) -> bool {
(self.storage[bit / uint::BITS] & (1 << (bit % uint::BITS))) != 0 (self.storage[bit / 32] & (1 << (bit % 32))) != 0
} }
#[inline] #[inline]
fn set(&mut self, bit: uint) { fn set(&mut self, bit: uint) {
self.storage[bit / uint::BITS] |= 1 << (bit % uint::BITS) self.storage[bit / 32] |= 1 << (bit % 32)
} }
% for i, property in enumerate(LONGHANDS): % for i, property in enumerate(LONGHANDS):
% if property.derived_from is None: % if property.derived_from is None:

View file

@ -169,7 +169,7 @@ impl Stylist {
/// The returned boolean indicates whether the style is *shareable*; that is, whether the /// The returned boolean indicates whether the style is *shareable*; that is, whether the
/// matched selectors are simple enough to allow the matching logic to be reduced to the logic /// matched selectors are simple enough to allow the matching logic to be reduced to the logic
/// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`. /// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`.
pub fn push_applicable_declarations<'a,E,N,V>( pub fn push_applicable_declarations<'a,N,V>(
&self, &self,
element: &N, element: &N,
parent_bf: &Option<Box<BloomFilter>>, parent_bf: &Option<Box<BloomFilter>>,
@ -177,8 +177,8 @@ impl Stylist {
pseudo_element: Option<PseudoElement>, pseudo_element: Option<PseudoElement>,
applicable_declarations: &mut V) applicable_declarations: &mut V)
-> bool -> bool
where E: TElement<'a> + TElementAttributes, where N: TNode<'a>,
N: TNode<'a,E>, N::Element: TElementAttributes,
V: VecLike<DeclarationBlock> { V: VecLike<DeclarationBlock> {
assert!(!self.is_dirty); assert!(!self.is_dirty);
assert!(element.is_element()); assert!(element.is_element());

View file

@ -873,6 +873,7 @@ pub mod computed {
use geom::size::Size2D; use geom::size::Size2D;
use properties::longhands; use properties::longhands;
use std::fmt; use std::fmt;
use std::marker::MarkerTrait;
use std::ops::{Add, Mul}; use std::ops::{Add, Mul};
use url::Url; use url::Url;
use util::geometry::Au; use util::geometry::Au;
@ -909,7 +910,7 @@ pub mod computed {
fn to_computed_value(&self, _context: &Context) -> Self::ComputedValue; fn to_computed_value(&self, _context: &Context) -> Self::ComputedValue;
} }
pub trait ComputedValueAsSpecified {} pub trait ComputedValueAsSpecified: MarkerTrait {}
impl<T> ToComputedValue for T where T: ComputedValueAsSpecified + Clone { impl<T> ToComputedValue for T where T: ComputedValueAsSpecified + Clone {
type ComputedValue = T; type ComputedValue = T;

View file

@ -36,7 +36,7 @@ path = "../../support/rust-task_info"
[dependencies.string_cache] [dependencies.string_cache]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros] [dependencies.string_cache_plugin]
git = "https://github.com/servo/string-cache" git = "https://github.com/servo/string-cache"
[dependencies.lazy_static] [dependencies.lazy_static]
@ -47,7 +47,7 @@ bitflags = "*"
libc = "*" libc = "*"
rand = "*" rand = "*"
regex = "0.1.14" regex = "0.1.14"
rustc-serialize = "0.2" rustc-serialize = "0.3"
text_writer = "0.1.1" text_writer = "0.1.1"
time = "0.1.12" time = "0.1.12"
url = "0.2.16" url = "0.2.16"

View file

@ -12,6 +12,7 @@ use std::hash::{Hash, Hasher, SipHasher};
use std::iter::repeat; use std::iter::repeat;
use rand; use rand;
use std::slice::Iter; use std::slice::Iter;
use std::default::Default;
#[cfg(test)] #[cfg(test)]
use std::cell::Cell; use std::cell::Cell;
@ -21,12 +22,12 @@ pub struct HashCache<K, V> {
} }
impl<K, V> HashCache<K,V> impl<K, V> HashCache<K,V>
where K: Clone + PartialEq + Eq + Hash<SipHasher>, where K: Clone + PartialEq + Eq + Hash,
V: Clone, V: Clone,
{ {
pub fn new() -> HashCache<K,V> { pub fn new() -> HashCache<K,V> {
HashCache { HashCache {
entries: HashMap::with_hash_state(DefaultState), entries: HashMap::with_hash_state(<DefaultState<SipHasher> as Default>::default()),
} }
} }
@ -133,7 +134,7 @@ pub struct SimpleHashCache<K,V> {
k1: u64, k1: u64,
} }
impl<K:Clone+Eq+Hash<SipHasher>,V:Clone> SimpleHashCache<K,V> { impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> {
pub fn new(cache_size: usize) -> SimpleHashCache<K,V> { pub fn new(cache_size: usize) -> SimpleHashCache<K,V> {
let mut r = rand::thread_rng(); let mut r = rand::thread_rng();
SimpleHashCache { SimpleHashCache {
@ -149,7 +150,7 @@ impl<K:Clone+Eq+Hash<SipHasher>,V:Clone> SimpleHashCache<K,V> {
} }
#[inline] #[inline]
fn bucket_for_key<Q:Hash<SipHasher>>(&self, key: &Q) -> usize { fn bucket_for_key<Q:Hash>(&self, key: &Q) -> usize {
let mut hasher = SipHasher::new_with_keys(self.k0, self.k1); let mut hasher = SipHasher::new_with_keys(self.k0, self.k1);
key.hash(&mut hasher); key.hash(&mut hasher);
self.to_bucket(hasher.finish() as usize) self.to_bucket(hasher.finish() as usize)
@ -160,7 +161,7 @@ impl<K:Clone+Eq+Hash<SipHasher>,V:Clone> SimpleHashCache<K,V> {
self.entries[bucket_index] = Some((key, value)); self.entries[bucket_index] = Some((key, value));
} }
pub fn find<Q>(&self, key: &Q) -> Option<V> where Q: PartialEq<K> + Hash<SipHasher> + Eq { pub fn find<Q>(&self, key: &Q) -> Option<V> where Q: PartialEq<K> + Hash + Eq {
let bucket_index = self.bucket_for_key(key); let bucket_index = self.bucket_for_key(key);
match self.entries[bucket_index] { match self.entries[bucket_index] {
Some((ref existing_key, ref value)) if key == existing_key => Some((*value).clone()), Some((ref existing_key, ref value)) if key == existing_key => Some((*value).clone()),

View file

@ -78,6 +78,8 @@ struct Deque<T> {
pool: BufferPool<T>, pool: BufferPool<T>,
} }
unsafe impl<T> Send for Deque<T> {}
/// Worker half of the work-stealing deque. This worker has exclusive access to /// Worker half of the work-stealing deque. This worker has exclusive access to
/// one side of the deque, and uses `push` and `pop` method to manipulate it. /// one side of the deque, and uses `push` and `pop` method to manipulate it.
/// ///
@ -144,7 +146,7 @@ struct Buffer<T> {
unsafe impl<T: 'static> Send for Buffer<T> { } unsafe impl<T: 'static> Send for Buffer<T> { }
impl<T: Send> BufferPool<T> { impl<T: Send + 'static> BufferPool<T> {
/// Allocates a new buffer pool which in turn can be used to allocate new /// Allocates a new buffer pool which in turn can be used to allocate new
/// deques. /// deques.
pub fn new() -> BufferPool<T> { pub fn new() -> BufferPool<T> {
@ -182,7 +184,7 @@ impl<T: Send> Clone for BufferPool<T> {
fn clone(&self) -> BufferPool<T> { BufferPool { pool: self.pool.clone() } } fn clone(&self) -> BufferPool<T> { BufferPool { pool: self.pool.clone() } }
} }
impl<T: Send> Worker<T> { impl<T: Send + 'static> Worker<T> {
/// Pushes data onto the front of this work queue. /// Pushes data onto the front of this work queue.
pub fn push(&self, t: T) { pub fn push(&self, t: T) {
unsafe { self.deque.push(t) } unsafe { self.deque.push(t) }
@ -201,7 +203,7 @@ impl<T: Send> Worker<T> {
} }
} }
impl<T: Send> Stealer<T> { impl<T: Send + 'static> Stealer<T> {
/// Steals work off the end of the queue (opposite of the worker's end) /// Steals work off the end of the queue (opposite of the worker's end)
pub fn steal(&self) -> Stolen<T> { pub fn steal(&self) -> Stolen<T> {
unsafe { self.deque.steal() } unsafe { self.deque.steal() }
@ -224,7 +226,7 @@ impl<T: Send> Clone for Stealer<T> {
// Almost all of this code can be found directly in the paper so I'm not // Almost all of this code can be found directly in the paper so I'm not
// personally going to heavily comment what's going on here. // personally going to heavily comment what's going on here.
impl<T: Send> Deque<T> { impl<T: Send + 'static> Deque<T> {
fn new(mut pool: BufferPool<T>) -> Deque<T> { fn new(mut pool: BufferPool<T>) -> Deque<T> {
let buf = pool.alloc(MIN_BITS); let buf = pool.alloc(MIN_BITS);
Deque { Deque {
@ -330,7 +332,7 @@ impl<T: Send> Deque<T> {
#[unsafe_destructor] #[unsafe_destructor]
impl<T: Send> Drop for Deque<T> { impl<T: Send + 'static> Drop for Deque<T> {
fn drop(&mut self) { fn drop(&mut self) {
let t = self.top.load(SeqCst); let t = self.top.load(SeqCst);
let b = self.bottom.load(SeqCst); let b = self.bottom.load(SeqCst);

View file

@ -4,14 +4,14 @@
//! Utility functions for doubly-linked lists. //! Utility functions for doubly-linked lists.
use std::collections::DList; use std::collections::LinkedList;
use std::mem; use std::mem;
/// Splits the head off a list in O(1) time, and returns the head. /// Splits the head off a list in O(1) time, and returns the head.
pub fn split_off_head<T>(list: &mut DList<T>) -> DList<T> { pub fn split_off_head<T>(list: &mut LinkedList<T>) -> LinkedList<T> {
// FIXME: Work around https://github.com/rust-lang/rust/issues/22244 // FIXME: Work around https://github.com/rust-lang/rust/issues/22244
if list.len() == 1 { if list.len() == 1 {
return mem::replace(list, DList::new()); return mem::replace(list, LinkedList::new());
} }
let tail = list.split_off(1); let tail = list.split_off(1);
mem::replace(list, tail) mem::replace(list, tail)
@ -19,7 +19,7 @@ pub fn split_off_head<T>(list: &mut DList<T>) -> DList<T> {
/// Prepends the items in the other list to this one, leaving the other list empty. /// Prepends the items in the other list to this one, leaving the other list empty.
#[inline] #[inline]
pub fn prepend_from<T>(this: &mut DList<T>, other: &mut DList<T>) { pub fn prepend_from<T>(this: &mut LinkedList<T>, other: &mut LinkedList<T>) {
other.append(this); other.append(this);
mem::swap(this, other); mem::swap(this, other);
} }

View file

@ -5,7 +5,8 @@
//! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs //! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs
use std::default::Default; use std::default::Default;
use std::hash::{Hasher, Writer}; use std::hash::Hasher;
use std::num::wrapping::WrappingOps;
/// A speedy hash algorithm for node ids and def ids. The hashmap in /// A speedy hash algorithm for node ids and def ids. The hashmap in
/// libcollections by default uses SipHash which isn't quite as speedy as we /// libcollections by default uses SipHash which isn't quite as speedy as we
@ -22,17 +23,12 @@ impl Default for FnvHasher {
} }
impl Hasher for FnvHasher { impl Hasher for FnvHasher {
type Output = u64;
fn reset(&mut self) { *self = Default::default(); }
fn finish(&self) -> u64 { self.0 } fn finish(&self) -> u64 { self.0 }
}
impl Writer for FnvHasher {
fn write(&mut self, bytes: &[u8]) { fn write(&mut self, bytes: &[u8]) {
let FnvHasher(mut hash) = *self; let FnvHasher(mut hash) = *self;
for byte in bytes.iter() { for byte in bytes.iter() {
hash = hash ^ (*byte as u64); hash = hash ^ (*byte as u64);
hash = hash * 0x100000001b3; hash = hash.wrapping_mul(0x100000001b3);
} }
*self = FnvHasher(hash); *self = FnvHasher(hash);
} }

View file

@ -132,7 +132,7 @@ impl Add for Au {
fn add(self, other: Au) -> Au { fn add(self, other: Au) -> Au {
let Au(s) = self; let Au(s) = self;
let Au(o) = other; let Au(o) = other;
Au(s + o) Au(s.wrapping_add(o))
} }
} }
@ -143,7 +143,7 @@ impl Sub for Au {
fn sub(self, other: Au) -> Au { fn sub(self, other: Au) -> Au {
let Au(s) = self; let Au(s) = self;
let Au(o) = other; let Au(o) = other;
Au(s - o) Au(s.wrapping_sub(o))
} }
} }
@ -154,7 +154,7 @@ impl Mul<i32> for Au {
#[inline] #[inline]
fn mul(self, other: i32) -> Au { fn mul(self, other: i32) -> Au {
let Au(s) = self; let Au(s) = self;
Au(s * other) Au(s.wrapping_mul(other))
} }
} }

Some files were not shown because too many files have changed in this diff Show more