From 0128e985f60c31f42d93f2d7c4e2c781691836cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 4 Mar 2016 22:51:17 +0100 Subject: [PATCH 01/15] geckolib: export LD_LIBRARY_PATH for linux --- ports/geckolib/tools/regen_bindings.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/geckolib/tools/regen_bindings.sh b/ports/geckolib/tools/regen_bindings.sh index 157877b0c72..32b36b3b59d 100755 --- a/ports/geckolib/tools/regen_bindings.sh +++ b/ports/geckolib/tools/regen_bindings.sh @@ -17,6 +17,7 @@ fi export RUST_BACKTRACE=1 export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib 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 # Check for the include directory. From 38b30c64904cb4ccdabd96c3cc607b3fa6fde0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 5 Mar 2016 01:29:52 +0100 Subject: [PATCH 02/15] geckolib: Don't hardcode library paths It feels like a hack but it's supposed to work in any clang... --- ports/geckolib/tools/regen_style_structs.sh | 24 ++++++++++++++------- ports/geckolib/tools/setup_bindgen.sh | 18 ++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ports/geckolib/tools/regen_style_structs.sh b/ports/geckolib/tools/regen_style_structs.sh index b8d84651ebb..73dbe75b987 100755 --- a/ports/geckolib/tools/regen_style_structs.sh +++ b/ports/geckolib/tools/regen_style_structs.sh @@ -15,17 +15,22 @@ if [ ! -d rust-bindgen ]; then fi # Need to find a way to avoid hardcoding these -STD_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include -STDXX_LIB_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -if [ ! -d $STD_LIB_PATH ] || [ ! -d $STDXX_LIB_PATH ]; then - echo "Please update the above environmental variables to point to your standard library." - exit 1 -fi - export RUST_BACKTRACE=1 export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib 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 +CLANG_SEARCH_DIRS=$(clang++ -print-search-dirs | grep 'libraries: ' | cut -d = -f 2) +CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \ + if ($0 == "#include <...> search starts here:") \ + in_headers = 1; \ + else if ($0 == "End of search list.") \ + in_headers = 0; \ + else if (in_headers == 1) { \ + gsub(/^[ \t]+/, "", $0); \ + printf " -isystem %s", $0; \ + } +}' | sed -e s/:$//g) # Check for the include directory. if [ ! -d $DIST_INCLUDE ]; then @@ -38,4 +43,7 @@ fi # library in DYLD_LIBRARY_PATH. # # /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- -./rust-bindgen/target/debug/bindgen -x c++ -std=gnu++0x -ignore-functions -allow-unknown-types -isystem $STDXX_LIB_PATH -isystem $STD_LIB_PATH -I$DIST_INCLUDE -I$DIST_INCLUDE/nspr -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 -DOS_MACOSX=1 -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -include $1/mozilla-config.h -o ../gecko_style_structs.rs $DIST_INCLUDE/nsStyleStruct.h +./rust-bindgen/target/debug/bindgen -x c++ -std=gnu++0x -ignore-functions -allow-unknown-types \ + $CLANG_SEARCH_DIRS \ + -I$DIST_INCLUDE -I$DIST_INCLUDE/nspr -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 -DOS_MACOSX=1 -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL \ + -include $1/mozilla-config.h -o ../gecko_style_structs.rs $DIST_INCLUDE/nsStyleStruct.h diff --git a/ports/geckolib/tools/setup_bindgen.sh b/ports/geckolib/tools/setup_bindgen.sh index d1fae60f6ae..d33c4d5ab88 100755 --- a/ports/geckolib/tools/setup_bindgen.sh +++ b/ports/geckolib/tools/setup_bindgen.sh @@ -9,12 +9,6 @@ if [ ! -d llvm ]; then exit 1 fi -# Don't run twice. -if [ -d rust-bindgen ]; then - echo "rust-bindgen directory already exists." - exit 1 -fi - # Check for multirust if [ ! -x "$(command -v multirust)" ]; then echo 'multirust must be installed.' @@ -23,8 +17,14 @@ fi # Setup and build bindgen. export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib -git clone https://github.com/bholley/rust-bindgen.git -cd rust-bindgen -git checkout sm-hacks +# Don't run twice. +if [ ! -d rust-bindgen ]; then + git clone https://github.com/bholley/rust-bindgen.git + cd rust-bindgen + git checkout sm-hacks +else + cd rust-bindgen +fi + multirust override nightly cargo build From a6ffabb2ad135b8e3f7d0d14c3cc2e5b1faca834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 5 Mar 2016 01:56:22 +0100 Subject: [PATCH 03/15] geckolib: Add basic documentation, be consistent and safe with quotes --- ports/geckolib/tools/.gitignore | 2 + ports/geckolib/tools/README.md | 30 +++++++++++++++ ports/geckolib/tools/build_custom_clang.sh | 2 +- ports/geckolib/tools/regen_bindings.sh | 20 ++++++---- ports/geckolib/tools/regen_style_structs.sh | 41 ++++++++++++++------- ports/geckolib/tools/setup_bindgen.sh | 14 ++++--- 6 files changed, 80 insertions(+), 29 deletions(-) create mode 100644 ports/geckolib/tools/.gitignore create mode 100644 ports/geckolib/tools/README.md diff --git a/ports/geckolib/tools/.gitignore b/ports/geckolib/tools/.gitignore new file mode 100644 index 00000000000..ba50cb6cd5d --- /dev/null +++ b/ports/geckolib/tools/.gitignore @@ -0,0 +1,2 @@ +llvm/ +rust-bindgen/ diff --git a/ports/geckolib/tools/README.md b/ports/geckolib/tools/README.md new file mode 100644 index 00000000000..f920c75c85b --- /dev/null +++ b/ports/geckolib/tools/README.md @@ -0,0 +1,30 @@ +# GeckoLib tools + +This directory contains mostly simple tools for working with +[stylo](https://public.etherpad-mozilla.org/p/stylo). + +Some scripts require [multirust](https://github.com/brson/multirust) in order to +work. + +You can see a description of them below. + +## `build_custom_clang.sh` + +Download a patched LLVM which is needed to use bindgen properly with C++. + +## `setup_bindgen.sh` + +This uses downloads a custom version of bindgen, up to date to generate the +bindings, and uses the custom `clang` to build it. + +It will also rebuild it if it's already downloaded. + +## `regen_bindings.sh` + +This will regenerate the bindings for the `ServoBindings.h` file in your gecko +build (which are in `ports/geckolib/bindings.rs`). + +## `regen_style_structs.sh` + +This will generate the bindings for Gecko's style structs. These bindings are a +work in progress, and are not in master yet. diff --git a/ports/geckolib/tools/build_custom_clang.sh b/ports/geckolib/tools/build_custom_clang.sh index 40b3c86f5aa..7bf98741060 100755 --- a/ports/geckolib/tools/build_custom_clang.sh +++ b/ports/geckolib/tools/build_custom_clang.sh @@ -1,7 +1,7 @@ #!/bin/bash # Run in the tools directory. -cd `dirname $0` +cd "$(dirname $0)" # Don't run twice. if [ -d llvm ]; then diff --git a/ports/geckolib/tools/regen_bindings.sh b/ports/geckolib/tools/regen_bindings.sh index 32b36b3b59d..ed99d5904a3 100755 --- a/ports/geckolib/tools/regen_bindings.sh +++ b/ports/geckolib/tools/regen_bindings.sh @@ -1,10 +1,10 @@ #!/bin/bash # Run in the tools directory. -cd `dirname $0` +cd "$(dirname $0)" if [ $# -ne 1 ]; then - echo "Usage: $0 /path/to/objdir/" + echo "Usage: $0 /path/to/gecko/objdir" exit 1 fi @@ -15,13 +15,13 @@ if [ ! -d rust-bindgen ]; then fi export RUST_BACKTRACE=1 -export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib -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 +export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib" +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" # Check for the include directory. -if [ ! -d $DIST_INCLUDE ]; then +if [ ! -d "$DIST_INCLUDE" ]; then echo "$DIST_INCLUDE: directory not found" exit 1 fi @@ -31,4 +31,8 @@ fi # library in DYLD_LIBRARY_PATH. # # /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -- -./rust-bindgen/target/debug/bindgen -x c++ -std=gnu++0x -I$DIST_INCLUDE -o ../bindings.rs $DIST_INCLUDE/mozilla/ServoBindings.h +./rust-bindgen/target/debug/bindgen \ + -x c++ -std=gnu++0x \ + "-I$DIST_INCLUDE" \ + -o ../bindings.rs \ + "$DIST_INCLUDE/mozilla/ServoBindings.h" diff --git a/ports/geckolib/tools/regen_style_structs.sh b/ports/geckolib/tools/regen_style_structs.sh index 73dbe75b987..5e0bdd45afa 100755 --- a/ports/geckolib/tools/regen_style_structs.sh +++ b/ports/geckolib/tools/regen_style_structs.sh @@ -4,7 +4,7 @@ cd `dirname $0` if [ $# -ne 1 ]; then - echo "Usage: $0 /path/to/objdir/" + echo "Usage: $0 /path/to/gecko/objdir" exit 1 fi @@ -16,11 +16,10 @@ fi # Need to find a way to avoid hardcoding these export RUST_BACKTRACE=1 -export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib -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 -CLANG_SEARCH_DIRS=$(clang++ -print-search-dirs | grep 'libraries: ' | cut -d = -f 2) +export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib" +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" CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \ if ($0 == "#include <...> search starts here:") \ in_headers = 1; \ @@ -33,17 +32,31 @@ CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \ }' | sed -e s/:$//g) # Check for the include directory. -if [ ! -d $DIST_INCLUDE ]; then +if [ ! -d "$DIST_INCLUDE" ]; then echo "$DIST_INCLUDE: directory not found" exit 1 fi -# 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. +PLATFORM_DEPENDENT_DEFINES=""; +if [ "$(uname)" == "Linux" ]; then + PLATFORM_DEPENDENT_DEFINES+="-DOS_LINUX"; +else + PLATFORM_DEPENDENT_DEFINES+="-DOS_MACOSX"; +fi + +# 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 -x c++ -std=gnu++0x -ignore-functions -allow-unknown-types \ - $CLANG_SEARCH_DIRS \ - -I$DIST_INCLUDE -I$DIST_INCLUDE/nspr -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 -DOS_MACOSX=1 -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL \ - -include $1/mozilla-config.h -o ../gecko_style_structs.rs $DIST_INCLUDE/nsStyleStruct.h +./rust-bindgen/target/debug/bindgen \ + -x c++ -std=gnu++0x \ + -ignore-functions -allow-unknown-types \ + $CLANG_SEARCH_DIRS \ + "-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \ + $PLATFORM_DEPENDENT_DEFINES \ + -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 \ + -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL \ + -include "$1/mozilla-config.h" \ + -o ../gecko_style_structs.rs \ + "$DIST_INCLUDE/nsStyleStruct.h" diff --git a/ports/geckolib/tools/setup_bindgen.sh b/ports/geckolib/tools/setup_bindgen.sh index d33c4d5ab88..ce3851daa1b 100755 --- a/ports/geckolib/tools/setup_bindgen.sh +++ b/ports/geckolib/tools/setup_bindgen.sh @@ -1,23 +1,25 @@ #!/bin/bash # Run in the tools directory. -cd `dirname $0` +cd "$(dirname $0)" + +# Setup and build bindgen. +export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib" + # Make sure we have a custom clang set up. -if [ ! -d llvm ]; then +if [ ! -d "$LIBCLANG_PATH" ]; then echo "Custom LLVM/Clang not found. Run build_custom_clang.sh first." exit 1 fi # Check for multirust if [ ! -x "$(command -v multirust)" ]; then - echo 'multirust must be installed.' + echo "multirust must be installed." exit 1 fi -# Setup and build bindgen. -export LIBCLANG_PATH=`pwd`/llvm/build/Release+Asserts/lib -# Don't run twice. +# Don't try to clone twice. if [ ! -d rust-bindgen ]; then git clone https://github.com/bholley/rust-bindgen.git cd rust-bindgen From 18b1cc68db8aa2f4cf58c67223184016c7745edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 5 Mar 2016 16:04:58 +0100 Subject: [PATCH 04/15] geckolib: Quote paths and remove things after the first non-preceding whitespace This should allow `regen_style_structs.sh` to run on mac, where a path like: /.../Frameworks (framework dir) was reported. --- ports/geckolib/tools/regen_style_structs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/geckolib/tools/regen_style_structs.sh b/ports/geckolib/tools/regen_style_structs.sh index 5e0bdd45afa..7d18fbbd28d 100755 --- a/ports/geckolib/tools/regen_style_structs.sh +++ b/ports/geckolib/tools/regen_style_structs.sh @@ -27,7 +27,8 @@ CLANG_SEARCH_DIRS=$(clang++ -E -x c++ - -v < /dev/null 2>&1 | awk '{ \ in_headers = 0; \ else if (in_headers == 1) { \ gsub(/^[ \t]+/, "", $0); \ - printf " -isystem %s", $0; \ + gsub(/[ \t].+$/, "", $0); \ + printf " -isystem \"%s\"", $0; \ } }' | sed -e s/:$//g) From 13d7b33a04023fb1f99ddbbeb911cc9a138b454f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 5 Mar 2016 18:18:22 +0100 Subject: [PATCH 05/15] geckolib: Define a few MOZ_* things to hack around more easily. --- ports/geckolib/tools/regen_style_structs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/geckolib/tools/regen_style_structs.sh b/ports/geckolib/tools/regen_style_structs.sh index 7d18fbbd28d..ab2e225609f 100755 --- a/ports/geckolib/tools/regen_style_structs.sh +++ b/ports/geckolib/tools/regen_style_structs.sh @@ -1,7 +1,7 @@ #!/bin/bash # Run in the tools directory. -cd `dirname $0` +cd "$(dirname $0)" if [ $# -ne 1 ]; then echo "Usage: $0 /path/to/gecko/objdir" @@ -56,6 +56,8 @@ fi $CLANG_SEARCH_DIRS \ "-I$DIST_INCLUDE" "-I$DIST_INCLUDE/nspr" \ $PLATFORM_DEPENDENT_DEFINES \ + -DMOZ_STRING_WITH_OBSOLETE_API=0 \ + -DMOZ_STYLO_BINDINGS=1 \ -DDEBUG=1 -DTRACING=1 -DOS_POSIX=1 \ -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL \ -include "$1/mozilla-config.h" \ From 706285123cb6741295f5edd6c1a4cb9871ad992c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 23 Mar 2016 02:40:45 +0100 Subject: [PATCH 06/15] geckolib: tools: Switch to llvm+clang 38 It also has our patches, and we'll benefit from improvements. --- ports/geckolib/tools/build_custom_clang.sh | 10 ++++------ ports/geckolib/tools/setup_bindgen.sh | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/geckolib/tools/build_custom_clang.sh b/ports/geckolib/tools/build_custom_clang.sh index 7bf98741060..541df798657 100755 --- a/ports/geckolib/tools/build_custom_clang.sh +++ b/ports/geckolib/tools/build_custom_clang.sh @@ -12,15 +12,13 @@ fi # Download and build a custom llvm git clone https://github.com/llvm-mirror/llvm cd llvm -git checkout release_37 +git checkout release_38 cd tools git clone https://github.com/llvm-mirror/clang cd clang -git remote add mwu https://github.com/michaelwu/clang -git fetch mwu -git checkout release_37_smhacks +git checkout release_38 cd ../.. # llvm root dir mkdir build cd build -../configure --enable-optimized -make +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. +make -j8 diff --git a/ports/geckolib/tools/setup_bindgen.sh b/ports/geckolib/tools/setup_bindgen.sh index ce3851daa1b..6a074537de9 100755 --- a/ports/geckolib/tools/setup_bindgen.sh +++ b/ports/geckolib/tools/setup_bindgen.sh @@ -4,7 +4,9 @@ cd "$(dirname $0)" # Setup and build bindgen. -export LIBCLANG_PATH="$(pwd)/llvm/build/Release+Asserts/lib" +export LIBCLANG_PATH="$(pwd)/llvm/build/lib" +export LD_LIBRARY_PATH="$(pwd)/llvm/build/lib" +export DYLD_LIBRARY_PATH="$(pwd)/llvm/build/lib" # Make sure we have a custom clang set up. From 3df2eaa4109dbbd5ef21ae2e035e59f1c03f9922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 8 Mar 2016 02:07:49 +0100 Subject: [PATCH 07/15] geckolib: Allow generating correct bindings for nsString Which is already a win! I'll keep moving into other style structs later. --- ports/geckolib/gecko_style_structs.rs | 891 ++++++++++++++++++++ ports/geckolib/tools/regen_style_structs.sh | 32 +- ports/geckolib/tools/setup_bindgen.sh | 4 +- 3 files changed, 921 insertions(+), 6 deletions(-) create mode 100644 ports/geckolib/gecko_style_structs.rs diff --git a/ports/geckolib/gecko_style_structs.rs b/ports/geckolib/gecko_style_structs.rs new file mode 100644 index 00000000000..abc265be2b4 --- /dev/null +++ b/ports/geckolib/gecko_style_structs.rs @@ -0,0 +1,891 @@ +/* automatically generated by rust-bindgen */ +#![feature(const_fn)] + +pub const NS_STYLE_INHERIT_MASK: u32 = 16777215; +pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: u32 = 16777216; +pub const NS_STYLE_HAS_PSEUDO_ELEMENT_DATA: u32 = 33554432; +pub const NS_STYLE_RELEVANT_LINK_VISITED: u32 = 67108864; +pub const NS_STYLE_IS_STYLE_IF_VISITED: u32 = 134217728; +pub const NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE: u32 = 268435456; +pub const NS_STYLE_IS_SHARED: u32 = 536870912; +pub const NS_STYLE_IS_GOING_AWAY: u32 = 1073741824; +pub const NS_STYLE_SUPPRESS_LINEBREAK: u32 = 2147483648; +pub const NS_STYLE_IN_DISPLAY_NONE_SUBTREE: u64 = 4294967296; +pub const NS_STYLE_INELIGIBLE_FOR_SHARING: u64 = 8589934592; +pub const NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE: u64 = 17179869184; +pub const NS_STYLE_CONTEXT_TYPE_SHIFT: u32 = 35; +pub const NS_RULE_NODE_IS_ANIMATION_RULE: u32 = 16777216; +pub const NS_RULE_NODE_GC_MARK: u32 = 33554432; +pub const NS_RULE_NODE_USED_DIRECTLY: u32 = 67108864; +pub const NS_RULE_NODE_IS_IMPORTANT: u32 = 134217728; +pub const NS_RULE_NODE_LEVEL_MASK: u32 = 4026531840; +pub const NS_RULE_NODE_LEVEL_SHIFT: u32 = 28; +pub const NS_RULE_NODE_HAS_ANIMATION_DATA: u32 = 2147483648; +pub const BORDER_COLOR_FOREGROUND: u32 = 32; +pub const OUTLINE_COLOR_INITIAL: u32 = 128; +pub const BORDER_COLOR_SPECIAL: u32 = 160; +pub const BORDER_STYLE_MASK: u32 = 31; +pub const NS_SPACING_MARGIN: u32 = 0; +pub const NS_SPACING_PADDING: u32 = 1; +pub const NS_SPACING_BORDER: u32 = 2; +pub enum nsIFrame { } +pub enum nsStyleContext { } +pub enum nsTextFrame { } +pub enum imgIContainer { } +#[repr(i32)] +#[derive(Copy, Clone)] +pub enum nsStyleStructID { + nsStyleStructID_None = -1, + nsStyleStructID_Inherited_Start = 0, + nsStyleStructID_DUMMY1 = -1, + eStyleStruct_Font = 0, + eStyleStruct_Color = 1, + eStyleStruct_List = 2, + eStyleStruct_Text = 3, + eStyleStruct_Visibility = 4, + eStyleStruct_Quotes = 5, + eStyleStruct_UserInterface = 6, + eStyleStruct_TableBorder = 7, + eStyleStruct_SVG = 8, + eStyleStruct_Variables = 9, + nsStyleStructID_Reset_Start = 10, + nsStyleStructID_DUMMY2 = 9, + eStyleStruct_Background = 10, + eStyleStruct_Position = 11, + eStyleStruct_TextReset = 12, + eStyleStruct_Display = 13, + eStyleStruct_Content = 14, + eStyleStruct_UIReset = 15, + eStyleStruct_Table = 16, + eStyleStruct_Margin = 17, + eStyleStruct_Padding = 18, + eStyleStruct_Border = 19, + eStyleStruct_Outline = 20, + eStyleStruct_XUL = 21, + eStyleStruct_SVGReset = 22, + eStyleStruct_Column = 23, + nsStyleStructID_Length = 24, + nsStyleStructID_Inherited_Count = 10, + nsStyleStructID_Reset_Count = 14, +} +pub type nsStyleStructID_size_t = i32; +#[repr(C)] +pub struct nsStyleFont { + pub mFont: nsFont, + pub mSize: nscoord, + pub mGenericID: uint8_t, + pub mScriptLevel: int8_t, + pub mMathVariant: uint8_t, + pub mMathDisplay: uint8_t, + pub mMinFontSizeRatio: uint8_t, + pub mExplicitLanguage: bool, + pub mAllowZoom: bool, + pub mScriptUnconstrainedSize: nscoord, + pub mScriptMinSize: nscoord, + pub mScriptSizeMultiplier: f32, + pub mLanguage: nsCOMPtr, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct nsStyleGradientStop { + pub mLocation: nsStyleCoord, + pub mColor: nscolor, + pub mIsInterpolationHint: bool, +} +#[repr(C)] +pub struct nsStyleGradient { + pub mShape: uint8_t, + pub mSize: uint8_t, + pub mRepeating: bool, + pub mLegacySyntax: bool, + pub mBgPosX: nsStyleCoord, + pub mBgPosY: nsStyleCoord, + pub mAngle: nsStyleCoord, + pub mRadiusX: nsStyleCoord, + pub mRadiusY: nsStyleCoord, + pub mStops: nsTArray, + pub mRefCnt: nsAutoRefCnt, + pub _mOwningThread: nsAutoOwningThread, +} +#[repr(i32)] +#[derive(Copy, Clone)] +pub enum nsStyleImageType { + eStyleImageType_Null = 0, + eStyleImageType_Image = 1, + eStyleImageType_Gradient = 2, + eStyleImageType_Element = 3, +} +/** + * Represents a paintable image of one of the following types. + * (1) A real image loaded from an external source. + * (2) A CSS linear or radial gradient. + * (3) An element within a document, or an ,