Fix up script and layout.

This commit is contained in:
Bobby Holley 2017-05-02 16:22:10 -07:00
parent d78ca4c4f9
commit 7b0679848b
49 changed files with 99 additions and 85 deletions

View file

@ -21,6 +21,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use style::computed_values::{font_style, font_variant_caps}; use style::computed_values::{font_style, font_variant_caps};
use style::properties::style_structs; use style::properties::style_structs;
use style::stylearc::Arc as StyleArc;
use webrender_traits; use webrender_traits;
static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h)
@ -109,7 +110,7 @@ impl FontContext {
/// Create a group of fonts for use in layout calculations. May return /// Create a group of fonts for use in layout calculations. May return
/// a cached font if this font instance has already been used by /// a cached font if this font instance has already been used by
/// this context. /// this context.
pub fn layout_font_group_for_style(&mut self, style: Arc<style_structs::Font>) pub fn layout_font_group_for_style(&mut self, style: StyleArc<style_structs::Font>)
-> Rc<FontGroup> { -> Rc<FontGroup> {
self.expire_font_caches_if_necessary(); self.expire_font_caches_if_necessary();
@ -239,7 +240,7 @@ impl HeapSizeOf for FontContext {
#[derive(Debug)] #[derive(Debug)]
struct LayoutFontGroupCacheKey { struct LayoutFontGroupCacheKey {
pointer: Arc<style_structs::Font>, pointer: StyleArc<style_structs::Font>,
size: Au, size: Au,
} }

View file

@ -2134,7 +2134,7 @@ impl Flow for BlockFlow {
self.build_display_list_for_block(state, BorderPaintingMode::Separate); self.build_display_list_for_block(state, BorderPaintingMode::Separate);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.fragment.repair_style(new_style) self.fragment.repair_style(new_style)
} }

View file

@ -13,6 +13,7 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
use StyleArc;
use app_units::Au; use app_units::Au;
use block::BlockFlow; use block::BlockFlow;
use context::{LayoutContext, with_thread_local_font_context}; use context::{LayoutContext, with_thread_local_font_context};
@ -107,7 +108,7 @@ pub enum ConstructionItem {
/// Inline fragments and associated {ib} splits that have not yet found flows. /// Inline fragments and associated {ib} splits that have not yet found flows.
InlineFragments(InlineFragmentsConstructionResult), InlineFragments(InlineFragmentsConstructionResult),
/// Potentially ignorable whitespace. /// Potentially ignorable whitespace.
Whitespace(OpaqueNode, PseudoElementType<()>, Arc<ServoComputedValues>, RestyleDamage), Whitespace(OpaqueNode, PseudoElementType<()>, StyleArc<ServoComputedValues>, RestyleDamage),
/// TableColumn Fragment /// TableColumn Fragment
TableColumnFragment(Fragment), TableColumnFragment(Fragment),
} }
@ -675,7 +676,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
fn create_fragments_for_node_text_content(&self, fn create_fragments_for_node_text_content(&self,
fragments: &mut IntermediateInlineFragments, fragments: &mut IntermediateInlineFragments,
node: &ConcreteThreadSafeLayoutNode, node: &ConcreteThreadSafeLayoutNode,
style: &Arc<ServoComputedValues>) { style: &StyleArc<ServoComputedValues>) {
// Fast path: If there is no text content, return immediately. // Fast path: If there is no text content, return immediately.
let text_content = node.text_content(); let text_content = node.text_content();
if text_content.is_empty() { if text_content.is_empty() {
@ -1804,7 +1805,7 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut LinkedList<Fragment>) {
/// If the 'unicode-bidi' property has a value other than 'normal', return the bidi control codes /// If the 'unicode-bidi' property has a value other than 'normal', return the bidi control codes
/// to inject before and after the text content of the element. /// to inject before and after the text content of the element.
fn bidi_control_chars(style: &Arc<ServoComputedValues>) -> Option<(&'static str, &'static str)> { fn bidi_control_chars(style: &StyleArc<ServoComputedValues>) -> Option<(&'static str, &'static str)> {
use style::computed_values::direction::T::*; use style::computed_values::direction::T::*;
use style::computed_values::unicode_bidi::T::*; use style::computed_values::unicode_bidi::T::*;

View file

@ -577,7 +577,7 @@ fn build_border_radius(abs_bounds: &Rect<Au>,
/// Get the border radius for the rectangle inside of a rounded border. This is useful /// Get the border radius for the rectangle inside of a rounded border. This is useful
/// for building the clip for the content inside the border. /// for building the clip for the content inside the border.
fn build_border_radius_for_inner_rect(outer_rect: &Rect<Au>, fn build_border_radius_for_inner_rect(outer_rect: &Rect<Au>,
style: Arc<ServoComputedValues>) style: ::StyleArc<ServoComputedValues>)
-> BorderRadii<Au> { -> BorderRadii<Au> {
let mut radii = build_border_radius(&outer_rect, style.get_border()); let mut radii = build_border_radius(&outer_rect, style.get_border());
if radii.is_square() { if radii.is_square() {

View file

@ -21,7 +21,6 @@ use model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
use model::{specified, specified_or_none}; use model::{specified, specified_or_none};
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::ops::Range; use std::ops::Range;
use std::sync::Arc;
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content}; use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
use style::computed_values::border_collapse; use style::computed_values::border_collapse;
use style::logical_geometry::{Direction, LogicalSize}; use style::logical_geometry::{Direction, LogicalSize};
@ -970,7 +969,7 @@ impl Flow for FlexFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -424,7 +424,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
/// Attempts to perform incremental fixup of this flow by replacing its fragment's style with /// Attempts to perform incremental fixup of this flow by replacing its fragment's style with
/// the new style. This can only succeed if the flow has exactly one fragment. /// the new style. This can only succeed if the flow has exactly one fragment.
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>); fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>);
/// Print any extra children (such as fragments) contained in this Flow /// Print any extra children (such as fragments) contained in this Flow
/// for debugging purposes. Any items inserted into the tree will become /// for debugging purposes. Any items inserted into the tree will become
@ -561,7 +561,7 @@ pub trait MutableFlowUtils {
/// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of /// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of
/// calling them individually, since there is no reason not to perform both operations. /// calling them individually, since there is no reason not to perform both operations.
fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ServoComputedValues>); fn repair_style_and_bubble_inline_sizes(self, style: &::StyleArc<ServoComputedValues>);
} }
pub trait MutableOwnedFlowUtils { pub trait MutableOwnedFlowUtils {
@ -1361,7 +1361,7 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
/// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of /// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of
/// calling them individually, since there is no reason not to perform both operations. /// calling them individually, since there is no reason not to perform both operations.
fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ServoComputedValues>) { fn repair_style_and_bubble_inline_sizes(self, style: &::StyleArc<ServoComputedValues>) {
self.repair_style(style); self.repair_style(style);
self.bubble_inline_sizes(); self.bubble_inline_sizes();
} }

View file

@ -6,6 +6,7 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
use StyleArc;
use app_units::Au; use app_units::Au;
use canvas_traits::CanvasMsg; use canvas_traits::CanvasMsg;
use context::{LayoutContext, with_thread_local_font_context}; use context::{LayoutContext, with_thread_local_font_context};
@ -39,7 +40,6 @@ use std::borrow::ToOwned;
use std::cmp::{Ordering, max, min}; use std::cmp::{Ordering, max, min};
use std::collections::LinkedList; use std::collections::LinkedList;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use style::arc_ptr_eq;
use style::computed_values::{border_collapse, box_sizing, clear, color, display, mix_blend_mode}; use style::computed_values::{border_collapse, box_sizing, clear, color, display, mix_blend_mode};
use style::computed_values::{overflow_wrap, overflow_x, position, text_decoration_line, transform}; use style::computed_values::{overflow_wrap, overflow_x, position, text_decoration_line, transform};
use style::computed_values::{transform_style, vertical_align, white_space, word_break}; use style::computed_values::{transform_style, vertical_align, white_space, word_break};
@ -95,10 +95,10 @@ pub struct Fragment {
pub node: OpaqueNode, pub node: OpaqueNode,
/// The CSS style of this fragment. /// The CSS style of this fragment.
pub style: Arc<ServoComputedValues>, pub style: StyleArc<ServoComputedValues>,
/// The CSS style of this fragment when it's selected /// The CSS style of this fragment when it's selected
pub selected_style: Arc<ServoComputedValues>, pub selected_style: StyleArc<ServoComputedValues>,
/// The position of this fragment relative to its owning flow. The size includes padding and /// The position of this fragment relative to its owning flow. The size includes padding and
/// border, but not margin. /// border, but not margin.
@ -672,8 +672,8 @@ impl Fragment {
/// Constructs a new `Fragment` instance from an opaque node. /// Constructs a new `Fragment` instance from an opaque node.
pub fn from_opaque_node_and_style(node: OpaqueNode, pub fn from_opaque_node_and_style(node: OpaqueNode,
pseudo: PseudoElementType<()>, pseudo: PseudoElementType<()>,
style: Arc<ServoComputedValues>, style: StyleArc<ServoComputedValues>,
selected_style: Arc<ServoComputedValues>, selected_style: StyleArc<ServoComputedValues>,
mut restyle_damage: RestyleDamage, mut restyle_damage: RestyleDamage,
specific: SpecificFragmentInfo) specific: SpecificFragmentInfo)
-> Fragment { -> Fragment {
@ -702,7 +702,7 @@ impl Fragment {
/// type. For the new anonymous fragment, layout-related values (border box, etc.) are reset to /// type. For the new anonymous fragment, layout-related values (border box, etc.) are reset to
/// initial values. /// initial values.
pub fn create_similar_anonymous_fragment(&self, pub fn create_similar_anonymous_fragment(&self,
style: Arc<ServoComputedValues>, style: StyleArc<ServoComputedValues>,
specific: SpecificFragmentInfo) specific: SpecificFragmentInfo)
-> Fragment { -> Fragment {
let writing_mode = style.writing_mode; let writing_mode = style.writing_mode;
@ -1846,7 +1846,7 @@ impl Fragment {
match (&mut self.specific, &next_fragment.specific) { match (&mut self.specific, &next_fragment.specific) {
(&mut SpecificFragmentInfo::ScannedText(ref mut this_info), (&mut SpecificFragmentInfo::ScannedText(ref mut this_info),
&SpecificFragmentInfo::ScannedText(ref other_info)) => { &SpecificFragmentInfo::ScannedText(ref other_info)) => {
debug_assert!(arc_ptr_eq(&this_info.run, &other_info.run)); debug_assert!(::arc_ptr_eq(&this_info.run, &other_info.run));
this_info.range_end_including_stripped_whitespace = this_info.range_end_including_stripped_whitespace =
other_info.range_end_including_stripped_whitespace; other_info.range_end_including_stripped_whitespace;
if other_info.requires_line_break_afterward_if_wrapping_on_newlines() { if other_info.requires_line_break_afterward_if_wrapping_on_newlines() {
@ -2398,7 +2398,7 @@ impl Fragment {
} }
} }
pub fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { pub fn repair_style(&mut self, new_style: &StyleArc<ServoComputedValues>) {
self.style = (*new_style).clone() self.style = (*new_style).clone()
} }

View file

@ -16,7 +16,6 @@ use gfx::display_list::OpaqueNode;
use script_layout_interface::wrapper_traits::PseudoElementType; use script_layout_interface::wrapper_traits::PseudoElementType;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::collections::{HashMap, LinkedList}; use std::collections::{HashMap, LinkedList};
use std::sync::Arc;
use style::computed_values::{display, list_style_type}; use style::computed_values::{display, list_style_type};
use style::computed_values::content::ContentItem; use style::computed_values::content::ContentItem;
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -369,7 +368,7 @@ impl Counter {
layout_context: &LayoutContext, layout_context: &LayoutContext,
node: OpaqueNode, node: OpaqueNode,
pseudo: PseudoElementType<()>, pseudo: PseudoElementType<()>,
style: Arc<ServoComputedValues>, style: ::StyleArc<ServoComputedValues>,
list_style_type: list_style_type::T, list_style_type: list_style_type::T,
mode: RenderingMode) mode: RenderingMode)
-> Option<SpecificFragmentInfo> { -> Option<SpecificFragmentInfo> {
@ -432,7 +431,7 @@ struct CounterValue {
fn render_text(layout_context: &LayoutContext, fn render_text(layout_context: &LayoutContext,
node: OpaqueNode, node: OpaqueNode,
pseudo: PseudoElementType<()>, pseudo: PseudoElementType<()>,
style: Arc<ServoComputedValues>, style: ::StyleArc<ServoComputedValues>,
string: String) string: String)
-> Option<SpecificFragmentInfo> { -> Option<SpecificFragmentInfo> {
let mut fragments = LinkedList::new(); let mut fragments = LinkedList::new();

View file

@ -4,6 +4,7 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
use StyleArc;
use app_units::Au; use app_units::Au;
use block::AbsoluteAssignBSizesTraversal; use block::AbsoluteAssignBSizesTraversal;
use context::LayoutContext; use context::LayoutContext;
@ -29,7 +30,6 @@ use std::{fmt, i32, isize, mem};
use std::cmp::max; use std::cmp::max;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::Arc; use std::sync::Arc;
use style::arc_ptr_eq;
use style::computed_values::{display, overflow_x, position, text_align, text_justify}; use style::computed_values::{display, overflow_x, position, text_align, text_justify};
use style::computed_values::{vertical_align, white_space}; use style::computed_values::{vertical_align, white_space};
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
@ -398,7 +398,7 @@ impl LineBreaker {
result.border_padding.inline_end == Au(0) && result.border_padding.inline_end == Au(0) &&
candidate.border_padding.inline_start == Au(0) && candidate.border_padding.inline_start == Au(0) &&
result_info.selected() == candidate_info.selected() && result_info.selected() == candidate_info.selected() &&
arc_ptr_eq(&result_info.run, &candidate_info.run) && ::arc_ptr_eq(&result_info.run, &candidate_info.run) &&
inline_contexts_are_equal(&result.inline_context, inline_contexts_are_equal(&result.inline_context,
&candidate.inline_context) &candidate.inline_context)
} }
@ -1657,7 +1657,7 @@ impl Flow for InlineFlow {
self.build_display_list_for_inline(state); self.build_display_list_for_inline(state);
} }
fn repair_style(&mut self, _: &Arc<ServoComputedValues>) {} fn repair_style(&mut self, _: &StyleArc<ServoComputedValues>) {}
fn compute_overflow(&self) -> Overflow { fn compute_overflow(&self) -> Overflow {
let mut overflow = Overflow::new(); let mut overflow = Overflow::new();
@ -1746,8 +1746,8 @@ impl fmt::Debug for InlineFlow {
#[derive(Clone)] #[derive(Clone)]
pub struct InlineFragmentNodeInfo { pub struct InlineFragmentNodeInfo {
pub address: OpaqueNode, pub address: OpaqueNode,
pub style: Arc<ServoComputedValues>, pub style: StyleArc<ServoComputedValues>,
pub selected_style: Arc<ServoComputedValues>, pub selected_style: StyleArc<ServoComputedValues>,
pub pseudo: PseudoElementType<()>, pub pseudo: PseudoElementType<()>,
pub flags: InlineFragmentNodeFlags, pub flags: InlineFragmentNodeFlags,
} }

View file

@ -93,3 +93,15 @@ pub mod wrapper;
// For unit tests: // For unit tests:
pub use fragment::Fragment; pub use fragment::Fragment;
pub use fragment::SpecificFragmentInfo; pub use fragment::SpecificFragmentInfo;
/// Returns whether the two arguments point to the same value.
///
/// FIXME: Remove this and use Arc::ptr_eq once we require Rust 1.17
#[inline]
pub fn arc_ptr_eq<T: 'static>(a: &::std::sync::Arc<T>, b: &::std::sync::Arc<T>) -> bool {
::style::ptr_eq::<T>(&**a, &**b)
}
// We can't use stylearc for everything in layout, because the Flow stuff uses
// weak references.
use style::stylearc::Arc as StyleArc;

View file

@ -18,7 +18,6 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedC
use fragment::Overflow; use fragment::Overflow;
use generated_content; use generated_content;
use inline::InlineFlow; use inline::InlineFlow;
use std::sync::Arc;
use style::computed_values::{list_style_type, position}; use style::computed_values::{list_style_type, position};
use style::logical_geometry::LogicalSize; use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -148,7 +147,7 @@ impl Flow for ListItemFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -6,6 +6,7 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
use StyleArc;
use app_units::Au; use app_units::Au;
use block::BlockFlow; use block::BlockFlow;
use context::LayoutContext; use context::LayoutContext;
@ -193,7 +194,7 @@ impl Flow for MulticolFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }
@ -275,7 +276,7 @@ impl Flow for MulticolColumnFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -55,7 +55,7 @@ pub struct LayoutThreadData {
pub display_list: Option<Arc<DisplayList>>, pub display_list: Option<Arc<DisplayList>>,
/// Performs CSS selector matching and style resolution. /// Performs CSS selector matching and style resolution.
pub stylist: Arc<Stylist>, pub stylist: ::StyleArc<Stylist>,
/// A queued response for the union of the content boxes of a node. /// A queued response for the union of the content boxes of a node.
pub content_box_response: Option<Rect<Au>>, pub content_box_response: Option<Rect<Au>>,

View file

@ -21,7 +21,6 @@ use layout_debug;
use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto}; use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
use std::cmp; use std::cmp;
use std::fmt; use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing, table_layout}; use style::computed_values::{border_collapse, border_spacing, table_layout};
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::logical_geometry::LogicalSize; use style::logical_geometry::LogicalSize;
@ -507,7 +506,7 @@ impl Flow for TableFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -15,7 +15,6 @@ use flow::{Flow, FlowClass, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx_traits::print_tree::PrintTree; use gfx_traits::print_tree::PrintTree;
use std::fmt; use std::fmt;
use std::sync::Arc;
use style::logical_geometry::LogicalSize; use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -84,7 +83,7 @@ impl Flow for TableCaptionFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -19,7 +19,6 @@ use layout_debug;
use model::MaybeAuto; use model::MaybeAuto;
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
use std::fmt; use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, border_top_style, vertical_align}; use style::computed_values::{border_collapse, border_top_style, vertical_align};
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -264,7 +263,7 @@ impl Flow for TableCellFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -15,7 +15,6 @@ use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentIn
use layout_debug; use layout_debug;
use std::cmp::max; use std::cmp::max;
use std::fmt; use std::fmt;
use std::sync::Arc;
use style::logical_geometry::LogicalSize; use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
use style::values::computed::LengthOrPercentageOrAuto; use style::values::computed::LengthOrPercentageOrAuto;
@ -95,7 +94,7 @@ impl Flow for TableColGroupFlow {
fn collect_stacking_contexts(&mut self, _: &mut DisplayListBuildState) {} fn collect_stacking_contexts(&mut self, _: &mut DisplayListBuildState) {}
fn repair_style(&mut self, _: &Arc<ServoComputedValues>) {} fn repair_style(&mut self, _: &::StyleArc<ServoComputedValues>) {}
fn compute_overflow(&self) -> Overflow { fn compute_overflow(&self) -> Overflow {
Overflow::new() Overflow::new()

View file

@ -22,7 +22,6 @@ use serde::{Serialize, Serializer};
use std::cmp::max; use std::cmp::max;
use std::fmt; use std::fmt;
use std::iter::{Enumerate, IntoIterator, Peekable}; use std::iter::{Enumerate, IntoIterator, Peekable};
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing, border_top_style}; use style::computed_values::{border_collapse, border_spacing, border_top_style};
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode}; use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -483,7 +482,7 @@ impl Flow for TableRowFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -18,7 +18,6 @@ use layout_debug;
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use std::fmt; use std::fmt;
use std::iter::{IntoIterator, Iterator, Peekable}; use std::iter::{IntoIterator, Iterator, Peekable};
use std::sync::Arc;
use style::computed_values::{border_collapse, border_spacing}; use style::computed_values::{border_collapse, border_spacing};
use style::logical_geometry::LogicalSize; use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues; use style::properties::ServoComputedValues;
@ -186,7 +185,7 @@ impl Flow for TableRowGroupFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -27,7 +27,6 @@ use model::MaybeAuto;
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::fmt; use std::fmt;
use std::ops::Add; use std::ops::Add;
use std::sync::Arc;
use style::computed_values::{border_collapse, position, table_layout}; use style::computed_values::{border_collapse, position, table_layout};
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalRect, LogicalSize}; use style::logical_geometry::{LogicalRect, LogicalSize};
@ -467,7 +466,7 @@ impl Flow for TableWrapperFlow {
self.block_flow.collect_stacking_contexts(state); self.block_flow.collect_stacking_contexts(state);
} }
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) { fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
self.block_flow.repair_style(new_style) self.block_flow.repair_style(new_style)
} }

View file

@ -435,7 +435,7 @@ fn bounding_box_for_run_metrics(metrics: &RunMetrics, writing_mode: WritingMode)
/// ///
/// `#[inline]` because often the caller only needs a few fields from the font metrics. /// `#[inline]` because often the caller only needs a few fields from the font metrics.
#[inline] #[inline]
pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<style_structs::Font>) pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: ::StyleArc<style_structs::Font>)
-> FontMetrics { -> FontMetrics {
let fontgroup = font_context.layout_font_group_for_style(font_style); let fontgroup = font_context.layout_font_group_for_style(font_style);
// FIXME(https://github.com/rust-lang/rust/issues/23338) // FIXME(https://github.com/rust-lang/rust/issues/23338)

View file

@ -115,6 +115,7 @@ use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaList, MediaType}; use style::media_queries::{Device, MediaList, MediaType};
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW}; use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards}; use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards};
use style::stylearc::Arc as StyleArc;
use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets}; use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
use style::stylist::{ExtraStyleData, Stylist}; use style::stylist::{ExtraStyleData, Stylist};
use style::thread_state; use style::thread_state;
@ -192,10 +193,10 @@ pub struct LayoutThread {
document_shared_lock: Option<SharedRwLock>, document_shared_lock: Option<SharedRwLock>,
/// The list of currently-running animations. /// The list of currently-running animations.
running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>, running_animations: StyleArc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
/// The list of animations that have expired since the last style recalculation. /// The list of animations that have expired since the last style recalculation.
expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>, expired_animations: StyleArc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
/// A counter for epoch messages /// A counter for epoch messages
epoch: Epoch, epoch: Epoch,
@ -412,7 +413,7 @@ impl LayoutThread {
let font_cache_receiver = let font_cache_receiver =
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver); ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
let stylist = Arc::new(Stylist::new(device)); let stylist = StyleArc::new(Stylist::new(device));
let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0)); let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0));
let ua_stylesheets = &*UA_STYLESHEETS; let ua_stylesheets = &*UA_STYLESHEETS;
let guard = ua_stylesheets.shared_lock.read(); let guard = ua_stylesheets.shared_lock.read();
@ -448,8 +449,8 @@ impl LayoutThread {
outstanding_web_fonts: outstanding_web_fonts_counter, outstanding_web_fonts: outstanding_web_fonts_counter,
root_flow: None, root_flow: None,
document_shared_lock: None, document_shared_lock: None,
running_animations: Arc::new(RwLock::new(HashMap::new())), running_animations: StyleArc::new(RwLock::new(HashMap::new())),
expired_animations: Arc::new(RwLock::new(HashMap::new())), expired_animations: StyleArc::new(RwLock::new(HashMap::new())),
epoch: Epoch(0), epoch: Epoch(0),
viewport_size: Size2D::new(Au(0), Au(0)), viewport_size: Size2D::new(Au(0), Au(0)),
webrender_api: webrender_api_sender.create_api(), webrender_api: webrender_api_sender.create_api(),
@ -741,7 +742,7 @@ impl LayoutThread {
} }
fn handle_add_stylesheet<'a, 'b>(&self, fn handle_add_stylesheet<'a, 'b>(&self,
stylesheet: Arc<Stylesheet>, stylesheet: StyleArc<Stylesheet>,
possibly_locked_rw_data: &mut RwData<'a, 'b>) { possibly_locked_rw_data: &mut RwData<'a, 'b>) {
// Find all font-face rules and notify the font cache of them. // Find all font-face rules and notify the font cache of them.
// GWTODO: Need to handle unloading web fonts. // GWTODO: Need to handle unloading web fonts.
@ -776,7 +777,7 @@ impl LayoutThread {
possibly_locked_rw_data: &mut RwData<'a, 'b>, possibly_locked_rw_data: &mut RwData<'a, 'b>,
quirks_mode: QuirksMode) { quirks_mode: QuirksMode) {
let mut rw_data = possibly_locked_rw_data.lock(); let mut rw_data = possibly_locked_rw_data.lock();
Arc::get_mut(&mut rw_data.stylist).unwrap().set_quirks_mode(quirks_mode); StyleArc::get_mut(&mut rw_data.stylist).unwrap().set_quirks_mode(quirks_mode);
possibly_locked_rw_data.block(rw_data); possibly_locked_rw_data.block(rw_data);
} }
@ -1034,7 +1035,7 @@ impl LayoutThread {
self.document_shared_lock = Some(document_shared_lock.clone()); self.document_shared_lock = Some(document_shared_lock.clone());
let author_guard = document_shared_lock.read(); let author_guard = document_shared_lock.read();
let device = Device::new(MediaType::Screen, initial_viewport); let device = Device::new(MediaType::Screen, initial_viewport);
Arc::get_mut(&mut rw_data.stylist).unwrap() StyleArc::get_mut(&mut rw_data.stylist).unwrap()
.set_device(device, &author_guard, &data.document_stylesheets); .set_device(device, &author_guard, &data.document_stylesheets);
self.viewport_size = self.viewport_size =
@ -1088,7 +1089,7 @@ impl LayoutThread {
let mut extra_data = ExtraStyleData { let mut extra_data = ExtraStyleData {
marker: PhantomData, marker: PhantomData,
}; };
let needs_dirtying = Arc::get_mut(&mut rw_data.stylist).unwrap().update( let needs_dirtying = StyleArc::get_mut(&mut rw_data.stylist).unwrap().update(
&data.document_stylesheets, &data.document_stylesheets,
&guards, &guards,
Some(ua_stylesheets), Some(ua_stylesheets),

View file

@ -99,6 +99,7 @@ use style::media_queries::MediaList;
use style::properties::PropertyDeclarationBlock; use style::properties::PropertyDeclarationBlock;
use style::selector_parser::{PseudoElement, Snapshot}; use style::selector_parser::{PseudoElement, Snapshot};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
use style::stylearc::Arc as StyleArc;
use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule}; use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule};
use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule}; use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule};
use style::values::specified::Length; use style::values::specified::Length;
@ -166,6 +167,12 @@ unsafe impl<T: JSTraceable> JSTraceable for Arc<T> {
} }
} }
unsafe impl<T: JSTraceable> JSTraceable for StyleArc<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
(**self).trace(trc)
}
}
unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> { unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
(**self).trace(trc) (**self).trace(trc)

View file

@ -10,8 +10,8 @@ use dom::cssmediarule::CSSMediaRule;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::csssupportsrule::CSSSupportsRule; use dom::csssupportsrule::CSSSupportsRule;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{SharedRwLock, Locked}; use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRules as StyleCssRules; use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct] #[dom_struct]

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::FontFaceRule; use style::stylesheets::FontFaceRule;
#[dom_struct] #[dom_struct]

View file

@ -12,8 +12,8 @@ use dom::cssrule::CSSRule;
use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{SharedRwLock, Locked}; use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRules as StyleCssRules; use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct] #[dom_struct]

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::ImportRule; use style::stylesheets::ImportRule;
#[dom_struct] #[dom_struct]

View file

@ -12,9 +12,9 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::keyframes::Keyframe; use style::keyframes::Keyframe;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
#[dom_struct] #[dom_struct]
pub struct CSSKeyframeRule { pub struct CSSKeyframeRule {

View file

@ -16,9 +16,9 @@ use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::keyframes::{Keyframe, KeyframeSelector}; use style::keyframes::{Keyframe, KeyframeSelector};
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::KeyframesRule; use style::stylesheets::KeyframesRule;
use style::values::KeyframesName; use style::values::KeyframesName;

View file

@ -15,10 +15,10 @@ use dom::cssstylesheet::CSSStyleSheet;
use dom::medialist::MediaList; use dom::medialist::MediaList;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext}; use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, MediaRule}; use style::stylesheets::{CssRuleType, MediaRule};
use style_traits::ToCss; use style_traits::ToCss;

View file

@ -11,8 +11,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::NamespaceRule; use style::stylesheets::NamespaceRule;
#[dom_struct] #[dom_struct]

View file

@ -13,8 +13,8 @@ use dom::cssrule::CSSRule;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::Locked; use style::shared_lock::Locked;
use style::stylearc::Arc;
use style::stylesheets::{CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError}; use style::stylesheets::{CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError};
#[allow(unsafe_code)] #[allow(unsafe_code)]

View file

@ -16,13 +16,13 @@ use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::sync::Arc;
use style::attr::AttrValue; use style::attr::AttrValue;
use style::parser::LengthParsingMode; use style::parser::LengthParsingMode;
use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId}; use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId};
use style::properties::{parse_one_declaration, parse_style_attribute}; use style::properties::{parse_one_declaration, parse_style_attribute};
use style::selector_parser::PseudoElement; use style::selector_parser::PseudoElement;
use style::shared_lock::Locked; use style::shared_lock::Locked;
use style::stylearc::Arc;
use style_traits::ToCss; use style_traits::ToCss;
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface

View file

@ -12,8 +12,8 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::StyleRule; use style::stylesheets::StyleRule;
#[dom_struct] #[dom_struct]

View file

@ -15,8 +15,8 @@ use dom::stylesheet::StyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::cell::Cell; use std::cell::Cell;
use std::sync::Arc;
use style::shared_lock::SharedRwLock; use style::shared_lock::SharedRwLock;
use style::stylearc::Arc;
use style::stylesheets::Stylesheet as StyleStyleSheet; use style::stylesheets::Stylesheet as StyleStyleSheet;
#[dom_struct] #[dom_struct]

View file

@ -13,9 +13,9 @@ use dom::cssrule::SpecificCSSRule;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::parser::{LengthParsingMode, ParserContext}; use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, SupportsRule}; use style::stylesheets::{CssRuleType, SupportsRule};
use style::supports::SupportsCondition; use style::supports::SupportsCondition;
use style_traits::ToCss; use style_traits::ToCss;

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::viewport::ViewportRule; use style::viewport::ViewportRule;
#[dom_struct] #[dom_struct]

View file

@ -128,7 +128,6 @@ use std::default::Default;
use std::iter::once; use std::iter::once;
use std::mem; use std::mem;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use style::attr::AttrValue; use style::attr::AttrValue;
use style::context::{QuirksMode, ReflowGoal}; use style::context::{QuirksMode, ReflowGoal};
@ -136,6 +135,7 @@ use style::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE};
use style::selector_parser::{RestyleDamage, Snapshot}; use style::selector_parser::{RestyleDamage, Snapshot};
use style::shared_lock::SharedRwLock as StyleSharedRwLock; use style::shared_lock::SharedRwLock as StyleSharedRwLock;
use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join};
use style::stylearc::Arc;
use style::stylesheets::Stylesheet; use style::stylesheets::Stylesheet;
use task_source::TaskSource; use task_source::TaskSource;
use time; use time;

View file

@ -96,7 +96,6 @@ use std::convert::TryFrom;
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc;
use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::{QuirksMode, ReflowGoal}; use style::context::{QuirksMode, ReflowGoal};
use style::element_state::*; use style::element_state::*;
@ -107,6 +106,7 @@ use style::rule_tree::CascadeLevel;
use style::selector_parser::{NonTSPseudoClass, RestyleDamage, SelectorImpl, SelectorParser}; use style::selector_parser::{NonTSPseudoClass, RestyleDamage, SelectorImpl, SelectorParser};
use style::shared_lock::{SharedRwLock, Locked}; use style::shared_lock::{SharedRwLock, Locked};
use style::sink::Push; use style::sink::Push;
use style::stylearc::Arc;
use style::stylist::ApplicableDeclarationBlock; use style::stylist::ApplicableDeclarationBlock;
use style::thread_state; use style::thread_state;
use style::values::CSSFloat; use style::values::CSSFloat;

View file

@ -30,11 +30,11 @@ use std::ascii::AsciiExt;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::Cell; use std::cell::Cell;
use std::default::Default; use std::default::Default;
use std::sync::Arc;
use style::attr::AttrValue; use style::attr::AttrValue;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext as CssParserContext}; use style::parser::{LengthParsingMode, ParserContext as CssParserContext};
use style::str::HTML_SPACE_CHARACTERS; use style::str::HTML_SPACE_CHARACTERS;
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet}; use style::stylesheets::{CssRuleType, Stylesheet};
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};

