mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
This commit is contained in:
parent
ff8cbff810
commit
95fc29fa0d
255 changed files with 3550 additions and 3362 deletions
|
@ -52,6 +52,7 @@ use style::{matches, SelectorList};
|
|||
|
||||
use js::jsapi::{JSContext, JSObject, JSTracer, JSRuntime};
|
||||
use js::jsfriendapi;
|
||||
use core::nonzero::NonZero;
|
||||
use libc;
|
||||
use libc::{uintptr_t, c_void};
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -122,7 +123,6 @@ impl NodeDerived for EventTarget {
|
|||
bitflags! {
|
||||
#[doc = "Flags for node items."]
|
||||
#[jstraceable]
|
||||
#[deriving(Copy)]
|
||||
flags NodeFlags: u16 {
|
||||
#[doc = "Specifies whether this node is in a document."]
|
||||
const IS_IN_DOC = 0x01,
|
||||
|
@ -183,7 +183,7 @@ impl Drop for Node {
|
|||
/// suppress observers flag
|
||||
/// http://dom.spec.whatwg.org/#concept-node-insert
|
||||
/// http://dom.spec.whatwg.org/#concept-node-remove
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
enum SuppressObserver {
|
||||
Suppressed,
|
||||
Unsuppressed
|
||||
|
@ -199,14 +199,14 @@ pub struct SharedLayoutData {
|
|||
pub struct LayoutData {
|
||||
chan: Option<LayoutChan>,
|
||||
_shared_data: SharedLayoutData,
|
||||
_data: *const (),
|
||||
_data: NonZero<*const ()>,
|
||||
}
|
||||
|
||||
pub struct LayoutDataRef {
|
||||
pub data_cell: RefCell<Option<LayoutData>>,
|
||||
}
|
||||
|
||||
no_jsmanaged_fields!(LayoutDataRef)
|
||||
no_jsmanaged_fields!(LayoutDataRef);
|
||||
|
||||
impl LayoutDataRef {
|
||||
pub fn new() -> LayoutDataRef {
|
||||
|
@ -225,8 +225,8 @@ impl LayoutDataRef {
|
|||
pub fn take_chan(&self) -> Option<LayoutChan> {
|
||||
let mut layout_data = self.data_cell.borrow_mut();
|
||||
match &mut *layout_data {
|
||||
&None => None,
|
||||
&Some(ref mut layout_data) => Some(layout_data.chan.take().unwrap()),
|
||||
&mut None => None,
|
||||
&mut Some(ref mut layout_data) => Some(layout_data.chan.take().unwrap()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,8 +255,10 @@ impl LayoutDataRef {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for LayoutDataRef {}
|
||||
|
||||
/// The different types of nodes.
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
#[derive(Copy, PartialEq, Show)]
|
||||
#[jstraceable]
|
||||
pub enum NodeTypeId {
|
||||
DocumentType,
|
||||
|
@ -387,7 +389,9 @@ impl<'a> QuerySelectorIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<JSRef<'a, Node>> for QuerySelectorIterator<'a> {
|
||||
impl<'a> Iterator for QuerySelectorIterator<'a> {
|
||||
type Item = JSRef<'a, Node>;
|
||||
|
||||
fn next(&mut self) -> Option<JSRef<'a, Node>> {
|
||||
let selectors = &self.selectors;
|
||||
// TODO(cgaebel): Is it worth it to build a bloom filter here
|
||||
|
@ -501,7 +505,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
s.push_str(self.debug_str().as_slice());
|
||||
debug!("{}", s);
|
||||
debug!("{:?}", s);
|
||||
|
||||
// FIXME: this should have a pure version?
|
||||
for kid in self.children() {
|
||||
|
@ -511,7 +515,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
|
||||
/// Returns a string that describes this node.
|
||||
fn debug_str(self) -> String {
|
||||
format!("{}", self.type_id)
|
||||
format!("{:?}", self.type_id)
|
||||
}
|
||||
|
||||
fn is_in_doc(self) -> bool {
|
||||
|
@ -825,8 +829,12 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
fn child_elements(self) -> ChildElementIterator<'a> {
|
||||
fn cast(n: JSRef<Node>) -> Option<JSRef<Element>> {
|
||||
ElementCast::to_ref(n)
|
||||
}
|
||||
|
||||
self.children()
|
||||
.filter_map::<JSRef<Element>>(ElementCast::to_ref)
|
||||
.filter_map(cast as fn(JSRef<Node>) -> Option<JSRef<Element>>)
|
||||
.peekable()
|
||||
}
|
||||
|
||||
|
@ -861,9 +869,12 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
publicId: "".to_owned(),
|
||||
systemId: "".to_owned(),
|
||||
|
||||
attrs: match ElementCast::to_ref(self) {
|
||||
Some(element) => element.summarize(),
|
||||
None => vec!(),
|
||||
attrs: {
|
||||
let e: Option<JSRef<Element>> = ElementCast::to_ref(self);
|
||||
match e {
|
||||
Some(element) => element.summarize(),
|
||||
None => vec!(),
|
||||
}
|
||||
},
|
||||
|
||||
isDocumentElement:
|
||||
|
@ -1007,16 +1018,18 @@ impl RawLayoutNodeHelpers for Node {
|
|||
|
||||
pub type ChildElementIterator<'a> =
|
||||
Peekable<JSRef<'a, Element>,
|
||||
FilterMap<'a,
|
||||
JSRef<'a, Node>,
|
||||
FilterMap<JSRef<'a, Node>,
|
||||
JSRef<'a, Element>,
|
||||
NodeChildrenIterator<'a>>>;
|
||||
NodeChildrenIterator<'a>,
|
||||
fn(JSRef<Node>) -> Option<JSRef<Element>>>>;
|
||||
|
||||
pub struct NodeChildrenIterator<'a> {
|
||||
current: Option<JSRef<'a, Node>>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator<JSRef<'a, Node>> for NodeChildrenIterator<'a> {
|
||||
impl<'a> Iterator for NodeChildrenIterator<'a> {
|
||||
type Item = JSRef<'a, Node>;
|
||||
|
||||
fn next(&mut self) -> Option<JSRef<'a, Node>> {
|
||||
let node = self.current;
|
||||
self.current = node.and_then(|node| node.next_sibling().map(|node| *node.root()));
|
||||
|
@ -1028,7 +1041,9 @@ pub struct ReverseChildrenIterator {
|
|||
current: Option<Root<Node>>,
|
||||
}
|
||||
|
||||
impl Iterator<Temporary<Node>> for ReverseChildrenIterator {
|
||||
impl Iterator for ReverseChildrenIterator {
|
||||
type Item = Temporary<Node>;
|
||||
|
||||
fn next(&mut self) -> Option<Temporary<Node>> {
|
||||
let node = self.current.r().map(Temporary::from_rooted);
|
||||
self.current = self.current.take().and_then(|node| node.r().prev_sibling()).root();
|
||||
|
@ -1040,7 +1055,9 @@ pub struct AncestorIterator<'a> {
|
|||
current: Option<JSRef<'a, Node>>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator<JSRef<'a, Node>> for AncestorIterator<'a> {
|
||||
impl<'a> Iterator for AncestorIterator<'a> {
|
||||
type Item = JSRef<'a, Node>;
|
||||
|
||||
fn next(&mut self) -> Option<JSRef<'a, Node>> {
|
||||
let node = self.current;
|
||||
self.current = node.and_then(|node| node.parent_node().map(|node| *node.root()));
|
||||
|
@ -1063,7 +1080,9 @@ impl<'a> TreeIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<JSRef<'a, Node>> for TreeIterator<'a> {
|
||||
impl<'a> Iterator for TreeIterator<'a> {
|
||||
type Item = JSRef<'a, Node>;
|
||||
|
||||
fn next(&mut self) -> Option<JSRef<'a, Node>> {
|
||||
let ret = self.stack.pop();
|
||||
ret.map(|node| {
|
||||
|
@ -1096,7 +1115,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()
|
||||
};
|
||||
|
||||
|
@ -1107,7 +1126,9 @@ impl NodeIterator {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<JSRef<'a, Node>> for NodeIterator {
|
||||
impl<'a> Iterator for NodeIterator {
|
||||
type Item = JSRef<'a, Node>;
|
||||
|
||||
fn next(&mut self) -> Option<JSRef<'a, Node>> {
|
||||
self.current_node = match self.current_node.as_ref().map(|node| node.root()) {
|
||||
None => {
|
||||
|
@ -1155,7 +1176,7 @@ impl<'a> Iterator<JSRef<'a, Node>> for NodeIterator {
|
|||
}
|
||||
|
||||
/// Specifies whether children must be recursively cloned or not.
|
||||
#[deriving(Copy, PartialEq)]
|
||||
#[derive(Copy, PartialEq)]
|
||||
pub enum CloneChildrenFlag {
|
||||
CloneChildren,
|
||||
DoNotCloneChildren
|
||||
|
@ -1635,13 +1656,13 @@ impl Node {
|
|||
None => {}
|
||||
Some(chan) => {
|
||||
let LayoutChan(chan) = chan;
|
||||
chan.send(Msg::ReapLayoutData(layout_data))
|
||||
chan.send(Msg::ReapLayoutData(layout_data)).unwrap()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn collect_text_contents<'a, T: Iterator<JSRef<'a, Node>>>(mut iterator: T) -> String {
|
||||
pub fn collect_text_contents<'a, T: Iterator<Item=JSRef<'a, Node>>>(mut iterator: T) -> String {
|
||||
let mut content = String::new();
|
||||
for node in iterator {
|
||||
let text: Option<JSRef<Text>> = TextCast::to_ref(node);
|
||||
|
@ -1989,7 +2010,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
fn Normalize(self) {
|
||||
let mut prev_text = None;
|
||||
for child in self.children() {
|
||||
match TextCast::to_ref(child) {
|
||||
let t: Option<JSRef<Text>> = TextCast::to_ref(child);
|
||||
match t {
|
||||
Some(text) => {
|
||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::from_ref(text);
|
||||
if characterdata.Length() == 0 {
|
||||
|
@ -2185,9 +2207,11 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
/// and are also used in the HTML parser interface.
|
||||
|
||||
#[allow(raw_pointer_deriving)]
|
||||
#[deriving(Clone, PartialEq, Eq, Copy)]
|
||||
#[derive(Clone, PartialEq, Eq, Copy)]
|
||||
pub struct TrustedNodeAddress(pub *const c_void);
|
||||
|
||||
unsafe impl Send for TrustedNodeAddress {}
|
||||
|
||||
pub fn document_from_node<T: NodeBase+Reflectable>(derived: JSRef<T>) -> Temporary<Document> {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(derived);
|
||||
node.owner_doc()
|
||||
|
@ -2280,7 +2304,9 @@ impl<'a> style::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
|
|||
ElementCast::to_ref(self).unwrap()
|
||||
}
|
||||
|
||||
fn match_attr(self, attr: &style::AttrSelector, test: |&str| -> bool) -> bool {
|
||||
fn match_attr<F>(self, attr: &style::AttrSelector, test: F) -> bool
|
||||
where F: Fn(&str) -> bool
|
||||
{
|
||||
let name = {
|
||||
if self.is_html_element_in_html_document() {
|
||||
&attr.lower_name
|
||||
|
@ -2367,7 +2393,7 @@ impl<'a> DisabledStateHelpers for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
/// A summary of the changes that happened to a node.
|
||||
#[deriving(Copy, Clone, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum NodeDamage {
|
||||
/// The node's `style` attribute changed.
|
||||
NodeStyleDamaged,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue