style: Use OwnedSlice for will-change.

We could use ArcSlice if wanted I guess, your call. Though will change is not
supposed to be used very frequently.

Differential Revision: https://phabricator.services.mozilla.com/D30548
This commit is contained in:
Emilio Cobos Álvarez 2019-05-16 23:23:28 +00:00
parent 5f6c8d9060
commit 85752fa479
2 changed files with 25 additions and 84 deletions

View file

@ -2513,7 +2513,7 @@ fn static_assert() {
transition-timing-function transition-property
transform-style
rotate scroll-snap-points-x scroll-snap-points-y
scroll-snap-coordinate -moz-binding will-change
scroll-snap-coordinate -moz-binding
offset-path shape-outside
translate scale -webkit-line-clamp""" %>
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
@ -2829,66 +2829,6 @@ fn static_assert() {
${impl_individual_transform('translate', 'Translate', 'mSpecifiedTranslate')}
${impl_individual_transform('scale', 'Scale', 'mSpecifiedScale')}
pub fn set_will_change(&mut self, v: longhands::will_change::computed_value::T) {
use crate::gecko_bindings::bindings::{Gecko_AppendWillChange, Gecko_ClearWillChange};
use crate::values::specified::box_::{WillChangeBits, WillChange};
match v {
WillChange::AnimateableFeatures { features, bits } => {
unsafe {
Gecko_ClearWillChange(&mut *self.gecko, features.len());
}
for feature in features.iter() {
unsafe {
Gecko_AppendWillChange(&mut *self.gecko, feature.0.as_ptr())
}
}
self.gecko.mWillChangeBitField = bits;
},
WillChange::Auto => {
unsafe {
Gecko_ClearWillChange(&mut *self.gecko, 0);
}
self.gecko.mWillChangeBitField = WillChangeBits::empty();
},
};
}
pub fn copy_will_change_from(&mut self, other: &Self) {
use crate::gecko_bindings::bindings::Gecko_CopyWillChangeFrom;
self.gecko.mWillChangeBitField = other.gecko.mWillChangeBitField;
unsafe {
Gecko_CopyWillChangeFrom(&mut *self.gecko, &*other.gecko);
}
}
pub fn reset_will_change(&mut self, other: &Self) {
self.copy_will_change_from(other)
}
pub fn clone_will_change(&self) -> longhands::will_change::computed_value::T {
use crate::values::CustomIdent;
use crate::values::specified::box_::WillChange;
if self.gecko.mWillChange.len() == 0 {
return WillChange::Auto
}
let custom_idents: Vec<CustomIdent> = self.gecko.mWillChange.iter().map(|gecko_atom| {
unsafe {
CustomIdent(Atom::from_raw(gecko_atom.mRawPtr))
}
}).collect();
WillChange::AnimateableFeatures {
features: custom_idents.into_boxed_slice(),
bits: self.gecko.mWillChangeBitField,
}
}
<% impl_shape_source("shape_outside", "mShapeOutside") %>
pub fn set_offset_path(&mut self, v: longhands::offset_path::computed_value::T) {