Skip to content

Commit

Permalink
Stop using associated types for the concrete TRestyleDamage implement…
Browse files Browse the repository at this point in the history
…ation.

MozReview-Commit-ID: LfaZFCVlIb1
  • Loading branch information
bholley committed Nov 7, 2016
1 parent b69fdad commit a2c7a9d
Show file tree
Hide file tree
Showing 29 changed files with 133 additions and 114 deletions.
2 changes: 1 addition & 1 deletion components/layout/animation.rs
Expand Up @@ -9,12 +9,12 @@ use flow::{self, Flow};
use gfx::display_list::OpaqueNode;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use script_layout_interface::restyle_damage::RestyleDamage;
use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg};
use std::collections::HashMap;
use std::sync::mpsc::Receiver;
use style::animation::{Animation, update_style_for_animation};
use style::dom::TRestyleDamage;
use style::selector_impl::RestyleDamage;
use style::timer::Timer;

/// Processes any new animations that were discovered after style recalculation.
Expand Down
3 changes: 1 addition & 2 deletions components/layout/block.rs
Expand Up @@ -48,8 +48,6 @@ use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
use model::{specified, specified_or_none};
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
use script_layout_interface::restyle_damage::REPOSITION;
use sequential;
use serde::{Serialize, Serializer};
use std::cmp::{max, min};
Expand All @@ -60,6 +58,7 @@ use style::computed_values::{position, text_align};
use style::context::{SharedStyleContext, StyleContext};
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPOSITION};
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
use style::values::computed::LengthOrPercentageOrAuto;
use util::clamp;
Expand Down
4 changes: 2 additions & 2 deletions components/layout/construct.rs
Expand Up @@ -36,7 +36,6 @@ use list_item::{ListItemFlow, ListStyleTypeContent};
use multicol::{MulticolColumnFlow, MulticolFlow};
use parallel;
use script_layout_interface::{LayoutElementType, LayoutNodeType, is_image_data};
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW, RestyleDamage};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use std::borrow::ToOwned;
use std::collections::LinkedList;
Expand All @@ -49,8 +48,9 @@ use style::computed_values::content::ContentItem;
use style::computed_values::position;
use style::context::SharedStyleContext;
use style::properties::{self, ServoComputedValues};
use style::selector_impl::{PseudoElement, RestyleDamage};
use style::selector_matching::Stylist;
use style::servo_selector_impl::PseudoElement;
use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
use table::TableFlow;
use table_caption::TableCaptionFlow;
use table_cell::TableCellFlow;
Expand Down
2 changes: 1 addition & 1 deletion components/layout/display_list_builder.rs
Expand Up @@ -35,7 +35,6 @@ use model::{self, MaybeAuto, ToGfxMatrix};
use net_traits::image::base::PixelFormat;
use net_traits::image_cache_thread::UsePlaceholder;
use range::Range;
use script_layout_interface::restyle_damage::REPAINT;
use std::{cmp, f32};
use std::collections::HashMap;
use std::default::Default;
Expand All @@ -51,6 +50,7 @@ use style::computed_values::text_shadow::TextShadow;
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::{self, ServoComputedValues};
use style::properties::style_structs;
use style::servo::restyle_damage::REPAINT;
use style::values::RGBA;
use style::values::computed;
use style::values::computed::{Gradient, GradientKind, LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto};
Expand Down
2 changes: 1 addition & 1 deletion components/layout/flex.rs
Expand Up @@ -21,7 +21,6 @@ use gfx_traits::ScrollRootId;
use layout_debug;
use model::{Direction, IntrinsicISizes, MaybeAuto, MinMaxConstraint};
use model::{specified, specified_or_none};
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use std::cmp::{max, min};
use std::ops::Range;
use std::sync::Arc;
Expand All @@ -30,6 +29,7 @@ use style::computed_values::border_collapse;
use style::context::{SharedStyleContext, StyleContext};
use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use style::values::computed::{LengthOrPercentageOrAutoOrContent, LengthOrPercentageOrNone};

Expand Down
4 changes: 2 additions & 2 deletions components/layout/flow.rs
Expand Up @@ -41,8 +41,6 @@ use inline::InlineFlow;
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use multicol::MulticolFlow;
use parallel::FlowParallelInfo;
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW};
use script_layout_interface::restyle_damage::{REPAINT, REPOSITION, RestyleDamage};
use serde::{Serialize, Serializer};
use std::{fmt, mem, raw};
use std::iter::Zip;
Expand All @@ -54,6 +52,8 @@ use style::context::SharedStyleContext;
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::selector_impl::RestyleDamage;
use style::servo::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION};
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow};
use table_caption::TableCaptionFlow;
Expand Down
3 changes: 2 additions & 1 deletion components/layout/fragment.rs
Expand Up @@ -30,7 +30,6 @@ use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
use range::*;
use script_layout_interface::HTMLCanvasData;
use script_layout_interface::SVGSVGData;
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, RestyleDamage};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use serde::{Serialize, Serializer};
use std::borrow::ToOwned;
Expand All @@ -47,6 +46,8 @@ use style::context::SharedStyleContext;
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::selector_impl::RestyleDamage;
use style::servo::restyle_damage::RECONSTRUCT_FLOW;
use style::str::char_is_whitespace;
use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto};
use style::values::computed::LengthOrPercentageOrNone;
Expand Down
3 changes: 2 additions & 1 deletion components/layout/generated_content.rs
Expand Up @@ -13,7 +13,6 @@ use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, Immutab
use flow::InorderFlowTraversal;
use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use gfx::display_list::OpaqueNode;
use script_layout_interface::restyle_damage::{RESOLVE_GENERATED_CONTENT, RestyleDamage};
use script_layout_interface::wrapper_traits::PseudoElementType;
use smallvec::SmallVec;
use std::collections::{HashMap, LinkedList};
Expand All @@ -22,6 +21,8 @@ use style::computed_values::{display, list_style_type};
use style::computed_values::content::ContentItem;
use style::dom::TRestyleDamage;
use style::properties::ServoComputedValues;
use style::selector_impl::RestyleDamage;
use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;
use text::TextRunScanner;

// Decimal styles per CSS-COUNTER-STYLES § 6.1:
Expand Down
3 changes: 2 additions & 1 deletion components/layout/incremental.rs
Expand Up @@ -3,9 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, IS_ABSOLUTELY_POSITIONED};
use script_layout_interface::restyle_damage::{RestyleDamage, REFLOW, RECONSTRUCT_FLOW};
use style::computed_values::float;
use style::dom::TRestyleDamage;
use style::selector_impl::RestyleDamage;
use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW};

bitflags! {
pub flags SpecialRestyleDamage: u8 {
Expand Down
3 changes: 1 addition & 2 deletions components/layout/inline.rs
Expand Up @@ -24,8 +24,6 @@ use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::IntrinsicISizesContribution;
use range::{Range, RangeIndex};
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
use script_layout_interface::restyle_damage::{REPOSITION, RESOLVE_GENERATED_CONTENT};
use script_layout_interface::wrapper_traits::PseudoElementType;
use std::{fmt, i32, isize, mem};
use std::cmp::max;
Expand All @@ -37,6 +35,7 @@ use style::computed_values::{text_overflow, vertical_align, white_space};
use style::context::{SharedStyleContext, StyleContext};
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPOSITION, RESOLVE_GENERATED_CONTENT};
use text;
use unicode_bidi;

Expand Down
2 changes: 1 addition & 1 deletion components/layout/list_item.rs
Expand Up @@ -20,12 +20,12 @@ use generated_content;
use gfx::display_list::StackingContext;
use gfx_traits::ScrollRootId;
use inline::InlineFlow;
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
use std::sync::Arc;
use style::computed_values::{list_style_type, position};
use style::context::SharedStyleContext;
use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;

/// A block with the CSS `display` property equal to `list-item`.
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion components/layout/sequential.rs
Expand Up @@ -15,8 +15,8 @@ use flow::IS_ABSOLUTELY_POSITIONED;
use fragment::FragmentBorderBoxIterator;
use generated_content::ResolveGeneratedContent;
use gfx_traits::ScrollRootId;
use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW};
use style::context::StyleContext;
use style::servo::restyle_damage::{REFLOW, STORE_OVERFLOW};
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
use util::opts;

