mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add style struct mapping support to regen_bindings.sh and eliminate the manual hack.
This commit is contained in:
parent
7751628bd9
commit
c6ded128ab
2 changed files with 30 additions and 14 deletions
|
@ -1,18 +1,5 @@
|
|||
/* automatically generated by rust-bindgen */
|
||||
|
||||
pub enum nsIAtom { }
|
||||
pub enum nsINode { }
|
||||
pub type RawGeckoNode = nsINode;
|
||||
pub enum Element { }
|
||||
pub type RawGeckoElement = Element;
|
||||
pub enum nsIDocument { }
|
||||
pub type RawGeckoDocument = nsIDocument;
|
||||
pub enum ServoNodeData { }
|
||||
pub enum ServoComputedValues { }
|
||||
pub enum RawServoStyleSheet { }
|
||||
pub enum RawServoStyleSet { }
|
||||
|
||||
// Temporary manual hack. This will be fixed soon in bindgen.
|
||||
use gecko_style_structs::nsStyleFont;
|
||||
use gecko_style_structs::nsStyleColor;
|
||||
use gecko_style_structs::nsStyleList;
|
||||
|
@ -38,6 +25,18 @@ use gecko_style_structs::nsStyleSVGReset;
|
|||
use gecko_style_structs::nsStyleColumn;
|
||||
use gecko_style_structs::nsStyleEffects;
|
||||
|
||||
|
||||
pub enum nsIAtom { }
|
||||
pub enum nsINode { }
|
||||
pub type RawGeckoNode = nsINode;
|
||||
pub enum Element { }
|
||||
pub type RawGeckoElement = Element;
|
||||
pub enum nsIDocument { }
|
||||
pub type RawGeckoDocument = nsIDocument;
|
||||
pub enum ServoNodeData { }
|
||||
pub enum ServoComputedValues { }
|
||||
pub enum RawServoStyleSheet { }
|
||||
pub enum RawServoStyleSet { }
|
||||
extern "C" {
|
||||
pub fn Gecko_ChildrenCount(node: *mut RawGeckoNode) -> u32;
|
||||
pub fn Gecko_NodeIsElement(node: *mut RawGeckoNode) -> bool;
|
||||
|
|
|
@ -20,18 +20,34 @@ export DYLD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
|||
export LD_LIBRARY_PATH="$(pwd)/llvm/build/Release+Asserts/lib"
|
||||
export DIST_INCLUDE="$1/dist/include"
|
||||
|
||||
# Prevent bindgen from generating opaque types for the gecko style structs.
|
||||
export MAP_GECKO_STRUCTS=""
|
||||
for STRUCT in nsStyleFont nsStyleColor nsStyleList nsStyleText \
|
||||
nsStyleVisibility nsStyleUserInterface nsStyleTableBorder \
|
||||
nsStyleSVG nsStyleVariables nsStyleBackground nsStylePosition \
|
||||
nsStyleTextReset nsStyleDisplay nsStyleContent nsStyleUIReset \
|
||||
nsStyleTable nsStyleMargin nsStylePadding nsStyleBorder \
|
||||
nsStyleOutline nsStyleXUL nsStyleSVGReset nsStyleColumn nsStyleEffects
|
||||
do
|
||||
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-blacklist-type $STRUCT "
|
||||
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-raw-line 'use gecko_style_structs::$STRUCT;'$'\n' "
|
||||
done
|
||||
|
||||
# Check for the include directory.
|
||||
if [ ! -d "$DIST_INCLUDE" ]; then
|
||||
echo "$DIST_INCLUDE: directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We need to use 'eval' here to make MAP_GECKO_STRUCTS evaluate properly as
|
||||
# multiple arguments.
|
||||
#
|
||||
# Uncomment the following line to run rust-bindgen in a debugger on mac.
|
||||
# The absolute path is required to allow launching lldb with an untrusted
|
||||
# library in DYLD_LIBRARY_PATH.
|
||||
#
|
||||
# /Applications/Xcode.app/Contents/Developer/usr/bin/lldb --
|
||||
./rust-bindgen/target/debug/bindgen \
|
||||
eval ./rust-bindgen/target/debug/bindgen \
|
||||
-x c++ -std=gnu++0x \
|
||||
"-I$DIST_INCLUDE" \
|
||||
-o ../bindings.rs \
|
||||
|
@ -39,3 +55,4 @@ fi
|
|||
"$DIST_INCLUDE/mozilla/ServoBindings.h" \
|
||||
-match "ServoBindings.h" \
|
||||
-match "nsStyleStructList.h" \
|
||||
$MAP_GECKO_STRUCTS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue