]>
Commit | Line | Data |
---|---|---|
29805339 JP |
1 | |
2 | # HG changeset patch | |
3 | # User Simon Sapin <simon.sapin@exyr.org> | |
4 | # Date 1547211748 -3600 | |
5 | # Node ID 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 | |
6 | # Parent 07acdca43a9b5e69f0f01d74dab7f6d2e6ef30f2 | |
7 | Bug 1519729 - Remove unused macro. r=emilio | |
8 | ||
9 | Cherry-picks a commit from https://github.com/servo/servo/pull/22674 | |
10 | ||
11 | ||
12 | diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs | |
13 | --- a/servo/components/style_traits/values.rs | |
14 | +++ b/servo/components/style_traits/values.rs | |
15 | @@ -153,34 +153,16 @@ where | |
16 | if !prefix.is_empty() { | |
17 | self.inner.write_str(prefix)?; | |
18 | } | |
19 | } | |
20 | self.inner.write_char(c) | |
21 | } | |
22 | } | |
23 | ||
24 | -#[macro_export] | |
25 | -macro_rules! serialize_function { | |
26 | - ($dest: expr, $name: ident($( $arg: expr, )+)) => { | |
27 | - serialize_function!($dest, $name($($arg),+)) | |
28 | - }; | |
29 | - ($dest: expr, $name: ident($first_arg: expr $( , $arg: expr )*)) => { | |
30 | - { | |
31 | - $dest.write_str(concat!(stringify!($name), "("))?; | |
32 | - $first_arg.to_css($dest)?; | |
33 | - $( | |
34 | - $dest.write_str(", ")?; | |
35 | - $arg.to_css($dest)?; | |
36 | - )* | |
37 | - $dest.write_char(')') | |
38 | - } | |
39 | - } | |
40 | -} | |
41 | - | |
42 | /// Convenience wrapper to serialise CSS values separated by a given string. | |
43 | pub struct SequenceWriter<'a, 'b: 'a, W: 'b> { | |
44 | inner: &'a mut CssWriter<'b, W>, | |
45 | separator: &'static str, | |
46 | } | |
47 | ||
48 | impl<'a, 'b, W> SequenceWriter<'a, 'b, W> | |
49 | where | |
50 | ||
51 | ||
52 | # HG changeset patch | |
53 | # User Simon Sapin <simon.sapin@exyr.org> | |
54 | # Date 1547211824 -3600 | |
55 | # Node ID f63ebd7e9e281f22e71c268151337178de2c246a | |
56 | # Parent 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 | |
57 | Bug 1519729 - Document public macros. r=emilio | |
58 | ||
59 | Undocumented public macros emit warnings in nightly-2019-01-11, | |
60 | and we #![deny] that warning. | |
61 | ||
62 | Cherry-picks a commit from https://github.com/servo/servo/pull/22674 | |
63 | ||
64 | ||
65 | diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs | |
66 | --- a/servo/components/style/properties/properties.mako.rs | |
67 | +++ b/servo/components/style/properties/properties.mako.rs | |
68 | @@ -3816,17 +3816,24 @@ impl AliasId { | |
69 | % for property in data.all_aliases(): | |
70 | AliasId::${property.camel_case} => "${property.camel_case}", | |
71 | % endfor | |
72 | }; | |
73 | formatter.write_str(name) | |
74 | } | |
75 | } | |
76 | ||
77 | -// NOTE(emilio): Callers are responsible to deal with prefs. | |
78 | +/// Call the given macro with tokens like this for each longhand and shorthand properties | |
79 | +/// that is enabled in content: | |
80 | +/// | |
81 | +/// ``` | |
82 | +/// [CamelCaseName, SetCamelCaseName, PropertyId::Longhand(LonghandId::CamelCaseName)], | |
83 | +/// ``` | |
84 | +/// | |
85 | +/// NOTE(emilio): Callers are responsible to deal with prefs. | |
86 | #[macro_export] | |
87 | macro_rules! css_properties_accessors { | |
88 | ($macro_name: ident) => { | |
89 | $macro_name! { | |
90 | % for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: | |
91 | % for property in props: | |
92 | % if property.enabled_in_content(): | |
93 | % for name in [property.name] + property.alias: | |
94 | @@ -3839,16 +3846,24 @@ macro_rules! css_properties_accessors { | |
95 | % endfor | |
96 | % endif | |
97 | % endfor | |
98 | % endfor | |
99 | } | |
100 | } | |
101 | } | |
102 | ||
103 | +/// Call the given macro with tokens like this for each longhand properties: | |
104 | +/// | |
105 | +/// ``` | |
106 | +/// { snake_case_ident, true } | |
107 | +/// ``` | |
108 | +/// | |
109 | +/// … where the boolean indicates whether the property value type | |
110 | +/// is wrapped in a `Box<_>` in the corresponding `PropertyDeclaration` variant. | |
111 | #[macro_export] | |
112 | macro_rules! longhand_properties_idents { | |
113 | ($macro_name: ident) => { | |
114 | $macro_name! { | |
115 | % for property in data.longhands: | |
116 | { ${property.ident}, ${"true" if property.boxed else "false"} } | |
117 | % endfor | |
118 | } | |
119 | diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs | |
120 | --- a/servo/components/style_traits/values.rs | |
121 | +++ b/servo/components/style_traits/values.rs | |
122 | @@ -427,17 +427,17 @@ impl_to_css_for_predefined_type!(i8); | |
123 | impl_to_css_for_predefined_type!(i32); | |
124 | impl_to_css_for_predefined_type!(u16); | |
125 | impl_to_css_for_predefined_type!(u32); | |
126 | impl_to_css_for_predefined_type!(::cssparser::Token<'a>); | |
127 | impl_to_css_for_predefined_type!(::cssparser::RGBA); | |
128 | impl_to_css_for_predefined_type!(::cssparser::Color); | |
129 | impl_to_css_for_predefined_type!(::cssparser::UnicodeRange); | |
130 | ||
131 | -#[macro_export] | |
132 | +/// Define an enum type with unit variants that each corrsepond to a CSS keyword. | |
133 | macro_rules! define_css_keyword_enum { | |
134 | (pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => { | |
135 | #[allow(missing_docs)] | |
136 | #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] | |
137 | #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)] | |
138 | pub enum $name { | |
139 | $($variant),+ | |
140 | } | |
141 | ||
142 | ||
143 | # HG changeset patch | |
144 | # User Emilio Cobos Álvarez <emilio@crisal.io> | |
145 | # Date 1547412158 -3600 | |
146 | # Node ID 1a1d8b9f1a3ab704ab277407823f6f42dd63a3d4 | |
147 | # Parent a2f691714d70fa6a9119503270809fa0eb8df6c6 | |
148 | Bug 1519629 - Document a few more macros. | |
149 | ||
150 | ||
151 | diff --git a/servo/components/style/gecko/regen_atoms.py b/servo/components/style/gecko/regen_atoms.py | |
152 | --- a/servo/components/style/gecko/regen_atoms.py | |
153 | +++ b/servo/components/style/gecko/regen_atoms.py | |
154 | @@ -125,16 +125,17 @@ PRELUDE = ''' | |
155 | RULE_TEMPLATE = ('("{atom}") =>\n ' | |
156 | '{{{{ ' | |
157 | '#[allow(unsafe_code)] #[allow(unused_unsafe)]' | |
158 | 'unsafe {{ $crate::string_cache::atom_macro::atom_from_static' | |
159 | '($crate::string_cache::atom_macro::{name} as *mut _) }}' | |
160 | ' }}}};') | |
161 | ||
162 | MACRO = ''' | |
163 | +/// Returns a static atom by passing the literal string it represents. | |
164 | #[macro_export] | |
165 | macro_rules! atom {{ | |
166 | {} | |
167 | }} | |
168 | ''' | |
169 | ||
170 | ||
171 | def write_atom_macro(atoms, file_name): | |
172 | diff --git a/servo/components/style/gecko_string_cache/namespace.rs b/servo/components/style/gecko_string_cache/namespace.rs | |
173 | --- a/servo/components/style/gecko_string_cache/namespace.rs | |
174 | +++ b/servo/components/style/gecko_string_cache/namespace.rs | |
175 | @@ -6,16 +6,18 @@ | |
176 | ||
177 | use gecko_bindings::structs::nsAtom; | |
178 | use precomputed_hash::PrecomputedHash; | |
179 | use std::borrow::Borrow; | |
180 | use std::fmt; | |
181 | use std::ops::Deref; | |
182 | use string_cache::{Atom, WeakAtom}; | |
183 | ||
184 | +/// In Gecko namespaces are just regular atoms, so this is a simple macro to | |
185 | +/// forward one macro to the other. | |
186 | #[macro_export] | |
187 | macro_rules! ns { | |
188 | () => { $crate::string_cache::Namespace(atom!("")) }; | |
189 | ($s: tt) => { $crate::string_cache::Namespace(atom!($s)) }; | |
190 | } | |
191 | ||
192 | /// A Gecko namespace is just a wrapped atom. | |
193 | #[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq)] | |
194 | --- firefox-60.6.1/servo/components/style/properties/properties.mako.rs.orig 2019-03-22 06:01:07.000000000 +0100 | |
195 | +++ firefox-60.6.1/servo/components/style/properties/properties.mako.rs 2019-04-14 12:19:55.687706977 +0200 | |
196 | @@ -55,6 +55,7 @@ | |
197 | ||
198 | pub use self::declaration_block::*; | |
199 | ||
200 | +/// doc stub | |
201 | #[cfg(feature = "gecko")] | |
202 | #[macro_export] | |
203 | macro_rules! property_name { |