mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Upgrade to latest Rust.
This commit is contained in:
parent
56dd5b943e
commit
f5b5b337d3
99 changed files with 269 additions and 253 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 0935beba717bf6d3b54ad1b2eace359dea5dfca0
|
Subproject commit 9f8d2205f0518389993a9b5de6646ba8b14e5a12
|
|
@ -1 +1 @@
|
||||||
0935beba717bf6d3b54ad1b2eace359dea5dfca0/rust-0.11.0-pre
|
9f8d2205f0518389993a9b5de6646ba8b14e5a12/rust-0.11.0-pre
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
use layers::platform::surface::NativePaintingGraphicsContext;
|
use layers::platform::surface::NativePaintingGraphicsContext;
|
||||||
use servo_msg::compositor_msg::Tile;
|
use servo_msg::compositor_msg::Tile;
|
||||||
|
@ -26,7 +26,7 @@ pub struct BufferMap<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A key with which to store buffers. It is based on the size of the buffer.
|
/// A key with which to store buffers. It is based on the size of the buffer.
|
||||||
#[deriving(TotalEq)]
|
#[deriving(Eq)]
|
||||||
struct BufferKey([uint, ..2]);
|
struct BufferKey([uint, ..2]);
|
||||||
|
|
||||||
impl Hash for BufferKey {
|
impl Hash for BufferKey {
|
||||||
|
@ -36,7 +36,7 @@ impl Hash for BufferKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for BufferKey {
|
impl PartialEq for BufferKey {
|
||||||
fn eq(&self, other: &BufferKey) -> bool {
|
fn eq(&self, other: &BufferKey) -> bool {
|
||||||
let BufferKey(s) = *self;
|
let BufferKey(s) = *self;
|
||||||
let BufferKey(o) = *other;
|
let BufferKey(o) = *other;
|
||||||
|
|
|
@ -19,7 +19,7 @@ use render_context::RenderContext;
|
||||||
use text::glyph::CharIndex;
|
use text::glyph::CharIndex;
|
||||||
use text::TextRun;
|
use text::TextRun;
|
||||||
|
|
||||||
use collections::deque::Deque;
|
use std::collections::Deque;
|
||||||
use collections::dlist::DList;
|
use collections::dlist::DList;
|
||||||
use collections::dlist;
|
use collections::dlist;
|
||||||
use geom::{Point2D, Rect, SideOffsets2D, Size2D};
|
use geom::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
|
@ -41,7 +41,7 @@ pub mod optimizer;
|
||||||
/// Because the script task's GC does not trace layout, node data cannot be safely stored in layout
|
/// Because the script task's GC does not trace layout, node data cannot be safely stored in layout
|
||||||
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
|
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
|
||||||
/// locality reasons. Using `OpaqueNode` enforces this invariant.
|
/// locality reasons. Using `OpaqueNode` enforces this invariant.
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub struct OpaqueNode(pub uintptr_t);
|
pub struct OpaqueNode(pub uintptr_t);
|
||||||
|
|
||||||
impl OpaqueNode {
|
impl OpaqueNode {
|
||||||
|
@ -53,7 +53,7 @@ impl OpaqueNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "Steps" as defined by CSS 2.1 § E.2.
|
/// "Steps" as defined by CSS 2.1 § E.2.
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub enum StackingLevel {
|
pub enum StackingLevel {
|
||||||
/// The border and backgrounds for the root of this stacking context: steps 1 and 2.
|
/// The border and backgrounds for the root of this stacking context: steps 1 and 2.
|
||||||
BackgroundAndBordersStackingLevel,
|
BackgroundAndBordersStackingLevel,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use display_list::{BorderDisplayItemClass, ClipDisplayItem, ClipDisplayItemClass
|
||||||
use display_list::{DisplayList, ImageDisplayItemClass, LineDisplayItemClass};
|
use display_list::{DisplayList, ImageDisplayItemClass, LineDisplayItemClass};
|
||||||
use display_list::{PseudoDisplayItemClass, SolidColorDisplayItemClass, TextDisplayItemClass};
|
use display_list::{PseudoDisplayItemClass, SolidColorDisplayItemClass, TextDisplayItemClass};
|
||||||
|
|
||||||
use collections::deque::Deque;
|
use std::collections::Deque;
|
||||||
use collections::dlist::DList;
|
use collections::dlist::DList;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
|
|
|
@ -94,7 +94,7 @@ pub struct FontMetrics {
|
||||||
// the instance's properties.
|
// the instance's properties.
|
||||||
//
|
//
|
||||||
// For now, the cases are differentiated with a typedef
|
// For now, the cases are differentiated with a typedef
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub struct FontStyle {
|
pub struct FontStyle {
|
||||||
pub pt_size: f64,
|
pub pt_size: f64,
|
||||||
pub weight: font_weight::T,
|
pub weight: font_weight::T,
|
||||||
|
@ -112,7 +112,7 @@ pub type UsedFontStyle = FontStyle;
|
||||||
// It's used to swizzle/unswizzle gfx::Font instances when
|
// It's used to swizzle/unswizzle gfx::Font instances when
|
||||||
// communicating across tasks, such as the display list between layout
|
// communicating across tasks, such as the display list between layout
|
||||||
// and render tasks.
|
// and render tasks.
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub struct FontDescriptor {
|
pub struct FontDescriptor {
|
||||||
pub style: UsedFontStyle,
|
pub style: UsedFontStyle,
|
||||||
pub selector: FontSelector,
|
pub selector: FontSelector,
|
||||||
|
@ -128,7 +128,7 @@ impl FontDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// A FontSelector is a platform-specific strategy for serializing face names.
|
// A FontSelector is a platform-specific strategy for serializing face names.
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub enum FontSelector {
|
pub enum FontSelector {
|
||||||
SelectorPlatformIdentifier(String),
|
SelectorPlatformIdentifier(String),
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use platform::font::FontHandle;
|
||||||
use platform::font_context::FontContextHandle;
|
use platform::font_context::FontContextHandle;
|
||||||
|
|
||||||
use azure::azure_hl::BackendType;
|
use azure::azure_hl::BackendType;
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use servo_util::cache::{Cache, LRUCache};
|
use servo_util::cache::{Cache, LRUCache};
|
||||||
use servo_util::time::TimeProfilerChan;
|
use servo_util::time::TimeProfilerChan;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use font::SpecifiedFontStyle;
|
use font::SpecifiedFontStyle;
|
||||||
use gfx_font::FontHandleMethods;
|
use gfx_font::FontHandleMethods;
|
||||||
use platform::font::FontHandle;
|
use platform::font::FontHandle;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#![feature(globs, macro_rules, phase)]
|
#![feature(globs, macro_rules, phase)]
|
||||||
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
|
@ -21,10 +21,10 @@ extern crate layers;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate stb_image;
|
extern crate stb_image;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
#[phase(syntax)]
|
#[phase(plugin)]
|
||||||
extern crate servo_macros = "macros";
|
extern crate servo_macros = "macros";
|
||||||
extern crate servo_net = "net";
|
extern crate servo_net = "net";
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
extern crate servo_msg = "msg";
|
extern crate servo_msg = "msg";
|
||||||
extern crate style;
|
extern crate style;
|
||||||
|
|
|
@ -25,7 +25,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap};
|
||||||
use platform::font::FontHandle;
|
use platform::font::FontHandle;
|
||||||
use platform::font_context::FontContextHandle;
|
use platform::font_context::FontContextHandle;
|
||||||
|
|
||||||
use collections::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use libc;
|
use libc;
|
||||||
use libc::{c_int, c_char};
|
use libc::{c_int, c_char};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
|
@ -27,7 +27,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap};
|
||||||
use platform::font::FontHandle;
|
use platform::font::FontHandle;
|
||||||
use platform::font_context::FontContextHandle;
|
use platform::font_context::FontContextHandle;
|
||||||
|
|
||||||
use collections::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use libc;
|
use libc;
|
||||||
use libc::{c_int, c_char};
|
use libc::{c_int, c_char};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap};
|
||||||
use platform::macos::font::FontHandle;
|
use platform::macos::font::FontHandle;
|
||||||
use platform::macos::font_context::FontContextHandle;
|
use platform::macos::font_context::FontContextHandle;
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use core_foundation::base::TCFType;
|
use core_foundation::base::TCFType;
|
||||||
use core_foundation::string::{CFString, CFStringRef};
|
use core_foundation::string::{CFString, CFStringRef};
|
||||||
use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef};
|
use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use servo_util::range;
|
||||||
use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex};
|
use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex};
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
|
|
||||||
use std::cmp::{Ord, Eq};
|
use std::cmp::{PartialOrd, PartialEq};
|
||||||
use std::num::{NumCast, Zero};
|
use std::num::{NumCast, Zero};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::u16;
|
use std::u16;
|
||||||
|
@ -87,7 +87,7 @@ impl GlyphEntry {
|
||||||
pub type GlyphId = u32;
|
pub type GlyphId = u32;
|
||||||
|
|
||||||
// TODO: unify with bit flags?
|
// TODO: unify with bit flags?
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum BreakType {
|
pub enum BreakType {
|
||||||
BreakTypeNone,
|
BreakTypeNone,
|
||||||
BreakTypeNormal,
|
BreakTypeNormal,
|
||||||
|
@ -270,7 +270,7 @@ impl DetailedGlyph {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone, TotalEq)]
|
#[deriving(PartialEq, Clone, Eq)]
|
||||||
struct DetailedGlyphRecord {
|
struct DetailedGlyphRecord {
|
||||||
// source string offset/GlyphEntry offset in the TextRun
|
// source string offset/GlyphEntry offset in the TextRun
|
||||||
entry_offset: CharIndex,
|
entry_offset: CharIndex,
|
||||||
|
@ -278,13 +278,13 @@ struct DetailedGlyphRecord {
|
||||||
detail_offset: int,
|
detail_offset: int,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for DetailedGlyphRecord {
|
impl PartialOrd for DetailedGlyphRecord {
|
||||||
fn lt(&self, other: &DetailedGlyphRecord) -> bool {
|
fn lt(&self, other: &DetailedGlyphRecord) -> bool {
|
||||||
self.entry_offset < other.entry_offset
|
self.entry_offset < other.entry_offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TotalOrd for DetailedGlyphRecord {
|
impl Ord for DetailedGlyphRecord {
|
||||||
fn cmp(&self, other: &DetailedGlyphRecord) -> Ordering {
|
fn cmp(&self, other: &DetailedGlyphRecord) -> Ordering {
|
||||||
self.entry_offset.cmp(&other.entry_offset)
|
self.entry_offset.cmp(&other.entry_offset)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use text::glyph::CharIndex;
|
use text::glyph::CharIndex;
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum CompressionMode {
|
pub enum CompressionMode {
|
||||||
CompressNone,
|
CompressNone,
|
||||||
CompressWhitespace,
|
CompressWhitespace,
|
||||||
|
@ -82,7 +82,7 @@ pub fn transform_text(text: &str, mode: CompressionMode,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (out_str.into_owned(), out_whitespace);
|
return (out_str.into_string(), out_whitespace);
|
||||||
|
|
||||||
fn is_in_whitespace(ch: char, mode: CompressionMode) -> bool {
|
fn is_in_whitespace(ch: char, mode: CompressionMode) -> bool {
|
||||||
match (ch, mode) {
|
match (ch, mode) {
|
||||||
|
|
|
@ -61,14 +61,13 @@ macro_rules! lazy_init(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
extern crate collections;
|
use std::collections::hashmap::HashMap;
|
||||||
|
|
||||||
lazy_init! {
|
lazy_init! {
|
||||||
static ref NUMBER: uint = times_two(3);
|
static ref NUMBER: uint = times_two(3);
|
||||||
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
|
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
|
||||||
static ref OWNED_STRING: String = "hello".to_string();
|
static ref OWNED_STRING: String = "hello".to_string();
|
||||||
static ref HASHMAP: collections::HashMap<uint, &'static str> = {
|
static ref HASHMAP: HashMap<uint, &'static str> = {
|
||||||
let mut m = collections::HashMap::new();
|
let mut m = HashMap::new();
|
||||||
m.insert(0u, "abc");
|
m.insert(0u, "abc");
|
||||||
m.insert(1, "def");
|
m.insert(1, "def");
|
||||||
m.insert(2, "ghi");
|
m.insert(2, "ghi");
|
||||||
|
|
|
@ -386,9 +386,10 @@ impl IOCompositor {
|
||||||
|
|
||||||
self.root_layer.remove_all_children();
|
self.root_layer.remove_all_children();
|
||||||
|
|
||||||
|
let new_layer_id = new_layer.id;
|
||||||
assert!(new_layer.add_child_if_necessary(self.root_layer.clone(),
|
assert!(new_layer.add_child_if_necessary(self.root_layer.clone(),
|
||||||
root_pipeline_id,
|
root_pipeline_id,
|
||||||
new_layer.id,
|
new_layer_id,
|
||||||
layer_id,
|
layer_id,
|
||||||
Rect(Point2D(0f32, 0f32), size),
|
Rect(Point2D(0f32, 0f32), size),
|
||||||
size,
|
size,
|
||||||
|
@ -414,13 +415,14 @@ impl IOCompositor {
|
||||||
scroll_policy: ScrollPolicy) {
|
scroll_policy: ScrollPolicy) {
|
||||||
match self.compositor_layer {
|
match self.compositor_layer {
|
||||||
Some(ref mut compositor_layer) => {
|
Some(ref mut compositor_layer) => {
|
||||||
|
let compositor_layer_id = compositor_layer.id;
|
||||||
|
let page_size = compositor_layer.page_size.unwrap();
|
||||||
assert!(compositor_layer.add_child_if_necessary(self.root_layer.clone(),
|
assert!(compositor_layer.add_child_if_necessary(self.root_layer.clone(),
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
compositor_layer.id,
|
compositor_layer_id,
|
||||||
layer_id,
|
layer_id,
|
||||||
rect,
|
rect,
|
||||||
compositor_layer.page_size
|
page_size,
|
||||||
.unwrap(),
|
|
||||||
scroll_policy))
|
scroll_policy))
|
||||||
}
|
}
|
||||||
None => fail!("Compositor: Received new layer without initialized pipeline"),
|
None => fail!("Compositor: Received new layer without initialized pipeline"),
|
||||||
|
|
|
@ -122,7 +122,7 @@ impl MaybeQuadtree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum WantsScrollEventsFlag {
|
pub enum WantsScrollEventsFlag {
|
||||||
WantsScrollEvents,
|
WantsScrollEvents,
|
||||||
DoesntWantScrollEvents,
|
DoesntWantScrollEvents,
|
||||||
|
@ -345,8 +345,8 @@ impl CompositorLayer {
|
||||||
if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) {
|
if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
let offset = self.scroll_offset;
|
||||||
self.scroll(self.scroll_offset)
|
self.scroll(offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -616,8 +616,8 @@ impl CompositorLayer {
|
||||||
if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) {
|
if old_origin - self.scroll_offset == TypedPoint2D(0f32, 0f32) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
let offset = self.scroll_offset;
|
||||||
self.scroll(self.scroll_offset)
|
self.scroll(offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether the layer should be vertically flipped.
|
// Returns whether the layer should be vertically flipped.
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct QuadtreeNode<T> {
|
||||||
|
|
||||||
/// The status of a QuadtreeNode. This determines the behavior of the node
|
/// The status of a QuadtreeNode. This determines the behavior of the node
|
||||||
/// when querying for tile requests.
|
/// when querying for tile requests.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum NodeStatus {
|
pub enum NodeStatus {
|
||||||
/// If we have no valid tile, request one; otherwise, don't send a request.
|
/// If we have no valid tile, request one; otherwise, don't send a request.
|
||||||
Normal,
|
Normal,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use compositing::{CompositorChan, LoadComplete, SetIds, SetLayerClipRect, ShutdownComplete};
|
use compositing::{CompositorChan, LoadComplete, SetIds, SetLayerClipRect, ShutdownComplete};
|
||||||
|
|
||||||
use collections::hashmap::{HashMap, HashSet};
|
use std::collections::hashmap::{HashMap, HashSet};
|
||||||
use geom::rect::{Rect, TypedRect};
|
use geom::rect::{Rect, TypedRect};
|
||||||
use geom::scale_factor::ScaleFactor;
|
use geom::scale_factor::ScaleFactor;
|
||||||
use geom::size::TypedSize2D;
|
use geom::size::TypedSize2D;
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl ApplicableDeclarationsCacheEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for ApplicableDeclarationsCacheEntry {
|
impl PartialEq for ApplicableDeclarationsCacheEntry {
|
||||||
fn eq(&self, other: &ApplicableDeclarationsCacheEntry) -> bool {
|
fn eq(&self, other: &ApplicableDeclarationsCacheEntry) -> bool {
|
||||||
let this_as_query = ApplicableDeclarationsCacheQuery::new(self.declarations.as_slice());
|
let this_as_query = ApplicableDeclarationsCacheQuery::new(self.declarations.as_slice());
|
||||||
this_as_query.equiv(other)
|
this_as_query.equiv(other)
|
||||||
|
@ -169,7 +169,7 @@ pub struct StyleSharingCandidate {
|
||||||
pub class: Option<DOMString>,
|
pub class: Option<DOMString>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for StyleSharingCandidate {
|
impl PartialEq for StyleSharingCandidate {
|
||||||
fn eq(&self, other: &StyleSharingCandidate) -> bool {
|
fn eq(&self, other: &StyleSharingCandidate) -> bool {
|
||||||
arc_ptr_eq(&self.style, &other.style) &&
|
arc_ptr_eq(&self.style, &other.style) &&
|
||||||
arc_ptr_eq(&self.parent_style, &other.parent_style) &&
|
arc_ptr_eq(&self.parent_style, &other.parent_style) &&
|
||||||
|
|
|
@ -449,13 +449,13 @@ enum BlockType {
|
||||||
FloatNonReplacedType,
|
FloatNonReplacedType,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub enum MarginsMayCollapseFlag {
|
pub enum MarginsMayCollapseFlag {
|
||||||
MarginsMayCollapse,
|
MarginsMayCollapse,
|
||||||
MarginsMayNotCollapse,
|
MarginsMayNotCollapse,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
enum FormattingContextType {
|
enum FormattingContextType {
|
||||||
NonformattingContext,
|
NonformattingContext,
|
||||||
BlockFormattingContext,
|
BlockFormattingContext,
|
||||||
|
|
|
@ -380,7 +380,7 @@ pub trait MutableOwnedFlowUtils {
|
||||||
fn set_abs_descendants(&mut self, abs_descendants: AbsDescendants);
|
fn set_abs_descendants(&mut self, abs_descendants: AbsDescendants);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Show)]
|
#[deriving(PartialEq, Show)]
|
||||||
pub enum FlowClass {
|
pub enum FlowClass {
|
||||||
BlockFlowClass,
|
BlockFlowClass,
|
||||||
InlineFlowClass,
|
InlineFlowClass,
|
||||||
|
|
|
@ -82,7 +82,7 @@ unsafe fn link_with_prev(mut next: FlowRef, prev: Option<FlowRef>) -> Link {
|
||||||
Some(next)
|
Some(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Container for FlowList {
|
impl Collection for FlowList {
|
||||||
/// O(1)
|
/// O(1)
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
|
|
|
@ -151,7 +151,7 @@ int_range_index! {
|
||||||
/// A line index consists of two indices: a fragment index that refers to the
|
/// A line index consists of two indices: a fragment index that refers to the
|
||||||
/// index of a DOM fragment within a flattened inline element; and a glyph index
|
/// index of a DOM fragment within a flattened inline element; and a glyph index
|
||||||
/// where the 0th glyph refers to the first glyph of that fragment.
|
/// where the 0th glyph refers to the first glyph of that fragment.
|
||||||
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Zero)]
|
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Zero)]
|
||||||
pub struct LineIndices {
|
pub struct LineIndices {
|
||||||
/// The index of a fragment into the flattened vector of DOM elements.
|
/// The index of a fragment into the flattened vector of DOM elements.
|
||||||
///
|
///
|
||||||
|
@ -1109,9 +1109,10 @@ impl Flow for InlineFlow {
|
||||||
debug!("InlineFlow::assign_widths: floats in: {:?}", self.base.floats);
|
debug!("InlineFlow::assign_widths: floats in: {:?}", self.base.floats);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
let width = self.base.position.size.width;
|
||||||
let this = &mut *self;
|
let this = &mut *self;
|
||||||
for (fragment, context) in this.fragments.mut_iter() {
|
for (fragment, context) in this.fragments.mut_iter() {
|
||||||
fragment.assign_replaced_width_if_necessary(self.base.position.size.width,
|
fragment.assign_replaced_width_if_necessary(width,
|
||||||
Some(context))
|
Some(context))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -895,7 +895,7 @@ impl LayoutTask {
|
||||||
// to the script task, and ultimately cause the image to be
|
// to the script task, and ultimately cause the image to be
|
||||||
// re-requested. We probably don't need to go all the way back to
|
// re-requested. We probably don't need to go all the way back to
|
||||||
// the script task for this.
|
// the script task for this.
|
||||||
fn make_on_image_available_cb(&self) -> Box<ImageResponder:Send> {
|
fn make_on_image_available_cb(&self) -> Box<ImageResponder+Send> {
|
||||||
// This has a crazy signature because the image cache needs to
|
// This has a crazy signature because the image cache needs to
|
||||||
// make multiple copies of the callback, and the dom event
|
// make multiple copies of the callback, and the dom event
|
||||||
// channel is not a copyable type, so this is actually a
|
// channel is not a copyable type, so this is actually a
|
||||||
|
@ -903,7 +903,7 @@ impl LayoutTask {
|
||||||
box LayoutImageResponder {
|
box LayoutImageResponder {
|
||||||
id: self.id.clone(),
|
id: self.id.clone(),
|
||||||
script_chan: self.script_chan.clone(),
|
script_chan: self.script_chan.clone(),
|
||||||
} as Box<ImageResponder:Send>
|
} as Box<ImageResponder+Send>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
|
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
|
||||||
|
|
|
@ -219,7 +219,7 @@ impl TextRunScanner {
|
||||||
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
let run = if clump.length() != CharIndex(0) && run_str.len() > 0 {
|
||||||
Some(Arc::new(box TextRun::new(
|
Some(Arc::new(box TextRun::new(
|
||||||
&mut *fontgroup.borrow().fonts.get(0).borrow_mut(),
|
&mut *fontgroup.borrow().fonts.get(0).borrow_mut(),
|
||||||
run_str.into_owned(), decoration)))
|
run_str.to_string(), decoration)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -150,7 +150,7 @@ impl<'ln> Clone for LayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Eq for LayoutNode<'a> {
|
impl<'a> PartialEq for LayoutNode<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &LayoutNode) -> bool {
|
fn eq(&self, other: &LayoutNode) -> bool {
|
||||||
self.node == other.node
|
self.node == other.node
|
||||||
|
@ -407,7 +407,7 @@ fn get_content(content_list: &content::T) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum PseudoElementType {
|
pub enum PseudoElementType {
|
||||||
Normal,
|
Normal,
|
||||||
Before,
|
Before,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#![feature(globs, macro_rules, phase, thread_local)]
|
#![feature(globs, macro_rules, phase, thread_local)]
|
||||||
|
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
|
@ -27,11 +27,11 @@ extern crate opengles;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
extern crate rustuv;
|
extern crate rustuv;
|
||||||
extern crate script;
|
extern crate script;
|
||||||
#[phase(syntax)]
|
#[phase(plugin)]
|
||||||
extern crate servo_macros = "macros";
|
extern crate servo_macros = "macros";
|
||||||
extern crate servo_net = "net";
|
extern crate servo_net = "net";
|
||||||
extern crate servo_msg = "msg";
|
extern crate servo_msg = "msg";
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
extern crate style;
|
extern crate style;
|
||||||
extern crate sharegl;
|
extern crate sharegl;
|
||||||
|
@ -41,6 +41,7 @@ extern crate collections;
|
||||||
extern crate green;
|
extern crate green;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate native;
|
extern crate native;
|
||||||
|
extern crate rustrt;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate sync;
|
extern crate sync;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
@ -78,7 +79,7 @@ use std::os;
|
||||||
#[cfg(not(test), target_os="android")]
|
#[cfg(not(test), target_os="android")]
|
||||||
use std::str;
|
use std::str;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use std::task::TaskOpts;
|
use rustrt::task::TaskOpts;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -48,13 +48,13 @@ impl LayerBufferSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The status of the renderer.
|
/// The status of the renderer.
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum RenderState {
|
pub enum RenderState {
|
||||||
IdleRenderState,
|
IdleRenderState,
|
||||||
RenderingRenderState,
|
RenderingRenderState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum ReadyState {
|
pub enum ReadyState {
|
||||||
/// Informs the compositor that nothing has been done yet. Used for setting status
|
/// Informs the compositor that nothing has been done yet. Used for setting status
|
||||||
Blank,
|
Blank,
|
||||||
|
@ -67,7 +67,7 @@ pub enum ReadyState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub struct Epoch(pub uint);
|
pub struct Epoch(pub uint);
|
||||||
|
|
||||||
impl Epoch {
|
impl Epoch {
|
||||||
|
@ -77,7 +77,7 @@ impl Epoch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub struct LayerId(pub uint, pub uint);
|
pub struct LayerId(pub uint, pub uint);
|
||||||
|
|
||||||
impl Show for LayerId {
|
impl Show for LayerId {
|
||||||
|
@ -95,7 +95,7 @@ impl LayerId {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The scrolling policy of a layer.
|
/// The scrolling policy of a layer.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum ScrollPolicy {
|
pub enum ScrollPolicy {
|
||||||
/// These layers scroll when the parent receives a scrolling message.
|
/// These layers scroll when the parent receives a scrolling message.
|
||||||
Scrollable,
|
Scrollable,
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl ConstellationChan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum IFrameSandboxState {
|
pub enum IFrameSandboxState {
|
||||||
IFrameSandboxed,
|
IFrameSandboxed,
|
||||||
IFrameUnsandboxed
|
IFrameUnsandboxed
|
||||||
|
@ -62,20 +62,20 @@ pub enum Msg {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the two different ways to which a page can be navigated
|
/// Represents the two different ways to which a page can be navigated
|
||||||
#[deriving(Clone, Eq, Hash)]
|
#[deriving(Clone, PartialEq, Hash)]
|
||||||
pub enum NavigationType {
|
pub enum NavigationType {
|
||||||
Load, // entered or clicked on a url
|
Load, // entered or clicked on a url
|
||||||
Navigate, // browser forward/back buttons
|
Navigate, // browser forward/back buttons
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, Hash)]
|
#[deriving(Clone, PartialEq, Hash)]
|
||||||
pub enum NavigationDirection {
|
pub enum NavigationDirection {
|
||||||
Forward,
|
Forward,
|
||||||
Back,
|
Back,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Hash, Encodable)]
|
#[deriving(Clone, PartialEq, Eq, Hash, Encodable)]
|
||||||
pub struct PipelineId(pub uint);
|
pub struct PipelineId(pub uint);
|
||||||
|
|
||||||
#[deriving(Clone, Eq, TotalEq, Hash, Encodable)]
|
#[deriving(Clone, PartialEq, Eq, Hash, Encodable)]
|
||||||
pub struct SubpageId(pub uint);
|
pub struct SubpageId(pub uint);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use resource_task::{Metadata, Payload, Done, LoadResponse, LoadData, LoaderTask, start_sending_opt};
|
use resource_task::{Metadata, Payload, Done, LoadResponse, LoadData, LoaderTask, start_sending_opt};
|
||||||
|
|
||||||
use collections::hashmap::HashSet;
|
use std::collections::hashmap::HashSet;
|
||||||
use http::client::{RequestWriter, NetworkStream};
|
use http::client::{RequestWriter, NetworkStream};
|
||||||
use http::headers::HeaderEnum;
|
use http::headers::HeaderEnum;
|
||||||
use std::io::Reader;
|
use std::io::Reader;
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub enum ImageResponseMsg {
|
||||||
ImageFailed
|
ImageFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for ImageResponseMsg {
|
impl PartialEq for ImageResponseMsg {
|
||||||
fn eq(&self, other: &ImageResponseMsg) -> bool {
|
fn eq(&self, other: &ImageResponseMsg) -> bool {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(&ImageReady(..), &ImageReady(..)) => fail!("unimplemented comparison"),
|
(&ImageReady(..), &ImageReady(..)) => fail!("unimplemented comparison"),
|
||||||
|
|
|
@ -32,7 +32,7 @@ pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache {
|
||||||
pub struct LocalImageCache {
|
pub struct LocalImageCache {
|
||||||
image_cache_task: ImageCacheTask,
|
image_cache_task: ImageCacheTask,
|
||||||
round_number: uint,
|
round_number: uint,
|
||||||
on_image_available: Option<Box<ImageResponder:Send>>,
|
on_image_available: Option<Box<ImageResponder+Send>>,
|
||||||
state_map: UrlMap<ImageState>
|
state_map: UrlMap<ImageState>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct ImageState {
|
||||||
impl LocalImageCache {
|
impl LocalImageCache {
|
||||||
/// The local cache will only do a single remote request for a given
|
/// The local cache will only do a single remote request for a given
|
||||||
/// URL in each 'round'. Layout should call this each time it begins
|
/// URL in each 'round'. Layout should call this each time it begins
|
||||||
pub fn next_round(&mut self, on_image_available: Box<ImageResponder:Send>) {
|
pub fn next_round(&mut self, on_image_available: Box<ImageResponder+Send>) {
|
||||||
self.round_number += 1;
|
self.round_number += 1;
|
||||||
self.on_image_available = Some(on_image_available);
|
self.on_image_available = Some(on_image_available);
|
||||||
}
|
}
|
||||||
|
@ -80,12 +80,13 @@ impl LocalImageCache {
|
||||||
// FIXME: Should return a Future
|
// FIXME: Should return a Future
|
||||||
pub fn get_image(&mut self, url: &Url) -> Receiver<ImageResponseMsg> {
|
pub fn get_image(&mut self, url: &Url) -> Receiver<ImageResponseMsg> {
|
||||||
{
|
{
|
||||||
|
let round_number = self.round_number;
|
||||||
let state = self.get_state(url);
|
let state = self.get_state(url);
|
||||||
|
|
||||||
// Save the previous round number for comparison
|
// Save the previous round number for comparison
|
||||||
let last_round = state.last_request_round;
|
let last_round = state.last_request_round;
|
||||||
// Set the current round number for this image
|
// Set the current round number for this image
|
||||||
state.last_request_round = self.round_number;
|
state.last_request_round = round_number;
|
||||||
|
|
||||||
match state.last_response {
|
match state.last_response {
|
||||||
ImageReady(ref image) => {
|
ImageReady(ref image) => {
|
||||||
|
@ -94,7 +95,7 @@ impl LocalImageCache {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
ImageNotReady => {
|
ImageNotReady => {
|
||||||
if last_round == self.round_number {
|
if last_round == round_number {
|
||||||
let (chan, port) = channel();
|
let (chan, port) = channel();
|
||||||
chan.send(ImageNotReady);
|
chan.send(ImageNotReady);
|
||||||
return port;
|
return port;
|
||||||
|
|
|
@ -14,7 +14,7 @@ extern crate collections;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate http;
|
extern crate http;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub struct LoadResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Messages sent in response to a `Load` message
|
/// Messages sent in response to a `Load` message
|
||||||
#[deriving(Eq,Show)]
|
#[deriving(PartialEq,Show)]
|
||||||
pub enum ProgressMsg {
|
pub enum ProgressMsg {
|
||||||
/// Binary data - there may be multiple of these
|
/// Binary data - there may be multiple of these
|
||||||
Payload(Vec<u8>),
|
Payload(Vec<u8>),
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub enum AttrSettingType {
|
||||||
ReplacedAttr,
|
ReplacedAttr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone, Encodable)]
|
#[deriving(PartialEq, Clone, Encodable)]
|
||||||
pub enum AttrValue {
|
pub enum AttrValue {
|
||||||
StringAttrValue(DOMString),
|
StringAttrValue(DOMString),
|
||||||
TokenListAttrValue(DOMString, Vec<(uint, uint)>),
|
TokenListAttrValue(DOMString, Vec<(uint, uint)>),
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub enum ExceptionHandling {
|
||||||
RethrowExceptions
|
RethrowExceptions
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone,Eq,Encodable)]
|
#[deriving(Clone,PartialEq,Encodable)]
|
||||||
pub struct CallbackFunction {
|
pub struct CallbackFunction {
|
||||||
object: CallbackObject
|
object: CallbackObject
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,13 @@ impl CallbackFunction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone,Eq,Encodable)]
|
#[deriving(Clone,PartialEq,Encodable)]
|
||||||
pub struct CallbackInterface {
|
pub struct CallbackInterface {
|
||||||
object: CallbackObject
|
object: CallbackObject
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(raw_pointer_deriving)]
|
#[allow(raw_pointer_deriving)]
|
||||||
#[deriving(Clone,Eq,Encodable)]
|
#[deriving(Clone,PartialEq,Encodable)]
|
||||||
struct CallbackObject {
|
struct CallbackObject {
|
||||||
callback: Traceable<*mut JSObject>,
|
callback: Traceable<*mut JSObject>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2707,7 +2707,7 @@ use js::jsapi::JSContext;
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
|
|
||||||
#[repr(uint)]
|
#[repr(uint)]
|
||||||
#[deriving(Encodable, Eq)]
|
#[deriving(Encodable, PartialEq)]
|
||||||
pub enum valuelist {
|
pub enum valuelist {
|
||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
|
@ -4756,7 +4756,7 @@ class CGCallback(CGClass):
|
||||||
bases=[ClassBase(baseName)],
|
bases=[ClassBase(baseName)],
|
||||||
constructors=self.getConstructors(),
|
constructors=self.getConstructors(),
|
||||||
methods=realMethods+getters+setters,
|
methods=realMethods+getters+setters,
|
||||||
decorators="#[deriving(Eq,Clone,Encodable)]")
|
decorators="#[deriving(PartialEq,Clone,Encodable)]")
|
||||||
|
|
||||||
def getConstructors(self):
|
def getConstructors(self):
|
||||||
return [ClassConstructor(
|
return [ClassConstructor(
|
||||||
|
@ -5262,7 +5262,7 @@ class GlobalGenRoots():
|
||||||
return CGList([
|
return CGList([
|
||||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||||
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq"),
|
CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ impl ToJSValConvertible for DOMString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum StringificationBehavior {
|
pub enum StringificationBehavior {
|
||||||
Default,
|
Default,
|
||||||
Empty,
|
Empty,
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub struct Temporary<T> {
|
||||||
js_ptr: *mut JSObject,
|
js_ptr: *mut JSObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Eq for Temporary<T> {
|
impl<T> PartialEq for Temporary<T> {
|
||||||
fn eq(&self, other: &Temporary<T>) -> bool {
|
fn eq(&self, other: &Temporary<T>) -> bool {
|
||||||
self.inner == other.inner
|
self.inner == other.inner
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ pub struct JS<T> {
|
||||||
ptr: *T
|
ptr: *T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Eq for JS<T> {
|
impl<T> PartialEq for JS<T> {
|
||||||
fn eq(&self, other: &JS<T>) -> bool {
|
fn eq(&self, other: &JS<T>) -> bool {
|
||||||
self.ptr == other.ptr
|
self.ptr == other.ptr
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ impl<'a, T> Clone for JSRef<'a, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Eq for JSRef<'a, T> {
|
impl<'a, T> PartialEq for JSRef<'a, T> {
|
||||||
fn eq(&self, other: &JSRef<T>) -> bool {
|
fn eq(&self, other: &JSRef<T>) -> bool {
|
||||||
self.ptr == other.ptr
|
self.ptr == other.ptr
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::hash::{Hash, sip};
|
||||||
use std::path::BytesContainer;
|
use std::path::BytesContainer;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
#[deriving(Encodable,Clone,TotalEq,Eq)]
|
#[deriving(Encodable,Clone,Eq,PartialEq)]
|
||||||
pub struct ByteString(Vec<u8>);
|
pub struct ByteString(Vec<u8>);
|
||||||
|
|
||||||
impl ByteString {
|
impl ByteString {
|
||||||
|
@ -66,7 +66,7 @@ impl ByteString {
|
||||||
|
|
||||||
pub fn is_field_value(&self) -> bool {
|
pub fn is_field_value(&self) -> bool {
|
||||||
// Classifications of characters necessary for the [CRLF] (SP|HT) rule
|
// Classifications of characters necessary for the [CRLF] (SP|HT) rule
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
enum PreviousCharacter {
|
enum PreviousCharacter {
|
||||||
Other,
|
Other,
|
||||||
CR,
|
CR,
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl<T> DerefMut<T> for Untraceable<T> {
|
||||||
///
|
///
|
||||||
/// We always prefer this, in case the contained type ever changes to something that should be traced.
|
/// We always prefer this, in case the contained type ever changes to something that should be traced.
|
||||||
/// See more details: mozilla#2662.
|
/// See more details: mozilla#2662.
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct Traceable<T> {
|
pub struct Traceable<T> {
|
||||||
inner: T
|
inner: T
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@ use dom::browsercontext;
|
||||||
use dom::window;
|
use dom::window;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use libc;
|
use libc;
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::Eq;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::cmp::PartialEq;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::ptr::null;
|
use std::ptr::null;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
@ -383,7 +383,7 @@ pub fn reflect_dom_object<T: Reflectable>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(raw_pointer_deriving)]
|
#[allow(raw_pointer_deriving)]
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub struct Reflector {
|
pub struct Reflector {
|
||||||
object: Cell<*mut JSObject>,
|
object: Cell<*mut JSObject>,
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext {
|
||||||
|
|
||||||
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name
|
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name
|
||||||
/// for details.
|
/// for details.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum XMLName {
|
pub enum XMLName {
|
||||||
QName,
|
QName,
|
||||||
Name,
|
Name,
|
||||||
|
|
|
@ -46,13 +46,13 @@ use servo_util::namespace;
|
||||||
use servo_util::namespace::{Namespace, Null};
|
use servo_util::namespace::{Namespace, Null};
|
||||||
use servo_util::str::{DOMString, null_str_as_empty_ref};
|
use servo_util::str::{DOMString, null_str_as_empty_ref};
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use url::{Url, from_str};
|
use url::{Url, from_str};
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum IsHTMLDocument {
|
pub enum IsHTMLDocument {
|
||||||
HTMLDocument,
|
HTMLDocument,
|
||||||
NonHTMLDocument,
|
NonHTMLDocument,
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl Reflectable for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum ElementTypeId {
|
pub enum ElementTypeId {
|
||||||
HTMLElementTypeId,
|
HTMLElementTypeId,
|
||||||
HTMLAnchorElementTypeId,
|
HTMLAnchorElementTypeId,
|
||||||
|
@ -773,9 +773,9 @@ pub fn get_attribute_parts(name: DOMString) -> (Option<String>, String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, Element> {
|
impl<'a> VirtualMethods for JSRef<'a, Element> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||||
Some(node as &VirtualMethods:)
|
Some(node as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub enum EventPhase {
|
||||||
PhaseBubbling = EventConstants::BUBBLING_PHASE,
|
PhaseBubbling = EventConstants::BUBBLING_PHASE,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Encodable)]
|
#[deriving(PartialEq, Encodable)]
|
||||||
pub enum EventTypeId {
|
pub enum EventTypeId {
|
||||||
CustomEventTypeId,
|
CustomEventTypeId,
|
||||||
HTMLEventTypeId,
|
HTMLEventTypeId,
|
||||||
|
|
|
@ -22,22 +22,22 @@ use std::cell::RefCell;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum ListenerPhase {
|
pub enum ListenerPhase {
|
||||||
Capturing,
|
Capturing,
|
||||||
Bubbling,
|
Bubbling,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum EventTargetTypeId {
|
pub enum EventTargetTypeId {
|
||||||
NodeTargetTypeId(NodeTypeId),
|
NodeTargetTypeId(NodeTypeId),
|
||||||
WindowTypeId,
|
WindowTypeId,
|
||||||
XMLHttpRequestTargetTypeId(XMLHttpRequestId)
|
XMLHttpRequestTargetTypeId(XMLHttpRequestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Encodable)]
|
#[deriving(PartialEq, Encodable)]
|
||||||
pub enum EventListenerType {
|
pub enum EventListenerType {
|
||||||
Additive(EventListener),
|
Additive(EventListener),
|
||||||
Inline(EventListener),
|
Inline(EventListener),
|
||||||
|
@ -51,7 +51,7 @@ impl EventListenerType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub struct EventListenerEntry {
|
pub struct EventListenerEntry {
|
||||||
pub phase: ListenerPhase,
|
pub phase: ListenerPhase,
|
||||||
pub listener: EventListenerType
|
pub listener: EventListenerType
|
||||||
|
@ -281,7 +281,7 @@ impl Reflectable for EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, EventTarget> {
|
impl<'a> VirtualMethods for JSRef<'a, EventTarget> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use dom::htmlformelement::HTMLFormElement;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
|
|
||||||
#[deriving(Encodable, Clone)]
|
#[deriving(Encodable, Clone)]
|
||||||
pub enum FormDatum {
|
pub enum FormDatum {
|
||||||
|
|
|
@ -68,9 +68,9 @@ impl<'a> PrivateHTMLAnchorElementHelpers for JSRef<'a, HTMLAnchorElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLAnchorElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLAnchorElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods:)
|
Some(htmlelement as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_event(&self, event: &JSRef<Event>) {
|
fn handle_event(&self, event: &JSRef<Event>) {
|
||||||
|
|
|
@ -59,9 +59,9 @@ impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let element: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let element: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(element as &VirtualMethods:)
|
Some(element as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -135,10 +135,10 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
||||||
Live(ref root, ref filter) => {
|
Live(ref root, ref filter) => {
|
||||||
let root = root.root();
|
let root = root.root();
|
||||||
root.deref().traverse_preorder()
|
root.deref().traverse_preorder()
|
||||||
.count(|child| {
|
.filter(|&child| {
|
||||||
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&child);
|
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&child);
|
||||||
elem.map_or(false, |elem| filter.filter(elem, &*root))
|
elem.map_or(false, |elem| filter.filter(elem, &*root))
|
||||||
}) as u32
|
}).count() as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,9 +93,9 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let element: &JSRef<Element> = ElementCast::from_ref(self);
|
let element: &JSRef<Element> = ElementCast::from_ref(self);
|
||||||
Some(element as &VirtualMethods:)
|
Some(element as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -136,9 +136,9 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLIFrameElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLIFrameElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods:)
|
Some(htmlelement as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -240,9 +240,9 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods:)
|
Some(htmlelement as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -85,9 +85,9 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods:)
|
Some(htmlelement as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||||
|
|
|
@ -22,9 +22,9 @@ use dom::text::Text;
|
||||||
pub fn serialize(iterator: &mut NodeIterator) -> String {
|
pub fn serialize(iterator: &mut NodeIterator) -> String {
|
||||||
let mut html = String::new();
|
let mut html = String::new();
|
||||||
let mut open_elements: Vec<String> = vec!();
|
let mut open_elements: Vec<String> = vec!();
|
||||||
|
let depth = iterator.depth;
|
||||||
for node in *iterator {
|
for node in *iterator {
|
||||||
while open_elements.len() > iterator.depth {
|
while open_elements.len() > depth {
|
||||||
html.push_str("</");
|
html.push_str("</");
|
||||||
html.push_str(open_elements.pop().unwrap().as_slice());
|
html.push_str(open_elements.pop().unwrap().as_slice());
|
||||||
html.push_str(">");
|
html.push_str(">");
|
||||||
|
|
|
@ -65,9 +65,9 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, HTMLStyleElement> {
|
impl<'a> VirtualMethods for JSRef<'a, HTMLStyleElement> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||||
Some(htmlelement as &VirtualMethods:)
|
Some(htmlelement as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn child_inserted(&self, child: &JSRef<Node>) {
|
fn child_inserted(&self, child: &JSRef<Node>) {
|
||||||
|
|
|
@ -172,12 +172,6 @@ impl LayoutDataRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn from_data<T>(data: Box<T>) -> LayoutDataRef {
|
|
||||||
LayoutDataRef {
|
|
||||||
data_cell: RefCell::new(Some(mem::transmute(data))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if there is layout data present.
|
/// Returns true if there is layout data present.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_present(&self) -> bool {
|
pub fn is_present(&self) -> bool {
|
||||||
|
@ -225,7 +219,7 @@ impl LayoutDataRef {
|
||||||
pub trait TLayoutData {}
|
pub trait TLayoutData {}
|
||||||
|
|
||||||
/// The different types of nodes.
|
/// The different types of nodes.
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum NodeTypeId {
|
pub enum NodeTypeId {
|
||||||
DoctypeNodeTypeId,
|
DoctypeNodeTypeId,
|
||||||
DocumentFragmentNodeTypeId,
|
DocumentFragmentNodeTypeId,
|
||||||
|
@ -901,7 +895,7 @@ fn gather_abstract_nodes<'a>(cur: &JSRef<'a, Node>, refs: &mut Vec<JSRef<'a, Nod
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies whether children must be recursively cloned or not.
|
/// Specifies whether children must be recursively cloned or not.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum CloneChildrenFlag {
|
pub enum CloneChildrenFlag {
|
||||||
CloneChildren,
|
CloneChildren,
|
||||||
DoNotCloneChildren
|
DoNotCloneChildren
|
||||||
|
@ -1024,13 +1018,13 @@ impl Node {
|
||||||
if node.children().any(|c| c.is_text()) {
|
if node.children().any(|c| c.is_text()) {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
match node.child_elements().len() {
|
match node.child_elements().count() {
|
||||||
0 => (),
|
0 => (),
|
||||||
// Step 6.1.2
|
// Step 6.1.2
|
||||||
1 => {
|
1 => {
|
||||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||||
// will be fixed
|
// will be fixed
|
||||||
if parent.child_elements().len() > 0 {
|
if parent.child_elements().count() > 0 {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
match child {
|
match child {
|
||||||
|
@ -1049,7 +1043,7 @@ impl Node {
|
||||||
ElementNodeTypeId(_) => {
|
ElementNodeTypeId(_) => {
|
||||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||||
// will be fixed
|
// will be fixed
|
||||||
if parent.child_elements().len() > 0 {
|
if parent.child_elements().count() > 0 {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
match child {
|
match child {
|
||||||
|
@ -1076,7 +1070,7 @@ impl Node {
|
||||||
None => {
|
None => {
|
||||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||||
// will be fixed
|
// will be fixed
|
||||||
if parent.child_elements().len() > 0 {
|
if parent.child_elements().count() > 0 {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1649,7 +1643,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
if node.children().any(|c| c.is_text()) {
|
if node.children().any(|c| c.is_text()) {
|
||||||
return Err(HierarchyRequest);
|
return Err(HierarchyRequest);
|
||||||
}
|
}
|
||||||
match node.child_elements().len() {
|
match node.child_elements().count() {
|
||||||
0 => (),
|
0 => (),
|
||||||
// Step 6.1.2
|
// Step 6.1.2
|
||||||
1 => {
|
1 => {
|
||||||
|
@ -1837,7 +1831,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 5.
|
// Step 5.
|
||||||
if this.children().len() != node.children().len() {
|
if this.children().count() != node.children().count() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1953,9 +1947,9 @@ pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Window> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, Node> {
|
impl<'a> VirtualMethods for JSRef<'a, Node> {
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||||
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
Some(eventtarget as &VirtualMethods:)
|
Some(eventtarget as &VirtualMethods+)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
||||||
Simple(ref elems) => elems.len() as u32,
|
Simple(ref elems) => elems.len() as u32,
|
||||||
Children(ref node) => {
|
Children(ref node) => {
|
||||||
let node = node.root();
|
let node = node.root();
|
||||||
node.deref().children().len() as u32
|
node.deref().children().count() as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ use servo_util::str::DOMString;
|
||||||
pub trait VirtualMethods {
|
pub trait VirtualMethods {
|
||||||
/// Returns self as the superclass of the implementation for this trait,
|
/// Returns self as the superclass of the implementation for this trait,
|
||||||
/// if any.
|
/// if any.
|
||||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:>;
|
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+>;
|
||||||
|
|
||||||
/// Called when changing or adding attributes, after the attribute's value
|
/// Called when changing or adding attributes, after the attribute's value
|
||||||
/// has been updated.
|
/// has been updated.
|
||||||
|
@ -99,42 +99,42 @@ pub trait VirtualMethods {
|
||||||
/// method call on the trait object will invoke the corresponding method on the
|
/// method call on the trait object will invoke the corresponding method on the
|
||||||
/// concrete type, propagating up the parent hierarchy unless otherwise
|
/// concrete type, propagating up the parent hierarchy unless otherwise
|
||||||
/// interrupted.
|
/// interrupted.
|
||||||
pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods: {
|
pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods+ {
|
||||||
match node.type_id() {
|
match node.type_id() {
|
||||||
ElementNodeTypeId(HTMLAnchorElementTypeId) => {
|
ElementNodeTypeId(HTMLAnchorElementTypeId) => {
|
||||||
let element: &JSRef<HTMLAnchorElement> = HTMLAnchorElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLAnchorElement> = HTMLAnchorElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(HTMLBodyElementTypeId) => {
|
ElementNodeTypeId(HTMLBodyElementTypeId) => {
|
||||||
let element: &JSRef<HTMLBodyElement> = HTMLBodyElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLBodyElement> = HTMLBodyElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||||
let element: &JSRef<HTMLImageElement> = HTMLImageElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLImageElement> = HTMLImageElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(HTMLIFrameElementTypeId) => {
|
ElementNodeTypeId(HTMLIFrameElementTypeId) => {
|
||||||
let element: &JSRef<HTMLIFrameElement> = HTMLIFrameElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLIFrameElement> = HTMLIFrameElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(HTMLObjectElementTypeId) => {
|
ElementNodeTypeId(HTMLObjectElementTypeId) => {
|
||||||
let element: &JSRef<HTMLObjectElement> = HTMLObjectElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLObjectElement> = HTMLObjectElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(HTMLStyleElementTypeId) => {
|
ElementNodeTypeId(HTMLStyleElementTypeId) => {
|
||||||
let element: &JSRef<HTMLStyleElement> = HTMLStyleElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLStyleElement> = HTMLStyleElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(ElementTypeId) => {
|
ElementNodeTypeId(ElementTypeId) => {
|
||||||
let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
ElementNodeTypeId(_) => {
|
ElementNodeTypeId(_) => {
|
||||||
let element: &JSRef<HTMLElement> = HTMLElementCast::to_ref(node).unwrap();
|
let element: &JSRef<HTMLElement> = HTMLElementCast::to_ref(node).unwrap();
|
||||||
element as &VirtualMethods:
|
element as &VirtualMethods+
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
node as &VirtualMethods:
|
node as &VirtualMethods+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ use js::jsapi::JSContext;
|
||||||
use js::jsapi::{JS_GC, JS_GetRuntime};
|
use js::jsapi::{JS_GC, JS_GetRuntime};
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::comm::{channel, Sender};
|
use std::comm::{channel, Sender};
|
||||||
|
@ -43,7 +43,7 @@ use time;
|
||||||
use serialize::{Encoder, Encodable};
|
use serialize::{Encoder, Encodable};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[deriving(Eq, Encodable, TotalEq)]
|
#[deriving(PartialEq, Encodable, Eq)]
|
||||||
pub struct TimerId(i32);
|
pub struct TimerId(i32);
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
|
|
|
@ -61,13 +61,13 @@ use url::Url;
|
||||||
// use SendParam = dom::bindings::codegen::UnionTypes::StringOrFormData;
|
// use SendParam = dom::bindings::codegen::UnionTypes::StringOrFormData;
|
||||||
pub type SendParam = DOMString;
|
pub type SendParam = DOMString;
|
||||||
|
|
||||||
#[deriving(Eq,Encodable)]
|
#[deriving(PartialEq,Encodable)]
|
||||||
pub enum XMLHttpRequestId {
|
pub enum XMLHttpRequestId {
|
||||||
XMLHttpRequestTypeId,
|
XMLHttpRequestTypeId,
|
||||||
XMLHttpRequestUploadTypeId
|
XMLHttpRequestUploadTypeId
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Encodable)]
|
#[deriving(PartialEq, Encodable)]
|
||||||
enum XMLHttpRequestState {
|
enum XMLHttpRequestState {
|
||||||
Unsent = 0u16,
|
Unsent = 0u16,
|
||||||
Opened = 1u16,
|
Opened = 1u16,
|
||||||
|
@ -889,7 +889,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
self.timer.deref().borrow_mut().oneshot(0);
|
self.timer.deref().borrow_mut().oneshot(0);
|
||||||
}
|
}
|
||||||
fn text_response(&self) -> DOMString {
|
fn text_response(&self) -> DOMString {
|
||||||
let mut encoding = UTF_8 as &Encoding:Send;
|
let mut encoding = UTF_8 as &Encoding+Send;
|
||||||
match self.response_headers.deref().borrow().content_type {
|
match self.response_headers.deref().borrow().content_type {
|
||||||
Some(ref x) => {
|
Some(ref x) => {
|
||||||
for &(ref name, ref value) in x.parameters.iter() {
|
for &(ref name, ref value) in x.parameters.iter() {
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub struct HitTestResponse(pub UntrustedNodeAddress);
|
||||||
pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>);
|
pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>);
|
||||||
|
|
||||||
/// Determines which part of the
|
/// Determines which part of the
|
||||||
#[deriving(Eq, Ord, TotalEq, TotalOrd, Encodable)]
|
#[deriving(PartialEq, PartialOrd, Eq, Ord, Encodable)]
|
||||||
pub enum DocumentDamageLevel {
|
pub enum DocumentDamageLevel {
|
||||||
/// Reflow, but do not perform CSS selector matching.
|
/// Reflow, but do not perform CSS selector matching.
|
||||||
ReflowDocumentDamage,
|
ReflowDocumentDamage,
|
||||||
|
@ -116,7 +116,7 @@ pub struct DocumentDamage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Why we're doing reflow.
|
/// Why we're doing reflow.
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum ReflowGoal {
|
pub enum ReflowGoal {
|
||||||
/// We're reflowing in order to send a display list to the screen.
|
/// We're reflowing in order to send a display list to the screen.
|
||||||
ReflowForDisplay,
|
ReflowForDisplay,
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
#![feature(globs, macro_rules, struct_variant, phase)]
|
#![feature(globs, macro_rules, struct_variant, phase)]
|
||||||
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
#[phase(syntax, link)]
|
|
||||||
|
#![allow(non_snake_case_functions)]
|
||||||
|
|
||||||
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
|
@ -29,7 +32,7 @@ extern crate native;
|
||||||
extern crate net;
|
extern crate net;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
#[phase(syntax)]
|
#[phase(plugin)]
|
||||||
extern crate servo_macros = "macros";
|
extern crate servo_macros = "macros";
|
||||||
extern crate servo_net = "net";
|
extern crate servo_net = "net";
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub enum MediaQueryType {
|
||||||
MediaType(MediaType),
|
MediaType(MediaType),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum MediaType {
|
pub enum MediaType {
|
||||||
Screen,
|
Screen,
|
||||||
Print,
|
Print,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::ast::*;
|
use cssparser::ast::*;
|
||||||
use collections::hashmap::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use servo_util::namespace::Namespace;
|
use servo_util::namespace::Namespace;
|
||||||
use errors::log_css_error;
|
use errors::log_css_error;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) {
|
||||||
match component_value {
|
match component_value {
|
||||||
Ident(value) => {
|
Ident(value) => {
|
||||||
if prefix.is_some() { syntax_error!() }
|
if prefix.is_some() { syntax_error!() }
|
||||||
prefix = Some(value.into_owned());
|
prefix = Some(value.into_string());
|
||||||
},
|
},
|
||||||
URL(value) | String(value) => {
|
URL(value) | String(value) => {
|
||||||
if ns.is_some() { syntax_error!() }
|
if ns.is_some() { syntax_error!() }
|
||||||
|
|
|
@ -205,7 +205,7 @@ pub mod computed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum LengthOrPercentage {
|
pub enum LengthOrPercentage {
|
||||||
LP_Length(Au),
|
LP_Length(Au),
|
||||||
LP_Percentage(CSSFloat),
|
LP_Percentage(CSSFloat),
|
||||||
|
@ -218,7 +218,7 @@ pub mod computed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum LengthOrPercentageOrAuto {
|
pub enum LengthOrPercentageOrAuto {
|
||||||
LPA_Length(Au),
|
LPA_Length(Au),
|
||||||
LPA_Percentage(CSSFloat),
|
LPA_Percentage(CSSFloat),
|
||||||
|
@ -233,7 +233,7 @@ pub mod computed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum LengthOrPercentageOrNone {
|
pub enum LengthOrPercentageOrNone {
|
||||||
LPN_Length(Au),
|
LPN_Length(Au),
|
||||||
LPN_Percentage(CSSFloat),
|
LPN_Percentage(CSSFloat),
|
||||||
|
|
|
@ -154,7 +154,7 @@ pub mod longhands {
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[deriving(Eq, Clone, FromPrimitive)]
|
#[deriving(PartialEq, Clone, FromPrimitive)]
|
||||||
pub enum T {
|
pub enum T {
|
||||||
% for value in values.split():
|
% for value in values.split():
|
||||||
${to_rust_ident(value)},
|
${to_rust_ident(value)},
|
||||||
|
@ -398,7 +398,7 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use super::super::{Au, CSSFloat};
|
use super::super::{Au, CSSFloat};
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum T {
|
pub enum T {
|
||||||
Normal,
|
Normal,
|
||||||
Length(Au),
|
Length(Au),
|
||||||
|
@ -486,7 +486,7 @@ pub mod longhands {
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use super::super::{Au, CSSFloat};
|
use super::super::{Au, CSSFloat};
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum T {
|
pub enum T {
|
||||||
% for keyword in vertical_align_keywords:
|
% for keyword in vertical_align_keywords:
|
||||||
${to_rust_ident(keyword)},
|
${to_rust_ident(keyword)},
|
||||||
|
@ -529,12 +529,12 @@ pub mod longhands {
|
||||||
<%self:longhand name="content">
|
<%self:longhand name="content">
|
||||||
pub use to_computed_value = super::computed_as_specified;
|
pub use to_computed_value = super::computed_as_specified;
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum Content {
|
pub enum Content {
|
||||||
StringContent(String),
|
StringContent(String),
|
||||||
}
|
}
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum T {
|
pub enum T {
|
||||||
normal,
|
normal,
|
||||||
none,
|
none,
|
||||||
|
@ -605,7 +605,7 @@ pub mod longhands {
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use super::super::super::common_types::computed::LengthOrPercentage;
|
use super::super::super::common_types::computed::LengthOrPercentage;
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct T {
|
pub struct T {
|
||||||
pub horizontal: LengthOrPercentage,
|
pub horizontal: LengthOrPercentage,
|
||||||
pub vertical: LengthOrPercentage,
|
pub vertical: LengthOrPercentage,
|
||||||
|
@ -703,7 +703,7 @@ pub mod longhands {
|
||||||
<%self:longhand name="font-family">
|
<%self:longhand name="font-family">
|
||||||
pub use to_computed_value = super::computed_as_specified;
|
pub use to_computed_value = super::computed_as_specified;
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum FontFamily {
|
pub enum FontFamily {
|
||||||
FamilyName(String),
|
FamilyName(String),
|
||||||
// Generic
|
// Generic
|
||||||
|
@ -816,7 +816,7 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum T {
|
pub enum T {
|
||||||
% for weight in range(100, 901, 100):
|
% for weight in range(100, 901, 100):
|
||||||
Weight${weight},
|
Weight${weight},
|
||||||
|
@ -905,7 +905,7 @@ pub mod longhands {
|
||||||
|
|
||||||
<%self:longhand name="text-decoration">
|
<%self:longhand name="text-decoration">
|
||||||
pub use to_computed_value = super::computed_as_specified;
|
pub use to_computed_value = super::computed_as_specified;
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct SpecifiedValue {
|
pub struct SpecifiedValue {
|
||||||
pub underline: bool,
|
pub underline: bool,
|
||||||
pub overline: bool,
|
pub overline: bool,
|
||||||
|
@ -957,7 +957,7 @@ pub mod longhands {
|
||||||
|
|
||||||
pub use to_computed_value = super::computed_as_specified;
|
pub use to_computed_value = super::computed_as_specified;
|
||||||
|
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, PartialEq)]
|
||||||
pub struct SpecifiedValue {
|
pub struct SpecifiedValue {
|
||||||
pub underline: Option<RGBA>,
|
pub underline: Option<RGBA>,
|
||||||
pub overline: Option<RGBA>,
|
pub overline: Option<RGBA>,
|
||||||
|
@ -1562,7 +1562,7 @@ impl PropertyDeclaration {
|
||||||
pub mod style_structs {
|
pub mod style_structs {
|
||||||
use super::longhands;
|
use super::longhands;
|
||||||
% for style_struct in STYLE_STRUCTS:
|
% for style_struct in STYLE_STRUCTS:
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct ${style_struct.name} {
|
pub struct ${style_struct.name} {
|
||||||
% for longhand in style_struct.longhands:
|
% for longhand in style_struct.longhands:
|
||||||
pub ${longhand.ident}: longhands::${longhand.ident}::computed_value::T,
|
pub ${longhand.ident}: longhands::${longhand.ident}::computed_value::T,
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use collections::hashmap::HashMap;
|
use collections::hash::Writer;
|
||||||
|
use std::collections::hashmap::HashMap;
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::hash::sip::SipState;
|
use std::hash::sip::SipState;
|
||||||
use num::div_rem;
|
use std::num::div_rem;
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
|
||||||
use servo_util::namespace;
|
use servo_util::namespace;
|
||||||
|
@ -49,12 +50,12 @@ impl<'a> Hash for LowercaseAsciiString<'a> {
|
||||||
// `Ascii` type's invariants by using `to_ascii_nocheck`, but it's OK as we simply
|
// `Ascii` type's invariants by using `to_ascii_nocheck`, but it's OK as we simply
|
||||||
// convert to a byte afterward.
|
// convert to a byte afterward.
|
||||||
unsafe {
|
unsafe {
|
||||||
state.write_u8(b.to_ascii_nocheck().to_lowercase().to_byte()).unwrap()
|
state.write(&[b.to_ascii_nocheck().to_lowercase().to_byte()])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Terminate the string with a non-UTF-8 character, to match what the built-in string
|
// Terminate the string with a non-UTF-8 character, to match what the built-in string
|
||||||
// `ToBytes` implementation does. (See `libstd/to_bytes.rs`.)
|
// `ToBytes` implementation does. (See `libstd/to_bytes.rs`.)
|
||||||
state.write_u8(0xff).unwrap();
|
state.write(&[0xff]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +498,7 @@ impl MatchedProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for MatchedProperty {
|
impl PartialEq for MatchedProperty {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &MatchedProperty) -> bool {
|
fn eq(&self, other: &MatchedProperty) -> bool {
|
||||||
let this_rank = (self.specificity, self.source_order);
|
let this_rank = (self.specificity, self.source_order);
|
||||||
|
@ -506,7 +507,9 @@ impl Eq for MatchedProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for MatchedProperty {
|
impl Eq for MatchedProperty {}
|
||||||
|
|
||||||
|
impl PartialOrd for MatchedProperty {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn lt(&self, other: &MatchedProperty) -> bool {
|
fn lt(&self, other: &MatchedProperty) -> bool {
|
||||||
let this_rank = (self.specificity, self.source_order);
|
let this_rank = (self.specificity, self.source_order);
|
||||||
|
@ -515,6 +518,15 @@ impl Ord for MatchedProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Ord for MatchedProperty {
|
||||||
|
#[inline]
|
||||||
|
fn cmp(&self, other: &MatchedProperty) -> Ordering {
|
||||||
|
let this_rank = (self.specificity, self.source_order);
|
||||||
|
let other_rank = (other.specificity, other.source_order);
|
||||||
|
this_rank.cmp(&other_rank)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Determines whether the given element matches the given single or compound selector.
|
/// Determines whether the given element matches the given single or compound selector.
|
||||||
///
|
///
|
||||||
/// NB: If you add support for any new kinds of selectors to this routine, be sure to set
|
/// NB: If you add support for any new kinds of selectors to this routine, be sure to set
|
||||||
|
|
|
@ -17,21 +17,21 @@ use namespaces::NamespaceMap;
|
||||||
|
|
||||||
|
|
||||||
// Only used in tests
|
// Only used in tests
|
||||||
impl Eq for Arc<CompoundSelector> {
|
impl PartialEq for Arc<CompoundSelector> {
|
||||||
fn eq(&self, other: &Arc<CompoundSelector>) -> bool {
|
fn eq(&self, other: &Arc<CompoundSelector>) -> bool {
|
||||||
**self == **other
|
**self == **other
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct Selector {
|
pub struct Selector {
|
||||||
pub compound_selectors: Arc<CompoundSelector>,
|
pub compound_selectors: Arc<CompoundSelector>,
|
||||||
pub pseudo_element: Option<PseudoElement>,
|
pub pseudo_element: Option<PseudoElement>,
|
||||||
pub specificity: u32,
|
pub specificity: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum PseudoElement {
|
pub enum PseudoElement {
|
||||||
Before,
|
Before,
|
||||||
After,
|
After,
|
||||||
|
@ -40,13 +40,13 @@ pub enum PseudoElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct CompoundSelector {
|
pub struct CompoundSelector {
|
||||||
pub simple_selectors: Vec<SimpleSelector>,
|
pub simple_selectors: Vec<SimpleSelector>,
|
||||||
pub next: Option<(Box<CompoundSelector>, Combinator)>, // c.next is left of c
|
pub next: Option<(Box<CompoundSelector>, Combinator)>, // c.next is left of c
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum Combinator {
|
pub enum Combinator {
|
||||||
Child, // >
|
Child, // >
|
||||||
Descendant, // space
|
Descendant, // space
|
||||||
|
@ -54,7 +54,7 @@ pub enum Combinator {
|
||||||
LaterSibling, // ~
|
LaterSibling, // ~
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum SimpleSelector {
|
pub enum SimpleSelector {
|
||||||
IDSelector(String),
|
IDSelector(String),
|
||||||
ClassSelector(String),
|
ClassSelector(String),
|
||||||
|
@ -90,14 +90,14 @@ pub enum SimpleSelector {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub struct AttrSelector {
|
pub struct AttrSelector {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub lower_name: String,
|
pub lower_name: String,
|
||||||
pub namespace: NamespaceConstraint,
|
pub namespace: NamespaceConstraint,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
pub enum NamespaceConstraint {
|
pub enum NamespaceConstraint {
|
||||||
AnyNamespace,
|
AnyNamespace,
|
||||||
SpecificNamespace(Namespace),
|
SpecificNamespace(Namespace),
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#![feature(globs, macro_rules)]
|
#![feature(globs, macro_rules)]
|
||||||
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
#[phase(syntax, link)] extern crate log;
|
#[phase(plugin, link)] extern crate log;
|
||||||
|
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
extern crate collections;
|
extern crate collections;
|
||||||
|
@ -25,7 +25,7 @@ extern crate url;
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate encoding;
|
extern crate encoding;
|
||||||
|
|
||||||
#[phase(syntax)]
|
#[phase(plugin)]
|
||||||
extern crate servo_macros = "macros";
|
extern crate servo_macros = "macros";
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use collections::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use rand;
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::hash::{Hash, sip};
|
use std::hash::{Hash, sip};
|
||||||
|
use std::rand::task_rng;
|
||||||
use std::slice::Items;
|
use std::slice::Items;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
pub trait Cache<K: Eq, V: Clone> {
|
pub trait Cache<K: PartialEq, V: Clone> {
|
||||||
fn insert(&mut self, key: K, value: V);
|
fn insert(&mut self, key: K, value: V);
|
||||||
fn find(&mut self, key: &K) -> Option<V>;
|
fn find(&mut self, key: &K) -> Option<V>;
|
||||||
fn find_or_create(&mut self, key: &K, blk: |&K| -> V) -> V;
|
fn find_or_create(&mut self, key: &K, blk: |&K| -> V) -> V;
|
||||||
|
@ -22,13 +22,13 @@ pub struct MonoCache<K, V> {
|
||||||
entry: Option<(K,V)>,
|
entry: Option<(K,V)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq, V: Clone> MonoCache<K,V> {
|
impl<K: Clone + PartialEq, V: Clone> MonoCache<K,V> {
|
||||||
pub fn new(_size: uint) -> MonoCache<K,V> {
|
pub fn new(_size: uint) -> MonoCache<K,V> {
|
||||||
MonoCache { entry: None }
|
MonoCache { entry: None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq, V: Clone> Cache<K,V> for MonoCache<K,V> {
|
impl<K: Clone + PartialEq, V: Clone> Cache<K,V> for MonoCache<K,V> {
|
||||||
fn insert(&mut self, key: K, value: V) {
|
fn insert(&mut self, key: K, value: V) {
|
||||||
self.entry = Some((key, value));
|
self.entry = Some((key, value));
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ pub struct HashCache<K, V> {
|
||||||
entries: HashMap<K, V>,
|
entries: HashMap<K, V>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq + TotalEq + Hash, V: Clone> HashCache<K,V> {
|
impl<K: Clone + PartialEq + Eq + Hash, V: Clone> HashCache<K,V> {
|
||||||
pub fn new() -> HashCache<K, V> {
|
pub fn new() -> HashCache<K, V> {
|
||||||
HashCache {
|
HashCache {
|
||||||
entries: HashMap::new(),
|
entries: HashMap::new(),
|
||||||
|
@ -82,7 +82,7 @@ impl<K: Clone + Eq + TotalEq + Hash, V: Clone> HashCache<K,V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq + TotalEq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> {
|
impl<K: Clone + PartialEq + Eq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> {
|
||||||
fn insert(&mut self, key: K, value: V) {
|
fn insert(&mut self, key: K, value: V) {
|
||||||
self.entries.insert(key, value);
|
self.entries.insert(key, value);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ pub struct LRUCache<K, V> {
|
||||||
cache_size: uint,
|
cache_size: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
|
impl<K: Clone + PartialEq, V: Clone> LRUCache<K,V> {
|
||||||
pub fn new(size: uint) -> LRUCache<K, V> {
|
pub fn new(size: uint) -> LRUCache<K, V> {
|
||||||
LRUCache {
|
LRUCache {
|
||||||
entries: vec!(),
|
entries: vec!(),
|
||||||
|
@ -146,7 +146,7 @@ impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq, V: Clone> Cache<K,V> for LRUCache<K,V> {
|
impl<K: Clone + PartialEq, V: Clone> Cache<K,V> for LRUCache<K,V> {
|
||||||
fn insert(&mut self, key: K, val: V) {
|
fn insert(&mut self, key: K, val: V) {
|
||||||
if self.entries.len() == self.cache_size {
|
if self.entries.len() == self.cache_size {
|
||||||
self.entries.remove(0);
|
self.entries.remove(0);
|
||||||
|
@ -183,9 +183,9 @@ pub struct SimpleHashCache<K,V> {
|
||||||
k1: u64,
|
k1: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> {
|
impl<K:Clone+PartialEq+Hash,V:Clone> SimpleHashCache<K,V> {
|
||||||
pub fn new(cache_size: uint) -> SimpleHashCache<K,V> {
|
pub fn new(cache_size: uint) -> SimpleHashCache<K,V> {
|
||||||
let mut r = rand::task_rng();
|
let mut r = task_rng();
|
||||||
SimpleHashCache {
|
SimpleHashCache {
|
||||||
entries: Vec::from_elem(cache_size, None),
|
entries: Vec::from_elem(cache_size, None),
|
||||||
k0: r.gen(),
|
k0: r.gen(),
|
||||||
|
@ -213,7 +213,7 @@ impl<K:Clone+Eq+Hash,V:Clone> SimpleHashCache<K,V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K:Clone+Eq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
|
impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
|
||||||
fn insert(&mut self, key: K, value: V) {
|
fn insert(&mut self, key: K, value: V) {
|
||||||
let bucket_index = self.bucket_for_key(&key);
|
let bucket_index = self.bucket_for_key(&key);
|
||||||
*self.entries.get_mut(bucket_index) = Some((key, value));
|
*self.entries.get_mut(bucket_index) = Some((key, value));
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub enum PagePx {}
|
||||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
|
||||||
//
|
//
|
||||||
// FIXME: Implement Au using Length and ScaleFactor instead of a custom type.
|
// FIXME: Implement Au using Length and ScaleFactor instead of a custom type.
|
||||||
#[deriving(Clone, Eq, Ord, Zero)]
|
#[deriving(Clone, PartialEq, PartialOrd, Zero)]
|
||||||
pub struct Au(pub i32);
|
pub struct Au(pub i32);
|
||||||
|
|
||||||
impl Default for Au {
|
impl Default for Au {
|
||||||
|
@ -288,7 +288,7 @@ pub fn to_pt(au: Au) -> f64 {
|
||||||
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
|
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
|
||||||
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
|
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
|
||||||
/// not considered inside the rectangle.
|
/// not considered inside the rectangle.
|
||||||
pub fn rect_contains_point<T:Ord + Add<T,T>>(rect: Rect<T>, point: Point2D<T>) -> bool {
|
pub fn rect_contains_point<T:PartialOrd + Add<T,T>>(rect: Rect<T>, point: Point2D<T>) -> bool {
|
||||||
point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
|
point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
|
||||||
point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
|
point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#[deriving(Eq, Clone, Encodable)]
|
#[deriving(PartialEq, Clone, Encodable)]
|
||||||
pub enum Namespace {
|
pub enum Namespace {
|
||||||
Null,
|
Null,
|
||||||
HTML,
|
HTML,
|
||||||
|
|
|
@ -12,10 +12,10 @@ use std::num::{Bounded, Zero};
|
||||||
pub trait RangeIndex: Copy
|
pub trait RangeIndex: Copy
|
||||||
+ Clone
|
+ Clone
|
||||||
+ fmt::Show
|
+ fmt::Show
|
||||||
|
+ PartialEq
|
||||||
|
+ PartialOrd
|
||||||
+ Eq
|
+ Eq
|
||||||
+ Ord
|
+ Ord
|
||||||
+ TotalEq
|
|
||||||
+ TotalOrd
|
|
||||||
+ Add<Self, Self>
|
+ Add<Self, Self>
|
||||||
+ Sub<Self, Self>
|
+ Sub<Self, Self>
|
||||||
+ Neg<Self>
|
+ Neg<Self>
|
||||||
|
@ -40,7 +40,7 @@ impl IntRangeIndex<int> for int {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! int_range_index {
|
macro_rules! int_range_index {
|
||||||
($(#[$attr:meta])* struct $Self:ident($T:ty)) => (
|
($(#[$attr:meta])* struct $Self:ident($T:ty)) => (
|
||||||
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show, Zero)]
|
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Zero)]
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
pub struct $Self(pub $T);
|
pub struct $Self(pub $T);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::intrinsics;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::raw::Slice;
|
use std::raw::Slice;
|
||||||
use std::rt::local_heap;
|
use rustrt::local_heap;
|
||||||
use alloc::heap;
|
use alloc::heap;
|
||||||
|
|
||||||
// Generic code for all small vectors
|
// Generic code for all small vectors
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! In-place sorting.
|
//! In-place sorting.
|
||||||
|
|
||||||
fn quicksort_helper<T:Ord + Eq>(arr: &mut [T], left: int, right: int) {
|
fn quicksort_helper<T:Ord + Eq + PartialOrd + PartialEq>(arr: &mut [T], left: int, right: int) {
|
||||||
if right <= left {
|
if right <= left {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ fn quicksort_helper<T:Ord + Eq>(arr: &mut [T], left: int, right: int) {
|
||||||
///
|
///
|
||||||
/// The algorithm is from Sedgewick and Bentley, "Quicksort is Optimal":
|
/// The algorithm is from Sedgewick and Bentley, "Quicksort is Optimal":
|
||||||
/// http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf
|
/// http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf
|
||||||
pub fn quicksort<T:Ord + Eq>(arr: &mut [T]) {
|
pub fn quicksort<T:Ord + Eq + PartialOrd + PartialEq>(arr: &mut [T]) {
|
||||||
if arr.len() <= 1 {
|
if arr.len() <= 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ pub fn quicksort<T:Ord + Eq>(arr: &mut [T]) {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use rand;
|
use std::rand;
|
||||||
use rand::{Rng, task_rng};
|
use std::rand::Rng;
|
||||||
|
|
||||||
use sort;
|
use sort;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ pub mod test {
|
||||||
let mut rng = rand::task_rng();
|
let mut rng = rand::task_rng();
|
||||||
for _ in range(0, 50000) {
|
for _ in range(0, 50000) {
|
||||||
let len: uint = rng.gen();
|
let len: uint = rng.gen();
|
||||||
let mut v: Vec<int> = rng.gen_vec((len % 32) + 1).iter().map(|&x| x).collect();
|
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
|
||||||
sort::quicksort(v.as_mut_slice());
|
sort::quicksort(v.as_mut_slice());
|
||||||
for i in range(0, v.len() - 1) {
|
for i in range(0, v.len() - 1) {
|
||||||
assert!(v.get(i) <= v.get(i + 1))
|
assert!(v.get(i) <= v.get(i + 1))
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub enum TimeProfilerMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[deriving(Eq, Clone, Ord, TotalEq, TotalOrd)]
|
#[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)]
|
||||||
pub enum TimeProfilerCategory {
|
pub enum TimeProfilerCategory {
|
||||||
CompositingCategory,
|
CompositingCategory,
|
||||||
LayoutQueryCategory,
|
LayoutQueryCategory,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use collections::HashMap;
|
use std::collections::hashmap::HashMap;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std_url;
|
use std_url;
|
||||||
use std_url::Url;
|
use std_url::Url;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#![feature(macro_rules)]
|
#![feature(macro_rules)]
|
||||||
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
#[phase(syntax, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate debug;
|
extern crate debug;
|
||||||
|
@ -21,6 +21,7 @@ extern crate geom;
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate native;
|
extern crate native;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
extern crate rustrt;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate sync;
|
extern crate sync;
|
||||||
extern crate std_time = "time";
|
extern crate std_time = "time";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::cmp::{Ord, Eq};
|
use std::cmp::{PartialOrd, PartialEq};
|
||||||
|
|
||||||
/// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in
|
/// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in
|
||||||
/// performance-critical code, so a closure is insufficient.
|
/// performance-critical code, so a closure is insufficient.
|
||||||
|
@ -10,7 +10,7 @@ pub trait Comparator<K,T> {
|
||||||
fn compare(&self, key: &K, value: &T) -> Ordering;
|
fn compare(&self, key: &K, value: &T) -> Ordering;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BinarySearchMethods<'a, T: TotalOrd + Ord + Eq> {
|
pub trait BinarySearchMethods<'a, T: Ord + PartialOrd + PartialEq> {
|
||||||
fn binary_search(&self, key: &T) -> Option<&'a T>;
|
fn binary_search(&self, key: &T) -> Option<&'a T>;
|
||||||
fn binary_search_index(&self, key: &T) -> Option<uint>;
|
fn binary_search_index(&self, key: &T) -> Option<uint>;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ pub trait FullBinarySearchMethods<T> {
|
||||||
fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<uint>;
|
fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<uint>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: TotalOrd + Ord + Eq> BinarySearchMethods<'a, T> for &'a [T] {
|
impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] {
|
||||||
fn binary_search(&self, key: &T) -> Option<&'a T> {
|
fn binary_search(&self, key: &T) -> Option<&'a T> {
|
||||||
self.binary_search_index(key).map(|i| &self[i])
|
self.binary_search_index(key).map(|i| &self[i])
|
||||||
}
|
}
|
||||||
|
@ -55,14 +55,14 @@ impl<'a, T> FullBinarySearchMethods<T> for &'a [T] {
|
||||||
|
|
||||||
struct DefaultComparator;
|
struct DefaultComparator;
|
||||||
|
|
||||||
impl<T:Eq + Ord + TotalOrd> Comparator<T,T> for DefaultComparator {
|
impl<T:PartialEq + PartialOrd + Ord> Comparator<T,T> for DefaultComparator {
|
||||||
fn compare(&self, key: &T, value: &T) -> Ordering {
|
fn compare(&self, key: &T, value: &T) -> Ordering {
|
||||||
(*key).cmp(value)
|
(*key).cmp(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn test_find_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T]) {
|
fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < arr.len() {
|
while i < arr.len() {
|
||||||
assert!(test_match(&arr[i], arr.binary_search(&arr[i])));
|
assert!(test_match(&arr[i], arr.binary_search(&arr[i])));
|
||||||
|
@ -71,7 +71,7 @@ fn test_find_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn test_miss_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T], misses: &[T]) {
|
fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T], misses: &[T]) {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < misses.len() {
|
while i < misses.len() {
|
||||||
let res = arr.binary_search(&misses[i]);
|
let res = arr.binary_search(&misses[i]);
|
||||||
|
@ -82,7 +82,7 @@ fn test_miss_all_elems<T: Eq + Ord + TotalEq + TotalOrd>(arr: &[T], misses: &[T]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn test_match<T: Eq>(b: &T, a: Option<&T>) -> bool {
|
fn test_match<T: PartialEq>(b: &T, a: Option<&T>) -> bool {
|
||||||
match a {
|
match a {
|
||||||
None => false,
|
None => false,
|
||||||
Some(t) => t == b
|
Some(t) => t == b
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
//! higher-level API on top of this could allow safe fork-join parallelism.
|
//! higher-level API on top of this could allow safe fork-join parallelism.
|
||||||
|
|
||||||
use native;
|
use native;
|
||||||
use rand;
|
|
||||||
use rand::{Rng, XorShiftRng};
|
use rand::{Rng, XorShiftRng};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::rand::weak_rng;
|
||||||
use std::sync::atomics::{AtomicUint, SeqCst};
|
use std::sync::atomics::{AtomicUint, SeqCst};
|
||||||
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
|
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
|
||||||
use std::task::TaskOpts;
|
use rustrt::task::TaskOpts;
|
||||||
|
|
||||||
/// A unit of work.
|
/// A unit of work.
|
||||||
///
|
///
|
||||||
|
@ -217,7 +217,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
|
||||||
port: worker_port,
|
port: worker_port,
|
||||||
chan: supervisor_chan.clone(),
|
chan: supervisor_chan.clone(),
|
||||||
other_deques: vec!(),
|
other_deques: vec!(),
|
||||||
rng: rand::weak_rng(),
|
rng: weak_rng(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c0036e25bbff4cc9f2100b344c37e50a0201a966
|
Subproject commit 9516a94b8b02e30e17a0eb52e4aaae9430064f42
|
|
@ -1 +1 @@
|
||||||
Subproject commit fe9455de1723be0b8ce78a60e110e18c739940a0
|
Subproject commit 4186de0b559bfc21b09ecc9c33aca453d6d48760
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8bb25c2a193f3b47bb5406c78c2d04396c345f22
|
Subproject commit 1d79b7db2429f52201ca6ac071ce6526e00accc7
|
|
@ -1 +1 @@
|
||||||
Subproject commit 187c5852d2c285daa3d8c1a0a1e9c8c034a42ffb
|
Subproject commit 0953d3258c050912ce91530a3625ed9568818469
|
|
@ -1 +1 @@
|
||||||
Subproject commit a0a42da1b85f431d18630454c5f2879c15771a53
|
Subproject commit 745cc15c4a6aba1833597c8f1f1244f0e187ee48
|
|
@ -1 +1 @@
|
||||||
Subproject commit 56beabc7132e9075620d397a38cf335003b846ce
|
Subproject commit 2d00be47103f654c4fe30a806ac358abe9754d3a
|
|
@ -1 +1 @@
|
||||||
Subproject commit 01bbc87a189134a71016290ce7c8b77b3b77ffb1
|
Subproject commit 5b292cb73d4b01aaec56b16f18cca48325e5cff6
|
|
@ -1 +1 @@
|
||||||
Subproject commit d6dc8d0402e317e9f9cc932ddb8502fcfc48438d
|
Subproject commit 1b1792712cb56ba82e47a2109dc705b3a066bf1f
|
|
@ -1 +1 @@
|
||||||
Subproject commit db3eb69799fa629599a729c37d6101e115cec016
|
Subproject commit 2b5981a97ab607a7b24f39484105d17c1e3a6fb8
|
|
@ -1 +1 @@
|
||||||
Subproject commit 51cdd77e2319c35e1445ffca50c25bf3cf8372c7
|
Subproject commit 9a53b6c4cd354bcd21e5dcae03a6555428302c1d
|
|
@ -1 +1 @@
|
||||||
Subproject commit a02cf0c0b67fe159de9e5ffb8f31e923dd4754c6
|
Subproject commit ae4820bfd19af931bfc84f406b74dfb67ab5ebe8
|
|
@ -1 +1 @@
|
||||||
Subproject commit 80515323fa470b340157ac6137d0f37b3e2d51d5
|
Subproject commit 2b208270fac74af639228bc7d065436a73e67b2b
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8564c2f9b23a3e178f8b233b5c08e546c87d6f74
|
Subproject commit 0165c93a0c77d1f48dcc62ffcb1a61e9fe9c4f28
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0105a21091b89cda0c8480d2240c45dc0d7b385d
|
Subproject commit 6267a184db3fa0b9f21b717766166aba3ceca98d
|
|
@ -1 +1 @@
|
||||||
Subproject commit 673b4ec2d8aa40c27de31969fa69b85040360246
|
Subproject commit d5d71e7fa23076f945eb415d275d0da18084ff2c
|
|
@ -12,7 +12,7 @@ extern crate getopts;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use test::{TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
|
use test::{AutoColor, TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
|
||||||
use getopts::{getopts, reqopt};
|
use getopts::{getopts, reqopt};
|
||||||
use std::{os, str};
|
use std::{os, str};
|
||||||
use std::io::fs;
|
use std::io::fs;
|
||||||
|
@ -63,7 +63,8 @@ fn test_options(config: Config) -> TestOpts {
|
||||||
save_metrics: None,
|
save_metrics: None,
|
||||||
test_shard: None,
|
test_shard: None,
|
||||||
logfile: None,
|
logfile: None,
|
||||||
nocapture: false
|
nocapture: false,
|
||||||
|
color: AutoColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use std::io;
|
||||||
use std::io::{File, Reader, Command};
|
use std::io::{File, Reader, Command};
|
||||||
use std::io::process::ExitStatus;
|
use std::io::process::ExitStatus;
|
||||||
use std::os;
|
use std::os;
|
||||||
use test::{DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn};
|
use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn};
|
||||||
use test::run_tests_console;
|
use test::run_tests_console;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ fn main() {
|
||||||
save_metrics: None,
|
save_metrics: None,
|
||||||
test_shard: None,
|
test_shard: None,
|
||||||
nocapture: false,
|
nocapture: false,
|
||||||
|
color: AutoColor
|
||||||
};
|
};
|
||||||
|
|
||||||
match run_tests_console(&test_opts, tests) {
|
match run_tests_console(&test_opts, tests) {
|
||||||
|
@ -54,7 +55,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(PartialEq)]
|
||||||
enum ReftestKind {
|
enum ReftestKind {
|
||||||
Same,
|
Same,
|
||||||
Different,
|
Different,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue