mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
geckolib: Add FFI function to get stylesheet origin.
This commit is contained in:
parent
0cf487b0ac
commit
9ef3871829
1 changed files with 14 additions and 0 deletions
|
@ -75,6 +75,9 @@ use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValueP
|
||||||
use style::gecko_bindings::structs::IterationCompositeOperation;
|
use style::gecko_bindings::structs::IterationCompositeOperation;
|
||||||
use style::gecko_bindings::structs::MallocSizeOf;
|
use style::gecko_bindings::structs::MallocSizeOf;
|
||||||
use style::gecko_bindings::structs::OriginFlags;
|
use style::gecko_bindings::structs::OriginFlags;
|
||||||
|
use style::gecko_bindings::structs::OriginFlags_Author;
|
||||||
|
use style::gecko_bindings::structs::OriginFlags_User;
|
||||||
|
use style::gecko_bindings::structs::OriginFlags_UserAgent;
|
||||||
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||||
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||||
use style::gecko_bindings::structs::SeenPtrs;
|
use style::gecko_bindings::structs::SeenPtrs;
|
||||||
|
@ -1012,6 +1015,17 @@ pub extern "C" fn Servo_StyleSheet_SizeOfIncludingThis(
|
||||||
.malloc_size_of_children(&guard, malloc_size_of)
|
.malloc_size_of_children(&guard, malloc_size_of)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn Servo_StyleSheet_GetOrigin(
|
||||||
|
sheet: RawServoStyleSheetContentsBorrowed
|
||||||
|
) -> OriginFlags {
|
||||||
|
match StylesheetContents::as_arc(&sheet).origin {
|
||||||
|
Origin::UserAgent => OriginFlags_UserAgent,
|
||||||
|
Origin::User => OriginFlags_User,
|
||||||
|
Origin::Author => OriginFlags_Author,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn read_locked_arc<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
|
fn read_locked_arc<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
|
||||||
where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
|
where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue