mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implement gecko glue for border-image-slice
This commit is contained in:
parent
8387d7e8b6
commit
6014c0c8ed
2 changed files with 33 additions and 2 deletions
|
@ -641,7 +641,7 @@ fn static_assert() {
|
|||
for x in CORNERS]) %>
|
||||
<%self:impl_trait style_struct_name="Border"
|
||||
skip_longhands="${skip_border_longhands} border-image-source border-image-outset
|
||||
border-image-repeat border-image-width"
|
||||
border-image-repeat border-image-width border-image-slice"
|
||||
skip_additionals="*">
|
||||
|
||||
% for side in SIDES:
|
||||
|
@ -751,6 +751,37 @@ fn static_assert() {
|
|||
.copy_from(&other.gecko.mBorderImageWidth.data_at(${side.index}));
|
||||
% endfor
|
||||
}
|
||||
|
||||
pub fn set_border_image_slice(&mut self, v: longhands::border_image_slice::computed_value::T) {
|
||||
use gecko_bindings::structs::{NS_STYLE_BORDER_IMAGE_SLICE_NOFILL, NS_STYLE_BORDER_IMAGE_SLICE_FILL};
|
||||
use properties::longhands::border_image_slice::computed_value::PercentageOrNumber;
|
||||
|
||||
for (i, corner) in v.corners.iter().enumerate() {
|
||||
match *corner {
|
||||
PercentageOrNumber::Percentage(p) => {
|
||||
self.gecko.mBorderImageSlice.data_at_mut(i).set_value(CoordDataValue::Percent(p.0))
|
||||
},
|
||||
PercentageOrNumber::Number(n) => {
|
||||
self.gecko.mBorderImageSlice.data_at_mut(i).set_value(CoordDataValue::Factor(n))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
let fill = if v.fill {
|
||||
NS_STYLE_BORDER_IMAGE_SLICE_FILL
|
||||
} else {
|
||||
NS_STYLE_BORDER_IMAGE_SLICE_NOFILL
|
||||
};
|
||||
self.gecko.mBorderImageFill = fill as u8;
|
||||
}
|
||||
|
||||
pub fn copy_border_image_slice_from(&mut self, other: &Self) {
|
||||
for i in 0..4 {
|
||||
self.gecko.mBorderImageSlice.data_at_mut(i)
|
||||
.copy_from(&other.gecko.mBorderImageSlice.data_at(i));
|
||||
}
|
||||
self.gecko.mBorderImageFill = other.gecko.mBorderImageFill;
|
||||
}
|
||||
</%self:impl_trait>
|
||||
|
||||
<% skip_margin_longhands = " ".join(["margin-%s" % x.ident for x in SIDES]) %>
|
||||
|
|
|
@ -579,7 +579,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
</%helpers:longhand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-slice
|
||||
<%helpers:longhand name="border-image-slice" products="none" animatable="False">
|
||||
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False">
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use values::LocalToCss;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue