mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Renamed TComputedValues to ComputedValues
This is a followup to #10210, and a continuation of #10185.
This commit is contained in:
parent
639fdd6b12
commit
4cb4cc93e4
34 changed files with 65 additions and 65 deletions
|
@ -25,7 +25,7 @@ use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
|
|||
use properties::longhands::visibility::computed_value::T as Visibility;
|
||||
use properties::longhands::z_index::computed_value::T as ZIndex;
|
||||
use properties::style_struct_traits::TAnimation;
|
||||
use properties::{ServoComputedValues, TComputedValues};
|
||||
use properties::{ComputedValues, ServoComputedValues};
|
||||
use std::cmp::Ordering;
|
||||
use std::iter::repeat;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
@ -930,11 +930,11 @@ impl<T> GetMod for Vec<T> {
|
|||
/// Inserts transitions into the queue of running animations as applicable for the given style
|
||||
/// difference. This is called from the layout worker threads. Returns true if any animations were
|
||||
/// kicked off and false otherwise.
|
||||
pub fn start_transitions_if_applicable<C: TComputedValues>(new_animations_sender: &Mutex<Sender<Animation>>,
|
||||
node: OpaqueNode,
|
||||
old_style: &C,
|
||||
new_style: &mut C)
|
||||
-> bool {
|
||||
pub fn start_transitions_if_applicable<C: ComputedValues>(new_animations_sender: &Mutex<Sender<Animation>>,
|
||||
node: OpaqueNode,
|
||||
old_style: &C,
|
||||
new_style: &mut C)
|
||||
-> bool {
|
||||
let mut had_animations = false;
|
||||
for i in 0..new_style.get_animation().transition_count() {
|
||||
// Create any property animations, if applicable.
|
||||
|
@ -965,7 +965,7 @@ pub fn start_transitions_if_applicable<C: TComputedValues>(new_animations_sender
|
|||
|
||||
/// Updates a single animation and associated style based on the current time. If `damage` is
|
||||
/// provided, inserts the appropriate restyle damage.
|
||||
pub fn update_style_for_animation<C: TComputedValues,
|
||||
pub fn update_style_for_animation<C: ComputedValues,
|
||||
Damage: TRestyleDamage<ConcreteComputedValues=C>>(animation: &Animation,
|
||||
style: &mut Arc<C>,
|
||||
damage: Option<&mut Damage>) {
|
||||
|
|
|
@ -8,7 +8,7 @@ use dom::OpaqueNode;
|
|||
use error_reporting::ParseErrorReporter;
|
||||
use euclid::Size2D;
|
||||
use matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
|
||||
use properties::TComputedValues;
|
||||
use properties::ComputedValues;
|
||||
use selector_impl::SelectorImplExt;
|
||||
use selector_matching::Stylist;
|
||||
use std::cell::RefCell;
|
||||
|
@ -55,12 +55,12 @@ pub struct SharedStyleContext<Impl: SelectorImplExt> {
|
|||
pub error_reporter: Box<ParseErrorReporter + Sync>,
|
||||
}
|
||||
|
||||
pub struct LocalStyleContext<C: TComputedValues> {
|
||||
pub struct LocalStyleContext<C: ComputedValues> {
|
||||
pub applicable_declarations_cache: RefCell<ApplicableDeclarationsCache<C>>,
|
||||
pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache<C>>,
|
||||
}
|
||||
|
||||
pub trait StyleContext<'a, Impl: SelectorImplExt, C: TComputedValues> {
|
||||
pub trait StyleContext<'a, Impl: SelectorImplExt, C: ComputedValues> {
|
||||
|
||||
fn shared_context(&self) -> &'a SharedStyleContext<Impl>;
|
||||
fn local_context(&self) -> &LocalStyleContext<C>;
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
* 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/. */
|
||||
|
||||
use properties::TComputedValues;
|
||||
use properties::ComputedValues;
|
||||
use selectors::parser::SelectorImpl;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
|
||||
pub struct PrivateStyleData<Impl: SelectorImpl, ConcreteComputedValues: TComputedValues> {
|
||||
pub struct PrivateStyleData<Impl: SelectorImpl, ConcreteComputedValues: ComputedValues> {
|
||||
/// The results of CSS styling for this node.
|
||||
pub style: Option<Arc<ConcreteComputedValues>>,
|
||||
|
||||
|
@ -22,7 +22,7 @@ pub struct PrivateStyleData<Impl: SelectorImpl, ConcreteComputedValues: TCompute
|
|||
}
|
||||
|
||||
impl<Impl, ConcreteComputedValues> PrivateStyleData<Impl, ConcreteComputedValues>
|
||||
where Impl: SelectorImpl, ConcreteComputedValues: TComputedValues {
|
||||
where Impl: SelectorImpl, ConcreteComputedValues: ComputedValues {
|
||||
pub fn new() -> PrivateStyleData<Impl, ConcreteComputedValues> {
|
||||
PrivateStyleData {
|
||||
style: None,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use data::PrivateStyleData;
|
||||
use element_state::ElementState;
|
||||
use properties::{PropertyDeclaration, PropertyDeclarationBlock, TComputedValues};
|
||||
use properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
||||
use selector_impl::ElementExt;
|
||||
use selectors::Element;
|
||||
|
@ -42,7 +42,7 @@ impl OpaqueNode {
|
|||
}
|
||||
|
||||
pub trait TRestyleDamage : BitOr<Output=Self> + Copy {
|
||||
type ConcreteComputedValues: TComputedValues;
|
||||
type ConcreteComputedValues: ComputedValues;
|
||||
fn compute(old: Option<&Arc<Self::ConcreteComputedValues>>, new: &Self::ConcreteComputedValues) -> Self;
|
||||
fn rebuild_and_reflow() -> Self;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ pub trait TNode : Sized + Copy + Clone {
|
|||
type ConcreteElement: TElement<ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
||||
type ConcreteRestyleDamage: TRestyleDamage<ConcreteComputedValues = Self::ConcreteComputedValues>;
|
||||
type ConcreteComputedValues: TComputedValues;
|
||||
type ConcreteComputedValues: ComputedValues;
|
||||
|
||||
fn to_unsafe(&self) -> UnsafeNode;
|
||||
unsafe fn from_unsafe(n: &UnsafeNode) -> Self;
|
||||
|
|
|
@ -8,7 +8,7 @@ use animation::{self, Animation};
|
|||
use context::SharedStyleContext;
|
||||
use data::PrivateStyleData;
|
||||
use dom::{TElement, TNode, TRestyleDamage};
|
||||
use properties::{PropertyDeclaration, TComputedValues, cascade};
|
||||
use properties::{ComputedValues, PropertyDeclaration, cascade};
|
||||
use selector_impl::{ElementExt, SelectorImplExt};
|
||||
use selector_matching::{DeclarationBlock, Stylist};
|
||||
use selectors::Element;
|
||||
|
@ -151,11 +151,11 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
|
|||
|
||||
static APPLICABLE_DECLARATIONS_CACHE_SIZE: usize = 32;
|
||||
|
||||
pub struct ApplicableDeclarationsCache<C: TComputedValues> {
|
||||
pub struct ApplicableDeclarationsCache<C: ComputedValues> {
|
||||
cache: SimpleHashCache<ApplicableDeclarationsCacheEntry, Arc<C>>,
|
||||
}
|
||||
|
||||
impl<C: TComputedValues> ApplicableDeclarationsCache<C> {
|
||||
impl<C: ComputedValues> ApplicableDeclarationsCache<C> {
|
||||
pub fn new() -> Self {
|
||||
ApplicableDeclarationsCache {
|
||||
cache: SimpleHashCache::new(APPLICABLE_DECLARATIONS_CACHE_SIZE),
|
||||
|
@ -179,12 +179,12 @@ impl<C: TComputedValues> ApplicableDeclarationsCache<C> {
|
|||
}
|
||||
|
||||
/// An LRU cache of the last few nodes seen, so that we can aggressively try to reuse their styles.
|
||||
pub struct StyleSharingCandidateCache<C: TComputedValues> {
|
||||
pub struct StyleSharingCandidateCache<C: ComputedValues> {
|
||||
cache: LRUCache<StyleSharingCandidate<C>, ()>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StyleSharingCandidate<C: TComputedValues> {
|
||||
pub struct StyleSharingCandidate<C: ComputedValues> {
|
||||
pub style: Arc<C>,
|
||||
pub parent_style: Arc<C>,
|
||||
pub local_name: Atom,
|
||||
|
@ -195,7 +195,7 @@ pub struct StyleSharingCandidate<C: TComputedValues> {
|
|||
pub link: bool,
|
||||
}
|
||||
|
||||
impl<C: TComputedValues> PartialEq for StyleSharingCandidate<C> {
|
||||
impl<C: ComputedValues> PartialEq for StyleSharingCandidate<C> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
arc_ptr_eq(&self.style, &other.style) &&
|
||||
arc_ptr_eq(&self.parent_style, &other.parent_style) &&
|
||||
|
@ -207,7 +207,7 @@ impl<C: TComputedValues> PartialEq for StyleSharingCandidate<C> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<C: TComputedValues> StyleSharingCandidate<C> {
|
||||
impl<C: ComputedValues> StyleSharingCandidate<C> {
|
||||
/// Attempts to create a style sharing candidate from this node. Returns
|
||||
/// the style sharing candidate or `None` if this node is ineligible for
|
||||
/// style sharing.
|
||||
|
@ -332,7 +332,7 @@ impl<C: TComputedValues> StyleSharingCandidate<C> {
|
|||
|
||||
static STYLE_SHARING_CANDIDATE_CACHE_SIZE: usize = 40;
|
||||
|
||||
impl<C: TComputedValues> StyleSharingCandidateCache<C> {
|
||||
impl<C: ComputedValues> StyleSharingCandidateCache<C> {
|
||||
pub fn new() -> Self {
|
||||
StyleSharingCandidateCache {
|
||||
cache: LRUCache::new(STYLE_SHARING_CANDIDATE_CACHE_SIZE),
|
||||
|
|
|
@ -139,7 +139,7 @@ pub mod longhands {
|
|||
use error_reporting::ParseErrorReporter;
|
||||
use properties::longhands;
|
||||
use properties::property_bit_field::PropertyBitField;
|
||||
use properties::{ServoComputedValues, PropertyDeclaration, TComputedValues};
|
||||
use properties::{ComputedValues, ServoComputedValues, PropertyDeclaration};
|
||||
use properties::style_struct_traits::T${THIS_STYLE_STRUCT.name};
|
||||
use properties::style_structs;
|
||||
use std::collections::HashMap;
|
||||
|
@ -149,7 +149,7 @@ pub mod longhands {
|
|||
use string_cache::Atom;
|
||||
${caller.body()}
|
||||
#[allow(unused_variables)]
|
||||
pub fn cascade_property<C: TComputedValues>(
|
||||
pub fn cascade_property<C: ComputedValues>(
|
||||
declaration: &PropertyDeclaration,
|
||||
inherited_style: &C,
|
||||
context: &mut computed::Context<C>,
|
||||
|
@ -505,7 +505,7 @@ pub mod longhands {
|
|||
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
|
||||
fn cascade_property_custom<C: TComputedValues>(
|
||||
fn cascade_property_custom<C: ComputedValues>(
|
||||
_declaration: &PropertyDeclaration,
|
||||
_inherited_style: &C,
|
||||
context: &mut computed::Context<C>,
|
||||
|
@ -2200,7 +2200,7 @@ pub mod longhands {
|
|||
if !empty { Ok(result) } else { Err(()) }
|
||||
}
|
||||
|
||||
fn cascade_property_custom<C: TComputedValues>(
|
||||
fn cascade_property_custom<C: ComputedValues>(
|
||||
_declaration: &PropertyDeclaration,
|
||||
_inherited_style: &C,
|
||||
context: &mut computed::Context<C>,
|
||||
|
@ -6231,7 +6231,7 @@ pub mod style_structs {
|
|||
% endfor
|
||||
}
|
||||
|
||||
pub trait TComputedValues : Clone + Send + Sync + 'static {
|
||||
pub trait ComputedValues : Clone + Send + Sync + 'static {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
type Concrete${style_struct.name}: style_struct_traits::T${style_struct.name};
|
||||
% endfor
|
||||
|
@ -6280,7 +6280,7 @@ pub struct ServoComputedValues {
|
|||
pub root_font_size: Au,
|
||||
}
|
||||
|
||||
impl TComputedValues for ServoComputedValues {
|
||||
impl ComputedValues for ServoComputedValues {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
type Concrete${style_struct.name} = style_structs::${style_struct.name};
|
||||
% endfor
|
||||
|
@ -6586,7 +6586,7 @@ lazy_static! {
|
|||
|
||||
/// Fast path for the function below. Only computes new inherited styles.
|
||||
#[allow(unused_mut, unused_imports)]
|
||||
fn cascade_with_cached_declarations<C: TComputedValues>(
|
||||
fn cascade_with_cached_declarations<C: ComputedValues>(
|
||||
viewport_size: Size2D<Au>,
|
||||
applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>],
|
||||
shareable: bool,
|
||||
|
@ -6692,7 +6692,7 @@ fn cascade_with_cached_declarations<C: TComputedValues>(
|
|||
context.style
|
||||
}
|
||||
|
||||
pub type CascadePropertyFn<C: TComputedValues> =
|
||||
pub type CascadePropertyFn<C: ComputedValues> =
|
||||
extern "Rust" fn(declaration: &PropertyDeclaration,
|
||||
inherited_style: &C,
|
||||
context: &mut computed::Context<C>,
|
||||
|
@ -6739,7 +6739,7 @@ thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ServoCompute
|
|||
/// this is ignored.
|
||||
///
|
||||
/// Returns the computed values and a boolean indicating whether the result is cacheable.
|
||||
pub fn cascade<C: TComputedValues>(
|
||||
pub fn cascade<C: ComputedValues>(
|
||||
viewport_size: Size2D<Au>,
|
||||
applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>],
|
||||
shareable: bool,
|
||||
|
|
|
@ -1436,7 +1436,7 @@ pub mod specified {
|
|||
pub mod computed {
|
||||
use app_units::Au;
|
||||
use euclid::size::Size2D;
|
||||
use properties::TComputedValues;
|
||||
use properties::ComputedValues;
|
||||
use properties::style_struct_traits::TFont;
|
||||
use std::fmt;
|
||||
use super::AuExtensionMethods;
|
||||
|
@ -1447,7 +1447,7 @@ pub mod computed {
|
|||
pub use super::specified::{Angle, BorderStyle, Time};
|
||||
|
||||
pub trait TContext {
|
||||
type ConcreteComputedValues: TComputedValues;
|
||||
type ConcreteComputedValues: ComputedValues;
|
||||
fn is_root_element(&self) -> bool;
|
||||
fn viewport_size(&self) -> Size2D<Au>;
|
||||
fn inherited_style(&self) -> &Self::ConcreteComputedValues;
|
||||
|
@ -1455,7 +1455,7 @@ pub mod computed {
|
|||
fn mutate_style(&mut self) -> &mut Self::ConcreteComputedValues;
|
||||
}
|
||||
|
||||
pub struct Context<'a, C: TComputedValues> {
|
||||
pub struct Context<'a, C: ComputedValues> {
|
||||
pub is_root_element: bool,
|
||||
pub viewport_size: Size2D<Au>,
|
||||
pub inherited_style: &'a C,
|
||||
|
@ -1465,7 +1465,7 @@ pub mod computed {
|
|||
pub style: C,
|
||||
}
|
||||
|
||||
impl<'a, C: TComputedValues> TContext for Context<'a, C> {
|
||||
impl<'a, C: ComputedValues> TContext for Context<'a, C> {
|
||||
type ConcreteComputedValues = C;
|
||||
fn is_root_element(&self) -> bool { self.is_root_element }
|
||||
fn viewport_size(&self) -> Size2D<Au> { self.viewport_size }
|
||||
|
|
|
@ -8,7 +8,7 @@ use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser,
|
|||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use parser::{ParserContext, log_css_error};
|
||||
use properties::{ServoComputedValues, TComputedValues};
|
||||
use properties::{ComputedValues, ServoComputedValues};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::collections::hash_map::{Entry, HashMap};
|
||||
use std::fmt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue