mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
style: Miscellaneous servo build fixes.
This commit is contained in:
parent
eff8f0fca0
commit
332aec212c
14 changed files with 52 additions and 35 deletions
|
@ -196,7 +196,7 @@ pub struct InvalidationMap {
|
|||
/// A list of document state dependencies in the rules we represent.
|
||||
pub document_state_selectors: Vec<DocumentStateDependency>,
|
||||
/// A map of other attribute affecting selectors.
|
||||
pub other_attribute_affecting_selectors: PrecomputedHashMap<Atom, SmallVec<[Dependency; 1]>>,
|
||||
pub other_attribute_affecting_selectors: PrecomputedHashMap<LocalName, SmallVec<[Dependency; 1]>>,
|
||||
}
|
||||
|
||||
impl InvalidationMap {
|
||||
|
@ -461,7 +461,6 @@ impl<'a> SelectorVisitor for SelectorDependencyCollector<'a> {
|
|||
}
|
||||
|
||||
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::selector_parser::NonTSPseudoClass;
|
||||
|
||||
match *s {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#![allow(unsafe_code)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use crate::animation::AnimationState;
|
||||
use crate::computed_value_flags::ComputedValueFlags;
|
||||
use crate::context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap};
|
||||
use crate::context::{SharedStyleContext, StyleContext};
|
||||
|
@ -438,6 +437,8 @@ trait PrivateMatchMethods: TElement {
|
|||
_restyle_hint: RestyleHint,
|
||||
_important_rules_changed: bool,
|
||||
) {
|
||||
use crate::animation::AnimationState;
|
||||
|
||||
let this_opaque = self.as_node().opaque();
|
||||
let shared_context = context.shared;
|
||||
let mut animation_states = shared_context.animation_states.write();
|
||||
|
|
|
@ -68,8 +68,7 @@ pub type AnimationValueMap = FxHashMap<LonghandId, AnimationValue>;
|
|||
///
|
||||
/// FIXME: We need to add a path for custom properties, but that's trivial after
|
||||
/// this (is a similar path to that of PropertyDeclaration).
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
#[repr(u16)]
|
||||
pub enum AnimationValue {
|
||||
% for prop in data.longhands:
|
||||
|
@ -420,6 +419,7 @@ impl AnimationValue {
|
|||
///
|
||||
/// SERVO ONLY: This doesn't properly handle things like updating 'em' units
|
||||
/// when animated font-size.
|
||||
#[cfg(feature = "servo")]
|
||||
pub fn set_in_style_for_servo(&self, style: &mut ComputedValues) {
|
||||
match self {
|
||||
% for prop in data.longhands:
|
||||
|
@ -439,6 +439,11 @@ impl AnimationValue {
|
|||
% endfor
|
||||
}
|
||||
}
|
||||
|
||||
/// As above, but a stub for Gecko.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn set_in_style_for_servo(&self, _: &mut ComputedValues) {
|
||||
}
|
||||
}
|
||||
|
||||
fn animate_discrete<T: Clone>(this: &T, other: &T, procedure: Procedure) -> Result<T, ()> {
|
||||
|
|
|
@ -278,9 +278,12 @@ impl SelectorMap<Rule> {
|
|||
}
|
||||
|
||||
impl<T: SelectorMapEntry> SelectorMap<T> {
|
||||
/// Inserts into the correct hash, trying id, class, localname and
|
||||
/// namespace.
|
||||
pub fn insert(&mut self, entry: T, quirks_mode: QuirksMode) -> Result<(), FailedAllocationError> {
|
||||
/// Inserts an entry into the correct bucket(s).
|
||||
pub fn insert(
|
||||
&mut self,
|
||||
entry: T,
|
||||
quirks_mode: QuirksMode,
|
||||
) -> Result<(), FailedAllocationError> {
|
||||
self.count += 1;
|
||||
|
||||
// NOTE(emilio): It'd be nice for this to be a separate function, but
|
||||
|
|
|
@ -615,15 +615,14 @@ impl DerefMut for SnapshotMap {
|
|||
}
|
||||
|
||||
/// Servo's version of an element snapshot.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(Debug, Default, MallocSizeOf)]
|
||||
pub struct ServoElementSnapshot {
|
||||
/// The stored state of the element.
|
||||
pub state: Option<ElementState>,
|
||||
/// The set of stored attributes and its values.
|
||||
pub attrs: Option<Vec<(AttrIdentifier, AttrValue)>>,
|
||||
/// Whether this element is an HTML element in an HTML document.
|
||||
pub is_html_element_in_html_document: bool,
|
||||
/// The set of changed attributes and its values.
|
||||
pub changed_attrs: Vec<LocalName>,
|
||||
/// Whether the class attribute changed or not.
|
||||
pub class_changed: bool,
|
||||
/// Whether the id attribute changed or not.
|
||||
|
@ -634,15 +633,8 @@ pub struct ServoElementSnapshot {
|
|||
|
||||
impl ServoElementSnapshot {
|
||||
/// Create an empty element snapshot.
|
||||
pub fn new(is_html_element_in_html_document: bool) -> Self {
|
||||
ServoElementSnapshot {
|
||||
state: None,
|
||||
attrs: None,
|
||||
is_html_element_in_html_document: is_html_element_in_html_document,
|
||||
class_changed: false,
|
||||
id_changed: false,
|
||||
other_attributes_changed: false,
|
||||
}
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Returns whether the id attribute changed or not.
|
||||
|
@ -669,6 +661,17 @@ impl ServoElementSnapshot {
|
|||
.map(|&(_, ref v)| v)
|
||||
}
|
||||
|
||||
/// Executes the callback once for each attribute that changed.
|
||||
#[inline]
|
||||
pub fn each_attr_changed<F>(&self, mut callback: F)
|
||||
where
|
||||
F: FnMut(&LocalName),
|
||||
{
|
||||
for name in &self.changed_attrs {
|
||||
callback(name)
|
||||
}
|
||||
}
|
||||
|
||||
fn any_attr_ignore_ns<F>(&self, name: &LocalName, mut f: F) -> bool
|
||||
where
|
||||
F: FnMut(&AttrValue) -> bool,
|
||||
|
|
|
@ -15,7 +15,6 @@ use std::cell::UnsafeCell;
|
|||
use std::fmt;
|
||||
#[cfg(feature = "servo")]
|
||||
use std::mem;
|
||||
use std::mem::ManuallyDrop;
|
||||
#[cfg(feature = "gecko")]
|
||||
use std::ptr;
|
||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||
|
|
|
@ -12,8 +12,7 @@ use crate::values::generics::color::{Color as GenericColor, ComplexColorRatios};
|
|||
///
|
||||
/// Unlike in computed values, each component value may exceed the
|
||||
/// range `[0.0, 1.0]`.
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedZero)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedZero)]
|
||||
pub struct RGBA {
|
||||
/// The red component.
|
||||
pub red: f32,
|
||||
|
|
|
@ -35,7 +35,7 @@ pub use super::specified::{AlignSelf, JustifySelf};
|
|||
/// sucks :(.
|
||||
///
|
||||
/// See the discussion in https://bugzil.la/1384542.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[repr(C)]
|
||||
pub struct ComputedJustifyItems {
|
||||
/// The specified value for the property. Can contain the bare `legacy`
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
//! Generic types for CSS values related to flexbox.
|
||||
|
||||
/// A generic value for the `flex-basis` property.
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(
|
||||
Animate,
|
||||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
|
|
|
@ -174,13 +174,13 @@ impl<LengthPercentage> Size<LengthPercentage> {
|
|||
|
||||
/// A generic value for the `max-width` or `max-height` property.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
#[derive(
|
||||
Animate,
|
||||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedValue,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue