mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
stylo: Add (unused) absolute offset to FontComputationData
This commit is contained in:
parent
ac2fd024b5
commit
1ad9463558
5 changed files with 27 additions and 25 deletions
|
@ -5007,7 +5007,7 @@ pub mod root {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ServoStyleContext() {
|
fn bindgen_test_layout_ServoStyleContext() {
|
||||||
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 272usize ,
|
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 280usize ,
|
||||||
concat ! (
|
concat ! (
|
||||||
"Size of: " , stringify ! ( ServoStyleContext ) ));
|
"Size of: " , stringify ! ( ServoStyleContext ) ));
|
||||||
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
|
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
|
||||||
|
@ -5030,14 +5030,14 @@ pub mod root {
|
||||||
assert_eq! (unsafe {
|
assert_eq! (unsafe {
|
||||||
& ( * ( 0 as * const ServoStyleContext ) ) .
|
& ( * ( 0 as * const ServoStyleContext ) ) .
|
||||||
mNextInheritingAnonBoxStyle as * const _ as usize } ,
|
mNextInheritingAnonBoxStyle as * const _ as usize } ,
|
||||||
256usize , concat ! (
|
264usize , concat ! (
|
||||||
"Alignment of field: " , stringify ! (
|
"Alignment of field: " , stringify ! (
|
||||||
ServoStyleContext ) , "::" , stringify ! (
|
ServoStyleContext ) , "::" , stringify ! (
|
||||||
mNextInheritingAnonBoxStyle ) ));
|
mNextInheritingAnonBoxStyle ) ));
|
||||||
assert_eq! (unsafe {
|
assert_eq! (unsafe {
|
||||||
& ( * ( 0 as * const ServoStyleContext ) ) .
|
& ( * ( 0 as * const ServoStyleContext ) ) .
|
||||||
mNextLazyPseudoStyle as * const _ as usize } ,
|
mNextLazyPseudoStyle as * const _ as usize } ,
|
||||||
264usize , concat ! (
|
272usize , concat ! (
|
||||||
"Alignment of field: " , stringify ! (
|
"Alignment of field: " , stringify ! (
|
||||||
ServoStyleContext ) , "::" , stringify ! (
|
ServoStyleContext ) , "::" , stringify ! (
|
||||||
mNextLazyPseudoStyle ) ));
|
mNextLazyPseudoStyle ) ));
|
||||||
|
@ -15914,7 +15914,7 @@ pub mod root {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ServoComputedData() {
|
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 )
|
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
|
||||||
));
|
));
|
||||||
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
|
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
|
||||||
|
|
|
@ -4895,7 +4895,7 @@ pub mod root {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ServoStyleContext() {
|
fn bindgen_test_layout_ServoStyleContext() {
|
||||||
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 264usize ,
|
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 272usize ,
|
||||||
concat ! (
|
concat ! (
|
||||||
"Size of: " , stringify ! ( ServoStyleContext ) ));
|
"Size of: " , stringify ! ( ServoStyleContext ) ));
|
||||||
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
|
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
|
||||||
|
@ -4918,14 +4918,14 @@ pub mod root {
|
||||||
assert_eq! (unsafe {
|
assert_eq! (unsafe {
|
||||||
& ( * ( 0 as * const ServoStyleContext ) ) .
|
& ( * ( 0 as * const ServoStyleContext ) ) .
|
||||||
mNextInheritingAnonBoxStyle as * const _ as usize } ,
|
mNextInheritingAnonBoxStyle as * const _ as usize } ,
|
||||||
248usize , concat ! (
|
256usize , concat ! (
|
||||||
"Alignment of field: " , stringify ! (
|
"Alignment of field: " , stringify ! (
|
||||||
ServoStyleContext ) , "::" , stringify ! (
|
ServoStyleContext ) , "::" , stringify ! (
|
||||||
mNextInheritingAnonBoxStyle ) ));
|
mNextInheritingAnonBoxStyle ) ));
|
||||||
assert_eq! (unsafe {
|
assert_eq! (unsafe {
|
||||||
& ( * ( 0 as * const ServoStyleContext ) ) .
|
& ( * ( 0 as * const ServoStyleContext ) ) .
|
||||||
mNextLazyPseudoStyle as * const _ as usize } ,
|
mNextLazyPseudoStyle as * const _ as usize } ,
|
||||||
256usize , concat ! (
|
264usize , concat ! (
|
||||||
"Alignment of field: " , stringify ! (
|
"Alignment of field: " , stringify ! (
|
||||||
ServoStyleContext ) , "::" , stringify ! (
|
ServoStyleContext ) , "::" , stringify ! (
|
||||||
mNextLazyPseudoStyle ) ));
|
mNextLazyPseudoStyle ) ));
|
||||||
|
@ -15706,7 +15706,7 @@ pub mod root {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ServoComputedData() {
|
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 )
|
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
|
||||||
));
|
));
|
||||||
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
|
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl ComputedValues {
|
||||||
pseudo: Option<<&PseudoElement>,
|
pseudo: Option<<&PseudoElement>,
|
||||||
custom_properties: Option<Arc<CustomPropertiesMap>>,
|
custom_properties: Option<Arc<CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
rules: Option<StrongRuleNode>,
|
rules: Option<StrongRuleNode>,
|
||||||
visited_style: Option<Arc<ComputedValues>>,
|
visited_style: Option<Arc<ComputedValues>>,
|
||||||
|
@ -188,7 +188,7 @@ type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
|
||||||
impl ComputedValuesInner {
|
impl ComputedValuesInner {
|
||||||
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
|
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
rules: Option<StrongRuleNode>,
|
rules: Option<StrongRuleNode>,
|
||||||
visited_style: Option<Arc<ComputedValues>>,
|
visited_style: Option<Arc<ComputedValues>>,
|
||||||
|
|
|
@ -955,7 +955,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
specified_value: &SpecifiedValue,
|
specified_value: &SpecifiedValue,
|
||||||
mut computed: NonNegativeAu) {
|
mut computed: NonNegativeAu) {
|
||||||
if let SpecifiedValue::Keyword(kw, fraction) = *specified_value {
|
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() {
|
} else if let Some(ratio) = specified_value.as_font_ratio() {
|
||||||
// In case a font-size-relative value was applied to a keyword
|
// In case a font-size-relative value was applied to a keyword
|
||||||
// value, we must preserve this fact in case the generic font family
|
// value, we must preserve this fact in case the generic font family
|
||||||
|
@ -963,8 +963,8 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
// recomputed from the base size for the keyword and the relative size.
|
// recomputed from the base size for the keyword and the relative size.
|
||||||
//
|
//
|
||||||
// See bug 1355707
|
// See bug 1355707
|
||||||
if let Some((kw, fraction)) = context.builder.inherited_font_computation_data().font_size_keyword {
|
if let Some((kw, fraction, _)) = context.builder.inherited_font_computation_data().font_size_keyword {
|
||||||
context.builder.font_size_keyword = Some((kw, fraction * ratio));
|
context.builder.font_size_keyword = Some((kw, fraction * ratio, Au(0).into()));
|
||||||
} else {
|
} else {
|
||||||
context.builder.font_size_keyword = None;
|
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_parent_font().gecko().mLanguage.raw::<nsIAtom>() ||
|
||||||
context.builder.get_font().gecko().mGenericID !=
|
context.builder.get_font().gecko().mGenericID !=
|
||||||
context.builder.get_parent_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));
|
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
|
// If inheriting, we must recompute font-size in case of language
|
||||||
// changes using the font_size_keyword. We also need to do this to
|
// changes using the font_size_keyword. We also need to do this to
|
||||||
// handle mathml scriptlevel changes
|
// 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))
|
context.maybe_zoom_text(SpecifiedValue::Keyword(kw, ratio).to_computed_value(context))
|
||||||
});
|
});
|
||||||
let parent_kw;
|
let parent_kw;
|
||||||
|
@ -1047,7 +1047,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
||||||
let device = context.builder.device;
|
let device = context.builder.device;
|
||||||
context.builder.mutate_font().fixup_font_min_size(device);
|
context.builder.mutate_font().fixup_font_min_size(device);
|
||||||
% endif
|
% endif
|
||||||
context.builder.font_size_keyword = Some((Default::default(), 1.));
|
context.builder.font_size_keyword = Some((Default::default(), 1., Au(0).into()));
|
||||||
}
|
}
|
||||||
</%helpers:longhand>
|
</%helpers:longhand>
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
|
use app_units::Au;
|
||||||
#[cfg(feature = "servo")] use app_units::Au;
|
#[cfg(feature = "servo")] use app_units::Au;
|
||||||
use servo_arc::{Arc, UniqueArc};
|
use servo_arc::{Arc, UniqueArc};
|
||||||
use smallbitvec::SmallBitVec;
|
use smallbitvec::SmallBitVec;
|
||||||
|
@ -109,22 +110,23 @@ pub struct FontComputationData {
|
||||||
/// and is 1 when there was just a keyword and no relative values.
|
/// 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
|
/// When this is Some, we compute font sizes by computing the keyword against
|
||||||
/// the generic font, and then multiplying it by the ratio.
|
/// the generic font, and then multiplying it by the ratio (as well as adding any
|
||||||
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>
|
/// absolute offset from calcs)
|
||||||
|
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl FontComputationData {
|
impl FontComputationData {
|
||||||
/// Assigns values for variables in struct 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 {
|
FontComputationData {
|
||||||
font_size_keyword: font_size_keyword
|
font_size_keyword: font_size_keyword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Assigns default values for variables in struct FontComputationData
|
/// Assigns default values for variables in struct FontComputationData
|
||||||
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32)> {
|
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)> {
|
||||||
Some((Default::default(), 1.))
|
Some((Default::default(), 1., Au(0).into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a FontComputationData with the default values.
|
/// Gets a FontComputationData with the default values.
|
||||||
|
@ -2007,7 +2009,7 @@ impl ComputedValues {
|
||||||
_: Option<<&PseudoElement>,
|
_: Option<<&PseudoElement>,
|
||||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
rules: Option<StrongRuleNode>,
|
rules: Option<StrongRuleNode>,
|
||||||
visited_style: Option<Arc<ComputedValues>>,
|
visited_style: Option<Arc<ComputedValues>>,
|
||||||
|
@ -2040,7 +2042,7 @@ impl ComputedValuesInner {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
rules: Option<StrongRuleNode>,
|
rules: Option<StrongRuleNode>,
|
||||||
visited_style: Option<Arc<ComputedValues>>,
|
visited_style: Option<Arc<ComputedValues>>,
|
||||||
|
@ -2564,7 +2566,7 @@ pub struct StyleBuilder<'a> {
|
||||||
/// TODO(emilio): Make private.
|
/// TODO(emilio): Make private.
|
||||||
pub writing_mode: WritingMode,
|
pub writing_mode: WritingMode,
|
||||||
/// The keyword behind the current font-size property, if any.
|
/// 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.
|
/// Flags for the computed value.
|
||||||
pub flags: ComputedValueFlags,
|
pub flags: ComputedValueFlags,
|
||||||
/// The element's style if visited, only computed if there's a relevant link
|
/// 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>,
|
rules: Option<StrongRuleNode>,
|
||||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32, NonNegativeAu)>,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
visited_style: Option<Arc<ComputedValues>>,
|
visited_style: Option<Arc<ComputedValues>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue