style: Make all font-metrics-affecting properties cascade early.

And make font-size computation work on the whole font of the parent, not just
accounting for the parent's font-size.

Differential Revision: https://phabricator.services.mozilla.com/D20656
This commit is contained in:
Emilio Cobos Álvarez 2019-03-18 16:27:54 +00:00
parent aa5ea337da
commit d3f254d2e4
4 changed files with 36 additions and 38 deletions

View file

@ -7,9 +7,6 @@
#![deny(missing_docs)]
use crate::context::SharedStyleContext;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::properties::style_structs::Font;
use crate::Atom;
use app_units::Au;
@ -36,22 +33,15 @@ pub enum FontMetricsQueryResult {
/// A trait used to represent something capable of providing us font metrics.
pub trait FontMetricsProvider {
/// Obtain the metrics for given font family.
///
/// TODO: We could make this take the full list, I guess, and save a few
/// virtual calls in the case we are repeatedly unable to find font metrics?
/// That is not too common in practice though.
fn query(
&self,
_font: &Font,
_font_size: Au,
_wm: WritingMode,
_in_media_query: bool,
_device: &Device,
_context: &crate::values::computed::Context,
_base_size: crate::values::specified::length::FontBaseSize,
) -> FontMetricsQueryResult {
FontMetricsQueryResult::NotAvailable
}
/// Get default size of a given language and generic family
/// Get default size of a given language and generic family.
fn get_size(&self, font_name: &Atom, font_family: u8) -> Au;
/// Construct from a shared style context