зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1643201 - Rustfmt recent changes.
Depends on D78203 Differential Revision: https://phabricator.services.mozilla.com/D78204
This commit is contained in:
Родитель
0cf71dd3a3
Коммит
a58560613e
|
@ -144,9 +144,7 @@ impl SelectorParsingState {
|
|||
|
||||
#[inline]
|
||||
fn allows_non_functional_pseudo_classes(self) -> bool {
|
||||
!self.intersects(
|
||||
Self::AFTER_SLOTTED | Self::AFTER_NON_STATEFUL_PSEUDO_ELEMENT,
|
||||
)
|
||||
!self.intersects(Self::AFTER_SLOTTED | Self::AFTER_NON_STATEFUL_PSEUDO_ELEMENT)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -354,10 +352,9 @@ impl<Impl: SelectorImpl> SelectorList<Impl> {
|
|||
{
|
||||
let mut values = SmallVec::new();
|
||||
loop {
|
||||
values.push(
|
||||
input
|
||||
.parse_until_before(Delimiter::Comma, |input| parse_selector(parser, input, state))?,
|
||||
);
|
||||
values.push(input.parse_until_before(Delimiter::Comma, |input| {
|
||||
parse_selector(parser, input, state)
|
||||
})?);
|
||||
match input.next() {
|
||||
Err(_) => return Ok(SelectorList(values)),
|
||||
Ok(&Token::Comma) => continue,
|
||||
|
@ -382,7 +379,11 @@ where
|
|||
P: Parser<'i, Impl = Impl>,
|
||||
Impl: SelectorImpl,
|
||||
{
|
||||
parse_selector(parser, input, state | SelectorParsingState::DISALLOW_PSEUDOS | SelectorParsingState::DISALLOW_COMBINATORS)
|
||||
parse_selector(
|
||||
parser,
|
||||
input,
|
||||
state | SelectorParsingState::DISALLOW_PSEUDOS | SelectorParsingState::DISALLOW_COMBINATORS,
|
||||
)
|
||||
}
|
||||
|
||||
/// Parse a comma separated list of compound selectors.
|
||||
|
@ -395,7 +396,9 @@ where
|
|||
Impl: SelectorImpl,
|
||||
{
|
||||
input
|
||||
.parse_comma_separated(|input| parse_inner_compound_selector(parser, input, SelectorParsingState::empty()))
|
||||
.parse_comma_separated(|input| {
|
||||
parse_inner_compound_selector(parser, input, SelectorParsingState::empty())
|
||||
})
|
||||
.map(|selectors| selectors.into_boxed_slice())
|
||||
}
|
||||
|
||||
|
@ -450,9 +453,7 @@ where
|
|||
},
|
||||
// In quirks mode, class and id selectors should match
|
||||
// case-insensitively, so just avoid inserting them into the filter.
|
||||
Component::ID(ref id) if quirks_mode != QuirksMode::Quirks => {
|
||||
id.precomputed_hash()
|
||||
},
|
||||
Component::ID(ref id) if quirks_mode != QuirksMode::Quirks => id.precomputed_hash(),
|
||||
Component::Class(ref class) if quirks_mode != QuirksMode::Quirks => {
|
||||
class.precomputed_hash()
|
||||
},
|
||||
|
@ -466,7 +467,7 @@ where
|
|||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
},
|
||||
_ => continue,
|
||||
};
|
||||
|
||||
|
@ -1086,11 +1087,14 @@ impl<Impl: SelectorImpl> Component<Impl> {
|
|||
pub fn maybe_allowed_after_pseudo_element(&self) -> bool {
|
||||
match *self {
|
||||
Component::NonTSPseudoClass(..) => true,
|
||||
Component::Negation(ref components) => components.iter().all(|c| c.maybe_allowed_after_pseudo_element()),
|
||||
Component::Is(ref selectors) |
|
||||
Component::Where(ref selectors) => {
|
||||
Component::Negation(ref components) => components
|
||||
.iter()
|
||||
.all(|c| c.maybe_allowed_after_pseudo_element()),
|
||||
Component::Is(ref selectors) | Component::Where(ref selectors) => {
|
||||
selectors.iter().all(|selector| {
|
||||
selector.iter_raw_match_order().all(|c| c.maybe_allowed_after_pseudo_element())
|
||||
selector
|
||||
.iter_raw_match_order()
|
||||
.all(|c| c.maybe_allowed_after_pseudo_element())
|
||||
})
|
||||
},
|
||||
_ => false,
|
||||
|
@ -1110,12 +1114,14 @@ impl<Impl: SelectorImpl> Component<Impl> {
|
|||
*self
|
||||
);
|
||||
match *self {
|
||||
Component::Negation(ref components) => {
|
||||
!components.iter().all(|c| c.matches_for_stateless_pseudo_element())
|
||||
},
|
||||
Component::Negation(ref components) => !components
|
||||
.iter()
|
||||
.all(|c| c.matches_for_stateless_pseudo_element()),
|
||||
Component::Is(ref selectors) | Component::Where(ref selectors) => {
|
||||
selectors.iter().any(|selector| {
|
||||
selector.iter_raw_match_order().all(|c| c.matches_for_stateless_pseudo_element())
|
||||
selector
|
||||
.iter_raw_match_order()
|
||||
.all(|c| c.matches_for_stateless_pseudo_element())
|
||||
})
|
||||
},
|
||||
_ => false,
|
||||
|
@ -2254,7 +2260,11 @@ where
|
|||
// Pseudo-elements cannot be represented by the matches-any
|
||||
// pseudo-class; they are not valid within :is().
|
||||
//
|
||||
let inner = SelectorList::parse_with_state(parser, input, state | SelectorParsingState::DISALLOW_PSEUDOS)?;
|
||||
let inner = SelectorList::parse_with_state(
|
||||
parser,
|
||||
input,
|
||||
state | SelectorParsingState::DISALLOW_PSEUDOS,
|
||||
)?;
|
||||
Ok(component(inner.0.into_vec().into_boxed_slice()))
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
use crate::context::QuirksMode;
|
||||
use crate::dom::{TDocument, TElement, TNode, TShadowRoot};
|
||||
use crate::invalidation::element::invalidation_map::Dependency;
|
||||
use crate::invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
|
||||
use crate::invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
|
||||
use crate::invalidation::element::invalidation_map::Dependency;
|
||||
use crate::Atom;
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||
|
@ -145,7 +145,10 @@ where
|
|||
}
|
||||
|
||||
fn check_outer_dependency(&mut self, _: &Dependency, _: E) -> bool {
|
||||
debug_assert!(false, "How? We should only have parent-less dependencies here!");
|
||||
debug_assert!(
|
||||
false,
|
||||
"How? We should only have parent-less dependencies here!"
|
||||
);
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -647,9 +650,11 @@ pub fn query_selector<E, Q>(
|
|||
if root_element.is_some() || !invalidation_may_be_useful {
|
||||
query_selector_slow::<E, Q>(root, selector_list, results, &mut matching_context);
|
||||
} else {
|
||||
let dependencies = selector_list.0.iter().map(|selector| {
|
||||
Dependency::for_full_selector_invalidation(selector.clone())
|
||||
}).collect::<SmallVec<[_; 5]>>();
|
||||
let dependencies = selector_list
|
||||
.0
|
||||
.iter()
|
||||
.map(|selector| Dependency::for_full_selector_invalidation(selector.clone()))
|
||||
.collect::<SmallVec<[_; 5]>>();
|
||||
let mut processor = QuerySelectorProcessor::<E, Q> {
|
||||
results,
|
||||
matching_context,
|
||||
|
|
|
@ -703,7 +703,6 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 53] = [
|
|||
keyword_evaluator!(eval_any_hover, Hover),
|
||||
ParsingRequirements::empty(),
|
||||
),
|
||||
|
||||
// Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
|
||||
// Internal because it is really only useful in the user agent anyway
|
||||
// and therefore not worth standardizing.
|
||||
|
|
|
@ -161,11 +161,13 @@ impl PseudoElement {
|
|||
/// Whether this pseudo-element is enabled for all content.
|
||||
pub fn enabled_in_content(&self) -> bool {
|
||||
match *self {
|
||||
PseudoElement::MozFocusOuter => static_prefs::pref!("layout.css.moz-focus-outer.enabled"),
|
||||
PseudoElement::FileChooserButton => static_prefs::pref!("layout.css.file-chooser-button.enabled"),
|
||||
_ => {
|
||||
(self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0
|
||||
}
|
||||
PseudoElement::MozFocusOuter => {
|
||||
static_prefs::pref!("layout.css.moz-focus-outer.enabled")
|
||||
},
|
||||
PseudoElement::FileChooserButton => {
|
||||
static_prefs::pref!("layout.css.file-chooser-button.enabled")
|
||||
},
|
||||
_ => (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,8 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
|
||||
#[inline]
|
||||
fn parse_is_and_where(&self) -> bool {
|
||||
self.in_user_agent_stylesheet() || static_prefs::pref!("layout.css.is-where-selectors.enabled")
|
||||
self.in_user_agent_stylesheet() ||
|
||||
static_prefs::pref!("layout.css.is-where-selectors.enabled")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! Helpers for different FFI pointer kinds that Gecko's FFI layer uses.
|
||||
|
||||
use gecko_bindings::structs::root::mozilla::detail::CopyablePtr;
|
||||
use servo_arc::{Arc, RawOffsetArc};
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::{forget, transmute};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ptr;
|
||||
use gecko_bindings::structs::root::mozilla::detail::CopyablePtr;
|
||||
|
||||
/// Indicates that a given Servo type has a corresponding Gecko FFI type.
|
||||
pub unsafe trait HasFFI: Sized + 'static {
|
||||
|
@ -345,4 +345,4 @@ impl<T> DerefMut for CopyablePtr<T> {
|
|||
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
|
||||
&mut self.mPtr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,10 @@ where
|
|||
I: Iterator<Item = &'a CascadeData>,
|
||||
{
|
||||
fn check_outer_dependency(&mut self, _: &Dependency, _: E) -> bool {
|
||||
debug_assert!(false, "how, we should only have parent-less dependencies here!");
|
||||
debug_assert!(
|
||||
false,
|
||||
"how, we should only have parent-less dependencies here!"
|
||||
);
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
use crate::context::QuirksMode;
|
||||
use crate::element_state::{DocumentState, ElementState};
|
||||
use crate::selector_map::{MaybeCaseInsensitiveHashMap, PrecomputedHashMap, SelectorMap, SelectorMapEntry};
|
||||
use crate::selector_map::{
|
||||
MaybeCaseInsensitiveHashMap, PrecomputedHashMap, SelectorMap, SelectorMapEntry,
|
||||
};
|
||||
use crate::selector_parser::SelectorImpl;
|
||||
use crate::{Atom, LocalName, Namespace};
|
||||
use fallible::{FallibleVec, FallibleHashMap};
|
||||
|
@ -196,7 +198,8 @@ 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<LocalName, SmallVec<[Dependency; 1]>>,
|
||||
pub other_attribute_affecting_selectors:
|
||||
PrecomputedHashMap<LocalName, SmallVec<[Dependency; 1]>>,
|
||||
}
|
||||
|
||||
impl InvalidationMap {
|
||||
|
@ -331,7 +334,11 @@ impl<'a> SelectorDependencyCollector<'a> {
|
|||
self.visit_whole_selector_from(iter, 0)
|
||||
}
|
||||
|
||||
fn visit_whole_selector_from(&mut self, mut iter: SelectorIter<SelectorImpl>, mut index: usize) -> bool {
|
||||
fn visit_whole_selector_from(
|
||||
&mut self,
|
||||
mut iter: SelectorIter<SelectorImpl>,
|
||||
mut index: usize,
|
||||
) -> bool {
|
||||
loop {
|
||||
// Reset the compound state.
|
||||
self.compound_state = PerCompoundState::new(index);
|
||||
|
@ -384,7 +391,7 @@ impl<'a> SelectorDependencyCollector<'a> {
|
|||
Err(err) => {
|
||||
*self.alloc_error = Some(err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,8 +402,7 @@ impl<'a> SelectorDependencyCollector<'a> {
|
|||
// cache them or something.
|
||||
for &(ref selector, ref selector_offset) in self.parent_selectors.iter() {
|
||||
debug_assert_ne!(
|
||||
self.compound_state.offset,
|
||||
0,
|
||||
self.compound_state.offset, 0,
|
||||
"Shouldn't bother creating nested dependencies for the rightmost compound",
|
||||
);
|
||||
let new_parent = Dependency {
|
||||
|
@ -442,7 +448,8 @@ impl<'a> SelectorVisitor for SelectorDependencyCollector<'a> {
|
|||
|
||||
index += 1; // account for the combinator.
|
||||
|
||||
self.parent_selectors.push((self.selector.clone(), self.compound_state.offset));
|
||||
self.parent_selectors
|
||||
.push((self.selector.clone(), self.compound_state.offset));
|
||||
let mut nested = SelectorDependencyCollector {
|
||||
map: &mut *self.map,
|
||||
document_state: &mut *self.document_state,
|
||||
|
@ -483,7 +490,7 @@ impl<'a> SelectorVisitor for SelectorDependencyCollector<'a> {
|
|||
Err(err) => {
|
||||
*self.alloc_error = Some(err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
Component::NonTSPseudoClass(ref pc) => {
|
||||
|
|
|
@ -177,13 +177,10 @@ pub struct Invalidation<'a> {
|
|||
|
||||
impl<'a> Invalidation<'a> {
|
||||
/// Create a new invalidation for matching a dependency.
|
||||
pub fn new(
|
||||
dependency: &'a Dependency,
|
||||
scope: Option<OpaqueElement>,
|
||||
) -> Self {
|
||||
pub fn new(dependency: &'a Dependency, scope: Option<OpaqueElement>) -> Self {
|
||||
debug_assert!(
|
||||
dependency.selector_offset == dependency.selector.len() + 1 ||
|
||||
dependency.invalidation_kind() != DependencyInvalidationKind::Element,
|
||||
dependency.invalidation_kind() != DependencyInvalidationKind::Element,
|
||||
"No point to this, if the dependency matched the element we should just invalidate it"
|
||||
);
|
||||
Self {
|
||||
|
@ -206,7 +203,11 @@ impl<'a> Invalidation<'a> {
|
|||
// for the weird pseudos in <input type="number">.
|
||||
//
|
||||
// We should be able to do better here!
|
||||
match self.dependency.selector.combinator_at_parse_order(self.offset - 1) {
|
||||
match self
|
||||
.dependency
|
||||
.selector
|
||||
.combinator_at_parse_order(self.offset - 1)
|
||||
{
|
||||
Combinator::Descendant | Combinator::LaterSibling | Combinator::PseudoElement => true,
|
||||
Combinator::Part |
|
||||
Combinator::SlotAssignment |
|
||||
|
@ -220,7 +221,11 @@ impl<'a> Invalidation<'a> {
|
|||
return InvalidationKind::Descendant(DescendantInvalidationKind::Dom);
|
||||
}
|
||||
|
||||
match self.dependency.selector.combinator_at_parse_order(self.offset - 1) {
|
||||
match self
|
||||
.dependency
|
||||
.selector
|
||||
.combinator_at_parse_order(self.offset - 1)
|
||||
{
|
||||
Combinator::Child | Combinator::Descendant | Combinator::PseudoElement => {
|
||||
InvalidationKind::Descendant(DescendantInvalidationKind::Dom)
|
||||
},
|
||||
|
@ -238,7 +243,11 @@ impl<'a> fmt::Debug for Invalidation<'a> {
|
|||
use cssparser::ToCss;
|
||||
|
||||
f.write_str("Invalidation(")?;
|
||||
for component in self.dependency.selector.iter_raw_parse_order_from(self.offset) {
|
||||
for component in self
|
||||
.dependency
|
||||
.selector
|
||||
.iter_raw_parse_order_from(self.offset)
|
||||
{
|
||||
if matches!(*component, Component::Combinator(..)) {
|
||||
break;
|
||||
}
|
||||
|
@ -816,9 +825,11 @@ where
|
|||
let mut cur_dependency = invalidation.dependency;
|
||||
loop {
|
||||
cur_dependency = match cur_dependency.parent {
|
||||
None => return SingleInvalidationResult {
|
||||
invalidated_self: true,
|
||||
matched: true,
|
||||
None => {
|
||||
return SingleInvalidationResult {
|
||||
invalidated_self: true,
|
||||
matched: true,
|
||||
}
|
||||
},
|
||||
Some(ref p) => &**p,
|
||||
};
|
||||
|
@ -828,11 +839,14 @@ where
|
|||
// The inner selector changed, now check if the full
|
||||
// previous part of the selector did, before keeping
|
||||
// checking for descendants.
|
||||
if !self.processor.check_outer_dependency(cur_dependency, self.element) {
|
||||
if !self
|
||||
.processor
|
||||
.check_outer_dependency(cur_dependency, self.element)
|
||||
{
|
||||
return SingleInvalidationResult {
|
||||
invalidated_self: false,
|
||||
matched: false,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if cur_dependency.invalidation_kind() == DependencyInvalidationKind::Element {
|
||||
|
@ -840,24 +854,21 @@ where
|
|||
}
|
||||
|
||||
debug!(" > Generating invalidation");
|
||||
break Invalidation::new(cur_dependency, invalidation.scope)
|
||||
break Invalidation::new(cur_dependency, invalidation.scope);
|
||||
}
|
||||
},
|
||||
CompoundSelectorMatchingResult::Matched {
|
||||
next_combinator_offset,
|
||||
} => {
|
||||
Invalidation {
|
||||
dependency: invalidation.dependency,
|
||||
scope: invalidation.scope,
|
||||
offset: next_combinator_offset + 1,
|
||||
matched_by_any_previous: false,
|
||||
}
|
||||
} => Invalidation {
|
||||
dependency: invalidation.dependency,
|
||||
scope: invalidation.scope,
|
||||
offset: next_combinator_offset + 1,
|
||||
matched_by_any_previous: false,
|
||||
},
|
||||
};
|
||||
|
||||
debug_assert_ne!(
|
||||
next_invalidation.offset,
|
||||
0,
|
||||
next_invalidation.offset, 0,
|
||||
"Rightmost selectors shouldn't generate more invalidations",
|
||||
);
|
||||
|
||||
|
@ -886,7 +897,9 @@ where
|
|||
c.maybe_allowed_after_pseudo_element(),
|
||||
"Someone seriously messed up selector parsing: \
|
||||
{:?} at offset {:?}: {:?}",
|
||||
next_invalidation.dependency, next_invalidation.offset, c,
|
||||
next_invalidation.dependency,
|
||||
next_invalidation.offset,
|
||||
c,
|
||||
);
|
||||
|
||||
None
|
||||
|
|
|
@ -254,7 +254,9 @@ where
|
|||
);
|
||||
}
|
||||
let mut attributes_changed = false;
|
||||
snapshot.each_attr_changed(|_| { attributes_changed = true; });
|
||||
snapshot.each_attr_changed(|_| {
|
||||
attributes_changed = true;
|
||||
});
|
||||
if attributes_changed {
|
||||
debug!(
|
||||
" > attributes changed, old: {}",
|
||||
|
@ -436,7 +438,12 @@ where
|
|||
/// Check whether a dependency should be taken into account.
|
||||
#[inline]
|
||||
fn check_dependency(&mut self, dependency: &Dependency) -> bool {
|
||||
check_dependency(dependency, &self.element, &self.wrapper, &mut self.matching_context)
|
||||
check_dependency(
|
||||
dependency,
|
||||
&self.element,
|
||||
&self.wrapper,
|
||||
&mut self.matching_context,
|
||||
)
|
||||
}
|
||||
|
||||
fn scan_dependency(&mut self, dependency: &'selectors Dependency) {
|
||||
|
@ -472,10 +479,8 @@ where
|
|||
debug_assert_ne!(dependency.selector_offset, 0);
|
||||
debug_assert_ne!(dependency.selector_offset, dependency.selector.len());
|
||||
|
||||
let invalidation = Invalidation::new(
|
||||
&dependency,
|
||||
self.matching_context.current_host.clone(),
|
||||
);
|
||||
let invalidation =
|
||||
Invalidation::new(&dependency, self.matching_context.current_host.clone());
|
||||
|
||||
match invalidation_kind {
|
||||
DependencyInvalidationKind::Element => unreachable!(),
|
||||
|
|
|
@ -208,13 +208,19 @@ where
|
|||
}
|
||||
|
||||
impl Parse for crate::OwnedStr {
|
||||
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(
|
||||
_: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
Ok(input.expect_string()?.as_ref().to_owned().into())
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for UnicodeRange {
|
||||
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(
|
||||
_: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
Ok(UnicodeRange::parse(input)?)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,8 +324,9 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
|||
.try_entry(url.clone())?
|
||||
.or_insert_with(SmallVec::new),
|
||||
Bucket::Universal => &mut self.other,
|
||||
}.try_push($entry)?;
|
||||
}}
|
||||
}
|
||||
.try_push($entry)?;
|
||||
}};
|
||||
}
|
||||
|
||||
let bucket = {
|
||||
|
@ -347,7 +348,11 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
|||
// This is specially true if there's any universal selector in the
|
||||
// `disjoint_selectors` set, at which point we'd just be doing
|
||||
// wasted work.
|
||||
if !disjoint_buckets.is_empty() && disjoint_buckets.iter().all(|b| b.more_specific_than(&bucket)) {
|
||||
if !disjoint_buckets.is_empty() &&
|
||||
disjoint_buckets
|
||||
.iter()
|
||||
.all(|b| b.more_specific_than(&bucket))
|
||||
{
|
||||
for bucket in &disjoint_buckets {
|
||||
let entry = entry.clone();
|
||||
insert_into_bucket!(entry, *bucket);
|
||||
|
|
|
@ -10,7 +10,8 @@ use crate::values::computed::{Context, ToComputedValue};
|
|||
use crate::values::specified;
|
||||
|
||||
pub use super::specified::{
|
||||
AlignContent, AlignItems, AlignTracks, ContentDistribution, JustifyContent, JustifyTracks, SelfAlignment,
|
||||
AlignContent, AlignItems, AlignTracks, ContentDistribution, JustifyContent, JustifyTracks,
|
||||
SelfAlignment,
|
||||
};
|
||||
pub use super::specified::{AlignSelf, JustifySelf};
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ use std::cmp;
|
|||
use std::f32;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::align::{AlignContent, AlignItems, AlignTracks, JustifyContent, JustifyItems, JustifyTracks, SelfAlignment};
|
||||
pub use self::align::{
|
||||
AlignContent, AlignItems, AlignTracks, JustifyContent, JustifyItems, JustifyTracks,
|
||||
SelfAlignment,
|
||||
};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::align::{AlignSelf, JustifySelf};
|
||||
pub use self::angle::Angle;
|
||||
|
@ -69,7 +72,9 @@ pub use self::motion::{OffsetPath, OffsetRotate};
|
|||
pub use self::outline::OutlineStyle;
|
||||
pub use self::percentage::{NonNegativePercentage, Percentage};
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, ZIndex};
|
||||
pub use self::position::{
|
||||
GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, ZIndex,
|
||||
};
|
||||
pub use self::rect::NonNegativeLengthOrNumberRect;
|
||||
pub use self::resolution::Resolution;
|
||||
pub use self::svg::MozContextProperties;
|
||||
|
|
|
@ -300,19 +300,14 @@ impl SpecifiedValueInfo for AlignContent {
|
|||
)]
|
||||
#[repr(transparent)]
|
||||
#[css(comma)]
|
||||
pub struct AlignTracks(
|
||||
#[css(iterable, if_empty = "normal")]
|
||||
pub crate::OwnedSlice<AlignContent>
|
||||
);
|
||||
pub struct AlignTracks(#[css(iterable, if_empty = "normal")] pub crate::OwnedSlice<AlignContent>);
|
||||
|
||||
impl Parse for AlignTracks {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let values = input.parse_comma_separated(|input| {
|
||||
AlignContent::parse(context, input)
|
||||
})?;
|
||||
let values = input.parse_comma_separated(|input| AlignContent::parse(context, input))?;
|
||||
Ok(AlignTracks(values.into()))
|
||||
}
|
||||
}
|
||||
|
@ -373,8 +368,7 @@ impl SpecifiedValueInfo for JustifyContent {
|
|||
#[repr(transparent)]
|
||||
#[css(comma)]
|
||||
pub struct JustifyTracks(
|
||||
#[css(iterable, if_empty = "normal")]
|
||||
pub crate::OwnedSlice<JustifyContent>
|
||||
#[css(iterable, if_empty = "normal")] pub crate::OwnedSlice<JustifyContent>,
|
||||
);
|
||||
|
||||
impl Parse for JustifyTracks {
|
||||
|
@ -382,9 +376,7 @@ impl Parse for JustifyTracks {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let values = input.parse_comma_separated(|input| {
|
||||
JustifyContent::parse(context, input)
|
||||
})?;
|
||||
let values = input.parse_comma_separated(|input| JustifyContent::parse(context, input))?;
|
||||
Ok(JustifyTracks(values.into()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,9 @@ pub use self::motion::{OffsetPath, OffsetRotate};
|
|||
pub use self::outline::OutlineStyle;
|
||||
pub use self::percentage::Percentage;
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto};
|
||||
pub use self::position::{
|
||||
GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto,
|
||||
};
|
||||
pub use self::position::{PositionComponent, ZIndex};
|
||||
pub use self::rect::NonNegativeLengthOrNumberRect;
|
||||
pub use self::resolution::Resolution;
|
||||
|
|
|
@ -452,13 +452,12 @@ pub struct MasonryAutoFlow {
|
|||
|
||||
#[inline]
|
||||
fn is_pack_with_non_default_order(placement: &MasonryPlacement, order: &MasonryItemOrder) -> bool {
|
||||
*placement == MasonryPlacement::Pack &&
|
||||
*order != MasonryItemOrder::DefiniteFirst
|
||||
*placement == MasonryPlacement::Pack && *order != MasonryItemOrder::DefiniteFirst
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_item_order_definite_first(order: &MasonryItemOrder) -> bool {
|
||||
*order == MasonryItemOrder::DefiniteFirst
|
||||
*order == MasonryItemOrder::DefiniteFirst
|
||||
}
|
||||
|
||||
impl MasonryAutoFlow {
|
||||
|
|
|
@ -154,8 +154,14 @@ pub fn derive(mut input: DeriveInput) -> TokenStream {
|
|||
let mut parse_non_keywords = quote! {};
|
||||
for (i, (variant, css_attrs, parse_attrs)) in non_keywords.iter().enumerate() {
|
||||
let skip_try = !has_keywords && i == non_keywords.len() - 1;
|
||||
let parse_variant =
|
||||
parse_non_keyword_variant(&mut where_clause, name, variant, css_attrs, parse_attrs, skip_try);
|
||||
let parse_variant = parse_non_keyword_variant(
|
||||
&mut where_clause,
|
||||
name,
|
||||
variant,
|
||||
css_attrs,
|
||||
parse_attrs,
|
||||
skip_try,
|
||||
);
|
||||
parse_non_keywords.extend(parse_variant);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче