mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implements parser/serializer for font-synthesis
This commit is contained in:
parent
3c16dde1f2
commit
690cf65a85
2 changed files with 80 additions and 1 deletions
|
@ -765,7 +765,7 @@ fn static_assert() {
|
|||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="Font"
|
||||
skip_longhands="font-family font-size font-weight"
|
||||
skip_longhands="font-family font-size font-weight font-synthesis"
|
||||
skip_additionals="*">
|
||||
|
||||
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
|
||||
|
@ -828,6 +828,22 @@ fn static_assert() {
|
|||
// This is used for PartialEq, which we don't implement for gecko style structs.
|
||||
pub fn compute_font_hash(&mut self) {}
|
||||
|
||||
pub fn set_font_synthesis(&mut self, v: longhands::font_synthesis::computed_value::T) {
|
||||
use gecko_bindings::structs::{NS_FONT_SYNTHESIS_WEIGHT, NS_FONT_SYNTHESIS_STYLE};
|
||||
|
||||
self.gecko.mFont.synthesis = 0;
|
||||
if v.weight {
|
||||
self.gecko.mFont.synthesis |= NS_FONT_SYNTHESIS_WEIGHT as u8;
|
||||
}
|
||||
if v.style {
|
||||
self.gecko.mFont.synthesis |= NS_FONT_SYNTHESIS_STYLE as u8;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_font_synthesis_from(&mut self, other: &Self) {
|
||||
self.gecko.mFont.synthesis = other.gecko.mFont.synthesis;
|
||||
}
|
||||
|
||||
</%self:impl_trait>
|
||||
|
||||
<% skip_box_longhands= """display overflow-y vertical-align
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue