Auto merge of #13372 - Manishearth:merge-stylo, r=emilio

Merge most of geckolib into style

Fixes #13038

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13372)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-09-26 02:36:05 -05:00 committed by GitHub
commit f763eca344
45 changed files with 2712 additions and 2763 deletions

View file

@ -2272,6 +2272,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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)", "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2286,6 +2287,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -12,8 +12,8 @@ name = "style"
path = "lib.rs" path = "lib.rs"
[features] [features]
gecko = ["gecko_bindings", "gecko_string_cache"] gecko = []
servo = ["serde", "serde/unstable", "serde_macros", "heapsize", "heapsize_plugin", servo = ["serde/unstable", "serde", "serde_macros", "heapsize_plugin",
"style_traits/servo", "app_units/plugins", "style_traits/servo", "app_units/plugins",
"cssparser/heap_size", "cssparser/serde-serialization", "cssparser/heap_size", "cssparser/serde-serialization",
"selectors/heap_size", "selectors/unstable", "string_cache", "selectors/heap_size", "selectors/unstable", "string_cache",
@ -23,20 +23,21 @@ testing = []
[dependencies] [dependencies]
app_units = "0.3" app_units = "0.3"
bitflags = "0.7" bitflags = "0.7"
cfg-if = "0.1.0"
cssparser = "0.7" cssparser = "0.7"
deque = "0.3.1" deque = "0.3.1"
encoding = "0.2" encoding = "0.2"
euclid = "0.10.1" euclid = "0.10.1"
fnv = "1.0" fnv = "1.0"
gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true} heapsize = "0.3.0"
gecko_string_cache = {path = "../../ports/geckolib/string_cache", optional = true}
heapsize = {version = "0.3.0", optional = true}
heapsize_plugin = {version = "0.1.2", optional = true} heapsize_plugin = {version = "0.1.2", optional = true}
lazy_static = "0.2" lazy_static = "0.2"
log = "0.3.5" log = "0.3.5"
libc = "0.2"
matches = "0.1" matches = "0.1"
num-integer = "0.1.32" num-integer = "0.1.32"
num-traits = "0.1.32" num-traits = "0.1.32"
num_cpus = "0.2.2"
ordered-float = "0.2.2" ordered-float = "0.2.2"
quickersort = "2.0.0" quickersort = "2.0.0"
rand = "0.3" rand = "0.3"

View file

@ -432,11 +432,13 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append("{}Strong".format(ty)) flags.append("{}Strong".format(ty))
flags.append("--raw-line") 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("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty)) flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line") 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("--blacklist-type")
flags.append("{}Borrowed".format(ty)) flags.append("{}Borrowed".format(ty))
flags.append("--raw-line") flags.append("--raw-line")
@ -452,7 +454,8 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty)) flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line") 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 # 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 # 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 # type with zero_size_type. If we ever introduce immutable borrow types
@ -478,21 +481,21 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append("{}Owned".format(ty)) flags.append("{}Owned".format(ty))
flags.append("--raw-line") 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("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty)) flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line") 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)) .format(ty))
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append("{}BorrowedMutOrNull".format(ty)) flags.append("{}BorrowedMutOrNull".format(ty))
flags.append("--raw-line") 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)) .format(ty))
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append("{}OwnedOrNull".format(ty)) flags.append("{}OwnedOrNull".format(ty))
flags.append("--raw-line") 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) zero_size_type(ty, flags)
if "structs_types" in current_target: if "structs_types" in current_target:
@ -500,7 +503,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type") flags.append("--blacklist-type")
flags.append(ty) flags.append(ty)
flags.append("--raw-line") 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 # TODO: this is hacky, figure out a better way to do it without
# hardcoding everything... # hardcoding everything...

View file

@ -117,7 +117,7 @@ def write_atom_macro(atoms, file_name):
with open(file_name, "wb") as f: with open(file_name, "wb") as f:
f.write(PRELUDE) 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") f.write("use Atom;\n\n")
for source in SOURCES: for source in SOURCES:
if source.TYPE != "nsIAtom": if source.TYPE != "nsIAtom":
@ -138,7 +138,8 @@ def write_atom_macro(atoms, file_name):
f.write("}\n\n") f.write("}\n\n")
f.write("#[macro_export]\n") f.write("#[macro_export]\n")
f.write("macro_rules! atom {\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]) % (atom.value, atom.ident) for atom in atoms])
f.write("}\n") f.write("}\n")
@ -191,6 +192,6 @@ def write_pseudo_element_helper(atoms, target_filename):
def build(objdir, verbose=False): def build(objdir, verbose=False):
atoms = collect_atoms(objdir) atoms = collect_atoms(objdir)
write_atom_macro(atoms, "../string_cache/atom_macro.rs") write_atom_macro(atoms, "../gecko_string_cache/atom_macro.rs")
write_pseudo_element_helper(atoms, "../../../components/style/generated/gecko_pseudo_element_helper.rs") write_pseudo_element_helper(atoms, "../gecko/generated/gecko_pseudo_element_helper.rs")
return 0 return 0

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use context::{LocalStyleContext, StyleContext, SharedStyleContext};
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use style::context::{LocalStyleContext, StyleContext, SharedStyleContext};
thread_local!(static LOCAL_CONTEXT_KEY: RefCell<Option<Rc<LocalStyleContext>>> = RefCell::new(None)); thread_local!(static LOCAL_CONTEXT_KEY: RefCell<Option<Rc<LocalStyleContext>>> = RefCell::new(None));

View file

@ -107,12 +107,12 @@ impl From<nsStyleCoord_CalcValue> for LengthOrPercentage {
pub mod basic_shape { pub mod basic_shape {
use euclid::size::Size2D; use euclid::size::Size2D;
use gecko::values::GeckoStyleCoordConvertible;
use gecko_bindings::structs; use gecko_bindings::structs;
use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleFillRule}; use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleFillRule};
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners}; use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
use gecko_bindings::structs::StyleClipPathGeometryBox; use gecko_bindings::structs::StyleClipPathGeometryBox;
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue}; use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use gecko_values::GeckoStyleCoordConvertible;
use std::borrow::Borrow; use std::borrow::Borrow;
use values::computed::{BorderRadiusSize, LengthOrPercentage}; use values::computed::{BorderRadiusSize, LengthOrPercentage};
use values::computed::basic_shape::*; use values::computed::basic_shape::*;

View file

@ -2,25 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use animation::Animation;
use context::SharedStyleContext;
use dom::OpaqueNode;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use gecko_bindings::bindings::RawServoStyleSet; use gecko_bindings::bindings::RawServoStyleSet;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use media_queries::{Device, MediaType};
use num_cpus; use num_cpus;
use parallel::WorkQueueData;
use selector_matching::Stylist;
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::sync::mpsc::{Receiver, Sender, channel}; use std::sync::mpsc::{Receiver, Sender, channel};
use style::animation::Animation;
use style::context::SharedStyleContext;
use style::dom::OpaqueNode;
use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::selector_matching::Stylist;
use style::stylesheets::Stylesheet;
use style::thread_state;
use style::workqueue::WorkQueue;
use style_traits::ViewportPx; use style_traits::ViewportPx;
use stylesheets::Stylesheet;
use thread_state;
use workqueue::WorkQueue;
pub struct PerDocumentStyleData { pub struct PerDocumentStyleData {
/// Rule processor. /// Rule processor.

View file

@ -0,0 +1,15 @@
/* 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/. */
pub mod context;
pub mod data;
pub mod snapshot;
pub mod snapshot_helpers;
pub mod traversal;
pub mod wrapper;
pub mod conversions;
pub mod selector_impl;
pub mod values;

View file

@ -1,16 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use element_state::ElementState;
use gecko::snapshot_helpers;
use gecko::wrapper::AttrSelectorHelpers;
use gecko_bindings::bindings; use gecko_bindings::bindings;
use gecko_bindings::structs::ServoElementSnapshot; use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::ServoElementSnapshotFlags as Flags; use gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use gecko_string_cache::Atom; use restyle_hints::ElementSnapshot;
use selector_impl::TheSelectorImpl;
use selectors::parser::AttrSelector; use selectors::parser::AttrSelector;
use snapshot_helpers; use string_cache::Atom;
use style::element_state::ElementState;
use style::restyle_hints::ElementSnapshot;
use style::selector_impl::TheSelectorImpl;
use wrapper::AttrSelectorHelpers;
// NB: This is sound, in some sense, because during computation of restyle hints // NB: This is sound, in some sense, because during computation of restyle hints
// the snapshot is kept alive by the modified elements table. // the snapshot is kept alive by the modified elements table.

View file

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

View file

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use context::StandaloneStyleContext; use context::{LocalStyleContext, SharedStyleContext, StyleContext};
use dom::OpaqueNode;
use gecko::context::StandaloneStyleContext;
use gecko::wrapper::GeckoNode;
use std::mem; use std::mem;
use style::context::{LocalStyleContext, SharedStyleContext, StyleContext}; use traversal::{DomTraversalContext, recalc_style_at};
use style::dom::OpaqueNode; use traversal::RestyleResult;
use style::traversal::{DomTraversalContext, recalc_style_at};
use style::traversal::RestyleResult;
use wrapper::GeckoNode;
pub struct RecalcStyleOnly<'lc> { pub struct RecalcStyleOnly<'lc> {
context: StandaloneStyleContext<'lc>, context: StandaloneStyleContext<'lc>,

View file

@ -4,6 +4,15 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
use data::PrivateStyleData;
use dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
use element_state::ElementState;
use error_reporting::StdoutErrorReporter;
use gecko::selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement};
use gecko::snapshot::GeckoElementSnapshot;
use gecko::snapshot_helpers;
use gecko_bindings::bindings; use gecko_bindings::bindings;
use gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference}; use gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference};
use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator}; use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
@ -24,31 +33,23 @@ use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRT
use gecko_bindings::structs::{RawGeckoDocument, RawGeckoElement, RawGeckoNode}; use gecko_bindings::structs::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsStyleContext}; use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsStyleContext};
use gecko_bindings::structs::OpaqueStyleData; use gecko_bindings::structs::OpaqueStyleData;
use gecko_bindings::sugar::ownership::FFIArcHelpers; use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasFFI};
use gecko_string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use glue::GeckoDeclarationBlock;
use libc::uintptr_t; use libc::uintptr_t;
use parser::ParserContextExtraData;
use properties::{ComputedValues, parse_style_attribute};
use properties::PropertyDeclarationBlock;
use refcell::{Ref, RefCell, RefMut};
use selector_impl::ElementExt;
use selector_matching::ApplicableDeclarationBlock;
use selectors::Element; use selectors::Element;
use selectors::parser::{AttrSelector, NamespaceConstraint}; use selectors::parser::{AttrSelector, NamespaceConstraint};
use snapshot::GeckoElementSnapshot; use sink::Push;
use snapshot_helpers;
use std::fmt; use std::fmt;
use std::ops::BitOr; use std::ops::BitOr;
use std::ptr; use std::ptr;
use std::sync::Arc; use std::sync::Arc;
use style::data::PrivateStyleData; use std::sync::atomic::{AtomicBool, AtomicPtr};
use style::dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode}; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use style::dom::{OpaqueNode, PresentationalHintsSynthetizer};
use style::element_state::ElementState;
use style::error_reporting::StdoutErrorReporter;
use style::gecko_selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement};
use style::parser::ParserContextExtraData;
use style::properties::{ComputedValues, parse_style_attribute};
use style::properties::PropertyDeclarationBlock;
use style::refcell::{Ref, RefCell, RefMut};
use style::selector_impl::ElementExt;
use style::selector_matching::ApplicableDeclarationBlock;
use style::sink::Push;
use url::Url; use url::Url;
pub struct NonOpaqueStyleData(RefCell<PrivateStyleData>); pub struct NonOpaqueStyleData(RefCell<PrivateStyleData>);
@ -60,6 +61,24 @@ impl NonOpaqueStyleData {
} }
pub struct GeckoDeclarationBlock {
pub declarations: Option<Arc<PropertyDeclarationBlock>>,
// XXX The following two fields are made atomic to work around the
// ownership system so that they can be changed inside a shared
// instance. It wouldn't provide safety as Rust usually promises,
// but it is fine as far as we only access them in a single thread.
// If we need to access them in different threads, we would need
// to redesign how it works with MiscContainer in Gecko side.
pub cache: AtomicPtr<bindings::nsHTMLCSSStyleSheet>,
pub immutable: AtomicBool,
}
unsafe impl HasFFI for GeckoDeclarationBlock {
type FFIType = bindings::ServoDeclarationBlock;
}
unsafe impl HasArcFFI for GeckoDeclarationBlock {}
// We can eliminate OpaqueStyleData when the bindings move into the style crate. // We can eliminate OpaqueStyleData when the bindings move into the style crate.
fn to_opaque_style_data(d: *mut NonOpaqueStyleData) -> *mut OpaqueStyleData { fn to_opaque_style_data(d: *mut NonOpaqueStyleData) -> *mut OpaqueStyleData {
d as *mut OpaqueStyleData d as *mut OpaqueStyleData

View file

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

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate heapsize;
#[allow(dead_code, non_camel_case_types)] #[allow(dead_code, non_camel_case_types)]
pub mod bindings; pub mod bindings;
pub mod ptr; pub mod ptr;

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bindings::*; use gecko_bindings::bindings::*;
use heapsize::HeapSizeOf; use heapsize::HeapSizeOf;
use std::fmt::{self, Debug}; 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bindings::Gecko_AddRefCSSShadowArrayArbitraryThread; use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use bindings::Gecko_NewCSSShadowArray; use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
use bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread; use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
use gecko_bindings::structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
use std::{ptr, slice}; use std::{ptr, slice};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
impl RefPtr<nsCSSShadowArray> { impl RefPtr<nsCSSShadowArray> {
pub fn replace_with_new(&mut self, len: u32) { pub fn replace_with_new(&mut self, len: u32) {

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use gecko_bindings::structs::nsStyleAutoArray;
use std::iter::{once, Chain, Once, IntoIterator}; use std::iter::{once, Chain, Once, IntoIterator};
use std::slice::{Iter, IterMut}; use std::slice::{Iter, IterMut};
use structs::nsStyleAutoArray;
impl<T> nsStyleAutoArray<T> { impl<T> nsStyleAutoArray<T> {
pub fn iter_mut(&mut self) -> Chain<Once<&mut T>, IterMut<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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bindings::{Gecko_ResetStyleCoord, Gecko_SetStyleCoordCalcValue, Gecko_AddRefCalcArbitraryThread}; use gecko_bindings::bindings::{Gecko_ResetStyleCoord, Gecko_SetStyleCoordCalcValue, Gecko_AddRefCalcArbitraryThread};
use gecko_bindings::structs::{nsStyleCoord_Calc, nsStyleUnit, nsStyleUnion, nsStyleCoord, nsStyleSides, nsStyleCorners};
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nscoord};
use std::mem; use std::mem;
use structs::{nsStyleCoord_Calc, nsStyleUnit, nsStyleUnion, nsStyleCoord, nsStyleSides, nsStyleCorners};
use structs::{nsStyleCoord_CalcValue, nscoord};
impl nsStyleCoord { impl nsStyleCoord {
#[inline] #[inline]
@ -235,7 +235,7 @@ pub trait CoordDataMut : CoordData {
/// Useful for initializing uninits /// Useful for initializing uninits
/// (set_value may segfault on uninits) /// (set_value may segfault on uninits)
fn leaky_set_null(&mut self) { fn leaky_set_null(&mut self) {
use structs::nsStyleUnit::*; use gecko_bindings::structs::nsStyleUnit::*;
unsafe { unsafe {
let (unit, union) = self.values_mut(); let (unit, union) = self.values_mut();
*unit = eStyleUnit_Null; *unit = eStyleUnit_Null;
@ -245,8 +245,8 @@ pub trait CoordDataMut : CoordData {
#[inline(always)] #[inline(always)]
fn set_value(&mut self, value: CoordDataValue) { fn set_value(&mut self, value: CoordDataValue) {
use gecko_bindings::structs::nsStyleUnit::*;
use self::CoordDataValue::*; use self::CoordDataValue::*;
use structs::nsStyleUnit::*;
self.reset(); self.reset();
unsafe { unsafe {
let (unit, union) = self.values_mut(); let (unit, union) = self.values_mut();
@ -337,8 +337,8 @@ pub trait CoordData {
#[inline(always)] #[inline(always)]
fn as_value(&self) -> CoordDataValue { fn as_value(&self) -> CoordDataValue {
use gecko_bindings::structs::nsStyleUnit::*;
use self::CoordDataValue::*; use self::CoordDataValue::*;
use structs::nsStyleUnit::*;
unsafe { unsafe {
match self.unit() { match self.unit() {
eStyleUnit_Null => Null, eStyleUnit_Null => Null,
@ -363,7 +363,7 @@ pub trait CoordData {
#[inline] #[inline]
/// Pretend inner value is a float; obtain it. /// Pretend inner value is a float; obtain it.
unsafe fn get_float(&self) -> f32 { unsafe fn get_float(&self) -> f32 {
use structs::nsStyleUnit::*; use gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(self.unit() == eStyleUnit_Percent || self.unit() == eStyleUnit_Factor debug_assert!(self.unit() == eStyleUnit_Percent || self.unit() == eStyleUnit_Factor
|| self.unit() == eStyleUnit_Degree || self.unit() == eStyleUnit_Grad || self.unit() == eStyleUnit_Degree || self.unit() == eStyleUnit_Grad
|| self.unit() == eStyleUnit_Radian || self.unit() == eStyleUnit_Turn || self.unit() == eStyleUnit_Radian || self.unit() == eStyleUnit_Turn
@ -374,7 +374,7 @@ pub trait CoordData {
#[inline] #[inline]
/// Pretend inner value is an int; obtain it. /// Pretend inner value is an int; obtain it.
unsafe fn get_integer(&self) -> i32 { unsafe fn get_integer(&self) -> i32 {
use structs::nsStyleUnit::*; use gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(self.unit() == eStyleUnit_Coord || self.unit() == eStyleUnit_Integer debug_assert!(self.unit() == eStyleUnit_Coord || self.unit() == eStyleUnit_Integer
|| self.unit() == eStyleUnit_Enumerated); || self.unit() == eStyleUnit_Enumerated);
*self.union().mInt.as_ref() *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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use bindings; use gecko_bindings::bindings;
use gecko_bindings::structs::{nsTArray, nsTArrayHeader};
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::os::raw::c_void; use std::os::raw::c_void;
use std::slice; use std::slice;
use structs::{nsTArray, nsTArrayHeader};
impl<T> Deref for nsTArray<T> { impl<T> Deref for nsTArray<T> {
type Target = [T]; type Target = [T];

View file

@ -2,12 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_use] #[no_link] #![allow(unsafe_code)]
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_AddRefAtom;
use gecko_bindings::bindings::Gecko_Atomize; use gecko_bindings::bindings::Gecko_Atomize;
@ -16,7 +11,6 @@ use gecko_bindings::structs::nsIAtom;
use heapsize::HeapSizeOf; use heapsize::HeapSizeOf;
use selectors::bloom::BloomHash; use selectors::bloom::BloomHash;
use selectors::parser::FromCowStr; use selectors::parser::FromCowStr;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::borrow::{Cow, Borrow}; use std::borrow::{Cow, Borrow};
use std::char::{self, DecodeUtf16}; use std::char::{self, DecodeUtf16};
@ -30,9 +24,10 @@ use std::slice;
#[macro_use] #[macro_use]
#[allow(improper_ctypes)] #[allow(improper_ctypes)]
pub mod atom_macro; pub mod atom_macro;
#[macro_use]
pub mod namespace; pub mod namespace;
pub use namespace::{Namespace, WeakNamespace}; pub use string_cache::namespace::{Namespace, WeakNamespace};
/// A strong reference to a Gecko atom. /// A strong reference to a Gecko atom.
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
@ -242,19 +237,6 @@ impl HeapSizeOf for Atom {
} }
} }
impl Serialize for Atom {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
self.with_str(|s| s.serialize(serializer))
}
}
impl Deserialize for Atom {
fn deserialize<D>(deserializer: &mut D) -> Result<Atom, D::Error> where D: Deserializer {
let string: String = try!(Deserialize::deserialize(deserializer));
Ok(Atom::from(&*string))
}
}
impl fmt::Debug for Atom { impl fmt::Debug for Atom {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
write!(w, "Gecko Atom({:p}, {})", self.0, self) write!(w, "Gecko Atom({:p}, {})", self.0, self)

View file

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use {Atom, WeakAtom};
use gecko_bindings::structs::nsIAtom; use gecko_bindings::structs::nsIAtom;
use selectors::bloom::BloomHash; use selectors::bloom::BloomHash;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::fmt; use std::fmt;
use std::ops::Deref; use std::ops::Deref;
use string_cache::{Atom, WeakAtom};
#[macro_export] #[macro_export]
macro_rules! ns { macro_rules! ns {
() => { $crate::Namespace(atom!("")) } () => { $crate::string_cache::Namespace(atom!("")) }
} }
#[derive(Debug, PartialEq, Eq, Clone, Default, Hash)] #[derive(Debug, PartialEq, Eq, Clone, Default, Hash)]

View file

@ -38,6 +38,8 @@ extern crate app_units;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
#[macro_use] #[no_link]
extern crate cfg_if;
extern crate core; extern crate core;
#[macro_use] #[macro_use]
extern crate cssparser; extern crate cssparser;
@ -45,12 +47,11 @@ extern crate deque;
extern crate encoding; extern crate encoding;
extern crate euclid; extern crate euclid;
extern crate fnv; extern crate fnv;
#[cfg(feature = "gecko")] extern crate gecko_bindings; extern crate heapsize;
#[cfg(feature = "gecko")] #[macro_use] extern crate gecko_string_cache as string_cache;
#[cfg(feature = "servo")] extern crate heapsize;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate libc;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
@ -58,12 +59,14 @@ extern crate log;
extern crate matches; extern crate matches;
extern crate num_integer; extern crate num_integer;
extern crate num_traits; extern crate num_traits;
#[cfg(feature = "gecko")] extern crate num_cpus;
extern crate ordered_float; extern crate ordered_float;
extern crate quickersort; extern crate quickersort;
extern crate rand; extern crate rand;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate selectors; extern crate selectors;
#[cfg(feature = "servo")] extern crate serde; #[cfg(feature = "servo")]
extern crate serde;
extern crate smallvec; extern crate smallvec;
#[cfg(feature = "servo")] #[macro_use] extern crate string_cache; #[cfg(feature = "servo")] #[macro_use] extern crate string_cache;
#[macro_use] #[macro_use]
@ -72,6 +75,10 @@ extern crate time;
extern crate url; extern crate url;
extern crate util; extern crate util;
#[cfg(feature = "gecko")]
#[path = "./gecko_string_cache/mod.rs"]
#[macro_use] pub mod string_cache;
pub mod animation; pub mod animation;
pub mod attr; pub mod attr;
pub mod bezier; pub mod bezier;
@ -85,9 +92,8 @@ pub mod domrefcell;
pub mod element_state; pub mod element_state;
pub mod error_reporting; pub mod error_reporting;
pub mod font_face; pub mod font_face;
#[cfg(feature = "gecko")] pub mod gecko_conversions; #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko;
#[cfg(feature = "gecko")] pub mod gecko_selector_impl; #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bindings;
#[cfg(feature = "gecko")] pub mod gecko_values;
pub mod keyframes; pub mod keyframes;
pub mod logical_geometry; pub mod logical_geometry;
pub mod matching; pub mod matching;

View file

@ -27,9 +27,9 @@ use gecko_bindings::bindings::{Gecko_FontFamilyList_Clear, Gecko_InitializeImage
use gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull; use gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
use gecko_bindings::structs; use gecko_bindings::structs;
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut}; use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
use gecko_values::{StyleCoordHelpers, GeckoStyleCoordConvertible, convert_nscolor_to_rgba}; use gecko::values::{StyleCoordHelpers, GeckoStyleCoordConvertible, convert_nscolor_to_rgba};
use gecko_values::convert_rgba_to_nscolor; use gecko::values::convert_rgba_to_nscolor;
use gecko_values::round_border_to_device_pixels; use gecko::values::round_border_to_device_pixels;
use logical_geometry::WritingMode; use logical_geometry::WritingMode;
use properties::CascadePropertyFn; use properties::CascadePropertyFn;
use properties::longhands; use properties::longhands;
@ -1622,8 +1622,8 @@ clip-path
use gecko_bindings::structs::StyleClipPathGeometryBox; use gecko_bindings::structs::StyleClipPathGeometryBox;
use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleShapeSourceType}; use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleShapeSourceType};
use gecko_bindings::structs::{StyleClipPath, StyleFillRule}; use gecko_bindings::structs::{StyleClipPath, StyleFillRule};
use gecko_conversions::basic_shape::set_corners_from_radius; use gecko::conversions::basic_shape::set_corners_from_radius;
use gecko_values::GeckoStyleCoordConvertible; use gecko::values::GeckoStyleCoordConvertible;
use values::computed::basic_shape::*; use values::computed::basic_shape::*;
let ref mut clip_path = self.gecko.mClipPath; let ref mut clip_path = self.gecko.mClipPath;
// clean up existing struct // clean up existing struct

View file

@ -18,10 +18,10 @@ pub use servo_selector_impl::*;
pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, ServoElementSnapshot as ElementSnapshot}; pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, ServoElementSnapshot as ElementSnapshot};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko_selector_impl::*; pub use gecko::selector_impl::*;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko_selector_impl::{GeckoSelectorImpl as TheSelectorImpl}; pub use gecko::selector_impl::{GeckoSelectorImpl as TheSelectorImpl};
/// This function determines if a pseudo-element is eagerly cascaded or not. /// This function determines if a pseudo-element is eagerly cascaded or not.
/// ///

2
ports/cef/Cargo.lock generated
View file

@ -2155,6 +2155,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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)", "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2169,6 +2170,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -5,8 +5,6 @@ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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)", "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)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -156,25 +154,6 @@ name = "fnv"
version = "1.0.4" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" 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]] [[package]]
name = "getopts" name = "getopts"
version = "0.2.14" version = "0.2.14"
@ -358,13 +337,13 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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)", "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)", "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)", "fnv 1.0.4 (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)",
"gecko_string_cache 0.2.20",
"kernel32-sys 0.2.2 (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)", "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)", "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -372,6 +351,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
@ -401,7 +381,6 @@ version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
] ]

View file

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

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

@ -5,25 +5,8 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
use app_units::Au; use app_units::Au;
use data::{NUM_THREADS, PerDocumentStyleData};
use env_logger; use env_logger;
use euclid::Size2D; 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 snapshot::GeckoElementSnapshot;
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
use std::slice; use std::slice;
@ -34,17 +17,36 @@ use style::arc_ptr_eq;
use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleContext}; use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleContext};
use style::dom::{NodeInfo, TDocument, TElement, TNode}; use style::dom::{NodeInfo, TDocument, TElement, TNode};
use style::error_reporting::StdoutErrorReporter; use style::error_reporting::StdoutErrorReporter;
use style::gecko_selector_impl::{GeckoSelectorImpl, PseudoElement}; use style::gecko::data::{NUM_THREADS, PerDocumentStyleData};
use style::gecko::selector_impl::{GeckoSelectorImpl, PseudoElement};
use style::gecko::snapshot::GeckoElementSnapshot;
use style::gecko::traversal::RecalcStyleOnly;
use style::gecko::wrapper::{DUMMY_BASE_URL, GeckoDeclarationBlock, GeckoDocument};
use style::gecko::wrapper::{GeckoElement, GeckoNode};
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::{ServoDeclarationBlockBorrowed, ServoDeclarationBlockStrong};
use style::gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder};
use style::gecko_bindings::bindings::{nsHTMLCSSStyleSheet, ServoComputedValuesBorrowedOrNull};
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::{HasSimpleFFI, Strong};
use style::parallel; use style::parallel;
use style::parser::ParserContextExtraData; use style::parser::ParserContextExtraData;
use style::properties::{ComputedValues, PropertyDeclarationBlock, parse_one_declaration}; use style::properties::{ComputedValues, parse_one_declaration};
use style::selector_impl::PseudoElementCascadeType; use style::selector_impl::PseudoElementCascadeType;
use style::sequential; use style::sequential;
use style::string_cache::Atom;
use style::stylesheets::{Origin, Stylesheet}; use style::stylesheets::{Origin, Stylesheet};
use style::timer::Timer; use style::timer::Timer;
use traversal::RecalcStyleOnly;
use url::Url; use url::Url;
use wrapper::{DUMMY_BASE_URL, GeckoDocument, GeckoElement, GeckoNode};
/* /*
* For Gecko->Servo function calls, we need to redeclare the same signature that was declared in * For Gecko->Servo function calls, we need to redeclare the same signature that was declared in
@ -337,23 +339,6 @@ pub extern "C" fn Servo_StyleSet_Drop(data: RawServoStyleSetOwned) -> () {
let _ = data.into_box::<PerDocumentStyleData>(); let _ = data.into_box::<PerDocumentStyleData>();
} }
pub struct GeckoDeclarationBlock {
pub declarations: Option<Arc<PropertyDeclarationBlock>>,
// XXX The following two fields are made atomic to work around the
// ownership system so that they can be changed inside a shared
// instance. It wouldn't provide safety as Rust usually promises,
// but it is fine as far as we only access them in a single thread.
// If we need to access them in different threads, we would need
// to redesign how it works with MiscContainer in Gecko side.
pub cache: AtomicPtr<nsHTMLCSSStyleSheet>,
pub immutable: AtomicBool,
}
unsafe impl HasFFI for GeckoDeclarationBlock {
type FFIType = ServoDeclarationBlock;
}
unsafe impl HasArcFFI for GeckoDeclarationBlock {}
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32, pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32,
cache: *mut nsHTMLCSSStyleSheet) cache: *mut nsHTMLCSSStyleSheet)

View file

@ -2,28 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_use]extern crate style;
extern crate app_units; extern crate app_units;
extern crate env_logger; extern crate env_logger;
extern crate euclid; extern crate euclid;
extern crate gecko_bindings;
#[macro_use] extern crate gecko_string_cache;
#[macro_use] extern crate lazy_static;
extern crate libc; extern crate libc;
#[macro_use] extern crate log; #[macro_use] extern crate log;
extern crate num_cpus;
extern crate selectors;
extern crate style;
extern crate style_traits;
extern crate url; extern crate url;
mod context;
mod data;
mod snapshot;
mod snapshot_helpers;
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub mod glue; pub mod glue;
mod traversal;
mod wrapper;
// FIXME(bholley): This should probably go away once we harmonize the allocators. // FIXME(bholley): This should probably go away once we harmonize the allocators.
#[no_mangle] #[no_mangle]

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

@ -8,10 +8,10 @@ packages = ["lazy_static"]
# Files that are ignored for all tidy and lint checks. # Files that are ignored for all tidy and lint checks.
files = [ files = [
# Generated and upstream code combined with our own. Could use cleanup # Generated and upstream code combined with our own. Could use cleanup
"./ports/geckolib/gecko_bindings/bindings.rs", "./components/style/gecko_bindings/bindings.rs",
"./ports/geckolib/gecko_bindings/structs_debug.rs", "./components/style/gecko_bindings/structs_debug.rs",
"./ports/geckolib/gecko_bindings/structs_release.rs", "./components/style/gecko_bindings/structs_release.rs",
"./ports/geckolib/string_cache/atom_macro.rs", "./components/style/gecko_string_cache/atom_macro.rs",
"./resources/hsts_preload.json", "./resources/hsts_preload.json",
"./tests/wpt/metadata/MANIFEST.json", "./tests/wpt/metadata/MANIFEST.json",
"./tests/wpt/metadata-css/MANIFEST.json", "./tests/wpt/metadata-css/MANIFEST.json",

View file

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