implements nsStyleTextOverflow type properties animatable

This commit is contained in:
Daisuke Akatsuka 2017-07-05 12:59:12 +09:00
parent 6316b7aeb8
commit 7d1374e019
2 changed files with 21 additions and 1 deletions

View file

@ -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 {

View file

@ -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;