mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #16702 - bholley:custom_arc, r=emilio
Use a custom arc in the style system See https://bugzilla.mozilla.org/show_bug.cgi?id=1360889 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16702) <!-- Reviewable:end -->
This commit is contained in:
commit
7b1006936a
88 changed files with 540 additions and 149 deletions
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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::*;
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>>,
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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),
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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};
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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};
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -19,8 +19,8 @@ use properties::longhands::animation_iteration_count::single_value::computed_val
|
||||||
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||||
use properties::longhands::transition_timing_function::single_value::computed_value::StartEnd;
|
use properties::longhands::transition_timing_function::single_value::computed_value::StartEnd;
|
||||||
use properties::longhands::transition_timing_function::single_value::computed_value::T as TransitionTimingFunction;
|
use properties::longhands::transition_timing_function::single_value::computed_value::T as TransitionTimingFunction;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
use stylearc::Arc;
|
||||||
use timer::Timer;
|
use timer::Timer;
|
||||||
use values::computed::Time;
|
use values::computed::Time;
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ use servo_url::ServoUrl;
|
||||||
use shared_lock::Locked;
|
use shared_lock::Locked;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
|
||||||
use str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
|
use str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
|
||||||
use str::{read_numbers, split_commas, split_html_space_chars};
|
use str::{read_numbers, split_commas, split_html_space_chars};
|
||||||
use str::str_join;
|
use str::str_join;
|
||||||
|
use stylearc::Arc;
|
||||||
use values::specified::Length;
|
use values::specified::Length;
|
||||||
|
|
||||||
// Duplicated from script::dom::values.
|
// Duplicated from script::dom::values.
|
||||||
|
|
|
@ -27,8 +27,9 @@ use std::collections::HashMap;
|
||||||
#[cfg(not(feature = "servo"))] use std::env;
|
#[cfg(not(feature = "servo"))] use std::env;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::Mutex;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
use stylearc::Arc;
|
||||||
use stylist::Stylist;
|
use stylist::Stylist;
|
||||||
use thread_state;
|
use thread_state;
|
||||||
use time;
|
use time;
|
||||||
|
|
|
@ -14,8 +14,8 @@ use std::ascii::AsciiExt;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// A custom property name is just an `Atom`.
|
/// A custom property name is just an `Atom`.
|
||||||
///
|
///
|
||||||
|
|
|
@ -16,7 +16,7 @@ use selector_parser::{EAGER_PSEUDO_COUNT, PseudoElement, RestyleDamage, Snapshot
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
#[cfg(feature = "servo")] use std::hash::BuildHasherDefault;
|
#[cfg(feature = "servo")] use std::hash::BuildHasherDefault;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use stylist::Stylist;
|
use stylist::Stylist;
|
||||||
use thread_state;
|
use thread_state;
|
||||||
use traversal::TraversalFlags;
|
use traversal::TraversalFlags;
|
||||||
|
|
|
@ -26,7 +26,7 @@ use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use stylist::ApplicableDeclarationBlock;
|
use stylist::ApplicableDeclarationBlock;
|
||||||
use thread_state;
|
use thread_state;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ use media_queries::MediaList;
|
||||||
use self::encoding::{EncodingRef, DecoderTrap};
|
use self::encoding::{EncodingRef, DecoderTrap};
|
||||||
use shared_lock::SharedRwLock;
|
use shared_lock::SharedRwLock;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use stylesheets::{Stylesheet, StylesheetLoader, Origin, UrlExtraData};
|
use stylesheets::{Stylesheet, StylesheetLoader, Origin, UrlExtraData};
|
||||||
|
|
||||||
struct RustEncoding;
|
struct RustEncoding;
|
||||||
|
|
|
@ -15,8 +15,8 @@ use parking_lot::RwLock;
|
||||||
use properties::ComputedValues;
|
use properties::ComputedValues;
|
||||||
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||||
|
use stylearc::Arc;
|
||||||
use stylesheet_set::StylesheetSet;
|
use stylesheet_set::StylesheetSet;
|
||||||
use stylesheets::{FontFaceRule, Origin, Stylesheet};
|
use stylesheets::{FontFaceRule, Origin, Stylesheet};
|
||||||
use stylist::{ExtraStyleData, Stylist};
|
use stylist::{ExtraStyleData, Stylist};
|
||||||
|
|
|
@ -18,11 +18,11 @@ use media_queries::MediaType;
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use properties::{ComputedValues, StyleBuilder};
|
use properties::{ComputedValues, StyleBuilder};
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use std::sync::Arc;
|
|
||||||
use str::starts_with_ignore_ascii_case;
|
use str::starts_with_ignore_ascii_case;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
|
use stylearc::Arc;
|
||||||
use values::{CSSFloat, specified};
|
use values::{CSSFloat, specified};
|
||||||
use values::computed::{self, ToComputedValue};
|
use values::computed::{self, ToComputedValue};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use gecko_bindings::structs::{nsChangeHint, nsStyleContext};
|
||||||
use gecko_bindings::sugar::ownership::FFIArcHelpers;
|
use gecko_bindings::sugar::ownership::FFIArcHelpers;
|
||||||
use properties::ComputedValues;
|
use properties::ComputedValues;
|
||||||
use std::ops::{BitAnd, BitOr, BitOrAssign, Not};
|
use std::ops::{BitAnd, BitOr, BitOrAssign, Not};
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// The representation of Gecko's restyle damage is just a wrapper over
|
/// The representation of Gecko's restyle damage is just a wrapper over
|
||||||
/// `nsChangeHint`.
|
/// `nsChangeHint`.
|
||||||
|
|
|
@ -10,8 +10,8 @@ use gecko_bindings::sugar::refptr::RefPtr;
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use std::sync::Arc;
|
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// A specified url() value for gecko. Gecko does not eagerly resolve SpecifiedUrls.
|
/// A specified url() value for gecko. Gecko does not eagerly resolve SpecifiedUrls.
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
|
|
@ -71,8 +71,8 @@ use std::collections::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
|
||||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||||
|
use stylearc::Arc;
|
||||||
use stylesheets::UrlExtraData;
|
use stylesheets::UrlExtraData;
|
||||||
use stylist::ApplicableDeclarationBlock;
|
use stylist::ApplicableDeclarationBlock;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::marker::PhantomData;
|
||||||
use std::mem::{forget, transmute};
|
use std::mem::{forget, transmute};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// Indicates that a given Servo type has a corresponding Gecko FFI type.
|
/// Indicates that a given Servo type has a corresponding Gecko FFI type.
|
||||||
pub unsafe trait HasFFI : Sized {
|
pub unsafe trait HasFFI : Sized {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use gecko_bindings::sugar::ownership::HasArcFFI;
|
||||||
use std::{mem, ptr};
|
use std::{mem, ptr};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// Trait for all objects that have Addref() and Release
|
/// Trait for all objects that have Addref() and Release
|
||||||
/// methods and can be placed inside RefPtr<T>
|
/// methods and can be placed inside RefPtr<T>
|
||||||
|
|
|
@ -17,8 +17,8 @@ use properties::animated_properties::TransitionProperty;
|
||||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, Locked, ToCssWithGuard};
|
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, Locked, ToCssWithGuard};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
use stylearc::Arc;
|
||||||
use stylesheets::{CssRuleType, Stylesheet, VendorPrefix};
|
use stylesheets::{CssRuleType, Stylesheet, VendorPrefix};
|
||||||
|
|
||||||
/// A number from 0 to 1, indicating the percentage of the animation when this
|
/// A number from 0 to 1, indicating the percentage of the animation when this
|
||||||
|
|
|
@ -70,6 +70,7 @@ extern crate pdqsort;
|
||||||
#[cfg(feature = "gecko")] extern crate precomputed_hash;
|
#[cfg(feature = "gecko")] extern crate precomputed_hash;
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
extern crate selectors;
|
extern crate selectors;
|
||||||
|
#[cfg(feature = "servo")] extern crate serde;
|
||||||
#[cfg(feature = "servo")] #[macro_use] extern crate serde_derive;
|
#[cfg(feature = "servo")] #[macro_use] extern crate serde_derive;
|
||||||
#[cfg(feature = "servo")] #[macro_use] extern crate servo_atoms;
|
#[cfg(feature = "servo")] #[macro_use] extern crate servo_atoms;
|
||||||
#[cfg(feature = "servo")] extern crate servo_config;
|
#[cfg(feature = "servo")] extern crate servo_config;
|
||||||
|
@ -118,6 +119,7 @@ pub mod sequential;
|
||||||
pub mod sink;
|
pub mod sink;
|
||||||
pub mod str;
|
pub mod str;
|
||||||
pub mod style_adjuster;
|
pub mod style_adjuster;
|
||||||
|
pub mod stylearc;
|
||||||
pub mod stylesheet_set;
|
pub mod stylesheet_set;
|
||||||
pub mod stylesheets;
|
pub mod stylesheets;
|
||||||
pub mod supports;
|
pub mod supports;
|
||||||
|
@ -130,7 +132,6 @@ pub mod values;
|
||||||
pub mod viewport;
|
pub mod viewport;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")] pub use gecko_string_cache as string_cache;
|
#[cfg(feature = "gecko")] pub use gecko_string_cache as string_cache;
|
||||||
|
@ -175,14 +176,6 @@ macro_rules! reexport_computed_values {
|
||||||
}
|
}
|
||||||
longhand_properties_idents!(reexport_computed_values);
|
longhand_properties_idents!(reexport_computed_values);
|
||||||
|
|
||||||
/// 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: &Arc<T>, b: &Arc<T>) -> bool {
|
|
||||||
ptr_eq::<T>(&**a, &**b)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pointer equality
|
/// Pointer equality
|
||||||
///
|
///
|
||||||
/// FIXME: Remove this and use std::ptr::eq once we require Rust 1.17
|
/// FIXME: Remove this and use std::ptr::eq once we require Rust 1.17
|
||||||
|
|
|
@ -27,7 +27,7 @@ use selectors::bloom::BloomFilter;
|
||||||
use selectors::matching::{ElementSelectorFlags, StyleRelations};
|
use selectors::matching::{ElementSelectorFlags, StyleRelations};
|
||||||
use selectors::matching::AFFECTED_BY_PSEUDO_ELEMENTS;
|
use selectors::matching::AFFECTED_BY_PSEUDO_ELEMENTS;
|
||||||
use sink::ForgetfulSink;
|
use sink::ForgetfulSink;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use stylist::ApplicableDeclarationBlock;
|
use stylist::ApplicableDeclarationBlock;
|
||||||
|
|
||||||
/// The way a style should be inherited.
|
/// The way a style should be inherited.
|
||||||
|
@ -120,8 +120,8 @@ fn same_computed_values<E: TElement>(first: Option<E>, second: Option<E>) -> boo
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let eq = ::arc_ptr_eq(a.borrow_data().unwrap().styles().primary.values(),
|
let eq = Arc::ptr_eq(a.borrow_data().unwrap().styles().primary.values(),
|
||||||
b.borrow_data().unwrap().styles().primary.values());
|
b.borrow_data().unwrap().styles().primary.values());
|
||||||
eq
|
eq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarat
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
use std::mem::{forget, transmute, zeroed};
|
use std::mem::{forget, transmute, zeroed};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use values::computed::ToComputedValue;
|
use values::computed::ToComputedValue;
|
||||||
use values::{Either, Auto, KeyframesName};
|
use values::{Either, Auto, KeyframesName};
|
||||||
|
|
|
@ -252,7 +252,7 @@
|
||||||
use properties::{DeclaredValue, LonghandId, LonghandIdSet};
|
use properties::{DeclaredValue, LonghandId, LonghandIdSet};
|
||||||
use properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
|
use properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
|
||||||
use properties::style_structs;
|
use properties::style_structs;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use values::computed::{Context, ToComputedValue};
|
use values::computed::{Context, ToComputedValue};
|
||||||
use values::{computed, generics, specified};
|
use values::{computed, generics, specified};
|
||||||
use Atom;
|
use Atom;
|
||||||
|
@ -716,7 +716,7 @@
|
||||||
use properties::{PropertyDeclaration, ParsedDeclaration};
|
use properties::{PropertyDeclaration, ParsedDeclaration};
|
||||||
use properties::{ShorthandId, UnparsedValue, longhands};
|
use properties::{ShorthandId, UnparsedValue, longhands};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
pub struct Longhands {
|
pub struct Longhands {
|
||||||
|
|
|
@ -197,7 +197,7 @@ ${helpers.single_keyword("mask-composite",
|
||||||
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image">
|
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image">
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use values::specified::Image;
|
use values::specified::Image;
|
||||||
use values::specified::url::SpecifiedUrl;
|
use values::specified::url::SpecifiedUrl;
|
||||||
use values::HasViewportPercentage;
|
use values::HasViewportPercentage;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::borrow::Cow;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
#[cfg(feature = "servo")] use cssparser::{Color as CSSParserColor, RGBA};
|
#[cfg(feature = "servo")] use cssparser::{Color as CSSParserColor, RGBA};
|
||||||
|
@ -178,7 +178,7 @@ pub mod shorthands {
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use properties::{ParsedDeclaration, ShorthandId, UnparsedValue};
|
use properties::{ParsedDeclaration, ShorthandId, UnparsedValue};
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<ParsedDeclaration, ()> {
|
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<ParsedDeclaration, ()> {
|
||||||
// This function is like the parse() that is generated by
|
// This function is like the parse() that is generated by
|
||||||
|
@ -2056,7 +2056,7 @@ pub enum StyleStructRef<'a, T: 'a> {
|
||||||
/// A borrowed struct from the parent, for example, for inheriting style.
|
/// A borrowed struct from the parent, for example, for inheriting style.
|
||||||
Borrowed(&'a Arc<T>),
|
Borrowed(&'a Arc<T>),
|
||||||
/// An owned struct, that we've already mutated.
|
/// An owned struct, that we've already mutated.
|
||||||
Owned(T),
|
Owned(Arc<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: 'a> StyleStructRef<'a, T>
|
impl<'a, T: 'a> StyleStructRef<'a, T>
|
||||||
|
@ -2066,11 +2066,11 @@ impl<'a, T: 'a> StyleStructRef<'a, T>
|
||||||
/// borrowed value, or returning the owned one.
|
/// borrowed value, or returning the owned one.
|
||||||
pub fn mutate(&mut self) -> &mut T {
|
pub fn mutate(&mut self) -> &mut T {
|
||||||
if let StyleStructRef::Borrowed(v) = *self {
|
if let StyleStructRef::Borrowed(v) = *self {
|
||||||
*self = StyleStructRef::Owned((**v).clone());
|
*self = StyleStructRef::Owned(Arc::new((**v).clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
StyleStructRef::Owned(ref mut v) => v,
|
StyleStructRef::Owned(ref mut v) => Arc::get_mut(v).unwrap(),
|
||||||
StyleStructRef::Borrowed(..) => unreachable!(),
|
StyleStructRef::Borrowed(..) => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2079,7 +2079,7 @@ impl<'a, T: 'a> StyleStructRef<'a, T>
|
||||||
/// hasn't been mutated.
|
/// hasn't been mutated.
|
||||||
pub fn get_if_mutated(&mut self) -> Option<<&mut T> {
|
pub fn get_if_mutated(&mut self) -> Option<<&mut T> {
|
||||||
match *self {
|
match *self {
|
||||||
StyleStructRef::Owned(ref mut v) => Some(v),
|
StyleStructRef::Owned(ref mut v) => Some(Arc::get_mut(v).unwrap()),
|
||||||
StyleStructRef::Borrowed(..) => None,
|
StyleStructRef::Borrowed(..) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2088,7 +2088,7 @@ impl<'a, T: 'a> StyleStructRef<'a, T>
|
||||||
/// appropriate.
|
/// appropriate.
|
||||||
pub fn build(self) -> Arc<T> {
|
pub fn build(self) -> Arc<T> {
|
||||||
match self {
|
match self {
|
||||||
StyleStructRef::Owned(v) => Arc::new(v),
|
StyleStructRef::Owned(v) => v,
|
||||||
StyleStructRef::Borrowed(v) => v.clone(),
|
StyleStructRef::Borrowed(v) => v.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2099,7 @@ impl<'a, T: 'a> Deref for StyleStructRef<'a, T> {
|
||||||
|
|
||||||
fn deref(&self) -> &T {
|
fn deref(&self) -> &T {
|
||||||
match *self {
|
match *self {
|
||||||
StyleStructRef::Owned(ref v) => v,
|
StyleStructRef::Owned(ref v) => &**v,
|
||||||
StyleStructRef::Borrowed(v) => &**v,
|
StyleStructRef::Borrowed(v) => &**v,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2246,7 +2246,7 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES;
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
mod lazy_static_module {
|
mod lazy_static_module {
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use super::{ComputedValues, longhands, style_structs};
|
use super::{ComputedValues, longhands, style_structs};
|
||||||
|
|
||||||
/// The initial values for all style structs as defined by the specification.
|
/// The initial values for all style structs as defined by the specification.
|
||||||
|
|
|
@ -6,15 +6,14 @@
|
||||||
|
|
||||||
//! The rule tree.
|
//! The rule tree.
|
||||||
|
|
||||||
use arc_ptr_eq;
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use properties::{Importance, PropertyDeclarationBlock};
|
use properties::{Importance, PropertyDeclarationBlock};
|
||||||
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
||||||
|
use stylearc::Arc;
|
||||||
use stylesheets::StyleRule;
|
use stylesheets::StyleRule;
|
||||||
use thread_state;
|
use thread_state;
|
||||||
|
|
||||||
|
@ -65,8 +64,8 @@ impl StyleSource {
|
||||||
fn ptr_equals(&self, other: &Self) -> bool {
|
fn ptr_equals(&self, other: &Self) -> bool {
|
||||||
use self::StyleSource::*;
|
use self::StyleSource::*;
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(&Style(ref one), &Style(ref other)) => arc_ptr_eq(one, other),
|
(&Style(ref one), &Style(ref other)) => Arc::ptr_eq(one, other),
|
||||||
(&Declarations(ref one), &Declarations(ref other)) => arc_ptr_eq(one, other),
|
(&Declarations(ref one), &Declarations(ref other)) => Arc::ptr_eq(one, other),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +202,7 @@ impl RuleTree {
|
||||||
// so let's skip it for now.
|
// so let's skip it for now.
|
||||||
let is_here_already = match current.get().source.as_ref() {
|
let is_here_already = match current.get().source.as_ref() {
|
||||||
Some(&StyleSource::Declarations(ref already_here)) => {
|
Some(&StyleSource::Declarations(ref already_here)) => {
|
||||||
arc_ptr_eq(pdb, already_here)
|
Arc::ptr_eq(pdb, already_here)
|
||||||
},
|
},
|
||||||
_ => unreachable!("Replacing non-declarations style?"),
|
_ => unreachable!("Replacing non-declarations style?"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;
|
||||||
/// A type that represents the previous computed values needed for restyle
|
/// A type that represents the previous computed values needed for restyle
|
||||||
/// damage calculation.
|
/// damage calculation.
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub type PreExistingComputedValues = ::std::sync::Arc<::properties::ServoComputedValues>;
|
pub type PreExistingComputedValues = ::stylearc::Arc<::properties::ServoComputedValues>;
|
||||||
|
|
||||||
/// A type that represents the previous computed values needed for restyle
|
/// A type that represents the previous computed values needed for restyle
|
||||||
/// damage calculation.
|
/// damage calculation.
|
||||||
|
|
|
@ -11,7 +11,7 @@ use computed_values::display;
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use properties::ServoComputedValues;
|
use properties::ServoComputedValues;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
#[doc = "Individual layout actions that may be necessary after restyling."]
|
#[doc = "Individual layout actions that may be necessary after restyling."]
|
||||||
|
|
|
@ -9,6 +9,9 @@ use parser::ParserContext;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
// Note: We use std::sync::Arc rather than stylearc::Arc here because the
|
||||||
|
// nonzero optimization is important in keeping the size of SpecifiedUrl below
|
||||||
|
// the threshold.
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use atomic_refcell::{AtomicRefCell, AtomicRef, AtomicRefMut};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use std::cell::UnsafeCell;
|
use std::cell::UnsafeCell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
/// A shared read/write lock that can protect multiple objects.
|
/// A shared read/write lock that can protect multiple objects.
|
||||||
///
|
///
|
||||||
|
@ -149,7 +149,7 @@ impl<T: fmt::Debug> fmt::Debug for Locked<T> {
|
||||||
impl<T> Locked<T> {
|
impl<T> Locked<T> {
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
fn same_lock_as(&self, lock: &SharedRwLock) -> bool {
|
fn same_lock_as(&self, lock: &SharedRwLock) -> bool {
|
||||||
::arc_ptr_eq(&self.shared_lock.arc, &lock.arc)
|
Arc::ptr_eq(&self.shared_lock.arc, &lock.arc)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
|
380
components/style/stylearc.rs
Normal file
380
components/style/stylearc.rs
Normal file
|
@ -0,0 +1,380 @@
|
||||||
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Fork of Arc for the style system. This has the following advantages over std::Arc:
|
||||||
|
//! * We don't waste storage on the weak reference count.
|
||||||
|
//! * We don't do extra RMU operations to handle the possibility of weak references.
|
||||||
|
//! * We can experiment with arena allocation (todo).
|
||||||
|
//! * We can add methods to support our custom use cases [1].
|
||||||
|
//!
|
||||||
|
//! [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1360883
|
||||||
|
|
||||||
|
// The semantics of Arc are alread documented in the Rust docs, so we don't
|
||||||
|
// duplicate those here.
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
use heapsize::HeapSizeOf;
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::{isize, usize};
|
||||||
|
use std::borrow;
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
use std::convert::From;
|
||||||
|
use std::fmt;
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
|
use std::mem;
|
||||||
|
use std::ops::Deref;
|
||||||
|
use std::sync::atomic;
|
||||||
|
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release};
|
||||||
|
|
||||||
|
// Private macro to get the offset of a struct field in bytes from the address of the struct.
|
||||||
|
macro_rules! offset_of {
|
||||||
|
($container:path, $field:ident) => {{
|
||||||
|
// Make sure the field actually exists. This line ensures that a compile-time error is
|
||||||
|
// generated if $field is accessed through a Deref impl.
|
||||||
|
let $container { $field: _, .. };
|
||||||
|
|
||||||
|
// Create an (invalid) instance of the container and calculate the offset to its
|
||||||
|
// field. Using a null pointer might be UB if `&(*(0 as *const T)).field` is interpreted to
|
||||||
|
// be nullptr deref.
|
||||||
|
let invalid: $container = ::std::mem::uninitialized();
|
||||||
|
let offset = &invalid.$field as *const _ as usize - &invalid as *const _ as usize;
|
||||||
|
|
||||||
|
// Do not run destructors on the made up invalid instance.
|
||||||
|
::std::mem::forget(invalid);
|
||||||
|
offset as isize
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A soft limit on the amount of references that may be made to an `Arc`.
|
||||||
|
///
|
||||||
|
/// Going above this limit will abort your program (although not
|
||||||
|
/// necessarily) at _exactly_ `MAX_REFCOUNT + 1` references.
|
||||||
|
const MAX_REFCOUNT: usize = (isize::MAX) as usize;
|
||||||
|
|
||||||
|
pub struct Arc<T: ?Sized> {
|
||||||
|
// FIXME(bholley): When NonZero/Shared/Unique are stabilized, we should use
|
||||||
|
// Shared here to get the NonZero optimization. Gankro is working on this.
|
||||||
|
//
|
||||||
|
// If we need a compact Option<Arc<T>> beforehand, we can make a helper
|
||||||
|
// class that wraps the result of Arc::into_raw.
|
||||||
|
//
|
||||||
|
// https://github.com/rust-lang/rust/issues/27730
|
||||||
|
ptr: *mut ArcInner<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl<T: ?Sized + Sync + Send> Send for Arc<T> {}
|
||||||
|
unsafe impl<T: ?Sized + Sync + Send> Sync for Arc<T> {}
|
||||||
|
|
||||||
|
struct ArcInner<T: ?Sized> {
|
||||||
|
count: atomic::AtomicUsize,
|
||||||
|
data: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl<T: ?Sized + Sync + Send> Send for ArcInner<T> {}
|
||||||
|
unsafe impl<T: ?Sized + Sync + Send> Sync for ArcInner<T> {}
|
||||||
|
|
||||||
|
impl<T> Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
pub fn new(data: T) -> Self {
|
||||||
|
let x = Box::new(ArcInner {
|
||||||
|
count: atomic::AtomicUsize::new(1),
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
Arc { ptr: Box::into_raw(x) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn into_raw(this: Self) -> *const T {
|
||||||
|
let ptr = unsafe { &((*this.ptr).data) as *const _ };
|
||||||
|
mem::forget(this);
|
||||||
|
ptr
|
||||||
|
}
|
||||||
|
|
||||||
|
pub unsafe fn from_raw(ptr: *const T) -> Self {
|
||||||
|
// To find the corresponding pointer to the `ArcInner` we need
|
||||||
|
// to subtract the offset of the `data` field from the pointer.
|
||||||
|
let ptr = (ptr as *const u8).offset(-offset_of!(ArcInner<T>, data));
|
||||||
|
Arc {
|
||||||
|
ptr: ptr as *mut ArcInner<T>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
fn inner(&self) -> &ArcInner<T> {
|
||||||
|
// This unsafety is ok because while this arc is alive we're guaranteed
|
||||||
|
// that the inner pointer is valid. Furthermore, we know that the
|
||||||
|
// `ArcInner` structure itself is `Sync` because the inner data is
|
||||||
|
// `Sync` as well, so we're ok loaning out an immutable pointer to these
|
||||||
|
// contents.
|
||||||
|
unsafe { &*self.ptr }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-inlined part of `drop`. Just invokes the destructor.
|
||||||
|
#[inline(never)]
|
||||||
|
unsafe fn drop_slow(&mut self) {
|
||||||
|
let _ = Box::from_raw(self.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
|
||||||
|
this.ptr == other.ptr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Clone for Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
// Using a relaxed ordering is alright here, as knowledge of the
|
||||||
|
// original reference prevents other threads from erroneously deleting
|
||||||
|
// the object.
|
||||||
|
//
|
||||||
|
// As explained in the [Boost documentation][1], Increasing the
|
||||||
|
// reference counter can always be done with memory_order_relaxed: New
|
||||||
|
// references to an object can only be formed from an existing
|
||||||
|
// reference, and passing an existing reference from one thread to
|
||||||
|
// another must already provide any required synchronization.
|
||||||
|
//
|
||||||
|
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
|
||||||
|
let old_size = self.inner().count.fetch_add(1, Relaxed);
|
||||||
|
|
||||||
|
// However we need to guard against massive refcounts in case someone
|
||||||
|
// is `mem::forget`ing Arcs. If we don't do this the count can overflow
|
||||||
|
// and users will use-after free. We racily saturate to `isize::MAX` on
|
||||||
|
// the assumption that there aren't ~2 billion threads incrementing
|
||||||
|
// the reference count at once. This branch will never be taken in
|
||||||
|
// any realistic program.
|
||||||
|
//
|
||||||
|
// We abort because such a program is incredibly degenerate, and we
|
||||||
|
// don't care to support it.
|
||||||
|
if old_size > MAX_REFCOUNT {
|
||||||
|
// Note: std::process::abort is stable in 1.17, which we don't yet
|
||||||
|
// require for Gecko. Panic is good enough in practice here (it will
|
||||||
|
// trigger an abort at least in Gecko, and this case is degenerate
|
||||||
|
// enough that Servo shouldn't have code that triggers it).
|
||||||
|
//
|
||||||
|
// We should fix this when we require 1.17.
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
|
||||||
|
Arc { ptr: self.ptr }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Deref for Arc<T> {
|
||||||
|
type Target = T;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn deref(&self) -> &T {
|
||||||
|
&self.inner().data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Clone> Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
pub fn make_mut(this: &mut Self) -> &mut T {
|
||||||
|
if !this.is_unique() {
|
||||||
|
// Another pointer exists; clone
|
||||||
|
*this = Arc::new((**this).clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
// This unsafety is ok because we're guaranteed that the pointer
|
||||||
|
// returned is the *only* pointer that will ever be returned to T. Our
|
||||||
|
// reference count is guaranteed to be 1 at this point, and we required
|
||||||
|
// the Arc itself to be `mut`, so we're returning the only possible
|
||||||
|
// reference to the inner data.
|
||||||
|
&mut (*this.ptr).data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
pub fn get_mut(this: &mut Self) -> Option<&mut T> {
|
||||||
|
if this.is_unique() {
|
||||||
|
unsafe {
|
||||||
|
// See make_mut() for documentation of the threadsafety here.
|
||||||
|
Some(&mut (*this.ptr).data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn is_unique(&self) -> bool {
|
||||||
|
// We can use Relaxed here, but the justification is a bit subtle.
|
||||||
|
//
|
||||||
|
// The reason to use Acquire would be to synchronize with other threads
|
||||||
|
// that are modifying the refcount with Release, i.e. to ensure that
|
||||||
|
// their writes to memory guarded by this refcount are flushed. However,
|
||||||
|
// we know that threads only modify the contents of the Arc when they
|
||||||
|
// observe the refcount to be 1, and no other thread could observe that
|
||||||
|
// because we're holding one strong reference here.
|
||||||
|
self.inner().count.load(Relaxed) == 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Drop for Arc<T> {
|
||||||
|
#[inline]
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// Because `fetch_sub` is already atomic, we do not need to synchronize
|
||||||
|
// with other threads unless we are going to delete the object.
|
||||||
|
if self.inner().count.fetch_sub(1, Release) != 1 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME(bholley): Use the updated comment when [2] is merged.
|
||||||
|
//
|
||||||
|
// This load is needed to prevent reordering of use of the data and
|
||||||
|
// deletion of the data. Because it is marked `Release`, the decreasing
|
||||||
|
// of the reference count synchronizes with this `Acquire` load. This
|
||||||
|
// means that use of the data happens before decreasing the reference
|
||||||
|
// count, which happens before this load, which happens before the
|
||||||
|
// deletion of the data.
|
||||||
|
//
|
||||||
|
// As explained in the [Boost documentation][1],
|
||||||
|
//
|
||||||
|
// > It is important to enforce any possible access to the object in one
|
||||||
|
// > thread (through an existing reference) to *happen before* deleting
|
||||||
|
// > the object in a different thread. This is achieved by a "release"
|
||||||
|
// > operation after dropping a reference (any access to the object
|
||||||
|
// > through this reference must obviously happened before), and an
|
||||||
|
// > "acquire" operation before deleting the object.
|
||||||
|
//
|
||||||
|
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
|
||||||
|
// [2]: https://github.com/rust-lang/rust/pull/41714
|
||||||
|
self.inner().count.load(Acquire);
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
self.drop_slow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
|
||||||
|
fn eq(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) == *(*other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ne(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) != *(*other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {
|
||||||
|
fn partial_cmp(&self, other: &Arc<T>) -> Option<Ordering> {
|
||||||
|
(**self).partial_cmp(&**other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn lt(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) < *(*other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn le(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) <= *(*other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn gt(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) > *(*other)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ge(&self, other: &Arc<T>) -> bool {
|
||||||
|
*(*self) >= *(*other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: ?Sized + Ord> Ord for Arc<T> {
|
||||||
|
fn cmp(&self, other: &Arc<T>) -> Ordering {
|
||||||
|
(**self).cmp(&**other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: ?Sized + Eq> Eq for Arc<T> {}
|
||||||
|
|
||||||
|
impl<T: ?Sized + fmt::Display> fmt::Display for Arc<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
fmt::Display::fmt(&**self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
fmt::Debug::fmt(&**self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> fmt::Pointer for Arc<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
fmt::Pointer::fmt(&self.ptr, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Default> Default for Arc<T> {
|
||||||
|
fn default() -> Arc<T> {
|
||||||
|
Arc::new(Default::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized + Hash> Hash for Arc<T> {
|
||||||
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
|
(**self).hash(state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> From<T> for Arc<T> {
|
||||||
|
fn from(t: T) -> Self {
|
||||||
|
Arc::new(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
|
||||||
|
fn borrow(&self) -> &T {
|
||||||
|
&**self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> AsRef<T> for Arc<T> {
|
||||||
|
fn as_ref(&self) -> &T {
|
||||||
|
&**self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is what the HeapSize crate does for regular arc, but is questionably
|
||||||
|
// sound. See https://github.com/servo/heapsize/issues/37
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
impl<T: HeapSizeOf> HeapSizeOf for Arc<T> {
|
||||||
|
fn heap_size_of_children(&self) -> usize {
|
||||||
|
(**self).heap_size_of_children()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
impl<T: Deserialize> Deserialize for Arc<T>
|
||||||
|
{
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Arc<T>, D::Error>
|
||||||
|
where
|
||||||
|
D: ::serde::de::Deserializer,
|
||||||
|
{
|
||||||
|
T::deserialize(deserializer).map(Arc::new)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
impl<T: Serialize> Serialize for Arc<T>
|
||||||
|
{
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: ::serde::ser::Serializer,
|
||||||
|
{
|
||||||
|
(**self).serialize(serializer)
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! A centralized set of stylesheets for a document.
|
//! A centralized set of stylesheets for a document.
|
||||||
|
|
||||||
use std::sync::Arc;
|
use stylearc::Arc;
|
||||||
use stylesheets::Stylesheet;
|
use stylesheets::Stylesheet;
|
||||||
|
|
||||||
/// Entry for a StylesheetSet. We don't bother creating a constructor, because
|
/// Entry for a StylesheetSet. We don't bother creating a constructor, because
|
||||||
|
|
|
@ -36,10 +36,10 @@ use servo_url::ServoUrl;
|
||||||
use shared_lock::{SharedRwLock, Locked, ToCssWithGuard, SharedRwLockReadGuard};
|
use shared_lock::{SharedRwLock, Locked, ToCssWithGuard, SharedRwLockReadGuard};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use str::starts_with_ignore_ascii_case;
|
use str::starts_with_ignore_ascii_case;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
use stylearc::Arc;
|
||||||
use stylist::FnvHashMap;
|
use stylist::FnvHashMap;
|
||||||
use supports::SupportsCondition;
|
use supports::SupportsCondition;
|
||||||
use values::{CustomIdent, KeyframesName};
|
use values::{CustomIdent, KeyframesName};
|
||||||
|
|
|
@ -39,8 +39,8 @@ use std::fmt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::sync::Arc;
|
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
|
use stylearc::Arc;
|
||||||
use stylesheets::{CssRule, FontFaceRule, Origin, StyleRule, Stylesheet, UserAgentStylesheets};
|
use stylesheets::{CssRule, FontFaceRule, Origin, StyleRule, Stylesheet, UserAgentStylesheets};
|
||||||
use thread_state;
|
use thread_state;
|
||||||
use viewport::{self, MaybeNew, ViewportRule};
|
use viewport::{self, MaybeNew, ViewportRule};
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::Mutex;
|
||||||
use style::context::{QuirksMode, SharedStyleContext, StyleContext};
|
use style::context::{QuirksMode, SharedStyleContext, StyleContext};
|
||||||
use style::context::{ThreadLocalStyleContext, ThreadLocalStyleContextCreationInfo};
|
use style::context::{ThreadLocalStyleContext, ThreadLocalStyleContextCreationInfo};
|
||||||
use style::data::{ElementData, ElementStyles, RestyleData};
|
use style::data::{ElementData, ElementStyles, RestyleData};
|
||||||
|
@ -83,6 +83,7 @@ use style::sequential;
|
||||||
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard, Locked};
|
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard, Locked};
|
||||||
use style::string_cache::Atom;
|
use style::string_cache::Atom;
|
||||||
use style::style_adjuster::StyleAdjuster;
|
use style::style_adjuster::StyleAdjuster;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{CssRule, CssRules, CssRuleType, CssRulesHelpers};
|
use style::stylesheets::{CssRule, CssRules, CssRuleType, CssRulesHelpers};
|
||||||
use style::stylesheets::{ImportRule, MediaRule, NamespaceRule, Origin};
|
use style::stylesheets::{ImportRule, MediaRule, NamespaceRule, Origin};
|
||||||
use style::stylesheets::{PageRule, Stylesheet, StyleRule, SupportsRule};
|
use style::stylesheets::{PageRule, Stylesheet, StyleRule, SupportsRule};
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
|
use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
|
||||||
use style::gecko_bindings::structs::{Loader, ServoStyleSheet};
|
use style::gecko_bindings::structs::{Loader, ServoStyleSheet};
|
||||||
use style::gecko_bindings::sugar::ownership::{HasArcFFI, FFIArcHelpers};
|
use style::gecko_bindings::sugar::ownership::{HasArcFFI, FFIArcHelpers};
|
||||||
use style::media_queries::MediaList;
|
use style::media_queries::MediaList;
|
||||||
use style::shared_lock::Locked;
|
use style::shared_lock::Locked;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{ImportRule, Stylesheet, StylesheetLoader as StyleStylesheetLoader};
|
use style::stylesheets::{ImportRule, Stylesheet, StylesheetLoader as StyleStylesheetLoader};
|
||||||
|
|
||||||
pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet);
|
pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet);
|
||||||
|
|
|
@ -31,10 +31,10 @@ macro_rules! sizeof_checker (
|
||||||
// Update the sizes here
|
// Update the sizes here
|
||||||
sizeof_checker!(size_event_target, EventTarget, 40);
|
sizeof_checker!(size_event_target, EventTarget, 40);
|
||||||
sizeof_checker!(size_node, Node, 152);
|
sizeof_checker!(size_node, Node, 152);
|
||||||
sizeof_checker!(size_element, Element, 320);
|
sizeof_checker!(size_element, Element, 328);
|
||||||
sizeof_checker!(size_htmlelement, HTMLElement, 336);
|
sizeof_checker!(size_htmlelement, HTMLElement, 344);
|
||||||
sizeof_checker!(size_div, HTMLDivElement, 336);
|
sizeof_checker!(size_div, HTMLDivElement, 344);
|
||||||
sizeof_checker!(size_span, HTMLSpanElement, 336);
|
sizeof_checker!(size_span, HTMLSpanElement, 344);
|
||||||
sizeof_checker!(size_text, Text, 184);
|
sizeof_checker!(size_text, Text, 184);
|
||||||
sizeof_checker!(size_characterdata, CharacterData, 184);
|
sizeof_checker!(size_characterdata, CharacterData, 184);
|
||||||
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);
|
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
use style::keyframes::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector};
|
use style::keyframes::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector};
|
||||||
use style::keyframes::{KeyframesStep, KeyframesStepValue};
|
use style::keyframes::{KeyframesStep, KeyframesStepValue};
|
||||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||||
use style::properties::animated_properties::TransitionProperty;
|
use style::properties::animated_properties::TransitionProperty;
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::values::specified::{LengthOrPercentageOrAuto, NoCalcLength};
|
use style::values::specified::{LengthOrPercentageOrAuto, NoCalcLength};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -6,13 +6,13 @@ use cssparser::{Parser, SourcePosition};
|
||||||
use euclid::size::TypedSize2D;
|
use euclid::size::TypedSize2D;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::sync::Arc;
|
|
||||||
use style::Atom;
|
use style::Atom;
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::error_reporting::ParseErrorReporter;
|
use style::error_reporting::ParseErrorReporter;
|
||||||
use style::media_queries::*;
|
use style::media_queries::*;
|
||||||
use style::servo::media_queries::*;
|
use style::servo::media_queries::*;
|
||||||
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard};
|
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard};
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{Stylesheet, Origin, CssRule};
|
use style::stylesheets::{Stylesheet, Origin, CssRule};
|
||||||
use style::values::specified;
|
use style::values::specified;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
use cssparser::{Parser, SourcePosition};
|
use cssparser::{Parser, SourcePosition};
|
||||||
use rayon;
|
use rayon;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::sync::Arc;
|
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::error_reporting::ParseErrorReporter;
|
use style::error_reporting::ParseErrorReporter;
|
||||||
use style::media_queries::MediaList;
|
use style::media_queries::MediaList;
|
||||||
use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
||||||
use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
|
use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{Origin, Stylesheet, CssRule};
|
use style::stylesheets::{Origin, Stylesheet, CssRule};
|
||||||
use test::{self, Bencher};
|
use test::{self, Bencher};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ use selectors::parser::*;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
|
@ -22,6 +21,7 @@ use style::properties::{CSSWideKeyword, DeclaredValueOwned, PropertyDeclaration,
|
||||||
use style::properties::longhands;
|
use style::properties::longhands;
|
||||||
use style::properties::longhands::animation_play_state;
|
use style::properties::longhands::animation_play_state;
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{Origin, Namespaces};
|
use style::stylesheets::{Origin, Namespaces};
|
||||||
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule};
|
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule};
|
||||||
use style::values::{KeyframesName, CustomIdent};
|
use style::values::{KeyframesName, CustomIdent};
|
||||||
|
|
|
@ -6,12 +6,12 @@ use html5ever_atoms::LocalName;
|
||||||
use selectors::parser::LocalName as LocalNameSelector;
|
use selectors::parser::LocalName as LocalNameSelector;
|
||||||
use selectors::parser::Selector;
|
use selectors::parser::Selector;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::sync::Arc;
|
|
||||||
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration};
|
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration};
|
||||||
use style::properties::{longhands, Importance};
|
use style::properties::{longhands, Importance};
|
||||||
use style::rule_tree::CascadeLevel;
|
use style::rule_tree::CascadeLevel;
|
||||||
use style::selector_parser::{SelectorImpl, SelectorParser};
|
use style::selector_parser::{SelectorImpl, SelectorParser};
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::StyleRule;
|
use style::stylesheets::StyleRule;
|
||||||
use style::stylist::{Rule, SelectorMap};
|
use style::stylist::{Rule, SelectorMap};
|
||||||
use style::stylist::needs_revalidation;
|
use style::stylist::needs_revalidation;
|
||||||
|
|
|
@ -7,11 +7,11 @@ use euclid::size::TypedSize2D;
|
||||||
use media_queries::CSSErrorReporterTest;
|
use media_queries::CSSErrorReporterTest;
|
||||||
use servo_config::prefs::{PREFS, PrefValue};
|
use servo_config::prefs::{PREFS, PrefValue};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::sync::Arc;
|
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::media_queries::{Device, MediaList, MediaType};
|
use style::media_queries::{Device, MediaList, MediaType};
|
||||||
use style::parser::{LengthParsingMode, Parse, ParserContext};
|
use style::parser::{LengthParsingMode, Parse, ParserContext};
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
|
use style::stylearc::Arc;
|
||||||
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
||||||
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
||||||
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
|
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue