Skip to content

Commit

Permalink
Stylo - add glue code for initial-letter property
Browse files Browse the repository at this point in the history
  • Loading branch information
chenpighead committed Apr 11, 2017
1 parent ca3cd64 commit 76b48c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion components/style/properties/gecko.mako.rs
Expand Up @@ -3012,7 +3012,7 @@ fn static_assert() {
</%self:impl_trait>

<%self:impl_trait style_struct_name="Text"
skip_longhands="text-decoration-line text-overflow"
skip_longhands="text-decoration-line text-overflow initial-letter"
skip_additionals="*">

pub fn set_text_decoration_line(&mut self, v: longhands::text_decoration_line::computed_value::T) {
Expand Down Expand Up @@ -3093,6 +3093,29 @@ fn static_assert() {
self.gecko.mTextOverflow.mLogicalDirections = other.gecko.mTextOverflow.mLogicalDirections;
}

pub fn set_initial_letter(&mut self, v: longhands::initial_letter::computed_value::T) {
use properties::longhands::initial_letter::computed_value::T;
match v {
T::Normal => {
self.gecko.mInitialLetterSize = 0.;
self.gecko.mInitialLetterSink = 0;
},
T::Specified(size, sink) => {
self.gecko.mInitialLetterSize = size.value;
if let Some(sink) = sink {
self.gecko.mInitialLetterSink = sink.value();
} else {
self.gecko.mInitialLetterSink = size.value.floor() as i32;
}
}
}
}

pub fn copy_initial_letter_from(&mut self, other: &Self) {
self.gecko.mInitialLetterSize = other.gecko.mInitialLetterSize;
self.gecko.mInitialLetterSink = other.gecko.mInitialLetterSink;
}

#[inline]
pub fn has_underline(&self) -> bool {
(self.gecko.mTextDecorationLine & (structs::NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE as u8)) != 0
Expand Down
2 changes: 1 addition & 1 deletion components/style/properties/longhand/text.mako.rs
Expand Up @@ -233,7 +233,7 @@ ${helpers.predefined_type(

<%helpers:longhand name="initial-letter"
animation_type="none"
products="none"
products="gecko"
spec="https://drafts.csswg.org/css-inline/#sizing-drop-initials">
use std::fmt;
use style_traits::ToCss;
Expand Down

0 comments on commit 76b48c3

Please sign in to comment.