stylo: Support URL clip-paths

MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
Manish Goregaokar 2017-02-09 17:43:52 -08:00 committed by Manish Goregaokar
parent 2942e3b2ea
commit c1d7941791
2 changed files with 9 additions and 29 deletions

View file

@ -704,6 +704,10 @@ extern "C" {
pub fn Gecko_NewBasicShape(type_: StyleBasicShapeType)
-> *mut StyleBasicShape;
}
extern "C" {
pub fn Gecko_StyleClipPath_SetURLValue(clip: *mut StyleClipPath,
uri: ServoBundledURI);
}
extern "C" {
pub fn Gecko_ResetFilters(effects: *mut nsStyleEffects, new_len: usize);
}

View file

@ -2624,7 +2624,11 @@ clip-path
clip_path.mType = StyleShapeSourceType::None;
match v {
ShapeSource::Url(..) => warn!("stylo: clip-path: url() not yet implemented"),
ShapeSource::Url(ref url) => {
unsafe {
bindings::Gecko_StyleClipPath_SetURLValue(clip_path, url.for_ffi());
}
}
ShapeSource::None => {} // don't change the type
ShapeSource::Box(reference) => {
clip_path.mReferenceBox = reference.into();
@ -2714,34 +2718,6 @@ clip-path
Gecko_CopyClipPathValueFrom(&mut self.gecko.mClipPath, &other.gecko.mClipPath);
}
}
pub fn clone_clip_path(&self) -> longhands::clip_path::computed_value::T {
use gecko_bindings::structs::StyleShapeSourceType;
use gecko_bindings::structs::StyleGeometryBox;
use values::computed::basic_shape::*;
let ref clip_path = self.gecko.mClipPath;
match clip_path.mType {
StyleShapeSourceType::None => ShapeSource::None,
StyleShapeSourceType::Box => {
ShapeSource::Box(clip_path.mReferenceBox.into())
}
StyleShapeSourceType::URL => {
warn!("stylo: clip-path: url() not implemented yet");
Default::default()
}
StyleShapeSourceType::Shape => {
let reference = if let StyleGeometryBox::NoBox = clip_path.mReferenceBox {
None
} else {
Some(clip_path.mReferenceBox.into())
};
let union = clip_path.__bindgen_anon_1;
let shape = unsafe { &**union.mBasicShape.as_ref() };
ShapeSource::Shape(shape.into(), reference)
}
}
}
</%self:impl_trait>
<%self:impl_trait style_struct_name="Color"