Skip to content

Commit

Permalink
Auto merge of #14460 - emilio:stylo-bindgenup, r=heycam
Browse files Browse the repository at this point in the history
stylo: Use master bindgen again.

<!-- Please describe your changes on the following line: -->

To be fair, this is master bindgen with rust-lang/rust-bindgen#318.

<!-- 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/14460)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Dec 5, 2016
2 parents 16c2960 + a890f90 commit 6c3e948
Show file tree
Hide file tree
Showing 7 changed files with 14,682 additions and 14,223 deletions.
72 changes: 34 additions & 38 deletions components/style/binding_tools/regen.py
Expand Up @@ -23,6 +23,7 @@
COMMON_BUILD_KEY: {
"flags": [
"--no-unstable-rust",
"--disable-name-namespacing",
],
"clang_flags": [
"-x", "c++", "-std=c++14",
Expand All @@ -42,15 +43,15 @@
"structs": {
"target_dir": "../gecko_bindings",
"flags": [
"--ignore-functions",
"--ignore-methods",
"--generate", "types,vars",
],
"includes": [
"{}/dist/include/gfxFontConstants.h",
"{}/dist/include/nsThemeConstants.h",
"{}/dist/include/mozilla/dom/AnimationEffectReadOnlyBinding.h",
"{}/dist/include/mozilla/ServoElementSnapshot.h",
"{}/dist/include/mozilla/dom/Element.h",
"{}/dist/include/mozilla/ServoBindings.h",
],
"files": [
"{}/dist/include/nsStyleStruct.h",
Expand All @@ -70,7 +71,9 @@
"use data::ElementData;",
"pub use nsstring::nsStringRepr as nsString;"
],
"blacklist_types": ["nsString"],
"blacklist_types": [
"nsString",
],
"whitelist_vars": [
"NS_THEME_.*",
"NODE_.*",
Expand All @@ -82,6 +85,13 @@
"BORDER_STYLE_.*"
],
"whitelist": [
"RawGecko.*",
"mozilla_ServoElementSnapshot.*",
"mozilla_ConsumeStyleBehavior",
"mozilla_LazyComputeBehavior",
"mozilla_css_SheetParsingMode",
"mozilla_SkipRootBehavior",
".*ThreadSafe.*Holder",
"AnonymousContent",
"AudioContext",
"CapturingContentInfo",
Expand All @@ -103,8 +113,8 @@
"nsAttrName",
"nsAttrValue",
"nsBorderColors",
"nsChangeHint",
"nscolor",
"nsChangeHint",
"nsCSSKeyword",
"nsCSSPropertyID",
"nsCSSRect",
Expand Down Expand Up @@ -139,8 +149,6 @@
"nsStyleContentData",
"nsStyleContext",
"nsStyleCoord",
"nsStyleCoord",
"nsStyleCoord",
"nsStyleCounterData",
"nsStyleDisplay",
"nsStyleEffects",
Expand All @@ -150,8 +158,6 @@
"nsStyleGradientStop",
"nsStyleImage",
"nsStyleImageLayers",
"nsStyleImageLayers_Layer",
"nsStyleImageLayers_LayerType",
"nsStyleList",
"nsStyleMargin",
"nsStyleOutline",
Expand All @@ -178,11 +184,10 @@
"ServoAttrSnapshot",
"ServoElementSnapshot",
"SheetParsingMode",
"Side",
"mozilla_Side",
"StaticRefPtr",
"StyleAnimation",
"StyleBasicShape",
"StyleBasicShape",
"StyleBasicShapeType",
"StyleClipPath",
"StyleClipPathGeometryBox",
Expand All @@ -196,13 +201,18 @@
"nsAString_internal_incompatible_char_type",
"nsACString_internal_char_traits",
"nsACString_internal_incompatible_char_type",
"RefPtr_Proxy", "nsAutoPtr_Proxy", "Pair_Base",
"RefPtr_Proxy_member_function", "nsAutoPtr_Proxy_member_function",
"RefPtr_Proxy",
"RefPtr_Proxy_member_function",
"nsAutoPtr_Proxy",
"nsAutoPtr_Proxy_member_function",
"mozilla_detail_PointerType",
"mozilla_Pair_Base",
"mozilla_SupportsWeakPtr",
"SupportsWeakPtr",
"mozilla_detail_WeakReference",
"mozilla_WeakPtr",
"nsWritingIterator_reference", "nsReadingIterator_reference",
"Heap", "TenuredHeap", "Rooted", "WeakPtr", # <- More template magic than what
# we support.
"nsTObserverArray", # <- Inherits from nsAutoTObserverArray<T, 0>
"PLArenaPool", # <- Bindgen bug
"nsTHashtable", # <- Inheriting from inner typedefs that clang
# doesn't expose properly.
"nsRefPtrHashtable", "nsDataHashtable", "nsClassHashtable", # <- Ditto
Expand All @@ -211,11 +221,9 @@
# for clang.
"nsPIDOMWindow", # <- Takes the vtable from a template parameter, and we can't
# generate it conditionally.
"SupportsWeakPtr",
"Maybe", # <- AlignedStorage, which means templated union, which
# means impossible to represent in stable rust as of
# right now.
"gfxSize", # <- Same, union { struct { T width; T height; }; T components[2] };
"JS_Rooted",
"mozilla_Maybe",
"gfxSize", # <- union { struct { T width; T height; }; T components[2] };
"gfxSize_Super", # Ditto.
],
"servo_mapped_generic_types": [
Expand All @@ -237,17 +245,13 @@
# Generation of the ffi bindings.
"bindings": {
"target_dir": "../gecko_bindings",
"blacklist_types": [
"nsACString_internal",
"nsAString_internal",
],
"raw_lines": [
"pub use nsstring::{nsACString, nsAString};",
"type nsACString_internal = nsACString;",
"type nsAString_internal = nsAString;"
],
"flags": [
"--ignore-methods",
"--generate", "functions",
],
"match_headers": [
"ServoBindingList.h",
Expand All @@ -258,19 +262,16 @@
"files": [
"{}/dist/include/mozilla/ServoBindings.h",
],
"whitelist": [
# Types to just use from the `structs` target.
"structs_types": [
"RawGeckoDocument",
"RawGeckoElement",
"RawGeckoNode",
"ThreadSafe.*Holder",
"ThreadSafeURIHolder",
"ThreadSafePrincipalHolder",
"ConsumeStyleBehavior",
"LazyComputeBehavior",
"SkipRootBehavior",
],

# Types to just use from the `structs` target.
"structs_types": [
"Element",
"FontFamilyList",
"FontFamilyType",
"ServoElementSnapshot",
Expand All @@ -286,11 +287,6 @@
"nsCursorImage",
"nsFont",
"nsIAtom",
"nsIDocument",
"nsINode",
"nsIPrincipal",
"nsIURI",
"nsMainThreadPtrHolder",
"nsRestyleHint",
"nsStyleBackground",
"nsStyleBorder",
Expand Down Expand Up @@ -614,7 +610,7 @@ def zero_size_type(ty, flags):
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("mozilla_{}".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 ""))

Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/wrapper.rs
Expand Up @@ -20,10 +20,10 @@ use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLEleme
use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement};
use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace};
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::{RawGeckoElement, RawGeckoNode};
use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_GetStyleContext;
use gecko_bindings::structs;
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode};
use gecko_bindings::structs::{nsIAtom, nsIContent, nsStyleContext};
use gecko_bindings::structs::NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
use gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
Expand Down
28 changes: 8 additions & 20 deletions components/style/gecko_bindings/bindings.rs
Expand Up @@ -63,7 +63,14 @@ pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<S
pub type ServoElementSnapshotBorrowedOrNull<'a> = Option<&'a ServoElementSnapshot>;
pub type ServoElementSnapshotBorrowedMutOrNull<'a> = Option<&'a mut ServoElementSnapshot>;
pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>;
use gecko_bindings::structs::Element;
use gecko_bindings::structs::RawGeckoDocument;
use gecko_bindings::structs::RawGeckoElement;
use gecko_bindings::structs::RawGeckoNode;
use gecko_bindings::structs::ThreadSafeURIHolder;
use gecko_bindings::structs::ThreadSafePrincipalHolder;
use gecko_bindings::structs::ConsumeStyleBehavior;
use gecko_bindings::structs::LazyComputeBehavior;
use gecko_bindings::structs::SkipRootBehavior;
use gecko_bindings::structs::FontFamilyList;
use gecko_bindings::structs::FontFamilyType;
use gecko_bindings::structs::ServoElementSnapshot;
Expand All @@ -79,11 +86,6 @@ use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::nsCursorImage;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::nsIAtom;
use gecko_bindings::structs::nsIDocument;
use gecko_bindings::structs::nsINode;
use gecko_bindings::structs::nsIPrincipal;
use gecko_bindings::structs::nsIURI;
use gecko_bindings::structs::nsMainThreadPtrHolder;
use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::structs::nsStyleBackground;
unsafe impl Send for nsStyleBackground {}
Expand Down Expand Up @@ -202,18 +204,6 @@ unsafe impl Sync for nsStyleXUL {}
use gecko_bindings::structs::nscoord;
use gecko_bindings::structs::nsresult;

#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ConsumeStyleBehavior { Consume = 0, DontConsume = 1, }
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum LazyComputeBehavior { Allow = 0, Assert = 1, }
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum SkipRootBehavior { Skip = 0, DontSkip = 1, }
pub type RawGeckoNode = nsINode;
pub type RawGeckoElement = Element;
pub type RawGeckoDocument = nsIDocument;
extern "C" {
pub fn Servo_CssRules_AddRef(ptr: ServoCssRulesBorrowed);
}
Expand Down Expand Up @@ -257,7 +247,6 @@ extern "C" {
pub fn Gecko_ClearPODTArray(aArray: *mut ::std::os::raw::c_void,
aElementSize: usize, aElementAlign: usize);
}
pub type ThreadSafePrincipalHolder = nsMainThreadPtrHolder<nsIPrincipal>;
extern "C" {
pub fn Gecko_AddRefPrincipalArbitraryThread(aPtr:
*mut ThreadSafePrincipalHolder);
Expand All @@ -266,7 +255,6 @@ extern "C" {
pub fn Gecko_ReleasePrincipalArbitraryThread(aPtr:
*mut ThreadSafePrincipalHolder);
}
pub type ThreadSafeURIHolder = nsMainThreadPtrHolder<nsIURI>;
extern "C" {
pub fn Gecko_AddRefURIArbitraryThread(aPtr: *mut ThreadSafeURIHolder);
}
Expand Down

0 comments on commit 6c3e948

Please sign in to comment.