diff options
53 files changed, 105 insertions, 105 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 8e42eb7a9e2..727760e57ed 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -145,7 +145,7 @@ enum CompositionRequest { CompositeNow(CompositingReason), } -#[derive(Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Debug)] enum ShutdownState { NotShuttingDown, ShuttingDown, diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 7b08b2cb249..69e5ef4f17b 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -95,7 +95,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> { } /// Information about each layer that the compositor keeps. -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct LayerProperties { pub pipeline_id: PipelineId, pub epoch: Epoch, diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 2e7a975b731..f1a7cd8c487 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -170,7 +170,7 @@ pub struct SendableFrameTree { pub children: Vec<SendableFrameTree>, } -#[derive(Copy)] +#[derive(Clone, Copy)] enum ExitPipelineMode { Normal, Force, diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs index e0cf4d22682..69b798b4e19 100644 --- a/components/gfx/buffer_map.rs +++ b/components/gfx/buffer_map.rs @@ -26,7 +26,7 @@ pub struct BufferMap { } /// 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]); impl Hash for BufferKey { diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 2db375e2cd9..1999cc5cf66 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -57,7 +57,7 @@ pub struct PaintContext<'a> { pub transient_clip: Option<ClippingRegion>, } -#[derive(Copy)] +#[derive(Copy, Clone)] enum Direction { Top, Left, @@ -65,7 +65,7 @@ enum Direction { Bottom } -#[derive(Copy)] +#[derive(Copy, Clone)] enum DashSize { DottedBorder = 1, DashedBorder = 3 diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index ba60e67e9a1..d69236b0ef5 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -87,7 +87,7 @@ impl GlyphEntry { pub type GlyphId = u32; // TODO: unify with bit flags? -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] pub enum BreakType { None, Normal, @@ -415,7 +415,7 @@ impl<'a> DetailedGlyphStore { // 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. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct GlyphData { id: GlyphId, advance: Au, @@ -449,7 +449,7 @@ impl GlyphData { // through glyphs (either for a particular TextRun offset, or all glyphs). // Rather than eagerly assembling and copying glyph data, it only retrieves // values as they are needed from the GlyphStore, using provided offsets. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum GlyphInfo<'a> { Simple(&'a GlyphStore, CharIndex), Detail(&'a GlyphStore, CharIndex, u16), diff --git a/components/gfx/text/util.rs b/components/gfx/text/util.rs index 95654af9ce5..60223ff7a73 100644 --- a/components/gfx/text/util.rs +++ b/components/gfx/text/util.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[derive(PartialEq, Eq, Copy)] +#[derive(PartialEq, Eq, Copy, Clone)] pub enum CompressionMode { CompressNone, CompressWhitespace, diff --git a/components/layout/block.rs b/components/layout/block.rs index 10bb2a055aa..eaa2e33f83a 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -88,7 +88,7 @@ impl FloatedBlockInfo { } /// The solutions for the block-size-and-margins constraint equation. -#[derive(Copy)] +#[derive(Copy, Clone)] struct BSizeConstraintSolution { block_start: Au, block_size: Au, @@ -1962,7 +1962,7 @@ impl fmt::Debug for BlockFlow { } /// The inputs for the inline-sizes-and-margins constraint equation. -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct ISizeConstraintInput { pub computed_inline_size: MaybeAuto, pub inline_start_margin: MaybeAuto, @@ -1992,7 +1992,7 @@ impl ISizeConstraintInput { } /// The solutions for the inline-size-and-margins constraint equation. -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub struct ISizeConstraintSolution { pub inline_start: Au, pub inline_size: Au, diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 9061b845c9a..890a3b12128 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1584,7 +1584,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow { } // A helper data structure for gradients. -#[derive(Copy)] +#[derive(Copy, Clone)] struct StopRun { start_offset: f32, end_offset: f32, diff --git a/components/layout/floats.rs b/components/layout/floats.rs index 0d0ea9e0617..5f61760829b 100644 --- a/components/layout/floats.rs +++ b/components/layout/floats.rs @@ -29,7 +29,7 @@ impl FloatKind { } /// The kind of clearance: left, right, or both. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ClearType { Left, Right, diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 6ebf8530c90..5c058439d29 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -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 /// confused with absolutely-positioned flows). -#[derive(RustcEncodable, Copy)] +#[derive(RustcEncodable, Copy, Clone)] pub struct AbsolutePositionInfo { /// The size of the containing block for relatively-positioned descendants. pub relative_containing_block_size: LogicalSize<Au>, diff --git a/components/layout/inline.rs b/components/layout/inline.rs index d755678d7ed..e4f35b2f69a 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -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 /// 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. -#[derive(RustcEncodable, Debug, Copy)] +#[derive(RustcEncodable, Debug, Copy, Clone)] pub struct Line { /// A range of line indices that describe line breaks. /// diff --git a/components/layout/model.rs b/components/layout/model.rs index ebd70dcae84..8aecee621ee 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -19,7 +19,7 @@ use util::geometry::Au; use util::logical_geometry::LogicalMargin; /// A collapsible margin. See CSS 2.1 § 8.3.1. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct AdjoiningMargins { /// The value of the greatest positive margin. 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. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum CollapsibleMargins { /// Margins may not collapse with this flow. None(Au, Au), @@ -260,7 +260,7 @@ impl MarginCollapseInfo { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum MarginCollapseState { AccumulatingCollapsibleTopMargin, AccumulatingMarginIn, @@ -357,7 +357,7 @@ impl IntrinsicISizesContribution { } /// Useful helper data type when computing values for blocks and positioned elements. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MaybeAuto { Auto, Specified(Au), diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index ef3f70f5d6f..3beeb1f7fe2 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -66,7 +66,7 @@ impl Encodable for TableRowFlow { } /// Information about the column inline size and span for each cell. -#[derive(RustcEncodable, Copy)] +#[derive(RustcEncodable, Copy, Clone)] pub struct CellIntrinsicInlineSize { /// Inline sizes that this cell contributes to the column. pub column_size: ColumnIntrinsicInlineSize, diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index a336ca55cfb..5db3674341c 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -37,7 +37,7 @@ use style::properties::ComputedValues; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; -#[derive(Copy, RustcEncodable, Debug)] +#[derive(Copy, Clone, RustcEncodable, Debug)] pub enum TableLayout { Fixed, 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 /// 0.0 to 1.0. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] enum SelectedAutoLayoutCandidateGuess { UseMinimumGuess, InterpolateBetweenMinimumGuessAndMinimumPercentageGuess(CSSFloat), diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 5fe8ec3e66d..0441f4fa76a 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -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 /// layout computation. This computes the styles applied to each node. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct RecalcStyleForNode<'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. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct ConstructFlows<'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`. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct AssignISizes<'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 /// positions, and computes overflow regions. In Gecko this corresponds to `Reflow` and /// `FinishAndStoreOverflow`. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct AssignBSizesAndStoreOverflow<'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 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 layout_context: &'a LayoutContext<'a>, } diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 44b184b897c..db99183939e 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -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 /// only ever see these and must never see instances of `LayoutJS`. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct LayoutNode<'a> { /// The wrapped node. node: LayoutJS<Node>, @@ -179,15 +179,6 @@ pub struct LayoutNode<'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> { #[inline] 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. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct LayoutElement<'le> { element: &'le Element, } diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index d306af649a9..7712481d146 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -33,7 +33,7 @@ pub enum ReadyState { } /// 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); impl Epoch { @@ -71,7 +71,7 @@ pub enum ScrollPolicy { /// All layer-specific information that the painting task sends to the compositor other than the /// buffer contents of the layer itself. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct LayerMetadata { /// An opaque ID. This is usually the address of the flow and index of the box within it. pub id: LayerId, diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 7b44a4b4c84..b2edf1c0f8f 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -27,7 +27,7 @@ impl ConstellationChan { } } -#[derive(PartialEq, Eq, Copy, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum IFrameSandboxState { IFrameSandboxed, IFrameUnsandboxed @@ -40,7 +40,7 @@ pub struct Failure { pub parent_info: Option<(PipelineId, SubpageId)>, } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct WindowSizeData { /// The size of the initial layout viewport, before parsing an /// 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 -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum FocusType { Element, // The first focus message - focus the element itself 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 // release resources automatically released on process termination. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum PipelineExitType { PipelineOnly, Complete, diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index dd564f9af1d..adf7b769cbf 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -11,7 +11,7 @@ use fetch::cors_cache::CORSCache; use fetch::response::Response; /// A [request context](https://fetch.spec.whatwg.org/#concept-request-context) -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Context { Audio, Beacon, CSPreport, Download, Embed, Eventsource, 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) -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ContextFrameType { Auxiliary, TopLevel, @@ -37,7 +37,7 @@ pub enum Referer { } /// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode) -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum RequestMode { SameOrigin, NoCORS, @@ -46,7 +46,7 @@ pub enum RequestMode { } /// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode) -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum CredentialsMode { Omit, CredentialsSameOrigin, @@ -54,7 +54,7 @@ pub enum CredentialsMode { } /// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting) -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ResponseTainting { Basic, CORSTainting, diff --git a/components/net_traits/image_cache_task.rs b/components/net_traits/image_cache_task.rs index 29a89be1594..dd6bb3c98ff 100644 --- a/components/net_traits/image_cache_task.rs +++ b/components/net_traits/image_cache_task.rs @@ -16,7 +16,7 @@ pub trait ImageResponder : Send { } /// The current state of an image in the cache. -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] pub enum ImageState { Pending, LoadError, diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 1e7f4c328ca..55cb27a0519 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -192,7 +192,7 @@ impl Metadata { } /// The creator of a given cookie -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] pub enum CookieSource { /// An HTTP API HTTP, diff --git a/components/net_traits/storage_task.rs b/components/net_traits/storage_task.rs index 3a2cd204220..24312a5ba05 100644 --- a/components/net_traits/storage_task.rs +++ b/components/net_traits/storage_task.rs @@ -7,7 +7,7 @@ use url::Url; use util::str::DOMString; -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum StorageType { Session, Local diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 1d3936f21bb..975e3cb99d9 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -16,7 +16,7 @@ use std::ffi::CString; use std::ptr; /// The exception handling used for a call. -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum ExceptionHandling { /// Report any exception and don't throw it to the caller code. Report, diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index b48efbda91d..b63df28d349 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2917,7 +2917,7 @@ class CGEnum(CGThing): decl = """\ #[repr(usize)] -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] #[jstraceable] pub enum %s { %s @@ -5388,8 +5388,8 @@ class GlobalGenRoots(): return CGList([ CGGeneric(AUTOGENERATED_WARNING_COMMENT), CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength), - CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy"), - CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy"), + CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy, Clone"), + CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy, Clone"), ]) diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 8297c2244a9..1b34844fa53 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -25,7 +25,7 @@ use js::jsapi::{JS_GetClass}; use url::Url; /// A freely-copyable reference to a rooted global object. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum GlobalRef<'a> { /// A reference to a `Window` object. Window(JSRef<'a, window::Window>), diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 115fcdbbe97..c80aa48b4ac 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -124,6 +124,9 @@ impl<T: Reflectable> Rootable<T> 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 /// this value. Importantly, it requires explicit rooting in order to interact @@ -545,6 +548,9 @@ pub struct RootCollection { pub struct RootCollectionPtr(pub *const RootCollection); impl Copy for RootCollectionPtr {} +impl Clone for RootCollectionPtr { + fn clone(&self) -> RootCollectionPtr { *self } +} impl RootCollection { /// Create an empty collection of roots diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 369a4f11d88..2c96fa2c0dd 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -129,7 +129,7 @@ pub struct NativePropertyHooks { } /// The struct that holds inheritance information for DOM object reflectors. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct DOMClass { /// A list of interfaces that this object implements, in order of decreasing /// derivedness. @@ -148,6 +148,9 @@ pub struct DOMJSClass { /// Associated data for DOM object reflectors. pub dom_class: DOMClass } +impl Clone for DOMJSClass { + fn clone(&self) -> DOMJSClass { *self } +} unsafe impl Sync for DOMJSClass {} /// Returns the ProtoOrIfaceArray for the given global object. diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 1c5a436199f..414e4481f16 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -13,7 +13,7 @@ use util::str::DOMString; use std::borrow::ToOwned; #[repr(u16)] -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] #[jstraceable] pub enum DOMErrorName { IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR, diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 03f8f17195f..a936e783ad4 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -108,7 +108,7 @@ impl ElementDerived for EventTarget { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] pub enum ElementTypeId { HTMLElement(HTMLElementTypeId), diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 55883659c39..4f0086310aa 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -19,7 +19,7 @@ use std::default::Default; use time; #[jstraceable] -#[derive(Copy)] +#[derive(Copy, Clone)] #[repr(u16)] pub enum EventPhase { None = EventConstants::NONE, diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index ab0e73ec8de..01e436c9743 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -33,14 +33,14 @@ use url::Url; use std::collections::HashMap; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] pub enum ListenerPhase { Capturing, Bubbling, } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] pub enum EventTargetTypeId { Node(NodeTypeId), @@ -51,7 +51,7 @@ pub enum EventTargetTypeId { XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId) } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] pub enum EventListenerType { Additive(EventListener), @@ -67,7 +67,7 @@ impl EventListenerType { } } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] #[privatize] pub struct EventListenerEntry { diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 57ce2aed0f0..22c1b67656a 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -29,7 +29,7 @@ use std::cell::Cell; use string_cache::Atom; #[jstraceable] -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] #[allow(dead_code)] enum ButtonType { ButtonSubmit, diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 0b5fa1b5639..f42aceced3a 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -239,7 +239,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] pub enum HTMLElementTypeId { HTMLElement, diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index abb3ec98aa6..c5c1ae2e77a 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -133,13 +133,13 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum SubmittedFrom { FromFormSubmitMethod, NotFromFormSubmitMethod } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ResetFrom { FromFormResetMethod, NotFromFormResetMethod @@ -407,21 +407,21 @@ pub struct FormDatum { pub value: DOMString } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum FormEncType { TextPlainEncoded, UrlEncoded, FormDataEncoded } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum FormMethod { FormGet, FormPost, FormDialog } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum FormSubmitter<'a> { FormElement(JSRef<'a, HTMLFormElement>), InputElement(JSRef<'a, HTMLInputElement>), diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index e72d13295ec..379327d760a 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -48,7 +48,7 @@ const DEFAULT_SUBMIT_VALUE: &'static str = "Submit"; const DEFAULT_RESET_VALUE: &'static str = "Reset"; #[jstraceable] -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] #[allow(dead_code)] enum InputType { InputSubmit, diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 331d43e8aba..86a882dbb86 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -38,7 +38,7 @@ impl HTMLMediaElement { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] pub enum HTMLMediaElementTypeId { HTMLAudioElement, diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 1737bddcb84..378a804c361 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -16,7 +16,7 @@ use cssparser::RGBA; use util::str::{self, DOMString, LengthOrPercentageOrAuto}; use std::cell::Cell; -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] pub enum HTMLTableCellElementTypeId { HTMLTableDataCellElement, diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f8dc318b6c6..d5e3482a10e 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -190,7 +190,7 @@ impl Drop for Node { /// suppress observers flag /// https://dom.spec.whatwg.org/#concept-node-insert /// https://dom.spec.whatwg.org/#concept-node-remove -#[derive(Copy)] +#[derive(Copy, Clone)] enum SuppressObserver { Suppressed, Unsuppressed @@ -266,7 +266,7 @@ impl LayoutDataRef { } /// The different types of nodes. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[jstraceable] pub enum NodeTypeId { DocumentType, @@ -1311,7 +1311,7 @@ impl Iterator for TreeIterator { /// Specifies whether children must be recursively cloned or not. -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum CloneChildrenFlag { CloneChildren, DoNotCloneChildren diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs index fbd89a27787..199c06dca35 100644 --- a/components/script/dom/servohtmlparser.rs +++ b/components/script/dom/servohtmlparser.rs @@ -33,7 +33,7 @@ pub struct Sink { /// FragmentContext is used only to pass this group of related values /// into functions. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct FragmentContext<'a> { pub context_elem: JSRef<'a, Node>, pub form_elem: Option<JSRef<'a, Node>>, diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index ec58f3e4221..8723454182b 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -34,7 +34,7 @@ use std::rc::Rc; use std::cell::Cell; use url::{Url, UrlParser}; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] pub enum WorkerGlobalScopeTypeId { DedicatedGlobalScope, diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 3e84dfc0037..73748b27f14 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -67,7 +67,7 @@ use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams; use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams}; pub type SendParam = StringOrURLSearchParams; -#[derive(PartialEq, Copy)] +#[derive(PartialEq, Copy, Clone)] #[jstraceable] enum XMLHttpRequestState { Unsent = 0, diff --git a/components/script/dom/xmlhttprequesteventtarget.rs b/components/script/dom/xmlhttprequesteventtarget.rs index e27496ec2d9..2457f192883 100644 --- a/components/script/dom/xmlhttprequesteventtarget.rs +++ b/components/script/dom/xmlhttprequesteventtarget.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::InheritTypes::XMLHttpRequestEventTargetDerived; use dom::bindings::js::JSRef; use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId}; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[jstraceable] pub enum XMLHttpRequestEventTargetTypeId { XMLHttpRequest, diff --git a/components/script/script_task.rs b/components/script/script_task.rs index e865976f2ae..08020fb12de 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -152,7 +152,7 @@ impl InProgressLoad { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum TimerSource { FromWindow(PipelineId), FromWorker diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 6b2053af3be..24383bf3fb4 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -17,14 +17,14 @@ use std::default::Default; use std::num::SignedInt; use std::sync::mpsc::channel; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum Selection { Selected, NotSelected } #[jstraceable] -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct TextPoint { /// 0-based line number pub line: usize, diff --git a/components/script/timers.rs b/components/script/timers.rs index d54a77c9951..01e9920b3b7 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -29,7 +29,7 @@ use std::time::duration::Duration; #[derive(PartialEq, Eq)] #[jstraceable] -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct TimerId(i32); #[jstraceable] diff --git a/components/style/legacy.rs b/components/style/legacy.rs index 2cf4d9d2a60..c65332246a4 100644 --- a/components/style/legacy.rs +++ b/components/style/legacy.rs @@ -21,14 +21,14 @@ use util::geometry::Au; use util::str::LengthOrPercentageOrAuto; /// 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 { /// `<td width>` Width, } /// 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 { /// `<input 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. -#[derive(Copy, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub enum UnsignedIntegerAttribute { /// `<td border>` Border, diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 2f649e1dda1..7f71d1602a2 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -16,7 +16,7 @@ pub struct MediaQueryList { pub media_queries: Vec<MediaQuery> } -#[derive(PartialEq, Eq, Copy, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum Range<T> { Min(T), Max(T), @@ -59,14 +59,14 @@ impl<T: Ord> Range<T> { } /// http://dev.w3.org/csswg/mediaqueries-3/#media1 -#[derive(PartialEq, Copy, Debug)] +#[derive(PartialEq, Copy, Clone, Debug)] pub enum Expression { /// http://dev.w3.org/csswg/mediaqueries-3/#width Width(Range<specified::Length>), } /// http://dev.w3.org/csswg/mediaqueries-3/#media0 -#[derive(PartialEq, Eq, Copy, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum Qualifier { Only, Not, @@ -91,13 +91,13 @@ impl MediaQuery { } /// http://dev.w3.org/csswg/mediaqueries-3/#media0 -#[derive(PartialEq, Eq, Copy, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum MediaQueryType { All, // Always true MediaType(MediaType), } -#[derive(PartialEq, Eq, Copy, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum MediaType { Screen, Print, diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index b6e08f7bd09..97720a5dcd6 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -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 { InitialKeyword, InheritKeyword, @@ -4732,7 +4732,7 @@ pub enum PropertyDeclaration { } -#[derive(Eq, PartialEq, Copy)] +#[derive(Eq, PartialEq, Copy, Clone)] pub enum PropertyDeclarationParseResult { UnknownProperty, ExperimentalProperty, diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index b47ef8954e9..b910d3fe62a 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -312,7 +312,7 @@ struct TopLevelRuleParser<'a> { state: Cell<State>, } -#[derive(Eq, PartialEq, Ord, PartialOrd, Copy)] +#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone)] enum State { Start = 1, Imports = 2, diff --git a/components/util/geometry.rs b/components/util/geometry.rs index b1c1aa6c4dc..c32a0264665 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -31,7 +31,7 @@ use rustc_serialize::{Encoder, Encodable}; /// /// The ratio between ScreenPx and DevicePixel for a given display be found by calling /// `servo::windowing::WindowMethods::hidpi_factor`. -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub enum ScreenPx {} /// 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 /// 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 {} /// 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 /// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size /// as the viewable area. -#[derive(RustcEncodable, Debug, Copy)] +#[derive(RustcEncodable, Debug, Copy, Clone)] pub enum PagePx {} // In summary, the hierarchy of pixel units and the factors to convert from one to the next: diff --git a/components/util/str.rs b/components/util/str.rs index e6987f2f809..7c36aca7c18 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -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 { Auto, Percentage(f64), diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index fe8d43825b6..6c3258972a6 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -148,7 +148,7 @@ pub struct hwc_color { } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct hwc_rect { left: c_int, top: c_int, |