mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
cargo fix --edition
This commit is contained in:
parent
e1fcffb336
commit
a15d33a10e
197 changed files with 1414 additions and 1380 deletions
|
@ -4,4 +4,4 @@
|
|||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub use counter_style::CounterStyleRuleData as CounterStyleRule;
|
||||
pub use crate::counter_style::CounterStyleRuleData as CounterStyleRule;
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
//! initially in CSS Conditional Rules Module Level 3, @document has been postponed to the level 4.
|
||||
//! We implement the prefixed `@-moz-document`.
|
||||
|
||||
use crate::media_queries::Device;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::CssRules;
|
||||
use crate::values::CssUrl;
|
||||
use cssparser::{Parser, SourceLocation};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::Device;
|
||||
use parser::{Parse, ParserContext};
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRules;
|
||||
use values::CssUrl;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// A @-moz-document rule
|
||||
|
@ -135,7 +135,7 @@ impl DocumentMatchingFunction {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(url) = input.try(|input| CssUrl::parse(context, input)) {
|
||||
if let Ok(url) = input.r#try(|input| CssUrl::parse(context, input)) {
|
||||
return Ok(DocumentMatchingFunction::Url(url));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub use font_face::FontFaceRuleData as FontFaceRule;
|
||||
pub use crate::font_face::FontFaceRuleData as FontFaceRule;
|
||||
|
|
|
@ -6,23 +6,23 @@
|
|||
//!
|
||||
//! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule
|
||||
|
||||
use crate::error_reporting::ContextualParseError;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::CssRuleType;
|
||||
use crate::values::computed::font::FamilyName;
|
||||
use crate::values::serialize_atom_identifier;
|
||||
use crate::Atom;
|
||||
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
|
||||
use cssparser::{DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray};
|
||||
use parser::{Parse, ParserContext};
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRuleType;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A @font-feature-values block declaration.
|
||||
/// It is `<ident>: <integer>+`.
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
//!
|
||||
//! [import]: https://drafts.csswg.org/css-cascade-3/#at-import
|
||||
|
||||
use context::QuirksMode;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::media_queries::MediaList;
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::{CssRule, Origin, StylesheetInDocument};
|
||||
use crate::values::CssUrl;
|
||||
use cssparser::SourceLocation;
|
||||
use media_queries::MediaList;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use stylesheets::{CssRule, Origin, StylesheetInDocument};
|
||||
use values::CssUrl;
|
||||
|
||||
/// With asynchronous stylesheet parsing, we can't synchronously create a
|
||||
/// GeckoStyleSheet. So we use this placeholder instead.
|
||||
|
@ -124,7 +124,7 @@ impl StylesheetInDocument for ImportSheet {
|
|||
/// A sheet that is held from an import rule.
|
||||
#[cfg(feature = "servo")]
|
||||
#[derive(Debug)]
|
||||
pub struct ImportSheet(pub ::servo_arc::Arc<::stylesheets::Stylesheet>);
|
||||
pub struct ImportSheet(pub ::servo_arc::Arc<crate::stylesheets::Stylesheet>);
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
impl StylesheetInDocument for ImportSheet {
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
|
||||
//! Keyframes: https://drafts.csswg.org/css-animations/#keyframes
|
||||
|
||||
use crate::error_reporting::ContextualParseError;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use crate::properties::LonghandIdSet;
|
||||
use crate::properties::{Importance, PropertyDeclaration};
|
||||
use crate::properties::{LonghandId, PropertyDeclarationBlock, PropertyId};
|
||||
use crate::properties::{PropertyDeclarationId, SourcePropertyDeclaration};
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
|
||||
use crate::shared_lock::{Locked, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::rule_parser::VendorPrefix;
|
||||
use crate::stylesheets::{CssRuleType, StylesheetContents};
|
||||
use crate::values::{serialize_percentage, KeyframesName};
|
||||
use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token};
|
||||
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use properties::LonghandIdSet;
|
||||
use properties::{Importance, PropertyDeclaration};
|
||||
use properties::{LonghandId, PropertyDeclarationBlock, PropertyId};
|
||||
use properties::{PropertyDeclarationId, SourcePropertyDeclaration};
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
|
||||
use shared_lock::{Locked, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::rule_parser::VendorPrefix;
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use values::{serialize_percentage, KeyframesName};
|
||||
|
||||
/// A [`@keyframes`][keyframes] rule.
|
||||
///
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
//! The stylesheet loader is the abstraction used to trigger network requests
|
||||
//! for `@import` rules.
|
||||
|
||||
use crate::media_queries::MediaList;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::shared_lock::{Locked, SharedRwLock};
|
||||
use crate::stylesheets::import_rule::ImportRule;
|
||||
use crate::values::CssUrl;
|
||||
use cssparser::SourceLocation;
|
||||
use media_queries::MediaList;
|
||||
use parser::ParserContext;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{Locked, SharedRwLock};
|
||||
use stylesheets::import_rule::ImportRule;
|
||||
use values::CssUrl;
|
||||
|
||||
/// The stylesheet loader is the abstraction used to trigger network requests
|
||||
/// for `@import` rules.
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
//!
|
||||
//! [media]: https://drafts.csswg.org/css-conditional/#at-ruledef-media
|
||||
|
||||
use crate::media_queries::MediaList;
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::CssRules;
|
||||
use cssparser::SourceLocation;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::MediaList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use stylesheets::CssRules;
|
||||
|
||||
/// An [`@media`][media] urle.
|
||||
///
|
||||
|
|
|
@ -23,15 +23,15 @@ mod stylesheet;
|
|||
pub mod supports_rule;
|
||||
pub mod viewport_rule;
|
||||
|
||||
use crate::parser::ParserContext;
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use cssparser::{parse_one_rule, Parser, ParserInput};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use parser::ParserContext;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::ParsingMode;
|
||||
|
||||
pub use self::counter_style_rule::CounterStyleRule;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
//! The `@namespace` at-rule.
|
||||
|
||||
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::{Namespace, Prefix};
|
||||
use cssparser::SourceLocation;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// A `@namespace` rule.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
//!
|
||||
//! [page]: https://drafts.csswg.org/css2/page.html#page-box
|
||||
|
||||
use crate::properties::PropertyDeclarationBlock;
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use cssparser::SourceLocation;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
|
||||
/// A [`@page`][page] rule.
|
||||
///
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
//! A list of CSS rules.
|
||||
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::loader::StylesheetLoader;
|
||||
use crate::stylesheets::rule_parser::{InsertRuleContext, State};
|
||||
use crate::stylesheets::stylesheet::StylesheetContents;
|
||||
use crate::stylesheets::{CssRule, RulesMutateError};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOfOps};
|
||||
use servo_arc::{Arc, RawOffsetArc};
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use stylesheets::loader::StylesheetLoader;
|
||||
use stylesheets::rule_parser::{InsertRuleContext, State};
|
||||
use stylesheets::stylesheet::StylesheetContents;
|
||||
use stylesheets::{CssRule, RulesMutateError};
|
||||
|
||||
/// A list of CSS rules.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
|
||||
//! Parsing of the stylesheet contents.
|
||||
|
||||
use counter_style::{parse_counter_style_body, parse_counter_style_name_definition};
|
||||
use crate::counter_style::{parse_counter_style_body, parse_counter_style_name_definition};
|
||||
use crate::error_reporting::ContextualParseError;
|
||||
use crate::font_face::parse_font_face_block;
|
||||
use crate::media_queries::MediaList;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::properties::parse_property_declaration_list;
|
||||
use crate::selector_parser::{SelectorImpl, SelectorParser};
|
||||
use crate::shared_lock::{Locked, SharedRwLock};
|
||||
use crate::str::starts_with_ignore_ascii_case;
|
||||
use crate::stylesheets::document_rule::DocumentCondition;
|
||||
use crate::stylesheets::font_feature_values_rule::parse_family_name_list;
|
||||
use crate::stylesheets::keyframes_rule::parse_keyframe_list;
|
||||
use crate::stylesheets::stylesheet::Namespaces;
|
||||
use crate::stylesheets::supports_rule::SupportsCondition;
|
||||
use crate::stylesheets::viewport_rule;
|
||||
use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
|
||||
use crate::stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
|
||||
use crate::stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
|
||||
use crate::values::computed::font::FamilyName;
|
||||
use crate::values::{CssUrl, CustomIdent, KeyframesName};
|
||||
use crate::{Namespace, Prefix};
|
||||
use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation};
|
||||
use error_reporting::ContextualParseError;
|
||||
use font_face::parse_font_face_block;
|
||||
use media_queries::MediaList;
|
||||
use parser::{Parse, ParserContext};
|
||||
use properties::parse_property_declaration_list;
|
||||
use selector_parser::{SelectorImpl, SelectorParser};
|
||||
use selectors::SelectorList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{Locked, SharedRwLock};
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use stylesheets::document_rule::DocumentCondition;
|
||||
use stylesheets::font_feature_values_rule::parse_family_name_list;
|
||||
use stylesheets::keyframes_rule::parse_keyframe_list;
|
||||
use stylesheets::stylesheet::Namespaces;
|
||||
use stylesheets::supports_rule::SupportsCondition;
|
||||
use stylesheets::viewport_rule;
|
||||
use stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
|
||||
use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
|
||||
use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
|
||||
use values::computed::font::FamilyName;
|
||||
use values::{CssUrl, CustomIdent, KeyframesName};
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// The information we need particularly to do CSSOM insertRule stuff.
|
||||
pub struct InsertRuleContext<'a> {
|
||||
|
@ -202,7 +202,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedNamespaceRule))
|
||||
}
|
||||
|
||||
let prefix = input.try(|i| i.expect_ident_cloned())
|
||||
let prefix = input.r#try(|i| i.expect_ident_cloned())
|
||||
.map(|s| Prefix::from(s.as_ref())).ok();
|
||||
let maybe_namespace = match input.expect_url_or_string() {
|
||||
Ok(url_or_string) => url_or_string,
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! An iterator over a list of rules.
|
||||
|
||||
use context::QuirksMode;
|
||||
use media_queries::Device;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::media_queries::Device;
|
||||
use crate::shared_lock::SharedRwLockReadGuard;
|
||||
use crate::stylesheets::StylesheetInDocument;
|
||||
use crate::stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
use smallvec::SmallVec;
|
||||
use std::slice;
|
||||
use stylesheets::StylesheetInDocument;
|
||||
use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
|
||||
/// An iterator over a list of rules.
|
||||
pub struct RulesIterator<'a, 'b, C>
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
|
||||
//! A style rule.
|
||||
|
||||
use crate::properties::PropertyDeclarationBlock;
|
||||
use crate::selector_parser::SelectorImpl;
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use cssparser::SourceLocation;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::SelectorList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
|
||||
/// A style rule, with selectors and declarations.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
* 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 context::QuirksMode;
|
||||
use cssparser::{Parser, ParserInput, RuleListParser};
|
||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
use fallible::FallibleVec;
|
||||
use fxhash::FxHashMap;
|
||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::{Device, MediaList};
|
||||
use parking_lot::RwLock;
|
||||
use parser::ParserContext;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{
|
||||
use crate::context::QuirksMode;
|
||||
use crate::error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use crate::media_queries::{Device, MediaList};
|
||||
use crate::parser::ParserContext;
|
||||
use crate::shared_lock::{
|
||||
DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard,
|
||||
};
|
||||
use crate::stylesheets::loader::StylesheetLoader;
|
||||
use crate::stylesheets::rule_parser::{State, TopLevelRuleParser};
|
||||
use crate::stylesheets::rules_iterator::{EffectiveRules, EffectiveRulesIterator};
|
||||
use crate::stylesheets::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
|
||||
use crate::stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
|
||||
use crate::use_counters::UseCounters;
|
||||
use crate::{Namespace, Prefix};
|
||||
use cssparser::{Parser, ParserInput, RuleListParser};
|
||||
use fallible::FallibleVec;
|
||||
use fxhash::FxHashMap;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use parking_lot::RwLock;
|
||||
use servo_arc::Arc;
|
||||
use std::mem;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use style_traits::ParsingMode;
|
||||
use stylesheets::loader::StylesheetLoader;
|
||||
use stylesheets::rule_parser::{State, TopLevelRuleParser};
|
||||
use stylesheets::rules_iterator::{EffectiveRules, EffectiveRulesIterator};
|
||||
use stylesheets::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
|
||||
use stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
|
||||
use use_counters::UseCounters;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// This structure holds the user-agent and user stylesheets.
|
||||
pub struct UserAgentStylesheets {
|
||||
|
@ -166,9 +166,9 @@ macro_rules! rule_filter {
|
|||
$(
|
||||
#[allow(missing_docs)]
|
||||
fn $method<F>(&self, device: &Device, guard: &SharedRwLockReadGuard, mut f: F)
|
||||
where F: FnMut(&::stylesheets::$rule_type),
|
||||
where F: FnMut(&crate::stylesheets::$rule_type),
|
||||
{
|
||||
use stylesheets::CssRule;
|
||||
use crate::stylesheets::CssRule;
|
||||
|
||||
for rule in self.effective_rules(device, guard) {
|
||||
if let CssRule::$variant(ref lock) = *rule {
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
|
||||
//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)
|
||||
|
||||
use crate::parser::ParserContext;
|
||||
use crate::properties::{PropertyDeclaration, PropertyId, SourcePropertyDeclaration};
|
||||
use crate::selector_parser::{SelectorImpl, SelectorParser};
|
||||
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::{CssRuleType, CssRules, Namespaces};
|
||||
use cssparser::parse_important;
|
||||
use cssparser::{Delimiter, Parser, SourceLocation, Token};
|
||||
use cssparser::{ParseError as CssParseError, ParserInput};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use parser::ParserContext;
|
||||
use properties::{PropertyDeclaration, PropertyId, SourcePropertyDeclaration};
|
||||
use selector_parser::{SelectorImpl, SelectorParser};
|
||||
use selectors::parser::{Selector, SelectorParseErrorKind};
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::fmt::{self, Write};
|
||||
use std::str;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{CssRuleType, CssRules, Namespaces};
|
||||
|
||||
/// An [`@supports`][supports] rule.
|
||||
///
|
||||
|
@ -103,7 +103,7 @@ impl SupportsCondition {
|
|||
///
|
||||
/// <https://drafts.csswg.org/css-conditional/#supports_condition>
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("not")).is_ok() {
|
||||
if input.r#try(|i| i.expect_ident_matching("not")).is_ok() {
|
||||
let inner = SupportsCondition::parse_in_parens(input)?;
|
||||
return Ok(SupportsCondition::Not(Box::new(inner)));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ impl SupportsCondition {
|
|||
loop {
|
||||
conditions.push(SupportsCondition::parse_in_parens(input)?);
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching(keyword))
|
||||
.r#try(|input| input.expect_ident_matching(keyword))
|
||||
.is_err()
|
||||
{
|
||||
// Did not find the expected keyword.
|
||||
|
@ -175,20 +175,20 @@ impl SupportsCondition {
|
|||
fn parse_in_parens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
// Whitespace is normally taken care of in `Parser::next`,
|
||||
// but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases.
|
||||
while input.try(Parser::expect_whitespace).is_ok() {}
|
||||
while input.r#try(Parser::expect_whitespace).is_ok() {}
|
||||
let pos = input.position();
|
||||
let location = input.current_source_location();
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
match input.next()?.clone() {
|
||||
Token::ParenthesisBlock => {
|
||||
let nested =
|
||||
input.try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
input.r#try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
if nested.is_ok() {
|
||||
return nested;
|
||||
}
|
||||
},
|
||||
Token::Function(ident) => {
|
||||
let nested = input.try(|input| {
|
||||
let nested = input.r#try(|input| {
|
||||
input.parse_nested_block(|input| {
|
||||
SupportsCondition::parse_functional(&ident, input)
|
||||
})
|
||||
|
@ -240,7 +240,7 @@ fn eval_moz_bool_pref(_: &CStr, _: &ParserContext) -> bool {
|
|||
pub fn parse_condition_or_declaration<'i, 't>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<SupportsCondition, ParseError<'i>> {
|
||||
if let Ok(condition) = input.try(SupportsCondition::parse) {
|
||||
if let Ok(condition) = input.r#try(SupportsCondition::parse) {
|
||||
Ok(SupportsCondition::Parenthesized(Box::new(condition)))
|
||||
} else {
|
||||
Declaration::parse(input).map(SupportsCondition::Declaration)
|
||||
|
@ -418,7 +418,7 @@ impl Declaration {
|
|||
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||
.map_err(|_| input.new_custom_error(()))
|
||||
})?;
|
||||
let _ = input.try(parse_important);
|
||||
let _ = input.r#try(parse_important);
|
||||
Ok(())
|
||||
})
|
||||
.is_ok()
|
||||
|
|
|
@ -8,29 +8,29 @@
|
|||
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
|
||||
|
||||
use app_units::Au;
|
||||
use context::QuirksMode;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::error_reporting::ContextualParseError;
|
||||
use crate::font_metrics::get_metrics_provider_for_product;
|
||||
use crate::media_queries::Device;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::properties::StyleBuilder;
|
||||
use crate::rule_cache::RuleCacheConditions;
|
||||
use crate::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::stylesheets::{Origin, StylesheetInDocument};
|
||||
use crate::values::computed::{Context, ToComputedValue};
|
||||
use crate::values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
|
||||
use cssparser::CowRcStr;
|
||||
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use error_reporting::ContextualParseError;
|
||||
use euclid::TypedSize2D;
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
use media_queries::Device;
|
||||
use parser::ParserContext;
|
||||
use properties::StyleBuilder;
|
||||
use rule_cache::RuleCacheConditions;
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use std::fmt::{self, Write};
|
||||
use std::iter::Enumerate;
|
||||
use std::str::Chars;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
||||
use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{Origin, StylesheetInDocument};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
|
||||
|
||||
/// Whether parsing and processing of `@viewport` rules is enabled.
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -265,7 +265,7 @@ fn parse_shorthand<'i, 't>(
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<(ViewportLength, ViewportLength), ParseError<'i>> {
|
||||
let min = ViewportLength::parse(context, input)?;
|
||||
match input.try(|i| ViewportLength::parse(context, i)) {
|
||||
match input.r#try(|i| ViewportLength::parse(context, i)) {
|
||||
Err(_) => Ok((min.clone(), min)),
|
||||
Ok(max) => Ok((min, max)),
|
||||
}
|
||||
|
@ -289,8 +289,8 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
) -> Result<Vec<ViewportDescriptorDeclaration>, ParseError<'i>> {
|
||||
macro_rules! declaration {
|
||||
($declaration:ident($parse:expr)) => {
|
||||
declaration!($declaration(value: try!($parse(input)),
|
||||
important: input.try(parse_important).is_ok()))
|
||||
declaration!($declaration(value: r#try!($parse(input)),
|
||||
important: input.r#try(parse_important).is_ok()))
|
||||
};
|
||||
($declaration:ident(value: $value:expr, important: $important:expr)) => {
|
||||
ViewportDescriptorDeclaration::new(
|
||||
|
@ -306,7 +306,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
};
|
||||
(shorthand -> [$min:ident, $max:ident]) => {{
|
||||
let shorthand = parse_shorthand(self.context, input)?;
|
||||
let important = input.try(parse_important).is_ok();
|
||||
let important = input.r#try(parse_important).is_ok();
|
||||
|
||||
Ok(vec![
|
||||
declaration!($min(value: shorthand.0, important: important)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue