mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make it possible to build the style_traits crate with a stable compiler.
Testing this on CI to make sure we don’t regress it is blocked on #11806
This commit is contained in:
parent
b9b289c4be
commit
ea73c8efac
20 changed files with 145 additions and 89 deletions
|
@ -13,7 +13,7 @@ path = "lib.rs"
|
|||
app_units = {version = "0.2.3", features = ["plugins"]}
|
||||
azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
|
||||
bitflags = "0.7"
|
||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
euclid = {version = "0.6.4", features = ["plugins", "unstable"]}
|
||||
fnv = "1.0"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
harfbuzz-sys = "0.1"
|
||||
|
|
|
@ -20,7 +20,8 @@ use azure::azure_hl::Color;
|
|||
use euclid::approxeq::ApproxEq;
|
||||
use euclid::num::Zero;
|
||||
use euclid::rect::TypedRect;
|
||||
use euclid::{Matrix2D, Matrix4D, Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use euclid::{Matrix2D, Matrix4D, Point2D, Rect, Size2D};
|
||||
use fnv::FnvHasher;
|
||||
use gfx_traits::{LayerId, ScrollPolicy, StackingContextId};
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
|
|
|
@ -21,6 +21,6 @@ plugins = {path = "../plugins"}
|
|||
rustc-serialize = "0.3.4"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
util = {path = "../util"}
|
||||
url = {version = "1.0.0", features = ["heap_size", "serde"]}
|
||||
util = {path = "../util", features = ["servo"]}
|
||||
webrender_traits = {git = "https://github.com/servo/webrender_traits"}
|
||||
|
|
|
@ -11,7 +11,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
plugins = {path = "../plugins"}
|
||||
util = {path = "../util"}
|
||||
util = {path = "../util", features = ["servo"]}
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
heartbeats-simple = "0.3"
|
||||
log = "0.3.5"
|
||||
|
|
|
@ -15,7 +15,7 @@ msg = {path = "../msg"}
|
|||
net_traits = {path = "../net_traits"}
|
||||
plugins = {path = "../plugins"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
style_traits = {path = "../style_traits"}
|
||||
style_traits = {path = "../style_traits", features = ["serde-serialization"]}
|
||||
util = {path = "../util"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
|
|
3
components/servo/Cargo.lock
generated
3
components/servo/Cargo.lock
generated
|
@ -2253,7 +2253,6 @@ dependencies = [
|
|||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2438,7 +2437,6 @@ dependencies = [
|
|||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2446,7 +2444,6 @@ dependencies = [
|
|||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -34,10 +34,10 @@ serde = {version = "0.7", features = ["nightly"]}
|
|||
serde_macros = "0.7"
|
||||
smallvec = "0.1"
|
||||
string_cache = {version = "0.2.20", features = ["heap_size"]}
|
||||
style_traits = {path = "../style_traits"}
|
||||
style_traits = {path = "../style_traits", features = ["heap_size"]}
|
||||
time = "0.1"
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
util = {path = "../util"}
|
||||
util = {path = "../util", features = ["servo"]}
|
||||
|
||||
[build-dependencies]
|
||||
walkdir = "0.1"
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
//! Geometry in flow-relative space.
|
||||
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
use std::ops::{Add, Sub};
|
||||
|
|
|
@ -25,7 +25,7 @@ use cssparser::{Parser, RGBA, AtRuleParser, DeclarationParser, Delimiter,
|
|||
DeclarationListParser, parse_important, ToCss, TokenSerializationType};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use url::Url;
|
||||
use euclid::SideOffsets2D;
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use euclid::size::Size2D;
|
||||
use string_cache::Atom;
|
||||
use computed_values;
|
||||
|
|
|
@ -8,13 +8,16 @@ publish = false
|
|||
name = "style_traits"
|
||||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
heap_size = ["heapsize", "heapsize_plugin", "cssparser/heap_size", "euclid/plugins"]
|
||||
serde-serialization = ["serde", "serde_macros", "cssparser/serde-serialization", "euclid/plugins"]
|
||||
|
||||
[dependencies]
|
||||
util = {path = "../util"}
|
||||
plugins = {path = "../plugins"}
|
||||
cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]}
|
||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
cssparser = "0.5.4"
|
||||
euclid = "0.6.4"
|
||||
heapsize = {version = "0.3.0", optional = true}
|
||||
heapsize_plugin = {version = "0.1.2", optional = true}
|
||||
rustc-serialize = "0.3"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
serde = {version = "0.7", optional = true}
|
||||
serde_macros = {version = "0.7", optional = true}
|
||||
|
|
|
@ -8,7 +8,9 @@ use cssparser::ToCss;
|
|||
|
||||
macro_rules! define_cursor {
|
||||
($( $css: expr => $variant: ident = $value: expr, )+) => {
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
|
||||
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
|
||||
#[repr(u8)]
|
||||
pub enum Cursor {
|
||||
$( $variant = $value ),+
|
||||
|
|
|
@ -8,19 +8,22 @@
|
|||
|
||||
#![crate_name = "style_traits"]
|
||||
#![crate_type = "rlib"]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(heapsize_plugin)]
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
#![cfg_attr(feature = "serde-serialization", feature(custom_derive))]
|
||||
#![cfg_attr(feature = "serde-serialization", feature(plugin))]
|
||||
#![cfg_attr(feature = "serde-serialization", plugin(serde_macros))]
|
||||
#![cfg_attr(feature = "heap_size", feature(custom_derive))]
|
||||
#![cfg_attr(feature = "heap_size", feature(plugin))]
|
||||
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate cssparser;
|
||||
extern crate euclid;
|
||||
extern crate heapsize;
|
||||
#[cfg(feature = "heap_size")] extern crate heapsize;
|
||||
extern crate rustc_serialize;
|
||||
extern crate serde;
|
||||
#[cfg(feature = "serde-serialization")] extern crate serde;
|
||||
extern crate util;
|
||||
|
||||
pub mod cursor;
|
||||
|
|
|
@ -5,12 +5,58 @@
|
|||
#[macro_export]
|
||||
macro_rules! define_css_keyword_enum {
|
||||
($name: ident: $( $css: expr => $variant: ident ),+,) => {
|
||||
define_css_keyword_enum!($name: $( $css => $variant ),+);
|
||||
__define_css_keyword_enum__add_serde!($name [ $( $css => $variant ),+ ]);
|
||||
};
|
||||
($name: ident: $( $css: expr => $variant: ident ),+) => {
|
||||
__define_css_keyword_enum__add_serde!($name [ $( $css => $variant ),+ ]);
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde-serialization")]
|
||||
#[macro_export]
|
||||
macro_rules! __define_css_keyword_enum__add_serde {
|
||||
($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
|
||||
__define_css_keyword_enum__add_heapsize! {
|
||||
$name [ Deserialize, Serialize ] [ $( $css => $variant ),+ ]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "serde-serialization"))]
|
||||
#[macro_export]
|
||||
macro_rules! __define_css_keyword_enum__add_serde {
|
||||
($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
|
||||
__define_css_keyword_enum__add_heapsize! {
|
||||
$name [] [ $( $css => $variant ),+ ]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "heap_size")]
|
||||
#[macro_export]
|
||||
macro_rules! __define_css_keyword_enum__add_heapsize {
|
||||
($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
|
||||
__define_css_keyword_enum__actual! {
|
||||
$name [ $( $derived_trait, )* HeapSizeOf ] [ $( $css => $variant ),+ ]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "heap_size"))]
|
||||
#[macro_export]
|
||||
macro_rules! __define_css_keyword_enum__add_heapsize {
|
||||
($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
|
||||
__define_css_keyword_enum__actual! {
|
||||
$name [ $( $derived_trait ),* ] [ $( $css => $variant ),+ ]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! __define_css_keyword_enum__actual {
|
||||
($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug, HeapSizeOf)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug $(, $derived_trait )* )]
|
||||
pub enum $name {
|
||||
$( $variant ),+
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ define_css_keyword_enum!(Orientation:
|
|||
"landscape" => Landscape);
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
|
||||
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
|
||||
pub struct ViewportConstraints {
|
||||
pub size: TypedSize2D<ViewportPx, f32>,
|
||||
|
||||
|
@ -54,7 +56,8 @@ impl ToCss for ViewportConstraints {
|
|||
|
||||
/// Zoom is a number | percentage | auto
|
||||
/// See http://dev.w3.org/csswg/css-device-adapt/#descdef-viewport-zoom
|
||||
#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
|
||||
pub enum Zoom {
|
||||
Number(f32),
|
||||
Percentage(f32),
|
||||
|
|
|
@ -8,28 +8,30 @@ publish = false
|
|||
name = "util"
|
||||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
# servo as opposed to geckolib
|
||||
servo = ["serde", "serde_macros", "backtrace", "ipc-channel", "bitflags"]
|
||||
|
||||
[dependencies]
|
||||
app_units = {version = "0.2.3", features = ["plugins"]}
|
||||
backtrace = "0.2.1"
|
||||
bitflags = "0.7"
|
||||
app_units = {version = "0.2.3"}
|
||||
backtrace = {version = "0.2.1", optional = true}
|
||||
bitflags = {version = "0.7", optional = true}
|
||||
deque = "0.3.1"
|
||||
euclid = {version = "0.6.4", features = ["unstable", "plugins"]}
|
||||
euclid = {version = "0.6.4"}
|
||||
getopts = "0.2.11"
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
|
||||
ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
|
||||
lazy_static = "0.2"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
num_cpus = "0.2.2"
|
||||
num-traits = "0.1.32"
|
||||
plugins = {path = "../plugins"}
|
||||
rand = "0.3"
|
||||
rustc-serialize = "0.3"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
serde = {version = "0.7", optional = true}
|
||||
serde_macros = {version = "0.7", optional = true}
|
||||
smallvec = "0.1"
|
||||
url = {version = "1.0.0", features = ["heap_size", "serde"]}
|
||||
url = {version = "1.0.0"}
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies]
|
||||
xdg = "2.0"
|
||||
|
|
|
@ -23,7 +23,7 @@ use std::i32;
|
|||
///
|
||||
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling
|
||||
/// `servo::windowing::WindowMethods::hidpi_factor`.
|
||||
#[derive(Clone, Copy, Debug, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum ScreenPx {}
|
||||
|
||||
/// One CSS "px" in the coordinate system of the "initial viewport":
|
||||
|
@ -35,7 +35,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(Clone, Copy, Debug, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum ViewportPx {}
|
||||
|
||||
/// One CSS "px" in the root coordinate system for the content document.
|
||||
|
@ -44,9 +44,11 @@ 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(Clone, Copy, Debug, HeapSizeOf)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum PagePx {}
|
||||
|
||||
known_heap_size!(0, ScreenPx, ViewportPx, PagePx);
|
||||
|
||||
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
|
||||
//
|
||||
// DevicePixel
|
||||
|
|
|
@ -2,39 +2,31 @@
|
|||
* 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/. */
|
||||
|
||||
#![feature(box_syntax)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(fnbox)]
|
||||
#![feature(plugin)]
|
||||
#![feature(reflect_marker)]
|
||||
#![feature(step_by)]
|
||||
|
||||
#![plugin(heapsize_plugin, plugins, serde_macros)]
|
||||
#![cfg_attr(feature = "servo", feature(core_intrinsics))]
|
||||
#![cfg_attr(feature = "servo", feature(custom_derive))]
|
||||
#![cfg_attr(feature = "servo", feature(fnbox))]
|
||||
#![cfg_attr(feature = "servo", feature(plugin))]
|
||||
#![cfg_attr(feature = "servo", feature(reflect_marker))]
|
||||
#![cfg_attr(feature = "servo", plugin(serde_macros))]
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate backtrace;
|
||||
#[allow(unused_extern_crates)]
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
#[cfg(feature = "servo")] extern crate backtrace;
|
||||
#[cfg(feature = "servo")] #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags;
|
||||
extern crate deque;
|
||||
extern crate euclid;
|
||||
extern crate getopts;
|
||||
extern crate heapsize;
|
||||
extern crate ipc_channel;
|
||||
#[allow(unused_extern_crates)]
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use] extern crate heapsize;
|
||||
#[cfg(feature = "servo")] extern crate ipc_channel;
|
||||
#[allow(unused_extern_crates)] #[macro_use] extern crate lazy_static;
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate num_cpus;
|
||||
extern crate num_traits;
|
||||
extern crate rand;
|
||||
extern crate rustc_serialize;
|
||||
extern crate serde;
|
||||
#[cfg(feature = "servo")] extern crate serde;
|
||||
extern crate smallvec;
|
||||
extern crate url;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
||||
|
@ -44,28 +36,24 @@ use std::sync::Arc;
|
|||
|
||||
pub mod basedir;
|
||||
pub mod cache;
|
||||
#[allow(unsafe_code)]
|
||||
pub mod debug_utils;
|
||||
#[allow(unsafe_code)] pub mod debug_utils;
|
||||
pub mod geometry;
|
||||
#[allow(unsafe_code)]
|
||||
pub mod ipc;
|
||||
pub mod linked_list;
|
||||
#[allow(unsafe_code)]
|
||||
pub mod opts;
|
||||
pub mod panicking;
|
||||
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
|
||||
#[cfg(feature = "servo")] pub mod linked_list;
|
||||
#[allow(unsafe_code)] pub mod opts;
|
||||
#[cfg(feature = "servo")] pub mod panicking;
|
||||
pub mod prefs;
|
||||
pub mod print_tree;
|
||||
#[cfg(feature = "servo")] pub mod print_tree;
|
||||
pub mod resource_files;
|
||||
#[allow(unsafe_code)]
|
||||
pub mod str;
|
||||
pub mod thread;
|
||||
pub mod thread_state;
|
||||
#[cfg(feature = "servo")] pub mod thread;
|
||||
#[cfg(feature = "servo")] pub mod thread_state;
|
||||
pub mod tid;
|
||||
pub mod time;
|
||||
#[cfg(feature = "servo")] pub mod time;
|
||||
pub mod vec;
|
||||
#[allow(unsafe_code)]
|
||||
pub mod workqueue;
|
||||
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod workqueue;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[allow(unsafe_code)]
|
||||
pub fn breakpoint() {
|
||||
unsafe { ::std::intrinsics::breakpoint() };
|
||||
|
|
|
@ -23,7 +23,8 @@ use url::{self, Url};
|
|||
|
||||
|
||||
/// Global flags for Servo, currently set on the command line.
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct Opts {
|
||||
pub is_running_problem_test: bool,
|
||||
|
||||
|
@ -379,7 +380,8 @@ pub fn print_debug_usage(app: &str) -> ! {
|
|||
process::exit(0)
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub enum OutputOptions {
|
||||
FileName(String),
|
||||
Stdout(f64)
|
||||
|
@ -404,7 +406,8 @@ enum UserAgent {
|
|||
Android,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub enum RenderApi {
|
||||
GL,
|
||||
ES2,
|
||||
|
@ -858,7 +861,7 @@ pub fn set_defaults(opts: Opts) {
|
|||
unsafe {
|
||||
assert!(DEFAULT_OPTIONS.is_null());
|
||||
assert!(DEFAULT_OPTIONS != INVALID_OPTIONS);
|
||||
let box_opts = box opts;
|
||||
let box_opts = Box::new(opts);
|
||||
DEFAULT_OPTIONS = Box::into_raw(box_opts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub enum PrefValue {
|
||||
Boolean(bool),
|
||||
String(String),
|
||||
|
@ -91,7 +92,8 @@ impl ToJson for PrefValue {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub enum Pref {
|
||||
NoDefault(Arc<PrefValue>),
|
||||
WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>)
|
||||
|
|
|
@ -9,10 +9,13 @@ use super::smallvec::VecLike;
|
|||
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
|
||||
pub fn byte_swap(data: &mut [u8]) {
|
||||
let length = data.len();
|
||||
for i in (0..length).step_by(4) {
|
||||
// FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
|
||||
let mut i = 0;
|
||||
while i < length {
|
||||
let r = data[i + 2];
|
||||
data[i + 2] = data[i + 0];
|
||||
data[i + 0] = r;
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue