servo: Merge #5256 - Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-de (from servo:rustup_20150311); r=jdm

...v.

Relies on:
* https://github.com/servo/rust-geom/pull/72
* https://github.com/servo/rust-glx/pull/10
* https://github.com/servo/gleam/pull/15
* https://github.com/servo/rust-mozjs/pull/137
* https://github.com/servo/rust-core-text/pull/35
* https://github.com/servo/rust-io-surface/pull/28

Source-Repo: https://github.com/servo/servo
Source-Revision: 99cf9dbfc107bacb84dfe5afa9539a0ede3beac2
This commit is contained in:
Ms2ger 2015-03-18 11:25:00 -06:00
Родитель 6554a779ae
Коммит 66cb126a50
133 изменённых файлов: 1413 добавлений и 1200 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -208,8 +208,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
composition_request: CompositionRequest::NoCompositingNecessary,
pending_scroll_events: Vec::new(),
shutdown_state: ShutdownState::NotShuttingDown,
page_zoom: ScaleFactor(1.0),
viewport_zoom: ScaleFactor(1.0),
page_zoom: ScaleFactor::new(1.0),
viewport_zoom: ScaleFactor::new(1.0),
zoom_action: false,
zoom_time: 0f64,
got_load_complete_message: false,
@ -893,7 +893,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
match opts::get().device_pixels_per_px {
Some(device_pixels_per_px) => device_pixels_per_px,
None => match opts::get().output_file {
Some(_) => ScaleFactor(1.0),
Some(_) => ScaleFactor::new(1.0),
None => self.hidpi_factor
}
}
@ -905,7 +905,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn update_zoom_transform(&mut self) {
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
// has changed in unscaled layer pixels.
@ -913,7 +913,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
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.send_window_size();
}
@ -924,7 +924,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.zoom_time = precise_time_s();
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;
self.update_zoom_transform();

Просмотреть файл

@ -307,8 +307,8 @@ impl CompositorLayer for Layer<CompositorData> {
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 new_offset : TypedPoint2D<LayerPixel, f32> =
Point2D(Length(new_offset.x.get().clamp(&min_x, &0.0)),
Length(new_offset.y.get().clamp(&min_y, &0.0)));
Point2D(Length::new(new_offset.x.get().clamp(&min_x, &0.0)),
Length::new(new_offset.y.get().clamp(&min_y, &0.0)));
if self.extra_data.borrow().scroll_offset == new_offset {
return ScrollEventResult::ScrollPositionUnchanged;

Просмотреть файл

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

Просмотреть файл

@ -59,7 +59,7 @@ impl NullCompositor {
chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
initial_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();
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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,
port: Receiver<Msg>,
compositor: C,

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -52,7 +52,7 @@ use script::dom::htmlobjectelement::is_image_data;
use script::dom::node::NodeTypeId;
use util::opts;
use std::borrow::ToOwned;
use std::collections::DList;
use std::collections::LinkedList;
use std::mem;
use std::sync::atomic::Ordering;
use style::computed_values::content::ContentItem;
@ -114,10 +114,10 @@ pub enum ConstructionItem {
#[derive(Clone)]
pub struct InlineFragmentsConstructionResult {
/// Any {ib} splits that we're bubbling up.
pub splits: DList<InlineBlockSplit>,
pub splits: LinkedList<InlineBlockSplit>,
/// Any fragments that succeed the {ib} splits.
pub fragments: DList<Fragment>,
pub fragments: LinkedList<Fragment>,
/// Any absolute descendants that we're bubbling up.
pub abs_descendants: AbsDescendants,
@ -152,7 +152,7 @@ pub struct InlineFragmentsConstructionResult {
#[derive(Clone)]
pub struct InlineBlockSplit {
/// The inline fragments that precede the flow.
pub predecessors: DList<Fragment>,
pub predecessors: LinkedList<Fragment>,
/// The flow that caused this {ib} split.
pub flow: FlowRef,
@ -161,7 +161,7 @@ pub struct InlineBlockSplit {
/// Holds inline fragments that we're gathering for children of an inline node.
struct InlineFragmentsAccumulator {
/// 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
/// outer node is an inline and None otherwise.
@ -171,20 +171,20 @@ struct InlineFragmentsAccumulator {
impl InlineFragmentsAccumulator {
fn new() -> InlineFragmentsAccumulator {
InlineFragmentsAccumulator {
fragments: DList::new(),
fragments: LinkedList::new(),
enclosing_style: None,
}
}
fn from_inline_node(node: &ThreadSafeLayoutNode) -> InlineFragmentsAccumulator {
let fragments = DList::new();
let fragments = LinkedList::new();
InlineFragmentsAccumulator {
fragments: fragments,
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 {
return
}
@ -192,7 +192,7 @@ impl InlineFragmentsAccumulator {
self.fragments.append(&mut fragments)
}
fn to_dlist(self) -> DList<Fragment> {
fn to_dlist(self) -> LinkedList<Fragment> {
let InlineFragmentsAccumulator {
mut fragments,
enclosing_style
@ -507,7 +507,7 @@ impl<'a> FlowConstructor<'a> {
fn build_flow_for_block_starting_with_fragments(&mut self,
mut flow: FlowRef,
node: &ThreadSafeLayoutNode,
mut initial_fragments: DList<Fragment>)
mut initial_fragments: LinkedList<Fragment>)
-> ConstructionResult {
// Gather up fragments for the inline flows we might need to create.
let mut inline_fragment_accumulator = InlineFragmentsAccumulator::new();
@ -577,7 +577,7 @@ impl<'a> FlowConstructor<'a> {
/// `<textarea>`.
fn build_flow_for_block(&mut self, flow: FlowRef, node: &ThreadSafeLayoutNode)
-> ConstructionResult {
let mut initial_fragments = DList::new();
let mut initial_fragments = LinkedList::new();
if node.get_pseudo_element_type() != PseudoElementType::Normal ||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLInputElement))) ||
@ -600,7 +600,7 @@ impl<'a> FlowConstructor<'a> {
/// Pushes fragments appropriate for the content of the given node onto the given list.
fn create_fragments_for_node_text_content(&self,
fragments: &mut DList<Fragment>,
fragments: &mut LinkedList<Fragment>,
node: &ThreadSafeLayoutNode,
style: &Arc<ComputedValues>) {
for content_item in node.text_content().into_iter() {
@ -650,7 +650,7 @@ impl<'a> FlowConstructor<'a> {
/// whitespace.
fn build_fragments_for_nonreplaced_inline_content(&mut self, node: &ThreadSafeLayoutNode)
-> 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 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
// fragment corresponding to that content. Otherwise, just initialize with the ordinary
// 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()) {
(_, Some(NodeTypeId::Text)) => {
self.create_fragments_for_node_text_content(&mut fragments, node, &style)
@ -782,7 +782,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(),
splits: LinkedList::new(),
fragments: fragments,
abs_descendants: Descendants::new(),
});
@ -806,7 +806,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(),
splits: LinkedList::new(),
fragments: fragment_accumulator.to_dlist(),
abs_descendants: abs_descendants,
});
@ -832,7 +832,7 @@ impl<'a> FlowConstructor<'a> {
let construction_item =
ConstructionItem::InlineFragments(InlineFragmentsConstructionResult {
splits: DList::new(),
splits: LinkedList::new(),
fragments: fragment_accumulator.to_dlist(),
abs_descendants: abs_descendants,
});
@ -1042,7 +1042,7 @@ impl<'a> FlowConstructor<'a> {
ListStyleTypeContent::None => None,
ListStyleTypeContent::StaticText(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(
node,
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,
// which has caused some malaise (Bugzilla #36854) but CSS 2.1 § 12.5.1 lets me do it, so
// there.
let mut initial_fragments = DList::new();
let mut initial_fragments = LinkedList::new();
let main_fragment = self.build_fragment_for_block(node);
let flow = match node.style().get_list().list_style_position {
list_style_position::T::outside => {
@ -1477,7 +1477,7 @@ impl FlowConstructionUtils for FlowRef {
}
/// 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() {
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.
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() {
return
}

Просмотреть файл

@ -19,7 +19,7 @@ use util::smallvec::{SmallVec, SmallVec16};
use util::arc_ptr_eq;
use std::borrow::ToOwned;
use std::mem;
use std::hash::{Hash, Hasher, Writer};
use std::hash::{Hash, Hasher};
use std::slice::Iter;
use string_cache::{Atom, Namespace};
use selectors::parser::PseudoElement;
@ -78,8 +78,8 @@ impl PartialEq for ApplicableDeclarationsCacheEntry {
}
impl Eq for ApplicableDeclarationsCacheEntry {}
impl<H: Hasher+Writer> Hash<H> for ApplicableDeclarationsCacheEntry {
fn hash(&self, state: &mut H) {
impl Hash for ApplicableDeclarationsCacheEntry {
fn hash<H: Hasher>(&self, state: &mut H) {
let tmp = ApplicableDeclarationsCacheQuery::new(&*self.declarations);
tmp.hash(state);
}
@ -119,8 +119,8 @@ impl<'a> PartialEq<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsC
}
}
impl<'a, H: Hasher+Writer> Hash<H> for ApplicableDeclarationsCacheQuery<'a> {
fn hash(&self, state: &mut H) {
impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
fn hash<H: Hasher>(&self, state: &mut H) {
for declaration in self.declarations.iter() {
let ptr: uint = unsafe {
mem::transmute_copy(declaration)
@ -357,7 +357,7 @@ impl StyleSharingCandidateCache {
}
/// 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
/// is shareable at all.
CannotShare(bool),

Просмотреть файл

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

Просмотреть файл

@ -5,21 +5,21 @@
use flow::Flow;
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.
// Until then, it's just a wrapper around DList.
// Until then, it's just a wrapper around LinkedList.
pub struct FlowList {
flows: DList<FlowRef>,
flows: LinkedList<FlowRef>,
}
pub struct FlowListIterator<'a> {
it: dlist::Iter<'a, FlowRef>,
it: linked_list::Iter<'a, FlowRef>,
}
pub struct MutFlowListIterator<'a> {
it: dlist::IterMut<'a, FlowRef>,
it: linked_list::IterMut<'a, FlowRef>,
}
impl FlowList {
@ -72,7 +72,7 @@ impl FlowList {
#[inline]
pub fn new() -> FlowList {
FlowList {
flows: DList::new(),
flows: LinkedList::new(),
}
}

Просмотреть файл

@ -39,7 +39,7 @@ use util::smallvec::SmallVec;
use util::str::is_whitespace;
use std::borrow::ToOwned;
use std::cmp::{max, min};
use std::collections::DList;
use std::collections::LinkedList;
use std::fmt;
use std::num::ToPrimitive;
use std::str::FromStr;
@ -829,7 +829,7 @@ impl Fragment {
/// Transforms this fragment into an ellipsis fragment, preserving all the other data.
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(
self.border_box.size,
SpecificFragmentInfo::UnscannedText(UnscannedTextFragmentInfo::from_text(
@ -1950,7 +1950,7 @@ impl Fragment {
/// into account.
///
/// 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
/// this fragment does not establish a stacking context, then it always belongs to its parent
/// stacking context and thus `coordinate_system` is ignored.)
@ -1966,7 +1966,7 @@ impl Fragment {
let container_size =
relative_containing_block_size.to_physical(relative_containing_block_mode);
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)
}
@ -2119,7 +2119,7 @@ pub enum CoordinateSystem {
/// The border box returned is relative to the fragment's parent stacking context.
Parent,
/// 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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -96,6 +96,7 @@ pub struct LayoutTaskData {
/// The root stacking context.
pub stacking_context: Option<Arc<StackingContext>>,
/// Performs CSS selector matching and style resolution.
pub stylist: Box<Stylist>,
/// 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> {
let id = self.id.clone();
let script_chan = self.script_chan.clone();
box move |&:_, node_address| {
box move |_, node_address| {
let ScriptControlChan(ref chan) = script_chan;
debug!("Dirtying {:x}", node_address.0 as uint);
let mut nodes = SmallVec1::new();
@ -281,10 +282,13 @@ impl LayoutTask {
let local_image_cache =
Arc::new(Mutex::new(LocalImageCache::new(image_cache_task.clone())));
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 {
Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT,
opts::get().layout_threads, SharedLayoutContextWrapper(ptr::null())))
opts::get().layout_threads,
SharedLayoutContextWrapper(ptr::null())))
} else {
None
};
@ -568,7 +572,7 @@ impl LayoutTask {
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
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());
});
rw_data.stylist.add_stylesheet(sheet);

Просмотреть файл

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

Просмотреть файл

@ -20,7 +20,7 @@ use util::geometry::Au;
use util::logical_geometry::{LogicalSize, WritingMode};
use util::range::Range;
use util::smallvec::{SmallVec, SmallVec1};
use std::collections::DList;
use std::collections::LinkedList;
use std::mem;
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
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.
pub struct TextRunScanner {
pub clump: DList<Fragment>,
pub clump: LinkedList<Fragment>,
}
impl TextRunScanner {
pub fn new() -> 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 {
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.
// If no clump takes ownership, however, it will leak.
if run_text.len() == 0 {
self.clump = DList::new();
self.clump = LinkedList::new();
return last_whitespace
}
@ -183,15 +183,15 @@ impl TextRunScanner {
flags: flags,
};
Arc::new(box TextRun::new(&mut *fontgroup.fonts.get(0).borrow_mut(),
run_text,
&options))
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let mut font = fontgroup.fonts.get(0).borrow_mut();
Arc::new(box TextRun::new(&mut *font, run_text, &options))
};
// Make new fragments with the run and adjusted text indices.
debug!("TextRunScanner: pushing {} fragment(s)", self.clump.len());
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);
if range.is_empty() {
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>)
-> FontMetrics {
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.

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -11,7 +11,7 @@ use hyper::http::RawStatus;
use util::resource_files::resources_dir_path;
use std::borrow::IntoCow;
use std::old_io::fs::PathExtensions;
use std::fs::PathExt;
use std::sync::mpsc::Sender;
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();
path.push("failure.html");
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))

Просмотреть файл

@ -93,7 +93,7 @@ impl CookieStorage {
// http://tools.ietf.org/html/rfc6265#section-5.4
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 RESULT {}", c.appropriate_for_url(url, source));
// Step 1
@ -104,7 +104,7 @@ impl CookieStorage {
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));
let reducer = |&:acc: String, c: &mut &mut Cookie| -> String {
let reducer = |acc: String, c: &mut &mut Cookie| -> String {
// Step 3
c.touch();

Просмотреть файл

@ -19,7 +19,7 @@ use hyper::net::HttpConnector;
use hyper::status::{StatusCode, StatusClass};
use std::error::Error;
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::thunk::Invoke;
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) {
Ok(req) => req,
Err(HttpError::HttpIoError(IoError {kind: IoErrorKind::OtherIoError,
desc: "Error in OpenSSL",
detail: Some(ref det)})) if det.as_slice() == ssl_err_string => {
Err(HttpError::HttpIoError(ref io_error)) if (
io_error.kind() == io::ErrorKind::Other &&
io_error.description() == "Error in OpenSSL" &&
io_error.detail() == Some(ssl_err_string.to_owned())
) => {
let mut image = resources_dir_path();
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);
return;
},
@ -186,7 +188,7 @@ reason: \"certificate verify failed\" }]";
};
match writer.write_all(&*data) {
Err(e) => {
send_error(url, e.desc.to_string(), senders);
send_error(url, e.description().to_string(), senders);
return;
}
_ => {}
@ -301,7 +303,7 @@ reason: \"certificate verify failed\" }]";
unsafe { buf.set_len(1024); }
match response.read(buf.as_mut_slice()) {
Ok(len) => {
Ok(len) if len > 0 => {
unsafe { buf.set_len(len); }
if progress_chan.send(Payload(buf)).is_err() {
// The send errors when the receiver is out of scope,
@ -310,7 +312,7 @@ reason: \"certificate verify failed\" }]";
return;
}
}
Err(_) => {
Ok(_) | Err(_) => {
let _ = progress_chan.send(Done(Ok(())));
break;
}

Просмотреть файл

@ -24,7 +24,7 @@ pub struct ImageHolder<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>>>)
-> ImageHolder<NodeAddress> {
debug!("ImageHolder::new() {}", url.serialize());

Просмотреть файл

@ -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>
where F: FnOnce(Receiver<A>) + Send,
A: Send
where F: FnOnce(Receiver<A>) + Send + 'static,
A: Send + 'static
{
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>| {
loop {
match port.recv().unwrap() {
@ -602,8 +602,8 @@ mod tests {
}
#[test]
#[should_fail]
fn should_fail_if_unprefetched_image_is_requested() {
#[should_panic]
fn should_panic_if_unprefetched_image_is_requested() {
let mock_resource_task = mock_resource_task(box DoesNothing);
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), profiler());

Просмотреть файл

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

Просмотреть файл

@ -47,7 +47,7 @@ struct ImageState {
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
/// 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>) {

Просмотреть файл

@ -38,7 +38,7 @@ use std::old_io::net::tcp::TcpListener;
static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None;
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
let path = Path::new(host_file_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();
for token in ip_host.iter().skip(1) {
if token[].as_bytes()[0] == b'#' {
if token.as_bytes()[0] == b'#' {
break;
}
host_table.insert(token.to_owned().to_string(), address.clone());
@ -326,7 +326,7 @@ impl ResourceManager {
fn from_factory(factory: fn(LoadData, Sender<TargetedLoadResponse>))
-> Box<Invoke<(LoadData, Sender<TargetedLoadResponse>)> + Send> {
box move |&:(load_data, start_chan)| {
box move |(load_data, start_chan)| {
factory(load_data, start_chan)
}
}

Просмотреть файл

@ -48,7 +48,7 @@ fn expand_cased<'cx, T>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree],
match (res, it.count()) {
(Some((s, span)), 0) => {
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) => {
if rest > 0 {

Просмотреть файл

@ -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`
///
/// 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 {
span: span,
attributes: Vec::new(),

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -33,9 +33,9 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
match ty.node {
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::TyPath(_, id) => {
match cx.tcx.def_map.borrow()[id].clone() {
def::DefTy(def_id, _) => {
ast::TyPath(..) => {
match cx.tcx.def_map.borrow()[ty.id] {
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
if ty::has_attr(cx.tcx, def_id, "must_root") {
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
}

Просмотреть файл

@ -10,7 +10,7 @@ use syntax::ast;
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 {
let struct_name = item.ident;
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time

Просмотреть файл

@ -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)
pub fn match_ty_unwrap<'a>(ty: &'a Ty, segments: &[&str]) -> Option<&'a [P<Ty>]> {
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.
// 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
@ -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
pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
let ty_id = match ty.node {
TyPath(_, ty_id) => ty_id,
match ty.node {
TyPath(..) => {},
_ => return false,
};
}
let def_id = match cx.tcx.def_map.borrow().get(&ty_id).cloned() {
Some(def::DefTy(def_id, _)) => def_id,
let def_id = match cx.tcx.def_map.borrow().get(&ty.id) {
Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) => def_id,
_ => return false,
};

Просмотреть файл

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

Просмотреть файл

@ -54,11 +54,12 @@ use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue};
use libc;
use std::borrow::ToOwned;
use std::default;
use std::marker::MarkerTrait;
use std::slice;
/// A trait to retrieve the constants necessary to check if a `JSObject`
/// implements a given interface.
pub trait IDLInterface {
pub trait IDLInterface: MarkerTrait {
/// Returns the prototype ID.
fn get_prototype_id() -> PrototypeList::ID;
/// 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.
pub trait FromJSValConvertible {
/// Optional configurable behaviour switch; use () for no configuration.
type Config;
/// Convert `val` to type `Self`.
/// Optional configuration of type `T` can be passed as the `option`

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -184,10 +184,10 @@ impl<T: JSTraceable> JSTraceable for Option<T> {
}
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,
S: HashState,
<S as HashState>::Hasher: Hasher<Output=u64>,
<S as HashState>::Hasher: Hasher,
{
#[inline]
fn trace(&self, trc: *mut JSTracer) {

Просмотреть файл

@ -577,7 +577,10 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
debug!("outerizing");
let obj = *obj.unnamed_field1;
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()
}
}

Просмотреть файл

@ -68,7 +68,9 @@ impl CharacterData {
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
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 {
@ -77,11 +79,15 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
}
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> {
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 {

Просмотреть файл

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

Просмотреть файл

@ -365,10 +365,13 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
fn find_fragment_node(self, fragid: DOMString) -> Option<Temporary<Element>> {
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);
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);
@ -461,7 +464,10 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
/// Sends this document's title to the compositor.
fn send_title_to_compositor(self) {
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) {
@ -843,12 +849,16 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-document-characterset
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
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
@ -893,7 +903,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> {
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,
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
}
@ -1218,7 +1230,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
None => return false,
};
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()
})
})
}

Просмотреть файл

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

Просмотреть файл

@ -618,9 +618,14 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
}
fn get_attributes(self, local_name: &Atom) -> Vec<Temporary<Attr>> {
self.attrs.borrow().iter().map(|attr| attr.root()).filter_map(|attr| {
if *attr.r().local_name() == *local_name {
Some(Temporary::from_rooted(attr.r()))
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attrs = self.attrs.borrow();
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 {
None
}
@ -746,12 +751,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
let owner_doc = node.owner_doc().root();
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,
Quirks => lhs.as_slice().eq_ignore_ascii_case(rhs.as_slice())
};
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))
}).unwrap_or(false)
}).unwrap_or(false)
@ -764,9 +772,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
}
fn has_attribute(self, name: &Atom) -> bool {
assert!(name.as_slice().bytes().all(|&:b| b.to_ascii_lowercase() == b));
self.attrs.borrow().iter().map(|attr| attr.root()).any(|attr| {
*attr.r().local_name() == *name && *attr.r().namespace() == ns!("")
assert!(name.as_slice().bytes().all(|b| b.to_ascii_lowercase() == b));
// FIXME(https://github.com/rust-lang/rust/issues/23338)
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,11 +825,12 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
fn get_tokenlist_attribute(self, name: &Atom) -> Vec<Atom> {
self.get_attribute(ns!(""), name).root().map(|attr| {
attr.r()
.value()
.tokens()
.expect("Expected a TokenListAttrValue")
.to_vec()
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();
let value = attr.value();
value.tokens()
.expect("Expected a TokenListAttrValue")
.to_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> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
// 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)]
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
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.
unsafe { mem::transmute(attr.r().value().as_slice()) }
unsafe { mem::transmute(value.as_slice()) }
}).collect()
}
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> {
self.get_attribute(ns!(""), &atom!("id")).map(|attr| {
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(),
_ => panic!("`id` attribute should be AttrValue::Atom"),
}

Просмотреть файл

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

Просмотреть файл

@ -178,7 +178,9 @@ impl<'a> EventMethods for JSRef<'a, Event> {
}
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>> {

Просмотреть файл

@ -245,7 +245,9 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
}
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()
}
}

Просмотреть файл

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

Просмотреть файл

@ -229,7 +229,7 @@ impl<'a> Activatable for JSRef<'a, HTMLButtonElement> {
h
})
.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));
}
}
}

Просмотреть файл

@ -32,6 +32,7 @@ use util::str::DOMString;
use string_cache::Atom;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
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 {
if name.as_slice().chars()
.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);
}
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);
element.get_attribute(ns!(""), &Atom::from_slice(to_snake_case(name).as_slice())).map(|attr| {
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()
})
}

Просмотреть файл

@ -238,7 +238,9 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
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
@ -781,7 +783,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
h
})
.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));
}
}
}

Просмотреть файл

@ -59,7 +59,12 @@ impl HTMLLinkElement {
fn get_attr(element: JSRef<Element>, name: &Atom) -> Option<String> {
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 {

Просмотреть файл

@ -177,7 +177,9 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value
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

Просмотреть файл

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

Просмотреть файл

@ -33,11 +33,19 @@ impl NamedNodeMap {
impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> {
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>> {
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>> {

Просмотреть файл

@ -856,7 +856,9 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
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 {
@ -865,8 +867,10 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
*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 {
uniqueId: self.unique_id.borrow().clone(),
uniqueId: unique_id.clone(),
baseURI: self.GetBaseURI().unwrap_or("".to_owned()),
parent: self.GetParentNode().root().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
nodeType: self.NodeType() as uint,
@ -1122,7 +1126,7 @@ impl NodeIterator {
}
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()
};
@ -1163,10 +1167,10 @@ impl<'a> Iterator for NodeIterator {
.expect("Got to root without reaching start node")
.root()
.get_unsound_ref_forever();
self.depth -= 1;
if JS::from_rooted(candidate) == self.start_node {
break;
}
self.depth -= 1;
}
if JS::from_rooted(candidate) != self.start_node {
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 {
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).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 {
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
let other_element: JSRef<Element> = ElementCast::to_ref(other).unwrap();
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| {
(*attr.r().namespace() == *other_attr.r().namespace()) &&
(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>> {
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
// of disambiguating methods.
@ -2305,12 +2316,22 @@ impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
match attr.namespace {
NamespaceConstraint::Specific(ref ns) => {
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 => {
self.as_element().get_attributes(name).into_iter()
.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())
})
}
}
}

Просмотреть файл

@ -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 first_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>>>;
}
impl<'a> TreeWalkerHelpers<'a> for JSRef<'a, TreeWalker> {
impl<'a> TreeWalkerHelpers for JSRef<'a, TreeWalker> {
// http://dom.spec.whatwg.org/#dom-treewalker-parentnode
fn parent_node(self) -> Fallible<Option<Temporary<Node>>> {
// "1. Let node be the value of the currentNode attribute."

Просмотреть файл

@ -53,7 +53,10 @@ impl URLSearchParams {
let u = u.root();
let usp = usp.r();
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 => {}
}
@ -81,11 +84,15 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
}
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 {
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) {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -179,11 +179,11 @@ impl Window {
&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()
}
pub fn browser_context(&self) -> Ref<Option<BrowserContext>> {
pub fn browser_context<'a>(&'a self) -> Ref<'a, Option<BrowserContext>> {
self.browser_context.borrow()
}
@ -281,7 +281,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
}
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> {
@ -301,7 +303,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
}
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> {
@ -356,7 +360,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::from_rooted(self)
}
fn Self(self) -> Temporary<Window> {
fn Self_(self) -> Temporary<Window> {
self.Window()
}
@ -373,7 +377,10 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
browser_context.frame_element().map_or(self.Window(), |fe| {
let frame_element = fe.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> {
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) {
@ -688,7 +697,9 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
}
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) {

Просмотреть файл

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

Просмотреть файл

@ -369,9 +369,13 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
// Step 4
Some(Method::Connect) | Some(Method::Trace) => 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
let base = self.global.root().r().get_url();
@ -675,7 +679,9 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
self.status.get()
}
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> {
self.filter_response_headers().iter().find(|h| {
@ -981,9 +987,12 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
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
// 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 {
// http://fetch.spec.whatwg.org/#concept-response-header-list
@ -992,7 +1001,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
use hyper::header::SetCookie;
// a dummy header so we can use headers.remove::<SetCookie2>()
#[derive(Clone)]
#[derive(Clone, Debug)]
struct SetCookie2;
impl Header for SetCookie2 {
fn header_name() -> &'static str {

Просмотреть файл

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

Просмотреть файл

@ -831,7 +831,7 @@ impl ScriptTask {
fn handle_page_fetch_complete(&self, id: PipelineId, subpage: Option<SubpageId>,
response: LoadResponse) {
// 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
}).unwrap();
let load = self.incomplete_loads.borrow_mut().remove(idx);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,4 +1,4 @@
paths = ["../../support/android-rs-glue"]
[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"

484
servo/components/servo/Cargo.lock сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -4,8 +4,6 @@
#![feature(core, env, libc, path, rustc_private, std_misc, thread_local)]
#![allow(missing_copy_implementations)]
#[macro_use]
extern crate log;
@ -57,13 +55,14 @@ use std::sync::mpsc::channel;
#[cfg(not(test))]
use std::thread::Builder;
pub struct Browser<Window> {
pub struct Browser {
compositor: Box<CompositorEventListener + 'static>,
}
impl<Window> Browser<Window> where Window: WindowMethods + 'static {
impl Browser {
#[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;
::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) {
Ok(url) => url,
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"),
};

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -2,7 +2,7 @@
* 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/. */
#![feature(path, io, env)]
#![feature(env, old_io, old_path)]
use std::env;
use std::old_path::Path;
@ -28,6 +28,6 @@ fn main() {
.output()
.unwrap();
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();
}

Просмотреть файл

@ -66,14 +66,13 @@ pub trait PresentationalHintSynthesis {
/// `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
/// style sharing.
fn synthesize_presentational_hints_for_legacy_attributes<'a,E,N,V>(
fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>(
&self,
node: &N,
matching_rules_list: &mut V,
shareable: &mut bool)
where E: TElement<'a> +
TElementAttributes,
N: TNode<'a,E>,
where N: TNode<'a>,
N::Element: TElementAttributes,
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
/// Synthesizes rules for the legacy `bgcolor` attribute.
fn synthesize_presentational_hint_for_legacy_background_color_attribute<'a,E,V>(
@ -100,14 +99,13 @@ pub trait PresentationalHintSynthesis {
}
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,
node: &N,
matching_rules_list: &mut V,
shareable: &mut bool)
where E: TElement<'a> +
TElementAttributes,
N: TNode<'a,E>,
where N: TNode<'a>,
N::Element: TElementAttributes,
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> {
let element = node.as_element();
match element.get_local_name() {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -169,7 +169,7 @@ impl Stylist {
/// 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
/// 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,
element: &N,
parent_bf: &Option<Box<BloomFilter>>,
@ -177,8 +177,8 @@ impl Stylist {
pseudo_element: Option<PseudoElement>,
applicable_declarations: &mut V)
-> bool
where E: TElement<'a> + TElementAttributes,
N: TNode<'a,E>,
where N: TNode<'a>,
N::Element: TElementAttributes,
V: VecLike<DeclarationBlock> {
assert!(!self.is_dirty);
assert!(element.is_element());

Просмотреть файл

@ -873,6 +873,7 @@ pub mod computed {
use geom::size::Size2D;
use properties::longhands;
use std::fmt;
use std::marker::MarkerTrait;
use std::ops::{Add, Mul};
use url::Url;
use util::geometry::Au;
@ -909,7 +910,7 @@ pub mod computed {
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 {
type ComputedValue = T;

Просмотреть файл

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

Просмотреть файл

@ -12,6 +12,7 @@ use std::hash::{Hash, Hasher, SipHasher};
use std::iter::repeat;
use rand;
use std::slice::Iter;
use std::default::Default;
#[cfg(test)]
use std::cell::Cell;
@ -21,12 +22,12 @@ pub struct HashCache<K, V> {
}
impl<K, V> HashCache<K,V>
where K: Clone + PartialEq + Eq + Hash<SipHasher>,
where K: Clone + PartialEq + Eq + Hash,
V: Clone,
{
pub fn new() -> HashCache<K,V> {
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,
}
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> {
let mut r = rand::thread_rng();
SimpleHashCache {
@ -149,7 +150,7 @@ impl<K:Clone+Eq+Hash<SipHasher>,V:Clone> SimpleHashCache<K,V> {
}
#[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);
key.hash(&mut hasher);
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));
}
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);
match self.entries[bucket_index] {
Some((ref existing_key, ref value)) if key == existing_key => Some((*value).clone()),

Просмотреть файл

@ -78,6 +78,8 @@ struct Deque<T> {
pool: BufferPool<T>,
}
unsafe impl<T> Send for Deque<T> {}
/// 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.
///
@ -144,7 +146,7 @@ struct 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
/// deques.
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() } }
}
impl<T: Send> Worker<T> {
impl<T: Send + 'static> Worker<T> {
/// Pushes data onto the front of this work queue.
pub fn push(&self, t: 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)
pub fn steal(&self) -> Stolen<T> {
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
// 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> {
let buf = pool.alloc(MIN_BITS);
Deque {
@ -330,7 +332,7 @@ impl<T: Send> Deque<T> {
#[unsafe_destructor]
impl<T: Send> Drop for Deque<T> {
impl<T: Send + 'static> Drop for Deque<T> {
fn drop(&mut self) {
let t = self.top.load(SeqCst);
let b = self.bottom.load(SeqCst);

Просмотреть файл

@ -4,14 +4,14 @@
//! Utility functions for doubly-linked lists.
use std::collections::DList;
use std::collections::LinkedList;
use std::mem;
/// 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
if list.len() == 1 {
return mem::replace(list, DList::new());
return mem::replace(list, LinkedList::new());
}
let tail = list.split_off(1);
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.
#[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);
mem::swap(this, other);
}

Просмотреть файл

@ -5,7 +5,8 @@
//! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs
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
/// 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 {
type Output = u64;
fn reset(&mut self) { *self = Default::default(); }
fn finish(&self) -> u64 { self.0 }
}
impl Writer for FnvHasher {
fn write(&mut self, bytes: &[u8]) {
let FnvHasher(mut hash) = *self;
for byte in bytes.iter() {
hash = hash ^ (*byte as u64);
hash = hash * 0x100000001b3;
hash = hash.wrapping_mul(0x100000001b3);
}
*self = FnvHasher(hash);
}

Просмотреть файл

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

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше