mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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
This commit is contained in:
parent
8ee516b681
commit
d80a5d9196
2 changed files with 3 additions and 35 deletions
|
@ -2205,8 +2205,7 @@ fn static_assert() {
|
||||||
transition-timing-function transition-property
|
transition-timing-function transition-property
|
||||||
transform-style scroll-snap-points-x
|
transform-style scroll-snap-points-x
|
||||||
scroll-snap-points-y scroll-snap-coordinate
|
scroll-snap-points-y scroll-snap-coordinate
|
||||||
-moz-binding offset-path shape-outside
|
-moz-binding shape-outside -webkit-line-clamp""" %>
|
||||||
-webkit-line-clamp""" %>
|
|
||||||
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
|
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") %>
|
<% 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)]
|
#[allow(non_snake_case)]
|
||||||
pub fn set__webkit_line_clamp(&mut self, v: longhands::_webkit_line_clamp::computed_value::T) {
|
pub fn set__webkit_line_clamp(&mut self, v: longhands::_webkit_line_clamp::computed_value::T) {
|
||||||
self.gecko.mLineClamp = match v {
|
self.gecko.mLineClamp = match v {
|
||||||
|
|
|
@ -12,6 +12,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
|
||||||
/// The offset-path value.
|
/// The offset-path value.
|
||||||
///
|
///
|
||||||
/// https://drafts.fxtf.org/motion-1/#offset-path-property
|
/// https://drafts.fxtf.org/motion-1/#offset-path-property
|
||||||
|
/// cbindgen:derive-tagged-enum-copy-constructor=true
|
||||||
#[derive(
|
#[derive(
|
||||||
Animate,
|
Animate,
|
||||||
Clone,
|
Clone,
|
||||||
|
@ -26,6 +27,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
|
||||||
ToResolvedValue,
|
ToResolvedValue,
|
||||||
ToShmem,
|
ToShmem,
|
||||||
)]
|
)]
|
||||||
|
#[repr(C, u8)]
|
||||||
pub enum OffsetPath {
|
pub enum OffsetPath {
|
||||||
// We could merge SVGPathData into ShapeSource, so we could reuse them. However,
|
// 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.
|
// we don't want to support other value for offset-path, so use SVGPathData only for now.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue