Move gecko_bindings and gecko_string_cache into the style crate

This commit is contained in:
Manish Goregaokar 2016-09-22 14:58:23 +05:30
parent 0dd005eacc
commit c6787458d9
33 changed files with 2629 additions and 2688 deletions

View file

@ -12,8 +12,8 @@ name = "style"
path = "lib.rs"
[features]
gecko = ["gecko_bindings", "gecko_string_cache"]
servo = ["serde", "serde/unstable", "serde_macros", "heapsize", "heapsize_plugin",
gecko = []
servo = ["serde/unstable", "serde_macros", "heapsize_plugin",
"style_traits/servo", "app_units/plugins",
"cssparser/heap_size", "cssparser/serde-serialization",
"selectors/heap_size", "selectors/unstable", "string_cache",
@ -23,14 +23,13 @@ testing = []
[dependencies]
app_units = "0.3"
bitflags = "0.7"
cfg-if = "0.1.0"
cssparser = "0.7"
deque = "0.3.1"
encoding = "0.2"
euclid = "0.10.1"
fnv = "1.0"
gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true}
gecko_string_cache = {path = "../../ports/geckolib/string_cache", optional = true}
heapsize = {version = "0.3.0", optional = true}
heapsize = "0.3.0"
heapsize_plugin = {version = "0.1.2", optional = true}
lazy_static = "0.2"
log = "0.3.5"
@ -42,7 +41,7 @@ quickersort = "2.0.0"
rand = "0.3"
rustc-serialize = "0.3"
selectors = "0.13"
serde = {version = "0.8", optional = true}
serde = "0.8"
serde_macros = {version = "0.8", optional = true}
smallvec = "0.1"
string_cache = {version = "0.2.26", features = ["heap_size"], optional = true}

View file

@ -432,11 +432,11 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type")
flags.append("{}Strong".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}Strong = ::sugar::ownership::Strong<{0}>;".format(ty))
flags.append("pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;".format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
flags.append("pub type {0}BorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
flags.append("--blacklist-type")
flags.append("{}Borrowed".format(ty))
flags.append("--raw-line")
@ -452,7 +452,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
flags.append("pub type {0}BorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
# Right now the only immutable borrow types are ones which we import
# from the |structs| module. As such, we don't need to create an opaque
# type with zero_size_type. If we ever introduce immutable borrow types
@ -478,21 +478,21 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type")
flags.append("{}Owned".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}Owned = ::sugar::ownership::Owned<{0}>;".format(ty))
flags.append("pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;".format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, {0}>;"
flags.append("pub type {0}BorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;"
.format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedMutOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedMutOrNull<'a> = ::sugar::ownership::BorrowedMut<'a, {0}>;"
flags.append("pub type {0}BorrowedMutOrNull<'a> = ::gecko_bindings::sugar::ownership::BorrowedMut<'a, {0}>;"
.format(ty))
flags.append("--blacklist-type")
flags.append("{}OwnedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}OwnedOrNull = ::sugar::ownership::OwnedOrNull<{0}>;".format(ty))
flags.append("pub type {0}OwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;".format(ty))
zero_size_type(ty, flags)
if "structs_types" in current_target:
@ -500,7 +500,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type")
flags.append(ty)
flags.append("--raw-line")
flags.append("use structs::{};".format(ty))
flags.append("use gecko_bindings::structs::{};".format(ty))
# TODO: this is hacky, figure out a better way to do it without
# hardcoding everything...

View file

@ -117,7 +117,7 @@ def write_atom_macro(atoms, file_name):
with open(file_name, "wb") as f:
f.write(PRELUDE)
f.write("use gecko_bindings::structs::nsIAtom;\n\n")
f.write("use style::gecko_bindings::structs::nsIAtom;\n\n")
f.write("use Atom;\n\n")
for source in SOURCES:
if source.TYPE != "nsIAtom":
@ -138,7 +138,7 @@ def write_atom_macro(atoms, file_name):
f.write("}\n\n")
f.write("#[macro_export]\n")
f.write("macro_rules! atom {\n")
f.writelines(['("%s") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::%s as *mut _) };\n'
f.writelines(['("%s") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::%s as *mut _) };\n'
% (atom.value, atom.ident) for atom in atoms])
f.write("}\n")
@ -191,6 +191,6 @@ def write_pseudo_element_helper(atoms, target_filename):
def build(objdir, verbose=False):
atoms = collect_atoms(objdir)
write_atom_macro(atoms, "../string_cache/atom_macro.rs")
write_pseudo_element_helper(atoms, "../../../components/style/generated/gecko_pseudo_element_helper.rs")
write_atom_macro(atoms, "../gecko_string_cache/atom_macro.rs")
write_pseudo_element_helper(atoms, "../generated/gecko_pseudo_element_helper.rs")
return 0

View file

@ -1,170 +1,170 @@
/* automatically generated by rust-bindgen */
use heapsize::HeapSizeOf;
pub type ServoComputedValuesStrong = ::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, ServoComputedValues>;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
enum ServoComputedValuesVoid{ }
pub struct ServoComputedValues(ServoComputedValuesVoid);
pub type RawServoStyleSheetStrong = ::sugar::ownership::Strong<RawServoStyleSheet>;
pub type RawServoStyleSheetBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawServoStyleSheet>;
pub type RawServoStyleSheetStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleSheet>;
pub type RawServoStyleSheetBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, RawServoStyleSheet>;
pub type RawServoStyleSheetBorrowed<'a> = &'a RawServoStyleSheet;
enum RawServoStyleSheetVoid{ }
pub struct RawServoStyleSheet(RawServoStyleSheetVoid);
pub type ServoDeclarationBlockStrong = ::sugar::ownership::Strong<ServoDeclarationBlock>;
pub type ServoDeclarationBlockBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, ServoDeclarationBlock>;
pub type ServoDeclarationBlockStrong = ::gecko_bindings::sugar::ownership::Strong<ServoDeclarationBlock>;
pub type ServoDeclarationBlockBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, ServoDeclarationBlock>;
pub type ServoDeclarationBlockBorrowed<'a> = &'a ServoDeclarationBlock;
enum ServoDeclarationBlockVoid{ }
pub struct ServoDeclarationBlock(ServoDeclarationBlockVoid);
pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode;
pub type RawGeckoNodeBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoNode>;
pub type RawGeckoNodeBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, RawGeckoNode>;
pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement;
pub type RawGeckoElementBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoElement>;
pub type RawGeckoElementBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, RawGeckoElement>;
pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
pub type RawGeckoDocumentBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoDocument>;
pub type RawGeckoDocumentBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, RawGeckoDocument>;
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
pub type RawServoStyleSetOwned = ::sugar::ownership::Owned<RawServoStyleSet>;
pub type RawServoStyleSetBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawServoStyleSet>;
pub type RawServoStyleSetBorrowedMutOrNull<'a> = ::sugar::ownership::BorrowedMut<'a, RawServoStyleSet>;
pub type RawServoStyleSetOwnedOrNull = ::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
pub type RawServoStyleSetBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, RawServoStyleSet>;
pub type RawServoStyleSetBorrowedMutOrNull<'a> = ::gecko_bindings::sugar::ownership::BorrowedMut<'a, RawServoStyleSet>;
pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
enum RawServoStyleSetVoid{ }
pub struct RawServoStyleSet(RawServoStyleSetVoid);
pub type StyleChildrenIteratorBorrowed<'a> = &'a StyleChildrenIterator;
pub type StyleChildrenIteratorBorrowedMut<'a> = &'a mut StyleChildrenIterator;
pub type StyleChildrenIteratorOwned = ::sugar::ownership::Owned<StyleChildrenIterator>;
pub type StyleChildrenIteratorBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, StyleChildrenIterator>;
pub type StyleChildrenIteratorBorrowedMutOrNull<'a> = ::sugar::ownership::BorrowedMut<'a, StyleChildrenIterator>;
pub type StyleChildrenIteratorOwnedOrNull = ::sugar::ownership::OwnedOrNull<StyleChildrenIterator>;
pub type StyleChildrenIteratorOwned = ::gecko_bindings::sugar::ownership::Owned<StyleChildrenIterator>;
pub type StyleChildrenIteratorBorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, StyleChildrenIterator>;
pub type StyleChildrenIteratorBorrowedMutOrNull<'a> = ::gecko_bindings::sugar::ownership::BorrowedMut<'a, StyleChildrenIterator>;
pub type StyleChildrenIteratorOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<StyleChildrenIterator>;
enum StyleChildrenIteratorVoid{ }
pub struct StyleChildrenIterator(StyleChildrenIteratorVoid);
use structs::nsStyleFont;
use gecko_bindings::structs::nsStyleFont;
unsafe impl Send for nsStyleFont {}
unsafe impl Sync for nsStyleFont {}
use structs::nsStyleColor;
use gecko_bindings::structs::nsStyleColor;
unsafe impl Send for nsStyleColor {}
unsafe impl Sync for nsStyleColor {}
use structs::nsStyleList;
use gecko_bindings::structs::nsStyleList;
unsafe impl Send for nsStyleList {}
unsafe impl Sync for nsStyleList {}
use structs::nsStyleText;
use gecko_bindings::structs::nsStyleText;
unsafe impl Send for nsStyleText {}
unsafe impl Sync for nsStyleText {}
use structs::nsStyleVisibility;
use gecko_bindings::structs::nsStyleVisibility;
unsafe impl Send for nsStyleVisibility {}
unsafe impl Sync for nsStyleVisibility {}
use structs::nsStyleUserInterface;
use gecko_bindings::structs::nsStyleUserInterface;
unsafe impl Send for nsStyleUserInterface {}
unsafe impl Sync for nsStyleUserInterface {}
use structs::nsStyleTableBorder;
use gecko_bindings::structs::nsStyleTableBorder;
unsafe impl Send for nsStyleTableBorder {}
unsafe impl Sync for nsStyleTableBorder {}
use structs::nsStyleSVG;
use gecko_bindings::structs::nsStyleSVG;
unsafe impl Send for nsStyleSVG {}
unsafe impl Sync for nsStyleSVG {}
use structs::nsStyleVariables;
use gecko_bindings::structs::nsStyleVariables;
unsafe impl Send for nsStyleVariables {}
unsafe impl Sync for nsStyleVariables {}
use structs::nsStyleBackground;
use gecko_bindings::structs::nsStyleBackground;
unsafe impl Send for nsStyleBackground {}
unsafe impl Sync for nsStyleBackground {}
use structs::nsStylePosition;
use gecko_bindings::structs::nsStylePosition;
unsafe impl Send for nsStylePosition {}
unsafe impl Sync for nsStylePosition {}
use structs::nsStyleTextReset;
use gecko_bindings::structs::nsStyleTextReset;
unsafe impl Send for nsStyleTextReset {}
unsafe impl Sync for nsStyleTextReset {}
use structs::nsStyleDisplay;
use gecko_bindings::structs::nsStyleDisplay;
unsafe impl Send for nsStyleDisplay {}
unsafe impl Sync for nsStyleDisplay {}
use structs::nsStyleContent;
use gecko_bindings::structs::nsStyleContent;
unsafe impl Send for nsStyleContent {}
unsafe impl Sync for nsStyleContent {}
use structs::nsStyleUIReset;
use gecko_bindings::structs::nsStyleUIReset;
unsafe impl Send for nsStyleUIReset {}
unsafe impl Sync for nsStyleUIReset {}
use structs::nsStyleTable;
use gecko_bindings::structs::nsStyleTable;
unsafe impl Send for nsStyleTable {}
unsafe impl Sync for nsStyleTable {}
use structs::nsStyleMargin;
use gecko_bindings::structs::nsStyleMargin;
unsafe impl Send for nsStyleMargin {}
unsafe impl Sync for nsStyleMargin {}
use structs::nsStylePadding;
use gecko_bindings::structs::nsStylePadding;
unsafe impl Send for nsStylePadding {}
unsafe impl Sync for nsStylePadding {}
use structs::nsStyleBorder;
use gecko_bindings::structs::nsStyleBorder;
unsafe impl Send for nsStyleBorder {}
unsafe impl Sync for nsStyleBorder {}
use structs::nsStyleOutline;
use gecko_bindings::structs::nsStyleOutline;
unsafe impl Send for nsStyleOutline {}
unsafe impl Sync for nsStyleOutline {}
use structs::nsStyleXUL;
use gecko_bindings::structs::nsStyleXUL;
unsafe impl Send for nsStyleXUL {}
unsafe impl Sync for nsStyleXUL {}
use structs::nsStyleSVGReset;
use gecko_bindings::structs::nsStyleSVGReset;
unsafe impl Send for nsStyleSVGReset {}
unsafe impl Sync for nsStyleSVGReset {}
use structs::nsStyleColumn;
use gecko_bindings::structs::nsStyleColumn;
unsafe impl Send for nsStyleColumn {}
unsafe impl Sync for nsStyleColumn {}
use structs::nsStyleEffects;
use gecko_bindings::structs::nsStyleEffects;
unsafe impl Send for nsStyleEffects {}
unsafe impl Sync for nsStyleEffects {}
use structs::nsStyleImage;
use gecko_bindings::structs::nsStyleImage;
unsafe impl Send for nsStyleImage {}
unsafe impl Sync for nsStyleImage {}
use structs::nsStyleGradient;
use gecko_bindings::structs::nsStyleGradient;
unsafe impl Send for nsStyleGradient {}
unsafe impl Sync for nsStyleGradient {}
use structs::nsStyleCoord;
use gecko_bindings::structs::nsStyleCoord;
unsafe impl Send for nsStyleCoord {}
unsafe impl Sync for nsStyleCoord {}
use structs::nsStyleGradientStop;
use gecko_bindings::structs::nsStyleGradientStop;
unsafe impl Send for nsStyleGradientStop {}
unsafe impl Sync for nsStyleGradientStop {}
use structs::nsStyleImageLayers;
use gecko_bindings::structs::nsStyleImageLayers;
unsafe impl Send for nsStyleImageLayers {}
unsafe impl Sync for nsStyleImageLayers {}
use structs::nsStyleImageLayers_Layer;
use gecko_bindings::structs::nsStyleImageLayers_Layer;
unsafe impl Send for nsStyleImageLayers_Layer {}
unsafe impl Sync for nsStyleImageLayers_Layer {}
use structs::nsStyleImageLayers_LayerType;
use gecko_bindings::structs::nsStyleImageLayers_LayerType;
unsafe impl Send for nsStyleImageLayers_LayerType {}
unsafe impl Sync for nsStyleImageLayers_LayerType {}
use structs::nsStyleUnit;
use gecko_bindings::structs::nsStyleUnit;
unsafe impl Send for nsStyleUnit {}
unsafe impl Sync for nsStyleUnit {}
use structs::nsStyleUnion;
use gecko_bindings::structs::nsStyleUnion;
unsafe impl Send for nsStyleUnion {}
unsafe impl Sync for nsStyleUnion {}
use structs::nsStyleCoord_CalcValue;
use gecko_bindings::structs::nsStyleCoord_CalcValue;
unsafe impl Send for nsStyleCoord_CalcValue {}
unsafe impl Sync for nsStyleCoord_CalcValue {}
use structs::nsStyleCoord_Calc;
use gecko_bindings::structs::nsStyleCoord_Calc;
unsafe impl Send for nsStyleCoord_Calc {}
unsafe impl Sync for nsStyleCoord_Calc {}
use structs::nsRestyleHint;
use structs::ServoElementSnapshot;
use structs::nsChangeHint;
use structs::SheetParsingMode;
use structs::nsMainThreadPtrHandle;
use structs::nsMainThreadPtrHolder;
use structs::nscolor;
use structs::nsFont;
use structs::FontFamilyList;
use structs::FontFamilyType;
use structs::nsIAtom;
use structs::nsStyleContext;
use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::SheetParsingMode;
use gecko_bindings::structs::nsMainThreadPtrHandle;
use gecko_bindings::structs::nsMainThreadPtrHolder;
use gecko_bindings::structs::nscolor;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::FontFamilyList;
use gecko_bindings::structs::FontFamilyType;
use gecko_bindings::structs::nsIAtom;
use gecko_bindings::structs::nsStyleContext;
unsafe impl Send for nsStyleContext {}
unsafe impl Sync for nsStyleContext {}
use structs::StyleClipPath;
use structs::StyleBasicShapeType;
use structs::StyleBasicShape;
use structs::nsCSSShadowArray;
use structs::nsINode;
use structs::nsIDocument;
use structs::nsIPrincipal;
use structs::nsIURI;
use gecko_bindings::structs::StyleClipPath;
use gecko_bindings::structs::StyleBasicShapeType;
use gecko_bindings::structs::StyleBasicShape;
use gecko_bindings::structs::nsCSSShadowArray;
use gecko_bindings::structs::nsINode;
use gecko_bindings::structs::nsIDocument;
use gecko_bindings::structs::nsIPrincipal;
use gecko_bindings::structs::nsIURI;
use structs::RawGeckoNode;
use structs::RawGeckoElement;
use structs::RawGeckoDocument;

View file

@ -2,8 +2,6 @@
* 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/. */
extern crate heapsize;
#[allow(dead_code, non_camel_case_types)]
pub mod bindings;
pub mod ptr;

View file

@ -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/. */
use bindings::*;
use gecko_bindings::bindings::*;
use heapsize::HeapSizeOf;
use std::fmt::{self, Debug};

View file

@ -2,12 +2,12 @@
* 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/. */
use bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use bindings::Gecko_NewCSSShadowArray;
use bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
use std::{ptr, slice};
use std::ops::{Deref, DerefMut};
use structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
use gecko_bindings::structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
impl RefPtr<nsCSSShadowArray> {
pub fn replace_with_new(&mut self, len: u32) {

View file

@ -4,7 +4,7 @@
use std::iter::{once, Chain, Once, IntoIterator};
use std::slice::{Iter, IterMut};
use structs::nsStyleAutoArray;
use gecko_bindings::structs::nsStyleAutoArray;
impl<T> nsStyleAutoArray<T> {
pub fn iter_mut(&mut self) -> Chain<Once<&mut T>, IterMut<T>> {

View file

@ -2,10 +2,10 @@
* 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/. */
use bindings::{Gecko_ResetStyleCoord, Gecko_SetStyleCoordCalcValue, Gecko_AddRefCalcArbitraryThread};
use gecko_bindings::bindings::{Gecko_ResetStyleCoord, Gecko_SetStyleCoordCalcValue, Gecko_AddRefCalcArbitraryThread};
use std::mem;
use structs::{nsStyleCoord_Calc, nsStyleUnit, nsStyleUnion, nsStyleCoord, nsStyleSides, nsStyleCorners};
use structs::{nsStyleCoord_CalcValue, nscoord};
use gecko_bindings::structs::{nsStyleCoord_Calc, nsStyleUnit, nsStyleUnion, nsStyleCoord, nsStyleSides, nsStyleCorners};
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nscoord};
impl nsStyleCoord {
#[inline]
@ -235,7 +235,7 @@ pub trait CoordDataMut : CoordData {
/// Useful for initializing uninits
/// (set_value may segfault on uninits)
fn leaky_set_null(&mut self) {
use structs::nsStyleUnit::*;
use gecko_bindings::structs::nsStyleUnit::*;
unsafe {
let (unit, union) = self.values_mut();
*unit = eStyleUnit_Null;
@ -246,7 +246,7 @@ pub trait CoordDataMut : CoordData {
#[inline(always)]
fn set_value(&mut self, value: CoordDataValue) {
use self::CoordDataValue::*;
use structs::nsStyleUnit::*;
use gecko_bindings::structs::nsStyleUnit::*;
self.reset();
unsafe {
let (unit, union) = self.values_mut();
@ -338,7 +338,7 @@ pub trait CoordData {
#[inline(always)]
fn as_value(&self) -> CoordDataValue {
use self::CoordDataValue::*;
use structs::nsStyleUnit::*;
use gecko_bindings::structs::nsStyleUnit::*;
unsafe {
match self.unit() {
eStyleUnit_Null => Null,
@ -363,7 +363,7 @@ pub trait CoordData {
#[inline]
/// Pretend inner value is a float; obtain it.
unsafe fn get_float(&self) -> f32 {
use structs::nsStyleUnit::*;
use gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(self.unit() == eStyleUnit_Percent || self.unit() == eStyleUnit_Factor
|| self.unit() == eStyleUnit_Degree || self.unit() == eStyleUnit_Grad
|| self.unit() == eStyleUnit_Radian || self.unit() == eStyleUnit_Turn
@ -374,7 +374,7 @@ pub trait CoordData {
#[inline]
/// Pretend inner value is an int; obtain it.
unsafe fn get_integer(&self) -> i32 {
use structs::nsStyleUnit::*;
use gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(self.unit() == eStyleUnit_Coord || self.unit() == eStyleUnit_Integer
|| self.unit() == eStyleUnit_Enumerated);
*self.union().mInt.as_ref()

View file

@ -2,12 +2,12 @@
* 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/. */
use bindings;
use gecko_bindings::bindings;
use std::mem;
use std::ops::{Deref, DerefMut};
use std::os::raw::c_void;
use std::slice;
use structs::{nsTArray, nsTArrayHeader};
use gecko_bindings::structs::{nsTArray, nsTArrayHeader};
impl<T> Deref for nsTArray<T> {
type Target = [T];

View file

@ -2,13 +2,6 @@
* 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/. */
#[macro_use] #[no_link]
extern crate cfg_if;
extern crate gecko_bindings;
extern crate heapsize;
extern crate selectors;
extern crate serde;
use gecko_bindings::bindings::Gecko_AddRefAtom;
use gecko_bindings::bindings::Gecko_Atomize;
use gecko_bindings::bindings::Gecko_ReleaseAtom;
@ -30,9 +23,10 @@ use std::slice;
#[macro_use]
#[allow(improper_ctypes)]
pub mod atom_macro;
#[macro_use]
pub mod namespace;
pub use namespace::{Namespace, WeakNamespace};
pub use string_cache::namespace::{Namespace, WeakNamespace};
/// A strong reference to a Gecko atom.
#[derive(PartialEq, Eq)]

View file

@ -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/. */
use {Atom, WeakAtom};
use string_cache::{Atom, WeakAtom};
use gecko_bindings::structs::nsIAtom;
use selectors::bloom::BloomHash;
use std::borrow::Borrow;
@ -11,7 +11,7 @@ use std::ops::Deref;
#[macro_export]
macro_rules! ns {
() => { $crate::Namespace(atom!("")) }
() => { $crate::string_cache::Namespace(atom!("")) }
}
#[derive(Debug, PartialEq, Eq, Clone, Default, Hash)]

View file

@ -38,6 +38,8 @@ extern crate app_units;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate bitflags;
#[macro_use] #[no_link]
extern crate cfg_if;
extern crate core;
#[macro_use]
extern crate cssparser;
@ -45,9 +47,7 @@ extern crate deque;
extern crate encoding;
extern crate euclid;
extern crate fnv;
#[cfg(feature = "gecko")] extern crate gecko_bindings;
#[cfg(feature = "gecko")] #[macro_use] extern crate gecko_string_cache as string_cache;
#[cfg(feature = "servo")] extern crate heapsize;
extern crate heapsize;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate lazy_static;
@ -63,7 +63,7 @@ extern crate quickersort;
extern crate rand;
extern crate rustc_serialize;
extern crate selectors;
#[cfg(feature = "servo")] extern crate serde;
extern crate serde;
extern crate smallvec;
#[cfg(feature = "servo")] #[macro_use] extern crate string_cache;
#[macro_use]
@ -72,6 +72,11 @@ extern crate time;
extern crate url;
extern crate util;
#[cfg(feature = "gecko")]
#[path = "./gecko_string_cache/mod.rs"]
#[allow(unsafe_code)]
#[macro_use] pub mod string_cache;
pub mod animation;
pub mod attr;
pub mod bezier;
@ -86,6 +91,7 @@ pub mod element_state;
pub mod error_reporting;
pub mod font_face;
#[cfg(feature = "gecko")] pub mod gecko_conversions;
#[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bindings;
#[cfg(feature = "gecko")] pub mod gecko_selector_impl;
#[cfg(feature = "gecko")] pub mod gecko_values;
pub mod keyframes;

View file

@ -5,8 +5,6 @@ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"gecko_string_cache 0.2.20",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -156,25 +154,6 @@ name = "fnv"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gecko_bindings"
version = "0.0.1"
dependencies = [
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gecko_string_cache"
version = "0.2.20"
dependencies = [
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "getopts"
version = "0.2.14"
@ -358,13 +337,13 @@ version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"gecko_string_cache 0.2.20",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -377,6 +356,7 @@ dependencies = [
"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)",
"selectors 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -401,7 +381,6 @@ version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"style 0.0.1",
"style_traits 0.0.1",
]

View file

@ -13,8 +13,6 @@ crate-type = ["staticlib", "rlib"]
app_units = "0.3"
env_logger = "0.3"
euclid = "0.10.1"
gecko_bindings = {version = "0.0.1", path = "gecko_bindings"}
gecko_string_cache = {path = "string_cache"}
lazy_static = "0.2"
libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]}

View file

@ -3,8 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use euclid::size::TypedSize2D;
use gecko_bindings::bindings::RawServoStyleSet;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use style::gecko_bindings::bindings::RawServoStyleSet;
use style::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use num_cpus;
use std::cmp;
use std::collections::HashMap;

View file

@ -1,13 +0,0 @@
[package]
name = "gecko_bindings"
version = "0.0.1"
authors = ["The Servo Project Developers"]
license = "MPL-2.0"
publish = false
[lib]
name = "gecko_bindings"
path = "lib.rs"
[dependencies]
heapsize = "0.3.0"

View file

@ -8,21 +8,21 @@ use app_units::Au;
use data::{NUM_THREADS, PerDocumentStyleData};
use env_logger;
use euclid::Size2D;
use gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoNodeBorrowed};
use gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetOwned};
use gecko_bindings::bindings::{RawServoStyleSetBorrowedMut, RawGeckoDocumentBorrowed};
use gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedValuesBorrowed};
use gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong};
use gecko_bindings::bindings::{ServoComputedValuesBorrowedOrNull, ServoDeclarationBlock};
use gecko_bindings::bindings::{ServoDeclarationBlockBorrowed, ServoDeclarationBlockStrong};
use gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder, nsHTMLCSSStyleSheet};
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
use gecko_bindings::structs::{SheetParsingMode, nsIAtom};
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasBoxFFI};
use gecko_bindings::sugar::ownership::{HasFFI, HasSimpleFFI, Strong};
use gecko_string_cache::Atom;
use style::gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoNodeBorrowed};
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetOwned};
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowedMut, RawGeckoDocumentBorrowed};
use style::gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedValuesBorrowed};
use style::gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong};
use style::gecko_bindings::bindings::{ServoComputedValuesBorrowedOrNull, ServoDeclarationBlock};
use style::gecko_bindings::bindings::{ServoDeclarationBlockBorrowed, ServoDeclarationBlockStrong};
use style::gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder, nsHTMLCSSStyleSheet};
use style::gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
use style::gecko_bindings::structs::{SheetParsingMode, nsIAtom};
use style::gecko_bindings::structs::ServoElementSnapshot;
use style::gecko_bindings::structs::nsRestyleHint;
use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasBoxFFI};
use style::gecko_bindings::sugar::ownership::{HasFFI, HasSimpleFFI, Strong};
use style::gecko_string_cache::Atom;
use snapshot::GeckoElementSnapshot;
use std::mem::transmute;
use std::ptr;

View file

@ -2,17 +2,16 @@
* 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/. */
#[macro_use]extern crate style;
extern crate app_units;
extern crate env_logger;
extern crate euclid;
extern crate gecko_bindings;
#[macro_use] extern crate gecko_string_cache;
#[macro_use] extern crate lazy_static;
extern crate libc;
#[macro_use] extern crate log;
extern crate num_cpus;
extern crate selectors;
extern crate style;
extern crate style_traits;
extern crate url;

View file

@ -1,10 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
use gecko_bindings::bindings;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use gecko_string_cache::Atom;
use style::gecko_bindings::bindings;
use style::gecko_bindings::structs::ServoElementSnapshot;
use style::gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use style::string_cache::Atom;
use selectors::parser::AttrSelector;
use snapshot_helpers;
use style::element_state::ElementState;

View file

@ -4,8 +4,8 @@
//! Element an snapshot common logic.
use gecko_bindings::structs::nsIAtom;
use gecko_string_cache::Atom;
use style::gecko_bindings::structs::nsIAtom;
use style::string_cache::Atom;
use std::{ptr, slice};
pub type ClassOrClassList<T> = unsafe extern fn (T, *mut *mut nsIAtom, *mut *mut *mut nsIAtom) -> u32;

View file

@ -1,18 +0,0 @@
[package]
name = "gecko_string_cache"
description = "A crate to allow using Gecko's nsIAtom as a replacement for string_cache."
version = "0.2.20"
authors = ["The Servo Project Developers"]
license = "MPL-2.0"
publish = false
[lib]
path = "lib.rs"
[dependencies]
cfg-if = "0.1.0"
gecko_bindings = {version = "0.0.1", path = "../gecko_bindings"}
heapsize = "0.3.5"
libc = "0.2"
selectors = "0.13"
serde = "0.8"

View file

@ -4,28 +4,28 @@
#![allow(unsafe_code)]
use gecko_bindings::bindings;
use gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference};
use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentElement};
use gecko_bindings::bindings::{Gecko_GetFirstChild, Gecko_GetFirstChildElement};
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetLastChildElement};
use gecko_bindings::bindings::{Gecko_GetNextSibling, Gecko_GetNextSiblingElement, Gecko_GetNextStyleChild};
use gecko_bindings::bindings::{Gecko_GetNodeFlags, Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::{Gecko_GetParentElement, Gecko_GetParentNode};
use gecko_bindings::bindings::{Gecko_GetPrevSibling, Gecko_GetPrevSiblingElement};
use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument};
use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_IsTextNode};
use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement};
use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_GetStyleContext;
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
use gecko_bindings::structs::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsStyleContext};
use gecko_bindings::structs::OpaqueStyleData;
use gecko_bindings::sugar::ownership::FFIArcHelpers;
use gecko_string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use style::gecko_bindings::bindings;
use style::gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference};
use style::gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
use style::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentElement};
use style::gecko_bindings::bindings::{Gecko_GetFirstChild, Gecko_GetFirstChildElement};
use style::gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetLastChildElement};
use style::gecko_bindings::bindings::{Gecko_GetNextSibling, Gecko_GetNextSiblingElement, Gecko_GetNextStyleChild};
use style::gecko_bindings::bindings::{Gecko_GetNodeFlags, Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use style::gecko_bindings::bindings::{Gecko_GetParentElement, Gecko_GetParentNode};
use style::gecko_bindings::bindings::{Gecko_GetPrevSibling, Gecko_GetPrevSiblingElement};
use style::gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument};
use style::gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_IsTextNode};
use style::gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
use style::gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement};
use style::gecko_bindings::bindings::Gecko_ClassOrClassList;
use style::gecko_bindings::bindings::Gecko_GetStyleContext;
use style::gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
use style::gecko_bindings::structs::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use style::gecko_bindings::structs::{nsChangeHint, nsIAtom, nsStyleContext};
use style::gecko_bindings::structs::OpaqueStyleData;
use style::gecko_bindings::sugar::ownership::FFIArcHelpers;
use style::gecko_string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use glue::GeckoDeclarationBlock;
use libc::uintptr_t;
use selectors::Element;

View file

@ -12,6 +12,5 @@ doctest = false
[dependencies]
app_units = "0.3"
cssparser = {version = "0.7", features = ["heap_size"]}
gecko_bindings = {path = "../../../ports/geckolib/gecko_bindings"}
style = {path = "../../../components/style", features = ["gecko"]}
style_traits = {path = "../../../components/style_traits"}