Skip to content

Commit

Permalink
stylo: Implement custom property value getter
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Jun 22, 2017
1 parent 50bef97 commit c4ccc75
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -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
}

0 comments on commit c4ccc75

Please sign in to comment.