mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Handle RawGeckoElement and friends, add support for types which are used in both maybe-null and non-null forms
This commit is contained in:
parent
de90f5fce8
commit
0d4c5674ec
6 changed files with 260 additions and 256 deletions
|
@ -24,7 +24,7 @@ use gecko_bindings::bindings::{Gecko_EnsureImageLayersLength, Gecko_CreateGradie
|
||||||
use gecko_bindings::bindings::{Gecko_CopyImageValueFrom, Gecko_CopyFontFamilyFrom};
|
use gecko_bindings::bindings::{Gecko_CopyImageValueFrom, Gecko_CopyFontFamilyFrom};
|
||||||
use gecko_bindings::bindings::{Gecko_FontFamilyList_AppendGeneric, Gecko_FontFamilyList_AppendNamed};
|
use gecko_bindings::bindings::{Gecko_FontFamilyList_AppendGeneric, Gecko_FontFamilyList_AppendNamed};
|
||||||
use gecko_bindings::bindings::{Gecko_FontFamilyList_Clear, Gecko_InitializeImageLayer};
|
use gecko_bindings::bindings::{Gecko_FontFamilyList_Clear, Gecko_InitializeImageLayer};
|
||||||
use gecko_bindings::bindings::ServoComputedValuesBorrowed;
|
use gecko_bindings::bindings::ServoComputedValuesMaybeBorrowed;
|
||||||
use gecko_bindings::structs;
|
use gecko_bindings::structs;
|
||||||
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
||||||
use gecko_values::{StyleCoordHelpers, GeckoStyleCoordConvertible, convert_nscolor_to_rgba};
|
use gecko_values::{StyleCoordHelpers, GeckoStyleCoordConvertible, convert_nscolor_to_rgba};
|
||||||
|
@ -1712,8 +1712,8 @@ fn static_assert() {
|
||||||
<%def name="define_ffi_struct_accessor(style_struct)">
|
<%def name="define_ffi_struct_accessor(style_struct)">
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[allow(non_snake_case, unused_variables)]
|
#[allow(non_snake_case, unused_variables)]
|
||||||
pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values: ServoComputedValuesBorrowed)
|
pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values:
|
||||||
-> *const ${style_struct.gecko_ffi_name} {
|
ServoComputedValuesMaybeBorrowed) -> *const ${style_struct.gecko_ffi_name} {
|
||||||
computed_values.as_arc::<ComputedValues>().get_${style_struct.name_lower}().get_gecko()
|
computed_values.as_arc::<ComputedValues>().get_${style_struct.name_lower}().get_gecko()
|
||||||
as *const ${style_struct.gecko_ffi_name}
|
as *const ${style_struct.gecko_ffi_name}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,11 +156,15 @@ COMPILATION_TARGETS = {
|
||||||
],
|
],
|
||||||
"servo_owned_types": [
|
"servo_owned_types": [
|
||||||
"RawServoStyleSet",
|
"RawServoStyleSet",
|
||||||
"RawGeckoNode",
|
|
||||||
],
|
],
|
||||||
"servo_maybe_owned_types": [
|
"servo_maybe_owned_types": [
|
||||||
"ServoNodeData",
|
"ServoNodeData",
|
||||||
],
|
],
|
||||||
|
"servo_immutable_borrow_types": [
|
||||||
|
"RawGeckoNode",
|
||||||
|
"RawGeckoElement",
|
||||||
|
"RawGeckoDocument",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
"atoms": {
|
"atoms": {
|
||||||
|
@ -329,9 +333,19 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
|
||||||
flags.append("--raw-line")
|
flags.append("--raw-line")
|
||||||
flags.append("pub type {0}Strong = ::sugar::ownership::Strong<{0}>;".format(ty))
|
flags.append("pub type {0}Strong = ::sugar::ownership::Strong<{0}>;".format(ty))
|
||||||
flags.append("--blacklist-type")
|
flags.append("--blacklist-type")
|
||||||
|
flags.append("{}MaybeBorrowed".format(ty))
|
||||||
|
flags.append("-raw-line")
|
||||||
|
flags.append("pub type {0}MaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
|
||||||
|
if "servo_immutable_borrow_types" in current_target:
|
||||||
|
for ty in current_target["servo_immutable_borrow_types"]:
|
||||||
|
flags.append("-blacklist-type")
|
||||||
flags.append("{}Borrowed".format(ty))
|
flags.append("{}Borrowed".format(ty))
|
||||||
flags.append("--raw-line")
|
flags.append("--raw-line")
|
||||||
flags.append("pub type {0}Borrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
|
flags.append("pub type {0}Borrowed<'a> = &'a {0};".format(ty))
|
||||||
|
flags.append("--blacklist-type")
|
||||||
|
flags.append("{}MaybeBorrowed".format(ty))
|
||||||
|
flags.append("--raw-line")
|
||||||
|
flags.append("pub type {0}MaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
|
||||||
if "servo_owned_types" in current_target:
|
if "servo_owned_types" in current_target:
|
||||||
for ty in current_target["servo_owned_types"]:
|
for ty in current_target["servo_owned_types"]:
|
||||||
flags.append("--blacklist-type")
|
flags.append("--blacklist-type")
|
||||||
|
@ -349,19 +363,19 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
|
||||||
if "servo_maybe_owned_types" in current_target:
|
if "servo_maybe_owned_types" in current_target:
|
||||||
for ty in current_target["servo_maybe_owned_types"]:
|
for ty in current_target["servo_maybe_owned_types"]:
|
||||||
flags.append("--blacklist-type")
|
flags.append("--blacklist-type")
|
||||||
flags.append("{}Borrowed".format(ty))
|
flags.append("{}MaybeBorrowed".format(ty))
|
||||||
flags.append("--raw-line")
|
flags.append("--raw-line")
|
||||||
flags.append("pub type {0}Borrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;"
|
flags.append("pub type {0}MaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;"
|
||||||
.format(ty))
|
.format(ty))
|
||||||
flags.append("--blacklist-type")
|
flags.append("--blacklist-type")
|
||||||
flags.append("{}BorrowedMut".format(ty))
|
flags.append("{}MaybeBorrowedMut".format(ty))
|
||||||
flags.append("--raw-line")
|
flags.append("--raw-line")
|
||||||
flags.append("pub type {0}BorrowedMut<'a> = ::sugar::ownership::BorrowedMut<'a, {0}>;"
|
flags.append("pub type {0}MaybeBorrowedMut<'a> = ::sugar::ownership::BorrowedMut<'a, {0}>;"
|
||||||
.format(ty))
|
.format(ty))
|
||||||
flags.append("--blacklist-type")
|
flags.append("--blacklist-type")
|
||||||
flags.append("{}Owned".format(ty))
|
flags.append("{}MaybeOwned".format(ty))
|
||||||
flags.append("--raw-line")
|
flags.append("--raw-line")
|
||||||
flags.append("pub type {0}Owned = ::sugar::ownership::MaybeOwned<{0}>;".format(ty))
|
flags.append("pub type {0}MaybeOwned = ::sugar::ownership::MaybeOwned<{0}>;".format(ty))
|
||||||
if "structs_types" in current_target:
|
if "structs_types" in current_target:
|
||||||
for ty in current_target["structs_types"]:
|
for ty in current_target["structs_types"]:
|
||||||
ty_fragments = ty.split("::")
|
ty_fragments = ty.split("::")
|
||||||
|
|
|
@ -6,20 +6,23 @@ pub enum nsIDocument {}
|
||||||
pub enum nsIPrincipal {}
|
pub enum nsIPrincipal {}
|
||||||
pub enum nsIURI {}
|
pub enum nsIURI {}
|
||||||
pub type ServoComputedValuesStrong = ::sugar::ownership::Strong<ServoComputedValues>;
|
pub type ServoComputedValuesStrong = ::sugar::ownership::Strong<ServoComputedValues>;
|
||||||
pub type ServoComputedValuesBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoComputedValues>;
|
pub type ServoComputedValuesMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoComputedValues>;
|
||||||
pub type RawServoStyleSheetStrong = ::sugar::ownership::Strong<RawServoStyleSheet>;
|
pub type RawServoStyleSheetStrong = ::sugar::ownership::Strong<RawServoStyleSheet>;
|
||||||
pub type RawServoStyleSheetBorrowed<'a> = ::sugar::ownership::Borrowed<'a, RawServoStyleSheet>;
|
pub type RawServoStyleSheetMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, RawServoStyleSheet>;
|
||||||
pub type ServoDeclarationBlockStrong = ::sugar::ownership::Strong<ServoDeclarationBlock>;
|
pub type ServoDeclarationBlockStrong = ::sugar::ownership::Strong<ServoDeclarationBlock>;
|
||||||
pub type ServoDeclarationBlockBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoDeclarationBlock>;
|
pub type ServoDeclarationBlockMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoDeclarationBlock>;
|
||||||
|
pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode;
|
||||||
|
pub type RawGeckoNodeMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoNode>;
|
||||||
|
pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement;
|
||||||
|
pub type RawGeckoElementMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoElement>;
|
||||||
|
pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
|
||||||
|
pub type RawGeckoDocumentMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, RawGeckoDocument>;
|
||||||
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
||||||
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
|
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
|
||||||
pub type RawServoStyleSetOwned = ::sugar::ownership::Owned<RawServoStyleSet>;
|
pub type RawServoStyleSetOwned = ::sugar::ownership::Owned<RawServoStyleSet>;
|
||||||
pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode;
|
pub type ServoNodeDataMaybeBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoNodeData>;
|
||||||
pub type RawGeckoNodeBorrowedMut<'a> = &'a mut RawGeckoNode;
|
pub type ServoNodeDataMaybeBorrowedMut<'a> = ::sugar::ownership::BorrowedMut<'a, ServoNodeData>;
|
||||||
pub type RawGeckoNodeOwned = ::sugar::ownership::Owned<RawGeckoNode>;
|
pub type ServoNodeDataMaybeOwned = ::sugar::ownership::MaybeOwned<ServoNodeData>;
|
||||||
pub type ServoNodeDataBorrowed<'a> = ::sugar::ownership::Borrowed<'a, ServoNodeData>;
|
|
||||||
pub type ServoNodeDataBorrowedMut<'a> = ::sugar::ownership::BorrowedMut<'a, ServoNodeData>;
|
|
||||||
pub type ServoNodeDataOwned = ::sugar::ownership::MaybeOwned<ServoNodeData>;
|
|
||||||
use structs::nsStyleFont;
|
use structs::nsStyleFont;
|
||||||
unsafe impl Send for nsStyleFont {}
|
unsafe impl Send for nsStyleFont {}
|
||||||
unsafe impl Sync for nsStyleFont {}
|
unsafe impl Sync for nsStyleFont {}
|
||||||
|
@ -182,26 +185,31 @@ pub enum StyleChildrenIterator { }
|
||||||
pub type ThreadSafePrincipalHolder = nsMainThreadPtrHolder<nsIPrincipal>;
|
pub type ThreadSafePrincipalHolder = nsMainThreadPtrHolder<nsIPrincipal>;
|
||||||
pub type ThreadSafeURIHolder = nsMainThreadPtrHolder<nsIURI>;
|
pub type ThreadSafeURIHolder = nsMainThreadPtrHolder<nsIURI>;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_ChildrenCount(node: *mut RawGeckoNode) -> u32;
|
pub fn Gecko_ChildrenCount(node: RawGeckoNodeBorrowed) -> u32;
|
||||||
pub fn Gecko_NodeIsElement(node: *mut RawGeckoNode) -> bool;
|
pub fn Gecko_NodeIsElement(node: RawGeckoNodeBorrowed) -> bool;
|
||||||
pub fn Gecko_GetParentNode(node: *mut RawGeckoNode) -> *mut RawGeckoNode;
|
pub fn Gecko_GetParentNode(node: RawGeckoNodeBorrowed)
|
||||||
pub fn Gecko_GetFirstChild(node: *mut RawGeckoNode) -> *mut RawGeckoNode;
|
-> RawGeckoNodeMaybeBorrowed;
|
||||||
pub fn Gecko_GetLastChild(node: *mut RawGeckoNode) -> *mut RawGeckoNode;
|
pub fn Gecko_GetFirstChild(node: RawGeckoNodeBorrowed)
|
||||||
pub fn Gecko_GetPrevSibling(node: *mut RawGeckoNode) -> *mut RawGeckoNode;
|
-> RawGeckoNodeMaybeBorrowed;
|
||||||
pub fn Gecko_GetNextSibling(node: *mut RawGeckoNode) -> *mut RawGeckoNode;
|
pub fn Gecko_GetLastChild(node: RawGeckoNodeBorrowed)
|
||||||
pub fn Gecko_GetParentElement(element: *mut RawGeckoElement)
|
-> RawGeckoNodeMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetPrevSibling(node: RawGeckoNodeBorrowed)
|
||||||
pub fn Gecko_GetFirstChildElement(element: *mut RawGeckoElement)
|
-> RawGeckoNodeMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetNextSibling(node: RawGeckoNodeBorrowed)
|
||||||
pub fn Gecko_GetLastChildElement(element: *mut RawGeckoElement)
|
-> RawGeckoNodeMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetParentElement(element: RawGeckoElementBorrowed)
|
||||||
pub fn Gecko_GetPrevSiblingElement(element: *mut RawGeckoElement)
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetFirstChildElement(element: RawGeckoElementBorrowed)
|
||||||
pub fn Gecko_GetNextSiblingElement(element: *mut RawGeckoElement)
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetLastChildElement(element: RawGeckoElementBorrowed)
|
||||||
pub fn Gecko_GetDocumentElement(document: *mut RawGeckoDocument)
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
-> *mut RawGeckoElement;
|
pub fn Gecko_GetPrevSiblingElement(element: RawGeckoElementBorrowed)
|
||||||
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: *mut RawGeckoNode)
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
|
pub fn Gecko_GetNextSiblingElement(element: RawGeckoElementBorrowed)
|
||||||
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
|
pub fn Gecko_GetDocumentElement(document: RawGeckoDocumentBorrowed)
|
||||||
|
-> RawGeckoElementMaybeBorrowed;
|
||||||
|
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
|
||||||
-> *mut StyleChildrenIterator;
|
-> *mut StyleChildrenIterator;
|
||||||
pub fn Gecko_DropStyleChildrenIterator(it: *mut StyleChildrenIterator);
|
pub fn Gecko_DropStyleChildrenIterator(it: *mut StyleChildrenIterator);
|
||||||
pub fn Gecko_GetNextStyleChild(it: *mut StyleChildrenIterator)
|
pub fn Gecko_GetNextStyleChild(it: *mut StyleChildrenIterator)
|
||||||
|
@ -209,36 +217,38 @@ extern "C" {
|
||||||
pub fn Gecko_ElementState(element: *mut RawGeckoElement) -> u8;
|
pub fn Gecko_ElementState(element: *mut RawGeckoElement) -> u8;
|
||||||
pub fn Gecko_IsHTMLElementInHTMLDocument(element: *mut RawGeckoElement)
|
pub fn Gecko_IsHTMLElementInHTMLDocument(element: *mut RawGeckoElement)
|
||||||
-> bool;
|
-> bool;
|
||||||
pub fn Gecko_IsLink(element: *mut RawGeckoElement) -> bool;
|
pub fn Gecko_IsLink(element: RawGeckoElementBorrowed) -> bool;
|
||||||
pub fn Gecko_IsTextNode(node: *mut RawGeckoNode) -> bool;
|
pub fn Gecko_IsTextNode(node: RawGeckoNodeBorrowed) -> bool;
|
||||||
pub fn Gecko_IsVisitedLink(element: *mut RawGeckoElement) -> bool;
|
pub fn Gecko_IsVisitedLink(element: RawGeckoElementBorrowed) -> bool;
|
||||||
pub fn Gecko_IsUnvisitedLink(element: *mut RawGeckoElement) -> bool;
|
pub fn Gecko_IsUnvisitedLink(element: RawGeckoElementBorrowed) -> bool;
|
||||||
pub fn Gecko_IsRootElement(element: *mut RawGeckoElement) -> bool;
|
pub fn Gecko_IsRootElement(element: RawGeckoElementBorrowed) -> bool;
|
||||||
pub fn Gecko_LocalName(element: *mut RawGeckoElement) -> *mut nsIAtom;
|
pub fn Gecko_LocalName(element: RawGeckoElementBorrowed) -> *mut nsIAtom;
|
||||||
pub fn Gecko_Namespace(element: *mut RawGeckoElement) -> *mut nsIAtom;
|
pub fn Gecko_Namespace(element: RawGeckoElementBorrowed) -> *mut nsIAtom;
|
||||||
pub fn Gecko_GetElementId(element: *mut RawGeckoElement) -> *mut nsIAtom;
|
pub fn Gecko_GetElementId(element: RawGeckoElementBorrowed)
|
||||||
pub fn Gecko_AtomAttrValue(element: *mut RawGeckoElement,
|
-> *mut nsIAtom;
|
||||||
|
pub fn Gecko_AtomAttrValue(element: RawGeckoElementBorrowed,
|
||||||
attribute: *mut nsIAtom) -> *mut nsIAtom;
|
attribute: *mut nsIAtom) -> *mut nsIAtom;
|
||||||
pub fn Gecko_HasAttr(element: *mut RawGeckoElement, ns: *mut nsIAtom,
|
pub fn Gecko_HasAttr(element: RawGeckoElementBorrowed, ns: *mut nsIAtom,
|
||||||
name: *mut nsIAtom) -> bool;
|
name: *mut nsIAtom) -> bool;
|
||||||
pub fn Gecko_AttrEquals(element: *mut RawGeckoElement, ns: *mut nsIAtom,
|
pub fn Gecko_AttrEquals(element: RawGeckoElementBorrowed,
|
||||||
name: *mut nsIAtom, str: *mut nsIAtom,
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
ignoreCase: bool) -> bool;
|
str: *mut nsIAtom, ignoreCase: bool) -> bool;
|
||||||
pub fn Gecko_AttrDashEquals(element: *mut RawGeckoElement,
|
pub fn Gecko_AttrDashEquals(element: RawGeckoElementBorrowed,
|
||||||
ns: *mut nsIAtom, name: *mut nsIAtom,
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
str: *mut nsIAtom) -> bool;
|
str: *mut nsIAtom) -> bool;
|
||||||
pub fn Gecko_AttrIncludes(element: *mut RawGeckoElement, ns: *mut nsIAtom,
|
pub fn Gecko_AttrIncludes(element: RawGeckoElementBorrowed,
|
||||||
name: *mut nsIAtom, str: *mut nsIAtom) -> bool;
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
pub fn Gecko_AttrHasSubstring(element: *mut RawGeckoElement,
|
str: *mut nsIAtom) -> bool;
|
||||||
|
pub fn Gecko_AttrHasSubstring(element: RawGeckoElementBorrowed,
|
||||||
ns: *mut nsIAtom, name: *mut nsIAtom,
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
str: *mut nsIAtom) -> bool;
|
str: *mut nsIAtom) -> bool;
|
||||||
pub fn Gecko_AttrHasPrefix(element: *mut RawGeckoElement,
|
pub fn Gecko_AttrHasPrefix(element: RawGeckoElementBorrowed,
|
||||||
ns: *mut nsIAtom, name: *mut nsIAtom,
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
str: *mut nsIAtom) -> bool;
|
str: *mut nsIAtom) -> bool;
|
||||||
pub fn Gecko_AttrHasSuffix(element: *mut RawGeckoElement,
|
pub fn Gecko_AttrHasSuffix(element: RawGeckoElementBorrowed,
|
||||||
ns: *mut nsIAtom, name: *mut nsIAtom,
|
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||||
str: *mut nsIAtom) -> bool;
|
str: *mut nsIAtom) -> bool;
|
||||||
pub fn Gecko_ClassOrClassList(element: *mut RawGeckoElement,
|
pub fn Gecko_ClassOrClassList(element: RawGeckoElementBorrowed,
|
||||||
class_: *mut *mut nsIAtom,
|
class_: *mut *mut nsIAtom,
|
||||||
classList: *mut *mut *mut nsIAtom) -> u32;
|
classList: *mut *mut *mut nsIAtom) -> u32;
|
||||||
pub fn Gecko_SnapshotAtomAttrValue(element: *mut ServoElementSnapshot,
|
pub fn Gecko_SnapshotAtomAttrValue(element: *mut ServoElementSnapshot,
|
||||||
|
@ -271,12 +281,12 @@ extern "C" {
|
||||||
class_: *mut *mut nsIAtom,
|
class_: *mut *mut nsIAtom,
|
||||||
classList: *mut *mut *mut nsIAtom)
|
classList: *mut *mut *mut nsIAtom)
|
||||||
-> u32;
|
-> u32;
|
||||||
pub fn Gecko_GetServoDeclarationBlock(element: *mut RawGeckoElement)
|
pub fn Gecko_GetServoDeclarationBlock(element: RawGeckoElementBorrowed)
|
||||||
-> ServoDeclarationBlockBorrowed;
|
-> ServoDeclarationBlockMaybeBorrowed;
|
||||||
pub fn Gecko_GetNodeData(node: RawGeckoNodeBorrowed)
|
pub fn Gecko_GetNodeData(node: RawGeckoNodeBorrowed)
|
||||||
-> ServoNodeDataBorrowed;
|
-> ServoNodeDataMaybeBorrowed;
|
||||||
pub fn Gecko_SetNodeData(node: RawGeckoNodeBorrowedMut,
|
pub fn Gecko_SetNodeData(node: RawGeckoNodeBorrowed,
|
||||||
data: ServoNodeDataOwned);
|
data: ServoNodeDataMaybeOwned);
|
||||||
pub fn Gecko_Atomize(aString: *const ::std::os::raw::c_char, aLength: u32)
|
pub fn Gecko_Atomize(aString: *const ::std::os::raw::c_char, aLength: u32)
|
||||||
-> *mut nsIAtom;
|
-> *mut nsIAtom;
|
||||||
pub fn Gecko_AddRefAtom(aAtom: *mut nsIAtom);
|
pub fn Gecko_AddRefAtom(aAtom: *mut nsIAtom);
|
||||||
|
@ -320,16 +330,17 @@ extern "C" {
|
||||||
principal: *mut ThreadSafePrincipalHolder);
|
principal: *mut ThreadSafePrincipalHolder);
|
||||||
pub fn Gecko_CopyMozBindingFrom(des: *mut nsStyleDisplay,
|
pub fn Gecko_CopyMozBindingFrom(des: *mut nsStyleDisplay,
|
||||||
src: *const nsStyleDisplay);
|
src: *const nsStyleDisplay);
|
||||||
pub fn Gecko_GetNodeFlags(node: *mut RawGeckoNode) -> u32;
|
pub fn Gecko_GetNodeFlags(node: RawGeckoNodeBorrowed) -> u32;
|
||||||
pub fn Gecko_SetNodeFlags(node: *mut RawGeckoNode, flags: u32);
|
pub fn Gecko_SetNodeFlags(node: RawGeckoNodeBorrowed, flags: u32);
|
||||||
pub fn Gecko_UnsetNodeFlags(node: *mut RawGeckoNode, flags: u32);
|
pub fn Gecko_UnsetNodeFlags(node: RawGeckoNodeBorrowed, flags: u32);
|
||||||
pub fn Gecko_GetStyleContext(node: *mut RawGeckoNode,
|
pub fn Gecko_GetStyleContext(node: RawGeckoNodeBorrowed,
|
||||||
aPseudoTagOrNull: *mut nsIAtom)
|
aPseudoTagOrNull: *mut nsIAtom)
|
||||||
-> *mut nsStyleContext;
|
-> *mut nsStyleContext;
|
||||||
pub fn Gecko_CalcStyleDifference(oldstyle: *mut nsStyleContext,
|
pub fn Gecko_CalcStyleDifference(oldstyle: *mut nsStyleContext,
|
||||||
newstyle: ServoComputedValuesBorrowed)
|
newstyle:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> nsChangeHint;
|
-> nsChangeHint;
|
||||||
pub fn Gecko_StoreStyleDifference(node: *mut RawGeckoNode,
|
pub fn Gecko_StoreStyleDifference(node: RawGeckoNodeBorrowed,
|
||||||
change: nsChangeHint);
|
change: nsChangeHint);
|
||||||
pub fn Gecko_EnsureTArrayCapacity(array: *mut ::std::os::raw::c_void,
|
pub fn Gecko_EnsureTArrayCapacity(array: *mut ::std::os::raw::c_void,
|
||||||
capacity: usize, elem_size: usize);
|
capacity: usize, elem_size: usize);
|
||||||
|
@ -466,7 +477,7 @@ extern "C" {
|
||||||
pub fn Gecko_CopyConstruct_nsStyleEffects(ptr: *mut nsStyleEffects,
|
pub fn Gecko_CopyConstruct_nsStyleEffects(ptr: *mut nsStyleEffects,
|
||||||
other: *const nsStyleEffects);
|
other: *const nsStyleEffects);
|
||||||
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||||
pub fn Servo_NodeData_Drop(data: ServoNodeDataOwned);
|
pub fn Servo_NodeData_Drop(data: ServoNodeDataMaybeOwned);
|
||||||
pub fn Servo_StyleSheet_FromUTF8Bytes(bytes: *const u8, length: u32,
|
pub fn Servo_StyleSheet_FromUTF8Bytes(bytes: *const u8, length: u32,
|
||||||
parsing_mode: SheetParsingMode,
|
parsing_mode: SheetParsingMode,
|
||||||
base_bytes: *const u8,
|
base_bytes: *const u8,
|
||||||
|
@ -476,49 +487,49 @@ extern "C" {
|
||||||
principal:
|
principal:
|
||||||
*mut ThreadSafePrincipalHolder)
|
*mut ThreadSafePrincipalHolder)
|
||||||
-> RawServoStyleSheetStrong;
|
-> RawServoStyleSheetStrong;
|
||||||
pub fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetBorrowed);
|
pub fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetBorrowed);
|
pub fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_StyleSheet_HasRules(sheet: RawServoStyleSheetBorrowed)
|
pub fn Servo_StyleSheet_HasRules(sheet: RawServoStyleSheetMaybeBorrowed)
|
||||||
-> bool;
|
-> bool;
|
||||||
pub fn Servo_StyleSet_Init() -> RawServoStyleSetOwned;
|
pub fn Servo_StyleSet_Init() -> RawServoStyleSetOwned;
|
||||||
pub fn Servo_StyleSet_Drop(set: RawServoStyleSetOwned);
|
pub fn Servo_StyleSet_Drop(set: RawServoStyleSetOwned);
|
||||||
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowedMut,
|
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowedMut,
|
||||||
sheet: RawServoStyleSheetBorrowed);
|
sheet: RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_StyleSet_PrependStyleSheet(set: RawServoStyleSetBorrowedMut,
|
pub fn Servo_StyleSet_PrependStyleSheet(set: RawServoStyleSetBorrowedMut,
|
||||||
sheet:
|
sheet:
|
||||||
RawServoStyleSheetBorrowed);
|
RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_StyleSet_RemoveStyleSheet(set: RawServoStyleSetBorrowedMut,
|
pub fn Servo_StyleSet_RemoveStyleSheet(set: RawServoStyleSetBorrowedMut,
|
||||||
sheet: RawServoStyleSheetBorrowed);
|
sheet: RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_StyleSet_InsertStyleSheetBefore(set: RawServoStyleSetBorrowedMut,
|
pub fn Servo_StyleSet_InsertStyleSheetBefore(set: RawServoStyleSetBorrowedMut,
|
||||||
sheet:
|
sheet:
|
||||||
RawServoStyleSheetBorrowed,
|
RawServoStyleSheetMaybeBorrowed,
|
||||||
reference:
|
reference:
|
||||||
RawServoStyleSheetBorrowed);
|
RawServoStyleSheetMaybeBorrowed);
|
||||||
pub fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32,
|
pub fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32,
|
||||||
cache: *mut nsHTMLCSSStyleSheet)
|
cache: *mut nsHTMLCSSStyleSheet)
|
||||||
-> ServoDeclarationBlockStrong;
|
-> ServoDeclarationBlockStrong;
|
||||||
pub fn Servo_DeclarationBlock_AddRef(declarations:
|
pub fn Servo_DeclarationBlock_AddRef(declarations:
|
||||||
ServoDeclarationBlockBorrowed);
|
ServoDeclarationBlockMaybeBorrowed);
|
||||||
pub fn Servo_DeclarationBlock_Release(declarations:
|
pub fn Servo_DeclarationBlock_Release(declarations:
|
||||||
ServoDeclarationBlockBorrowed);
|
ServoDeclarationBlockMaybeBorrowed);
|
||||||
pub fn Servo_DeclarationBlock_GetCache(declarations:
|
pub fn Servo_DeclarationBlock_GetCache(declarations:
|
||||||
ServoDeclarationBlockBorrowed)
|
ServoDeclarationBlockMaybeBorrowed)
|
||||||
-> *mut nsHTMLCSSStyleSheet;
|
-> *mut nsHTMLCSSStyleSheet;
|
||||||
pub fn Servo_DeclarationBlock_SetImmutable(declarations:
|
pub fn Servo_DeclarationBlock_SetImmutable(declarations:
|
||||||
ServoDeclarationBlockBorrowed);
|
ServoDeclarationBlockMaybeBorrowed);
|
||||||
pub fn Servo_DeclarationBlock_ClearCachePointer(declarations:
|
pub fn Servo_DeclarationBlock_ClearCachePointer(declarations:
|
||||||
ServoDeclarationBlockBorrowed);
|
ServoDeclarationBlockMaybeBorrowed);
|
||||||
pub fn Servo_CSSSupports(name: *const u8, name_length: u32,
|
pub fn Servo_CSSSupports(name: *const u8, name_length: u32,
|
||||||
value: *const u8, value_length: u32) -> bool;
|
value: *const u8, value_length: u32) -> bool;
|
||||||
pub fn Servo_ComputedValues_Get(node: *mut RawGeckoNode)
|
pub fn Servo_ComputedValues_Get(node: RawGeckoNodeBorrowed)
|
||||||
-> ServoComputedValuesStrong;
|
-> ServoComputedValuesStrong;
|
||||||
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
ServoComputedValuesBorrowed,
|
ServoComputedValuesMaybeBorrowed,
|
||||||
pseudoTag: *mut nsIAtom,
|
pseudoTag: *mut nsIAtom,
|
||||||
set: RawServoStyleSetBorrowedMut)
|
set: RawServoStyleSetBorrowedMut)
|
||||||
-> ServoComputedValuesStrong;
|
-> ServoComputedValuesStrong;
|
||||||
pub fn Servo_ComputedValues_GetForPseudoElement(parent_style:
|
pub fn Servo_ComputedValues_GetForPseudoElement(parent_style:
|
||||||
ServoComputedValuesBorrowed,
|
ServoComputedValuesMaybeBorrowed,
|
||||||
match_element:
|
match_element:
|
||||||
*mut RawGeckoElement,
|
*mut RawGeckoElement,
|
||||||
pseudo_tag: *mut nsIAtom,
|
pseudo_tag: *mut nsIAtom,
|
||||||
|
@ -527,76 +538,92 @@ extern "C" {
|
||||||
is_probe: bool)
|
is_probe: bool)
|
||||||
-> ServoComputedValuesStrong;
|
-> ServoComputedValuesStrong;
|
||||||
pub fn Servo_ComputedValues_Inherit(parent_style:
|
pub fn Servo_ComputedValues_Inherit(parent_style:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> ServoComputedValuesStrong;
|
-> ServoComputedValuesStrong;
|
||||||
pub fn Servo_ComputedValues_AddRef(computed_values:
|
pub fn Servo_ComputedValues_AddRef(computed_values:
|
||||||
ServoComputedValuesBorrowed);
|
ServoComputedValuesMaybeBorrowed);
|
||||||
pub fn Servo_ComputedValues_Release(computed_values:
|
pub fn Servo_ComputedValues_Release(computed_values:
|
||||||
ServoComputedValuesBorrowed);
|
ServoComputedValuesMaybeBorrowed);
|
||||||
pub fn Servo_Initialize();
|
pub fn Servo_Initialize();
|
||||||
pub fn Servo_Shutdown();
|
pub fn Servo_Shutdown();
|
||||||
pub fn Servo_ComputeRestyleHint(element: *mut RawGeckoElement,
|
pub fn Servo_ComputeRestyleHint(element: *mut RawGeckoElement,
|
||||||
snapshot: *mut ServoElementSnapshot,
|
snapshot: *mut ServoElementSnapshot,
|
||||||
set: RawServoStyleSetBorrowedMut)
|
set: RawServoStyleSetBorrowedMut)
|
||||||
-> nsRestyleHint;
|
-> nsRestyleHint;
|
||||||
pub fn Servo_RestyleDocument(doc: *mut RawGeckoDocument,
|
pub fn Servo_RestyleDocument(doc: RawGeckoDocumentBorrowed,
|
||||||
set: RawServoStyleSetBorrowedMut);
|
set: RawServoStyleSetBorrowedMut);
|
||||||
pub fn Servo_RestyleSubtree(node: *mut RawGeckoNode,
|
pub fn Servo_RestyleSubtree(node: RawGeckoNodeBorrowed,
|
||||||
set: RawServoStyleSetBorrowedMut);
|
set: RawServoStyleSetBorrowedMut);
|
||||||
pub fn Servo_GetStyleFont(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleFont(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleFont;
|
-> *const nsStyleFont;
|
||||||
pub fn Servo_GetStyleColor(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleColor(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleColor;
|
-> *const nsStyleColor;
|
||||||
pub fn Servo_GetStyleList(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleList(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleList;
|
-> *const nsStyleList;
|
||||||
pub fn Servo_GetStyleText(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleText(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleText;
|
-> *const nsStyleText;
|
||||||
pub fn Servo_GetStyleVisibility(computed_values:
|
pub fn Servo_GetStyleVisibility(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleVisibility;
|
-> *const nsStyleVisibility;
|
||||||
pub fn Servo_GetStyleUserInterface(computed_values:
|
pub fn Servo_GetStyleUserInterface(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleUserInterface;
|
-> *const nsStyleUserInterface;
|
||||||
pub fn Servo_GetStyleTableBorder(computed_values:
|
pub fn Servo_GetStyleTableBorder(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleTableBorder;
|
-> *const nsStyleTableBorder;
|
||||||
pub fn Servo_GetStyleSVG(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleSVG(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleSVG;
|
-> *const nsStyleSVG;
|
||||||
pub fn Servo_GetStyleVariables(computed_values:
|
pub fn Servo_GetStyleVariables(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleVariables;
|
-> *const nsStyleVariables;
|
||||||
pub fn Servo_GetStyleBackground(computed_values:
|
pub fn Servo_GetStyleBackground(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleBackground;
|
-> *const nsStyleBackground;
|
||||||
pub fn Servo_GetStylePosition(computed_values:
|
pub fn Servo_GetStylePosition(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStylePosition;
|
-> *const nsStylePosition;
|
||||||
pub fn Servo_GetStyleTextReset(computed_values:
|
pub fn Servo_GetStyleTextReset(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleTextReset;
|
-> *const nsStyleTextReset;
|
||||||
pub fn Servo_GetStyleDisplay(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleDisplay(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleDisplay;
|
-> *const nsStyleDisplay;
|
||||||
pub fn Servo_GetStyleContent(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleContent(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleContent;
|
-> *const nsStyleContent;
|
||||||
pub fn Servo_GetStyleUIReset(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleUIReset(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleUIReset;
|
-> *const nsStyleUIReset;
|
||||||
pub fn Servo_GetStyleTable(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleTable(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleTable;
|
-> *const nsStyleTable;
|
||||||
pub fn Servo_GetStyleMargin(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleMargin(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleMargin;
|
-> *const nsStyleMargin;
|
||||||
pub fn Servo_GetStylePadding(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStylePadding(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStylePadding;
|
-> *const nsStylePadding;
|
||||||
pub fn Servo_GetStyleBorder(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleBorder(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleBorder;
|
-> *const nsStyleBorder;
|
||||||
pub fn Servo_GetStyleOutline(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleOutline(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleOutline;
|
-> *const nsStyleOutline;
|
||||||
pub fn Servo_GetStyleXUL(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleXUL(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleXUL;
|
-> *const nsStyleXUL;
|
||||||
pub fn Servo_GetStyleSVGReset(computed_values:
|
pub fn Servo_GetStyleSVGReset(computed_values:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleSVGReset;
|
-> *const nsStyleSVGReset;
|
||||||
pub fn Servo_GetStyleColumn(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleColumn(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleColumn;
|
-> *const nsStyleColumn;
|
||||||
pub fn Servo_GetStyleEffects(computed_values: ServoComputedValuesBorrowed)
|
pub fn Servo_GetStyleEffects(computed_values:
|
||||||
|
ServoComputedValuesMaybeBorrowed)
|
||||||
-> *const nsStyleEffects;
|
-> *const nsStyleEffects;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem::{forget, transmute};
|
use std::mem::{forget, transmute, transmute_copy};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
|
@ -9,12 +9,14 @@ use data::{NUM_THREADS, PerDocumentStyleData};
|
||||||
use env_logger;
|
use env_logger;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
||||||
|
use gecko_bindings::bindings::RawGeckoDocumentBorrowed;
|
||||||
|
use gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoNodeBorrowed};
|
||||||
use gecko_bindings::bindings::{RawServoStyleSet, RawServoStyleSetBorrowedMut};
|
use gecko_bindings::bindings::{RawServoStyleSet, RawServoStyleSetBorrowedMut};
|
||||||
use gecko_bindings::bindings::{RawServoStyleSetOwned, ServoNodeDataOwned};
|
use gecko_bindings::bindings::{RawServoStyleSetOwned, ServoNodeDataMaybeOwned};
|
||||||
use gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedValuesBorrowed};
|
use gecko_bindings::bindings::{RawServoStyleSheetMaybeBorrowed, ServoComputedValuesMaybeBorrowed};
|
||||||
use gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong};
|
use gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong};
|
||||||
use gecko_bindings::bindings::{ServoDeclarationBlock, ThreadSafePrincipalHolder};
|
use gecko_bindings::bindings::{ServoDeclarationBlock, ThreadSafePrincipalHolder};
|
||||||
use gecko_bindings::bindings::{ServoDeclarationBlockBorrowed, ServoDeclarationBlockStrong};
|
use gecko_bindings::bindings::{ServoDeclarationBlockMaybeBorrowed, ServoDeclarationBlockStrong};
|
||||||
use gecko_bindings::bindings::{ThreadSafeURIHolder, nsHTMLCSSStyleSheet};
|
use gecko_bindings::bindings::{ThreadSafeURIHolder, nsHTMLCSSStyleSheet};
|
||||||
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
|
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
|
||||||
use gecko_bindings::structs::ServoElementSnapshot;
|
use gecko_bindings::structs::ServoElementSnapshot;
|
||||||
|
@ -114,15 +116,15 @@ fn restyle_subtree(node: GeckoNode, raw_data: RawServoStyleSetBorrowedMut) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_RestyleSubtree(node: *mut RawGeckoNode,
|
pub extern "C" fn Servo_RestyleSubtree(node: RawGeckoNodeBorrowed,
|
||||||
raw_data: RawServoStyleSetBorrowedMut) -> () {
|
raw_data: RawServoStyleSetBorrowedMut) -> () {
|
||||||
let node = unsafe { GeckoNode::from_raw(node) };
|
let node = GeckoNode(node);
|
||||||
restyle_subtree(node, raw_data);
|
restyle_subtree(node, raw_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: RawServoStyleSetBorrowedMut) -> () {
|
pub extern "C" fn Servo_RestyleDocument(doc: RawGeckoDocumentBorrowed, raw_data: RawServoStyleSetBorrowedMut) -> () {
|
||||||
let document = unsafe { GeckoDocument::from_raw(doc) };
|
let document = GeckoDocument(doc);
|
||||||
let node = match document.root_node() {
|
let node = match document.root_node() {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => return,
|
None => return,
|
||||||
|
@ -136,7 +138,7 @@ pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_NodeData_Drop(data: ServoNodeDataOwned) -> () {
|
pub extern "C" fn Servo_NodeData_Drop(data: ServoNodeDataMaybeOwned) -> () {
|
||||||
let _ = data.into_box_opt::<NonOpaqueStyleData>();
|
let _ = data.into_box_opt::<NonOpaqueStyleData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +176,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(bytes: *const u8,
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_AppendStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
pub extern "C" fn Servo_StyleSet_AppendStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
||||||
raw_sheet: RawServoStyleSheetBorrowed) {
|
raw_sheet: RawServoStyleSheetMaybeBorrowed) {
|
||||||
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
let sheet = raw_sheet.as_arc();
|
let sheet = raw_sheet.as_arc();
|
||||||
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
||||||
|
@ -184,7 +186,7 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(raw_data: RawServoStyleSetBorr
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_PrependStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
pub extern "C" fn Servo_StyleSet_PrependStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
||||||
raw_sheet: RawServoStyleSheetBorrowed) {
|
raw_sheet: RawServoStyleSheetMaybeBorrowed) {
|
||||||
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
let sheet = raw_sheet.as_arc();
|
let sheet = raw_sheet.as_arc();
|
||||||
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
||||||
|
@ -194,8 +196,8 @@ pub extern "C" fn Servo_StyleSet_PrependStyleSheet(raw_data: RawServoStyleSetBor
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(raw_data: RawServoStyleSetBorrowedMut,
|
pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(raw_data: RawServoStyleSetBorrowedMut,
|
||||||
raw_sheet: RawServoStyleSheetBorrowed,
|
raw_sheet: RawServoStyleSheetMaybeBorrowed,
|
||||||
raw_reference: RawServoStyleSheetBorrowed) {
|
raw_reference: RawServoStyleSheetMaybeBorrowed) {
|
||||||
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
let sheet = raw_sheet.as_arc();
|
let sheet = raw_sheet.as_arc();
|
||||||
let reference = raw_reference.as_arc();
|
let reference = raw_reference.as_arc();
|
||||||
|
@ -207,7 +209,7 @@ pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(raw_data: RawServoStyleS
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(raw_data: RawServoStyleSetBorrowedMut,
|
||||||
raw_sheet: RawServoStyleSheetBorrowed) {
|
raw_sheet: RawServoStyleSheetMaybeBorrowed) {
|
||||||
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
let sheet = raw_sheet.as_arc();
|
let sheet = raw_sheet.as_arc();
|
||||||
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
|
||||||
|
@ -215,24 +217,24 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(raw_data: RawServoStyleSetBorr
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSheet_HasRules(raw_sheet: RawServoStyleSheetBorrowed) -> bool {
|
pub extern "C" fn Servo_StyleSheet_HasRules(raw_sheet: RawServoStyleSheetMaybeBorrowed) -> bool {
|
||||||
!raw_sheet.as_arc::<Stylesheet>().rules.is_empty()
|
!raw_sheet.as_arc::<Stylesheet>().rules.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetBorrowed) -> () {
|
pub extern "C" fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetMaybeBorrowed) -> () {
|
||||||
unsafe { Stylesheet::addref(sheet) };
|
unsafe { Stylesheet::addref(sheet) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetBorrowed) -> () {
|
pub extern "C" fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetMaybeBorrowed) -> () {
|
||||||
unsafe { Stylesheet::release(sheet) };
|
unsafe { Stylesheet::release(sheet) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_Get(node: *mut RawGeckoNode)
|
pub extern "C" fn Servo_ComputedValues_Get(node: RawGeckoNodeBorrowed)
|
||||||
-> ServoComputedValuesStrong {
|
-> ServoComputedValuesStrong {
|
||||||
let node = unsafe { GeckoNode::from_raw(node) };
|
let node = unsafe { GeckoNode(node) };
|
||||||
let arc_cv = match node.borrow_data().map_or(None, |data| data.style.clone()) {
|
let arc_cv = match node.borrow_data().map_or(None, |data| data.style.clone()) {
|
||||||
Some(style) => style,
|
Some(style) => style,
|
||||||
None => {
|
None => {
|
||||||
|
@ -248,7 +250,7 @@ pub extern "C" fn Servo_ComputedValues_Get(node: *mut RawGeckoNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesBorrowed,
|
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesMaybeBorrowed,
|
||||||
pseudo_tag: *mut nsIAtom,
|
pseudo_tag: *mut nsIAtom,
|
||||||
raw_data: RawServoStyleSetBorrowedMut)
|
raw_data: RawServoStyleSetBorrowedMut)
|
||||||
-> ServoComputedValuesStrong {
|
-> ServoComputedValuesStrong {
|
||||||
|
@ -266,13 +268,13 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoComputedValuesBorrowed,
|
pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoComputedValuesMaybeBorrowed,
|
||||||
match_element: *mut RawGeckoElement,
|
match_element: RawGeckoElementBorrowed,
|
||||||
pseudo_tag: *mut nsIAtom,
|
pseudo_tag: *mut nsIAtom,
|
||||||
raw_data: RawServoStyleSetBorrowedMut,
|
raw_data: RawServoStyleSetBorrowedMut,
|
||||||
is_probe: bool)
|
is_probe: bool)
|
||||||
-> ServoComputedValuesStrong {
|
-> ServoComputedValuesStrong {
|
||||||
debug_assert!(!match_element.is_null());
|
debug_assert!(!(match_element as *const _).is_null());
|
||||||
|
|
||||||
let parent_or_null = || {
|
let parent_or_null = || {
|
||||||
if is_probe {
|
if is_probe {
|
||||||
|
@ -289,7 +291,7 @@ pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoCo
|
||||||
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
let data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
data.flush_stylesheets();
|
data.flush_stylesheets();
|
||||||
|
|
||||||
let element = unsafe { GeckoElement::from_raw(match_element) };
|
let element = unsafe { GeckoElement(match_element) };
|
||||||
|
|
||||||
|
|
||||||
match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) {
|
match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) {
|
||||||
|
@ -315,7 +317,7 @@ pub extern "C" fn Servo_ComputedValues_GetForPseudoElement(parent_style: ServoCo
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_Inherit(parent_style: ServoComputedValuesBorrowed)
|
pub extern "C" fn Servo_ComputedValues_Inherit(parent_style: ServoComputedValuesMaybeBorrowed)
|
||||||
-> ServoComputedValuesStrong {
|
-> ServoComputedValuesStrong {
|
||||||
let style = if parent_style.is_null() {
|
let style = if parent_style.is_null() {
|
||||||
Arc::new(ComputedValues::initial_values().clone())
|
Arc::new(ComputedValues::initial_values().clone())
|
||||||
|
@ -326,12 +328,12 @@ pub extern "C" fn Servo_ComputedValues_Inherit(parent_style: ServoComputedValues
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesBorrowed) -> () {
|
pub extern "C" fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesMaybeBorrowed) -> () {
|
||||||
unsafe { ComputedValues::addref(ptr) };
|
unsafe { ComputedValues::addref(ptr) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed) -> () {
|
pub extern "C" fn Servo_ComputedValues_Release(ptr: ServoComputedValuesMaybeBorrowed) -> () {
|
||||||
unsafe { ComputedValues::release(ptr) };
|
unsafe { ComputedValues::release(ptr) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,28 +378,28 @@ pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: ServoDeclarationBlockBorrowed) {
|
pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: ServoDeclarationBlockMaybeBorrowed) {
|
||||||
unsafe { GeckoDeclarationBlock::addref(declarations) };
|
unsafe { GeckoDeclarationBlock::addref(declarations) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_Release(declarations: ServoDeclarationBlockBorrowed) {
|
pub extern "C" fn Servo_DeclarationBlock_Release(declarations: ServoDeclarationBlockMaybeBorrowed) {
|
||||||
unsafe { GeckoDeclarationBlock::release(declarations) };
|
unsafe { GeckoDeclarationBlock::release(declarations) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_GetCache(declarations: ServoDeclarationBlockBorrowed)
|
pub extern "C" fn Servo_DeclarationBlock_GetCache(declarations: ServoDeclarationBlockMaybeBorrowed)
|
||||||
-> *mut nsHTMLCSSStyleSheet {
|
-> *mut nsHTMLCSSStyleSheet {
|
||||||
declarations.as_arc::<GeckoDeclarationBlock>().cache.load(Ordering::Relaxed)
|
declarations.as_arc::<GeckoDeclarationBlock>().cache.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_SetImmutable(declarations: ServoDeclarationBlockBorrowed) {
|
pub extern "C" fn Servo_DeclarationBlock_SetImmutable(declarations: ServoDeclarationBlockMaybeBorrowed) {
|
||||||
declarations.as_arc::<GeckoDeclarationBlock>().immutable.store(true, Ordering::Relaxed)
|
declarations.as_arc::<GeckoDeclarationBlock>().immutable.store(true, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_ClearCachePointer(declarations: ServoDeclarationBlockBorrowed) {
|
pub extern "C" fn Servo_DeclarationBlock_ClearCachePointer(declarations: ServoDeclarationBlockMaybeBorrowed) {
|
||||||
declarations.as_arc::<GeckoDeclarationBlock>().cache.store(ptr::null_mut(), Ordering::Relaxed)
|
declarations.as_arc::<GeckoDeclarationBlock>().cache.store(ptr::null_mut(), Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,12 +419,12 @@ pub extern "C" fn Servo_CSSSupports(property: *const u8, property_length: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ComputeRestyleHint(element: *mut RawGeckoElement,
|
pub extern "C" fn Servo_ComputeRestyleHint(element: RawGeckoElementBorrowed,
|
||||||
snapshot: *mut ServoElementSnapshot,
|
snapshot: *mut ServoElementSnapshot,
|
||||||
raw_data: *mut RawServoStyleSet) -> nsRestyleHint {
|
raw_data: RawServoStyleSetBorrowedMut) -> nsRestyleHint {
|
||||||
let per_doc_data = unsafe { &mut *(raw_data as *mut PerDocumentStyleData) };
|
let per_doc_data = PerDocumentStyleData::from_ffi_mut(raw_data);
|
||||||
let snapshot = unsafe { GeckoElementSnapshot::from_raw(snapshot) };
|
let snapshot = unsafe { GeckoElementSnapshot::from_raw(snapshot) };
|
||||||
let element = unsafe { GeckoElement::from_raw(element) };
|
let element = unsafe { GeckoElement(element) };
|
||||||
|
|
||||||
// NB: This involves an FFI call, we can get rid of it easily if needed.
|
// NB: This involves an FFI call, we can get rid of it easily if needed.
|
||||||
let current_state = element.get_state();
|
let current_state = element.get_state();
|
||||||
|
|
|
@ -23,6 +23,8 @@ use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_IsTextNo
|
||||||
use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
|
use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
|
||||||
use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement, Gecko_SetNodeData};
|
use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement, Gecko_SetNodeData};
|
||||||
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
||||||
|
use gecko_bindings::bindings::RawGeckoDocumentBorrowed;
|
||||||
|
use gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoNodeBorrowed};
|
||||||
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
|
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
|
||||||
use gecko_bindings::structs::{nsIAtom, nsChangeHint, nsStyleContext};
|
use gecko_bindings::structs::{nsIAtom, nsChangeHint, nsStyleContext};
|
||||||
use gecko_bindings::sugar::ownership::Borrowed;
|
use gecko_bindings::sugar::ownership::Borrowed;
|
||||||
|
@ -74,35 +76,20 @@ impl NonOpaqueStyleData {
|
||||||
// could implement refcounting if need be (at a potentially non-trivial
|
// could implement refcounting if need be (at a potentially non-trivial
|
||||||
// performance cost) by implementing Drop and making LayoutFoo non-Copy.
|
// performance cost) by implementing Drop and making LayoutFoo non-Copy.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct GeckoNode<'ln> {
|
pub struct GeckoNode<'ln>(pub &'ln RawGeckoNode);
|
||||||
node: *mut RawGeckoNode,
|
|
||||||
chain: PhantomData<&'ln ()>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ln> GeckoNode<'ln> {
|
impl<'ln> GeckoNode<'ln> {
|
||||||
pub unsafe fn from_raw(n: *mut RawGeckoNode) -> GeckoNode<'ln> {
|
|
||||||
GeckoNode {
|
|
||||||
node: n,
|
|
||||||
chain: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn from_ref(n: &RawGeckoNode) -> GeckoNode<'ln> {
|
|
||||||
GeckoNode::from_raw(n as *const RawGeckoNode as *mut RawGeckoNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_node_data(&self) -> Borrowed<NonOpaqueStyleData> {
|
fn get_node_data(&self) -> Borrowed<NonOpaqueStyleData> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// XXXManishearth should GeckoNode just contain an &'ln RawGeckoNode?
|
Borrowed::from_ffi(Gecko_GetNodeData(&*self.0))
|
||||||
Borrowed::from_ffi(Gecko_GetNodeData(&*self.node))
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn initialize_data(self) {
|
pub fn initialize_data(self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
if self.get_node_data().is_null() {
|
if self.get_node_data().is_null() {
|
||||||
let ptr = Box::new(NonOpaqueStyleData::new());
|
let ptr = Box::new(NonOpaqueStyleData::new());
|
||||||
Gecko_SetNodeData(&mut *self.node, ptr.into_ffi().maybe());
|
Gecko_SetNodeData(self.0, ptr.into_ffi().maybe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,22 +136,22 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
type ConcreteChildrenIterator = GeckoChildrenIterator<'ln>;
|
type ConcreteChildrenIterator = GeckoChildrenIterator<'ln>;
|
||||||
|
|
||||||
fn to_unsafe(&self) -> UnsafeNode {
|
fn to_unsafe(&self) -> UnsafeNode {
|
||||||
(self.node as usize, 0)
|
(self.0 as *const _ as usize, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn from_unsafe(n: &UnsafeNode) -> Self {
|
unsafe fn from_unsafe(n: &UnsafeNode) -> Self {
|
||||||
GeckoNode::from_raw(n.0 as *mut RawGeckoNode)
|
GeckoNode(&*(n.0 as *mut RawGeckoNode))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_text_node(&self) -> bool {
|
fn is_text_node(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_IsTextNode(self.node)
|
Gecko_IsTextNode(self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_element(&self) -> bool {
|
fn is_element(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_NodeIsElement(self.node)
|
Gecko_NodeIsElement(self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +164,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn children(self) -> GeckoChildrenIterator<'ln> {
|
fn children(self) -> GeckoChildrenIterator<'ln> {
|
||||||
let maybe_iter = unsafe { Gecko_MaybeCreateStyleChildrenIterator(self.node) };
|
let maybe_iter = unsafe { Gecko_MaybeCreateStyleChildrenIterator(self.0) };
|
||||||
if !maybe_iter.is_null() {
|
if !maybe_iter.is_null() {
|
||||||
GeckoChildrenIterator::GeckoIterator(maybe_iter)
|
GeckoChildrenIterator::GeckoIterator(maybe_iter)
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,7 +173,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn opaque(&self) -> OpaqueNode {
|
fn opaque(&self) -> OpaqueNode {
|
||||||
let ptr: uintptr_t = self.node as uintptr_t;
|
let ptr: uintptr_t = self.0 as *const _ as uintptr_t;
|
||||||
OpaqueNode(ptr)
|
OpaqueNode(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +191,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
|
|
||||||
fn as_element(&self) -> Option<GeckoElement<'ln>> {
|
fn as_element(&self) -> Option<GeckoElement<'ln>> {
|
||||||
if self.is_element() {
|
if self.is_element() {
|
||||||
unsafe { Some(GeckoElement::from_raw(self.node as *mut RawGeckoElement)) }
|
unsafe { Some(GeckoElement(&*(self.0 as *const _ as *const RawGeckoElement))) }
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -229,15 +216,15 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let flags = unsafe { Gecko_GetNodeFlags(self.node) };
|
let flags = unsafe { Gecko_GetNodeFlags(self.0) };
|
||||||
flags & (NODE_IS_DIRTY_FOR_SERVO as u32) != 0
|
flags & (NODE_IS_DIRTY_FOR_SERVO as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn set_dirty(&self, value: bool) {
|
unsafe fn set_dirty(&self, value: bool) {
|
||||||
if value {
|
if value {
|
||||||
Gecko_SetNodeFlags(self.node, NODE_IS_DIRTY_FOR_SERVO as u32)
|
Gecko_SetNodeFlags(self.0, NODE_IS_DIRTY_FOR_SERVO as u32)
|
||||||
} else {
|
} else {
|
||||||
Gecko_UnsetNodeFlags(self.node, NODE_IS_DIRTY_FOR_SERVO as u32)
|
Gecko_UnsetNodeFlags(self.0, NODE_IS_DIRTY_FOR_SERVO as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,15 +234,15 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
if self.get_node_data().is_null() {
|
if self.get_node_data().is_null() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let flags = unsafe { Gecko_GetNodeFlags(self.node) };
|
let flags = unsafe { Gecko_GetNodeFlags(self.0) };
|
||||||
flags & (NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
|
flags & (NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn set_dirty_descendants(&self, value: bool) {
|
unsafe fn set_dirty_descendants(&self, value: bool) {
|
||||||
if value {
|
if value {
|
||||||
Gecko_SetNodeFlags(self.node, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
|
Gecko_SetNodeFlags(self.0, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
|
||||||
} else {
|
} else {
|
||||||
Gecko_UnsetNodeFlags(self.node, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
|
Gecko_UnsetNodeFlags(self.0, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,36 +279,36 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_restyle_damage(self, damage: Self::ConcreteRestyleDamage) {
|
fn set_restyle_damage(self, damage: Self::ConcreteRestyleDamage) {
|
||||||
unsafe { Gecko_StoreStyleDifference(self.node, damage.0) }
|
unsafe { Gecko_StoreStyleDifference(self.0, damage.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_node(&self) -> Option<GeckoNode<'ln>> {
|
fn parent_node(&self) -> Option<GeckoNode<'ln>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetParentNode(self.node).as_ref().map(|n| GeckoNode::from_ref(n))
|
Gecko_GetParentNode(self.0).borrow_opt().map(|n| GeckoNode(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn first_child(&self) -> Option<GeckoNode<'ln>> {
|
fn first_child(&self) -> Option<GeckoNode<'ln>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetFirstChild(self.node).as_ref().map(|n| GeckoNode::from_ref(n))
|
Gecko_GetFirstChild(self.0).borrow_opt().map(|n| GeckoNode(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn last_child(&self) -> Option<GeckoNode<'ln>> {
|
fn last_child(&self) -> Option<GeckoNode<'ln>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetLastChild(self.node).as_ref().map(|n| GeckoNode::from_ref(n))
|
Gecko_GetLastChild(self.0).borrow_opt().map(|n| GeckoNode(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prev_sibling(&self) -> Option<GeckoNode<'ln>> {
|
fn prev_sibling(&self) -> Option<GeckoNode<'ln>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetPrevSibling(self.node).as_ref().map(|n| GeckoNode::from_ref(n))
|
Gecko_GetPrevSibling(self.0).borrow_opt().map(|n| GeckoNode(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_sibling(&self) -> Option<GeckoNode<'ln>> {
|
fn next_sibling(&self) -> Option<GeckoNode<'ln>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetNextSibling(self.node).as_ref().map(|n| GeckoNode::from_ref(n))
|
Gecko_GetNextSibling(self.0).borrow_opt().map(|n| GeckoNode(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +324,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let atom_ptr = pseudo.map(|p| p.as_atom().as_ptr())
|
let atom_ptr = pseudo.map(|p| p.as_atom().as_ptr())
|
||||||
.unwrap_or(ptr::null_mut());
|
.unwrap_or(ptr::null_mut());
|
||||||
let context_ptr = Gecko_GetStyleContext(self.node, atom_ptr);
|
let context_ptr = Gecko_GetStyleContext(self.0, atom_ptr);
|
||||||
context_ptr.as_ref()
|
context_ptr.as_ref()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,38 +376,26 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct GeckoDocument<'ld> {
|
pub struct GeckoDocument<'ld>(pub &'ld RawGeckoDocument);
|
||||||
document: *mut RawGeckoDocument,
|
|
||||||
chain: PhantomData<&'ld ()>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ld> GeckoDocument<'ld> {
|
|
||||||
pub unsafe fn from_raw(doc: *mut RawGeckoDocument) -> GeckoDocument<'ld> {
|
|
||||||
GeckoDocument {
|
|
||||||
document: doc,
|
|
||||||
chain: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ld> TDocument for GeckoDocument<'ld> {
|
impl<'ld> TDocument for GeckoDocument<'ld> {
|
||||||
type ConcreteNode = GeckoNode<'ld>;
|
type ConcreteNode = GeckoNode<'ld>;
|
||||||
type ConcreteElement = GeckoElement<'ld>;
|
type ConcreteElement = GeckoElement<'ld>;
|
||||||
|
|
||||||
fn as_node(&self) -> GeckoNode<'ld> {
|
fn as_node(&self) -> GeckoNode<'ld> {
|
||||||
unsafe { GeckoNode::from_raw(self.document as *mut RawGeckoNode) }
|
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root_node(&self) -> Option<GeckoNode<'ld>> {
|
fn root_node(&self) -> Option<GeckoNode<'ld>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetDocumentElement(self.document).as_ref().map(|el| GeckoElement::from_ref(el).as_node())
|
Gecko_GetDocumentElement(self.0).borrow_opt().map(|el| GeckoElement(el).as_node())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drain_modified_elements(&self) -> Vec<(GeckoElement<'ld>, GeckoElementSnapshot)> {
|
fn drain_modified_elements(&self) -> Vec<(GeckoElement<'ld>, GeckoElementSnapshot)> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
/*
|
/*
|
||||||
let elements = unsafe { self.document.drain_modified_elements() };
|
let elements = unsafe { self.0.drain_modified_elements() };
|
||||||
elements.into_iter().map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot)).collect()*/
|
elements.into_iter().map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot)).collect()*/
|
||||||
}
|
}
|
||||||
fn will_paint(&self) { unimplemented!() }
|
fn will_paint(&self) { unimplemented!() }
|
||||||
|
@ -428,10 +403,7 @@ impl<'ld> TDocument for GeckoDocument<'ld> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct GeckoElement<'le> {
|
pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
|
||||||
element: *mut RawGeckoElement,
|
|
||||||
chain: PhantomData<&'le ()>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'le> fmt::Debug for GeckoElement<'le> {
|
impl<'le> fmt::Debug for GeckoElement<'le> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
@ -444,17 +416,6 @@ impl<'le> fmt::Debug for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> GeckoElement<'le> {
|
impl<'le> GeckoElement<'le> {
|
||||||
pub unsafe fn from_raw(el: *mut RawGeckoElement) -> GeckoElement<'le> {
|
|
||||||
GeckoElement {
|
|
||||||
element: el,
|
|
||||||
chain: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe fn from_ref(el: &RawGeckoElement) -> GeckoElement<'le> {
|
|
||||||
GeckoElement::from_raw(el as *const RawGeckoElement as *mut RawGeckoElement)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_style_attribute(value: &str) -> Option<PropertyDeclarationBlock> {
|
pub fn parse_style_attribute(value: &str) -> Option<PropertyDeclarationBlock> {
|
||||||
// FIXME(bholley): Real base URL and error reporter.
|
// FIXME(bholley): Real base URL and error reporter.
|
||||||
let base_url = &*DUMMY_BASE_URL;
|
let base_url = &*DUMMY_BASE_URL;
|
||||||
|
@ -476,11 +437,11 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
type ConcreteDocument = GeckoDocument<'le>;
|
type ConcreteDocument = GeckoDocument<'le>;
|
||||||
|
|
||||||
fn as_node(&self) -> Self::ConcreteNode {
|
fn as_node(&self) -> Self::ConcreteNode {
|
||||||
unsafe { GeckoNode::from_raw(self.element as *mut RawGeckoNode) }
|
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_attribute(&self) -> Option<&Arc<PropertyDeclarationBlock>> {
|
fn style_attribute(&self) -> Option<&Arc<PropertyDeclarationBlock>> {
|
||||||
let declarations = unsafe { Gecko_GetServoDeclarationBlock(self.element) };
|
let declarations = unsafe { Gecko_GetServoDeclarationBlock(self.0) };
|
||||||
if declarations.is_null() {
|
if declarations.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -491,14 +452,14 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
|
|
||||||
fn get_state(&self) -> ElementState {
|
fn get_state(&self) -> ElementState {
|
||||||
unsafe {
|
unsafe {
|
||||||
ElementState::from_bits_truncate(Gecko_ElementState(self.element) as u16)
|
ElementState::from_bits_truncate(Gecko_ElementState(self.0) as u16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool {
|
fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_HasAttr(self.element,
|
bindings::Gecko_HasAttr(self.0,
|
||||||
namespace.0.as_ptr(),
|
namespace.0.as_ptr(),
|
||||||
attr.as_ptr())
|
attr.as_ptr())
|
||||||
}
|
}
|
||||||
|
@ -507,7 +468,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, val: &Atom) -> bool {
|
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, val: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrEquals(self.element,
|
bindings::Gecko_AttrEquals(self.0,
|
||||||
namespace.0.as_ptr(),
|
namespace.0.as_ptr(),
|
||||||
attr.as_ptr(),
|
attr.as_ptr(),
|
||||||
val.as_ptr(),
|
val.as_ptr(),
|
||||||
|
@ -518,7 +479,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
|
|
||||||
impl<'le> PartialEq for GeckoElement<'le> {
|
impl<'le> PartialEq for GeckoElement<'le> {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.element == other.element
|
self.0 as *const _ == other.0 as *const _
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,37 +494,37 @@ impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
||||||
impl<'le> ::selectors::Element for GeckoElement<'le> {
|
impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
fn parent_element(&self) -> Option<Self> {
|
fn parent_element(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetParentElement(self.element).as_ref().map(|el| GeckoElement::from_ref(el))
|
Gecko_GetParentElement(self.0).borrow_opt().map(|el| GeckoElement(el))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn first_child_element(&self) -> Option<Self> {
|
fn first_child_element(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetFirstChildElement(self.element).as_ref().map(|el| GeckoElement::from_ref(el))
|
Gecko_GetFirstChildElement(self.0).borrow_opt().map(|el| GeckoElement(el))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn last_child_element(&self) -> Option<Self> {
|
fn last_child_element(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetLastChildElement(self.element).as_ref().map(|el| GeckoElement::from_ref(el))
|
Gecko_GetLastChildElement(self.0).borrow_opt().map(|el| GeckoElement(el))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prev_sibling_element(&self) -> Option<Self> {
|
fn prev_sibling_element(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetPrevSiblingElement(self.element).as_ref().map(|el| GeckoElement::from_ref(el))
|
Gecko_GetPrevSiblingElement(self.0).borrow_opt().map(|el| GeckoElement(el))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_sibling_element(&self) -> Option<Self> {
|
fn next_sibling_element(&self) -> Option<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_GetNextSiblingElement(self.element).as_ref().map(|el| GeckoElement::from_ref(el))
|
Gecko_GetNextSiblingElement(self.0).borrow_opt().map(|el| GeckoElement(el))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_root(&self) -> bool {
|
fn is_root(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_IsRootElement(self.element)
|
Gecko_IsRootElement(self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,22 +535,22 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
|
|
||||||
fn get_local_name(&self) -> &WeakAtom {
|
fn get_local_name(&self) -> &WeakAtom {
|
||||||
unsafe {
|
unsafe {
|
||||||
WeakAtom::new(Gecko_LocalName(self.element))
|
WeakAtom::new(Gecko_LocalName(self.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_namespace(&self) -> &WeakNamespace {
|
fn get_namespace(&self) -> &WeakNamespace {
|
||||||
unsafe {
|
unsafe {
|
||||||
WeakNamespace::new(Gecko_Namespace(self.element))
|
WeakNamespace::new(Gecko_Namespace(self.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {
|
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {
|
||||||
match pseudo_class {
|
match pseudo_class {
|
||||||
// https://github.com/servo/servo/issues/8718
|
// https://github.com/servo/servo/issues/8718
|
||||||
NonTSPseudoClass::AnyLink => unsafe { Gecko_IsLink(self.element) },
|
NonTSPseudoClass::AnyLink => unsafe { Gecko_IsLink(self.0) },
|
||||||
NonTSPseudoClass::Link => unsafe { Gecko_IsUnvisitedLink(self.element) },
|
NonTSPseudoClass::Link => unsafe { Gecko_IsUnvisitedLink(self.0) },
|
||||||
NonTSPseudoClass::Visited => unsafe { Gecko_IsVisitedLink(self.element) },
|
NonTSPseudoClass::Visited => unsafe { Gecko_IsVisitedLink(self.0) },
|
||||||
NonTSPseudoClass::Active |
|
NonTSPseudoClass::Active |
|
||||||
NonTSPseudoClass::Focus |
|
NonTSPseudoClass::Focus |
|
||||||
NonTSPseudoClass::Hover |
|
NonTSPseudoClass::Hover |
|
||||||
|
@ -608,7 +569,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
|
|
||||||
fn get_id(&self) -> Option<Atom> {
|
fn get_id(&self) -> Option<Atom> {
|
||||||
let ptr = unsafe {
|
let ptr = unsafe {
|
||||||
bindings::Gecko_AtomAttrValue(self.element,
|
bindings::Gecko_AtomAttrValue(self.0,
|
||||||
atom!("id").as_ptr())
|
atom!("id").as_ptr())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -620,7 +581,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_class(&self, name: &Atom) -> bool {
|
fn has_class(&self, name: &Atom) -> bool {
|
||||||
snapshot_helpers::has_class(self.element,
|
snapshot_helpers::has_class(self.0,
|
||||||
name,
|
name,
|
||||||
Gecko_ClassOrClassList)
|
Gecko_ClassOrClassList)
|
||||||
}
|
}
|
||||||
|
@ -628,14 +589,14 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
fn each_class<F>(&self, callback: F)
|
fn each_class<F>(&self, callback: F)
|
||||||
where F: FnMut(&Atom)
|
where F: FnMut(&Atom)
|
||||||
{
|
{
|
||||||
snapshot_helpers::each_class(self.element,
|
snapshot_helpers::each_class(self.0,
|
||||||
callback,
|
callback,
|
||||||
Gecko_ClassOrClassList)
|
Gecko_ClassOrClassList)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_html_element_in_html_document(&self) -> bool {
|
fn is_html_element_in_html_document(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
Gecko_IsHTMLElementInHTMLDocument(self.element)
|
Gecko_IsHTMLElementInHTMLDocument(self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,14 +628,14 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
|
|
||||||
fn match_attr_has(&self, attr: &AttrSelector<Self::Impl>) -> bool {
|
fn match_attr_has(&self, attr: &AttrSelector<Self::Impl>) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_HasAttr(self.element,
|
bindings::Gecko_HasAttr(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()))
|
attr.select_name(self.is_html_element_in_html_document()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn match_attr_equals(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_equals(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrEquals(self.element,
|
bindings::Gecko_AttrEquals(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr(),
|
value.as_ptr(),
|
||||||
|
@ -683,7 +644,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_equals_ignore_ascii_case(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_equals_ignore_ascii_case(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrEquals(self.element,
|
bindings::Gecko_AttrEquals(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr(),
|
value.as_ptr(),
|
||||||
|
@ -692,7 +653,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_includes(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_includes(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrIncludes(self.element,
|
bindings::Gecko_AttrIncludes(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr())
|
value.as_ptr())
|
||||||
|
@ -700,7 +661,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_dash(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_dash(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrDashEquals(self.element,
|
bindings::Gecko_AttrDashEquals(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr())
|
value.as_ptr())
|
||||||
|
@ -708,7 +669,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_prefix(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_prefix(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrHasPrefix(self.element,
|
bindings::Gecko_AttrHasPrefix(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr())
|
value.as_ptr())
|
||||||
|
@ -716,7 +677,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_substring(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_substring(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrHasSubstring(self.element,
|
bindings::Gecko_AttrHasSubstring(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr())
|
value.as_ptr())
|
||||||
|
@ -724,7 +685,7 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
fn match_attr_suffix(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
fn match_attr_suffix(&self, attr: &AttrSelector<Self::Impl>, value: &Atom) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AttrHasSuffix(self.element,
|
bindings::Gecko_AttrHasSuffix(self.0,
|
||||||
attr.ns_or_null(),
|
attr.ns_or_null(),
|
||||||
attr.select_name(self.is_html_element_in_html_document()),
|
attr.select_name(self.is_html_element_in_html_document()),
|
||||||
value.as_ptr())
|
value.as_ptr())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue