From 109bf2a75591f0f901df1e3be3967385438fe5fe Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Mon, 24 Oct 2016 20:43:42 +1100 Subject: [PATCH] Move RawGecko{Node,Element,Document} to bindings --- components/style/binding_tools/regen.py | 18 +++--- components/style/gecko/wrapper.rs | 2 +- components/style/gecko_bindings/bindings.rs | 57 ++++++++++--------- .../style/gecko_bindings/structs_debug.rs | 3 - .../style/gecko_bindings/structs_release.rs | 3 - 5 files changed, 40 insertions(+), 43 deletions(-) diff --git a/components/style/binding_tools/regen.py b/components/style/binding_tools/regen.py index 4f5a76fe161..93a1e8db0ba 100755 --- a/components/style/binding_tools/regen.py +++ b/components/style/binding_tools/regen.py @@ -171,9 +171,6 @@ COMPILATION_TARGETS = { "nsTArrayHeader", "pair", "Position", - "RawGeckoDocument", - "RawGeckoElement", - "RawGeckoNode", "Runnable", "ServoAttrSnapshot", "ServoElementSnapshot", @@ -248,14 +245,17 @@ COMPILATION_TARGETS = { "files": [ "{}/dist/include/mozilla/ServoBindings.h", ], - - # Types to just use from the `structs` target. - "structs_types": [ - "FontFamilyList", - "FontFamilyType", + "whitelist": [ "RawGeckoDocument", "RawGeckoElement", "RawGeckoNode", + ], + + # Types to just use from the `structs` target. + "structs_types": [ + "Element", + "FontFamilyList", + "FontFamilyType", "ServoElementSnapshot", "SheetParsingMode", "StyleBasicShape", @@ -265,6 +265,8 @@ COMPILATION_TARGETS = { "nsChangeHint", "nsFont", "nsIAtom", + "nsIDocument", + "nsINode", "nsIPrincipal", "nsIURI", "nsMainThreadPtrHolder", diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 7c78ef908f4..9340dc68776 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -22,12 +22,12 @@ use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild}; use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument}; use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement}; use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace}; +use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode}; use gecko_bindings::bindings::Gecko_ClassOrClassList; use gecko_bindings::bindings::Gecko_GetStyleContext; use gecko_bindings::bindings::Gecko_SetNodeFlags; use gecko_bindings::structs; 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, nsIContent, nsStyleContext}; use gecko_bindings::sugar::ownership::FFIArcHelpers; use libc::uintptr_t; diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 9a9d82de6e1..abebe1d89a9 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -39,11 +39,9 @@ pub type StyleChildrenIteratorBorrowedMutOrNull<'a> = Option<&'a mut StyleChildr pub type StyleChildrenIteratorOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull; enum StyleChildrenIteratorVoid{ } pub struct StyleChildrenIterator(StyleChildrenIteratorVoid); +use gecko_bindings::structs::Element; use gecko_bindings::structs::FontFamilyList; use gecko_bindings::structs::FontFamilyType; -use gecko_bindings::structs::RawGeckoDocument; -use gecko_bindings::structs::RawGeckoElement; -use gecko_bindings::structs::RawGeckoNode; use gecko_bindings::structs::ServoElementSnapshot; use gecko_bindings::structs::SheetParsingMode; use gecko_bindings::structs::StyleBasicShape; @@ -53,6 +51,8 @@ use gecko_bindings::structs::nsCSSShadowArray; use gecko_bindings::structs::nsChangeHint; 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; @@ -170,6 +170,32 @@ use gecko_bindings::structs::nsStyleXUL; unsafe impl Send for nsStyleXUL {} unsafe impl Sync for nsStyleXUL {} +pub type RawGeckoNode = nsINode; +pub type RawGeckoElement = Element; +pub type RawGeckoDocument = nsIDocument; +extern "C" { + pub fn Servo_StyleSheet_AddRef(ptr: RawServoStyleSheetBorrowed); +} +extern "C" { + pub fn Servo_StyleSheet_Release(ptr: RawServoStyleSheetBorrowed); +} +extern "C" { + pub fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesBorrowed); +} +extern "C" { + pub fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed); +} +extern "C" { + pub fn Servo_DeclarationBlock_AddRef(ptr: + RawServoDeclarationBlockBorrowed); +} +extern "C" { + pub fn Servo_DeclarationBlock_Release(ptr: + RawServoDeclarationBlockBorrowed); +} +extern "C" { + pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned); +} extern "C" { pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void, aCapacity: usize, aElementSize: usize); @@ -821,12 +847,6 @@ extern "C" { *mut ThreadSafePrincipalHolder) -> RawServoStyleSheetStrong; } -extern "C" { - pub fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetBorrowed); -} -extern "C" { - pub fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetBorrowed); -} extern "C" { pub fn Servo_StyleSheet_HasRules(sheet: RawServoStyleSheetBorrowed) -> bool; @@ -834,9 +854,6 @@ extern "C" { extern "C" { pub fn Servo_StyleSet_Init() -> RawServoStyleSetOwned; } -extern "C" { - pub fn Servo_StyleSet_Drop(set: RawServoStyleSetOwned); -} extern "C" { pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed, sheet: RawServoStyleSheetBorrowed); @@ -879,14 +896,6 @@ extern "C" { pub fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32) -> RawServoDeclarationBlockStrong; } -extern "C" { - pub fn Servo_DeclarationBlock_AddRef(declarations: - RawServoDeclarationBlockBorrowed); -} -extern "C" { - pub fn Servo_DeclarationBlock_Release(declarations: - RawServoDeclarationBlockBorrowed); -} extern "C" { pub fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed, b: RawServoDeclarationBlockBorrowed) @@ -929,14 +938,6 @@ extern "C" { ServoComputedValuesBorrowedOrNull) -> ServoComputedValuesStrong; } -extern "C" { - pub fn Servo_ComputedValues_AddRef(computed_values: - ServoComputedValuesBorrowed); -} -extern "C" { - pub fn Servo_ComputedValues_Release(computed_values: - ServoComputedValuesBorrowed); -} extern "C" { pub fn Servo_Initialize(); } diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs index 1997c09f806..277fc5f7827 100644 --- a/components/style/gecko_bindings/structs_debug.rs +++ b/components/style/gecko_bindings/structs_debug.rs @@ -10035,9 +10035,6 @@ fn bindgen_test_layout_nsStyleVisibility() { assert_eq!(::std::mem::size_of::() , 7usize); assert_eq!(::std::mem::align_of::() , 1usize); } -pub type RawGeckoNode = nsINode; -pub type RawGeckoElement = Element; -pub type RawGeckoDocument = nsIDocument; #[repr(C)] #[derive(Debug, Copy)] pub struct Position { diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs index eb66f803531..90854ea309d 100644 --- a/components/style/gecko_bindings/structs_release.rs +++ b/components/style/gecko_bindings/structs_release.rs @@ -9981,9 +9981,6 @@ fn bindgen_test_layout_nsStyleVisibility() { assert_eq!(::std::mem::size_of::() , 7usize); assert_eq!(::std::mem::align_of::() , 1usize); } -pub type RawGeckoNode = nsINode; -pub type RawGeckoElement = Element; -pub type RawGeckoDocument = nsIDocument; #[repr(C)] #[derive(Debug, Copy)] pub struct Position {