mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
style: Support shape-image: <image>
MozReview-Commit-ID: GSCZIMEpCS2
This commit is contained in:
parent
b8b5c5371f
commit
f3dbaad222
5 changed files with 82 additions and 27 deletions
|
@ -5008,18 +5008,32 @@ fn static_assert() {
|
|||
use gecko::conversions::basic_shape::set_corners_from_radius;
|
||||
use gecko::values::GeckoStyleCoordConvertible;
|
||||
use values::generics::basic_shape::{BasicShape, FillRule, ShapeSource};
|
||||
|
||||
let ref mut ${ident} = self.gecko.${gecko_ffi_name};
|
||||
|
||||
// clean up existing struct
|
||||
unsafe { Gecko_DestroyShapeSource(${ident}) };
|
||||
|
||||
${ident}.mType = StyleShapeSourceType::None;
|
||||
|
||||
match v {
|
||||
ShapeSource::Url(ref url) => {
|
||||
% if ident == "clip_path":
|
||||
ShapeSource::ImageOrUrl(ref url) => {
|
||||
unsafe {
|
||||
bindings::Gecko_StyleShapeSource_SetURLValue(${ident}, url.for_ffi())
|
||||
}
|
||||
}
|
||||
% elif ident == "shape_outside":
|
||||
ShapeSource::ImageOrUrl(image) => {
|
||||
unsafe {
|
||||
bindings::Gecko_NewShapeImage(${ident});
|
||||
let style_image = &mut *${ident}.mShapeImage.mPtr;
|
||||
style_image.set(image);
|
||||
}
|
||||
}
|
||||
% else:
|
||||
<% raise Exception("Unknown property: %s" % ident) %>
|
||||
}
|
||||
% endif
|
||||
ShapeSource::None => {} // don't change the type
|
||||
ShapeSource::Box(reference) => {
|
||||
${ident}.mReferenceBox = reference.into();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue