mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Add safer bindings for refcounted types across ffi
This commit is contained in:
parent
8fd74e026c
commit
0d4d1b539e
10 changed files with 248 additions and 180 deletions
|
@ -6,10 +6,23 @@
|
|||
//! Ideally, it would be in geckolib itself, but coherence
|
||||
//! forces us to keep the traits and implementations here
|
||||
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use gecko_bindings::bindings::{RawServoStyleSheet, ServoComputedValues};
|
||||
use gecko_bindings::structs::nsStyleCoord_CalcValue;
|
||||
use gecko_bindings::sugar::refptr::HasArcFFI;
|
||||
use properties::ComputedValues;
|
||||
use stylesheets::Stylesheet;
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage};
|
||||
|
||||
unsafe impl HasArcFFI for Stylesheet {
|
||||
type FFIType = RawServoStyleSheet;
|
||||
}
|
||||
unsafe impl HasArcFFI for ComputedValues {
|
||||
type FFIType = ServoComputedValues;
|
||||
}
|
||||
|
||||
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
|
||||
fn from(other: CalcLengthOrPercentage) -> nsStyleCoord_CalcValue {
|
||||
let has_percentage = other.percentage.is_some();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue