End the libstyle 'pub use' madness.

This commit is contained in:
Simon Sapin 2015-01-28 21:46:51 +01:00
parent 493a9e6a89
commit d13d36f57f
39 changed files with 159 additions and 169 deletions

View file

@ -22,6 +22,7 @@ use values::computed;
use selector_matching::DeclarationBlock;
use parser::{ParserContext, log_css_error};
use stylesheets::Origin;
use computed_values;
use self::property_bit_field::PropertyBitField;
@ -2629,43 +2630,43 @@ impl ComputedValues {
}
#[inline]
pub fn content_inline_size(&self) -> computed_values::LengthOrPercentageOrAuto {
pub fn content_inline_size(&self) -> computed::LengthOrPercentageOrAuto {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.height } else { box_style.width }
}
#[inline]
pub fn content_block_size(&self) -> computed_values::LengthOrPercentageOrAuto {
pub fn content_block_size(&self) -> computed::LengthOrPercentageOrAuto {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.width } else { box_style.height }
}
#[inline]
pub fn min_inline_size(&self) -> computed_values::LengthOrPercentage {
pub fn min_inline_size(&self) -> computed::LengthOrPercentage {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.min_height } else { box_style.min_width }
}
#[inline]
pub fn min_block_size(&self) -> computed_values::LengthOrPercentage {
pub fn min_block_size(&self) -> computed::LengthOrPercentage {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.min_width } else { box_style.min_height }
}
#[inline]
pub fn max_inline_size(&self) -> computed_values::LengthOrPercentageOrNone {
pub fn max_inline_size(&self) -> computed::LengthOrPercentageOrNone {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.max_height } else { box_style.max_width }
}
#[inline]
pub fn max_block_size(&self) -> computed_values::LengthOrPercentageOrNone {
pub fn max_block_size(&self) -> computed::LengthOrPercentageOrNone {
let box_style = self.get_box();
if self.writing_mode.is_vertical() { box_style.max_width } else { box_style.max_height }
}
#[inline]
pub fn logical_padding(&self) -> LogicalMargin<computed_values::LengthOrPercentage> {
pub fn logical_padding(&self) -> LogicalMargin<computed::LengthOrPercentage> {
let padding_style = self.get_padding();
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
padding_style.padding_top,
@ -2687,7 +2688,7 @@ impl ComputedValues {
}
#[inline]
pub fn logical_margin(&self) -> LogicalMargin<computed_values::LengthOrPercentageOrAuto> {
pub fn logical_margin(&self) -> LogicalMargin<computed::LengthOrPercentageOrAuto> {
let margin_style = self.get_margin();
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
margin_style.margin_top,
@ -2698,7 +2699,7 @@ impl ComputedValues {
}
#[inline]
pub fn logical_position(&self) -> LogicalMargin<computed_values::LengthOrPercentageOrAuto> {
pub fn logical_position(&self) -> LogicalMargin<computed::LengthOrPercentageOrAuto> {
// FIXME(SimonSapin): should be the writing mode of the containing block, maybe?
let position_style = self.get_positionoffsets();
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
@ -3169,6 +3170,17 @@ macro_rules! css_properties_accessors {
}
}
macro_rules! longhand_properties_idents {
($macro_name: ident) => {
$macro_name! {
% for property in LONGHANDS:
${property.ident}
% endfor
}
}
}
pub fn longhands_from_shorthand(shorthand: &str) -> Option<Vec<String>> {
match shorthand {
% for property in SHORTHANDS:
@ -3181,18 +3193,3 @@ pub fn longhands_from_shorthand(shorthand: &str) -> Option<Vec<String>> {
_ => None,
}
}
// Only re-export the types for computed values.
pub mod computed_values {
% for property in LONGHANDS:
pub use super::longhands::${property.ident}::computed_value as ${property.ident};
% endfor
// Don't use a side-specific name needlessly:
pub use super::longhands::border_top_style::computed_value as border_style;
pub use cssparser::RGBA;
pub use values::computed::{
LengthOrPercentage,
LengthOrPercentageOrAuto,
LengthOrPercentageOrNone};
}