mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Stylo - add glue code for initial-letter property
This commit is contained in:
parent
ca3cd64d6b
commit
76b48c3c41
2 changed files with 25 additions and 2 deletions
|
@ -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) {
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue