зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1448757
part 1 - Add more filters for InspectorUtils.getCSSPropertyNames. r=heycam
MozReview-Commit-ID: 4io5CRLE7op --HG-- extra : rebase_source : bcb3fe53647ee3c0526decff7ad30ac7da0b11d6
This commit is contained in:
Родитель
15041846e1
Коммит
2fe625751b
|
@ -88,6 +88,8 @@ namespace InspectorUtils {
|
|||
|
||||
dictionary PropertyNamesOptions {
|
||||
boolean includeAliases = false;
|
||||
boolean includeShorthands = true;
|
||||
boolean includeExperimentals = false;
|
||||
};
|
||||
|
||||
dictionary InspectorRGBATuple {
|
||||
|
|
|
@ -369,34 +369,37 @@ InspectorUtils::GetCSSPropertyNames(GlobalObject& aGlobalObject,
|
|||
const PropertyNamesOptions& aOptions,
|
||||
nsTArray<nsString>& aResult)
|
||||
{
|
||||
#define DO_PROP(_prop) \
|
||||
PR_BEGIN_MACRO \
|
||||
nsCSSPropertyID cssProp = nsCSSPropertyID(_prop); \
|
||||
if (nsCSSProps::IsEnabled(cssProp, CSSEnabledState::eForAllContent)) { \
|
||||
nsDependentCString name(kCSSRawProperties[_prop]); \
|
||||
aResult.AppendElement(NS_ConvertASCIItoUTF16(name)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
CSSEnabledState enabledState = aOptions.mIncludeExperimentals
|
||||
? CSSEnabledState::eIgnoreEnabledState
|
||||
: CSSEnabledState::eForAllContent;
|
||||
|
||||
auto appendProperty = [enabledState, &aResult](uint32_t prop) {
|
||||
nsCSSPropertyID cssProp = nsCSSPropertyID(prop);
|
||||
if (nsCSSProps::IsEnabled(cssProp, enabledState)) {
|
||||
nsDependentCString name(kCSSRawProperties[prop]);
|
||||
aResult.AppendElement(NS_ConvertASCIItoUTF16(name));
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t prop = 0;
|
||||
for ( ; prop < eCSSProperty_COUNT_no_shorthands; ++prop) {
|
||||
if (nsCSSProps::PropertyParseType(nsCSSPropertyID(prop)) !=
|
||||
CSS_PROPERTY_PARSE_INACCESSIBLE) {
|
||||
DO_PROP(prop);
|
||||
appendProperty(prop);
|
||||
}
|
||||
}
|
||||
|
||||
if (aOptions.mIncludeShorthands) {
|
||||
for ( ; prop < eCSSProperty_COUNT; ++prop) {
|
||||
DO_PROP(prop);
|
||||
appendProperty(prop);
|
||||
}
|
||||
}
|
||||
|
||||
if (aOptions.mIncludeAliases) {
|
||||
for (prop = eCSSProperty_COUNT; prop < eCSSProperty_COUNT_with_aliases; ++prop) {
|
||||
DO_PROP(prop);
|
||||
appendProperty(prop);
|
||||
}
|
||||
}
|
||||
|
||||
#undef DO_PROP
|
||||
}
|
||||
|
||||
static void InsertNoDuplicates(nsTArray<nsString>& aArray,
|
||||
|
|
Загрузка…
Ссылка в новой задаче