mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
stylo: Implement custom property value getter
This commit is contained in:
parent
50bef977d0
commit
c4ccc759e7
1 changed files with 18 additions and 0 deletions
|
@ -3083,3 +3083,21 @@ pub extern "C" fn Servo_StyleSet_HasStateDependency(raw_data: RawServoStyleSetBo
|
|||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
data.stylist.might_have_state_dependency(ElementState::from_bits_truncate(state))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_GetCustomProperty(computed_values: ServoComputedValuesBorrowed,
|
||||
name: *const nsAString, value: *mut nsAString) -> bool {
|
||||
let custom_properties = match ComputedValues::as_arc(&computed_values).custom_properties() {
|
||||
Some(p) => p,
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let name = unsafe { Atom::from((&*name)) };
|
||||
let computed_value = match custom_properties.get(&name) {
|
||||
Some(v) => v,
|
||||
None => return false,
|
||||
};
|
||||
|
||||
computed_value.to_css(unsafe { value.as_mut().unwrap() }).unwrap();
|
||||
true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue