mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Rustfmt has changed its default style :/
This commit is contained in:
parent
82fc6d9f49
commit
be69f9c3e6
207 changed files with 1200 additions and 1339 deletions
|
@ -8,7 +8,6 @@
|
|||
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use crate::gecko::values::GeckoStyleCoordConvertible;
|
||||
use crate::gecko_bindings::bindings;
|
||||
use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||
|
@ -27,6 +26,7 @@ use crate::values::generics::box_::VerticalAlign;
|
|||
use crate::values::generics::grid::{TrackListValue, TrackSize};
|
||||
use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
|
||||
use crate::values::generics::rect::Rect;
|
||||
use app_units::Au;
|
||||
use std::f32::consts::PI;
|
||||
|
||||
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Data needed to style a Gecko document.
|
||||
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use crate::context::QuirksMode;
|
||||
use crate::dom::TElement;
|
||||
use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
|
||||
|
@ -19,6 +18,7 @@ use crate::selector_parser::SnapshotMap;
|
|||
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use crate::stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
|
||||
use crate::stylist::Stylist;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Gecko's media feature list and evaluator.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::gecko_bindings::bindings;
|
||||
use crate::gecko_bindings::structs;
|
||||
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||
|
@ -14,6 +13,7 @@ use crate::media_queries::Device;
|
|||
use crate::values::computed::CSSPixelLength;
|
||||
use crate::values::computed::Resolution;
|
||||
use crate::Atom;
|
||||
use app_units::Au;
|
||||
use euclid::Size2D;
|
||||
|
||||
fn viewport_size(device: &Device) -> Size2D<Au> {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
//! Gecko's media-query device and expression representation.
|
||||
|
||||
use app_units::Au;
|
||||
use app_units::AU_PER_PX;
|
||||
use crate::custom_properties::CssEnvironment;
|
||||
use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
|
||||
use crate::gecko_bindings::bindings;
|
||||
|
@ -16,6 +14,8 @@ use crate::properties::ComputedValues;
|
|||
use crate::string_cache::Atom;
|
||||
use crate::values::computed::font::FontSize;
|
||||
use crate::values::{CustomIdent, KeyframesName};
|
||||
use app_units::Au;
|
||||
use app_units::AU_PER_PX;
|
||||
use cssparser::RGBA;
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
|
|
|
@ -230,33 +230,34 @@ impl NonTSPseudoClass {
|
|||
/// Returns true if the given pseudoclass should trigger style sharing cache
|
||||
/// revalidation.
|
||||
pub fn needs_cache_revalidation(&self) -> bool {
|
||||
self.state_flag().is_empty() && !matches!(*self,
|
||||
// :-moz-any is handled by the revalidation visitor walking
|
||||
// the things inside it; it does not need to cause
|
||||
// revalidation on its own.
|
||||
NonTSPseudoClass::MozAny(_) |
|
||||
// :dir() depends on state only, but doesn't use state_flag
|
||||
// because its semantics don't quite match. Nevertheless, it
|
||||
// doesn't need cache revalidation, because we already compare
|
||||
// states for elements and candidates.
|
||||
NonTSPseudoClass::Dir(_) |
|
||||
// :-moz-is-html only depends on the state of the document and
|
||||
// the namespace of the element; the former is invariant
|
||||
// across all the elements involved and the latter is already
|
||||
// checked for by our caching precondtions.
|
||||
NonTSPseudoClass::MozIsHTML |
|
||||
// :-moz-placeholder is parsed but never matches.
|
||||
NonTSPseudoClass::MozPlaceholder |
|
||||
// :-moz-locale-dir and :-moz-window-inactive depend only on
|
||||
// the state of the document, which is invariant across all
|
||||
// the elements involved in a given style cache.
|
||||
NonTSPseudoClass::MozLocaleDir(_) |
|
||||
NonTSPseudoClass::MozWindowInactive |
|
||||
// Similar for the document themes.
|
||||
NonTSPseudoClass::MozLWTheme |
|
||||
NonTSPseudoClass::MozLWThemeBrightText |
|
||||
NonTSPseudoClass::MozLWThemeDarkText
|
||||
)
|
||||
self.state_flag().is_empty() &&
|
||||
!matches!(*self,
|
||||
// :-moz-any is handled by the revalidation visitor walking
|
||||
// the things inside it; it does not need to cause
|
||||
// revalidation on its own.
|
||||
NonTSPseudoClass::MozAny(_) |
|
||||
// :dir() depends on state only, but doesn't use state_flag
|
||||
// because its semantics don't quite match. Nevertheless, it
|
||||
// doesn't need cache revalidation, because we already compare
|
||||
// states for elements and candidates.
|
||||
NonTSPseudoClass::Dir(_) |
|
||||
// :-moz-is-html only depends on the state of the document and
|
||||
// the namespace of the element; the former is invariant
|
||||
// across all the elements involved and the latter is already
|
||||
// checked for by our caching precondtions.
|
||||
NonTSPseudoClass::MozIsHTML |
|
||||
// :-moz-placeholder is parsed but never matches.
|
||||
NonTSPseudoClass::MozPlaceholder |
|
||||
// :-moz-locale-dir and :-moz-window-inactive depend only on
|
||||
// the state of the document, which is invariant across all
|
||||
// the elements involved in a given style cache.
|
||||
NonTSPseudoClass::MozLocaleDir(_) |
|
||||
NonTSPseudoClass::MozWindowInactive |
|
||||
// Similar for the document themes.
|
||||
NonTSPseudoClass::MozLWTheme |
|
||||
NonTSPseudoClass::MozLWThemeBrightText |
|
||||
NonTSPseudoClass::MozLWThemeDarkText
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns true if the evaluation of the pseudo-class depends on the
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
//! Different kind of helpers to interact with Gecko values.
|
||||
|
||||
use app_units::Au;
|
||||
use crate::counter_style::{Symbol, Symbols};
|
||||
use crate::gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
|
||||
use crate::gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
|
||||
|
@ -29,6 +28,7 @@ use crate::values::generics::length::{MaxLength, MozLength};
|
|||
use crate::values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use crate::values::{Auto, Either, None_, Normal};
|
||||
use crate::Atom;
|
||||
use app_units::Au;
|
||||
use cssparser::RGBA;
|
||||
use nsstring::{nsACString, nsCStr};
|
||||
use std::cmp::max;
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
//! style system it's kind of pointless in the Stylo case, and only Servo forces
|
||||
//! the separation between the style system implementation and everything else.
|
||||
|
||||
use app_units::Au;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use crate::applicable_declarations::ApplicableDeclarationBlock;
|
||||
use crate::author_styles::AuthorStyles;
|
||||
use crate::context::{PostAnimationTasks, QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
||||
|
@ -72,6 +70,8 @@ use crate::shared_lock::Locked;
|
|||
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use crate::stylist::CascadeData;
|
||||
use crate::CaseSensitivityExt;
|
||||
use app_units::Au;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
|
@ -931,13 +931,14 @@ impl<'le> GeckoElement<'le> {
|
|||
|
||||
debug_assert_eq!(to.is_some(), from.is_some());
|
||||
|
||||
combined_duration > 0.0f32 && from != to && from
|
||||
.unwrap()
|
||||
.animate(
|
||||
to.as_ref().unwrap(),
|
||||
Procedure::Interpolate { progress: 0.5 },
|
||||
)
|
||||
.is_ok()
|
||||
combined_duration > 0.0f32 &&
|
||||
from != to &&
|
||||
from.unwrap()
|
||||
.animate(
|
||||
to.as_ref().unwrap(),
|
||||
Procedure::Interpolate { progress: 0.5 },
|
||||
)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1241,10 +1242,11 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn owner_doc_matches_for_testing(&self, device: &Device) -> bool {
|
||||
self.as_node().owner_doc().0 as *const structs::nsIDocument == device
|
||||
.pres_context()
|
||||
.mDocument
|
||||
.raw::<structs::nsIDocument>()
|
||||
self.as_node().owner_doc().0 as *const structs::nsIDocument ==
|
||||
device
|
||||
.pres_context()
|
||||
.mDocument
|
||||
.raw::<structs::nsIDocument>()
|
||||
}
|
||||
|
||||
fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
|
||||
|
@ -1864,9 +1866,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
.intersects(NonTSPseudoClass::Active.state_flag());
|
||||
if active {
|
||||
let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
|
||||
let declarations: Option<
|
||||
&RawOffsetArc<Locked<PropertyDeclarationBlock>>,
|
||||
> = declarations.and_then(|s| s.as_arc_opt());
|
||||
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
|
||||
declarations.and_then(|s| s.as_arc_opt());
|
||||
if let Some(decl) = declarations {
|
||||
hints.push(ApplicableDeclarationBlock::from_declarations(
|
||||
decl.clone_arc(),
|
||||
|
@ -2081,11 +2082,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
return false;
|
||||
}
|
||||
|
||||
debug_assert!(
|
||||
self.as_node()
|
||||
.parent_node()
|
||||
.map_or(false, |p| p.is_document())
|
||||
);
|
||||
debug_assert!(self
|
||||
.as_node()
|
||||
.parent_node()
|
||||
.map_or(false, |p| p.is_document()));
|
||||
unsafe { bindings::Gecko_IsRootElement(self.0) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue