Skip to content
Permalink
Browse files

stylo: Add (unused) absolute offset to FontComputationData

  • Loading branch information
Manishearth committed Sep 11, 2017
1 parent ac2fd02 commit 1ad9463558dd656d830b1e3b7d52921bbf014765
@@ -5007,7 +5007,7 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_ServoStyleContext() {
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 272usize ,
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 280usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@@ -5030,14 +5030,14 @@ pub mod root {
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextInheritingAnonBoxStyle as * const _ as usize } ,
256usize , concat ! (
264usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextInheritingAnonBoxStyle ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextLazyPseudoStyle as * const _ as usize } ,
264usize , concat ! (
272usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextLazyPseudoStyle ) ));
}
#[test]
fn bindgen_test_layout_ServoComputedData() {
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 224usize ,
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 232usize ,
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
));
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
@@ -4895,7 +4895,7 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_ServoStyleContext() {
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 264usize ,
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 272usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@@ -4918,14 +4918,14 @@ pub mod root {
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextInheritingAnonBoxStyle as * const _ as usize } ,
248usize , concat ! (
256usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextInheritingAnonBoxStyle ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextLazyPseudoStyle as * const _ as usize } ,
256usize , concat ! (
264usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextLazyPseudoStyle ) ));
}
#[test]
fn bindgen_test_layout_ServoComputedData() {
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 224usize ,
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 232usize ,
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
));
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
@@ -85,7 +85,7 @@ impl ComputedValues {
pseudo: Option<<&PseudoElement>,
custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -188,7 +188,7 @@ type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
impl ComputedValuesInner {
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -955,16 +955,16 @@ ${helpers.single_keyword_system("font-variant-caps",
specified_value: &SpecifiedValue,
mut computed: NonNegativeAu) {
if let SpecifiedValue::Keyword(kw, fraction) = *specified_value {
context.builder.font_size_keyword = Some((kw, fraction));
context.builder.font_size_keyword = Some((kw, fraction, Au(0).into()));
} else if let Some(ratio) = specified_value.as_font_ratio() {
// In case a font-size-relative value was applied to a keyword
// value, we must preserve this fact in case the generic font family
// changes. relative values (em and %) applied to keywords must be
// recomputed from the base size for the keyword and the relative size.
//
// See bug 1355707
if let Some((kw, fraction)) = context.builder.inherited_font_computation_data().font_size_keyword {
context.builder.font_size_keyword = Some((kw, fraction * ratio));
if let Some((kw, fraction, _)) = context.builder.inherited_font_computation_data().font_size_keyword {
context.builder.font_size_keyword = Some((kw, fraction * ratio, Au(0).into()));
} else {
context.builder.font_size_keyword = None;
}
@@ -982,7 +982,7 @@ ${helpers.single_keyword_system("font-variant-caps",
context.builder.get_parent_font().gecko().mLanguage.raw::<nsIAtom>() ||
context.builder.get_font().gecko().mGenericID !=
context.builder.get_parent_font().gecko().mGenericID {
if let Some((kw, ratio)) = context.builder.font_size_keyword {
if let Some((kw, ratio, _)) = context.builder.font_size_keyword {
computed = context.maybe_zoom_text(kw.to_computed_value(context).scale_by(ratio));
}
}
@@ -1012,7 +1012,7 @@ ${helpers.single_keyword_system("font-variant-caps",
// If inheriting, we must recompute font-size in case of language
// changes using the font_size_keyword. We also need to do this to
// handle mathml scriptlevel changes
let kw_inherited_size = context.builder.font_size_keyword.map(|(kw, ratio)| {
let kw_inherited_size = context.builder.font_size_keyword.map(|(kw, ratio, _)| {
context.maybe_zoom_text(SpecifiedValue::Keyword(kw, ratio).to_computed_value(context))
});
let parent_kw;
@@ -1047,7 +1047,7 @@ ${helpers.single_keyword_system("font-variant-caps",
let device = context.builder.device;
context.builder.mutate_font().fixup_font_min_size(device);
% endif
context.builder.font_size_keyword = Some((Default::default(), 1.));
context.builder.font_size_keyword = Some((Default::default(), 1., Au(0).into()));
}
</%helpers:longhand>

@@ -10,6 +10,7 @@

<%namespace name="helpers" file="/helpers.mako.rs" />

use app_units::Au;
#[cfg(feature = "servo")] use app_units::Au;
use servo_arc::{Arc, UniqueArc};
use smallbitvec::SmallBitVec;
@@ -109,22 +110,23 @@ pub struct FontComputationData {
/// and is 1 when there was just a keyword and no relative values.
///
/// When this is Some, we compute font sizes by computing the keyword against
/// the generic font, and then multiplying it by the ratio.
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>
/// the generic font, and then multiplying it by the ratio (as well as adding any
/// absolute offset from calcs)
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>
}


impl FontComputationData {
/// Assigns values for variables in struct FontComputationData
pub fn new(font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>) -> Self {
pub fn new(font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>) -> Self {
FontComputationData {
font_size_keyword: font_size_keyword
}
}

/// Assigns default values for variables in struct FontComputationData
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32)> {
Some((Default::default(), 1.))
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)> {
Some((Default::default(), 1., Au(0).into()))
}

/// Gets a FontComputationData with the default values.
@@ -2007,7 +2009,7 @@ impl ComputedValues {
_: Option<<&PseudoElement>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -2040,7 +2042,7 @@ impl ComputedValuesInner {
pub fn new(
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -2564,7 +2566,7 @@ pub struct StyleBuilder<'a> {
/// TODO(emilio): Make private.
pub writing_mode: WritingMode,
/// The keyword behind the current font-size property, if any.
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
/// Flags for the computed value.
pub flags: ComputedValueFlags,
/// The element's style if visited, only computed if there's a relevant link
@@ -2587,7 +2589,7 @@ impl<'a> StyleBuilder<'a> {
rules: Option<StrongRuleNode>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
flags: ComputedValueFlags,
visited_style: Option<Arc<ComputedValues>>,
) -> Self {

0 comments on commit 1ad9463

Please sign in to comment.
You can’t perform that action at this time.