Implement Clone for Copy types.

This commit is contained in:
Ms2ger 2015-04-28 19:42:46 +02:00
parent b6fc83cf2b
commit 903305416a
53 changed files with 105 additions and 105 deletions

View file

@ -145,7 +145,7 @@ enum CompositionRequest {
CompositeNow(CompositingReason), CompositeNow(CompositingReason),
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Clone, Copy, PartialEq, Debug)]
enum ShutdownState { enum ShutdownState {
NotShuttingDown, NotShuttingDown,
ShuttingDown, ShuttingDown,

View file

@ -95,7 +95,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
} }
/// Information about each layer that the compositor keeps. /// Information about each layer that the compositor keeps.
#[derive(Copy)] #[derive(Clone, Copy)]
pub struct LayerProperties { pub struct LayerProperties {
pub pipeline_id: PipelineId, pub pipeline_id: PipelineId,
pub epoch: Epoch, pub epoch: Epoch,

View file

@ -170,7 +170,7 @@ pub struct SendableFrameTree {
pub children: Vec<SendableFrameTree>, pub children: Vec<SendableFrameTree>,
} }
#[derive(Copy)] #[derive(Clone, Copy)]
enum ExitPipelineMode { enum ExitPipelineMode {
Normal, Normal,
Force, Force,

View file

@ -26,7 +26,7 @@ pub struct BufferMap {
} }
/// 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.
#[derive(Eq, Copy)] #[derive(Eq, Copy, Clone)]
struct BufferKey([usize; 2]); struct BufferKey([usize; 2]);
impl Hash for BufferKey { impl Hash for BufferKey {

View file

@ -57,7 +57,7 @@ pub struct PaintContext<'a> {
pub transient_clip: Option<ClippingRegion>, pub transient_clip: Option<ClippingRegion>,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum Direction { enum Direction {
Top, Top,
Left, Left,
@ -65,7 +65,7 @@ enum Direction {
Bottom Bottom
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum DashSize { enum DashSize {
DottedBorder = 1, DottedBorder = 1,
DashedBorder = 3 DashedBorder = 3

View file

@ -87,7 +87,7 @@ impl GlyphEntry {
pub type GlyphId = u32; pub type GlyphId = u32;
// TODO: unify with bit flags? // TODO: unify with bit flags?
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
pub enum BreakType { pub enum BreakType {
None, None,
Normal, Normal,
@ -415,7 +415,7 @@ impl<'a> DetailedGlyphStore {
// This struct is used by GlyphStore clients to provide new glyph data. // This struct is used by GlyphStore clients to provide new glyph data.
// It should be allocated on the stack and passed by reference to GlyphStore. // It should be allocated on the stack and passed by reference to GlyphStore.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct GlyphData { pub struct GlyphData {
id: GlyphId, id: GlyphId,
advance: Au, advance: Au,
@ -449,7 +449,7 @@ impl GlyphData {
// through glyphs (either for a particular TextRun offset, or all glyphs). // through glyphs (either for a particular TextRun offset, or all glyphs).
// Rather than eagerly assembling and copying glyph data, it only retrieves // Rather than eagerly assembling and copying glyph data, it only retrieves
// values as they are needed from the GlyphStore, using provided offsets. // values as they are needed from the GlyphStore, using provided offsets.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum GlyphInfo<'a> { pub enum GlyphInfo<'a> {
Simple(&'a GlyphStore, CharIndex), Simple(&'a GlyphStore, CharIndex),
Detail(&'a GlyphStore, CharIndex, u16), Detail(&'a GlyphStore, CharIndex, u16),

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[derive(PartialEq, Eq, Copy)] #[derive(PartialEq, Eq, Copy, Clone)]
pub enum CompressionMode { pub enum CompressionMode {
CompressNone, CompressNone,
CompressWhitespace, CompressWhitespace,

View file

@ -88,7 +88,7 @@ impl FloatedBlockInfo {
} }
/// The solutions for the block-size-and-margins constraint equation. /// The solutions for the block-size-and-margins constraint equation.
#[derive(Copy)] #[derive(Copy, Clone)]
struct BSizeConstraintSolution { struct BSizeConstraintSolution {
block_start: Au, block_start: Au,
block_size: Au, block_size: Au,
@ -1962,7 +1962,7 @@ impl fmt::Debug for BlockFlow {
} }
/// The inputs for the inline-sizes-and-margins constraint equation. /// The inputs for the inline-sizes-and-margins constraint equation.
#[derive(Debug, Copy)] #[derive(Debug, Copy, Clone)]
pub struct ISizeConstraintInput { pub struct ISizeConstraintInput {
pub computed_inline_size: MaybeAuto, pub computed_inline_size: MaybeAuto,
pub inline_start_margin: MaybeAuto, pub inline_start_margin: MaybeAuto,
@ -1992,7 +1992,7 @@ impl ISizeConstraintInput {
} }
/// The solutions for the inline-size-and-margins constraint equation. /// The solutions for the inline-size-and-margins constraint equation.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct ISizeConstraintSolution { pub struct ISizeConstraintSolution {
pub inline_start: Au, pub inline_start: Au,
pub inline_size: Au, pub inline_size: Au,

View file

@ -1584,7 +1584,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
} }
// A helper data structure for gradients. // A helper data structure for gradients.
#[derive(Copy)] #[derive(Copy, Clone)]
struct StopRun { struct StopRun {
start_offset: f32, start_offset: f32,
end_offset: f32, end_offset: f32,

View file

@ -29,7 +29,7 @@ impl FloatKind {
} }
/// The kind of clearance: left, right, or both. /// The kind of clearance: left, right, or both.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ClearType { pub enum ClearType {
Left, Left,
Right, Right,

View file

@ -693,7 +693,7 @@ pub type DescendantOffsetIter<'a> = Zip<DescendantIter<'a>, IterMut<'a, Au>>;
/// Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be /// Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be
/// confused with absolutely-positioned flows). /// confused with absolutely-positioned flows).
#[derive(RustcEncodable, Copy)] #[derive(RustcEncodable, Copy, Clone)]
pub struct AbsolutePositionInfo { pub struct AbsolutePositionInfo {
/// The size of the containing block for relatively-positioned descendants. /// The size of the containing block for relatively-positioned descendants.
pub relative_containing_block_size: LogicalSize<Au>, pub relative_containing_block_size: LogicalSize<Au>,

View file

@ -65,7 +65,7 @@ static FONT_SUPERSCRIPT_OFFSET_RATIO: f64 = 0.34;
/// with a float or a horizontal wall of the containing block. The block-start /// with a float or a horizontal wall of the containing block. The block-start
/// inline-start corner of the green zone is the same as that of the line, but /// inline-start corner of the green zone is the same as that of the line, but
/// the green zone can be taller and wider than the line itself. /// the green zone can be taller and wider than the line itself.
#[derive(RustcEncodable, Debug, Copy)] #[derive(RustcEncodable, Debug, Copy, Clone)]
pub struct Line { pub struct Line {
/// A range of line indices that describe line breaks. /// A range of line indices that describe line breaks.
/// ///

View file

@ -19,7 +19,7 @@ use util::geometry::Au;
use util::logical_geometry::LogicalMargin; use util::logical_geometry::LogicalMargin;
/// A collapsible margin. See CSS 2.1 § 8.3.1. /// A collapsible margin. See CSS 2.1 § 8.3.1.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct AdjoiningMargins { pub struct AdjoiningMargins {
/// The value of the greatest positive margin. /// The value of the greatest positive margin.
pub most_positive: Au, pub most_positive: Au,
@ -62,7 +62,7 @@ impl AdjoiningMargins {
} }
/// Represents the block-start and block-end margins of a flow with collapsible margins. See CSS 2.1 § 8.3.1. /// Represents the block-start and block-end margins of a flow with collapsible margins. See CSS 2.1 § 8.3.1.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum CollapsibleMargins { pub enum CollapsibleMargins {
/// Margins may not collapse with this flow. /// Margins may not collapse with this flow.
None(Au, Au), None(Au, Au),
@ -260,7 +260,7 @@ impl MarginCollapseInfo {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum MarginCollapseState { pub enum MarginCollapseState {
AccumulatingCollapsibleTopMargin, AccumulatingCollapsibleTopMargin,
AccumulatingMarginIn, AccumulatingMarginIn,
@ -357,7 +357,7 @@ impl IntrinsicISizesContribution {
} }
/// Useful helper data type when computing values for blocks and positioned elements. /// Useful helper data type when computing values for blocks and positioned elements.
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum MaybeAuto { pub enum MaybeAuto {
Auto, Auto,
Specified(Au), Specified(Au),

View file

@ -66,7 +66,7 @@ impl Encodable for TableRowFlow {
} }
/// Information about the column inline size and span for each cell. /// Information about the column inline size and span for each cell.
#[derive(RustcEncodable, Copy)] #[derive(RustcEncodable, Copy, Clone)]
pub struct CellIntrinsicInlineSize { pub struct CellIntrinsicInlineSize {
/// Inline sizes that this cell contributes to the column. /// Inline sizes that this cell contributes to the column.
pub column_size: ColumnIntrinsicInlineSize, pub column_size: ColumnIntrinsicInlineSize,

View file

@ -37,7 +37,7 @@ use style::properties::ComputedValues;
use style::values::CSSFloat; use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto; use style::values::computed::LengthOrPercentageOrAuto;
#[derive(Copy, RustcEncodable, Debug)] #[derive(Copy, Clone, RustcEncodable, Debug)]
pub enum TableLayout { pub enum TableLayout {
Fixed, Fixed,
Auto Auto
@ -565,7 +565,7 @@ impl<'a> Add for &'a AutoLayoutCandidateGuess {
/// The `CSSFloat` member specifies the weight of the smaller of the two guesses, on a scale from /// The `CSSFloat` member specifies the weight of the smaller of the two guesses, on a scale from
/// 0.0 to 1.0. /// 0.0 to 1.0.
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
enum SelectedAutoLayoutCandidateGuess { enum SelectedAutoLayoutCandidateGuess {
UseMinimumGuess, UseMinimumGuess,
InterpolateBetweenMinimumGuessAndMinimumPercentageGuess(CSSFloat), InterpolateBetweenMinimumGuessAndMinimumPercentageGuess(CSSFloat),

View file

@ -119,7 +119,7 @@ fn insert_ancestors_into_bloom_filter(bf: &mut Box<BloomFilter>,
/// The recalc-style-for-node traversal, which styles each node and must run before /// The recalc-style-for-node traversal, which styles each node and must run before
/// layout computation. This computes the styles applied to each node. /// layout computation. This computes the styles applied to each node.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct RecalcStyleForNode<'a> { pub struct RecalcStyleForNode<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }
@ -211,7 +211,7 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> {
} }
/// The flow construction traversal, which builds flows for styled nodes. /// The flow construction traversal, which builds flows for styled nodes.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct ConstructFlows<'a> { pub struct ConstructFlows<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }
@ -310,7 +310,7 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
} }
/// The assign-inline-sizes traversal. In Gecko this corresponds to `Reflow`. /// The assign-inline-sizes traversal. In Gecko this corresponds to `Reflow`.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct AssignISizes<'a> { pub struct AssignISizes<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }
@ -331,7 +331,7 @@ impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
/// layout computation. Determines the final block-sizes for all layout objects, computes /// layout computation. Determines the final block-sizes for all layout objects, computes
/// positions, and computes overflow regions. In Gecko this corresponds to `Reflow` and /// positions, and computes overflow regions. In Gecko this corresponds to `Reflow` and
/// `FinishAndStoreOverflow`. /// `FinishAndStoreOverflow`.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct AssignBSizesAndStoreOverflow<'a> { pub struct AssignBSizesAndStoreOverflow<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }
@ -356,7 +356,7 @@ impl<'a> PostorderFlowTraversal for AssignBSizesAndStoreOverflow<'a> {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct ComputeAbsolutePositions<'a> { pub struct ComputeAbsolutePositions<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }
@ -368,7 +368,7 @@ impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct BuildDisplayList<'a> { pub struct BuildDisplayList<'a> {
pub layout_context: &'a LayoutContext<'a>, pub layout_context: &'a LayoutContext<'a>,
} }

View file

@ -170,7 +170,7 @@ pub trait TLayoutNode {
/// A wrapper so that layout can access only the methods that it should have access to. Layout must /// A wrapper so that layout can access only the methods that it should have access to. Layout must
/// only ever see these and must never see instances of `LayoutJS`. /// only ever see these and must never see instances of `LayoutJS`.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LayoutNode<'a> { pub struct LayoutNode<'a> {
/// The wrapped node. /// The wrapped node.
node: LayoutJS<Node>, node: LayoutJS<Node>,
@ -179,15 +179,6 @@ pub struct LayoutNode<'a> {
pub chain: PhantomData<&'a ()>, pub chain: PhantomData<&'a ()>,
} }
impl<'ln> Clone for LayoutNode<'ln> {
fn clone(&self) -> LayoutNode<'ln> {
LayoutNode {
node: self.node.clone(),
chain: self.chain,
}
}
}
impl<'a> PartialEq for LayoutNode<'a> { impl<'a> PartialEq for LayoutNode<'a> {
#[inline] #[inline]
fn eq(&self, other: &LayoutNode) -> bool { fn eq(&self, other: &LayoutNode) -> bool {
@ -520,7 +511,7 @@ impl<'a> Iterator for LayoutTreeIterator<'a> {
} }
/// A wrapper around elements that ensures layout can only ever access safe properties. /// A wrapper around elements that ensures layout can only ever access safe properties.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LayoutElement<'le> { pub struct LayoutElement<'le> {
element: &'le Element, element: &'le Element,
} }

View file

@ -33,7 +33,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.
#[derive(PartialEq, Eq, Debug, Copy)] #[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub struct Epoch(pub u32); pub struct Epoch(pub u32);
impl Epoch { impl Epoch {
@ -71,7 +71,7 @@ pub enum ScrollPolicy {
/// All layer-specific information that the painting task sends to the compositor other than the /// All layer-specific information that the painting task sends to the compositor other than the
/// buffer contents of the layer itself. /// buffer contents of the layer itself.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LayerMetadata { pub struct LayerMetadata {
/// An opaque ID. This is usually the address of the flow and index of the box within it. /// An opaque ID. This is usually the address of the flow and index of the box within it.
pub id: LayerId, pub id: LayerId,

View file

@ -27,7 +27,7 @@ impl ConstellationChan {
} }
} }
#[derive(PartialEq, Eq, Copy, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum IFrameSandboxState { pub enum IFrameSandboxState {
IFrameSandboxed, IFrameSandboxed,
IFrameUnsandboxed IFrameUnsandboxed
@ -40,7 +40,7 @@ pub struct Failure {
pub parent_info: Option<(PipelineId, SubpageId)>, pub parent_info: Option<(PipelineId, SubpageId)>,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct WindowSizeData { pub struct WindowSizeData {
/// The size of the initial layout viewport, before parsing an /// The size of the initial layout viewport, before parsing an
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport /// http://www.w3.org/TR/css-device-adapt/#initial-viewport
@ -196,7 +196,7 @@ bitflags! {
} }
/// Specifies the type of focus event that is sent to a pipeline /// Specifies the type of focus event that is sent to a pipeline
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum FocusType { pub enum FocusType {
Element, // The first focus message - focus the element itself Element, // The first focus message - focus the element itself
Parent, // Focusing a parent element (an iframe) Parent, // Focusing a parent element (an iframe)
@ -342,7 +342,7 @@ pub struct SubpageId(pub u32);
// The type of pipeline exit. During complete shutdowns, pipelines do not have to // The type of pipeline exit. During complete shutdowns, pipelines do not have to
// release resources automatically released on process termination. // release resources automatically released on process termination.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum PipelineExitType { pub enum PipelineExitType {
PipelineOnly, PipelineOnly,
Complete, Complete,

View file

@ -11,7 +11,7 @@ use fetch::cors_cache::CORSCache;
use fetch::response::Response; use fetch::response::Response;
/// A [request context](https://fetch.spec.whatwg.org/#concept-request-context) /// A [request context](https://fetch.spec.whatwg.org/#concept-request-context)
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Context { pub enum Context {
Audio, Beacon, CSPreport, Download, Embed, Eventsource, Audio, Beacon, CSPreport, Download, Embed, Eventsource,
Favicon, Fetch, Font, Form, Frame, Hyperlink, IFrame, Image, Favicon, Fetch, Font, Form, Frame, Hyperlink, IFrame, Image,
@ -21,7 +21,7 @@ pub enum Context {
} }
/// A [request context frame type](https://fetch.spec.whatwg.org/#concept-request-context-frame-type) /// A [request context frame type](https://fetch.spec.whatwg.org/#concept-request-context-frame-type)
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ContextFrameType { pub enum ContextFrameType {
Auxiliary, Auxiliary,
TopLevel, TopLevel,
@ -37,7 +37,7 @@ pub enum Referer {
} }
/// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode) /// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode)
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum RequestMode { pub enum RequestMode {
SameOrigin, SameOrigin,
NoCORS, NoCORS,
@ -46,7 +46,7 @@ pub enum RequestMode {
} }
/// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode) /// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum CredentialsMode { pub enum CredentialsMode {
Omit, Omit,
CredentialsSameOrigin, CredentialsSameOrigin,
@ -54,7 +54,7 @@ pub enum CredentialsMode {
} }
/// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting) /// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting)
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ResponseTainting { pub enum ResponseTainting {
Basic, Basic,
CORSTainting, CORSTainting,

View file

@ -16,7 +16,7 @@ pub trait ImageResponder : Send {
} }
/// The current state of an image in the cache. /// The current state of an image in the cache.
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
pub enum ImageState { pub enum ImageState {
Pending, Pending,
LoadError, LoadError,

View file

@ -192,7 +192,7 @@ impl Metadata {
} }
/// The creator of a given cookie /// The creator of a given cookie
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
pub enum CookieSource { pub enum CookieSource {
/// An HTTP API /// An HTTP API
HTTP, HTTP,

View file

@ -7,7 +7,7 @@ use url::Url;
use util::str::DOMString; use util::str::DOMString;
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum StorageType { pub enum StorageType {
Session, Session,
Local Local

View file

@ -16,7 +16,7 @@ use std::ffi::CString;
use std::ptr; use std::ptr;
/// The exception handling used for a call. /// The exception handling used for a call.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum ExceptionHandling { pub enum ExceptionHandling {
/// Report any exception and don't throw it to the caller code. /// Report any exception and don't throw it to the caller code.
Report, Report,

View file

@ -2917,7 +2917,7 @@ class CGEnum(CGThing):
decl = """\ decl = """\
#[repr(usize)] #[repr(usize)]
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
#[jstraceable] #[jstraceable]
pub enum %s { pub enum %s {
%s %s
@ -5388,8 +5388,8 @@ class GlobalGenRoots():
return CGList([ return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT), CGGeneric(AUTOGENERATED_WARNING_COMMENT),
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength), CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength),
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy"), CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy, Clone"),
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy"), CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy, Clone"),
]) ])

View file

@ -25,7 +25,7 @@ use js::jsapi::{JS_GetClass};
use url::Url; use url::Url;
/// A freely-copyable reference to a rooted global object. /// A freely-copyable reference to a rooted global object.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum GlobalRef<'a> { pub enum GlobalRef<'a> {
/// A reference to a `Window` object. /// A reference to a `Window` object.
Window(JSRef<'a, window::Window>), Window(JSRef<'a, window::Window>),

View file

@ -124,6 +124,9 @@ impl<T: Reflectable> Rootable<T> for Unrooted<T> {
} }
impl<T> Copy for Unrooted<T> {} impl<T> Copy for Unrooted<T> {}
impl<T> Clone for Unrooted<T> {
fn clone(&self) -> Unrooted<T> { *self }
}
/// A type that represents a JS-owned value that is rooted for the lifetime of /// A type that represents a JS-owned value that is rooted for the lifetime of
/// this value. Importantly, it requires explicit rooting in order to interact /// this value. Importantly, it requires explicit rooting in order to interact
@ -545,6 +548,9 @@ pub struct RootCollection {
pub struct RootCollectionPtr(pub *const RootCollection); pub struct RootCollectionPtr(pub *const RootCollection);
impl Copy for RootCollectionPtr {} impl Copy for RootCollectionPtr {}
impl Clone for RootCollectionPtr {
fn clone(&self) -> RootCollectionPtr { *self }
}
impl RootCollection { impl RootCollection {
/// Create an empty collection of roots /// Create an empty collection of roots

View file

@ -129,7 +129,7 @@ pub struct NativePropertyHooks {
} }
/// The struct that holds inheritance information for DOM object reflectors. /// The struct that holds inheritance information for DOM object reflectors.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct DOMClass { pub struct DOMClass {
/// A list of interfaces that this object implements, in order of decreasing /// A list of interfaces that this object implements, in order of decreasing
/// derivedness. /// derivedness.
@ -148,6 +148,9 @@ pub struct DOMJSClass {
/// Associated data for DOM object reflectors. /// Associated data for DOM object reflectors.
pub dom_class: DOMClass pub dom_class: DOMClass
} }
impl Clone for DOMJSClass {
fn clone(&self) -> DOMJSClass { *self }
}
unsafe impl Sync for DOMJSClass {} unsafe impl Sync for DOMJSClass {}
/// Returns the ProtoOrIfaceArray for the given global object. /// Returns the ProtoOrIfaceArray for the given global object.

View file

@ -13,7 +13,7 @@ use util::str::DOMString;
use std::borrow::ToOwned; use std::borrow::ToOwned;
#[repr(u16)] #[repr(u16)]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[jstraceable] #[jstraceable]
pub enum DOMErrorName { pub enum DOMErrorName {
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR, IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,

View file

@ -108,7 +108,7 @@ impl ElementDerived for EventTarget {
} }
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[jstraceable] #[jstraceable]
pub enum ElementTypeId { pub enum ElementTypeId {
HTMLElement(HTMLElementTypeId), HTMLElement(HTMLElementTypeId),

View file

@ -19,7 +19,7 @@ use std::default::Default;
use time; use time;
#[jstraceable] #[jstraceable]
#[derive(Copy)] #[derive(Copy, Clone)]
#[repr(u16)] #[repr(u16)]
pub enum EventPhase { pub enum EventPhase {
None = EventConstants::NONE, None = EventConstants::NONE,

View file

@ -33,14 +33,14 @@ use url::Url;
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
pub enum ListenerPhase { pub enum ListenerPhase {
Capturing, Capturing,
Bubbling, Bubbling,
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
pub enum EventTargetTypeId { pub enum EventTargetTypeId {
Node(NodeTypeId), Node(NodeTypeId),
@ -51,7 +51,7 @@ pub enum EventTargetTypeId {
XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId) XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId)
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
pub enum EventListenerType { pub enum EventListenerType {
Additive(EventListener), Additive(EventListener),
@ -67,7 +67,7 @@ impl EventListenerType {
} }
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
#[privatize] #[privatize]
pub struct EventListenerEntry { pub struct EventListenerEntry {

View file

@ -29,7 +29,7 @@ use std::cell::Cell;
use string_cache::Atom; use string_cache::Atom;
#[jstraceable] #[jstraceable]
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
#[allow(dead_code)] #[allow(dead_code)]
enum ButtonType { enum ButtonType {
ButtonSubmit, ButtonSubmit,

View file

@ -239,7 +239,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
} }
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[jstraceable] #[jstraceable]
pub enum HTMLElementTypeId { pub enum HTMLElementTypeId {
HTMLElement, HTMLElement,

View file

@ -133,13 +133,13 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum SubmittedFrom { pub enum SubmittedFrom {
FromFormSubmitMethod, FromFormSubmitMethod,
NotFromFormSubmitMethod NotFromFormSubmitMethod
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ResetFrom { pub enum ResetFrom {
FromFormResetMethod, FromFormResetMethod,
NotFromFormResetMethod NotFromFormResetMethod
@ -407,21 +407,21 @@ pub struct FormDatum {
pub value: DOMString pub value: DOMString
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum FormEncType { pub enum FormEncType {
TextPlainEncoded, TextPlainEncoded,
UrlEncoded, UrlEncoded,
FormDataEncoded FormDataEncoded
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum FormMethod { pub enum FormMethod {
FormGet, FormGet,
FormPost, FormPost,
FormDialog FormDialog
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum FormSubmitter<'a> { pub enum FormSubmitter<'a> {
FormElement(JSRef<'a, HTMLFormElement>), FormElement(JSRef<'a, HTMLFormElement>),
InputElement(JSRef<'a, HTMLInputElement>), InputElement(JSRef<'a, HTMLInputElement>),

View file

@ -48,7 +48,7 @@ const DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
const DEFAULT_RESET_VALUE: &'static str = "Reset"; const DEFAULT_RESET_VALUE: &'static str = "Reset";
#[jstraceable] #[jstraceable]
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
#[allow(dead_code)] #[allow(dead_code)]
enum InputType { enum InputType {
InputSubmit, InputSubmit,

View file

@ -38,7 +38,7 @@ impl HTMLMediaElement {
} }
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[jstraceable] #[jstraceable]
pub enum HTMLMediaElementTypeId { pub enum HTMLMediaElementTypeId {
HTMLAudioElement, HTMLAudioElement,

View file

@ -16,7 +16,7 @@ use cssparser::RGBA;
use util::str::{self, DOMString, LengthOrPercentageOrAuto}; use util::str::{self, DOMString, LengthOrPercentageOrAuto};
use std::cell::Cell; use std::cell::Cell;
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[jstraceable] #[jstraceable]
pub enum HTMLTableCellElementTypeId { pub enum HTMLTableCellElementTypeId {
HTMLTableDataCellElement, HTMLTableDataCellElement,

View file

@ -190,7 +190,7 @@ impl Drop for Node {
/// suppress observers flag /// suppress observers flag
/// https://dom.spec.whatwg.org/#concept-node-insert /// https://dom.spec.whatwg.org/#concept-node-insert
/// https://dom.spec.whatwg.org/#concept-node-remove /// https://dom.spec.whatwg.org/#concept-node-remove
#[derive(Copy)] #[derive(Copy, Clone)]
enum SuppressObserver { enum SuppressObserver {
Suppressed, Suppressed,
Unsuppressed Unsuppressed
@ -266,7 +266,7 @@ impl LayoutDataRef {
} }
/// The different types of nodes. /// The different types of nodes.
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[jstraceable] #[jstraceable]
pub enum NodeTypeId { pub enum NodeTypeId {
DocumentType, DocumentType,
@ -1311,7 +1311,7 @@ impl Iterator for TreeIterator {
/// Specifies whether children must be recursively cloned or not. /// Specifies whether children must be recursively cloned or not.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum CloneChildrenFlag { pub enum CloneChildrenFlag {
CloneChildren, CloneChildren,
DoNotCloneChildren DoNotCloneChildren

View file

@ -33,7 +33,7 @@ pub struct Sink {
/// FragmentContext is used only to pass this group of related values /// FragmentContext is used only to pass this group of related values
/// into functions. /// into functions.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct FragmentContext<'a> { pub struct FragmentContext<'a> {
pub context_elem: JSRef<'a, Node>, pub context_elem: JSRef<'a, Node>,
pub form_elem: Option<JSRef<'a, Node>>, pub form_elem: Option<JSRef<'a, Node>>,

View file

@ -34,7 +34,7 @@ use std::rc::Rc;
use std::cell::Cell; use std::cell::Cell;
use url::{Url, UrlParser}; use url::{Url, UrlParser};
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
pub enum WorkerGlobalScopeTypeId { pub enum WorkerGlobalScopeTypeId {
DedicatedGlobalScope, DedicatedGlobalScope,

View file

@ -67,7 +67,7 @@ use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams;
use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams}; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams};
pub type SendParam = StringOrURLSearchParams; pub type SendParam = StringOrURLSearchParams;
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
#[jstraceable] #[jstraceable]
enum XMLHttpRequestState { enum XMLHttpRequestState {
Unsent = 0, Unsent = 0,

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::InheritTypes::XMLHttpRequestEventTargetDerived;
use dom::bindings::js::JSRef; use dom::bindings::js::JSRef;
use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId}; use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId};
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[jstraceable] #[jstraceable]
pub enum XMLHttpRequestEventTargetTypeId { pub enum XMLHttpRequestEventTargetTypeId {
XMLHttpRequest, XMLHttpRequest,

View file

@ -152,7 +152,7 @@ impl InProgressLoad {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum TimerSource { pub enum TimerSource {
FromWindow(PipelineId), FromWindow(PipelineId),
FromWorker FromWorker

View file

@ -17,14 +17,14 @@ use std::default::Default;
use std::num::SignedInt; use std::num::SignedInt;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Selection { pub enum Selection {
Selected, Selected,
NotSelected NotSelected
} }
#[jstraceable] #[jstraceable]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TextPoint { pub struct TextPoint {
/// 0-based line number /// 0-based line number
pub line: usize, pub line: usize,

View file

@ -29,7 +29,7 @@ use std::time::duration::Duration;
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
#[jstraceable] #[jstraceable]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TimerId(i32); pub struct TimerId(i32);
#[jstraceable] #[jstraceable]

View file

@ -21,14 +21,14 @@ use util::geometry::Au;
use util::str::LengthOrPercentageOrAuto; use util::str::LengthOrPercentageOrAuto;
/// Legacy presentational attributes that take a length as defined in HTML5 § 2.4.4.4. /// Legacy presentational attributes that take a length as defined in HTML5 § 2.4.4.4.
#[derive(Copy, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
pub enum LengthAttribute { pub enum LengthAttribute {
/// `<td width>` /// `<td width>`
Width, Width,
} }
/// Legacy presentational attributes that take an integer as defined in HTML5 § 2.4.4.2. /// Legacy presentational attributes that take an integer as defined in HTML5 § 2.4.4.2.
#[derive(Copy, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
pub enum IntegerAttribute { pub enum IntegerAttribute {
/// `<input size>` /// `<input size>`
Size, Size,
@ -37,7 +37,7 @@ pub enum IntegerAttribute {
} }
/// Legacy presentational attributes that take a nonnegative integer as defined in HTML5 § 2.4.4.2. /// Legacy presentational attributes that take a nonnegative integer as defined in HTML5 § 2.4.4.2.
#[derive(Copy, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
pub enum UnsignedIntegerAttribute { pub enum UnsignedIntegerAttribute {
/// `<td border>` /// `<td border>`
Border, Border,

View file

@ -16,7 +16,7 @@ pub struct MediaQueryList {
pub media_queries: Vec<MediaQuery> pub media_queries: Vec<MediaQuery>
} }
#[derive(PartialEq, Eq, Copy, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum Range<T> { pub enum Range<T> {
Min(T), Min(T),
Max(T), Max(T),
@ -59,14 +59,14 @@ impl<T: Ord> Range<T> {
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media1 /// http://dev.w3.org/csswg/mediaqueries-3/#media1
#[derive(PartialEq, Copy, Debug)] #[derive(PartialEq, Copy, Clone, Debug)]
pub enum Expression { pub enum Expression {
/// http://dev.w3.org/csswg/mediaqueries-3/#width /// http://dev.w3.org/csswg/mediaqueries-3/#width
Width(Range<specified::Length>), Width(Range<specified::Length>),
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media0 /// http://dev.w3.org/csswg/mediaqueries-3/#media0
#[derive(PartialEq, Eq, Copy, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum Qualifier { pub enum Qualifier {
Only, Only,
Not, Not,
@ -91,13 +91,13 @@ impl MediaQuery {
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media0 /// http://dev.w3.org/csswg/mediaqueries-3/#media0
#[derive(PartialEq, Eq, Copy, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum MediaQueryType { pub enum MediaQueryType {
All, // Always true All, // Always true
MediaType(MediaType), MediaType(MediaType),
} }
#[derive(PartialEq, Eq, Copy, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum MediaType { pub enum MediaType {
Screen, Screen,
Print, Print,

View file

@ -4685,7 +4685,7 @@ fn deduplicate_property_declarations(declarations: Vec<PropertyDeclaration>)
} }
#[derive(Copy, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum CSSWideKeyword { pub enum CSSWideKeyword {
InitialKeyword, InitialKeyword,
InheritKeyword, InheritKeyword,
@ -4732,7 +4732,7 @@ pub enum PropertyDeclaration {
} }
#[derive(Eq, PartialEq, Copy)] #[derive(Eq, PartialEq, Copy, Clone)]
pub enum PropertyDeclarationParseResult { pub enum PropertyDeclarationParseResult {
UnknownProperty, UnknownProperty,
ExperimentalProperty, ExperimentalProperty,

View file

@ -312,7 +312,7 @@ struct TopLevelRuleParser<'a> {
state: Cell<State>, state: Cell<State>,
} }
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy)] #[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone)]
enum State { enum State {
Start = 1, Start = 1,
Imports = 2, Imports = 2,

View file

@ -31,7 +31,7 @@ use rustc_serialize::{Encoder, Encodable};
/// ///
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling /// The ratio between ScreenPx and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`. /// `servo::windowing::WindowMethods::hidpi_factor`.
#[derive(Debug, Copy)] #[derive(Debug, Copy, Clone)]
pub enum ScreenPx {} pub enum ScreenPx {}
/// One CSS "px" in the coordinate system of the "initial viewport": /// One CSS "px" in the coordinate system of the "initial viewport":
@ -43,7 +43,7 @@ pub enum ScreenPx {}
/// ///
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the /// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
/// document is zoomed in or out then this scale may be larger or smaller. /// document is zoomed in or out then this scale may be larger or smaller.
#[derive(RustcEncodable, Debug, Copy)] #[derive(RustcEncodable, Debug, Copy, Clone)]
pub enum ViewportPx {} pub enum ViewportPx {}
/// One CSS "px" in the root coordinate system for the content document. /// One CSS "px" in the root coordinate system for the content document.
@ -52,7 +52,7 @@ pub enum ViewportPx {}
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the /// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size /// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
/// as the viewable area. /// as the viewable area.
#[derive(RustcEncodable, Debug, Copy)] #[derive(RustcEncodable, Debug, Copy, Clone)]
pub enum PagePx {} pub enum PagePx {}
// In summary, the hierarchy of pixel units and the factors to convert from one to the next: // In summary, the hierarchy of pixel units and the factors to convert from one to the next:

View file

@ -127,7 +127,7 @@ pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> {
}) })
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum LengthOrPercentageOrAuto { pub enum LengthOrPercentageOrAuto {
Auto, Auto,
Percentage(f64), Percentage(f64),

View file

@ -148,7 +148,7 @@ pub struct hwc_color {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct hwc_rect { pub struct hwc_rect {
left: c_int, left: c_int,
top: c_int, top: c_int,