firefox/Bug-1519729-Document-public-macros.patch

63 lines
2.4 KiB
Diff
Raw Normal View History

2020-07-27 16:48:25 +08:00
From 9d5e559547d0b4c7eb6d3c1843cc929328e0f2e4 Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Fri, 11 Jan 2019 14:03:44 +0100
Subject: [PATCH] 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
---
.../style/properties/properties.mako.rs | 17 ++++++++++++++++-
servo/components/style_traits/values.rs | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs
index 2d91273be15a7..9220c3b1a6655 100644
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -3821,7 +3821,14 @@ impl AliasId {
}
}
-// 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) => {
@@ -3844,6 +3851,14 @@ macro_rules! css_properties_accessors {
}
}
+/// 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) => {
diff --git a/servo/components/style_traits/values.rs b/servo/components/style_traits/values.rs
index 2851082c22e05..0d7ee3f506ce2 100644
--- a/servo/components/style_traits/values.rs
+++ b/servo/components/style_traits/values.rs
@@ -432,7 +432,7 @@ 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)]