mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Geckolib: Implement font-weight.
This commit is contained in:
parent
2c69278067
commit
9fdb791e93
2 changed files with 14 additions and 1 deletions
|
@ -173,6 +173,7 @@ ${helpers.single_keyword("font-variant", "normal small-caps")}
|
|||
pub mod computed_value {
|
||||
use std::fmt;
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Hash, Deserialize, Serialize, HeapSizeOf, Debug)]
|
||||
#[repr(u16)]
|
||||
pub enum T {
|
||||
% for weight in range(100, 901, 100):
|
||||
Weight${weight} = ${weight},
|
||||
|
|
|
@ -424,7 +424,7 @@ fn static_assert() {
|
|||
}
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="Font" skip_longhands="font-size" skip_additionals="*">
|
||||
<%self:impl_trait style_struct_name="Font" skip_longhands="font-size font-weight" skip_additionals="*">
|
||||
|
||||
// FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the
|
||||
// actual computed size, and the other of which (mFont.size) is the 'display
|
||||
|
@ -441,6 +441,18 @@ fn static_assert() {
|
|||
Au(self.gecko.mSize)
|
||||
}
|
||||
|
||||
fn set_font_weight(&mut self, v: longhands::font_weight::computed_value::T) {
|
||||
self.gecko.mFont.weight = v as u16;
|
||||
}
|
||||
<%call expr="impl_simple_copy('font_weight', 'mFont.weight')"></%call>
|
||||
|
||||
fn clone_font_weight(&self) -> longhands::font_weight::computed_value::T {
|
||||
debug_assert!(self.gecko.mFont.weight >= 100);
|
||||
debug_assert!(self.gecko.mFont.weight <= 900);
|
||||
debug_assert!(self.gecko.mFont.weight % 10 == 0);
|
||||
unsafe { transmute(self.gecko.mFont.weight) }
|
||||
}
|
||||
|
||||
// This is used for PartialEq, which we don't implement for gecko style structs.
|
||||
fn compute_font_hash(&mut self) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue