Skip to content
Permalink
Browse files

stylo: Remove FontComputationData, switch over to using the new font …

…tracking
  • Loading branch information
Manishearth committed Sep 23, 2017
1 parent c73dc57 commit e1a39a2012a5e17422d6fa08b684a4d27668131e
@@ -10,7 +10,6 @@ pub type ServoUnsafeCell<T> = ::std::cell::UnsafeCell<T>;
pub type ServoCell<T> = ::std::cell::Cell<T>;
pub type ServoNodeData = AtomicRefCell<ElementData>;
pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>;
pub type ServoVisitedStyle = Option<::servo_arc::RawOffsetArc<::properties::ComputedValues>>;
@@ -4463,19 +4462,6 @@ pub mod root {
FirstLetterContinuation = 1,
PlaceholderFrame = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ServoKeywordSize {
Empty = 0,
XXSmall = 1,
XSmall = 2,
Small = 3,
Medium = 4,
Large = 5,
XLarge = 6,
XXLarge = 7,
XXXLarge = 8,
}
#[repr(C)]
#[derive(Debug)]
pub struct ServoStyleContext {
@@ -4487,7 +4473,7 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_ServoStyleContext() {
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 280usize ,
assert_eq!(::std::mem::size_of::<ServoStyleContext>() , 264usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@@ -4510,14 +4496,14 @@ pub mod root {
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextInheritingAnonBoxStyle as * const _ as usize } ,
264usize , concat ! (
248usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextInheritingAnonBoxStyle ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextLazyPseudoStyle as * const _ as usize } ,
272usize , concat ! (
256usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextLazyPseudoStyle ) ));
/// /// relevant link for this element. A element's "relevant link" is the
/// /// element being matched if it is a link or the nearest ancestor link.
pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle,
pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData,
}
#[test]
fn bindgen_test_layout_ServoComputedData() {
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 232usize ,
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 216usize ,
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
));
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
as * const _ as usize } , 208usize , concat ! (
"Alignment of field: " , stringify ! ( ServoComputedData )
, "::" , stringify ! ( visited_style ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoComputedData ) ) .
font_computation_data as * const _ as usize } , 216usize ,
concat ! (
"Alignment of field: " , stringify ! ( ServoComputedData )
, "::" , stringify ! ( font_computation_data ) ));
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -10,7 +10,6 @@ pub type ServoUnsafeCell<T> = ::std::cell::UnsafeCell<T>;
pub type ServoCell<T> = ::std::cell::Cell<T>;
pub type ServoNodeData = AtomicRefCell<ElementData>;
pub type ServoWritingMode = ::logical_geometry::WritingMode;
pub type ServoFontComputationData = ::properties::FontComputationData;
pub type ServoCustomPropertiesMap = Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>;
pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>;
pub type ServoVisitedStyle = Option<::servo_arc::RawOffsetArc<::properties::ComputedValues>>;
@@ -4383,19 +4382,6 @@ pub mod root {
FirstLetterContinuation = 1,
PlaceholderFrame = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ServoKeywordSize {
Empty = 0,
XXSmall = 1,
XSmall = 2,
Small = 3,
Medium = 4,
Large = 5,
XLarge = 6,
XXLarge = 7,
XXXLarge = 8,
}
#[repr(C)]
#[derive(Debug)]
pub struct ServoStyleContext {
@@ -4407,7 +4393,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>() , 256usize ,
concat ! (
"Size of: " , stringify ! ( ServoStyleContext ) ));
assert_eq! (::std::mem::align_of::<ServoStyleContext>() , 8usize ,
@@ -4430,14 +4416,14 @@ pub mod root {
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextInheritingAnonBoxStyle as * const _ as usize } ,
256usize , concat ! (
240usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextInheritingAnonBoxStyle ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoStyleContext ) ) .
mNextLazyPseudoStyle as * const _ as usize } ,
264usize , concat ! (
248usize , concat ! (
"Alignment of field: " , stringify ! (
ServoStyleContext ) , "::" , stringify ! (
mNextLazyPseudoStyle ) ));
/// /// relevant link for this element. A element's "relevant link" is the
/// /// element being matched if it is a link or the nearest ancestor link.
pub visited_style: ::gecko_bindings::structs::ServoVisitedStyle,
pub font_computation_data: ::gecko_bindings::structs::ServoFontComputationData,
}
#[test]
fn bindgen_test_layout_ServoComputedData() {
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 232usize ,
assert_eq!(::std::mem::size_of::<ServoComputedData>() , 216usize ,
concat ! ( "Size of: " , stringify ! ( ServoComputedData )
));
assert_eq! (::std::mem::align_of::<ServoComputedData>() , 8usize ,
as * const _ as usize } , 208usize , concat ! (
"Alignment of field: " , stringify ! ( ServoComputedData )
, "::" , stringify ! ( visited_style ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const ServoComputedData ) ) .
font_computation_data as * const _ as usize } , 216usize ,
concat ! (
"Alignment of field: " , stringify ! ( ServoComputedData )
, "::" , stringify ! ( font_computation_data ) ));
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -53,7 +53,7 @@ use logical_geometry::WritingMode;
use media_queries::Device;
use properties::animated_properties::TransitionProperty;
use properties::computed_value_flags::*;
use properties::{default_font_size_keyword, longhands, FontComputationData, Importance, LonghandId};
use properties::{longhands, Importance, LonghandId};
use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarationId};
use rule_tree::StrongRuleNode;
use selector_parser::PseudoElement;
@@ -85,7 +85,6 @@ impl ComputedValues {
pseudo: Option<<&PseudoElement>,
custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: FontComputationData,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -96,7 +95,6 @@ impl ComputedValues {
ComputedValuesInner::new(
custom_properties,
writing_mode,
font_size_keyword,
flags,
rules,
visited_style,
@@ -114,7 +112,6 @@ impl ComputedValues {
ComputedValuesInner::new(
/* custom_properties = */ None,
/* writing_mode = */ WritingMode::empty(), // FIXME(bz): This seems dubious
default_font_size_keyword(),
ComputedValueFlags::empty(),
/* rules = */ None,
/* visited_style = */ None,
@@ -174,7 +171,6 @@ impl Clone for ComputedValuesInner {
% endfor
custom_properties: self.custom_properties.clone(),
writing_mode: self.writing_mode.clone(),
font_computation_data: self.font_computation_data.clone(),
flags: self.flags.clone(),
rules: self.rules.clone(),
visited_style: self.visited_style.clone(),
@@ -188,7 +184,6 @@ type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
impl ComputedValuesInner {
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
writing_mode: WritingMode,
font_size_keyword: FontComputationData,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
@@ -199,7 +194,6 @@ impl ComputedValuesInner {
ComputedValuesInner {
custom_properties: custom_properties,
writing_mode: writing_mode,
font_computation_data: font_size_keyword,
rules: rules,
visited_style: visited_style.map(|x| Arc::into_raw_offset(x)),
flags: flags,
@@ -2322,11 +2316,9 @@ fn static_assert() {
/// This function will also handle scriptminsize and scriptlevel
/// so should not be called when you just want the font sizes to be copied.
/// Hence the different name.
///
/// Returns true if the inherited keyword size was actually used
pub fn inherit_font_size_from(&mut self, parent: &Self,
kw_inherited_size: Option<NonNegativeLength>,
device: &Device) -> bool {
device: &Device) {
let (adjusted_size, adjusted_unconstrained_size)
= self.calculate_script_level_size(parent, device);
if adjusted_size.0 != parent.gecko.mSize ||
@@ -2355,8 +2347,6 @@ fn static_assert() {
self.gecko.mFontSizeOffset = 0;

self.gecko.mScriptUnconstrainedSize = adjusted_unconstrained_size.0;
self.fixup_font_min_size(device);
false
} else if let Some(size) = kw_inherited_size {
// Parent element was a keyword-derived size.
self.gecko.mSize = size.0.to_i32_au();
@@ -2366,8 +2356,6 @@ fn static_assert() {
self.gecko.mFontSizeKeyword = parent.gecko.mFontSizeKeyword;
// MathML constraints didn't apply here, so we can ignore this.
self.gecko.mScriptUnconstrainedSize = size.0.to_i32_au();
self.fixup_font_min_size(device);
true
} else {
// MathML isn't affecting us, and our parent element does not
// have a keyword-derived size. Set things normally.
@@ -2377,9 +2365,8 @@ fn static_assert() {
self.gecko.mFontSizeFactor = 1.;
self.gecko.mFontSizeOffset = 0;
self.gecko.mScriptUnconstrainedSize = parent.gecko.mScriptUnconstrainedSize;
self.fixup_font_min_size(device);
false
}
self.fixup_font_min_size(device);
}

pub fn clone_font_size(&self) -> longhands::font_size::computed_value::T {

0 comments on commit e1a39a2

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