Bug 1371115 - Part 5: implements nsStyleTextOverflow type properties animatable. r?hiro
In this patch, implements following properties:
* text-overflow
MozReview-Commit-ID: 9a9NZ6fCixS
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -3918,16 +3918,36 @@ fn static_assert() {
side.mType = other.mType
}
self.clear_overflow_sides_if_string();
set(&mut self.gecko.mTextOverflow.mLeft, &other.gecko.mTextOverflow.mLeft);
set(&mut self.gecko.mTextOverflow.mRight, &other.gecko.mTextOverflow.mRight);
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 {
InitialLetter::Normal => {
self.gecko.mInitialLetterSize = 0.;
self.gecko.mInitialLetterSink = 0;
},
InitialLetter::Specified(size, sink) => {
--- a/servo/components/style/properties/longhand/text.mako.rs
+++ b/servo/components/style/properties/longhand/text.mako.rs
@@ -7,17 +7,17 @@
<% data.new_style_struct("Text",
inherited=False,
gecko_name="TextReset",
additional_methods=[Method("has_underline", "bool"),
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;
no_viewport_percentage!(SpecifiedValue);
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]