mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
style: Refactor and add infrastructure for font metrics in style.
This commit itself only moves things around and adds an extra parameter to the `apply_declarations` function to eventually handle #14079 correctly. Probably needs a more granular API to query fonts, á la nsFontMetrics, but that's trivial to do once this is landed. Then we should make the font provider mandatory, and implement the missing stylo bits.
This commit is contained in:
parent
9fd6f0acd5
commit
6c3458767b
15 changed files with 196 additions and 94 deletions
|
@ -7,6 +7,7 @@
|
|||
//!
|
||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::Parse;
|
||||
use std::fmt;
|
||||
|
@ -290,9 +291,9 @@ impl ToComputedValue for Position {
|
|||
Keyword::Right => {
|
||||
if let Some(x) = self.horiz_position {
|
||||
let (length, percentage) = match x {
|
||||
LengthOrPercentage::Percentage(Percentage(y)) => (None, Some(1.0 - y)),
|
||||
LengthOrPercentage::Length(y) => (Some(-y.to_computed_value(context)), Some(1.0)),
|
||||
_ => (None, None),
|
||||
LengthOrPercentage::Percentage(Percentage(y)) => (Au(0), Some(1.0 - y)),
|
||||
LengthOrPercentage::Length(y) => (-y.to_computed_value(context), Some(1.0)),
|
||||
_ => (Au(0), None),
|
||||
};
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage {
|
||||
length: length,
|
||||
|
@ -316,9 +317,9 @@ impl ToComputedValue for Position {
|
|||
Keyword::Bottom => {
|
||||
if let Some(x) = self.vert_position {
|
||||
let (length, percentage) = match x {
|
||||
LengthOrPercentage::Percentage(Percentage(y)) => (None, Some(1.0 - y)),
|
||||
LengthOrPercentage::Length(y) => (Some(-y.to_computed_value(context)), Some(1.0)),
|
||||
_ => (None, None),
|
||||
LengthOrPercentage::Percentage(Percentage(y)) => (Au(0), Some(1.0 - y)),
|
||||
LengthOrPercentage::Length(y) => (-y.to_computed_value(context), Some(1.0)),
|
||||
_ => (Au(0), None),
|
||||
};
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage {
|
||||
length: length,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue