Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylo: Manage servo node data directly from Servo #13404

Merged
merged 2 commits into from Sep 24, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Bug 1304913 - Have Servo manage node data directly without FFI calls.…

… r=Manishearth

MozReview-Commit-ID: H8f8VP18TbM
  • Loading branch information
bholley committed Sep 24, 2016
commit ba743f59d9ecf8a1dd2b4ab27a64aa0549ce6f6a
@@ -66,6 +66,10 @@
"release": {
}
},
"raw_lines": [
# We can get rid of this when the bindings move into the style crate.
"pub enum OpaqueStyleData {}",
],
"whitelist_vars": [
"NS_THEME_.*",
"NODE_.*",
@@ -77,6 +81,9 @@
"BORDER_STYLE_.*"
],
"whitelist": [
"RawGeckoNode",
"RawGeckoElement",
"RawGeckoDocument",
"Element",
"Side",
"nsTArrayHeader",
@@ -168,6 +175,21 @@
"gfxSize", # <- Same, union { struct { T width; T height; }; T components[2] };
"gfxSize_Super", # Ditto.
],
"servo_mapped_generic_types": [
{
"generic": True,
"gecko": "ServoUnsafeCell",
"servo": "::std::cell::UnsafeCell"
}, {
"generic": True,
"gecko": "ServoCell",
"servo": "::std::cell::Cell"
}, {
"generic": False,
"gecko": "ServoNodeData",
"servo": "OpaqueStyleData"
}
],
},
# Generation of the ffi bindings.
"bindings": {
@@ -206,14 +228,15 @@
"FontFamilyType", "nsIAtom", "nsStyleContext", "StyleClipPath",
"StyleBasicShapeType", "StyleBasicShape", "nsCSSShadowArray",
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
"RawGeckoNode", "RawGeckoElement", "RawGeckoDocument",
"ServoNodeData",
],
"servo_nullable_arc_types": [
"ServoComputedValues", "RawServoStyleSheet",
"ServoDeclarationBlock"
],
"servo_owned_types": [
"RawServoStyleSet",
"ServoNodeData",
"StyleChildrenIterator",
],
"servo_immutable_borrow_types": [
@@ -430,7 +453,17 @@ def zero_size_type(ty, flags):
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
zero_size_type(ty, flags)
# 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
# which _do_ need to be opaque, we'll need a separate mode.

if "servo_mapped_generic_types" in current_target:
for ty in current_target["servo_mapped_generic_types"]:
flags.append("--blacklist-type")
flags.append("{}".format(ty["gecko"]))
flags.append("--raw-line")
flags.append("pub type {0}{2} = {1}{2};".format(ty["gecko"], ty["servo"], "<T>" if ty["generic"] else ""))

if "servo_owned_types" in current_target:
for ty in current_target["servo_owned_types"]:
@@ -18,16 +18,10 @@ enum ServoDeclarationBlockVoid{ }
pub struct ServoDeclarationBlock(ServoDeclarationBlockVoid);
pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode;
pub type RawGeckoNodeBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoNode>;
enum RawGeckoNodeVoid{ }
pub struct RawGeckoNode(RawGeckoNodeVoid);
pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement;
pub type RawGeckoElementBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoElement>;
enum RawGeckoElementVoid{ }
pub struct RawGeckoElement(RawGeckoElementVoid);
pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
pub type RawGeckoDocumentBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoDocument>;
enum RawGeckoDocumentVoid{ }
pub struct RawGeckoDocument(RawGeckoDocumentVoid);
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
pub type RawServoStyleSetOwned = ::sugar::ownership::Owned<RawServoStyleSet>;
@@ -36,14 +30,6 @@ pub type RawServoStyleSetBorrowedMutOrNull<'a> = ::sugar::ownership::BorrowedMut
pub type RawServoStyleSetOwnedOrNull = ::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
enum RawServoStyleSetVoid{ }
pub struct RawServoStyleSet(RawServoStyleSetVoid);
pub type ServoNodeDataBorrowed<'a> = &'a ServoNodeData;
pub type ServoNodeDataBorrowedMut<'a> = &'a mut ServoNodeData;
pub type ServoNodeDataOwned = ::sugar::ownership::Owned<ServoNodeData>;
pub type ServoNodeDataBorrowedOrNull<'a> = ::sugar::ownership::Borrowed<'a, ServoNodeData>;
pub type ServoNodeDataBorrowedMutOrNull<'a> = ::sugar::ownership::BorrowedMut<'a, ServoNodeData>;
pub type ServoNodeDataOwnedOrNull = ::sugar::ownership::OwnedOrNull<ServoNodeData>;
enum ServoNodeDataVoid{ }
pub struct ServoNodeData(ServoNodeDataVoid);
pub type StyleChildrenIteratorBorrowed<'a> = &'a StyleChildrenIterator;
pub type StyleChildrenIteratorBorrowedMut<'a> = &'a mut StyleChildrenIterator;
pub type StyleChildrenIteratorOwned = ::sugar::ownership::Owned<StyleChildrenIterator>;
@@ -179,6 +165,10 @@ use structs::nsINode;
use structs::nsIDocument;
use structs::nsIPrincipal;
use structs::nsIURI;
use structs::RawGeckoNode;
use structs::RawGeckoElement;
use structs::RawGeckoDocument;
use structs::ServoNodeData;

extern "C" {
pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void,
@@ -189,7 +179,7 @@ extern "C" {
aElementSize: usize, aElementAlign: usize);
}
extern "C" {
pub fn Servo_NodeData_Drop(arg1: *mut ServoNodeData);
pub fn Servo_Node_ClearNodeData(arg1: *mut nsINode);
}
#[repr(C)]
#[derive(Debug, Copy)]
@@ -387,14 +377,6 @@ extern "C" {
pub fn Gecko_GetServoDeclarationBlock(element: RawGeckoElementBorrowed)
-> ServoDeclarationBlockBorrowedOrNull;
}
extern "C" {
pub fn Gecko_GetNodeData(node: RawGeckoNodeBorrowed)
-> ServoNodeDataBorrowedOrNull;
}
extern "C" {
pub fn Gecko_SetNodeData(node: RawGeckoNodeBorrowed,
data: ServoNodeDataOwned);
}
extern "C" {
pub fn Gecko_Atomize(aString: *const ::std::os::raw::c_char, aLength: u32)
-> *mut nsIAtom;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.