Skip to content
Permalink
Browse files

style: Unpack StyleMotion and use cbindgen for OffsetPath.

Unpack StyleMotion and move its members into nsStyleDisplay, use
cbindgen to generate StyleOffsetPath.

Differential Revision: https://phabricator.services.mozilla.com/D31164
  • Loading branch information...
BorisChiou authored and emilio committed May 20, 2019
1 parent 8ee516b commit d80a5d9196d59e5e699d35d13929b0489535978e
Showing with 3 additions and 35 deletions.
  1. +1 −35 components/style/properties/gecko.mako.rs
  2. +2 −0 components/style/values/specified/motion.rs
@@ -2205,8 +2205,7 @@ fn static_assert() {
transition-timing-function transition-property
transform-style scroll-snap-points-x
scroll-snap-points-y scroll-snap-coordinate
-moz-binding offset-path shape-outside
-webkit-line-clamp""" %>
-moz-binding shape-outside -webkit-line-clamp""" %>
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
#[inline]
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
@@ -2513,39 +2512,6 @@ fn static_assert() {

<% impl_shape_source("shape_outside", "mShapeOutside") %>

pub fn set_offset_path(&mut self, v: longhands::offset_path::computed_value::T) {
use crate::gecko_bindings::bindings::{Gecko_NewStyleMotion, Gecko_SetStyleMotion};
use crate::gecko_bindings::structs::StyleShapeSourceType;
use crate::values::generics::basic_shape::FillRule;
use crate::values::specified::OffsetPath;

let motion = unsafe { Gecko_NewStyleMotion().as_mut().unwrap() };
match v {
OffsetPath::None => motion.mOffsetPath.mType = StyleShapeSourceType::None,
OffsetPath::Path(p) => {
set_style_svg_path(&mut motion.mOffsetPath, p, FillRule::Nonzero)
},
}
unsafe { Gecko_SetStyleMotion(&mut self.gecko.mMotion, motion) };
}

pub fn clone_offset_path(&self) -> longhands::offset_path::computed_value::T {
use crate::values::specified::OffsetPath;
match unsafe { self.gecko.mMotion.mPtr.as_ref() } {
None => OffsetPath::none(),
Some(v) => (&v.mOffsetPath).into()
}
}

pub fn copy_offset_path_from(&mut self, other: &Self) {
use crate::gecko_bindings::bindings::Gecko_CopyStyleMotions;
unsafe { Gecko_CopyStyleMotions(&mut self.gecko.mMotion, other.gecko.mMotion.mPtr) };
}

pub fn reset_offset_path(&mut self, other: &Self) {
self.copy_offset_path_from(other);
}

#[allow(non_snake_case)]
pub fn set__webkit_line_clamp(&mut self, v: longhands::_webkit_line_clamp::computed_value::T) {
self.gecko.mLineClamp = match v {
@@ -12,6 +12,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
/// The offset-path value.
///
/// https://drafts.fxtf.org/motion-1/#offset-path-property
/// cbindgen:derive-tagged-enum-copy-constructor=true
#[derive(
Animate,
Clone,
@@ -26,6 +27,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
ToResolvedValue,
ToShmem,
)]
#[repr(C, u8)]
pub enum OffsetPath {
// We could merge SVGPathData into ShapeSource, so we could reuse them. However,
// we don't want to support other value for offset-path, so use SVGPathData only for now.

0 comments on commit d80a5d9

Please sign in to comment.
You can’t perform that action at this time.