Expand Down
2 changes: 1 addition & 1 deletion components/layout/table.rs
Expand Up @@ -21,14 +21,14 @@ use gfx_traits::ScrollRootId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use std::cmp;
use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing, table_layout};
use style::context::SharedStyleContext;
use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
Expand Down
2 changes: 1 addition & 1 deletion components/layout/table_row.rs
Expand Up @@ -20,7 +20,6 @@ use gfx_traits::ScrollRootId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::MaybeAuto;
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use serde::{Serialize, Serializer};
use std::cmp::max;
use std::fmt;
Expand All @@ -30,6 +29,7 @@ use style::computed_values::{border_collapse, border_spacing, border_top_style};
use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
use style::properties::ServoComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use table_cell::{CollapsedBordersForCell, TableCellFlow};
Expand Down
3 changes: 2 additions & 1 deletion components/layout/traversal.rs
Expand Up @@ -10,13 +10,14 @@ use display_list_builder::DisplayListBuildState;
use flow::{self, PreorderFlowTraversal};
use flow::{CAN_BE_FRAGMENTED, Flow, ImmutableFlowUtils, PostorderFlowTraversal};
use gfx::display_list::OpaqueNode;
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage};
use script_layout_interface::wrapper_traits::{LayoutElement, LayoutNode, ThreadSafeLayoutNode};
use std::mem;
use style::atomic_refcell::AtomicRefCell;
use style::context::{LocalStyleContext, SharedStyleContext, StyleContext};
use style::data::ElementData;
use style::dom::{StylingMode, TElement, TNode};
use style::selector_impl::RestyleDamage;
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT};
use style::traversal::{DomTraversalContext, put_thread_local_bloom_filter};
use style::traversal::{recalc_style_at, remove_from_bloom_filter};
use style::traversal::take_thread_local_bloom_filter;
Expand Down
3 changes: 1 addition & 2 deletions components/layout_thread/lib.rs
Expand Up @@ -87,8 +87,6 @@ use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::layout_wrapper::{ServoLayoutDocument, ServoLayoutNode};
use script_layout_interface::message::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
use script_layout_interface::reporter::CSSErrorReporter;
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION};
use script_layout_interface::restyle_damage::STORE_OVERFLOW;
use script_layout_interface::rpc::{LayoutRPC, MarginStyleResponse, NodeOverflowResponse, OffsetParentResponse};
use script_layout_interface::wrapper_traits::LayoutNode;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
Expand All @@ -111,6 +109,7 @@ use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::parser::ParserContextExtraData;
use style::selector_matching::Stylist;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
use style::thread_state;
use style::timer::Timer;
Expand Down
4 changes: 1 addition & 3 deletions components/script/layout_wrapper.rs
Expand Up @@ -46,7 +46,6 @@ use parking_lot::RwLock;
use range::Range;
use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress};
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
use script_layout_interface::restyle_damage::RestyleDamage;
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutElement, LayoutNode};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use selectors::matching::ElementFlags;
Expand All @@ -66,7 +65,7 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthe
use style::dom::{TRestyleDamage, UnsafeNode};
use style::element_state::*;
use style::properties::{ComputedValues, PropertyDeclarationBlock};
use style::selector_impl::{NonTSPseudoClass, PseudoElement, ServoSelectorImpl, Snapshot};
use style::selector_impl::{NonTSPseudoClass, PseudoElement, RestyleDamage, ServoSelectorImpl, Snapshot};
use style::selector_matching::ApplicableDeclarationBlock;
use style::sink::Push;
use style::str::is_whitespace;
Expand Down Expand Up @@ -435,7 +434,6 @@ impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> {
impl<'le> TElement for ServoLayoutElement<'le> {
type ConcreteNode = ServoLayoutNode<'le>;
type ConcreteDocument = ServoLayoutDocument<'le>;
type ConcreteRestyleDamage = RestyleDamage;

fn as_node(&self) -> ServoLayoutNode<'le> {
ServoLayoutNode::from_layout_js(self.element.upcast())
Expand Down
3 changes: 1 addition & 2 deletions components/script_layout_interface/lib.rs
Expand Up @@ -41,18 +41,17 @@ extern crate url;

pub mod message;
pub mod reporter;
pub mod restyle_damage;
pub mod rpc;
pub mod wrapper_traits;

use canvas_traits::CanvasMsg;
use core::nonzero::NonZero;
use ipc_channel::ipc::IpcSender;
use libc::c_void;
use restyle_damage::RestyleDamage;
use std::sync::atomic::AtomicIsize;
use style::atomic_refcell::AtomicRefCell;
use style::data::ElementData;
use style::selector_impl::RestyleDamage;

pub struct PartialPersistentLayoutData {
/// Data that the style system associates with a node. When the
Expand Down
3 changes: 1 addition & 2 deletions components/script_layout_interface/wrapper_traits.rs
Expand Up @@ -12,7 +12,6 @@ use gfx_traits::ByteIndex;
use html5ever_atoms::{Namespace, LocalName};
use msg::constellation_msg::PipelineId;
use range::Range;
use restyle_damage::RestyleDamage;
use std::fmt::Debug;
use std::sync::Arc;
use style::atomic_refcell::AtomicRefCell;
Expand All @@ -22,7 +21,7 @@ use style::data::ElementData;
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TElement, TNode};
use style::dom::OpaqueNode;
use style::properties::ServoComputedValues;
use style::selector_impl::{PseudoElement, PseudoElementCascadeType, ServoSelectorImpl};
use style::selector_impl::{PseudoElement, PseudoElementCascadeType, RestyleDamage, ServoSelectorImpl};
use url::Url;

#[derive(Copy, PartialEq, Clone, Debug)]
Expand Down
7 changes: 3 additions & 4 deletions components/style/dom.rs
Expand Up @@ -14,7 +14,7 @@ use parking_lot::RwLock;
use properties::{ComputedValues, PropertyDeclarationBlock};
use properties::longhands::display::computed_value as display;
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
use selector_impl::{ElementExt, PseudoElement, Snapshot};
use selector_impl::{ElementExt, PseudoElement, RestyleDamage, Snapshot};
use selector_matching::ApplicableDeclarationBlock;
use sink::Push;
use std::fmt::Debug;
Expand Down Expand Up @@ -173,7 +173,6 @@ pub trait PresentationalHintsSynthetizer {
pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer {
type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
type ConcreteRestyleDamage: TRestyleDamage;

fn as_node(&self) -> Self::ConcreteNode;

Expand All @@ -185,15 +184,15 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre
fn attr_equals(&self, namespace: &Namespace, attr: &LocalName, value: &Atom) -> bool;

/// Set the restyle damage field.
fn set_restyle_damage(self, damage: Self::ConcreteRestyleDamage);
fn set_restyle_damage(self, damage: RestyleDamage);

/// XXX: It's a bit unfortunate we need to pass the current computed values
/// as an argument here, but otherwise Servo would crash due to double
/// borrows to return it.
fn existing_style_for_restyle_damage<'a>(&'a self,
current_computed_values: Option<&'a Arc<ComputedValues>>,
pseudo: Option<&PseudoElement>)
-> Option<&'a <Self::ConcreteRestyleDamage as TRestyleDamage>::PreExistingComputedValues>;
-> Option<&'a <RestyleDamage as TRestyleDamage>::PreExistingComputedValues>;

/// The concept of a dirty bit doesn't exist in our new restyle algorithm.
/// Instead, we associate restyle and change hints with nodes. However, we
Expand Down
1 change: 1 addition & 0 deletions components/style/gecko/mod.rs
Expand Up @@ -5,6 +5,7 @@

pub mod context;
pub mod data;
pub mod restyle_damage;
pub mod snapshot;
pub mod snapshot_helpers;
pub mod traversal;
Expand Down

0 comments on commit a2c7a9d

Please sign in to comment.