Remove the ComputedValue traits and style_struct_traits

This commit is contained in:
Simon Sapin 2016-07-19 20:29:22 +02:00
parent b2a7e44373
commit 789807b7b0
60 changed files with 589 additions and 652 deletions

View file

@ -102,7 +102,7 @@
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value<Cx: TContext>(&self, context: &Cx) -> computed_value::T {
fn to_computed_value(&self, context: &Context) -> computed_value::T {
match *self {
SpecifiedValue::Normal => computed_value::T::Normal,
% if product == "gecko":
@ -248,7 +248,7 @@
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value<Cx: TContext>(&self, context: &Cx) -> computed_value::T {
fn to_computed_value(&self, context: &Context) -> computed_value::T {
match *self {
SpecifiedValue::Normal => computed_value::T(None),
SpecifiedValue::Specified(l) =>
@ -322,7 +322,7 @@
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value<Cx: TContext>(&self, context: &Cx) -> computed_value::T {
fn to_computed_value(&self, context: &Context) -> computed_value::T {
match *self {
SpecifiedValue::Normal => computed_value::T(None),
SpecifiedValue::Specified(l) =>
@ -374,7 +374,6 @@ ${helpers.single_keyword("text-justify",
use values:: NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;
use properties::style_struct_traits::{Box, Color, Text};
impl ComputedValueAsSpecified for SpecifiedValue {}
impl NoViewportPercentage for SpecifiedValue {}
@ -407,7 +406,7 @@ ${helpers.single_keyword("text-justify",
}
}
fn maybe<Cx: TContext>(flag: bool, context: &Cx) -> Option<RGBA> {
fn maybe(flag: bool, context: &Context) -> Option<RGBA> {
if flag {
Some(context.style().get_color().clone_color())
} else {
@ -415,7 +414,7 @@ ${helpers.single_keyword("text-justify",
}
}
fn derive<Cx: TContext>(context: &Cx) -> computed_value::T {
fn derive(context: &Context) -> computed_value::T {
// Start with no declarations if this is an atomic inline-level box; otherwise, start with the
// declarations in effect and add in the text decorations that this block specifies.
let mut result = match context.style().get_box().clone_display() {
@ -439,13 +438,13 @@ ${helpers.single_keyword("text-justify",
}
#[inline]
pub fn derive_from_text_decoration<Cx: TContext>(context: &mut Cx) {
pub fn derive_from_text_decoration(context: &mut Context) {
let derived = derive(context);
context.mutate_style().mutate_inheritedtext().set__servo_text_decorations_in_effect(derived);
}
#[inline]
pub fn derive_from_display<Cx: TContext>(context: &mut Cx) {
pub fn derive_from_display(context: &mut Context) {
let derived = derive(context);
context.mutate_style().mutate_inheritedtext().set__servo_text_decorations_in_effect(derived);
}
@ -675,7 +674,7 @@ ${helpers.single_keyword("text-justify",
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
fn to_computed_value<Cx: TContext>(&self, context: &Cx) -> computed_value::T {
fn to_computed_value(&self, context: &Context) -> computed_value::T {
computed_value::T(self.0.iter().map(|value| {
computed_value::TextShadow {
offset_x: value.offset_x.to_computed_value(context),