mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is passed to rustdoc. This is mostly a global find-and-replace for bare URIs on lines by themselves in doc comments.
This commit is contained in:
parent
aa3122e7d1
commit
efc3683cc7
137 changed files with 572 additions and 565 deletions
|
@ -393,7 +393,7 @@ impl PartialEq<Atom> for AttrValue {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values
|
||||
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values>
|
||||
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
|
||||
match parse_length(value) {
|
||||
LengthOrPercentageOrAuto::Length(x) if x == Au::zero() => LengthOrPercentageOrAuto::Auto,
|
||||
|
|
|
@ -229,55 +229,55 @@ macro_rules! counter_style_descriptors {
|
|||
}
|
||||
|
||||
counter_style_descriptors! {
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-system
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-system>
|
||||
"system" system / eCSSCounterDesc_System: System = {
|
||||
System::Symbolic
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-negative
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-negative>
|
||||
"negative" negative / eCSSCounterDesc_Negative: Negative = {
|
||||
Negative(Symbol::String("-".to_owned()), None)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-prefix
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-prefix>
|
||||
"prefix" prefix / eCSSCounterDesc_Prefix: Symbol = {
|
||||
Symbol::String("".to_owned())
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-suffix
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-suffix>
|
||||
"suffix" suffix / eCSSCounterDesc_Suffix: Symbol = {
|
||||
Symbol::String(". ".to_owned())
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-range
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-range>
|
||||
"range" range / eCSSCounterDesc_Range: Ranges = {
|
||||
Ranges(Vec::new()) // Empty Vec represents 'auto'
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-pad
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||
"pad" pad / eCSSCounterDesc_Pad: Pad = {
|
||||
Pad(0, Symbol::String("".to_owned()))
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-fallback
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-fallback>
|
||||
"fallback" fallback / eCSSCounterDesc_Fallback: Fallback = {
|
||||
// FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 use atom!()
|
||||
Fallback(CustomIdent(Atom::from("decimal")))
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
||||
"symbols" symbols / eCSSCounterDesc_Symbols: Symbols = !
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
|
||||
"additive-symbols" additive_symbols / eCSSCounterDesc_AdditiveSymbols: AdditiveSymbols = !
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as>
|
||||
"speak-as" speak_as / eCSSCounterDesc_SpeakAs: SpeakAs = {
|
||||
SpeakAs::Auto
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-system
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-system>
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum System {
|
||||
/// 'cyclic'
|
||||
|
@ -343,7 +343,7 @@ impl ToCss for System {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#typedef-symbol
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#typedef-symbol>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub enum Symbol {
|
||||
|
@ -388,7 +388,7 @@ impl Symbol {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-negative
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-negative>
|
||||
#[derive(Clone, Debug, ToCss)]
|
||||
pub struct Negative(pub Symbol, pub Option<Symbol>);
|
||||
|
||||
|
@ -401,7 +401,7 @@ impl Parse for Negative {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-range
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-range>
|
||||
///
|
||||
/// Empty Vec represents 'auto'
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -467,7 +467,7 @@ fn bound_to_css<W>(range: Option<i32>, dest: &mut W) -> fmt::Result where W: fmt
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-pad
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||
#[derive(Clone, Debug, ToCss)]
|
||||
pub struct Pad(pub u32, pub Symbol);
|
||||
|
||||
|
@ -483,7 +483,7 @@ impl Parse for Pad {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-fallback
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-fallback>
|
||||
#[derive(Clone, Debug, ToCss)]
|
||||
pub struct Fallback(pub CustomIdent);
|
||||
|
||||
|
@ -493,7 +493,7 @@ impl Parse for Fallback {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||
pub struct Symbols(pub Vec<Symbol>);
|
||||
|
@ -528,7 +528,7 @@ impl ToCss for Symbols {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
|
||||
#[derive(Clone, Debug, ToCss)]
|
||||
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
|
||||
|
||||
|
@ -571,7 +571,7 @@ impl Parse for AdditiveTuple {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as>
|
||||
#[derive(Clone, Debug, ToCss)]
|
||||
pub enum SpeakAs {
|
||||
/// auto
|
||||
|
|
|
@ -28,7 +28,7 @@ pub type Name = Atom;
|
|||
|
||||
/// Parse a custom property name.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-variables/#typedef-custom-property-name
|
||||
/// <https://drafts.csswg.org/css-variables/#typedef-custom-property-name>
|
||||
pub fn parse_name(s: &str) -> Result<&str, ()> {
|
||||
if s.starts_with("--") {
|
||||
Ok(&s[2..])
|
||||
|
@ -317,7 +317,7 @@ fn parse_self_contained_declaration_value<'i, 't>(
|
|||
Ok((first, css, last))
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value
|
||||
/// <https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value>
|
||||
fn parse_declaration_value<'i, 't>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
references: Option<&mut PrecomputedHashSet<Name>>,
|
||||
|
|
|
@ -9,7 +9,7 @@ use context::QuirksMode;
|
|||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-element-matches
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-matches>
|
||||
pub fn element_matches<E>(
|
||||
element: &E,
|
||||
selector_list: &SelectorList<E::Impl>,
|
||||
|
@ -28,7 +28,7 @@ where
|
|||
matching::matches_selector_list(selector_list, element, &mut context)
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#dom-element-closest
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-closest>
|
||||
pub fn element_closest<E>(
|
||||
element: E,
|
||||
selector_list: &SelectorList<E::Impl>,
|
||||
|
|
|
@ -18,35 +18,35 @@ bitflags! {
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub flags ElementState: u64 {
|
||||
/// The mouse is down on this element.
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-active
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-active>
|
||||
/// FIXME(#7333): set/unset this when appropriate
|
||||
const IN_ACTIVE_STATE = 1 << 0,
|
||||
/// This element has focus.
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-focus
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-focus>
|
||||
const IN_FOCUS_STATE = 1 << 1,
|
||||
/// The mouse is hovering over this element.
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-hover
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-hover>
|
||||
const IN_HOVER_STATE = 1 << 2,
|
||||
/// Content is enabled (and can be disabled).
|
||||
/// http://www.whatwg.org/html/#selector-enabled
|
||||
/// <http://www.whatwg.org/html/#selector-enabled>
|
||||
const IN_ENABLED_STATE = 1 << 3,
|
||||
/// Content is disabled.
|
||||
/// http://www.whatwg.org/html/#selector-disabled
|
||||
/// <http://www.whatwg.org/html/#selector-disabled>
|
||||
const IN_DISABLED_STATE = 1 << 4,
|
||||
/// Content is checked.
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-checked
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-checked>
|
||||
const IN_CHECKED_STATE = 1 << 5,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-indeterminate
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-indeterminate>
|
||||
const IN_INDETERMINATE_STATE = 1 << 6,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-placeholder-shown
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-placeholder-shown>
|
||||
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-target
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-target>
|
||||
const IN_TARGET_STATE = 1 << 8,
|
||||
/// https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class
|
||||
/// <https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class>
|
||||
const IN_FULLSCREEN_STATE = 1 << 9,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-valid
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-valid>
|
||||
const IN_VALID_STATE = 1 << 10,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-invalid
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-invalid>
|
||||
const IN_INVALID_STATE = 1 << 11,
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid
|
||||
const IN_MOZ_UI_VALID_STATE = 1 << 12,
|
||||
|
@ -66,31 +66,31 @@ bitflags! {
|
|||
const IN_HANDLER_DISABLED_STATE = 1 << 19,
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed
|
||||
const IN_HANDLER_CRASHED_STATE = 1 << 20,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-required
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-required>
|
||||
const IN_REQUIRED_STATE = 1 << 21,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-optional
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
|
||||
const IN_OPTIONAL_STATE = 1 << 22,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-read-write
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||
const IN_READ_WRITE_STATE = 1 << 22,
|
||||
/// Non-standard: Older custom-elements spec.
|
||||
const IN_UNRESOLVED_STATE = 1 << 23,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-visited
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-visited>
|
||||
const IN_VISITED_STATE = 1 << 24,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-link
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-link>
|
||||
const IN_UNVISITED_STATE = 1 << 25,
|
||||
/// https://drafts.csswg.org/selectors-4/#the-any-link-pseudo
|
||||
/// <https://drafts.csswg.org/selectors-4/#the-any-link-pseudo>
|
||||
const IN_VISITED_OR_UNVISITED_STATE = IN_VISITED_STATE.bits | IN_UNVISITED_STATE.bits,
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
|
||||
const IN_DRAGOVER_STATE = 1 << 26,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-in-range
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-in-range>
|
||||
const IN_INRANGE_STATE = 1 << 27,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-out-of-range
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-out-of-range>
|
||||
const IN_OUTOFRANGE_STATE = 1 << 28,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-read-only
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-only>
|
||||
const IN_MOZ_READONLY_STATE = 1 << 29,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-read-write
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||
const IN_MOZ_READWRITE_STATE = 1 << 30,
|
||||
/// https://html.spec.whatwg.org/multipage/#selector-default
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-default>
|
||||
const IN_DEFAULT_STATE = 1 << 31,
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid
|
||||
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32,
|
||||
|
@ -114,7 +114,7 @@ bitflags! {
|
|||
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41,
|
||||
/// Non-standard & undocumented.
|
||||
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42,
|
||||
/// https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo
|
||||
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
|
||||
const IN_FOCUS_WITHIN_STATE = 1 << 43,
|
||||
/// :dir matching; the states are used for dynamic change detection.
|
||||
/// State that elements that match :dir(ltr) are in.
|
||||
|
|
|
@ -43,7 +43,7 @@ impl OneOrMoreSeparated for Source {
|
|||
/// A `UrlSource` represents a font-face source that has been specified with a
|
||||
/// `url()` function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts/#src-desc
|
||||
/// <https://drafts.csswg.org/css-fonts/#src-desc>
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct UrlSource {
|
||||
|
@ -235,7 +235,7 @@ macro_rules! font_face_descriptors_common {
|
|||
) => {
|
||||
/// Data inside a `@font-face` rule.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts/#font-face-rule
|
||||
/// <https://drafts.csswg.org/css-fonts/#font-face-rule>
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct FontFaceRuleData {
|
||||
$(
|
||||
|
|
|
@ -57,7 +57,7 @@ pub struct Device {
|
|||
/// The body text color, stored as an `nscolor`, used for the "tables
|
||||
/// inherit from body" quirk.
|
||||
///
|
||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||
body_text_color: AtomicUsize,
|
||||
/// Whether any styles computed in the document relied on the root font-size
|
||||
/// by using rem units.
|
||||
|
@ -118,7 +118,7 @@ impl Device {
|
|||
|
||||
/// Sets the body text color for the "inherit color from body" quirk.
|
||||
///
|
||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||
pub fn set_body_text_color(&self, color: RGBA) {
|
||||
self.body_text_color.store(convert_rgba_to_nscolor(&color) as usize, Ordering::Relaxed)
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ impl NonTSPseudoClass {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/selectors-4/#useraction-pseudos
|
||||
/// <https://drafts.csswg.org/selectors-4/#useraction-pseudos>
|
||||
///
|
||||
/// We intentionally skip the link-related ones.
|
||||
pub fn is_safe_user_action_state(&self) -> bool {
|
||||
|
|
|
@ -47,15 +47,15 @@ impl MediaList {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/mediaqueries/#mq-prefix
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
||||
pub enum Qualifier {
|
||||
/// Hide a media query from legacy UAs:
|
||||
/// https://drafts.csswg.org/mediaqueries/#mq-only
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-only>
|
||||
Only,
|
||||
/// Negate a media query:
|
||||
/// https://drafts.csswg.org/mediaqueries/#mq-not
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-not>
|
||||
Not,
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ impl ToCss for MediaQuery {
|
|||
}
|
||||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media0
|
||||
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum MediaQueryType {
|
||||
|
@ -162,7 +162,7 @@ impl MediaQueryType {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/mediaqueries/#media-types
|
||||
/// <https://drafts.csswg.org/mediaqueries/#media-types>
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct MediaType(pub CustomIdent);
|
||||
|
@ -241,7 +241,7 @@ impl MediaQuery {
|
|||
/// Always returns a media query list. If any invalid media query is found, the
|
||||
/// media query list is only filled with the equivalent of "not all", see:
|
||||
///
|
||||
/// https://drafts.csswg.org/mediaqueries/#error-handling
|
||||
/// <https://drafts.csswg.org/mediaqueries/#error-handling>
|
||||
pub fn parse_media_query_list<R>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser,
|
||||
|
@ -311,7 +311,7 @@ impl MediaList {
|
|||
}
|
||||
|
||||
/// Append a new media query item to the media list.
|
||||
/// https://drafts.csswg.org/cssom/#dom-medialist-appendmedium
|
||||
/// <https://drafts.csswg.org/cssom/#dom-medialist-appendmedium>
|
||||
///
|
||||
/// Returns true if added, false if fail to parse the medium string.
|
||||
pub fn append_medium(&mut self, context: &ParserContext, new_medium: &str) -> bool {
|
||||
|
@ -330,7 +330,7 @@ impl MediaList {
|
|||
}
|
||||
|
||||
/// Delete a media query from the media list.
|
||||
/// https://drafts.csswg.org/cssom/#dom-medialist-deletemedium
|
||||
/// <https://drafts.csswg.org/cssom/#dom-medialist-deletemedium>
|
||||
///
|
||||
/// Returns true if found and deleted, false otherwise.
|
||||
pub fn delete_medium(&mut self, context: &ParserContext, old_medium: &str) -> bool {
|
||||
|
|
|
@ -308,7 +308,7 @@ impl PropertyDeclarationBlock {
|
|||
|
||||
/// Find the value of the given property in this block and serialize it
|
||||
///
|
||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
|
||||
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue>
|
||||
pub fn property_value_to_css<W>(&self, property: &PropertyId, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write,
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ impl PropertyDeclarationBlock {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority
|
||||
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority>
|
||||
pub fn property_priority(&self, property: &PropertyId) -> Importance {
|
||||
// Step 1: done when parsing a string to PropertyId
|
||||
|
||||
|
@ -560,7 +560,7 @@ impl PropertyDeclarationBlock {
|
|||
updated_at_least_one
|
||||
}
|
||||
|
||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty>
|
||||
///
|
||||
/// Returns whether any declaration was actually removed.
|
||||
pub fn remove_property(&mut self, property: &PropertyId) -> bool {
|
||||
|
|
|
@ -57,7 +57,7 @@ use values::generics::position as generic_position;
|
|||
use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint};
|
||||
use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity};
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-repeatable-list
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-repeatable-list>
|
||||
pub trait RepeatableListAnimatable: Animate {}
|
||||
|
||||
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
|
||||
|
@ -655,7 +655,7 @@ macro_rules! repeated_vec_impl {
|
|||
|
||||
repeated_vec_impl!(SmallVec<[T; 1]>, Vec<T>);
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-visibility
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-visibility>
|
||||
impl Animate for Visibility {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -686,7 +686,7 @@ impl ToAnimatedZero for Visibility {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
impl Animate for CalcLengthOrPercentage {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -738,7 +738,7 @@ impl ToAnimatedZero for MaxLength {
|
|||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/css-transitions/#animtype-font-weight
|
||||
/// <http://dev.w3.org/csswg/css-transitions/#animtype-font-weight>
|
||||
impl Animate for FontWeight {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -759,7 +759,7 @@ impl ToAnimatedZero for FontWeight {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-fonts/#font-stretch-prop
|
||||
/// <https://drafts.csswg.org/css-fonts/#font-stretch-prop>
|
||||
impl Animate for FontStretch {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
|
||||
|
@ -786,7 +786,7 @@ impl ToAnimatedZero for FontStretch {
|
|||
}
|
||||
|
||||
/// We should treat font stretch as real number in order to interpolate this property.
|
||||
/// https://drafts.csswg.org/css-fonts-3/#font-stretch-animation
|
||||
/// <https://drafts.csswg.org/css-fonts-3/#font-stretch-animation>
|
||||
impl From<FontStretch> for f64 {
|
||||
fn from(stretch: FontStretch) -> f64 {
|
||||
use self::FontStretch::*;
|
||||
|
@ -815,7 +815,7 @@ impl Into<FontStretch> for f64 {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def
|
||||
/// <https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def>
|
||||
#[cfg(feature = "gecko")]
|
||||
impl Animate for FontVariationSettings {
|
||||
#[inline]
|
||||
|
@ -989,7 +989,7 @@ impl<'a> Iterator for FontSettingTagIter<'a> {
|
|||
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
|
||||
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-rect
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-rect>
|
||||
impl Animate for ClipRect {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -1018,7 +1018,7 @@ impl ToAnimatedZero for ClipRect {
|
|||
|
||||
/// Build an equivalent 'identity transform function list' based
|
||||
/// on an existing transform list.
|
||||
/// http://dev.w3.org/csswg/css-transforms/#none-transform-animation
|
||||
/// <http://dev.w3.org/csswg/css-transforms/#none-transform-animation>
|
||||
impl ToAnimatedZero for TransformOperation {
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
match *self {
|
||||
|
@ -1078,7 +1078,7 @@ fn animate_multiplicative_factor(
|
|||
Ok((this - 1.).animate(&(other - 1.), procedure)? + 1.)
|
||||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms
|
||||
/// <http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms>
|
||||
impl Animate for TransformOperation {
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
match (self, other) {
|
||||
|
@ -1159,7 +1159,7 @@ impl Animate for TransformOperation {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined
|
||||
/// <https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined>
|
||||
fn rotate_to_matrix(x: f32, y: f32, z: f32, a: Angle) -> ComputedMatrix {
|
||||
let half_rad = a.radians() / 2.0;
|
||||
let sc = (half_rad).sin() * (half_rad).cos();
|
||||
|
@ -1246,7 +1246,7 @@ impl Animate for Scale2D {
|
|||
}
|
||||
|
||||
impl Animate for MatrixDecomposed2D {
|
||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values
|
||||
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values>
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
// If x-axis of one is flipped, and y-axis of the other,
|
||||
// convert to an unflipped rotation.
|
||||
|
@ -1375,7 +1375,7 @@ impl ComputeSquaredDistance for ComputedMatrix {
|
|||
|
||||
impl From<ComputedMatrix> for MatrixDecomposed2D {
|
||||
/// Decompose a 2D matrix.
|
||||
/// https://drafts.csswg.org/css-transforms/#decomposing-a-2d-matrix
|
||||
/// <https://drafts.csswg.org/css-transforms/#decomposing-a-2d-matrix>
|
||||
fn from(matrix: ComputedMatrix) -> MatrixDecomposed2D {
|
||||
let mut row0x = matrix.m11;
|
||||
let mut row0y = matrix.m12;
|
||||
|
@ -1439,7 +1439,7 @@ impl From<ComputedMatrix> for MatrixDecomposed2D {
|
|||
|
||||
impl From<MatrixDecomposed2D> for ComputedMatrix {
|
||||
/// Recompose a 2D matrix.
|
||||
/// https://drafts.csswg.org/css-transforms/#recomposing-to-a-2d-matrix
|
||||
/// <https://drafts.csswg.org/css-transforms/#recomposing-to-a-2d-matrix>
|
||||
fn from(decomposed: MatrixDecomposed2D) -> ComputedMatrix {
|
||||
let mut computed_matrix = ComputedMatrix::identity();
|
||||
computed_matrix.m11 = decomposed.matrix.m11;
|
||||
|
@ -1577,7 +1577,7 @@ impl ComputeSquaredDistance for Quaternion {
|
|||
}
|
||||
|
||||
/// Decompose a 3D matrix.
|
||||
/// https://drafts.csswg.org/css-transforms/#decomposing-a-3d-matrix
|
||||
/// <https://drafts.csswg.org/css-transforms/#decomposing-a-3d-matrix>
|
||||
fn decompose_3d_matrix(mut matrix: ComputedMatrix) -> Result<MatrixDecomposed3D, ()> {
|
||||
// Normalize the matrix.
|
||||
if matrix.m44 == 0.0 {
|
||||
|
@ -1829,7 +1829,7 @@ impl Animate for Perspective {
|
|||
}
|
||||
|
||||
impl Animate for MatrixDecomposed3D {
|
||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values
|
||||
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values>
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
use std::f64;
|
||||
|
||||
|
@ -1911,7 +1911,7 @@ impl Animate for MatrixDecomposed3D {
|
|||
|
||||
impl From<MatrixDecomposed3D> for ComputedMatrix {
|
||||
/// Recompose a 3D matrix.
|
||||
/// https://drafts.csswg.org/css-transforms/#recomposing-to-a-3d-matrix
|
||||
/// <https://drafts.csswg.org/css-transforms/#recomposing-to-a-3d-matrix>
|
||||
fn from(decomposed: MatrixDecomposed3D) -> ComputedMatrix {
|
||||
let mut matrix = ComputedMatrix::identity();
|
||||
|
||||
|
@ -2106,7 +2106,7 @@ impl ComputedMatrix {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-transforms
|
||||
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-transforms>
|
||||
impl Animate for TransformList {
|
||||
#[inline]
|
||||
fn animate(
|
||||
|
@ -2463,7 +2463,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty>
|
||||
impl<L> Animate for SVGStrokeDashArray<L>
|
||||
where
|
||||
L: Clone + RepeatableListAnimatable,
|
||||
|
@ -2521,7 +2521,7 @@ where
|
|||
'Sepia' ]
|
||||
%>
|
||||
|
||||
/// https://drafts.fxtf.org/filters/#animation-of-filters
|
||||
/// <https://drafts.fxtf.org/filters/#animation-of-filters>
|
||||
impl Animate for AnimatedFilter {
|
||||
fn animate(
|
||||
&self,
|
||||
|
@ -2553,7 +2553,7 @@ impl Animate for AnimatedFilter {
|
|||
}
|
||||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/css-transforms/#none-transform-animation
|
||||
/// <http://dev.w3.org/csswg/css-transforms/#none-transform-animation>
|
||||
impl ToAnimatedZero for AnimatedFilter {
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
match *self {
|
||||
|
|
|
@ -1623,7 +1623,7 @@ impl PropertyDeclaration {
|
|||
|
||||
/// The `context` parameter controls this:
|
||||
///
|
||||
/// https://drafts.csswg.org/css-animations/#keyframes
|
||||
/// <https://drafts.csswg.org/css-animations/#keyframes>
|
||||
/// > The <declaration-list> inside of <keyframe-block> accepts any CSS property
|
||||
/// > except those defined in this specification,
|
||||
/// > but does accept the `animation-play-state` property and interprets it specially.
|
||||
|
@ -2377,7 +2377,7 @@ impl ComputedValuesInner {
|
|||
effects.mix_blend_mode != mix_blend_mode::T::normal
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transforms/#grouping-property-values
|
||||
/// <https://drafts.csswg.org/css-transforms/#grouping-property-values>
|
||||
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
|
||||
use computed_values::transform_style;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ impl Device {
|
|||
|
||||
/// Sets the body text color for the "inherit color from body" quirk.
|
||||
///
|
||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||
pub fn set_body_text_color(&self, _color: RGBA) {
|
||||
// Servo doesn't implement this quirk (yet)
|
||||
}
|
||||
|
@ -155,13 +155,13 @@ impl Device {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum ExpressionKind {
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#width
|
||||
/// <http://dev.w3.org/csswg/mediaqueries-3/#width>
|
||||
Width(Range<specified::Length>),
|
||||
}
|
||||
|
||||
/// A single expression a per:
|
||||
///
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media1
|
||||
/// <http://dev.w3.org/csswg/mediaqueries-3/#media1>
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Expression(pub ExpressionKind);
|
||||
|
|
|
@ -21,7 +21,7 @@ use values::computed::{Context, ToComputedValue, ComputedUrl};
|
|||
/// eagerly resolving with rust-url would be duplicated work.
|
||||
///
|
||||
/// However, this approach is still not necessarily optimal: See
|
||||
/// https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6
|
||||
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6>
|
||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
||||
pub struct SpecifiedUrl {
|
||||
/// The original URI. This might be optional since we may insert computed
|
||||
|
|
|
@ -21,7 +21,7 @@ pub type StaticStringVec = &'static [&'static str];
|
|||
|
||||
/// A "space character" according to:
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#space-character
|
||||
/// <https://html.spec.whatwg.org/multipage/#space-character>
|
||||
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
||||
'\u{0020}',
|
||||
'\u{0009}',
|
||||
|
|
|
@ -30,7 +30,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://fullscreen.spec.whatwg.org/#new-stacking-layer
|
||||
/// <https://fullscreen.spec.whatwg.org/#new-stacking-layer>
|
||||
///
|
||||
/// Any position value other than 'absolute' and 'fixed' are
|
||||
/// computed to 'absolute' if the element is in a top layer.
|
||||
|
@ -53,7 +53,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Apply the blockification rules based on the table in CSS 2.2 section 9.7.
|
||||
/// https://drafts.csswg.org/css2/visuren.html#dis-pos-flo
|
||||
/// <https://drafts.csswg.org/css2/visuren.html#dis-pos-flo>
|
||||
fn blockify_if_necessary(
|
||||
&mut self,
|
||||
layout_parent_style: &ComputedValues,
|
||||
|
@ -160,7 +160,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-writing-modes-3/#block-flow:
|
||||
/// <https://drafts.csswg.org/css-writing-modes-3/#block-flow:>
|
||||
///
|
||||
/// If a box has a different writing-mode value than its containing
|
||||
/// block:
|
||||
|
@ -171,8 +171,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// This matches the adjustment that Gecko does, not exactly following
|
||||
/// the spec. See also:
|
||||
///
|
||||
/// https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html
|
||||
/// https://github.com/servo/servo/issues/15754
|
||||
/// <https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html>
|
||||
/// <https://github.com/servo/servo/issues/15754>
|
||||
fn adjust_for_writing_mode(
|
||||
&mut self,
|
||||
layout_parent_style: &ComputedValues,
|
||||
|
@ -519,7 +519,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// Resolves "justify-items: auto" based on the inherited style if needed to
|
||||
/// comply with:
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#valdef-justify-items-legacy
|
||||
/// <https://drafts.csswg.org/css-align/#valdef-justify-items-legacy>
|
||||
///
|
||||
/// (Note that "auto" is being renamed to "legacy")
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -194,7 +194,7 @@ impl ToCss for UrlMatchingFunction {
|
|||
|
||||
/// A `@document` rule's condition.
|
||||
///
|
||||
/// https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document
|
||||
/// <https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document>
|
||||
///
|
||||
/// The `@document` rule's condition is written as a comma-separated list of
|
||||
/// URL matching functions, and the condition evaluates to true whenever any
|
||||
|
|
|
@ -58,7 +58,7 @@ impl KeyframesRule {
|
|||
/// If the selector is not valid, or no keyframe is found, returns None.
|
||||
///
|
||||
/// Related spec:
|
||||
/// https://drafts.csswg.org/css-animations-1/#interface-csskeyframesrule-findrule
|
||||
/// <https://drafts.csswg.org/css-animations-1/#interface-csskeyframesrule-findrule>
|
||||
pub fn find_rule(&self, guard: &SharedRwLockReadGuard, selector: &str) -> Option<usize> {
|
||||
let mut input = ParserInput::new(selector);
|
||||
if let Ok(selector) = Parser::new(&mut input).parse_entirely(KeyframeSelector::parse) {
|
||||
|
|
|
@ -9,18 +9,18 @@ use std::ops::BitOrAssign;
|
|||
|
||||
/// Each style rule has an origin, which determines where it enters the cascade.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-cascade/#cascading-origins
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascading-origins>
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Origin {
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
|
||||
UserAgent = 1 << 0,
|
||||
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-user
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user>
|
||||
User = 1 << 1,
|
||||
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-author
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-author>
|
||||
Author = 1 << 2,
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,11 @@ bitflags! {
|
|||
/// A set of origins. This is equivalent to Gecko's OriginFlags.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub flags OriginSet: u8 {
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
|
||||
const ORIGIN_USER_AGENT = Origin::UserAgent as u8,
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-user
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user>
|
||||
const ORIGIN_USER = Origin::User as u8,
|
||||
/// https://drafts.csswg.org/css-cascade/#cascade-origin-author
|
||||
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-author>
|
||||
const ORIGIN_AUTHOR = Origin::Author as u8,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ impl CssRules {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom/#remove-a-css-rule
|
||||
/// <https://drafts.csswg.org/cssom/#remove-a-css-rule>
|
||||
pub fn remove_rule(&mut self, index: usize) -> Result<(), RulesMutateError> {
|
||||
// Step 1, 2
|
||||
if index >= self.0.len() {
|
||||
|
@ -92,7 +92,7 @@ impl CssRules {
|
|||
|
||||
/// A trait to implement helpers for `Arc<Locked<CssRules>>`.
|
||||
pub trait CssRulesHelpers {
|
||||
/// https://drafts.csswg.org/cssom/#insert-a-css-rule
|
||||
/// <https://drafts.csswg.org/cssom/#insert-a-css-rule>
|
||||
///
|
||||
/// Written in this funky way because parsing an @import rule may cause us
|
||||
/// to clone a stylesheet from the same document due to caching in the CSS
|
||||
|
|
|
@ -75,7 +75,7 @@ impl DeepCloneWithLock for SupportsRule {
|
|||
|
||||
/// An @supports condition
|
||||
///
|
||||
/// https://drafts.csswg.org/css-conditional-3/#at-supports
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#at-supports>
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum SupportsCondition {
|
||||
/// `not (condition)`
|
||||
|
@ -95,7 +95,7 @@ pub enum SupportsCondition {
|
|||
impl SupportsCondition {
|
||||
/// Parse a condition
|
||||
///
|
||||
/// https://drafts.csswg.org/css-conditional/#supports_condition
|
||||
/// <https://drafts.csswg.org/css-conditional/#supports_condition>
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<SupportsCondition, ParseError<'i>> {
|
||||
if let Ok(_) = input.try(|i| i.expect_ident_matching("not")) {
|
||||
let inner = SupportsCondition::parse_in_parens(input)?;
|
||||
|
@ -133,7 +133,7 @@ impl SupportsCondition {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-conditional-3/#supports_condition_in_parens
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#supports_condition_in_parens>
|
||||
fn parse_in_parens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<SupportsCondition, 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.
|
||||
|
@ -171,7 +171,7 @@ impl SupportsCondition {
|
|||
}
|
||||
|
||||
/// supports_condition | declaration
|
||||
/// https://drafts.csswg.org/css-conditional/#dom-css-supports-conditiontext-conditiontext
|
||||
/// <https://drafts.csswg.org/css-conditional/#dom-css-supports-conditiontext-conditiontext>
|
||||
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) {
|
||||
|
@ -237,7 +237,7 @@ impl ToCss for Declaration {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-syntax-3/#typedef-any-value
|
||||
/// <https://drafts.csswg.org/css-syntax-3/#typedef-any-value>
|
||||
fn consume_any_value<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(), ParseError<'i>> {
|
||||
input.expect_no_error_token().map_err(|err| err.into())
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ impl Declaration {
|
|||
|
||||
/// Determine if a declaration parses
|
||||
///
|
||||
/// https://drafts.csswg.org/css-conditional-3/#support-definition
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#support-definition>
|
||||
pub fn eval(&self, context: &ParserContext) -> bool {
|
||||
debug_assert_eq!(context.rule_type(), CssRuleType::Style);
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ impl ToCssWithGuard for ViewportRule {
|
|||
}
|
||||
|
||||
/// Computes the cascade precedence as according to
|
||||
/// http://dev.w3.org/csswg/css-cascade/#cascade-origin
|
||||
/// <http://dev.w3.org/csswg/css-cascade/#cascade-origin>
|
||||
fn cascade_precendence(origin: Origin, important: bool) -> u8 {
|
||||
match (origin, important) {
|
||||
(Origin::UserAgent, true) => 1,
|
||||
|
|
|
@ -27,7 +27,7 @@ pub type TextShadowList = ShadowList<SimpleShadow>;
|
|||
|
||||
/// An animated value for shadow lists.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-shadow-list
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-shadow-list>
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ShadowList<Shadow>(Vec<Shadow>);
|
||||
|
|
|
@ -48,15 +48,15 @@ pub trait Animate: Sized {
|
|||
|
||||
/// An animation procedure.
|
||||
///
|
||||
/// https://w3c.github.io/web-animations/#procedures-for-animating-properties
|
||||
/// <https://w3c.github.io/web-animations/#procedures-for-animating-properties>
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum Procedure {
|
||||
/// https://w3c.github.io/web-animations/#animation-interpolation
|
||||
/// <https://w3c.github.io/web-animations/#animation-interpolation>
|
||||
Interpolate { progress: f64 },
|
||||
/// https://w3c.github.io/web-animations/#animation-addition
|
||||
/// <https://w3c.github.io/web-animations/#animation-addition>
|
||||
Add,
|
||||
/// https://w3c.github.io/web-animations/#animation-accumulation
|
||||
/// <https://w3c.github.io/web-animations/#animation-accumulation>
|
||||
Accumulate { count: u64 },
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ impl Procedure {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-number
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-number>
|
||||
impl Animate for i32 {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -121,7 +121,7 @@ impl Animate for i32 {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-number
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-number>
|
||||
impl Animate for f32 {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
@ -132,7 +132,7 @@ impl Animate for f32 {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-number
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-number>
|
||||
impl Animate for f64 {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
|
|
|
@ -46,7 +46,7 @@ impl JustifyItems {
|
|||
impl ToComputedValue for specified::JustifyItems {
|
||||
type ComputedValue = JustifyItems;
|
||||
|
||||
/// https://drafts.csswg.org/css-align/#valdef-justify-items-legacy
|
||||
/// <https://drafts.csswg.org/css-align/#valdef-justify-items-legacy>
|
||||
fn to_computed_value(&self, _context: &Context) -> JustifyItems {
|
||||
use values::specified::align;
|
||||
let specified = *self;
|
||||
|
|
|
@ -67,7 +67,7 @@ impl Angle {
|
|||
Angle::Radian(0.0)
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-number
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-number>
|
||||
#[inline]
|
||||
fn animate_fallback(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
Ok(Angle::from_radians(self.radians().animate(&other.radians(), procedure)?))
|
||||
|
|
|
@ -27,11 +27,11 @@ use values::specified::position::{X, Y};
|
|||
pub type ImageLayer = Either<None_, Image>;
|
||||
|
||||
/// Computed values for an image according to CSS-IMAGES.
|
||||
/// https://drafts.csswg.org/css-images/#image-values
|
||||
/// <https://drafts.csswg.org/css-images/#image-values>
|
||||
pub type Image = GenericImage<Gradient, MozImageRect, ComputedUrl>;
|
||||
|
||||
/// Computed values for a CSS gradient.
|
||||
/// https://drafts.csswg.org/css-images/#gradients
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
pub type Gradient = GenericGradient<
|
||||
LineDirection,
|
||||
Length,
|
||||
|
|
|
@ -307,7 +307,7 @@ pub enum LengthOrPercentage {
|
|||
}
|
||||
|
||||
impl LengthOrPercentage {
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
fn animate_fallback(
|
||||
&self,
|
||||
other: &Self,
|
||||
|
@ -465,7 +465,7 @@ pub enum LengthOrPercentageOrAuto {
|
|||
}
|
||||
|
||||
impl LengthOrPercentageOrAuto {
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
fn animate_fallback(
|
||||
&self,
|
||||
other: &Self,
|
||||
|
@ -561,7 +561,7 @@ pub enum LengthOrPercentageOrNone {
|
|||
}
|
||||
|
||||
impl LengthOrPercentageOrNone {
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
fn animate_fallback(
|
||||
&self,
|
||||
other: &Self,
|
||||
|
|
|
@ -37,7 +37,7 @@ impl SVGPaint {
|
|||
}
|
||||
|
||||
/// A value of <length> | <percentage> | <number> for stroke-dashoffset.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
|
||||
pub type SvgLengthOrPercentageOrNumber =
|
||||
generic::SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number>;
|
||||
|
||||
|
@ -52,7 +52,7 @@ impl From<Au> for SVGLength {
|
|||
}
|
||||
|
||||
/// A value of <length> | <percentage> | <number> for stroke-width/stroke-dasharray.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
|
||||
pub type NonNegativeSvgLengthOrPercentageOrNumber =
|
||||
generic::SvgLengthOrPercentageOrNumber<NonNegativeLengthOrPercentage, NonNegativeNumber>;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use values::generics::rect::Rect;
|
|||
/// A clipping shape, for `clip-path`.
|
||||
pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, Url>;
|
||||
|
||||
/// https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
|
||||
/// <https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box>
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -71,7 +71,7 @@ pub enum BasicShape<H, V, LengthOrPercentage> {
|
|||
Polygon(Polygon<LengthOrPercentage>),
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-inset
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -81,7 +81,7 @@ pub struct InsetRect<LengthOrPercentage> {
|
|||
pub round: Option<BorderRadius<LengthOrPercentage>>,
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-circle
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -91,7 +91,7 @@ pub struct Circle<H, V, LengthOrPercentage> {
|
|||
pub radius: ShapeRadius<LengthOrPercentage>,
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-ellipse
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -102,7 +102,7 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
|
|||
pub semiaxis_y: ShapeRadius<LengthOrPercentage>,
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
||||
/// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius>
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -121,7 +121,7 @@ pub enum ShapeRadius<LengthOrPercentage> {
|
|||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
/// A generic type for representing the `polygon()` function
|
||||
///
|
||||
/// https://drafts.csswg.org/css-shapes/#funcdef-polygon
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
|
||||
pub struct Polygon<LengthOrPercentage> {
|
||||
/// The filling rule for a polygon.
|
||||
pub fill: FillRule,
|
||||
|
|
|
@ -63,7 +63,7 @@ impl<L> BorderSpacing<L> {
|
|||
|
||||
/// A generic value for `border-radius`, `outline-radius` and `inset()`.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||
/// <https://drafts.csswg.org/css-backgrounds-3/#border-radius>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
|
||||
|
|
|
@ -16,7 +16,7 @@ use values::specified::grid::parse_line_names;
|
|||
|
||||
/// A `<grid-line>` type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, ToComputedValue)]
|
||||
|
@ -25,7 +25,7 @@ pub struct GridLine<Integer> {
|
|||
pub is_span: bool,
|
||||
/// A custom identifier for named lines.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#grid-placement-slot
|
||||
/// <https://drafts.csswg.org/css-grid/#grid-placement-slot>
|
||||
pub ident: Option<CustomIdent>,
|
||||
/// Denotes the nth grid line from grid item's placement.
|
||||
pub line_num: Option<Integer>,
|
||||
|
@ -144,7 +144,7 @@ add_impls_for_keyword_enum!(TrackKeyword);
|
|||
/// A track breadth for explicit grid track sizing. It's generic solely to
|
||||
/// avoid re-implementing it for the computed type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-breadth
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-breadth>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
|
@ -160,7 +160,7 @@ pub enum TrackBreadth<L> {
|
|||
impl<L> TrackBreadth<L> {
|
||||
/// Check whether this is a `<fixed-breadth>` (i.e., it only has `<length-percentage>`)
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-fixed-breadth
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-fixed-breadth>
|
||||
#[inline]
|
||||
pub fn is_fixed(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -183,7 +183,7 @@ impl<L: ToCss> ToCss for TrackBreadth<L> {
|
|||
/// A `<track-size>` type for explicit grid track sizing. Like `<track-breadth>`, this is
|
||||
/// generic only to avoid code bloat. It only takes `<length-percentage>`
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-size
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
@ -193,18 +193,18 @@ pub enum TrackSize<L> {
|
|||
/// A `minmax` function for a range over an inflexible `<track-breadth>`
|
||||
/// and a flexible `<track-breadth>`
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax
|
||||
/// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax>
|
||||
Minmax(TrackBreadth<L>, TrackBreadth<L>),
|
||||
/// A `fit-content` function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content
|
||||
/// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content>
|
||||
FitContent(L),
|
||||
}
|
||||
|
||||
impl<L> TrackSize<L> {
|
||||
/// Check whether this is a `<fixed-size>`
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-fixed-size
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-fixed-size>
|
||||
pub fn is_fixed(&self) -> bool {
|
||||
match *self {
|
||||
TrackSize::Breadth(ref breadth) => breadth.is_fixed(),
|
||||
|
@ -347,7 +347,7 @@ where
|
|||
|
||||
/// The initial argument of the `repeat` function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-repeat
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
|
@ -477,7 +477,7 @@ pub enum TrackListValue<LengthOrPercentage, Integer> {
|
|||
|
||||
/// The type of a `<track-list>` as determined during parsing.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-list
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -501,7 +501,7 @@ pub enum TrackListType {
|
|||
|
||||
/// A grid `<track-list>` type.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-list
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
|
|
@ -30,13 +30,13 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
|||
/// A `-moz-element(# <element-id>)`
|
||||
Element(Atom),
|
||||
/// A paint worklet image.
|
||||
/// https://drafts.css-houdini.org/css-paint-api/
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/>
|
||||
#[cfg(feature = "servo")]
|
||||
PaintWorklet(PaintWorklet),
|
||||
}
|
||||
|
||||
/// A CSS gradient.
|
||||
/// https://drafts.csswg.org/css-images/#gradients
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
|
||||
|
@ -110,7 +110,7 @@ pub enum Ellipse<LengthOrPercentage> {
|
|||
Extent(ShapeExtent),
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-images/#typedef-extent-keyword
|
||||
/// <https://drafts.csswg.org/css-images/#typedef-extent-keyword>
|
||||
define_css_keyword_enum!(ShapeExtent:
|
||||
"closest-side" => ClosestSide,
|
||||
"farthest-side" => FarthestSide,
|
||||
|
@ -122,7 +122,7 @@ define_css_keyword_enum!(ShapeExtent:
|
|||
add_impls_for_keyword_enum!(ShapeExtent);
|
||||
|
||||
/// A gradient item.
|
||||
/// https://drafts.csswg.org/css-images-4/#color-stop-syntax
|
||||
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
|
@ -134,7 +134,7 @@ pub enum GradientItem<Color, LengthOrPercentage> {
|
|||
}
|
||||
|
||||
/// A color stop.
|
||||
/// https://drafts.csswg.org/css-images/#typedef-color-stop-list
|
||||
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
|
||||
#[derive(Clone, Copy, PartialEq, ToComputedValue, ToCss)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -146,7 +146,7 @@ pub struct ColorStop<Color, LengthOrPercentage> {
|
|||
}
|
||||
|
||||
/// Specified values for a paint worklet.
|
||||
/// https://drafts.css-houdini.org/css-paint-api/
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/>
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct PaintWorklet {
|
||||
|
|
|
@ -68,7 +68,7 @@ impl SymbolsType {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#typedef-counter-style
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#typedef-counter-style>
|
||||
///
|
||||
/// Since wherever <counter-style> is used, 'none' is a valid value as
|
||||
/// well, we combine them into one type to make code simpler.
|
||||
|
@ -159,8 +159,8 @@ impl<T: ToCss> ToCss for FontSettingTag<T> {
|
|||
}
|
||||
|
||||
impl<T: Parse> Parse for FontSettingTag<T> {
|
||||
/// https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings
|
||||
/// https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-
|
||||
/// <https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings>
|
||||
/// <https://drafts.csswg.org/css-fonts-4/#low-level-font-variation->
|
||||
/// settings-control-the-font-variation-settings-property
|
||||
/// <string> [ on | off | <integer> ]
|
||||
/// <string> <number>
|
||||
|
@ -201,7 +201,7 @@ pub enum FontSettings<T> {
|
|||
}
|
||||
|
||||
impl<T: Parse> Parse for FontSettings<T> {
|
||||
/// https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings
|
||||
/// <https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings>
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
|
||||
return Ok(FontSettings::Normal);
|
||||
|
|
|
@ -15,7 +15,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
|||
|
||||
/// An SVG paint value
|
||||
///
|
||||
/// https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint
|
||||
/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
|
||||
|
@ -64,7 +64,7 @@ impl<ColorType, UrlPaintServer> SVGPaintKind<ColorType, UrlPaintServer> {
|
|||
|
||||
/// Parse SVGPaint's fallback.
|
||||
/// fallback is keyword(none), Color or empty.
|
||||
/// https://svgwg.org/svg2-draft/painting.html#SpecifyingPaint
|
||||
/// <https://svgwg.org/svg2-draft/painting.html#SpecifyingPaint>
|
||||
fn parse_fallback<'i, 't, ColorType: Parse>(context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>)
|
||||
-> Option<Either<ColorType, None_>> {
|
||||
|
@ -110,7 +110,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
|
|||
}
|
||||
|
||||
/// A value of <length> | <percentage> | <number> for svg which allow unitless length.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedValue)]
|
||||
|
|
|
@ -39,7 +39,7 @@ pub struct TransformOrigin<H, V, Depth> {
|
|||
|
||||
/// A generic timing function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-timing-1/#single-timing-function-production
|
||||
/// <https://drafts.csswg.org/css-timing-1/#single-timing-function-production>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
|
|
@ -95,7 +95,7 @@ impl<A: Parse, B: Parse> Parse for Either<A, B> {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-values-4/#custom-idents
|
||||
/// <https://drafts.csswg.org/css-values-4/#custom-idents>
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -126,7 +126,7 @@ impl ToCss for CustomIdent {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-animations/#typedef-keyframes-name
|
||||
/// <https://drafts.csswg.org/css-animations/#typedef-keyframes-name>
|
||||
#[derive(Clone, Debug, ToComputedValue)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
@ -138,7 +138,7 @@ pub enum KeyframesName {
|
|||
}
|
||||
|
||||
impl KeyframesName {
|
||||
/// https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-name
|
||||
/// <https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-name>
|
||||
pub fn from_ident(value: &str) -> Self {
|
||||
let location = SourceLocation { line: 0, column: 0 };
|
||||
let custom_ident = CustomIdent::from_ident(location, &value.into(), &["none"]).ok();
|
||||
|
|
|
@ -111,7 +111,7 @@ const ALIGN_ALL_SHIFT: u32 = structs::NS_STYLE_ALIGN_ALL_SHIFT;
|
|||
|
||||
/// Value of the `align-content` or `justify-content` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#content-distribution
|
||||
/// <https://drafts.csswg.org/css-align/#content-distribution>
|
||||
///
|
||||
/// The 16-bit field stores the primary value in its lower 8 bits, and the optional fallback value
|
||||
/// in its upper 8 bits. This matches the representation of these properties in Gecko.
|
||||
|
@ -135,7 +135,7 @@ impl AlignJustifyContent {
|
|||
|
||||
/// Construct a value including a fallback alignment.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#fallback-alignment
|
||||
/// <https://drafts.csswg.org/css-align/#fallback-alignment>
|
||||
#[inline]
|
||||
pub fn with_fallback(flags: AlignFlags, fallback: AlignFlags) -> Self {
|
||||
AlignJustifyContent(flags.bits() as u16 | ((fallback.bits() as u16) << ALIGN_ALL_SHIFT))
|
||||
|
@ -207,7 +207,7 @@ impl Parse for AlignJustifyContent {
|
|||
|
||||
/// Value of the `align-self` or `justify-self` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#self-alignment
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub struct AlignJustifySelf(pub AlignFlags);
|
||||
|
@ -245,7 +245,7 @@ impl Parse for AlignJustifySelf {
|
|||
|
||||
/// Value of the `align-items` property
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#self-alignment
|
||||
/// <https://drafts.csswg.org/css-align/#self-alignment>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
|
||||
pub struct AlignItems(pub AlignFlags);
|
||||
|
@ -283,7 +283,7 @@ impl Parse for AlignItems {
|
|||
|
||||
/// Value of the `justify-items` property
|
||||
///
|
||||
/// https://drafts.csswg.org/css-align/#justify-items-property
|
||||
/// <https://drafts.csswg.org/css-align/#justify-items-property>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
||||
pub struct JustifyItems(pub AlignFlags);
|
||||
|
|
|
@ -237,7 +237,7 @@ impl Parse for ShapeRadius {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-shapes/#basic-shape-serialization
|
||||
/// <https://drafts.csswg.org/css-shapes/#basic-shape-serialization>
|
||||
///
|
||||
/// Positions get serialized differently with basic shapes. Keywords
|
||||
/// are converted to percentages where possible. Only the two or four
|
||||
|
|
|
@ -84,7 +84,7 @@ pub struct CalcLengthOrPercentage {
|
|||
}
|
||||
|
||||
impl ToCss for CalcLengthOrPercentage {
|
||||
/// https://drafts.csswg.org/css-values/#calc-serialize
|
||||
/// <https://drafts.csswg.org/css-values/#calc-serialize>
|
||||
///
|
||||
/// FIXME(emilio): Should this simplify away zeros?
|
||||
#[allow(unused_assignments)]
|
||||
|
|
|
@ -128,7 +128,7 @@ impl Color {
|
|||
|
||||
/// Parse a color, with quirks.
|
||||
///
|
||||
/// https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk>
|
||||
pub fn parse_quirky<'i, 't>(context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
allow_quirks: AllowQuirks)
|
||||
|
@ -145,7 +145,7 @@ impl Color {
|
|||
|
||||
/// Parse a <quirky-color> value.
|
||||
///
|
||||
/// https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk>
|
||||
fn parse_quirky_color<'i, 't>(input: &mut Parser<'i, 't>) -> Result<RGBA, ParseError<'i>> {
|
||||
let location = input.current_source_location();
|
||||
let (value, unit) = match *input.next()? {
|
||||
|
|
|
@ -239,7 +239,7 @@ impl ToComputedValue for KeywordSize {
|
|||
}
|
||||
|
||||
impl FontSize {
|
||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size
|
||||
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size>
|
||||
pub fn from_html_size(size: u8) -> Self {
|
||||
FontSize::Keyword(match size {
|
||||
// If value is less than 1, let it be 1.
|
||||
|
|
|
@ -85,7 +85,7 @@ impl ToNsCssValue for PixelOrPercentage {
|
|||
/// Only bare px or percentage values are allowed. Other length units and
|
||||
/// calc() values are not allowed.
|
||||
///
|
||||
/// https://w3c.github.io/IntersectionObserver/#parse-a-root-margin
|
||||
/// <https://w3c.github.io/IntersectionObserver/#parse-a-root-margin>
|
||||
pub struct IntersectionObserverRootMargin(pub Rect<PixelOrPercentage>);
|
||||
|
||||
impl Parse for IntersectionObserverRootMargin {
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Parse for TrackSize<LengthOrPercentage> {
|
|||
|
||||
/// Parse the grid line names into a vector of owned strings.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-line-names
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-line-names>
|
||||
pub fn parse_line_names<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Box<[CustomIdent]>, ParseError<'i>> {
|
||||
input.expect_square_bracket_block()?;
|
||||
input.parse_nested_block(|input| {
|
||||
|
@ -88,7 +88,7 @@ pub fn parse_line_names<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Box<[Custo
|
|||
|
||||
/// The type of `repeat` function (only used in parsing).
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-repeat
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
enum RepeatType {
|
||||
|
|
|
@ -37,11 +37,11 @@ use values::specified::url::SpecifiedUrl;
|
|||
pub type ImageLayer = Either<None_, Image>;
|
||||
|
||||
/// Specified values for an image according to CSS-IMAGES.
|
||||
/// https://drafts.csswg.org/css-images/#image-values
|
||||
/// <https://drafts.csswg.org/css-images/#image-values>
|
||||
pub type Image = GenericImage<Gradient, MozImageRect, SpecifiedUrl>;
|
||||
|
||||
/// Specified values for a CSS gradient.
|
||||
/// https://drafts.csswg.org/css-images/#gradients
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
pub type Gradient = GenericGradient<
|
||||
LineDirection,
|
||||
|
@ -53,7 +53,7 @@ pub type Gradient = GenericGradient<
|
|||
>;
|
||||
|
||||
/// Specified values for a CSS gradient.
|
||||
/// https://drafts.csswg.org/css-images/#gradients
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
#[cfg(feature = "gecko")]
|
||||
pub type Gradient = GenericGradient<
|
||||
LineDirection,
|
||||
|
|
|
@ -213,15 +213,15 @@ impl FontRelativeLength {
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
/// A viewport-relative length.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#viewport-relative-lengths
|
||||
/// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
|
||||
pub enum ViewportPercentageLength {
|
||||
/// A vw unit: https://drafts.csswg.org/css-values/#vw
|
||||
Vw(CSSFloat),
|
||||
/// A vh unit: https://drafts.csswg.org/css-values/#vh
|
||||
Vh(CSSFloat),
|
||||
/// https://drafts.csswg.org/css-values/#vmin
|
||||
/// <https://drafts.csswg.org/css-values/#vmin>
|
||||
Vmin(CSSFloat),
|
||||
/// https://drafts.csswg.org/css-values/#vmax
|
||||
/// <https://drafts.csswg.org/css-values/#vmax>
|
||||
Vmax(CSSFloat)
|
||||
}
|
||||
|
||||
|
@ -440,24 +440,24 @@ impl Mul<CSSFloat> for PhysicalLength {
|
|||
|
||||
/// A `<length>` without taking `calc` expressions into account
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#lengths
|
||||
/// <https://drafts.csswg.org/css-values/#lengths>
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum NoCalcLength {
|
||||
/// An absolute length
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#absolute-length
|
||||
/// <https://drafts.csswg.org/css-values/#absolute-length>
|
||||
Absolute(AbsoluteLength),
|
||||
|
||||
/// A font-relative length:
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#font-relative-lengths
|
||||
/// <https://drafts.csswg.org/css-values/#font-relative-lengths>
|
||||
FontRelative(FontRelativeLength),
|
||||
|
||||
/// A viewport-relative length.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#viewport-relative-lengths
|
||||
/// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
|
||||
ViewportPercentage(ViewportPercentageLength),
|
||||
|
||||
/// HTML5 "character width", as defined in HTML5 § 14.5.4.
|
||||
|
@ -581,7 +581,7 @@ impl NoCalcLength {
|
|||
/// An extension to `NoCalcLength` to parse `calc` expressions.
|
||||
/// This is commonly used for the `<length>` values.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#lengths
|
||||
/// <https://drafts.csswg.org/css-values/#lengths>
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
|
@ -590,7 +590,7 @@ pub enum Length {
|
|||
NoCalc(NoCalcLength),
|
||||
/// A calc expression.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#calc-notation
|
||||
/// <https://drafts.csswg.org/css-values/#calc-notation>
|
||||
Calc(Box<CalcLengthOrPercentage>),
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ impl LengthOrPercentage {
|
|||
|
||||
/// Parse a length, treating dimensionless numbers as pixels
|
||||
///
|
||||
/// https://www.w3.org/TR/SVG2/types.html#presentation-attribute-css-value
|
||||
/// <https://www.w3.org/TR/SVG2/types.html#presentation-attribute-css-value>
|
||||
pub fn parse_numbers_are_pixels<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<LengthOrPercentage, ParseError<'i>> {
|
||||
if let Ok(lop) = input.try(|i| Self::parse(context, i)) {
|
||||
|
@ -959,7 +959,7 @@ impl Parse for LengthOrPercentage {
|
|||
|
||||
impl LengthOrPercentage {
|
||||
/// Parses a length or a percentage, allowing the unitless length quirk.
|
||||
/// https://quirks.spec.whatwg.org/#the-unitless-length-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-unitless-length-quirk>
|
||||
#[inline]
|
||||
pub fn parse_quirky<'i, 't>(context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
|
@ -1191,7 +1191,7 @@ impl NonNegativeLengthOrPercentage {
|
|||
}
|
||||
|
||||
/// Parses a length or a percentage, allowing the unitless length quirk.
|
||||
/// https://quirks.spec.whatwg.org/#the-unitless-length-quirk
|
||||
/// <https://quirks.spec.whatwg.org/#the-unitless-length-quirk>
|
||||
#[inline]
|
||||
pub fn parse_quirky<'i, 't>(context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
|
|
|
@ -365,7 +365,7 @@ impl ToComputedValue for Opacity {
|
|||
|
||||
/// An specified `<integer>`, optionally coming from a `calc()` expression.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-values/#integers
|
||||
/// <https://drafts.csswg.org/css-values/#integers>
|
||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
|
|
|
@ -43,7 +43,7 @@ fn parse_context_value<'i, 't, T>(input: &mut Parser<'i, 't>, value: T)
|
|||
}
|
||||
|
||||
/// A value of <length> | <percentage> | <number> for stroke-dashoffset.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
|
||||
pub type SvgLengthOrPercentageOrNumber =
|
||||
generic::SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number>;
|
||||
|
||||
|
@ -66,7 +66,7 @@ impl From<SvgLengthOrPercentageOrNumber> for SVGLength {
|
|||
}
|
||||
|
||||
/// A value of <length> | <percentage> | <number> for stroke-width/stroke-dasharray.
|
||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeProperties
|
||||
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
|
||||
pub type NonNegativeSvgLengthOrPercentageOrNumber =
|
||||
generic::SvgLengthOrPercentageOrNumber<NonNegativeLengthOrPercentage, NonNegativeNumber>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue