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

@ -14,17 +14,16 @@ use script_traits::{AnimationState, LayoutMsg as ConstellationMsg};
use std::collections::HashMap;
use std::sync::mpsc::Receiver;
use style::animation::{Animation, update_style_for_animation};
use style::selector_impl::{SelectorImplExt, ServoSelectorImpl};
use time;
/// Processes any new animations that were discovered after style recalculation.
/// Also expire any old animations that have completed, inserting them into
/// `expired_animations`.
pub fn update_animation_state<Impl: SelectorImplExt>(constellation_chan: &IpcSender<ConstellationMsg>,
running_animations: &mut HashMap<OpaqueNode, Vec<Animation<Impl>>>,
expired_animations: &mut HashMap<OpaqueNode, Vec<Animation<Impl>>>,
new_animations_receiver: &Receiver<Animation<Impl>>,
pipeline_id: PipelineId) {
pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
running_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
expired_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
new_animations_receiver: &Receiver<Animation>,
pipeline_id: PipelineId) {
let mut new_running_animations = vec![];
while let Ok(animation) = new_animations_receiver.try_recv() {
let mut should_push = true;
@ -125,7 +124,7 @@ pub fn update_animation_state<Impl: SelectorImplExt>(constellation_chan: &IpcSen
pub fn recalc_style_for_animations(context: &SharedLayoutContext,
flow: &mut Flow,
animations: &HashMap<OpaqueNode,
Vec<Animation<ServoSelectorImpl>>>) {
Vec<Animation>>) {
let mut damage = RestyleDamage::empty();
flow.mutate_fragments(&mut |fragment| {
if let Some(ref animations) = animations.get(&fragment.node) {

View file

@ -58,7 +58,7 @@ use style::computed_values::{border_collapse, box_sizing, display, float, overfl
use style::computed_values::{position, text_align, transform, transform_style};
use style::context::StyleContext;
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};

View file

@ -46,7 +46,7 @@ use std::sync::atomic::Ordering;
use style::computed_values::content::ContentItem;
use style::computed_values::position;
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
use style::properties::{self, ComputedValues, ServoComputedValues};
use style::properties::{self, ServoComputedValues};
use style::servo::SharedStyleContext;
use table::TableFlow;
use table_caption::TableCaptionFlow;

View file

@ -31,7 +31,7 @@ use url::Url;
use util::opts;
struct LocalLayoutContext {
style_context: LocalStyleContext<ServoSelectorImpl>,
style_context: LocalStyleContext,
font_context: RefCell<FontContext>,
}
@ -108,7 +108,7 @@ impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> {
&self.shared.style_context
}
fn local_context(&self) -> &LocalStyleContext<ServoSelectorImpl> {
fn local_context(&self) -> &LocalStyleContext {
&self.cached_local_layout_context.style_context
}
}

View file

@ -50,8 +50,8 @@ use style::computed_values::{background_repeat, background_size, border_style};
use style::computed_values::{cursor, image_rendering, overflow_x, pointer_events, position};
use style::computed_values::{transform, transform_style, visibility};
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::style_structs::ServoBorder;
use style::properties::{self, ComputedValues, ServoComputedValues};
use style::properties::style_structs;
use style::properties::{self, ServoComputedValues};
use style::values::RGBA;
use style::values::computed;
use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto, LinearGradient};
@ -315,7 +315,7 @@ fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> Borde
}
}
fn build_border_radius(abs_bounds: &Rect<Au>, border_style: &ServoBorder) -> BorderRadii<Au> {
fn build_border_radius(abs_bounds: &Rect<Au>, border_style: &style_structs::Border) -> BorderRadii<Au> {
// TODO(cgaebel): Support border radii even in the case of multiple border widths.
// This is an extension of supporting elliptical radii. For now, all percentage
// radii will be relative to the width.

View file

@ -26,7 +26,7 @@ use std::cmp::max;
use std::sync::Arc;
use style::computed_values::flex_direction;
use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};

View file

@ -52,7 +52,7 @@ use std::{fmt, mem, raw};
use style::computed_values::{clear, display, empty_cells, float, position, overflow_x, text_align};
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::{self, ComputedValues, ServoComputedValues};
use style::properties::{self, ServoComputedValues};
use style::servo::SharedStyleContext;
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow};

View file

@ -44,7 +44,7 @@ use style::computed_values::{overflow_wrap, overflow_x, position, text_decoratio
use style::computed_values::{transform_style, vertical_align, white_space, word_break, z_index};
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::str::char_is_whitespace;
use style::values::computed::LengthOrPercentageOrNone;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};

View file

@ -21,7 +21,7 @@ use std::sync::Arc;
use style::computed_values::content::ContentItem;
use style::computed_values::{display, list_style_type};
use style::dom::TRestyleDamage;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use text::TextRunScanner;
// Decimal styles per CSS-COUNTER-STYLES § 6.1:

View file

@ -37,7 +37,7 @@ use style::computed_values::{display, overflow_x, position, text_align, text_jus
use style::computed_values::{text_overflow, vertical_align, white_space};
use style::context::StyleContext;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::computed::LengthOrPercentage;
use text;

View file

@ -24,7 +24,7 @@ use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
use std::sync::Arc;
use style::computed_values::{list_style_type, position};
use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use text;

View file

@ -13,7 +13,7 @@ use std::cmp::{max, min};
use std::fmt;
use style::computed_values::transform::ComputedMatrix;
use style::logical_geometry::LogicalMargin;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::values::computed::{BorderRadiusSize, LengthOrPercentageOrAuto};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone};

View file

@ -23,7 +23,7 @@ use std::fmt;
use std::sync::Arc;
use style::context::StyleContext;
use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};

View file

@ -31,7 +31,6 @@ use std::sync::{Arc, Mutex};
use string_cache::Atom;
use style::computed_values;
use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection};
use style::properties::ComputedValues;
use style::properties::longhands::{display, position};
use style::properties::style_structs;
use style::selector_impl::PseudoElement;
@ -450,7 +449,7 @@ impl ParentOffsetBorderBoxIterator {
impl FragmentBorderBoxIterator for FragmentLocatingFragmentIterator {
fn process(&mut self, fragment: &Fragment, _: i32, border_box: &Rect<Au>) {
let style_structs::ServoBorder {
let style_structs::Border {
border_top_width: top_width,
border_right_width: right_width,
border_bottom_width: bottom_width,
@ -476,7 +475,7 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
// increase in size. To work around this, we store the original elements padding
// rectangle as `origin_rect` and the union of all child elements padding and
// margin rectangles as `union_rect`.
let style_structs::ServoBorder {
let style_structs::Border {
border_top_width: top_border,
border_right_width: right_border,
border_bottom_width: bottom_border,

View file

@ -27,7 +27,7 @@ use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing, table_layout};
use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;

View file

@ -25,7 +25,7 @@ use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, border_top_style, vertical_align};
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use table::InternalTable;
use table_row::{CollapsedBorder, CollapsedBorderProvenance};

View file

@ -27,7 +27,7 @@ use std::iter::{Enumerate, IntoIterator, Peekable};
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing, border_top_style};
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};

View file

@ -23,7 +23,7 @@ use std::iter::{IntoIterator, Iterator, Peekable};
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing};
use style::logical_geometry::{LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
use table_row;

View file

@ -32,7 +32,7 @@ use std::ops::Add;
use std::sync::Arc;
use style::computed_values::{border_collapse, table_layout};
use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;

View file

@ -25,8 +25,8 @@ use std::sync::Arc;
use style::computed_values::white_space;
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
use style::logical_geometry::{LogicalSize, WritingMode};
use style::properties::style_structs::ServoFont;
use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::ServoComputedValues;
use style::properties::style_structs;
use unicode_bidi::{is_rtl, process_text};
use unicode_script::{get_script, Script};
@ -431,11 +431,11 @@ fn bounding_box_for_run_metrics(metrics: &RunMetrics, writing_mode: WritingMode)
}
/// Returns the metrics of the font represented by the given `ServoFont`, respectively.
/// Returns the metrics of the font represented by the given `style_structs::Font`, respectively.
///
/// `#[inline]` because often the caller only needs a few fields from the font metrics.
#[inline]
pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<ServoFont>)
pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<style_structs::Font>)
-> FontMetrics {
let fontgroup = font_context.layout_font_group_for_style(font_style);
// FIXME(https://github.com/rust-lang/rust/issues/23338)

View file

@ -14,7 +14,6 @@ use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use std::mem;
use style::dom::TNode;
use style::properties::ServoComputedValues;
use style::selector_impl::ServoSelectorImpl;
use style::servo::SharedStyleContext;
use style::traversal::{DomTraversalContext, remove_from_bloom_filter, recalc_style_at};
@ -27,7 +26,7 @@ pub struct RecalcStyleAndConstructFlows<'lc> {
}
impl<'lc, N> DomTraversalContext<N> for RecalcStyleAndConstructFlows<'lc>
where N: LayoutNode + TNode<ConcreteComputedValues=ServoComputedValues>,
where N: LayoutNode + TNode,
N::ConcreteElement: ::selectors::Element<Impl=ServoSelectorImpl, AttrString=String>
{

View file

@ -35,7 +35,6 @@ use data::{LayoutDataFlags, PrivateLayoutData};
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
use style::computed_values::content::{self, ContentItem};
use style::properties::ComputedValues;
use style::refcell::{Ref, RefCell, RefMut};
pub type NonOpaqueStyleAndLayoutData = *mut RefCell<PrivateLayoutData>;