From c4ccc759e762b9aeef695e47663c674ab6d650fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 22 Jun 2017 16:38:30 +0200 Subject: [PATCH] stylo: Implement custom property value getter --- ports/geckolib/glue.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index d2240fea4d4..0a116ed12d8 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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 +}