mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #10210 - perlun:rename-computedvalues-to-servocomputedvalues, r=SimonSapin
ComputedValues is now ServoComputedValues This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10210) <!-- Reviewable:end -->
This commit is contained in:
commit
639fdd6b12
28 changed files with 135 additions and 139 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::{ComputedValues, TComputedValues};
|
||||
use properties::{ServoComputedValues, TComputedValues};
|
||||
use std::cmp::Ordering;
|
||||
use std::iter::repeat;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
@ -69,8 +69,8 @@ impl PropertyAnimation {
|
|||
/// Any number of animations may be returned, from zero (if the property did not animate) to
|
||||
/// one (for a single transition property) to arbitrarily many (for `all`).
|
||||
pub fn from_transition(transition_index: usize,
|
||||
old_style: &ComputedValues,
|
||||
new_style: &mut ComputedValues)
|
||||
old_style: &ServoComputedValues,
|
||||
new_style: &mut ServoComputedValues)
|
||||
-> Vec<PropertyAnimation> {
|
||||
let mut result = Vec::new();
|
||||
let transition_property =
|
||||
|
@ -102,8 +102,8 @@ impl PropertyAnimation {
|
|||
|
||||
fn from_transition_property(transition_property: TransitionProperty,
|
||||
transition_index: usize,
|
||||
old_style: &ComputedValues,
|
||||
new_style: &mut ComputedValues)
|
||||
old_style: &ServoComputedValues,
|
||||
new_style: &mut ServoComputedValues)
|
||||
-> Option<PropertyAnimation> {
|
||||
let animation_style = new_style.get_animation();
|
||||
macro_rules! match_transition {
|
||||
|
@ -197,7 +197,7 @@ impl PropertyAnimation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update(&self, style: &mut ComputedValues, time: f64) {
|
||||
pub fn update(&self, style: &mut ServoComputedValues, time: f64) {
|
||||
let progress = match self.timing_function {
|
||||
TransitionTimingFunction::CubicBezier(p1, p2) => {
|
||||
// See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit.
|
||||
|
|
|
@ -139,7 +139,7 @@ pub mod longhands {
|
|||
use error_reporting::ParseErrorReporter;
|
||||
use properties::longhands;
|
||||
use properties::property_bit_field::PropertyBitField;
|
||||
use properties::{ComputedValues, PropertyDeclaration, TComputedValues};
|
||||
use properties::{ServoComputedValues, PropertyDeclaration, TComputedValues};
|
||||
use properties::style_struct_traits::T${THIS_STYLE_STRUCT.name};
|
||||
use properties::style_structs;
|
||||
use std::collections::HashMap;
|
||||
|
@ -6240,8 +6240,8 @@ pub trait TComputedValues : Clone + Send + Sync + 'static {
|
|||
// yet - panics for non-Servo implementations.
|
||||
//
|
||||
// Used only for animations. Don't use it in other places.
|
||||
fn as_servo<'a>(&'a self) -> &'a ComputedValues;
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ComputedValues;
|
||||
fn as_servo<'a>(&'a self) -> &'a ServoComputedValues;
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues;
|
||||
|
||||
fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
shareable: bool,
|
||||
|
@ -6270,7 +6270,7 @@ pub trait TComputedValues : Clone + Send + Sync + 'static {
|
|||
}
|
||||
|
||||
#[derive(Clone, HeapSizeOf)]
|
||||
pub struct ComputedValues {
|
||||
pub struct ServoComputedValues {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
|
||||
% endfor
|
||||
|
@ -6280,13 +6280,13 @@ pub struct ComputedValues {
|
|||
pub root_font_size: Au,
|
||||
}
|
||||
|
||||
impl TComputedValues for ComputedValues {
|
||||
impl TComputedValues for ServoComputedValues {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
type Concrete${style_struct.name} = style_structs::${style_struct.name};
|
||||
% endfor
|
||||
|
||||
fn as_servo<'a>(&'a self) -> &'a ComputedValues { self }
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ComputedValues { self }
|
||||
fn as_servo<'a>(&'a self) -> &'a ServoComputedValues { self }
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues { self }
|
||||
|
||||
fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
shareable: bool,
|
||||
|
@ -6296,7 +6296,7 @@ impl TComputedValues for ComputedValues {
|
|||
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
|
||||
% endfor
|
||||
) -> Self {
|
||||
ComputedValues {
|
||||
ServoComputedValues {
|
||||
custom_properties: custom_properties,
|
||||
shareable: shareable,
|
||||
writing_mode: writing_mode,
|
||||
|
@ -6345,7 +6345,7 @@ impl TComputedValues for ComputedValues {
|
|||
}
|
||||
}
|
||||
|
||||
impl ComputedValues {
|
||||
impl ServoComputedValues {
|
||||
/// Resolves the currentColor keyword.
|
||||
/// Any color value form computed values (except for the 'color' property itself)
|
||||
/// should go through this method.
|
||||
|
@ -6565,7 +6565,7 @@ pub fn get_writing_mode<S: style_struct_traits::TInheritedBox>(inheritedbox_styl
|
|||
|
||||
/// The initial values for all style structs as defined by the specification.
|
||||
lazy_static! {
|
||||
pub static ref INITIAL_SERVO_VALUES: ComputedValues = ComputedValues {
|
||||
pub static ref INITIAL_SERVO_VALUES: ServoComputedValues = ServoComputedValues {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
|
||||
% for longhand in style_struct.longhands:
|
||||
|
@ -6702,8 +6702,8 @@ pub type CascadePropertyFn<C: TComputedValues> =
|
|||
|
||||
// This is a thread-local rather than a lazy static to avoid atomic operations when cascading
|
||||
// properties.
|
||||
thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ComputedValues>>> = {
|
||||
let mut result: Vec<Option<CascadePropertyFn<ComputedValues>>> = Vec::new();
|
||||
thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ServoComputedValues>>> = {
|
||||
let mut result: Vec<Option<CascadePropertyFn<ServoComputedValues>>> = Vec::new();
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
% for property in style_struct.longhands:
|
||||
let discriminant;
|
||||
|
@ -6743,8 +6743,8 @@ pub fn cascade<C: TComputedValues>(
|
|||
viewport_size: Size2D<Au>,
|
||||
applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>],
|
||||
shareable: bool,
|
||||
parent_style: Option< &C >,
|
||||
cached_style: Option< &C >,
|
||||
parent_style: Option<<&C>,
|
||||
cached_style: Option<<&C>,
|
||||
mut error_reporter: Box<ParseErrorReporter + Send>)
|
||||
-> (C, bool) {
|
||||
use properties::style_struct_traits::{TBorder, TBox, TColor, TFont, TOutline};
|
||||
|
@ -6942,7 +6942,7 @@ pub fn cascade<C: TComputedValues>(
|
|||
///
|
||||
/// FIXME(#5625, pcwalton): It would probably be cleaner and faster to do this in the cascade.
|
||||
#[inline]
|
||||
pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
|
||||
pub fn modify_style_for_replaced_content(style: &mut Arc<ServoComputedValues>) {
|
||||
// Reset `position` to handle cases like `<div style="position: absolute">foo bar baz</div>`.
|
||||
if style.box_.display != longhands::display::computed_value::T::inline {
|
||||
let mut style = Arc::make_mut(style);
|
||||
|
@ -6978,10 +6978,10 @@ pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
|
|||
/// Specifically, this function sets border widths to zero on the sides for which the fragment is
|
||||
/// not outermost.
|
||||
#[inline]
|
||||
pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
||||
pub fn modify_border_style_for_inline_sides(style: &mut Arc<ServoComputedValues>,
|
||||
is_first_fragment_of_element: bool,
|
||||
is_last_fragment_of_element: bool) {
|
||||
fn modify_side(style: &mut Arc<ComputedValues>, side: PhysicalSide) {
|
||||
fn modify_side(style: &mut Arc<ServoComputedValues>, side: PhysicalSide) {
|
||||
let mut style = Arc::make_mut(style);
|
||||
let border = Arc::make_mut(&mut style.border);
|
||||
match side {
|
||||
|
@ -7018,7 +7018,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
|||
/// Adjusts the display and position properties as appropriate for an anonymous table object.
|
||||
#[inline]
|
||||
pub fn modify_style_for_anonymous_table_object(
|
||||
style: &mut Arc<ComputedValues>,
|
||||
style: &mut Arc<ServoComputedValues>,
|
||||
new_display_value: longhands::display::computed_value::T) {
|
||||
let mut style = Arc::make_mut(style);
|
||||
let box_style = Arc::make_mut(&mut style.box_);
|
||||
|
@ -7028,7 +7028,7 @@ pub fn modify_style_for_anonymous_table_object(
|
|||
|
||||
/// Adjusts the `position` property as necessary for the outer fragment wrapper of an inline-block.
|
||||
#[inline]
|
||||
pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValues>) {
|
||||
pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ServoComputedValues>) {
|
||||
let mut style = Arc::make_mut(style);
|
||||
let box_style = Arc::make_mut(&mut style.box_);
|
||||
box_style.position = longhands::position::computed_value::T::static_
|
||||
|
@ -7039,7 +7039,7 @@ pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValu
|
|||
/// Text is never directly relatively positioned; it's always contained within an element that is
|
||||
/// itself relatively positioned.
|
||||
#[inline]
|
||||
pub fn modify_style_for_text(style: &mut Arc<ComputedValues>) {
|
||||
pub fn modify_style_for_text(style: &mut Arc<ServoComputedValues>) {
|
||||
if style.box_.position == longhands::position::computed_value::T::relative {
|
||||
// We leave the `position` property set to `relative` so that we'll still establish a
|
||||
// containing block if needed. But we reset all position offsets to `auto`.
|
||||
|
@ -7074,7 +7074,7 @@ pub fn modify_style_for_text(style: &mut Arc<ComputedValues>) {
|
|||
///
|
||||
/// Margins apply to the `input` element itself, so including them in the text will cause them to
|
||||
/// be double-counted.
|
||||
pub fn modify_style_for_input_text(style: &mut Arc<ComputedValues>) {
|
||||
pub fn modify_style_for_input_text(style: &mut Arc<ServoComputedValues>) {
|
||||
let mut style = Arc::make_mut(style);
|
||||
let margin_style = Arc::make_mut(&mut style.margin);
|
||||
margin_style.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||
|
@ -7089,7 +7089,7 @@ pub fn modify_style_for_input_text(style: &mut Arc<ComputedValues>) {
|
|||
|
||||
/// Adjusts the `clip` property so that an inline absolute hypothetical fragment doesn't clip its
|
||||
/// children.
|
||||
pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc<ComputedValues>) {
|
||||
pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc<ServoComputedValues>) {
|
||||
if style.get_effects().clip.0.is_some() {
|
||||
let mut style = Arc::make_mut(style);
|
||||
let effects_style = Arc::make_mut(&mut style.effects);
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
use context;
|
||||
use data;
|
||||
use properties::ComputedValues;
|
||||
use properties::ServoComputedValues;
|
||||
use selector_impl::ServoSelectorImpl;
|
||||
use selector_matching;
|
||||
use stylesheets;
|
||||
|
||||
/// Concrete types for servo Style implementation
|
||||
pub type Stylesheet = stylesheets::Stylesheet<ServoSelectorImpl>;
|
||||
pub type PrivateStyleData = data::PrivateStyleData<ServoSelectorImpl, ComputedValues>;
|
||||
pub type PrivateStyleData = data::PrivateStyleData<ServoSelectorImpl, ServoComputedValues>;
|
||||
pub type Stylist = selector_matching::Stylist<ServoSelectorImpl>;
|
||||
pub type StylistWrapper = context::StylistWrapper<ServoSelectorImpl>;
|
||||
pub type SharedStyleContext = context::SharedStyleContext<ServoSelectorImpl>;
|
||||
|
|
|
@ -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::{ComputedValues, TComputedValues};
|
||||
use properties::{ServoComputedValues, TComputedValues};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::collections::hash_map::{Entry, HashMap};
|
||||
use std::fmt;
|
||||
|
@ -594,8 +594,8 @@ impl MaybeNew for ViewportConstraints {
|
|||
let context = Context {
|
||||
is_root_element: false,
|
||||
viewport_size: initial_viewport,
|
||||
inherited_style: ComputedValues::initial_values(),
|
||||
style: ComputedValues::initial_values().clone(),
|
||||
inherited_style: ServoComputedValues::initial_values(),
|
||||
style: ServoComputedValues::initial_values().clone(),
|
||||
};
|
||||
|
||||
// DEVICE-ADAPT § 9.3 Resolving 'extend-to-zoom'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue