# HG changeset patch # User Simon Sapin # Date 1547211748 -3600 # Node ID 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 # Parent 07acdca43a9b5e69f0f01d74dab7f6d2e6ef30f2 Bug 1519729 - Remove unused macro. r=emilio Cherry-picks a commit from https://github.com/servo/servo/pull/22674 diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs --- a/servo/components/style_traits/values.rs +++ b/servo/components/style_traits/values.rs @@ -153,34 +153,16 @@ where if !prefix.is_empty() { self.inner.write_str(prefix)?; } } self.inner.write_char(c) } } -#[macro_export] -macro_rules! serialize_function { - ($dest: expr, $name: ident($( $arg: expr, )+)) => { - serialize_function!($dest, $name($($arg),+)) - }; - ($dest: expr, $name: ident($first_arg: expr $( , $arg: expr )*)) => { - { - $dest.write_str(concat!(stringify!($name), "("))?; - $first_arg.to_css($dest)?; - $( - $dest.write_str(", ")?; - $arg.to_css($dest)?; - )* - $dest.write_char(')') - } - } -} - /// Convenience wrapper to serialise CSS values separated by a given string. pub struct SequenceWriter<'a, 'b: 'a, W: 'b> { inner: &'a mut CssWriter<'b, W>, separator: &'static str, } impl<'a, 'b, W> SequenceWriter<'a, 'b, W> where # HG changeset patch # User Simon Sapin # Date 1547211824 -3600 # Node ID f63ebd7e9e281f22e71c268151337178de2c246a # Parent 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 Bug 1519729 - Document public macros. r=emilio Undocumented public macros emit warnings in nightly-2019-01-11, and we #![deny] that warning. Cherry-picks a commit from https://github.com/servo/servo/pull/22674 diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -3816,17 +3816,24 @@ impl AliasId { % for property in data.all_aliases(): AliasId::${property.camel_case} => "${property.camel_case}", % endfor }; formatter.write_str(name) } } -// NOTE(emilio): Callers are responsible to deal with prefs. +/// Call the given macro with tokens like this for each longhand and shorthand properties +/// that is enabled in content: +/// +/// ``` +/// [CamelCaseName, SetCamelCaseName, PropertyId::Longhand(LonghandId::CamelCaseName)], +/// ``` +/// +/// NOTE(emilio): Callers are responsible to deal with prefs. #[macro_export] macro_rules! css_properties_accessors { ($macro_name: ident) => { $macro_name! { % for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for property in props: % if property.enabled_in_content(): % for name in [property.name] + property.alias: @@ -3839,16 +3846,24 @@ macro_rules! css_properties_accessors { % endfor % endif % endfor % endfor } } } +/// Call the given macro with tokens like this for each longhand properties: +/// +/// ``` +/// { snake_case_ident, true } +/// ``` +/// +/// … where the boolean indicates whether the property value type +/// is wrapped in a `Box<_>` in the corresponding `PropertyDeclaration` variant. #[macro_export] macro_rules! longhand_properties_idents { ($macro_name: ident) => { $macro_name! { % for property in data.longhands: { ${property.ident}, ${"true" if property.boxed else "false"} } % endfor } diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs --- a/servo/components/style_traits/values.rs +++ b/servo/components/style_traits/values.rs @@ -427,17 +427,17 @@ impl_to_css_for_predefined_type!(i8); impl_to_css_for_predefined_type!(i32); impl_to_css_for_predefined_type!(u16); impl_to_css_for_predefined_type!(u32); impl_to_css_for_predefined_type!(::cssparser::Token<'a>); impl_to_css_for_predefined_type!(::cssparser::RGBA); impl_to_css_for_predefined_type!(::cssparser::Color); impl_to_css_for_predefined_type!(::cssparser::UnicodeRange); -#[macro_export] +/// Define an enum type with unit variants that each corrsepond to a CSS keyword. macro_rules! define_css_keyword_enum { (pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)] pub enum $name { $($variant),+ } # HG changeset patch # User Emilio Cobos Álvarez # Date 1547412158 -3600 # Node ID 1a1d8b9f1a3ab704ab277407823f6f42dd63a3d4 # Parent a2f691714d70fa6a9119503270809fa0eb8df6c6 Bug 1519629 - Document a few more macros. diff --git a/servo/components/style/gecko/regen_atoms.py b/servo/components/style/gecko/regen_atoms.py --- a/servo/components/style/gecko/regen_atoms.py +++ b/servo/components/style/gecko/regen_atoms.py @@ -125,16 +125,17 @@ PRELUDE = ''' RULE_TEMPLATE = ('("{atom}") =>\n ' '{{{{ ' '#[allow(unsafe_code)] #[allow(unused_unsafe)]' 'unsafe {{ $crate::string_cache::atom_macro::atom_from_static' '($crate::string_cache::atom_macro::{name} as *mut _) }}' ' }}}};') MACRO = ''' +/// Returns a static atom by passing the literal string it represents. #[macro_export] macro_rules! atom {{ {} }} ''' def write_atom_macro(atoms, file_name): diff --git a/servo/components/style/gecko_string_cache/namespace.rs b/servo/components/style/gecko_string_cache/namespace.rs --- a/servo/components/style/gecko_string_cache/namespace.rs +++ b/servo/components/style/gecko_string_cache/namespace.rs @@ -6,16 +6,18 @@ use gecko_bindings::structs::nsAtom; use precomputed_hash::PrecomputedHash; use std::borrow::Borrow; use std::fmt; use std::ops::Deref; use string_cache::{Atom, WeakAtom}; +/// In Gecko namespaces are just regular atoms, so this is a simple macro to +/// forward one macro to the other. #[macro_export] macro_rules! ns { () => { $crate::string_cache::Namespace(atom!("")) }; ($s: tt) => { $crate::string_cache::Namespace(atom!($s)) }; } /// A Gecko namespace is just a wrapped atom. #[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq)] --- firefox-60.6.1/servo/components/style/properties/properties.mako.rs.orig 2019-03-22 06:01:07.000000000 +0100 +++ firefox-60.6.1/servo/components/style/properties/properties.mako.rs 2019-04-14 12:19:55.687706977 +0200 @@ -55,6 +55,7 @@ pub use self::declaration_block::*; +/// doc stub #[cfg(feature = "gecko")] #[macro_export] macro_rules! property_name {