--- a/dom/base/UseCounters.conf
+++ b/dom/base/UseCounters.conf
@@ -14,21 +14,18 @@
//
// (c) one of four possible use counter declarations:
//
// method <IDL interface name>.<IDL operation name>
// attribute <IDL interface name>.<IDL attribute name>
// property <CSS property method name>
// custom <any valid identifier> <description>
//
-// The |CSS property method name| should be identical to the |method|
-// argument to CSS_PROP and related macros. The method name is
-// identical to the name of the property, except that all hyphens are
-// removed and CamelCase naming is used. See nsCSSPropList.h for
-// further details.
+// The |CSS property method name| should be CamelCase form of the property
+// name with -moz- and -x- prefix removed.
//
// The <description> for custom counters will be appended to "When a document "
// or "When a page ", so phrase it appropriately. For instance, "constructs a
// Foo object" or "calls Document.bar('some value')". It may contain any
// character (including whitespace).
//
// To actually cause use counters to be incremented, DOM methods
// and attributes must have a [UseCounter] extended attribute in
--- a/dom/base/gen-usecounters.py
+++ b/dom/base/gen-usecounters.py
@@ -56,20 +56,25 @@ def generate_list(f, counters):
print_optional_macro_undeclare('USE_COUNTER_CSS_PROPERTY')
print_optional_macro_undeclare('USE_COUNTER_CUSTOM')
def generate_property_map(f, counters):
print(AUTOGENERATED_WARNING_COMMENT, file=f)
print('''
enum {
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
- #define CSS_PROP(name_, id_, method_, ...) \\
+ // Need an extra level of macro nesting to force expansion of method_
+ // params before they get pasted.
+ #define CSS_PROP_USE_COUNTER(method_) \\
USE_COUNTER_FOR_CSS_PROPERTY_##method_ = eUseCounter_UNKNOWN,
- #include "nsCSSPropList.h"
- #undef CSS_PROP
+ #define CSS_PROP_LONGHAND(name_, id_, method_, ...) \\
+ CSS_PROP_USE_COUNTER(method_)
+ #include "mozilla/ServoCSSPropList.h"
+ #undef CSS_PROP_LONGHAND
+ #undef CSS_PROP_USE_COUNTER
#undef CSS_PROP_PUBLIC_OR_PRIVATE
};
''', file=f)
for counter in counters:
if counter['type'] == 'property':
prop = counter['property_name']
print('#define USE_COUNTER_FOR_CSS_PROPERTY_%s eUseCounter_property_%s' % (prop, prop), file=f)
--- a/layout/style/nsCSSPropertyID.h
+++ b/layout/style/nsCSSPropertyID.h
@@ -10,41 +10,41 @@
#define nsCSSPropertyID_h___
#include <nsHashKeys.h>
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
- To change the list of properties, see nsCSSPropList.h
+ To change the list of properties, see ServoCSSPropList.h
*/
enum nsCSSPropertyID {
eCSSProperty_UNKNOWN = -1,
- #define CSS_PROP(name_, id_, ...) eCSSProperty_##id_,
- #include "nsCSSPropList.h"
- #undef CSS_PROP
+ #define CSS_PROP_LONGHAND(name_, id_, ...) eCSSProperty_##id_,
+ #include "mozilla/ServoCSSPropList.h"
+ #undef CSS_PROP_LONGHAND
eCSSProperty_COUNT_no_shorthands,
// Make the count continue where it left off:
eCSSProperty_COUNT_DUMMY = eCSSProperty_COUNT_no_shorthands - 1,
#define CSS_PROP_SHORTHAND(name_, id_, ...) eCSSProperty_##id_,
- #include "nsCSSPropList.h"
+ #include "mozilla/ServoCSSPropList.h"
#undef CSS_PROP_SHORTHAND
eCSSProperty_COUNT,
// Make the count continue where it left off:
eCSSProperty_COUNT_DUMMY2 = eCSSProperty_COUNT - 1,
#define CSS_PROP_ALIAS(aliasname_, aliasid_, id_, method_, pref_) \
eCSSPropertyAlias_##aliasid_,
- #include "nsCSSPropAliasList.h"
+ #include "mozilla/ServoCSSPropList.h"
#undef CSS_PROP_ALIAS
eCSSProperty_COUNT_with_aliases,
// Make the count continue where it left off:
eCSSProperty_COUNT_DUMMY3 = eCSSProperty_COUNT_with_aliases - 1,
// Some of the values below could probably overlap with each other
// if we had a need for them to do so.
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -54,25 +54,23 @@ typedef nsCSSProps::KTableEntry KTableEn
#include "nsCSSPropList.h"
#undef CSS_PROP
// required to make the symbol external, so that TestCSSPropertyLookup.cpp can link with it
extern const char* const kCSSRawProperties[];
// define an array of all CSS properties
const char* const kCSSRawProperties[eCSSProperty_COUNT_with_aliases] = {
-#define CSS_PROP(name_, ...) #name_,
-#include "nsCSSPropList.h"
-#undef CSS_PROP
-#define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) #name_,
-#include "nsCSSPropList.h"
+#define CSS_PROP_LONGHAND(name_, ...) #name_,
+#define CSS_PROP_SHORTHAND(name_, ...) #name_,
+#define CSS_PROP_ALIAS(name_, ...) #name_,
+#include "mozilla/ServoCSSPropList.h"
+#undef CSS_PROP_ALIAS
#undef CSS_PROP_SHORTHAND
-#define CSS_PROP_ALIAS(aliasname_, aliasid_, id_, method_, pref_) #aliasname_,
-#include "nsCSSPropAliasList.h"
-#undef CSS_PROP_ALIAS
+#undef CSS_PROP_LONGHAND
};
using namespace mozilla;
static int32_t gPropertyTableRefCount;
static nsStaticCaseInsensitiveNameTable* gPropertyTable;
static nsStaticCaseInsensitiveNameTable* gFontDescTable;
static nsStaticCaseInsensitiveNameTable* gCounterDescTable;
@@ -123,17 +121,17 @@ static const char* const kCSSRawPredefin
enum {
eCSSAliasCount = eCSSProperty_COUNT_with_aliases - eCSSProperty_COUNT
};
// The names are in kCSSRawProperties.
static nsCSSPropertyID gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = {
#define CSS_PROP_ALIAS(aliasname_, aliasid_, propid_, aliasmethod_, pref_) \
eCSSProperty_##propid_ ,
-#include "nsCSSPropAliasList.h"
+#include "mozilla/ServoCSSPropList.h"
#undef CSS_PROP_ALIAS
};
static nsStaticCaseInsensitiveNameTable*
CreateStaticTable(const char* const aRawTable[], int32_t aLength)
{
auto table = new nsStaticCaseInsensitiveNameTable(aRawTable, aLength);
#ifdef DEBUG
@@ -268,30 +266,26 @@ nsCSSProps::AddRefTable(void)
prefObserversInited = true;
#define OBSERVE_PROP(pref_, id_) \
if (pref_[0]) { \
Preferences::AddBoolVarCache(&gPropertyEnabled[id_], \
pref_); \
}
- #define CSS_PROP(name_, id_, method_, flags_, pref_, ...) \
+ #define CSS_PROP_LONGHAND(name_, id_, method_, flags_, pref_) \
OBSERVE_PROP(pref_, eCSSProperty_##id_)
- #include "nsCSSPropList.h"
- #undef CSS_PROP
-
- #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
+ #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
OBSERVE_PROP(pref_, eCSSProperty_##id_)
- #include "nsCSSPropList.h"
+ #define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, pref_) \
+ OBSERVE_PROP(pref_, eCSSPropertyAlias_##aliasid_)
+ #include "mozilla/ServoCSSPropList.h"
+ #undef CSS_PROP_ALIAS
#undef CSS_PROP_SHORTHAND
-
- #define CSS_PROP_ALIAS(aliasname_, aliasid_, propid_, aliasmethod_, pref_) \
- OBSERVE_PROP(pref_, eCSSPropertyAlias_##aliasid_)
- #include "nsCSSPropAliasList.h"
- #undef CSS_PROP_ALIAS
+ #undef CSS_PROP_LONGHAND
#undef OBSERVE_PROP
}
#ifdef DEBUG
{
// Assert that if CSS_PROPERTY_ENABLED_IN_UA_SHEETS or
// CSS_PROPERTY_ENABLED_IN_CHROME is used on a shorthand property
@@ -2821,43 +2815,43 @@ nsCSSProps::gPropertyEnabled[eCSSPropert
// If the property has any "ENABLED_IN" flag set, it is disabled by
// default. Note that, if a property has pref, whatever its default
// value is, it will later be changed in nsCSSProps::AddRefTable().
// If the property has "ENABLED_IN" flags but doesn't have a pref,
// it is an internal property which is disabled elsewhere.
#define IS_ENABLED_BY_DEFAULT(flags_) \
(!((flags_) & (CSS_PROPERTY_ENABLED_MASK | CSS_PROPERTY_PARSE_INACCESSIBLE)))
- #define CSS_PROP(name_, id_, method_, flags_, ...) \
+ #define CSS_PROP_LONGHAND(name_, id_, method_, flags_, ...) \
IS_ENABLED_BY_DEFAULT(flags_),
- #include "nsCSSPropList.h"
- #undef CSS_PROP
-
- #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
+ #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, ...) \
IS_ENABLED_BY_DEFAULT(flags_),
- #include "nsCSSPropList.h"
+ #define CSS_PROP_ALIAS(...) true,
+ #include "mozilla/ServoCSSPropList.h"
+ #undef CSS_PROP_ALIAS
#undef CSS_PROP_SHORTHAND
-
- #define CSS_PROP_ALIAS(aliasname_, aliasid_, propid_, aliasmethod_, pref_) \
- true,
- #include "nsCSSPropAliasList.h"
- #undef CSS_PROP_ALIAS
+ #undef CSS_PROP_LONGHAND
#undef IS_ENABLED_BY_DEFAULT
};
#include "../../dom/base/PropertyUseCounterMap.inc"
/* static */ const UseCounter
nsCSSProps::gPropertyUseCounter[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
- #define CSS_PROP(name_, id_, method_, ...) \
+ // Need an extra level of macro nesting to force expansion of method_
+ // params before they get pasted.
+ #define CSS_PROP_USE_COUNTER(method_) \
static_cast<UseCounter>(USE_COUNTER_FOR_CSS_PROPERTY_##method_),
- #include "nsCSSPropList.h"
- #undef CSS_PROP
+ #define CSS_PROP_LONGHAND(name_, id_, method_, ...) \
+ CSS_PROP_USE_COUNTER(method_)
+ #include "mozilla/ServoCSSPropList.h"
+ #undef CSS_PROP_LONGHAND
+ #undef CSS_PROP_USE_COUNTER
#undef CSS_PROP_PUBLIC_OR_PRIVATE
};
const uint32_t
nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, ...) \
parsevariant_,
#include "nsCSSPropList.h"
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -7169,36 +7169,48 @@ nsComputedDOMStyle::GetComputedStyleMap(
return ↦
}
/* static */ void
nsComputedDOMStyle::RegisterPrefChangeCallbacks()
{
// Note that this will register callbacks for all properties with prefs, not
// just those that are implemented on computed style objects, as it's not
- // easy to grab specific property data from nsCSSPropList.h based on the
+ // easy to grab specific property data from ServoCSSPropList.h based on the
// entries iterated in nsComputedDOMStylePropertyList.h.
ComputedStyleMap* data = GetComputedStyleMap();
#define REGISTER_CALLBACK(pref_) \
if (pref_[0]) { \
Preferences::RegisterCallback(MarkComputedStyleMapDirty, pref_, data); \
}
-#define CSS_PROP(prop_, id_, method_, flags_, pref_, ...) \
+#define CSS_PROP_LONGHAND(prop_, id_, method_, flags_, pref_) \
+ REGISTER_CALLBACK(pref_)
+#define CSS_PROP_SHORTHAND(prop_, id_, method_, flags_, pref_) \
REGISTER_CALLBACK(pref_)
-#include "nsCSSPropList.h"
-#undef CSS_PROP
+#define CSS_PROP_ALIAS(prop_, aliasid_, id_, method_, pref_) \
+ REGISTER_CALLBACK(pref_)
+#include "mozilla/ServoCSSPropList.h"
+#undef CSS_PROP_ALIAS
+#undef CSS_PROP_SHORTHAND
+#undef CSS_PROP_LONGHAND
#undef REGISTER_CALLBACK
}
/* static */ void
nsComputedDOMStyle::UnregisterPrefChangeCallbacks()
{
ComputedStyleMap* data = GetComputedStyleMap();
#define UNREGISTER_CALLBACK(pref_) \
if (pref_[0]) { \
Preferences::UnregisterCallback(MarkComputedStyleMapDirty, pref_, data); \
}
-#define CSS_PROP(prop_, id_, method_, flags_, pref_, ...) \
+#define CSS_PROP_LONGHAND(prop_, id_, method_, flags_, pref_) \
+ UNREGISTER_CALLBACK(pref_)
+#define CSS_PROP_SHORTHAND(prop_, id_, method_, flags_, pref_) \
+ UNREGISTER_CALLBACK(pref_)
+#define CSS_PROP_ALIAS(prop_, aliasid_, id_, method_, pref_) \
UNREGISTER_CALLBACK(pref_)
-#include "nsCSSPropList.h"
-#undef CSS_PROP
+#include "mozilla/ServoCSSPropList.h"
+#undef CSS_PROP_ALIAS
+#undef CSS_PROP_SHORTHAND
+#undef CSS_PROP_LONGHAND
#undef UNREGISTER_CALLBACK
}
--- a/layout/style/nsDOMCSSDeclaration.h
+++ b/layout/style/nsDOMCSSDeclaration.h
@@ -78,40 +78,38 @@ public:
NS_IMETHOD SetProperty(const nsAString& propertyName,
const nsAString& value,
const nsAString& priority,
nsIPrincipal* aSubjectPrincipal) override;
uint32_t Length() override;
// WebIDL interface for CSS2Properties
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
-#define CSS_PROP(name_, id_, method_, ...) \
+#define CSS_PROP(id_, method_) \
void \
Get##method_(nsAString& aValue, mozilla::ErrorResult& rv) \
{ \
rv = GetPropertyValue(eCSSProperty_##id_, aValue); \
} \
\
void \
Set##method_(const nsAString& aValue, nsIPrincipal* aSubjectPrincipal, \
mozilla::ErrorResult& rv) \
{ \
rv = SetPropertyValue(eCSSProperty_##id_, aValue, aSubjectPrincipal); \
}
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
-#define CSS_PROP_SHORTHAND(name_, id_, method_, ...) CSS_PROP(name_, id_, method_, )
-#include "nsCSSPropList.h"
-
-#define CSS_PROP_ALIAS(aliasname_, aliasid_, propid_, aliasmethod_, ...) \
- CSS_PROP(X, propid_, aliasmethod_, )
-#include "nsCSSPropAliasList.h"
+#define CSS_PROP_LONGHAND(name_, id_, method_, ...) CSS_PROP(id_, method_)
+#define CSS_PROP_SHORTHAND(name_, id_, method_, ...) CSS_PROP(id_, method_)
+#define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, ...) CSS_PROP(id_, method_)
+#include "mozilla/ServoCSSPropList.h"
#undef CSS_PROP_ALIAS
-
#undef CSS_PROP_SHORTHAND
+#undef CSS_PROP_LONGHAND
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
#undef CSS_PROP
#undef CSS_PROP_PUBLIC_OR_PRIVATE
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) override;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/layout/style/test/ListCSSProperties.cpp
+++ b/layout/style/test/ListCSSProperties.cpp
@@ -5,96 +5,90 @@
/* build (from code) lists of all supported CSS properties */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mozilla/ArrayUtils.h"
+// Need an extra level of macro nesting to force expansion of method_
+// params before they get pasted.
+#define STRINGIFY_METHOD(method_) #method_
+
struct PropertyInfo {
const char *propName;
const char *domName;
const char *pref;
};
const PropertyInfo gLonghandProperties[] = {
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
-#define CSS_PROP(name_, id_, method_, flags_, pref_, ...) \
- { #name_, #method_, pref_ },
+#define CSS_PROP_LONGHAND(name_, id_, method_, flags_, pref_, ...) \
+ { #name_, STRINGIFY_METHOD(method_), pref_ },
-#include "nsCSSPropList.h"
+#include "mozilla/ServoCSSPropList.h"
-#undef CSS_PROP
+#undef CSS_PROP_LONGHAND
#undef CSS_PROP_PUBLIC_OR_PRIVATE
};
/*
* These are the properties for which domName in the above list should
* be used. They're in the same order as the above list, with some
* items skipped.
*/
const char* gLonghandPropertiesWithDOMProp[] = {
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
-#define CSS_PROP(name_, ...) #name_,
+#define CSS_PROP_LONGHAND(name_, ...) #name_,
-#include "nsCSSPropList.h"
+#include "mozilla/ServoCSSPropList.h"
-#undef CSS_PROP
+#undef CSS_PROP_LONGHAND
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
};
const PropertyInfo gShorthandProperties[] = {
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
-// Need an extra level of macro nesting to force expansion of method_
-// params before they get pasted.
-#define LISTCSSPROPERTIES_INNER_MACRO(method_) #method_
#define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
- { #name_, LISTCSSPROPERTIES_INNER_MACRO(method_), pref_ },
-
-#include "nsCSSPropList.h"
-
-#undef CSS_PROP_SHORTHAND
-#undef LISTCSSPROPERTIES_INNER_MACRO
-#undef CSS_PROP_PUBLIC_OR_PRIVATE
-
+ { #name_, STRINGIFY_METHOD(method_), pref_ },
#define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, pref_) \
{ #name_, #method_, pref_ },
-#include "nsCSSPropAliasList.h"
+#include "mozilla/ServoCSSPropList.h"
#undef CSS_PROP_ALIAS
+#undef CSS_PROP_SHORTHAND
+#undef CSS_PROP_PUBLIC_OR_PRIVATE
};
/* see gLonghandPropertiesWithDOMProp */
const char* gShorthandPropertiesWithDOMProp[] = {
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
#define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
#name_,
+#define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, pref_) \
+ #name_,
-#include "nsCSSPropList.h"
+#include "mozilla/ServoCSSPropList.h"
+#undef CSS_PROP_ALIAS
#undef CSS_PROP_SHORTHAND
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
-#define CSS_PROP_ALIAS(name_, aliasid_, id_, method_, pref_) \
- #name_,
+};
-#include "nsCSSPropAliasList.h"
-
-#undef CSS_PROP_ALIAS
-
-};
+#undef STRINGIFY_METHOD
const char *gInaccessibleProperties[] = {
// Don't print the properties that aren't accepted by the parser, per
// CSSParserImpl::ParseProperty
"-x-cols",
"-x-lang",
"-x-span",
"-x-text-zoom",