mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
Auto merge of #12815 - emilio:stylo-atoms, r=bholley
stylo: Use atoms as the pseudo-element back-end. <!-- Please describe your changes on the following line: --> A bit of work left, and we can uber-optimize this (left comments, will fill follow-ups), but this is a decent refactor so I thought I'd rather get some feedback on it. r? @bholley (not formally yet, maybe, but some feedback is appreciated). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because geckolib only... <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/12815) <!-- Reviewable:end -->
This commit is contained in:
commit
c386a3c881
17 changed files with 11499 additions and 9875 deletions
|
@ -13,6 +13,8 @@ import copy
|
|||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import regen_atoms
|
||||
|
||||
DESCRIPTION = 'Regenerate the rust version of the structs or the bindings file.'
|
||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
COMMON_BUILD_KEY = "__common__"
|
||||
|
@ -22,7 +24,7 @@ COMPILATION_TARGETS = {
|
|||
COMMON_BUILD_KEY: {
|
||||
"flags": [
|
||||
"-x", "c++", "-std=c++14",
|
||||
"-allow-unknown-types", "-no-bitfield-methods",
|
||||
"-allow-unknown-types", "-no-unstable-rust",
|
||||
"-no-type-renaming", "-no-namespaced-constants",
|
||||
"-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1",
|
||||
"-DMOZILLA_INTERNAL_API", "-DRUST_BINDGEN",
|
||||
|
@ -38,9 +40,11 @@ COMPILATION_TARGETS = {
|
|||
},
|
||||
# Generation of style structs.
|
||||
"structs": {
|
||||
"target_dir": "../gecko_bindings",
|
||||
"test": True,
|
||||
"flags": [
|
||||
"-ignore-functions",
|
||||
"-ignore-methods",
|
||||
],
|
||||
"includes": [
|
||||
"{}/dist/include/nsThemeConstants.h",
|
||||
|
@ -108,6 +112,7 @@ COMPILATION_TARGETS = {
|
|||
},
|
||||
# Generation of the ffi bindings.
|
||||
"bindings": {
|
||||
"target_dir": "../gecko_bindings",
|
||||
"raw_lines": [
|
||||
"use heapsize::HeapSizeOf;",
|
||||
],
|
||||
|
@ -140,6 +145,10 @@ COMPILATION_TARGETS = {
|
|||
"void_types": [
|
||||
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
|
||||
],
|
||||
},
|
||||
|
||||
"atoms": {
|
||||
"custom_build": regen_atoms.build,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +221,17 @@ def build(objdir, target_name, kind_name=None,
|
|||
assert ((kind_name is None and "build_kinds" not in current_target) or
|
||||
(kind_name in current_target["build_kinds"]))
|
||||
|
||||
if "custom_build" in current_target:
|
||||
print("[CUSTOM] {}::{} in \"{}\"... ".format(target_name, kind_name, objdir), end='')
|
||||
sys.stdout.flush()
|
||||
ret = current_target["custom_build"](objdir, verbose=True)
|
||||
if ret != 0:
|
||||
print("FAIL")
|
||||
else:
|
||||
print("OK")
|
||||
|
||||
return ret
|
||||
|
||||
if bindgen is None:
|
||||
bindgen = os.path.join(TOOLS_DIR, "rust-bindgen")
|
||||
|
||||
|
@ -221,18 +241,23 @@ def build(objdir, target_name, kind_name=None,
|
|||
else:
|
||||
bindgen = [bindgen]
|
||||
|
||||
if output_filename is None:
|
||||
filename = "{}.rs".format(target_name)
|
||||
|
||||
if kind_name is not None:
|
||||
filename = "{}_{}.rs".format(target_name, kind_name)
|
||||
|
||||
output_filename = "{}/../{}".format(TOOLS_DIR, filename)
|
||||
|
||||
if kind_name is not None:
|
||||
current_target = copy.deepcopy(current_target)
|
||||
extend_object(current_target, current_target["build_kinds"][kind_name])
|
||||
|
||||
target_dir = None
|
||||
if output_filename is None and "target_dir" in current_target:
|
||||
target_dir = current_target["target_dir"]
|
||||
|
||||
if output_filename is None:
|
||||
output_filename = "{}.rs".format(target_name)
|
||||
|
||||
if kind_name is not None:
|
||||
output_filename = "{}_{}.rs".format(target_name, kind_name)
|
||||
|
||||
if target_dir:
|
||||
output_filename = "{}/{}".format(target_dir, output_filename)
|
||||
|
||||
print("[BINDGEN] {}::{} in \"{}\"... ".format(target_name, kind_name, objdir), end='')
|
||||
sys.stdout.flush()
|
||||
|
194
ports/geckolib/binding_tools/regen_atoms.py
Executable file
194
ports/geckolib/binding_tools/regen_atoms.py
Executable file
|
@ -0,0 +1,194 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import re
|
||||
import os
|
||||
|
||||
|
||||
def gnu_symbolify(source, ident):
|
||||
return "_ZN" + str(len(source.CLASS)) + source.CLASS + str(len(ident)) + ident + "E"
|
||||
|
||||
|
||||
def msvc64_symbolify(source, ident):
|
||||
return "?" + ident + "@" + source.CLASS + "@@2PEAV" + source.TYPE + "@@EA"
|
||||
|
||||
|
||||
def msvc32_symbolify(source, ident):
|
||||
return "?" + ident + "@" + source.CLASS + "@@2PAV" + source.TYPE + "@@A"
|
||||
|
||||
|
||||
class GkAtomSource:
|
||||
PATTERN = re.compile('^GK_ATOM\((.+),\s*"(.*)"\)')
|
||||
FILE = "dist/include/nsGkAtomList.h"
|
||||
CLASS = "nsGkAtoms"
|
||||
TYPE = "nsIAtom"
|
||||
|
||||
|
||||
class CSSPseudoElementsAtomSource:
|
||||
PATTERN = re.compile('^CSS_PSEUDO_ELEMENT\((.+),\s*"(.*)",')
|
||||
FILE = "dist/include/nsCSSPseudoElementList.h"
|
||||
CLASS = "nsCSSPseudoElements"
|
||||
# NB: nsICSSPseudoElement is effectively the same as a nsIAtom, but we need
|
||||
# this for MSVC name mangling.
|
||||
TYPE = "nsICSSPseudoElement"
|
||||
|
||||
|
||||
class CSSAnonBoxesAtomSource:
|
||||
PATTERN = re.compile('^CSS_ANON_BOX\((.+),\s*"(.*)"\)')
|
||||
FILE = "dist/include/nsCSSAnonBoxList.h"
|
||||
CLASS = "nsCSSAnonBoxes"
|
||||
TYPE = "nsICSSAnonBoxPseudo"
|
||||
|
||||
|
||||
SOURCES = [
|
||||
GkAtomSource,
|
||||
CSSPseudoElementsAtomSource,
|
||||
CSSAnonBoxesAtomSource,
|
||||
]
|
||||
|
||||
|
||||
def map_atom(ident):
|
||||
if ident in {"box", "loop", "match", "mod", "ref",
|
||||
"self", "type", "use", "where", "in"}:
|
||||
return ident + "_"
|
||||
return ident
|
||||
|
||||
|
||||
class Atom:
|
||||
def __init__(self, source, ident, value):
|
||||
self.ident = "{}_{}".format(source.CLASS, ident)
|
||||
self._original_ident = ident
|
||||
self.value = value
|
||||
self.source = source
|
||||
|
||||
def cpp_class(self):
|
||||
return self.source.CLASS
|
||||
|
||||
def gnu_symbol(self):
|
||||
return gnu_symbolify(self.source, self._original_ident)
|
||||
|
||||
def msvc32_symbol(self):
|
||||
return msvc32_symbolify(self.source, self._original_ident)
|
||||
|
||||
def msvc64_symbol(self):
|
||||
return msvc64_symbolify(self.source, self._original_ident)
|
||||
|
||||
def type(self):
|
||||
return self.source.TYPE
|
||||
|
||||
|
||||
def collect_atoms(objdir):
|
||||
atoms = []
|
||||
for source in SOURCES:
|
||||
with open(os.path.join(objdir, source.FILE)) as f:
|
||||
for line in f.readlines():
|
||||
result = re.match(source.PATTERN, line)
|
||||
if result:
|
||||
atoms.append(Atom(source, result.group(1), result.group(2)))
|
||||
return atoms
|
||||
|
||||
PRELUDE = """
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Autogenerated file, DO NOT EDIT DIRECTLY */
|
||||
"""[1:]
|
||||
|
||||
|
||||
def write_atom_macro(atoms, file_name):
|
||||
ATOM_TEMPLATE = """
|
||||
#[link_name = "{link_name}"]
|
||||
pub static {name}: *mut {type};
|
||||
"""[1:]
|
||||
|
||||
def write_items(f, func):
|
||||
f.write(" extern {\n")
|
||||
for atom in atoms:
|
||||
f.write(ATOM_TEMPLATE.format(name=atom.ident,
|
||||
link_name=func(atom),
|
||||
type=atom.type()))
|
||||
f.write(" }\n")
|
||||
|
||||
with open(file_name, "wb") as f:
|
||||
f.write(PRELUDE)
|
||||
f.write("use gecko_bindings::structs::nsIAtom;\n\n")
|
||||
f.write("use Atom;\n\n")
|
||||
for source in SOURCES:
|
||||
if source.TYPE != "nsIAtom":
|
||||
f.write("pub enum {} {{}}\n\n".format(source.TYPE))
|
||||
f.write("""
|
||||
#[inline(always)] pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {
|
||||
unsafe { Atom::from_static(ptr) }
|
||||
}\n\n
|
||||
""")
|
||||
f.write("cfg_if! {\n")
|
||||
f.write(" if #[cfg(not(target_env = \"msvc\"))] {\n")
|
||||
write_items(f, Atom.gnu_symbol)
|
||||
f.write(" } else if #[cfg(target_pointer_width = \"64\")] {\n")
|
||||
write_items(f, Atom.msvc64_symbol)
|
||||
f.write(" } else {\n")
|
||||
write_items(f, Atom.msvc32_symbol)
|
||||
f.write(" }\n")
|
||||
f.write("}\n\n")
|
||||
f.write("#[macro_export]\n")
|
||||
f.write("macro_rules! atom {\n")
|
||||
f.writelines(['("%s") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::%s as *mut _) };\n'
|
||||
% (atom.value, atom.ident) for atom in atoms])
|
||||
f.write("}\n")
|
||||
|
||||
|
||||
PSEUDO_ELEMENT_HEADER = """
|
||||
/*
|
||||
* This file contains a helper macro invocation to aid Gecko's style system
|
||||
* pseudo-element integration.
|
||||
*
|
||||
* This file is NOT INTENDED to be compiled as a standalone module.
|
||||
*
|
||||
* Also, it guarantees the property that normal pseudo-elements are processed
|
||||
* before anonymous boxes.
|
||||
*
|
||||
* Expected usage is as follows:
|
||||
*
|
||||
* ```
|
||||
* fn have_to_use_pseudo_elements() {
|
||||
* macro_rules pseudo_element! {
|
||||
* ($pseudo_str_with_colon:expr, $pseudo_atom:expr, $is_anon_box:true) => {{
|
||||
* // Stuff stuff stuff.
|
||||
* }}
|
||||
* }
|
||||
* include!("path/to/helper.rs")
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
"""
|
||||
|
||||
PSEUDO_ELEMENT_MACRO_INVOCATION = """
|
||||
pseudo_element!(\"{}\",
|
||||
atom!(\"{}\"),
|
||||
{});
|
||||
"""[1:]
|
||||
|
||||
|
||||
def write_pseudo_element_helper(atoms, target_filename):
|
||||
with open(target_filename, "wb") as f:
|
||||
f.write(PRELUDE)
|
||||
f.write(PSEUDO_ELEMENT_HEADER)
|
||||
f.write("{\n")
|
||||
for atom in atoms:
|
||||
if atom.type() == "nsICSSPseudoElement":
|
||||
f.write(PSEUDO_ELEMENT_MACRO_INVOCATION.format(atom.value, atom.value, "false"))
|
||||
elif atom.type() == "nsICSSAnonBoxPseudo":
|
||||
f.write(PSEUDO_ELEMENT_MACRO_INVOCATION.format(atom.value, atom.value, "true"))
|
||||
f.write("}\n")
|
||||
|
||||
|
||||
def build(objdir, verbose=False):
|
||||
atoms = collect_atoms(objdir)
|
||||
write_atom_macro(atoms, "../string_cache/atom_macro.rs")
|
||||
write_pseudo_element_helper(atoms, "../../../components/style/generated/gecko_pseudo_element_helper.rs")
|
||||
return 0
|
|
@ -181,6 +181,7 @@ pub const NS_ERROR_MODULE_DOM_BLUETOOTH: ::std::os::raw::c_uint = 37;
|
|||
pub const NS_ERROR_MODULE_SIGNED_APP: ::std::os::raw::c_uint = 38;
|
||||
pub const NS_ERROR_MODULE_DOM_ANIM: ::std::os::raw::c_uint = 39;
|
||||
pub const NS_ERROR_MODULE_DOM_PUSH: ::std::os::raw::c_uint = 40;
|
||||
pub const NS_ERROR_MODULE_DOM_MEDIA: ::std::os::raw::c_uint = 41;
|
||||
pub const NS_ERROR_MODULE_GENERAL: ::std::os::raw::c_uint = 51;
|
||||
pub const NS_ERROR_SEVERITY_SUCCESS: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_ERROR_SEVERITY_ERROR: ::std::os::raw::c_uint = 1;
|
||||
|
@ -188,6 +189,12 @@ pub const NS_ERROR_MODULE_BASE_OFFSET: ::std::os::raw::c_uint = 69;
|
|||
pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1;
|
||||
pub const NSID_LENGTH: ::std::os::raw::c_uint = 39;
|
||||
pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2;
|
||||
pub const _STL_PAIR_H: ::std::os::raw::c_uint = 1;
|
||||
pub const _GLIBCXX_UTILITY: ::std::os::raw::c_uint = 1;
|
||||
pub const __cpp_lib_tuple_element_t: ::std::os::raw::c_uint = 201402;
|
||||
pub const __cpp_lib_tuples_by_type: ::std::os::raw::c_uint = 201304;
|
||||
pub const __cpp_lib_exchange_function: ::std::os::raw::c_uint = 201304;
|
||||
pub const __cpp_lib_integer_sequence: ::std::os::raw::c_uint = 201304;
|
||||
pub const NS_EVENT_STATE_HIGHEST_SERVO_BIT: ::std::os::raw::c_uint = 6;
|
||||
pub const DOM_USER_DATA: ::std::os::raw::c_uint = 1;
|
||||
pub const SMIL_MAPPED_ATTR_ANIMVAL: ::std::os::raw::c_uint = 2;
|
||||
|
@ -206,17 +213,6 @@ pub const NS_CORNER_BOTTOM_RIGHT_X: ::std::os::raw::c_uint = 4;
|
|||
pub const NS_CORNER_BOTTOM_RIGHT_Y: ::std::os::raw::c_uint = 5;
|
||||
pub const NS_CORNER_BOTTOM_LEFT_X: ::std::os::raw::c_uint = 6;
|
||||
pub const NS_CORNER_BOTTOM_LEFT_Y: ::std::os::raw::c_uint = 7;
|
||||
pub const NS_STYLE_USER_SELECT_NONE: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_STYLE_USER_SELECT_TEXT: ::std::os::raw::c_uint = 1;
|
||||
pub const NS_STYLE_USER_SELECT_ELEMENT: ::std::os::raw::c_uint = 2;
|
||||
pub const NS_STYLE_USER_SELECT_ELEMENTS: ::std::os::raw::c_uint = 3;
|
||||
pub const NS_STYLE_USER_SELECT_ALL: ::std::os::raw::c_uint = 4;
|
||||
pub const NS_STYLE_USER_SELECT_TOGGLE: ::std::os::raw::c_uint = 5;
|
||||
pub const NS_STYLE_USER_SELECT_TRI_STATE: ::std::os::raw::c_uint = 6;
|
||||
pub const NS_STYLE_USER_SELECT_AUTO: ::std::os::raw::c_uint = 7;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_ALL: ::std::os::raw::c_uint = 8;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_NONE: ::std::os::raw::c_uint = 9;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_TEXT: ::std::os::raw::c_uint = 10;
|
||||
pub const NS_STYLE_USER_INPUT_NONE: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_STYLE_USER_INPUT_ENABLED: ::std::os::raw::c_uint = 1;
|
||||
pub const NS_STYLE_USER_INPUT_DISABLED: ::std::os::raw::c_uint = 2;
|
||||
|
@ -1237,6 +1233,7 @@ pub enum nsresult {
|
|||
NS_ERROR_DOM_UNKNOWN_ERR = -2142044130,
|
||||
NS_ERROR_DOM_DATA_ERR = -2142044129,
|
||||
NS_ERROR_DOM_OPERATION_ERR = -2142044128,
|
||||
NS_ERROR_DOM_NOT_ALLOWED_ERR = -2142044127,
|
||||
NS_ERROR_DOM_SECMAN_ERR = -2142043159,
|
||||
NS_ERROR_DOM_WRONG_TYPE_ERR = -2142043158,
|
||||
NS_ERROR_DOM_NOT_OBJECT_ERR = -2142043157,
|
||||
|
@ -1467,6 +1464,9 @@ pub enum nsresult {
|
|||
NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE = -2140340220,
|
||||
NS_ERROR_DOM_PUSH_INVALID_KEY_ERR = -2140340219,
|
||||
NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR = -2140340218,
|
||||
NS_ERROR_DOM_MEDIA_ABORT_ERR = -2140274687,
|
||||
NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR = -2140274686,
|
||||
NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR = -2140274685,
|
||||
NS_ERROR_DOWNLOAD_COMPLETE = -2139619327,
|
||||
NS_ERROR_DOWNLOAD_NOT_PARTIAL = -2139619326,
|
||||
NS_ERROR_UNORM_MOREOUTPUT = -2139619295,
|
||||
|
@ -2172,6 +2172,32 @@ pub struct nsTArrayHeader {
|
|||
pub mLength: u32,
|
||||
pub _bitfield_1: u32,
|
||||
}
|
||||
impl nsTArrayHeader {
|
||||
#[inline]
|
||||
pub fn mCapacity(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483647usize as u32)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mCapacity(&mut self, val: u32) {
|
||||
self._bitfield_1 &= !(2147483647usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 0usize) & (2147483647usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsAutoArray(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483648usize as u32)) >> 31usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsAutoArray(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2147483648usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 31usize) & (2147483648usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mCapacity: u32, mIsAutoArray: bool) -> u32 {
|
||||
0 | ((mCapacity as u32) << 0u32) | ((mIsAutoArray as u32) << 31u32)
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsTArrayHeader {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -2467,6 +2493,32 @@ pub struct nsIAtom {
|
|||
pub struct _vftable_nsIAtom {
|
||||
pub _base: _vftable_nsISupports,
|
||||
}
|
||||
impl nsIAtom {
|
||||
#[inline]
|
||||
pub fn mLength(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483647usize as u32)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mLength(&mut self, val: u32) {
|
||||
self._bitfield_1 &= !(2147483647usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 0usize) & (2147483647usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsStatic(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483648usize as u32)) >> 31usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsStatic(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2147483648usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 31usize) & (2147483648usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mLength: u32, mIsStatic: bool) -> u32 {
|
||||
0 | ((mLength as u32) << 0u32) | ((mIsStatic as u32) << 31u32)
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsIAtom {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -2745,6 +2797,12 @@ impl ::std::clone::Clone for nsIExpandedPrincipal {
|
|||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _Make_integer_sequence<_Tp, _ISeq> {
|
||||
pub _phantom0: ::std::marker::PhantomData<_Tp>,
|
||||
pub _phantom1: ::std::marker::PhantomData<_ISeq>,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct nsIURI {
|
||||
pub _base: nsISupports,
|
||||
|
@ -2796,7 +2854,7 @@ impl ::std::clone::Clone for nsIRequest {
|
|||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct EventStates {
|
||||
pub mStates: ::std::os::raw::c_ulonglong,
|
||||
pub mStates: ::std::os::raw::c_ulong,
|
||||
}
|
||||
impl ::std::clone::Clone for EventStates {
|
||||
fn clone(&self) -> Self { *self }
|
||||
|
@ -2926,7 +2984,7 @@ fn bindgen_test_layout_nsMutationGuard() {
|
|||
extern "C" {
|
||||
#[link_name = "_ZN15nsMutationGuard11sGenerationE"]
|
||||
pub static mut nsMutationGuard_consts_sGeneration:
|
||||
::std::os::raw::c_ulonglong;
|
||||
::std::os::raw::c_ulong;
|
||||
}
|
||||
pub type Float = f32;
|
||||
#[repr(i8)]
|
||||
|
@ -3980,6 +4038,20 @@ pub enum StyleUserFocus {
|
|||
SelectSame = 6,
|
||||
SelectMenu = 7,
|
||||
}
|
||||
#[repr(i8)]
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
||||
pub enum StyleUserSelect {
|
||||
None_ = 0,
|
||||
Text = 1,
|
||||
Element = 2,
|
||||
Elements = 3,
|
||||
All = 4,
|
||||
Toggle = 5,
|
||||
TriState = 6,
|
||||
Auto = 7,
|
||||
MozAll = 8,
|
||||
MozText = 9,
|
||||
}
|
||||
pub const eCSSProperty_COUNT_DUMMY: nsCSSProperty =
|
||||
nsCSSProperty::eCSSProperty_z_index;
|
||||
pub const eCSSProperty_all: nsCSSProperty =
|
||||
|
@ -4728,7 +4800,91 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_13 {
|
|||
pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsCSSValue_nsCSSValue_h_unnamed_13 { }
|
||||
impl nsCSSValue_nsCSSValue_h_unnamed_13 {
|
||||
pub unsafe fn mInt(&mut self) -> *mut i32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloat(&mut self) -> *mut f32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mString(&mut self) -> *mut *mut nsStringBuffer {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mColor(&mut self) -> *mut nscolor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mArray(&mut self) -> *mut *mut Array {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mURL(&mut self) -> *mut *mut URLValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut ImageValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGridTemplateAreas(&mut self)
|
||||
-> *mut *mut GridTemplateAreasValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGradient(&mut self) -> *mut *mut nsCSSValueGradient {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mTokenStream(&mut self) -> *mut *mut nsCSSValueTokenStream {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPair(&mut self) -> *mut *mut nsCSSValuePair_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mRect(&mut self) -> *mut *mut nsCSSRect_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mTriplet(&mut self) -> *mut *mut nsCSSValueTriplet_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mList(&mut self) -> *mut *mut nsCSSValueList_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mListDependent(&mut self) -> *mut *mut nsCSSValueList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mSharedList(&mut self) -> *mut *mut nsCSSValueSharedList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPairList(&mut self) -> *mut *mut nsCSSValuePairList_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPairListDependent(&mut self)
|
||||
-> *mut *mut nsCSSValuePairList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloatColor(&mut self) -> *mut *mut nsCSSValueFloatColor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFontFamilyList(&mut self)
|
||||
-> *mut *mut FontFamilyListRefCnt {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_13 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5190,7 +5346,20 @@ pub struct nsStyleCoord_h_unnamed_18 {
|
|||
pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleCoord_h_unnamed_18 { }
|
||||
impl nsStyleCoord_h_unnamed_18 {
|
||||
pub unsafe fn mInt(&mut self) -> *mut i32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloat(&mut self) -> *mut f32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPointer(&mut self) -> *mut *mut ::std::os::raw::c_void {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleCoord_h_unnamed_18 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5468,7 +5637,21 @@ pub struct nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
|||
pub mElementId: __BindgenUnionField<*mut ::std::os::raw::c_ushort>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleImage_nsStyleStruct_h_unnamed_21 { }
|
||||
impl nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut imgRequestProxy {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGradient(&mut self) -> *mut *mut nsStyleGradient {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mElementId(&mut self)
|
||||
-> *mut *mut ::std::os::raw::c_ushort {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5821,6 +6004,30 @@ pub struct nsStyleGridTemplate {
|
|||
pub mRepeatAutoIndex: i16,
|
||||
pub _bitfield_1: u8,
|
||||
}
|
||||
impl nsStyleGridTemplate {
|
||||
#[inline]
|
||||
pub fn mIsAutoFill(&self) -> u8 {
|
||||
(self._bitfield_1 & (1usize as u8)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsAutoFill(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(1usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 0usize) & (1usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsSubgrid(&self) -> u8 {
|
||||
(self._bitfield_1 & (2usize as u8)) >> 1usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsSubgrid(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 1usize) & (2usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mIsAutoFill: bool, mIsSubgrid: bool) -> u8 {
|
||||
0 | ((mIsAutoFill as u8) << 0u32) | ((mIsSubgrid as u8) << 1u32)
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_nsStyleGridTemplate() {
|
||||
assert_eq!(::std::mem::size_of::<nsStyleGridTemplate>() , 48usize);
|
||||
|
@ -5942,6 +6149,64 @@ pub struct nsStyleText {
|
|||
pub mTextShadow: RefPtr<nsCSSShadowArray>,
|
||||
pub mTextEmphasisStyleString: nsString,
|
||||
}
|
||||
impl nsStyleText {
|
||||
#[inline]
|
||||
pub fn mTextAlignTrue(&self) -> u8 {
|
||||
(self._bitfield_1 & (1usize as u8)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextAlignTrue(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(1usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 0usize) & (1usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mTextAlignLastTrue(&self) -> u8 {
|
||||
(self._bitfield_1 & (2usize as u8)) >> 1usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextAlignLastTrue(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 1usize) & (2usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mTextEmphasisColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (4usize as u8)) >> 2usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextEmphasisColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(4usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 2usize) & (4usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mWebkitTextFillColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (8usize as u8)) >> 3usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mWebkitTextFillColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(8usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 3usize) & (8usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mWebkitTextStrokeColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (16usize as u8)) >> 4usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mWebkitTextStrokeColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(16usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 4usize) & (16usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mTextAlignTrue: bool, mTextAlignLastTrue: bool,
|
||||
mTextEmphasisColorForeground: bool,
|
||||
mWebkitTextFillColorForeground: bool,
|
||||
mWebkitTextStrokeColorForeground: bool) -> u8 {
|
||||
0 | ((mTextAlignTrue as u8) << 0u32) |
|
||||
((mTextAlignLastTrue as u8) << 1u32) |
|
||||
((mTextEmphasisColorForeground as u8) << 2u32) |
|
||||
((mWebkitTextFillColorForeground as u8) << 3u32) |
|
||||
((mWebkitTextStrokeColorForeground as u8) << 4u32)
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_nsStyleText() {
|
||||
assert_eq!(::std::mem::size_of::<nsStyleText>() , 136usize);
|
||||
|
@ -6019,7 +6284,20 @@ pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
|||
pub nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25: __BindgenUnionField<nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25>,
|
||||
pub _bindgen_data_: [u32; 4usize],
|
||||
}
|
||||
impl nsTimingFunction_nsStyleStruct_h_unnamed_23 { }
|
||||
impl nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
||||
pub unsafe fn mFunc(&mut self)
|
||||
->
|
||||
*mut nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25(&mut self)
|
||||
->
|
||||
*mut nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6255,7 +6533,20 @@ pub struct nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
|||
pub mCounters: __BindgenUnionField<*mut Array>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleContentData_nsStyleStruct_h_unnamed_27 { }
|
||||
impl nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
||||
pub unsafe fn mString(&mut self) -> *mut *mut ::std::os::raw::c_ushort {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut imgRequestProxy {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mCounters(&mut self) -> *mut *mut Array {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6301,7 +6592,7 @@ fn bindgen_test_layout_nsStyleContent() {
|
|||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct nsStyleUIReset {
|
||||
pub mUserSelect: u8,
|
||||
pub mUserSelect: StyleUserSelect,
|
||||
pub mForceBrokenImageIcon: u8,
|
||||
pub mIMEMode: u8,
|
||||
pub mWindowDragging: u8,
|
||||
|
@ -6408,7 +6699,16 @@ pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
|||
pub mPaintServer: __BindgenUnionField<*mut FragmentOrURL>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 { }
|
||||
impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
||||
pub unsafe fn mColor(&mut self) -> *mut nscolor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPaintServer(&mut self) -> *mut *mut FragmentOrURL {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6479,7 +6779,16 @@ pub struct nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
|||
pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleFilter_nsStyleStruct_h_unnamed_30 { }
|
||||
impl nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
||||
pub unsafe fn mURL(&mut self) -> *mut *mut FragmentOrURL {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mDropShadow(&mut self) -> *mut *mut nsCSSShadowArray {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ pub const NS_ERROR_MODULE_DOM_BLUETOOTH: ::std::os::raw::c_uint = 37;
|
|||
pub const NS_ERROR_MODULE_SIGNED_APP: ::std::os::raw::c_uint = 38;
|
||||
pub const NS_ERROR_MODULE_DOM_ANIM: ::std::os::raw::c_uint = 39;
|
||||
pub const NS_ERROR_MODULE_DOM_PUSH: ::std::os::raw::c_uint = 40;
|
||||
pub const NS_ERROR_MODULE_DOM_MEDIA: ::std::os::raw::c_uint = 41;
|
||||
pub const NS_ERROR_MODULE_GENERAL: ::std::os::raw::c_uint = 51;
|
||||
pub const NS_ERROR_SEVERITY_SUCCESS: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_ERROR_SEVERITY_ERROR: ::std::os::raw::c_uint = 1;
|
||||
|
@ -188,6 +189,12 @@ pub const NS_ERROR_MODULE_BASE_OFFSET: ::std::os::raw::c_uint = 69;
|
|||
pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1;
|
||||
pub const NSID_LENGTH: ::std::os::raw::c_uint = 39;
|
||||
pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2;
|
||||
pub const _STL_PAIR_H: ::std::os::raw::c_uint = 1;
|
||||
pub const _GLIBCXX_UTILITY: ::std::os::raw::c_uint = 1;
|
||||
pub const __cpp_lib_tuple_element_t: ::std::os::raw::c_uint = 201402;
|
||||
pub const __cpp_lib_tuples_by_type: ::std::os::raw::c_uint = 201304;
|
||||
pub const __cpp_lib_exchange_function: ::std::os::raw::c_uint = 201304;
|
||||
pub const __cpp_lib_integer_sequence: ::std::os::raw::c_uint = 201304;
|
||||
pub const NS_EVENT_STATE_HIGHEST_SERVO_BIT: ::std::os::raw::c_uint = 6;
|
||||
pub const DOM_USER_DATA: ::std::os::raw::c_uint = 1;
|
||||
pub const SMIL_MAPPED_ATTR_ANIMVAL: ::std::os::raw::c_uint = 2;
|
||||
|
@ -206,17 +213,6 @@ pub const NS_CORNER_BOTTOM_RIGHT_X: ::std::os::raw::c_uint = 4;
|
|||
pub const NS_CORNER_BOTTOM_RIGHT_Y: ::std::os::raw::c_uint = 5;
|
||||
pub const NS_CORNER_BOTTOM_LEFT_X: ::std::os::raw::c_uint = 6;
|
||||
pub const NS_CORNER_BOTTOM_LEFT_Y: ::std::os::raw::c_uint = 7;
|
||||
pub const NS_STYLE_USER_SELECT_NONE: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_STYLE_USER_SELECT_TEXT: ::std::os::raw::c_uint = 1;
|
||||
pub const NS_STYLE_USER_SELECT_ELEMENT: ::std::os::raw::c_uint = 2;
|
||||
pub const NS_STYLE_USER_SELECT_ELEMENTS: ::std::os::raw::c_uint = 3;
|
||||
pub const NS_STYLE_USER_SELECT_ALL: ::std::os::raw::c_uint = 4;
|
||||
pub const NS_STYLE_USER_SELECT_TOGGLE: ::std::os::raw::c_uint = 5;
|
||||
pub const NS_STYLE_USER_SELECT_TRI_STATE: ::std::os::raw::c_uint = 6;
|
||||
pub const NS_STYLE_USER_SELECT_AUTO: ::std::os::raw::c_uint = 7;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_ALL: ::std::os::raw::c_uint = 8;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_NONE: ::std::os::raw::c_uint = 9;
|
||||
pub const NS_STYLE_USER_SELECT_MOZ_TEXT: ::std::os::raw::c_uint = 10;
|
||||
pub const NS_STYLE_USER_INPUT_NONE: ::std::os::raw::c_uint = 0;
|
||||
pub const NS_STYLE_USER_INPUT_ENABLED: ::std::os::raw::c_uint = 1;
|
||||
pub const NS_STYLE_USER_INPUT_DISABLED: ::std::os::raw::c_uint = 2;
|
||||
|
@ -1237,6 +1233,7 @@ pub enum nsresult {
|
|||
NS_ERROR_DOM_UNKNOWN_ERR = -2142044130,
|
||||
NS_ERROR_DOM_DATA_ERR = -2142044129,
|
||||
NS_ERROR_DOM_OPERATION_ERR = -2142044128,
|
||||
NS_ERROR_DOM_NOT_ALLOWED_ERR = -2142044127,
|
||||
NS_ERROR_DOM_SECMAN_ERR = -2142043159,
|
||||
NS_ERROR_DOM_WRONG_TYPE_ERR = -2142043158,
|
||||
NS_ERROR_DOM_NOT_OBJECT_ERR = -2142043157,
|
||||
|
@ -1467,6 +1464,9 @@ pub enum nsresult {
|
|||
NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE = -2140340220,
|
||||
NS_ERROR_DOM_PUSH_INVALID_KEY_ERR = -2140340219,
|
||||
NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR = -2140340218,
|
||||
NS_ERROR_DOM_MEDIA_ABORT_ERR = -2140274687,
|
||||
NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR = -2140274686,
|
||||
NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR = -2140274685,
|
||||
NS_ERROR_DOWNLOAD_COMPLETE = -2139619327,
|
||||
NS_ERROR_DOWNLOAD_NOT_PARTIAL = -2139619326,
|
||||
NS_ERROR_UNORM_MOREOUTPUT = -2139619295,
|
||||
|
@ -2172,6 +2172,32 @@ pub struct nsTArrayHeader {
|
|||
pub mLength: u32,
|
||||
pub _bitfield_1: u32,
|
||||
}
|
||||
impl nsTArrayHeader {
|
||||
#[inline]
|
||||
pub fn mCapacity(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483647usize as u32)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mCapacity(&mut self, val: u32) {
|
||||
self._bitfield_1 &= !(2147483647usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 0usize) & (2147483647usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsAutoArray(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483648usize as u32)) >> 31usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsAutoArray(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2147483648usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 31usize) & (2147483648usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mCapacity: u32, mIsAutoArray: bool) -> u32 {
|
||||
0 | ((mCapacity as u32) << 0u32) | ((mIsAutoArray as u32) << 31u32)
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsTArrayHeader {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -2468,6 +2494,32 @@ pub struct nsIAtom {
|
|||
pub struct _vftable_nsIAtom {
|
||||
pub _base: _vftable_nsISupports,
|
||||
}
|
||||
impl nsIAtom {
|
||||
#[inline]
|
||||
pub fn mLength(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483647usize as u32)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mLength(&mut self, val: u32) {
|
||||
self._bitfield_1 &= !(2147483647usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 0usize) & (2147483647usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsStatic(&self) -> u32 {
|
||||
(self._bitfield_1 & (2147483648usize as u32)) >> 31usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsStatic(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2147483648usize as u32);
|
||||
self._bitfield_1 |=
|
||||
((val as u32) << 31usize) & (2147483648usize as u32);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mLength: u32, mIsStatic: bool) -> u32 {
|
||||
0 | ((mLength as u32) << 0u32) | ((mIsStatic as u32) << 31u32)
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsIAtom {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -2724,6 +2776,12 @@ impl ::std::clone::Clone for nsIExpandedPrincipal {
|
|||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _Make_integer_sequence<_Tp, _ISeq> {
|
||||
pub _phantom0: ::std::marker::PhantomData<_Tp>,
|
||||
pub _phantom1: ::std::marker::PhantomData<_ISeq>,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct nsIURI {
|
||||
pub _base: nsISupports,
|
||||
|
@ -2775,7 +2833,7 @@ impl ::std::clone::Clone for nsIRequest {
|
|||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct EventStates {
|
||||
pub mStates: ::std::os::raw::c_ulonglong,
|
||||
pub mStates: ::std::os::raw::c_ulong,
|
||||
}
|
||||
impl ::std::clone::Clone for EventStates {
|
||||
fn clone(&self) -> Self { *self }
|
||||
|
@ -2905,7 +2963,7 @@ fn bindgen_test_layout_nsMutationGuard() {
|
|||
extern "C" {
|
||||
#[link_name = "_ZN15nsMutationGuard11sGenerationE"]
|
||||
pub static mut nsMutationGuard_consts_sGeneration:
|
||||
::std::os::raw::c_ulonglong;
|
||||
::std::os::raw::c_ulong;
|
||||
}
|
||||
pub type Float = f32;
|
||||
#[repr(i8)]
|
||||
|
@ -3959,6 +4017,20 @@ pub enum StyleUserFocus {
|
|||
SelectSame = 6,
|
||||
SelectMenu = 7,
|
||||
}
|
||||
#[repr(i8)]
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
||||
pub enum StyleUserSelect {
|
||||
None_ = 0,
|
||||
Text = 1,
|
||||
Element = 2,
|
||||
Elements = 3,
|
||||
All = 4,
|
||||
Toggle = 5,
|
||||
TriState = 6,
|
||||
Auto = 7,
|
||||
MozAll = 8,
|
||||
MozText = 9,
|
||||
}
|
||||
pub const eCSSProperty_COUNT_DUMMY: nsCSSProperty =
|
||||
nsCSSProperty::eCSSProperty_z_index;
|
||||
pub const eCSSProperty_all: nsCSSProperty =
|
||||
|
@ -4707,7 +4779,91 @@ pub struct nsCSSValue_nsCSSValue_h_unnamed_13 {
|
|||
pub mFontFamilyList: __BindgenUnionField<*mut FontFamilyListRefCnt>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsCSSValue_nsCSSValue_h_unnamed_13 { }
|
||||
impl nsCSSValue_nsCSSValue_h_unnamed_13 {
|
||||
pub unsafe fn mInt(&mut self) -> *mut i32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloat(&mut self) -> *mut f32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mString(&mut self) -> *mut *mut nsStringBuffer {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mColor(&mut self) -> *mut nscolor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mArray(&mut self) -> *mut *mut Array {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mURL(&mut self) -> *mut *mut URLValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut ImageValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGridTemplateAreas(&mut self)
|
||||
-> *mut *mut GridTemplateAreasValue {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGradient(&mut self) -> *mut *mut nsCSSValueGradient {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mTokenStream(&mut self) -> *mut *mut nsCSSValueTokenStream {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPair(&mut self) -> *mut *mut nsCSSValuePair_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mRect(&mut self) -> *mut *mut nsCSSRect_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mTriplet(&mut self) -> *mut *mut nsCSSValueTriplet_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mList(&mut self) -> *mut *mut nsCSSValueList_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mListDependent(&mut self) -> *mut *mut nsCSSValueList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mSharedList(&mut self) -> *mut *mut nsCSSValueSharedList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPairList(&mut self) -> *mut *mut nsCSSValuePairList_heap {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPairListDependent(&mut self)
|
||||
-> *mut *mut nsCSSValuePairList {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloatColor(&mut self) -> *mut *mut nsCSSValueFloatColor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFontFamilyList(&mut self)
|
||||
-> *mut *mut FontFamilyListRefCnt {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsCSSValue_nsCSSValue_h_unnamed_13 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5169,7 +5325,20 @@ pub struct nsStyleCoord_h_unnamed_18 {
|
|||
pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleCoord_h_unnamed_18 { }
|
||||
impl nsStyleCoord_h_unnamed_18 {
|
||||
pub unsafe fn mInt(&mut self) -> *mut i32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mFloat(&mut self) -> *mut f32 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPointer(&mut self) -> *mut *mut ::std::os::raw::c_void {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleCoord_h_unnamed_18 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5446,7 +5615,21 @@ pub struct nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
|||
pub mElementId: __BindgenUnionField<*mut ::std::os::raw::c_ushort>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleImage_nsStyleStruct_h_unnamed_21 { }
|
||||
impl nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut imgRequestProxy {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mGradient(&mut self) -> *mut *mut nsStyleGradient {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mElementId(&mut self)
|
||||
-> *mut *mut ::std::os::raw::c_ushort {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleImage_nsStyleStruct_h_unnamed_21 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -5799,6 +5982,30 @@ pub struct nsStyleGridTemplate {
|
|||
pub mRepeatAutoIndex: i16,
|
||||
pub _bitfield_1: u8,
|
||||
}
|
||||
impl nsStyleGridTemplate {
|
||||
#[inline]
|
||||
pub fn mIsAutoFill(&self) -> u8 {
|
||||
(self._bitfield_1 & (1usize as u8)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsAutoFill(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(1usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 0usize) & (1usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mIsSubgrid(&self) -> u8 {
|
||||
(self._bitfield_1 & (2usize as u8)) >> 1usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mIsSubgrid(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 1usize) & (2usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mIsAutoFill: bool, mIsSubgrid: bool) -> u8 {
|
||||
0 | ((mIsAutoFill as u8) << 0u32) | ((mIsSubgrid as u8) << 1u32)
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_nsStyleGridTemplate() {
|
||||
assert_eq!(::std::mem::size_of::<nsStyleGridTemplate>() , 48usize);
|
||||
|
@ -5920,6 +6127,64 @@ pub struct nsStyleText {
|
|||
pub mTextShadow: RefPtr<nsCSSShadowArray>,
|
||||
pub mTextEmphasisStyleString: nsString,
|
||||
}
|
||||
impl nsStyleText {
|
||||
#[inline]
|
||||
pub fn mTextAlignTrue(&self) -> u8 {
|
||||
(self._bitfield_1 & (1usize as u8)) >> 0usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextAlignTrue(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(1usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 0usize) & (1usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mTextAlignLastTrue(&self) -> u8 {
|
||||
(self._bitfield_1 & (2usize as u8)) >> 1usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextAlignLastTrue(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(2usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 1usize) & (2usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mTextEmphasisColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (4usize as u8)) >> 2usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mTextEmphasisColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(4usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 2usize) & (4usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mWebkitTextFillColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (8usize as u8)) >> 3usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mWebkitTextFillColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(8usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 3usize) & (8usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn mWebkitTextStrokeColorForeground(&self) -> u8 {
|
||||
(self._bitfield_1 & (16usize as u8)) >> 4usize
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_mWebkitTextStrokeColorForeground(&mut self, val: bool) {
|
||||
self._bitfield_1 &= !(16usize as u8);
|
||||
self._bitfield_1 |= ((val as u8) << 4usize) & (16usize as u8);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new_bitfield_1(mTextAlignTrue: bool, mTextAlignLastTrue: bool,
|
||||
mTextEmphasisColorForeground: bool,
|
||||
mWebkitTextFillColorForeground: bool,
|
||||
mWebkitTextStrokeColorForeground: bool) -> u8 {
|
||||
0 | ((mTextAlignTrue as u8) << 0u32) |
|
||||
((mTextAlignLastTrue as u8) << 1u32) |
|
||||
((mTextEmphasisColorForeground as u8) << 2u32) |
|
||||
((mWebkitTextFillColorForeground as u8) << 3u32) |
|
||||
((mWebkitTextStrokeColorForeground as u8) << 4u32)
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_nsStyleText() {
|
||||
assert_eq!(::std::mem::size_of::<nsStyleText>() , 136usize);
|
||||
|
@ -5997,7 +6262,20 @@ pub struct nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
|||
pub nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25: __BindgenUnionField<nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25>,
|
||||
pub _bindgen_data_: [u32; 4usize],
|
||||
}
|
||||
impl nsTimingFunction_nsStyleStruct_h_unnamed_23 { }
|
||||
impl nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
||||
pub unsafe fn mFunc(&mut self)
|
||||
->
|
||||
*mut nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_24 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25(&mut self)
|
||||
->
|
||||
*mut nsTimingFunction_nsStyleStruct_h_unnamed_23_nsStyleStruct_h_unnamed_25 {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsTimingFunction_nsStyleStruct_h_unnamed_23 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6232,7 +6510,20 @@ pub struct nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
|||
pub mCounters: __BindgenUnionField<*mut Array>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleContentData_nsStyleStruct_h_unnamed_27 { }
|
||||
impl nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
||||
pub unsafe fn mString(&mut self) -> *mut *mut ::std::os::raw::c_ushort {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mImage(&mut self) -> *mut *mut imgRequestProxy {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mCounters(&mut self) -> *mut *mut Array {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleContentData_nsStyleStruct_h_unnamed_27 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6278,7 +6569,7 @@ fn bindgen_test_layout_nsStyleContent() {
|
|||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct nsStyleUIReset {
|
||||
pub mUserSelect: u8,
|
||||
pub mUserSelect: StyleUserSelect,
|
||||
pub mForceBrokenImageIcon: u8,
|
||||
pub mIMEMode: u8,
|
||||
pub mWindowDragging: u8,
|
||||
|
@ -6385,7 +6676,16 @@ pub struct nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
|||
pub mPaintServer: __BindgenUnionField<*mut FragmentOrURL>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 { }
|
||||
impl nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
||||
pub unsafe fn mColor(&mut self) -> *mut nscolor {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mPaintServer(&mut self) -> *mut *mut FragmentOrURL {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleSVGPaint_nsStyleStruct_h_unnamed_28 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
@ -6456,7 +6756,16 @@ pub struct nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
|||
pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>,
|
||||
pub _bindgen_data_: u64,
|
||||
}
|
||||
impl nsStyleFilter_nsStyleStruct_h_unnamed_30 { }
|
||||
impl nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
||||
pub unsafe fn mURL(&mut self) -> *mut *mut FragmentOrURL {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
pub unsafe fn mDropShadow(&mut self) -> *mut *mut nsCSSShadowArray {
|
||||
let raw: *mut u8 = ::std::mem::transmute(&self._bindgen_data_);
|
||||
::std::mem::transmute(raw.offset(0))
|
||||
}
|
||||
}
|
||||
impl ::std::clone::Clone for nsStyleFilter_nsStyleStruct_h_unnamed_30 {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
|
|||
use gecko_bindings::structs::ServoElementSnapshot;
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use gecko_bindings::structs::{SheetParsingMode, nsIAtom};
|
||||
use gecko_string_cache::Atom;
|
||||
use snapshot::GeckoElementSnapshot;
|
||||
use std::mem::transmute;
|
||||
use std::ptr;
|
||||
|
@ -39,29 +40,6 @@ use traversal::RecalcStyleOnly;
|
|||
use url::Url;
|
||||
use wrapper::{DUMMY_BASE_URL, GeckoDocument, GeckoElement, GeckoNode, NonOpaqueStyleData};
|
||||
|
||||
// TODO: This is ugly and should go away once we get an atom back-end.
|
||||
pub fn pseudo_element_from_atom(pseudo: *mut nsIAtom,
|
||||
in_ua_stylesheet: bool) -> Result<PseudoElement, String> {
|
||||
use gecko_bindings::bindings::Gecko_GetAtomAsUTF16;
|
||||
use selectors::parser::{ParserContext, SelectorImpl};
|
||||
|
||||
let pseudo_string = unsafe {
|
||||
let mut length = 0;
|
||||
let mut buff = Gecko_GetAtomAsUTF16(pseudo, &mut length);
|
||||
|
||||
// Handle the annoying preceding colon in front of everything in nsCSSAnonBoxList.h.
|
||||
debug_assert!(length >= 2 && *buff == ':' as u16 && *buff.offset(1) != ':' as u16);
|
||||
buff = buff.offset(1);
|
||||
length -= 1;
|
||||
|
||||
String::from_utf16(slice::from_raw_parts(buff, length as usize)).unwrap()
|
||||
};
|
||||
|
||||
let mut context = ParserContext::new();
|
||||
context.in_user_agent_stylesheet = in_ua_stylesheet;
|
||||
GeckoSelectorImpl::parse_pseudo_element(&context, &pseudo_string).map_err(|_| pseudo_string)
|
||||
}
|
||||
|
||||
/*
|
||||
* For Gecko->Servo function calls, we need to redeclare the same signature that was declared in
|
||||
* the C header in Gecko. In order to catch accidental mismatches, we run rust-bindgen against
|
||||
|
@ -286,13 +264,8 @@ pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(parent_style_or_null: *
|
|||
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
|
||||
data.flush_stylesheets();
|
||||
|
||||
let pseudo = match pseudo_element_from_atom(pseudo_tag, /* ua_stylesheet = */ true) {
|
||||
Ok(pseudo) => pseudo,
|
||||
Err(pseudo) => {
|
||||
warn!("stylo: Unable to parse anonymous-box pseudo-element: {}", pseudo);
|
||||
return ptr::null_mut();
|
||||
}
|
||||
};
|
||||
let atom = Atom::from(pseudo_tag);
|
||||
let pseudo = PseudoElement::from_atom_unchecked(atom, /* anon_box = */ true);
|
||||
|
||||
type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
|
||||
|
||||
|
@ -320,14 +293,8 @@ pub extern "C" fn Servo_GetComputedValuesForPseudoElement(parent_style: *mut Ser
|
|||
}
|
||||
};
|
||||
|
||||
let pseudo = match pseudo_element_from_atom(pseudo_tag, /* ua_stylesheet = */ true) {
|
||||
Ok(pseudo) => pseudo,
|
||||
Err(pseudo) => {
|
||||
warn!("stylo: Unable to parse anonymous-box pseudo-element: {}", pseudo);
|
||||
return parent_or_null();
|
||||
}
|
||||
};
|
||||
|
||||
let atom = Atom::from(pseudo_tag);
|
||||
let pseudo = PseudoElement::from_atom_unchecked(atom, /* anon_box = */ false);
|
||||
|
||||
// The stylist consumes stylesheets lazily.
|
||||
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
|
||||
|
|
|
@ -42,3 +42,28 @@ fn assert_restyle_hints_match() {
|
|||
check_enum_value_non_static!(nsRestyleHint::eRestyle_SomeDescendants, RESTYLE_DESCENDANTS.bits());
|
||||
check_enum_value_non_static!(nsRestyleHint::eRestyle_LaterSiblings, RESTYLE_LATER_SIBLINGS.bits());
|
||||
}
|
||||
|
||||
// Note that we can't call each_pseudo_element, parse_pseudo_element, or
|
||||
// similar, because we'd need the foreign atom symbols to link.
|
||||
#[test]
|
||||
fn assert_basic_pseudo_elements() {
|
||||
let mut saw_before = false;
|
||||
let mut saw_after = false;
|
||||
|
||||
macro_rules! pseudo_element {
|
||||
(":before", $atom:expr, false) => {
|
||||
saw_before = true;
|
||||
};
|
||||
(":after", $atom:expr, false) => {
|
||||
saw_after = true;
|
||||
};
|
||||
($pseudo_str_with_colon:expr, $atom:expr, $is_anon_box:expr) => {
|
||||
// Do nothing
|
||||
};
|
||||
}
|
||||
|
||||
include!("../../components/style/generated/gecko_pseudo_element_helper.rs");
|
||||
|
||||
assert!(saw_before);
|
||||
assert!(saw_after);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -89,6 +89,7 @@ impl WeakAtom {
|
|||
Atom::from(self.as_ptr())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_hash(&self) -> u32 {
|
||||
self.0.mHash
|
||||
}
|
||||
|
@ -101,28 +102,46 @@ impl WeakAtom {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn chars(&self) -> DecodeUtf16<Cloned<slice::Iter<u16>>> {
|
||||
// NOTE: don't expose this, since it's slow, and easy to be misused.
|
||||
fn chars(&self) -> DecodeUtf16<Cloned<slice::Iter<u16>>> {
|
||||
char::decode_utf16(self.as_slice().iter().cloned())
|
||||
}
|
||||
|
||||
pub fn with_str<F, Output>(&self, cb: F) -> Output
|
||||
where F: FnOnce(&str) -> Output {
|
||||
where F: FnOnce(&str) -> Output
|
||||
{
|
||||
// FIXME(bholley): We should measure whether it makes more sense to
|
||||
// cache the UTF-8 version in the Gecko atom table somehow.
|
||||
let owned = String::from_utf16(self.as_slice()).unwrap();
|
||||
cb(&owned)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn eq_str_ignore_ascii_case(&self, s: &str) -> bool {
|
||||
unsafe {
|
||||
Gecko_AtomEqualsUTF8IgnoreCase(self.as_ptr(), s.as_ptr() as *const _, s.len() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn to_string(&self) -> String {
|
||||
String::from_utf16(self.as_slice()).unwrap()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_static(&self) -> bool {
|
||||
unsafe {
|
||||
(*self.as_ptr()).mIsStatic() != 0
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn len(&self) -> u32 {
|
||||
unsafe {
|
||||
(*self.as_ptr()).mLength()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn as_ptr(&self) -> *mut nsIAtom {
|
||||
let const_ptr: *const nsIAtom = &self.0;
|
||||
|
@ -130,12 +149,41 @@ impl WeakAtom {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for WeakAtom {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(w, "Gecko WeakAtom({:p}, {})", self, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for WeakAtom {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
for c in self.chars() {
|
||||
try!(write!(w, "{}", c.unwrap_or(char::REPLACEMENT_CHARACTER)))
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Atom {
|
||||
pub unsafe fn with<F>(ptr: *mut nsIAtom, callback: &mut F) where F: FnMut(&Atom) {
|
||||
let atom = Atom(WeakAtom::new(ptr));
|
||||
callback(&atom);
|
||||
mem::forget(atom);
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates an atom from an static atom pointer without checking in release
|
||||
/// builds.
|
||||
///
|
||||
/// Right now it's only used by the atom macro, and ideally it should keep
|
||||
/// that way, now we have sugar for is_static, creating atoms using
|
||||
/// Atom::from should involve almost no overhead.
|
||||
#[inline]
|
||||
unsafe fn from_static(ptr: *mut nsIAtom) -> Self {
|
||||
let atom = Atom(ptr as *mut WeakAtom);
|
||||
debug_assert!(atom.is_static(),
|
||||
"Called from_static for a non-static atom!");
|
||||
atom
|
||||
}
|
||||
}
|
||||
|
||||
impl BloomHash for Atom {
|
||||
|
@ -174,8 +222,10 @@ impl Clone for Atom {
|
|||
impl Drop for Atom {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
Gecko_ReleaseAtom(self.as_ptr());
|
||||
if !self.is_static() {
|
||||
unsafe {
|
||||
Gecko_ReleaseAtom(self.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,23 +258,22 @@ impl Deserialize for Atom {
|
|||
|
||||
impl fmt::Debug for Atom {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(w, "Gecko Atom {:p}", self.0)
|
||||
write!(w, "Gecko Atom({:p}, {})", self.0, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Atom {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
for c in char::decode_utf16(self.as_slice().iter().cloned()) {
|
||||
try!(write!(w, "{}", c.unwrap_or(char::REPLACEMENT_CHARACTER)))
|
||||
unsafe {
|
||||
(&*self.0).fmt(w)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for Atom {
|
||||
#[inline]
|
||||
fn from(string: &str) -> Atom {
|
||||
assert!(string.len() <= u32::max_value() as usize);
|
||||
debug_assert!(string.len() <= u32::max_value() as usize);
|
||||
unsafe {
|
||||
Atom(WeakAtom::new(
|
||||
Gecko_Atomize(string.as_ptr() as *const _, string.len() as u32)
|
||||
|
@ -257,8 +306,11 @@ impl From<String> for Atom {
|
|||
impl From<*mut nsIAtom> for Atom {
|
||||
#[inline]
|
||||
fn from(ptr: *mut nsIAtom) -> Atom {
|
||||
debug_assert!(!ptr.is_null());
|
||||
unsafe {
|
||||
Gecko_AddRefAtom(ptr);
|
||||
if (*ptr).mIsStatic() == 0 {
|
||||
Gecko_AddRefAtom(ptr);
|
||||
}
|
||||
Atom(WeakAtom::new(ptr))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: ./%s PATH/TO/OBJDIR" % sys.argv[0]
|
||||
objdir_path = sys.argv[1]
|
||||
|
||||
|
||||
def line_to_atom(line):
|
||||
result = re.match('^GK_ATOM\((.+),\s*"(.*)"\)', line)
|
||||
return (result.group(1), result.group(2))
|
||||
|
||||
|
||||
def map_atom(ident):
|
||||
if ident in {"box", "loop", "match", "mod", "ref",
|
||||
"self", "type", "use", "where", "in"}:
|
||||
return ident + "_"
|
||||
return ident
|
||||
|
||||
|
||||
def gnu_symbolify(ident):
|
||||
return "_ZN9nsGkAtoms" + str(len(ident)) + ident + "E"
|
||||
|
||||
|
||||
def msvc64_symbolify(ident):
|
||||
return "?" + ident + "@nsGkAtoms@@2PEAVnsIAtom@@EA"
|
||||
|
||||
|
||||
def msvc32_symbolify(ident):
|
||||
return "?" + ident + "@nsGkAtoms@@2PAVnsIAtom@@A"
|
||||
|
||||
|
||||
def write_items(f, func):
|
||||
f.write(" extern {\n")
|
||||
for atom in atoms:
|
||||
f.write(TEMPLATE.format(name=map_atom(atom[0]),
|
||||
link_name=func(atom[0])))
|
||||
f.write(" }\n")
|
||||
|
||||
|
||||
with open(objdir_path + "/dist/include/nsGkAtomList.h") as f:
|
||||
lines = [line for line in f.readlines() if line.startswith("GK_ATOM")]
|
||||
atoms = [line_to_atom(line) for line in lines]
|
||||
|
||||
TEMPLATE = """
|
||||
#[link_name = "{link_name}"]
|
||||
pub static {name}: *mut nsIAtom;
|
||||
"""[1:]
|
||||
|
||||
with open("atom_macro.rs", "wb") as f:
|
||||
f.write("use gecko_bindings::structs::nsIAtom;\n\n")
|
||||
f.write("use Atom;\n\n")
|
||||
f.write("pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom { unsafe { Atom::from_static(ptr) } }\n\n")
|
||||
f.write("cfg_if! {\n")
|
||||
f.write(" if #[cfg(not(target_env = \"msvc\"))] {\n")
|
||||
write_items(f, gnu_symbolify)
|
||||
f.write(" } else if #[cfg(target_pointer_width = \"64\")] {\n")
|
||||
write_items(f, msvc64_symbolify)
|
||||
f.write(" } else {\n")
|
||||
write_items(f, msvc32_symbolify)
|
||||
f.write(" }\n")
|
||||
f.write("}\n\n")
|
||||
f.write("#[macro_export]\n")
|
||||
f.write("macro_rules! atom {\n")
|
||||
f.writelines(['("%s") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::%s) };\n'
|
||||
% (atom[1], map_atom(atom[0])) for atom in atoms])
|
||||
f.write("}\n")
|
Loading…
Add table
Add a link
Reference in a new issue