View file

@ -21,11 +21,11 @@ use dom_struct::dom_struct;
use html5ever_atoms::LocalName; use html5ever_atoms::LocalName;
use servo_config::prefs::PREFS; use servo_config::prefs::PREFS;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::sync::Arc;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use style::attr::AttrValue; use style::attr::AttrValue;
use style::media_queries::MediaList; use style::media_queries::MediaList;
use style::str::HTML_SPACE_CHARACTERS; use style::str::HTML_SPACE_CHARACTERS;
use style::stylearc::Arc;
use style::stylesheets::{Stylesheet, CssRule, CssRules, Origin}; use style::stylesheets::{Stylesheet, CssRule, CssRules, Origin};
use style::viewport::ViewportRule; use style::viewport::ViewportRule;

View file

@ -21,7 +21,7 @@ use dom_struct::dom_struct;
use html5ever_atoms::LocalName; use html5ever_atoms::LocalName;
use net_traits::image::base::Image; use net_traits::image::base::Image;
use std::default::Default; use std::default::Default;
use std::sync::Arc; use style::stylearc::Arc;
#[dom_struct] #[dom_struct]
pub struct HTMLObjectElement { pub struct HTMLObjectElement {

View file

@ -23,9 +23,9 @@ use html5ever_atoms::LocalName;
use net_traits::ReferrerPolicy; use net_traits::ReferrerPolicy;
use script_layout_interface::message::Msg; use script_layout_interface::message::Msg;
use std::cell::Cell; use std::cell::Cell;
use std::sync::Arc;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext as CssParserContext}; use style::parser::{LengthParsingMode, ParserContext as CssParserContext};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet, Origin}; use style::stylesheets::{CssRuleType, Stylesheet, Origin};
use stylesheet_loader::{StylesheetLoader, StylesheetOwner}; use stylesheet_loader::{StylesheetLoader, StylesheetOwner};

View file

@ -12,11 +12,11 @@ use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use std::sync::Arc;
use style::media_queries::{MediaQuery, parse_media_query_list}; use style::media_queries::{MediaQuery, parse_media_query_list};
use style::media_queries::MediaList as StyleMediaList; use style::media_queries::MediaList as StyleMediaList;
use style::parser::{LengthParsingMode, ParserContext}; use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{SharedRwLock, Locked}; use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRuleType; use style::stylesheets::CssRuleType;
use style_traits::ToCss; use style_traits::ToCss;

View file

@ -78,10 +78,10 @@ use std::default::Default;
use std::iter; use std::iter;
use std::mem; use std::mem;
use std::ops::Range; use std::ops::Range;
use std::sync::Arc;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;
use style::selector_parser::{SelectorImpl, SelectorParser}; use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylearc::Arc;
use style::stylesheets::Stylesheet; use style::stylesheets::Stylesheet;
use style::thread_state; use style::thread_state;
use uuid::Uuid; use uuid::Uuid;

View file

@ -58,7 +58,6 @@ use std::fmt::Debug;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem::transmute; use std::mem::transmute;
use std::sync::Arc;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use style; use style;
use style::attr::AttrValue; use style::attr::AttrValue;
@ -74,6 +73,7 @@ use style::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
use style::sink::Push; use style::sink::Push;
use style::str::is_whitespace; use style::str::is_whitespace;
use style::stylearc::Arc;
use style::stylist::ApplicableDeclarationBlock; use style::stylist::ApplicableDeclarationBlock;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -24,9 +24,10 @@ use net_traits::request::{CorsSettings, CredentialsMode, Destination, RequestIni
use network_listener::{NetworkListener, PreInvoke}; use network_listener::{NetworkListener, PreInvoke};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::mem; use std::mem;
use std::sync::{Arc, Mutex}; use std::sync::Mutex;
use style::media_queries::MediaList; use style::media_queries::MediaList;
use style::shared_lock::Locked as StyleLocked; use style::shared_lock::Locked as StyleLocked;
use style::stylearc::Arc;
use style::stylesheets::{ImportRule, Stylesheet, Origin}; use style::stylesheets::{ImportRule, Stylesheet, Origin};
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader; use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
@ -207,7 +208,7 @@ impl<'a> StylesheetLoader<'a> {
let document = document_from_node(self.elem); let document = document_from_node(self.elem);
let gen = self.elem.downcast::<HTMLLinkElement>() let gen = self.elem.downcast::<HTMLLinkElement>()
.map(HTMLLinkElement::get_request_generation_id); .map(HTMLLinkElement::get_request_generation_id);
let context = Arc::new(Mutex::new(StylesheetContext { let context = ::std::sync::Arc::new(Mutex::new(StylesheetContext {
elem: Trusted::new(&*self.elem), elem: Trusted::new(&*self.elem),
source: source, source: source,
url: url.clone(), url: url.clone(),

View file

@ -25,7 +25,7 @@ use style::stylesheets::Stylesheet;
/// Asynchronous messages that script can send to layout. /// Asynchronous messages that script can send to layout.
pub enum Msg { pub enum Msg {
/// Adds the given stylesheet to the document. /// Adds the given stylesheet to the document.
AddStylesheet(Arc<Stylesheet>), AddStylesheet(::style::stylearc::Arc<Stylesheet>),
/// Change the quirks mode. /// Change the quirks mode.
SetQuirksMode(QuirksMode), SetQuirksMode(QuirksMode),
@ -116,7 +116,7 @@ pub struct ScriptReflow {
/// The document node. /// The document node.
pub document: TrustedNodeAddress, pub document: TrustedNodeAddress,
/// The document's list of stylesheets. /// The document's list of stylesheets.
pub document_stylesheets: Vec<Arc<Stylesheet>>, pub document_stylesheets: Vec<::style::stylearc::Arc<Stylesheet>>,
/// Whether the document's stylesheets have changed since the last script reflow. /// Whether the document's stylesheets have changed since the last script reflow.
pub stylesheets_changed: bool, pub stylesheets_changed: bool,
/// The current window size. /// The current window size.

View file

@ -15,7 +15,6 @@ use msg::constellation_msg::PipelineId;
use range::Range; use range::Range;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt::Debug; use std::fmt::Debug;
use std::sync::Arc;
use style::computed_values::display; use style::computed_values::display;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::data::ElementData; use style::data::ElementData;
@ -24,6 +23,7 @@ use style::dom::OpaqueNode;
use style::font_metrics::ServoMetricsProvider; use style::font_metrics::ServoMetricsProvider;
use style::properties::{CascadeFlags, ServoComputedValues}; use style::properties::{CascadeFlags, ServoComputedValues};
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl}; use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
use style::stylearc::Arc;
use webrender_traits::ClipId; use webrender_traits::ClipId;
#[derive(Copy, PartialEq, Clone, Debug)] #[derive(Copy, PartialEq, Clone, Debug)]