Auto merge of #16349 - chenpighead:stylo-initial-letter-support, r=heycam

Stylo - add glue code for initial-letter property

<!-- Please describe your changes on the following line: -->

Add glue code for initial-letter property.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16349)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-11 20:22:59 -05:00 committed by GitHub
commit 52c68736e1
2 changed files with 25 additions and 2 deletions

View file

@ -3039,7 +3039,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) {
@ -3120,6 +3120,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

View file

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