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

@ -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 = "*"

View file

@ -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);

View file

@ -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
}

View file

@ -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),

View file

@ -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={:?}: \
{:?}",

View file

@ -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(),
}
}

View file

@ -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

View file

@ -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,

View file

@ -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 {

View file

@ -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);

View file

@ -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;

View file

@ -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.

View file

@ -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))