From 7d1374e0197d11f5cc927a0d902a390e74a9dcb5 Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Wed, 5 Jul 2017 12:59:12 +0900 Subject: [PATCH] implements nsStyleTextOverflow type properties animatable --- components/style/properties/gecko.mako.rs | 20 +++++++++++++++++++ .../style/properties/longhand/text.mako.rs | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 053e1cdd49a..7e910c638bb 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3923,6 +3923,26 @@ fn static_assert() { self.gecko.mTextOverflow.mLogicalDirections = other.gecko.mTextOverflow.mLogicalDirections; } + pub fn clone_text_overflow(&self) -> longhands::text_overflow::computed_value::T { + use gecko_bindings::structs::nsStyleTextOverflowSide; + use properties::longhands::text_overflow::Side; + + fn to_servo(side: &nsStyleTextOverflowSide) -> Side { + match side.mType as u32 { + structs::NS_STYLE_TEXT_OVERFLOW_CLIP => Side::Clip, + structs::NS_STYLE_TEXT_OVERFLOW_ELLIPSIS => Side::Ellipsis, + structs::NS_STYLE_TEXT_OVERFLOW_STRING => Side::String(side.mString.to_string().into_boxed_str()), + x => panic!("Found unexpected value in style struct for text_overflow property: {:?}", x), + } + } + + longhands::text_overflow::computed_value::T { + first: to_servo(&self.gecko.mTextOverflow.mLeft), + second: to_servo(&self.gecko.mTextOverflow.mRight), + sides_are_logical: self.gecko.mTextOverflow.mLogicalDirections + } + } + pub fn set_initial_letter(&mut self, v: longhands::initial_letter::computed_value::T) { use values::generics::text::InitialLetter; match v { diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index 640e0cc438e..a5aec3ad47c 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -12,7 +12,7 @@ Method("has_overline", "bool"), Method("has_line_through", "bool")]) %> -<%helpers:longhand name="text-overflow" animation_value_type="none" boxed="True" +<%helpers:longhand name="text-overflow" animation_value_type="discrete" boxed="True" spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow"> use std::fmt; use style_traits::ToCss;