style: Implement offset-rotate.

This includes style system and layout update. I add 3 extra reftests
because the original tests use ray() function as the offset-path, but we
don't support it. It'd be better to add tests using a different type of
offset-path.

The spec issue about the serialization:
https://github.com/w3c/fxtf-drafts/issues/340

Differential Revision: https://phabricator.services.mozilla.com/D32212
This commit is contained in:
Boris Chiou 2019-05-24 03:42:03 +00:00 committed by Emilio Cobos Álvarez
parent 43444db8a8
commit 73b0b7c477
6 changed files with 154 additions and 3 deletions

View file

@ -4,7 +4,41 @@
//! Computed types for CSS values that are related to motion path.
use crate::values::computed::Angle;
use crate::Zero;
/// A computed offset-path. The computed value is as specified value.
///
/// https://drafts.fxtf.org/motion-1/#offset-path-property
pub use crate::values::specified::motion::OffsetPath;
#[inline]
fn is_auto_zero_angle(auto: &bool, angle: &Angle) -> bool {
*auto && angle.is_zero()
}
/// A computed offset-rotate.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
#[repr(C)]
pub struct OffsetRotate {
/// If auto is false, this is a fixed angle which indicates a
/// constant clockwise rotation transformation applied to it by this
/// specified rotation angle. Otherwise, the angle will be added to
/// the angle of the direction in layout.
#[css(represents_keyword)]
pub auto: bool,
/// The angle value.
#[css(contextual_skip_if = "is_auto_zero_angle")]
pub angle: Angle,
}
impl OffsetRotate {
/// Returns "auto 0deg".
#[inline]
pub fn auto() -> Self {
OffsetRotate {
auto: true,
angle: Zero::zero(),
}
}
}